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 +++++++++++++++++++++-- Zotlabs/Module/Appman.php | 4 ++++ 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'Zotlabs') 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) { diff --git a/Zotlabs/Module/Appman.php b/Zotlabs/Module/Appman.php index a7631758b..270301d34 100644 --- a/Zotlabs/Module/Appman.php +++ b/Zotlabs/Module/Appman.php @@ -62,6 +62,10 @@ class Appman extends \Zotlabs\Web\Controller { return; } + if($_POST['feature']) { + Zlib\Apps::app_feature(local_channel(),$papp); + } + if($_SESSION['return_url']) goaway(z_root() . '/' . $_SESSION['return_url']); -- cgit v1.2.3 From 7b065365e0d64a06ddfb7ade55e713a4b6a0f802 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 30 Jan 2017 15:01:22 -0800 Subject: consolidate hubloc storage --- Zotlabs/Daemon/Checksites.php | 1 - Zotlabs/Daemon/Cron_daily.php | 1 - Zotlabs/Daemon/Cron_weekly.php | 1 - Zotlabs/Module/Admin/Queue.php | 1 - Zotlabs/Module/Fhublocs.php | 28 +++++++++++++++------------- Zotlabs/Module/Import.php | 33 +++++++++++++++++---------------- 6 files changed, 32 insertions(+), 33 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Checksites.php b/Zotlabs/Daemon/Checksites.php index 991456319..a2081967a 100644 --- a/Zotlabs/Daemon/Checksites.php +++ b/Zotlabs/Daemon/Checksites.php @@ -3,7 +3,6 @@ namespace Zotlabs\Daemon; require_once('include/zot.php'); -require_once('include/hubloc.php'); class Checksites { diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php index a16d49853..0f0001890 100644 --- a/Zotlabs/Daemon/Cron_daily.php +++ b/Zotlabs/Daemon/Cron_daily.php @@ -76,7 +76,6 @@ class Cron_daily { Master::Summon(array('Expire')); Master::Summon(array('Cli_suggest')); - require_once('include/hubloc.php'); remove_obsolete_hublocs(); call_hooks('cron_daily',datetime_convert()); diff --git a/Zotlabs/Daemon/Cron_weekly.php b/Zotlabs/Daemon/Cron_weekly.php index ba4b67ff5..5b185f475 100644 --- a/Zotlabs/Daemon/Cron_weekly.php +++ b/Zotlabs/Daemon/Cron_weekly.php @@ -17,7 +17,6 @@ class Cron_weekly { z_check_cert(); - require_once('include/hubloc.php'); prune_hub_reinstalls(); mark_orphan_hubsxchans(); diff --git a/Zotlabs/Module/Admin/Queue.php b/Zotlabs/Module/Admin/Queue.php index 4986de925..5a47413ee 100644 --- a/Zotlabs/Module/Admin/Queue.php +++ b/Zotlabs/Module/Admin/Queue.php @@ -15,7 +15,6 @@ class Queue { $expert = ((array_key_exists('expert',$_REQUEST)) ? intval($_REQUEST['expert']) : 0); if($_REQUEST['drophub']) { - require_once('hubloc.php'); hubloc_mark_as_down($_REQUEST['drophub']); remove_queue_by_posturl($_REQUEST['drophub']); } diff --git a/Zotlabs/Module/Fhublocs.php b/Zotlabs/Module/Fhublocs.php index cdf323a41..d47ef24db 100644 --- a/Zotlabs/Module/Fhublocs.php +++ b/Zotlabs/Module/Fhublocs.php @@ -56,19 +56,21 @@ class Fhublocs extends \Zotlabs\Web\Controller { // Create a verified hub location pointing to this site. - $h = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_addr, hubloc_primary, hubloc_url, hubloc_url_sig, hubloc_host, hubloc_callback, hubloc_sitekey, hubloc_network ) - values ( '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s' )", - dbesc($rr['channel_guid']), - dbesc($rr['channel_guid_sig']), - dbesc($rr['channel_hash']), - dbesc(channel_reddress($rr)), - intval($primary), - dbesc(z_root()), - dbesc(base64url_encode(rsa_sign(z_root(),$rr['channel_prvkey']))), - dbesc(\App::get_hostname()), - dbesc(z_root() . '/post'), - dbesc($sitekey), - dbesc('zot') + + $h = hubloc_store_lowelevel( + [ + 'hubloc_guid' => $rr['channel_guid'], + 'hubloc_guid_sig' => $rr['channel_guid_sig'], + 'hubloc_hash' => $rr['channel_hash'], + 'hubloc_addr' => channel_reddress($rr), + 'hubloc_network' => 'zot', + 'hubloc_primary' => $primary, + 'hubloc_url' => z_root(), + 'hubloc_url_sig' => base64url_encode(rsa_sign(z_root(),$rr['channel_prvkey'])), + 'hubloc_host' => \App::get_hostname(), + 'hubloc_callback' => z_root() . '/post', + 'hubloc_sitekey' => $sitekey + ] ); if($h) diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php index 6de7c85a2..c28cf8770 100644 --- a/Zotlabs/Module/Import.php +++ b/Zotlabs/Module/Import.php @@ -206,23 +206,24 @@ class Import extends \Zotlabs\Web\Controller { if($completed < 5) { // create new hubloc for the new channel at this site - - $r = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_addr, hubloc_network, hubloc_primary, - hubloc_url, hubloc_url_sig, hubloc_host, hubloc_callback, hubloc_sitekey ) - values ( '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s' )", - dbesc($channel['channel_guid']), - dbesc($channel['channel_guid_sig']), - dbesc($channel['channel_hash']), - dbesc(channel_reddress($channel)), - dbesc('zot'), - intval(($seize) ? 1 : 0), - dbesc(z_root()), - dbesc(base64url_encode(rsa_sign(z_root(),$channel['channel_prvkey']))), - dbesc(\App::get_hostname()), - dbesc(z_root() . '/post'), - dbesc(get_config('system','pubkey')) + + $r = hubloc_store_lowelevel( + [ + 'hubloc_guid' => $channel['channel_guid'], + 'hubloc_guid_sig' => $channel['channel_guid_sig'], + 'hubloc_hash' => $channel['channel_hash'], + 'hubloc_addr' => channel_reddress($channel), + 'hubloc_network' => 'zot', + 'hubloc_primary' => (($seize) ? 1 : 0), + 'hubloc_url' => z_root(), + 'hubloc_url_sig' => base64url_encode(rsa_sign(z_root(),$channel['channel_prvkey'])), + 'hubloc_host' => \App::get_hostname(), + 'hubloc_callback' => z_root() . '/post', + 'hubloc_sitekey' => get_config('system','pubkey'), + 'hubloc_updated' => datetime_convert() + ] ); - + // reset the original primary hubloc if it is being seized if($seize) { -- cgit v1.2.3 From e1b54b684383557159cc25839637c35329fce3cd Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 31 Jan 2017 09:43:58 +0100 Subject: fix typos --- Zotlabs/Module/Fhublocs.php | 2 +- Zotlabs/Module/Import.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Fhublocs.php b/Zotlabs/Module/Fhublocs.php index d47ef24db..42c119da3 100644 --- a/Zotlabs/Module/Fhublocs.php +++ b/Zotlabs/Module/Fhublocs.php @@ -57,7 +57,7 @@ class Fhublocs extends \Zotlabs\Web\Controller { // Create a verified hub location pointing to this site. - $h = hubloc_store_lowelevel( + $h = hubloc_store_lowlevel( [ 'hubloc_guid' => $rr['channel_guid'], 'hubloc_guid_sig' => $rr['channel_guid_sig'], diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php index c28cf8770..52835c685 100644 --- a/Zotlabs/Module/Import.php +++ b/Zotlabs/Module/Import.php @@ -207,7 +207,7 @@ class Import extends \Zotlabs\Web\Controller { if($completed < 5) { // create new hubloc for the new channel at this site - $r = hubloc_store_lowelevel( + $r = hubloc_store_lowlevel( [ 'hubloc_guid' => $channel['channel_guid'], 'hubloc_guid_sig' => $channel['channel_guid_sig'], -- 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') 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