OSDN Git Service

Insert return function of JavaScript for history.back.
[nucleus-jp/nucleus-jp-ancient.git] / utf8 / install / index.php
index 48b9617..a5506ca 100755 (executable)
@@ -1,7 +1,7 @@
 <?php\r
 /*\r
  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2009 The Nucleus Group\r
+ * Copyright (C) 2002-2011 The Nucleus Group\r
  *\r
  * This program is free software; you can redistribute it and/or\r
  * modify it under the terms of the GNU General Public License\r
  * those tables.\r
  *\r
  * Below is a friendly way of letting users on non-php systems know that Nucleus won't run there.\r
- * ?><div style="font-size: xx-large;">If you see this text in your browser when you open <i>install.php</i>, your web server is not able to run PHP-scripts, and therefor Nucleus will not be able to run there. </div><div style="display: none"><?php\r
+ * ?><div style="font-size: xx-large;">If you see this text in your browser when you open <i>/install/</i>, your web server is not able to run PHP-scripts, and therefor Nucleus will not be able to run there. </div><div style="display: none"><?php\r
  */\r
 \r
 /**\r
  * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
+ * @copyright Copyright (C) 2002-2011 The Nucleus Group\r
  * @version $Id$\r
- * $NucleusJP: install.php,v 1.7 2007/02/04 06:28:44 kimitake Exp $\r
+ * $NucleusJP: index.php,v 1.7 2007/02/04 06:28:44 kimitake Exp $\r
  */\r
 \r
 /*\r
-       This part of the install.php code allows for customization of the install process.\r
+       This part of the index.php code allows for customization of the install process.\r
        When distributing plugins or skins together with a Nucleus installation, the\r
        configuration below will instruct to install them\r
 \r
@@ -39,8 +39,6 @@ include('./install_lang_japanese.php');
 //      array('NP_TrackBack', 'NP_MemberGoodies')\r
 $aConfPlugsToInstall = array(\r
        'NP_SkinFiles',\r
-       'NP_SecurityEnforcer',\r
-       'NP_Text'\r
 );\r
 \r
 \r
@@ -80,6 +78,7 @@ if (phpversion() >= '4.1.0') {
 }\r
 \r
 // include core classes that are needed for login & plugin handling\r
+include_once('../nucleus/libs/mysql.php');\r
 // added for 3.5 sql_* wrapper\r
 global $MYSQL_HANDLER;\r
 //set the handler if different from mysql (or mysqli)\r
@@ -87,10 +86,8 @@ global $MYSQL_HANDLER;
 if (!isset($MYSQL_HANDLER)) {\r
        $MYSQL_HANDLER = array('mysql','');\r
 }\r
-\r
 include_once('../nucleus/libs/sql/'.$MYSQL_HANDLER[0].'.php');\r
 // end new for 3.5 sql_* wrapper\r
-include_once('../nucleus/libs/mysql.php');\r
 \r
 // check if mysql support is installed\r
 // this check may not make sense, as is, in a version past 3.5x\r
@@ -134,17 +131,17 @@ function showInstallForm() {
                --></script>\r
        </head>\r
        <body>\r
-               <div style="text-align:center"><img src="../nucleus/styles/logo.gif" /></div> <!-- Nucleus logo -->\r
+               <div style="text-align:center"><img src="../nucleus/styles/logo.gif" alt="<?php echo _ALT_NUCLEUS_CMS_LOGO; ?>" /></div> <!-- Nucleus logo -->\r
                <form method="post" action="index.php">\r
-\r
+               \r
                <h1><?php echo _HEADER1; ?></h1>\r
-\r
+               \r
                <?php echo _TEXT1; ?>\r
-\r
+               \r
                <h1><?php echo _HEADER1_2 ?></h1>\r
-\r
+               \r
                <?php echo _TEXT1_2; ?>\r
-\r
+               \r
                <fieldset>\r
                        <legend><?php echo _TEXT1_2_TAB_HEAD; ?></legend>\r
                        <table>\r
@@ -159,45 +156,37 @@ function showInstallForm() {
                                </tr>\r
                        </table>\r
                </fieldset>\r
-\r
+               \r
                <h1><?php echo _HEADER2; ?></h1>\r
-\r
+               \r
                <?php echo _TEXT2; ?>\r
-\r
+               \r
                <ul>\r
                        <li>PHP:\r
-\r
 <?php\r
        echo phpversion();\r
-       $minVersion = '4.0.6';\r
-\r
-       if (phpversion() < $minVersion) {\r
-               echo ' <span class="warning" style="display:block">' . sprintf(_TEXT2_WARN, $minVersion) . '</span>';\r
-       } elseif (phpversion() < '5') {\r
-               echo ' <span class="warning" style="display:block">' . _TEXT2_WARN3 . '</span>';\r
-       }\r
 ?>\r
-\r
                        </li>\r
                        <li>MySQL:\r
-\r
 <?php\r
+       // Turn on output buffer\r
+       // Needed to repress the output of the sql function that are\r
+       // not part of php (in this case the @ operator doesn't work) \r
+       ob_start();\r
        // note: this piece of code is taken from phpMyAdmin\r
        $conn   = sql_connect_args('localhost','','');\r
        $result = @sql_query('SELECT VERSION() AS version', $conn);\r
-\r
-       if ($result != FALSE && @sql_num_rows($result) > 0) {\r
+       if ($result != FALSE && sql_num_rows($result) > 0) {\r
                $row   = sql_fetch_array($result);\r
                $match = explode('.', $row['version']);\r
        } else {\r
                $result = @sql_query('SHOW VARIABLES LIKE \'version\'', $conn);\r
-\r
                if ($result != FALSE && @sql_num_rows($result) > 0) {\r
                        $row   = sql_fetch_row($result);\r
                        $match = explode('.', $row[1]);\r
                } else {\r
                        $output = (function_exists('shell_exec')) ? @shell_exec('mysql -V') : '0.0.0';\r
-                       preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);\r
+                       preg_match('#[0-9]+\.[0-9]+\.[0-9]+#', $output, $version);\r
                        $match = explode('.', $version[0]);\r
 \r
                        if ($match[0] == '') {\r
@@ -207,8 +196,9 @@ function showInstallForm() {
                        }\r
                }\r
        }\r
-\r
-       sql_disconnect($conn);\r
+       @sql_disconnect($conn);\r
+       //End and clean output buffer\r
+       ob_end_clean();\r
        $mysqlVersion = implode($match, '.');\r
        $minVersion   = '3.23';\r
 \r
@@ -220,14 +210,22 @@ function showInstallForm() {
        }\r
 \r
        if ($mysqlVersion < $minVersion) {\r
-               echo ' <span class="warning" style="display:block">' . sprintf(_TEXT2_WARN2, $minVersion) . '</span>';\r
+               echo ' <span class="warning" style="display:block">' . sprintf(_TEXT2_WARN1, $minVersion) . '</span>';\r
        }\r
 ?>\r
-\r
                        </li>\r
                </ul>\r
-\r
 <?php\r
+       if (phpversion() < '5.0.0') {\r
+               echo ' <p class="deprecated">' . _TEXT2_WARN2 . '</p>';\r
+?>\r
+</form>\r
+</body>\r
+</html>\r
+<?php\r
+               exit;\r
+       }\r
+\r
        // tell people how they can have their config file filled out automatically\r
        if (@file_exists('../config.php') && @!is_writable('../config.php')) {\r
 ?>\r
@@ -246,20 +244,20 @@ function showInstallForm() {
                        <legend><?php echo _TEXT4_TAB_HEAD; ?></legend>\r
                        <table>\r
                                <tr>\r
-                                       <td><?php echo _TEXT4_TAB_FIELD1; ?></td>\r
-                                       <td><input name="mySQL_host" value="<?php echo htmlspecialchars(@ini_get('mysql.default_host') )?>" tabindex="10010" /></td>\r
+                                       <td><label for="if_mySQL_host"><?php echo _TEXT4_TAB_FIELD1; ?>:</label></td>\r
+                                       <td><input id="if_mySQL_host" name="mySQL_host" value="<?php echo htmlspecialchars(@ini_get('mysql.default_host') )?>" tabindex="10010" /></td>\r
                                </tr>\r
                                <tr>\r
-                                       <td><?php echo _TEXT4_TAB_FIELD2; ?></td>\r
-                                       <td><input name="mySQL_user" tabindex="10020" /></td>\r
+                                       <td><label for="if_mySQL_user"><?php echo _TEXT4_TAB_FIELD2; ?>:</label></td>\r
+                                       <td><input id="if_mySQL_user" name="mySQL_user" tabindex="10020" /></td>\r
                                </tr>\r
                                <tr>\r
-                                       <td><?php echo _TEXT4_TAB_FIELD3; ?></td>\r
-                                       <td><input name="mySQL_password" type="password" tabindex="10030" /></td>\r
+                                       <td><label for="if_mySQL_password"><?php echo _TEXT4_TAB_FIELD3; ?>:</label></td>\r
+                                       <td><input id="if_mySQL_password" name="mySQL_password" type="password" tabindex="10030" /></td>\r
                                </tr>\r
                                <tr>\r
-                                       <td><?php echo _TEXT4_TAB_FIELD4; ?></td>\r
-                                       <td><input name="mySQL_database" tabindex="10040" /> (<input name="mySQL_create" value="1" type="checkbox" id="mySQL_create" tabindex="10050" /><label for="mySQL_create"><?php echo _TEXT4_TAB_FIELD4_ADD; ?></label>)</td>\r
+                                       <td><label for="if_mySQL_database"><?php echo _TEXT4_TAB_FIELD4; ?>:</label></td>\r
+                                       <td><input id="if_mySQL_database" name="mySQL_database" tabindex="10040" /> (<input name="mySQL_create" value="1" type="checkbox" id="mySQL_create" tabindex="10050" /><label for="mySQL_create"><?php echo _TEXT4_TAB_FIELD4_ADD; ?></label>)</td>\r
                                </tr>\r
                        </table>\r
                </fieldset>\r
@@ -268,7 +266,7 @@ function showInstallForm() {
                        <legend><?php echo _TEXT4_TAB2_HEAD; ?></legend>\r
                        <table>\r
                                <tr>\r
-                                       <td><input name="mySQL_usePrefix" value="1" type="checkbox" id="mySQL_usePrefix" tabindex="10060" /><label for="mySQL_usePrefix"><?php echo _TEXT4_TAB2_FIELD; ?></label></td>\r
+                                       <td><input name="mySQL_usePrefix" value="1" type="checkbox" id="mySQL_usePrefix" tabindex="10060" /><label for="mySQL_usePrefix"><?php echo _TEXT4_TAB2_FIELD; ?>:</label></td>\r
                                        <td><input name="mySQL_tablePrefix" value="" tabindex="10070" /></td>\r
                                </tr>\r
                        </table>\r
@@ -302,15 +300,15 @@ function showInstallForm() {
        }\r
        */\r
 \r
