OSDN Git Service

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@1025 1ca29...
[nucleus-jp/nucleus-jp-ancient.git] / utf8 / install.php
index c6d51bf..4de48d2 100755 (executable)
        -- Start Of Configurable Part --\r
 */\r
 \r
-include('./install_lang_japanese-utf8.php');\r
+include('./install_lang_japanese.php');\r
 \r
 // array with names of plugins to install. Plugin files must be present in the nucleus/plugin/\r
 // directory.\r
 //\r
 // example:\r
 //     array('NP_TrackBack', 'NP_MemberGoodies')\r
-$aConfPlugsToInstall = array('NP_SkinFiles');\r
+$aConfPlugsToInstall = array('NP_SkinFiles', 'NP_SecurityEnforcer', 'NP_Text');\r
 \r
 \r
 // array with skins to install. skins must be present under the skins/ directory with\r
@@ -70,9 +70,19 @@ if (phpversion() >= '4.1.0') {
        include_once('nucleus/libs/vars4.0.6.php');\r
 }\r
 \r
+// include core classes that are needed for login & plugin handling\r
+// added for 3.5 sql_* wrapper\r
+global $MYSQL_HANDLER;\r
+//set the handler if different from mysql (or mysqli)\r
+//$MYSQL_HANDLER = array('pdo','mysql');\r
+if (!isset($MYSQL_HANDLER))\r
+       $MYSQL_HANDLER = array('mysql','');\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
        if (!function_exists('mysql_query') ) {\r
                _doError(_ERROR1);\r
        }\r
