OSDN Git Service

Fix PDO switch problem and nclude UTF-8 multibyte processing.
[nucleus-jp/nucleus-jp-ancient.git] / utf8 / install / index.php
index a76b644..e3a4a9a 100755 (executable)
@@ -1,7 +1,7 @@
 <?php\r
 /*\r
  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2010 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-2010 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
@@ -78,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
@@ -85,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
@@ -182,14 +181,12 @@ function showInstallForm() {
 <?php\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
+       $result = @at_sql_query('SELECT VERSION() AS version', $conn);\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
+               $result = @at_sql_query('SHOW VARIABLES LIKE \'version\'', $conn);\r
                if ($result != FALSE && @sql_num_rows($result) > 0) {\r
                        $row   = sql_fetch_row($result);\r
                        $match = explode('.', $row[1]);\r
@@ -599,12 +596,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
@@ -703,7 +701,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
@@ -760,7 +758,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
@@ -843,7 +841,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
@@ -910,6 +908,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