From 81f232d57e8991ca342751d0db2d2680ec7bc7c8 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 30 Nov 2024 19:30:39 +0000 Subject: [PATCH] Fix errors in js_upload addon --- .../file-uploader/tests/action-acceptance.php | 16 ++++++++-------- .../tests/action-handler-queue-test.php | 8 ++++---- .../file-uploader/tests/action-handler-test.php | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/js_upload/file-uploader/tests/action-acceptance.php b/js_upload/file-uploader/tests/action-acceptance.php index fc9583f2..172b8857 100644 --- a/js_upload/file-uploader/tests/action-acceptance.php +++ b/js_upload/file-uploader/tests/action-acceptance.php @@ -2,12 +2,12 @@ usleep(100000); -$fileName; -$fileSize; +$fileName = ''; +$fileSize = 0;; if (isset($_GET['qqfile'])){ $fileName = $_GET['qqfile']; - + // xhr request $headers = apache_request_headers(); $fileSize = (int)$headers['Content-Length']; @@ -34,13 +34,13 @@ if ($fileSize > 9 * 1024){ die ('{error: "server-error file size is bigger than 9kB"}'); } -if (count($_GET)){ +if (count($_GET)){ array_merge($_GET, array('fileName'=>$fileName)); - + $response = array_merge($_GET, array('success'=>true, 'fileName'=>$fileName)); - - // to pass data through iframe you will need to encode all html tags - echo htmlspecialchars(json_encode($response), ENT_NOQUOTES); + + // to pass data through iframe you will need to encode all html tags + echo htmlspecialchars(json_encode($response), ENT_NOQUOTES); } else { die ('{error: "server-error query params not passed"}'); } diff --git a/js_upload/file-uploader/tests/action-handler-queue-test.php b/js_upload/file-uploader/tests/action-handler-queue-test.php index ff13576d..78760d64 100644 --- a/js_upload/file-uploader/tests/action-handler-queue-test.php +++ b/js_upload/file-uploader/tests/action-handler-queue-test.php @@ -2,11 +2,11 @@ sleep(4); -$fileName; +$fileName = ''; if (isset($_GET['qqfile'])){ $fileName = $_GET['qqfile']; - + // xhr request $headers = apache_request_headers(); if ((int)$headers['Content-Length'] == 0){ @@ -14,7 +14,7 @@ if (isset($_GET['qqfile'])){ } } elseif (isset($_FILES['qqfile'])){ $fileName = basename($_FILES['qqfile']['name']); - + // form request if ($_FILES['qqfile']['size'] == 0){ die ('{error: "file size is zero"}'); @@ -25,7 +25,7 @@ if (isset($_GET['qqfile'])){ if (count($_GET)){ $_GET['success'] = true; - echo json_encode(array_merge($_GET)); + echo json_encode(array_merge($_GET)); } else { die ('{error: "query params not passed"}'); } diff --git a/js_upload/file-uploader/tests/action-handler-test.php b/js_upload/file-uploader/tests/action-handler-test.php index 24466b12..9fa72023 100644 --- a/js_upload/file-uploader/tests/action-handler-test.php +++ b/js_upload/file-uploader/tests/action-handler-test.php @@ -2,11 +2,11 @@ usleep(300); -$fileName; +$fileName = ''; if (isset($_GET['qqfile'])){ $fileName = $_GET['qqfile']; - + // xhr request $headers = apache_request_headers(); if ((int)$headers['Content-Length'] == 0){ @@ -14,7 +14,7 @@ if (isset($_GET['qqfile'])){ } } elseif (isset($_FILES['qqfile'])){ $fileName = basename($_FILES['qqfile']['name']); - + // form request if ($_FILES['qqfile']['size'] == 0){ die ('{error: "file size is zero"}'); @@ -25,7 +25,7 @@ if (isset($_GET['qqfile'])){ if (count($_GET)){ //return query params - echo json_encode(array_merge($_GET, array('fileName'=>$fileName))); + echo json_encode(array_merge($_GET, array('fileName'=>$fileName))); } else { die ('{error: "query params not passed"}'); }