blob: 244c2adb767992b2b5f3cfc6f78e0d9b634fc148 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
<?php /** @file */
/**
* apps
*
*/
require_once('include/plugin.php');
function get_system_apps() {
$ret = array();
$files = glob('app/*.apd');
if($files) {
foreach($files as $f) {
$x = parse_app_description($f);
if($x) {
$ret[] = $x;
}
}
}
$files = glob('addon/*/*.apd');
if($files) {
foreach($files as $f) {
$n = basename($f,'.apd');
if(plugin_is_installed($n)) {
$x = parse_app_description($f);
if($x) {
$ret[] = $x;
}
}
}
}
return $ret;
}
function parse_app_description($f) {
$ret = array();
$baseurl = z_root();
$channel = get_app()->get_channel();
$address = (($channel) ? $channel['channel_address'] : '');
//future expansion
$observer = get_observer();
$lines = @file($f);
if($lines) {
foreach($lines as $x) {
if(preg_match('/^([a-zA-Z].*?):(.*?)$/ism',$x,$matches)) {
$ret[$matches[1]] = trim(str_replace(array('$baseurl','$nick'),array($baseurl,$address),$matches[2]));
}
}
}
if(! $ret['photo'])
$ret['photo'] = $baseurl . '/' . get_default_profile_photo(80);
return $ret;
}
|