diff options
87 files changed, 972 insertions, 596 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 010947467..aef6756b5 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -337,7 +337,20 @@ class Apps { 'Profiles' => t('Profiles'), 'Privacy Groups' => t('Privacy Groups'), 'Notifications' => t('Notifications'), - 'Order Apps' => t('Order Apps') + 'Order Apps' => t('Order Apps'), + 'CalDAV' => t('CalDAV'), + 'CardDAV' => t('CardDAV'), + 'Channel Sources' => t('Channel Sources'), + 'Gallery' => t('Gallery'), + 'Guest Access' => t('Guest Access'), + 'Notes' => t('Notes'), + 'OAuth Apps Manager' => t('OAuth Apps Manager'), + 'OAuth2 Apps Manager' => t('OAuth2 Apps Manager'), + 'PDL Editor' => t('PDL Editor'), + 'Permission Categories' => t('Permission Categories'), + 'Premium Channel' => t('Premium Channel'), + 'Public Stream' => t('Public Stream'), + 'My Chatrooms' => t('My Chatrooms') ); if(array_key_exists('name',$arr)) { @@ -349,6 +362,9 @@ class Apps { for($x = 0; $x < count($arr); $x++) { if(array_key_exists($arr[$x]['name'],$apps)) { $arr[$x]['name'] = $apps[$arr[$x]['name']]; + } else { + // Try to guess by app name if not in list + $arr[$x]['name'] = t(trim($arr[$x]['name'])); } } } @@ -532,7 +548,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 +676,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/Zotlabs/Lib/Group.php b/Zotlabs/Lib/Group.php index f136a3614..a4ff4fced 100644 --- a/Zotlabs/Lib/Group.php +++ b/Zotlabs/Lib/Group.php @@ -20,11 +20,11 @@ class Group { // access lists. What we're doing here is reviving the dead group, but old content which // was restricted to this group may now be seen by the new group members. - $z = q("SELECT * FROM groups WHERE id = %d LIMIT 1", + $z = q("SELECT * FROM pgrp WHERE id = %d LIMIT 1", intval($r) ); if(($z) && $z[0]['deleted']) { - q('UPDATE groups SET deleted = 0 WHERE id = %d', intval($z[0]['id'])); + q('UPDATE pgrp SET deleted = 0 WHERE id = %d', intval($z[0]['id'])); notice( t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL); } return true; @@ -34,13 +34,13 @@ class Group { $dups = false; $hash = random_string(32) . str_replace(['<','>'],['.','.'], $name); - $r = q("SELECT id FROM groups WHERE hash = '%s' LIMIT 1", dbesc($hash)); + $r = q("SELECT id FROM pgrp WHERE hash = '%s' LIMIT 1", dbesc($hash)); if($r) $dups = true; } while($dups == true); - $r = q("INSERT INTO groups ( hash, uid, visible, gname ) + $r = q("INSERT INTO pgrp ( hash, uid, visible, gname ) VALUES( '%s', %d, %d, '%s' ) ", dbesc($hash), intval($uid), @@ -58,7 +58,7 @@ class Group { static function remove($uid,$name) { $ret = false; if(x($uid) && x($name)) { - $r = q("SELECT id, hash FROM groups WHERE uid = %d AND gname = '%s' LIMIT 1", + $r = q("SELECT id, hash FROM pgrp WHERE uid = %d AND gname = '%s' LIMIT 1", intval($uid), dbesc($name) ); @@ -103,13 +103,13 @@ class Group { } // remove all members - $r = q("DELETE FROM group_member WHERE uid = %d AND gid = %d ", + $r = q("DELETE FROM pgrp_member WHERE uid = %d AND gid = %d ", intval($uid), intval($group_id) ); // remove group - $r = q("UPDATE groups SET deleted = 1 WHERE uid = %d AND gname = '%s'", + $r = q("UPDATE pgrp SET deleted = 1 WHERE uid = %d AND gname = '%s'", intval($uid), dbesc($name) ); @@ -127,7 +127,7 @@ class Group { static function byname($uid,$name) { if((! $uid) || (! strlen($name))) return false; - $r = q("SELECT * FROM groups WHERE uid = %d AND gname = '%s' LIMIT 1", + $r = q("SELECT * FROM pgrp WHERE uid = %d AND gname = '%s' LIMIT 1", intval($uid), dbesc($name) ); @@ -140,7 +140,7 @@ class Group { static function rec_byhash($uid,$hash) { if((! $uid) || (! strlen($hash))) return false; - $r = q("SELECT * FROM groups WHERE uid = %d AND hash = '%s' LIMIT 1", + $r = q("SELECT * FROM pgrp WHERE uid = %d AND hash = '%s' LIMIT 1", intval($uid), dbesc($hash) ); @@ -156,7 +156,7 @@ class Group { return false; if(! ( $uid && $gid && $member)) return false; - $r = q("DELETE FROM group_member WHERE uid = %d AND gid = %d AND xchan = '%s' ", + $r = q("DELETE FROM pgrp_member WHERE uid = %d AND gid = %d AND xchan = '%s' ", intval($uid), intval($gid), dbesc($member) @@ -174,7 +174,7 @@ class Group { if((! $gid) || (! $uid) || (! $member)) return false; - $r = q("SELECT * FROM group_member WHERE uid = %d AND gid = %d AND xchan = '%s' LIMIT 1", + $r = q("SELECT * FROM pgrp_member WHERE uid = %d AND gid = %d AND xchan = '%s' LIMIT 1", intval($uid), intval($gid), dbesc($member) @@ -184,7 +184,7 @@ class Group { // we indicate success because the group member was in fact created // -- It was just created at another time if(! $r) - $r = q("INSERT INTO group_member (uid, gid, xchan) + $r = q("INSERT INTO pgrp_member (uid, gid, xchan) VALUES( %d, %d, '%s' ) ", intval($uid), intval($gid), @@ -200,9 +200,9 @@ class Group { static function members($gid) { $ret = array(); if(intval($gid)) { - $r = q("SELECT * FROM group_member - LEFT JOIN abook ON abook_xchan = group_member.xchan left join xchan on xchan_hash = abook_xchan - WHERE gid = %d AND abook_channel = %d and group_member.uid = %d and xchan_deleted = 0 and abook_self = 0 and abook_blocked = 0 and abook_pending = 0 ORDER BY xchan_name ASC ", + $r = q("SELECT * FROM pgrp_member + LEFT JOIN abook ON abook_xchan = pgrp_member.xchan left join xchan on xchan_hash = abook_xchan + WHERE gid = %d AND abook_channel = %d and pgrp_member.uid = %d and xchan_deleted = 0 and abook_self = 0 and abook_blocked = 0 and abook_pending = 0 ORDER BY xchan_name ASC ", intval($gid), intval(local_channel()), intval(local_channel()) @@ -216,7 +216,7 @@ class Group { static function members_xchan($gid) { $ret = []; if(intval($gid)) { - $r = q("SELECT xchan FROM group_member WHERE gid = %d AND uid = %d", + $r = q("SELECT xchan FROM pgrp_member WHERE gid = %d AND uid = %d", intval($gid), intval(local_channel()) ); @@ -254,7 +254,7 @@ class Group { $grps = []; $o = ''; - $r = q("SELECT * FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC", + $r = q("SELECT * FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC", intval($uid) ); $grps[] = array('name' => '', 'hash' => '0', 'selected' => ''); @@ -286,7 +286,7 @@ class Group { $groups = array(); - $r = q("SELECT * FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC", + $r = q("SELECT * FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC", intval($_SESSION['uid']) ); $member_of = array(); @@ -366,7 +366,7 @@ class Group { stringify_array_elms($x,true); $groups = implode(',', $x); if($groups) { - $r = q("SELECT xchan FROM group_member WHERE gid IN ( select id from groups where hash in ( $groups ))"); + $r = q("SELECT xchan FROM pgrp_member WHERE gid IN ( select id from pgrp where hash in ( $groups ))"); if($r) { foreach($r as $rr) { $ret[] = $rr['xchan']; @@ -379,7 +379,7 @@ class Group { static function member_of($c) { - $r = q("SELECT groups.gname, groups.id FROM groups LEFT JOIN group_member ON group_member.gid = groups.id WHERE group_member.xchan = '%s' AND groups.deleted = 0 ORDER BY groups.gname ASC ", + $r = q("SELECT pgrp.gname, pgrp.id FROM pgrp LEFT JOIN pgrp_member ON pgrp_member.gid = pgrp.id WHERE pgrp_member.xchan = '%s' AND pgrp.deleted = 0 ORDER BY pgrp.gname ASC ", dbesc($c) ); @@ -389,7 +389,7 @@ class Group { static function containing($uid,$c) { - $r = q("SELECT gid FROM group_member WHERE uid = %d AND group_member.xchan = '%s' ", + $r = q("SELECT gid FROM pgrp_member WHERE uid = %d AND pgrp_member.xchan = '%s' ", intval($uid), dbesc($c) ); diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php index 938d484b7..d037a0058 100644 --- a/Zotlabs/Lib/Libsync.php +++ b/Zotlabs/Lib/Libsync.php @@ -122,13 +122,13 @@ class Libsync { } if($groups_changed) { - $r = q("select hash as collection, visible, deleted, gname as name from groups where uid = %d", + $r = q("select hash as collection, visible, deleted, gname as name from pgrp where uid = %d", intval($uid) ); if($r) $info['collections'] = $r; - $r = q("select groups.hash as collection, group_member.xchan as member from groups left join group_member on groups.id = group_member.gid where group_member.uid = %d", + $r = q("select pgrp.hash as collection, pgrp_member.xchan as member from pgrp left join pgrp_member on pgrp.id = pgrp_member.gid where pgrp_member.uid = %d", intval($uid) ); if($r) @@ -464,7 +464,7 @@ class Libsync { // sync collections (privacy groups) oh joy... if(array_key_exists('collections',$arr) && is_array($arr['collections']) && count($arr['collections'])) { - $x = q("select * from groups where uid = %d", + $x = q("select * from pgrp where uid = %d", intval($channel['channel_id']) ); foreach($arr['collections'] as $cl) { @@ -480,7 +480,7 @@ class Libsync { if(($y['gname'] != $cl['name']) || ($y['visible'] != $cl['visible']) || ($y['deleted'] != $cl['deleted'])) { - q("update groups set gname = '%s', visible = %d, deleted = %d where hash = '%s' and uid = %d", + q("update pgrp set gname = '%s', visible = %d, deleted = %d where hash = '%s' and uid = %d", dbesc($cl['name']), intval($cl['visible']), intval($cl['deleted']), @@ -489,14 +489,14 @@ class Libsync { ); } if(intval($cl['deleted']) && (! intval($y['deleted']))) { - q("delete from group_member where gid = %d", + q("delete from pgrp_member where gid = %d", intval($y['id']) ); } } } if(! $found) { - $r = q("INSERT INTO groups ( hash, uid, visible, deleted, gname ) + $r = q("INSERT INTO pgrp ( hash, uid, visible, deleted, gname ) VALUES( '%s', %d, %d, %d, '%s' ) ", dbesc($cl['collection']), intval($channel['channel_id']), @@ -520,10 +520,10 @@ class Libsync { } } if(! $found_local) { - q("delete from group_member where gid = %d", + q("delete from pgrp_member where gid = %d", intval($y['id']) ); - q("update groups set deleted = 1 where id = %d and uid = %d", + q("update pgrp set deleted = 1 where id = %d and uid = %d", intval($y['id']), intval($channel['channel_id']) ); @@ -533,7 +533,7 @@ class Libsync { } // reload the group list with any updates - $x = q("select * from groups where uid = %d", + $x = q("select * from pgrp where uid = %d", intval($channel['channel_id']) ); @@ -560,7 +560,7 @@ class Libsync { if(isset($y['hash']) && isset($members[$y['hash']])) { foreach($members[$y['hash']] as $member) { $found = false; - $z = q("select xchan from group_member where gid = %d and uid = %d and xchan = '%s' limit 1", + $z = q("select xchan from pgrp_member where gid = %d and uid = %d and xchan = '%s' limit 1", intval($y['id']), intval($channel['channel_id']), dbesc($member) @@ -571,7 +571,7 @@ class Libsync { // if somebody is in the group that wasn't before - add them if(! $found) { - q("INSERT INTO group_member (uid, gid, xchan) + q("INSERT INTO pgrp_member (uid, gid, xchan) VALUES( %d, %d, '%s' ) ", intval($channel['channel_id']), intval($y['id']), @@ -582,7 +582,7 @@ class Libsync { } // now retrieve a list of members we have on this site - $m = q("select xchan from group_member where gid = %d and uid = %d", + $m = q("select xchan from pgrp_member where gid = %d and uid = %d", intval($y['id']), intval($channel['channel_id']) ); @@ -590,7 +590,7 @@ class Libsync { foreach($m as $mm) { // if the local existing member isn't in the list we just received - remove them if(! in_array($mm['xchan'],$members[$y['hash']])) { - q("delete from group_member where xchan = '%s' and gid = %d and uid = %d", + q("delete from pgrp_member where xchan = '%s' and gid = %d and uid = %d", dbesc($mm['xchan']), intval($y['id']), intval($channel['channel_id']) 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/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/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 @@ <?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>Premium Channel App (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..2e886aa64 100644 --- a/Zotlabs/Module/Defperms.php +++ b/Zotlabs/Module/Defperms.php @@ -1,6 +1,7 @@ <?php namespace Zotlabs\Module; +use Zotlabs\Lib\Apps; require_once('include/socgraph.php'); require_once('include/selectors.php'); @@ -238,7 +239,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/Group.php b/Zotlabs/Module/Group.php index acebe995d..bfe051d59 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>Privacy Groups App (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/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/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/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/Network.php b/Zotlabs/Module/Network.php index ffe605538..e7b150faf 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -108,7 +108,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()) ); diff --git a/Zotlabs/Module/New_channel.php b/Zotlabs/Module/New_channel.php index 97a46a43e..ebdd6c37f 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 = ''; @@ -186,7 +189,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..cd383a6c2 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>Notes App (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..fbcc48ead 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>OAuth Apps Manager App (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..c27d7534b 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>OAuth2 Apps Manager App (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..d0bde7715 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>PDL Editor App (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..3d068862a 100644 --- a/Zotlabs/Module/Settings/Permcats.php +++ b/Zotlabs/Module/Permcats.php @@ -1,19 +1,24 @@ <?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(); @@ -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>Permission Categories App (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, diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php index 27a8e695d..73cb4decb 100644 --- a/Zotlabs/Module/Settings/Channel.php +++ b/Zotlabs/Module/Settings/Channel.php @@ -63,7 +63,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 +71,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') ) ); diff --git a/Zotlabs/Module/Settings/Channel_home.php b/Zotlabs/Module/Settings/Channel_home.php new file mode 100644 index 000000000..1d1cc370b --- /dev/null +++ b/Zotlabs/Module/Settings/Channel_home.php @@ -0,0 +1,43 @@ +<?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); + + build_sync_packet(); + 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('Channel Home Settings'), + '$features' => process_module_features_get(local_channel(), $features), + '$submit' => t('Submit') + )); + + return $o; + } + +} 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..2682bcafc --- /dev/null +++ b/Zotlabs/Module/Settings/Directory.php @@ -0,0 +1,43 @@ +<?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(); + 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..0c63a3056 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 @@ -204,15 +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' => 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/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/Tokens.php b/Zotlabs/Module/Tokens.php index e59cf8d1c..ae03a499a 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>Guest Access App (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/Update/_1221.php b/Zotlabs/Update/_1221.php new file mode 100644 index 000000000..75b400adc --- /dev/null +++ b/Zotlabs/Update/_1221.php @@ -0,0 +1,25 @@ +<?php + +namespace Zotlabs\Update; + +class _1221 { + + function run() { + + q("START TRANSACTION"); + + $r1 = q("ALTER table " . TQUOT . 'groups' . TQUOT . " rename to pgrp "); + $r2 = q("ALTER table " . TQUOT . 'group_member' . TQUOT . " rename to pgrp_member "); + + + if($r1 && $r2) { + q("COMMIT"); + return UPDATE_SUCCESS; + } + + q("ROLLBACK"); + return UPDATE_FAILED; + + } + +} diff --git a/Zotlabs/Widget/Activity_filter.php b/Zotlabs/Widget/Activity_filter.php index d725f8b55..c27a5d48b 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,8 +46,8 @@ class Activity_filter { ]; } - if(feature_enabled(local_channel(),'groups')) { - $groups = q("SELECT * FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC", + if(Apps::system_app_installed(local_channel(), 'Privacy Groups')) { + $groups = q("SELECT * FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC", intval(local_channel()) ); 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/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/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php index f35d6f147..238b8071e 100644 --- a/Zotlabs/Widget/Settings_menu.php +++ b/Zotlabs/Widget/Settings_menu.php @@ -45,19 +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', - 'selected' => ((argv(1) === 'featured') ? 'active' : ''), - ); $tabs[] = array( 'label' => t('Display settings'), @@ -65,6 +52,12 @@ class Settings_menu { 'selected' => ((argv(1) === 'display') ? 'active' : ''), ); + $tabs[] = array( + 'label' => t('Addon settings'), + 'url' => z_root().'/settings/featured', + 'selected' => ((argv(1) === 'featured') ? 'active' : ''), + ); + if($hublocs) { $tabs[] = array( 'label' => t('Manage locations'), @@ -79,39 +72,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'), - 'url' => z_root() . '/settings/tokens', - 'selected' => ((argv(1) === 'tokens') ? 'active' : ''), - ); - } - - 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'), @@ -120,22 +80,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 +88,4 @@ class Settings_menu { )); } -}
\ No newline at end of file +} diff --git a/app/channel.apd b/app/channel.apd index ab79e7047..f0f435ef5 100644 --- a/app/channel.apd +++ b/app/channel.apd @@ -1,5 +1,5 @@ -version: 1 -url: $baseurl/channel/$nick +version: 1.1 +url: $baseurl/channel/$nick, $baseurl/settings/channel_home requires: local_channel name: Channel Home photo: icon:home 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/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/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/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/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/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 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 @@ -50,11 +50,11 @@ require_once('include/attach.php'); require_once('include/bbcode.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); -define ( 'STD_VERSION', '3.7.3' ); +define ( 'STD_VERSION', '3.7.4' ); define ( 'ZOT_REVISION', '6.0a' ); -define ( 'DB_UPDATE_VERSION', 1220 ); +define ( 'DB_UPDATE_VERSION', 1221 ); define ( 'PROJECT_BASE', __DIR__ ); 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 diff --git a/include/acl_selectors.php b/include/acl_selectors.php index bada3e528..c7a87afee 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -89,7 +89,7 @@ function populate_acl($defaults = null,$show_jotnets = true, $emptyACL_descripti } } - $r = q("SELECT id, hash, gname FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC", + $r = q("SELECT id, hash, gname FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC", intval(local_channel()) ); diff --git a/include/api_zot.php b/include/api_zot.php index 921242152..6a5b9a268 100644 --- a/include/api_zot.php +++ b/include/api_zot.php @@ -350,20 +350,20 @@ $r = null; if($_REQUEST['group_id']) { - $r = q("select * from groups where uid = %d and id = %d limit 1", + $r = q("select * from pgrp where uid = %d and id = %d limit 1", intval(api_user()), intval($_REQUEST['group_id']) ); } elseif($_REQUEST['group_name']) { - $r = q("select * from groups where uid = %d and gname = '%s' limit 1", + $r = q("select * from pgrp where uid = %d and gname = '%s' limit 1", intval(api_user()), dbesc($_REQUEST['group_name']) ); } if($r) { - $x = q("select * from group_member left join abook on abook_xchan = xchan and abook_channel = group_member.uid left join xchan on group_member.xchan = xchan.xchan_hash + $x = q("select * from pgrp_member left join abook on abook_xchan = xchan and abook_channel = pgrp_member.uid left join xchan on pgrp_member.xchan = xchan.xchan_hash where gid = %d", intval($r[0]['id']) ); @@ -376,7 +376,7 @@ if(api_user() === false) return false; - $r = q("select * from groups where uid = %d", + $r = q("select * from pgrp where uid = %d", intval(api_user()) ); json_return_and_die($r); diff --git a/include/channel.php b/include/channel.php index 7f49deb2e..33e438e53 100644 --- a/include/channel.php +++ b/include/channel.php @@ -447,7 +447,7 @@ function create_identity($arr) { // if our role_permissions indicate that we're using a default collection ACL, add it. if(is_array($role_permissions) && $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($newuid), dbesc( t('Friends') ) ); @@ -837,14 +837,14 @@ function identity_basic_export($channel_id, $sections = null) { $ret['hubloc'] = $r; } - $r = q("select * from groups where uid = %d ", + $r = q("select * from pgrp where uid = %d ", intval($channel_id) ); if($r) $ret['group'] = $r; - $r = q("select * from group_member where uid = %d ", + $r = q("select * from pgrp_member where uid = %d ", intval($channel_id) ); if($r) @@ -2573,8 +2573,8 @@ function channel_remove($channel_id, $local = true, $unset_session = false) { q("DELETE FROM chatroom WHERE cr_uid = %d", intval($channel_id)); q("DELETE FROM conv WHERE uid = %d", intval($channel_id)); - q("DELETE FROM groups WHERE uid = %d", intval($channel_id)); - q("DELETE FROM group_member WHERE uid = %d", intval($channel_id)); + q("DELETE FROM pgrp WHERE uid = %d", intval($channel_id)); + q("DELETE FROM pgrp_member WHERE uid = %d", intval($channel_id)); q("DELETE FROM event WHERE uid = %d", intval($channel_id)); q("DELETE FROM mail WHERE channel_id = %d", intval($channel_id)); q("DELETE FROM menu WHERE menu_channel_id = %d", intval($channel_id)); diff --git a/include/connections.php b/include/connections.php index 129bcdc8d..d97ea3887 100644 --- a/include/connections.php +++ b/include/connections.php @@ -296,7 +296,7 @@ function remove_all_xchan_resources($xchan, $channel_id = 0) { $r = q("delete from event where event_xchan = '%s'", dbesc($xchan) ); - $r = q("delete from group_member where xchan = '%s'", + $r = q("delete from pgrp_member where xchan = '%s'", dbesc($xchan) ); $r = q("delete from mail where ( from_xchan = '%s' or to_xchan = '%s' )", @@ -402,7 +402,7 @@ function contact_remove($channel_id, $abook_id) { intval($channel_id) ); - $r = q("delete from group_member where xchan = '%s' and uid = %d", + $r = q("delete from pgrp_member where xchan = '%s' and uid = %d", dbesc($abook['abook_xchan']), intval($channel_id) ); 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 37445c643..ccf3c5faf 100644 --- a/include/features.php +++ b/include/features.php @@ -71,123 +71,49 @@ function get_features($filtered = true, $level = (-1)) { $arr = [ - // General - 'general' => [ - - 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), - ], + 'calendar' => [ -/* - [ - '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), - ], + t('CalDAV'), [ - 'premium_channel', - t('Premium Channel'), - t('Allows you to set restrictions and terms on those that connect with your channel'), + 'cal_first_day', + t('Start calendar week on Monday'), + t('Default is Sunday'), false, - get_config('feature_lock','premium_channel'), - 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), - ], + get_config('feature_lock','cal_first_day') + ] - [ - '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), - ], ], + 'channel_home' => [ - '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), - ], + t('Channel Home'), [ - 'permcats', - t('Permission Categories'), - t('Create custom connection permission limits'), + 'tagadelic', + t('Tag Cloud'), + t('Provide a personal tag cloud on your channel page'), false, - get_config('feature_lock','permcats'), - feature_level('permcats',2), - ], + get_config('feature_lock','tagadelic'), + ] + ], - [ - '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), - ], + 'connections' => [ - [ - '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), - ], + t('Connections'), [ - 'access_tokens', - t('Access Tokens'), - t('Create access tokens so that non-members can access private content.'), + 'connfilter', + t('Connection Filtering'), + t('Filter incoming posts from connections based on keywords/content'), false, - get_config('feature_lock','access_tokens'), - feature_level('access_tokens',2), - ], - + get_config('feature_lock','connfilter') + ] ], + 'conversation' => [ - // Item tools - 'tools' => [ - - t('Post/Comment Tools'), + t('Conversation'), [ 'commtag', @@ -195,16 +121,6 @@ function get_features($filtered = true, $level = (-1)) { t('Ability to tag existing posts'), false, get_config('feature_lock','commtag'), - feature_level('commtag',1), - ], - - [ - 'categories', - t('Post Categories'), - t('Add categories to your posts'), - false, - get_config('feature_lock','categories'), - feature_level('categories',1), ], [ @@ -213,7 +129,6 @@ function get_features($filtered = true, $level = (-1)) { t('Add emoji reaction ability to posts'), true, get_config('feature_lock','emojis'), - feature_level('emojis',1), ], [ @@ -222,7 +137,6 @@ function get_features($filtered = true, $level = (-1)) { t('Ability to file posts under folders'), false, get_config('feature_lock','filing'), - feature_level('filing',2), ], [ @@ -231,7 +145,6 @@ function get_features($filtered = true, $level = (-1)) { t('Ability to dislike posts/comments'), false, get_config('feature_lock','dislike'), - feature_level('dislike',1), ], [ @@ -240,52 +153,36 @@ function get_features($filtered = true, $level = (-1)) { 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), - ], ], -############################################ -############################################ + 'directory' => [ - 'calendar' => [ - - t('CalDAV'), + t('Directory'), [ - 'cal_first_day', - t('Start calendar week on Monday'), - t('Default is Sunday'), + 'advanced_dirsearch', + t('Advanced Directory Search'), + t('Allows creation of complex directory search queries'), false, - get_config('feature_lock','cal_first_day') + get_config('feature_lock','advanced_dirsearch'), ] ], - 'connections' => [ + 'editor' => [ - t('Connections'), + t('Editor'), [ - 'connfilter', - t('Connection Filtering'), - t('Filter incoming posts from connections based on keywords/content'), + 'categories', + t('Post Categories'), + t('Add categories to your posts'), false, - get_config('feature_lock','connfilter') - ] - ], - - 'editor' => [ - - t('Editor'), + get_config('feature_lock','categories'), + feature_level('categories',1), + ], [ 'large_photos', @@ -391,7 +288,7 @@ function get_features($filtered = true, $level = (-1)) { 'nav_channel_select', t('Navigation Channel Select'), t('Change channels directly from within the navigation dropdown menu'), - true, + false, get_config('feature_lock','nav_channel_select'), ] diff --git a/include/group.php b/include/group.php index 56bf210ff..6011af08f 100644 --- a/include/group.php +++ b/include/group.php @@ -14,11 +14,11 @@ function group_add($uid,$name,$public = 0) { // access lists. What we're doing here is reviving the dead group, but old content which // was restricted to this group may now be seen by the new group members. - $z = q("SELECT * FROM groups WHERE id = %d LIMIT 1", + $z = q("SELECT * FROM pgrp WHERE id = %d LIMIT 1", intval($r) ); if(($z) && $z[0]['deleted']) { - q('UPDATE groups SET deleted = 0 WHERE id = %d', intval($z[0]['id'])); + q('UPDATE pgrp SET deleted = 0 WHERE id = %d', intval($z[0]['id'])); notice( t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL); } return true; @@ -28,13 +28,13 @@ function group_add($uid,$name,$public = 0) { $dups = false; $hash = random_string() . $name; - $r = q("SELECT id FROM groups WHERE hash = '%s' LIMIT 1", dbesc($hash)); + $r = q("SELECT id FROM pgrp WHERE hash = '%s' LIMIT 1", dbesc($hash)); if($r) $dups = true; } while($dups == true); - $r = q("INSERT INTO groups ( hash, uid, visible, gname ) + $r = q("INSERT INTO pgrp ( hash, uid, visible, gname ) VALUES( '%s', %d, %d, '%s' ) ", dbesc($hash), intval($uid), @@ -53,7 +53,7 @@ function group_add($uid,$name,$public = 0) { function group_rmv($uid,$name) { $ret = false; if(x($uid) && x($name)) { - $r = q("SELECT id, hash FROM groups WHERE uid = %d AND gname = '%s' LIMIT 1", + $r = q("SELECT id, hash FROM pgrp WHERE uid = %d AND gname = '%s' LIMIT 1", intval($uid), dbesc($name) ); @@ -98,13 +98,13 @@ function group_rmv($uid,$name) { } // remove all members - $r = q("DELETE FROM group_member WHERE uid = %d AND gid = %d ", + $r = q("DELETE FROM pgrp_member WHERE uid = %d AND gid = %d ", intval($uid), intval($group_id) ); // remove group - $r = q("UPDATE groups SET deleted = 1 WHERE uid = %d AND gname = '%s'", + $r = q("UPDATE pgrp SET deleted = 1 WHERE uid = %d AND gname = '%s'", intval($uid), dbesc($name) ); @@ -121,7 +121,7 @@ function group_rmv($uid,$name) { function group_byname($uid,$name) { if((! $uid) || (! strlen($name))) return false; - $r = q("SELECT * FROM groups WHERE uid = %d AND gname = '%s' LIMIT 1", + $r = q("SELECT * FROM pgrp WHERE uid = %d AND gname = '%s' LIMIT 1", intval($uid), dbesc($name) ); @@ -134,7 +134,7 @@ function group_byname($uid,$name) { function group_rec_byhash($uid,$hash) { if((! $uid) || (! strlen($hash))) return false; - $r = q("SELECT * FROM groups WHERE uid = %d AND hash = '%s' LIMIT 1", + $r = q("SELECT * FROM pgrp WHERE uid = %d AND hash = '%s' LIMIT 1", intval($uid), dbesc($hash) ); @@ -149,7 +149,7 @@ function group_rmv_member($uid,$name,$member) { return false; if(! ( $uid && $gid && $member)) return false; - $r = q("DELETE FROM group_member WHERE uid = %d AND gid = %d AND xchan = '%s' ", + $r = q("DELETE FROM pgrp_member WHERE uid = %d AND gid = %d AND xchan = '%s' ", intval($uid), intval($gid), dbesc($member) @@ -169,7 +169,7 @@ function group_add_member($uid,$name,$member,$gid = 0) { if((! $gid) || (! $uid) || (! $member)) return false; - $r = q("SELECT * FROM group_member WHERE uid = %d AND gid = %d AND xchan = '%s' LIMIT 1", + $r = q("SELECT * FROM pgrp_member WHERE uid = %d AND gid = %d AND xchan = '%s' LIMIT 1", intval($uid), intval($gid), dbesc($member) @@ -179,7 +179,7 @@ function group_add_member($uid,$name,$member,$gid = 0) { // we indicate success because the group member was in fact created // -- It was just created at another time if(! $r) - $r = q("INSERT INTO group_member (uid, gid, xchan) + $r = q("INSERT INTO pgrp_member (uid, gid, xchan) VALUES( %d, %d, '%s' ) ", intval($uid), intval($gid), @@ -194,9 +194,9 @@ function group_add_member($uid,$name,$member,$gid = 0) { function group_get_members($gid) { $ret = array(); if(intval($gid)) { - $r = q("SELECT * FROM group_member - LEFT JOIN abook ON abook_xchan = group_member.xchan left join xchan on xchan_hash = abook_xchan - WHERE gid = %d AND abook_channel = %d and group_member.uid = %d and xchan_deleted = 0 and abook_self = 0 and abook_blocked = 0 and abook_pending = 0 ORDER BY xchan_name ASC ", + $r = q("SELECT * FROM pgrp_member + LEFT JOIN abook ON abook_xchan = pgrp_member.xchan left join xchan on xchan_hash = abook_xchan + WHERE gid = %d AND abook_channel = %d and pgrp_member.uid = %d and xchan_deleted = 0 and abook_self = 0 and abook_blocked = 0 and abook_pending = 0 ORDER BY xchan_name ASC ", intval($gid), intval(local_channel()), intval(local_channel()) @@ -210,7 +210,7 @@ function group_get_members($gid) { function group_get_members_xchan($gid) { $ret = array(); if(intval($gid)) { - $r = q("SELECT xchan FROM group_member WHERE gid = %d AND uid = %d", + $r = q("SELECT xchan FROM pgrp_member WHERE gid = %d AND uid = %d", intval($gid), intval(local_channel()) ); @@ -248,7 +248,7 @@ function mini_group_select($uid,$group = '') { $grps = array(); $o = ''; - $r = q("SELECT * FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC", + $r = q("SELECT * FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC", intval($uid) ); $grps[] = array('name' => '', 'hash' => '0', 'selected' => ''); @@ -274,13 +274,13 @@ 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 ''; } $groups = array(); - $r = q("SELECT * FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC", + $r = q("SELECT * FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC", intval($_SESSION['uid']) ); $member_of = array(); @@ -361,7 +361,7 @@ function expand_groups($g) { stringify_array_elms($x,true); $groups = implode(',', $x); if($groups) { - $r = q("SELECT xchan FROM group_member WHERE gid IN ( select id from groups where hash in ( $groups ))"); + $r = q("SELECT xchan FROM pgrp_member WHERE gid IN ( select id from pgrp where hash in ( $groups ))"); if($r) { foreach($r as $rr) { $ret[] = $rr['xchan']; @@ -375,7 +375,7 @@ function expand_groups($g) { function member_of($c) { - $r = q("SELECT groups.gname, groups.id FROM groups LEFT JOIN group_member ON group_member.gid = groups.id WHERE group_member.xchan = '%s' AND groups.deleted = 0 ORDER BY groups.gname ASC ", + $r = q("SELECT pgrp.gname, pgrp.id FROM pgrp LEFT JOIN pgrp_member ON pgrp_member.gid = pgrp.id WHERE pgrp_member.xchan = '%s' AND pgrp.deleted = 0 ORDER BY pgrp.gname ASC ", dbesc($c) ); @@ -385,7 +385,7 @@ function member_of($c) { function groups_containing($uid,$c) { - $r = q("SELECT gid FROM group_member WHERE uid = %d AND group_member.xchan = '%s' ", + $r = q("SELECT gid FROM pgrp_member WHERE uid = %d AND pgrp_member.xchan = '%s' ", intval($uid), dbesc($c) ); diff --git a/include/items.php b/include/items.php index c817c5afb..58461cc3a 100755 --- a/include/items.php +++ b/include/items.php @@ -4159,7 +4159,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C $sql_extra .= protect_sprintf(term_query('item', $arr['cat'], TERM_CATEGORY)); if($arr['gid'] && $uid) { - $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($arr['group']), intval($uid) ); 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'); diff --git a/include/security.php b/include/security.php index ffdd1d7ea..493d34699 100644 --- a/include/security.php +++ b/include/security.php @@ -577,7 +577,7 @@ function init_groups_visitor($contact_id) { // physical groups this channel is a member of - $r = q("SELECT hash FROM groups left join group_member on groups.id = group_member.gid WHERE xchan = '%s' ", + $r = q("SELECT hash FROM pgrp left join pgrp_member on pgrp.id = pgrp_member.gid WHERE xchan = '%s' ", dbesc($contact_id) ); if($r) { diff --git a/include/text.php b/include/text.php index 4b5442985..7782eac40 100644 --- a/include/text.php +++ b/include/text.php @@ -2737,7 +2737,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag, $i $grp = group_byname($profile_uid,$name); if($grp) { - $g = q("select hash from groups where id = %d and visible = 1 limit 1", + $g = q("select hash from pgrp where id = %d and visible = 1 limit 1", intval($grp) ); if($g && $exclusive) { diff --git a/include/xchan.php b/include/xchan.php index 8c9c09c72..aad56063f 100644 --- a/include/xchan.php +++ b/include/xchan.php @@ -176,7 +176,7 @@ function xchan_change_key($oldx,$newx,$data) { $tables = [ 'abook' => 'abook_xchan', 'abconfig' => 'xchan', - 'group_member' => 'xchan', + 'pgrp_member' => 'xchan', 'chat' => 'chat_xchan', 'chatpresence' => 'cp_xchan', 'event' => 'event_xchan', diff --git a/include/zot.php b/include/zot.php index e31d650d2..1a632cf87 100644 --- a/include/zot.php +++ b/include/zot.php @@ -3320,13 +3320,13 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) { } if($groups_changed) { - $r = q("select hash as collection, visible, deleted, gname as name from groups where uid = %d", + $r = q("select hash as collection, visible, deleted, gname as name from pgrp where uid = %d", intval($uid) ); if($r) $info['collections'] = $r; - $r = q("select groups.hash as collection, group_member.xchan as member from groups left join group_member on groups.id = group_member.gid where group_member.uid = %d", + $r = q("select pgrp.hash as collection, pgrp_member.xchan as member from pgrp left join pgrp_member on pgrp.id = pgrp_member.gid where pgrp_member.uid = %d", intval($uid) ); if($r) @@ -3734,7 +3734,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { // sync collections (privacy groups) oh joy... if(array_key_exists('collections',$arr) && is_array($arr['collections']) && count($arr['collections'])) { - $x = q("select * from groups where uid = %d", + $x = q("select * from pgrp where uid = %d", intval($channel['channel_id']) ); foreach($arr['collections'] as $cl) { @@ -3750,7 +3750,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { if(($y['gname'] != $cl['name']) || ($y['visible'] != $cl['visible']) || ($y['deleted'] != $cl['deleted'])) { - q("update groups set gname = '%s', visible = %d, deleted = %d where hash = '%s' and uid = %d", + q("update pgrp set gname = '%s', visible = %d, deleted = %d where hash = '%s' and uid = %d", dbesc($cl['name']), intval($cl['visible']), intval($cl['deleted']), @@ -3759,14 +3759,14 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { ); } if(intval($cl['deleted']) && (! intval($y['deleted']))) { - q("delete from group_member where gid = %d", + q("delete from pgrp_member where gid = %d", intval($y['id']) ); } } } if(! $found) { - $r = q("INSERT INTO groups ( hash, uid, visible, deleted, gname ) + $r = q("INSERT INTO pgrp ( hash, uid, visible, deleted, gname ) VALUES( '%s', %d, %d, %d, '%s' ) ", dbesc($cl['collection']), intval($channel['channel_id']), @@ -3790,10 +3790,10 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { } } if(! $found_local) { - q("delete from group_member where gid = %d", + q("delete from pgrp_member where gid = %d", intval($y['id']) ); - q("update groups set deleted = 1 where id = %d and uid = %d", + q("update pgrp set deleted = 1 where id = %d and uid = %d", intval($y['id']), intval($channel['channel_id']) ); @@ -3803,7 +3803,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { } // reload the group list with any updates - $x = q("select * from groups where uid = %d", + $x = q("select * from pgrp where uid = %d", intval($channel['channel_id']) ); @@ -3830,7 +3830,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { if(isset($y['hash']) && isset($members[$y['hash']])) { foreach($members[$y['hash']] as $member) { $found = false; - $z = q("select xchan from group_member where gid = %d and uid = %d and xchan = '%s' limit 1", + $z = q("select xchan from pgrp_member where gid = %d and uid = %d and xchan = '%s' limit 1", intval($y['id']), intval($channel['channel_id']), dbesc($member) @@ -3841,7 +3841,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { // if somebody is in the group that wasn't before - add them if(! $found) { - q("INSERT INTO group_member (uid, gid, xchan) + q("INSERT INTO pgrp_member (uid, gid, xchan) VALUES( %d, %d, '%s' ) ", intval($channel['channel_id']), intval($y['id']), @@ -3852,7 +3852,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { } // now retrieve a list of members we have on this site - $m = q("select xchan from group_member where gid = %d and uid = %d", + $m = q("select xchan from pgrp_member where gid = %d and uid = %d", intval($y['id']), intval($channel['channel_id']) ); @@ -3860,7 +3860,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { foreach($m as $mm) { // if the local existing member isn't in the list we just received - remove them if(! in_array($mm['xchan'],$members[$y['hash']])) { - q("delete from group_member where xchan = '%s' and gid = %d and uid = %d", + q("delete from pgrp_member where xchan = '%s' and gid = %d and uid = %d", dbesc($mm['xchan']), intval($y['id']), intval($channel['channel_id']) diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql index 9b78ae8d4..a5db8e184 100644 --- a/install/schema_mysql.sql +++ b/install/schema_mysql.sql @@ -1,4 +1,3 @@ - CREATE TABLE IF NOT EXISTS `abconfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `chan` int(10) unsigned NOT NULL DEFAULT 0 , @@ -462,7 +461,7 @@ CREATE TABLE IF NOT EXISTS `event` ( KEY `event_priority` (`event_priority`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -CREATE TABLE IF NOT EXISTS `groups` ( +CREATE TABLE IF NOT EXISTS `pgrp` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `hash` char(191) NOT NULL DEFAULT '', `uid` int(10) unsigned NOT NULL DEFAULT 0 , @@ -477,7 +476,7 @@ CREATE TABLE IF NOT EXISTS `groups` ( KEY `gname` (`gname`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -CREATE TABLE IF NOT EXISTS `group_member` ( +CREATE TABLE IF NOT EXISTS `pgrp_member` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `uid` int(10) unsigned NOT NULL DEFAULT 0 , `gid` int(10) unsigned NOT NULL DEFAULT 0 , diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql index 7f118646e..cb4476628 100644 --- a/install/schema_postgres.sql +++ b/install/schema_postgres.sql @@ -434,18 +434,18 @@ create index "event_status_idx" on event ("event_status"); create index "event_sequence_idx" on event ("event_sequence"); create index "event_priority_idx" on event ("event_priority"); -CREATE TABLE "group_member" ( +CREATE TABLE "pgrp_member" ( "id" serial NOT NULL, "uid" bigint NOT NULL, "gid" bigint NOT NULL, "xchan" text NOT NULL DEFAULT '', PRIMARY KEY ("id") ); -create index "groupmember_uid" on group_member ("uid"); -create index "groupmember_gid" on group_member ("gid"); -create index "groupmember_xchan" on group_member ("xchan"); +create index "groupmember_uid" on pgrp_member ("uid"); +create index "groupmember_gid" on pgrp_member ("gid"); +create index "groupmember_xchan" on pgrp_member ("xchan"); -CREATE TABLE "groups" ( +CREATE TABLE "pgrp" ( "id" serial NOT NULL, "hash" text NOT NULL DEFAULT '', "uid" bigint NOT NULL, @@ -455,10 +455,10 @@ CREATE TABLE "groups" ( PRIMARY KEY ("id") ); -create index "groups_uid_idx" on groups ("uid"); -create index "groups_visible_idx" on groups ("visible"); -create index "groups_deleted_idx" on groups ("deleted"); -create index "groups_hash_idx" on groups ("hash"); +create index "groups_uid_idx" on pgrp ("uid"); +create index "groups_visible_idx" on pgrp ("visible"); +create index "groups_deleted_idx" on pgrp ("deleted"); +create index "groups_hash_idx" on pgrp ("hash"); CREATE TABLE "hook" ( "id" serial NOT NULL, 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; +} 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/theme/redbasic/php/config.php b/view/theme/redbasic/php/config.php index f98182739..0a779529d 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(feature_enabled(local_channel(),'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 advanced 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/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 @@ </div> {{if $permcat_enable}} - <a href="settings/permcats" class="pull-right"><i class="fa fa-plus"></i> {{$permcat_new}}</a> + <a href="permcats" class="pull-right"><i class="fa fa-plus"></i> {{$permcat_new}}</a> {{include file="field_select.tpl" field=$permcat}} {{/if}} 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}} </div> {{/if}} + {{if $desc}} <div id="channels-desc" class="section-content-info-wrapper"> {{$desc}} </div> + {{/if}} {{foreach $all_channels as $chn}} {{include file="channel.tpl" channel=$chn}} {{/foreach}} 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 @@ <div id="page-spinner" class="spinner-wrapper"> <div class="spinner m"></div> </div> - - +<div class="modal" id="conversation_settings" tabindex="-1" role="dialog" aria-labelledby="conversation_settings_label" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h3 class="modal-title" id="conversation_settings_label">{{$conversation_tools}}</h3> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + </div> + <div class="modal-body" id="conversation_settings_body"> + {{$wait}} + </div> + </div><!-- /.modal-content --> + </div><!-- /.modal-dialog --> +</div><!-- /.modal --> 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 @@ <div class="dropdown-divider"></div> <a class="dropdown-item" href="dreport/{{$item.mid}}">{{$item.dreport}}</a> {{/if}} + {{if $item.settings}} + <div class="dropdown-divider"></div> + <a class="dropdown-item conversation-settings-link" href="" data-toggle="modal" data-target="#conversation_settings">{{$item.settings}}</a> + {{/if}} </div> </div> </div> @@ -210,7 +214,7 @@ <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> - <h4 class="modal-title">{{$response.count}} {{$response.button}}</h4> + <h3 class="modal-title">{{$response.count}} {{$response.button}}</h3> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> </div> <div class="modal-body response-list"> 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 @@ <p>{{$permnote_self}}</p> </div> {{if $permcat_enable}} - <a href="settings/permcats" class="pull-right"><i class="fa fa-plus"></i> {{$permcat_new}}</a> + <a href="permcats" class="pull-right"><i class="fa fa-plus"></i> {{$permcat_new}}</a> {{include file="field_select.tpl" field=$permcat}} {{/if}} diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl index 2137baf9b..cb80c6c7e 100755 --- a/view/tpl/jot.tpl +++ b/view/tpl/jot.tpl @@ -212,7 +212,7 @@ <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> - <h4 class="modal-title" id="expiryModalLabel">{{$jotnets_label}}</h4> + <h3 class="modal-title" id="expiryModalLabel">{{$jotnets_label}}</h3> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> </div> <div class="modal-body"> @@ -239,7 +239,7 @@ <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> - <h4 class="modal-title" id="expiryModalLabel">{{$expires}}</h4> + <h3 class="modal-title" id="expiryModalLabel">{{$expires}}</h3> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> </div> <div class="modal-body form-group" style="width:90%"> @@ -266,7 +266,7 @@ <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> - <h4 class="modal-title" id="createdModalLabel">{{$future_txt}}</h4> + <h3 class="modal-title" id="createdModalLabel">{{$future_txt}}</h3> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> </div> <div class="modal-body form-group" style="width:90%"> @@ -293,7 +293,7 @@ <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> - <h4 class="modal-title" id="embedPhotoModalLabel">{{$embedPhotosModalTitle}}</h4> + <h3 class="modal-title" id="embedPhotoModalLabel">{{$embedPhotosModalTitle}}</h3> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> </div> <div class="modal-body" id="embedPhotoModalBody" > diff --git a/view/tpl/new_channel.tpl b/view/tpl/new_channel.tpl index 51880e1f6..8d72df55b 100755 --- a/view/tpl/new_channel.tpl +++ b/view/tpl/new_channel.tpl @@ -13,23 +13,25 @@ </div> {{/if}} {{/if}} - <form action="new_channel" method="post" id="newchannel-form"> - {{if $default_role}} - <input type="hidden" name="permissions_role" value="{{$default_role}}" /> - {{else}} - {{include file="field_select_grouped.tpl" field=$role}} - {{/if}} - - {{include file="field_input.tpl" field=$name}} - - {{include file="field_input.tpl" field=$nickname}} - <button class="btn btn-primary" type="submit" id="newchannel-submit-button">{{$submit}}</button> - - - <div id="newchannel-submit-end" class="clear"></div> - - <div id="newchannel-import-link" class="descriptive-paragraph" >{{$label_import}}</div> - <div id="newchannel-import-end" class="clear"></div> - </form> + {{if $canadd}} + <form action="new_channel" method="post" id="newchannel-form"> + {{if $default_role}} + <input type="hidden" name="permissions_role" value="{{$default_role}}" /> + {{else}} + {{include file="field_select_grouped.tpl" field=$role}} + {{/if}} + + {{include file="field_input.tpl" field=$name}} + + {{include file="field_input.tpl" field=$nickname}} + <button class="btn btn-primary" type="submit" id="newchannel-submit-button">{{$submit}}</button> + + + <div id="newchannel-submit-end" class="clear"></div> + + <div id="newchannel-import-link" class="descriptive-paragraph" >{{$label_import}}</div> + <div id="newchannel-import-end" class="clear"></div> + </form> + {{/if}} </div> </div> 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}} +<div class="generic-content-wrapper"> + <div class="section-title-wrapper"> + <h2>{{$banner}}</h2> + </div> + <div class="section-content-wrapper"> +{{else}} <div class="widget"> <h3>{{$banner}}</h3> +{{/if}} <textarea name="note_text" id="note-text">{{$text}}</textarea> <script> var noteSaveTimer = null; @@ -32,4 +40,7 @@ noteSaveTimer = setTimeout(noteSaveChanges,10000); } </script> +{{if $app}} +</div> +{{/if}} </div> diff --git a/view/tpl/settings_oauth.tpl b/view/tpl/oauth.tpl index 811cfcec5..881e22e99 100755 --- a/view/tpl/settings_oauth.tpl +++ b/view/tpl/oauth.tpl @@ -4,13 +4,13 @@ </div> <div class="section-content-tools-wrapper"> -<form action="settings/oauth" method="post" autocomplete="off"> +<form action="oauth" method="post" autocomplete="off"> <input type='hidden' name='form_security_token' value='{{$form_security_token}}'> <div id="profile-edit-links"> <ul> <li> - <a id="profile-edit-view-link" href="{{$baseurl}}/settings/oauth/add">{{$add}}</a> + <a id="profile-edit-view-link" href="{{$baseurl}}/oauth/add">{{$add}}</a> </li> </ul> </div> @@ -25,8 +25,8 @@ {{/if}} {{/if}} {{if $app.my}} - <a href="{{$baseurl}}/settings/oauth/edit/{{$app.client_id}}" title="{{$edit}}"><i class="fa fa-pencil btn btn-outline-secondary"></i></a> - <a href="{{$baseurl}}/settings/oauth/delete/{{$app.client_id}}?t={{$form_security_token}}" title="{{$delete}}"><i class="fa fa-trash-o btn btn-outline-secondary"></i></a> + <a href="{{$baseurl}}/oauth/edit/{{$app.client_id}}" title="{{$edit}}"><i class="fa fa-pencil btn btn-outline-secondary"></i></a> + <a href="{{$baseurl}}/oauth/delete/{{$app.client_id}}?t={{$form_security_token}}" title="{{$delete}}"><i class="fa fa-trash-o btn btn-outline-secondary"></i></a> {{/if}} </div> {{/foreach}} diff --git a/view/tpl/settings_oauth2.tpl b/view/tpl/oauth2.tpl index f3bf59a12..a5b48ffce 100755 --- a/view/tpl/settings_oauth2.tpl +++ b/view/tpl/oauth2.tpl @@ -8,13 +8,13 @@ <div id="profile-edit-links"> <ul> <li> - <a id="profile-edit-view-link" href="{{$baseurl}}/settings/oauth2/add">{{$add}}</a> + <a id="profile-edit-view-link" href="{{$baseurl}}/oauth2/add">{{$add}}</a> </li> </ul> </div> {{foreach $apps as $app}} -<form action="settings/oauth2" method="post" autocomplete="off"> +<form action="oauth2" method="post" autocomplete="off"> <input type='hidden' name='form_security_token' value='{{$form_security_token}}'> <input type='hidden' name='name' value='{{$app.client_id}}'> <div class='oauthapp'> @@ -25,8 +25,8 @@ {{/if}} {{/if}} {{if $app.my}} - <a href="{{$baseurl}}/settings/oauth2/edit/{{$app.client_id}}" title="{{$edit}}"><i class="fa fa-pencil btn btn-outline-secondary"></i></a> - <a href="{{$baseurl}}/settings/oauth2/delete/{{$app.client_id}}?t={{$form_security_token}}" title="{{$delete}}"><i class="fa fa-trash-o btn btn-outline-secondary"></i></a> + <a href="{{$baseurl}}/oauth2/edit/{{$app.client_id}}" title="{{$edit}}"><i class="fa fa-pencil btn btn-outline-secondary"></i></a> + <a href="{{$baseurl}}/oauth2/delete/{{$app.client_id}}?t={{$form_security_token}}" title="{{$delete}}"><i class="fa fa-trash-o btn btn-outline-secondary"></i></a> {{/if}} </div> </form> diff --git a/view/tpl/settings_oauth2_edit.tpl b/view/tpl/oauth2_edit.tpl index 399c64977..399c64977 100755 --- a/view/tpl/settings_oauth2_edit.tpl +++ b/view/tpl/oauth2_edit.tpl diff --git a/view/tpl/settings_oauth_edit.tpl b/view/tpl/oauth_edit.tpl index e44b44723..e44b44723 100755 --- a/view/tpl/settings_oauth_edit.tpl +++ b/view/tpl/oauth_edit.tpl diff --git a/view/tpl/settings_permcats.tpl b/view/tpl/permcats.tpl index bbbd41669..2cad2db5b 100644 --- a/view/tpl/settings_permcats.tpl +++ b/view/tpl/permcats.tpl @@ -8,7 +8,7 @@ {{$desc}} </div> - <form action="settings/permcats" id="settings-permcats-form" method="post" autocomplete="off" > + <form action="permcats" id="settings-permcats-form" method="post" autocomplete="off" > <input type='hidden' name='form_security_token' value='{{$form_security_token}}'> {{include file="field_input.tpl" field=$name}} @@ -50,8 +50,8 @@ <table id="permcat-index"> {{foreach $permcats as $k => $v}} <tr class="permcat-row-{{$k}}"> - <td width="99%"><a href="settings/permcats/{{$k}}">{{$v}}</a></td> - <td width="1%"><i class="fa fa-trash-o drop-icons" onClick="dropItem('/settings/permcats/{{$k}}/drop', '.permcat-row-{{$k}}')"></i></td> + <td width="99%"><a href="permcats/{{$k}}">{{$v}}</a></td> + <td width="1%"><i class="fa fa-trash-o drop-icons" onClick="dropItem('permcats/{{$k}}/drop', '.permcat-row-{{$k}}')"></i></td> </tr> {{/foreach}} </table> diff --git a/view/tpl/settings_addon.tpl b/view/tpl/settings_addon.tpl index b5665f579..93bf3d083 100644 --- a/view/tpl/settings_addon.tpl +++ b/view/tpl/settings_addon.tpl @@ -3,11 +3,20 @@ <h2>{{$title}}</h2> </div> <div class="section-content-wrapper"> + {{if $action_url}} <form action="{{$action_url}}" method="post" autocomplete="off"> - <input type='hidden' name='form_security_token' value='{{$form_security_token}}'> - {{$content}} - <div class="settings-submit-wrapper" > - <button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button> - </div> + {{/if}} + {{if $form_security_token}} + <input type='hidden' name='form_security_token' value='{{$form_security_token}}'> + {{/if}} + {{$content}} + {{if $submit}} + <div class="settings-submit-wrapper" > + <button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button> + </div> + {{/if}} + {{if $action_url}} + </form> + {{/if}} </div> </div> diff --git a/view/tpl/settings_display.tpl b/view/tpl/settings_display.tpl index 7600038ea..f96e7f84c 100755 --- a/view/tpl/settings_display.tpl +++ b/view/tpl/settings_display.tpl @@ -68,11 +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}} - {{if $expert}} - <div class="form-group"> - <a class="btn btn-outline-secondary "href="pdledit">{{$layout_editor}}</a> - </div> - {{/if}} + {{include file="field_checkbox.tpl" field=$start_menu}} <div class="settings-submit-wrapper" > <button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button> </div> diff --git a/view/tpl/settings_features.tpl b/view/tpl/settings_features.tpl index 998199c8e..12c4f44f3 100755 --- a/view/tpl/settings_features.tpl +++ b/view/tpl/settings_features.tpl @@ -1,31 +1,10 @@ -<script> - $(document).ready(function() { - $('#id_techlevel').change(function() { - var techlvl = $('#id_techlevel').val(); - window.location.href='{{$baseurl}}/settings/features?f=&techlevel=' + techlvl; - }); - }); -</script> - <div class="generic-content-wrapper"> <div class="section-title-wrapper"> <h2>{{$title}}</h2> </div> <form action="settings/features" method="post" autocomplete="off"> <input type='hidden' name='form_security_token' value='{{$form_security_token}}'> - {{if ! $techlock}} - <div class="section-content-tools-wrapper"> - {{include file="field_select.tpl" field=$techlevel}} - </div> - {{else}} - <input type="hidden" name="techlevel" value="{{$techlevel.2}}" /> - {{/if}} - {{if $hiddens}} - {{foreach $hiddens as $k => $v}} - <input type="hidden" name="feature_{{$k}}" value="{{$v}}" /> - {{/foreach}} - {{/if}} <div class="panel-group" id="settings" role="tablist" aria-multiselectable="true"> {{foreach $features as $g => $f}} <div class="panel"> diff --git a/view/tpl/settings_module.tpl b/view/tpl/settings_module.tpl index cabefc3e5..a701ec364 100755 --- a/view/tpl/settings_module.tpl +++ b/view/tpl/settings_module.tpl @@ -4,15 +4,16 @@ </div> <div class="section-content-wrapper"> <form action="{{$action_url}}" method="post" autocomplete="off"> - <input type='hidden' name='form_security_token' value='{{$form_security_token}}'> - {{if $rpath}} - <input type='hidden' name='rpath' value='{{$rpath}}'> - {{/if}} - {{foreach $features as $feature}} - {{include file="field_checkbox.tpl" field=$feature}} - {{/foreach}} - <div class="settings-submit-wrapper" > - <button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button> - </div> + <input type='hidden' name='form_security_token' value='{{$form_security_token}}'> + {{if $rpath}} + <input type='hidden' name='rpath' value='{{$rpath}}'> + {{/if}} + {{foreach $features as $feature}} + {{include file="field_checkbox.tpl" field=$feature}} + {{/foreach}} + <div class="settings-submit-wrapper" > + <button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button> + </div> + </form> </div> </div> diff --git a/view/tpl/settings_module_ajax.tpl b/view/tpl/settings_module_ajax.tpl new file mode 100644 index 000000000..bd7b6f3df --- /dev/null +++ b/view/tpl/settings_module_ajax.tpl @@ -0,0 +1,11 @@ +<form id="settings_module_ajax_form" action="{{$action_url}}" method="post" autocomplete="off"> + <input type='hidden' name='form_security_token' value='{{$form_security_token}}'> + <input type='hidden' name='aj' value='1'> + {{foreach $features as $feature}} + {{include file="field_checkbox.tpl" field=$feature}} + {{/foreach}} + <div class="settings-submit-wrapper" > + <button id="settings_module_ajax_submit" type="submit" name="submit" class="btn btn-primary">{{$submit}}</button> + </div> +</form> + diff --git a/view/tpl/settings_tokens.tpl b/view/tpl/tokens.tpl index 48190c00c..ccb1f8c61 100644 --- a/view/tpl/settings_tokens.tpl +++ b/view/tpl/tokens.tpl @@ -8,7 +8,7 @@ {{$desc}} </div> - <form action="settings/tokens" id="settings-account-form" method="post" autocomplete="off" > + <form action="tokens" id="settings-account-form" method="post" autocomplete="off" > <input type='hidden' name='form_security_token' value='{{$form_security_token}}'> {{if $atoken}}<input type="hidden" name="atoken_id" value="{{$atoken.atoken_id}}" />{{/if}} {{include file="field_input.tpl" field=$name}} @@ -61,8 +61,8 @@ <table id="atoken-index"> {{foreach $tokens as $t}} <tr id="atoken-index-{{$t.atoken_id}}" class="atoken-index-row"> - <td width="99%"><a href="settings/tokens/{{$t.atoken_id}}">{{$t.atoken_name}}</a></td> - <td width="1%" class="atoken-index-tool"><i class="fa fa-trash-o drop-icons" onClick="dropItem('/settings/tokens/{{$t.atoken_id}}/drop', '#atoken-index-{{$t.atoken_id}}')"></i></td> + <td width="99%"><a href="tokens/{{$t.atoken_id}}">{{$t.atoken_name}}</a></td> + <td width="1%" class="atoken-index-tool"><i class="fa fa-trash-o drop-icons" onClick="dropItem('tokens/{{$t.atoken_id}}/drop', '#atoken-index-{{$t.atoken_id}}')"></i></td> </tr> {{/foreach}} </table> |