From bae28965abb179948ccd50eabdc2c038a58b9b03 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 14 Dec 2016 19:11:01 -0800 Subject: issue #446 apps usability - disable app if attached to a plugin that is uninstalled, allow system apps to be soft deleted and undeleted from the edit pane. --- Zotlabs/Lib/Apps.php | 87 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 65 insertions(+), 22 deletions(-) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index a2f253299..46486bb5a 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -38,6 +38,7 @@ class Apps { if(plugin_is_installed($plugin)) { $x = self::parse_app_description($f,$translate); if($x) { + $x['plugin'] = $plugin; $ret[] = $x; } } @@ -54,7 +55,6 @@ class Apps { return; $apps = self::get_system_apps(false); - self::$installed_system_apps = q("select * from app where app_system = 1 and app_channel = %d", intval(local_channel()) ); @@ -68,7 +68,7 @@ class Apps { if($id !== true) { // if we already installed this app, but it changed, preserve any categories we created $s = ''; - $r = q("select * from term where otype = %d and oid = d", + $r = q("select * from term where otype = %d and oid = %d", intval(TERM_OBJ_APP), intval($id) ); @@ -100,6 +100,8 @@ class Apps { } $notfound = true; foreach(self::$installed_system_apps as $iapp) { + if($app['plugin'] && (! $iapp['app_plugin'])) + return(1); if($iapp['app_id'] == hash('whirlpool',$app['name'])) { $notfound = false; if($iapp['app_version'] != $app['version']) { @@ -238,9 +240,9 @@ class Apps { 'Profile Photo' => t('Profile Photo') ); - if(array_key_exists($arr['name'],$apps)) + if(array_key_exists($arr['name'],$apps)) { $arr['name'] = $apps[$arr['name']]; - + } } @@ -267,6 +269,9 @@ class Apps { self::translate_system_apps($papp); + if(($papp['plugin']) && (! plugin_is_installed($papp['plugin']))) + return ''; + $papp['papp'] = self::papp_encode($papp); if(! strstr($papp['url'],'://')) @@ -339,7 +344,9 @@ class Apps { '$purchase' => (($papp['page'] && (! $installed)) ? t('Purchase') : ''), '$install' => (($hosturl && $mode == 'view') ? $install_action : ''), '$edit' => ((local_channel() && $installed && $mode == 'edit') ? t('Edit') : ''), - '$delete' => ((local_channel() && $installed && $mode == 'edit') ? t('Delete') : '') + '$delete' => ((local_channel() && $installed && $mode == 'edit') ? t('Delete') : ''), + '$undelete' => ((local_channel() && $installed && $mode == 'edit') ? t('Undelete') : ''), + '$deleted' => $papp['deleted'] )); } @@ -359,7 +366,7 @@ class Apps { if($r) { if(! $r[0]['app_system']) { if($app['categories'] && (! $app['term'])) { - $r[0]['term'] = q("select * from term where otype = %d and oid = d", + $r[0]['term'] = q("select * from term where otype = %d and oid = %d", intval(TERM_OBJ_APP), intval($r[0]['id']) ); @@ -382,31 +389,60 @@ class Apps { intval($uid) ); if($x) { - $x[0]['app_deleted'] = 1; - q("delete from term where otype = %d and oid = %d", - intval(TERM_OBJ_APP), - intval($x[0]['id']) - ); - if($x[0]['app_system']) { - $r = q("update app set app_deleted = 1 where app_id = '%s' and app_channel = %d", - dbesc($app['guid']), - intval($uid) + if(! intval($x[0]['app_deleted'])) { + $x[0]['app_deleted'] = 1; + q("delete from term where otype = %d and oid = %d", + intval(TERM_OBJ_APP), + intval($x[0]['id']) ); + if($x[0]['app_system']) { + $r = q("update app set app_deleted = 1 where app_id = '%s' and app_channel = %d", + dbesc($app['guid']), + intval($uid) + ); + } + else { + $r = q("delete from app where app_id = '%s' and app_channel = %d", + dbesc($app['guid']), + intval($uid) + ); + + // we don't sync system apps - they may be completely different on the other system + build_sync_packet($uid,array('app' => $x)); + } } else { - $r = q("delete from app where app_id = '%s' and app_channel = %d", + self::app_undestroy($uid,$app); + } + } + } + } + + + static public function app_undestroy($uid,$app) { + + // undelete a system app + + if($uid && $app['guid']) { + + $x = q("select * from app where app_id = '%s' and app_channel = %d limit 1", + dbesc($app['guid']), + intval($uid) + ); + if($x) { + if($x[0]['app_system']) { + $r = q("update app set app_deleted = 0 where app_id = '%s' and app_channel = %d", dbesc($app['guid']), intval($uid) ); - - // we don't sync system apps - they may be completely different on the other system - build_sync_packet($uid,array('app' => $x)); } } } } + + static public function app_installed($uid,$app) { $r = q("select id from app where app_id = '%s' and app_version = '%s' and app_channel = %d limit 1", @@ -421,7 +457,7 @@ class Apps { static public function app_list($uid, $deleted = false, $cat = '') { if($deleted) - $sql_extra = " and app_deleted = 1 "; + $sql_extra = ""; else $sql_extra = " and app_deleted = 0 "; @@ -494,13 +530,14 @@ class Apps { $darray['app_addr'] = ((x($arr,'addr')) ? escape_tags($arr['addr']) : ''); $darray['app_price'] = ((x($arr,'price')) ? escape_tags($arr['price']) : ''); $darray['app_page'] = ((x($arr,'page')) ? escape_tags($arr['page']) : ''); + $darray['app_plugin'] = ((x($arr,'plugin')) ? escape_tags($arr['plugin']) : ''); $darray['app_requires'] = ((x($arr,'requires')) ? escape_tags($arr['requires']) : ''); $darray['app_system'] = ((x($arr,'system')) ? intval($arr['system']) : 0); $darray['app_deleted'] = ((x($arr,'deleted')) ? intval($arr['deleted']) : 0); $created = datetime_convert(); - $r = q("insert into app ( app_id, app_sig, app_author, app_name, app_desc, app_url, app_photo, app_version, app_channel, app_addr, app_price, app_page, app_requires, app_created, app_edited, app_system, app_deleted ) values ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, %d )", + $r = q("insert into app ( app_id, app_sig, app_author, app_name, app_desc, app_url, app_photo, app_version, app_channel, app_addr, app_price, app_page, app_requires, app_created, app_edited, app_system, app_plugin, app_deleted ) values ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', %d )", dbesc($darray['app_id']), dbesc($darray['app_sig']), dbesc($darray['app_author']), @@ -517,6 +554,7 @@ class Apps { dbesc($created), dbesc($created), intval($darray['app_system']), + dbesc($darray['app_plugin']), intval($darray['app_deleted']) ); if($r) { @@ -569,13 +607,14 @@ class Apps { $darray['app_addr'] = ((x($arr,'addr')) ? escape_tags($arr['addr']) : ''); $darray['app_price'] = ((x($arr,'price')) ? escape_tags($arr['price']) : ''); $darray['app_page'] = ((x($arr,'page')) ? escape_tags($arr['page']) : ''); + $darray['app_plugin'] = ((x($arr,'plugin')) ? escape_tags($arr['plugin']) : ''); $darray['app_requires'] = ((x($arr,'requires')) ? escape_tags($arr['requires']) : ''); $darray['app_system'] = ((x($arr,'system')) ? intval($arr['system']) : 0); $darray['app_deleted'] = ((x($arr,'deleted')) ? intval($arr['deleted']) : 0); $edited = datetime_convert(); - $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', app_edited = '%s', app_system = %d, app_deleted = %d where app_id = '%s' and app_channel = %d", + $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', app_edited = '%s', app_system = %d, app_plugin = '%s', app_deleted = %d where app_id = '%s' and app_channel = %d", dbesc($darray['app_sig']), dbesc($darray['app_author']), dbesc($darray['app_name']), @@ -589,6 +628,7 @@ class Apps { dbesc($darray['app_requires']), dbesc($edited), intval($darray['app_system']), + dbesc($darray['app_plugin']), intval($darray['app_deleted']), dbesc($darray['app_id']), intval($darray['app_channel']) @@ -673,6 +713,9 @@ class Apps { if($app['app_system']) $ret['system'] = $app['app_system']; + if($app['app_plugin']) + $ret['plugin'] = $app['app_plugin']; + if($app['app_deleted']) $ret['deleted'] = $app['app_deleted']; -- cgit v1.2.3 From 4f1e4ffa70f5a822367eafec914ff8853561210d Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 13 Jan 2017 13:22:36 -0800 Subject: several minor app nits --- Zotlabs/Lib/Apps.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 46486bb5a..358ae409b 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -100,15 +100,15 @@ class Apps { } $notfound = true; foreach(self::$installed_system_apps as $iapp) { - if($app['plugin'] && (! $iapp['app_plugin'])) - return(1); if($iapp['app_id'] == hash('whirlpool',$app['name'])) { $notfound = false; - if($iapp['app_version'] != $app['version']) { + if(($iapp['app_version'] != $app['version']) + || ($app['plugin'] && (! $iapp['app_plugin']))) { return intval($iapp['app_id']); } } } + return $notfound; } @@ -503,7 +503,7 @@ class Apps { static public function app_store($arr) { - // logger('app_store: ' . print_r($arr,true)); + //logger('app_store: ' . print_r($arr,true)); $darray = array(); $ret = array('success' => false); @@ -583,6 +583,7 @@ class Apps { static public function app_update($arr) { + //logger('app_update: ' . print_r($arr,true)); $darray = array(); $ret = array('success' => false); -- cgit v1.2.3 From 1627297143b022e8418feb63cc34e1eba1ecb0cd Mon Sep 17 00:00:00 2001 From: Hubzilla Date: Sun, 22 Jan 2017 15:17:37 -0800 Subject: use icons for app photos. --- Zotlabs/Lib/Apps.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 358ae409b..65f5b3556 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -337,9 +337,12 @@ class Apps { } $install_action = (($installed) ? t('Update') : t('Install')); + $icon = ((strpos($papp['photo'],'icon:') === 0) ? substr($papp['photo'],5) : ''); + return replace_macros(get_markup_template('app.tpl'),array( '$app' => $papp, + '$icon' => $icon, '$hosturl' => $hosturl, '$purchase' => (($papp['page'] && (! $installed)) ? t('Purchase') : ''), '$install' => (($hosturl && $mode == 'view') ? $install_action : ''), @@ -514,7 +517,7 @@ class Apps { if((! $darray['app_url']) || (! $darray['app_channel'])) return $ret; - if($arr['photo'] && ! strstr($arr['photo'],z_root())) { + if($arr['photo'] && (strpos($arr['photo'],'icon:') !== 0) && (! strstr($arr['photo'],z_root()))) { $x = import_xchan_photo($arr['photo'],get_observer_hash(),true); $arr['photo'] = $x[1]; } @@ -594,7 +597,7 @@ class Apps { if((! $darray['app_url']) || (! $darray['app_channel']) || (! $darray['app_id'])) return $ret; - if($arr['photo'] && ! strstr($arr['photo'],z_root())) { + if($arr['photo'] && (strpos($arr['photo'],'icon:') !== 0) && (! strstr($arr['photo'],z_root()))) { $x = import_xchan_photo($arr['photo'],get_observer_hash(),true); $arr['photo'] = $x[1]; } -- cgit v1.2.3 From 0d9e12737a90d4f275446969aee07190a173a11b Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 23 Jan 2017 11:36:28 -0800 Subject: remnant code that checked for version to see if an app was installed. We do that differently now. --- Zotlabs/Lib/Apps.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 65f5b3556..2480dde1f 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -448,9 +448,8 @@ class Apps { static public function app_installed($uid,$app) { - $r = q("select id from app where app_id = '%s' and app_version = '%s' and app_channel = %d limit 1", + $r = q("select id from app where app_id = '%s' and app_channel = %d limit 1", dbesc((array_key_exists('guid',$app)) ? $app['guid'] : ''), - dbesc((array_key_exists('version',$app)) ? $app['version'] : ''), intval($uid) ); return(($r) ? true : false); -- cgit v1.2.3 From d0827dbb3c61727deba6fa9c2df3718467274e55 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 30 Jan 2017 15:17:46 +0100 Subject: provide a feature/unfeature app button --- Zotlabs/Lib/Apps.php | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 2480dde1f..64ac16e5b 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -349,7 +349,8 @@ class Apps { '$edit' => ((local_channel() && $installed && $mode == 'edit') ? t('Edit') : ''), '$delete' => ((local_channel() && $installed && $mode == 'edit') ? t('Delete') : ''), '$undelete' => ((local_channel() && $installed && $mode == 'edit') ? t('Undelete') : ''), - '$deleted' => $papp['deleted'] + '$deleted' => $papp['deleted'], + '$featured' => ((strpos($papp['categories'], 'featured') === false) ? false : true) )); } @@ -421,7 +422,6 @@ class Apps { } } - static public function app_undestroy($uid,$app) { // undelete a system app @@ -443,8 +443,27 @@ class Apps { } } + static public function app_feature($uid,$app) { + $r = q("select id from app where app_id = '%s' and app_channel = %d limit 1", + dbesc($app['guid']), + intval($uid) + ); + $x = q("select * from term where otype = %d and oid = %d limit 1", + intval(TERM_OBJ_APP), + intval($r[0]['id']) + ); + if($x) { + q("delete from term where otype = %d and oid = %d", + intval(TERM_OBJ_APP), + intval($x[0]['oid']) + ); + } + else { + store_item_tag($uid,$r[0]['id'],TERM_OBJ_APP,TERM_CATEGORY,'featured',escape_tags(z_root() . '/apps/?f=&cat=featured')); + } + } static public function app_installed($uid,$app) { -- cgit v1.2.3 From a6cbebe03c4c1ca66b4b55c340ebb1d369d93c3a Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 31 Jan 2017 12:53:33 +0100 Subject: hide featured app category in the app category widget --- Zotlabs/Lib/Apps.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 64ac16e5b..4b95a9f5d 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -350,7 +350,7 @@ class Apps { '$delete' => ((local_channel() && $installed && $mode == 'edit') ? t('Delete') : ''), '$undelete' => ((local_channel() && $installed && $mode == 'edit') ? t('Undelete') : ''), '$deleted' => $papp['deleted'], - '$featured' => ((strpos($papp['categories'], 'featured') === false) ? false : true) + '$featured' => ((strpos($papp['categories'], 'nav_featured_app') === false) ? false : true) )); } @@ -461,7 +461,7 @@ class Apps { ); } else { - store_item_tag($uid,$r[0]['id'],TERM_OBJ_APP,TERM_CATEGORY,'featured',escape_tags(z_root() . '/apps/?f=&cat=featured')); + store_item_tag($uid,$r[0]['id'],TERM_OBJ_APP,TERM_CATEGORY,'nav_featured_app',escape_tags(z_root() . '/apps/?f=&cat=nav_featured_app')); } } -- cgit v1.2.3 From 2daafe80a5cc9af9fb40712135490c86155fb9cf Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 2 Feb 2017 14:49:51 -0800 Subject: move opensearch to plugins --- Zotlabs/Lib/Apps.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 4b95a9f5d..595cf33ee 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -159,6 +159,8 @@ class Apps { if(array_key_exists('version',$ret)) $ret['version'] = str_replace(array('\'','"'),array(''','&dquot;'),$ret['version']); + if(array_key_exists('categories',$ret)) + $ret['categories'] = str_replace(array('\'','"'),array(''','&dquot;'),$ret['categories']); if(array_key_exists('requires',$ret)) { $requires = explode(',',$ret['requires']); -- cgit v1.2.3 From dce9a70ff59658249abeb58af46144eea16c721b Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 3 Feb 2017 12:12:05 +0100 Subject: check for app-icons in app_list() instead of app_render() --- Zotlabs/Lib/Apps.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 595cf33ee..c8345e351 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -339,12 +339,9 @@ class Apps { } $install_action = (($installed) ? t('Update') : t('Install')); - $icon = ((strpos($papp['photo'],'icon:') === 0) ? substr($papp['photo'],5) : ''); - return replace_macros(get_markup_template('app.tpl'),array( '$app' => $papp, - '$icon' => $icon, '$hosturl' => $hosturl, '$purchase' => (($papp['page'] && (! $installed)) ? t('Purchase') : ''), '$install' => (($hosturl && $mode == 'view') ? $install_action : ''), @@ -512,8 +509,11 @@ class Apps { intval(TERM_OBJ_APP), intval($r[$x]['id']) ); + + $r[$x]['app_icon'] = ((strpos($r[$x]['app_photo'],'icon:') === 0) ? substr($r[$x]['app_photo'],5) : ''); } } + return($r); } @@ -719,6 +719,9 @@ class Apps { if($app['app_photo']) $ret['photo'] = $app['app_photo']; + if($app['app_icon']) + $ret['icon'] = $app['app_icon']; + if($app['app_version']) $ret['version'] = $app['app_version']; -- cgit v1.2.3 From cf4cdffcc1812f0a09a7990741c0e0351bc4b836 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 6 Feb 2017 10:49:42 +0100 Subject: parse icons in get_system_apps() --- Zotlabs/Lib/Apps.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index c8345e351..455287fb8 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -26,6 +26,7 @@ class Apps { foreach($files as $f) { $x = self::parse_app_description($f,$translate); if($x) { + $x['icon'] = ((strpos($x['photo'],'icon:') === 0) ? substr($x['photo'],5) : ''); $ret[] = $x; } } @@ -39,6 +40,7 @@ class Apps { $x = self::parse_app_description($f,$translate); if($x) { $x['plugin'] = $plugin; + $x['icon'] = ((strpos($x['photo'],'icon:') === 0) ? substr($x['photo'],5) : ''); $ret[] = $x; } } @@ -501,6 +503,7 @@ class Apps { $r = q("select * from app where app_channel = %d $sql_extra order by app_name asc", intval($uid) ); + if($r) { for($x = 0; $x < count($r); $x ++) { if(! $r[$x]['app_system']) -- cgit v1.2.3 From 59baf34170d38f5aa9303d9001c9c0d23a0604ea Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 6 Feb 2017 14:37:33 +0100 Subject: make sure we do not remove other categories on app un-feature --- Zotlabs/Lib/Apps.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 455287fb8..7c07f2974 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -450,13 +450,13 @@ class Apps { intval($uid) ); - $x = q("select * from term where otype = %d and oid = %d limit 1", + $x = q("select * from term where otype = %d and oid = %d and term = 'nav_featured_app' limit 1", intval(TERM_OBJ_APP), intval($r[0]['id']) ); if($x) { - q("delete from term where otype = %d and oid = %d", + q("delete from term where otype = %d and oid = %d and term = 'nav_featured_app'", intval(TERM_OBJ_APP), intval($x[0]['oid']) ); -- cgit v1.2.3 From 70edcabca1e9341b857c469760c88e5c9d318c53 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 6 Feb 2017 20:10:10 +0100 Subject: move icon stuff back to app_render() and send navapps through app_render() --- Zotlabs/Lib/Apps.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 7c07f2974..e40c7ef0e 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -26,7 +26,6 @@ class Apps { foreach($files as $f) { $x = self::parse_app_description($f,$translate); if($x) { - $x['icon'] = ((strpos($x['photo'],'icon:') === 0) ? substr($x['photo'],5) : ''); $ret[] = $x; } } @@ -40,7 +39,6 @@ class Apps { $x = self::parse_app_description($f,$translate); if($x) { $x['plugin'] = $plugin; - $x['icon'] = ((strpos($x['photo'],'icon:') === 0) ? substr($x['photo'],5) : ''); $ret[] = $x; } } @@ -341,9 +339,11 @@ class Apps { } $install_action = (($installed) ? t('Update') : t('Install')); + $icon = ((strpos($papp['photo'],'icon:') === 0) ? substr($papp['photo'],5) : ''); return replace_macros(get_markup_template('app.tpl'),array( '$app' => $papp, + '$icon' => $icon, '$hosturl' => $hosturl, '$purchase' => (($papp['page'] && (! $installed)) ? t('Purchase') : ''), '$install' => (($hosturl && $mode == 'view') ? $install_action : ''), @@ -351,7 +351,8 @@ class Apps { '$delete' => ((local_channel() && $installed && $mode == 'edit') ? t('Delete') : ''), '$undelete' => ((local_channel() && $installed && $mode == 'edit') ? t('Undelete') : ''), '$deleted' => $papp['deleted'], - '$featured' => ((strpos($papp['categories'], 'nav_featured_app') === false) ? false : true) + '$featured' => ((strpos($papp['categories'], 'nav_featured_app') === false) ? false : true), + '$navapps' => ((local_channel() && $installed && $mode == 'nav') ? true : false) )); } @@ -512,8 +513,6 @@ class Apps { intval(TERM_OBJ_APP), intval($r[$x]['id']) ); - - $r[$x]['app_icon'] = ((strpos($r[$x]['app_photo'],'icon:') === 0) ? substr($r[$x]['app_photo'],5) : ''); } } -- cgit v1.2.3 From 5d12c56510dcd13ecf5182452e94183ce1b703b9 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 6 Feb 2017 20:30:02 +0100 Subject: only check for mode --- Zotlabs/Lib/Apps.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index e40c7ef0e..bb0fd9230 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -352,7 +352,7 @@ class Apps { '$undelete' => ((local_channel() && $installed && $mode == 'edit') ? t('Undelete') : ''), '$deleted' => $papp['deleted'], '$featured' => ((strpos($papp['categories'], 'nav_featured_app') === false) ? false : true), - '$navapps' => ((local_channel() && $installed && $mode == 'nav') ? true : false) + '$navapps' => (($mode == 'nav') ? true : false) )); } -- cgit v1.2.3 From 947478ca760d8a59753d9139592ea623a49a3f08 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 6 Feb 2017 14:10:54 -0800 Subject: don't add zid to app links if they're on this system and we're logged in already. This messes up the null arg detection in mod_network. --- Zotlabs/Lib/Apps.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index e40c7ef0e..ee1458aba 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -146,8 +146,11 @@ class Apps { $ret['type'] = 'system'; foreach($ret as $k => $v) { - if(strpos($v,'http') === 0) - $ret[$k] = zid($v); + if(strpos($v,'http') === 0) { + if(! (local_channel() && strpos($v,z_root()) === 0)) { + $ret[$k] = zid($v); + } + } } if(array_key_exists('desc',$ret)) @@ -280,8 +283,11 @@ class Apps { $papp['url'] = z_root() . ((strpos($papp['url'],'/') === 0) ? '' : '/') . $papp['url']; foreach($papp as $k => $v) { - if(strpos($v,'http') === 0 && $k != 'papp') - $papp[$k] = zid($v); + if(strpos($v,'http') === 0 && $k != 'papp') { + if(! (local_channel() && strpos($v,z_root()) === 0)) { + $papp[$k] = zid($v); + } + } if($k === 'desc') $papp['desc'] = str_replace(array('\'','"'),array(''','&dquot;'),$papp['desc']); -- cgit v1.2.3 From ace0a1cb754422da929784b9bd24b4c106d2a66e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 8 Feb 2017 10:56:03 +0100 Subject: do not show feature button if the app is shared. css fixes --- Zotlabs/Lib/Apps.php | 1 + 1 file changed, 1 insertion(+) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 6f23b83ee..0297c3e14 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -357,6 +357,7 @@ class Apps { '$delete' => ((local_channel() && $installed && $mode == 'edit') ? t('Delete') : ''), '$undelete' => ((local_channel() && $installed && $mode == 'edit') ? t('Undelete') : ''), '$deleted' => $papp['deleted'], + '$feature' => ((array_key_exists('categories',$papp)) ? true : false), '$featured' => ((strpos($papp['categories'], 'nav_featured_app') === false) ? false : true), '$navapps' => (($mode == 'nav') ? true : false) )); -- cgit v1.2.3 From eb415fd869b03724b7308320b45b1bdfae6e5142 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 8 Feb 2017 11:17:09 +0100 Subject: better detection of when to show the feature button and document nav mode for app_render() --- Zotlabs/Lib/Apps.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 0297c3e14..1432cbdcf 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -262,6 +262,7 @@ class Apps { * list: normal mode for viewing an app on the app page * no buttons are shown * edit: viewing the app page in editing mode provides a delete button + * nav: render apps for app-bin */ $installed = false; @@ -357,7 +358,7 @@ class Apps { '$delete' => ((local_channel() && $installed && $mode == 'edit') ? t('Delete') : ''), '$undelete' => ((local_channel() && $installed && $mode == 'edit') ? t('Undelete') : ''), '$deleted' => $papp['deleted'], - '$feature' => ((array_key_exists('categories',$papp)) ? true : false), + '$feature' => (($papp['embed']) ? false : true), '$featured' => ((strpos($papp['categories'], 'nav_featured_app') === false) ? false : true), '$navapps' => (($mode == 'nav') ? true : false) )); @@ -769,6 +770,8 @@ class Apps { if(! $embed) return $ret; + $ret['embed'] = true; + if(array_key_exists('categories',$ret)) unset($ret['categories']); -- cgit v1.2.3 From 55924f5c5b147412fda350a3b7c2ecfaef523e19 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 22 Feb 2017 11:22:43 +0100 Subject: apps improvements --- Zotlabs/Lib/Apps.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 1432cbdcf..0ca2f7a99 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -360,7 +360,9 @@ class Apps { '$deleted' => $papp['deleted'], '$feature' => (($papp['embed']) ? false : true), '$featured' => ((strpos($papp['categories'], 'nav_featured_app') === false) ? false : true), - '$navapps' => (($mode == 'nav') ? true : false) + '$navapps' => (($mode == 'nav') ? true : false), + '$add' => t('Add to app-tray'), + '$remove' => t('Remove from app-tray') )); } -- cgit v1.2.3