diff options
author | Mario <mario@mariovavti.com> | 2022-10-20 13:16:03 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-10-20 13:16:03 +0000 |
commit | bf434818d7cfac6bf29482d4bb07fc567de2fc90 (patch) | |
tree | fc50a3cafce38134d758767caec1ffea8da8fdcf /Zotlabs | |
parent | 03aeb888322e792ccb17593761f1f93ad2906c7e (diff) | |
download | volse-hubzilla-bf434818d7cfac6bf29482d4bb07fc567de2fc90.tar.gz volse-hubzilla-bf434818d7cfac6bf29482d4bb07fc567de2fc90.tar.bz2 volse-hubzilla-bf434818d7cfac6bf29482d4bb07fc567de2fc90.zip |
fix php warnings
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Lib/Activity.php | 8 | ||||
-rw-r--r-- | Zotlabs/Lib/Enotify.php | 6 | ||||
-rw-r--r-- | Zotlabs/Module/Channel_calendar.php | 18 | ||||
-rw-r--r-- | Zotlabs/Module/Dreport.php | 1 | ||||
-rw-r--r-- | Zotlabs/Module/Editpost.php | 21 | ||||
-rw-r--r-- | Zotlabs/Module/Permcats.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Siteinfo.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Tokens.php | 8 | ||||
-rw-r--r-- | Zotlabs/Web/HTTPSig.php | 2 | ||||
-rw-r--r-- | Zotlabs/Widget/Permcats.php | 5 | ||||
-rw-r--r-- | Zotlabs/Zot6/Receiver.php | 2 |
11 files changed, 39 insertions, 36 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index d80394c7b..8380e2287 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -1600,9 +1600,9 @@ class Activity { // we already store this in Activity::fetch() // XConfig::Set($url, 'system', 'actor_record', $person_obj); - $name = $person_obj['name']; + $name = $person_obj['name'] ?? ''; if (!$name) { - $name = $person_obj['preferredUsername']; + $name = $person_obj['preferredUsername'] ?? ''; } if (!$name) { $name = t('Unknown'); @@ -1644,7 +1644,7 @@ class Activity { $links = false; $profile = false; - if (is_array($person_obj['url'])) { + if (isset($person_obj['url']) && is_array($person_obj['url'])) { if (!array_key_exists(0, $person_obj['url'])) { $links = [$person_obj['url']]; } @@ -1653,7 +1653,7 @@ class Activity { } } - if ($links) { + if (is_array($links) && $links) { foreach ($links as $link) { if (is_array($link) && array_key_exists('mediaType', $link) && $link['mediaType'] === 'text/html') { $profile = $link['href']; diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index 5a09ade90..513f4ae14 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -499,6 +499,7 @@ class Enotify { $datarray['verb'] = $params['verb']; $datarray['otype'] = $params['otype']; $datarray['abort'] = false; + $datarray['seen'] = 0; $datarray['item'] = $params['item']; @@ -511,7 +512,6 @@ class Enotify { // create notification entry in DB - $seen = 0; // Mark some notifications as seen right away // Note! The notification have to be created, because they are used to send emails @@ -521,7 +521,7 @@ class Enotify { if (!$always_show_in_notices) { if (($params['type'] === NOTIFY_WALL) || ($params['type'] === NOTIFY_MAIL) || ($params['type'] === NOTIFY_INTRO)) { - $seen = 1; + $datarray['seen'] = 1; } } @@ -537,7 +537,7 @@ class Enotify { intval($datarray['uid']), dbesc($datarray['link']), dbesc($datarray['parent']), - intval($seen), + intval($datarray['seen']), intval($datarray['ntype']), dbesc($datarray['verb']), dbesc($datarray['otype']) diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index 26c6aaf40..289e3a734 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -30,7 +30,7 @@ class Channel_calendar extends Controller { $xchan = ((x($_POST, 'xchan')) ? dbesc($_POST['xchan']) : ''); - // only allow editing your own events. + // only allow editing your own events. if (($xchan) && ($xchan !== get_observer_hash())) return; @@ -55,8 +55,8 @@ class Channel_calendar extends Controller { // Don't allow the event to finish before it begins. // It won't hurt anything, but somebody will file a bug report - // and we'll waste a bunch of time responding to it. Time that - // could've been spent doing something else. + // and we'll waste a bunch of time responding to it. Time that + // could've been spent doing something else. if (strcmp($finish, $start) < 0) { notice(t('Event can not end before it has started.') . EOL); @@ -319,12 +319,12 @@ class Channel_calendar extends Controller { // fixed an issue with "nofinish" events not showing up in the calendar. // There's still an issue if the finish date crosses the end of month. // Noting this for now - it will need to be fixed here and in Friendica. - // Ultimately the finish date shouldn't be involved in the query. + // Ultimately the finish date shouldn't be involved in the query. $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan, item.id as item_id - from event left join item on event.event_hash = item.resource_id - where item.resource_type = 'event' and event.uid = %d and event.uid = item.uid $ignored - AND (( event.adjust = 0 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' ) + from event left join item on event.event_hash = item.resource_id + where item.resource_type = 'event' and event.uid = %d and event.uid = item.uid $ignored + AND (( event.adjust = 0 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' ) OR ( event.adjust = 1 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' )) ", intval(local_channel()), dbesc($start), @@ -357,7 +357,7 @@ class Channel_calendar extends Controller { $catsenabled = feature_enabled(local_channel(), 'categories'); $categories = ''; if ($catsenabled) { - if ($rr['term']) { + if (isset($rr['term']) && $rr['term']) { $cats = get_terms_oftype($rr['term'], TERM_CATEGORY); foreach ($cats as $cat) { if (strlen($categories)) @@ -449,7 +449,7 @@ class Channel_calendar extends Controller { } // The site admin can delete any post/item on the site. - // If the item originated on this site+channel the deletion will propagate downstream. + // If the item originated on this site+channel the deletion will propagate downstream. // Otherwise just the local copy is removed. if (is_site_admin()) { diff --git a/Zotlabs/Module/Dreport.php b/Zotlabs/Module/Dreport.php index d6f4e5979..759e1acb4 100644 --- a/Zotlabs/Module/Dreport.php +++ b/Zotlabs/Module/Dreport.php @@ -94,6 +94,7 @@ class Dreport extends \Zotlabs\Web\Controller { case 'updated': $r[$x]['gravity'] = 5; $r[$x]['dreport_result'] = t('updated'); + break; case 'update ignored': $r[$x]['gravity'] = 6; $r[$x]['dreport_result'] = t('update ignored'); diff --git a/Zotlabs/Module/Editpost.php b/Zotlabs/Module/Editpost.php index c6cfc6dc4..b21c58af2 100644 --- a/Zotlabs/Module/Editpost.php +++ b/Zotlabs/Module/Editpost.php @@ -57,15 +57,17 @@ class Editpost extends \Zotlabs\Web\Controller { $catsenabled = ((feature_enabled($owner_uid,'categories')) ? 'categories' : ''); if ($catsenabled){ - $itm = fetch_post_tags($itm); - - $cats = get_terms_oftype($itm[0]['term'], TERM_CATEGORY); - - foreach ($cats as $cat) { - if (strlen($category)) - $category .= ', '; - $category .= $cat['term']; - } + $itm = fetch_post_tags($itm); + if (isset($itm[0]['term'])) { + $cats = get_terms_oftype($itm[0]['term'], TERM_CATEGORY); + if ($cats) { + foreach ($cats as $cat) { + if (strlen($category)) + $category .= ', '; + $category .= $cat['term']; + } + } + } } if($itm[0]['attach']) { @@ -104,6 +106,7 @@ class Editpost extends \Zotlabs\Web\Controller { 'bbcode' => true ); + $a = ''; $editor = status_editor($a, $x, false, 'Editpost'); $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( diff --git a/Zotlabs/Module/Permcats.php b/Zotlabs/Module/Permcats.php index d42e45beb..a9ba6dc18 100644 --- a/Zotlabs/Module/Permcats.php +++ b/Zotlabs/Module/Permcats.php @@ -213,7 +213,7 @@ class Permcats extends Controller { $thisperm = Permcat::find_permcat($existing, $k); $checkinherited = PermissionLimits::Get(local_channel(), $k); - if ($existing[$k]) + if (isset($existing[$k]) && $existing[$k]) $thisperm = 1; $perms[] = [ diff --git a/Zotlabs/Module/Siteinfo.php b/Zotlabs/Module/Siteinfo.php index be6862c6b..ac33747f8 100644 --- a/Zotlabs/Module/Siteinfo.php +++ b/Zotlabs/Module/Siteinfo.php @@ -5,7 +5,7 @@ namespace Zotlabs\Module; class Siteinfo extends \Zotlabs\Web\Controller { function init() { - if (argv(1) === 'json' || $_REQUEST['module_format'] === 'json') { + if (argv(1) === 'json' || (isset($_REQUEST['module_format']) && $_REQUEST['module_format'] === 'json')) { $data = get_site_info(); json_return_and_die($data); } diff --git a/Zotlabs/Module/Tokens.php b/Zotlabs/Module/Tokens.php index a41003f6b..701f29c19 100644 --- a/Zotlabs/Module/Tokens.php +++ b/Zotlabs/Module/Tokens.php @@ -282,15 +282,15 @@ class Tokens extends Controller { } $tpl = get_markup_template("tokens.tpl"); - $o .= replace_macros($tpl, array( + $o = replace_macros($tpl, array( '$form_security_token' => get_form_security_token('tokens'), '$permcat' => ['permcat', t('Select a role for this guest'), $current_permcat, '', $permcats], '$title' => t('Guest Access'), '$desc' => $desc, '$atoken' => $atoken, - '$name' => array('name', t('Login Name') . ' <span class="required">*</span>', (($atoken) ? $atoken['atoken_name'] : ''),''), - '$token'=> array('token', t('Login Password') . ' <span class="required">*</span>',(($atoken) ? $atoken['atoken_token'] : new_token()), ''), - '$expires'=> array('expires', t('Expires (yyyy-mm-dd)'), (($atoken['atoken_expires'] && $atoken['atoken_expires'] > NULL_DATE) ? datetime_convert('UTC',date_default_timezone_get(),$atoken['atoken_expires']) : ''), ''), + '$name' => array('name', t('Login Name') . ' <span class="required">*</span>', $atoken['atoken_name'] ?? '',''), + '$token'=> array('token', t('Login Password') . ' <span class="required">*</span>', $atoken['atoken_token'] ?? new_token(), ''), + '$expires'=> array('expires', t('Expires (yyyy-mm-dd)'), ((isset($atoken['atoken_expires']) && $atoken['atoken_expires'] > NULL_DATE) ? datetime_convert('UTC',date_default_timezone_get(),$atoken['atoken_expires']) : ''), ''), '$submit' => t('Submit'), '$delete' => t('Delete') )); diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php index c831acda4..9ff0267c3 100644 --- a/Zotlabs/Web/HTTPSig.php +++ b/Zotlabs/Web/HTTPSig.php @@ -207,7 +207,7 @@ class HTTPSig { $key = (($fetched_key) ? $fetched_key : $cached_key); - $result['portable_id'] = $key['portable_id']; + $result['portable_id'] = $key['portable_id'] ?? ''; $result['header_valid'] = true; if (in_array('digest', $signed_headers)) { diff --git a/Zotlabs/Widget/Permcats.php b/Zotlabs/Widget/Permcats.php index 9226b3c71..9bda5b8f1 100644 --- a/Zotlabs/Widget/Permcats.php +++ b/Zotlabs/Widget/Permcats.php @@ -24,6 +24,7 @@ class Permcats { $roles = []; $active_role = ''; + $members = []; foreach($pcatlist as $pc) { if (!$active_role) { @@ -76,8 +77,6 @@ class Permcats { dbesc($active_role) ); - $members = []; - foreach ($r as $rr) { $members[] = [ 'name' => $rr['xchan_name'], @@ -89,7 +88,7 @@ class Permcats { } $tpl = get_markup_template("permcats_widget.tpl"); - $o .= replace_macros($tpl, [ + $o = replace_macros($tpl, [ '$roles_label' => t('Contact roles'), '$members_label' => t('Role members'), '$roles' => $roles, diff --git a/Zotlabs/Zot6/Receiver.php b/Zotlabs/Zot6/Receiver.php index 78661865e..b276cbe31 100644 --- a/Zotlabs/Zot6/Receiver.php +++ b/Zotlabs/Zot6/Receiver.php @@ -81,7 +81,7 @@ class Receiver { } else { $this->error = true; - $this->response['message'] = 'no data'; + $this->response['message'] = 'no data (decryption failed)'; } } } |