X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Finstall-inc.php;h=fa17cf66ce4e2c5cee8276512338fb45d1be0983;hp=eb857910094daf7a2bca0bbd174264c32e30d058;hb=9dea40187dc40c8e2b642dccae039c681cbc43f9;hpb=1fe7cf281be6832ba105934537aba5127892c576
diff --git a/inc/install-inc.php b/inc/install-inc.php
index eb85791009..fa17cf66ce 100644
--- a/inc/install-inc.php
+++ b/inc/install-inc.php
@@ -1,7 +1,7 @@
READ: ".$file." ");
- if (is_resource($fp)) {
- $fp_tmp = @fopen($tmp, 'w') or OUTPUT_HTML("WRITE: ".$tmp." ");
- if (is_resource($fp_tmp)) {
- while (!feof($fp)) {
- $line = fgets ($fp, 10240);
- //* DEBUG: */ echo $search."/".htmlentities($line)." \n";
- $found = strpos($line, $search);
- //* DEBUG: */ echo "FOUND: ";
- //* DEBUG: */ var_dump($found);
- //* DEBUG: */ echo " \n";
- if ($found !== false) $next = 0;
- if ($next > -1) {
- if ($next == $sneak) {
- $next = -1;
- $line = $prefix.$DATA.$suffix."\n";
- //* DEBUG: */ echo "NEW: ".htmlentities($line)." \n";
- } 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);
-
- if (($done) && (is_writeable($file))) {
- // Copy back tmp file and delete tmp :-)
- @copy($tmp, $file);
- @unlink($tmp);
- } else {
- OUTPUT_HTML("TMP: UNDONE!");
- }
- } // END - if
- } else {
- OUTPUT_HTML("404: ".$file." ");
- }
-}
+ die();
+} // END - if
-//
-$mysql = "";
-if (isset($_POST['mysql']) && is_array($_POST['mysql'])) $mysql = $_POST['mysql'];
-
-if (URL != "http://your-server.com") {
- // Already installed???
- $burl = constant('URL');
-} elseif (empty($burl)) {
- // Auto-detect URL
- $burl = "http://".$SERVER_NAME.$_SERVER['PHP_SELF'];
- $burl = substr($burl, 0, strpos($burl, "install.php"));
-}
+// Init variables
+$mysql = array();
+if ((isPostRequestParameterSet('mysql')) && (is_array(postRequestParameter('mysql')))) {
+ // Transfer 'mysql' array
+ $mysql = postRequestParameter('mysql');
+} // END - if
// Check if both passwords from SMTP are matching
-if ((isset($_GET['page']) && ($_GET['page'] == 5))) {
+if ((isGetRequestParameterSet('page') && (getRequestParameter('page') == 5))) {
// Okay, we have to check it
- if (!empty($_POST['smtp_user']) && (empty($_POST['smtp_host']))) {
+ if (isPostRequestParameterSet('smtp_user') && (!isPostRequestParameterSet('smtp_host'))) {
// Hostname not set
- OUTPUT_HTML(getMessage('INSTALL_SMTP_HOSTNAME_EMPTY')." ");
- $_GET['page'] = 3;
+ addToInstallContent('
' . getMessage('INSTALL_SMTP_HOSTNAME_EMPTY') . '
');
+ setGetRequestParameter('page', 3);
} // END - if
- if ((empty($_POST['smtp_pass1'])) && (!empty($_POST['smtp_pass2']))) {
+
+ if ((!isPostRequestParameterSet('smtp_pass1')) && (isPostRequestParameterSet('smtp_pass2'))) {
// Password is empty
- OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS1_EMPTY')." ");
- $_GET['page'] = 3;
+ addToInstallContent('
' . getMessage('INSTALL_SMTP_PASS1_EMPTY') . '
');
+ setGetRequestParameter('page', 3);
} // END - if
- if ((!empty($_POST['smtp_pass1'])) && (empty($_POST['smtp_pass2']))) {
+
+ if ((isPostRequestParameterSet('smtp_pass1')) && (!isPostRequestParameterSet('smtp_pass2'))) {
// Password repeat is empty
- OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS2_EMPTY')." ");
- $_GET['page'] = 3;
+ addToInstallContent('
' . getMessage('INSTALL_SMTP_PASS2_EMPTY') . '
');
+ setGetRequestParameter('page', 3);
} // END - if
- if ($_POST['smtp_pass1'] != $_POST['smtp_pass1']) {
+
+ if (postRequestParameter('smtp_pass1') != postRequestParameter('smtp_pass1')) {
// Passwords are not matching
- OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS_MISMATCH')." ");
- $_GET['page'] = 3;
+ addToInstallContent('
' . getMessage('INSTALL_SMTP_PASS_MISMATCH') . '
');
+ setGetRequestParameter('page', 3);
} // END - if
} // END - if
-// Is MXChange installed or no admin registered so far?
-if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered')))
-{
- // Set URL for FORM actions
- define('__BURL_ACTION', $burl);
-
+// Is the mailer installed or no admin registered so far?
+if ((!isInstalled()) || (!isAdminRegistered())) {
// Output page for entered value
- switch ($_GET['page'])
- {
- case "welcome": // Welcome to the installation!
- LOAD_TEMPLATE("install_welcome");
- break;
-
- case "1": // Server path, base URL
- // @Profi-Concept: Hab meine Meinung doch geaendert! :-)
- // Load template
- LOAD_TEMPLATE("install_page1");
- break;
-
- case "2": // MySQL data (alone!)
- if (empty($mysql['dbase'])) $mysql['dbase'] = "your_database";
- if (empty($mysql['login'])) $mysql['login'] = "your_login";
- if (empty($mysql['host'])) $mysql['host'] = "localhost";
- if (empty($mysql['prefix'])) $mysql['prefix'] = "mxchange_";
- if (getTotalFatalErrors() > 0) {
- OUTPUT_HTML("");
- foreach ($FATAL as $key => $err) {
- OUTPUT_HTML(" · {--FATAL_NO--}".($key + 1).": ".$err." ");
+ switch (getRequestParameter('page')) {
+ case 'welcome': // Welcome to the installation!
+ addTemplateToInstallContent('install_welcome');
+ break;
+
+ case '1': // Server path, base URL
+ // Load template
+ addTemplateToInstallContent('install_page1');
+ break;
+
+ case '2': // MySQL data (alone!)
+ if (empty($mysql['dbase'])) $mysql['dbase'] = 'your_database';
+ if (empty($mysql['login'])) $mysql['login'] = 'your_login';
+ if (empty($mysql['host'])) $mysql['host'] = 'localhost';
+ if (empty($mysql['prefix'])) $mysql['prefix'] = 'mxchange';
+ if (empty($mysql['type'])) $mysql['type'] = 'MyISAM';
+ if (getTotalFatalErrors() > 0) {
+ addToInstallContent('