Rev 360 | 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 |
||
5 | * Copyright 2019 Daniel Marschall, ViaThinkSoft |
||
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 | |||
20 | class OIDplusPageAdminOOBE extends OIDplusPagePluginAdmin { |
||
21 | |||
22 | public function gui($id, &$out, &$handled) { |
||
23 | // Nothing |
||
24 | } |
||
25 | |||
26 | public function init($html=true) { |
||
362 | daniel-mar | 27 | OIDplus::config()->prepareConfigKey('oobe_main_done', '"Out Of Box Experience" wizard for the system settings done once?', '0', OIDplusConfig::PROTECTION_HIDDEN, function($value) {}); |
292 | daniel-mar | 28 | |
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 | echo "Plugin ".get_class($plugin)." requested OOBE\n"; |
||
35 | $oobe_done = false; |
||
36 | } |
||
37 | } |
||
38 | } |
||
39 | |||
292 | daniel-mar | 40 | if (!$oobe_done) { |
41 | // Show registration/configuration wizard once |
||
42 | if ($html) { |
||
43 | if (basename($_SERVER['SCRIPT_NAME']) != 'oobe.php') { |
||
44 | header('Location:'.OIDplus::webpath(__DIR__).'oobe.php'); |
||
362 | daniel-mar | 45 | die(_L('Redirecting to Out-Of-Box-Experience wizard...')); |
292 | daniel-mar | 46 | } |
47 | } else { |
||
48 | // We cannot guarantee that everything works correctly if OOBE never ran once. So abort AJAX and co. |
||
49 | die(); |
||
50 | } |
||
51 | } |
||
52 | } |
||
53 | |||
54 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
||
55 | return true; |
||
56 | } |
||
57 | |||
58 | public function tree_search($request) { |
||
59 | return false; |
||
60 | } |
||
360 | daniel-mar | 61 | } |