aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authormrjive <mrjive@mrjive.it>2018-01-22 09:34:08 +0100
committerGitHub <noreply@github.com>2018-01-22 09:34:08 +0100
commit131baa9f4584b74ab76328d776c0bb5ce603da7d (patch)
treec962a68dbf7874e326f4ca268fe0183ac184ea12 /Zotlabs
parent8e475810a74f738fe3b23648b904639e5099d995 (diff)
parent1709dbd376af3171815f25b7055fb41da53924cb (diff)
downloadvolse-hubzilla-131baa9f4584b74ab76328d776c0bb5ce603da7d.tar.gz
volse-hubzilla-131baa9f4584b74ab76328d776c0bb5ce603da7d.tar.bz2
volse-hubzilla-131baa9f4584b74ab76328d776c0bb5ce603da7d.zip
Merge pull request #10 from redmatrix/dev
Dev
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Daemon/Notifier.php4
-rw-r--r--Zotlabs/Lib/ThreadItem.php4
-rw-r--r--Zotlabs/Module/Admin/Site.php8
-rw-r--r--Zotlabs/Module/Dirsearch.php5
-rw-r--r--Zotlabs/Module/Pubstream.php15
-rw-r--r--Zotlabs/Web/Router.php6
-rw-r--r--Zotlabs/Web/WebServer.php75
-rw-r--r--Zotlabs/Widget/Forums.php22
8 files changed, 80 insertions, 59 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php
index ca6a7c08a..b168db5ae 100644
--- a/Zotlabs/Daemon/Notifier.php
+++ b/Zotlabs/Daemon/Notifier.php
@@ -90,8 +90,6 @@ class Notifier {
$item_id = $argv[2];
- $extra = (($argc > 3) ? $argv[3] : null);
-
if(! $item_id)
return;
@@ -315,7 +313,7 @@ class Notifier {
}
- if($target_item['id'] == $target_item['parent']) {
+ if($target_item['mid'] === $target_item['parent_mid']) {
$parent_item = $target_item;
$top_level_post = true;
}
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 748edcdb7..d35d4732a 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -730,9 +730,6 @@ class ThreadItem {
$observer = $conv->get_observer();
- $qc = ((local_channel()) ? get_pconfig(local_channel(),'system','qcomment') : null);
- $qcomment = (($qc) ? explode("\n",$qc) : null);
-
$arr = array('comment_buttons' => '','id' => $this->get_id());
call_hooks('comment_buttons',$arr);
$comment_buttons = $arr['comment_buttons'];
@@ -744,7 +741,6 @@ class ThreadItem {
'$type' => (($conv->get_mode() === 'channel') ? 'wall-comment' : 'net-comment'),
'$id' => $this->get_id(),
'$parent' => $this->get_id(),
- '$qcomment' => $qcomment,
'$comment_buttons' => $comment_buttons,
'$profile_uid' => $conv->get_profile_owner(),
'$mylink' => $observer['xchan_url'],
diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php
index 60cb39277..037f49277 100644
--- a/Zotlabs/Module/Admin/Site.php
+++ b/Zotlabs/Module/Admin/Site.php
@@ -43,6 +43,7 @@ class Site {
$allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : '');
$force_publish = ((x($_POST,'publish_all')) ? True : False);
$disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True);
+ $site_firehose = ((x($_POST,'site_firehose')) ? True : False);
$login_on_homepage = ((x($_POST,'login_on_homepage')) ? True : False);
$enable_context_help = ((x($_POST,'enable_context_help')) ? True : False);
$global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
@@ -66,7 +67,7 @@ class Site {
$techlevel_lock = ((x($_POST,'techlock')) ? intval($_POST['techlock']) : 0);
$imagick_path = ((x($_POST,'imagick_path')) ? trim($_POST['imagick_path']) : '');
$thumbnail_security = ((x($_POST,'thumbnail_security')) ? intval($_POST['thumbnail_security']) : 0);
- $force_queue = ((intval($_POST['force_queue']) > 0) ? intval($_POST['force_queue']) : 300);
+ $force_queue = ((intval($_POST['force_queue']) > 0) ? intval($_POST['force_queue']) : 3000);
$techlevel = null;
if(array_key_exists('techlevel', $_POST))
@@ -135,6 +136,7 @@ class Site {
set_config('system','allowed_sites', $allowed_sites);
set_config('system','publish_all', $force_publish);
set_config('system','disable_discover_tab', $disable_discover_tab);
+ set_config('system','site_firehose', $site_firehose);
set_config('system','force_queue_threshold', $force_queue);
if ($global_directory == '') {
del_config('system', 'directory_submit_url');
@@ -314,6 +316,8 @@ class Site {
'$verify_email' => array('verify_email', t("Verify Email Addresses"), get_config('system','verify_email'), t("Check to verify email addresses used in account registration (recommended).")),
'$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")),
'$disable_discover_tab' => array('disable_discover_tab', t('Import Public Streams'), $discover_tab, t('Import and allow access to public content pulled from other sites. Warning: this content is unmoderated.')),
+ '$site_firehose' => array('site_firehose', t('Site only Public Streams'), get_config('system','site_firehose'), t('Allow access to public content originating only from this site if Imported Public Streams are disabled.')),
+
'$login_on_homepage' => array('login_on_homepage', t("Login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")),
'$enable_context_help' => array('enable_context_help', t("Enable context help"),((intval($enable_context_help) === 1 || $enable_context_help === false) ? 1 : 0) , t("Display contextual help for the current page when the help button is pressed.")),
@@ -328,7 +332,7 @@ class Site {
'$timeout' => array('timeout', t("Network timeout"), (x(get_config('system','curl_timeout'))?get_config('system','curl_timeout'):60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")),
'$delivery_interval' => array('delivery_interval', t("Delivery interval"), (x(get_config('system','delivery_interval'))?get_config('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")),
'$delivery_batch_count' => array('delivery_batch_count', t('Deliveries per process'),(x(get_config('system','delivery_batch_count'))?get_config('system','delivery_batch_count'):1), t("Number of deliveries to attempt in a single operating system process. Adjust if necessary to tune system performance. Recommend: 1-5.")),
- '$force_queue' => array('force_queue', t("Queue Threshold"), get_config('system','force_queue_threshold',300), t("Always defer immediate delivery if queue contains more than this number of entries.")),
+ '$force_queue' => array('force_queue', t("Queue Threshold"), get_config('system','force_queue_threshold',3000), t("Always defer immediate delivery if queue contains more than this number of entries.")),
'$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
'$imagick_path' => array('imagick_path', t("Path to ImageMagick convert program"), get_config('system','imagick_convert_path'), t("If set, use this program to generate photo thumbnails for huge images ( > 4000 pixels in either dimension), otherwise memory exhaustion may occur. Example: /usr/bin/convert")),
'$thumbnail_security' => array('thumbnail_security', t("Allow SVG thumbnails in file browser"), get_config('system','thumbnail_security',0), t("WARNING: SVG images may contain malicious code.")),
diff --git a/Zotlabs/Module/Dirsearch.php b/Zotlabs/Module/Dirsearch.php
index 53ec1a850..08f1f7a13 100644
--- a/Zotlabs/Module/Dirsearch.php
+++ b/Zotlabs/Module/Dirsearch.php
@@ -97,7 +97,10 @@ class Dirsearch extends \Zotlabs\Web\Controller {
else
$sync = false;
-
+ if(($dirmode == DIRECTORY_MODE_STANDALONE) && (! $hub)) {
+ $hub = \App::get_hostname();
+ }
+
if($hub)
$hub_query = " and xchan_hash in (select hubloc_hash from hubloc where hubloc_host = '" . protect_sprintf(dbesc($hub)) . "') ";
else
diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php
index c469a0eca..2c25e2ce0 100644
--- a/Zotlabs/Module/Pubstream.php
+++ b/Zotlabs/Module/Pubstream.php
@@ -17,9 +17,16 @@ class Pubstream extends \Zotlabs\Web\Controller {
return login();
}
- $disable_discover_tab = get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false;
- if($disable_discover_tab)
- return;
+ $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
+ $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
+
+ if(! ($site_firehose || $net_firehose)) {
+ return '';
+ }
+
+ if($net_firehose) {
+ $site_firehose = false;
+ }
$mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : '');
@@ -142,7 +149,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
require_once('include/channel.php');
require_once('include/security.php');
- if(get_config('system','site_firehose')) {
+ if($site_firehose) {
$uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and item_wall = 1 ";
}
else {
diff --git a/Zotlabs/Web/Router.php b/Zotlabs/Web/Router.php
index a6b780cdc..fb551e36f 100644
--- a/Zotlabs/Web/Router.php
+++ b/Zotlabs/Web/Router.php
@@ -38,10 +38,9 @@ class Router {
/**
* @brief Router constructor.
*
- * @param[in,out] App &$a
* @throws Exception module not found
*/
- function __construct(&$a) {
+ function __construct() {
$module = \App::$module;
$modname = "Zotlabs\\Module\\" . ucfirst($module);
@@ -179,9 +178,8 @@ class Router {
/**
* @brief
*
- * @param[in,out] App &$a
*/
- function Dispatch(&$a) {
+ function Dispatch() {
/**
* Call module functions
diff --git a/Zotlabs/Web/WebServer.php b/Zotlabs/Web/WebServer.php
index 9e6af8c4c..5183fb2b0 100644
--- a/Zotlabs/Web/WebServer.php
+++ b/Zotlabs/Web/WebServer.php
@@ -58,11 +58,10 @@ class WebServer {
if((x($_GET,'zid')) && (! \App::$install)) {
\App::$query_string = strip_zids(\App::$query_string);
if(! local_channel()) {
- if ($_SESSION['my_address']!=$_GET['zid'])
- {
- $_SESSION['my_address'] = $_GET['zid'];
- $_SESSION['authenticated'] = 0;
- }
+ if ($_SESSION['my_address']!=$_GET['zid']) {
+ $_SESSION['my_address'] = $_GET['zid'];
+ $_SESSION['authenticated'] = 0;
+ }
zid_init();
}
}
@@ -107,9 +106,43 @@ class WebServer {
check_config();
}
- //nav_set_selected('nothing');
+ $this->create_channel_links();
- $Router = new Router($a);
+ $Router = new Router();
+
+ $this->initialise_content();
+
+ $Router->Dispatch();
+
+ $this->set_homebase();
+
+ // now that we've been through the module content, see if the page reported
+ // a permission problem and if so, a 403 response would seem to be in order.
+
+ if(is_array($_SESSION['sysmsg']) && stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) {
+ header($_SERVER['SERVER_PROTOCOL'] . ' 403 ' . t('Permission denied.'));
+ }
+
+ call_hooks('page_end', \App::$page['content']);
+
+ construct_page();
+
+ killme();
+ }
+
+
+ private function initialise_content() {
+
+ /* initialise content region */
+
+ if(! x(\App::$page, 'content'))
+ \App::$page['content'] = '';
+
+ call_hooks('page_content_top', \App::$page['content']);
+
+ }
+
+ private function create_channel_links() {
/* Initialise the Link: response header if this is a channel page.
* This cannot be done inside the channel module because some protocol
@@ -135,26 +168,17 @@ class WebServer {
\App::$channel_links = $x['channel_links'];
header('Link: ' . \App::get_channel_links());
}
+ }
-
-
- /* initialise content region */
-
- if(! x(\App::$page, 'content'))
- \App::$page['content'] = '';
-
- call_hooks('page_content_top', \App::$page['content']);
-
-
- $Router->Dispatch($a);
-
+ private function set_homebase() {
// If you're just visiting, let javascript take you home
if(x($_SESSION, 'visitor_home')) {
$homebase = $_SESSION['visitor_home'];
- } elseif(local_channel()) {
+ }
+ elseif(local_channel()) {
$homebase = z_root() . '/channel/' . \App::$channel['channel_address'];
}
@@ -162,17 +186,8 @@ class WebServer {
\App::$page['content'] .= '<script>var homebase = "' . $homebase . '";</script>';
}
- // now that we've been through the module content, see if the page reported
- // a permission problem and if so, a 403 response would seem to be in order.
-
- if(is_array($_SESSION['sysmsg']) && stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) {
- header($_SERVER['SERVER_PROTOCOL'] . ' 403 ' . t('Permission denied.'));
- }
+ }
- call_hooks('page_end', \App::$page['content']);
- construct_page();
- killme();
- }
}
diff --git a/Zotlabs/Widget/Forums.php b/Zotlabs/Widget/Forums.php
index 0b90b9740..44d95012f 100644
--- a/Zotlabs/Widget/Forums.php
+++ b/Zotlabs/Widget/Forums.php
@@ -71,6 +71,8 @@ class Forums {
if($r)
$r1[$x]['unseen'] = $r[0]['unseen'];
+ }
+
/**
* @FIXME
* This SQL makes the counts correct when you get forum posts arriving from different routes/sources
@@ -79,21 +81,19 @@ class Forums {
* It may make more sense in that query to look for the mention in the body rather than another join,
* but that makes it very inefficient.
*
- $r = q("select sum(item_unseen) as unseen from item left join term on oid = id where otype = %d and owner_xchan != '%s' and item.uid = %d and url = '%s' and ttype = %d $perms_sql ",
- intval(TERM_OBJ_POST),
- dbesc($r1[$x]['xchan_hash']),
- intval(local_channel()),
- dbesc($r1[$x]['xchan_url']),
- intval(TERM_MENTION)
- );
- if($r)
- $r1[$x]['unseen'] = ((array_key_exists('unseen',$r1[$x])) ? $r1[$x]['unseen'] + $r[0]['unseen'] : $r[0]['unseen']);
+ * $r = q("select sum(item_unseen) as unseen from item left join term on oid = id where otype = %d and owner_xchan != '%s' and item.uid = %d and url = '%s' and ttype = %d $perms_sql ",
+ * intval(TERM_OBJ_POST),
+ * dbesc($r1[$x]['xchan_hash']),
+ * intval(local_channel()),
+ * dbesc($r1[$x]['xchan_url']),
+ * intval(TERM_MENTION)
+ * );
+ * if($r)
+ * $r1[$x]['unseen'] = ((array_key_exists('unseen',$r1[$x])) ? $r1[$x]['unseen'] + $r[0]['unseen'] : $r[0]['unseen']);
*
* end @FIXME
*/
- }
-
if($r1) {
$o .= '<div class="widget">';
$o .= '<h3>' . t('Forums') . '</h3><ul class="nav nav-pills flex-column">';