From c6abe87ec2e08fc38ff9c505ac2000d52d45c228 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 10 Sep 2018 13:34:05 +0200 Subject: move cards from features to apps --- Zotlabs/Module/Cards.php | 40 +++++++++++++++++++++++----------------- Zotlabs/Widget/Categories.php | 13 ++++++++----- app/cards.apd | 4 ++-- include/features.php | 10 ---------- 4 files changed, 33 insertions(+), 34 deletions(-) diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php index f196988a2..f81d9324f 100644 --- a/Zotlabs/Module/Cards.php +++ b/Zotlabs/Module/Cards.php @@ -1,12 +1,16 @@ Cards App - Not Installed:
'; + $o .= 'Create personal planning cards'; + return $o; } - nav_set_selected(t('Cards')); + nav_set_selected('Cards'); head_add_link([ 'rel' => 'alternate', 'type' => 'application/json+oembed', - 'href' => z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$query_string), + 'href' => z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . App::$query_string), 'title' => 'oembed' ]); @@ -52,7 +58,7 @@ class Cards extends \Zotlabs\Web\Controller { $category = (($_REQUEST['cat']) ? escape_tags(trim($_REQUEST['cat'])) : ''); if($category) { - $sql_extra2 .= protect_sprintf(term_item_parent_query(\App::$profile['profile_uid'], 'item', $category, TERM_CATEGORY)); + $sql_extra2 .= protect_sprintf(term_item_parent_query(App::$profile['profile_uid'], 'item', $category, TERM_CATEGORY)); } @@ -60,11 +66,11 @@ class Cards extends \Zotlabs\Web\Controller { $selected_card = ((argc() > 2) ? argv(2) : ''); - $_SESSION['return_url'] = \App::$query_string; + $_SESSION['return_url'] = App::$query_string; $uid = local_channel(); - $owner = \App::$profile_uid; - $observer = \App::get_observer(); + $owner = App::$profile_uid; + $observer = App::get_observer(); $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); @@ -101,8 +107,8 @@ class Cards extends \Zotlabs\Web\Controller { 'nickname' => $channel['channel_address'], 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), - 'acl' => (($is_owner) ? populate_acl($channel_acl, false, - \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_pages')) : ''), + 'acl' => (($is_owner) ? populate_acl($channel_acl, false, + PermissionDescription::fromGlobalPermission('view_pages')) : ''), 'permissions' => $channel_acl, 'showacl' => (($is_owner) ? true : false), 'visitor' => true, @@ -132,8 +138,8 @@ class Cards extends \Zotlabs\Web\Controller { $itemspage = get_pconfig(local_channel(),'system','itemspage'); - \App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); - $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start'])); + App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); + $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start'])); $sql_extra = item_permissions_sql($owner); @@ -171,7 +177,7 @@ class Cards extends \Zotlabs\Web\Controller { WHERE item.uid = %d $item_normal AND item.parent IN ( %s ) $sql_extra $sql_extra2 ", - intval(\App::$profile['profile_uid']), + intval(App::$profile['profile_uid']), dbesc($parents_str) ); if($items) { diff --git a/Zotlabs/Widget/Categories.php b/Zotlabs/Widget/Categories.php index 9bfa9742a..27d4b5980 100644 --- a/Zotlabs/Widget/Categories.php +++ b/Zotlabs/Widget/Categories.php @@ -2,6 +2,9 @@ namespace Zotlabs\Widget; +use App; +use Zotlabs\Lib\Apps; + require_once('include/contact_widgets.php'); class Categories { @@ -10,22 +13,22 @@ class Categories { $cards = ((array_key_exists('cards',$arr) && $arr['cards']) ? true : false); - if(($cards) && (! feature_enabled(\App::$profile['profile_uid'],'cards'))) + if(($cards) && (! Apps::system_app_installed(App::$profile['profile_uid'], 'Cards'))) return ''; $articles = ((array_key_exists('articles',$arr) && $arr['articles']) ? true : false); - if(($articles) && (! feature_enabled(\App::$profile['profile_uid'],'articles'))) + if(($articles) && (! feature_enabled(App::$profile['profile_uid'],'articles'))) return ''; - if((! \App::$profile['profile_uid']) - || (! perm_is_allowed(\App::$profile['profile_uid'],get_observer_hash(),(($cards || $articles) ? 'view_pages' : 'view_stream')))) { + if((! App::$profile['profile_uid']) + || (! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),(($cards || $articles) ? 'view_pages' : 'view_stream')))) { return ''; } $cat = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat'],ENT_COMPAT,'UTF-8') : ''); - $srchurl = (($cards) ? \App::$argv[0] . '/' . \App::$argv[1] : \App::$query_string); + $srchurl = (($cards) ? App::$argv[0] . '/' . App::$argv[1] : App::$query_string); $srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&'); $srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl); diff --git a/app/cards.apd b/app/cards.apd index 8e2762ff8..ecc61b7f9 100644 --- a/app/cards.apd +++ b/app/cards.apd @@ -1,6 +1,6 @@ -version: 1.1 +version: 1.2 url: $baseurl/cards/$nick name: Cards -requires: local_channel, cards +requires: local_channel photo: icon:list categories: nav_featured_app, Productivity diff --git a/include/features.php b/include/features.php index 03f50c9a4..7e2c9a3ac 100644 --- a/include/features.php +++ b/include/features.php @@ -118,16 +118,6 @@ function get_features($filtered = true, $level = (-1)) { feature_level('private_notes',1), ], - [ - 'cards', - t('Cards'), - t('Create personal planning cards'), - false, - get_config('feature_lock','cards'), - feature_level('cards',1), - ], - - [ 'articles', t('Articles'), -- cgit v1.2.3