aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget/Messages.php
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Widget/Messages.php')
-rw-r--r--Zotlabs/Widget/Messages.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php
index 71f4bd310..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);
}
@@ -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) {
$summary = '...';
}
- $summary = substr_words($summary, 68);
+ else {
+ $summary = substr_words($summary, 68);
+ }
switch(intval($item['item_private'])) {
case 1: