From 36830c43e7cd1bf277564a60ef1dcc7c69b7ea9c Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Wed, 26 Dec 2018 19:39:40 +0100 Subject: Fix warning if searching two whitespaces and formatting --- includes/pages/admin_arrive.php | 4 +++- includes/pages/admin_shifts.php | 32 ++++++++++++++++---------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/includes/pages/admin_arrive.php b/includes/pages/admin_arrive.php index 90f939fb..aedb0803 100644 --- a/includes/pages/admin_arrive.php +++ b/includes/pages/admin_arrive.php @@ -79,11 +79,13 @@ function admin_arrive() $match = false; $index = join(' ', $usr->toArray()); foreach ($tokens as $t) { - if (stristr($index, trim($t))) { + $t = trim($t); + if (!empty($t) && stristr($index, $t)) { $match = true; break; } } + if (!$match) { continue; } diff --git a/includes/pages/admin_shifts.php b/includes/pages/admin_shifts.php index 51167bc4..8ef713a1 100644 --- a/includes/pages/admin_shifts.php +++ b/includes/pages/admin_shifts.php @@ -183,10 +183,10 @@ function admin_shifts() $shifts = []; if ($mode == 'single') { $shifts[] = [ - 'start' => $start, - 'end' => $end, - 'RID' => $rid, - 'title' => $title, + 'start' => $start, + 'end' => $end, + 'RID' => $rid, + 'title' => $title, 'shifttype_id' => $shifttype_id ]; } elseif ($mode == 'multi') { @@ -202,10 +202,10 @@ function admin_shifts() } $shifts[] = [ - 'start' => $shift_start, - 'end' => $shift_end, - 'RID' => $rid, - 'title' => $title, + 'start' => $shift_start, + 'end' => $shift_end, + 'RID' => $rid, + 'title' => $title, 'shifttype_id' => $shifttype_id ]; @@ -261,10 +261,10 @@ function admin_shifts() } $shifts[] = [ - 'start' => $shift_start, - 'end' => $shift_end, - 'RID' => $rid, - 'title' => $title, + 'start' => $shift_start, + 'end' => $shift_end, + 'RID' => $rid, + 'title' => $title, 'shifttype_id' => $shifttype_id ]; @@ -276,14 +276,14 @@ function admin_shifts() $shifts_table = []; foreach ($shifts as $shift) { $shifts_table_entry = [ - 'timeslot' => + 'timeslot' => ' ' . date('Y-m-d H:i', $shift['start']) . ' - ' . date('H:i', $shift['end']) . '
' . Room_name_render(Room($shift['RID'])), - 'title' => + 'title' => ShiftType_name_render(ShiftType($shifttype_id)) . ($shift['title'] ? '
' . $shift['title'] : ''), 'needed_angels' => '' @@ -319,8 +319,8 @@ function admin_shifts() form_hidden('angelmode', $angelmode), form_submit('back', __('back')), table([ - 'timeslot' => __('Time and location'), - 'title' => __('Type and title'), + 'timeslot' => __('Time and location'), + 'title' => __('Type and title'), 'needed_angels' => __('Needed angels') ], $shifts_table), form_submit('submit', __('Save')) -- cgit v1.2.3-54-g00ecf