diff options
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Acl.php | 1 | ||||
-rw-r--r-- | Zotlabs/Module/Hq.php | 1 | ||||
-rw-r--r-- | Zotlabs/Widget/Messages.php | 22 |
4 files changed, 23 insertions, 5 deletions
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index e4be56157..c2787e03c 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -1974,7 +1974,7 @@ class Libzot { $ret = []; - $signer = q("select hubloc_hash, hubloc_url from hubloc where hubloc_id_url = '%s' and hubloc_network = 'zot6' limit 1", + $signer = q("select hubloc_hash, hubloc_url from hubloc where hubloc_id_url = '%s' and hubloc_network = 'zot6' order by hubloc_id desc limit 1", dbesc($a['signature']['signer']) ); @@ -2002,7 +2002,7 @@ class Libzot { continue; } - $r = q("select hubloc_hash, hubloc_network from hubloc where hubloc_id_url = '%s'", + $r = q("select hubloc_hash, hubloc_network from hubloc where hubloc_id_url = '%s' order by hubloc_id desc", dbesc($AS->actor['id']) ); diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php index bcd79c873..b98f5621e 100644 --- a/Zotlabs/Module/Acl.php +++ b/Zotlabs/Module/Acl.php @@ -378,6 +378,7 @@ class Acl extends \Zotlabs\Web\Controller { "name" => $g['name'], "id" => urlencode($g['id']), "xid" => $g['hash'], + "url" => $g['url'], "link" => $clink, "nick" => ((strpos($g['nick'],'@')) ? substr($g['nick'],0,strpos($g['nick'],'@')) : $g['nick']), "self" => (intval($g['abook_self']) ? 'abook-self' : ''), diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index 0b2d0ea7d..df30f933d 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -245,6 +245,7 @@ class Hq extends \Zotlabs\Web\Controller { $options['offset'] = $_REQUEST['offset'] ?? 0; $options['type'] = $_REQUEST['type'] ?? ''; + $options['author'] = $_REQUEST['author'] ? urldecode($_REQUEST['author']) : ''; $ret = Messages::get_messages_page($options); diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index edd15c2a5..418e49169 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -35,7 +35,8 @@ class Messages { 'notice_messages_title' => t('Notices'), 'loading' => t('Loading'), 'empty' => t('No messages'), - 'unseen_count' => t('Unseen') + 'unseen_count' => t('Unseen'), + 'filter' => t('Filter by name or address') ] ]); @@ -47,7 +48,8 @@ class Messages { return; $offset = $options['offset'] ?? 0; - $type = $options['type'] ?? 'default'; + $type = $options['type'] ?? ''; + $author = $options['author'] ?? ''; if ($offset == -1) { return; @@ -63,6 +65,7 @@ class Messages { $entries = []; $limit = 30; $dummy_order_sql = ''; + $author_sql = ''; $loadtime = (($offset) ? $_SESSION['messages_loadtime'] : datetime_convert()); $vnotify = get_pconfig(local_channel(), 'system', 'vnotify', -1); @@ -78,6 +81,10 @@ class Messages { $vnotify_sql_i = " AND i.verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') "; } + if($author) { + $author_sql = " AND i.author_xchan = '" . protect_sprintf(dbesc($author)) . "' "; + } + switch($type) { case 'direct': $type_sql = ' AND i.item_private = 2 '; @@ -101,6 +108,7 @@ class Messages { AND i.created <= '%s' $type_sql AND i.item_thread_top = 1 + $author_sql $item_normal_i ORDER BY i.created DESC $dummy_order_sql LIMIT $limit OFFSET $offset", @@ -241,6 +249,7 @@ class Messages { if (!local_channel()) return; + $limit = 30; $offset = 0; @@ -248,7 +257,14 @@ class Messages { $offset = intval($options['offset']); } - $notices = q("SELECT * FROM notify WHERE uid = %d + $author_url = $options['author'] ?? ''; + $author_sql = ''; + + if($author_url) { + $author_sql = " AND url = '" . protect_sprintf(dbesc($author_url)) . "' "; + } + + $notices = q("SELECT * FROM notify WHERE uid = %d $author_sql ORDER BY created DESC LIMIT $limit OFFSET $offset", intval(local_channel()) ); |