From 37558e24f8ca8eb4b74037e5ce245d3343fb5a52 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 27 May 2021 09:30:57 +0000 Subject: remove dir_fns includes --- Zotlabs/Widget/Dirtags.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Dirtags.php b/Zotlabs/Widget/Dirtags.php index f211d5942..246c47dde 100644 --- a/Zotlabs/Widget/Dirtags.php +++ b/Zotlabs/Widget/Dirtags.php @@ -2,8 +2,6 @@ namespace Zotlabs\Widget; -require_once('include/dir_fns.php'); - class Dirtags { function widget($arr) { -- cgit v1.2.3 From 3ab8632d3bd82306b8b82f652da329af4fdd4333 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 27 May 2021 19:20:07 +0000 Subject: update mail widgets to not require include message and minor fixes --- Zotlabs/Widget/Conversations.php | 175 +++++++++++++++++++++++++++++---------- Zotlabs/Widget/Mailmenu.php | 4 +- 2 files changed, 134 insertions(+), 45 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Conversations.php b/Zotlabs/Widget/Conversations.php index 267d50fa0..3dc260b50 100644 --- a/Zotlabs/Widget/Conversations.php +++ b/Zotlabs/Widget/Conversations.php @@ -9,67 +9,154 @@ class Conversations { if (! local_channel()) return; - if(argc() > 1) { + switch(argv(1)) { + case 'inbox': + $mailbox = 'inbox'; + $header = t('Received Messages'); + break; + case 'outbox': + $mailbox = 'outbox'; + $header = t('Sent Messages'); + break; + default: + $mailbox = 'combined'; + $header = t('Conversations'); + break; + } + + $o = ''; + + // private_messages_list() can do other more complicated stuff, for now keep it simple + $r = self::private_messages_list(local_channel(), $mailbox, \App::$pager['start'], \App::$pager['itemspage']); + + if(! $r) { + info( t('No messages.') . EOL); + return $o; + } + + $messages = []; + + foreach($r as $rr) { + + $selected = ((argc() == 3) ? intval(argv(2)) == intval($rr['id']) : $r[0]['id'] == $rr['id']); + + $messages[] = [ + 'mailbox' => $mailbox, + 'id' => $rr['id'], + 'from_name' => $rr['from']['xchan_name'], + 'from_url' => chanlink_hash($rr['from_xchan']), + 'from_photo' => $rr['from']['xchan_photo_s'], + 'to_name' => $rr['to']['xchan_name'], + 'to_url' => chanlink_hash($rr['to_xchan']), + 'to_photo' => $rr['to']['xchan_photo_s'], + 'subject' => (($rr['seen']) ? $rr['title'] : '' . $rr['title'] . ''), + 'delete' => t('Delete conversation'), + 'body' => $rr['body'], + 'date' => datetime_convert('UTC',date_default_timezone_get(),$rr['created'], 'c'), + 'seen' => $rr['seen'], + 'selected' => ((argv(1) != 'new') ? $selected : '') + ]; + } + + $tpl = get_markup_template('mail_head.tpl'); + $o .= replace_macros($tpl, [ + '$header' => $header, + '$messages' => $messages + ]); + + return $o; + } + + function private_messages_list($uid, $mailbox = '', $start = 0, $numitems = 0) { + + $where = ''; + $limit = ''; + + $t0 = dba_timer(); + + if($numitems) + $limit = " LIMIT " . intval($numitems) . " OFFSET " . intval($start); + + if($mailbox !== '') { + $x = q("select channel_hash from channel where channel_id = %d limit 1", + intval($uid) + ); + + if(! $x) + return array(); + + $channel_hash = dbesc($x[0]['channel_hash']); + $local_channel = intval(local_channel()); + + switch($mailbox) { - switch(argv(1)) { case 'inbox': - $mailbox = 'inbox'; - $header = t('Received Messages'); + $sql = "SELECT * FROM mail WHERE channel_id = $local_channel AND from_xchan != '$channel_hash' ORDER BY created DESC $limit"; break; + case 'outbox': - $mailbox = 'outbox'; - $header = t('Sent Messages'); + $sql = "SELECT * FROM mail WHERE channel_id = $local_channel AND from_xchan = '$channel_hash' ORDER BY created DESC $limit"; break; + + case 'combined': default: - $mailbox = 'combined'; - $header = t('Conversations'); + $parents = q("SELECT mail.parent_mid FROM mail LEFT JOIN conv ON mail.conv_guid = conv.guid WHERE mail.mid = mail.parent_mid AND mail.channel_id = %d ORDER BY conv.updated DESC $limit", + intval($local_channel) + ); break; } - require_once('include/message.php'); + } - $o = ''; + $r = null; - // private_messages_list() can do other more complicated stuff, for now keep it simple - $r = private_messages_list(local_channel(), $mailbox, \App::$pager['start'], \App::$pager['itemspage']); + if($parents) { + foreach($parents as $parent) { + $all = q("SELECT * FROM mail WHERE parent_mid = '%s' AND channel_id = %d ORDER BY created DESC limit 1", + dbesc($parent['parent_mid']), + intval($local_channel) + ); - if(! $r) { - info( t('No messages.') . EOL); - return $o; + if($all) { + foreach($all as $single) { + $r[] = $single; + } + } } + } + elseif($sql) { + $r = q($sql); + } - $messages = []; - - foreach($r as $rr) { - - $selected = ((argc() == 3) ? intval(argv(2)) == intval($rr['id']) : $r[0]['id'] == $rr['id']); - - $messages[] = [ - 'mailbox' => $mailbox, - 'id' => $rr['id'], - 'from_name' => $rr['from']['xchan_name'], - 'from_url' => chanlink_hash($rr['from_xchan']), - 'from_photo' => $rr['from']['xchan_photo_s'], - 'to_name' => $rr['to']['xchan_name'], - 'to_url' => chanlink_hash($rr['to_xchan']), - 'to_photo' => $rr['to']['xchan_photo_s'], - 'subject' => (($rr['seen']) ? $rr['title'] : '' . $rr['title'] . ''), - 'delete' => t('Delete conversation'), - 'body' => $rr['body'], - 'date' => datetime_convert('UTC',date_default_timezone_get(),$rr['created'], 'c'), - 'seen' => $rr['seen'], - 'selected' => ((argv(1) != 'new') ? $selected : '') - ]; - } + if(! $r) { + return array(); + } - $tpl = get_markup_template('mail_head.tpl'); - $o .= replace_macros($tpl, [ - '$header' => $header, - '$messages' => $messages - ]); + $chans = array(); + foreach($r as $rr) { + $s = "'" . dbesc(trim($rr['from_xchan'])) . "'"; + if(! in_array($s,$chans)) + $chans[] = $s; + $s = "'" . dbesc(trim($rr['to_xchan'])) . "'"; + if(! in_array($s,$chans)) + $chans[] = $s; + } + $c = q("select * from xchan where xchan_hash in (" . protect_sprintf(implode(',',$chans)) . ")"); + + foreach($r as $k => $rr) { + $r[$k]['from'] = find_xchan_in_array($rr['from_xchan'],$c); + $r[$k]['to'] = find_xchan_in_array($rr['to_xchan'],$c); + $r[$k]['seen'] = intval($rr['mail_seen']); + if(intval($r[$k]['mail_obscured'])) { + if($r[$k]['title']) + $r[$k]['title'] = base64url_decode(str_rot47($r[$k]['title'])); + if($r[$k]['body']) + $r[$k]['body'] = base64url_decode(str_rot47($r[$k]['body'])); + } } - return $o; + + return $r; } } diff --git a/Zotlabs/Widget/Mailmenu.php b/Zotlabs/Widget/Mailmenu.php index 512f7d9c0..ca022c807 100644 --- a/Zotlabs/Widget/Mailmenu.php +++ b/Zotlabs/Widget/Mailmenu.php @@ -14,7 +14,7 @@ class Mailmenu { '$combined' => array( 'label' => t('Combined View'), 'url' => z_root() . '/mail/combined', - 'sel' => (argv(1) == 'combined'), + 'sel' => (argv(1) == 'combined' || argc() == 1), ), '$inbox' => array( 'label' => t('Inbox'), @@ -26,11 +26,13 @@ class Mailmenu { 'url' => z_root() . '/mail/outbox', 'sel' => (argv(1) == 'outbox'), ), +/* '$new' => array( 'label' => t('New Message'), 'url' => z_root() . '/mail/new', 'sel'=> (argv(1) == 'new'), ) +*/ )); } } -- cgit v1.2.3 From 0718ac514d2421a96ab191f874a0cd8b120a5a78 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 28 May 2021 08:11:40 +0000 Subject: remove deprecated mail code --- Zotlabs/Widget/Notifications.php | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php index dd5a6cd46..d59312148 100644 --- a/Zotlabs/Widget/Notifications.php +++ b/Zotlabs/Widget/Notifications.php @@ -67,21 +67,6 @@ class Notifications { ] ]; - $notifications[] = [ - 'type' => 'mail', - 'icon' => 'envelope', - 'severity' => 'danger', - 'label' => t('New Mails'), - 'title' => t('New Mails Notifications'), - 'viewall' => [ - 'url' => 'mail/combined', - 'label' => t('View your private mails') - ], - 'markall' => [ - 'label' => t('Mark all messages seen') - ] - ]; - $notifications[] = [ 'type' => 'all_events', 'icon' => 'calendar', @@ -187,4 +172,4 @@ class Notifications { } } - + -- cgit v1.2.3 From b55676d08914d58927b5503a1bfa283397cd6d44 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 17 Jun 2021 07:33:45 +0000 Subject: New landing page HQ with separate views for direct messages, public/limited messages and starred messages if the feature is enabled --- Zotlabs/Widget/Hq_controls.php | 33 +++++-- Zotlabs/Widget/Messages.php | 181 +++++++++++++++++++++++++++++++++++++++ Zotlabs/Widget/Notes.php | 6 +- Zotlabs/Widget/Notifications.php | 2 - 4 files changed, 207 insertions(+), 15 deletions(-) create mode 100644 Zotlabs/Widget/Messages.php (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Hq_controls.php b/Zotlabs/Widget/Hq_controls.php index 0caa54a1a..781e2a0bd 100644 --- a/Zotlabs/Widget/Hq_controls.php +++ b/Zotlabs/Widget/Hq_controls.php @@ -9,17 +9,32 @@ class Hq_controls { if (! local_channel()) return; + $entries = [ + 'toggle_editor' => [ + 'label' => t('Toggle post editor'), + 'id' => 'jot-toggle', + 'href' => '#', + 'class' => 'btn btn-outline-primary', + 'type' => 'button', + 'icon' => 'pencil', + 'extra' => 'data-toggle="button"' + ] + ]; + + + $entries['toggle_notes'] = [ + 'label' => t('Toggle personal notes'), + 'id' => 'notes-toggle', + 'href' => '#', + 'class' => 'btn btn-outline-primary', + 'type' => 'button', + 'icon' => 'sticky-note-o', + 'extra' => 'data-toggle="button"' + ]; + return replace_macros(get_markup_template('hq_controls.tpl'), [ - '$title' => t('HQ Control Panel'), - '$menu' => [ - 'create' => [ - 'label' => t('Create a new post'), - 'id' => 'jot-toggle', - 'href' => '#', - 'class' => '' - ] - ] + '$entries' => $entries ] ); } diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php new file mode 100644 index 000000000..6117bfa73 --- /dev/null +++ b/Zotlabs/Widget/Messages.php @@ -0,0 +1,181 @@ + $page['entries'], + '$offset' => $page['offset'], + '$feature_star' => feature_enabled(local_channel(), 'star_posts'), + '$strings' => [ + 'messages_title' => t('Public and restricted messages'), + 'direct_messages_title' => t('Direct messages'), + 'starred_messages_title' => t('Starred messages'), + 'loading' => t('Loading') + ] + ]); + + return $o; + } + + public static function get_messages_page($options) { + if (!local_channel()) + return; + + if ($options['offset'] == -1) { + return; + } + + $channel = App::get_channel(); + $item_normal = item_normal(); + $entries = []; + $limit = 30; + + $offset = 0; + if ($options['offset']) { + $offset = intval($options['offset']); + } + + $loadtime = (($offset) ? $_SESSION['page_loadtime'] : datetime_convert()); + + switch($options['type']) { + case 'direct': + $type_sql = ' AND item_private = 2 '; + break; + case 'starred': + $type_sql = ' AND item_starred = 1 '; + break; + default: + $type_sql = ' AND item_private IN (0, 1) '; + } + + $items = q("SELECT * FROM item WHERE uid = %d + AND created <= '%s' + $type_sql + AND item_thread_top = 1 + $item_normal + ORDER BY created DESC + LIMIT $limit OFFSET $offset", + intval(local_channel()), + dbescdate($loadtime) + ); + + xchan_query($items, false); + + $i = 0; + + foreach($items as $item) { + + $info = ''; + if ($options['type'] == 'direct') { + $info .= self::get_dm_recipients($channel, $item); + } + + if($item['owner_xchan'] !== $item['author_xchan']) { + $info .= t('via') . ' ' . $item['owner']['xchan_name']; + } + + $summary = $item['title']; + if (!$summary) { + $summary = $item['summary']; + } + if (!$summary) { + $summary = htmlentities(html2plain(bbcode($item['body']), 75, true), ENT_QUOTES, 'UTF-8', false); + } + if (!$summary) { + $summary = t('Sorry, there is no text preview available for this post'); + } + $summary = substr_words($summary, 68); + + switch(intval($item['item_private'])) { + case 1: + $icon = ''; + break; + case 2: + $icon = ''; + break; + default: + $icon = ''; + } + + $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; + $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; + + $i++; + } + + $result = [ + 'offset' => ((count($entries) < $limit) ? -1 : intval($offset + $limit)), + 'entries' => $entries + ]; + + return $result; + } + + public static function get_dm_recipients($channel, $item) { + + if($channel['channel_hash'] === $item['owner']['xchan_hash']) { + // we are the owner, get the recipients from the item + $recips = expand_acl($item['allow_cid']); + if (is_array($recips)) { + array_unshift($recips, $item['owner']['xchan_hash']); + $column = 'xchan_hash'; + } + } + else { + $recips = IConfig::Get($item, 'activitypub', 'recips'); + if (isset($recips['to']) && is_array($recips['to'])) { + $recips = $recips['to']; + array_unshift($recips, $item['owner']['xchan_url']); + $column = 'xchan_url'; + } + else { + $hookinfo = [ + 'item' => $item, + 'recips' => null, + 'column' => '' + ]; + + call_hooks('direct_message_recipients', $hookinfo); + + $recips = $hookinfo['recips']; + $column = $hookinfo['column']; + } + } + + if(is_array($recips)) { + stringify_array_elms($recips, true); + + $query_str = implode(',', $recips); + $xchans = dbq("SELECT DISTINCT xchan_name FROM xchan WHERE $column IN ($query_str)"); + + foreach($xchans as $xchan) { + $recipients .= $xchan['xchan_name'] . ', '; + } + } + + return trim($recipients, ', '); + } + +} diff --git a/Zotlabs/Widget/Notes.php b/Zotlabs/Widget/Notes.php index 238008d81..b2c8eda86 100644 --- a/Zotlabs/Widget/Notes.php +++ b/Zotlabs/Widget/Notes.php @@ -10,9 +10,6 @@ class Notes { if(! local_channel()) return EMPTY_STR; - if(! Apps::system_app_installed(local_channel(), 'Notes')) - return EMPTY_STR; - $text = get_pconfig(local_channel(),'notes','text'); $tpl = get_markup_template('notes.tpl'); @@ -21,7 +18,8 @@ class Notes { '$banner' => t('Notes'), '$text' => $text, '$save' => t('Save'), - '$app' => ((isset($arr['app'])) ? true : false) + '$app' => ((isset($arr['app'])) ? true : false), + '$hidden' => ((isset($arr['hidden'])) ? true : false) )); return $o; diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php index d59312148..56b1f9caa 100644 --- a/Zotlabs/Widget/Notifications.php +++ b/Zotlabs/Widget/Notifications.php @@ -161,11 +161,9 @@ class Notifications { } $o = replace_macros(get_markup_template('notifications_widget.tpl'), [ - '$module' => \App::$module, '$notifications' => $notifications, '$no_notifications' => t('Sorry, you have got no notifications at the moment'), '$loading' => t('Loading'), - '$startpage' => ($channel ? $channel['channel_startpage'] : '') ]); return $o; -- cgit v1.2.3 From 34ca2cddd4d70e08c6351ef0f72ea5e2a6c9b056 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 17 Jun 2021 07:43:32 +0000 Subject: only show notes if the app is enabled --- Zotlabs/Widget/Hq_controls.php | 24 ++++++++++++++---------- Zotlabs/Widget/Notes.php | 3 +++ 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Hq_controls.php b/Zotlabs/Widget/Hq_controls.php index 781e2a0bd..8c36b8d3a 100644 --- a/Zotlabs/Widget/Hq_controls.php +++ b/Zotlabs/Widget/Hq_controls.php @@ -2,6 +2,9 @@ namespace Zotlabs\Widget; +use Zotlabs\Lib\Apps; + + class Hq_controls { function widget($arr) { @@ -21,16 +24,17 @@ class Hq_controls { ] ]; - - $entries['toggle_notes'] = [ - 'label' => t('Toggle personal notes'), - 'id' => 'notes-toggle', - 'href' => '#', - 'class' => 'btn btn-outline-primary', - 'type' => 'button', - 'icon' => 'sticky-note-o', - 'extra' => 'data-toggle="button"' - ]; + if(Apps::system_app_installed(local_channel(), 'Notes')) { + $entries['toggle_notes'] = [ + 'label' => t('Toggle personal notes'), + 'id' => 'notes-toggle', + 'href' => '#', + 'class' => 'btn btn-outline-primary', + 'type' => 'button', + 'icon' => 'sticky-note-o', + 'extra' => 'data-toggle="button"' + ]; + } return replace_macros(get_markup_template('hq_controls.tpl'), [ diff --git a/Zotlabs/Widget/Notes.php b/Zotlabs/Widget/Notes.php index b2c8eda86..05c1a0292 100644 --- a/Zotlabs/Widget/Notes.php +++ b/Zotlabs/Widget/Notes.php @@ -10,6 +10,9 @@ class Notes { if(! local_channel()) return EMPTY_STR; + if(! Apps::system_app_installed(local_channel(), 'Notes')) + return EMPTY_STR; + $text = get_pconfig(local_channel(),'notes','text'); $tpl = get_markup_template('notes.tpl'); -- cgit v1.2.3 From 2f0bac8ddfc6286f69931a2164f99fea87d2146d Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 17 Jun 2021 08:06:26 +0000 Subject: consolidate notifications strings --- Zotlabs/Widget/Notifications.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php index 56b1f9caa..a818ae40a 100644 --- a/Zotlabs/Widget/Notifications.php +++ b/Zotlabs/Widget/Notifications.php @@ -13,11 +13,11 @@ class Notifications { 'type' => 'network', 'icon' => 'th', 'severity' => 'secondary', - 'label' => t('New Network Activity'), - 'title' => t('New Network Activity Notifications'), + 'label' => t('Network'), + 'title' => t('New network activity notifications'), 'viewall' => [ 'url' => 'network', - 'label' => t('View your network activity') + 'label' => t('Network stream') ], 'markall' => [ 'label' => t('Mark all notifications read') @@ -33,11 +33,11 @@ class Notifications { 'type' => 'home', 'icon' => 'home', 'severity' => 'danger', - 'label' => t('New Home Activity'), - 'title' => t('New Home Activity Notifications'), + 'label' => t('Home'), + 'title' => t('New home activity notifications'), 'viewall' => [ 'url' => 'channel/' . $channel['channel_address'], - 'label' => t('View your home activity') + 'label' => t('Home stream') ], 'markall' => [ 'label' => t('Mark all notifications seen') @@ -52,11 +52,11 @@ class Notifications { 'type' => 'dm', 'icon' => 'envelope', 'severity' => 'danger', - 'label' => t('New Direct Messages'), - 'title' => t('New Direct Messages Notifications'), + 'label' => t('Direct Messages'), + 'title' => t('New direct messages notifications'), 'viewall' => [ 'url' => 'network/?dm=1', - 'label' => t('View your direct messages') + 'label' => t('Direct messages stream') ], 'markall' => [ 'label' => t('Mark all notifications read') @@ -71,8 +71,8 @@ class Notifications { 'type' => 'all_events', 'icon' => 'calendar', 'severity' => 'secondary', - 'label' => t('New Events'), - 'title' => t('New Events Notifications'), + 'label' => t('Events'), + 'title' => t('New events notifications'), 'viewall' => [ 'url' => 'cdav/calendar', 'label' => t('View events') @@ -87,7 +87,7 @@ class Notifications { 'icon' => 'users', 'severity' => 'danger', 'label' => t('New Connections'), - 'title' => t('New Connections Notifications'), + 'title' => t('New connections notifications'), 'viewall' => [ 'url' => 'connections', 'label' => t('View all connections') @@ -98,8 +98,8 @@ class Notifications { 'type' => 'files', 'icon' => 'folder', 'severity' => 'danger', - 'label' => t('New Files'), - 'title' => t('New Files Notifications'), + 'label' => t('Files'), + 'title' => t('New files notifications'), ]; $notifications[] = [ @@ -134,8 +134,8 @@ class Notifications { 'type' => 'register', 'icon' => 'user-o', 'severity' => 'danger', - 'label' => t('New Registrations'), - 'title' => t('New Registrations Notifications'), + 'label' => t('Registrations'), + 'title' => t('New registrations notifications'), ]; } @@ -145,10 +145,10 @@ class Notifications { 'icon' => 'globe', 'severity' => 'secondary', 'label' => t('Public Stream'), - 'title' => t('Public Stream Notifications'), + 'title' => t('New public stream notifications'), 'viewall' => [ 'url' => 'pubstream', - 'label' => t('View the public stream') + 'label' => t('Public stream') ], 'markall' => [ 'label' => t('Mark all notifications seen') -- cgit v1.2.3 From e79a27c654589ed2ab3b3f2c1a6b603e2e642ad9 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 17 Jun 2021 08:08:14 +0000 Subject: just use ... as preview if we could not wind anything useful --- Zotlabs/Widget/Messages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index 6117bfa73..a03238c9a 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -98,7 +98,7 @@ class Messages { $summary = htmlentities(html2plain(bbcode($item['body']), 75, true), ENT_QUOTES, 'UTF-8', false); } if (!$summary) { - $summary = t('Sorry, there is no text preview available for this post'); + $summary = '...'; } $summary = substr_words($summary, 68); -- cgit v1.2.3 From 5ca352a6c362ac1b452460ebbb07fbf56bb76417 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 17 Jun 2021 12:10:54 +0000 Subject: allow to add a wrapper class to the hq_controls widget --- Zotlabs/Widget/Hq_controls.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Hq_controls.php b/Zotlabs/Widget/Hq_controls.php index 8c36b8d3a..8b532defe 100644 --- a/Zotlabs/Widget/Hq_controls.php +++ b/Zotlabs/Widget/Hq_controls.php @@ -7,7 +7,7 @@ use Zotlabs\Lib\Apps; class Hq_controls { - function widget($arr) { + function widget($options) { if (! local_channel()) return; @@ -38,7 +38,8 @@ class Hq_controls { return replace_macros(get_markup_template('hq_controls.tpl'), [ - '$entries' => $entries + '$entries' => $entries, + '$wrapper_class' => $options['class'] ] ); } -- cgit v1.2.3 From f4f9ccc3b234eaadf29b3f5c8bec6e19de0aa761 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 18 Jun 2021 08:55:49 +0000 Subject: css fixes --- Zotlabs/Widget/Hq_controls.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Hq_controls.php b/Zotlabs/Widget/Hq_controls.php index 8b532defe..9504b8f9e 100644 --- a/Zotlabs/Widget/Hq_controls.php +++ b/Zotlabs/Widget/Hq_controls.php @@ -17,7 +17,7 @@ class Hq_controls { 'label' => t('Toggle post editor'), 'id' => 'jot-toggle', 'href' => '#', - 'class' => 'btn btn-outline-primary', + 'class' => 'btn', 'type' => 'button', 'icon' => 'pencil', 'extra' => 'data-toggle="button"' @@ -29,7 +29,7 @@ class Hq_controls { 'label' => t('Toggle personal notes'), 'id' => 'notes-toggle', 'href' => '#', - 'class' => 'btn btn-outline-primary', + 'class' => 'btn', 'type' => 'button', 'icon' => 'sticky-note-o', 'extra' => 'data-toggle="button"' @@ -39,7 +39,8 @@ class Hq_controls { return replace_macros(get_markup_template('hq_controls.tpl'), [ '$entries' => $entries, - '$wrapper_class' => $options['class'] + '$wrapper_class' => $options['wrapper_class'], + '$entry_class' => $options['entry_class'] ] ); } -- cgit v1.2.3 From c42d8a81c729ff8441195371106e96d398210067 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 18 Jun 2021 09:51:20 +0000 Subject: bbcode: add option to drop media content --- Zotlabs/Widget/Messages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index a03238c9a..95f3d4eb6 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -95,7 +95,7 @@ class Messages { $summary = $item['summary']; } if (!$summary) { - $summary = htmlentities(html2plain(bbcode($item['body']), 75, true), ENT_QUOTES, 'UTF-8', false); + $summary = htmlentities(html2plain(bbcode($item['body'], ['drop_media' => true]), 75, true), ENT_QUOTES, 'UTF-8', false); } if (!$summary) { $summary = '...'; -- cgit v1.2.3 From 97d9764f015990b1df01463c45090c4cbc2192fa Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 23 Jun 2021 22:14:01 +0200 Subject: if there are no messages display that there are no messages --- Zotlabs/Widget/Messages.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index 95f3d4eb6..9679631c6 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -11,14 +11,10 @@ class Messages { if (!local_channel()) return EMPTY_STR; - $o = ''; $page = self::get_messages_page($options); - if (!$page['entries']) - return $o; - $tpl = get_markup_template('messages_widget.tpl'); - $o .= replace_macros($tpl, [ + $o = replace_macros($tpl, [ '$entries' => $page['entries'], '$offset' => $page['offset'], '$feature_star' => feature_enabled(local_channel(), 'star_posts'), @@ -26,7 +22,8 @@ class Messages { 'messages_title' => t('Public and restricted messages'), 'direct_messages_title' => t('Direct messages'), 'starred_messages_title' => t('Starred messages'), - 'loading' => t('Loading') + 'loading' => t('Loading'), + 'empty' => t('No messages') ] ]); -- cgit v1.2.3 From 167db22e15c72c32cd67ce1a2b242dc4527e0b64 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 24 Jun 2021 19:31:19 +0000 Subject: slightly refactor for desktop notifications and fix minor issues --- Zotlabs/Widget/Hq_controls.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Hq_controls.php b/Zotlabs/Widget/Hq_controls.php index 9504b8f9e..91335fd76 100644 --- a/Zotlabs/Widget/Hq_controls.php +++ b/Zotlabs/Widget/Hq_controls.php @@ -15,9 +15,8 @@ class Hq_controls { $entries = [ 'toggle_editor' => [ 'label' => t('Toggle post editor'), - 'id' => 'jot-toggle', 'href' => '#', - 'class' => 'btn', + 'class' => 'btn jot-toggle', 'type' => 'button', 'icon' => 'pencil', 'extra' => 'data-toggle="button"' @@ -27,9 +26,8 @@ class Hq_controls { if(Apps::system_app_installed(local_channel(), 'Notes')) { $entries['toggle_notes'] = [ 'label' => t('Toggle personal notes'), - 'id' => 'notes-toggle', 'href' => '#', - 'class' => 'btn', + 'class' => 'btn notes-toggle', 'type' => 'button', 'icon' => 'sticky-note-o', 'extra' => 'data-toggle="button"' -- cgit v1.2.3 From bed81d785c50a1a056a409b8113eceb0c1d47bba Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 29 Jun 2021 09:22:38 +0000 Subject: an attempt to improve the query for direct messages on some systems with hopefully no bad side-effect for others --- Zotlabs/Widget/Messages.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index 9679631c6..ed666bfaa 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -42,6 +42,7 @@ class Messages { $item_normal = item_normal(); $entries = []; $limit = 30; + $dummy_sql = ''; $offset = 0; if ($options['offset']) { @@ -53,6 +54,9 @@ class Messages { switch($options['type']) { case 'direct': $type_sql = ' AND item_private = 2 '; + // $dummy_order_sql has no other meaning but trick + // some mysql backends into using the right index. + $dummy_order_sql = ', received DESC '; break; case 'starred': $type_sql = ' AND item_starred = 1 '; @@ -66,7 +70,7 @@ class Messages { $type_sql AND item_thread_top = 1 $item_normal - ORDER BY created DESC + ORDER BY created DESC $dummy_order_sql LIMIT $limit OFFSET $offset", intval(local_channel()), dbescdate($loadtime) -- cgit v1.2.3 From e8c6121b4e40e16b291b38158dd3a1639641c56a Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 29 Jun 2021 09:24:13 +0000 Subject: version --- Zotlabs/Widget/Messages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index ed666bfaa..9dda33d71 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -54,7 +54,7 @@ class Messages { switch($options['type']) { case 'direct': $type_sql = ' AND item_private = 2 '; - // $dummy_order_sql has no other meaning but trick + // $dummy_order_sql has no other meaning but to trick // some mysql backends into using the right index. $dummy_order_sql = ', received DESC '; break; -- cgit v1.2.3 From 6a4727e3eb8d00c5927644b43bd6ba69fcd3c247 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 29 Jun 2021 18:21:12 +0000 Subject: fix variable name --- Zotlabs/Widget/Messages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index 9dda33d71..269d669dc 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -42,7 +42,7 @@ class Messages { $item_normal = item_normal(); $entries = []; $limit = 30; - $dummy_sql = ''; + $dummy_order_sql = ''; $offset = 0; if ($options['offset']) { -- cgit v1.2.3 From 7b2f4b08145ec31f0150544891633db2f5061104 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 16 Jul 2021 12:56:57 +0200 Subject: fix a regression in regard to unified session page load times intoduced in 6.0 --- Zotlabs/Widget/Messages.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index 269d669dc..21375b08f 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -13,6 +13,8 @@ class Messages { $page = self::get_messages_page($options); + $_SESSION['messages_loadtime'] = datetime_convert(); + $tpl = get_markup_template('messages_widget.tpl'); $o = replace_macros($tpl, [ '$entries' => $page['entries'], @@ -49,7 +51,7 @@ class Messages { $offset = intval($options['offset']); } - $loadtime = (($offset) ? $_SESSION['page_loadtime'] : datetime_convert()); + $loadtime = (($offset) ? $_SESSION['messages_loadtime'] : datetime_convert()); switch($options['type']) { case 'direct': -- cgit v1.2.3 From cddc0217724f1a7661014d50e4c940e623a0c2dc Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 3 Aug 2021 07:12:35 +0000 Subject: Apps drag and drop feature --- Zotlabs/Widget/Activity.php | 10 +++++----- Zotlabs/Widget/Forums.php | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Activity.php b/Zotlabs/Widget/Activity.php index 04e9fc4b1..5d9795c7e 100644 --- a/Zotlabs/Widget/Activity.php +++ b/Zotlabs/Widget/Activity.php @@ -35,7 +35,7 @@ class Activity { } } foreach($contributors as $k => $v) { - $arr[] = [ 'author_xchan' => $k, 'total' => $v ]; + $arr[] = [ 'author_xchan' => $k, 'total' => $v ]; } usort($arr,'total_sort'); xchan_query($arr); @@ -43,19 +43,19 @@ class Activity { $x = [ 'entries' => $arr ]; call_hooks('activity_widget',$x); - $arr = $x['entries']; + $arr = $x['entries']; if($arr) { $o .= '
'; - $o .= '

' . t('Activity','widget') . '

'; } return $o; } -} +} diff --git a/Zotlabs/Widget/Forums.php b/Zotlabs/Widget/Forums.php index d3e2f2534..2af7347f1 100644 --- a/Zotlabs/Widget/Forums.php +++ b/Zotlabs/Widget/Forums.php @@ -34,7 +34,7 @@ class Forums { intval(local_channel()) ); - if($x2) { + if($x2) { $xf = ids_to_querystr($x2,'xchan',true); // private forums @@ -47,7 +47,7 @@ class Forums { } } - $sql_extra = (($xf) ? " and ( xchan_hash in (" . $xf . ") or xchan_pubforum = 1 ) " : " and xchan_pubforum = 1 "); + $sql_extra = (($xf) ? " and ( xchan_hash in (" . $xf . ") or xchan_pubforum = 1 ) " : " and xchan_pubforum = 1 "); @@ -64,7 +64,7 @@ class Forums { // There also should be a way to update this via ajax. for($x = 0; $x < count($r1); $x ++) { - $r = q("select sum(item_unseen) as unseen from item + $r = q("select sum(item_unseen) as unseen from item where uid = %d and owner_xchan = '%s' and item_unseen = 1 $perms_sql ", intval(local_channel()), dbesc($r1[$x]['xchan_hash']) @@ -109,12 +109,12 @@ class Forums { } } } - + if($unseen && (! intval($rr['unseen']))) continue; - $o .= ''; + $o .= ''; } $o .= ''; } -- cgit v1.2.3 From 2e7a915ee8d99970a32e02bf3ac5bb5834f7fa1a Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 25 Aug 2021 10:19:20 +0000 Subject: add appstore widget to appman --- Zotlabs/Widget/Appcategories.php | 2 +- Zotlabs/Widget/Appstore.php | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Appcategories.php b/Zotlabs/Widget/Appcategories.php index aebd144d0..e916f095f 100644 --- a/Zotlabs/Widget/Appcategories.php +++ b/Zotlabs/Widget/Appcategories.php @@ -40,7 +40,7 @@ class Appcategories { $terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : '')); return replace_macros(get_markup_template('categories_widget.tpl'),array( - '$title' => t('Categories'), + '$title' => t('App Categories'), '$desc' => '', '$sel_all' => (($selected == '') ? 'selected' : ''), '$all' => t('Everything'), diff --git a/Zotlabs/Widget/Appstore.php b/Zotlabs/Widget/Appstore.php index 6a00ac06a..da05c0b62 100644 --- a/Zotlabs/Widget/Appstore.php +++ b/Zotlabs/Widget/Appstore.php @@ -6,12 +6,11 @@ namespace Zotlabs\Widget; class Appstore { function widget($arr) { - $store = ((argc() > 1 && argv(1) === 'available') ? 1 : 0); - return replace_macros(get_markup_template('appstore.tpl'), [ + return replace_macros(get_markup_template('appstore.tpl'), [ '$title' => t('App Collections'), '$options' => [ - [ z_root() . '/apps', t('Installed apps'), 1 - $store ], - [ z_root() . '/apps/available', t('Available Apps'), $store ] + [z_root() . '/apps', t('Installed apps'), ((argc() == 1 && argv(0) === 'apps') ? 1 : 0)], + [z_root() . '/apps/available', t('Available Apps'), ((argc() > 1 && argv(1) === 'available') ? 1 : 0)] ] ]); } -- cgit v1.2.3 From 529824d010cf88c409d5ce894b72060caccae580 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 4 Sep 2021 08:18:41 +0000 Subject: more unpack_link_id() --- Zotlabs/Widget/Pinned.php | 58 +++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Pinned.php b/Zotlabs/Widget/Pinned.php index cad139a91..66d06bbd3 100644 --- a/Zotlabs/Widget/Pinned.php +++ b/Zotlabs/Widget/Pinned.php @@ -40,15 +40,15 @@ class Pinned { $observer = \App::get_observer(); foreach($items as $item) { - - $midb64 = 'b64.' . base64url_encode($item['mid']); - + + $midb64 = gen_link_id($item['mid']); + if(isset($observer['xchan_hash']) && in_array($observer['xchan_hash'], get_pconfig($item['uid'], 'pinned_hide', $midb64, []))) continue; - + $author = channelx_by_hash($item['author_xchan']); $owner = channelx_by_hash($item['owner_xchan']); - + $profile_avatar = $author['xchan_photo_m']; $profile_link = chanlink_hash($item['author_xchan']); $profile_name = $author['xchan_name']; @@ -71,7 +71,7 @@ class Pinned { $isevent = true; } } - + $consensus = (intval($item['item_consensus']) ? true : false); if($consensus) { $conv_responses['agree'] = [ 'title' => t('Agree','title') ]; @@ -87,7 +87,7 @@ class Pinned { $verified = (intval($item['item_verified']) ? t('Message signature validated') : ''); $forged = ((! intval($item['item_verified']) && $item['sig']) ? t('Message signature incorrect') : ''); - + $shareable = ((local_channel() && \App::$profile_uid == local_channel() && $item['item_private'] != 1) ? true : false); if ($shareable) { // This actually turns out not to be possible in some protocol stacks without opening up hundreds of new issues. @@ -102,9 +102,9 @@ class Pinned { $is_new = boolval(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0); $body = prepare_body($item,true); - + $str = [ - 'item_type' => intval($item['item_type']), + 'item_type' => intval($item['item_type']), 'body' => $body['html'], 'tags' => $body['tags'], 'categories' => $body['categories'], @@ -115,7 +115,7 @@ class Pinned { 'id' => $item['id'], 'mids' => json_encode([ $midb64 ]), 'isevent' => $isevent, - 'attend' => $attend, + 'attend' => $attend, 'consensus' => $consensus, 'conlabels' => ($canvote ? $conlabels : []), 'canvote' => $canvote, @@ -158,55 +158,55 @@ class Pinned { 'modal_dismiss' => t('Close'), 'responses' => $conv_responses ]; - - $tpl = get_markup_template('pinned_item.tpl'); + + $tpl = get_markup_template('pinned_item.tpl'); $ret['html'] .= replace_macros($tpl, $str); } return $ret; } - + /* * @brief List pinned items depend on type * * @param $types * @return array of pinned items * - */ + */ private function list($types) { if(empty($types) || (! is_array($types))) return []; - + $item_types = array_intersect($this->allowed_types, $types); if(empty($item_types)) return []; - + $mids_list = []; - + foreach($item_types as $type) { - + $mids = get_pconfig($this->uid, 'pinned', $type, []); foreach($mids as $mid) { - if(! empty($mid) && strpos($mid,'b64.') === 0) - $mids_list[] = @base64url_decode(substr($mid,4)); + if(!empty($mid)) + $mids_list[] = unpack_link_id($mid); } } if(empty($mids_list)) return []; - + $r = q("SELECT * FROM item WHERE mid IN ( '%s' ) AND uid = %d AND id = parent AND item_private = 0 ORDER BY created DESC", dbesc(implode(",", $mids_list)), intval($this->uid) ); if($r) return $r; - + return []; } - + /* * @brief List activities on item * @@ -214,7 +214,7 @@ class Pinned { * @param array $conv_responses * @return array * - */ + */ private function activity($item, &$conv_responses) { foreach(array_keys($conv_responses) as $verb) { @@ -256,23 +256,23 @@ class Pinned { unset($conv_responses[$verb]); continue; } - + $conv_responses[$verb]['count'] = count($r); $conv_responses[$verb]['button'] = get_response_button_text($verb, $conv_responses[$verb]['count']); - + foreach($r as $rr) { - + $author = q("SELECT * FROM xchan WHERE xchan_hash = '%s' LIMIT 1", dbesc($rr['author_xchan']) ); $name = (($author && $author[0]['xchan_name']) ? $author[0]['xchan_name'] : t('Unknown')); $conv_responses[$verb]['list'][] = (($rr['author_xchan'] && $author && $author[0]['xchan_photo_s']) ? - '' . '' . urlencode($name) . ' ' . $name . '' : + '' . '' . urlencode($name) . ' ' . $name . '' : '' . $name . '' ); } } - + $conv_responses['count'] = count($conv_responses); } } -- cgit v1.2.3 From 989a4f3d49c4825a6826b9f28c36938b6a2979a9 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 23 Sep 2021 10:42:37 +0000 Subject: add notices tab to HQ widget --- Zotlabs/Widget/Messages.php | 53 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index 21375b08f..99de57704 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -11,7 +11,7 @@ class Messages { if (!local_channel()) return EMPTY_STR; - $page = self::get_messages_page($options); + $page = self::get_messages_page([]); $_SESSION['messages_loadtime'] = datetime_convert(); @@ -24,6 +24,7 @@ class Messages { 'messages_title' => t('Public and restricted messages'), 'direct_messages_title' => t('Direct messages'), 'starred_messages_title' => t('Starred messages'), + 'notice_messages_title' => t('Notices'), 'loading' => t('Loading'), 'empty' => t('No messages') ] @@ -40,6 +41,10 @@ class Messages { return; } + if ($options['type'] == 'notification') { + return self::get_notices_page($options); + } + $channel = App::get_channel(); $item_normal = item_normal(); $entries = []; @@ -181,4 +186,50 @@ class Messages { return trim($recipients, ', '); } + public static function get_notices_page($options) { + + if (!local_channel()) + return; + + $limit = 30; + + $offset = 0; + if ($options['offset']) { + $offset = intval($options['offset']); + } + + $notices = q("SELECT * FROM notify WHERE uid = %d + ORDER BY created DESC LIMIT $limit OFFSET $offset", + intval(local_channel()) + ); + + $i = 0; + + foreach($notices as $notice) { + + $summary = trim(strip_tags(bbcode($notice['msg']))); + + if(strpos($summary, $notification['xname']) === 0) { + $summary = substr($summary, strlen($notice['xname']) + 1); + } + + $entries[$i]['author_name'] = $notice['xname']; + $entries[$i]['author_addr'] = $notice['url']; + $entries[$i]['info'] = ''; + $entries[$i]['created'] = datetime_convert('UTC', date_default_timezone_get(), $notice['created']); + $entries[$i]['summary'] = $summary; + $entries[$i]['b64mid'] = basename($notice['link']); + $entries[$i]['href'] = z_root() . '/hq/' . basename($notice['link']); + $entries[$i]['icon'] = ''; + + $i++; + } + + $result = [ + 'offset' => ((count($entries) < $limit) ? -1 : intval($offset + $limit)), + 'entries' => $entries + ]; + + return $result; + } } -- cgit v1.2.3 From d19aa8fb3b8df7ae9598d511093dc1a8d78bbbe9 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 23 Sep 2021 11:17:45 +0000 Subject: make sure entries is initialized --- Zotlabs/Widget/Messages.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index 99de57704..1b6e6f914 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -86,6 +86,7 @@ class Messages { xchan_query($items, false); $i = 0; + $entries = []; foreach($items as $item) { @@ -204,6 +205,7 @@ class Messages { ); $i = 0; + $entries = []; foreach($notices as $notice) { -- cgit v1.2.3 From 0588975e372f863aa2d74bbff0ac2b9778852431 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 23 Sep 2021 14:59:40 +0000 Subject: =?UTF-8?q?=C3=83fix=20wrong=20variable=20name=20and=20streamline?= =?UTF-8?q?=20icon=20with=20unseen=20notifications=20icon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zotlabs/Widget/Messages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index 1b6e6f914..22662a01d 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -211,7 +211,7 @@ class Messages { $summary = trim(strip_tags(bbcode($notice['msg']))); - if(strpos($summary, $notification['xname']) === 0) { + if(strpos($summary, $notice['xname']) === 0) { $summary = substr($summary, strlen($notice['xname']) + 1); } -- cgit v1.2.3 From b35d95da5299ccce9ad79661cf384d3bab514ca6 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 25 Sep 2021 08:47:39 +0000 Subject: dismiss deleted xchans in query --- Zotlabs/Widget/Messages.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index 22662a01d..eb3a07da1 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -177,8 +177,7 @@ class Messages { stringify_array_elms($recips, true); $query_str = implode(',', $recips); - $xchans = dbq("SELECT DISTINCT xchan_name FROM xchan WHERE $column IN ($query_str)"); - + $xchans = dbq("SELECT DISTINCT xchan_name FROM xchan WHERE $column IN ($query_str) AND xchan_deleted = 0"); foreach($xchans as $xchan) { $recipients .= $xchan['xchan_name'] . ', '; } -- cgit v1.2.3 From b830bbd0846f86c36b07a5340aac3def8264b9f4 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 8 Oct 2021 17:35:36 +0000 Subject: remove hz_syslog and deal with intro notifications in the messages widget --- Zotlabs/Widget/Messages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index eb3a07da1..91b82fe2e 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -220,7 +220,7 @@ class Messages { $entries[$i]['created'] = datetime_convert('UTC', date_default_timezone_get(), $notice['created']); $entries[$i]['summary'] = $summary; $entries[$i]['b64mid'] = basename($notice['link']); - $entries[$i]['href'] = z_root() . '/hq/' . basename($notice['link']); + $entries[$i]['href'] = (($notice['ntype'] & NOTIFY_INTRO) ? $notice['link'] : z_root() . '/hq/' . basename($notice['link'])); $entries[$i]['icon'] = ''; $i++; -- cgit v1.2.3 From 08f65420f47f28cd92813c3cd20e838ab6b4dc12 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 10 Oct 2021 09:49:12 +0000 Subject: messages widget: show user-plus icon for connection requests --- Zotlabs/Widget/Messages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index 91b82fe2e..c0fef9f75 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -221,7 +221,7 @@ class Messages { $entries[$i]['summary'] = $summary; $entries[$i]['b64mid'] = basename($notice['link']); $entries[$i]['href'] = (($notice['ntype'] & NOTIFY_INTRO) ? $notice['link'] : z_root() . '/hq/' . basename($notice['link'])); - $entries[$i]['icon'] = ''; + $entries[$i]['icon'] = (($notice['ntype'] & NOTIFY_INTRO) ? '' : ''); $i++; } -- cgit v1.2.3 From e455fae334c4b5f8d5a563e099add1482749c92f Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 12 Oct 2021 11:25:24 +0000 Subject: httpsig: add parentheses --- Zotlabs/Widget/Notes.php | 1 + 1 file changed, 1 insertion(+) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Notes.php b/Zotlabs/Widget/Notes.php index 05c1a0292..66c90ef7d 100644 --- a/Zotlabs/Widget/Notes.php +++ b/Zotlabs/Widget/Notes.php @@ -20,6 +20,7 @@ class Notes { $o = replace_macros($tpl, array( '$banner' => t('Notes'), '$text' => $text, + '$html' => bbcode($text), '$save' => t('Save'), '$app' => ((isset($arr['app'])) ? true : false), '$hidden' => ((isset($arr['hidden'])) ? true : false) -- cgit v1.2.3 From 3e503ec3a35e4226a566c1986bf570afc7c8a53f Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 12 Oct 2021 11:25:44 +0000 Subject: Revert "httpsig: add parentheses" This reverts commit e455fae334c4b5f8d5a563e099add1482749c92f. --- Zotlabs/Widget/Notes.php | 1 - 1 file changed, 1 deletion(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Notes.php b/Zotlabs/Widget/Notes.php index 66c90ef7d..05c1a0292 100644 --- a/Zotlabs/Widget/Notes.php +++ b/Zotlabs/Widget/Notes.php @@ -20,7 +20,6 @@ class Notes { $o = replace_macros($tpl, array( '$banner' => t('Notes'), '$text' => $text, - '$html' => bbcode($text), '$save' => t('Save'), '$app' => ((isset($arr['app'])) ? true : false), '$hidden' => ((isset($arr['hidden'])) ? true : false) -- cgit v1.2.3 From 96c334e7303f15c7402c96531574a438f4ff8ad0 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 12 Oct 2021 11:27:36 +0000 Subject: bbcode for notes app --- Zotlabs/Widget/Notes.php | 1 + 1 file changed, 1 insertion(+) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Notes.php b/Zotlabs/Widget/Notes.php index 05c1a0292..66c90ef7d 100644 --- a/Zotlabs/Widget/Notes.php +++ b/Zotlabs/Widget/Notes.php @@ -20,6 +20,7 @@ class Notes { $o = replace_macros($tpl, array( '$banner' => t('Notes'), '$text' => $text, + '$html' => bbcode($text), '$save' => t('Save'), '$app' => ((isset($arr['app'])) ? true : false), '$hidden' => ((isset($arr['hidden'])) ? true : false) -- cgit v1.2.3 From bb31a4620e227e21acb573c82a081142ff965114 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 15 Oct 2021 19:30:38 +0000 Subject: notes: provide translateable strings --- Zotlabs/Widget/Notes.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Notes.php b/Zotlabs/Widget/Notes.php index 66c90ef7d..659b62390 100644 --- a/Zotlabs/Widget/Notes.php +++ b/Zotlabs/Widget/Notes.php @@ -18,14 +18,24 @@ class Notes { $tpl = get_markup_template('notes.tpl'); $o = replace_macros($tpl, array( - '$banner' => t('Notes'), '$text' => $text, '$html' => bbcode($text), - '$save' => t('Save'), '$app' => ((isset($arr['app'])) ? true : false), - '$hidden' => ((isset($arr['hidden'])) ? true : false) + '$hidden' => ((isset($arr['hidden'])) ? true : false), + '$strings' => [ + 'title' => t('Notes'), + 'read' => t('Read mode'), + 'edit' => t('Edit mode'), + 'editing' => t('Editing'), + 'saving' => t('Saving'), + 'saved' => t('Saved'), + 'dots' => '...' + ] )); + + + return $o; } } -- cgit v1.2.3 From ca17fb01bc24f27e2229557e59977702f43619f4 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 25 Nov 2021 07:54:53 +0000 Subject: profile cleanup and fixes --- Zotlabs/Widget/Fullprofile.php | 2 +- Zotlabs/Widget/Profile.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Fullprofile.php b/Zotlabs/Widget/Fullprofile.php index d7340ef40..e8ed13811 100644 --- a/Zotlabs/Widget/Fullprofile.php +++ b/Zotlabs/Widget/Fullprofile.php @@ -11,6 +11,6 @@ class Fullprofile { $block = observer_prohibited(); - return profile_sidebar(\App::$profile, $block); + return profile_sidebar(\App::$profile, $block, true, true); } } diff --git a/Zotlabs/Widget/Profile.php b/Zotlabs/Widget/Profile.php index bffd910b6..8bd624c0f 100644 --- a/Zotlabs/Widget/Profile.php +++ b/Zotlabs/Widget/Profile.php @@ -7,7 +7,7 @@ class Profile { function widget($args) { $block = observer_prohibited(); - return profile_sidebar(\App::$profile, $block, true); + return profile_sidebar(\App::$profile, $block, true, false); } -} \ No newline at end of file +} -- cgit v1.2.3 From 2968bf8241d2969c4d51f1651fc3f8c7688b2fca Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 15 Dec 2021 12:17:19 +0000 Subject: merge branch perms_ng into dev --- Zotlabs/Widget/Collections.php | 6 +-- Zotlabs/Widget/Messages.php | 2 +- Zotlabs/Widget/Permcats.php | 79 ++++++++++++++++++++++++++++++++++++++++ Zotlabs/Widget/Profile.php | 10 +++-- Zotlabs/Widget/Settings_menu.php | 5 +++ 5 files changed, 95 insertions(+), 7 deletions(-) create mode 100644 Zotlabs/Widget/Permcats.php (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Collections.php b/Zotlabs/Widget/Collections.php index bc9c812c6..774878540 100644 --- a/Zotlabs/Widget/Collections.php +++ b/Zotlabs/Widget/Collections.php @@ -1,8 +1,8 @@ ' : ''); diff --git a/Zotlabs/Widget/Permcats.php b/Zotlabs/Widget/Permcats.php new file mode 100644 index 000000000..72c80ca0c --- /dev/null +++ b/Zotlabs/Widget/Permcats.php @@ -0,0 +1,79 @@ +listing(); + + $list = 'Roles:
'; + $active = ''; + $active_role = ''; + + if($pcatlist) { + $i = 0; + foreach($pcatlist as $pc) { + if(argc() > 1) { + if($pc['name'] == hex2bin(argv(1))) { + $active = $i; + $active_role = $pc['name']; + } + } + + $list .= '' . $pc['localname'] . '
'; + $i++; + } + } + + if(argc() > 1) { + +/* get role members based on permissions + $test = $pcatlist[$active]['perms']; + + $role_sql = ''; + $count = 0; + foreach ($test as $t) { + $checkinherited = PermissionLimits::Get(local_channel(),$t['name']); + + if($checkinherited & PERMS_SPECIFIC) { + $role_sql .= "( abconfig.k = '" . dbesc($t['name']) . "' AND abconfig.v = '" . intval($t['value']) . "' ) OR "; + $count++; + } + } + + $role_sql = rtrim($role_sql, ' OR '); + + $r = q("SELECT abconfig.xchan, xchan.xchan_name, abook.abook_id FROM abconfig LEFT JOIN xchan on abconfig.xchan = xchan.xchan_hash LEFT JOIN abook ON abconfig.xchan = abook.abook_xchan WHERE xchan.xchan_deleted = 0 and abconfig.chan = %d AND abconfig.cat = 'my_perms' AND ( $role_sql ) GROUP BY abconfig.xchan HAVING count(abconfig.xchan) = %d ORDER BY xchan.xchan_name", + intval(local_channel()), + intval($count) + ); +*/ + + // get role members based on abook_role + + $r = q("SELECT abook.abook_id, abook.abook_role, xchan.xchan_name, xchan.xchan_addr, xchan.xchan_url, xchan.xchan_photo_s FROM abook + LEFT JOIN xchan on abook.abook_xchan = xchan.xchan_hash + WHERE abook.abook_channel = %d AND abook.abook_role = '%s' AND abook_self = 0 AND xchan_deleted = 0 + ORDER BY xchan.xchan_name", + intval(local_channel()), + dbesc($active_role) + ); + + $members = 'Role members:
'; + $members .= '
'; + + foreach ($r as $rr) { + $addr = (($rr['xchan_addr']) ? $rr['xchan_addr'] : $rr['xchan_url']); + $members .= '' . $rr['xchan_name'] . '
' . $addr . '
'; + } + $members .= '
'; + } + return $list . '
' . $members. '
' . $others; + + } +} diff --git a/Zotlabs/Widget/Profile.php b/Zotlabs/Widget/Profile.php index 8bd624c0f..0e5444a56 100644 --- a/Zotlabs/Widget/Profile.php +++ b/Zotlabs/Widget/Profile.php @@ -2,12 +2,16 @@ namespace Zotlabs\Widget; +use App; class Profile { - function widget($args) { + if(!App::$profile['profile_uid']) { + return; + } + $block = observer_prohibited(); - return profile_sidebar(\App::$profile, $block, true, false); - } + return profile_sidebar(App::$profile, $block, true, false); + } } diff --git a/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php index 25b80a4b4..4d0f1d2dd 100644 --- a/Zotlabs/Widget/Settings_menu.php +++ b/Zotlabs/Widget/Settings_menu.php @@ -40,6 +40,11 @@ class Settings_menu { 'selected' => ((argv(1) === 'channel') ? 'active' : ''), ), + array( + 'label' => t('Privacy settings'), + 'url' => z_root().'/settings/privacy', + 'selected' => ((argv(1) === 'privacy') ? 'active' : '') + ) ); $tabs[] = array( -- cgit v1.2.3 From 220ed35f5855f22344d7a815da9bb1f6c96f1002 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 17 Dec 2021 14:59:25 +0100 Subject: implement contact role deletion --- Zotlabs/Widget/Permcats.php | 53 +++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 21 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Permcats.php b/Zotlabs/Widget/Permcats.php index 72c80ca0c..97ae6cba2 100644 --- a/Zotlabs/Widget/Permcats.php +++ b/Zotlabs/Widget/Permcats.php @@ -11,26 +11,25 @@ class Permcats { $pcat = new Permcat(local_channel()); $pcatlist = $pcat->listing(); - $list = 'Roles:
'; - $active = ''; - $active_role = ''; + if (!$pcatlist) { + return; + } - if($pcatlist) { - $i = 0; - foreach($pcatlist as $pc) { - if(argc() > 1) { - if($pc['name'] == hex2bin(argv(1))) { - $active = $i; - $active_role = $pc['name']; - } - } + $roles = []; + $active_role = ''; - $list .= '' . $pc['localname'] . '
'; - $i++; + foreach($pcatlist as $pc) { + if (!$active_role) { + $active_role = ((argc() > 1 && $pc['name'] === hex2bin(argv(1))) ? $pc['name'] : ''); } + $roles[] = [ + 'name' => $pc['localname'], + 'url' => z_root() . '/permcats/' . bin2hex($pc['name']), + 'active' => (argc() > 1 && $pc['name'] === hex2bin(argv(1))) + ]; } - if(argc() > 1) { + if($active_role) { /* get role members based on permissions $test = $pcatlist[$active]['perms']; @@ -64,16 +63,28 @@ class Permcats { dbesc($active_role) ); - $members = 'Role members:
'; - $members .= '
'; + $members = []; foreach ($r as $rr) { - $addr = (($rr['xchan_addr']) ? $rr['xchan_addr'] : $rr['xchan_url']); - $members .= '' . $rr['xchan_name'] . '
' . $addr . '
'; + $members[] = [ + 'name' => $rr['xchan_name'], + 'addr' => (($rr['xchan_addr']) ? $rr['xchan_addr'] : $rr['xchan_url']), + 'url' => z_root() . '/connections#' . $rr['abook_id'], + 'photo' => $rr['xchan_photo_s'] + ]; } - $members .= '
'; } - return $list . '
' . $members. '
' . $others; + + $tpl = get_markup_template("permcats_widget.tpl"); + $o .= replace_macros($tpl, [ + '$roles_label' => t('Contact roles'), + '$members_label' => t('Role members'), + '$roles' => $roles, + '$members' => $members + + ]); + + return $o; } } -- cgit v1.2.3 From 5e811819e2738bd4de2869c9b99601219631ff0d Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 7 Jan 2022 19:14:14 +0000 Subject: add link to create new contact roles --- Zotlabs/Widget/Permcats.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Permcats.php b/Zotlabs/Widget/Permcats.php index 97ae6cba2..a908f6220 100644 --- a/Zotlabs/Widget/Permcats.php +++ b/Zotlabs/Widget/Permcats.php @@ -31,6 +31,12 @@ class Permcats { if($active_role) { + $roles[] = [ + 'name' => ' ' . t('Add new role'), + 'url' => z_root() . '/permcats', + 'active' => '' + ]; + /* get role members based on permissions $test = $pcatlist[$active]['perms']; -- cgit v1.2.3 From c72e5e3b66db227e27a400044dcc0a6748d49cb5 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 7 Jan 2022 20:03:40 +0000 Subject: streamline privacy groups --- Zotlabs/Widget/Collections.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Collections.php b/Zotlabs/Widget/Collections.php index 774878540..ad1a10f4b 100644 --- a/Zotlabs/Widget/Collections.php +++ b/Zotlabs/Widget/Collections.php @@ -9,7 +9,7 @@ class Collections { function widget($args) { if(argc() < 2) - return; + // return; $mode = ((array_key_exists('mode',$args)) ? $args['mode'] : 'conversation'); switch($mode) { -- cgit v1.2.3 From 7450ac1a31596ba7dade032d6a38008eb339eba2 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 7 Jan 2022 20:07:09 +0000 Subject: missing files --- Zotlabs/Widget/Privacygroups.php | 55 ++++++++++++++++++++++++++++++++++++++++ Zotlabs/Widget/Tokens.php | 51 +++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 Zotlabs/Widget/Privacygroups.php create mode 100644 Zotlabs/Widget/Tokens.php (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Privacygroups.php b/Zotlabs/Widget/Privacygroups.php new file mode 100644 index 000000000..74ce02ccd --- /dev/null +++ b/Zotlabs/Widget/Privacygroups.php @@ -0,0 +1,55 @@ + $z_root . '/group/' . $group['id'], + 'label' => $group['gname'], + 'title' => '', + 'active' => ($active === $group['id']), + 'count' => count(AccessList::members(local_channel(), $group['id'])) + ]; + } + + if ($active) { + $menu_items[] = [ + 'href' => $z_root . '/group', + 'label' => '  ' . t('Add new privacy group'), + 'title' => '', + 'active' => '', + 'count' => '' + ]; + } + + $tpl = get_markup_template("widget_menu_count.tpl"); + $o .= replace_macros($tpl, [ + '$title' => t('Privacy groups'), + '$menu_items' => $menu_items, + + ]); + + return $o; + + } +} diff --git a/Zotlabs/Widget/Tokens.php b/Zotlabs/Widget/Tokens.php new file mode 100644 index 000000000..8c31003fc --- /dev/null +++ b/Zotlabs/Widget/Tokens.php @@ -0,0 +1,51 @@ + $z_root . '/tokens/' . $token['atoken_id'], + 'label' => $token['atoken_name'], + 'title' => '', + 'active' => ($active === $token['atoken_id']) + ]; + } + + if ($active) { + $menu_items[] = [ + 'href' => $z_root . '/tokens', + 'label' => '  ' . t('Add new guest'), + 'title' => '', + 'active' => '' + ]; + } + + $tpl = get_markup_template("widget_menu.tpl"); + $o .= replace_macros($tpl, [ + '$title' => t('Guest access'), + '$menu_items' => $menu_items, + + ]); + + return $o; + + } +} -- cgit v1.2.3 From a35f741a3549934a40be17a91b488d48ab7c1953 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 9 Jan 2022 15:40:54 +0000 Subject: deprecate AccessList::widget() --- Zotlabs/Widget/Privacygroups.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Privacygroups.php b/Zotlabs/Widget/Privacygroups.php index 74ce02ccd..a6b16c552 100644 --- a/Zotlabs/Widget/Privacygroups.php +++ b/Zotlabs/Widget/Privacygroups.php @@ -35,7 +35,7 @@ class Privacygroups { if ($active) { $menu_items[] = [ 'href' => $z_root . '/group', - 'label' => '  ' . t('Add new privacy group'), + 'label' => '  ' . t('Add new group'), 'title' => '', 'active' => '', 'count' => '' -- cgit v1.2.3 From 867deda24771848575bb7d9cb7e4bfc82e642e33 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 11 Jan 2022 09:29:18 +0000 Subject: remove legacy mail which has been deprecated since a year --- Zotlabs/Widget/Conversations.php | 163 --------------------------------------- Zotlabs/Widget/Mailmenu.php | 38 --------- 2 files changed, 201 deletions(-) delete mode 100644 Zotlabs/Widget/Conversations.php delete mode 100644 Zotlabs/Widget/Mailmenu.php (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Conversations.php b/Zotlabs/Widget/Conversations.php deleted file mode 100644 index 3dc260b50..000000000 --- a/Zotlabs/Widget/Conversations.php +++ /dev/null @@ -1,163 +0,0 @@ - $mailbox, - 'id' => $rr['id'], - 'from_name' => $rr['from']['xchan_name'], - 'from_url' => chanlink_hash($rr['from_xchan']), - 'from_photo' => $rr['from']['xchan_photo_s'], - 'to_name' => $rr['to']['xchan_name'], - 'to_url' => chanlink_hash($rr['to_xchan']), - 'to_photo' => $rr['to']['xchan_photo_s'], - 'subject' => (($rr['seen']) ? $rr['title'] : '' . $rr['title'] . ''), - 'delete' => t('Delete conversation'), - 'body' => $rr['body'], - 'date' => datetime_convert('UTC',date_default_timezone_get(),$rr['created'], 'c'), - 'seen' => $rr['seen'], - 'selected' => ((argv(1) != 'new') ? $selected : '') - ]; - } - - $tpl = get_markup_template('mail_head.tpl'); - $o .= replace_macros($tpl, [ - '$header' => $header, - '$messages' => $messages - ]); - - return $o; - } - - function private_messages_list($uid, $mailbox = '', $start = 0, $numitems = 0) { - - $where = ''; - $limit = ''; - - $t0 = dba_timer(); - - if($numitems) - $limit = " LIMIT " . intval($numitems) . " OFFSET " . intval($start); - - if($mailbox !== '') { - $x = q("select channel_hash from channel where channel_id = %d limit 1", - intval($uid) - ); - - if(! $x) - return array(); - - $channel_hash = dbesc($x[0]['channel_hash']); - $local_channel = intval(local_channel()); - - switch($mailbox) { - - case 'inbox': - $sql = "SELECT * FROM mail WHERE channel_id = $local_channel AND from_xchan != '$channel_hash' ORDER BY created DESC $limit"; - break; - - case 'outbox': - $sql = "SELECT * FROM mail WHERE channel_id = $local_channel AND from_xchan = '$channel_hash' ORDER BY created DESC $limit"; - break; - - case 'combined': - default: - $parents = q("SELECT mail.parent_mid FROM mail LEFT JOIN conv ON mail.conv_guid = conv.guid WHERE mail.mid = mail.parent_mid AND mail.channel_id = %d ORDER BY conv.updated DESC $limit", - intval($local_channel) - ); - break; - } - - } - - $r = null; - - if($parents) { - foreach($parents as $parent) { - $all = q("SELECT * FROM mail WHERE parent_mid = '%s' AND channel_id = %d ORDER BY created DESC limit 1", - dbesc($parent['parent_mid']), - intval($local_channel) - ); - - if($all) { - foreach($all as $single) { - $r[] = $single; - } - } - } - } - elseif($sql) { - $r = q($sql); - } - - if(! $r) { - return array(); - } - - $chans = array(); - foreach($r as $rr) { - $s = "'" . dbesc(trim($rr['from_xchan'])) . "'"; - if(! in_array($s,$chans)) - $chans[] = $s; - $s = "'" . dbesc(trim($rr['to_xchan'])) . "'"; - if(! in_array($s,$chans)) - $chans[] = $s; - } - - $c = q("select * from xchan where xchan_hash in (" . protect_sprintf(implode(',',$chans)) . ")"); - - foreach($r as $k => $rr) { - $r[$k]['from'] = find_xchan_in_array($rr['from_xchan'],$c); - $r[$k]['to'] = find_xchan_in_array($rr['to_xchan'],$c); - $r[$k]['seen'] = intval($rr['mail_seen']); - if(intval($r[$k]['mail_obscured'])) { - if($r[$k]['title']) - $r[$k]['title'] = base64url_decode(str_rot47($r[$k]['title'])); - if($r[$k]['body']) - $r[$k]['body'] = base64url_decode(str_rot47($r[$k]['body'])); - } - } - - return $r; - } - -} - diff --git a/Zotlabs/Widget/Mailmenu.php b/Zotlabs/Widget/Mailmenu.php deleted file mode 100644 index ca022c807..000000000 --- a/Zotlabs/Widget/Mailmenu.php +++ /dev/null @@ -1,38 +0,0 @@ - t('Private Mail Menu'), - '$combined' => array( - 'label' => t('Combined View'), - 'url' => z_root() . '/mail/combined', - 'sel' => (argv(1) == 'combined' || argc() == 1), - ), - '$inbox' => array( - 'label' => t('Inbox'), - 'url' => z_root() . '/mail/inbox', - 'sel' => (argv(1) == 'inbox'), - ), - '$outbox' => array( - 'label' => t('Outbox'), - 'url' => z_root() . '/mail/outbox', - 'sel' => (argv(1) == 'outbox'), - ), -/* - '$new' => array( - 'label' => t('New Message'), - 'url' => z_root() . '/mail/new', - 'sel'=> (argv(1) == 'new'), - ) -*/ - )); - } -} -- cgit v1.2.3 From 9e9d96a2eca57143f8f13b3fb092ac9359d40bec Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 11 Feb 2022 09:36:17 +0000 Subject: minor restructure to omit php 8.1 deprecation warning --- Zotlabs/Widget/Messages.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index 71f4bd310..89533697f 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -103,13 +103,20 @@ class Messages { if (!$summary) { $summary = $item['summary']; } + if (!$summary) { - $summary = htmlentities(html2plain(bbcode($item['body'], ['drop_media' => true]), 75, true), ENT_QUOTES, 'UTF-8', false); + $summary = html2plain(bbcode($item['body'], ['drop_media' => true]), 75, true); + if ($summary) { + $summary = htmlentities($summary, ENT_QUOTES, 'UTF-8', false); + } } - if (!$summary) { + + if (!$summary) $summary = '...'; } - $summary = substr_words($summary, 68); + else { + $summary = substr_words($summary, 68); + } switch(intval($item['item_private'])) { case 1: -- cgit v1.2.3 From abbca1256502b3b017746de1187c8c65294d44ab Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 11 Feb 2022 09:37:29 +0000 Subject: typo --- Zotlabs/Widget/Messages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index 89533697f..e7341b556 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -111,7 +111,7 @@ class Messages { } } - if (!$summary) + if (!$summary) { $summary = '...'; } else { -- cgit v1.2.3 From c0350861ef0da66209e6b08c75af2c16e3673e25 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 13 Feb 2022 19:31:51 +0000 Subject: php8 warnings --- Zotlabs/Widget/Messages.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index e7341b556..86ce2fa29 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -17,8 +17,8 @@ class Messages { $tpl = get_markup_template('messages_widget.tpl'); $o = replace_macros($tpl, [ - '$entries' => $page['entries'], - '$offset' => $page['offset'], + '$entries' => $page['entries'] ?? [], + '$offset' => $page['offset'] ?? 0, '$feature_star' => feature_enabled(local_channel(), 'star_posts'), '$strings' => [ 'messages_title' => t('Public and restricted messages'), @@ -37,11 +37,11 @@ class Messages { if (!local_channel()) return; - if ($options['offset'] == -1) { + if (isset($options['offset']) && $options['offset'] == -1) { return; } - if ($options['type'] == 'notification') { + if (isset($options['type']) && $options['type'] == 'notification') { return self::get_notices_page($options); } -- cgit v1.2.3 From 2a60f1cc6ed49ab559090c831788308fe3df0706 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 20 Feb 2022 20:18:24 +0000 Subject: merge branch pdledit_gui into dev - many widgets still miss their description and requirements (this is work in progress) --- Zotlabs/Widget/Activity_filter.php | 7 +++++++ Zotlabs/Widget/Activity_order.php | 8 +++++++- Zotlabs/Widget/Admin.php | 5 +++++ Zotlabs/Widget/Affinity.php | 12 +++++++++--- Zotlabs/Widget/Filer.php | 1 - Zotlabs/Widget/Hq_controls.php | 7 +++++++ Zotlabs/Widget/Messages.php | 8 ++++++++ Zotlabs/Widget/Notes.php | 11 ++++++++--- Zotlabs/Widget/Notifications.php | 6 ++++++ 9 files changed, 57 insertions(+), 8 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Activity_filter.php b/Zotlabs/Widget/Activity_filter.php index b7a69752e..daaf5fb67 100644 --- a/Zotlabs/Widget/Activity_filter.php +++ b/Zotlabs/Widget/Activity_filter.php @@ -1,5 +1,12 @@ t('Refresh'), '$labels' => $label_str, )); - + $arr = array('html' => $x); call_hooks('main_slider',$arr); @@ -63,4 +69,4 @@ class Affinity { } } - + diff --git a/Zotlabs/Widget/Filer.php b/Zotlabs/Widget/Filer.php index 5d6f96a87..bac1c339e 100644 --- a/Zotlabs/Widget/Filer.php +++ b/Zotlabs/Widget/Filer.php @@ -10,7 +10,6 @@ class Filer { if(! local_channel()) return ''; - $selected = ((x($_REQUEST,'file')) ? $_REQUEST['file'] : ''); $terms = array(); diff --git a/Zotlabs/Widget/Hq_controls.php b/Zotlabs/Widget/Hq_controls.php index 91335fd76..7b1fe817d 100644 --- a/Zotlabs/Widget/Hq_controls.php +++ b/Zotlabs/Widget/Hq_controls.php @@ -1,5 +1,12 @@ Date: Mon, 21 Feb 2022 10:02:33 +0000 Subject: remove deprecated widgets and add some more widget descriptions --- Zotlabs/Widget/Activity.php | 5 ++++ Zotlabs/Widget/Album.php | 8 +++++- Zotlabs/Widget/Appcategories.php | 6 +++++ Zotlabs/Widget/Appcloud.php | 6 +++++ Zotlabs/Widget/Appstore.php | 6 +++++ Zotlabs/Widget/Archive.php | 6 +++++ Zotlabs/Widget/Bookmarkedchats.php | 9 ++++--- Zotlabs/Widget/Catcloud.php | 9 ++++++- Zotlabs/Widget/Catcloud_wall.php | 6 +++++ Zotlabs/Widget/Categories.php | 6 +++++ Zotlabs/Widget/Cdav.php | 10 ++++--- Zotlabs/Widget/Chatroom_list.php | 6 +++++ Zotlabs/Widget/Chatroom_members.php | 6 +++++ Zotlabs/Widget/Clock.php | 5 ++++ Zotlabs/Widget/Collections.php | 54 ------------------------------------- Zotlabs/Widget/Common_friends.php | 8 +++++- Zotlabs/Widget/Cover_photo.php | 6 +++++ Zotlabs/Widget/Design_tools.php | 8 +++++- Zotlabs/Widget/Dirsort.php | 6 +++++ Zotlabs/Widget/Dirtags.php | 6 +++++ Zotlabs/Widget/Eventstools.php | 19 ------------- Zotlabs/Widget/Filer.php | 6 +++++ Zotlabs/Widget/Findpeople.php | 5 ++++ Zotlabs/Widget/Follow.php | 7 ++++- Zotlabs/Widget/Forums.php | 36 +++++-------------------- Zotlabs/Widget/Suggestedchats.php | 10 ++++--- 26 files changed, 148 insertions(+), 117 deletions(-) delete mode 100644 Zotlabs/Widget/Collections.php delete mode 100644 Zotlabs/Widget/Eventstools.php (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Activity.php b/Zotlabs/Widget/Activity.php index 5d9795c7e..34e0f67dc 100644 --- a/Zotlabs/Widget/Activity.php +++ b/Zotlabs/Widget/Activity.php @@ -1,5 +1,10 @@ $upload_form, '$usage' => $usage_message )); - + return $o; } } diff --git a/Zotlabs/Widget/Appcategories.php b/Zotlabs/Widget/Appcategories.php index e916f095f..31fb2542e 100644 --- a/Zotlabs/Widget/Appcategories.php +++ b/Zotlabs/Widget/Appcategories.php @@ -1,5 +1,11 @@ $sabreabook['uri'], 'displayname' => $sabreabook['{DAV:}displayname'], 'id' => $sabreabook['id'] - + ]; } diff --git a/Zotlabs/Widget/Chatroom_list.php b/Zotlabs/Widget/Chatroom_list.php index e2aad0e05..42b92ddb2 100644 --- a/Zotlabs/Widget/Chatroom_list.php +++ b/Zotlabs/Widget/Chatroom_list.php @@ -1,5 +1,11 @@ t('Events Tools'), - '$export' => t('Export Calendar'), - '$import' => t('Import Calendar'), - '$submit' => t('Submit') - )); - } -} diff --git a/Zotlabs/Widget/Filer.php b/Zotlabs/Widget/Filer.php index bac1c339e..6c5ac47a9 100644 --- a/Zotlabs/Widget/Filer.php +++ b/Zotlabs/Widget/Filer.php @@ -1,5 +1,11 @@ t('Add New Connection'), '$desc' => t('Enter channel address'), diff --git a/Zotlabs/Widget/Forums.php b/Zotlabs/Widget/Forums.php index 2af7347f1..454cc7a26 100644 --- a/Zotlabs/Widget/Forums.php +++ b/Zotlabs/Widget/Forums.php @@ -1,5 +1,11 @@ Date: Mon, 21 Feb 2022 10:03:43 +0000 Subject: do not require network for forums widget --- Zotlabs/Widget/Forums.php | 1 - 1 file changed, 1 deletion(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Forums.php b/Zotlabs/Widget/Forums.php index 454cc7a26..c40556273 100644 --- a/Zotlabs/Widget/Forums.php +++ b/Zotlabs/Widget/Forums.php @@ -3,7 +3,6 @@ /** * * Name: Forums * * Description: A list of forum channels with unseen item counts - * * Requires: network */ namespace Zotlabs\Widget; -- cgit v1.2.3 From a520063265459a6a02c7e39b64aa7fd83bc0b246 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 23 Feb 2022 11:52:11 +0000 Subject: widget descriptions and add content region to all pdl files for convenience --- Zotlabs/Widget/Chatroom_list.php | 2 +- Zotlabs/Widget/Common_friends.php | 2 +- Zotlabs/Widget/Fullprofile.php | 6 ++++++ Zotlabs/Widget/Helpindex.php | 7 +++++++ Zotlabs/Widget/Item.php | 8 +++++++- Zotlabs/Widget/Menu_preview.php | 6 ++++++ Zotlabs/Widget/Newmember.php | 9 +++++++-- Zotlabs/Widget/Permcats.php | 7 +++++++ Zotlabs/Widget/Photo.php | 6 ++++++ Zotlabs/Widget/Photo_albums.php | 6 ++++++ Zotlabs/Widget/Photo_rand.php | 11 ++++++++--- Zotlabs/Widget/Pinned.php | 9 ++++++--- Zotlabs/Widget/Portfolio.php | 10 +++++++--- Zotlabs/Widget/Privacygroups.php | 7 +++++++ Zotlabs/Widget/Profile.php | 7 +++++++ Zotlabs/Widget/Pubsites.php | 16 ---------------- Zotlabs/Widget/Pubtagcloud.php | 5 +++++ Zotlabs/Widget/Random_block.php | 5 +++++ Zotlabs/Widget/Rating.php | 6 ++++++ Zotlabs/Widget/Savedsearch.php | 6 ++++++ Zotlabs/Widget/Settings_menu.php | 5 +++++ Zotlabs/Widget/Shortprofile.php | 18 ------------------ Zotlabs/Widget/Sitesearch.php | 6 ++++++ Zotlabs/Widget/Suggestions.php | 13 +++++++++---- Zotlabs/Widget/Tagcloud.php | 5 +++++ Zotlabs/Widget/Tagcloud_wall.php | 6 ++++++ Zotlabs/Widget/Tasklist.php | 9 ++++++--- Zotlabs/Widget/Tokens.php | 6 ++++++ Zotlabs/Widget/Vcard.php | 5 +++++ Zotlabs/Widget/Website_portation_tools.php | 7 ++++++- Zotlabs/Widget/Wiki_list.php | 5 +++++ Zotlabs/Widget/Wiki_page_history.php | 8 +++++++- Zotlabs/Widget/Wiki_pages.php | 10 ++++++++-- Zotlabs/Widget/Zcard.php | 5 +++++ 34 files changed, 190 insertions(+), 59 deletions(-) delete mode 100644 Zotlabs/Widget/Pubsites.php delete mode 100644 Zotlabs/Widget/Shortprofile.php (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Chatroom_list.php b/Zotlabs/Widget/Chatroom_list.php index 42b92ddb2..d80e40bf9 100644 --- a/Zotlabs/Widget/Chatroom_list.php +++ b/Zotlabs/Widget/Chatroom_list.php @@ -1,7 +1,7 @@ '; $level_0 = get_help_content('sitetoc'); diff --git a/Zotlabs/Widget/Item.php b/Zotlabs/Widget/Item.php index 273d5649c..9fd703dfe 100644 --- a/Zotlabs/Widget/Item.php +++ b/Zotlabs/Widget/Item.php @@ -1,5 +1,11 @@ t('Upload profile photo'), 'cover_photo' => t('Upload cover photo'), 'profiles' => t('Edit your profile'), @@ -84,4 +89,4 @@ class Newmember { } - + diff --git a/Zotlabs/Widget/Permcats.php b/Zotlabs/Widget/Permcats.php index a908f6220..9226b3c71 100644 --- a/Zotlabs/Widget/Permcats.php +++ b/Zotlabs/Widget/Permcats.php @@ -1,5 +1,12 @@ '; diff --git a/Zotlabs/Widget/Pinned.php b/Zotlabs/Widget/Pinned.php index 66d06bbd3..83036e98c 100644 --- a/Zotlabs/Widget/Pinned.php +++ b/Zotlabs/Widget/Pinned.php @@ -1,11 +1,14 @@ $upload_form, '$usage' => $usage_message )); - + return $o; } } diff --git a/Zotlabs/Widget/Privacygroups.php b/Zotlabs/Widget/Privacygroups.php index a6b16c552..62f343ea6 100644 --- a/Zotlabs/Widget/Privacygroups.php +++ b/Zotlabs/Widget/Privacygroups.php @@ -1,5 +1,12 @@ '; - } -} - - diff --git a/Zotlabs/Widget/Pubtagcloud.php b/Zotlabs/Widget/Pubtagcloud.php index 826e3e6ae..db7ea02e7 100644 --- a/Zotlabs/Widget/Pubtagcloud.php +++ b/Zotlabs/Widget/Pubtagcloud.php @@ -1,5 +1,10 @@ 2) ? mt_rand(0,count($r) - 2) : 0); + $index = ((count($r) > 4) ? mt_rand(0,count($r) - 4) : 0); - for($x = $index; $x <= ($index+1); $x ++) { + for($x = $index; $x <= ($index+3); $x ++) { $rr = $r[$x]; if(! $rr['xchan_url']) break; diff --git a/Zotlabs/Widget/Tagcloud.php b/Zotlabs/Widget/Tagcloud.php index f79bd59ad..00456f24f 100644 --- a/Zotlabs/Widget/Tagcloud.php +++ b/Zotlabs/Widget/Tagcloud.php @@ -2,6 +2,11 @@ namespace Zotlabs\Widget; +/** + * * Name: Tag cloud + * * Description: Display hashtags of your network items in a cloud + * * Requires: network, hq + */ class Tagcloud { diff --git a/Zotlabs/Widget/Tagcloud_wall.php b/Zotlabs/Widget/Tagcloud_wall.php index 7cff6ce09..20def4ab1 100644 --- a/Zotlabs/Widget/Tagcloud_wall.php +++ b/Zotlabs/Widget/Tagcloud_wall.php @@ -1,5 +1,11 @@ '; - $o .= '
' . '

' . t('Tasks') . '

'; + $o .= '
' . '

' . t('Tasks') . '

'; $o .= '
'; $o .= '
'; return $o; diff --git a/Zotlabs/Widget/Tokens.php b/Zotlabs/Widget/Tokens.php index 8c31003fc..69452d628 100644 --- a/Zotlabs/Widget/Tokens.php +++ b/Zotlabs/Widget/Tokens.php @@ -1,5 +1,11 @@ \App::$profile_uid, + 'channel_id' => \App::$profile_uid, 'observer_hash' => get_observer_hash(), 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName diff --git a/Zotlabs/Widget/Wiki_pages.php b/Zotlabs/Widget/Wiki_pages.php index dee0a2229..ece712334 100644 --- a/Zotlabs/Widget/Wiki_pages.php +++ b/Zotlabs/Widget/Wiki_pages.php @@ -1,5 +1,11 @@ t('Add new page'), '$typelock' => $typelock, '$lockedtype' => $w['mimeType'], - '$mimetype' => mimetype_select(0,$w['mimeType'], + '$mimetype' => mimetype_select(0,$w['mimeType'], [ 'text/markdown' => t('Markdown'), 'text/bbcode' => t('BBcode'), 'text/plain' => t('Text') ]), '$pageName' => array('missingPageName', 'Create Page' , $pageName), '$refresh' => $arr['refresh'], @@ -91,7 +97,7 @@ class Wiki_pages { '$addnew' => t('Add new page'), '$typelock' => $typelock, '$lockedtype' => $w['mimeType'], - '$mimetype' => mimetype_select(0,$w['mimeType'], + '$mimetype' => mimetype_select(0,$w['mimeType'], [ 'text/markdown' => t('Markdown'), 'text/bbcode' => t('BBcode'), 'text/plain' => t('Text') ]), '$pageName' => array('pageName', t('Page name')), '$refresh' => $arr['refresh'], diff --git a/Zotlabs/Widget/Zcard.php b/Zotlabs/Widget/Zcard.php index 12e53eaab..35362c50e 100644 --- a/Zotlabs/Widget/Zcard.php +++ b/Zotlabs/Widget/Zcard.php @@ -1,5 +1,10 @@