class_setup.inc 9.52 KiB
<?php
/*
  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
  Copyright (C) 2003  Cajus Pollmeier
  Copyright (C) 2011-2019  FusionDirectory
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
require_once("class_setupStep.inc");
class setup implements FusionDirectoryDialog
  /* Number of setup steps */
  var $i_steps;
  /* Current step */
  var $i_current        = 0;
  /* Previous setup step */
  var $i_previous       = 0;
  var $i_config         = 4;
  var $o_steps          = [];
  var $captured_values  = [];
  function __construct ()
    $this->o_steps = [
      new setupStepWelcome($this),
      new setupStepLanguage($this),
      new setupStepChecks($this),
      new setupStepLdap($this),
      new setupStepConfigBeforeInit($this),
      new setupStepMigrate($this),
      new setupStepFinish($this),
    $this->i_steps = count($this->o_steps);
    /* Ensure that setup is not reachable if fusiondirectory.conf exist (CONFIG_FILE) */
    if (file_exists(CONFIG_DIR.'/'.CONFIG_FILE)) {
      session::destroy('Invalid setup.php call');
      header('Location: index.php');
      exit();
  public function render (): string
    /* Display phpinfo() dialog when $_GET['info'] is set,
     *  but only do this, if user is allowed to use the setup.
     * If setupsetupStepWelcome is_completed, we are allowed to view those infos-
    if (isset($_GET['info']) && preg_match('/setupStepWelcome/i', get_class($this->o_steps[0])) && $this->o_steps[0]->is_completed()) {
      phpinfo();
      exit();