diff options
author | Mario <mario@mariovavti.com> | 2023-01-13 20:01:05 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-01-13 20:01:05 +0000 |
commit | 2805520d1bcb2640fc079d54f5f230f7b87d1f84 (patch) | |
tree | 43b3e5bb7c71522d04560015478765a7b763a5fe /Zotlabs/Widget | |
parent | f6d940606350eb8685c278af6d87f3a0b8c0f5e5 (diff) | |
parent | fb7ca18820e7618325dded78a3c3a464dd01b391 (diff) | |
download | volse-hubzilla-8.0.tar.gz volse-hubzilla-8.0.tar.bz2 volse-hubzilla-8.0.zip |
Merge remote-tracking branch 'origin/8.0RC'8.0
Diffstat (limited to 'Zotlabs/Widget')
-rw-r--r-- | Zotlabs/Widget/Admin.php | 1 | ||||
-rw-r--r-- | Zotlabs/Widget/Categories.php | 13 | ||||
-rw-r--r-- | Zotlabs/Widget/Channel_activities.php | 4 | ||||
-rw-r--r-- | Zotlabs/Widget/Messages.php | 46 | ||||
-rw-r--r-- | Zotlabs/Widget/Pubtagcloud.php | 17 |
5 files changed, 50 insertions, 31 deletions
diff --git a/Zotlabs/Widget/Admin.php b/Zotlabs/Widget/Admin.php index 0a7a6925f..aa88de36a 100644 --- a/Zotlabs/Widget/Admin.php +++ b/Zotlabs/Widget/Admin.php @@ -32,6 +32,7 @@ class Admin { 'addons' => array(z_root() . '/admin/addons/', t('Addons'), 'addons'), 'themes' => array(z_root() . '/admin/themes/', t('Themes'), 'themes'), 'queue' => array(z_root() . '/admin/queue', t('Inspect queue'), 'queue'), + 'queueworker' => array(z_root() . '/admin/queueworker', t('Queueworker'), 'queueworker'), 'profs' => array(z_root() . '/admin/profs', t('Profile Fields'), 'profs'), 'dbsync' => array(z_root() . '/admin/dbsync/', t('DB updates'), 'dbsync') ]; diff --git a/Zotlabs/Widget/Categories.php b/Zotlabs/Widget/Categories.php index b31856e48..7e6a3c6f7 100644 --- a/Zotlabs/Widget/Categories.php +++ b/Zotlabs/Widget/Categories.php @@ -3,7 +3,7 @@ /** * * Name: Categories * * Description: Display a menu with links to categories - * * Requires: channel, articles, cards, cloud + * * Requires: channel, cloud */ namespace Zotlabs\Widget; @@ -24,15 +24,16 @@ class Categories { } $cat = ((x($_REQUEST, 'cat')) ? htmlspecialchars($_REQUEST['cat'], ENT_COMPAT, 'UTF-8') : ''); - $srchurl = App::$query_string; - $srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is', '', $srchurl), '&'); - $srchurl = str_replace(['?f=','&f=', '/?'], ['', '', ''], $srchurl); + + // Discard queries from the current URL, as the template expects a base + // URL without any queries. + $base = substr(App::$query_string, 0, strcspn(App::$query_string, '?')); if($files) { - return filecategories_widget($srchurl, $cat); + return filecategories_widget($base, $cat); } - return categories_widget($srchurl, $cat); + return categories_widget($base, $cat); } } diff --git a/Zotlabs/Widget/Channel_activities.php b/Zotlabs/Widget/Channel_activities.php index 9acde591d..06080f8c8 100644 --- a/Zotlabs/Widget/Channel_activities.php +++ b/Zotlabs/Widget/Channel_activities.php @@ -26,7 +26,7 @@ class Channel_activities { self::$channel = App::get_channel(); $o = '<div id="channel-activities" class="d-none overflow-hidden">'; - $o .= '<h2 class="mb-4">Welcome ' . self::$channel['channel_name'] . '!</h2>'; + $o .= '<h2 class="mb-4">' . t('Welcome') . ' ' . self::$channel['channel_name'] . '!</h2>'; //$o .= 'Last login date: ' . get_pconfig(self::$uid, 'system', 'stored_login_date') . ' from ' . get_pconfig(self::$uid, 'system', 'stored_login_addr'); self::get_photos_activity(); @@ -43,7 +43,7 @@ class Channel_activities { call_hooks('channel_activities_widget', $hookdata); if (!$hookdata['activities']) { - $o .= '<h3>No recent activity to display</h3>'; + $o .= '<h3>' . t('No recent activities') . '</h3>'; $o .= '</div>'; return $o; } diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index 38c822502..8c413e16e 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_count' => t('Unseen') ] ]); @@ -57,34 +58,53 @@ class Messages { } $channel = App::get_channel(); - $item_normal = item_normal(); + $item_normal_i = str_replace('item.', 'i.', item_normal()); + $item_normal_c = str_replace('item.', 'c.', item_normal()); $entries = []; $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_c = " AND c.verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + $vnotify_sql_i = " AND i.verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + } + elseif (!feature_enabled(local_channel(), 'dislike')) { + $vnotify_sql_c = " AND c.verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') "; + $vnotify_sql_i = " AND i.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' + // FEP-5624 filter approvals for comments + $approvals_c = " AND c.verb NOT IN ('" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject') "; + + $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 $item_normal_c $approvals_c $vnotify_sql_c) AS unseen_count + FROM item i WHERE i.uid = %d + AND i.created <= '%s' $type_sql - AND item_thread_top = 1 - $item_normal - ORDER BY created DESC $dummy_order_sql + AND i.item_thread_top = 1 + $item_normal_i + ORDER BY i.created DESC $dummy_order_sql LIMIT $limit OFFSET $offset", intval(local_channel()), + intval(local_channel()), dbescdate($loadtime) ); @@ -148,13 +168,15 @@ class Messages { } $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_count'] = (($item['unseen_count']) ? $item['unseen_count'] : (($item['item_unseen']) ? ' ' : '')); + $entries[$i]['unseen_class'] = (($item['item_unseen']) ? 'primary' : 'secondary'); $i++; } diff --git a/Zotlabs/Widget/Pubtagcloud.php b/Zotlabs/Widget/Pubtagcloud.php index db7ea02e7..90bf5eb97 100644 --- a/Zotlabs/Widget/Pubtagcloud.php +++ b/Zotlabs/Widget/Pubtagcloud.php @@ -22,24 +22,19 @@ class Pubtagcloud { } } - $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false); - $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true); + $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true); - if(! ($site_firehose || $net_firehose)) { - return EMPTY_STR; - } + if(!$net_firehose) { + return ''; + } - if($net_firehose) { - $site_firehose = false; - } + $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false); $safemode = get_xconfig(get_observer_hash(),'directory','safemode',1); - - $limit = ((array_key_exists('limit', $arr)) ? intval($arr['limit']) : 75); - return pubtagblock($net_firehose,$site_firehose, $limit, $trending, $safemode); + return pubtagblock($net_firehose, $site_firehose, $limit, $trending, $safemode); return ''; } |