summaryrefslogtreecommitdiffstats
path: root/modules/sysconfig/addmodule_custom.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2014-05-23 20:49:02 +0200
committerSimon Rettberg2014-05-23 20:49:02 +0200
commitfe6ac16498b05d0f0c8ed7fda394273815d3d6da (patch)
treecadf5f103ef3db7ba1b40d59d85937c998aad22f /modules/sysconfig/addmodule_custom.inc.php
parentServer Setup page (diff)
downloadslx-admin-fe6ac16498b05d0f0c8ed7fda394273815d3d6da.tar.gz
slx-admin-fe6ac16498b05d0f0c8ed7fda394273815d3d6da.tar.xz
slx-admin-fe6ac16498b05d0f0c8ed7fda394273815d3d6da.zip
Stuff (WIP)
Diffstat (limited to 'modules/sysconfig/addmodule_custom.inc.php')
-rw-r--r--modules/sysconfig/addmodule_custom.inc.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/sysconfig/addmodule_custom.inc.php b/modules/sysconfig/addmodule_custom.inc.php
index ec2c8af7..070c1fd4 100644
--- a/modules/sysconfig/addmodule_custom.inc.php
+++ b/modules/sysconfig/addmodule_custom.inc.php
@@ -20,7 +20,10 @@ class CustomModule_UploadForm extends AddModule_Base
protected function renderInternal()
{
Session::set('mod_temp', false);
- Render::addDialog('Eigenes Modul hinzufügen', false, 'sysconfig/custom-upload', array('step' => 'CustomModule_ProcessUpload'));
+ Render::addDialog('Eigenes Modul hinzufügen', false, 'sysconfig/custom-upload', array(
+ 'token' => Session::get('token'),
+ 'step' => 'CustomModule_ProcessUpload'
+ ));
}
}
@@ -42,7 +45,7 @@ class CustomModule_ProcessUpload extends AddModule_Base
Util::redirect('?do=SysConfig');
}
if ($_FILES['modulefile']['error'] != UPLOAD_ERR_OK) {
- Message::addError('upload-failed', $_FILES['modulefile']['name']);
+ Message::addError('upload-failed', Util::uploadErrorString($_FILES['modulefile']['error']));
Util::redirect('?do=SysConfig');
}
$tempfile = $_FILES['modulefile']['tmp_name'] . '.tmp';
@@ -91,6 +94,7 @@ class CustomModule_ProcessUpload extends AddModule_Base
}
}
Render::addDialog('Eigenes Modul hinzufügen', false, 'sysconfig/custom-fileselect', array(
+ 'token' => Session::get('token'),
'step' => 'CustomModule_CompressModule',
'files' => $list,
));
@@ -114,7 +118,7 @@ class CustomModule_CompressModule extends AddModule_Base
}
// Recompress using task manager
$this->taskId = 'tgzmod' . mt_rand() . '-' . microtime(true);
- $destFile = CONFIG_TGZ_LIST_DIR . '/modules/mod-' . preg_replace('/[^a-z0-9_\-]+/is', '_', $title) . '-' . microtime(true) . '.tgz';
+ $destFile = CONFIG_TGZ_LIST_DIR . '/modules/mod-' . Util::sanitizeFilename($title) . '-' . microtime(true) . '.tgz';
Taskmanager::submit('RecompressArchive', array(
'id' => $this->taskId,
'inputFiles' => array($tempfile),
@@ -129,7 +133,7 @@ class CustomModule_CompressModule extends AddModule_Base
$this->taskError($status);
}
// Seems ok, create entry in DB
- $ret = Database::exec("INSERT INTO configtgz_module (title, moduletype, filename, contents) VALUES (:title, 'custom', :file, '')",
+ $ret = Database::exec("INSERT INTO configtgz_module (title, moduletype, filepath, contents) VALUES (:title, 'custom', :file, '')",
array('title' => $title, 'file' => $destFile));
if ($ret === false) {
unlink($destFile);