diff options
author | Mario <mario@mariovavti.com> | 2022-09-08 20:02:22 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-09-08 20:02:22 +0000 |
commit | 990a3af2a7349e07c10224cf2a023d179ecfd6ca (patch) | |
tree | 75c6f7bcb2f7d630a3fc5395e7f3480541e4fe25 /Zotlabs | |
parent | 1f5a23143aa5aa1fb3273b8a9c74782cd0441fde (diff) | |
download | volse-hubzilla-990a3af2a7349e07c10224cf2a023d179ecfd6ca.tar.gz volse-hubzilla-990a3af2a7349e07c10224cf2a023d179ecfd6ca.tar.bz2 volse-hubzilla-990a3af2a7349e07c10224cf2a023d179ecfd6ca.zip |
php8: random cleanup and warning fixes
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Lib/Enotify.php | 4 | ||||
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 6 | ||||
-rw-r--r-- | Zotlabs/Lib/ThreadItem.php | 43 | ||||
-rw-r--r-- | Zotlabs/Module/Channel.php | 1 | ||||
-rw-r--r-- | Zotlabs/Module/Hq.php | 3 | ||||
-rw-r--r-- | Zotlabs/Photo/PhotoDriver.php | 50 |
6 files changed, 48 insertions, 59 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, |