diff options
-rw-r--r-- | Zotlabs/Daemon/Cron_daily.php | 16 | ||||
-rw-r--r-- | Zotlabs/Daemon/Poller.php | 4 | ||||
-rw-r--r-- | Zotlabs/Lib/Webfinger.php | 18 | ||||
-rw-r--r-- | Zotlabs/Module/Invite.php | 13 | ||||
-rw-r--r-- | Zotlabs/Module/Pubstream.php | 11 | ||||
-rw-r--r-- | Zotlabs/Module/Sse.php | 6 | ||||
-rw-r--r-- | Zotlabs/Widget/Messages.php | 40 | ||||
-rw-r--r-- | boot.php | 2 | ||||
-rw-r--r-- | include/api_auth.php | 4 | ||||
-rw-r--r-- | include/event.php | 6 | ||||
-rw-r--r-- | include/feedutils.php | 6 | ||||
-rw-r--r-- | include/items.php | 20 | ||||
-rw-r--r-- | include/nav.php | 4 | ||||
-rw-r--r-- | view/pdl/mod_invite.pdl | 10 | ||||
-rw-r--r-- | view/theme/redbasic/schema/bootstrap-nightfall.css | 2 | ||||
-rw-r--r-- | view/theme/redbasic/schema/dark.css | 17 | ||||
-rw-r--r-- | view/tpl/messages_widget.tpl | 8 |
17 files changed, 117 insertions, 70 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']) ? ' ' : '')); - $entries[$i]['unseen_class'] = (($item['item_unseen']) ? 'bg-primary' : 'bg-secondary'); + $entries[$i]['unseen_count'] = (($item['unseen_count']) ? $item['unseen_count'] : (($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.8'); +define('STD_VERSION', '7.9.9'); define('ZOT_REVISION', '6.0'); define('DB_UPDATE_VERSION', 1253); diff --git a/include/api_auth.php b/include/api_auth.php index 0395dae7a..be886fbb2 100644 --- a/include/api_auth.php +++ b/include/api_auth.php @@ -102,13 +102,13 @@ function api_login(&$a) { if ($sigblock) { $keyId = str_replace('acct:', '', $sigblock['keyId']); if ($keyId) { - $r = q("select * from hubloc where hubloc_addr = '%s' or hubloc_id_url = '%s'", + $r = q("select * from hubloc where hubloc_addr = '%s' or hubloc_id_url = '%s' order by hubloc_id desc", dbesc($keyId), dbesc($keyId) ); if (!$r) { HTTPSig::get_zotfinger_key($keyId); - $r = q("select * from hubloc where hubloc_addr = '%s' or hubloc_id_url = '%s'", + $r = q("select * from hubloc where hubloc_addr = '%s' or hubloc_id_url = '%s' order by hubloc_id desc", dbesc($keyId), dbesc($keyId) ); diff --git a/include/event.php b/include/event.php index 7c81d6934..b27504296 100644 --- a/include/event.php +++ b/include/event.php @@ -502,7 +502,6 @@ function ev_compare($a, $b) { function event_store_event($arr) { - $arr['created'] = $arr['created'] ?? datetime_convert(); $arr['edited'] = $arr['edited'] ?? datetime_convert(); $arr['etype'] = $arr['etype'] ?? 'event'; @@ -533,7 +532,7 @@ function event_store_event($arr) { $existing_event = null; - if(isset($arr['event_hash'])) { + if(isset($arr['event_hash']) && $arr['event_hash']) { $r = q("SELECT * FROM event WHERE event_hash = '%s' AND uid = %d LIMIT 1", dbesc($arr['event_hash']), intval($arr['uid']) @@ -543,7 +542,7 @@ function event_store_event($arr) { } } - if(isset($arr['id'])) { + if(isset($arr['id']) && $arr['id']) { $r = q("SELECT * FROM event WHERE id = %d AND uid = %d LIMIT 1", intval($arr['id']), intval($arr['uid']) @@ -647,7 +646,6 @@ function event_store_event($arr) { $hash = random_string(48); } } - $r = q("INSERT INTO event ( uid,aid,event_xchan,event_hash,created,edited,dtstart,dtend,summary,description,location,etype, adjust,nofinish, event_status, event_status_date, event_percent, event_repeat, event_sequence, event_priority, event_vdata, allow_cid,allow_gid,deny_cid,deny_gid) VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, '%s', %d, %d, '%s', '%s', '%s', '%s', '%s' ) ", diff --git a/include/feedutils.php b/include/feedutils.php index eea908fe8..43b95b966 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -2007,9 +2007,9 @@ function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0, $ if($enclosures) { foreach($enclosures as $enc) { $o .= '<link rel="enclosure" ' - . (($enc['href']) ? 'href="' . $enc['href'] . '" ' : '') - . (($enc['length']) ? 'length="' . $enc['length'] . '" ' : '') - . (($enc['type']) ? 'type="' . $enc['type'] . '" ' : '') + . ((isset($enc['href']) && $enc['href']) ? 'href="' . $enc['href'] . '" ' : '') + . ((isset($enc['length']) && $enc['length']) ? 'length="' . $enc['length'] . '" ' : '') + . ((isset($enc['type']) && $enc['type']) ? 'type="' . $enc['type'] . '" ' : '') . ' />' . "\r\n"; } } diff --git a/include/items.php b/include/items.php index 0f477e761..752251a7e 100644 --- a/include/items.php +++ b/include/items.php @@ -1848,21 +1848,11 @@ function item_store($arr, $allow_exec = false, $deliver = true) { if($parent_deleted) $arr['item_deleted'] = 1; - if($arr['uuid']) { - $r = q("SELECT id FROM item WHERE uuid = '%s' AND uid = %d and revision = %d LIMIT 1", - dbesc($arr['uuid']), - intval($arr['uid']), - intval($arr['revision']) - ); - } - else { - $r = q("SELECT id FROM item WHERE (mid = '%s' OR mid = '%s') AND uid = %d and revision = %d LIMIT 1", - dbesc($arr['mid']), - dbesc(basename(rawurldecode($arr['mid']))), // de-duplicate relayed comments from hubzilla < 4.0 - intval($arr['uid']), - intval($arr['revision']) - ); - } + $r = q("SELECT id FROM item WHERE uuid = '%s' AND uid = %d and revision = %d LIMIT 1", + dbesc($arr['uuid']), + intval($arr['uid']), + intval($arr['revision']) + ); if($r) { logger('duplicate item ignored. ' . print_r($arr,true)); diff --git a/include/nav.php b/include/nav.php index 29d99aaee..2cdf7d42b 100644 --- a/include/nav.php +++ b/include/nav.php @@ -17,6 +17,7 @@ function nav($template = 'default') { App::$page['nav'] = App::$page['nav'] ?? ''; App::$page['htmlhead'] = App::$page['htmlhead'] ?? ''; App::$page['htmlhead'] .= '<script>$(document).ready(function() { $("#nav-search-text").search_autocomplete(\'' . z_root() . '/acl' . '\');});</script>'; + $is_owner = (((local_channel()) && ((App::$profile_uid == local_channel()) || (App::$profile_uid == 0))) ? true : false); $observer = App::get_observer(); $chans = []; @@ -166,7 +167,8 @@ function nav($template = 'default') { $nav['register'] = ['register', t('Register'), "", t('Create an account'), 'register_nav_btn']; } - if (!get_config('system', 'hide_help')) { + // TODO: update help content for various modules + if (false /* !get_config('system', 'hide_help') */) { $help_url = z_root() . '/help?f=&cmd=' . App::$cmd; $context_help = ''; $enable_context_help = ((intval(get_config('system', 'enable_context_help')) === 1 || get_config('system', 'enable_context_help') === false) ? true : false); diff --git a/view/pdl/mod_invite.pdl b/view/pdl/mod_invite.pdl new file mode 100644 index 000000000..47af1ed38 --- /dev/null +++ b/view/pdl/mod_invite.pdl @@ -0,0 +1,10 @@ +[region=aside] +[widget=profile][/widget] +[/region] +[region=content] +$content +[/region] +[region=right_aside] +[widget=notifications][/widget] +[widget=newmember][/widget] +[/region] diff --git a/view/theme/redbasic/schema/bootstrap-nightfall.css b/view/theme/redbasic/schema/bootstrap-nightfall.css index d9cb8cc63..c574ed29b 100644 --- a/view/theme/redbasic/schema/bootstrap-nightfall.css +++ b/view/theme/redbasic/schema/bootstrap-nightfall.css @@ -1895,4 +1895,4 @@ body::selection { background: rgba(23, 162, 184, 0.5); } -/*# sourceMappingURL=bootstrap-nightfall.css.map */
\ No newline at end of file +/*# sourceMappingURL=bootstrap-nightfall.css.map */ diff --git a/view/theme/redbasic/schema/dark.css b/view/theme/redbasic/schema/dark.css index 3a93a5c17..bc1a84ec8 100644 --- a/view/theme/redbasic/schema/dark.css +++ b/view/theme/redbasic/schema/dark.css @@ -32,3 +32,20 @@ a, .fakelink { color: var(--bs-link-color); } +.item-category { + background-color: #293a4f !important; +} +#cboxContent { + background-color: #273039; +} +#jot-title-wrap, +#jot-summary-wrap, +#jot-pagetitle-wrap, +#jot-category-wrap, +#jot-customjotheaders-wrap { + border-bottom: 1px solid var(--bs-border-color); +} +#adminpage table tr:hover { + background-color: #2E3136; +} + diff --git a/view/tpl/messages_widget.tpl b/view/tpl/messages_widget.tpl index ed3bc0aaf..ee933b392 100644 --- a/view/tpl/messages_widget.tpl +++ b/view/tpl/messages_widget.tpl @@ -22,7 +22,7 @@ </a> </li> </ul> -<div id="messages-widget" class="border border-top-0 overflow-auto mb-3 clearfix" style="height: 70vh;"> +<div id="messages-widget" class="border-start border-end border-bottom overflow-auto mb-3 clearfix" style="height: 70vh;"> <div id="messages-template" rel="template" class="d-none"> <a href="{6}" class="list-group-item list-group-item-action message" data-b64mid="{0}"> <div class="d-flex w-100 justify-content-between"> @@ -53,8 +53,8 @@ <div class="text-break">{{$e.summary}}</div> </div> <small>{{$e.info}}</small> - {{if $e.unseen}} - <span class="badge {{$e.unseen_class}} rounded-pill position-absolute bottom-0 end-0 m-2" title="{{$strings.unseen}}">{{$e.unseen}}</span> + {{if $e.unseen_count}} + <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_count}}">{{$e.unseen_count}}</span> {{/if}} </a> {{/foreach}} @@ -129,7 +129,7 @@ e.author_addr, e.href, e.icon, - e.unseen ? '<span class="badge ' + e.unseen_class + ' rounded-pill position-absolute bottom-0 end-0 m-2" title="{{$strings.unseen}}">' + e.unseen + '</span>' : '' + e.unseen_count ? '<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_count}}">' + e.unseen_count + '</span>' : '' ); $('#messages-loading').before(html); }); |