From 0cf4bf626e94007b1023eb080b3b4f0b75d15dde Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 14 Sep 2024 21:00:50 +0100 Subject: [PATCH] #3867 Remove module upload functions --- html/includes/module.php | 3 --- html/includes/moduleutil.php | 36 ------------------------------------ html/js/modules/modules.js | 30 ------------------------------ 3 files changed, 69 deletions(-) diff --git a/html/includes/module.php b/html/includes/module.php index 1fa567ca3..9692ca806 100644 --- a/html/includes/module.php +++ b/html/includes/module.php @@ -52,9 +52,6 @@ function DisplayModule() { -
  • - -
  • diff --git a/html/includes/moduleutil.php b/html/includes/moduleutil.php index 6dfd5dcda..02f4fac20 100644 --- a/html/includes/moduleutil.php +++ b/html/includes/moduleutil.php @@ -380,42 +380,6 @@ public function deleteModules() { } } - public function postUpload() { - $data = $_FILES['module-file']; - $sourcePath = $_FILES['module-file']['tmp_name']; - $scriptName = str_replace("zip","py",$_FILES['module-file']['name']); - - $targetPath = $this->userModules . '/' . $scriptName ; - - $zipArchive = new ZipArchive(); - $zipArchive->open($sourcePath); - for ($i = 0; $i < $zipArchive->numFiles; $i++) { - $stat = $zipArchive->statIndex($i); - - $nameInArchive = $stat['name']; - - if ($scriptName == $nameInArchive) { - $fp = $zipArchive->getStream($nameInArchive); - if (!$fp) { - $this->send500('Unable to extract module from zip file'); - } - - $contents = ''; - while (!feof($fp)) { - $contents .= fread($fp, 1024); - } - fclose($fp); - - $file = fopen($targetPath, 'wb'); - fwrite($file, $contents); - fclose($file); - $this->sendResponse(); - break; - } - } - $this->send500('Unable to locate module in zip file'); - } - public function getReset() { $flow = $_GET['flow']; diff --git a/html/js/modules/modules.js b/html/js/modules/modules.js index 8a69dffcf..106908091 100644 --- a/html/js/modules/modules.js +++ b/html/js/modules/modules.js @@ -849,27 +849,6 @@ class MODULESEDITOR { } } - #uploadFile(form) { - $.LoadingOverlay('show'); - $('#module-upload-dialog').modal('hide'); - - $.ajax({ - type: 'POST', - url: 'includes/moduleutil.php?request=Upload', - data: new FormData(form), - contentType: false, - cache: false, - processData: false, - context: this - }).done(function () { - this.#buildUI(); - }).fail(function () { - bootbox.alert('Failed to upload the plugin. Unable to move the file'); - }).always(function () { - $.LoadingOverlay('hide'); - }); - } - #showDebug() { $.ajax({ url: 'includes/moduleutil.php?request=Modules&event=' + this.#eventName, @@ -1044,15 +1023,6 @@ class MODULESEDITOR { } }); - $(document).on('click', '#module-editor-new', () => { - $('#module-upload-dialog').modal('show'); - }); - - $('#module-upload-dialog-form').on('submit', (e) => { - e.preventDefault(); - this.#uploadFile(e.target); - }); - this.#buildUI(); }