summaryrefslogtreecommitdiffstats
path: root/modules/webinterface/module.inc.php
diff options
context:
space:
mode:
authorJonathan Bauer2016-04-01 16:50:13 +0200
committerJonathan Bauer2016-04-01 16:50:13 +0200
commitdbc0d9614421e064cc62aacf116ebb783c83f2f3 (patch)
tree091844b8578ff1d9ac18edfd3cee3e63210133d7 /modules/webinterface/module.inc.php
parent[ldapauth] Add homedir conf to ldap wizard (diff)
downloadslx-admin-dbc0d9614421e064cc62aacf116ebb783c83f2f3.tar.gz
slx-admin-dbc0d9614421e064cc62aacf116ebb783c83f2f3.tar.xz
slx-admin-dbc0d9614421e064cc62aacf116ebb783c83f2f3.zip
[merge] merging c3sl / fr - initial commit
Diffstat (limited to 'modules/webinterface/module.inc.php')
-rw-r--r--modules/webinterface/module.inc.php85
1 files changed, 85 insertions, 0 deletions
diff --git a/modules/webinterface/module.inc.php b/modules/webinterface/module.inc.php
new file mode 100644
index 00000000..c301dec9
--- /dev/null
+++ b/modules/webinterface/module.inc.php
@@ -0,0 +1,85 @@
+<?php
+
+class Page_WebInterface extends Page
+{
+
+ protected function doPreprocess()
+ {
+ User::load();
+ if (!User::hasPermission('superadmin')) {
+ Message::addError('no-permission');
+ Util::redirect('?do=Main');
+ }
+ switch (Request::post('action')) {
+ case 'https':
+ $this->actionConfigureHttps();
+ break;
+ case 'password':
+ $this->actionShowHidePassword();
+ break;
+ }
+ }
+
+ private function actionConfigureHttps()
+ {
+ $task = false;
+ switch (Request::post('mode')) {
+ case 'off':
+ $task = $this->setHttpsOff();
+ break;
+ case 'random':
+ $task = $this->setHttpsRandomCert();
+ break;
+ case 'custom':
+ $task = $this->setHttpsCustomCert();
+ break;
+ }
+ if (isset($task['id'])) {
+ Session::set('https-id', $task['id']);
+ Util::redirect('?do=WebInterface&show=httpsupdate');
+ }
+ }
+
+ private function actionShowHidePassword()
+ {
+ Property::setPasswordFieldType(Request::post('mode') === 'show' ? 'text' : 'password');
+ Util::redirect('?do=WebInterface');
+ }
+
+ protected function doRender()
+ {
+ Render::setTitle(Dictionary::translate('lang_titleWebinterface'));
+ if (Request::get('show') === 'httpsupdate') {
+ Render::addTemplate('httpd-restart', array('taskid' => Session::get('https-id')));
+ }
+ Render::addTemplate('https', array('httpsEnabled' => file_exists('/etc/lighttpd/server.pem')));
+ $data = array();
+ if (Property::getPasswordFieldType() === 'text')
+ $data['selected_show'] = 'checked';
+ else
+ $data['selected_hide'] = 'checked';
+ Render::addTemplate('passwords', $data);
+ }
+
+ private function setHttpsOff()
+ {
+ return Taskmanager::submit('LighttpdHttps', array());
+ }
+
+ private function setHttpsRandomCert()
+ {
+ return Taskmanager::submit('LighttpdHttps', array(
+ 'proxyip' => Property::getServerIp()
+ ));
+ }
+
+ private function setHttpsCustomCert()
+ {
+ return Taskmanager::submit('LighttpdHttps', array(
+ 'importcert' => Request::post('certificate', 'bla'),
+ 'importkey' => Request::post('privatekey', 'bla'),
+ 'importchain' => Request::post('cachain', '')
+ ));
+ }
+
+}