X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Finstall-inc.php;h=5768d4807b22dc8bc1490d9b2e3e492afa492102;hb=aa838f04c6d825f706e3c7e27e3e1aa8bbd9ebb2;hp=552956e9a6683588bf8b98c332e2bce73c2f8e79;hpb=7f104f6fe558bb56b4205241435a2357c2feece1;p=mailer.git diff --git a/inc/install-inc.php b/inc/install-inc.php index 552956e9a6..5768d4807b 100644 --- a/inc/install-inc.php +++ b/inc/install-inc.php @@ -71,15 +71,15 @@ function install_WriteData ($file, $comment, $prefix, $suffix, $DATA, $sneak=0) } else { $next++; } - } + } // END - if //* DEBUG: */ echo "WRITE: ".htmlentities($line)."
\n"; fputs($fp_tmp, $line); - } + } // END - while fclose($fp_tmp); // Finished writing tmp file $done = true; - } + } // END - if // Close source directory fclose($fp); @@ -91,7 +91,7 @@ function install_WriteData ($file, $comment, $prefix, $suffix, $DATA, $sneak=0) } else { OUTPUT_HTML("TMP: UNDONE!"); } - } + } // END - if } else { OUTPUT_HTML("404: ".$file."
"); } @@ -117,23 +117,23 @@ if ((isset($_GET['page']) && ($_GET['page'] == 5))) { // Hostname not set OUTPUT_HTML(INSTALL_SMTP_HOSTNAME_EMPTY."
"); $_GET['page'] = 3; - } + } // END - if if ((empty($_POST['smtp_pass1'])) && (!empty($_POST['smtp_pass2']))) { // Password is empty OUTPUT_HTML(INSTALL_SMTP_PASS1_EMPTY."
"); $_GET['page'] = 3; - } + } // END - if if ((!empty($_POST['smtp_pass1'])) && (empty($_POST['smtp_pass2']))) { // Password repeat is empty OUTPUT_HTML(INSTALL_SMTP_PASS2_EMPTY."
"); $_GET['page'] = 3; - } + } // END - if if ($_POST['smtp_pass1'] != $_POST['smtp_pass1']) { // Passwords are not matching OUTPUT_HTML(INSTALL_SMTP_PASS_MISMATCH."
"); $_GET['page'] = 3; - } -} + } // END - if +} // END - if // Is MXChange installed or no admin registered so far? if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered'))) @@ -356,16 +356,16 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT $sql = str_replace("\n\n", "\n", $sql); // And split it up against ;\n ... - $SQLs = array_merge($SQLs, explode(";\n", $sql)); - } - } + $SQLs = merge_array($SQLs, explode(";\n", $sql)); + } // END - if + } // END - foreach // Are some SQLs found? if (count($SQLs) == 0) { // Abort here ADD_FATAL(INSTALL_SQL_IMPORT_FAILED); return; - } + } // END - if // Now run all queries through and try to keep out empty or comment queries foreach ($SQLs as $sql) { @@ -376,8 +376,8 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT if ((!empty($sql)) && (substr($sql, 0, 2) != "--") && (substr($sql, 0, 1) != "#")) { // Then run it! SQL_QUERY($sql, __FILE__, __LINE__); - } - } + } // END - if + } // END - foreach // Ok, all done. So we can write the config data to the php files if ($_POST['spath'] != PATH) install_WriteData($_POST['spath']."inc/config.php", "SERVER-PATH", "define('PATH', \"", "\");", $_POST['spath'], 0); @@ -398,30 +398,23 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT install_WriteData($_POST['spath']."inc/config.php", "SMTP-USER", "define('SMTP_USER', \"", "\");", $_POST['smtp_user'], 0); install_WriteData($_POST['spath']."inc/config.php", "SMTP-PASSWORD", "define('SMTP_PASSWORD', \"", "\");", $_POST['smtp_pass'], 0); install_WriteData($_POST['spath']."inc/config.php", "INSTALLED", "define('mxchange_installed', ", ");", "true", 0); - - // Close the link - SQL_CLOSE($link, __FILE__, __LINE__); - } - else - { + } else { // Installation area not found! ADD_FATAL(INSTALL_MISSING_DUMPS); } - } - } - if ((sizeof($FATAL) > 0) || ($FATAL[0] != '')) - { + } // END - if + } // END - if + + if ((sizeof($FATAL) > 0) || ((isset($FATAL[0])) && ($FATAL[0] != ''))) { $OUT = ""; - foreach ($FATAL as $value) - { + foreach ($FATAL as $value) { $OUT .= "
  • ".$value."
  • \n"; - } + } // END foreach define('__FATAL_ERROR_LI', $OUT); $OUT = ""; - foreach ($mysql as $key => $value) - { + foreach ($mysql as $key => $value) { $OUT .= " \n"; - } + } // END foreach define('__MYSQL_DATA' , $OUT); define('__SPATH_VALUE' , $_POST['spath']); define('__BURL_VALUE' , $_POST['burl']); @@ -457,21 +450,14 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT "); - } - else - { + } else { // Installation is done! - $URL = $burl."/install.php?page=finalize"; - LOAD_URL($URL); + LOAD_URL($burl."/install.php?page=finalize"); } - } - elseif (isBooleanConstantAndTrue('mxchange_installed')) - { + } elseif (isBooleanConstantAndTrue('mxchange_installed')) { // Redirection after writing data... :-) LOAD_TEMPLATE("install_finished"); - } - else - { + } else { // Something goes wrong during installation! :-( ADD_FATAL(INSTALL_FINALIZER_FAILED); include ("inc/fatal_errors.php"); @@ -479,12 +465,11 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT break; default: + DEBUG_LOG(__FILE__, __LINE__, sprintf("Wrong page %s detected.", $_GET['page'])); OUTPUT_HTML(" ".WRONG_PAGE.""); break; } -} - else -{ +} else { ADD_FATAL(ALREADY_INSTALLED); } //