From d7c148fa8943fcd341e341a4cdbe8fc0d78768f9 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Wed, 20 Jul 2022 19:08:51 +0200 Subject: [PATCH] Allow more characters for room names --- includes/pages/admin_rooms.php | 4 ++-- includes/sys_page.php | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/includes/pages/admin_rooms.php b/includes/pages/admin_rooms.php index b6f13ceb..653d633a 100644 --- a/includes/pages/admin_rooms.php +++ b/includes/pages/admin_rooms.php @@ -75,8 +75,8 @@ function admin_rooms() if ($request->hasPostData('submit')) { $valid = true; - if ($request->has('name') && strlen(strip_request_item('name')) > 0) { - $result = Room_validate_name(strip_request_item('name'), $room_id); + if ($request->has('name') && strlen(strip_request_tags('name')) > 0) { + $result = Room_validate_name(strip_request_tags('name'), $room_id); if (!$result->isValid()) { $valid = false; $msg .= error(__('This name is already in use.'), true); diff --git a/includes/sys_page.php b/includes/sys_page.php index 4597caaa..5b1295f4 100644 --- a/includes/sys_page.php +++ b/includes/sys_page.php @@ -185,6 +185,23 @@ function strip_request_item($name, $default_value = null) return $default_value; } +/** + * Returns REQUEST value or default value (null) if not set. + * + * @param string $name + * @param string|null $default_value + * @return mixed|null + */ +function strip_request_tags($name, $default_value = null) +{ + $request = request(); + if ($request->has($name)) { + return strip_tags($request->input($name)); + } + + return $default_value; +} + /** * Testet, ob der angegebene REQUEST Wert ein Integer ist, bzw. * eine ID sein könnte.