aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/Apps.php2
-rw-r--r--Zotlabs/Lib/ThreadItem.php6
-rw-r--r--Zotlabs/Module/Admin/Site.php1
-rw-r--r--Zotlabs/Module/Hq.php108
-rw-r--r--Zotlabs/Module/Ping.php2
-rw-r--r--Zotlabs/Module/Settings/Channel.php6
-rw-r--r--Zotlabs/Web/HTTPSig.php2
7 files changed, 70 insertions, 57 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php
index 9271cee85..457b85b62 100644
--- a/Zotlabs/Lib/Apps.php
+++ b/Zotlabs/Lib/Apps.php
@@ -352,7 +352,7 @@ class Apps {
break;
default:
if($config)
- $unset = ((get_config('system', $require[0]) == $require[1]) ? false : true);
+ $unset = ((get_config('system', $require[0]) === $require[1]) ? false : true);
else
$unset = ((local_channel() && feature_enabled(local_channel(),$require)) ? false : true);
if($unset)
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 197657ab1..748edcdb7 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -38,7 +38,7 @@ class ThreadItem {
$this->toplevel = ($this->get_id() == $this->get_data_value('parent'));
// Prepare the children
- if(count($data['children'])) {
+ if($data['children']) {
foreach($data['children'] as $item) {
/*
@@ -196,7 +196,7 @@ class ThreadItem {
$like_count = ((x($conv_responses['like'],$item['mid'])) ? $conv_responses['like'][$item['mid']] : '');
$like_list = ((x($conv_responses['like'],$item['mid'])) ? $conv_responses['like'][$item['mid'] . '-l'] : '');
- if (count($like_list) > MAX_LIKERS) {
+ if (($like_list) && (count($like_list) > MAX_LIKERS)) {
$like_list_part = array_slice($like_list, 0, MAX_LIKERS);
array_push($like_list_part, '<a class="dropdown-item" href="#" data-toggle="modal" data-target="#likeModal-' . $this->get_id() . '"><b>' . t('View all') . '</b></a>');
} else {
@@ -208,7 +208,7 @@ class ThreadItem {
$dislike_count = ((x($conv_responses['dislike'],$item['mid'])) ? $conv_responses['dislike'][$item['mid']] : '');
$dislike_list = ((x($conv_responses['dislike'],$item['mid'])) ? $conv_responses['dislike'][$item['mid'] . '-l'] : '');
$dislike_button_label = tt('Dislike','Dislikes',$dislike_count,'noun');
- if (count($dislike_list) > MAX_LIKERS) {
+ if (($dislike_list) && (count($dislike_list) > MAX_LIKERS)) {
$dislike_list_part = array_slice($dislike_list, 0, MAX_LIKERS);
array_push($dislike_list_part, '<a class="dropdown-item" href="#" data-toggle="modal" data-target="#dislikeModal-' . $this->get_id() . '"><b>' . t('View all') . '</b></a>');
} else {
diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php
index eda97b591..a9db1ad55 100644
--- a/Zotlabs/Module/Admin/Site.php
+++ b/Zotlabs/Module/Admin/Site.php
@@ -251,6 +251,7 @@ class Site {
);
$discover_tab = get_config('system','disable_discover_tab');
+
// $disable public streams by default
if($discover_tab === false)
$discover_tab = 1;
diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php
index 6bc65e44e..073b67b92 100644
--- a/Zotlabs/Module/Hq.php
+++ b/Zotlabs/Module/Hq.php
@@ -53,29 +53,53 @@ class Hq extends \Zotlabs\Web\Controller {
$r = q("SELECT mid FROM item
WHERE uid = %d
AND mid = parent_mid
- ORDER BY created DESC
- limit 1",
+ ORDER BY created DESC LIMIT 1",
intval(local_channel())
);
- if(!$r[0]['mid']) {
- \App::$error = 404;
- notice( t('Item not found.') . EOL);
- return;
+ if($r[0]['mid']) {
+ $item_hash = 'b64.' . base64url_encode($r[0]['mid']);
}
-
- $item_hash = 'b64.' . base64url_encode($r[0]['mid']);
}
+ if($item_hash) {
- if(strpos($item_hash,'b64.') === 0)
- $decoded = @base64url_decode(substr($item_hash,4));
+ if(strpos($item_hash,'b64.') === 0)
+ $decoded = @base64url_decode(substr($item_hash,4));
- if($decoded)
- $item_hash = $decoded;
-
- $updateable = false;
+ if($decoded)
+ $item_hash = $decoded;
+
+ $target_item = null;
+
+ $r = q("select id, uid, mid, parent_mid, thr_parent, verb, item_type, item_deleted, item_blocked from item where mid like '%s' limit 1",
+ dbesc($item_hash . '%')
+ );
+
+ if($r) {
+ $target_item = $r[0];
+ }
+ //if the item is to be moderated redirect to /moderate
+ if($target_item['item_blocked'] == ITEM_MODERATED) {
+ goaway(z_root() . '/moderate/' . $target_item['id']);
+ }
+
+ $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0);
+
+ $simple_update = (($update) ? " AND item_unseen = 1 " : '');
+
+ if($update && $_SESSION['loadtime'])
+ $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) ";
+
+ if($static && $simple_update)
+ $simple_update .= " and item_thread_top = 0 and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' ";
+
+ $sys = get_sys_channel();
+ $sql_extra = item_permissions_sql($sys['channel_id']);
+
+ }
+
if(! $update) {
$channel = \App::get_channel();
@@ -105,52 +129,36 @@ class Hq extends \Zotlabs\Web\Controller {
'bbcode' => true,
'jotnets' => true
];
+
+ $o = replace_macros(get_markup_template("hq.tpl"),
+ [
+ '$no_messages' => (($target_item) ? false : true),
+ '$no_messages_label' => t('Welcome to hubzilla!')
+ ]
+ );
$o = '<div id="jot-popup">';
$o .= status_editor($a,$x);
$o .= '</div>';
}
-
- $target_item = null;
-
- $r = q("select id, uid, mid, parent_mid, thr_parent, verb, item_type, item_deleted, item_blocked from item where mid like '%s' limit 1",
- dbesc($item_hash . '%')
- );
-
- if($r) {
- $target_item = $r[0];
- }
-
- //if the item is to be moderated redirect to /moderate
- if($target_item['item_blocked'] == ITEM_MODERATED) {
- goaway(z_root() . '/moderate/' . $target_item['id']);
- }
-
- $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0);
- $simple_update = (($update) ? " AND item_unseen = 1 " : '');
-
- if($update && $_SESSION['loadtime'])
- $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) ";
-
- if($static && $simple_update)
- $simple_update .= " and item_thread_top = 0 and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' ";
-
- $sys = get_sys_channel();
- $sql_extra = item_permissions_sql($sys['channel_id']);
-
if(! $update && ! $load) {
nav_set_selected('HQ');
$static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1);
- // if the target item is not a post (eg a like) we want to address its thread parent
- $mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']);
+ if($target_item) {
+ // if the target item is not a post (eg a like) we want to address its thread parent
+ $mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']);
- // if we got a decoded hash we must encode it again before handing to javascript
- if($decoded)
- $mid = 'b64.' . base64url_encode($mid);
+ // if we got a decoded hash we must encode it again before handing to javascript
+ if($decoded)
+ $mid = 'b64.' . base64url_encode($mid);
+ }
+ else {
+ $mid = '';
+ }
$o .= '<div id="live-hq"></div>' . "\r\n";
$o .= "<script> var profile_uid = " . local_channel()
@@ -188,7 +196,9 @@ class Hq extends \Zotlabs\Web\Controller {
]);
}
- if($load) {
+ $updateable = false;
+
+ if($load && $target_item) {
$r = null;
$r = q("SELECT item.id AS item_id FROM item
@@ -215,7 +225,7 @@ class Hq extends \Zotlabs\Web\Controller {
);
}
}
- elseif($update) {
+ elseif($update && $target_item) {
$r = null;
$r = q("SELECT item.parent AS item_id FROM item
diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php
index 84f9d2a21..c1bce0d51 100644
--- a/Zotlabs/Module/Ping.php
+++ b/Zotlabs/Module/Ping.php
@@ -140,7 +140,7 @@ class Ping extends \Zotlabs\Web\Controller {
db_utcnow(), db_quoteinterval('3 MINUTE')
);
- $discover_tab_on = ((get_config('system','disable_discover_tab') != 1) ? true : false);
+ $discover_tab_on = ((get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false) ? false : true);
$notify_pubs = ((local_channel()) ? ($vnotify & VNOTIFY_PUBS) && $discover_tab_on : $discover_tab_on);
if($notify_pubs) {
diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php
index db0f79060..5e9e88a6d 100644
--- a/Zotlabs/Module/Settings/Channel.php
+++ b/Zotlabs/Module/Settings/Channel.php
@@ -206,7 +206,7 @@ class Channel {
$vnotify += intval($_POST['vnotify11']);
if(x($_POST,'vnotify12'))
$vnotify += intval($_POST['vnotify12']);
- if(x($_POST,'vnotify13') && (get_config('system', 'disable_discover_tab') != 1))
+ if(x($_POST,'vnotify13'))
$vnotify += intval($_POST['vnotify13']);
$always_show_in_notices = x($_POST,'always_show_in_notices') ? 1 : 0;
@@ -481,6 +481,8 @@ class Channel {
$plugin = [ 'basic' => '', 'security' => '', 'notify' => '', 'misc' => '' ];
call_hooks('channel_settings',$plugin);
+ $disable_discover_tab = get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false;
+
$o .= replace_macros($stpl,array(
'$ptitle' => t('Channel Settings'),
@@ -570,7 +572,7 @@ class Channel {
'$vnotify10' => array('vnotify10', t('New connections'), ($vnotify & VNOTIFY_INTRO), VNOTIFY_INTRO, t('Recommended'), $yes_no),
'$vnotify11' => array('vnotify11', t('System Registrations'), ($vnotify & VNOTIFY_REGISTER), VNOTIFY_REGISTER, '', $yes_no),
'$vnotify12' => array('vnotify12', t('Unseen shared files'), ($vnotify & VNOTIFY_FILES), VNOTIFY_FILES, '', $yes_no),
- '$vnotify13' => ((get_config('system', 'disable_discover_tab') != 1) ? array('vnotify13', t('Unseen public activity'), ($vnotify & VNOTIFY_PUBS), VNOTIFY_PUBS, '', $yes_no) : array()),
+ '$vnotify13' => (($disable_discover_tab) ? array() : array('vnotify13', t('Unseen public activity'), ($vnotify & VNOTIFY_PUBS), VNOTIFY_PUBS, '', $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()) ],
'$always_show_in_notices' => array('always_show_in_notices', t('Also show new wall posts, private messages and connections under Notices'), $always_show_in_notices, 1, '', $yes_no),
diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php
index 1c66b8cf4..9a8c23a9b 100644
--- a/Zotlabs/Web/HTTPSig.php
+++ b/Zotlabs/Web/HTTPSig.php
@@ -237,7 +237,7 @@ class HTTPSig {
$fields = '(request-target)';
}
- if(head) {
+ if($head) {
foreach($head as $k => $v) {
$headers .= strtolower($k) . ': ' . trim($v) . "\n";
if($fields)