diff options
author | zotlabs <mike@macgirvin.com> | 2018-10-04 19:20:10 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-10-04 19:20:10 -0700 |
commit | 3a0a611f15f2789099acf57c6ca93828f5edae46 (patch) | |
tree | d928cd86bc856ae80a95a9738fc8a96b8fa23e5b /Zotlabs/Module | |
parent | d33c331abd3ae500fc7cdac206ea647c4c71905e (diff) | |
parent | 1eaf6df842184743ee20ec69931be1ff7136f34e (diff) | |
download | volse-hubzilla-3a0a611f15f2789099acf57c6ca93828f5edae46.tar.gz volse-hubzilla-3a0a611f15f2789099acf57c6ca93828f5edae46.tar.bz2 volse-hubzilla-3a0a611f15f2789099acf57c6ca93828f5edae46.zip |
Merge branch 'dev'
Diffstat (limited to 'Zotlabs/Module')
66 files changed, 642 insertions, 343 deletions
diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php index 0c2ad7522..ea131e08c 100644 --- a/Zotlabs/Module/Acl.php +++ b/Zotlabs/Module/Acl.php @@ -81,7 +81,7 @@ class Acl extends \Zotlabs\Web\Controller { if($search) { - $sql_extra = " AND groups.gname LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " "; + $sql_extra = " AND pgrp.gname LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " "; $sql_extra2 = "AND ( xchan_name LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " OR xchan_addr LIKE " . protect_sprintf( "'%" . dbesc(punify($search)) . ((strpos($search,'@') === false) ? "%@%'" : "%'")) . ") "; // This horrible mess is needed because position also returns 0 if nothing is found. @@ -128,13 +128,13 @@ class Acl extends \Zotlabs\Web\Controller { // Normal privacy groups - $r = q("SELECT groups.id, groups.hash, groups.gname - FROM groups, group_member - WHERE groups.deleted = 0 AND groups.uid = %d - AND group_member.gid = groups.id + $r = q("SELECT pgrp.id, pgrp.hash, pgrp.gname + FROM pgrp, pgrp_member + WHERE pgrp.deleted = 0 AND pgrp.uid = %d + AND pgrp_member.gid = pgrp.id $sql_extra - GROUP BY groups.id - ORDER BY groups.gname + GROUP BY pgrp.id + ORDER BY pgrp.gname LIMIT %d OFFSET %d", intval(local_channel()), intval($count), diff --git a/Zotlabs/Module/Admin/Account_edit.php b/Zotlabs/Module/Admin/Account_edit.php index 6dfadf183..0300fb10c 100644 --- a/Zotlabs/Module/Admin/Account_edit.php +++ b/Zotlabs/Module/Admin/Account_edit.php @@ -31,7 +31,7 @@ class Account_edit { } $service_class = trim($_REQUEST['service_class']); - $account_level = intval(trim($_REQUEST['account_level'])); + $account_level = 5; $account_language = trim($_REQUEST['account_language']); $r = q("update account set account_service_class = '%s', account_level = %d, account_language = '%s' @@ -68,7 +68,6 @@ class Account_edit { '$title' => t('Account Edit'), '$pass1' => [ 'pass1', t('New Password'), ' ','' ], '$pass2' => [ 'pass2', t('New Password again'), ' ','' ], - '$account_level' => [ 'account_level', t('Technical skill level'), $x[0]['account_level'], '', \Zotlabs\Lib\Techlevels::levels() ], '$account_language' => [ 'account_language' , t('Account language (for emails)'), $x[0]['account_language'], '', language_list() ], '$service_class' => [ 'service_class', t('Service class'), $x[0]['account_service_class'], '' ], '$submit' => t('Submit'), @@ -81,4 +80,4 @@ class Account_edit { } -}
\ No newline at end of file +} diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index 5912a7c97..e67f9f165 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -72,7 +72,6 @@ class Site { $maxloadavg = ((x($_POST,'maxloadavg')) ? intval(trim($_POST['maxloadavg'])) : 50); $feed_contacts = ((x($_POST,'feed_contacts')) ? intval($_POST['feed_contacts']) : 0); $verify_email = ((x($_POST,'verify_email')) ? 1 : 0); - $techlevel_lock = ((x($_POST,'techlock')) ? intval($_POST['techlock']) : 0); $imagick_path = ((x($_POST,'imagick_path')) ? trim($_POST['imagick_path']) : ''); $thumbnail_security = ((x($_POST,'thumbnail_security')) ? intval($_POST['thumbnail_security']) : 0); $force_queue = ((intval($_POST['force_queue']) > 0) ? intval($_POST['force_queue']) : 3000); @@ -81,10 +80,6 @@ class Site { $permissions_role = escape_tags(trim($_POST['permissions_role'])); - $techlevel = null; - if(array_key_exists('techlevel', $_POST)) - $techlevel = intval($_POST['techlevel']); - set_config('system', 'feed_contacts', $feed_contacts); set_config('system', 'delivery_interval', $delivery_interval); set_config('system', 'delivery_batch_count', $delivery_batch_count); @@ -110,12 +105,6 @@ class Site { set_config('system', 'pubstream_incl',$pub_incl); set_config('system', 'pubstream_excl',$pub_excl); - set_config('system', 'techlevel_lock', $techlevel_lock); - - - - if(! is_null($techlevel)) - set_config('system', 'techlevel', $techlevel); if($directory_server) set_config('system','directory_server',$directory_server); @@ -284,15 +273,6 @@ class Site { // now invert the logic for the setting. $discover_tab = (1 - $discover_tab); - $techlevels = [ - '0' => t('Beginner/Basic'), - '1' => t('Novice - not skilled but willing to learn'), - '2' => t('Intermediate - somewhat comfortable'), - '3' => t('Advanced - very comfortable'), - '4' => t('Expert - I can write computer code'), - '5' => t('Wizard - I probably know more than you do') - ]; - $perm_roles = \Zotlabs\Access\PermissionRoles::roles(); $default_role = get_config('system','default_permissions_role','social'); @@ -316,10 +296,6 @@ class Site { // name, label, value, help string, extra data... '$sitename' => array('sitename', t("Site name"), htmlspecialchars(get_config('system','sitename'), ENT_QUOTES, 'UTF-8'),''), - '$techlevel' => [ 'techlevel', t('Site default technical skill level'), get_config('system','techlevel'), t('Used to provide a member experience matched to technical comfort level'), $techlevels ], - - '$techlock' => [ 'techlock', t('Lock the technical skill level setting'), get_config('system','techlevel_lock'), t('Members can set their own technical comfort level by default') ], - '$banner' => array('banner', t("Banner/Logo"), $banner, t('Unfiltered HTML/CSS/JS is allowed')), '$admininfo' => array('admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. BBCode can be used here")), '$siteinfo' => array('siteinfo', t('Site Information'), get_config('system','siteinfo'), t("Publicly visible description of this site. Displayed on siteinfo page. BBCode can be used here")), diff --git a/Zotlabs/Module/Appman.php b/Zotlabs/Module/Appman.php index 3ebafafa4..f50dcc2ab 100644 --- a/Zotlabs/Module/Appman.php +++ b/Zotlabs/Module/Appman.php @@ -113,10 +113,12 @@ class Appman extends \Zotlabs\Web\Controller { if($r) { $app = $r[0]; - $term = q("select * from term where otype = %d and oid = %d", + $term = q("select * from term where otype = %d and oid = %d and uid = %d", intval(TERM_OBJ_APP), - intval($r[0]['id']) + intval($r[0]['id']), + intval(local_channel()) ); + if($term) { $app['categories'] = ''; foreach($term as $t) { diff --git a/Zotlabs/Module/Article_edit.php b/Zotlabs/Module/Article_edit.php index 89abccc40..d3cce343f 100644 --- a/Zotlabs/Module/Article_edit.php +++ b/Zotlabs/Module/Article_edit.php @@ -122,7 +122,7 @@ class Article_edit extends \Zotlabs\Web\Controller { 'bbcode' => (($mimetype == 'text/bbcode') ? true : false) ); - $editor = status_editor($a, $x); + $editor = status_editor($a, $x, false, 'Article_edit'); $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( '$title' => t('Edit Article'), diff --git a/Zotlabs/Module/Articles.php b/Zotlabs/Module/Articles.php index 7af1ab6b8..58c16be45 100644 --- a/Zotlabs/Module/Articles.php +++ b/Zotlabs/Module/Articles.php @@ -40,7 +40,7 @@ class Articles extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = '<b>Articles App (Not Installed):</b><br>'; + $o = '<b>' . t('Articles App') . ' (' . t('Not Installed') . '):</b><br>'; $o .= t('Create interactive articles'); return $o; } @@ -132,7 +132,7 @@ class Articles extends Controller { $x['title'] = $_REQUEST['title']; if($_REQUEST['body']) $x['body'] = $_REQUEST['body']; - $editor = status_editor($a,$x); + $editor = status_editor($a,$x,false,'Articles'); } else { diff --git a/Zotlabs/Module/Blocks.php b/Zotlabs/Module/Blocks.php index e6a97794d..fde30a6dd 100644 --- a/Zotlabs/Module/Blocks.php +++ b/Zotlabs/Module/Blocks.php @@ -109,7 +109,7 @@ class Blocks extends \Zotlabs\Web\Controller { if($_REQUEST['pagetitle']) $x['pagetitle'] = $_REQUEST['pagetitle']; - $editor = status_editor($a,$x); + $editor = status_editor($a,$x,false,'Blocks'); $r = q("select iconfig.iid, iconfig.k, iconfig.v, mid, title, body, mimetype, created, edited from iconfig diff --git a/Zotlabs/Module/Card_edit.php b/Zotlabs/Module/Card_edit.php index 694bdc4ea..e01e70fdb 100644 --- a/Zotlabs/Module/Card_edit.php +++ b/Zotlabs/Module/Card_edit.php @@ -122,7 +122,7 @@ class Card_edit extends \Zotlabs\Web\Controller { 'bbcode' => (($mimetype == 'text/bbcode') ? true : false) ); - $editor = status_editor($a, $x); + $editor = status_editor($a, $x, false, 'Card_edit'); $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( '$title' => t('Edit Card'), diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php index 78cbad5fd..b66de158b 100644 --- a/Zotlabs/Module/Cards.php +++ b/Zotlabs/Module/Cards.php @@ -43,7 +43,7 @@ class Cards extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = '<b>Cards App (Not Installed):</b><br>'; + $o = '<b>' . t('Cards App') . ' (' . t('Not Installed') . '):</b><br>'; $o .= t('Create personal planning cards'); return $o; } @@ -133,7 +133,7 @@ class Cards extends Controller { if($_REQUEST['body']) $x['body'] = $_REQUEST['body']; - $editor = status_editor($a, $x); + $editor = status_editor($a, $x, false, 'Cards'); } else { $editor = ''; diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index 7142615d5..d644e48b1 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -836,7 +836,7 @@ class Cdav extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = '<b>CalDAV App (Not Installed):</b><br>'; + $o = '<b>' . t('CalDAV App') . ' (' . t('Not Installed') . '):</b><br>'; $o .= t('CalDAV capable calendar'); return $o; } @@ -845,7 +845,7 @@ class Cdav extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = '<b>CardDAV App (Not Installed):</b><br>'; + $o = '<b>' . t('CardDAV App') . ' (' . t('Not Installed') . '):</b><br>'; $o .= t('CalDAV capable addressbook'); return $o; } diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 74fdc1cb4..f1537ed15 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -168,7 +168,7 @@ class Channel extends Controller { 'reset' => t('Reset form') ); - $o .= status_editor($a,$x); + $o .= status_editor($a,$x,false,'Channel'); } } @@ -182,7 +182,7 @@ class Channel extends Controller { $item_normal_update = item_normal_update(); $sql_extra = item_permissions_sql(App::$profile['profile_uid']); - if(get_pconfig(App::$profile['profile_uid'],'system','channel_list_mode') && (! $mid)) + if(feature_enabled(App::$profile['profile_uid'], 'channel_list_mode') && (! $mid)) $page_mode = 'list'; else $page_mode = 'client'; diff --git a/Zotlabs/Module/Chat.php b/Zotlabs/Module/Chat.php index 551dc5e2a..db77e2612 100644 --- a/Zotlabs/Module/Chat.php +++ b/Zotlabs/Module/Chat.php @@ -99,7 +99,7 @@ class Chat extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = '<b>Chatrooms App (Not Installed):</b><br>'; + $o = '<b>' . t('Chatrooms App') . ' (' . t('Not Installed') . '):</b><br>'; $o .= t('Access Controlled Chatrooms'); return $o; } diff --git a/Zotlabs/Module/Connect.php b/Zotlabs/Module/Connect.php index cd43ea290..62d3af840 100644 --- a/Zotlabs/Module/Connect.php +++ b/Zotlabs/Module/Connect.php @@ -1,21 +1,21 @@ <?php namespace Zotlabs\Module; /** @file */ - +use App; +use Zotlabs\Web\Controller; +use Zotlabs\Lib\Apps; require_once('include/contact_widgets.php'); require_once('include/items.php'); - - -class Connect extends \Zotlabs\Web\Controller { +class Connect extends Controller { function init() { if(argc() > 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 = '<b>' . t('Premium Channel App') . ' (' . t('Not Installed') . '):</b><br>'; + $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/Module/Connections.php b/Zotlabs/Module/Connections.php index 0e5f1dfe2..967e9521d 100644 --- a/Zotlabs/Module/Connections.php +++ b/Zotlabs/Module/Connections.php @@ -220,7 +220,7 @@ class Connections extends \Zotlabs\Web\Controller { $sql_extra .= (($searching) ? protect_sprintf(" AND xchan_name like '%$search_txt%' ") : ""); if($_REQUEST['gid']) { - $sql_extra .= " and xchan_hash in ( select xchan from group_member where gid = " . intval($_REQUEST['gid']) . " and uid = " . intval(local_channel()) . " ) "; + $sql_extra .= " and xchan_hash in ( select xchan from pgrp_member where gid = " . intval($_REQUEST['gid']) . " and uid = " . intval(local_channel()) . " ) "; } $r = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash 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'), '', '<span class="loading invisible">' . t('Loading') . '<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span></span>',$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/Contactgroup.php b/Zotlabs/Module/Contactgroup.php index 2ba53517f..36aaf7da0 100644 --- a/Zotlabs/Module/Contactgroup.php +++ b/Zotlabs/Module/Contactgroup.php @@ -23,7 +23,7 @@ class Contactgroup extends \Zotlabs\Web\Controller { if((argc() > 1) && (intval(argv(1)))) { - $r = q("SELECT * FROM groups WHERE id = %d AND uid = %d AND deleted = 0 LIMIT 1", + $r = q("SELECT * FROM pgrp WHERE id = %d AND uid = %d AND deleted = 0 LIMIT 1", intval(argv(1)), intval(local_channel()) ); diff --git a/Zotlabs/Module/Defperms.php b/Zotlabs/Module/Defperms.php index 63acc9795..463ecb57a 100644 --- a/Zotlabs/Module/Defperms.php +++ b/Zotlabs/Module/Defperms.php @@ -1,14 +1,16 @@ <?php namespace Zotlabs\Module; +use App; +use Zotlabs\Lib\Apps; +use Zotlabs\Web\Controller; require_once('include/socgraph.php'); require_once('include/selectors.php'); require_once('include/group.php'); require_once('include/photos.php'); - -class Defperms extends \Zotlabs\Web\Controller { +class Defperms extends Controller { /* @brief Initialize the connection-editor * @@ -19,6 +21,9 @@ class Defperms extends \Zotlabs\Web\Controller { if(! local_channel()) return; + + if(! Apps::system_app_installed(local_channel(), 'Default Permissions')) + return; $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash @@ -26,10 +31,10 @@ class Defperms extends \Zotlabs\Web\Controller { intval(local_channel()) ); if($r) { - \App::$poi = $r[0]; + App::$poi = $r[0]; } - $channel = \App::get_channel(); + $channel = App::get_channel(); if($channel) head_set_icon($channel['xchan_photo_s']); } @@ -43,12 +48,15 @@ class Defperms extends \Zotlabs\Web\Controller { if(! local_channel()) return; + + if(! Apps::system_app_installed(local_channel(), 'Default Permissions')) + return; $contact_id = intval(argv(1)); if(! $contact_id) return; - $channel = \App::get_channel(); + $channel = App::get_channel(); $orig_record = q("SELECT * FROM abook WHERE abook_id = %d AND abook_channel = %d LIMIT 1", intval($contact_id), @@ -112,7 +120,7 @@ class Defperms extends \Zotlabs\Web\Controller { intval($contact_id) ); if($r) { - \App::$poi = $r[0]; + App::$poi = $r[0]; } @@ -131,22 +139,22 @@ class Defperms extends \Zotlabs\Web\Controller { function defperms_clone(&$a) { - if(! \App::$poi) + if(! App::$poi) return; - $channel = \App::get_channel(); + $channel = App::get_channel(); $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and abook_id = %d LIMIT 1", intval(local_channel()), - intval(\App::$poi['abook_id']) + intval(App::$poi['abook_id']) ); if($r) { - \App::$poi = array_shift($r); + App::$poi = array_shift($r); } - $clone = \App::$poi; + $clone = App::$poi; unset($clone['abook_id']); unset($clone['abook_account']); @@ -173,9 +181,18 @@ class Defperms extends \Zotlabs\Web\Controller { notice( t('Permission denied.') . EOL); return login(); } + + if(! Apps::system_app_installed(local_channel(), 'Default Permissions')) { + //Do not display any associated widgets at this point + App::$pdl = ''; + + $o = '<b>' . t('Default Permissions App') . ' (' . t('Not Installed') . '):</b><br>'; + $o .= t('Set custom default permissions for new connections'); + return $o; + } $section = ((array_key_exists('section',$_REQUEST)) ? $_REQUEST['section'] : ''); - $channel = \App::get_channel(); + $channel = App::get_channel(); $yes_no = array(t('No'),t('Yes')); @@ -193,7 +210,7 @@ class Defperms extends \Zotlabs\Web\Controller { } $o .= " }\n</script>\n"; - if(\App::$poi) { + if(App::$poi) { $sections = []; @@ -203,9 +220,9 @@ class Defperms extends \Zotlabs\Web\Controller { $perms = array(); - $channel = \App::get_channel(); + $channel = App::get_channel(); - $contact = \App::$poi; + $contact = App::$poi; $global_perms = \Zotlabs\Access\Permissions::Perms(); @@ -238,7 +255,7 @@ class Defperms extends \Zotlabs\Web\Controller { '$autoperms' => 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'), '', '<span class="loading invisible">' . t('Loading') . '<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span></span>',$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/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/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 1d21b64ac..8b46ebb79 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -81,7 +81,7 @@ class Display extends \Zotlabs\Web\Controller { ); $o = '<div id="jot-popup">'; - $o .= status_editor($a,$x); + $o .= status_editor($a,$x,false,'Display'); $o .= '</div>'; } diff --git a/Zotlabs/Module/Editblock.php b/Zotlabs/Module/Editblock.php index 563ad9ca2..c031f32a1 100644 --- a/Zotlabs/Module/Editblock.php +++ b/Zotlabs/Module/Editblock.php @@ -132,7 +132,7 @@ class Editblock extends \Zotlabs\Web\Controller { 'bbcode' => (($mimetype == 'text/bbcode') ? true : false) ); - $editor = status_editor($a, $x); + $editor = status_editor($a, $x, false, 'Editblock'); $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( '$title' => t('Edit Block'), diff --git a/Zotlabs/Module/Editlayout.php b/Zotlabs/Module/Editlayout.php index 67e0bcd32..50096f1a1 100644 --- a/Zotlabs/Module/Editlayout.php +++ b/Zotlabs/Module/Editlayout.php @@ -131,7 +131,7 @@ class Editlayout extends \Zotlabs\Web\Controller { 'profile_uid' => intval($owner), ); - $editor = status_editor($a, $x); + $editor = status_editor($a, $x, false, 'Editlayout'); $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( '$title' => t('Edit Layout'), diff --git a/Zotlabs/Module/Editpost.php b/Zotlabs/Module/Editpost.php index 45d8e7644..1c9068e07 100644 --- a/Zotlabs/Module/Editpost.php +++ b/Zotlabs/Module/Editpost.php @@ -102,7 +102,7 @@ class Editpost extends \Zotlabs\Web\Controller { 'bbcode' => true ); - $editor = status_editor($a, $x); + $editor = status_editor($a, $x, false, 'Editpost'); $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( '$title' => t('Edit post'), diff --git a/Zotlabs/Module/Editwebpage.php b/Zotlabs/Module/Editwebpage.php index b67421cd5..785eeb4ec 100644 --- a/Zotlabs/Module/Editwebpage.php +++ b/Zotlabs/Module/Editwebpage.php @@ -160,7 +160,7 @@ class Editwebpage extends \Zotlabs\Web\Controller { 'bbcode' => (($mimetype == 'text/bbcode') ? true : false) ); - $editor = status_editor($a, $x); + $editor = status_editor($a, $x, false, 'Editwebpage'); $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( '$title' => t('Edit Webpage'), diff --git a/Zotlabs/Module/Group.php b/Zotlabs/Module/Group.php index acebe995d..c8ccaa2cb 100644 --- a/Zotlabs/Module/Group.php +++ b/Zotlabs/Module/Group.php @@ -1,11 +1,13 @@ <?php namespace Zotlabs\Module; -require_once('include/group.php'); - +use App; +use Zotlabs\Web\Controller; +use Zotlabs\Lib\Apps; +require_once('include/group.php'); -class Group extends \Zotlabs\Web\Controller { +class Group extends Controller { function init() { if(! local_channel()) { @@ -13,7 +15,11 @@ class Group extends \Zotlabs\Web\Controller { return; } - \App::$profile_uid = local_channel(); + if(! Apps::system_app_installed(local_channel(), 'Privacy Groups')) { + return; + } + + App::$profile_uid = local_channel(); nav_set_selected('Privacy Groups'); } @@ -24,6 +30,10 @@ class Group extends \Zotlabs\Web\Controller { notice( t('Permission denied.') . EOL); return; } + + if(! Apps::system_app_installed(local_channel(), 'Privacy Groups')) { + return; + } if((argc() == 2) && (argv(1) === 'new')) { check_form_security_token_redirectOnErr('/group/new', 'group_edit'); @@ -43,7 +53,7 @@ class Group extends \Zotlabs\Web\Controller { if((argc() == 2) && (intval(argv(1)))) { check_form_security_token_redirectOnErr('/group', 'group_edit'); - $r = q("SELECT * FROM groups WHERE id = %d AND uid = %d LIMIT 1", + $r = q("SELECT * FROM pgrp WHERE id = %d AND uid = %d LIMIT 1", intval(argv(1)), intval(local_channel()) ); @@ -57,7 +67,7 @@ class Group extends \Zotlabs\Web\Controller { $public = intval($_POST['public']); if((strlen($groupname)) && (($groupname != $group['gname']) || ($public != $group['visible']))) { - $r = q("UPDATE groups SET gname = '%s', visible = %d WHERE uid = %d AND id = %d", + $r = q("UPDATE pgrp SET gname = '%s', visible = %d WHERE uid = %d AND id = %d", dbesc($groupname), intval($public), intval(local_channel()), @@ -77,13 +87,22 @@ class Group extends \Zotlabs\Web\Controller { $change = false; - logger('mod_group: ' . \App::$cmd,LOGGER_DEBUG); + logger('mod_group: ' . App::$cmd,LOGGER_DEBUG); if(! local_channel()) { notice( t('Permission denied') . EOL); return; } + if(! Apps::system_app_installed(local_channel(), 'Privacy Groups')) { + //Do not display any associated widgets at this point + App::$pdl = ''; + + $o = '<b>' . t('Privacy Groups App') . ' (' . t('Not Installed') . '):</b><br>'; + $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) @@ -96,7 +115,7 @@ class Group extends \Zotlabs\Web\Controller { $new = (((argc() == 2) && (argv(1) === 'new')) ? true : false); - $groups = q("SELECT id, gname FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC", + $groups = q("SELECT id, gname FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC", intval(local_channel()) ); @@ -141,7 +160,7 @@ class Group extends \Zotlabs\Web\Controller { check_form_security_token_redirectOnErr('/group', 'group_drop', 't'); if(intval(argv(2))) { - $r = q("SELECT gname FROM groups WHERE id = %d AND uid = %d LIMIT 1", + $r = q("SELECT gname FROM pgrp WHERE id = %d AND uid = %d LIMIT 1", intval(argv(2)), intval(local_channel()) ); @@ -173,7 +192,7 @@ class Group extends \Zotlabs\Web\Controller { if((argc() > 1) && (intval(argv(1)))) { require_once('include/acl_selectors.php'); - $r = q("SELECT * FROM groups WHERE id = %d AND uid = %d AND deleted = 0 LIMIT 1", + $r = q("SELECT * FROM pgrp WHERE id = %d AND uid = %d AND deleted = 0 LIMIT 1", intval(argv(1)), intval(local_channel()) ); diff --git a/Zotlabs/Module/Home.php b/Zotlabs/Module/Home.php index 647a6412a..7f2d6424d 100644 --- a/Zotlabs/Module/Home.php +++ b/Zotlabs/Module/Home.php @@ -13,14 +13,12 @@ class Home extends \Zotlabs\Web\Controller { $ret = array(); call_hooks('home_init',$ret); - + $splash = ((argc() > 1 && argv(1) === 'splash') ? true : false); $channel = \App::get_channel(); if(local_channel() && $channel && $channel['xchan_url'] && ! $splash) { - $dest = $channel['channel_startpage']; - if(! $dest) - $dest = get_pconfig(local_channel(),'system','startpage'); + $dest = (($ret['startpage']) ? $ret['startpage'] : ''); if(! $dest) $dest = get_config('system','startpage'); if(! $dest) diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index fee4246c0..3535ac71a 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -138,7 +138,7 @@ class Hq extends \Zotlabs\Web\Controller { [ '$no_messages' => (($target_item) ? false : true), '$no_messages_label' => [ t('Welcome to Hubzilla!'), t('You have got no unseen posts...') ], - '$editor' => status_editor($a,$x) + '$editor' => status_editor($a,$x,false,'Hq') ] ); diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php index d031bf16b..c5c52674a 100644 --- a/Zotlabs/Module/Import.php +++ b/Zotlabs/Module/Import.php @@ -428,7 +428,7 @@ class Import extends \Zotlabs\Web\Controller { create_table_from_array('groups', $group); } - $r = q("select * from groups where uid = %d", + $r = q("select * from pgrp where uid = %d", intval($channel['channel_id']) ); if($r) { diff --git a/Zotlabs/Module/Invite.php b/Zotlabs/Module/Invite.php index 234802746..6359da54c 100644 --- a/Zotlabs/Module/Invite.php +++ b/Zotlabs/Module/Invite.php @@ -107,7 +107,7 @@ class Invite extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = '<b>Invite App (Not Installed):</b><br>'; + $o = '<b>' . t('Invite App') . ' (' . t('Not Installed') . '):</b><br>'; $o .= t('Send email invitations to join this network'); return $o; } diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index a24d6da9c..2ee639874 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -1165,28 +1165,6 @@ class Item extends \Zotlabs\Web\Controller { return $ret; } - // auto-upgrade beginner (techlevel 0) accounts - if they have at least two friends and ten posts - // and have uploaded something (like a profile photo), promote them to level 1. - - $a = q("select account_id, account_level from account where account_id = (select channel_account_id from channel where channel_id = %d limit 1)", - intval($channel_id) - ); - if((! intval($a[0]['account_level'])) && intval($r[0]['total']) > 10) { - $x = q("select count(abook_id) as total from abook where abook_channel = %d", - intval($channel_id) - ); - if($x && intval($x[0]['total']) > 2) { - $y = q("select count(id) as total from attach where uid = %d", - intval($channel_id) - ); - if($y && intval($y[0]['total']) > 1) { - q("update account set account_level = 1 where account_id = %d limit 1", - intval($a[0]['account_id']) - ); - } - } - } - if (!$iswebpage) { $max = engr_units_to_bytes(service_class_fetch($channel_id,'total_items')); if(! service_class_allows($channel_id,'total_items',$r[0]['total'])) { diff --git a/Zotlabs/Module/Lang.php b/Zotlabs/Module/Lang.php index 9858beecd..a32f933a6 100644 --- a/Zotlabs/Module/Lang.php +++ b/Zotlabs/Module/Lang.php @@ -14,7 +14,7 @@ class Lang extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = '<b>Language App (Not Installed):</b><br>'; + $o = '<b>' . t('Language App') . ' (' . t('Not Installed') . '):</b><br>'; $o .= t('Change UI language'); return $o; } diff --git a/Zotlabs/Module/Layouts.php b/Zotlabs/Module/Layouts.php index 19efb37fd..25e27d226 100644 --- a/Zotlabs/Module/Layouts.php +++ b/Zotlabs/Module/Layouts.php @@ -141,7 +141,7 @@ class Layouts extends \Zotlabs\Web\Controller { if($_REQUEST['pagetitle']) $x['pagetitle'] = $_REQUEST['pagetitle']; - $editor = status_editor($a,$x); + $editor = status_editor($a,$x,false,'Layouts'); $r = q("select iconfig.iid, iconfig.v, mid, title, body, mimetype, created, edited, item_type from iconfig left join item on iconfig.iid = item.id diff --git a/Zotlabs/Module/Lockview.php b/Zotlabs/Module/Lockview.php index 466d16997..d7ed07a53 100644 --- a/Zotlabs/Module/Lockview.php +++ b/Zotlabs/Module/Lockview.php @@ -118,7 +118,7 @@ class Lockview extends \Zotlabs\Web\Controller { } if(count($allowed_groups)) { - $r = q("SELECT gname FROM groups WHERE hash IN ( " . implode(', ', $allowed_groups) . " )"); + $r = q("SELECT gname FROM pgrp WHERE hash IN ( " . implode(', ', $allowed_groups) . " )"); if($r) foreach($r as $rr) $l[] = '<div class="dropdown-item"><b>' . $rr['gname'] . '</b></div>'; @@ -156,7 +156,7 @@ class Lockview extends \Zotlabs\Web\Controller { if(count($deny_groups)) { - $r = q("SELECT gname FROM groups WHERE hash IN ( " . implode(', ', $deny_groups) . " )"); + $r = q("SELECT gname FROM pgrp WHERE hash IN ( " . implode(', ', $deny_groups) . " )"); if($r) foreach($r as $rr) $l[] = '<div class="dropdown-item"><b><strike>' . $rr['gname'] . '</strike></b></div>'; diff --git a/Zotlabs/Module/Mail.php b/Zotlabs/Module/Mail.php index ca183f644..d38c1d88c 100644 --- a/Zotlabs/Module/Mail.php +++ b/Zotlabs/Module/Mail.php @@ -393,7 +393,7 @@ class Mail extends \Zotlabs\Web\Controller { 'delete' => t('Delete message'), 'dreport' => t('Delivery report'), 'recall' => t('Recall message'), - 'can_recall' => (($channel['channel_hash'] == $message['from_xchan'] && get_account_techlevel() > 0) ? true : false), + 'can_recall' => ($channel['channel_hash'] == $message['from_xchan']), 'is_recalled' => (intval($message['mail_recalled']) ? t('Message has been recalled.') : ''), 'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'], 'c'), ); 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/Zotlabs/Module/Mood.php b/Zotlabs/Module/Mood.php index cceef5ffa..16ef0b171 100644 --- a/Zotlabs/Module/Mood.php +++ b/Zotlabs/Module/Mood.php @@ -129,7 +129,7 @@ class Mood extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = '<b>Mood App (Not Installed):</b><br>'; + $o = '<b>' . t('Mood App') . ' (' . t('Not Installed') . '):</b><br>'; $o .= t('Set your current mood and tell your friends'); return $o; } diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index ffe605538..015351cbf 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -84,20 +84,9 @@ class Network extends \Zotlabs\Web\Controller { $search = (($_GET['search']) ? $_GET['search'] : ''); if($search) { - $_GET['netsearch'] = escape_tags($search); - if(strpos($search,'@') === 0) { - $r = q("select abook_id from abook left join xchan on abook_xchan = xchan_hash where xchan_name = '%s' and abook_channel = %d limit 1", - dbesc(substr($search,1)), - intval(local_channel()) - ); - if($r) { - $_GET['cid'] = $r[0]['abook_id']; - $search = $_GET['search'] = ''; - } - } - elseif(strpos($search,'#') === 0) { + if(strpos($search,'#') === 0) { $hashtags = substr($search,1); - $search = $_GET['search'] = ''; + $search = ''; } } @@ -108,7 +97,7 @@ class Network extends \Zotlabs\Web\Controller { // filter by collection (e.g. group) if($gid) { - $r = q("SELECT * FROM groups WHERE id = %d AND uid = %d LIMIT 1", + $r = q("SELECT * FROM pgrp WHERE id = %d AND uid = %d LIMIT 1", intval($gid), intval(local_channel()) ); @@ -143,7 +132,7 @@ class Network extends \Zotlabs\Web\Controller { $deftag = ''; - if(x($_GET,'search') || $file || (!$pf && $cid)) + if(x($_GET,'search') || $file || (!$pf && $cid) || $hashtags || $verb || $category) $nouveau = true; if($cid) { @@ -169,9 +158,9 @@ class Network extends \Zotlabs\Web\Controller { if(! $update) { // search terms header - if($search) { + if($search || $hashtags) { $o .= replace_macros(get_markup_template("section_title.tpl"),array( - '$title' => t('Search Results For:') . ' ' . htmlspecialchars($search, ENT_COMPAT,'UTF-8') + '$title' => t('Search Results For:') . ' ' . (($search) ? htmlspecialchars($search, ENT_COMPAT,'UTF-8') : '#' . htmlspecialchars($hashtags, ENT_COMPAT,'UTF-8')) )); } @@ -207,7 +196,7 @@ class Network extends \Zotlabs\Web\Controller { $x['pretext'] = $deftag; - $status_editor = status_editor($a,$x); + $status_editor = status_editor($a,$x,false,'Network'); $o .= $status_editor; $static = channel_manual_conv_update(local_channel()); @@ -448,7 +437,7 @@ class Network extends \Zotlabs\Web\Controller { $abook_uids = " and abook.abook_channel = " . local_channel() . " "; $uids = " and item.uid = " . local_channel() . " "; - if(get_pconfig(local_channel(),'system','network_list_mode')) + if(feature_enabled(local_channel(), 'network_list_mode')) $page_mode = 'list'; else $page_mode = 'client'; diff --git a/Zotlabs/Module/New_channel.php b/Zotlabs/Module/New_channel.php index 97a46a43e..a9022a03a 100644 --- a/Zotlabs/Module/New_channel.php +++ b/Zotlabs/Module/New_channel.php @@ -142,9 +142,12 @@ class New_channel extends \Zotlabs\Web\Controller { } $limit = account_service_class_fetch(get_account_id(),'total_identities'); - + $canadd = true; if($r && ($limit !== false)) { $channel_usage_message = sprintf( t("You have created %1$.0f of %2$.0f allowed channels."), $r[0]['total'], $limit); + if ($r[0]['total'] >= $limit) { + $canadd = false; + } } else { $channel_usage_message = ''; @@ -168,8 +171,6 @@ class New_channel extends \Zotlabs\Web\Controller { $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" ); $perm_roles = \Zotlabs\Access\PermissionRoles::roles(); - if((get_account_techlevel() < 4) && $privacy_role !== 'custom') - unset($perm_roles[t('Other')]); $name = array('name', t('Channel name'), ((x($_REQUEST,'name')) ? $_REQUEST['name'] : ''), $name_help, "*"); $nickhub = '@' . \App::get_hostname(); @@ -186,7 +187,8 @@ class New_channel extends \Zotlabs\Web\Controller { '$nickname' => $nickname, '$validate' => t('Validate'), '$submit' => t('Create'), - '$channel_usage_message' => $channel_usage_message + '$channel_usage_message' => $channel_usage_message, + '$canadd' => $canadd )); return $o; diff --git a/Zotlabs/Module/Notes.php b/Zotlabs/Module/Notes.php index e530e6ff4..178a6bce0 100644 --- a/Zotlabs/Module/Notes.php +++ b/Zotlabs/Module/Notes.php @@ -1,13 +1,19 @@ <?php namespace Zotlabs\Module; /** @file */ +use App; +use Zotlabs\Web\Controller; +use Zotlabs\Lib\Apps; -class Notes extends \Zotlabs\Web\Controller { +class Notes extends Controller { - function init() { + function post() { if(! local_channel()) - return; + return EMPTY_STR; + + if(! Apps::system_app_installed(local_channel(), 'Notes')) + return EMPTY_STR; $ret = array('success' => 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 = '<b>' . t('Notes App') . ' (' . t('Not Installed') . '):</b><br>'; + $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/Module/Settings/Oauth.php b/Zotlabs/Module/Oauth.php index d6576c6de..27c062df2 100644 --- a/Zotlabs/Module/Settings/Oauth.php +++ b/Zotlabs/Module/Oauth.php @@ -1,27 +1,37 @@ <?php -namespace Zotlabs\Module\Settings; +namespace Zotlabs\Module; +use App; +use Zotlabs\Lib\Apps; +use Zotlabs\Web\Controller; -class Oauth { +class Oauth extends Controller { function post() { + + if(! local_channel()) + return; + + + if(! Apps::system_app_installed(local_channel(), 'OAuth Apps Manager')) + return; if(x($_POST,'remove')){ - check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth'); + check_form_security_token_redirectOnErr('/oauth', 'oauth'); $key = $_POST['remove']; q("DELETE FROM tokens WHERE id='%s' AND uid=%d", dbesc($key), local_channel()); - goaway(z_root()."/settings/oauth/"); + goaway(z_root()."/oauth"); return; } - if((argc() > 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 +83,30 @@ class Oauth { ); } } - goaway(z_root()."/settings/oauth/"); + goaway(z_root()."/oauth"); return; } } 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 = ''; + + $o = '<b>' . t('OAuth Apps Manager App') . ' (' . t('Not Installed') . '):</b><br>'; + $o .= t('OAuth authentication tokens for mobile and remote apps'); + 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 +119,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 +130,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 +145,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 +164,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 +181,4 @@ class Oauth { } -}
\ No newline at end of file +} diff --git a/Zotlabs/Module/Settings/Oauth2.php b/Zotlabs/Module/Oauth2.php index 70fd3a5c3..db2687b4c 100644 --- a/Zotlabs/Module/Settings/Oauth2.php +++ b/Zotlabs/Module/Oauth2.php @@ -1,15 +1,24 @@ <?php -namespace Zotlabs\Module\Settings; +namespace Zotlabs\Module; +use App; +use Zotlabs\Lib\Apps; +use Zotlabs\Web\Controller; -class Oauth2 { +class Oauth2 extends Controller { function post() { + + if(! local_channel()) + return; + + if(! Apps::system_app_installed(local_channel(), 'OAuth2 Apps Manager')) + return; if(x($_POST,'remove')){ - 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'])) : ''); logger("REMOVE! ".$name." uid: ".local_channel()); $key = $_POST['remove']; @@ -25,13 +34,13 @@ class Oauth2 { dbesc($name), intval(local_channel()) ); - goaway(z_root()."/settings/oauth2/"); + goaway(z_root()."/oauth2"); return; } - if((argc() > 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 +89,29 @@ class Oauth2 { ); } } - goaway(z_root()."/settings/oauth2/"); + goaway(z_root()."/oauth2"); return; } } 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 = ''; + + $o = '<b>' . t('OAuth2 Apps Manager App') . ' (' . t('Not Installed') . '):</b><br>'; + $o .= t('OAuth2 authenticatication tokens for mobile and remote apps'); + 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 +124,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 +137,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 +152,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 +185,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/Zotlabs/Module/Pdledit.php b/Zotlabs/Module/Pdledit.php index 9b86b599b..5cedb29a8 100644 --- a/Zotlabs/Module/Pdledit.php +++ b/Zotlabs/Module/Pdledit.php @@ -1,15 +1,20 @@ <?php namespace Zotlabs\Module; +use App; +use Zotlabs\Web\Controller; +use Zotlabs\Lib\Apps; -class Pdledit extends \Zotlabs\Web\Controller { +class Pdledit extends Controller { function post() { if(! local_channel()) return; - if(! $_REQUEST['module']) + + if(! Apps::system_app_installed(local_channel(), 'PDL Editor')) return; - if(! feature_enabled(local_channel(),'advanced_theming')) + + if(! $_REQUEST['module']) return; if(! trim($_REQUEST['content'])) { @@ -30,9 +35,13 @@ class Pdledit extends \Zotlabs\Web\Controller { return; } - if(! feature_enabled(local_channel(),'advanced_theming')) { - notice( t('Feature disabled.') . EOL); - return; + if(! Apps::system_app_installed(local_channel(), 'PDL Editor')) { + //Do not display any associated widgets at this point + App::$pdl = ''; + + $o = '<b>' . t('PDL Editor App') . ' (' . t('Not Installed') . '):</b><br>'; + $o .= t('Provides the ability to edit system page layouts'); + return $o; } if(argc() > 2 && argv(2) === 'reset') { diff --git a/Zotlabs/Module/Settings/Permcats.php b/Zotlabs/Module/Permcats.php index 40641c3f2..75ac2ac87 100644 --- a/Zotlabs/Module/Settings/Permcats.php +++ b/Zotlabs/Module/Permcats.php @@ -1,26 +1,31 @@ <?php -namespace Zotlabs\Module\Settings; +namespace Zotlabs\Module; +use App; +use Zotlabs\Web\Controller; +use Zotlabs\Lib\Apps; - -class Permcats { +class Permcats extends Controller { function post() { if(! local_channel()) return; - $channel = \App::get_channel(); + if(! Apps::system_app_installed(local_channel(), 'Permission Categories')) + return; + + $channel = App::get_channel(); - check_form_security_token_redirectOnErr('/settings/permcats', 'settings_permcats'); + check_form_security_token_redirectOnErr('/permcats', 'permcats'); $all_perms = \Zotlabs\Access\Permissions::Perms(); $name = escape_tags(trim($_POST['name'])); if(! $name) { - notice( t('Permission Name is required.') . EOL); + notice( t('Permission category name is required.') . EOL); return; } @@ -50,13 +55,21 @@ class Permcats { if(! local_channel()) return; - $channel = \App::get_channel(); + if(! Apps::system_app_installed(local_channel(), 'Permission Categories')) { + //Do not display any associated widgets at this point + App::$pdl = ''; + + $o = '<b>' . t('Permission Categories App') . ' (' . t('Not Installed') . '):</b><br>'; + $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 +106,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, @@ -104,7 +117,7 @@ class Permcats { '$atoken' => $atoken, '$url1' => z_root() . '/channel/' . $channel['channel_address'], '$url2' => z_root() . '/photos/' . $channel['channel_address'], - '$name' => array('name', t('Permission Name') . ' <span class="required">*</span>', (($name) ? $name : ''), ''), + '$name' => array('name', t('Permission category name') . ' <span class="required">*</span>', (($name) ? $name : ''), ''), '$me' => t('My Settings'), '$perms' => $perms, '$inherited' => t('inherited'), diff --git a/Zotlabs/Module/Poke.php b/Zotlabs/Module/Poke.php index 46dcf6dd3..1f1edfa18 100644 --- a/Zotlabs/Module/Poke.php +++ b/Zotlabs/Module/Poke.php @@ -162,7 +162,7 @@ class Poke extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = '<b>Poke App (Not Installed):</b><br>'; + $o = '<b>' . t('Poke App') . ' (' . t('Not Installed') . '):</b><br>'; $o .= t('Poke somebody in your addressbook'); return $o; } diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 7b80a3978..19cb72b5b 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -81,7 +81,7 @@ class Pubstream extends \Zotlabs\Web\Controller { ); $o = '<div id="jot-popup">'; - $o .= status_editor($a,$x); + $o .= status_editor($a,$x,false,'Pubstream'); $o .= '</div>'; } diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php index 3dded19c7..f9d81be0c 100644 --- a/Zotlabs/Module/Register.php +++ b/Zotlabs/Module/Register.php @@ -227,11 +227,6 @@ class Register extends \Zotlabs\Web\Controller { $perm_roles = \Zotlabs\Access\PermissionRoles::roles(); - // A new account will not have a techlevel, but accounts can also be created by the administrator. - - if((get_account_techlevel() < 4) && $privacy_role !== 'custom') - unset($perm_roles[t('Other')]); - // Configurable terms of service link $tosurl = get_config('system','tos_url'); diff --git a/Zotlabs/Module/Rpost.php b/Zotlabs/Module/Rpost.php index 86ee296ec..f03dae2bf 100644 --- a/Zotlabs/Module/Rpost.php +++ b/Zotlabs/Module/Rpost.php @@ -138,7 +138,7 @@ class Rpost extends \Zotlabs\Web\Controller { 'jotnets' => true ); - $editor = status_editor($a,$x); + $editor = status_editor($a,$x,false,'Rpost'); $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( '$title' => t('Edit post'), diff --git a/Zotlabs/Module/Settings/Account.php b/Zotlabs/Module/Settings/Account.php index 9643c5958..b40f516ca 100644 --- a/Zotlabs/Module/Settings/Account.php +++ b/Zotlabs/Module/Settings/Account.php @@ -12,7 +12,6 @@ class Account { $errs = array(); $email = ((x($_POST,'email')) ? trim(notags($_POST['email'])) : ''); - $techlevel = ((array_key_exists('techlevel',$_POST)) ? intval($_POST['techlevel']) : 0); $account = \App::get_account(); if($email != $account['account_email']) { @@ -32,13 +31,6 @@ class Account { $errs[] = t('System failure storing new email. Please try again.'); } } - if($techlevel != $account['account_level']) { - $r = q("update account set account_level = %d where account_id = %d", - intval($techlevel), - intval($account['account_id']) - ); - info( t('Technical skill level updated') . EOL); - } if($errs) { foreach($errs as $err) @@ -101,11 +93,6 @@ class Account { $email = \App::$account['account_email']; - $techlevels = \Zotlabs\Lib\Techlevels::levels(); - - $def_techlevel = \App::$account['account_level']; - $techlock = get_config('system','techlevel_lock'); - $tpl = get_markup_template("settings_account.tpl"); $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_account"), @@ -113,8 +100,6 @@ class Account { '$origpass' => array('origpass', t('Current Password'), ' ',''), '$password1'=> array('npassword', t('Enter New Password'), '', ''), '$password2'=> array('confirm', t('Confirm New Password'), '', t('Leave password fields blank unless changing')), - '$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, '$submit' => t('Submit'), '$email' => array('email', t('Email Address:'), $email, ''), '$removeme' => t('Remove Account'), diff --git a/Zotlabs/Module/Settings/Calendar.php b/Zotlabs/Module/Settings/Calendar.php index b3a611cdf..a27bf0fa5 100644 --- a/Zotlabs/Module/Settings/Calendar.php +++ b/Zotlabs/Module/Settings/Calendar.php @@ -16,6 +16,10 @@ class Calendar { process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + return; } diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php index 27a8e695d..6b49f165d 100644 --- a/Zotlabs/Module/Settings/Channel.php +++ b/Zotlabs/Module/Settings/Channel.php @@ -2,6 +2,8 @@ namespace Zotlabs\Module\Settings; +use Zotlabs\Lib\Apps; + require_once('include/selectors.php'); @@ -63,7 +65,7 @@ class Channel { } $hide_presence = 1 - (intval($role_permissions['online'])); if($role_permissions['default_collection']) { - $r = q("select hash from groups where uid = %d and gname = '%s' limit 1", + $r = q("select hash from pgrp where uid = %d and gname = '%s' limit 1", intval(local_channel()), dbesc( t('Friends') ) ); @@ -71,7 +73,7 @@ class Channel { require_once('include/group.php'); group_add(local_channel(), t('Friends')); group_add_member(local_channel(),t('Friends'),$channel['channel_hash']); - $r = q("select hash from groups where uid = %d and gname = '%s' limit 1", + $r = q("select hash from pgrp where uid = %d and gname = '%s' limit 1", intval(local_channel()), dbesc( t('Friends') ) ); @@ -432,7 +434,7 @@ class Channel { '$nickname' => (($intl_nickname === $webbie) ? $webbie : $intl_nickname . ' (' . $webbie . ')'), '$subdir' => $subdir, '$davdesc' => t('Your files/photos are accessible via WebDAV at'), - '$davpath' => ((get_account_techlevel() > 3) ? z_root() . '/dav/' . $nickname : ''), + '$davpath' => z_root() . '/dav/' . $nickname, '$basepath' => \App::get_hostname() )); @@ -490,11 +492,6 @@ class Channel { $permissions_set = (($permissions_role != 'custom') ? true : false); $perm_roles = \Zotlabs\Access\PermissionRoles::roles(); - if((get_account_techlevel() < 4) && $permissions_role !== 'custom') - unset($perm_roles[t('Other')]); - - - $vnotify = get_pconfig(local_channel(),'system','vnotify'); $always_show_in_notices = get_pconfig(local_channel(),'system','always_show_in_notices'); @@ -556,8 +553,8 @@ class Channel { '$suggestme' => $suggestme, '$group_select' => $group_select, '$role' => array('permissions_role' , t('Channel role and privacy'), $permissions_role, '', $perm_roles), - '$defpermcat' => [ 'defpermcat', t('Default Permissions Group'), $default_permcat, '', $permcats ], - '$permcat_enable' => feature_enabled(local_channel(),'permcats'), + '$defpermcat' => [ 'defpermcat', t('Default permissions category'), $default_permcat, '', $permcats ], + '$permcat_enable' => Apps::system_app_installed(local_channel(), 'Permission Categories'), '$profile_in_dir' => $profile_in_dir, '$hide_friends' => $hide_friends, '$hide_wall' => $hide_wall, diff --git a/Zotlabs/Module/Settings/Channel_home.php b/Zotlabs/Module/Settings/Channel_home.php new file mode 100644 index 000000000..0e916d530 --- /dev/null +++ b/Zotlabs/Module/Settings/Channel_home.php @@ -0,0 +1,67 @@ +<?php + +namespace Zotlabs\Module\Settings; + + +class Channel_home { + + function post() { + + $module = substr(strrchr(strtolower(static::class), '\\'), 1); + + check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module); + + $features = get_module_features($module); + + process_module_features_post(local_channel(), $features, $_POST); + + $channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400); + if($channel_divmore_height < 50) + $channel_divmore_height = 50; + + set_pconfig(local_channel(),'system','channel_divmore_height', $channel_divmore_height); + + build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + + return; + } + + function get() { + + $module = substr(strrchr(strtolower(static::class), '\\'), 1); + + $features = get_module_features($module); + $rpath = (($_GET['rpath']) ? $_GET['rpath'] : ''); + + $channel_divmore_height = [ + 'channel_divmore_height', + t('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') + ]; + + $extra_settings_html = replace_macros(get_markup_template('field_input.tpl'), + [ + '$field' => $channel_divmore_height + ] + ); + + $tpl = get_markup_template("settings_module.tpl"); + + $o .= replace_macros($tpl, array( + '$rpath' => $rpath, + '$action_url' => 'settings/' . $module, + '$form_security_token' => get_form_security_token('settings_' . $module), + '$title' => t('Channel Home Settings'), + '$features' => process_module_features_get(local_channel(), $features), + '$extra_settings_html' => $extra_settings_html, + '$submit' => t('Submit') + )); + + return $o; + } + +} diff --git a/Zotlabs/Module/Settings/Connections.php b/Zotlabs/Module/Settings/Connections.php index 70b4daa42..cac357791 100644 --- a/Zotlabs/Module/Settings/Connections.php +++ b/Zotlabs/Module/Settings/Connections.php @@ -16,6 +16,10 @@ class Connections { process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + return; } 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 @@ +<?php + +namespace Zotlabs\Module\Settings; + + +class Conversation { + + function post() { + + $module = substr(strrchr(strtolower(static::class), '\\'), 1); + + check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module); + + $features = get_module_features($module); + + process_module_features_post(local_channel(), $features, $_POST); + + build_sync_packet(); + + if($_POST['aj']) { + if($_POST['auto_update'] == 1) + info(t('Settings saved.') . EOL); + else + info(t('Settings saved. Reload page please.') . EOL); + + killme(); + } + else { + return; + } + } + + function get() { + + $aj = ((isset($_GET['aj'])) ? true : false); + + $module = substr(strrchr(strtolower(static::class), '\\'), 1); + + $features = get_module_features($module); + + $tpl = (($aj) ? get_markup_template("settings_module_ajax.tpl") : get_markup_template("settings_module.tpl")); + + $o .= replace_macros($tpl, array( + '$action_url' => '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/Directory.php b/Zotlabs/Module/Settings/Directory.php new file mode 100644 index 000000000..13fe6eb79 --- /dev/null +++ b/Zotlabs/Module/Settings/Directory.php @@ -0,0 +1,47 @@ +<?php + +namespace Zotlabs\Module\Settings; + + +class Directory { + + function post() { + + $module = substr(strrchr(strtolower(static::class), '\\'), 1); + + check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module); + + $features = get_module_features($module); + + process_module_features_post(local_channel(), $features, $_POST); + + build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + + return; + } + + function get() { + + $module = substr(strrchr(strtolower(static::class), '\\'), 1); + + $features = get_module_features($module); + $rpath = (($_GET['rpath']) ? $_GET['rpath'] : ''); + + $tpl = get_markup_template("settings_module.tpl"); + + $o .= replace_macros($tpl, array( + '$rpath' => $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; + } + +} diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index 340b3c0bb..45d80e011 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -27,16 +27,8 @@ class Display { $user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0); $nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0); $title_tosource = ((x($_POST,'title_tosource')) ? intval($_POST['title_tosource']) : 0); - $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); - - $channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400); - if($channel_divmore_height < 50) - $channel_divmore_height = 50; - $network_divmore_height = ((x($_POST,'network_divmore_height')) ? intval($_POST['network_divmore_height']) : 400); - if($network_divmore_height < 50) - $network_divmore_height = 50; + $start_menu = ((x($_POST,'start_menu')) ? intval($_POST['start_menu']) : 0); $browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0); $browser_update = $browser_update * 1000; @@ -54,12 +46,9 @@ class Display { set_pconfig(local_channel(),'system','itemspage', $itemspage); set_pconfig(local_channel(),'system','no_smilies',1-intval($nosmile)); set_pconfig(local_channel(),'system','title_tosource',$title_tosource); - set_pconfig(local_channel(),'system','channel_list_mode', $channel_list_mode); - set_pconfig(local_channel(),'system','network_list_mode', $network_list_mode); - set_pconfig(local_channel(),'system','channel_divmore_height', $channel_divmore_height); - 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 +139,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 @@ -204,15 +201,8 @@ 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' => feature_enabled(local_channel(),'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] )); call_hooks('display_settings',$o); diff --git a/Zotlabs/Module/Settings/Editor.php b/Zotlabs/Module/Settings/Editor.php index 93e3ce602..5e7a9473a 100644 --- a/Zotlabs/Module/Settings/Editor.php +++ b/Zotlabs/Module/Settings/Editor.php @@ -16,6 +16,10 @@ class Editor { process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + return; } diff --git a/Zotlabs/Module/Settings/Events.php b/Zotlabs/Module/Settings/Events.php index fcb4441e1..eb6dda99b 100644 --- a/Zotlabs/Module/Settings/Events.php +++ b/Zotlabs/Module/Settings/Events.php @@ -16,6 +16,10 @@ class Events { process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + return; } 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/Module/Settings/Manage.php b/Zotlabs/Module/Settings/Manage.php index 15d3216e9..9bae12022 100644 --- a/Zotlabs/Module/Settings/Manage.php +++ b/Zotlabs/Module/Settings/Manage.php @@ -16,6 +16,10 @@ class Manage { process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + return; } diff --git a/Zotlabs/Module/Settings/Network.php b/Zotlabs/Module/Settings/Network.php index c51b780f1..aaafe9255 100644 --- a/Zotlabs/Module/Settings/Network.php +++ b/Zotlabs/Module/Settings/Network.php @@ -14,8 +14,18 @@ class Network { $features = get_module_features($module); process_module_features_post(local_channel(), $features, $_POST); + + $network_divmore_height = ((x($_POST,'network_divmore_height')) ? intval($_POST['network_divmore_height']) : 400); + if($network_divmore_height < 50) + $network_divmore_height = 50; + + set_pconfig(local_channel(),'system','network_divmore_height', $network_divmore_height); build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + return; } @@ -26,6 +36,19 @@ class Network { $features = get_module_features($module); $rpath = (($_GET['rpath']) ? $_GET['rpath'] : ''); + $network_divmore_height = [ + 'network_divmore_height', + t('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') + ]; + + $extra_settings_html = replace_macros(get_markup_template('field_input.tpl'), + [ + '$field' => $network_divmore_height + ] + ); + $tpl = get_markup_template("settings_module.tpl"); $o .= replace_macros($tpl, array( @@ -33,8 +56,9 @@ class Network { '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), '$title' => t('Activity Settings'), - '$features' => process_module_features_get(local_channel(), $features), - '$submit' => t('Submit') + '$features' => process_module_features_get(local_channel(), $features), + '$extra_settings_html' => $extra_settings_html, + '$submit' => t('Submit') )); return $o; diff --git a/Zotlabs/Module/Settings/Photos.php b/Zotlabs/Module/Settings/Photos.php index f403b4d38..9edbaa929 100644 --- a/Zotlabs/Module/Settings/Photos.php +++ b/Zotlabs/Module/Settings/Photos.php @@ -16,6 +16,10 @@ class Photos { process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + return; } diff --git a/Zotlabs/Module/Settings/Profiles.php b/Zotlabs/Module/Settings/Profiles.php index 78dc0160e..2dc037317 100644 --- a/Zotlabs/Module/Settings/Profiles.php +++ b/Zotlabs/Module/Settings/Profiles.php @@ -16,6 +16,10 @@ class Profiles { process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + return; } diff --git a/Zotlabs/Module/Sources.php b/Zotlabs/Module/Sources.php index 5d05244a7..e535f6ebf 100644 --- a/Zotlabs/Module/Sources.php +++ b/Zotlabs/Module/Sources.php @@ -85,7 +85,7 @@ class Sources extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = '<b>Sources App (Not Installed):</b><br>'; + $o = '<b>' . t('Sources App') . ' (' . t('Not Installed') . '):</b><br>'; $o .= t('Automatically import channel content from other channels or feeds'); return $o; } diff --git a/Zotlabs/Module/Settings/Tokens.php b/Zotlabs/Module/Tokens.php index e59cf8d1c..1ba41dcc5 100644 --- a/Zotlabs/Module/Settings/Tokens.php +++ b/Zotlabs/Module/Tokens.php @@ -1,16 +1,24 @@ <?php -namespace Zotlabs\Module\Settings; +namespace Zotlabs\Module; +use App; +use Zotlabs\Web\Controller; +use Zotlabs\Lib\Apps; - -class Tokens { +class Tokens extends Controller { function post() { - $channel = \App::get_channel(); + if(! local_channel()) + return; + + if(! Apps::system_app_installed(local_channel(), 'Guest Access')) + return; + + $channel = App::get_channel(); - check_form_security_token_redirectOnErr('/settings/tokens', 'settings_tokens'); + check_form_security_token_redirectOnErr('tokens', 'tokens'); $token_errs = 0; if(array_key_exists('token',$_POST)) { $atoken_id = (($_POST['atoken_id']) ? intval($_POST['atoken_id']) : 0); @@ -81,13 +89,25 @@ class Tokens { function get() { - $channel = \App::get_channel(); + if(! local_channel()) + return; + + if(! Apps::system_app_installed(local_channel(), 'Guest Access')) { + //Do not display any associated widgets at this point + App::$pdl = ''; + + $o = '<b>' . t('Guest Access App') . ' (' . t('Not Installed') . '):</b><br>'; + $o .= t('Create access tokens so that non-members can access private content'); + return $o; + } + + $channel = App::get_channel(); $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), @@ -99,7 +119,7 @@ class Tokens { $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 = ''; @@ -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/Module/Uexport.php b/Zotlabs/Module/Uexport.php index 9af1887dc..3d1587b87 100644 --- a/Zotlabs/Module/Uexport.php +++ b/Zotlabs/Module/Uexport.php @@ -1,18 +1,24 @@ <?php namespace Zotlabs\Module; +use App; +use Zotlabs\Lib\Apps; +use Zotlabs\Web\Controller; -class Uexport extends \Zotlabs\Web\Controller { +class Uexport extends Controller { function init() { if(! local_channel()) killme(); - + + if(! Apps::system_app_installed(local_channel(), 'Channel Export')) + return; + if(argc() > 1) { $sections = (($_REQUEST['sections']) ? explode(',',$_REQUEST['sections']) : ''); - $channel = \App::get_channel(); + $channel = App::get_channel(); if(argc() > 1 && intval(argv(1)) > 1900) { $year = intval(argv(1)); @@ -47,6 +53,15 @@ class Uexport extends \Zotlabs\Web\Controller { } function get() { + + if(! Apps::system_app_installed(local_channel(), 'Channel Export')) { + //Do not display any associated widgets at this point + App::$pdl = ''; + + $o = '<b>' . t('Channel Export App') . ' (' . t('Not Installed') . '):</b><br>'; + $o .= t('Export your channel'); + return $o; + } $y = datetime_convert('UTC',date_default_timezone_get(),'now','Y'); diff --git a/Zotlabs/Module/Webpages.php b/Zotlabs/Module/Webpages.php index c6599db3b..787ed5850 100644 --- a/Zotlabs/Module/Webpages.php +++ b/Zotlabs/Module/Webpages.php @@ -45,7 +45,7 @@ class Webpages extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = '<b>Webpages App (Not Installed):</b><br>'; + $o = '<b>' . t('Webpages App') . ' (' . t('Not Installed') . '):</b><br>'; $o .= t('Provide managed web pages on your channel'); return $o; } @@ -208,7 +208,7 @@ class Webpages extends Controller { if(! $r) $x['pagetitle'] = 'home'; - $editor = status_editor($a,$x); + $editor = status_editor($a,$x,false,'Webpages'); $pages = null; diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 0fb5a4605..6be39214e 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -49,7 +49,7 @@ class Wiki extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = '<b>Wiki App (Not Installed):</b><br>'; + $o = '<b>' . t('Wiki App') . ' (' . t('Not Installed') . '):</b><br>'; $o .= t('Provide a wiki for your channel'); return $o; } |