]> git.mxchange.org Git - mailer.git/blob - inc/install-inc.php
Monthly beg/bonus rallye rewritten
[mailer.git] / inc / install-inc.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 08/29/2003 *
4  * ===============                              Last change: 11/11/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : install-inc.php                                  *
8  * -------------------------------------------------------------------- *
9  * Short description : Functions for installation procedure             *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Funktionen fuer die Installationsroutine         *
12  * -------------------------------------------------------------------- *
13  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
18  * This program is free software; you can redistribute it and/or modify *
19  * it under the terms of the GNU General Public License as published by *
20  * the Free Software Foundation; either version 2 of the License, or    *
21  * (at your option) any later version.                                  *
22  *                                                                      *
23  * This program is distributed in the hope that it will be useful,      *
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
26  * GNU General Public License for more details.                         *
27  *                                                                      *
28  * You should have received a copy of the GNU General Public License    *
29  * along with this program; if not, write to the Free Software          *
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 /************************************************************************
35  *      YOU MAY ALSO WANT TO REMOVE THIS FILE AFTER INSTALLTION!        *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
41         require($INC);
42 }
43
44 //
45 function install_WriteData ($file, $comment, $prefix, $suffix, $DATA, $sneak=0) {
46         // Initialize all and count up the "seak" value
47         $done = false;
48         $next = -1;
49         $sneak++;
50
51         if (FILE_READABLE($file)) {
52                 $search = "CFG: ".$comment;
53                 $tmp = $file.".tmp";
54                 $fp = @fopen($file, 'r') or OUTPUT_HTML("<STRONG>READ:</STRONG> ".$file."<br />");
55                 if (is_resource($fp)) {
56                         $fp_tmp = @fopen($tmp, 'w') or OUTPUT_HTML("<STRONG>WRITE:</STRONG> ".$tmp."<br />");
57                         if (is_resource($fp_tmp)) {
58                                 while (!feof($fp)) {
59                                         $line = fgets ($fp, 10240);
60                                         //* DEBUG: */ echo $search."/<font color=\"red\">".htmlentities($line)."</font><br />\n";
61                                         $found = strpos($line, $search);
62                                         //* DEBUG: */ echo "FOUND: <font color=\"brown\">";
63                                         //* DEBUG: */ var_dump($found);
64                                         //* DEBUG: */ echo "</font><br />\n";
65                                         if ($found !== false) $next = 0;
66                                         if ($next > -1) {
67                                                 if ($next == $sneak) {
68                                                         $next = -1;
69                                                         $line = $prefix.$DATA.$suffix."\n";
70                                                         //* DEBUG: */ echo "NEW: <font color=\"blue\">".htmlentities($line)."</font><br />\n";
71                                                 } else {
72                                                         $next++;
73                                                 }
74                                         }
75                                         //* DEBUG: */ echo "WRITE: <font color=\"green\">".htmlentities($line)."</font><br />\n";
76                                         fputs($fp_tmp, $line);
77                                 }
78                                 fclose($fp_tmp);
79
80                                 // Finished writing tmp file
81                                 $done = true;
82                         }
83
84                         // Close source directory
85                         fclose($fp);
86
87                         if (($done) && (is_writeable($file))) {
88                                 // Copy back tmp file and delete tmp :-)
89                                 @copy($tmp, $file);
90                                 @unlink($tmp);
91                         } else {
92                                 OUTPUT_HTML("<STRONG>TMP:</STRONG> UNDONE!");
93                         }
94                 }
95         } else {
96                 OUTPUT_HTML("<STRONG>404:</STRONG> ".$file."<br />");
97         }
98 }
99
100 //
101 $mysql = "";
102 if (isset($_POST['mysql']) && is_array($_POST['mysql'])) $mysql = $_POST['mysql'];
103
104 if (URL != "http://your-server.com") {
105         // Already installed???
106         $burl = URL;
107 } elseif (empty($burl)) {
108         // Auto-detect URL
109         $burl = "http://".$SERVER_NAME.$_SERVER['PHP_SELF'];
110         $burl = substr($burl, 0, strpos($burl, "install.php"));
111 }
112
113 // Check if both passwords from SMTP are matching
114 if ((isset($_GET['page']) && ($_GET['page'] == 5))) {
115         // Okay, we have to check it
116         if (!empty($_POST['smtp_user']) && (empty($_POST['smtp_host']))) {
117                 // Hostname not set
118                 OUTPUT_HTML(INSTALL_SMTP_HOSTNAME_EMPTY."<br />");
119                 $_GET['page'] = 3;
120         }
121         if ((empty($_POST['smtp_pass1'])) && (!empty($_POST['smtp_pass2']))) {
122                 // Password is empty
123                 OUTPUT_HTML(INSTALL_SMTP_PASS1_EMPTY."<br />");
124                 $_GET['page'] = 3;
125         }
126         if ((!empty($_POST['smtp_pass1'])) && (empty($_POST['smtp_pass2']))) {
127                 // Password repeat is empty
128                 OUTPUT_HTML(INSTALL_SMTP_PASS2_EMPTY."<br />");
129                 $_GET['page'] = 3;
130         }
131         if ($_POST['smtp_pass1'] != $_POST['smtp_pass1']) {
132                 // Passwords are not matching
133                 OUTPUT_HTML(INSTALL_SMTP_PASS_MISMATCH."<br />");
134                 $_GET['page'] = 3;
135         }
136 }
137
138 // Is MXChange installed or no admin registered so far?
139 if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered')))
140 {
141         // Set URL for FORM actions
142         define('__BURL_ACTION', $burl);
143
144         // Output page for entered value
145         switch ($_GET['page'])
146         {
147         case "welcome": // Welcome to the installation!
148                 LOAD_TEMPLATE("install_welcome");
149                 break;
150
151         case "1": // Server path, base URL
152                 define('__PATH_LEN'     , strlen(PATH));
153                 define('__BURL_LEN'     , strlen($burl));
154                 define('__TITLE_LEN'    , strlen(MAIN_TITLE));
155                 define('__SLOGAN_LEN'   , strlen(SLOGAN));
156                 define('__WEBMASTER_LEN', (strlen(WEBMASTER) * 3));
157
158                 // Load template
159                 LOAD_TEMPLATE("install_page1");
160                 break;
161
162         case "2": // MySQL data (alone!)
163                 if (empty($mysql['dbase']))  $mysql['dbase']  = "your_database";
164                 if (empty($mysql['login']))  $mysql['login']  = "your_login";
165                 if (empty($mysql['host']))   $mysql['host']   = "localhost";
166                 if (empty($mysql['prefix'])) $mysql['prefix'] = "mxchange_";
167                 if ((sizeof($FATAL) > 0) || (!empty($FATAL[0]))) {
168                         OUTPUT_HTML("<SPAN class=\"install_fatal\">");
169                         foreach ($FATAL as $key => $err) {
170                                 OUTPUT_HTML("  <STRONG>&middot;</STRONG>&nbsp;".FATAL_NO.($key + 1).":&nbsp;".$err."<br />");
171                         }
172                         OUTPUT_HTML("</SPAN><br />");
173                 }
174                 define('__MYSQL_HOST'  , $mysql['host']);
175                 define('__MYSQL_DBASE' , $mysql['dbase']);
176                 define('__MYSQL_PREFIX', $mysql['prefix']);
177                 define('__MYSQL_LOGIN' , $mysql['login']);
178                 define('__SPATH_VALUE' , $_POST['spath']);
179                 define('__BURL_VALUE'  , $_POST['burl']);
180                 define('__TITLE_VALUE' , $_POST['title']);
181                 define('__SLOGAN_VALUE', $_POST['slogan']);
182                 define('__EMAIL_VALUE' , $_POST['email']);
183
184                 // Load template
185                 LOAD_TEMPLATE("install_page2");
186                 break;
187
188         case "3":
189                 // Set more values
190                 define('__SPATH_VALUE'  , $_POST['spath']);
191                 define('__BURL_VALUE'   , $_POST['burl']);
192                 define('__TITLE_VALUE'  , $_POST['title']);
193                 define('__SLOGAN_VALUE' , $_POST['slogan']);
194                 define('__EMAIL_VALUE'  , $_POST['email']);
195
196                 // Use default SMTP data
197                 $smtpHost  = SMTP_HOSTNAME;
198                 $smtpUser  = SMTP_USER;
199                 $smtpPass1 = SMTP_PASSWORD;
200                 $smtpPass2 = SMTP_PASSWORD;
201
202                 // Overwrite it with the data from sent (failed) form
203                 if (!empty($_POST['smtp_host'])) $smtpHost = $_POST['smtp_host'];
204                 if (!empty($_POST['smtp_user'])) $smtpUser = $_POST['smtp_user'];
205
206                 // MySQL settings
207                 define('__MYSQL_HOST'   , $mysql['host']);
208                 define('__MYSQL_DBASE'  , $mysql['dbase']);
209                 define('__MYSQL_PREFIX' , $mysql['prefix']);
210                 define('__MYSQL_LOGIN'  , $mysql['login']);
211                 define('__MYSQL_PASS1'  , $mysql['pass1']);
212                 define('__MYSQL_PASS2'  , $mysql['pass2']);
213
214                 // Set constants for SMTP data
215                 define('__SMTP_HOST'    , $smtpHost);
216                 define('__SMTP_USER'    , $smtpUser);
217                 define('__SMTP_PASS1'   , $smtpPass1);
218                 define('__SMTP_PASS2'   , $smtpPass2);
219
220                 // Load template
221                 LOAD_TEMPLATE("install_page3");
222                 break;
223
224         case "5": // Misc settings
225                 // General settings
226                 define('__SPATH_VALUE'  , $_POST['spath']);
227                 define('__BURL_VALUE'   , $_POST['burl']);
228                 define('__TITLE_VALUE'  , $_POST['title']);
229                 define('__SLOGAN_VALUE' , $_POST['slogan']);
230                 define('__EMAIL_VALUE'  , $_POST['email']);
231
232                 // MySQL settings
233                 define('__MYSQL_HOST'   , $mysql['host']);
234                 define('__MYSQL_DBASE'  , $mysql['dbase']);
235                 define('__MYSQL_PREFIX' , $mysql['prefix']);
236                 define('__MYSQL_LOGIN'  , $mysql['login']);
237
238                 // SMTP settings
239                 define('__SMTP_HOST'    , $_POST['smtp_host']);
240                 define('__SMTP_USER'    , $_POST['smtp_user']);
241                 define('__SMTP_PASS'    , $_POST['smtp_pass1']);
242                 OUTPUT_HTML("<FORM action=\"".__BURL_ACTION."/install.php?page=finalize\" method=\"POST\" target=\"_self\">
243 <TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"install_content\">
244 <TR>
245   <TD colspan=\"2\" align=\"center\">
246     <STRONG class=\"install\">".HEADER_TEXT_PAGE5."</STRONG>
247   </TD>
248 </TR>
249 <TR><TD colspan=\"2\" height=\"21\" class=\"seperator\">&nbsp;</TD></TR>
250 <TR>
251   <TD colspan=\"2\"><SPAN class=\"install_intro\">
252     ".TEXT_PAGE_5."
253   </SPAN></TD>
254 </TR>
255 <TR><TD colspan=\"2\" height=\"21\" class=\"seperator\">&nbsp;</TD></TR>
256 <TR>
257   <TD class=\"install\" align=\"right\">".LANG_OUTPUT_MODE.":&nbsp;&nbsp;</TD>
258   <TD>
259     <SELECT name=\"omode\" size=\"1\" class=\"install_select\">
260       <OPTION value=\"render\"");
261                 if (OUTPUT_MODE == "render") OUTPUT_HTML(" selected=\"selected\"");
262                 OUTPUT_HTML(">".MODE_RENDER."</OPTION>
263       <OPTION value=\"direct\"");
264                 if (OUTPUT_MODE == "direct") OUTPUT_HTML(" selected=\"selected\"");
265                 OUTPUT_HTML(">".MODE_DIRECT."</OPTION>
266     </SELECT>
267   </TD>
268 </TR>
269 <TR><TD colspan=\"2\" height=\"10\" class=\"seperator\">&nbsp;</TD></TR>
270 <TR>
271   <TD class=\"install\" align=\"right\">".WARN_NO_PASSWORD.":&nbsp;&nbsp;</TD>
272   <TD>
273     <SELECT name=\"warn_no_pass\" size=\"1\" class=\"install_select\">
274       <OPTION value=\"true\"");
275                 if (isBooleanConstantAndTrue('warn_no_pass')) OUTPUT_HTML(" selected=\"selected\"");
276                 OUTPUT_HTML(">".YES."</OPTION>
277       <OPTION value=\"false\"");
278                 if (!defined('warn_no_pass')) OUTPUT_HTML(" selected=\"selected\"");
279                 OUTPUT_HTML(">".NO."</OPTION>
280     </SELECT>
281   </TD>
282 </TR>
283 <TR><TD colspan=\"2\" height=\"10\" class=\"seperator\">&nbsp;</TD></TR>
284 <TR>
285   <TD class=\"install\" align=\"right\">".LANG_WRITE_FOOTER.":&nbsp;&nbsp;</TD>
286   <TD>
287     <SELECT name=\"wfooter\" size=\"1\" class=\"install_select\">
288       <OPTION value=\"true\"");
289                 if (isBooleanConstantAndTrue('WRITE_FOOTER')) OUTPUT_HTML(" selected=\"selected\"");
290                 OUTPUT_HTML(">".YES."</OPTION>
291       <OPTION value=\"false\"");
292                 if (!defined('WRITE_FOOTER')) OUTPUT_HTML(" selected=\"selected\"");
293                 OUTPUT_HTML(">".NO."</OPTION>
294     </SELECT>
295   </TD>
296 </TR>
297 <TR><TD colspan=\"2\" height=\"10\" class=\"seperator\">&nbsp;</TD></TR>
298 <TR>
299   <TD class=\"install\" align=\"right\">".INSTALL_ENABLE_BACKLINK.":&nbsp;&nbsp;</TD>
300   <TD>
301     <SELECT name=\"blink\" size=\"1\" class=\"install_select\">
302       <OPTION value=\"true\"");
303                 if (ENABLE_BACKLINK) OUTPUT_HTML(" selected=\"selected\"");
304                 OUTPUT_HTML(">".YES."</OPTION>
305       <OPTION value=\"false\"");
306                 if (!ENABLE_BACKLINK) OUTPUT_HTML(" selected=\"selected\"");
307                 OUTPUT_HTML(">".NO."</OPTION>
308     </SELECT>
309   </TD>
310 </TR>
311 <TR><TD colspan=\"2\" height=\"21\" class=\"seperator\">&nbsp;</TD></TR>
312 <TR>
313   <TD colspan=\"2\" align=\"center\">");
314                 foreach ($mysql as $key => $value) {
315                         OUTPUT_HTML("    <INPUT type=\"hidden\" name=\"mysql[".$key."]\" value=\"".$value."\">");
316                 }
317                 OUTPUT_HTML("    <INPUT type=\"hidden\" name=\"spath\" value=\"".__SPATH_VALUE."\">
318     <INPUT type=\"hidden\" name=\"burl\" value=\"".__BURL_VALUE."\">
319     <INPUT type=\"hidden\" name=\"title\" value=\"".__TITLE_VALUE."\">
320     <INPUT type=\"hidden\" name=\"slogan\" value=\"".__SLOGAN_VALUE."\">
321     <INPUT type=\"hidden\" name=\"email\" value=\"".__EMAIL_VALUE."\">
322     <INPUT type=\"hidden\" name=\"smtp_host\" value=\"".__SMTP_HOST."\">
323     <INPUT type=\"hidden\" name=\"smtp_user\" value=\"".__SMTP_USER."\">
324     <INPUT type=\"hidden\" name=\"smtp_pass\" value=\"".__SMTP_PASS."\">
325     <INPUT type=\"submit\" class=\"admin_submit submit\" name=\"finalize\" value=\"".NEXT_PAGE."\" class=\"install_submit\">
326   </TD>
327 </TR>
328 <TR><TD colspan=\"2\" height=\"21\" class=\"seperator\">&nbsp;</TD></TR>
329 </TABLE>
330 </FORM>");
331                 break;
332
333         case "finalize": // Write captured data to files
334                 if ((!empty($_POST['finalize'])) && (!isBooleanConstantAndTrue('mxchange_installed'))) {
335                         // You have submitted data then we have to reset the fatal messages
336                         $FATAL = array(); $SQLs = array();
337
338                         // Connect to MySQL server
339                         $link = SQL_CONNECT($mysql['host'], $mysql['login'], $mysql['pass1'], __FILE__, __LINE__);
340                         if ($link) {
341                                 // Seems to work, also right database?
342                                 $db = SQL_SELECT_DB($mysql['dbase'], $link, __FILE__, __LINE__);
343                                 if ($db) {
344                                         // Automatically run install.sql
345                                         if ((FILE_READABLE($_POST['spath']."install/tables.sql")) && (FILE_READABLE($_POST['spath']."install/menu-".GET_LANGUAGE().".sql"))) {
346                                                 // Both exists so import them
347                                                 foreach (array("tables.sql", "menu-".GET_LANGUAGE().".sql") as $dump) {
348                                                         // Should be save here because file_exists() is there but we check it again. :)
349                                                         $file = secureString($_POST['spath']) . "install/" . $dump;
350                                                         if (FILE_READABLE($file)) {
351                                                                 // Load the file
352                                                                 $sql = implode("", file($file));
353
354                                                                 // Remove some unwanted chars
355                                                                 $sql = str_replace("\r", "", $sql);
356                                                                 $sql = str_replace("\n\n", "\n", $sql);
357
358                                                                 // And split it up against ;\n ...
359                                                                 $SQLs = array_merge($SQLs, explode(";\n", $sql));
360                                                         }
361                                                 }
362
363                                                 // Are some SQLs found?
364                                                 if (count($SQLs) == 0) {
365                                                         // Abort here
366                                                         ADD_FATAL(INSTALL_SQL_IMPORT_FAILED);
367                                                         return;
368                                                 }
369
370                                                 // Now run all queries through and try to keep out empty or comment queries
371                                                 foreach ($SQLs as $sql) {
372                                                         // Trim spaces away
373                                                         $sql = trim($sql);
374
375                                                         // Is this query not empty and not a comment?
376                                                         if ((!empty($sql)) && (substr($sql, 0, 2) != "--") && (substr($sql, 0, 1) != "#")) {
377                                                                 // Then run it!
378                                                                 SQL_QUERY($sql, __FILE__, __LINE__);
379                                                         }
380                                                 }
381
382                                                 // Ok, all done. So we can write the config data to the php files
383                                                 if ($_POST['spath'] != PATH) install_WriteData($_POST['spath']."inc/config.php", "SERVER-PATH", "define('PATH', \"", "\");", $_POST['spath'], 0);
384                                                 if ($_POST['burl']  != URL)  install_WriteData($_POST['spath']."inc/config.php", "HOST-URL", "define('URL', \"", "\");", $_POST['burl'], 0);
385                                                 install_WriteData($_POST['spath']."inc/config.php", "MAIN_TITLE", "define('MAIN_TITLE', \"", "\");", $_POST['title'], 0);
386                                                 install_WriteData($_POST['spath']."inc/config.php", "SLOGAN", "define('SLOGAN', \"", "\");", $_POST['slogan'], 0);
387                                                 install_WriteData($_POST['spath']."inc/config.php", "WEBMASTER", "define('WEBMASTER', \"", "\");", $_POST['email'], 0);
388                                                 install_WriteData($_POST['spath']."inc/config.php", "NULLPASS-WARNING", "define('warn_no_pass', ", ");", $_POST['warn_no_pass'], 0);
389                                                 install_WriteData($_POST['spath']."inc/config.php", "WRITE-FOOTER", "define('WRITE_FOOTER', ", ");", $_POST['wfooter'], 0);
390                                                 install_WriteData($_POST['spath']."inc/config.php", "BACKLINK", "define('ENABLE_BACKLINK', ", ");", $_POST['blink'], 0);
391                                                 // install_WriteData($_POST['spath']."inc/config.php", "OUTPUT-MODE", "define('OUTPUT_MODE', \"", "\");", $_POST['omode'], 0);
392                                                 install_WriteData($_POST['spath']."inc/config.php", "MYSQL-HOST", "     'host'     => \"", "\",", $mysql['host'], 0);
393                                                 install_WriteData($_POST['spath']."inc/config.php", "MYSQL-DBASE", "    'dbase'    => \"", "\",", $mysql['dbase'], 0);
394                                                 install_WriteData($_POST['spath']."inc/config.php", "MYSQL-LOGIN", "    'login'    => \"", "\",", $mysql['login'], 0);
395                                                 install_WriteData($_POST['spath']."inc/config.php", "MYSQL-PASSWORD", " 'password' => \"", "\",", $mysql['pass1'], 0);
396                                                 install_WriteData($_POST['spath']."inc/config.php", "MYSQL-PREFIX", "define('_MYSQL_PREFIX', \"", "\");", $mysql['prefix'], 0);
397                                                 install_WriteData($_POST['spath']."inc/config.php", "SMTP-HOSTNAME", "define('SMTP_HOSTNAME', \"", "\");", $_POST['smtp_host'], 0);
398                                                 install_WriteData($_POST['spath']."inc/config.php", "SMTP-USER", "define('SMTP_USER', \"", "\");", $_POST['smtp_user'], 0);
399                                                 install_WriteData($_POST['spath']."inc/config.php", "SMTP-PASSWORD", "define('SMTP_PASSWORD', \"", "\");", $_POST['smtp_pass'], 0);
400                                                 install_WriteData($_POST['spath']."inc/config.php", "INSTALLED", "define('mxchange_installed', ", ");", "true", 0);
401
402                                                 // Close the link
403                                                 SQL_CLOSE($link, __FILE__, __LINE__);
404                                         }
405                                          else
406                                         {
407                                                 // Installation area not found!
408                                                 ADD_FATAL(INSTALL_MISSING_DUMPS);
409                                         }
410                                 }
411                         }
412                         if ((sizeof($FATAL) > 0) || ($FATAL[0] != ''))
413                         {
414                                 $OUT = "";
415                                 foreach ($FATAL as $value)
416                                 {
417                                         $OUT .= "    <LI>".$value."</LI>\n";
418                                 }
419                                 define('__FATAL_ERROR_LI', $OUT);
420                                 $OUT = "";
421                                 foreach ($mysql as $key => $value)
422                                 {
423                                         $OUT .= "    <INPUT type=\"hidden\" name=\"mysql[".$key."]\" value=\"".$value."\">\n";
424                                 }
425                                 define('__MYSQL_DATA'   , $OUT);
426                                 define('__SPATH_VALUE'  , $_POST['spath']);
427                                 define('__BURL_VALUE'   , $_POST['burl']);
428                                 define('__TITLE_VALUE'  , $_POST['title']);
429                                 define('__SMTP_HOST'    , $_POST['smtp_host']);
430                                 define('__SMTP_USER'    , $_POST['smtp_user']);
431                                 define('__SMTP_PASS'    , $_POST['smtp_pass']);
432
433                                 OUTPUT_HTML("<FORM action=\"".__BURL_ACTION."/install.php?page=2\" method=\"POST\">
434 <TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"install_content\">
435 <TR>
436   <TD align=\"center\">
437     <STRONG class=\"install\">".HEADER_MYSQL_ERRORS."</STRONG>
438   </TD>
439 </TR>
440 <TR><TD colspan=\"2\" height=\"21\" class=\"seperator\">&nbsp;</TD></TR>
441 <TR>
442   <TD><SPAN class=\"install_intro\">
443     ".TEXT_MYSQL_ERRORS."
444   </SPAN></TD>
445 </TR>
446 <TR>
447   <TD align=\"center\"><STRONG>
448     <OL>
449 ".__FATAL_ERROR_LI."
450     </OL>
451 ".__MYSQL_DATA."
452     <INPUT type=\"hidden\" name=\"spath\" value=\"".__SPATH_VALUE."\">
453     <INPUT type=\"hidden\" name=\"burl\" value=\"".__BURL_VALUE."\">
454     <INPUT type=\"hidden\" name=\"title\" value=\"".__TITLE_VALUE."\">
455     <INPUT type=\"submit\" class=\"admin_submit\" name=\"ok\" value=\"".RETURN_MYSQL_PAGE."\">
456   </STRONG></TD>
457 </TR>
458 </TABLE>
459 </FORM>");
460                         }
461                          else
462                         {
463                                 // Installation is done!
464                                 $URL = $burl."/install.php?page=finalize";
465                                 LOAD_URL($URL);
466                         }
467                 }
468                  elseif (isBooleanConstantAndTrue('mxchange_installed'))
469                 {
470                         // Redirection after writing data... :-)
471                         LOAD_TEMPLATE("install_finished");
472                 }
473                  else
474                 {
475                         // Something goes wrong during installation! :-(
476                         ADD_FATAL(INSTALL_FINALIZER_FAILED);
477                         include ("inc/fatal_errors.php");
478                 }
479                 break;
480
481         default:
482                 OUTPUT_HTML("    <STRONG class=\"install_error\">".WRONG_PAGE."</STRONG>");
483                 break;
484         }
485 }
486  else
487 {
488         ADD_FATAL(ALREADY_INSTALLED);
489 }
490 //
491 ?>