aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Daemon/Cron_daily.php16
-rw-r--r--Zotlabs/Daemon/Poller.php4
-rw-r--r--Zotlabs/Lib/Webfinger.php18
-rw-r--r--Zotlabs/Module/Invite.php13
-rw-r--r--Zotlabs/Module/Pubstream.php11
-rw-r--r--Zotlabs/Module/Sse.php6
-rw-r--r--Zotlabs/Widget/Messages.php40
7 files changed, 69 insertions, 39 deletions
diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php
index d1b74a032..71d3bc9ef 100644
--- a/Zotlabs/Daemon/Cron_daily.php
+++ b/Zotlabs/Daemon/Cron_daily.php
@@ -49,6 +49,22 @@ class Cron_daily {
dbesc('sse_id.%')
);
+ // Mark items seen after X days (default 90)
+
+ $r = dbq("select channel_id from channel where channel_removed = 0");
+ if ($r) {
+ foreach ($r as $rr) {
+ $mark_seen_days = get_pconfig($rr['channel_id'], 'system', 'mark_seen_days', 90);
+ q("UPDATE item SET item_unseen = 0 WHERE
+ uid = %d AND item_unseen = 1
+ AND created < %s - INTERVAL %s",
+ intval($rr['channel_id']),
+ db_utcnow(),
+ db_quoteinterval($mark_seen_days . ' DAY')
+ );
+ }
+ }
+
// Clean up emdedded content cache
q("DELETE FROM cache WHERE updated < %s - INTERVAL %s",
db_utcnow(),
diff --git a/Zotlabs/Daemon/Poller.php b/Zotlabs/Daemon/Poller.php
index 702c940a3..63c498f17 100644
--- a/Zotlabs/Daemon/Poller.php
+++ b/Zotlabs/Daemon/Poller.php
@@ -101,12 +101,14 @@ class Poller {
$x = datetime_convert('UTC', 'UTC', "now - $min minutes");
- if ($c < $x) {
+ if ($t < $x) {
Master::Summon(['Onepoll', $contact['abook_id']]);
if ($interval)
@time_sleep_until(microtime(true) + (float)$interval);
}
+
continue;
+
}
if ($contact['xchan_network'] !== 'zot6')
diff --git a/Zotlabs/Lib/Webfinger.php b/Zotlabs/Lib/Webfinger.php
index 16d54010c..a0a4aef47 100644
--- a/Zotlabs/Lib/Webfinger.php
+++ b/Zotlabs/Lib/Webfinger.php
@@ -52,15 +52,21 @@ class Webfinger {
if(strpos($resource,'http') === 0) {
$m = parse_url($resource);
- if($m) {
- if(isset($m['scheme']) && $m['scheme'] !== 'https') {
- return false;
- }
- self::$server = $m['host'] . ((isset($m['port'])) ? ':' . $m['port'] : '');
+
+ if (!$m) {
+ return false;
}
- else {
+
+ if(isset($m['scheme']) && $m['scheme'] !== 'https') {
return false;
}
+
+ if(!isset($m['host'])) {
+ return false;
+ }
+
+ self::$server = $m['host'] . ((isset($m['port'])) ? ':' . $m['port'] : '');
+
}
elseif(strpos($resource,'tag:') === 0) {
$arr = explode(':',$resource); // split the tag
diff --git a/Zotlabs/Module/Invite.php b/Zotlabs/Module/Invite.php
index 2a126ac27..bb552e4c7 100644
--- a/Zotlabs/Module/Invite.php
+++ b/Zotlabs/Module/Invite.php
@@ -43,6 +43,19 @@ class Invite extends Controller {
const MYP = 'ZAI';
const VERSION = '2.0.0';
+ function init() {
+
+ if (!local_channel()) {
+ return;
+ }
+
+ $channel = App::get_channel();
+ if ($channel) {
+ profile_load($channel['channel_address']);
+ }
+
+ }
+
function post() {
// zai02
diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php
index 3c8dfa0a5..47da3c13a 100644
--- a/Zotlabs/Module/Pubstream.php
+++ b/Zotlabs/Module/Pubstream.php
@@ -12,6 +12,7 @@ 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
@@ -31,16 +32,13 @@ class Pubstream extends \Zotlabs\Web\Controller {
}
}
- $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)) {
+ if(!$net_firehose) {
return '';
}
- if($net_firehose) {
- $site_firehose = false;
- }
+ $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
$mid = ((x($_REQUEST, 'mid')) ? unpack_link_id($_REQUEST['mid']) : '');
if ($mid === false) {
@@ -161,13 +159,14 @@ class Pubstream extends \Zotlabs\Web\Controller {
$sys = get_sys_channel();
$abook_uids = " and abook.abook_channel = " . intval($sys['channel_id']) . " ";
+ $sql_extra = '';
if($site_firehose) {
$uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and item_wall = 1 ";
}
else {
$uids = " and item.uid = " . intval($sys['channel_id']) . " ";
- $sql_extra = item_permissions_sql($sys['channel_id']);
+ $sql_extra .= item_permissions_sql($sys['channel_id']);
\App::$data['firehose'] = intval($sys['channel_id']);
}
diff --git a/Zotlabs/Module/Sse.php b/Zotlabs/Module/Sse.php
index 3dab3d465..f87a19821 100644
--- a/Zotlabs/Module/Sse.php
+++ b/Zotlabs/Module/Sse.php
@@ -100,9 +100,9 @@ class Sse extends Controller {
// We do not have the local_channel in the addon.
// Reset pubs here if the app is not installed.
if (self::$uid && (!(self::$vnotify & VNOTIFY_PUBS) || !Apps::system_app_installed(self::$uid, 'Public Stream'))) {
- $result['pubs']['count'] = 0;
- $result['pubs']['notifications'] = [];
- $result['pubs']['offset'] = -1;
+ if (isset($result['pubs'])) {
+ unset($result['pubs']);
+ }
}
if($result && !$lock) {
diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php
index 2ba1f4da5..0f57a8d85 100644
--- a/Zotlabs/Widget/Messages.php
+++ b/Zotlabs/Widget/Messages.php
@@ -35,7 +35,7 @@ class Messages {
'notice_messages_title' => t('Notices'),
'loading' => t('Loading'),
'empty' => t('No messages'),
- 'unseen' => t('Unseen')
+ 'unseen_count' => t('Unseen')
]
]);
@@ -58,7 +58,7 @@ class Messages {
}
$channel = App::get_channel();
- $item_normal = item_normal();
+ $item_normal = str_replace('item.', 'i.', item_normal());
$entries = [];
$limit = 30;
$dummy_order_sql = '';
@@ -68,34 +68,37 @@ class Messages {
$vnotify_sql = '';
if (!($vnotify & VNOTIFY_LIKE)) {
- $vnotify_sql = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $vnotify_sql = " AND c.verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
}
elseif (!feature_enabled(local_channel(), 'dislike')) {
- $vnotify_sql = " AND verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $vnotify_sql = " AND c.verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') ";
}
switch($type) {
case 'direct':
- $type_sql = ' AND item_private = 2 ';
+ $type_sql = ' AND i.item_private = 2 ';
// $dummy_order_sql has no other meaning but to trick
// some mysql backends into using the right index.
- $dummy_order_sql = ', received DESC ';
+ $dummy_order_sql = ', i.received DESC ';
break;
case 'starred':
- $type_sql = ' AND item_starred = 1 ';
+ $type_sql = ' AND i.item_starred = 1 ';
break;
default:
- $type_sql = ' AND item_private IN (0, 1) ';
+ $type_sql = ' AND i.item_private IN (0, 1) ';
}
- $items = q("SELECT * FROM item WHERE uid = %d
- AND created <= '%s'
+ $items = q("SELECT *,
+ (SELECT count(*) FROM item c WHERE c.uid = %d AND c.parent = i.parent AND c.item_unseen = 1 AND c.item_thread_top = 0 $vnotify_sql) AS unseen_count
+ FROM item i WHERE i.uid = %d
+ AND i.created <= '%s'
$type_sql
- AND item_thread_top = 1
+ AND i.item_thread_top = 1
$item_normal
- ORDER BY created DESC $dummy_order_sql
+ ORDER BY i.created DESC $dummy_order_sql
LIMIT $limit OFFSET $offset",
intval(local_channel()),
+ intval(local_channel()),
dbescdate($loadtime)
);
@@ -158,15 +161,6 @@ class Messages {
$icon = '';
}
- $unseen = q("SELECT count(id) AS total FROM item WHERE uid = %d
- AND parent = %d
- AND item_thread_top = 0
- AND item_unseen = 1
- $vnotify_sql",
- intval(local_channel()),
- intval($item['id'])
- );
-
$entries[$i]['author_name'] = $item['author']['xchan_name'];
$entries[$i]['author_addr'] = (($item['author']['xchan_addr']) ? $item['author']['xchan_addr'] : $item['author']['xchan_url']);
$entries[$i]['info'] = $info;
@@ -175,8 +169,8 @@ class Messages {
$entries[$i]['b64mid'] = gen_link_id($item['mid']);
$entries[$i]['href'] = z_root() . '/hq/' . gen_link_id($item['mid']);
$entries[$i]['icon'] = $icon;
- $entries[$i]['unseen'] = (($unseen[0]['total']) ? $unseen[0]['total'] : (($item['item_unseen']) ? '&#8192;' : ''));
- $entries[$i]['unseen_class'] = (($item['item_unseen']) ? 'bg-primary' : 'bg-secondary');
+ $entries[$i]['unseen_count'] = (($item['unseen_count']) ? $item['unseen_count'] : (($item['item_unseen']) ? '&#8192;' : ''));
+ $entries[$i]['unseen_class'] = (($item['item_unseen']) ? 'primary' : 'secondary');
$i++;
}