From bf434818d7cfac6bf29482d4bb07fc567de2fc90 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 20 Oct 2022 13:16:03 +0000 Subject: fix php warnings --- Zotlabs/Module/Channel_calendar.php | 18 +++++++++--------- Zotlabs/Module/Dreport.php | 1 + Zotlabs/Module/Editpost.php | 21 ++++++++++++--------- Zotlabs/Module/Permcats.php | 2 +- Zotlabs/Module/Siteinfo.php | 2 +- Zotlabs/Module/Tokens.php | 8 ++++---- 6 files changed, 28 insertions(+), 24 deletions(-) (limited to 'Zotlabs/Module') 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') . ' *', (($atoken) ? $atoken['atoken_name'] : ''),''), - '$token'=> array('token', t('Login Password') . ' *',(($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') . ' *', $atoken['atoken_name'] ?? '',''), + '$token'=> array('token', t('Login Password') . ' *', $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') )); -- cgit v1.2.3