From 9b7c6e96f79ef1b2dc9d71d18db816ffd99f644c Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 23 Sep 2018 20:41:01 +0200 Subject: [PATCH 001/130] only show nav settings icon when hovering over nav --- view/theme/redbasic/css/style.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index a9ea29ba1..c54f571a2 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -1274,6 +1274,14 @@ img.mail-conv-sender-photo { white-space: nowrap; } +#nav-app-settings-link { + opacity: 0; +} + +nav:hover #nav-app-settings-link { + opacity: 1; +} + .page-title { margin: 7px 0px; } From e735220691366fb29276dbc3f47ad0347c40aaf5 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 23 Sep 2018 20:54:36 +0200 Subject: [PATCH 002/130] only explain how to select a channel if there are channels to select --- Zotlabs/Module/Manage.php | 4 ++-- view/tpl/channels.tpl | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Module/Manage.php b/Zotlabs/Module/Manage.php index ea24bbf61..20d5b0449 100644 --- a/Zotlabs/Module/Manage.php +++ b/Zotlabs/Module/Manage.php @@ -129,7 +129,7 @@ class Manage extends \Zotlabs\Web\Controller { } } - + $r = q("select count(channel_id) as total from channel where channel_account_id = %d and channel_removed = 0", intval(get_account_id()) ); @@ -170,7 +170,7 @@ class Manage extends \Zotlabs\Web\Controller { '$header' => t('Channel Manager'), '$msg_selected' => t('Current Channel'), '$selected' => local_channel(), - '$desc' => t('Switch to one of your channels by selecting it.'), + '$desc' => ((count($channels) > 1 || $delegates) ? t('Switch to one of your channels by selecting it.') : ''), '$msg_default' => t('Default Channel'), '$msg_make_default' => t('Make Default'), '$create' => $create, diff --git a/view/tpl/channels.tpl b/view/tpl/channels.tpl index f484b49e5..695b3b30f 100755 --- a/view/tpl/channels.tpl +++ b/view/tpl/channels.tpl @@ -9,9 +9,11 @@ {{$channel_usage_message}} {{/if}} + {{if $desc}} + {{/if}} {{foreach $all_channels as $chn}} {{include file="channel.tpl" channel=$chn}} {{/foreach}} From 995fc63f2caa6d735044b28caf03793f7c275eb1 Mon Sep 17 00:00:00 2001 From: "M.Dent" Date: Sun, 23 Sep 2018 22:36:27 -0400 Subject: [PATCH 003/130] Add filters for addon/app installed checks and docs --- Zotlabs/Lib/Apps.php | 35 ++++++++++++++++++++++--- doc/hook/addon_app_installed_filter.bb | 18 +++++++++++++ doc/hook/app_installed_filter.bb | 17 ++++++++++++ doc/hook/system_app_installed_filter.bb | 18 +++++++++++++ doc/hooklist.bb | 9 +++++++ 5 files changed, 93 insertions(+), 4 deletions(-) create mode 100644 doc/hook/addon_app_installed_filter.bb create mode 100644 doc/hook/app_installed_filter.bb create mode 100644 doc/hook/system_app_installed_filter.bb diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 010947467..4ee64f15e 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -532,7 +532,7 @@ class Apps { static public function app_install($uid,$app) { $app['uid'] = $uid; - if(self::app_installed($uid,$app)) + if(self::app_installed($uid,$app,true)) $x = self::app_update($app); else $x = self::app_store($app); @@ -660,33 +660,60 @@ class Apps { } } - static public function app_installed($uid,$app) { + static public function app_installed($uid,$app,$bypass_filter=false) { $r = q("select id from app where app_id = '%s' and app_channel = %d limit 1", dbesc((array_key_exists('guid',$app)) ? $app['guid'] : ''), intval($uid) ); + if (!$bypass_filter) { + $filter_arr = [ + 'uid'=>$uid, + 'app'=>$app, + 'installed'=>$r + ]; + call_hooks('app_installed_filter',$filter_arr); + $r = $filter_arr['installed']; + } return(($r) ? true : false); } - static public function addon_app_installed($uid,$app) { + static public function addon_app_installed($uid,$app,$bypass_filter=false) { $r = q("select id from app where app_plugin = '%s' and app_channel = %d limit 1", dbesc($app), intval($uid) ); + if (!$bypass_filter) { + $filter_arr = [ + 'uid'=>$uid, + 'app'=>$app, + 'installed'=>$r + ]; + call_hooks('addon_app_installed_filter',$filter_arr); + $r = $filter_arr['installed']; + } return(($r) ? true : false); } - static public function system_app_installed($uid,$app) { + static public function system_app_installed($uid,$app,$bypass_filter=false) { $r = q("select id from app where app_id = '%s' and app_channel = %d limit 1", dbesc(hash('whirlpool',$app)), intval($uid) ); + if (!$bypass_filter) { + $filter_arr = [ + 'uid'=>$uid, + 'app'=>$app, + 'installed'=>$r + ]; + call_hooks('system_app_installed_filter',$filter_arr); + $r = $filter_arr['installed']; + } return(($r) ? true : false); } diff --git a/doc/hook/addon_app_installed_filter.bb b/doc/hook/addon_app_installed_filter.bb new file mode 100644 index 000000000..e610b3205 --- /dev/null +++ b/doc/hook/addon_app_installed_filter.bb @@ -0,0 +1,18 @@ +[h2]addon_app_installed_filter[/h2] + +Allow plugins to filter the result of addon_app_installed. + +Code excerpt: + +[code] + $filter_arr = [ + 'uid'=>$uid, + 'app'=>$app, + 'installed'=>$r + ]; + call_hooks('addon_app_installed_filter',$filter_arr); + $r = $filter_arr['installed']; +[/code] + +cxref: Zotlabs/Lib/Apps.php + diff --git a/doc/hook/app_installed_filter.bb b/doc/hook/app_installed_filter.bb new file mode 100644 index 000000000..f0d91d6f0 --- /dev/null +++ b/doc/hook/app_installed_filter.bb @@ -0,0 +1,17 @@ +[h2]app_installed_filter[/h2] + +Allow plugins to filter the result of app_installed. + +Code excerpt: + +[code] + $filter_arr = [ + 'uid'=>$uid, + 'app'=>$app, + 'installed'=>$r + ]; + call_hooks('app_installed_filter',$filter_arr); + $r = $filter_arr['installed']; +[/code] + +cxref: Zotlabs/Lib/Apps.php diff --git a/doc/hook/system_app_installed_filter.bb b/doc/hook/system_app_installed_filter.bb new file mode 100644 index 000000000..a269a79a8 --- /dev/null +++ b/doc/hook/system_app_installed_filter.bb @@ -0,0 +1,18 @@ +[h2]system_app_installed_filter[/h2] + +Allow plugins to filter the result of system_app_installed. + +Code excerpt: + +[code] + $filter_arr = [ + 'uid'=>$uid, + 'app'=>$app, + 'installed'=>$r + ]; + call_hooks('system_app_installed_filter',$filter_arr); + $r = $filter_arr['installed']; +[/code] + +cxref: Zotlabs/Lib/Apps.php + diff --git a/doc/hooklist.bb b/doc/hooklist.bb index d7fe633ba..b71a28e63 100644 --- a/doc/hooklist.bb +++ b/doc/hooklist.bb @@ -37,6 +37,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the [zrl=[baseurl]/help/hook/activity_order]activity_order[/zrl] Called when generating the list of order options for the network page +[zrl=[baseurl]/help/hook/addon_app_installed_filter]addon_app_installed_filter[/zrl] + Called when determining whether an addon_app is installed + [zrl=[baseurl]/help/hook/activity_received]activity_received[/zrl] Called when an activity (post, comment, like, etc.) has been received from a zot source @@ -49,6 +52,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the [zrl=[baseurl]/help/hook/api_perm_is_allowed]api_perm_is_allowed[/zrl] Called when perm_is_allowed() is executed from an API call. +[zrl=[baseurl]/help/hook/app_installed_filter]app_installed_filter[/zrl] + Called when determining whether an app is installed + [zrl=[baseurl]/help/hook/app_menu]app_menu[/zrl] Called when generating the app_menu dropdown (may be obsolete) @@ -592,6 +598,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the [zrl=[baseurl]/help/hook/stream_item]stream_item[/zrl] Called for each item which is rendered for viewing via conversation() +[zrl=[baseurl]/help/hook/system_app_installed_filter]system_app_installed_filter[/zrl] + Called when determining whether a system app is installed + [zrl=[baseurl]/help/hook/tagged]tagged[/zrl] Called when a delivery is processed which results in you being tagged From 7cadc30914041364663b947d787da6f8b980b894 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 24 Sep 2018 09:33:52 +0200 Subject: [PATCH 004/130] settings for directory and set App::$profile_uid in directory if local_channel() --- Zotlabs/Module/Directory.php | 6 +++++- app/directory.apd | 4 ++-- include/features.php | 23 ++++++++++++++--------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php index 8a7c6baf6..c29fa8326 100644 --- a/Zotlabs/Module/Directory.php +++ b/Zotlabs/Module/Directory.php @@ -12,13 +12,16 @@ class Directory extends \Zotlabs\Web\Controller { function init() { \App::set_pager_itemspage(60); - if(x($_GET,'ignore')) { + if(local_channel() && x($_GET,'ignore')) { q("insert into xign ( uid, xchan ) values ( %d, '%s' ) ", intval(local_channel()), dbesc($_GET['ignore']) ); goaway(z_root() . '/directory?f=&suggest=1'); } + + if(local_channel()) + \App::$profile_uid = local_channel(); $observer = get_observer_hash(); $global_changed = false; @@ -55,6 +58,7 @@ class Directory extends \Zotlabs\Web\Controller { if($observer) set_xconfig($observer,'directory','pubforums',$pubforums); } + } function get() { diff --git a/app/directory.apd b/app/directory.apd index 03a93f042..0c723c16b 100644 --- a/app/directory.apd +++ b/app/directory.apd @@ -1,5 +1,5 @@ -version: 1 -url: $baseurl/directory +version: 1.1 +url: $baseurl/directory, $baseurl/settings/directory name: Directory photo: icon:sitemap categories: nav_featured_app, Networking diff --git a/include/features.php b/include/features.php index 37445c643..c1d2510de 100644 --- a/include/features.php +++ b/include/features.php @@ -113,15 +113,6 @@ function get_features($filtered = true, $level = (-1)) { feature_level('premium_channel',4), ], - [ - 'advanced_dirsearch', - t('Advanced Directory Search'), - t('Allows creation of complex directory search queries'), - false, - get_config('feature_lock','advanced_dirsearch'), - feature_level('advanced_dirsearch',4), - ], - [ 'advanced_theming', t('Advanced Theme and Layout Settings'), @@ -283,6 +274,20 @@ function get_features($filtered = true, $level = (-1)) { ] ], + 'directory' => [ + + t('Directory'), + + [ + 'advanced_dirsearch', + t('Advanced Directory Search'), + t('Allows creation of complex directory search queries'), + false, + get_config('feature_lock','advanced_dirsearch'), + ] + + ], + 'editor' => [ t('Editor'), From 85e06a77af7c81dab185b7a5757564215c41a2ed Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 24 Sep 2018 09:34:28 +0200 Subject: [PATCH 005/130] add file --- Zotlabs/Module/Settings/Directory.php | 43 +++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Zotlabs/Module/Settings/Directory.php diff --git a/Zotlabs/Module/Settings/Directory.php b/Zotlabs/Module/Settings/Directory.php new file mode 100644 index 000000000..2682bcafc --- /dev/null +++ b/Zotlabs/Module/Settings/Directory.php @@ -0,0 +1,43 @@ + $rpath, + '$action_url' => 'settings/' . $module, + '$form_security_token' => get_form_security_token('settings_' . $module), + '$title' => t('Directory Settings'), + '$features' => process_module_features_get(local_channel(), $features), + '$submit' => t('Submit') + )); + + return $o; + } + +} From 4a7c678213fca1ba3f98c96579368062297d425b Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 24 Sep 2018 09:46:19 +0200 Subject: [PATCH 006/130] fade in nav settings button --- view/theme/redbasic/css/style.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index c54f571a2..97f4c67db 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -1280,6 +1280,9 @@ img.mail-conv-sender-photo { nav:hover #nav-app-settings-link { opacity: 1; + transition: opacity .3s ease-in-out; + -moz-transition: opacity .3s ease-in-out; + -webkit-transition: opacity .3s ease-in-out; } .page-title { From b45bd901e05db6cb797f83cb9c0276911b965286 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 24 Sep 2018 10:13:56 +0200 Subject: [PATCH 007/130] move categories from tools to editor settings --- include/features.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/features.php b/include/features.php index c1d2510de..3feb10fbf 100644 --- a/include/features.php +++ b/include/features.php @@ -189,15 +189,6 @@ function get_features($filtered = true, $level = (-1)) { feature_level('commtag',1), ], - [ - 'categories', - t('Post Categories'), - t('Add categories to your posts'), - false, - get_config('feature_lock','categories'), - feature_level('categories',1), - ], - [ 'emojis', t('Emoji Reactions'), @@ -292,6 +283,15 @@ function get_features($filtered = true, $level = (-1)) { t('Editor'), + [ + 'categories', + t('Post Categories'), + t('Add categories to your posts'), + false, + get_config('feature_lock','categories'), + feature_level('categories',1), + ], + [ 'large_photos', t('Large Photos'), From c3aa15cc165730b6e67de580065ace255454dfb5 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 24 Sep 2018 11:46:18 +0200 Subject: [PATCH 008/130] appification of notes --- Zotlabs/Module/Notes.php | 41 +++++++++++++++++++++++++++++++++------- Zotlabs/Widget/Notes.php | 14 ++++++++++---- app/notes.apd | 6 ++++++ include/features.php | 19 ------------------- view/tpl/notes.tpl | 11 +++++++++++ 5 files changed, 61 insertions(+), 30 deletions(-) create mode 100644 app/notes.apd diff --git a/Zotlabs/Module/Notes.php b/Zotlabs/Module/Notes.php index e530e6ff4..cd383a6c2 100644 --- a/Zotlabs/Module/Notes.php +++ b/Zotlabs/Module/Notes.php @@ -1,13 +1,19 @@ true); if(array_key_exists('note_text',$_REQUEST)) { @@ -24,17 +30,38 @@ class Notes extends \Zotlabs\Web\Controller { } set_pconfig(local_channel(),'notes','text',$body); } - + // push updates to channel clones - + if((argc() > 1) && (argv(1) === 'sync')) { require_once('include/zot.php'); build_sync_packet(); } - + logger('notes saved.', LOGGER_DEBUG); json_return_and_die($ret); - + + } + + function get() { + + if(! local_channel()) + return EMPTY_STR; + + if(! Apps::system_app_installed(local_channel(), 'Notes')) { + //Do not display any associated widgets at this point + App::$pdl = EMPTY_STR; + + $o = 'Notes App (Not Installed):
'; + $o .= t('A simple notes app with a widget (note: notes are not encrypted)'); + return $o; + } + + $w = new \Zotlabs\Widget\Notes; + $arr = ['app' => true]; + + return $w->widget($arr); + } } diff --git a/Zotlabs/Widget/Notes.php b/Zotlabs/Widget/Notes.php index 5c83a550f..238008d81 100644 --- a/Zotlabs/Widget/Notes.php +++ b/Zotlabs/Widget/Notes.php @@ -2,20 +2,26 @@ namespace Zotlabs\Widget; +use Zotlabs\Lib\Apps; + class Notes { function widget($arr) { if(! local_channel()) - return ''; - if(! feature_enabled(local_channel(),'private_notes')) - return ''; + return EMPTY_STR; + + if(! Apps::system_app_installed(local_channel(), 'Notes')) + return EMPTY_STR; $text = get_pconfig(local_channel(),'notes','text'); - $o = replace_macros(get_markup_template('notes.tpl'), array( + $tpl = get_markup_template('notes.tpl'); + + $o = replace_macros($tpl, array( '$banner' => t('Notes'), '$text' => $text, '$save' => t('Save'), + '$app' => ((isset($arr['app'])) ? true : false) )); return $o; diff --git a/app/notes.apd b/app/notes.apd new file mode 100644 index 000000000..ba7e2bbc1 --- /dev/null +++ b/app/notes.apd @@ -0,0 +1,6 @@ +version: 1 +url: $baseurl/notes +requires: local_channel +name: Notes +photo: icon:sticky-note-o +categories: Personal, Productivity diff --git a/include/features.php b/include/features.php index 3feb10fbf..4c865f406 100644 --- a/include/features.php +++ b/include/features.php @@ -85,25 +85,6 @@ function get_features($filtered = true, $level = (-1)) { feature_level('start_menu',1), ], -/* - [ - 'hide_rating', - t('Hide Rating'), - t('Hide the rating buttons on your channel and profile pages. Note: People can still rate you somewhere else.'), - false, - get_config('feature_lock','hide_rating'), - feature_level('hide_rating',3), - ], -*/ - [ - 'private_notes', - t('Private Notes'), - t('Enables a tool to store notes and reminders (note: not encrypted)'), - false, - get_config('feature_lock','private_notes'), - feature_level('private_notes',1), - ], - [ 'premium_channel', t('Premium Channel'), diff --git a/view/tpl/notes.tpl b/view/tpl/notes.tpl index c6d5d8a73..67da5ff37 100644 --- a/view/tpl/notes.tpl +++ b/view/tpl/notes.tpl @@ -1,5 +1,13 @@ +{{if $app}} +
+
+

