aboutsummaryrefslogtreecommitdiffstats
path: root/include/apps.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/apps.php')
-rw-r--r--include/apps.php136
1 files changed, 76 insertions, 60 deletions
diff --git a/include/apps.php b/include/apps.php
index 135eaa99a..e08e6a6f5 100644
--- a/include/apps.php
+++ b/include/apps.php
@@ -11,7 +11,10 @@ require_once('include/identity.php');
function get_system_apps() {
$ret = array();
- $files = glob('app/*.apd');
+ if(is_dir('apps'))
+ $files = glob('apps/*.apd');
+ else
+ $files = glob('app/*.apd');
if($files) {
foreach($files as $f) {
$x = parse_app_description($f);
@@ -80,35 +83,37 @@ function parse_app_description($f) {
$ret['target'] = str_replace(array('\'','"'),array(''','&dquot;'),$ret['target']);
if(array_key_exists('requires',$ret)) {
- $require = trim(strtolower($ret['requires']));
- switch($require) {
- case 'nologin':
- if(local_user())
- unset($ret);
- break;
- case 'admin':
- if(! is_site_admin())
- unset($ret);
- break;
- case 'local_user':
- if(! local_user())
- unset($ret);
- break;
- case 'public_profile':
- if(! is_public_profile())
- unset($ret);
- break;
- case 'observer':
- if(! $observer)
- unset($ret);
- break;
- default:
- if(! local_user() && feature_enabled(local_user(),$require))
- unset($ret);
- break;
+ $requires = explode(',',$ret['requires']);
+ foreach($requires as $require) {
+ $require = trim(strtolower($require));
+ switch($require) {
+ case 'nologin':
+ if(local_user())
+ unset($ret);
+ break;
+ case 'admin':
+ if(! is_site_admin())
+ unset($ret);
+ break;
+ case 'local_user':
+ if(! local_user())
+ unset($ret);
+ break;
+ case 'public_profile':
+ if(! is_public_profile())
+ unset($ret);
+ break;
+ case 'observer':
+ if(! $observer)
+ unset($ret);
+ break;
+ default:
+ if(! (local_user() && feature_enabled(local_user(),$require)))
+ unset($ret);
+ break;
+ }
}
-// logger('require: ' . print_r($ret,true));
}
if($ret) {
translate_system_apps($ret);
@@ -124,7 +129,7 @@ function translate_system_apps(&$arr) {
'Bookmarks' => t('Bookmarks'),
'Address Book' => t('Address Book'),
'Login' => t('Login'),
- 'Channel Select' => t('Channel Select'),
+ 'Channel Manager' => t('Channel Manager'),
'Matrix' => t('Matrix'),
'Settings' => t('Settings'),
'Files' => t('Files'),
@@ -141,7 +146,13 @@ function translate_system_apps(&$arr) {
'Chat' => t('Chat'),
'Search' => t('Search'),
'Probe' => t('Probe'),
- 'Suggest' => t('Suggest')
+ 'Suggest' => t('Suggest'),
+ 'Random Channel' => t('Random Channel'),
+ 'Invite' => t('Invite'),
+ 'Features' => t('Features'),
+ 'Language' => t('Language'),
+ 'Post' => t('Post'),
+ 'Profile Photo' => t('Profile Photo')
);
if(array_key_exists($arr['name'],$apps))
@@ -180,34 +191,37 @@ function app_render($papp,$mode = 'view') {
$papp['desc'] = str_replace(array('\'','"'),array(''','&dquot;'),$papp['desc']);
if($k === 'requires') {
- $require = trim(strtolower($v));
- switch($require) {
- case 'nologin':
- if(local_user())
- return '';
- break;
- case 'admin':
- if(! is_site_admin())
- return '';
- break;
- case 'local_user':
- if(! local_user())
- return '';
- break;
- case 'public_profile':
- if(! is_public_profile())
- return '';
- break;
- case 'observer':
- $observer = get_app()->get_observer();
- if(! $observer)
- return '';
- break;
- default:
- if(! local_user() && feature_enabled(local_user(),$require))
- return '';
- break;
+ $requires = explode(',',$v);
+ foreach($requires as $require) {
+ $require = trim(strtolower($require));
+ switch($require) {
+ case 'nologin':
+ if(local_user())
+ return '';
+ break;
+ case 'admin':
+ if(! is_site_admin())
+ return '';
+ break;
+ case 'local_user':
+ if(! local_user())
+ return '';
+ break;
+ case 'public_profile':
+ if(! is_public_profile())
+ return '';
+ break;
+ case 'observer':
+ $observer = get_app()->get_observer();
+ if(! $observer)
+ return '';
+ break;
+ default:
+ if(! (local_user() && feature_enabled(local_user(),$require)))
+ return '';
+ break;
+ }
}
}
@@ -258,7 +272,7 @@ function app_install($uid,$app) {
function app_destroy($uid,$app) {
if($uid && $app['guid']) {
- $r = q("delete from app where app_id = '%s' and app_channel = %d limit 1",
+ $r = q("delete from app where app_id = '%s' and app_channel = %d",
dbesc($app['guid']),
intval($uid)
);
@@ -379,7 +393,7 @@ function app_update($arr) {
$darray['app_page'] = ((x($arr,'page')) ? escape_tags($arr['page']) : '');
$darray['app_requires'] = ((x($arr,'requires')) ? escape_tags($arr['requires']) : '');
- $r = q("update app set app_sig = '%s', app_author = '%s', app_name = '%s', app_desc = '%s', app_url = '%s', app_photo = '%s', app_version = '%s', app_addr = '%s', app_price = '%s', app_page = '%s', app_requires = '%s' where app_id = '%s' and app_channel = %d limit 1",
+ $r = q("update app set app_sig = '%s', app_author = '%s', app_name = '%s', app_desc = '%s', app_url = '%s', app_photo = '%s', app_version = '%s', app_addr = '%s', app_price = '%s', app_page = '%s', app_requires = '%s' where app_id = '%s' and app_channel = %d",
dbesc($darray['app_sig']),
dbesc($darray['app_author']),
dbesc($darray['app_name']),
@@ -461,4 +475,6 @@ function app_encode($app,$embed = false) {
function papp_encode($papp) {
return chunk_split(base64_encode(json_encode($papp)),72,"\n");
-} \ No newline at end of file
+}
+
+