Subversion Repositories oidplus

Rev

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

Rev 1143 Rev 1201
Line 71... Line 71...
71
         * @throws OIDplusException
71
         * @throws OIDplusException
72
         */
72
         */
73
        public function action(string $actionID, array $params): array {
73
        public function action(string $actionID, array $params): array {
74
                if ($actionID == 'color_update') {
74
                if ($actionID == 'color_update') {
75
                        if (!OIDplus::authUtils()->isAdminLoggedIn()) {
75
                        if (!OIDplus::authUtils()->isAdminLoggedIn()) {
76
                                throw new OIDplusException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')));
76
                                throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')));
77
                        }
77
                        }
78
 
78
 
79
                        _CheckParamExists($params, 'hue_shift');
79
                        _CheckParamExists($params, 'hue_shift');
80
                        _CheckParamExists($params, 'sat_shift');
80
                        _CheckParamExists($params, 'sat_shift');
81
                        _CheckParamExists($params, 'val_shift');
81
                        _CheckParamExists($params, 'val_shift');
Line 269... Line 269...
269
                                echo ' checked';
269
                                echo ' checked';
270
                        }
270
                        }
271
                }
271
                }
272
                echo '> <label for="color_invert">'._L('Dark Theme (inverted colors)').'</label><br>';
272
                echo '> <label for="color_invert">'._L('Dark Theme (inverted colors)').'</label><br>';
273
 
273
 
274
                $msg = '';
274
                $htmlmsg = '';
275
                if ($do_edits) {
275
                if ($do_edits) {
276
                        try {
276
                        try {
277
                                OIDplus::config()->setValue('color_invert', $set_value ? 1 : 0);
277
                                OIDplus::config()->setValue('color_invert', $set_value ? 1 : 0);
278
                                OIDplus::config()->setValue('oobe_colors_done', '1');
278
                                OIDplus::config()->setValue('oobe_colors_done', '1');
279
                        } catch (\Exception $e) {
279
                        } catch (\Exception $e) {
280
                                $msg = $e->getMessage();
280
                                $htmlmsg = $e instanceof OIDplusException ? $e->getHtmlMessage() : htmlentities($e->getMessage());
281
                                $errors_happened = true;
281
                                $errors_happened = true;
282
                        }
282
                        }
283
                }
283
                }
284
 
284
 
285
                echo ' <font color="red"><b>'.$msg.'</b></font>';
285
                echo ' <font color="red"><b>'.$htmlmsg.'</b></font>';
286
        }
286
        }
287
 
287
 
288
}
288
}