{{$banner}}

+
+
+{{else}}

{{$banner}}

+{{/if}} +{{if $app}} +
+{{/if}}
From c748230b35b16cdf1558671b26a49af41b253876 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 24 Sep 2018 11:51:20 +0200 Subject: [PATCH 009/130] revert nav settings opacity --- view/theme/redbasic/css/style.css | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 97f4c67db..a9ea29ba1 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -1274,17 +1274,6 @@ img.mail-conv-sender-photo { white-space: nowrap; } -#nav-app-settings-link { - opacity: 0; -} - -nav:hover #nav-app-settings-link { - opacity: 1; - transition: opacity .3s ease-in-out; - -moz-transition: opacity .3s ease-in-out; - -webkit-transition: opacity .3s ease-in-out; -} - .page-title { margin: 7px 0px; } From 4c58a5cef278357c1bc31b76cfbd2719e3338398 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 25 Sep 2018 10:06:24 +0200 Subject: [PATCH 010/130] premium channel app --- Zotlabs/Module/Connect.php | 68 ++++++++++++++++++++++---------- Zotlabs/Widget/Settings_menu.php | 19 +-------- include/features.php | 9 ----- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/Zotlabs/Module/Connect.php b/Zotlabs/Module/Connect.php index cd43ea290..7194e7039 100644 --- a/Zotlabs/Module/Connect.php +++ b/Zotlabs/Module/Connect.php @@ -1,21 +1,21 @@ 1) $which = argv(1); else { notice( t('Requested profile is not available.') . EOL ); - \App::$error = 404; + App::$error = 404; return; } @@ -24,20 +24,32 @@ class Connect extends \Zotlabs\Web\Controller { ); if($r) - \App::$data['channel'] = $r[0]; + App::$data['channel'] = $r[0]; + + $channel_id = App::$data['channel']['channel_id']; + + if(! Apps::system_app_installed($channel_id, 'Premium Channel')) { + return; + } profile_load($which,''); } function post() { - if(! array_key_exists('channel', \App::$data)) + if(! array_key_exists('channel', App::$data)) return; + + $channel_id = App::$data['channel']['channel_id']; + + if(! Apps::system_app_installed($channel_id, 'Premium Channel')) { + return; + } - $edit = ((local_channel() && (local_channel() == \App::$data['channel']['channel_id'])) ? true : false); + $edit = ((local_channel() && (local_channel() == $channel_id)) ? true : false); if($edit) { - $has_premium = ((\App::$data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? 1 : 0); + $has_premium = ((App::$data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? 1 : 0); $premium = (($_POST['premium']) ? intval($_POST['premium']) : 0); $text = escape_tags($_POST['text']); @@ -48,25 +60,25 @@ class Connect extends \Zotlabs\Web\Controller { intval(local_channel()) ); - \Zotlabs\Daemon\Master::Summon(array('Notifier','refresh_all',\App::$data['channel']['channel_id'])); + \Zotlabs\Daemon\Master::Summon(array('Notifier','refresh_all',$channel_id)); } - set_pconfig(\App::$data['channel']['channel_id'],'system','selltext',$text); + set_pconfig($channel_id,'system','selltext',$text); // reload the page completely to get fresh data - goaway(z_root() . '/' . \App::$query_string); + goaway(z_root() . '/' . App::$query_string); } $url = ''; - $observer = \App::get_observer(); + $observer = App::get_observer(); if(($observer) && ($_POST['submit'] === t('Continue'))) { if($observer['xchan_follow']) - $url = sprintf($observer['xchan_follow'],urlencode(channel_reddress(\App::$data['channel']))); + $url = sprintf($observer['xchan_follow'],urlencode(channel_reddress(App::$data['channel']))); if(! $url) { $r = q("select * from hubloc where hubloc_hash = '%s' order by hubloc_id desc limit 1", dbesc($observer['xchan_hash']) ); if($r) - $url = $r[0]['hubloc_url'] . '/follow?f=&url=' . urlencode(channel_reddress(\App::$data['channel'])); + $url = $r[0]['hubloc_url'] . '/follow?f=&url=' . urlencode(channel_reddress(App::$data['channel'])); } } if($url) @@ -79,17 +91,31 @@ class Connect extends \Zotlabs\Web\Controller { function get() { + + if(! array_key_exists('channel', App::$data)) + return; + + $channel_id = App::$data['channel']['channel_id']; + + if(! Apps::system_app_installed($channel_id, 'Premium Channel')) { + //Do not display any associated widgets at this point + App::$pdl = ''; + + $o = 'Premium Channel App (Not Installed):
'; + $o .= t('Allows you to set restrictions and terms on those that connect with your channel'); + return $o; + } - $edit = ((local_channel() && (local_channel() == \App::$data['channel']['channel_id'])) ? true : false); + $edit = ((local_channel() && (local_channel() == $channel_id)) ? true : false); - $text = get_pconfig(\App::$data['channel']['channel_id'],'system','selltext'); + $text = get_pconfig($channel_id,'system','selltext'); if($edit) { $o = replace_macros(get_markup_template('sellpage_edit.tpl'),array( '$header' => t('Premium Channel Setup'), - '$address' => \App::$data['channel']['channel_address'], - '$premium' => array('premium', t('Enable premium channel connection restrictions'),((\App::$data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? '1' : ''),''), + '$address' => App::$data['channel']['channel_address'], + '$premium' => array('premium', t('Enable premium channel connection restrictions'),((App::$data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? '1' : ''),''), '$lbl_about' => t('Please enter your restrictions or conditions, such as paypal receipt, usage guidelines, etc.'), '$text' => $text, '$desc' => t('This channel may require additional steps or acknowledgement of the following conditions prior to connecting:'), @@ -107,7 +133,7 @@ class Connect extends \Zotlabs\Web\Controller { $submit = replace_macros(get_markup_template('sellpage_submit.tpl'), array( '$continue' => t('Continue'), - '$address' => \App::$data['channel']['channel_address'] + '$address' => App::$data['channel']['channel_address'] )); $o = replace_macros(get_markup_template('sellpage_view.tpl'),array( @@ -120,7 +146,7 @@ class Connect extends \Zotlabs\Web\Controller { )); - $arr = array('channel' => \App::$data['channel'],'observer' => \App::get_observer(), 'sellpage' => $o, 'submit' => $submit); + $arr = array('channel' => App::$data['channel'],'observer' => App::get_observer(), 'sellpage' => $o, 'submit' => $submit); call_hooks('connect_premium', $arr); $o = $arr['sellpage']; diff --git a/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php index f35d6f147..1b96e4d14 100644 --- a/Zotlabs/Widget/Settings_menu.php +++ b/Zotlabs/Widget/Settings_menu.php @@ -111,7 +111,6 @@ class Settings_menu { ); } - if($role === false || $role === 'custom') { $tabs[] = array( 'label' => t('Connection Default Permissions'), @@ -120,22 +119,6 @@ class Settings_menu { ); } - if(feature_enabled(local_channel(),'premium_channel')) { - $tabs[] = array( - 'label' => t('Premium Channel Settings'), - 'url' => z_root() . '/connect/' . $channel['channel_address'], - 'selected' => '' - ); - } - - if(feature_enabled(local_channel(),'channel_sources')) { - $tabs[] = array( - 'label' => t('Channel Sources'), - 'url' => z_root() . '/sources', - 'selected' => '' - ); - } - $tabtpl = get_markup_template("generic_links_widget.tpl"); return replace_macros($tabtpl, array( '$title' => t('Settings'), @@ -144,4 +127,4 @@ class Settings_menu { )); } -} \ No newline at end of file +} diff --git a/include/features.php b/include/features.php index 4c865f406..35c526c3e 100644 --- a/include/features.php +++ b/include/features.php @@ -85,15 +85,6 @@ function get_features($filtered = true, $level = (-1)) { feature_level('start_menu',1), ], - [ - 'premium_channel', - t('Premium Channel'), - t('Allows you to set restrictions and terms on those that connect with your channel'), - false, - get_config('feature_lock','premium_channel'), - feature_level('premium_channel',4), - ], - [ 'advanced_theming', t('Advanced Theme and Layout Settings'), From 39866b74637a58df5b1ffb8f2b6f164849d65315 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 25 Sep 2018 11:37:22 +0200 Subject: [PATCH 011/130] move start_menu switch to settings/display for now --- Zotlabs/Module/Settings/Display.php | 12 +++++++++++- Zotlabs/Widget/Newmember.php | 9 ++++++++- include/features.php | 9 --------- view/tpl/settings_display.tpl | 1 + 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index 340b3c0bb..dbc383135 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -30,6 +30,7 @@ class Display { $channel_list_mode = ((x($_POST,'channel_list_mode')) ? intval($_POST['channel_list_mode']) : 0); $network_list_mode = ((x($_POST,'network_list_mode')) ? intval($_POST['network_list_mode']) : 0); $manual_update = ((array_key_exists('manual_update',$_POST)) ? intval($_POST['manual_update']) : 0); + $start_menu = ((x($_POST,'start_menu')) ? intval($_POST['start_menu']) : 0); $channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400); if($channel_divmore_height < 50) @@ -60,6 +61,7 @@ class Display { set_pconfig(local_channel(),'system','network_divmore_height', $network_divmore_height); set_pconfig(local_channel(),'system','manual_conversation_update', $manual_update); set_pconfig(local_channel(),'system','channel_menu', $channel_menu); + set_pconfig(local_channel(),'system','start_menu', $start_menu); $newschema = ''; if($theme){ @@ -150,6 +152,14 @@ class Display { $theme_selected = explode(':', $theme_selected)[0]; } + $account = \App::get_account(); + + if($account['account_created'] > datetime_convert('','','now - 60 days')) { + $start_menu = get_pconfig(local_channel(), 'system', 'start_menu', 1); + } + else { + $start_menu = get_pconfig(local_channel(), 'system', 'start_menu', 0); + } $preload_images = get_pconfig(local_channel(),'system','preload_images'); $preload_images = (($preload_images===false)? '0': $preload_images); // default if not set: 0 @@ -211,7 +221,7 @@ class Display { '$network_list_mode' => array('network_list_mode', t('Use blog/list mode on grid page'), get_pconfig(local_channel(),'system','network_list_mode'), t('(comments displayed separately)'), $yes_no), '$channel_divmore_height' => array('channel_divmore_height', t('Channel page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','channel_divmore_height')) ? get_pconfig(local_channel(),'system','channel_divmore_height') : 400), t('click to expand content exceeding this height')), '$network_divmore_height' => array('network_divmore_height', t('Grid page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','network_divmore_height')) ? get_pconfig(local_channel(),'system','network_divmore_height') : 400) , t('click to expand content exceeding this height')), - + '$start_menu' => ['start_menu', t('New Member Links'), $start_menu, t('Display new member quick links menu'), $yes_no] )); diff --git a/Zotlabs/Widget/Newmember.php b/Zotlabs/Widget/Newmember.php index 1a4b575b9..e57cf5171 100644 --- a/Zotlabs/Widget/Newmember.php +++ b/Zotlabs/Widget/Newmember.php @@ -17,7 +17,14 @@ class Newmember { if(! $a) return EMPTY_STR; - if(! feature_enabled(local_channel(),'start_menu')) + if($a['account_created'] > datetime_convert('','','now - 60 days')) { + $enabled = get_pconfig(local_channel(), 'system', 'start_menu', 1); + } + else { + $enabled = get_pconfig(local_channel(), 'system', 'start_menu', 0); + } + + if(! $enabled) return EMPTY_STR; $options = [ diff --git a/include/features.php b/include/features.php index 35c526c3e..f6ab7d142 100644 --- a/include/features.php +++ b/include/features.php @@ -76,15 +76,6 @@ function get_features($filtered = true, $level = (-1)) { t('General Features'), - [ - 'start_menu', - t('New Member Links'), - t('Display new member quick links menu'), - (($account['account_created'] > datetime_convert('','','now - 60 days')) ? true : false), - get_config('feature_lock','start_menu'), - feature_level('start_menu',1), - ], - [ 'advanced_theming', t('Advanced Theme and Layout Settings'), diff --git a/view/tpl/settings_display.tpl b/view/tpl/settings_display.tpl index 7600038ea..1500ea0d3 100755 --- a/view/tpl/settings_display.tpl +++ b/view/tpl/settings_display.tpl @@ -68,6 +68,7 @@ {{include file="field_checkbox.tpl" field=$user_scalable}} {{include file="field_checkbox.tpl" field=$preload_images}} {{include file="field_checkbox.tpl" field=$manual_update}} + {{include file="field_checkbox.tpl" field=$start_menu}} {{if $expert}}
{{$layout_editor}} From 9bb0f1d18ece05ac1d37800c61d0b071f560dac3 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 25 Sep 2018 12:02:00 +0200 Subject: [PATCH 012/130] move advanced_theming switch to settings/display for now --- Zotlabs/Module/Settings/Display.php | 11 ++++++++--- view/theme/redbasic/php/config.php | 2 +- view/tpl/settings_display.tpl | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index dbc383135..d35c54a90 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -30,7 +30,8 @@ class Display { $channel_list_mode = ((x($_POST,'channel_list_mode')) ? intval($_POST['channel_list_mode']) : 0); $network_list_mode = ((x($_POST,'network_list_mode')) ? intval($_POST['network_list_mode']) : 0); $manual_update = ((array_key_exists('manual_update',$_POST)) ? intval($_POST['manual_update']) : 0); - $start_menu = ((x($_POST,'start_menu')) ? intval($_POST['start_menu']) : 0); + $start_menu = ((x($_POST,'start_menu')) ? intval($_POST['start_menu']) : 0); + $advanced_theming = ((x($_POST,'advanced_theming')) ? intval($_POST['advanced_theming']) : 0); $channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400); if($channel_divmore_height < 50) @@ -62,6 +63,7 @@ class Display { set_pconfig(local_channel(),'system','manual_conversation_update', $manual_update); set_pconfig(local_channel(),'system','channel_menu', $channel_menu); set_pconfig(local_channel(),'system','start_menu', $start_menu); + set_pconfig(local_channel(),'system','advanced_theming', $advanced_theming); $newschema = ''; if($theme){ @@ -179,6 +181,8 @@ class Display { $title_tosource = get_pconfig(local_channel(),'system','title_tosource'); $title_tosource = (($title_tosource===false)? '0': $title_tosource); // default if not set: 0 + $advanced_theming = get_pconfig(local_channel(),'system','advanced_theming', 0); + $theme_config = ""; if(($themeconfigfile = $this->get_theme_config_file($theme)) != null){ require_once($themeconfigfile); @@ -216,12 +220,13 @@ class Display { '$title_tosource' => array('title_tosource', t("Link post titles to source"), $title_tosource, '', $yes_no), '$layout_editor' => t('System Page Layout Editor - (advanced)'), '$theme_config' => $theme_config, - '$expert' => feature_enabled(local_channel(),'advanced_theming'), + '$expert' => $advanced_theming, '$channel_list_mode' => array('channel_list_mode', t('Use blog/list mode on channel page'), get_pconfig(local_channel(),'system','channel_list_mode'), t('(comments displayed separately)'), $yes_no), '$network_list_mode' => array('network_list_mode', t('Use blog/list mode on grid page'), get_pconfig(local_channel(),'system','network_list_mode'), t('(comments displayed separately)'), $yes_no), '$channel_divmore_height' => array('channel_divmore_height', t('Channel page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','channel_divmore_height')) ? get_pconfig(local_channel(),'system','channel_divmore_height') : 400), t('click to expand content exceeding this height')), '$network_divmore_height' => array('network_divmore_height', t('Grid page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','network_divmore_height')) ? get_pconfig(local_channel(),'system','network_divmore_height') : 400) , t('click to expand content exceeding this height')), - '$start_menu' => ['start_menu', t('New Member Links'), $start_menu, t('Display new member quick links menu'), $yes_no] + '$start_menu' => ['start_menu', t('New Member Links'), $start_menu, t('Display new member quick links menu'), $yes_no], + '$advanced_theming' => ['advanced_theming', t('Advanced Theme and Layout Settings'), $advanced_theming, t('Allows fine tuning of themes and page layouts'), $yes_no] )); diff --git a/view/theme/redbasic/php/config.php b/view/theme/redbasic/php/config.php index f98182739..ae926d07b 100644 --- a/view/theme/redbasic/php/config.php +++ b/view/theme/redbasic/php/config.php @@ -85,7 +85,7 @@ class RedbasicConfig { function form($arr) { - if(feature_enabled(local_channel(),'advanced_theming')) + if(get_pconfig(local_channel(), 'system', 'advanced_theming')) $expert = 1; diff --git a/view/tpl/settings_display.tpl b/view/tpl/settings_display.tpl index 1500ea0d3..ee0e137b5 100755 --- a/view/tpl/settings_display.tpl +++ b/view/tpl/settings_display.tpl @@ -69,6 +69,7 @@ {{include file="field_checkbox.tpl" field=$preload_images}} {{include file="field_checkbox.tpl" field=$manual_update}} {{include file="field_checkbox.tpl" field=$start_menu}} + {{include file="field_checkbox.tpl" field=$advanced_theming}} {{if $expert}}
{{$layout_editor}} From 65423b1768b485452e1f8bad4a1be2625f7a0350 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 25 Sep 2018 12:02:48 +0200 Subject: [PATCH 013/130] get rid of general features --- include/features.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/include/features.php b/include/features.php index f6ab7d142..12b0ed787 100644 --- a/include/features.php +++ b/include/features.php @@ -71,22 +71,6 @@ function get_features($filtered = true, $level = (-1)) { $arr = [ - // General - 'general' => [ - - t('General Features'), - - [ - 'advanced_theming', - t('Advanced Theme and Layout Settings'), - t('Allows fine tuning of themes and page layouts'), - false, - get_config('feature_lock','advanced_theming'), - feature_level('advanced_theming',4), - ], - ], - - 'access_control' => [ t('Access Control and Permissions'), From 0722775038121905b04af9601b55075ddf574bf3 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 25 Sep 2018 12:22:43 +0200 Subject: [PATCH 014/130] missing file --- app/premium_channel.apd | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 app/premium_channel.apd diff --git a/app/premium_channel.apd b/app/premium_channel.apd new file mode 100644 index 000000000..263dd5701 --- /dev/null +++ b/app/premium_channel.apd @@ -0,0 +1,6 @@ +version: 1 +url: $baseurl/connect/$nick +requires: local_channel +name: Premium Channel +photo: icon:check-circle-o +categories: Networking From 9948bb3f2aa3bf3efa68623b87ba854fb59b4926 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 25 Sep 2018 12:59:53 +0200 Subject: [PATCH 015/130] appification of privacy groups --- Zotlabs/Module/Group.php | 29 ++++++++++++++++++++++++----- Zotlabs/Widget/Activity_filter.php | 4 +++- include/features.php | 9 --------- include/group.php | 2 +- include/nav.php | 2 +- 5 files changed, 29 insertions(+), 17 deletions(-) diff --git a/Zotlabs/Module/Group.php b/Zotlabs/Module/Group.php index acebe995d..bf0edb1ed 100644 --- a/Zotlabs/Module/Group.php +++ b/Zotlabs/Module/Group.php @@ -1,11 +1,13 @@ Privacy Groups App (Not Installed):
'; + $o .= t('Management of privacy groups'); + return $o; + } + // Switch to text mode interface if we have more than 'n' contacts or group members $switchtotext = get_pconfig(local_channel(),'system','groupedit_image_limit'); if($switchtotext === false) diff --git a/Zotlabs/Widget/Activity_filter.php b/Zotlabs/Widget/Activity_filter.php index d725f8b55..912bfce49 100644 --- a/Zotlabs/Widget/Activity_filter.php +++ b/Zotlabs/Widget/Activity_filter.php @@ -2,6 +2,8 @@ namespace Zotlabs\Widget; +use Zotlabs\Lib\Apps; + class Activity_filter { function widget($arr) { @@ -44,7 +46,7 @@ class Activity_filter { ]; } - if(feature_enabled(local_channel(),'groups')) { + if(Apps::system_app_installed(local_channel(), 'Privacy Groups')) { $groups = q("SELECT * FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC", intval(local_channel()) ); diff --git a/include/features.php b/include/features.php index 12b0ed787..0da6a9725 100644 --- a/include/features.php +++ b/include/features.php @@ -74,15 +74,6 @@ function get_features($filtered = true, $level = (-1)) { 'access_control' => [ t('Access Control and Permissions'), - [ - 'groups', - t('Privacy Groups'), - t('Enable management and selection of privacy groups'), - true, - get_config('feature_lock','groups'), - feature_level('groups',0), - ], - [ 'permcats', t('Permission Categories'), diff --git a/include/group.php b/include/group.php index 56bf210ff..79d70aca4 100644 --- a/include/group.php +++ b/include/group.php @@ -274,7 +274,7 @@ function group_side($every="connections",$each="group",$edit = false, $group_id $o = ''; - if(! (local_channel() && feature_enabled(local_channel(),'groups'))) { + if(! (local_channel() && \Zotlabs\Lib\Apps::system_app_installed(local_channel(), 'Privacy Groups'))) { return ''; } diff --git a/include/nav.php b/include/nav.php index 1eef8dc07..988a07b7c 100644 --- a/include/nav.php +++ b/include/nav.php @@ -93,7 +93,7 @@ function nav($template = 'default') { if(! $_SESSION['delegate']) { $nav['manage'] = array('manage', t('Channel Manager'), "", t('Manage your channels'),'manage_nav_btn'); } - if(feature_enabled(local_channel(),'groups')) + if(Apps::system_app_installed(local_channel(), 'Privacy Groups')) $nav['group'] = array('group', t('Privacy Groups'),"", t('Manage your privacy groups'),'group_nav_btn'); $nav['settings'] = array('settings', t('Settings'),"", t('Account/Channel Settings'),'settings_nav_btn'); From 9bc76b425948e7a6118e7749a3eb7c08c447bab3 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 26 Sep 2018 15:02:20 +0200 Subject: [PATCH 016/130] appification of the pdl editor and move advanced_theming to theme settings where it belongs --- Zotlabs/Module/Pdledit.php | 21 +++++++++++++++------ Zotlabs/Module/Settings/Display.php | 10 +--------- app/pdledit.apd | 6 ++++++ view/theme/redbasic/php/config.php | 6 ++++-- view/theme/redbasic/tpl/theme_settings.tpl | 1 + view/tpl/settings_display.tpl | 6 ------ 6 files changed, 27 insertions(+), 23 deletions(-) create mode 100644 app/pdledit.apd diff --git a/Zotlabs/Module/Pdledit.php b/Zotlabs/Module/Pdledit.php index 9b86b599b..d0bde7715 100644 --- a/Zotlabs/Module/Pdledit.php +++ b/Zotlabs/Module/Pdledit.php @@ -1,15 +1,20 @@ PDL Editor App (Not Installed):
'; + $o .= t('Provides the ability to edit system page layouts'); + return $o; } if(argc() > 2 && argv(2) === 'reset') { diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index d35c54a90..0c63a3056 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -31,7 +31,6 @@ class Display { $network_list_mode = ((x($_POST,'network_list_mode')) ? intval($_POST['network_list_mode']) : 0); $manual_update = ((array_key_exists('manual_update',$_POST)) ? intval($_POST['manual_update']) : 0); $start_menu = ((x($_POST,'start_menu')) ? intval($_POST['start_menu']) : 0); - $advanced_theming = ((x($_POST,'advanced_theming')) ? intval($_POST['advanced_theming']) : 0); $channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400); if($channel_divmore_height < 50) @@ -63,7 +62,6 @@ class Display { set_pconfig(local_channel(),'system','manual_conversation_update', $manual_update); set_pconfig(local_channel(),'system','channel_menu', $channel_menu); set_pconfig(local_channel(),'system','start_menu', $start_menu); - set_pconfig(local_channel(),'system','advanced_theming', $advanced_theming); $newschema = ''; if($theme){ @@ -181,8 +179,6 @@ class Display { $title_tosource = get_pconfig(local_channel(),'system','title_tosource'); $title_tosource = (($title_tosource===false)? '0': $title_tosource); // default if not set: 0 - $advanced_theming = get_pconfig(local_channel(),'system','advanced_theming', 0); - $theme_config = ""; if(($themeconfigfile = $this->get_theme_config_file($theme)) != null){ require_once($themeconfigfile); @@ -218,16 +214,12 @@ class Display { '$channel_menu' => [ 'channel_menu', t('Provide channel menu in navigation bar'), get_pconfig(local_channel(),'system','channel_menu',get_config('system','channel_menu',0)), t('Default: channel menu located in app menu'),$yes_no ], '$manual_update' => array('manual_update', t('Manual conversation updates'), channel_manual_conv_update(local_channel()), t('Default is on, turning this off may increase screen jumping'), $yes_no), '$title_tosource' => array('title_tosource', t("Link post titles to source"), $title_tosource, '', $yes_no), - '$layout_editor' => t('System Page Layout Editor - (advanced)'), '$theme_config' => $theme_config, - '$expert' => $advanced_theming, '$channel_list_mode' => array('channel_list_mode', t('Use blog/list mode on channel page'), get_pconfig(local_channel(),'system','channel_list_mode'), t('(comments displayed separately)'), $yes_no), '$network_list_mode' => array('network_list_mode', t('Use blog/list mode on grid page'), get_pconfig(local_channel(),'system','network_list_mode'), t('(comments displayed separately)'), $yes_no), '$channel_divmore_height' => array('channel_divmore_height', t('Channel page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','channel_divmore_height')) ? get_pconfig(local_channel(),'system','channel_divmore_height') : 400), t('click to expand content exceeding this height')), '$network_divmore_height' => array('network_divmore_height', t('Grid page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','network_divmore_height')) ? get_pconfig(local_channel(),'system','network_divmore_height') : 400) , t('click to expand content exceeding this height')), - '$start_menu' => ['start_menu', t('New Member Links'), $start_menu, t('Display new member quick links menu'), $yes_no], - '$advanced_theming' => ['advanced_theming', t('Advanced Theme and Layout Settings'), $advanced_theming, t('Allows fine tuning of themes and page layouts'), $yes_no] - + '$start_menu' => ['start_menu', t('New Member Links'), $start_menu, t('Display new member quick links menu'), $yes_no] )); call_hooks('display_settings',$o); diff --git a/app/pdledit.apd b/app/pdledit.apd new file mode 100644 index 000000000..ae62d4ff3 --- /dev/null +++ b/app/pdledit.apd @@ -0,0 +1,6 @@ +version: 1 +url: $baseurl/pdledit +requires: local_channel +name: PDL Editor +photo: icon:object-group +categories: Appearance diff --git a/view/theme/redbasic/php/config.php b/view/theme/redbasic/php/config.php index ae926d07b..d9d46c8f4 100644 --- a/view/theme/redbasic/php/config.php +++ b/view/theme/redbasic/php/config.php @@ -54,6 +54,7 @@ class RedbasicConfig { $arr['converse_width']=get_pconfig(local_channel(),"redbasic","converse_width"); $arr['top_photo']=get_pconfig(local_channel(),"redbasic","top_photo"); $arr['reply_photo']=get_pconfig(local_channel(),"redbasic","reply_photo"); + $arr['advanced_theming'] = get_pconfig(local_channel(), 'redbasic', 'advanced_theming'); return $this->form($arr); } @@ -80,15 +81,15 @@ class RedbasicConfig { set_pconfig(local_channel(), 'redbasic', 'converse_width', $_POST['redbasic_converse_width']); set_pconfig(local_channel(), 'redbasic', 'top_photo', $_POST['redbasic_top_photo']); set_pconfig(local_channel(), 'redbasic', 'reply_photo', $_POST['redbasic_reply_photo']); + set_pconfig(local_channel(), 'redbasic', 'advanced_theming', $_POST['redbasic_advanced_theming']); } } function form($arr) { - if(get_pconfig(local_channel(), 'system', 'advanced_theming')) + if(get_pconfig(local_channel(), 'redbasic', 'advanced_theming')) $expert = 1; - $o .= replace_macros(get_markup_template('theme_settings.tpl'), array( '$submit' => t('Submit'), '$baseurl' => z_root(), @@ -112,6 +113,7 @@ class RedbasicConfig { '$converse_width' => array('redbasic_converse_width',t('Set maximum width of content region in pixel'),$arr['converse_width'], t('Leave empty for default width')), '$top_photo' => array('redbasic_top_photo', t('Set size of conversation author photo'), $arr['top_photo']), '$reply_photo' => array('redbasic_reply_photo', t('Set size of followup author photos'), $arr['reply_photo']), + '$advanced_theming' => ['redbasic_advanced_theming', t('Show more custom theme settings'), $arr['advanced_theming'], '', [t('No'), t('Yes')]] )); return $o; diff --git a/view/theme/redbasic/tpl/theme_settings.tpl b/view/theme/redbasic/tpl/theme_settings.tpl index 7c552b49e..cc403f0a7 100644 --- a/view/theme/redbasic/tpl/theme_settings.tpl +++ b/view/theme/redbasic/tpl/theme_settings.tpl @@ -1,6 +1,7 @@ {{include file="field_checkbox.tpl" field=$narrow_navbar}} {{include file="field_input.tpl" field=$converse_width}} {{include file="field_input.tpl" field=$font_size}} +{{include file="field_checkbox.tpl" field=$advanced_theming}} {{if $expert}} {{include file="field_colorinput.tpl" field=$nav_bg}} {{include file="field_colorinput.tpl" field=$nav_icon_colour}} diff --git a/view/tpl/settings_display.tpl b/view/tpl/settings_display.tpl index ee0e137b5..f96e7f84c 100755 --- a/view/tpl/settings_display.tpl +++ b/view/tpl/settings_display.tpl @@ -69,12 +69,6 @@ {{include file="field_checkbox.tpl" field=$preload_images}} {{include file="field_checkbox.tpl" field=$manual_update}} {{include file="field_checkbox.tpl" field=$start_menu}} - {{include file="field_checkbox.tpl" field=$advanced_theming}} - {{if $expert}} - - {{/if}}
From 91502b4104788b4f2d57da800ffc4c38585de94d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 26 Sep 2018 15:13:19 +0200 Subject: [PATCH 017/130] change wording --- view/theme/redbasic/php/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/theme/redbasic/php/config.php b/view/theme/redbasic/php/config.php index d9d46c8f4..0a779529d 100644 --- a/view/theme/redbasic/php/config.php +++ b/view/theme/redbasic/php/config.php @@ -113,7 +113,7 @@ class RedbasicConfig { '$converse_width' => array('redbasic_converse_width',t('Set maximum width of content region in pixel'),$arr['converse_width'], t('Leave empty for default width')), '$top_photo' => array('redbasic_top_photo', t('Set size of conversation author photo'), $arr['top_photo']), '$reply_photo' => array('redbasic_reply_photo', t('Set size of followup author photos'), $arr['reply_photo']), - '$advanced_theming' => ['redbasic_advanced_theming', t('Show more custom theme settings'), $arr['advanced_theming'], '', [t('No'), t('Yes')]] + '$advanced_theming' => ['redbasic_advanced_theming', t('Show advanced settings'), $arr['advanced_theming'], '', [t('No'), t('Yes')]] )); return $o; From aab97adb23c65dfc54f4f160742f8066fcd98032 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 26 Sep 2018 16:22:34 +0200 Subject: [PATCH 018/130] oauth and oauth2 apps manager --- Zotlabs/Module/{Settings => }/Oauth.php | 60 +++++++++++------- Zotlabs/Module/{Settings => }/Oauth2.php | 61 ++++++++++++------- app/oauth.apd | 6 ++ app/oauth2.apd | 6 ++ view/tpl/{settings_oauth.tpl => oauth.tpl} | 8 +-- view/tpl/{settings_oauth2.tpl => oauth2.tpl} | 8 +-- ...ttings_oauth2_edit.tpl => oauth2_edit.tpl} | 0 ...settings_oauth_edit.tpl => oauth_edit.tpl} | 0 8 files changed, 96 insertions(+), 53 deletions(-) rename Zotlabs/Module/{Settings => }/Oauth.php (74%) rename Zotlabs/Module/{Settings => }/Oauth2.php (79%) create mode 100644 app/oauth.apd create mode 100644 app/oauth2.apd rename view/tpl/{settings_oauth.tpl => oauth.tpl} (63%) rename view/tpl/{settings_oauth2.tpl => oauth2.tpl} (62%) rename view/tpl/{settings_oauth2_edit.tpl => oauth2_edit.tpl} (100%) rename view/tpl/{settings_oauth_edit.tpl => oauth_edit.tpl} (100%) diff --git a/Zotlabs/Module/Settings/Oauth.php b/Zotlabs/Module/Oauth.php similarity index 74% rename from Zotlabs/Module/Settings/Oauth.php rename to Zotlabs/Module/Oauth.php index d6576c6de..196209308 100644 --- a/Zotlabs/Module/Settings/Oauth.php +++ b/Zotlabs/Module/Oauth.php @@ -1,27 +1,33 @@ 2) && (argv(2) === 'edit' || argv(2) === 'add') && x($_POST,'submit')) { + if((argc() > 1) && (argv(1) === 'edit' || argv(1) === 'add') && x($_POST,'submit')) { - check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth'); + check_form_security_token_redirectOnErr('oauth', 'oauth'); $name = ((x($_POST,'name')) ? escape_tags($_POST['name']) : ''); $key = ((x($_POST,'key')) ? escape_tags($_POST['key']) : ''); @@ -73,17 +79,27 @@ class Oauth { ); } } - goaway(z_root()."/settings/oauth/"); + goaway(z_root()."/oauth"); return; } } function get() { + + if(! Apps::system_app_installed(local_channel(), 'OAuth Apps Manager')) { + //Do not display any associated widgets at this point + App::$pdl = ''; + + $o = 'OAuth App (Not Installed):
'; + $o .= t('An OAuth apps manager'); + return $o; + } + - if((argc() > 2) && (argv(2) === 'add')) { - $tpl = get_markup_template("settings_oauth_edit.tpl"); + if((argc() > 1) && (argv(1) === 'add')) { + $tpl = get_markup_template("oauth_edit.tpl"); $o .= replace_macros($tpl, array( - '$form_security_token' => get_form_security_token("settings_oauth"), + '$form_security_token' => get_form_security_token("oauth"), '$title' => t('Add application'), '$submit' => t('Submit'), '$cancel' => t('Cancel'), @@ -96,9 +112,9 @@ class Oauth { return $o; } - if((argc() > 3) && (argv(2) === 'edit')) { + if((argc() > 2) && (argv(1) === 'edit')) { $r = q("SELECT * FROM clients WHERE client_id='%s' AND uid=%d", - dbesc(argv(3)), + dbesc(argv(2)), local_channel()); if (!count($r)){ @@ -107,9 +123,9 @@ class Oauth { } $app = $r[0]; - $tpl = get_markup_template("settings_oauth_edit.tpl"); + $tpl = get_markup_template("oauth_edit.tpl"); $o .= replace_macros($tpl, array( - '$form_security_token' => get_form_security_token("settings_oauth"), + '$form_security_token' => get_form_security_token("oauth"), '$title' => t('Add application'), '$submit' => t('Update'), '$cancel' => t('Cancel'), @@ -122,13 +138,13 @@ class Oauth { return $o; } - if((argc() > 3) && (argv(2) === 'delete')) { - check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth', 't'); + if((argc() > 2) && (argv(1) === 'delete')) { + check_form_security_token_redirectOnErr('/oauth', 'oauth', 't'); $r = q("DELETE FROM clients WHERE client_id='%s' AND uid=%d", - dbesc(argv(3)), + dbesc(argv(2)), local_channel()); - goaway(z_root()."/settings/oauth/"); + goaway(z_root()."/oauth"); return; } @@ -141,11 +157,11 @@ class Oauth { local_channel()); - $tpl = get_markup_template("settings_oauth.tpl"); + $tpl = get_markup_template("oauth.tpl"); $o .= replace_macros($tpl, array( - '$form_security_token' => get_form_security_token("settings_oauth"), + '$form_security_token' => get_form_security_token("oauth"), '$baseurl' => z_root(), - '$title' => t('Connected Apps'), + '$title' => t('Connected OAuth Apps'), '$add' => t('Add application'), '$edit' => t('Edit'), '$delete' => t('Delete'), @@ -158,4 +174,4 @@ class Oauth { } -} \ No newline at end of file +} diff --git a/Zotlabs/Module/Settings/Oauth2.php b/Zotlabs/Module/Oauth2.php similarity index 79% rename from Zotlabs/Module/Settings/Oauth2.php rename to Zotlabs/Module/Oauth2.php index 70fd3a5c3..2302d1b10 100644 --- a/Zotlabs/Module/Settings/Oauth2.php +++ b/Zotlabs/Module/Oauth2.php @@ -1,15 +1,21 @@ 2) && (argv(2) === 'edit' || argv(2) === 'add') && x($_POST,'submit')) { + if((argc() > 1) && (argv(1) === 'edit' || argv(1) === 'add') && x($_POST,'submit')) { - check_form_security_token_redirectOnErr('/settings/oauth2', 'settings_oauth2'); + check_form_security_token_redirectOnErr('oauth2', 'oauth2'); $name = ((x($_POST,'name')) ? escape_tags(trim($_POST['name'])) : ''); $secret = ((x($_POST,'secret')) ? escape_tags(trim($_POST['secret'])) : ''); @@ -80,17 +86,26 @@ class Oauth2 { ); } } - goaway(z_root()."/settings/oauth2/"); + goaway(z_root()."/oauth2"); return; } } function get() { + + if(! Apps::system_app_installed(local_channel(), 'OAuth2 Apps Manager')) { + //Do not display any associated widgets at this point + App::$pdl = ''; + + $o = 'OAuth2 App (Not Installed):
'; + $o .= t('An OAuth2 apps manager'); + return $o; + } - if((argc() > 2) && (argv(2) === 'add')) { - $tpl = get_markup_template("settings_oauth2_edit.tpl"); + if((argc() > 1) && (argv(1) === 'add')) { + $tpl = get_markup_template("oauth2_edit.tpl"); $o .= replace_macros($tpl, array( - '$form_security_token' => get_form_security_token("settings_oauth2"), + '$form_security_token' => get_form_security_token("oauth2"), '$title' => t('Add OAuth2 application'), '$submit' => t('Submit'), '$cancel' => t('Cancel'), @@ -103,9 +118,9 @@ class Oauth2 { return $o; } - if((argc() > 3) && (argv(2) === 'edit')) { + if((argc() > 2) && (argv(1) === 'edit')) { $r = q("SELECT * FROM oauth_clients WHERE client_id='%s' AND user_id= %d", - dbesc(argv(3)), + dbesc(argv(2)), intval(local_channel()) ); @@ -116,9 +131,9 @@ class Oauth2 { $app = $r[0]; - $tpl = get_markup_template("settings_oauth2_edit.tpl"); + $tpl = get_markup_template("oauth2_edit.tpl"); $o .= replace_macros($tpl, array( - '$form_security_token' => get_form_security_token("settings_oauth2"), + '$form_security_token' => get_form_security_token("oauth2"), '$title' => t('Add application'), '$submit' => t('Update'), '$cancel' => t('Cancel'), @@ -131,26 +146,26 @@ class Oauth2 { return $o; } - if((argc() > 3) && (argv(2) === 'delete')) { - check_form_security_token_redirectOnErr('/settings/oauth2', 'settings_oauth2', 't'); + if((argc() > 2) && (argv(1) === 'delete')) { + check_form_security_token_redirectOnErr('oauth2', 'oauth2', 't'); $r = q("DELETE FROM oauth_clients WHERE client_id = '%s' AND user_id = %d", - dbesc(argv(3)), + dbesc(argv(2)), intval(local_channel()) ); $r = q("DELETE FROM oauth_access_tokens WHERE client_id = '%s' AND user_id = %d", - dbesc(argv(3)), + dbesc(argv(2)), intval(local_channel()) ); $r = q("DELETE FROM oauth_authorization_codes WHERE client_id = '%s' AND user_id = %d", - dbesc(argv(3)), + dbesc(argv(2)), intval(local_channel()) ); $r = q("DELETE FROM oauth_refresh_tokens WHERE client_id = '%s' AND user_id = %d", - dbesc(argv(3)), + dbesc(argv(2)), intval(local_channel()) ); - goaway(z_root()."/settings/oauth2/"); + goaway(z_root()."/oauth2"); return; } @@ -164,9 +179,9 @@ class Oauth2 { intval(local_channel()) ); - $tpl = get_markup_template("settings_oauth2.tpl"); + $tpl = get_markup_template("oauth2.tpl"); $o .= replace_macros($tpl, array( - '$form_security_token' => get_form_security_token("settings_oauth2"), + '$form_security_token' => get_form_security_token("oauth2"), '$baseurl' => z_root(), '$title' => t('Connected OAuth2 Apps'), '$add' => t('Add application'), diff --git a/app/oauth.apd b/app/oauth.apd new file mode 100644 index 000000000..4771773ed --- /dev/null +++ b/app/oauth.apd @@ -0,0 +1,6 @@ +version: 1 +url: $baseurl/oauth +requires: local_channel +name: OAuth Apps Manager +photo: icon:chevron-circle-up +categories: Access Control diff --git a/app/oauth2.apd b/app/oauth2.apd new file mode 100644 index 000000000..21fa44c97 --- /dev/null +++ b/app/oauth2.apd @@ -0,0 +1,6 @@ +version: 1 +url: $baseurl/oauth2 +requires: local_channel +name: OAuth2 Apps Manager +photo: icon:chevron-circle-up +categories: Access Control diff --git a/view/tpl/settings_oauth.tpl b/view/tpl/oauth.tpl similarity index 63% rename from view/tpl/settings_oauth.tpl rename to view/tpl/oauth.tpl index 811cfcec5..881e22e99 100755 --- a/view/tpl/settings_oauth.tpl +++ b/view/tpl/oauth.tpl @@ -4,13 +4,13 @@
-
+ @@ -25,8 +25,8 @@ {{/if}} {{/if}} {{if $app.my}} - - + + {{/if}}
{{/foreach}} diff --git a/view/tpl/settings_oauth2.tpl b/view/tpl/oauth2.tpl similarity index 62% rename from view/tpl/settings_oauth2.tpl rename to view/tpl/oauth2.tpl index f3bf59a12..a5b48ffce 100755 --- a/view/tpl/settings_oauth2.tpl +++ b/view/tpl/oauth2.tpl @@ -8,13 +8,13 @@ {{foreach $apps as $app}} - +
@@ -25,8 +25,8 @@ {{/if}} {{/if}} {{if $app.my}} - - + + {{/if}}
diff --git a/view/tpl/settings_oauth2_edit.tpl b/view/tpl/oauth2_edit.tpl similarity index 100% rename from view/tpl/settings_oauth2_edit.tpl rename to view/tpl/oauth2_edit.tpl diff --git a/view/tpl/settings_oauth_edit.tpl b/view/tpl/oauth_edit.tpl similarity index 100% rename from view/tpl/settings_oauth_edit.tpl rename to view/tpl/oauth_edit.tpl From d7ec36e3da017bff3bed64d2714e9cdf460e0c18 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 26 Sep 2018 16:23:12 +0200 Subject: [PATCH 019/130] wrong app name --- Zotlabs/Module/Oauth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zotlabs/Module/Oauth.php b/Zotlabs/Module/Oauth.php index 196209308..9297eb65d 100644 --- a/Zotlabs/Module/Oauth.php +++ b/Zotlabs/Module/Oauth.php @@ -11,7 +11,7 @@ class Oauth extends Controller { function post() { - if(! Apps::system_app_installed(local_channel(), 'OAuth')) + if(! Apps::system_app_installed(local_channel(), 'OAuth Apps Manager')) return; if(x($_POST,'remove')){ From 9af1b62beef76781e3384a536377d9f8123aab07 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 26 Sep 2018 16:26:36 +0200 Subject: [PATCH 020/130] change wording --- Zotlabs/Module/Oauth.php | 4 ++-- Zotlabs/Module/Oauth2.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Zotlabs/Module/Oauth.php b/Zotlabs/Module/Oauth.php index 9297eb65d..d087ecec4 100644 --- a/Zotlabs/Module/Oauth.php +++ b/Zotlabs/Module/Oauth.php @@ -90,8 +90,8 @@ class Oauth extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = 'OAuth App (Not Installed):
'; - $o .= t('An OAuth apps manager'); + $o = 'OAuth Apps Manager App (Not Installed):
'; + $o .= t('OAuth authenticatication tokens for mobile and remote apps'); return $o; } diff --git a/Zotlabs/Module/Oauth2.php b/Zotlabs/Module/Oauth2.php index 2302d1b10..4c34b499f 100644 --- a/Zotlabs/Module/Oauth2.php +++ b/Zotlabs/Module/Oauth2.php @@ -97,8 +97,8 @@ class Oauth2 extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = 'OAuth2 App (Not Installed):
'; - $o .= t('An OAuth2 apps manager'); + $o = 'OAuth2 Apps Manager App (Not Installed):
'; + $o .= t('OAuth2 authenticatication tokens for mobile and remote apps'); return $o; } From 1353c291e9d6fbe4cdbe8e4911f99d51e1da9198 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 26 Sep 2018 16:32:06 +0200 Subject: [PATCH 021/130] add check for local_channel() --- Zotlabs/Module/Oauth.php | 7 +++++++ Zotlabs/Module/Oauth2.php | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/Zotlabs/Module/Oauth.php b/Zotlabs/Module/Oauth.php index d087ecec4..5aae71ae7 100644 --- a/Zotlabs/Module/Oauth.php +++ b/Zotlabs/Module/Oauth.php @@ -11,6 +11,10 @@ class Oauth extends Controller { function post() { + if(! local_channel()) + return; + + if(! Apps::system_app_installed(local_channel(), 'OAuth Apps Manager')) return; @@ -86,6 +90,9 @@ class Oauth extends Controller { function get() { + if(! local_channel()) + return; + if(! Apps::system_app_installed(local_channel(), 'OAuth Apps Manager')) { //Do not display any associated widgets at this point App::$pdl = ''; diff --git a/Zotlabs/Module/Oauth2.php b/Zotlabs/Module/Oauth2.php index 4c34b499f..c27d7534b 100644 --- a/Zotlabs/Module/Oauth2.php +++ b/Zotlabs/Module/Oauth2.php @@ -11,6 +11,9 @@ class Oauth2 extends Controller { function post() { + if(! local_channel()) + return; + if(! Apps::system_app_installed(local_channel(), 'OAuth2 Apps Manager')) return; @@ -93,6 +96,9 @@ class Oauth2 extends Controller { function get() { + if(! local_channel()) + return; + if(! Apps::system_app_installed(local_channel(), 'OAuth2 Apps Manager')) { //Do not display any associated widgets at this point App::$pdl = ''; From 505782f224d232acd57f7a5986adfc9bf8a7bb79 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 26 Sep 2018 16:35:05 +0200 Subject: [PATCH 022/130] remove oauth from features --- Zotlabs/Widget/Settings_menu.php | 16 ---------------- include/features.php | 18 ------------------ 2 files changed, 34 deletions(-) diff --git a/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php index 1b96e4d14..041ca312f 100644 --- a/Zotlabs/Widget/Settings_menu.php +++ b/Zotlabs/Widget/Settings_menu.php @@ -79,22 +79,6 @@ class Settings_menu { 'selected' => '' ); - if(feature_enabled(local_channel(),'oauth_clients')) { - $tabs[] = array( - 'label' => t('OAuth1 apps'), - 'url' => z_root() . '/settings/oauth', - 'selected' => ((argv(1) === 'oauth') ? 'active' : ''), - ); - } - - if(feature_enabled(local_channel(),'oauth2_clients')) { - $tabs[] = array( - 'label' => t('OAuth2 apps'), - 'url' => z_root() . '/settings/oauth2', - 'selected' => ((argv(1) === 'oauth2') ? 'active' : ''), - ); - } - if(feature_enabled(local_channel(),'access_tokens')) { $tabs[] = array( 'label' => t('Guest Access Tokens'), diff --git a/include/features.php b/include/features.php index 0da6a9725..46f19fc50 100644 --- a/include/features.php +++ b/include/features.php @@ -83,24 +83,6 @@ function get_features($filtered = true, $level = (-1)) { feature_level('permcats',2), ], - [ - 'oauth_clients', - t('OAuth1 Clients'), - t('Manage OAuth1 authenticatication tokens for mobile and remote apps.'), - false, - get_config('feature_lock','oauth_clients'), - feature_level('oauth_clients',1), - ], - - [ - 'oauth2_clients', - t('OAuth2 Clients'), - t('Manage OAuth2 authenticatication tokens for mobile and remote apps.'), - false, - get_config('feature_lock','oauth2_clients'), - feature_level('oauth2_clients',1), - ], - [ 'access_tokens', t('Access Tokens'), From a7948d7bfee1c0c8c9f1a731aabdc636c280bff0 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 26 Sep 2018 22:02:50 +0200 Subject: [PATCH 023/130] permcats app --- Zotlabs/Module/Connedit.php | 3 +- Zotlabs/Module/Defperms.php | 3 +- Zotlabs/Module/{Settings => }/Permcats.php | 37 +++++++++++++------ Zotlabs/Widget/Settings_menu.php | 8 ---- app/permcats.apd | 6 +++ include/features.php | 9 ----- view/tpl/abook_edit.tpl | 2 +- view/tpl/defperms.tpl | 2 +- .../{settings_permcats.tpl => permcats.tpl} | 6 +-- 9 files changed, 41 insertions(+), 35 deletions(-) rename Zotlabs/Module/{Settings => }/Permcats.php (75%) create mode 100644 app/permcats.apd rename view/tpl/{settings_permcats.tpl => permcats.tpl} (87%) diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 712215bc3..3d7ee449a 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -7,6 +7,7 @@ namespace Zotlabs\Module; * */ +use Zotlabs\Lib\Apps; require_once('include/socgraph.php'); require_once('include/selectors.php'); @@ -851,7 +852,7 @@ class Connedit extends \Zotlabs\Web\Controller { '$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), t('Connection requests will be approved without your interaction'), $yes_no), '$permcat' => [ 'permcat', t('Permission role'), '', '',$permcats ], '$permcat_new' => t('Add permission role'), - '$permcat_enable' => feature_enabled(local_channel(),'permcats'), + '$permcat_enable' => Apps::system_app_installed(local_channel(), 'Permission Categories'), '$addr' => unpunify($contact['xchan_addr']), '$primeurl' => unpunify($contact['xchan_url']), '$section' => $section, diff --git a/Zotlabs/Module/Defperms.php b/Zotlabs/Module/Defperms.php index 63acc9795..2e886aa64 100644 --- a/Zotlabs/Module/Defperms.php +++ b/Zotlabs/Module/Defperms.php @@ -1,6 +1,7 @@ array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), t('If enabled, connection requests will be approved without your interaction'), $yes_no), '$permcat' => [ 'permcat', t('Permission role'), '', '',$permcats ], '$permcat_new' => t('Add permission role'), - '$permcat_enable' => feature_enabled(local_channel(),'permcats'), + '$permcat_enable' => Apps::system_app_installed(local_channel(), 'Permission Categories'), '$section' => $section, '$sections' => $sections, '$autolbl' => t('The permissions indicated on this page will be applied to all new connections.'), diff --git a/Zotlabs/Module/Settings/Permcats.php b/Zotlabs/Module/Permcats.php similarity index 75% rename from Zotlabs/Module/Settings/Permcats.php rename to Zotlabs/Module/Permcats.php index 40641c3f2..97090067b 100644 --- a/Zotlabs/Module/Settings/Permcats.php +++ b/Zotlabs/Module/Permcats.php @@ -1,19 +1,25 @@ Permission Categories App (Not Installed):
'; + $o .= t('Create custom connection permission limits'); + return $o; + } + + $channel = App::get_channel(); - if(argc() > 2) - $name = hex2bin(argv(2)); + if(argc() > 1) + $name = hex2bin(argv(1)); - if(argc() > 3 && argv(3) === 'drop') { + if(argc() > 2 && argv(2) === 'drop') { \Zotlabs\Lib\Permcat::delete(local_channel(),$name); build_sync_packet(); json_return_and_die([ 'success' => true ]); @@ -93,9 +108,9 @@ class Permcats { - $tpl = get_markup_template("settings_permcats.tpl"); + $tpl = get_markup_template("permcats.tpl"); $o .= replace_macros($tpl, array( - '$form_security_token' => get_form_security_token("settings_permcats"), + '$form_security_token' => get_form_security_token("permcats"), '$title' => t('Permission Categories'), '$desc' => $desc, '$desc2' => $desc2, diff --git a/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php index 041ca312f..781f3b145 100644 --- a/Zotlabs/Widget/Settings_menu.php +++ b/Zotlabs/Widget/Settings_menu.php @@ -87,14 +87,6 @@ class Settings_menu { ); } - if(feature_enabled(local_channel(),'permcats')) { - $tabs[] = array( - 'label' => t('Permission Categories'), - 'url' => z_root() . '/settings/permcats', - 'selected' => ((argv(1) === 'permcats') ? 'active' : ''), - ); - } - if($role === false || $role === 'custom') { $tabs[] = array( 'label' => t('Connection Default Permissions'), diff --git a/app/permcats.apd b/app/permcats.apd new file mode 100644 index 000000000..6a961b87e --- /dev/null +++ b/app/permcats.apd @@ -0,0 +1,6 @@ +version: 1 +url: $baseurl/permcats +requires: local_channel +name: Permission Categories +photo: icon:unlock-alt +categories: Access Control diff --git a/include/features.php b/include/features.php index 46f19fc50..a264ae289 100644 --- a/include/features.php +++ b/include/features.php @@ -74,15 +74,6 @@ function get_features($filtered = true, $level = (-1)) { 'access_control' => [ t('Access Control and Permissions'), - [ - 'permcats', - t('Permission Categories'), - t('Create custom connection permission limits'), - false, - get_config('feature_lock','permcats'), - feature_level('permcats',2), - ], - [ 'access_tokens', t('Access Tokens'), diff --git a/view/tpl/abook_edit.tpl b/view/tpl/abook_edit.tpl index d72258fa0..6ff7bffcd 100755 --- a/view/tpl/abook_edit.tpl +++ b/view/tpl/abook_edit.tpl @@ -485,7 +485,7 @@
{{if $permcat_enable}} -  {{$permcat_new}} +  {{$permcat_new}} {{include file="field_select.tpl" field=$permcat}} {{/if}} diff --git a/view/tpl/defperms.tpl b/view/tpl/defperms.tpl index 5273ee91b..29f642cff 100755 --- a/view/tpl/defperms.tpl +++ b/view/tpl/defperms.tpl @@ -17,7 +17,7 @@

{{$permnote_self}}

{{if $permcat_enable}} -  {{$permcat_new}} +  {{$permcat_new}} {{include file="field_select.tpl" field=$permcat}} {{/if}} diff --git a/view/tpl/settings_permcats.tpl b/view/tpl/permcats.tpl similarity index 87% rename from view/tpl/settings_permcats.tpl rename to view/tpl/permcats.tpl index bbbd41669..2cad2db5b 100644 --- a/view/tpl/settings_permcats.tpl +++ b/view/tpl/permcats.tpl @@ -8,7 +8,7 @@ {{$desc}} -
+ {{include file="field_input.tpl" field=$name}} @@ -50,8 +50,8 @@ {{foreach $permcats as $k => $v}} - - + + {{/foreach}}
{{$v}}{{$v}}
From e3c04b1fd0f441e0042e218f47696b1bfad26c73 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 26 Sep 2018 22:24:36 +0200 Subject: [PATCH 024/130] guest access app --- Zotlabs/Module/Permcats.php | 4 +-- Zotlabs/Module/{Settings => }/Tokens.php | 36 +++++++++++++++----- Zotlabs/Widget/Settings_menu.php | 8 ----- app/tokens.apd | 6 ++++ include/features.php | 15 -------- view/tpl/{settings_tokens.tpl => tokens.tpl} | 6 ++-- 6 files changed, 38 insertions(+), 37 deletions(-) rename Zotlabs/Module/{Settings => }/Tokens.php (86%) create mode 100644 app/tokens.apd rename view/tpl/{settings_tokens.tpl => tokens.tpl} (87%) diff --git a/Zotlabs/Module/Permcats.php b/Zotlabs/Module/Permcats.php index 97090067b..3d068862a 100644 --- a/Zotlabs/Module/Permcats.php +++ b/Zotlabs/Module/Permcats.php @@ -14,8 +14,7 @@ class Permcats extends Controller { return; if(! Apps::system_app_installed(local_channel(), 'Permission Categories')) - return - + return; $channel = App::get_channel(); @@ -67,7 +66,6 @@ class Permcats extends Controller { $channel = App::get_channel(); - if(argc() > 1) $name = hex2bin(argv(1)); diff --git a/Zotlabs/Module/Settings/Tokens.php b/Zotlabs/Module/Tokens.php similarity index 86% rename from Zotlabs/Module/Settings/Tokens.php rename to Zotlabs/Module/Tokens.php index e59cf8d1c..a791d3f63 100644 --- a/Zotlabs/Module/Settings/Tokens.php +++ b/Zotlabs/Module/Tokens.php @@ -1,16 +1,24 @@ Guest Access App (Not Installed):
'; + $o .= t('Create access tokens so that non-members can access private content'); + return $o; + } + + $channel = App::get_channel(); $atoken = null; $atoken_xchan = ''; @@ -144,9 +164,9 @@ class Tokens { - $tpl = get_markup_template("settings_tokens.tpl"); + $tpl = get_markup_template("tokens.tpl"); $o .= replace_macros($tpl, array( - '$form_security_token' => get_form_security_token("settings_tokens"), + '$form_security_token' => get_form_security_token("tokens"), '$title' => t('Guest Access Tokens'), '$desc' => $desc, '$desc2' => $desc2, diff --git a/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php index 781f3b145..ecf93ec78 100644 --- a/Zotlabs/Widget/Settings_menu.php +++ b/Zotlabs/Widget/Settings_menu.php @@ -79,14 +79,6 @@ class Settings_menu { 'selected' => '' ); - if(feature_enabled(local_channel(),'access_tokens')) { - $tabs[] = array( - 'label' => t('Guest Access Tokens'), - 'url' => z_root() . '/settings/tokens', - 'selected' => ((argv(1) === 'tokens') ? 'active' : ''), - ); - } - if($role === false || $role === 'custom') { $tabs[] = array( 'label' => t('Connection Default Permissions'), diff --git a/app/tokens.apd b/app/tokens.apd new file mode 100644 index 000000000..6cb66cbd7 --- /dev/null +++ b/app/tokens.apd @@ -0,0 +1,6 @@ +version: 1 +url: $baseurl/tokens +requires: local_channel +name: Guest Access +photo: icon:user-secret +categories: Access Control diff --git a/include/features.php b/include/features.php index a264ae289..8dcf4517d 100644 --- a/include/features.php +++ b/include/features.php @@ -71,21 +71,6 @@ function get_features($filtered = true, $level = (-1)) { $arr = [ - 'access_control' => [ - t('Access Control and Permissions'), - - [ - 'access_tokens', - t('Access Tokens'), - t('Create access tokens so that non-members can access private content.'), - false, - get_config('feature_lock','access_tokens'), - feature_level('access_tokens',2), - ], - - ], - - // Item tools 'tools' => [ diff --git a/view/tpl/settings_tokens.tpl b/view/tpl/tokens.tpl similarity index 87% rename from view/tpl/settings_tokens.tpl rename to view/tpl/tokens.tpl index 48190c00c..ccb1f8c61 100644 --- a/view/tpl/settings_tokens.tpl +++ b/view/tpl/tokens.tpl @@ -8,7 +8,7 @@ {{$desc}} - + {{if $atoken}}{{/if}} {{include file="field_input.tpl" field=$name}} @@ -61,8 +61,8 @@ {{foreach $tokens as $t}} - - + + {{/foreach}}
{{$t.atoken_name}}{{$t.atoken_name}}
From bdf6289b323c26329087eb21911576239e0b6216 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 26 Sep 2018 22:32:06 +0200 Subject: [PATCH 025/130] tokens: add css file and fix argc and argv values --- Zotlabs/Module/Tokens.php | 6 +++--- view/css/mod_settings.css | 17 ----------------- view/css/mod_tokens.css | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 20 deletions(-) create mode 100644 view/css/mod_tokens.css diff --git a/Zotlabs/Module/Tokens.php b/Zotlabs/Module/Tokens.php index a791d3f63..ae03a499a 100644 --- a/Zotlabs/Module/Tokens.php +++ b/Zotlabs/Module/Tokens.php @@ -106,8 +106,8 @@ class Tokens extends Controller { $atoken = null; $atoken_xchan = ''; - if(argc() > 2) { - $id = argv(2); + if(argc() > 1) { + $id = argv(1); $atoken = q("select * from atoken where atoken_id = %d and atoken_uid = %d", intval($id), @@ -119,7 +119,7 @@ class Tokens extends Controller { $atoken_xchan = substr($channel['channel_hash'],0,16) . '.' . $atoken['atoken_name']; } - if($atoken && argc() > 3 && argv(3) === 'drop') { + if($atoken && argc() > 2 && argv(2) === 'drop') { atoken_delete($id); $atoken = null; $atoken_xchan = ''; diff --git a/view/css/mod_settings.css b/view/css/mod_settings.css index 4236b3dff..d8786eed2 100644 --- a/view/css/mod_settings.css +++ b/view/css/mod_settings.css @@ -9,20 +9,3 @@ .channel-menu { margin-top: 24px; } - -.zat-example { - color: red; -} - -#atoken-index { - width: 100%; -} - -#atoken-index td:nth-child(1){ - padding: 7px 3px 7px 10px; - white-space: nowrap; -} - -.atoken-index-tool { - padding: 7px 10px; -} diff --git a/view/css/mod_tokens.css b/view/css/mod_tokens.css new file mode 100644 index 000000000..ac3bd90d7 --- /dev/null +++ b/view/css/mod_tokens.css @@ -0,0 +1,16 @@ +.zat-example { + color: red; +} + +#atoken-index { + width: 100%; +} + +#atoken-index td:nth-child(1){ + padding: 7px 3px 7px 10px; + white-space: nowrap; +} + +.atoken-index-tool { + padding: 7px 10px; +} From 6b23c3e1796b818ce893ed919f2e2bdd000c83fb Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 27 Sep 2018 14:56:47 +0200 Subject: [PATCH 026/130] implement conversation tools (settings/conversation), remove additional features from the settings menu and get rid of skill levels --- Zotlabs/Lib/ThreadItem.php | 7 +- Zotlabs/Module/Settings/Conversation.php | 60 ++++++++++++ Zotlabs/Module/Settings/Features.php | 35 +------ Zotlabs/Widget/Settings_menu.php | 8 -- include/conversation.php | 1 + include/features.php | 117 +++++++++++------------ view/js/main.js | 29 ++++++ view/tpl/conv_frame.tpl | 15 ++- view/tpl/conv_item.tpl | 6 +- view/tpl/jot.tpl | 8 +- view/tpl/settings_features.tpl | 21 ---- view/tpl/settings_module.tpl | 21 ++-- view/tpl/settings_module_ajax.tpl | 11 +++ 13 files changed, 194 insertions(+), 145 deletions(-) create mode 100644 Zotlabs/Module/Settings/Conversation.php create mode 100644 view/tpl/settings_module_ajax.tpl diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index f8a7366f8..ac24806a6 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -259,7 +259,7 @@ class ThreadItem { $forged = ((($item['sig']) && (! intval($item['item_verified']))) ? t('Message signature incorrect') : ''); $unverified = '' ; // (($this->is_wall_to_wall() && (! intval($item['item_verified']))) ? t('Message cannot be verified') : ''); - + $settings = ''; // FIXME - check this permission if($conv->get_profile_owner() == local_channel()) { @@ -267,6 +267,8 @@ class ThreadItem { 'tagit' => t("Add Tag"), 'classtagger' => "", ); + + $settings = t('Conversation Tools'); } $has_bookmarks = false; @@ -436,7 +438,8 @@ class ThreadItem { 'preview_lbl' => t('This is an unsaved preview'), 'wait' => t('Please wait'), 'submid' => str_replace(['+','='], ['',''], base64_encode($item['mid'])), - 'thread_level' => $thread_level + 'thread_level' => $thread_level, + 'settings' => $settings ); $arr = array('item' => $item, 'output' => $tmp_item); diff --git a/Zotlabs/Module/Settings/Conversation.php b/Zotlabs/Module/Settings/Conversation.php new file mode 100644 index 000000000..43e59a3c2 --- /dev/null +++ b/Zotlabs/Module/Settings/Conversation.php @@ -0,0 +1,60 @@ + 'settings/' . $module, + '$form_security_token' => get_form_security_token('settings_' . $module), + '$title' => t('Conversation Settings'), + '$features' => process_module_features_get(local_channel(), $features), + '$submit' => t('Submit') + )); + + if($aj) { + echo $o; + killme(); + } + else { + return $o; + } + } + +} diff --git a/Zotlabs/Module/Settings/Features.php b/Zotlabs/Module/Settings/Features.php index 888032c28..6a3ab104b 100644 --- a/Zotlabs/Module/Settings/Features.php +++ b/Zotlabs/Module/Settings/Features.php @@ -26,44 +26,14 @@ class Features { function get() { $arr = []; - $harr = []; - if(intval($_REQUEST['techlevel'])) - $level = intval($_REQUEST['techlevel']); - else { - $level = get_account_techlevel(); - } - - if(! intval($level)) { - notice( t('Permission denied.') . EOL); - return; - } - - $techlevels = \Zotlabs\Lib\Techlevels::levels(); - - // This page isn't accessible at techlevel 0 - - unset($techlevels[0]); - - $def_techlevel = (($level > 0) ? $level : 1); - $techlock = get_config('system','techlevel_lock'); - - $all_features_raw = get_features(false); - - foreach($all_features_raw as $fname => $fdata) { - foreach(array_slice($fdata,1) as $f) { - $harr[$f[0]] = ((intval(feature_enabled(local_channel(),$f[0]))) ? "1" : ''); - } - } - - $features = get_features(true,$level); + $features = get_features(false); foreach($features as $fname => $fdata) { $arr[$fname] = array(); $arr[$fname][0] = $fdata[0]; foreach(array_slice($fdata,1) as $f) { $arr[$fname][1][] = array('feature_' . $f[0],$f[1],((intval(feature_enabled(local_channel(),$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On'))); - unset($harr[$f[0]]); } } @@ -71,10 +41,7 @@ class Features { $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_features"), '$title' => t('Additional Features'), - '$techlevel' => [ 'techlevel', t('Your technical skill level'), $def_techlevel, t('Used to provide a member experience and additional features consistent with your comfort level'), $techlevels ], - '$techlock' => $techlock, '$features' => $arr, - '$hiddens' => $harr, '$baseurl' => z_root(), '$submit' => t('Submit'), )); diff --git a/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php index ecf93ec78..92f615452 100644 --- a/Zotlabs/Widget/Settings_menu.php +++ b/Zotlabs/Widget/Settings_menu.php @@ -45,14 +45,6 @@ class Settings_menu { ); - if(get_account_techlevel() > 0 && get_features()) { - $tabs[] = array( - 'label' => t('Additional features'), - 'url' => z_root().'/settings/features', - 'selected' => ((argv(1) === 'features') ? 'active' : ''), - ); - } - $tabs[] = array( 'label' => t('Addon settings'), 'url' => z_root().'/settings/featured', diff --git a/include/conversation.php b/include/conversation.php index 28a339479..dc3f45e45 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -888,6 +888,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa '$user' => App::$user, '$threads' => $threads, '$wait' => t('Loading...'), + '$conversation_tools' => t('Conversation Tools'), '$dropping' => ($page_dropping?t('Delete Selected Items'):False), )); diff --git a/include/features.php b/include/features.php index 8dcf4517d..5584ba3e4 100644 --- a/include/features.php +++ b/include/features.php @@ -71,69 +71,6 @@ function get_features($filtered = true, $level = (-1)) { $arr = [ - // Item tools - 'tools' => [ - - t('Post/Comment Tools'), - - [ - 'commtag', - t('Community Tagging'), - t('Ability to tag existing posts'), - false, - get_config('feature_lock','commtag'), - feature_level('commtag',1), - ], - - [ - 'emojis', - t('Emoji Reactions'), - t('Add emoji reaction ability to posts'), - true, - get_config('feature_lock','emojis'), - feature_level('emojis',1), - ], - - [ - 'filing', - t('Saved Folders'), - t('Ability to file posts under folders'), - false, - get_config('feature_lock','filing'), - feature_level('filing',2), - ], - - [ - 'dislike', - t('Dislike Posts'), - t('Ability to dislike posts/comments'), - false, - get_config('feature_lock','dislike'), - feature_level('dislike',1), - ], - - [ - 'star_posts', - t('Star Posts'), - t('Ability to mark special posts with a star indicator'), - false, - get_config('feature_lock','star_posts'), - feature_level('star_posts',1), - ], - - [ - 'tagadelic', - t('Tag Cloud'), - t('Provide a personal tag cloud on your channel page'), - false, - get_config('feature_lock','tagadelic'), - feature_level('tagadelic',2), - ], - ], - -############################################ -############################################ - 'calendar' => [ t('CalDAV'), @@ -161,6 +98,60 @@ function get_features($filtered = true, $level = (-1)) { ] ], + 'conversation' => [ + + t('Conversation'), + + [ + 'commtag', + t('Community Tagging'), + t('Ability to tag existing posts'), + false, + get_config('feature_lock','commtag'), + ], + + [ + 'emojis', + t('Emoji Reactions'), + t('Add emoji reaction ability to posts'), + true, + get_config('feature_lock','emojis'), + ], + + [ + 'filing', + t('Saved Folders'), + t('Ability to file posts under folders'), + false, + get_config('feature_lock','filing'), + ], + + [ + 'dislike', + t('Dislike Posts'), + t('Ability to dislike posts/comments'), + false, + get_config('feature_lock','dislike'), + ], + + [ + 'star_posts', + t('Star Posts'), + t('Ability to mark special posts with a star indicator'), + false, + get_config('feature_lock','star_posts'), + ], + + [ + 'tagadelic', + t('Tag Cloud'), + t('Provide a personal tag cloud on your channel page'), + false, + get_config('feature_lock','tagadelic'), + ] + + ], + 'directory' => [ t('Directory'), diff --git a/view/js/main.js b/view/js/main.js index 17f94dd16..48277f5cc 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -41,6 +41,8 @@ $.ajaxSetup({cache: false}); $(document).ready(function() { $(document).on('click focus', '.comment-edit-form', handle_comment_form); + $(document).on('click', '.conversation-settings-link', getConversationSettings); + $(document).on('click', '#settings_module_ajax_submit', postConversationSettings); jQuery.timeago.settings.strings = { prefixAgo : aStr['t01'], @@ -122,6 +124,33 @@ $(document).ready(function() { }); +function getConversationSettings() { + $.get('settings/conversation/?f=&aj=1',function(data) { + $('#conversation_settings_body').html(data); + }); + + + +} + +function postConversationSettings() { + $.post( + 'settings/conversation', + $('#settings_module_ajax_form').serialize() + "&auto_update=" + next_page + ); + + if(next_page === 1) { + page_load = true; + } + + $('#conversation_settings').modal('hide'); + + if(timer) clearTimeout(timer); + timer = setTimeout(updateInit,100); + + return false; +} + function datasrc2src(selector) { $(selector).each(function(i, el) { $(el).attr("src", $(el).data("src")); diff --git a/view/tpl/conv_frame.tpl b/view/tpl/conv_frame.tpl index 8aa865076..c6b3b0d9b 100755 --- a/view/tpl/conv_frame.tpl +++ b/view/tpl/conv_frame.tpl @@ -4,5 +4,16 @@
- - + diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl index 05c3d7ae0..5720a2a5f 100755 --- a/view/tpl/conv_item.tpl +++ b/view/tpl/conv_item.tpl @@ -183,6 +183,10 @@ {{$item.dreport}} {{/if}} + {{if $item.settings}} + + {{$item.settings}} + {{/if}} @@ -210,7 +214,7 @@