$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;
// 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;
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())
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
$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'));
$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");
}
// 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';
$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);
}