diff options
-rw-r--r-- | CHANGELOG | 21 | ||||
-rw-r--r-- | Zotlabs/Daemon/Externals.php | 6 | ||||
-rw-r--r-- | Zotlabs/Daemon/Onepoll.php | 13 | ||||
-rw-r--r-- | Zotlabs/Daemon/Poller.php | 7 | ||||
-rw-r--r-- | Zotlabs/Lib/Activity.php | 7 | ||||
-rw-r--r-- | Zotlabs/Lib/Apps.php | 4 | ||||
-rw-r--r-- | Zotlabs/Lib/Connect.php | 4 | ||||
-rw-r--r-- | Zotlabs/Lib/Libsync.php | 9 | ||||
-rw-r--r-- | Zotlabs/Module/Activity.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Cdav.php | 34 | ||||
-rw-r--r-- | Zotlabs/Module/Display.php | 21 | ||||
-rw-r--r-- | Zotlabs/Module/Follow.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Item.php | 9 | ||||
-rw-r--r-- | Zotlabs/Module/Oep.php | 1 | ||||
-rw-r--r-- | Zotlabs/Module/Sse_bs.php | 24 | ||||
-rw-r--r-- | Zotlabs/Module/Wall_upload.php | 22 | ||||
-rw-r--r-- | Zotlabs/Web/WebServer.php | 3 | ||||
-rw-r--r-- | Zotlabs/Widget/Messages.php | 26 | ||||
-rw-r--r-- | boot.php | 2 | ||||
-rw-r--r-- | include/attach.php | 11 | ||||
-rw-r--r-- | include/feedutils.php | 4 | ||||
-rw-r--r-- | include/items.php | 48 | ||||
-rw-r--r-- | include/xchan.php | 6 | ||||
-rw-r--r-- | view/js/main.js | 6 | ||||
-rw-r--r-- | view/tpl/messages_widget.tpl | 7 | ||||
-rw-r--r-- | view/tpl/notifications_widget.tpl | 14 |
26 files changed, 196 insertions, 119 deletions
@@ -1,3 +1,24 @@ +Hubzilla 7.8.6 (2022-11-14) + - Fix typo in boot.php + + +Hubzilla 7.8.5 (2022-11-13) + - Fix outbound edit activity not of type update + - Fix mod display not falling through to fetch public item + - Fix more PHP warnings + - Fix regression in items_fetch() which resulted in empty atom feed + - Pubcrawl: cleanup and slightly restructre mod inbox + + +Hubzilla 7.8.4 (2022-11-09) + - Fix new uuid created when editing a post + + +Hubzilla 7.8.3 (2022-11-07) + - Fix regression where auto created directories were not created with public permissions + - Fix regression where pinned/featured state of apps was not displayed correctly + + Hubzilla 7.8.2 (2022-11-05) - Pubcrawl: fix regression in inbox - Fix display issue of shares coming from streams diff --git a/Zotlabs/Daemon/Externals.php b/Zotlabs/Daemon/Externals.php index 5b7954c2f..91fa09044 100644 --- a/Zotlabs/Daemon/Externals.php +++ b/Zotlabs/Daemon/Externals.php @@ -19,6 +19,7 @@ class Externals { $importer = get_sys_channel(); $total = 0; $attempts = 0; + $url = ''; logger('externals: startup', LOGGER_DEBUG); @@ -67,9 +68,8 @@ class Externals { datetime_convert('UTC', 'UTC', 'now - 30 days') ); - $contact = $r[0]; - - if ($contact) { + if ($r) { + $contact = $r[0]; $url = $contact['hubloc_id_url']; } } diff --git a/Zotlabs/Daemon/Onepoll.php b/Zotlabs/Daemon/Onepoll.php index f2b5d8c58..0a30a0c7d 100644 --- a/Zotlabs/Daemon/Onepoll.php +++ b/Zotlabs/Daemon/Onepoll.php @@ -64,12 +64,21 @@ class Onepoll { if ($contact['xchan_network'] === 'rss') { logger('onepoll: processing feed ' . $contact['xchan_name'], LOGGER_DEBUG); $alive = handle_feed($importer['channel_id'], $contact_id, $contact['xchan_hash']); - if ($alive) { - q("update abook set abook_connected = '%s' where abook_id = %d", + + if (!$alive) { + q("update abook set abook_updated = '%s' where abook_id = %d", dbesc(datetime_convert()), intval($contact['abook_id']) ); + return; } + + q("update abook set abook_updated = '%s', abook_connected = '%s' where abook_id = %d", + dbesc(datetime_convert()), + dbesc(datetime_convert()), + intval($contact['abook_id']) + ); + return; } diff --git a/Zotlabs/Daemon/Poller.php b/Zotlabs/Daemon/Poller.php index 88213a7c9..702c940a3 100644 --- a/Zotlabs/Daemon/Poller.php +++ b/Zotlabs/Daemon/Poller.php @@ -93,7 +93,14 @@ class Poller { $min = intval(get_config('system', 'minimum_feedcheck_minutes')); if (!$min) $min = 60; + + if ($t !== $c) { + // if the last fetch failed only attempt fetch once a day + $min = 60 * 24; + } + $x = datetime_convert('UTC', 'UTC', "now - $min minutes"); + if ($c < $x) { Master::Summon(['Onepoll', $contact['abook_id']]); if ($interval) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 963a8ff75..9dbb15c28 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -545,6 +545,7 @@ class Activity { call_hooks('encode_item', $hookinfo); + return $hookinfo['encoded']; } @@ -821,8 +822,12 @@ class Activity { } $ret['published'] = ((isset($i['created'])) ? datetime_convert('UTC', 'UTC', $i['created'], ATOM_TIME) : datetime_convert()); - if (isset($i['created'], $i['edited']) && $i['created'] !== $i['edited']) + if (isset($i['created'], $i['edited']) && $i['created'] !== $i['edited']) { $ret['updated'] = datetime_convert('UTC', 'UTC', $i['edited'], ATOM_TIME); + if ($ret['type'] === 'Create') { + $ret['type'] = 'Update'; + } + } if (isset($i['app']) && $i['app']) { $ret['generator'] = ['type' => 'Application', 'name' => $i['app']]; diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index a9c7d0a2a..497a9d299 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -605,8 +605,8 @@ class Apps { '$deleted' => $papp['deleted'] ?? false, '$feature' => ((isset($papp['embed']) || $mode == 'edit') ? false : true), '$pin' => ((isset($papp['embed']) || $mode == 'edit') ? false : true), - '$featured' => ((isset($papp['categories']) && strpos($papp['categories'], 'nav_featured_app') === false) ? false : true), - '$pinned' => ((isset($papp['categories']) && strpos($papp['categories'], 'nav_pinned_app') === false) ? false : true), + '$featured' => ((isset($papp['categories']) && strpos($papp['categories'], 'nav_featured_app') !== false) ? true : false), + '$pinned' => ((isset($papp['categories']) && strpos($papp['categories'], 'nav_pinned_app') !== false) ? true : false), '$mode' => $mode, '$add' => t('Add to app-tray'), '$remove' => t('Remove from app-tray'), diff --git a/Zotlabs/Lib/Connect.php b/Zotlabs/Lib/Connect.php index 4570627fc..802bbe0f5 100644 --- a/Zotlabs/Lib/Connect.php +++ b/Zotlabs/Lib/Connect.php @@ -109,10 +109,12 @@ class Connect { if ($wf || $d) { + $xchan_hash = (($wf) ? $wf : $url); + // something was discovered - find the record which was just created. $r = q("select * from xchan where ( xchan_hash = '%s' or xchan_url = '%s' or xchan_addr = '%s' ) $sql_options", - dbesc($wf ?? $url), + dbesc($xchan_hash), dbesc($url), dbesc($url) ); diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php index 9851ce52a..fd9886f71 100644 --- a/Zotlabs/Lib/Libsync.php +++ b/Zotlabs/Lib/Libsync.php @@ -192,7 +192,10 @@ class Libsync { dbesc($sender) ); - $DR = new DReport(z_root(), $sender, $d, 'sync'); + $mid = 'sync'; + + + $DR = new DReport(z_root(), $sender, $d, $mid); if (!$r) { $DR->update('recipient not found'); @@ -202,7 +205,6 @@ class Libsync { $channel = $r[0]; - $mid = 'sync'; $DR->set_name($channel['channel_name'] . ' <' . channel_reddress($channel) . '>'); @@ -297,7 +299,7 @@ class Libsync { if (array_key_exists('item', $arr) && $arr['item']) { sync_items($channel, $arr['item'], ((array_key_exists('relocate', $arr)) ? $arr['relocate'] : null)); - $mid = $arr['item']['mid'] . '#sync'; + $mid = $arr['item'][0]['message_id'] . '#sync'; } // deprecated, maintaining for a few months for upward compatibility @@ -750,7 +752,6 @@ class Libsync { $result[] = $DR->get(); } - return $result; } diff --git a/Zotlabs/Module/Activity.php b/Zotlabs/Module/Activity.php index 2fbc35274..4ddfe602d 100644 --- a/Zotlabs/Module/Activity.php +++ b/Zotlabs/Module/Activity.php @@ -182,7 +182,7 @@ class Activity extends Controller { return; } - $ob_authorise = false; + $ob_authorize = false; $item_uid = 0; $bear = ZlibActivity::token_from_request(); diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index e68b2e5b4..8e77515ce 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -332,9 +332,9 @@ class Cdav extends Controller { } while ($duplicate == true); $properties = [ - '{DAV:}displayname' => $_REQUEST['{DAV:}displayname'], - '{http://apple.com/ns/ical/}calendar-color' => $_REQUEST['color'], - '{urn:ietf:params:xml:ns:caldav}calendar-description' => $channel['channel_name'] + '{DAV:}displayname' => escape_tags($_REQUEST['{DAV:}displayname']), + '{http://apple.com/ns/ical/}calendar-color' => escape_tags($_REQUEST['color']), + '{urn:ietf:params:xml:ns:caldav}calendar-description' => escape_tags($channel['channel_name']) ]; $id = $caldavBackend->createCalendar($principalUri, $calendarUri, $properties); @@ -366,7 +366,7 @@ class Cdav extends Controller { $allday = $_REQUEST['allday']; - $title = $_REQUEST['title']; + $title = escape_tags($_REQUEST['title']); $start = datetime_convert('UTC', 'UTC', $_REQUEST['dtstart']); $dtstart = new \DateTime($start); @@ -374,8 +374,8 @@ class Cdav extends Controller { $end = datetime_convert('UTC', 'UTC', $_REQUEST['dtend']); $dtend = new \DateTime($end); } - $description = $_REQUEST['description']; - $location = $_REQUEST['location']; + $description = escape_tags($_REQUEST['description']); + $location = escape_tags($_REQUEST['location']); do { $duplicate = false; @@ -441,8 +441,8 @@ class Cdav extends Controller { $cdavdata = $this->get_cdav_data($id[0], 'calendarinstances'); $mutations = [ - '{DAV:}displayname' => $_REQUEST['{DAV:}displayname'], - '{http://apple.com/ns/ical/}calendar-color' => $_REQUEST['color'] + '{DAV:}displayname' => escape_tags($_REQUEST['{DAV:}displayname']), + '{http://apple.com/ns/ical/}calendar-color' => escape_tags($_REQUEST['color']) ]; $patch = new \Sabre\DAV\PropPatch($mutations); @@ -471,18 +471,18 @@ class Cdav extends Controller { $timezone = ((x($_POST,'timezone_select')) ? escape_tags(trim($_POST['timezone_select'])) : ''); $tz = (($timezone) ? $timezone : date_default_timezone_get()); - $allday = $_REQUEST['allday']; + $allday = intval($_REQUEST['allday']); - $uri = $_REQUEST['uri']; - $title = $_REQUEST['title']; + $uri = escape_tags($_REQUEST['uri']); + $title = escape_tags($_REQUEST['title']); $start = datetime_convert('UTC', 'UTC', $_REQUEST['dtstart']); $dtstart = new \DateTime($start); if($_REQUEST['dtend']) { $end = datetime_convert('UTC', 'UTC', $_REQUEST['dtend']); $dtend = new \DateTime($end); } - $description = $_REQUEST['description']; - $location = $_REQUEST['location']; + $description = escape_tags($_REQUEST['description']); + $location = escape_tags($_REQUEST['location']); $object = $caldavBackend->getCalendarObject($id, $uri); @@ -654,7 +654,7 @@ class Cdav extends Controller { $duplicate = true; } while ($duplicate == true); - $properties = ['{DAV:}displayname' => $_REQUEST['{DAV:}displayname']]; + $properties = ['{DAV:}displayname' => escape_tags($_REQUEST['{DAV:}displayname'])]; $carddavBackend->createAddressBook($principalUri, $addressbookUri, $properties); @@ -668,9 +668,9 @@ class Cdav extends Controller { } //edit addressbook - if($_REQUEST['{DAV:}displayname'] && $_REQUEST['edit'] && intval($_REQUEST['id'])) { + if($_REQUEST['{DAV:}displayname'] && $_REQUEST['edit'] && $_REQUEST['id']) { - $id = $_REQUEST['id']; + $id = intval($_REQUEST['id']); if(! cdav_perms($id,$addressbooks)) return; @@ -678,7 +678,7 @@ class Cdav extends Controller { $cdavdata = $this->get_cdav_data($id, 'addressbooks'); $mutations = [ - '{DAV:}displayname' => $_REQUEST['{DAV:}displayname'] + '{DAV:}displayname' => escape_tags($_REQUEST['{DAV:}displayname']) ]; $patch = new \Sabre\DAV\PropPatch($mutations); diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 0aac96f4a..1a1c09d7c 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -213,27 +213,27 @@ class Display extends \Zotlabs\Web\Controller { $observer_hash = get_observer_hash(); $item_normal = item_normal(); $item_normal_update = item_normal_update(); - - $sql_extra = ((local_channel()) ? EMPTY_STR : item_permissions_sql(0, $observer_hash)); + $sql_extra = ''; + $r = []; if($noscript_content || $load) { - require_once('include/channel.php'); $sys = get_sys_channel(); // in case somebody turned off public access to sys channel content using permissions // make that content unsearchable by ensuring the owner uid can't match $sys_id = perm_is_allowed($sys['channel_id'], $observer_hash, 'view_stream') ? $sys['channel_id'] : 0; - $r = null; - if(local_channel()) { $r = q("SELECT item.id AS item_id FROM item WHERE uid = %d AND mid = '%s' $item_normal LIMIT 1", intval(local_channel()), dbesc($target_item['parent_mid']) ); + } - if($r === null) { + if(!$r) { + $sql_extra = item_permissions_sql(0, $observer_hash); + $r = q("SELECT item.id AS item_id FROM item WHERE ((mid = '%s' AND (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = '' @@ -257,7 +257,6 @@ class Display extends \Zotlabs\Web\Controller { // make that content unsearchable by ensuring the owner uid can't match $sys_id = perm_is_allowed($sys['channel_id'], $observer_hash, 'view_stream') ? $sys['channel_id'] : 0; - $r = null; if(local_channel()) { $r = q("SELECT item.parent AS item_id from item WHERE uid = %d @@ -270,7 +269,9 @@ class Display extends \Zotlabs\Web\Controller { ); } - if($r === null) { + if(!$r) { + $sql_extra = item_permissions_sql(0, $observer_hash); + $r = q("SELECT item.id as item_id from item WHERE ((parent_mid = '%s' AND (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = '' @@ -287,10 +288,6 @@ class Display extends \Zotlabs\Web\Controller { } } - else { - $r = []; - } - if($r) { $parents_str = ids_to_querystr($r,'item_id'); if($parents_str) { diff --git a/Zotlabs/Module/Follow.php b/Zotlabs/Module/Follow.php index 54e29c492..f8bfc11f3 100644 --- a/Zotlabs/Module/Follow.php +++ b/Zotlabs/Module/Follow.php @@ -70,12 +70,12 @@ class Follow extends Controller { } $uid = local_channel(); - $url = notags(trim(punify($_REQUEST['url']))); + $url = notags(punify(trim($_REQUEST['url']))); $return_url = $_SESSION['return_url']; $interactive = $_REQUEST['interactive'] ?? 1; $channel = App::get_channel(); - $result = Connect::connect($channel,$url); + $result = Connect::connect($channel, $url); if ($result['success'] == false) { if ($result['message']) { diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index a5e7b31ea..8e6106e79 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -393,7 +393,7 @@ class Item extends Controller { $owner_hash = null; - $message_id = ((x($_REQUEST, 'message_id') && $api_source) ? strip_tags($_REQUEST['message_id']) : ''); + $message_id = ((x($_REQUEST, 'message_id') && $api_source) ? strip_tags($_REQUEST['message_id']) : null); $created = ((x($_REQUEST, 'created')) ? datetime_convert(date_default_timezone_get(), 'UTC', $_REQUEST['created']) : datetime_convert()); $post_id = ((x($_REQUEST, 'post_id')) ? intval($_REQUEST['post_id']) : 0); $app = ((x($_REQUEST, 'source')) ? strip_tags($_REQUEST['source']) : ''); @@ -710,6 +710,7 @@ class Item extends Controller { $expires = $orig_post['expires']; $comments_closed = $orig_post['comments_closed']; $mid = $orig_post['mid']; + $uuid = $orig_post['uuid']; $thr_parent = $orig_post['thr_parent']; $parent_mid = $orig_post['parent_mid']; $plink = $orig_post['plink']; @@ -1000,10 +1001,8 @@ class Item extends Controller { $notify_type = (($parent) ? 'comment-new' : 'wall-new'); - $uuid = (($message_id) ? $message_id : item_message_id()); - - $mid = $mid ?? z_root() . '/item/' . $uuid; - + $uuid = $uuid ?? $message_id ?? item_message_id(); + $mid = $mid ?? z_root() . '/item/' . $uuid; if ($is_poll) { $poll = [ diff --git a/Zotlabs/Module/Oep.php b/Zotlabs/Module/Oep.php index d3ef05e16..bf17e6436 100644 --- a/Zotlabs/Module/Oep.php +++ b/Zotlabs/Module/Oep.php @@ -343,6 +343,7 @@ class Oep extends \Zotlabs\Web\Controller { if(! ($chn && $res)) return; + $c = q("select * from channel where channel_address = '%s' limit 1", dbesc($chn) ); diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index 3a4e4e09e..4aabcafcb 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -205,18 +205,18 @@ class Sse_bs extends Controller { } - $r = q("SELECT count(id) as total FROM item + $r = q("SELECT id FROM item WHERE uid = %d and item_unseen = 1 AND item_wall = 0 AND item_private IN (0, 1) AND obj_type NOT IN ('Document', 'Video', 'Audio', 'Image') AND author_xchan != '%s' $item_normal - $sql_extra", + $sql_extra LIMIT 100", intval(self::$uid), dbesc(self::$ob_hash) ); if($r) - $result['network']['count'] = intval($r[0]['total']); + $result['network']['count'] = count($r); return $result; } @@ -285,17 +285,17 @@ class Sse_bs extends Controller { } - $r = q("SELECT count(id) as total FROM item + $r = q("SELECT id FROM item WHERE uid = %d and item_unseen = 1 AND item_private = 2 $item_normal $sql_extra - AND author_xchan != '%s'", + AND author_xchan != '%s' LIMIT 100", intval(self::$uid), dbesc(self::$ob_hash) ); if($r) - $result['dm']['count'] = intval($r[0]['total']); + $result['dm']['count'] = count($r); return $result; } @@ -365,17 +365,17 @@ class Sse_bs extends Controller { } - $r = q("SELECT count(id) as total FROM item + $r = q("SELECT id FROM item WHERE uid = %d and item_unseen = 1 AND item_wall = 1 AND item_private IN (0, 1) $item_normal $sql_extra - AND author_xchan != '%s'", + AND author_xchan != '%s' LIMIT 100", intval(self::$uid), dbesc(self::$ob_hash) ); if($r) - $result['home']['count'] = intval($r[0]['total']); + $result['home']['count'] = count($r); return $result; } @@ -458,19 +458,19 @@ class Sse_bs extends Controller { } - $r = q("SELECT count(id) as total FROM item + $r = q("SELECT id FROM item WHERE uid = %d AND item_unseen = 1 AND created > '%s' $item_normal $sql_extra - AND author_xchan != '%s'", + AND author_xchan != '%s' LIMIT 100", intval($sys['channel_id']), dbescdate($_SESSION['static_loadtime']), dbesc(self::$ob_hash) ); if($r) - $result['pubs']['count'] = intval($r[0]['total']); + $result['pubs']['count'] = count($r); return $result; } diff --git a/Zotlabs/Module/Wall_upload.php b/Zotlabs/Module/Wall_upload.php index 6d58e4032..3e979588c 100644 --- a/Zotlabs/Module/Wall_upload.php +++ b/Zotlabs/Module/Wall_upload.php @@ -11,10 +11,10 @@ require_once('include/photos.php'); class Wall_upload extends \Zotlabs\Web\Controller { function post() { - - - $using_api = ((x($_FILES,'media')) ? true : false); - + + + $using_api = ((x($_FILES,'media')) ? true : false); + if($using_api) { require_once('include/api.php'); if(api_user()) @@ -24,32 +24,32 @@ class Wall_upload extends \Zotlabs\Web\Controller { if(argc() > 1) $channel = channelx_by_nick(argv(1)); } - + if(! $channel) { if($using_api) return; notice( t('Channel not found.') . EOL); killme(); } - + $observer = \App::get_observer(); - + $args = array( 'source' => 'editor', 'visible' => 0, 'contact_allow' => array($channel['channel_hash'])); - + $ret = photo_upload($channel,$observer,$args); - + if(! $ret['success']) { if($using_api) return; notice($ret['message']); killme(); } - + if($using_api) return("\n\n" . $ret['body'] . "\n\n"); else echo "\n\n" . $ret['body'] . "\n\n"; killme(); } - + } diff --git a/Zotlabs/Web/WebServer.php b/Zotlabs/Web/WebServer.php index 9fa5a7797..f43ae10a4 100644 --- a/Zotlabs/Web/WebServer.php +++ b/Zotlabs/Web/WebServer.php @@ -50,7 +50,8 @@ class WebServer { else unset($_SESSION['language']); } - if((x($_SESSION, 'language')) && ($_SESSION['language'] !== $lang)) { + + if ((x($_SESSION, 'language')) && ($_SESSION['language'] !== \App::$language)) { \App::$language = $_SESSION['language']; load_translation_table(\App::$language); } diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index 38c822502..c40d294e8 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -34,7 +34,8 @@ class Messages { 'starred_messages_title' => t('Starred messages'), 'notice_messages_title' => t('Notices'), 'loading' => t('Loading'), - 'empty' => t('No messages') + 'empty' => t('No messages'), + 'unseen' => t('Unseen') ] ]); @@ -62,6 +63,16 @@ class Messages { $limit = 30; $dummy_order_sql = ''; $loadtime = (($offset) ? $_SESSION['messages_loadtime'] : datetime_convert()); + $vnotify = get_pconfig(local_channel(), 'system', 'vnotify', -1); + + $vnotify_sql = ''; + + if (!($vnotify & VNOTIFY_LIKE)) { + $vnotify_sql = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + } + elseif (!feature_enabled(local_channel(), 'dislike')) { + $vnotify_sql = " AND verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') "; + } switch($type) { case 'direct': @@ -147,14 +158,25 @@ 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_url']; + $entries[$i]['author_addr'] = (($item['author']['xchan_addr']) ? $item['author']['xchan_addr'] : $item['author']['xchan_url']); $entries[$i]['info'] = $info; $entries[$i]['created'] = datetime_convert('UTC', date_default_timezone_get(), $item['created']); $entries[$i]['summary'] = $summary; $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']) ? ' ' : '')); + $entries[$i]['unseen_class'] = (($item['item_unseen']) ? 'primary' : 'secondary'); $i++; } @@ -60,7 +60,7 @@ require_once('include/bbcode.php'); require_once('include/items.php'); define('PLATFORM_NAME', 'hubzilla'); -define('STD_VERSION', '7.9.2'); +define('STD_VERSION', '7.9.8'); define('ZOT_REVISION', '6.0'); define('DB_UPDATE_VERSION', 1253); diff --git a/include/attach.php b/include/attach.php index 3b63bd651..fd418103d 100644 --- a/include/attach.php +++ b/include/attach.php @@ -707,13 +707,12 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { $darr = array('pathname' => $pathname); - // if we need to create a directory, use the channel default permissions. - - $darr['allow_cid'] = $channel['channel_allow_cid']; - $darr['allow_gid'] = $channel['channel_allow_gid']; - $darr['deny_cid'] = $channel['channel_deny_cid']; - $darr['deny_gid'] = $channel['channel_deny_gid']; + // if we need to create a directory at this point, make it public + $darr['allow_cid'] = ''; + $darr['allow_gid'] = ''; + $darr['deny_cid'] = ''; + $darr['deny_gid'] = ''; $direct = null; diff --git a/include/feedutils.php b/include/feedutils.php index 814e9c163..eea908fe8 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -1904,7 +1904,7 @@ function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0, $ if(! $item['parent']) return; - if($item['deleted']) + if($item['item_deleted']) return '<at:deleted-entry ref="' . xmlify($item['mid']) . '" when="' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . '" />' . "\r\n"; create_export_photo_body($item); @@ -2024,7 +2024,7 @@ function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0, $ } } - if($item['term']) { + if (isset($item['term']) && $item['term']) { foreach($item['term'] as $term) { $scheme = ''; $label = ''; diff --git a/include/items.php b/include/items.php index 46140b699..0f477e761 100644 --- a/include/items.php +++ b/include/items.php @@ -2659,9 +2659,10 @@ function tag_deliver($uid, $item_id) { if ($is_group && intval($x[0]['item_wall'])) { // don't let the forked delivery chain recurse - if ($item['verb'] === 'Announce' && $item['author_xchan'] === $u['channel_hash']) { + if ($item['verb'] === 'Announce' && $item['author_xchan'] === $u[0]['channel_hash']) { return; } + // don't announce moderated content until it has been approved if (intval($item['item_blocked']) === ITEM_MODERATED) { return; @@ -2678,7 +2679,7 @@ function tag_deliver($uid, $item_id) { } elseif (intval($x[0]['item_uplink'])) { - start_delivery_chain($u,$item,$item_id,$x[0]); + start_delivery_chain($u[0], $item, $item_id, $x[0]); } } @@ -4336,7 +4337,6 @@ function zot_feed($uid, $observer_hash, $arr) { } function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = CLIENT_MODE_NORMAL,$module = 'network') { - $result = ['success' => false]; $sql_extra = ''; $sql_nets = ''; @@ -4354,7 +4354,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C ); } - if(isset($arr['uid'])) { + if(isset($arr['uid']) && $arr['uid']) { $uid = $arr['uid']; } @@ -4364,30 +4364,30 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C $item_uids = " item.uid = " . intval($uid) . " "; } - if(isset($arr['top'])) + if(isset($arr['top']) && $arr['top']) $sql_options .= " and item_thread_top = 1 "; - if(isset($arr['star'])) + if(isset($arr['star']) && $arr['star']) $sql_options .= " and item_starred = 1 "; - if(isset($arr['wall'])) + if(isset($arr['wall']) && $arr['wall']) $sql_options .= " and item_wall = 1 "; - if(isset($arr['item_id'])) + if(isset($arr['item_id']) && $arr['item_id']) $sql_options .= " and parent = " . intval($arr['item_id']) . " "; - if(isset($arr['mid'])) + if(isset($arr['mid']) && $arr['mid']) $sql_options .= " and parent_mid = '" . dbesc($arr['mid']) . "' "; $sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE $item_uids and item_thread_top = 1 $sql_options $item_normal ) "; - if(isset($arr['since_id'])) + if(isset($arr['since_id']) && $arr['since_id']) $sql_extra .= " and item.id > " . intval($arr['since_id']) . " "; - if(isset($arr['cat'])) + if(isset($arr['cat']) && $arr['cat']) $sql_extra .= protect_sprintf(term_query('item', $arr['cat'], TERM_CATEGORY)); - if(isset($arr['gid']) && $uid) { + if((isset($arr['gid']) && $arr['gid']) && $uid) { $r = q("SELECT * FROM pgrp WHERE id = %d AND uid = %d LIMIT 1", intval($arr['group']), intval($uid) @@ -4418,7 +4418,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C $x = AccessList::by_hash($uid, $r[0]['hash']); $result['headline'] = sprintf( t('Privacy group: %s'),$x['gname']); } - elseif(isset($arr['cid']) && $uid) { + elseif((isset($arr['cid']) && $arr['cid']) && $uid) { $r = q("SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_channel = %d and abook_blocked = 0 limit 1", intval($arr['cid']), @@ -4437,14 +4437,14 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C $sql_extra = " AND author_xchan = '" . $channel['channel_hash'] . "' and item_private = 0 $item_normal "; } - if (isset($arr['datequery'])) { + if (isset($arr['datequery']) && $arr['datequery']) { $sql_extra3 .= protect_sprintf(sprintf(" AND item.created <= '%s' ", dbesc(datetime_convert('UTC','UTC',$arr['datequery'])))); } - if (isset($arr['datequery2'])) { + if (isset($arr['datequery2']) && $arr['datequery2']) { $sql_extra3 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert('UTC','UTC',$arr['datequery2'])))); } - if(isset($arr['search'])) { + if(isset($arr['search']) && $arr['search']) { if(strpos($arr['search'],'#') === 0) $sql_extra .= term_query('item',substr($arr['search'],1),TERM_HASHTAG,TERM_COMMUNITYTAG); else @@ -4453,11 +4453,11 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C ); } - if(isset($arr['file'])) { - $sql_extra .= term_query('item',$arr['files'],TERM_FILE); + if(isset($arr['file']) && $arr['file']) { + $sql_extra .= term_query('item',$arr['file'],TERM_FILE); } - if(isset($arr['conv']) && $channel) { + if((isset($arr['conv']) && $arr['conv']) && $channel) { $sql_extra .= sprintf(" AND parent IN (SELECT distinct parent from item where ( author_xchan like '%s' or item_mentionsme = 1 )) ", dbesc(protect_sprintf($uidhash)) ); @@ -4507,15 +4507,16 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C require_once('include/security.php'); $sql_extra .= item_permissions_sql($channel['channel_id'],$observer_hash); - if(isset($arr['pages'])) + if(isset($arr['pages']) && $arr['pages']) { $item_restrict = " AND item_type = " . ITEM_TYPE_WEBPAGE . " "; + } else $item_restrict = " AND item_type = 0 "; if(isset($arr['item_type']) && $arr['item_type'] === '*') $item_restrict = ''; - if (((isset($arr['compat'])) || (isset($arr['nouveau']) && ($client_mode & CLIENT_MODE_LOAD))) && $channel) { + if (((isset($arr['compat']) && $arr['compat']) || ((isset($arr['nouveau']) && $arr['nouveau']) && ($client_mode & CLIENT_MODE_LOAD))) && $channel) { // "New Item View" - show all items unthreaded in reverse created date order @@ -4552,9 +4553,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C $ordering = "commented"; if(($client_mode & CLIENT_MODE_LOAD) || ($client_mode == CLIENT_MODE_NORMAL)) { - // Fetch a page full of parent items for this page - $r = dbq("SELECT distinct item.id AS item_id, item.$ordering FROM item left join abook on item.author_xchan = abook.abook_xchan WHERE $item_uids $item_restrict @@ -4610,9 +4609,10 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C $items = array(); } - if($parents_str && $arr['mark_seen']) + if ($parents_str && (isset($arr['mark_seen']) && $arr['mark_seen'])) { $update_unseen = ' AND parent IN ( ' . dbesc($parents_str) . ' )'; /** @FIXME finish mark unseen sql */ + } } return $items; diff --git a/include/xchan.php b/include/xchan.php index a32064303..4a2d389c0 100644 --- a/include/xchan.php +++ b/include/xchan.php @@ -148,15 +148,15 @@ function xchan_store($arr) { function xchan_fetch($arr) { $key = ''; - if($arr['hash']) { + if(isset($arr['hash']) && $arr['hash']) { $key = 'xchan_hash'; $v = $arr['hash']; } - elseif($arr['guid']) { + elseif(isset($arr['guid']) && $arr['guid']) { $key = 'xchan_guid'; $v = $arr['guid']; } - elseif($arr['address']) { + elseif(isset($arr['address']) && $arr['address']) { $key = 'xchan_addr'; $v = $arr['address']; } diff --git a/view/js/main.js b/view/js/main.js index aff6eab4d..c409eed35 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -197,8 +197,7 @@ $(document).ready(function() { if (singlethread_modules.indexOf(module) !== -1) { history.pushState(stateObj, '', module + '/' + b64mid); - $('.message').removeClass('active'); - $('[data-b64mid="' + b64mid + '"].message').addClass('active'); + } if (b64mid) { @@ -207,6 +206,9 @@ $(document).ready(function() { if(! page_load) { prepareLiveUpdate(b64mid, notify_id); + $('.message').removeClass('active'); + $('[data-b64mid="' + b64mid + '"].message').addClass('active'); + $('[data-b64mid="' + b64mid + '"].message .badge').remove(); } } } diff --git a/view/tpl/messages_widget.tpl b/view/tpl/messages_widget.tpl index ddb21beb5..5d0caf46d 100644 --- a/view/tpl/messages_widget.tpl +++ b/view/tpl/messages_widget.tpl @@ -36,6 +36,7 @@ <div class="text-break">{2}</div> </div> <small>{3}</small> + {8} </a> </div> <div id="dm-container" class="list-group list-group-flush" data-offset="10"> @@ -52,6 +53,9 @@ <div class="text-break">{{$e.summary}}</div> </div> <small>{{$e.info}}</small> + {{if $e.unseen}} + <span class="badge bg-transparent border border-{{$e.unseen_class}} text-{{$e.unseen_class}} rounded-pill position-absolute bottom-0 end-0 m-2" title="{{$strings.unseen}}">{{$e.unseen}}</span> + {{/if}} </a> {{/foreach}} <div id="messages-empty" class="list-group-item border-0"{{if $entries}} style="display: none;"{{/if}}> @@ -124,7 +128,8 @@ e.author_name, e.author_addr, e.href, - e.icon + e.icon, + e.unseen ? '<span class="badge bg-transparent border border-' + e.unseen_class + ' text-' + e.unseen_class + ' rounded-pill position-absolute bottom-0 end-0 m-2" title="{{$strings.unseen}}">' + e.unseen + '</span>' : '' ); $('#messages-loading').before(html); }); diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl index 82b3665c3..7a4e909c7 100644 --- a/view/tpl/notifications_widget.tpl +++ b/view/tpl/notifications_widget.tpl @@ -306,12 +306,18 @@ if(typeof obj[type] === typeof undefined) return true; + var count = Number(obj[type].count); + + if(obj[type].count) { $('.' + type + '-button').fadeIn(); - if(replace || followup) - $('.' + type + '-update').html(Number(obj[type].count)); - else - $('.' + type + '-update').html(Number(obj[type].count) + Number($('.' + type + '-update').html())); + if(replace || followup) { + $('.' + type + '-update').html(count >= 100 ? '99+' : count); + } + else { + count = count + Number($('.' + type + '-update').html().replace(/\++$/, '')); + $('.' + type + '-update').html(count >= 100 ? '99+' : count); + } } else { $('.' + type + '-update').html('0'); |