From 821429fdf13ca1bcd442b389d390287921b65e0b Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 4 Sep 2018 17:48:09 +0000 Subject: [PATCH] Good news, everyone - again somce notices removed --- mod/events.php | 18 ++++++++++-------- mod/notifications.php | 11 ++++------- mod/unfollow.php | 2 +- src/App.php | 6 +++++- src/Util/HTTPSignature.php | 2 ++ 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/mod/events.php b/mod/events.php index 91474022fc..21cf70d20f 100644 --- a/mod/events.php +++ b/mod/events.php @@ -54,11 +54,11 @@ function events_post(App $a) { $cid = (x($_POST, 'cid') ? intval($_POST['cid']) : 0); $uid = local_user(); - $start_text = escape_tags($_REQUEST['start_text']); - $finish_text = escape_tags($_REQUEST['finish_text']); + $start_text = escape_tags(defaults($_REQUEST, 'start_text', '')); + $finish_text = escape_tags(defaults($_REQUEST, 'finish_text', '')); - $adjust = intval($_POST['adjust']); - $nofinish = intval($_POST['nofinish']); + $adjust = intval(defaults($_POST, 'adjust', 0)); + $nofinish = intval(defaults($_POST, 'nofinish', 0)); // The default setting for the `private` field in event_store() is false, so mirror that $private_event = false; @@ -91,9 +91,9 @@ function events_post(App $a) { // and we'll waste a bunch of time responding to it. Time that // could've been spent doing something else. - $summary = escape_tags(trim($_POST['summary'])); - $desc = escape_tags(trim($_POST['desc'])); - $location = escape_tags(trim($_POST['location'])); + $summary = escape_tags(trim(defaults($_POST, 'summary', ''))); + $desc = escape_tags(trim(defaults($_POST, 'desc', ''))); + $location = escape_tags(trim(defaults($_POST, 'location', ''))); $type = 'event'; $action = ($event_id == '') ? 'new' : "event/" . $event_id; @@ -117,7 +117,7 @@ function events_post(App $a) { goaway($onerror_url); } - $share = (intval($_POST['share']) ? intval($_POST['share']) : 0); + $share = intval(defaults($_POST, 'share', 0)); $c = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1", intval(local_user()) @@ -484,6 +484,8 @@ function events_content(App $a) { if ($mode === 'new' || $mode === 'copy') { $acl = ($cid ? '' : ACL::getFullSelectorHTML($a->user, false, $orig_event)); + } else { + $acl = ''; } // If we copy an old event, we need to remove the ID and URI diff --git a/mod/notifications.php b/mod/notifications.php index bc581b6dd3..091323d998 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -87,10 +87,11 @@ function notifications_content(App $a) $perpage = 20; $startrec = ($page * $perpage) - $perpage; + $notif_header = L10n::t('Notifications'); + // Get introductions if ((($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) { Nav::setSelected('introductions'); - $notif_header = L10n::t('Notifications'); $all = (($a->argc > 2) && ($a->argv[2] == 'all')); @@ -132,12 +133,8 @@ function notifications_content(App $a) $notif_tpl = get_markup_template('notifications.tpl'); - if (!isset($notifs['ident'])) { - logger('Missing data in notifs: ' . json_encode($a->argv), LOGGER_DEBUG); - } - // Process the data for template creation - if ($notifs['ident'] === 'introductions') { + if (defaults($notifs, 'ident', '') === 'introductions') { $sugg = get_markup_template('suggestions.tpl'); $tpl = get_markup_template("intros.tpl"); @@ -280,7 +277,7 @@ function notifications_content(App $a) } // Normal notifications (no introductions) - } else { + } elseif (!empty($notifs['notifications'])) { // The template files we need in different cases for formatting the content $tpl_item_like = 'notifications_likes_item.tpl'; $tpl_item_dislike = 'notifications_dislikes_item.tpl'; diff --git a/mod/unfollow.php b/mod/unfollow.php index 0af16ec671..956b6fbdb7 100644 --- a/mod/unfollow.php +++ b/mod/unfollow.php @@ -22,7 +22,7 @@ function unfollow_post() // NOTREACHED } - if ($_REQUEST['cancel']) { + if (!empty($_REQUEST['cancel'])) { goaway($return_url); } diff --git a/src/App.php b/src/App.php index 2a5fba8541..488c2301b6 100644 --- a/src/App.php +++ b/src/App.php @@ -1074,7 +1074,11 @@ class App $meminfo = []; foreach ($memdata as $line) { - list($key, $val) = explode(':', $line); + $data = explode(':', $line); + if (count($data) != 2) { + continue; + } + list($key, $val) = $data; $meminfo[$key] = (int) trim(str_replace('kB', '', $val)); $meminfo[$key] = (int) ($meminfo[$key] / 1024); } diff --git a/src/Util/HTTPSignature.php b/src/Util/HTTPSignature.php index f88b0423c5..911de4308e 100644 --- a/src/Util/HTTPSignature.php +++ b/src/Util/HTTPSignature.php @@ -125,6 +125,8 @@ class HTTPSignature $key = $key($sig_block['keyId']); } + logger('Got keyID ' . $sig_block['keyId']); + // We don't use Activity Pub at the moment. // if (!$key) { // $result['signer'] = $sig_block['keyId'];