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/https.inc.php | |
| 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/https.inc.php')
| -rw-r--r-- | modules/https.inc.php | 60 |
1 files changed, 60 insertions, 0 deletions
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', '') + )); + } + +} |
