/** * Check for previous sessions. * Checks to see if there's an unfinished upgrade. * * @param array * @access public */ public static function restorePreviousSession($session) { /* Delete all previous sessions */ ipsRegistry::DB()->delete('upgrade_sessions', 'session_id != \'' . ipsRegistry::$request['s'] . '\''); /* Update the session */ ipsRegistry::DB()->update('upgrade_sessions', array('session_current_time' => time(), 'session_section' => $session['session_section'], 'session_post' => serialize($session['_session_post']), 'session_get' => serialize($session['_session_get'])), 'session_id=\'' . ipsRegistry::$request['s'] . '\''); /* Set correct app */ $_GET['app'] = 'upgrade'; $_POST['app'] = 'upgrade'; ipsRegistry::$request['app'] = 'upgrade'; ipsRegistry::$current_section = 'upgrade'; /* Set correct section */ $_GET['section'] = $session['_session_get']['section']; $_POST['section'] = $session['_session_get']['section']; ipsRegistry::$request['section'] = $session['_session_get']['section']; ipsRegistry::$current_section = $session['_session_get']['section']; /* Set up the correct do */ $_GET['do'] = $session['_session_get']['do']; $_POST['do'] = $session['_session_get']['do']; ipsRegistry::$request['do'] = $session['_session_get']['do']; /* Set up the correct previous */ $_GET['previous'] = $session['_session_get']['previous']; $_POST['previous'] = $session['_session_get']['previous']; ipsRegistry::$request['previous'] = $session['_session_get']['previous']; /* Set up SD */ $_POST['_sd'] = $session['_sd']; ipsRegistry::$request['_sd'] = $session['_sd']; /* App dir, etc */ ipsRegistry::$request['appdir'] = $session['_sd']['appdir']; ipsRegistry::$request['man'] = $session['_sd']['man']; ipsRegistry::$request['helpfile'] = $session['_sd']['helpfile']; $apps = explode(',', $session['_sd']['install_apps']); $toSave = array(); $vNums = array(); /* set saved data */ if (count($session['_sd'])) { foreach ($session['_sd'] as $k => $v) { if ($k) { IPSSetUp::setSavedData($k, $v); } } } if (is_array($apps) and count($apps)) { /* Grab data */ foreach ($apps as $app) { /* Grab version numbers */ $numbers = IPSSetUp::fetchAppVersionNumbers($app); /* Grab all numbers */ $nums[$app] = IPSSetUp::fetchXmlAppVersions($app); /* Grab app data */ $appData[$app] = IPSSetUp::fetchXmlAppInformation($app); $appClasses[$app] = IPSSetUp::fetchVersionClasses($app, $numbers['current'][0], $numbers['latest'][0]); /* Store starting vnums */ $vNums[$app] = $numbers['current'][0]; } /* Got anything? */ if (count($appClasses)) { foreach ($appClasses as $app => $data) { foreach ($data as $num) { if (is_file(IPSLib::getAppDir($app) . '/setup/versions/upg_' . $num . '/version_class.php')) { $_class = 'version_class_' . $app . '_' . $num; require_once IPSLib::getAppDir($app) . '/setup/versions/upg_' . $num . '/version_class.php'; /*noLibHook*/ $_tmp = new $_class(ipsRegistry::instance()); if (method_exists($_tmp, 'preInstallOptionsSave')) { $_t = $_tmp->preInstallOptionsSave(); if (is_array($_t) and count($_t)) { $toSave[$app][$num] = $_t; } } } } } /* Save it */ if (count($toSave)) { IPSSetUp::setSavedData('custom_options', $toSave); } if (count($vNums)) { IPSSetUp::setSavedData('version_numbers', $vNums); } } /* Freeze data */ IPSSetUp::freezeSavedData(); /* Thaw it */ IPSSetUp::thawSavedData(); } /* Re run our controller */ ipsController::run(); }
/** * Main output function * * @access public * @param boolean TRUE - freeze data, FALSE, do not. * @return @e void Nothin' */ public function sendOutput($saveData = TRUE) { //----------------------------------------- // INIT //----------------------------------------- $_hit = 0; /* Options */ $options['savedData'] = $saveData === TRUE ? IPSSetUp::freezeSavedData() : ''; $options['hideButton'] = $this->_hideButton === TRUE ? TRUE : FALSE; $options['progress'] = array(); /* Sequence progress */ foreach ($this->sequenceData as $key => $page) { if ($key == $this->currentPage) { $options['progress'][] = array('step_doing', $page); $_hit = 1; } else { if ($_hit) { $options['progress'][] = array('step_notdone', $page); } else { $options['progress'][] = array('step_done', $page); } } } //----------------------------------------- // Header //----------------------------------------- if (isset($_SERVER['SERVER_PROTOCOL']) and strstr($_SERVER['SERVER_PROTOCOL'], '/1.0')) { header("HTTP/1.0 200 OK"); } else { header("HTTP/1.1 200 OK"); } header("Content-type: text/html;charset={$this->settings['gb_char_set']}"); header("Cache-Control: no-cache, must-revalidate, max-age=0"); header("Expires: 0"); header("Pragma: no-cache"); $template = $this->template->globalTemplate($this->_title, $this->_html, $options, $this->_errors, $this->_warnings, $this->_messages, $this->_installStep, $this->_curVersion, $this->_curApp); print $template; exit; }
/** * Writes out conf_global * * @access public * @return bool File written successfully */ public static function writeConfiguration() { //----------------------------------------- // Safe mode? //----------------------------------------- $safe_mode = 0; if (@get_cfg_var('safe_mode')) { $safe_mode = @get_cfg_var('safe_mode'); } //----------------------------------------- // Set info array //----------------------------------------- $INFO = array('sql_driver' => IPSSetUp::getSavedData('sql_driver'), 'sql_host' => IPSSetUp::getSavedData('db_host'), 'sql_database' => IPSSetUp::getSavedData('db_name'), 'sql_user' => IPSSetUp::getSavedData('db_user'), 'sql_pass' => str_replace('\'', '\\\'', IPSSetUp::getSavedData('db_pass')), 'sql_tbl_prefix' => IPSSetUp::getSavedData('db_pre'), 'sql_debug' => 0, 'sql_charset' => '', 'board_start' => time(), 'installed' => 1, 'php_ext' => 'php', 'safe_mode' => $safe_mode, 'board_url' => IPSSetUp::getSavedData('install_url'), 'banned_group' => '5', 'admin_group' => '4', 'guest_group' => '2', 'member_group' => '3', 'auth_group' => '1', 'use_friendly_urls' => 1, '_jsDebug' => 0); //--------------------------------------------- // Any "extra" configs required for this driver? //--------------------------------------------- foreach (IPSSetUp::getSavedDataAsArray() as $k => $v) { if (preg_match("#^__sql__#", $k)) { $k = str_replace("__sql__", "", $k); $INFO[$k] = $v; } } //--------------------------------------------- // Write to disk //--------------------------------------------- $core_conf = "<" . "?php\n"; foreach ($INFO as $k => $v) { $core_conf .= '$INFO[' . "'" . $k . "'" . ']' . "\t\t\t=\t'" . $v . "';\n"; } $core_conf .= "\ndefine('IN_DEV', 0);"; /* Remote archive stuff */ $core_conf .= "\n/* Remote archive DB - complete these details if you\\'re using a remote DB for the post archive.\n If content has already been archived in the local DB, this will need transferring and will not be done automatically. */\n"; foreach (array('archive_remote_sql_host', 'archive_remote_sql_database', 'archive_remote_sql_user', 'archive_remote_sql_pass', 'archive_remote_sql_charset') as $k) { $core_conf .= '$INFO[' . "'" . $k . "'" . ']' . "\t\t\t=\t'';\n"; } $core_conf .= "\n" . '?' . '>'; /* Write Configuration Files */ $output[] = 'Writing configuration files...<br />'; $ret = IPSSetUp::writeFile(IPSSetUp::getSavedData('install_dir') . '/conf_global.php', $core_conf); /* Now freeze data */ IPSSetUp::freezeSavedData(); return $ret; }
/** * Writes out conf_global * * @access public * @return bool File written successfully */ public static function writeConfiguration() { //----------------------------------------- // Safe mode? //----------------------------------------- $safe_mode = 0; if (@get_cfg_var('safe_mode')) { $safe_mode = @get_cfg_var('safe_mode'); } //----------------------------------------- // Set info array //----------------------------------------- $INFO = array('sql_driver' => IPSSetUp::getSavedData('sql_driver'), 'sql_host' => IPSSetUp::getSavedData('db_host'), 'sql_database' => IPSSetUp::getSavedData('db_name'), 'sql_user' => IPSSetUp::getSavedData('db_user'), 'sql_pass' => IPSSetUp::getSavedData('db_pass'), 'sql_tbl_prefix' => IPSSetUp::getSavedData('db_pre'), 'sql_debug' => 1, 'sql_charset' => '', 'board_start' => time(), 'installed' => 1, 'php_ext' => 'php', 'safe_mode' => $safe_mode, 'board_url' => IPSSetUp::getSavedData('install_url'), 'banned_group' => '5', 'admin_group' => '4', 'guest_group' => '2', 'member_group' => '3', 'auth_group' => '1', 'use_friendly_urls' => 1, '_jsDebug' => 0); //--------------------------------------------- // Any "extra" configs required for this driver? //--------------------------------------------- foreach (IPSSetUp::getSavedDataAsArray() as $k => $v) { if (preg_match("#^__sql__#", $k)) { $k = str_replace("__sql__", "", $k); $INFO[$k] = $v; } } //--------------------------------------------- // Write to disk //--------------------------------------------- $core_conf = "<" . "?php\n"; foreach ($INFO as $k => $v) { $core_conf .= '$INFO[' . "'" . $k . "'" . ']' . "\t\t\t=\t'" . $v . "';\n"; } $core_conf .= "\ndefine('IN_DEV', 0);"; $core_conf .= "\n" . '?' . '>'; /* Write Configuration Files */ $output[] = 'Writing configuration files...<br />'; $ret = IPSSetUp::writeFile(IPSSetUp::getSavedData('install_dir') . '/conf_global.php', $core_conf); /* Now freeze data */ IPSSetUp::freezeSavedData(); return $ret; }