@@ -93,7 +103,7 @@ function showInstallForm() {
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
        <html xmlns="http://www.w3.org/1999/xhtml">\r
        <head>\r
-               <meta http-equiv="content-type" content="application/xhtml+xml; charset=<?php echo _CHARSET; ?>" />\r
+               <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />\r
                <title><?php echo _TITLE; ?></title>\r
                <style type="text/css"><!--\r
                        @import url('nucleus/documentation/styles/manual.css');\r
@@ -120,6 +130,25 @@ function showInstallForm() {
 \r
                <?php echo _TEXT1; ?>\r
 \r
+               <h1><?php echo _HEADER1_2 ?></h1>\r
+\r
+               <?php echo _TEXT1_2; ?>\r
+\r
+               <fieldset>\r
+                       <legend><?php echo _TEXT1_2_TAB_HEAD; ?></legend>\r
+                       <table>\r
+                               <tr>\r
+                                       <td><?php echo _TEXT1_2_TAB_FIELD1; ?></td>\r
+                                       <td>\r
+                                               <select name="charset" tabindex="10000">\r
+                                                       <option value="utf8" selected="selected">UTF-8</option>\r
+                                                       <option value="ujis" >EUC-JP</option>\r
+                                               </select>\r
+                                       </td>\r
+                               </tr>\r
+                       </table>\r
+               </fieldset>\r
+\r
                <h1><?php echo _HEADER2; ?></h1>\r
 \r
                <?php echo _TEXT2; ?>\r
@@ -143,19 +172,21 @@ function showInstallForm() {
 \r
 <?php\r
        // note: this piece of code is taken from phpMyAdmin\r
-       $result = @mysql_query('SELECT VERSION() AS version');\r
+       $conn   = sql_connect_args('localhost','','');\r
+       $result = @sql_query('SELECT VERSION() AS version', $conn);\r
 \r
-       if ($result != FALSE && @mysql_num_rows($result) > 0) {\r
-               $row   = mysql_fetch_array($result);\r
+       if ($result != FALSE && @sql_num_rows($result) > 0) {\r
+               $row   = sql_fetch_array($result);\r
                $match = explode('.', $row['version']);\r
        } else {\r
-               $result = @mysql_query('SHOW VARIABLES LIKE \'version\'');\r
+               $result = @sql_query('SHOW VARIABLES LIKE \'version\'', $conn);\r
 \r
-               if ($result != FALSE && @mysql_num_rows($result) > 0) {\r
-                       $row   = mysql_fetch_row($result);\r
+               if ($result != FALSE && @sql_num_rows($result) > 0) {\r
+                       $row   = sql_fetch_row($result);\r
                        $match = explode('.', $row[1]);\r
                } else {\r
                        $output = shell_exec('mysql -V');\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
                        $match = explode('.', $version[0]);\r
 \r
@@ -167,8 +198,9 @@ function showInstallForm() {
                }\r
        }\r
 \r
+       sql_disconnect($conn);\r
        $mysqlVersion = implode($match, '.');\r
-       $minVersion = '3.23';\r
+       $minVersion   = '3.23';\r
 \r
        if ($mysqlVersion == '0.0.0') {\r
                echo _NOTIFICATION1;\r
@@ -205,19 +237,19 @@ function showInstallForm() {
                        <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') )?>" /></td>\r
+                                       <td><input 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" /></td>\r
+                                       <td><input 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" /></td>\r
+                                       <td><input 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" /> (<input name="mySQL_create" value="1" type="checkbox" id="mySQL_create" /><label for="mySQL_create"><?php echo _TEXT4_TAB_FIELD4_ADD; ?></label>)</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
                                </tr>\r
                        </table>\r
                </fieldset>\r
@@ -226,8 +258,8 @@ 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" /><label for="mySQL_usePrefix"><?php echo _TEXT4_TAB2_FIELD; ?></label></td>\r
-                                       <td><input name="mySQL_tablePrefix" value="" /></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
 \r
@@ -278,42 +310,42 @@ function showInstallForm() {
                                                        $url .= '/';\r
                                                }\r
 \r
-                                               echo $url; ?>" /></td>\r
+                                               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
                                                if ($url) {\r
                                                        echo $url . 'nucleus/';\r
-                                               } ?>" /></td>\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
                                                if($basePath) {\r
                                                        echo $basePath . 'nucleus/';\r
-                                               } ?>" /></td>\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
                                                if ($url) {\r
                                                        echo $url . 'media/';\r
-                                               } ?>" /></td>\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
                                                if ($basePath) {\r
                                                        echo $basePath . 'media/';\r
-                                               } ?>" /></td>\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
                                                if ($url) {\r
                                                        echo $url . 'skins/';\r
-                                               } ?>" />\r
+                                               } ?>" tabindex="10130" />\r
                                                <br />(<?php echo _TEXT5_TAB_FIELD7_2; ?>)\r
                                        </td>\r
                                </tr>\r
@@ -322,7 +354,7 @@ function showInstallForm() {
                                        <td><input name="SkinsPath" size="60" value="<?php\r
                                                if ($basePath) {\r
                                                        echo $basePath . 'skins/';\r
-                                               } ?>" />\r
+                                               } ?>" tabindex="10140" />\r
                                                <br />(<?php echo _TEXT5_TAB_FIELD7_2; ?>)\r
                                        </td>\r
                                </tr>\r
@@ -331,14 +363,14 @@ function showInstallForm() {
                                        <td><input name="PluginURL" size="60" value="<?php\r
                                                if ($url) {\r
                                                        echo $url . 'nucleus/plugins/';\r
-                                               } ?>" /></td>\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
                                                if ($url) {\r
                                                        echo $url . 'action.php';\r
-                                               } ?>" />\r
+                                               } ?>" tabindex="10160" />\r
                                                <br />(<?php echo _TEXT5_TAB_FIELD9_2;?>)\r
                                        </td>\r
                                </tr>\r
@@ -356,23 +388,23 @@ function showInstallForm() {
                        <table>\r
                                <tr>\r
                                        <td><?php echo _TEXT6_TAB_FIELD1; ?></td>\r
-                                       <td><input name="User_name" value="" /> <small>(<?php echo _TEXT6_TAB_FIELD1_2; ?>)</small></td>\r
+                                       <td><input 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="" /></td>\r
+                                       <td><input 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="" /></td>\r
+                                       <td><input 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="" /></td>\r
+                                       <td><input 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="" /> <small>(<?php echo _TEXT6_TAB_FIELD5_2; ?>)</small></td>\r
+                                       <td><input name="User_email" value="" tabindex="10210" /> <small>(<?php echo _TEXT6_TAB_FIELD5_2; ?>)</small></td>\r
                                </tr>\r
                        </table>\r
                </fieldset>\r
@@ -386,11 +418,11 @@ function showInstallForm() {
                        <table>\r
                                <tr>\r
                                        <td><?php echo _TEXT7_TAB_FIELD1; ?></td>\r
-                                       <td><input name="Blog_name" size="60" value="My Nucleus CMS" /></td>\r
+                                       <td><input 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" /> <small>(<?php echo _TEXT7_TAB_FIELD2_2; ?>)</small></td>\r
+                                       <td><input name="Blog_shortname" value="mynucleuscms" tabindex="10230" /> <small>(<?php echo _TEXT7_TAB_FIELD2_2; ?>)</small></td>\r
                                </tr>\r
                        </table>\r
                </fieldset>\r
@@ -401,7 +433,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" /><?php echo _TEXT8_TAB_FIELD1; ?></td>\r
+                                       <td><input name="Weblog_ping" value="1" type="checkbox" id="Weblog_ping" tabindex="10240" /><?php echo _TEXT8_TAB_FIELD1; ?></td>\r
                                </tr>\r
                        </table>\r
                </fieldset>\r
@@ -410,7 +442,7 @@ function showInstallForm() {
 \r
                <?php echo _TEXT9; ?>\r
 \r
-               <p><input name="action" value="go" type="hidden" /> <input type="submit" value="<?php echo _BUTTON1; ?>" onclick="return checkSubmit();" /></p>\r
+               <p><input name="action" value="go" type="hidden" /> <input type="submit" value="<?php echo _BUTTON1; ?>" onclick="return checkSubmit();" tabindex="10250" /></p>\r
 \r
                </form>\r
        </body>\r
@@ -455,10 +487,24 @@ function doInstall() {
        $user_email        = postVar('User_email');\r
        $blog_name         = postVar('Blog_name');\r
        $blog_shortname    = postVar('Blog_shortname');\r
+       $charset           = postVar('charset');\r
        $config_adminemail = $user_email;\r
        $config_sitename   = $blog_name;\r
        $weblog_ping       = postVar('Weblog_ping');\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
        $config_indexurl   = replaceDoubleBackslash($config_indexurl);\r
        $config_adminurl   = replaceDoubleBackslash($config_adminurl);\r
        $config_mediaurl   = replaceDoubleBackslash($config_mediaurl);\r
@@ -529,21 +575,44 @@ function doInstall() {
                showErrorMessages($errors);\r
        }\r
 \r
-       // 2. try to log in to mySQL\r
+       // 2-1. try to log in to mySQL\r
+\r
        global $MYSQL_CONN;\r
-       $MYSQL_CONN = @mysql_connect($mysql_host, $mysql_user, $mysql_password);\r
+       // this will need to be changed if we ever allow\r
+       $MYSQL_CONN = @sql_connect_args($mysql_host, $mysql_user, $mysql_password);\r
 \r
        if ($MYSQL_CONN == false) {\r
-               _doError(_ERROR15 . ': ' . mysql_error() );\r
+               _doError(_ERROR15 . ': ' . sql_error() );\r
        }\r
 \r
+// <add for garble measure>\r
+       // 2-2. set DEFAULT CHARSET and COLLATE\r
+       $mySqlVer = implode('.', array_map('intval', explode('.', mysql_get_server_info($MYSQL_CONN))));\r
+       if ($mySqlVer >= '5.0.7' && phpversion() >= '5.2.3') {\r
+               mysql_set_charset($charset);\r
+       } elseif ($mySqlVer >= '4.1.0') {\r
+               sql_query("SET NAMES " . $charset);\r
+       }\r
+       $collation = ($charset == 'utf8') ? 'utf8_unicode_ci' : 'ujis_japanese_ci';\r
+// </add for garble measure>*/\r
+\r
        // 3. try to create database (if needed)\r
        if ($mysql_create == 1) {\r
-               mysql_query('CREATE DATABASE ' . $mysql_database) or _doError(_ERROR16 . ': ' . mysql_error() );\r
+               $sql = 'CREATE DATABASE '\r
+                        .     $mysql_database;\r
+// <add for garble measure>\r
+       if ($mySqlVer >= '4.1.0') {\r
+               $sql .= ' DEFAULT CHARACTER SET '\r
+                         .     $charset\r
+                         . ' COLLATE '\r
+                         .     $collation;\r
+       }\r
+// </add for garble measure>*/\r
+               sql_query($sql,$MYSQL_CONN) or _doError(_ERROR16 . ': ' . sql_error($MYSQL_CONN));\r
        }\r
 \r
        // 4. try to select database\r
-       mysql_select_db($mysql_database) or _doError(_ERROR17);\r
+       sql_select_db($mysql_database,$MYSQL_CONN) or _doError(_ERROR17);\r
 \r
        // 5. execute queries\r
        $filename = 'install.sql';\r
@@ -612,14 +681,35 @@ function doInstall() {
                        if ($mysql_usePrefix == 1) {\r
                                        $query = str_replace($aTableNames, $aTableNamesPrefixed, $query);\r
                        }\r
+// <add for garble measure>\r
+                       if ($mysql_create != 1 && strpos($query, 'CREATE TABLE') === 0 && $mySqlVer >= '4.1.0') {\r
+                               $query .= ' DEFAULT CHARACTER SET ' . $charset . ' COLLATE ' . $collation;\r
+                       }\r
+// </add for garble measure>*/\r
 \r
-                       mysql_query($query) or _doError(_ERROR30 . ' (<small>' . htmlspecialchars($query) . '</small>): ' . mysql_error() );\r
+                       sql_query($query,$MYSQL_CONN) or _doError(_ERROR30 . ' (<small>' . htmlspecialchars($query) . '</small>): ' . sql_error($MYSQL_CONN) );\r
                }\r
        }\r
 \r
        // 5a make first post\r
-       $newpost = "INSERT INTO " . tableName('nucleus_item') . " VALUES (1, '" . _1ST_POST_TITLE . "', '" . _1ST_POST . "', '" . _1ST_POST2 . "', 1, 1, '2005-08-15 11:04:26', 0, 0, 0, 1, 0, 1);";\r
-       mysql_query($newpost) or _doError(_ERROR18 . ' (<small>' . htmlspecialchars($newpost) . '</small>): ' . mysql_error() );\r
+       if ($charset == 'ujis') {\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
+       } else {\r
+               $itm_title = _1ST_POST_TITLE;\r
+               $itm_body  = _1ST_POST;\r
+               $itm_more  = _1ST_POST2;\r
+       }\r
+       $newpost = "INSERT INTO "\r
+                        . tableName('nucleus_item')\r
+                        . " VALUES ("\r
+                        . "1, "\r
+                        . "'" . $itm_title . "',"\r
+                        . " '" . $itm_body . "',"\r
+                        . " '" . $itm_more . "',"\r
+                        . " 1, 1, '2005-08-15 11:04:26', 0, 0, 0, 1, 0, 1);";\r
+       sql_query($newpost,$MYSQL_CONN) or _doError(_ERROR18 . ' (<small>' . htmlspecialchars($newpost) . '</small>): ' . sql_error($MYSQL_CONN) );\r
 \r
        // 6. update global settings\r
        updateConfig('IndexURL',   $config_indexurl);\r
@@ -630,6 +720,9 @@ function doInstall() {
        updateConfig('ActionURL',  $config_actionurl);\r
        updateConfig('AdminEmail', $config_adminemail);\r
        updateConfig('SiteName',   $config_sitename);\r
+       if ($charset == 'ujis') {\r
+               updateConfig('Language',   'japanese-euc');\r
+       }\r
 \r
        // 7. update GOD member\r
        $query = 'UPDATE ' . tableName('nucleus_member')\r
@@ -643,7 +736,7 @@ function doInstall() {
                   . " WHERE"\r
                   . " mnumber       = 1";\r
 \r
-       mysql_query($query) or _doError(_ERROR19 . ': ' . mysql_error() );\r
+       sql_query($query,$MYSQL_CONN) or _doError(_ERROR19 . ': ' . sql_error($MYSQL_CONN) );\r
 \r
        // 8. update weblog settings\r
        $query = 'UPDATE ' . tableName('nucleus_blog')\r
@@ -653,23 +746,30 @@ function doInstall() {
                   . " WHERE"\r
                   . " bnumber    = 1";\r
 \r
-       mysql_query($query) or _doError(_ERROR20 . ': ' . mysql_error() );\r
+       sql_query($query,$MYSQL_CONN) or _doError(_ERROR20 . ': ' . sql_error($MYSQL_CONN) );\r
 \r
        // 8-2. update category settings\r
+       if ($charset == 'ujis') {\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
+               $cat_name = _GENERALCAT_NAME;\r
+               $cat_desc = _GENERALCAT_DESC;\r
+       }\r
        $query = 'UPDATE ' . tableName('nucleus_category')\r
-                  . " SET cname  = '" . addslashes(_GENERALCAT_NAME) . "',"\r
-                  . " cdesc      = '" . addslashes(_GENERALCAT_DESC) . "'"\r
+                  . " SET cname  = '" . $cat_name . "',"\r
+                  . " cdesc      = '" . $cat_desc . "'"\r
                   . " WHERE"\r
                   . " catid      = 1";\r
 \r
-       mysql_query($query) or _doError(_ERROR20 . ': ' . mysql_error() );\r
+       sql_query($query,$MYSQL_CONN) or _doError(_ERROR20 . ': ' . sql_error($MYSQL_CONN) );\r
 \r
        // 9. update item date\r
        $query = 'UPDATE ' . tableName('nucleus_item')\r
                   . " SET   itime   = '" . date('Y-m-d H:i:s', time() ) ."'"\r
                   . " WHERE inumber = 1";\r
 \r
-       mysql_query($query) or _doError(_ERROR21 . ': ' . mysql_error() );\r
+       sql_query($query,$MYSQL_CONN) or _doError(_ERROR21 . ': ' . sql_error($MYSQL_CONN) );\r
 \r
        global $aConfPlugsToInstall, $aConfSkinsToImport;\r
        $aSkinErrors = array();\r
@@ -695,7 +795,7 @@ function doInstall() {
                $DIR_LIBS    = $DIR_NUCLEUS . 'libs/';\r
 \r
                // close database connection (needs to be closed if we want to include globalfunctions.php)\r
-               mysql_close();\r
+               sql_close($MYSQL_CONN);\r
 \r
                $manager = '';\r
                include_once($DIR_LIBS . 'globalfunctions.php');\r
@@ -725,6 +825,11 @@ function doInstall() {
                $config_data .= "       \$MYSQL_PASSWORD = '" . $mysql_password . "';\n";\r
                $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 .= "       //\$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
                $config_data .= "\n";\r
                $config_data .= "       // main nucleus directory\n";\r
                $config_data .= "       \$DIR_NUCLEUS = '" . $config_adminpath . "';\n";\r
@@ -760,7 +865,7 @@ function doInstall() {
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
 <html xmlns="http://www.w3.org/1999/xhtml">\r
 <head>\r
-       <meta http-equiv="Content-Type" content="text/html; charset=<?php echo _CHARSET; ?>" />\r
+       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r
        <title><?php echo _TITLE; ?></title>\r
        <style>@import url('nucleus/styles/manual.css');</style>\r
 </head>\r
@@ -840,13 +945,14 @@ function doInstall() {
                <ul>\r
                <li><?php echo _TEXT15_L1; ?></li>\r
                <li><?php echo _TEXT15_L2; ?></li>\r
+               <li><?php echo _TEXT15_L3; ?></li>\r
                </ul>\r
 \r
-       <?php echo _TEXT15_EX; ?>\r
+       <?php echo _TEXT16; ?>\r
 \r
        <h1><?php echo _HEADER11; ?></h1>\r
 \r
-       <p><?php echo _TEXT16; ?>\r
+       <p><?php echo _TEXT16_H; ?>\r
                <ul>\r
                        <li><a href="<?php echo $config_adminurl?>"><?php echo _TEXT16_L1; ?></a></li>\r
                        <li><a href="<?php echo $config_indexurl?>"><?php echo _TEXT16_L2; ?></a></li>\r
@@ -869,7 +975,7 @@ function installCustomPlugs(&$manager) {
        }\r
 \r
        $res = sql_query('SELECT * FROM ' . sql_table('plugin') );\r
-       $numCurrent = mysql_num_rows($res);\r
+       $numCurrent = sql_num_rows($res);\r
 \r
        foreach ($aConfPlugsToInstall as $plugName) {\r
                // do this before calling getPlugin (in case the plugin id is used there)\r
@@ -897,7 +1003,7 @@ function installCustomPlugs(&$manager) {
        // loop over all installed plugins\r
        $res = sql_query('SELECT pid, pfile FROM ' . sql_table('plugin') );\r
 \r
-       while($o = mysql_fetch_object($res) ) {\r
+       while($o = sql_fetch_object($res) ) {\r
                $pid  =  $o->pid;\r
                $plug =& $manager->getPlugin($o->pfile);\r
 \r
@@ -996,6 +1102,7 @@ function doCheckFiles() {
 }\r
 \r
 function updateConfig($name, $val) {\r
+       global $MYSQL_CONN;\r
        $name = addslashes($name);\r
        $val  = trim(addslashes($val) );\r
 \r
@@ -1003,8 +1110,8 @@ function updateConfig($name, $val) {
                   . " SET   value = '$val'"\r
                   . " WHERE name  = '$name'";\r
 \r
-       mysql_query($query) or _doError(_ERROR26 . ': ' . mysql_error() );\r
-       return mysql_insert_id();\r
+       sql_query($query,$MYSQL_CONN) or _doError(_ERROR26 . ': ' . mysql_error($MYSQL_CONN) );\r
+       return sql_insert_id($MYSQL_CONN);\r
 }\r
 \r
 function replaceDoubleBackslash($input) {\r
@@ -1055,7 +1162,7 @@ function _doError($msg) {
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
 <html xmlns="http://www.w3.org/1999/xhtml">\r
 <head>\r
-       <meta http-equiv="Content-Type" content="text/html; charset=<?php echo _CHARSET ?>" />\r
+       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r
        <title><?php echo _TITLE; ?></title>\r
        <style>@import url('nucleus/styles/manual.css');</style>\r
 </head>\r
@@ -1063,7 +1170,7 @@ function _doError($msg) {
        <div style='text-align:center'><img src='./nucleus/styles/logo.gif' /></div> <!-- Nucleus logo -->\r
        <h1><?php echo _ERROR27; ?></h1>\r
 \r
-       <p><?php echo _ERROR28; ?>: "<?php echo $msg?>";</p>\r
+       <p><?php echo _ERROR28; ?> "<?php echo $msg; ?>";</p>\r
 \r
        <p><a href="install.php" onclick="history.back();"><?php echo _TEXT17; ?></a></p>\r
 </body>\r
@@ -1078,7 +1185,7 @@ function showErrorMessages($errors) {
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
 <html xmlns="http://www.w3.org/1999/xhtml">\r
 <head>\r
-       <meta http-equiv="Content-Type" content="text/html; charset=<?php echo _CHARSET ?>" />\r
+       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r
        <title><?php echo _TITLE; ?></title>\r
        <style>@import url('nucleus/styles/manual.css');</style>\r
 </head>\r