X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Finstall-inc.php;h=0ff9df89976b9622efd1dc1f383e5d52cd463eae;hb=c3b3af29e6e80926519ade146ac657c036782bd3;hp=f19cf3a718928e19c6b463653dd5bb2c932870b5;hpb=798cdd57a6c0e5879e3ad5d9a76900ed27e1d9e0;p=mailer.git diff --git a/inc/install-inc.php b/inc/install-inc.php index f19cf3a718..0ff9df8997 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'))) @@ -348,24 +348,20 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT // Should be save here because file_exists() is there but we check it again. :) $file = secureString($_POST['spath']) . "install/" . $dump; if (FILE_READABLE($file)) { - // Load the file - $sql = implode("", file($file)); - - // Remove some unwanted chars - $sql = str_replace("\r", "", $sql); - $sql = str_replace("\n\n", "\n", $sql); + // Read the file + $SQLs = READ_FILE($file, true); // 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 +372,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 +394,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) || ((isset($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 +446,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 +461,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); } //