X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Finstall-inc.php;h=5768d4807b22dc8bc1490d9b2e3e492afa492102;hb=1dddfaaf4153c2df63288c2d1e4b39f9196afb59;hp=b07d9fef35ccc2173a50b852d91c6363a91b3890;hpb=80e2def8ef2125fd4d7d1312ee3993ab613f0846;p=mailer.git
diff --git a/inc/install-inc.php b/inc/install-inc.php
index b07d9fef35..5768d4807b 100644
--- a/inc/install-inc.php
+++ b/inc/install-inc.php
@@ -36,7 +36,7 @@
************************************************************************/
// Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
+if (!defined('__SECURITY')) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
}
@@ -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."
");
}
@@ -104,7 +104,7 @@ if (isset($_POST['mysql']) && is_array($_POST['mysql'])) $mysql = $_POST['mysql'
if (URL != "http://your-server.com") {
// Already installed???
$burl = URL;
-} elseif ($burl == "") {
+} elseif (empty($burl)) {
// Auto-detect URL
$burl = "http://".$SERVER_NAME.$_SERVER['PHP_SELF'];
$burl = substr($burl, 0, strpos($burl, "install.php"));
@@ -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')))
@@ -275,7 +275,7 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT
if (isBooleanConstantAndTrue('warn_no_pass')) OUTPUT_HTML(" selected=\"selected\"");
OUTPUT_HTML(">".YES."
@@ -289,7 +289,7 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT
if (isBooleanConstantAndTrue('WRITE_FOOTER')) OUTPUT_HTML(" selected=\"selected\"");
OUTPUT_HTML(">".YES."
@@ -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 .= "