Skip to content

Commit 70990f6

Browse files
authored
Merge pull request #3868 from AllskyTeam/3867-remove-ability-to-upload-modules
#3867 Remove module upload functions
2 parents e7db7bb + 0cf4bf6 commit 70990f6

3 files changed

Lines changed: 0 additions & 69 deletions

File tree

html/includes/module.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ function DisplayModule() {
5252
<div class="btn btn-lg navbar-btn" id="module-editor-save"><i class="fa-solid fa-floppy-disk"></i></div>
5353
</div>
5454
</li>
55-
<li>
56-
<div class="btn btn-lg navbar-btn" id="module-editor-new" data-toggle="tooltip" data-placement="top" data-container="body" title="Add A New Module"><i class="fa-solid fa-upload"></i></div>
57-
</li>
5855
<li class="btn-lg">
5956
<form id="oe-item-list-edit-dialog-form" class="form-horizontal">
6057
<div class="form-group">

html/includes/moduleutil.php

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -380,42 +380,6 @@ public function deleteModules() {
380380
}
381381
}
382382

383-
public function postUpload() {
384-
$data = $_FILES['module-file'];
385-
$sourcePath = $_FILES['module-file']['tmp_name'];
386-
$scriptName = str_replace("zip","py",$_FILES['module-file']['name']);
387-
388-
$targetPath = $this->userModules . '/' . $scriptName ;
389-
390-
$zipArchive = new ZipArchive();
391-
$zipArchive->open($sourcePath);
392-
for ($i = 0; $i < $zipArchive->numFiles; $i++) {
393-
$stat = $zipArchive->statIndex($i);
394-
395-
$nameInArchive = $stat['name'];
396-
397-
if ($scriptName == $nameInArchive) {
398-
$fp = $zipArchive->getStream($nameInArchive);
399-
if (!$fp) {
400-
$this->send500('Unable to extract module from zip file');
401-
}
402-
403-
$contents = '';
404-
while (!feof($fp)) {
405-
$contents .= fread($fp, 1024);
406-
}
407-
fclose($fp);
408-
409-
$file = fopen($targetPath, 'wb');
410-
fwrite($file, $contents);
411-
fclose($file);
412-
$this->sendResponse();
413-
break;
414-
}
415-
}
416-
$this->send500('Unable to locate module in zip file');
417-
}
418-
419383
public function getReset() {
420384
$flow = $_GET['flow'];
421385

html/js/modules/modules.js

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -849,27 +849,6 @@ class MODULESEDITOR {
849849
}
850850
}
851851

852-
#uploadFile(form) {
853-
$.LoadingOverlay('show');
854-
$('#module-upload-dialog').modal('hide');
855-
856-
$.ajax({
857-
type: 'POST',
858-
url: 'includes/moduleutil.php?request=Upload',
859-
data: new FormData(form),
860-
contentType: false,
861-
cache: false,
862-
processData: false,
863-
context: this
864-
}).done(function () {
865-
this.#buildUI();
866-
}).fail(function () {
867-
bootbox.alert('Failed to upload the plugin. Unable to move the file');
868-
}).always(function () {
869-
$.LoadingOverlay('hide');
870-
});
871-
}
872-
873852
#showDebug() {
874853
$.ajax({
875854
url: 'includes/moduleutil.php?request=Modules&event=' + this.#eventName,
@@ -1044,15 +1023,6 @@ class MODULESEDITOR {
10441023
}
10451024
});
10461025

1047-
$(document).on('click', '#module-editor-new', () => {
1048-
$('#module-upload-dialog').modal('show');
1049-
});
1050-
1051-
$('#module-upload-dialog-form').on('submit', (e) => {
1052-
e.preventDefault();
1053-
this.#uploadFile(e.target);
1054-
});
1055-
10561026
this.#buildUI();
10571027
}
10581028

0 commit comments

Comments
 (0)