Subversion Repositories oidplus

Rev

Rev 366 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

  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) {
  27.                 OIDplus::config()->deleteConfigKey('reg_wizard_done');
  28.                 OIDplus::config()->prepareConfigKey('oobe_main_done', '"Out Of Box Experience" wizard for the system settings done once?', '0', OIDplusConfig::PROTECTION_HIDDEN, function($value) {});
  29.  
  30.                 $oobe_done = OIDplus::config()->getValue('oobe_main_done') == '1';
  31.  
  32.                 foreach (OIDplus::getPagePlugins() as $plugin) {
  33.                         if ($plugin->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.1')) {
  34.                                 if ($plugin->oobeRequested()) {
  35.                                         $oobe_done = false;
  36.                                 }
  37.                         }
  38.                 }
  39.  
  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');
  45.                                         die(_L('Redirecting to Out-Of-Box-Experience wizard...'));
  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.         }
  61. }
  62.