/**
  * Constructor
  *
  * @return void
  */
 function tx_install()
 {
     parent::t3lib_install();
     if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword']) {
         die("Install Tool deactivated.<br />You must enable it by setting a password in typo3conf/localconf.php. If you insert the line below, the password will be 'joh316':<br /><br />\$TYPO3_CONF_VARS['BE']['installToolPassword'] = '******';");
     }
     if ($this->sendNoCacheHeaders) {
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
         header('Expires: 0');
         header('Cache-Control: no-cache, must-revalidate');
         header('Pragma: no-cache');
     }
     // ****************************
     // Initializing incoming vars.
     // ****************************
     $this->INSTALL = t3lib_div::_GP('TYPO3_INSTALL');
     $this->mode = t3lib_div::_GP('mode');
     if ($this->mode !== '123') {
         $this->mode = '';
     }
     if (t3lib_div::_GP('step') === 'go') {
         $this->step = 'go';
     } else {
         $this->step = intval(t3lib_div::_GP('step'));
     }
     $this->redirect_url = t3lib_div::_GP('redirect_url');
     $this->INSTALL['type'] = '';
     if ($_GET['TYPO3_INSTALL']['type']) {
         $allowedTypes = array('config', 'database', 'update', 'images', 'extConfig', 'cleanup', 'phpinfo', 'typo3conf_edit', 'about', 'logout');
         if (in_array($_GET['TYPO3_INSTALL']['type'], $allowedTypes)) {
             $this->INSTALL['type'] = $_GET['TYPO3_INSTALL']['type'];
         }
     }
     if ($this->step == 4) {
         $this->INSTALL['type'] = 'database';
     }
     // Hook to raise the counter for the total steps in the 1-2-3 installer
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['additionalSteps'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['additionalSteps'] as $classData) {
             $hookObject = t3lib_div::getUserObj($classData);
             $this->totalSteps += (int) $hookObject->executeAdditionalSteps($this);
         }
     }
     if ($this->mode == '123') {
         $tempItems = $this->menuitems;
         $this->menuitems = array('config' => $tempItems['config'], 'database' => $tempItems['database']);
         if (!$this->INSTALL['type'] || !isset($this->menuitems[$this->INSTALL['type']])) {
             $this->INSTALL['type'] = 'config';
         }
     } else {
         if (!$this->INSTALL['type'] || !isset($this->menuitems[$this->INSTALL['type']])) {
             $this->INSTALL['type'] = 'about';
         }
     }
     $this->action = $this->scriptSelf . '?TYPO3_INSTALL[type]=' . $this->INSTALL['type'] . ($this->mode ? '&mode=' . $this->mode : '') . ($this->step ? '&step=' . $this->step : '');
     $this->typo3temp_path = PATH_site . 'typo3temp/';
     if (!is_dir($this->typo3temp_path) || !is_writeable($this->typo3temp_path)) {
         die('Install Tool needs to write to typo3temp/. Make sure this directory is writeable by your webserver: ' . $this->typo3temp_path);
     }
     $this->session = t3lib_div::makeInstance('tx_install_session');
     // *******************
     // Check authorization
     // *******************
     if (!$this->session->hasSession()) {
         $this->session->startSession();
     }
     if ($this->session->isAuthorized() || $this->checkPassword()) {
         $this->passwordOK = 1;
         $this->session->refreshSession();
         $enableInstallToolFile = PATH_typo3conf . 'ENABLE_INSTALL_TOOL';
         if (is_file($enableInstallToolFile)) {
             // Extend the age of the ENABLE_INSTALL_TOOL file by one hour
             @touch($enableInstallToolFile);
         }
         // Let DBAL decide whether to load itself
         $dbalLoaderFile = $this->backPath . 'sysext/dbal/class.tx_dbal_autoloader.php';
         if (@is_file($dbalLoaderFile)) {
             include $dbalLoaderFile;
         }
         if ($this->redirect_url) {
             t3lib_utility_Http::redirect($this->redirect_url);
         }
     } else {
         $this->loginForm();
     }
 }