From a1bc5b5fa588a73c48e1e86d66966b039c6064d5 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 15 Oct 2023 20:17:56 +0200 Subject: [PATCH] minor warning adjustments --- api/upload.php | 5 ++++- content-controllers/image/image.controller.php | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/api/upload.php b/api/upload.php index 7514d96..713e685 100644 --- a/api/upload.php +++ b/api/upload.php @@ -26,7 +26,10 @@ else if(!isFolderWritable(ROOT.DS.'tmp')) // check if client has permission to upload executeUploadPermission(); -$hash = sanatizeString(trim($_REQUEST['hash']))?sanatizeString(trim($_REQUEST['hash'])):false; +if(isset($_REQUEST['hash'])) + $hash = sanatizeString(trim($_REQUEST['hash'])); +else + $hash = false; // check for POST upload if ($_FILES['file']["error"] == UPLOAD_ERR_OK) diff --git a/content-controllers/image/image.controller.php b/content-controllers/image/image.controller.php index 37daf8b..0e50e58 100644 --- a/content-controllers/image/image.controller.php +++ b/content-controllers/image/image.controller.php @@ -319,6 +319,9 @@ class ImageController implements ContentController function shouldAlwaysBeWebp() { + //sanity check + if(!$_SERVER['HTTP_ACCEPT']) return false; + if(defined('ALWAYS_WEBP') && ALWAYS_WEBP && strpos( $_SERVER['HTTP_ACCEPT'], 'image/webp' ) !== false ) return true; else