diff --git a/e107_languages/English/lan_installer.php b/e107_languages/English/lan_installer.php index af68ad5c3..eb21e0833 100644 --- a/e107_languages/English/lan_installer.php +++ b/e107_languages/English/lan_installer.php @@ -182,5 +182,6 @@ define("LANINS_123", "Optional: Your public name or alias. Leave blank to use th define("LANINS_124", "Please choose a password of at least 8 characters"); define("LANINS_125", "e107 has been installed successfully!"); define("LANINS_126", "For security reasons you should now set the file permissions on the e107_config.php file back to 644."); - +define("LANINS_127", "The database [x] already exists. Overwrite it? (any existing data will be lost)"); +define("LANINS_128", "Overwrite"); diff --git a/e107_plugins/tinymce4/plugin.xml b/e107_plugins/tinymce4/plugin.xml index 08191b3e0..8969f9502 100644 --- a/e107_plugins/tinymce4/plugin.xml +++ b/e107_plugins/tinymce4/plugin.xml @@ -1,5 +1,5 @@ - + TinyMce4 CDN version misc diff --git a/install.php b/install.php index b4941d2cb..bd519e3cf 100644 --- a/install.php +++ b/install.php @@ -253,6 +253,7 @@ class e_install if(isset($this->previous_steps['language'])) { define("e_LANGUAGE", $this->previous_steps['language']); + include_lan(e_LANGUAGEDIR.e_LANGUAGE."/".e_LANGUAGE.".php"); include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_admin.php"); } } @@ -352,6 +353,8 @@ class e_install $this->stage = 1; $this->logLine('Stage 1 started'); + + $this->template->SetTag("installation_heading", LANINS_001); $this->template->SetTag("stage_pre", LANINS_002); $this->template->SetTag("stage_num", LANINS_003); @@ -381,7 +384,7 @@ class e_install $this->stage = 2; $this->logLine('Stage 2 started'); $this->previous_steps['language'] = $_POST['language']; - + $this->template->SetTag("installation_heading", LANINS_001); $this->template->SetTag("stage_pre", LANINS_002); $this->template->SetTag("stage_num", LANINS_021); @@ -389,6 +392,11 @@ class e_install $this->template->SetTag("percent", 25); $this->template->SetTag("bartype", 'warning'); + if(!isset($this->previous_steps['mysql']['createdb'])) + { + $this->previous_steps['mysql']['createdb'] = 1; // default to yes. + } + // $this->template->SetTag("onload", "document.getElementById('name').focus()"); // $page_info = nl2br(LANINS_023); $page_info = "
Please fill in the form below with your MySQL details. If you do not know this information, please contact your hosting provider. You may hover over each field for additional information.
"; @@ -409,7 +417,7 @@ class e_install - + ".LANINS_031." @@ -417,7 +425,7 @@ class e_install - + ".LANINS_032." @@ -426,7 +434,7 @@ class e_install - + ".LANINS_033." @@ -480,6 +488,12 @@ class e_install private function stage_3() { + + if(!empty($_POST['back'])) + { + return $this->stage_2(); + } + global $e_forms; $success = TRUE; $this->stage = 3; @@ -492,19 +506,29 @@ class e_install $this->template->SetTag("percent", 40); $this->template->SetTag("bartype", 'warning'); - $this->previous_steps['mysql']['server'] = trim($_POST['server']); - $this->previous_steps['mysql']['user'] = trim($_POST['name']); - $this->previous_steps['mysql']['password'] = $_POST['password']; - $this->previous_steps['mysql']['db'] = trim($_POST['db']); - $this->previous_steps['mysql']['createdb'] = (isset($_POST['createdb']) && $_POST['createdb'] == TRUE ? TRUE : FALSE); - $this->previous_steps['mysql']['prefix'] = trim($_POST['prefix']); - + + if(!empty($_POST['server'])) + { + $this->previous_steps['mysql']['server'] = trim($_POST['server']); + $this->previous_steps['mysql']['user'] = trim($_POST['name']); + $this->previous_steps['mysql']['password'] = $_POST['password']; + $this->previous_steps['mysql']['db'] = trim($_POST['db']); + $this->previous_steps['mysql']['createdb'] = (isset($_POST['createdb']) && $_POST['createdb'] == TRUE ? TRUE : FALSE); + $this->previous_steps['mysql']['prefix'] = trim($_POST['prefix']); + } + if(!empty($_POST['overwritedb'])) + { + $this->previous_steps['mysql']['overwritedb'] = 1;; + } + $success = $this->check_name($this->previous_steps['mysql']['db'], FALSE) && $this->check_name($this->previous_steps['mysql']['prefix'], TRUE); + if ($success) { $success = $this->checkDbFields($this->previous_steps['mysql']); // Check for invalid characters } + if(!$success || $this->previous_steps['mysql']['server'] == "" || $this->previous_steps['mysql']['user'] == "") { $this->stage = 3; @@ -516,7 +540,7 @@ class e_install - + @@ -544,10 +568,12 @@ class e_install "; + if (!$success) { $output .= ""; } + $output .= "
".LANINS_030."
".LANINS_034."
".LANINS_105."


@@ -559,7 +585,8 @@ class e_install } else { - $this->template->SetTag("stage_title", LANINS_037.($this->previous_steps['mysql']['createdb'] == 1 ? LANINS_038 : "")); + $this->template->SetTag("stage_title", LANINS_037.($this->previous_steps['mysql']['createdb'] == 1 ? LANINS_038 : "")); + if (!$res = @mysql_connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password'])) { $success = FALSE; @@ -567,6 +594,23 @@ class e_install $alertType = 'error'; } + elseif(($this->previous_steps['mysql']['createdb'] == 1) && empty($this->previous_steps['mysql']['overwritedb']) && mysql_select_db($this->previous_steps['mysql']['db'], $res)) + { + $success = false; + $e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : "")); + $head = str_replace('[x]', ''.$this->previous_steps['mysql']['db'].'', LANINS_127); + $alertType = 'error'; + $e_forms->add_plain_html(" +   + " + + ); + + $this->finish_form(3); + $this->template->SetTag("stage_content", "
".$head."
".$e_forms->return_form()); + $this->logLine('Stage 3 completed'); + return; + } else { $page_content = " ".LANINS_042; @@ -580,17 +624,30 @@ class e_install } */ // Do brute force for now - Should be enough - - $DB_ALREADY_EXISTS = mysql_select_db($this->previous_steps['mysql']['db'], $res); - - //TODO Add option to continue install even if DB exists. - - if($this->previous_steps['mysql']['createdb'] == 1 || !$DB_ALREADY_EXISTS) + + if(!empty($this->previous_steps['mysql']['overwritedb'])) { - $query = 'CREATE DATABASE `'.$this->previous_steps['mysql']['db'].'` CHARACTER SET `utf8` '; + if($this->dbqry('DROP DATABASE `'.$this->previous_steps['mysql']['db'].'` ')) + { + $page_content .= "
Deleted existing database"; + } + else + { + $success = false; + $page_content .= "

".LANINS_043.nl2br("\n\n".LANINS_083."\n".mysql_error().""); + } + } - elseif($DB_ALREADY_EXISTS) + + if($this->previous_steps['mysql']['createdb'] == 1) { + $notification = "
".LANINS_044; + $query = 'CREATE DATABASE `'.$this->previous_steps['mysql']['db'].'` CHARACTER SET `utf8` '; + + } + else + { + $notification = "
Found existing database"; $query = 'ALTER DATABASE `'.$this->previous_steps['mysql']['db'].'` CHARACTER SET `utf8` '; } @@ -602,9 +659,10 @@ class e_install else { $this->dbqry('SET NAMES `utf8`'); - $page_content .= "
".LANINS_044; + $page_content .= $notification; // " } } + if($success) { $e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : "")); @@ -958,10 +1016,12 @@ class e_install $title = vartrue($themeInfo['@attributes']['name']); $category = vartrue($themeInfo['category']); + $selected = ($val == 'bootstrap3') ? "selected='selected'" : ""; + $output .= " - + {$category} "; @@ -1663,7 +1723,7 @@ class e_install { $errorInfo = 'Query Error [#'.mysql_errno().']: '.mysql_error()."\nQuery: {$qry}"; echo $errorInfo."
"; - exit; + //exit; $this->debug_db_info['db_error_log'][] = $errorInfo; //$this->debug_db_info['db_log'][] = $qry; return false; @@ -1694,13 +1754,16 @@ class e_forms } $this->form .= "\n"; } + + function add_button($id, $title, $align = "right", $type = "submit") { $this->form .= "
"; if($id != 'start') { - $this->form .= "« Back "; + $this->form .= "« ".LAN_BACK." "; + // $this->form .= " "; } if($id != 'back') {