Rev 241 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 241 | Rev 250 | ||
---|---|---|---|
Line 40... | Line 40... | ||
40 | public function action(&$handled) { |
40 | public function action(&$handled) { |
41 | if (isset($_POST["action"]) && ($_POST["action"] == "config_update")) { |
41 | if (isset($_POST["action"]) && ($_POST["action"] == "config_update")) { |
42 | $handled = true; |
42 | $handled = true; |
43 | 43 | ||
44 | if (!OIDplus::authUtils()::isAdminLoggedIn()) { |
44 | if (!OIDplus::authUtils()::isAdminLoggedIn()) { |
45 | throw new Exception('You need to log in as administrator.'); |
45 | throw new OIDplusException('You need to log in as administrator.'); |
46 | } |
46 | } |
47 | 47 | ||
48 | $name = $_POST['name']; |
48 | $name = $_POST['name']; |
49 | $value = $_POST['value']; |
49 | $value = $_POST['value']; |
50 | 50 | ||
51 | $res = OIDplus::db()->query("select protected from ".OIDPLUS_TABLENAME_PREFIX."config where name = ?", array($name)); |
51 | $res = OIDplus::db()->query("select protected from ".OIDPLUS_TABLENAME_PREFIX."config where name = ?", array($name)); |
52 | $row = $res->fetch_array(); |
52 | $row = $res->fetch_array(); |
53 | if ($row['protected'] == 1) { |
53 | if ($row['protected'] == 1) { |
54 | throw new Exception('Setting is write protected'); |
54 | throw new OIDplusException('Setting is write protected'); |
55 | } |
55 | } |
56 | 56 | ||
57 | OIDplus::config()->setValue($name, $value); |
57 | OIDplus::config()->setValue($name, $value); |
58 | OIDplus::logger()->log("A?", "Changed system config setting '$name' to '$value'"); |
58 | OIDplus::logger()->log("A?", "Changed system config setting '$name' to '$value'"); |
59 | 59 | ||
Line 75... | Line 75... | ||
75 | $out['title'] = 'System configuration'; |
75 | $out['title'] = 'System configuration'; |
76 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
76 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
77 | 77 | ||
78 | if (!OIDplus::authUtils()::isAdminLoggedIn()) { |
78 | if (!OIDplus::authUtils()::isAdminLoggedIn()) { |
79 | $out['icon'] = 'img/error_big.png'; |
79 | $out['icon'] = 'img/error_big.png'; |
80 | $out['text'] = '<p>You need to <a '.oidplus_link('oidplus:login').'>log in</a> as administrator.</p>'; |
80 | $out['text'] = '<p>You need to <a '.OIDplus::gui()->link('oidplus:login').'>log in</a> as administrator.</p>'; |
81 | } else { |
81 | } else { |
82 | $output = ''; |
82 | $output = ''; |
83 | $output .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
83 | $output .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
84 | $output .= '<table class="table table-bordered table-striped">'; |
84 | $output .= '<table class="table table-bordered table-striped">'; |
85 | $output .= ' <tr>'; |
85 | $output .= ' <tr>'; |