From d5fe2b0ba6850cb35d4bb88fe4ce44b5ef0696dd Mon Sep 17 00:00:00 2001 From: Stein Magne Bjorklund <steinmb@smbjorklund.com> Date: Wed, 1 Sep 2021 11:32:21 +0200 Subject: [PATCH] Issue 6 Reformatting and improved variable names - Removed no longer needed inline comments. --- classes/modules/staticModule.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/classes/modules/staticModule.php b/classes/modules/staticModule.php index 746f6a5e..171da4d9 100644 --- a/classes/modules/staticModule.php +++ b/classes/modules/staticModule.php @@ -99,13 +99,12 @@ class StaticModule extends abstractModule{ */ private function validateDirectory(array $conf, $file): void { - $staticdir = realpath($conf['static']['directory']); - $imgdir = realpath($conf['static']['directory'] . "img"); - $resourcepath = realpath($conf['static']['directory'].$file); + $staticDirectory = realpath($conf['static']['directory']); + $imgDirectory = realpath($conf['static']['directory'] . "img"); + $resourcePath = realpath($conf['static']['directory'] . $file); - // static resources should be in static or img dir (img may be symlinked, check realpath of img as well) - if (strpos($resourcepath, $staticdir)!== 0 and strpos($resourcepath, $imgdir)!== 0) { - HTTPStatus::send404($file); // send404 calls exit();// + if (strpos($resourcePath, $staticDirectory) !== 0 && strpos($resourcePath, $imgDirectory) !== 0) { + HTTPStatus::send404($file); } } -- GitLab