From 540efef63ebee72853be4f79a0cf689b62bcc339 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Fri, 28 Dec 2018 21:39:23 +0100 Subject: active angels: Bugfix and prevent errors when searching double spaces --- includes/pages/admin_active.php | 6 ++++-- includes/pages/admin_free.php | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'includes/pages') diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php index 20f11a31..c2f36693 100644 --- a/includes/pages/admin_active.php +++ b/includes/pages/admin_active.php @@ -168,7 +168,7 @@ function admin_active() ->leftJoin('Shifts', function ($join) use ($show_all_shifts) { /** @var JoinClause $join */ $join->on('ShiftEntry.SID', '=', 'Shifts.SID'); - if ($show_all_shifts) { + if (!$show_all_shifts) { $join->where(function ($query) { /** @var Builder $query */ $query->where('Shifts.end', '<', time()) @@ -187,6 +187,7 @@ function admin_active() $query->limit($count); } + /** @var User[] $users */ $users = $query->get(); $matched_users = []; if ($search == '') { @@ -198,7 +199,8 @@ function admin_active() if (count($tokens) > 0) { $match = false; foreach ($tokens as $t) { - if (stristr($usr->name, trim($t))) { + $t = trim($t); + if (!empty($t) && stristr($usr->name, $t)) { $match = true; break; } diff --git a/includes/pages/admin_free.php b/includes/pages/admin_free.php index f666b077..d2facbc8 100644 --- a/includes/pages/admin_free.php +++ b/includes/pages/admin_free.php @@ -72,7 +72,8 @@ function admin_free() $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; } -- cgit v1.2.3-54-g00ecf