Rev 373 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
292 | daniel-mar | 1 | <?php |
2 | |||
3 | /* |
||
4 | * OIDplus 2.0 |
||
511 | daniel-mar | 5 | * Copyright 2019 - 2021 Daniel Marschall, ViaThinkSoft |
292 | daniel-mar | 6 | * |
7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
8 | * you may not use this file except in compliance with the License. |
||
9 | * You may obtain a copy of the License at |
||
10 | * |
||
11 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
12 | * |
||
13 | * Unless required by applicable law or agreed to in writing, software |
||
14 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
16 | * See the License for the specific language governing permissions and |
||
17 | * limitations under the License. |
||
18 | */ |
||
19 | |||
511 | daniel-mar | 20 | if (!defined('INSIDE_OIDPLUS')) die(); |
21 | |||
292 | daniel-mar | 22 | class OIDplusPageAdminOOBE extends OIDplusPagePluginAdmin { |
23 | |||
24 | public function gui($id, &$out, &$handled) { |
||
25 | // Nothing |
||
26 | } |
||
27 | |||
373 | daniel-mar | 28 | public function oobeRequired() { |
362 | daniel-mar | 29 | $oobe_done = OIDplus::config()->getValue('oobe_main_done') == '1'; |
292 | daniel-mar | 30 | |
362 | daniel-mar | 31 | foreach (OIDplus::getPagePlugins() as $plugin) { |
32 | if ($plugin->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.1')) { |
||
33 | if ($plugin->oobeRequested()) { |
||
34 | $oobe_done = false; |
||
373 | daniel-mar | 35 | break; |
362 | daniel-mar | 36 | } |
37 | } |
||
38 | } |
||
39 | |||
373 | daniel-mar | 40 | return !$oobe_done; |
41 | } |
||
42 | |||
43 | public function init($html=true) { |
||
44 | OIDplus::config()->deleteConfigKey('reg_wizard_done'); |
||
45 | OIDplus::config()->prepareConfigKey('oobe_main_done', '"Out Of Box Experience" wizard for the system settings done once?', '0', OIDplusConfig::PROTECTION_HIDDEN, function($value) {}); |
||
46 | |||
47 | if ($this->oobeRequired()) { |
||
292 | daniel-mar | 48 | // Show registration/configuration wizard once |
49 | if ($html) { |
||
50 | if (basename($_SERVER['SCRIPT_NAME']) != 'oobe.php') { |
||
51 | header('Location:'.OIDplus::webpath(__DIR__).'oobe.php'); |
||
362 | daniel-mar | 52 | die(_L('Redirecting to Out-Of-Box-Experience wizard...')); |
292 | daniel-mar | 53 | } |
54 | } else { |
||
55 | // We cannot guarantee that everything works correctly if OOBE never ran once. So abort AJAX and co. |
||
373 | daniel-mar | 56 | throw new OIDplusException(_L('A plugin has requested that the initialization wizard (OOBE) is shown. Please reload the page.')); |
292 | daniel-mar | 57 | } |
58 | } |
||
59 | } |
||
60 | |||
61 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
||
62 | return true; |
||
63 | } |
||
64 | |||
65 | public function tree_search($request) { |
||
66 | return false; |
||
67 | } |
||
366 | daniel-mar | 68 | } |