diff options
author | Simon Rettberg | 2013-11-05 20:25:55 +0100 |
---|---|---|
committer | Simon Rettberg | 2013-11-05 20:25:55 +0100 |
commit | e277baed387b642bb7e6707b49e55da4719a9c79 (patch) | |
tree | 350343881ddc35fe53862e971506bc405a9a7fad /apis | |
parent | Tolle neue APIs Sachen (diff) | |
download | slx-admin-e277baed387b642bb7e6707b49e55da4719a9c79.tar.gz slx-admin-e277baed387b642bb7e6707b49e55da4719a9c79.tar.xz slx-admin-e277baed387b642bb7e6707b49e55da4719a9c79.zip |
Working on download of remote configs
Diffstat (limited to 'apis')
-rw-r--r-- | apis/download.inc.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/apis/download.inc.php b/apis/download.inc.php new file mode 100644 index 00000000..9ba0f008 --- /dev/null +++ b/apis/download.inc.php @@ -0,0 +1,34 @@ +<?php + +User::load(); + +if (!User::hasPermission('superadmin')) die('No permission'); +if (!isset($_REQUEST['type'])) die('No type'); +if (!isset($_REQUEST['file'])) die('No file'); +if (!isset($_REQUEST['id'])) die('No id'); + +require_once('inc/render.inc.php'); + +$type = $_REQUEST['type']; +$file = preg_replace('/[^a-z0-9\.\-_]/is', '', $_REQUEST['file']); +$id = $_REQUEST['id']; + +switch ($type) { +case 'tgz': + $remote = CONFIG_REMOTE_TGZ; + $local = CONFIG_TGZ_LIST_DIR; + break; +default: + die('Invalid download type'); +} + +if (file_exists($local . '/' . $file) && !isset($_REQUEST['exec'])) { + echo 'FILE EXISTS LOCALLY I SHOULD ASK FOR OVERWRITE NOW'; + exit(0); +} + +sleep(2); + +// No execution - just return dialog +echo Render::parse('download-complete', array('file' => $file)); + |