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