Subversion Repositories oidplus

Rev

Rev 236 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 236 Rev 237
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
                                die(json_encode(array("error" => 'You need to log in as administrator.')));
45
                                throw new Exception('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
                                die(json_encode(array("error" => 'Setting is write protected')));
54
                                throw new Exception('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 110... Line 110...
110
 
110
 
111
                                $output .= '</table>';
111
                                $output .= '</table>';
112
                                $output .= '</div></div>';
112
                                $output .= '</div></div>';
113
 
113
 
114
                                $output .= '<br><p>See also:</p>';
114
                                $output .= '<br><p>See also:</p>';
115
                                $output .= '<ul><li><a href="setup/">Setup part 1: Create config.php (contains database settings, ReCAPTCHA, admin password and SSL enforcement)</a></li>';
115
                                $output .= '<ul><li><a href="'.OIDplus::getSystemUrl().'setup/">Setup part 1: Create config.php (contains database settings, ReCAPTCHA, admin password and SSL enforcement)</a></li>';
116
                                $output .= '<li><a href="plugins/'.basename(dirname(__DIR__)).'/120_registration/registration.php">Setup part 2: Basic settings (they are all available above, too)</a></li></ul>';
116
                                $output .= '<li><a href="plugins/'.basename(dirname(__DIR__)).'/120_registration/registration.php">Setup part 2: Basic settings (they are all available above, too)</a></li></ul>';
117
 
117
 
118
                                $out['text'] = $output;
118
                                $out['text'] = $output;
119
                        }
119
                        }
120
 
120