diff options
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Daemon/Master.php | 120 | ||||
-rw-r--r-- | Zotlabs/Lib/Apps.php | 13 | ||||
-rw-r--r-- | Zotlabs/Lib/ThreadItem.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Bookmarks.php | 18 | ||||
-rw-r--r-- | Zotlabs/Module/Import.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Network.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Ping.php | 11 | ||||
-rw-r--r-- | Zotlabs/Module/Probe.php | 19 | ||||
-rw-r--r-- | Zotlabs/Module/Pubstream.php | 14 | ||||
-rw-r--r-- | Zotlabs/Module/Randprof.php | 22 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Channel.php | 31 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Channel_home.php | 30 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Network.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Profiles.php | 13 | ||||
-rw-r--r-- | Zotlabs/Module/Suggest.php | 21 | ||||
-rw-r--r-- | Zotlabs/Update/_1222.php | 23 | ||||
-rw-r--r-- | Zotlabs/Update/_1223.php | 23 | ||||
-rw-r--r-- | Zotlabs/Update/_1224.php | 28 | ||||
-rw-r--r-- | Zotlabs/Widget/Activity_filter.php | 2 | ||||
-rw-r--r-- | Zotlabs/Widget/Activity_order.php | 2 |
20 files changed, 340 insertions, 62 deletions
diff --git a/Zotlabs/Daemon/Master.php b/Zotlabs/Daemon/Master.php index 580df97db..ed1adf8fb 100644 --- a/Zotlabs/Daemon/Master.php +++ b/Zotlabs/Daemon/Master.php @@ -3,7 +3,6 @@ namespace Zotlabs\Daemon; if(array_search( __file__ , get_included_files()) === 0) { - require_once('include/cli_startup.php'); array_shift($argv); $argc = count($argv); @@ -17,14 +16,127 @@ if(array_search( __file__ , get_included_files()) === 0) { class Master { + static public $queueworker = null; + static public function Summon($arr) { proc_run('php','Zotlabs/Daemon/Master.php',$arr); } static public function Release($argc,$argv) { cli_startup(); - logger('Master: release: ' . print_r($argv,true), LOGGER_ALL,LOG_DEBUG); - $cls = '\\Zotlabs\\Daemon\\' . $argv[0]; - $cls::run($argc,$argv); + + $maxworkers = get_config('system','max_queue_workers'); + + if (!$maxworkers || $maxworkers == 0) { + logger('Master: release: ' . print_r($argv,true), LOGGER_ALL,LOG_DEBUG); + $cls = '\\Zotlabs\\Daemon\\' . $argv[0]; + $cls::run($argc,$argv); + self::ClearQueue(); + } else { + logger('Master: enqueue: ' . print_r($argv,true), LOGGER_ALL,LOG_DEBUG); + $workinfo = ['argc'=>$argc,'argv'=>$argv]; + q("insert into config (cat,k,v) values ('queuework','%s','%s')", + dbesc(uniqid('workitem:',true)), + dbesc(serialize($workinfo))); + self::Process(); + } + } + + static public function GetWorkerID() { + $maxworkers = get_config('system','max_queue_workers'); + $maxworkers = ($maxworkers) ? $maxworkers : 3; + + $workermaxage = get_config('system','max_queue_worker_age'); + $workermaxage = ($workermaxage) ? $workermaxage : 300; + + $workers = q("select * from config where cat='queueworkers' and k like '%s'", 'workerstarted_%'); + + if (count($workers) > $maxworkers) { + foreach ($workers as $idx => $worker) { + $curtime = time(); + if (($time - $worker['v']) > $workermaxage) { + $k = explode('_',$worker['k']); + q("delete from config where cat='queueworkers' and k='%s'", + 'workerstarted_'.$k[1]); + q("update config set k='workitem' where cat='queuework' and k='%s'", + 'workitem_'.$k[1]); + unset($workers[$idx]); + } + } + if (count($workers) > $maxworkers) { + return false; + } + } + return uniqid(); + + } + + static public function Process() { + + self::$queueworker = self::GetWorkerID(); + + if (!self::$queueworker) { + logger('Master: unable to obtain worker ID.'); + killme(); + } + + set_config('queueworkers','workerstarted_'.self::$queueworker,time()); + + $workersleep = get_config('system','queue_worker_sleep'); + $workersleep = ($workersleep) ? $workersleep : 5; + cli_startup(); + + $work = q("update config set k='%s' where cat='queuework' and k like '%s' limit 1", + 'workitem_'.self::$queueworker, + dbesc('workitem:%')); + $jobs = 0; + while ($work) { + $workitem = q("select * from config where cat='queuework' and k='%s'", + 'workitem_'.self::$queueworker); + + if (isset($workitem[0])) { + $jobs++; + $workinfo = unserialize($workitem[0]['v']); + $argc = $workinfo['argc']; + $argv = $workinfo['argv']; + logger('Master: process: ' . print_r($argv,true), LOGGER_ALL,LOG_DEBUG); + $cls = '\\Zotlabs\\Daemon\\' . $argv[0]; + $cls::run($argc,$argv); + + //Right now we assume that if we get a return, everything is OK. + //At some point we may want to test whether the run returns true/false + // and requeue the work to be tried again. But we probably want + // to implement some sort of "retry interval" first. + + q("delete from config where cat='queuework' and k='%s'", + 'workitem_'.self::$queueworker); + } else { + break; + } + sleep ($workersleep); + $work = q("update config set k='%s' where cat='queuework' and k like '%s' limit 1", + 'workitem_'.self::$queueworker, + dbesc('workitem:%')); + + } + logger('Master: Worker Thread: queue items processed:' . $jobs); + q("delete from config where cat='queueworkers' and k='%s'", + 'workerstarted_'.self::$queueworker); } + + static public function ClearQueue() { + $work = q("select * from config where cat='queuework' and k like '%s'", + dbesc('workitem%')); + foreach ($work as $workitem) { + $workinfo = unserialize($workitem['v']); + $argc = $workinfo['argc']; + $argv = $workinfo['argv']; + logger('Master: process: ' . print_r($argv,true), LOGGER_ALL,LOG_DEBUG); + $cls = '\\Zotlabs\\Daemon\\' . $argv[0]; + $cls::run($argc,$argv); + } + $work = q("delete from config where cat='queuework' and k like '%s'", + dbesc('workitem%')); + } + } diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 7f4bd6ef9..e6757497a 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -59,8 +59,7 @@ class Apps { static public function get_base_apps() { return get_config('system','base_apps',[ 'Connections', - 'Suggest Channels', - 'Grid', + 'Network', 'Settings', 'Files', 'Channel Home', @@ -75,8 +74,6 @@ class Apps { ]); } - - static public function import_system_apps() { if(! local_channel()) return; @@ -306,14 +303,14 @@ class Apps { 'Cards' => t('Cards'), 'Admin' => t('Site Admin'), 'Report Bug' => t('Report Bug'), - 'View Bookmarks' => t('View Bookmarks'), + 'Bookmarks' => t('Bookmarks'), 'Chatrooms' => t('Chatrooms'), 'Connections' => t('Connections'), 'Remote Diagnostics' => t('Remote Diagnostics'), 'Suggest Channels' => t('Suggest Channels'), 'Login' => t('Login'), 'Channel Manager' => t('Channel Manager'), - 'Grid' => t('Activity'), + 'Network' => t('Stream'), 'Settings' => t('Settings'), 'Files' => t('Files'), 'Webpages' => t('Webpages'), @@ -345,7 +342,6 @@ class 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'), @@ -354,7 +350,8 @@ class Apps { 'Permission Categories' => t('Permission Categories'), 'Premium Channel' => t('Premium Channel'), 'Public Stream' => t('Public Stream'), - 'My Chatrooms' => t('My Chatrooms') + 'My Chatrooms' => t('My Chatrooms'), + 'Channel Export' => t('Channel Export') ); if(array_key_exists('name',$arr)) { diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 48018f66c..78714c2c4 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -2,6 +2,8 @@ namespace Zotlabs\Lib; +use Zotlabs\Lib\Apps; + require_once('include/text.php'); /** @@ -272,7 +274,7 @@ class ThreadItem { } $has_bookmarks = false; - if(is_array($item['term'])) { + if(Apps::system_app_installed(local_channel(), 'Bookmarks') && is_array($item['term'])) { foreach($item['term'] as $t) { if(($t['ttype'] == TERM_BOOKMARK)) $has_bookmarks = true; diff --git a/Zotlabs/Module/Bookmarks.php b/Zotlabs/Module/Bookmarks.php index cee86a47d..4b4929c65 100644 --- a/Zotlabs/Module/Bookmarks.php +++ b/Zotlabs/Module/Bookmarks.php @@ -1,6 +1,9 @@ <?php namespace Zotlabs\Module; +use App; +use Zotlabs\Lib\Apps; + class Bookmarks extends \Zotlabs\Web\Controller { @@ -8,7 +11,10 @@ class Bookmarks extends \Zotlabs\Web\Controller { if(! local_channel()) return; - nav_set_selected('View Bookmarks'); + if(! Apps::system_app_installed(local_channel(), 'Bookmarks')) + return; + + nav_set_selected('Bookmarks'); $item_id = intval($_REQUEST['item']); $burl = trim($_REQUEST['burl']); @@ -64,7 +70,15 @@ class Bookmarks extends \Zotlabs\Web\Controller { notice( t('Permission denied.') . EOL); return; } - + + if(! Apps::system_app_installed(local_channel(), 'Bookmarks')) { + //Do not display any associated widgets at this point + App::$pdl = ''; + + $o = '<b>' . t('Bookmarks App') . ' (' . t('Not Installed') . '):</b><br>'; + $o .= t('Bookmark links from posts and manage them'); + return $o; + } require_once('include/menu.php'); require_once('include/conversation.php'); diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php index c5c52674a..6016328a5 100644 --- a/Zotlabs/Module/Import.php +++ b/Zotlabs/Module/Import.php @@ -426,7 +426,7 @@ class Import extends \Zotlabs\Web\Controller { unset($group['id']); $group['uid'] = $channel['channel_id']; - create_table_from_array('groups', $group); + create_table_from_array('pgrp', $group); } $r = q("select * from pgrp where uid = %d", intval($channel['channel_id']) @@ -448,7 +448,7 @@ class Import extends \Zotlabs\Web\Controller { if($x['old'] == $group_member['gid']) $group_member['gid'] = $x['new']; } - create_table_from_array('group_member', $group_member); + create_table_from_array('pgrp_member', $group_member); } } diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 015351cbf..792f92418 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -164,7 +164,7 @@ class Network extends \Zotlabs\Web\Controller { )); } - nav_set_selected('Grid'); + nav_set_selected('Network'); $channel_acl = array( 'allow_cid' => $channel['channel_allow_cid'], diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index baefe62ec..14627f56e 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -2,6 +2,8 @@ namespace Zotlabs\Module; +use Zotlabs\Lib\Apps; + require_once('include/bbcode.php'); /** @@ -147,9 +149,12 @@ class Ping extends \Zotlabs\Web\Controller { if(! ($vnotify & VNOTIFY_LIKE)) $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; - $discover_tab_on = can_view_public_stream(); - - $notify_pubs = ((local_channel()) ? ($vnotify & VNOTIFY_PUBS) && $discover_tab_on : $discover_tab_on); + if(local_channel()) { + $notify_pubs = ($vnotify & VNOTIFY_PUBS) && can_view_public_stream() && Apps::system_app_installed(local_channel(), 'Public Stream'); + } + else { + $notify_pubs = can_view_public_stream(); + } if($notify_pubs) { $sys = get_sys_channel(); diff --git a/Zotlabs/Module/Probe.php b/Zotlabs/Module/Probe.php index 2c67c6aae..d338b08ea 100644 --- a/Zotlabs/Module/Probe.php +++ b/Zotlabs/Module/Probe.php @@ -1,16 +1,29 @@ <?php namespace Zotlabs\Module; -require_once('include/zot.php'); +use App; +use Zotlabs\Lib\Apps; +require_once('include/zot.php'); class Probe extends \Zotlabs\Web\Controller { function get() { + if(local_channel()) { + if(! Apps::system_app_installed(local_channel(), 'Remote Diagnostics')) { + //Do not display any associated widgets at this point + App::$pdl = ''; + + $o = '<b>' . t('Remote Diagnostics App') . ' (' . t('Not Installed') . '):</b><br>'; + $o .= t('Perform diagnostics on remote channels'); + return $o; + } + } + nav_set_selected('Remote Diagnostics'); - $o .= '<h3>Probe Diagnostic</h3>'; + $o .= '<h3>Remote Diagnostics</h3>'; $o .= '<form action="probe" method="get">'; $o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" />'; @@ -19,7 +32,7 @@ class Probe extends \Zotlabs\Web\Controller { $o .= '<br /><br />'; if(x($_GET,'addr')) { - $channel = \App::get_channel(); + $channel = App::get_channel(); $addr = trim($_GET['addr']); $do_import = ((intval($_GET['import']) && is_site_admin()) ? true : false); diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 19cb72b5b..94df29984 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -1,6 +1,9 @@ <?php namespace Zotlabs\Module; +use App; +use Zotlabs\Lib\Apps; + require_once('include/conversation.php'); require_once('include/acl_selectors.php'); @@ -9,6 +12,17 @@ class Pubstream extends \Zotlabs\Web\Controller { function get($update = 0, $load = false) { + if(local_channel()) { + if(! Apps::system_app_installed(local_channel(), 'Public Stream')) { + //Do not display any associated widgets at this point + App::$pdl = ''; + + $o = '<b>' . t('Public Stream App') . ' (' . t('Not Installed') . '):</b><br>'; + $o .= t('The unmoderated public stream of this hub'); + return $o; + } + } + if($load) $_SESSION['loadtime'] = datetime_convert(); diff --git a/Zotlabs/Module/Randprof.php b/Zotlabs/Module/Randprof.php index 94ec095cb..c38b07ead 100644 --- a/Zotlabs/Module/Randprof.php +++ b/Zotlabs/Module/Randprof.php @@ -1,11 +1,17 @@ <?php namespace Zotlabs\Module; - +use App; +use Zotlabs\Lib\Apps; class Randprof extends \Zotlabs\Web\Controller { function init() { + if(local_channel()) { + if(! Apps::system_app_installed(local_channel(), 'Random Channel')) + return; + } + $x = random_profile(); if($x) goaway(chanlink_hash($x)); @@ -13,5 +19,19 @@ class Randprof extends \Zotlabs\Web\Controller { /** FIXME this doesn't work at the moment as a fallback */ goaway(z_root() . '/profile'); } + + function get() { + if(local_channel()) { + if(! Apps::system_app_installed(local_channel(), 'Random Channel')) { + //Do not display any associated widgets at this point + App::$pdl = ''; + + $o = '<b>' . t('Random Channel App') . ' (' . t('Not Installed') . '):</b><br>'; + $o .= t('Visit a random channel in the $Projectname network'); + return $o; + } + } + + } } diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php index 6b49f165d..b0115d352 100644 --- a/Zotlabs/Module/Settings/Channel.php +++ b/Zotlabs/Module/Settings/Channel.php @@ -135,8 +135,6 @@ class Channel { $photo_path = ((x($_POST,'photo_path')) ? escape_tags(trim($_POST['photo_path'])) : ''); $attach_path = ((x($_POST,'attach_path')) ? escape_tags(trim($_POST['attach_path'])) : ''); - $channel_menu = ((x($_POST['channel_menu'])) ? htmlspecialchars_decode(trim($_POST['channel_menu']),ENT_QUOTES) : ''); - $expire_items = ((x($_POST,'expire_items')) ? intval($_POST['expire_items']) : 0); $expire_starred = ((x($_POST,'expire_starred')) ? intval($_POST['expire_starred']) : 0); $expire_photos = ((x($_POST,'expire_photos'))? intval($_POST['expire_photos']) : 0); @@ -157,8 +155,6 @@ class Channel { $defpermcat = ((x($_POST,'defpermcat')) ? notags(trim($_POST['defpermcat'])) : 'default'); $mailhost = ((array_key_exists('mailhost',$_POST)) ? notags(trim($_POST['mailhost'])) : ''); - $profile_assign = ((x($_POST,'profile_assign')) ? notags(trim($_POST['profile_assign'])) : ''); - $pageflags = $channel['channel_pageflags']; $existing_adult = (($pageflags & PAGE_ADULT) ? 1 : 0); @@ -246,7 +242,6 @@ class Channel { set_pconfig(local_channel(),'system','post_joingroup', $post_joingroup); set_pconfig(local_channel(),'system','post_profilechange', $post_profilechange); set_pconfig(local_channel(),'system','blocktags',$blocktags); - set_pconfig(local_channel(),'system','channel_menu',$channel_menu); set_pconfig(local_channel(),'system','vnotify',$vnotify); set_pconfig(local_channel(),'system','always_show_in_notices',$always_show_in_notices); set_pconfig(local_channel(),'system','evdays',$evdays); @@ -254,7 +249,6 @@ class Channel { set_pconfig(local_channel(),'system','attach_path',$attach_path); set_pconfig(local_channel(),'system','default_permcat',$defpermcat); set_pconfig(local_channel(),'system','email_notify_host',$mailhost); - set_pconfig(local_channel(),'system','profile_assign',$profile_assign); set_pconfig(local_channel(),'system','autoperms',$autoperms); $r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d $set_perms where channel_id = %d", @@ -460,18 +454,6 @@ class Channel { require_once('include/group.php'); $group_select = mini_group_select(local_channel(),$channel['channel_default_group']); - require_once('include/menu.php'); - $m1 = menu_list(local_channel()); - $menu = false; - if($m1) { - $menu = array(); - $current = get_pconfig(local_channel(),'system','channel_menu'); - $menu[] = array('name' => '', 'selected' => ((! $current) ? true : false)); - foreach($m1 as $m) { - $menu[] = array('name' => htmlspecialchars($m['menu_name'],ENT_COMPAT,'UTF-8'), 'selected' => (($m['menu_name'] === $current) ? ' selected="selected" ' : false)); - } - } - $evdays = get_pconfig(local_channel(),'system','evdays'); if(! $evdays) $evdays = 3; @@ -498,7 +480,7 @@ class Channel { if($vnotify === false) $vnotify = (-1); - $plugin = [ 'basic' => '', 'security' => '', 'notify' => '', 'misc' => '' ]; + $plugin = [ 'basic' => '', 'security' => '', 'notify' => '' ]; call_hooks('channel_settings',$plugin); $disable_discover_tab = intval(get_config('system','disable_discover_tab',1)) == 1; @@ -543,8 +525,6 @@ class Channel { '$permissions' => t('Default Privacy Group'), '$permdesc' => t("\x28click to open/close\x29"), '$aclselect' => populate_acl($perm_defaults, false, \Zotlabs\Lib\PermissionDescription::fromDescription(t('Use my default audience setting for the type of object published'))), - '$profseltxt' => t('Profile to assign new connections'), - '$profselect' => ((feature_enabled(local_channel(),'multi_profiles')) ? contact_profile_assign(get_pconfig(local_channel(),'system','profile_assign','')) : ''), '$allow_cid' => acl2json($perm_defaults['allow_cid']), '$allow_gid' => acl2json($perm_defaults['allow_gid']), @@ -582,7 +562,7 @@ class Channel { '$lbl_vnot' => t('Show visual notifications including:'), - '$vnotify1' => array('vnotify1', t('Unseen grid activity'), ($vnotify & VNOTIFY_NETWORK), VNOTIFY_NETWORK, '', $yes_no), + '$vnotify1' => array('vnotify1', t('Unseen stream activity'), ($vnotify & VNOTIFY_NETWORK), VNOTIFY_NETWORK, '', $yes_no), '$vnotify2' => array('vnotify2', t('Unseen channel activity'), ($vnotify & VNOTIFY_CHANNEL), VNOTIFY_CHANNEL, '', $yes_no), '$vnotify3' => array('vnotify3', t('Unseen private messages'), ($vnotify & VNOTIFY_MAIL), VNOTIFY_MAIL, t('Recommended'), $yes_no), '$vnotify4' => array('vnotify4', t('Upcoming events'), ($vnotify & VNOTIFY_EVENT), VNOTIFY_EVENT, '', $yes_no), @@ -594,7 +574,7 @@ class Channel { '$vnotify10' => array('vnotify10', t('New connections'), ($vnotify & VNOTIFY_INTRO), VNOTIFY_INTRO, t('Recommended'), $yes_no), '$vnotify11' => ((is_site_admin()) ? array('vnotify11', t('System Registrations'), ($vnotify & VNOTIFY_REGISTER), VNOTIFY_REGISTER, '', $yes_no) : array()), '$vnotify12' => array('vnotify12', t('Unseen shared files'), ($vnotify & VNOTIFY_FILES), VNOTIFY_FILES, '', $yes_no), - '$vnotify13' => (($disable_discover_tab && !$site_firehose) ? array() : array('vnotify13', t('Unseen public activity'), ($vnotify & VNOTIFY_PUBS), VNOTIFY_PUBS, '', $yes_no)), + '$vnotify13' => ((($disable_discover_tab && !$site_firehose) || !Apps::system_app_installed(local_channel(), 'Public Stream')) ? array() : array('vnotify13', t('Unseen public stream activity'), ($vnotify & VNOTIFY_PUBS), VNOTIFY_PUBS, '', $yes_no)), '$vnotify14' => array('vnotify14', t('Unseen likes and dislikes'), ($vnotify & VNOTIFY_LIKE), VNOTIFY_LIKE, '', $yes_no), '$vnotify15' => array('vnotify15', t('Unseen forum posts'), ($vnotify & VNOTIFY_FORUMS), VNOTIFY_FORUMS, '', $yes_no), '$mailhost' => [ 'mailhost', t('Email notification hub (hostname)'), get_pconfig(local_channel(),'system','email_notify_host',\App::get_hostname()), sprintf( t('If your channel is mirrored to multiple hubs, set this to your preferred location. This will prevent duplicate email notifications. Example: %s'),\App::get_hostname()) ], @@ -604,7 +584,6 @@ class Channel { '$basic_addon' => $plugin['basic'], '$sec_addon' => $plugin['security'], '$notify_addon' => $plugin['notify'], - '$misc_addon' => $plugin['misc'], '$h_advn' => t('Advanced Account/Page Type Settings'), '$h_descadvn' => t('Change the behaviour of this account for special situations'), @@ -612,12 +591,8 @@ class Channel { '$lbl_misc' => t('Miscellaneous Settings'), '$photo_path' => array('photo_path', t('Default photo upload folder'), get_pconfig(local_channel(),'system','photo_path'), t('%Y - current year, %m - current month')), '$attach_path' => array('attach_path', t('Default file upload folder'), get_pconfig(local_channel(),'system','attach_path'), t('%Y - current year, %m - current month')), - '$menus' => $menu, - '$menu_desc' => t('Personal menu to display in your channel pages'), '$removeme' => t('Remove Channel'), '$removechannel' => t('Remove this channel.'), - '$firefoxshare' => t('Firefox Share $Projectname provider'), - )); call_hooks('settings_form',$o); diff --git a/Zotlabs/Module/Settings/Channel_home.php b/Zotlabs/Module/Settings/Channel_home.php index 0e916d530..b6ecf4ff1 100644 --- a/Zotlabs/Module/Settings/Channel_home.php +++ b/Zotlabs/Module/Settings/Channel_home.php @@ -2,6 +2,7 @@ namespace Zotlabs\Module\Settings; +require_once('include/menu.php'); class Channel_home { @@ -18,8 +19,10 @@ class Channel_home { $channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400); if($channel_divmore_height < 50) $channel_divmore_height = 50; - set_pconfig(local_channel(),'system','channel_divmore_height', $channel_divmore_height); + + $channel_menu = ((x($_POST['channel_menu'])) ? htmlspecialchars_decode(trim($_POST['channel_menu']),ENT_QUOTES) : ''); + set_pconfig(local_channel(),'system','channel_menu',$channel_menu); build_sync_packet(); @@ -43,12 +46,37 @@ class Channel_home { t('Click to expand content exceeding this height') ]; + $menus = menu_list(local_channel()); + if($menus) { + $current = get_pconfig(local_channel(),'system','channel_menu'); + $menu[] = ''; + foreach($menus as $m) { + $menu[$m['menu_name']] = htmlspecialchars($m['menu_name'],ENT_COMPAT,'UTF-8'); + } + + $menu_select = [ + 'channel_menu', + t('Personal menu to display in your channel pages'), + $current, + '', + $menu + ]; + } + $extra_settings_html = replace_macros(get_markup_template('field_input.tpl'), [ '$field' => $channel_divmore_height ] ); + if($menu) { + $extra_settings_html .= replace_macros(get_markup_template('field_select.tpl'), + [ + '$field' => $menu_select + ] + ); + } + $tpl = get_markup_template("settings_module.tpl"); $o .= replace_macros($tpl, array( diff --git a/Zotlabs/Module/Settings/Network.php b/Zotlabs/Module/Settings/Network.php index aaafe9255..ae02b06e9 100644 --- a/Zotlabs/Module/Settings/Network.php +++ b/Zotlabs/Module/Settings/Network.php @@ -55,7 +55,7 @@ class Network { '$rpath' => $rpath, '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), - '$title' => t('Activity Settings'), + '$title' => t('Stream Settings'), '$features' => process_module_features_get(local_channel(), $features), '$extra_settings_html' => $extra_settings_html, '$submit' => t('Submit') diff --git a/Zotlabs/Module/Settings/Profiles.php b/Zotlabs/Module/Settings/Profiles.php index 2dc037317..fb6abf664 100644 --- a/Zotlabs/Module/Settings/Profiles.php +++ b/Zotlabs/Module/Settings/Profiles.php @@ -2,6 +2,7 @@ namespace Zotlabs\Module\Settings; +require_once('include/selectors.php'); class Profiles { @@ -14,6 +15,9 @@ class Profiles { $features = get_module_features($module); process_module_features_post(local_channel(), $features, $_POST); + + $profile_assign = ((x($_POST,'profile_assign')) ? notags(trim($_POST['profile_assign'])) : ''); + set_pconfig(local_channel(),'system','profile_assign',$profile_assign); build_sync_packet(); @@ -30,6 +34,10 @@ class Profiles { $features = get_module_features($module); $rpath = (($_GET['rpath']) ? $_GET['rpath'] : ''); + $extra_settings_html = ''; + if(feature_enabled(local_channel(),'multi_profiles')) + $extra_settings_html = contact_profile_assign(get_pconfig(local_channel(),'system','profile_assign','')); + $tpl = get_markup_template("settings_module.tpl"); $o .= replace_macros($tpl, array( @@ -37,8 +45,9 @@ class Profiles { '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), '$title' => t('Profiles Settings'), - '$features' => process_module_features_get(local_channel(), $features), - '$submit' => t('Submit') + '$features' => process_module_features_get(local_channel(), $features), + '$extra_settings_html' => $extra_settings_html, + '$submit' => t('Submit') )); return $o; diff --git a/Zotlabs/Module/Suggest.php b/Zotlabs/Module/Suggest.php index f79e4e245..18961214e 100644 --- a/Zotlabs/Module/Suggest.php +++ b/Zotlabs/Module/Suggest.php @@ -1,15 +1,20 @@ <?php namespace Zotlabs\Module; +use App; +use Zotlabs\Lib\Apps; + require_once('include/socgraph.php'); require_once('include/contact_widgets.php'); - class Suggest extends \Zotlabs\Web\Controller { function init() { if(! local_channel()) return; + + if(! Apps::system_app_installed(local_channel(), 'Suggest Channels')) + return; if(x($_GET,'ignore')) { q("insert into xign ( uid, xchan ) values ( %d, '%s' ) ", @@ -22,13 +27,23 @@ class Suggest extends \Zotlabs\Web\Controller { function get() { - - $o = ''; + if(! local_channel()) { notice( t('Permission denied.') . EOL); return; } + if(! Apps::system_app_installed(local_channel(), 'Suggest Channels')) { + //Do not display any associated widgets at this point + App::$pdl = ''; + + $o = '<b>' . t('Suggest Channels App') . ' (' . t('Not Installed') . '):</b><br>'; + $o .= t('Suggestions for channels in the $Projectname network you might be interested in'); + return $o; + } + + $o = ''; + nav_set_selected('Suggest Channels'); $_SESSION['return_url'] = z_root() . '/' . \App::$cmd; diff --git a/Zotlabs/Update/_1222.php b/Zotlabs/Update/_1222.php new file mode 100644 index 000000000..ad8d03197 --- /dev/null +++ b/Zotlabs/Update/_1222.php @@ -0,0 +1,23 @@ +<?php + +namespace Zotlabs\Update; + +class _1222 { + + function run() { + + q("START TRANSACTION"); + + $r1 = q("DELETE FROM app WHERE app_name = 'Grid' and app_system = 1"); + + if($r1) { + q("COMMIT"); + return UPDATE_SUCCESS; + } + + q("ROLLBACK"); + return UPDATE_FAILED; + + } + +} diff --git a/Zotlabs/Update/_1223.php b/Zotlabs/Update/_1223.php new file mode 100644 index 000000000..c6f05c806 --- /dev/null +++ b/Zotlabs/Update/_1223.php @@ -0,0 +1,23 @@ +<?php + +namespace Zotlabs\Update; + +class _1223 { + + function run() { + + q("START TRANSACTION"); + + $r1 = q("DELETE FROM app WHERE app_name = 'View Bookmarks' and app_system = 1"); + + if($r1) { + q("COMMIT"); + return UPDATE_SUCCESS; + } + + q("ROLLBACK"); + return UPDATE_FAILED; + + } + +} diff --git a/Zotlabs/Update/_1224.php b/Zotlabs/Update/_1224.php new file mode 100644 index 000000000..d160cea5d --- /dev/null +++ b/Zotlabs/Update/_1224.php @@ -0,0 +1,28 @@ +<?php + +namespace Zotlabs\Update; + +class _1224 { + + function run() { + if(ACTIVE_DBTYPE == DBTYPE_MYSQL) { + q("START TRANSACTION"); + + $r1 = q("ALTER TABLE hubloc ALTER hubloc_id_url SET DEFAULT ''"); + $r2 = q("ALTER TABLE hubloc ALTER hubloc_site_id SET DEFAULT ''"); + + if($r1 && $r2) { + q("COMMIT"); + return UPDATE_SUCCESS; + } + + q("ROLLBACK"); + return UPDATE_FAILED; + } + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + return UPDATE_SUCCESS; + } + + } + +} diff --git a/Zotlabs/Widget/Activity_filter.php b/Zotlabs/Widget/Activity_filter.php index c27a5d48b..4ea0086dd 100644 --- a/Zotlabs/Widget/Activity_filter.php +++ b/Zotlabs/Widget/Activity_filter.php @@ -192,7 +192,7 @@ class Activity_filter { ]); $o .= replace_macros(get_markup_template('activity_filter_widget.tpl'), [ - '$title' => t('Activity Filters'), + '$title' => t('Stream Filters'), '$reset' => $reset, '$content' => $content, '$name' => $name diff --git a/Zotlabs/Widget/Activity_order.php b/Zotlabs/Widget/Activity_order.php index d9dbcc91f..1cba1ce8c 100644 --- a/Zotlabs/Widget/Activity_order.php +++ b/Zotlabs/Widget/Activity_order.php @@ -120,7 +120,7 @@ class Activity_order { ]); $o = replace_macros(get_markup_template('common_widget.tpl'), [ - '$title' => t('Activity Order'), + '$title' => t('Stream Order'), '$content' => $content, ]); } |