__recovery(); } catch (\Exception $e) { return $this->__Index(); } } public function __recovery() { if (self::$connection = self::fusion_get_config(BASEDIR.'config_temp.php')) { $validation = Requirements::get_system_validation(); $current_version = fusion_get_settings('version'); if (!empty($current_version)) { if (isset($validation[3])) { if (version_compare(self::BUILD_VERSION, $current_version, ">")) { return $this->step_Upgrade(); } else { return $this->__RecoveryConsole(); } } throw new \Exception('Not a valid Super Administrator'); } else { throw new \Exception('No table to upgrade or recover from'); } } throw new \Exception('No config'); } private function step_Upgrade() { /* * Here we already have a working database, but config is not done so there will be errors. * Now I've already cured the config_temp.php to PF9 standard config_temp.php * All we need to do left is check on the system, so we'll send to start with STEP2 */ $_GET['upgrade'] = TRUE; $_POST['license'] = TRUE; $this->installer_step(self::STEP_INTRO); return $this->__Index(); } private function __Index() { if (isset($_POST['step']) && $_POST['step'] == 1) { if (isset($_POST['license'])) { $_SESSION['step'] = self::STEP_PERMISSIONS; redirect(FUSION_SELF."?localeset=".LANGUAGE); } else { redirect(FUSION_SELF."?error=license&localeset=".LANGUAGE); } } $content = "

".(isset($_GET['upgrade']) ? self::$locale['setup_0022'] : self::$locale['setup_0002'])."

\n"; $content .= "

".(isset($_GET['upgrade']) ? self::$locale['setup_0023'] : self::$locale['setup_0003'])."

\n"; $content .= "

".self::$locale['setup_1001']."

\n"; $content .= "
"; $content .= "

".self::$locale['setup_1000']."

\n"; $content .= form_select('localeset', '', LANGUAGE, [ 'options' => self::$locale_files, ] ); if (isset($_GET['error']) && $_GET['error'] == 'license') { $content .= "
".self::$locale['setup_5000']."
\n"; } $content .= form_checkbox('license', self::$locale['setup_0005'], '', [ 'reverse_label' => TRUE, 'required' => TRUE, 'error_text' => self::$locale['setup_5000'] ] ); add_to_jquery(' $("#step").attr("disabled", true); $("#license").on("click", function() { if ($(this).is(":checked")) { $("#step").attr("disabled", false); } else { $("#step").attr("disabled", true); } }); '); add_to_jquery(" $('#localeset').bind('change', function() { var value = $(this).val(); document.location.href='".FUSION_SELF."?localeset='+value; }); "); self::$step = [ 1 => [ 'name' => 'step', 'label' => self::$locale['setup_0121'], 'value' => self::STEP_INTRO ] ]; return $content; } private function __RecoveryConsole() { $content = "

".self::$locale['setup_1002']."

\n"; if (isset($_POST['htaccess'])) { require_once(INCLUDES.'htaccess_include.php'); write_htaccess(); addNotice('success', self::$locale['setup_1020']); $this->installer_step(self::STEP_INTRO); redirect(FUSION_SELF."?localeset=".LANGUAGE); } if (isset($_POST['uninstall'])) { require_once CLASSES.'PHPFusion/Installer/Lib/Core.tables.inc'; // See below previous comment $coretables = get_core_tables(self::$localeset); $i = 0; foreach (array_keys($coretables) as $table) { $result = dbquery("DROP TABLE IF EXISTS ".self::$connection['db_prefix'].$table); if ($result) { $i++; usleep(600); continue; } } @unlink(BASEDIR.'config_temp.php'); @unlink(BASEDIR.'config.php'); @unlink(BASEDIR.'.htaccess'); // go back to the installer $_SESSION['step'] = self::STEP_INTRO; addNotice('danger', "".self::$locale['setup_0125'].""); $content .= renderNotices(getNotices()); if ($i == count($coretables)) { redirect(filter_input(INPUT_SERVER, 'REQUEST_URI'), 6); } } else { // Exit Installer $content .= "".self::$locale['setup_1003']."\n"; $content .= "
\n"; $content .= renderNotices(getNotices()); $content .= form_hidden('localeset', '', LANGUAGE); $content .= "
".self::$locale['setup_1017']."
\n"; $content .= "

".self::$locale['setup_1018']."

\n"; $content .= form_button('step', self::$locale['setup_1019'], self::STEP_EXIT, ['class' => 'btn-success']); $content .= "
\n"; // Change Primary Admin Details $content .= "
".self::$locale['setup_1011']."
\n"; $content .= "

".self::$locale['setup_1012']."

\n"; $content .= form_button('step', self::$locale['setup_1013'], self::STEP_TRANSFER, ['class' => 'btn-primary']); $content .= "
\n"; // Infusions Installer $content .= "
".self::$locale['setup_1008']."
\n"; $content .= "

".self::$locale['setup_1009']."

\n"; $content .= form_button('step', self::$locale['setup_1010'], self::STEP_INFUSIONS, ['class' => 'btn-primary']); $content .= "
\n"; // Build htaccess if (isset(self::$connection['db_prefix'])) { $content .= "
".self::$locale['setup_1014']."
\n"; $content .= "

".self::$locale['setup_1015']."

\n"; $content .= form_button('htaccess', self::$locale['setup_1014'], 'htaccess', ['class' => 'btn-default']); $content .= "
\n"; } $content .= "
".self::$locale['setup_1004']."
\n"; $content .= "

".self::$locale['setup_1005']."

".self::$locale['setup_1006']."

\n"; $content .= form_button('uninstall', self::$locale['setup_1007'], 'uninstall', ['class' => 'btn-danger']); } return $content; } }