aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-09-08 20:02:22 +0000
committerMario <mario@mariovavti.com>2022-09-08 20:02:22 +0000
commit990a3af2a7349e07c10224cf2a023d179ecfd6ca (patch)
tree75c6f7bcb2f7d630a3fc5395e7f3480541e4fe25
parent1f5a23143aa5aa1fb3273b8a9c74782cd0441fde (diff)
downloadvolse-hubzilla-990a3af2a7349e07c10224cf2a023d179ecfd6ca.tar.gz
volse-hubzilla-990a3af2a7349e07c10224cf2a023d179ecfd6ca.tar.bz2
volse-hubzilla-990a3af2a7349e07c10224cf2a023d179ecfd6ca.zip
php8: random cleanup and warning fixes
-rw-r--r--Zotlabs/Lib/Enotify.php4
-rw-r--r--Zotlabs/Lib/Libzot.php6
-rw-r--r--Zotlabs/Lib/ThreadItem.php43
-rw-r--r--Zotlabs/Module/Channel.php1
-rw-r--r--Zotlabs/Module/Hq.php3
-rw-r--r--Zotlabs/Photo/PhotoDriver.php50
-rw-r--r--include/auth.php4
-rw-r--r--include/bbcode.php16
-rw-r--r--include/channel.php15
-rw-r--r--include/conversation.php68
-rw-r--r--include/text.php16
11 files changed, 97 insertions, 129 deletions
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index 07c426960..5a09ade90 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -815,10 +815,10 @@ class Enotify {
localize_item($item);
- if($item['shortlocalize']) {
+ if(isset($item['shortlocalize'])) {
$itemem_text = $item['shortlocalize'];
}
- elseif($item['localize']) {
+ elseif(isset($item['localize'])) {
$itemem_text = $item['localize'];
}
else {
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 8eb5ce647..09ce3a9de 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -304,8 +304,14 @@ class Libzot {
$record = Zotfinger::exec($url, $channel);
+ if (!$record) {
+ return false;
+ }
+
// Check the HTTP signature
$hsig = $record['signature'];
+ $hsig_valid = false;
+
if ($hsig && $hsig['signer'] === $url && $hsig['header_valid'] === true && $hsig['content_valid'] === true) {
$hsig_valid = true;
}
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 0422d81d0..20cbff4fc 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -98,7 +98,7 @@ class ThreadItem {
$is_item = false;
$osparkle = '';
$total_children = $this->count_descendants();
- $unseen_comments = (($item['real_uid']) ? 0 : $this->count_unseen_descendants());
+ $unseen_comments = ((isset($item['real_uid']) && $item['real_uid']) ? 0 : $this->count_unseen_descendants());
$conv = $this->get_conversation();
$observer = $conv->get_observer();
@@ -148,7 +148,7 @@ class ThreadItem {
}
if ($lock) {
- if (($item['mid'] == $item['parent_mid']) && count(get_terms_oftype($item['term'],TERM_FORUM))) {
+ if (($item['mid'] == $item['parent_mid']) && isset($item['term']) && count(get_terms_oftype($item['term'], TERM_FORUM))) {
$privacy_warning = true;
$conv_flags['parent_privacy_warning'] = true;
}
@@ -191,13 +191,6 @@ class ThreadItem {
$drop = [ 'dropping' => true, 'delete' => t('Admin Delete') ];
}
-// FIXME
- if($observer_is_pageowner) {
- $multidrop = array(
- 'select' => t('Select'),
- );
- }
-
$filer = ((($conv->get_profile_owner() == local_channel()) && (! array_key_exists('real_uid',$item))) ? t("Save to Folder") : false);
$profile_avatar = $item['author']['xchan_photo_m'];
@@ -207,7 +200,6 @@ class ThreadItem {
$location = format_location($item);
$isevent = false;
$attend = null;
- $canvote = false;
// process action responses - e.g. like/dislike/attend/agree/whatever
$response_verbs = array('like');
@@ -227,17 +219,6 @@ class ThreadItem {
$response_verbs[] = 'answer';
}
- $consensus = (intval($item['item_consensus']) ? true : false);
- if($consensus) {
- $response_verbs[] = 'agree';
- $response_verbs[] = 'disagree';
- $response_verbs[] = 'abstain';
- if($this->is_commentable() && $observer) {
- $conlabels = array( t('I agree'), t('I disagree'), t('I abstain'));
- $canvote = true;
- }
- }
-
if(! feature_enabled($conv->get_profile_owner(),'dislike'))
unset($conv_responses['dislike']);
@@ -245,7 +226,8 @@ class ThreadItem {
$my_responses = [];
foreach($response_verbs as $v) {
- $my_responses[$v] = (($conv_responses[$v][$item['mid'] . '-m']) ? 1 : 0);
+
+ $my_responses[$v] = ((isset($conv_responses[$v][$item['mid'] . '-m'])) ? 1 : 0);
}
$like_count = ((x($conv_responses['like'],$item['mid'])) ? $conv_responses['like'][$item['mid']] : '');
@@ -333,14 +315,16 @@ class ThreadItem {
$reply_to = array( t("Reply on this comment"), t("reply"), t("Reply to"));
}
+ $share = [];
+ $embed = [];
if ($shareable) {
// This actually turns out not to be possible in some protocol stacks without opening up hundreds of new issues.
// Will allow it only for uri resolvable sources.
if(strpos($item['mid'],'http') === 0) {
- $share = []; //Not yet ready for primetime
+ //Not yet ready for primetime
//$share = array( t('Repeat This'), t('repeat'));
}
- $embed = array( t('Share This'), t('share'));
+ $embed = [t('Share This'), t('share')];
}
$dreport = '';
@@ -349,11 +333,13 @@ class ThreadItem {
if($keep_reports === 0)
$keep_reports = 10;
+ $dreport_link = '';
if((intval($item['item_type']) == ITEM_TYPE_POST) && (! get_config('system','disable_dreport')) && strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC',"now - $keep_reports days")) > 0) {
$dreport = t('Delivery Report');
$dreport_link = gen_link_id($item['mid']);
}
+ $is_new = false;
if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
$is_new = true;
@@ -423,9 +409,6 @@ class ThreadItem {
'author_is_group_actor' => (($item['author']['xchan_pubforum']) ? t('Forum') : ''),
'isevent' => $isevent,
'attend' => $attend,
- 'consensus' => $consensus,
- 'conlabels' => $conlabels,
- 'canvote' => $canvote,
'linktitle' => (($item['author']['xchan_addr']) ? $item['author']['xchan_addr'] : $item['author']['xchan_url']),
'olinktitle' => (($item['owner']['xchan_addr']) ? $item['owner']['xchan_addr'] : $item['owner']['xchan_url']),
'llink' => $item['llink'],
@@ -494,7 +477,6 @@ class ThreadItem {
'bookmark' => (($conv->get_profile_owner() == local_channel() && local_channel() && $has_bookmarks) ? t('Save Bookmarks') : ''),
'addtocal' => (($has_event) ? t('Add to Calendar') : ''),
'drop' => $drop,
- 'multidrop' => ((feature_enabled($conv->get_profile_owner(),'multi_delete')) ? $multidrop : ''),
'dropdown_extras' => $dropdown_extras,
// end toolbar buttons
'unseen_comments' => $unseen_comments,
@@ -517,7 +499,7 @@ class ThreadItem {
'modal_dismiss' => t('Close'),
'showlike' => $showlike,
'showdislike' => $showdislike,
- 'comment' => ($item['item_delayed'] ? '' : $this->get_comment_box($indent)),
+ 'comment' => ($item['item_delayed'] ? '' : $this->get_comment_box()),
'previewing' => ($conv->is_preview() ? true : false ),
'preview_lbl' => t('This is an unsaved preview'),
'wait' => t('Please wait'),
@@ -811,7 +793,7 @@ class ThreadItem {
* _ The comment box string (empty if no comment box)
* _ false on failure
*/
- private function get_comment_box($indent) {
+ private function get_comment_box() {
if(!$this->is_toplevel() && !get_config('system','thread_allow')) {
return '';
@@ -857,7 +839,6 @@ class ThreadItem {
'$edurl' => t('Insert Link'),
'$edvideo' => t('Video'),
'$preview' => t('Preview'), // ((feature_enabled($conv->get_profile_owner(),'preview')) ? t('Preview') : ''),
- '$indent' => $indent,
'$can_upload' => (perm_is_allowed($conv->get_profile_owner(),get_observer_hash(),'write_storage') && $conv->is_uploadable()),
'$feature_encrypt' => ((feature_enabled($conv->get_profile_owner(),'content_encrypt')) ? true : false),
'$encrypt' => t('Encrypt text'),
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index aebc70c15..7ffc7cfb0 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -267,6 +267,7 @@ class Channel extends Controller {
'reset' => t('Reset form')
];
+ $a = '';
$o .= status_editor($a, $x, false, 'Channel');
}
diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php
index 120f7caeb..cd95ac4b0 100644
--- a/Zotlabs/Module/Hq.php
+++ b/Zotlabs/Module/Hq.php
@@ -48,6 +48,7 @@ class Hq extends \Zotlabs\Web\Controller {
$sys_item = false;
$sql_extra = '';
$target_item = null;
+ $o = '';
if($item_hash) {
@@ -101,7 +102,7 @@ class Hq extends \Zotlabs\Web\Controller {
];
$a = '';
- $o = status_editor($a, $x, true);
+ $o .= status_editor($a, $x, true);
}
diff --git a/Zotlabs/Photo/PhotoDriver.php b/Zotlabs/Photo/PhotoDriver.php
index f50ef17ae..7439ab401 100644
--- a/Zotlabs/Photo/PhotoDriver.php
+++ b/Zotlabs/Photo/PhotoDriver.php
@@ -421,30 +421,30 @@ abstract class PhotoDriver {
$p = [];
- $p['aid'] = ((intval($arr['aid'])) ? intval($arr['aid']) : 0);
- $p['uid'] = ((intval($arr['uid'])) ? intval($arr['uid']) : 0);
- $p['xchan'] = (($arr['xchan']) ? $arr['xchan'] : '');
- $p['resource_id'] = (($arr['resource_id']) ? $arr['resource_id'] : '');
- $p['filename'] = (($arr['filename']) ? $arr['filename'] : '');
- $p['mimetype'] = (($arr['mimetype']) ? $arr['mimetype'] : $this->getType());
- $p['album'] = (($arr['album']) ? $arr['album'] : '');
- $p['imgscale'] = ((intval($arr['imgscale'])) ? intval($arr['imgscale']) : 0);
- $p['allow_cid'] = (($arr['allow_cid']) ? $arr['allow_cid'] : '');
- $p['allow_gid'] = (($arr['allow_gid']) ? $arr['allow_gid'] : '');
- $p['deny_cid'] = (($arr['deny_cid']) ? $arr['deny_cid'] : '');
- $p['deny_gid'] = (($arr['deny_gid']) ? $arr['deny_gid'] : '');
- $p['edited'] = (($arr['edited']) ? $arr['edited'] : datetime_convert());
- $p['title'] = (($arr['title']) ? $arr['title'] : '');
- $p['description'] = (($arr['description']) ? $arr['description'] : '');
- $p['photo_usage'] = intval($arr['photo_usage']);
- $p['os_storage'] = intval($arr['os_storage']);
- $p['os_path'] = $arr['os_path'];
- $p['os_syspath'] = ((array_key_exists('os_syspath', $arr)) ? $arr['os_syspath'] : '');
- $p['display_path'] = (($arr['display_path']) ? $arr['display_path'] : '');
- $p['width'] = (($arr['width']) ? $arr['width'] : $this->getWidth());
- $p['height'] = (($arr['height']) ? $arr['height'] : $this->getHeight());
- $p['expires'] = (($arr['expires']) ? $arr['expires'] : gmdate('Y-m-d H:i:s', time() + get_config('system', 'photo_cache_time', 86400)));
- $p['profile'] = ((array_key_exists('profile', $arr)) ? intval($arr['profile']) : 0);
+ $p['aid'] = $arr['aid'] ?? 0;
+ $p['uid'] = $arr['uid'] ?? 0;
+ $p['xchan'] = $arr['xchan'] ?? '';
+ $p['resource_id'] = $arr['resource_id'] ?? '';
+ $p['filename'] = $arr['filename'] ?? '';
+ $p['mimetype'] = $arr['mimetype'] ?? $this->getType();
+ $p['album'] = $arr['album'] ?? '';
+ $p['imgscale'] = $arr['imgscale'] ?? 0;
+ $p['allow_cid'] = $arr['allow_cid'] ?? '';
+ $p['allow_gid'] = $arr['allow_gid'] ?? '';
+ $p['deny_cid'] = $arr['deny_cid'] ?? '';
+ $p['deny_gid'] = $arr['deny_gid'] ?? '';
+ $p['edited'] = $arr['edited'] ?? datetime_convert();
+ $p['title'] = $arr['title'] ?? '';
+ $p['description'] = $arr['description'] ?? '';
+ $p['photo_usage'] = $arr['photo_usage'] ?? PHOTO_NORMAL;
+ $p['os_storage'] = $arr['os_storage'] ?? 1;
+ $p['os_path'] = $arr['os_path'] ?? '';
+ $p['os_syspath'] = $arr['os_syspath'] ?? '';
+ $p['display_path'] = $arr['display_path'] ?? '';
+ $p['width'] = $arr['width'] ?? $this->getWidth();
+ $p['height'] = $arr['height'] ?? $this->getHeight();
+ $p['expires'] = $arr['expires'] ?? gmdate('Y-m-d H:i:s', time() + get_config('system', 'photo_cache_time', 86400));
+ $p['profile'] = $arr['profile'] ?? 0;
if(! intval($p['imgscale']))
logger('save: ' . print_r($arr, true), LOGGER_DATA);
@@ -452,7 +452,7 @@ abstract class PhotoDriver {
$x = q("select id, created from photo where resource_id = '%s' and uid = %d and xchan = '%s' and imgscale = %d limit 1", dbesc($p['resource_id']), intval($p['uid']), dbesc($p['xchan']), intval($p['imgscale']));
if($x) {
- $p['created'] = (($x['created']) ? $x['created'] : $p['edited']);
+ $p['created'] = $x['created'] ?? $p['edited'];
$r = q("UPDATE photo set
aid = %d,
uid = %d,
diff --git a/include/auth.php b/include/auth.php
index 8a83f16fe..4f4d26a6c 100644
--- a/include/auth.php
+++ b/include/auth.php
@@ -280,8 +280,8 @@ else {
// handle a fresh login request
- $password = $_POST['main_login_password'] ?? $_POST['modal_login_password'];
- $username = $_POST['main_login_username'] ?? $_POST['modal_login_username'];
+ $password = $_POST['main_login_password'] ?? $_POST['modal_login_password'] ?? '';
+ $username = $_POST['main_login_username'] ?? $_POST['modal_login_username'] ?? '';
if($password)
$encrypted = hash('whirlpool', trim($password));
diff --git a/include/bbcode.php b/include/bbcode.php
index 100991afd..6ec24fa0b 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -367,26 +367,30 @@ function bb_format_attachdata($body) {
if($data) {
$txt = '';
- if($data['url'] && $data['title']) {
+ if(isset($data['url']) && isset($data['title'])) {
$txt .= "\n\n" . '[url=' . $data['url'] . ']' . $data['title'] . '[/url]';
}
else {
- if($data['url']) {
+ if(isset($data['url'])) {
$txt .= "\n\n" . $data['url'];
}
- if($data['title']) {
+ if(isset($data['title'])) {
$txt .= "\n\n" . $data['title'];
}
}
- if($data['preview']) {
+
+ if(isset($data['preview'])) {
$txt .= "\n\n" . '[img]' . $data['preview'] . '[/img]';
}
- if($data['image']) {
+
+ if(isset($data['image'])) {
$txt .= "\n\n" . '[img]' . $data['image'] . '[/img]';
}
+ if(isset($data['text'])) {
+ $txt .= "\n\n" . $data['text'];
+ }
- $txt .= "\n\n" . $data['text'];
return preg_replace('/\[attachment(.*?)\](.*?)\[\/attachment\]/ism',$txt,$body);
}
diff --git a/include/channel.php b/include/channel.php
index 0d02dff1e..68e7fdf31 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -1433,10 +1433,10 @@ function profile_load($nickname, $profile = '') {
dbesc($p[0]['profile_guid']),
intval($p[0]['profile_uid'])
);
- if($q) {
- $extra_fields = array();
- require_once('include/channel.php');
+ $extra_fields = [];
+
+ if($q) {
$profile_fields_basic = get_profile_fields_basic();
$profile_fields_advanced = get_profile_fields_advanced();
@@ -1568,7 +1568,7 @@ function profile_edit_menu($uid) {
* @param array $profile
* @param int $block
* @param boolean $show_connect (optional) default true
- * @param mixed $zcard (optional) default false
+ * @param mixed $details (optional) default false
*
* @return string (HTML) suitable for sidebar inclusion
* Exceptions: Returns empty string if passed $profile is wrong type or not populated
@@ -1635,7 +1635,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $details =
// logger('online: ' . $profile['online']);
- if(($profile['hidewall'] && (! local_channel()) && (! remote_channel())) || $block ) {
+ if((isset($profile['hidewall']) && (! local_channel()) && (! remote_channel())) || $block ) {
$location = $reddress = $pdesc = $gender = $marital = $homepage = False;
}
@@ -1664,10 +1664,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $details =
$channel_menu .= $comanche->block($menublock);
}
- if($zcard)
- $tpl = get_markup_template('profile_vcard_short.tpl');
- else
- $tpl = get_markup_template('profile_vcard.tpl');
+ $tpl = get_markup_template('profile_vcard.tpl');
$o .= replace_macros($tpl, array(
'$details' => $details,
diff --git a/include/conversation.php b/include/conversation.php
index d450bc609..fe001a79d 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -165,7 +165,7 @@ function localize_item(&$item){
case 'Note':
default:
$post_type = t('post');
- if(($obj['parent'] && $obj['id'] != $obj['parent']) || $obj['inReplyTo'])
+ if(((isset($obj['parent']) && isset($obj['id']) && $obj['id'] != $obj['parent'])) || isset($obj['inReplyTo']))
$post_type = t('comment');
break;
}
@@ -567,15 +567,12 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
$page_writeable = ($profile_owner == local_channel());
if (!$update) {
- $tab = notags(trim((string)$_GET['tab']));
- if ($tab === 'posts') {
- // This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
- // because browser prefetching might change it on us. We have to deliver it with the page.
-
- $live_update_div = '<div id="live-channel"></div>' . "\r\n"
- . "<script> var profile_uid = " . App::$profile['profile_uid']
- . "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; </script>\r\n";
- }
+ // This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
+ // because browser prefetching might change it on us. We have to deliver it with the page.
+
+ $live_update_div = '<div id="live-channel"></div>' . "\r\n"
+ . "<script> var profile_uid = " . App::$profile['profile_uid']
+ . "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; </script>\r\n";
}
}
@@ -970,7 +967,7 @@ function best_link_url($item) {
$best_url = '';
$sparkle = false;
- $clean_url = normalise_link($item['author-link']);
+ $clean_url = isset($item['author-link']) ? normalise_link($item['author-link']) : '';
if((local_channel()) && (local_channel() == $item['uid'])) {
if(isset(App::$contacts) && x(App::$contacts,$clean_url)) {
@@ -1071,6 +1068,8 @@ function thread_author_menu($item, $mode = '') {
$profile_link = chanlink_hash($item['author_xchan']);
$contact = false;
+ $follow_url = '';
+
if($channel['channel_hash'] !== $item['author_xchan']) {
if(App::$contacts && array_key_exists($item['author_xchan'],App::$contacts)) {
$contact = App::$contacts[$item['author_xchan']];
@@ -1083,19 +1082,18 @@ function thread_author_menu($item, $mode = '') {
}
}
+
+ $contact_url = '';
+ $posts_link = '';
+ $poke_link = '';
+
if($contact) {
$poke_link = ((Apps::system_app_installed($local_channel, 'Poke')) ? z_root() . '/poke/?f=&c=' . $contact['abook_id'] : '');
- if (! intval($contact['abook_self']))
+ if (isset($contact['abook_self']) && !intval($contact['abook_self']))
$contact_url = z_root() . '/connections#' . $contact['abook_id'];
$posts_link = z_root() . '/network/?cid=' . $contact['abook_id'];
-
- $clean_url = normalise_link($item['author-link']);
}
- $rating_enabled = get_config('system','rating_enabled');
-
- $ratings_url = (($rating_enabled) ? z_root() . '/ratings/' . urlencode($item['author_xchan']) : '');
-
if($profile_link) {
$menu[] = [
'menu' => 'view_profile',
@@ -1144,30 +1142,6 @@ function thread_author_menu($item, $mode = '') {
];
}
- if($pm_url) {
- $menu[] = [
- 'menu' => 'prv_message',
- 'title' => t('Message'),
- 'icon' => 'fw',
- 'action' => '',
- 'href' => $pm_url,
- 'data' => '',
- 'class' => ''
- ];
- }
-
- if($ratings_url) {
- $menu[] = [
- 'menu' => 'ratings',
- 'title' => t('Ratings'),
- 'icon' => 'fw',
- 'action' => '',
- 'href' => $ratings_url,
- 'data' => '',
- 'class' => ''
- ];
- }
-
if($poke_link) {
$menu[] = [
'menu' => 'poke',
@@ -1766,11 +1740,11 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) {
$ret = array();
foreach($response_verbs as $v) {
- $ret[$v] = array();
- $ret[$v]['count'] = ((x($conv_responses[$v],$item['mid'])) ? $conv_responses[$v][$item['mid']] : 0);
- $ret[$v]['list'] = ((x($conv_responses[$v],$item['mid'])) ? $conv_responses[$v][$item['mid'] . '-l'] : '');
- $ret[$v]['button'] = get_response_button_text($v,$ret[$v]['count']);
- $ret[$v]['title'] = $conv_responses[$v]['title'];
+ $ret[$v] = [];
+ $ret[$v]['count'] = $conv_responses[$v][$item['mid']] ?? 0;
+ $ret[$v]['list'] = ((isset($conv_responses[$v][$item['mid']])) ? $conv_responses[$v][$item['mid'] . '-l'] : '');
+ $ret[$v]['button'] = get_response_button_text($v, $ret[$v]['count']);
+ $ret[$v]['title'] = $conv_responses[$v]['title'] ?? '';
$ret[$v]['modal'] = (($ret[$v]['count'] > MAX_LIKERS) ? true : false);
}
diff --git a/include/text.php b/include/text.php
index 0c806d009..87aaf7bf8 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1554,6 +1554,8 @@ function theme_attachments(&$item) {
if(isset($r['type']))
$icon = getIconFromType($r['type']);
+ $label = '';
+
if(isset($r['title']))
$label = urldecode(htmlspecialchars($r['title'], ENT_COMPAT, 'UTF-8'));
@@ -1593,7 +1595,7 @@ function theme_attachments(&$item) {
function format_categories(&$item,$writeable) {
$s = '';
- $terms = get_terms_oftype($item['term'],TERM_CATEGORY);
+ $terms = isset($item['term']) ? get_terms_oftype($item['term'], TERM_CATEGORY) : [];
if($terms) {
$categories = array();
foreach($terms as $t) {
@@ -1623,7 +1625,7 @@ function format_categories(&$item,$writeable) {
function format_hashtags(&$item) {
$s = '';
- $terms = get_terms_oftype($item['term'], array(TERM_HASHTAG,TERM_COMMUNITYTAG));
+ $terms = isset($item['term']) ? get_terms_oftype($item['term'], array(TERM_HASHTAG, TERM_COMMUNITYTAG)) : [];
if($terms) {
foreach($terms as $t) {
$term = htmlspecialchars($t['term'], ENT_COMPAT, 'UTF-8', false) ;
@@ -1647,7 +1649,7 @@ function format_hashtags(&$item) {
function format_mentions(&$item) {
$s = '';
- $terms = get_terms_oftype($item['term'],TERM_MENTION);
+ $terms = isset($item['term']) ? get_terms_oftype($item['term'], TERM_MENTION) : [];
if($terms) {
foreach($terms as $t) {
if(! isset($t['term']))
@@ -1670,7 +1672,7 @@ function format_mentions(&$item) {
function format_filer(&$item) {
$s = '';
- $terms = get_terms_oftype($item['term'],TERM_FILE);
+ $terms = isset($item['term']) ? get_terms_oftype($item['term'], TERM_FILE) : [];
if($terms) {
$categories = array();
foreach($terms as $t) {
@@ -1789,14 +1791,15 @@ function prepare_body(&$item,$attach = false,$opts = false) {
$s = $poll;
}
- $event = (($item['obj_type'] === ACTIVITY_OBJ_EVENT) ? format_event_obj($item['obj']) : false);
+ $event = (($item['obj_type'] === ACTIVITY_OBJ_EVENT) ? format_event_obj($item['obj']) : []);
$prep_arr = [
'item' => $item,
'html' => $event ? $event['content'] : $s,
- 'event' => $event['header'],
+ 'event' => $event ? $event['header'] : '',
'photo' => $photo
];
+
/**
* @hooks prepare_body
* * \e array \b item
@@ -1827,6 +1830,7 @@ function prepare_body(&$item,$attach = false,$opts = false) {
$tags = format_hashtags($item);
+ $mentions = '';
if($item['resource_type'] == 'photo')
$mentions = format_mentions($item);