Fix warning if searching two whitespaces and formatting

This commit is contained in:
Igor Scheller 2018-12-26 19:39:40 +01:00
parent 26f58b8156
commit 36830c43e7
2 changed files with 19 additions and 17 deletions

View File

@ -79,11 +79,13 @@ function admin_arrive()
$match = false; $match = false;
$index = join(' ', $usr->toArray()); $index = join(' ', $usr->toArray());
foreach ($tokens as $t) { foreach ($tokens as $t) {
if (stristr($index, trim($t))) { $t = trim($t);
if (!empty($t) && stristr($index, $t)) {
$match = true; $match = true;
break; break;
} }
} }
if (!$match) { if (!$match) {
continue; continue;
} }

View File

@ -183,10 +183,10 @@ function admin_shifts()
$shifts = []; $shifts = [];
if ($mode == 'single') { if ($mode == 'single') {
$shifts[] = [ $shifts[] = [
'start' => $start, 'start' => $start,
'end' => $end, 'end' => $end,
'RID' => $rid, 'RID' => $rid,
'title' => $title, 'title' => $title,
'shifttype_id' => $shifttype_id 'shifttype_id' => $shifttype_id
]; ];
} elseif ($mode == 'multi') { } elseif ($mode == 'multi') {
@ -202,10 +202,10 @@ function admin_shifts()
} }
$shifts[] = [ $shifts[] = [
'start' => $shift_start, 'start' => $shift_start,
'end' => $shift_end, 'end' => $shift_end,
'RID' => $rid, 'RID' => $rid,
'title' => $title, 'title' => $title,
'shifttype_id' => $shifttype_id 'shifttype_id' => $shifttype_id
]; ];
@ -261,10 +261,10 @@ function admin_shifts()
} }
$shifts[] = [ $shifts[] = [
'start' => $shift_start, 'start' => $shift_start,
'end' => $shift_end, 'end' => $shift_end,
'RID' => $rid, 'RID' => $rid,
'title' => $title, 'title' => $title,
'shifttype_id' => $shifttype_id 'shifttype_id' => $shifttype_id
]; ];
@ -276,14 +276,14 @@ function admin_shifts()
$shifts_table = []; $shifts_table = [];
foreach ($shifts as $shift) { foreach ($shifts as $shift) {
$shifts_table_entry = [ $shifts_table_entry = [
'timeslot' => 'timeslot' =>
'<span class="glyphicon glyphicon-time"></span> ' '<span class="glyphicon glyphicon-time"></span> '
. date('Y-m-d H:i', $shift['start']) . date('Y-m-d H:i', $shift['start'])
. ' - ' . ' - '
. date('H:i', $shift['end']) . date('H:i', $shift['end'])
. '<br />' . '<br />'
. Room_name_render(Room($shift['RID'])), . Room_name_render(Room($shift['RID'])),
'title' => 'title' =>
ShiftType_name_render(ShiftType($shifttype_id)) ShiftType_name_render(ShiftType($shifttype_id))
. ($shift['title'] ? '<br />' . $shift['title'] : ''), . ($shift['title'] ? '<br />' . $shift['title'] : ''),
'needed_angels' => '' 'needed_angels' => ''
@ -319,8 +319,8 @@ function admin_shifts()
form_hidden('angelmode', $angelmode), form_hidden('angelmode', $angelmode),
form_submit('back', __('back')), form_submit('back', __('back')),
table([ table([
'timeslot' => __('Time and location'), 'timeslot' => __('Time and location'),
'title' => __('Type and title'), 'title' => __('Type and title'),
'needed_angels' => __('Needed angels') 'needed_angels' => __('Needed angels')
], $shifts_table), ], $shifts_table),
form_submit('submit', __('Save')) form_submit('submit', __('Save'))