diff options
author | Simon Rettberg | 2014-11-19 19:51:49 +0100 |
---|---|---|
committer | Simon Rettberg | 2014-11-19 19:51:49 +0100 |
commit | d3e058cc3450cea589484a600c12fffb6ef8e330 (patch) | |
tree | 201e900ede72851fe6ed29ee951ef6a05c796d1d /modules | |
parent | Update config example, style, translations (diff) | |
download | slx-admin-d3e058cc3450cea589484a600c12fffb6ef8e330.tar.gz slx-admin-d3e058cc3450cea589484a600c12fffb6ef8e330.tar.xz slx-admin-d3e058cc3450cea589484a600c12fffb6ef8e330.zip |
Add HTTPS config module for webif, update everything to use FileUtil class, minor fixes
Diffstat (limited to 'modules')
-rw-r--r-- | modules/backup.inc.php | 34 | ||||
-rw-r--r-- | modules/https.inc.php | 60 | ||||
-rw-r--r-- | modules/internetaccess.inc.php | 4 | ||||
-rw-r--r-- | modules/minilinux.inc.php | 5 | ||||
-rw-r--r-- | modules/sysconfig/addmodule_branding.inc.php | 2 |
5 files changed, 68 insertions, 37 deletions
diff --git a/modules/backup.inc.php b/modules/backup.inc.php index ecdc3565..e3652ebe 100644 --- a/modules/backup.inc.php +++ b/modules/backup.inc.php @@ -84,7 +84,7 @@ class Page_Backup extends Page Util::redirect('?do=Backup'); } // Got uploaded file, now shut down all the daemons etc. - $parent = $this->stopDaemons(null); + $parent = Trigger::stopDaemons(null, &$this->templateData); // Unmount store $task = Taskmanager::submit('MountVmStore', array( 'address' => 'null', @@ -116,36 +116,4 @@ class Page_Backup extends Page $this->templateData['rebootid'] = $task['id']; } - private function stopDaemons($parent) - { - $task = Taskmanager::submit('SyncdaemonLauncher', array( - 'operation' => 'stop', - 'parentTask' => $parent, - 'failOnParentFail' => false - )); - if (isset($task['id'])) { - $this->templateData['syncid'] = $task['id']; - $parent = $task['id']; - } - $task = Taskmanager::submit('DozmodLauncher', array( - 'operation' => 'stop', - 'parentTask' => $parent, - 'failOnParentFail' => false - )); - if (isset($task['id'])) { - $this->templateData['dmsdid'] = $task['id']; - $parent = $task['id']; - } - $task = Taskmanager::submit('LdadpLauncher', array( - 'ids' => array(), - 'parentTask' => $parent, - 'failOnParentFail' => false - )); - if (isset($task['id'])) { - $this->templateData['ldadpid'] = $task['id']; - $parent = $task['id']; - } - return $parent; - } - } diff --git a/modules/https.inc.php b/modules/https.inc.php new file mode 100644 index 00000000..c4ee0288 --- /dev/null +++ b/modules/https.inc.php @@ -0,0 +1,60 @@ +<?php + +class Page_Https extends Page +{ + + protected function doPreprocess() + { + User::load(); + if (!User::hasPermission('superadmin')) { + Message::addError('no-permission'); + Util::redirect('?do=Main'); + } + $task = false; + switch (Request::post('mode')) { + case 'off': + $task = $this->setOff(); + break; + case 'random': + $task = $this->setRandom(); + break; + case 'custom': + $task = $this->setCustom(); + break; + } + if (isset($task['id'])) { + Session::set('https-id', $task['id']); + Util::redirect('?do=Https&show=update'); + } + } + + protected function doRender() + { + if (Request::get('show') === 'update') { + Render::addTemplate('https/restart', array('taskid' => Session::get('https-id'))); + } + Render::addTemplate('https/_page'); + } + + private function setOff() + { + return Taskmanager::submit('LighttpdHttps', array()); + } + + private function setRandom() + { + return Taskmanager::submit('LighttpdHttps', array( + 'proxyip' => Property::getServerIp() + )); + } + + private function setCustom() + { + return Taskmanager::submit('LighttpdHttps', array( + 'importcert' => Request::post('certificate', 'bla'), + 'importkey' => Request::post('privatekey', 'bla'), + 'importchain' => Request::post('cachain', '') + )); + } + +} diff --git a/modules/internetaccess.inc.php b/modules/internetaccess.inc.php index a292926c..c142285d 100644 --- a/modules/internetaccess.inc.php +++ b/modules/internetaccess.inc.php @@ -22,9 +22,9 @@ class Page_InternetAccess extends Page Message::addSuccess('settings-updated'); Taskmanager::release(Taskmanager::submit('ReloadProxy')); $taskids = array(); - Trigger::stopDaemons(NULL, &$taskids); + Trigger::stopDaemons(NULL, $taskids); $taskids = array(); - Trigger::startDaemons(NULL, &$taskids); + Trigger::startDaemons(NULL, $taskids); Session::set('ia-restart', $taskids); Util::redirect('?do=InternetAccess&show=update'); } diff --git a/modules/minilinux.inc.php b/modules/minilinux.inc.php index df2a0839..5027c1b7 100644 --- a/modules/minilinux.inc.php +++ b/modules/minilinux.inc.php @@ -65,11 +65,13 @@ class Page_MiniLinux extends Page return; } $file = false; + $gpg = false; foreach ($data['systems'] as &$system) { if ($system['id'] !== $id) continue; foreach ($system['files'] as &$f) { if ($f['name'] !== $name) continue; $file = $f; + if (isset($f['gpg'])) $gpg = $f['gpg']; break; } } @@ -79,7 +81,8 @@ class Page_MiniLinux extends Page } $task = Taskmanager::submit('DownloadFile', array( 'url' => CONFIG_REMOTE_ML . '/' . $id . '/' . $name, - 'destination' => CONFIG_HTTP_DIR . '/' . $id . '/' . $name + 'destination' => CONFIG_HTTP_DIR . '/' . $id . '/' . $name, + 'gpg' => $gpg )); if (!isset($task['id'])) { echo 'Error launching download task: ' . $task['statusCode']; diff --git a/modules/sysconfig/addmodule_branding.inc.php b/modules/sysconfig/addmodule_branding.inc.php index a6080d06..9612bedb 100644 --- a/modules/sysconfig/addmodule_branding.inc.php +++ b/modules/sysconfig/addmodule_branding.inc.php @@ -105,7 +105,7 @@ class Branding_ProcessFile extends AddModule_Base Message::addError('remote-timeout', $url, $code); return false; } - $content = Util::readFile($svgName, 25000); + $content = FileUtil::readFile($svgName, 25000); // Is svg file? if (strpos($content, '<svg') !== false) return true; // Found an svg tag - don't try to find links to the actual image |