From 2a4939bbd5ef66bd3698f3f880a063747272e1fd Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sat, 4 Nov 2023 11:54:04 +0100 Subject: [PATCH] code review --- src/FrontendTemplate.php | 2 +- src/Manage.php | 2 +- src/Utils.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/FrontendTemplate.php b/src/FrontendTemplate.php index ebdbbb2..12fe70e 100644 --- a/src/FrontendTemplate.php +++ b/src/FrontendTemplate.php @@ -24,7 +24,7 @@ class FrontendTemplate * * - any filters See Tpl::getFilters() * - * @param ArrayObject $attr The attributes + * @param ArrayObject $attr The attributes * * @return string */ diff --git a/src/Manage.php b/src/Manage.php index 07c0649..e0d69f7 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -67,7 +67,7 @@ class Manage extends Process $password = empty($_POST['filesalias_password']) ? '' : $_POST['filesalias_password']; if (preg_match('/^' . preg_quote(App::media()->root_url, '/') . '/', $target)) { - $target = preg_replace('/^' . preg_quote(App::media()->root_url, '/') . '/', '', $target); + $target = (string) preg_replace('/^' . preg_quote(App::media()->root_url, '/') . '/', '', $target); $found = Utils::getMediaId($target); if (!empty($found)) { diff --git a/src/Utils.php b/src/Utils.php index 98fecc6..1965a78 100644 --- a/src/Utils.php +++ b/src/Utils.php @@ -177,6 +177,6 @@ class Utils ->and('media_file = ' . $sql->quote($target)) ->select(); - return $rs->count() ? (int) $rs->f('media_id') : 0; + return !is_null($rs) && $rs->count() ? (int) $rs->f('media_id') : 0; } }