diff options
author | Simon Rettberg | 2013-10-29 20:02:30 +0100 |
---|---|---|
committer | Simon Rettberg | 2013-10-29 20:02:30 +0100 |
commit | 010656745dd6f7db6b09ec501ad3bb1e202b9a96 (patch) | |
tree | 2900c8daafe4b0b79cd6766348eb6db0b763bc54 /modules/baseconfig.inc.php | |
parent | DB-Support, add user functionality (diff) | |
download | slx-admin-010656745dd6f7db6b09ec501ad3bb1e202b9a96.tar.gz slx-admin-010656745dd6f7db6b09ec501ad3bb1e202b9a96.tar.xz slx-admin-010656745dd6f7db6b09ec501ad3bb1e202b9a96.zip |
First version of basic minilinux configuration
Diffstat (limited to 'modules/baseconfig.inc.php')
-rw-r--r-- | modules/baseconfig.inc.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/modules/baseconfig.inc.php b/modules/baseconfig.inc.php new file mode 100644 index 00000000..9d581624 --- /dev/null +++ b/modules/baseconfig.inc.php @@ -0,0 +1,41 @@ +<?php + +User::load(); + +if (isset($_POST['setting']) && is_array($_POST['setting'])) { + if (User::hasPermission('superadmin')) { + if (Util::verifyToken()) { + foreach ($_POST['setting'] as $key => $value) { + Database::exec('UPDATE setting_global SET setting_global.value = :value WHERE setting_global.setting = :key LIMIT 1', array( + 'key' => $key, + 'value' => $value, + )); + } + Message::addSuccess('settings-updated'); + } + } +} + +function render_module() +{ + if (!User::hasPermission('superadmin')) { + Message::addError('no-permission'); + return; + } + // List global config option + $rows = array(); + $res = Database::simpleQuery('SELECT setting.setting, setting_global.value, setting.permissions, setting.description + FROM setting + INNER JOIN setting_global USING (setting) + ORDER BY setting.setting ASC'); + while ($row = $res->fetch(PDO::FETCH_ASSOC)) { + $row['description'] = Util::markup($row['description']); + $row['big'] = false; + $rows[] = $row; + } + Render::addTemplate('page-baseconfig', array( + 'settings' => $rows, + 'token' => Session::get('token'), + )); +} + |