-       $basePath = str_replace('install/index.php', '', dirname(__FILE__));\r
+       $basePath = str_replace('install', '', dirname(__FILE__));\r
 ?>\r
 \r
                <fieldset>\r
                        <legend><?php echo _TEXT5_TAB_HEAD; ?></legend>\r
                        <table>\r
                                <tr>\r
-                                       <td><?php echo _TEXT5_TAB_FIELD1; ?></td>\r
-                                       <td><input name="IndexURL" size="60" value="<?php\r
+                                       <td><label for="if_IndexURL"><?php echo _TEXT5_TAB_FIELD1;?>:</label></td>\r
+                                       <td><input id="if_IndexURL" name="IndexURL" size="60" value="<?php\r
                                                $url = 'http://' . serverVar('HTTP_HOST') . serverVar('PHP_SELF');\r
                                                $url = str_replace('install/index.php', '', $url);\r
                                                $url = replaceDoubleBackslash($url);\r
@@ -323,36 +321,36 @@ function showInstallForm() {
                                                echo $url; ?>" tabindex="10080" /></td>\r
                                </tr>\r
                                <tr>\r
-                                       <td><?php echo _TEXT5_TAB_FIELD2; ?></td>\r
-                                       <td><input name="AdminURL" size="60" value="<?php\r
+                                       <td><label for="if_AdminURL"><?php echo _TEXT5_TAB_FIELD2;?>:</label></td>\r
+                                       <td><input id="if_AdminURL" name="AdminURL" size="60" value="<?php\r
                                                if ($url) {\r
                                                        echo $url . 'nucleus/';\r
                                                } ?>" tabindex="10090" /></td>\r
                                </tr>\r
                                <tr>\r
-                                       <td><?php echo _TEXT5_TAB_FIELD3; ?></td>\r
-                                       <td><input name="AdminPath" size="60" value="<?php\r
+                                       <td><label for="if_AdminPath"><?php echo _TEXT5_TAB_FIELD3;?>:</label></td>\r
+                                       <td><input id="if_AdminPath" name="AdminPath" size="60" value="<?php\r
                                                if($basePath) {\r
                                                        echo $basePath . 'nucleus/';\r
                                                } ?>" tabindex="10100" /></td>\r
                                </tr>\r
                                <tr>\r
-                                       <td><?php echo _TEXT5_TAB_FIELD4; ?></td>\r
-                                       <td><input name="MediaURL" size="60" value="<?php\r
+                                       <td><label for="if_MediaURL"><?php echo _TEXT5_TAB_FIELD4;?>:</label></td>\r
+                                       <td><input id="if_MediaURL" name="MediaURL" size="60" value="<?php\r
                                                if ($url) {\r
                                                        echo $url . 'media/';\r
                                                } ?>" tabindex="10110" /></td>\r
                                </tr>\r
                                <tr>\r
-                                       <td><?php echo _TEXT5_TAB_FIELD5; ?></td>\r
-                                       <td><input name="MediaPath" size="60" value="<?php\r
+                                       <td><label for="if_MediaPath"><?php echo _TEXT5_TAB_FIELD5;?>:</label></td>\r
+                                       <td><input id="if_MediaPath" name="MediaPath" size="60" value="<?php\r
                                                if ($basePath) {\r
                                                        echo $basePath . 'media/';\r
                                                } ?>" tabindex="10120" /></td>\r
                                </tr>\r
                                <tr>\r
-                                       <td><?php echo _TEXT5_TAB_FIELD6; ?></td>\r
-                                       <td><input name="SkinsURL" size="60" value="<?php\r
+                                       <td><label for="if_SkinsURL"><?php echo _TEXT5_TAB_FIELD6;?>:</label></td>\r
+                                       <td><input id="if_SkinsURL" name="SkinsURL" size="60" value="<?php\r
                                                if ($url) {\r
                                                        echo $url . 'skins/';\r
                                                } ?>" tabindex="10130" />\r
@@ -360,8 +358,8 @@ function showInstallForm() {
                                        </td>\r
                                </tr>\r
                                <tr>\r
-                                       <td><?php echo _TEXT5_TAB_FIELD7; ?></td>\r
-                                       <td><input name="SkinsPath" size="60" value="<?php\r
+                                       <td><label for="if_SkinsPath"><?php echo _TEXT5_TAB_FIELD7;?>:</label></td>\r
+                                       <td><input id="if_SkinsPath" name="SkinsPath" size="60" value="<?php\r
                                                if ($basePath) {\r
                                                        echo $basePath . 'skins/';\r
                                                } ?>" tabindex="10140" />\r
@@ -369,15 +367,15 @@ function showInstallForm() {
                                        </td>\r
                                </tr>\r
                                <tr>\r
-                                       <td><?php echo _TEXT5_TAB_FIELD8; ?></td>\r
-                                       <td><input name="PluginURL" size="60" value="<?php\r
+                                       <td><label for="if_PluginURL"><?php echo _TEXT5_TAB_FIELD8;?>:</label></td>\r
+                                       <td><input id="if_PluginURL" name="PluginURL" size="60" value="<?php\r
                                                if ($url) {\r
                                                        echo $url . 'nucleus/plugins/';\r
                                                } ?>" tabindex="10150" /></td>\r
                                </tr>\r
                                <tr>\r
-                                       <td><?php echo _TEXT5_TAB_FIELD9; ?></td>\r
-                                       <td><input name="ActionURL" size="60" value="<?php\r
+                                       <td><label for="if_ActionURL"><?php echo _TEXT5_TAB_FIELD9;?>:</label></td>\r
+                                       <td><input id="if_ActionURL" name="ActionURL" size="60" value="<?php\r
                                                if ($url) {\r
                                                        echo $url . 'action.php';\r
                                                } ?>" tabindex="10160" />\r
@@ -389,7 +387,7 @@ function showInstallForm() {
 \r
                <?php echo _TEXT5_2; ?>\r
 \r
-               <h1><? echo _HEADER6; ?></h1>\r
+               <h1><?php echo _HEADER6; ?></h1>\r
 \r
                <?php echo _TEXT6; ?>\r
 \r
@@ -397,24 +395,24 @@ function showInstallForm() {
                        <legend><?php echo _TEXT6_TAB_HEAD; ?></legend>\r
                        <table>\r
                                <tr>\r
-                                       <td><?php echo _TEXT6_TAB_FIELD1; ?></td>\r
-                                       <td><input name="User_name" value="" tabindex="10170" /> (<?php echo _TEXT6_TAB_FIELD1_2; ?>)</td>\r
+                                       <td><label for="if_User_name"><?php echo _TEXT6_TAB_FIELD1; ?>:</label></td>\r
+                                       <td><input id="if_User_name" name="User_name" value="" tabindex="10170" /> <small>(<?php echo _TEXT6_TAB_FIELD1_2; ?>)</small></td>\r
                                </tr>\r
                                <tr>\r
-                                       <td><?php echo _TEXT6_TAB_FIELD2; ?></td>\r
-                                       <td><input name="User_realname" value="" tabindex="10180" /></td>\r
+                                       <td><label for="if_User_realname"><?php echo _TEXT6_TAB_FIELD2; ?>:</label></td>\r
+                                       <td><input id="if_User_realname" name="User_realname" value="" tabindex="10180" /></td>\r
                                </tr>\r
                                <tr>\r
-                                       <td><?php echo _TEXT6_TAB_FIELD3; ?></td>\r
-                                       <td><input name="User_password" type="password" value="" tabindex="10190" /></td>\r
+                                       <td><label for="if_User_password"><?php echo _TEXT6_TAB_FIELD3; ?>:</label></td>\r
+                                       <td><input id="if_User_password" name="User_password" type="password" value="" tabindex="10190" /></td>\r
                                </tr>\r
                                <tr>\r
-                                       <td><?php echo _TEXT6_TAB_FIELD4; ?></td>\r
-                                       <td><input name="User_password2" type="password" value="" tabindex="10200" /></td>\r
+                                       <td><label for="if_User_password2"><?php echo _TEXT6_TAB_FIELD4; ?>:</label></td>\r
+                                       <td><input id="if_User_password2" name="User_password2" type="password" value="" tabindex="10200" /></td>\r
                                </tr>\r
                                <tr>\r
-                                       <td><?php echo _TEXT6_TAB_FIELD5; ?></td>\r
-                                       <td><input name="User_email" value="" tabindex="10210" /> (<?php echo _TEXT6_TAB_FIELD5_2; ?>)</td>\r
+                                       <td><label for="if_User_email"><?php echo _TEXT6_TAB_FIELD5; ?>:</label></td>\r
+                                       <td><input id="if_User_email" name="User_email" value="" tabindex="10210" /> <small>(<?php echo _TEXT6_TAB_FIELD5_2; ?>)</small></td>\r
                                </tr>\r
                        </table>\r
                </fieldset>\r
@@ -427,12 +425,12 @@ function showInstallForm() {
                        <legend><?php echo _TEXT7_TAB_HEAD; ?></legend>\r
                        <table>\r
                                <tr>\r
-                                       <td><?php echo _TEXT7_TAB_FIELD1; ?></td>\r
-                                       <td><input name="Blog_name" size="60" value="My Nucleus CMS" tabindex="10220" /></td>\r
+                                       <td><label for="if_Blog_name"><?php echo _TEXT7_TAB_FIELD1; ?>:</label></td>\r
+                                       <td><input id="if_Blog_name" name="Blog_name" size="60" value="My Nucleus CMS" tabindex="10220" /></td>\r
                                </tr>\r
                                <tr>\r
-                                       <td><?php echo _TEXT7_TAB_FIELD2; ?></td>\r
-                                       <td><input name="Blog_shortname" value="mynucleuscms" tabindex="10230" /> (<?php echo _TEXT7_TAB_FIELD2_2; ?>)</td>\r
+                                       <td><label for="if_Blog_shortname"><?php echo _TEXT7_TAB_FIELD2; ?>:</label></td>\r
+                                       <td><input id="if_Blog_shortname" name="Blog_shortname" value="mynucleuscms" tabindex="10230" /> <small>(<?php echo _TEXT7_TAB_FIELD2_2; ?>)</small></td>\r
                                </tr>\r
                        </table>\r
                </fieldset>\r
@@ -443,7 +441,7 @@ function showInstallForm() {
                        <legend><?php echo _TEXT8_TAB_HEADER; ?></legend>\r
                        <table>\r
                                <tr>\r
-                                       <td><input name="Weblog_ping" value="1" type="checkbox" id="Weblog_ping" tabindex="10240" /><?php echo _TEXT8_TAB_FIELD1; ?></td>\r
+                                       <td><input name="Weblog_ping" value="1" type="checkbox" id="Weblog_ping" tabindex="10240" /><label for="Weblog_ping"><?php echo _TEXT8_TAB_FIELD1; ?></label></td>\r
                                </tr>\r
                        </table>\r
                </fieldset>\r
@@ -504,20 +502,9 @@ function doInstall() {
        $config_adminemail = $user_email;\r
        $config_sitename   = $blog_name;\r
        $weblog_ping       = postVar('Weblog_ping');\r
-\r
+       \r
        $_POST = array();\r
-       if (!extension_loaded('mbstring')) {\r
-               include('../nucleus/libs/mb_emulator/mb-emulator.php');\r
-       }\r
-       if ($charset == 'ujis') {\r
-               define('_CHARSET', 'EUC-JP');\r
-               $config_sitename = mb_convert_encoding($config_sitename, _CHARSET, 'UTF-8');\r
-               $user_realname  = mb_convert_encoding($user_realname, _CHARSET, 'UTF-8');\r
-               $blog_name        = mb_convert_encoding($blog_name, _CHARSET, 'UTF-8');\r
-       } else {\r
-               define('_CHARSET', 'UTF-8');\r
-       }\r
-\r
+       \r
        $config_indexurl   = replaceDoubleBackslash($config_indexurl);\r
        $config_adminurl   = replaceDoubleBackslash($config_adminurl);\r
        $config_mediaurl   = replaceDoubleBackslash($config_mediaurl);\r
@@ -528,6 +515,29 @@ function doInstall() {
        $config_skinspath  = replaceDoubleBackslash($config_skinspath);\r
        $config_mediapath  = replaceDoubleBackslash($config_mediapath);\r
 \r
+/**\r
+ * Include and initialize multibyte functions as a replacement for mbstring extension\r
+ *  if mbstring extension is not loaded.\r
+ * Jan.28, 2011. Japanese Package Release Team\r
+ */ \r
+       if (!function_exists('mb_convert_encoding')){\r
+               global $mbemu_internals;\r
+               include_once($config_adminpath.'libs/mb_emulator/mb-emulator.php');\r
+       }\r
+       if (function_exists('date_default_timezone_set')){\r
+                @date_default_timezone_set((function_exists('date_default_timezone_get')) ? @date_default_timezone_get() : 'UTC');\r
+       }\r
+       \r
+       if ($charset == 'ujis') {\r
+               define('_CHARSET', 'EUC-JP');\r
+               $config_sitename = mb_convert_encoding($config_sitename, _CHARSET, 'UTF-8');\r
+               $user_realname  = mb_convert_encoding($user_realname, _CHARSET, 'UTF-8');\r
+               $blog_name        = mb_convert_encoding($blog_name, _CHARSET, 'UTF-8');\r
+       } else {\r
+               define('_CHARSET', 'UTF-8');\r
+       }\r
+       \r
+       \r
        // 1. check all the data\r
        $errors = array();\r
 \r
@@ -539,7 +549,7 @@ function doInstall() {
                array_push($errors, _ERROR3);\r
        }\r
 \r
-       if (($mysql_usePrefix == 1) && (!eregi('^[a-zA-Z0-9_]+$', $mysql_prefix) ) ) {\r
+       if (($mysql_usePrefix == 1) && (!preg_match('#^[a-zA-Z0-9_]+$#', $mysql_prefix) ) ) {\r
                array_push($errors, _ERROR4);\r
        }\r
 \r
@@ -601,12 +611,13 @@ function doInstall() {
 // <add for garble measure>\r
        // 2-2. set DEFAULT CHARSET and COLLATE\r
        $mySqlVer = implode('.', array_map('intval', explode('.', sql_get_server_info($MYSQL_CONN))));\r
-       if ($mySqlVer >= '5.0.7' && phpversion() >= '5.2.3') {\r
+//     if ($mySqlVer >= '5.0.7' && phpversion() >= '5.2.3') {//}\r
+       if ($mySqlVer >= '5.0.7' && function_exists('mysql_set_charset')) {\r
                mysql_set_charset($charset);\r
        } elseif ($mySqlVer >= '4.1.0') {\r
-               sql_query("SET NAMES " . $charset);\r
+               sql_query("SET CHARACTER SET " . $charset);\r
        }\r
-       $collation = ($charset == 'utf8') ? 'utf8_unicode_ci' : 'ujis_japanese_ci';\r
+       $collation = ($charset == 'utf8') ? 'utf8_general_ci' : 'ujis_japanese_ci';\r
 // </add for garble measure>*/\r
 \r
        // 3. try to create database (if needed)\r
@@ -705,7 +716,7 @@ function doInstall() {
        }\r
 \r
        // 5a make first post\r
-       if ($charset == 'ujis') {\r
+       if (strtoupper(_CHARSET) != 'UTF-8') {\r
                $itm_title = mb_convert_encoding(_1ST_POST_TITLE, _CHARSET, 'UTF-8');\r
                $itm_body  = mb_convert_encoding(_1ST_POST, _CHARSET, 'UTF-8');\r
                $itm_more  = mb_convert_encoding(_1ST_POST2, _CHARSET, 'UTF-8');\r
@@ -762,7 +773,7 @@ function doInstall() {
        sql_query($query,$MYSQL_CONN) or _doError(_ERROR20 . ': ' . sql_error($MYSQL_CONN) );\r
 \r
        // 8-2. update category settings\r
-       if ($charset == 'ujis') {\r
+       if (strtoupper(_CHARSET) != 'UTF-8') {\r
                $cat_name = mb_convert_encoding(_GENERALCAT_NAME, _CHARSET, 'UTF-8');\r
                $cat_desc = mb_convert_encoding(_GENERALCAT_DESC, _CHARSET, 'UTF-8');\r
        } else {\r
@@ -845,7 +856,7 @@ function doInstall() {
                $config_data .= "   \$MYSQL_DATABASE = '" . $mysql_database . "';\n";\r
                $config_data .= "   \$MYSQL_PREFIX   = '" . (($mysql_usePrefix == 1) ? $mysql_prefix : '') . "';\n";\r
                $config_data .= "   // new in 3.50. first element is db handler, the second is the db driver used by the handler\n";\r
-               $config_data .= "   // default is \$MYSQL_HANDLER = array('mysql','mysql');\n";\r
+               $config_data .= "   // default is \$MYSQL_HANDLER = array('mysql','');\n";\r
                $config_data .= "   //\$MYSQL_HANDLER = array('mysql','mysql');\n";\r
                $config_data .= "   //\$MYSQL_HANDLER = array('pdo','mysql');\n";\r
                $config_data .= "   \$MYSQL_HANDLER = array('".$MYSQL_HANDLER[0]."','".$MYSQL_HANDLER[1]."');\n";\r
@@ -867,9 +878,6 @@ function doInstall() {
                $config_data .= "\n";\r
                $config_data .= "   // include libs\n";\r
                $config_data .= "   include(\$DIR_LIBS . 'globalfunctions.php');\n";\r
-               $config_data .= "   if (!extension_loaded('mbstring')) {\n";\r
-               $config_data .= "          include(\$DIR_LIBS . 'mb_emulator/mb-emulator.php');\n";\r
-               $config_data .= "   }\n";\r
                $config_data .= "?" . ">";\r
 \r
                $result = @fputs($fp, $config_data, strlen($config_data) );\r
@@ -889,7 +897,7 @@ function doInstall() {
        <style>@import url('../nucleus/styles/manual.css');</style>\r
 </head>\r
 <body>\r
-       <div style='text-align:center'><img src='../nucleus/styles/logo.gif' /></div> <!-- Nucleus logo -->\r
+       <div style="text-align:center"><img src="../nucleus/styles/logo.gif" alt="<?php echo _ALT_NUCLEUS_CMS_LOGO; ?>" /></div> <!-- Nucleus logo -->\r
 \r
 <?php\r
        $aAllErrors = array_merge($aSkinErrors, $aPlugErrors);\r
@@ -902,7 +910,7 @@ function doInstall() {
        if (!$bConfigWritten) { ?>\r
                <h1><?php echo _TITLE3; ?></h1>\r
 \r
-               <? echo _TEXT10; ?>\r
+               <?php echo _TEXT10; ?>\r
 \r
                <pre><code>&lt;?php\r
        // mySQL connection information\r
@@ -912,6 +920,10 @@ function doInstall() {
        $MYSQL_DATABASE = '<b><?php echo $mysql_database?></b>';\r
        $MYSQL_PREFIX   = '<b><?php echo ($mysql_usePrefix == 1)?$mysql_prefix:''?></b>';\r
 \r
+       // new in 3.50. first element is db handler, the second is the db driver used by the handler\r
+       // default is $MYSQL_HANDLER = array('mysql','');\r
+       $MYSQL_HANDLER = array('<?php echo $MYSQL_HANDLER[0];?>','<?php echo $MYSQL_HANDLER[1];?>');\r
+\r
        // main nucleus directory\r
        $DIR_NUCLEUS = '<b><?php echo $config_adminpath?></b>';\r
 \r
@@ -929,9 +941,6 @@ function doInstall() {
 \r
        // include libs\r
        include($DIR_LIBS . 'globalfunctions.php');\r
-       if (!extension_loaded('mbstring')) {\r
-               include($DIR_LIBS . 'mb_emulator/mb-emulator.php');\r
-       }\r
 ?&gt;</code></pre>\r
 \r
        <?php echo _TEXT11; ?>\r
@@ -1113,12 +1122,6 @@ function doCheckFiles() {
                }\r
        }\r
 \r
-// The above code replaces several if statements of the form:\r
-\r
-//     if (!is_readable('install.sql') ) {\r
-//             array_push($missingfiles, 'File <b>install.sql</b> is missing or not readable');\r
-//     }\r
-\r
        if (count($missingfiles) > 0) {\r
                showErrorMessages($missingfiles);\r
        }\r
@@ -1149,7 +1152,7 @@ function endsWithSlash($s) {
  * Checks if email address is valid\r
  */\r
 function _isValidMailAddress($address) {\r
-       if (preg_match("/^[a-zA-Z0-9\._-]+@+[A-Za-z0-9\._-]+\.+[A-Za-z]{2,4}$/", $address) ) {\r
+       if (preg_match("#^[a-zA-Z0-9\._-]+@+[A-Za-z0-9\._-]+\.+[A-Za-z]{2,4}$#", $address) ) {\r
                return 1;\r
        } else {\r
                return 0;\r
@@ -1161,7 +1164,7 @@ function _isValidMailAddress($address) {
 // logic: starts and ends with a non space, can contain spaces in between\r
 //             min 2 chars\r
 function _isValidShortName($name) {\r
-       if (eregi("^[a-z0-9]+$", $name) ) {\r
+       if (preg_match("#^[a-zA-Z0-9]+$#", $name) ) {\r
                return 1;\r
        } else {\r
                return 0;\r
@@ -1173,7 +1176,7 @@ function _isValidShortName($name) {
 // returns true if the given string is a valid display name\r
 // (to check nicknames)\r
 function _isValidDisplayName($name) {\r
-       if (eregi("^[a-z0-9]+[a-z0-9 ]*[a-z0-9]+$", $name) ) {\r
+       if (preg_match("#^[a-zA-Z0-9]+[a-zA-Z0-9 ]*[a-zA-Z0-9]+$#", $name) ) {\r
                return 1;\r
        } else {\r
                return 0;\r
@@ -1190,12 +1193,12 @@ function _doError($msg) {
        <style>@import url('../nucleus/styles/manual.css');</style>\r
 </head>\r
 <body>\r
-       <div style='text-align:center'><img src='../nucleus/styles/logo.gif' /></div> <!-- Nucleus logo -->\r
+       <div style="text-align:center"><img src="../nucleus/styles/logo.gif" alt="<?php echo _ALT_NUCLEUS_CMS_LOGO; ?>" /></div> <!-- Nucleus logo -->\r
        <h1><?php echo _ERROR27; ?></h1>\r
 \r
        <p><?php echo _ERROR28; ?> "<?php echo $msg; ?>";</p>\r
 \r
-       <p><a href="index.php" onclick="history.back();"><?php echo _TEXT17; ?></a></p>\r
+       <p><a href="index.php" onclick="history.back();return false;"><?php echo _TEXT17; ?></a></p>\r
 </body>\r
 </html>\r
 \r
@@ -1213,7 +1216,7 @@ function showErrorMessages($errors) {
        <style>@import url('../nucleus/styles/manual.css');</style>\r
 </head>\r
 <body>\r
-       <div style='text-align:center'><img src='../nucleus/styles/logo.gif' /></div> <!-- Nucleus logo -->\r
+       <div style="text-align:center"><img src="../nucleus/styles/logo.gif" alt="<?php echo _ALT_NUCLEUS_CMS_LOGO; ?>" /></div> <!-- Nucleus logo -->\r
        <h1><?php echo _ERROR27; ?></h1>\r
 \r
        <p><?php echo _ERROR29; ?>:</p>\r