OSDN Git Service

インストールスクリプトを統合
authorshizuki <shizuki@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Tue, 17 Mar 2009 09:01:31 +0000 (09:01 +0000)
committershizuki <shizuki@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Tue, 17 Mar 2009 09:01:31 +0000 (09:01 +0000)
$CONF['DisableEncodingCheck'] の設定をコメントアウト

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@982 1ca29b6e-896d-4ea0-84a5-967f57386b96

utf8/install.php
utf8/install_lang_japanese.php [moved from utf8/install_lang_japanese-utf8.php with 97% similarity]
utf8/nucleus/libs/globalfunctions.php

index c6d51bf..95e6bdb 100755 (executable)
@@ -30,7 +30,7 @@
        -- Start Of Configurable Part --\r
 */\r
 \r
        -- 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
 // array with names of plugins to install. Plugin files must be present in the nucleus/plugin/\r
 // directory.\r
@@ -93,7 +93,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
        <!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
                <title><?php echo _TITLE; ?></title>\r
                <style type="text/css"><!--\r
                        @import url('nucleus/documentation/styles/manual.css');\r
@@ -120,6 +120,25 @@ function showInstallForm() {
 \r
                <?php echo _TEXT1; ?>\r
 \r
 \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
                <h1><?php echo _HEADER2; ?></h1>\r
 \r
                <?php echo _TEXT2; ?>\r
@@ -205,7 +224,7 @@ function showInstallForm() {
                        <table>\r
                                <tr>\r
                                        <td><?php echo _TEXT4_TAB_FIELD1; ?></td>\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') )?>" /></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
                                </tr>\r
                                <tr>\r
                                        <td><?php echo _TEXT4_TAB_FIELD2; ?></td>\r
@@ -213,11 +232,11 @@ function showInstallForm() {
                                </tr>\r
                                <tr>\r
                                        <td><?php echo _TEXT4_TAB_FIELD3; ?></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
                                </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
                                </tr>\r
                        </table>\r
                </fieldset>\r
@@ -226,8 +245,8 @@ function showInstallForm() {
                        <legend><?php echo _TEXT4_TAB2_HEAD; ?></legend>\r
                        <table>\r
                                <tr>\r
                        <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
                                </tr>\r
                        </table>\r
 \r
@@ -278,42 +297,42 @@ function showInstallForm() {
                                                        $url .= '/';\r
                                                }\r
 \r
                                                        $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
                                </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
                                </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
                                </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
                                </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
                                </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
                                                <br />(<?php echo _TEXT5_TAB_FIELD7_2; ?>)\r
                                        </td>\r
                                </tr>\r
@@ -322,7 +341,7 @@ function showInstallForm() {
                                        <td><input name="SkinsPath" size="60" value="<?php\r
                                                if ($basePath) {\r
                                                        echo $basePath . 'skins/';\r
                                        <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
                                                <br />(<?php echo _TEXT5_TAB_FIELD7_2; ?>)\r
                                        </td>\r
                                </tr>\r
@@ -331,14 +350,14 @@ function showInstallForm() {
                                        <td><input name="PluginURL" size="60" value="<?php\r
                                                if ($url) {\r
                                                        echo $url . 'nucleus/plugins/';\r
                                        <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
                                </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
                                                <br />(<?php echo _TEXT5_TAB_FIELD9_2;?>)\r
                                        </td>\r
                                </tr>\r
@@ -356,23 +375,23 @@ function showInstallForm() {
                        <table>\r
                                <tr>\r
                                        <td><?php echo _TEXT6_TAB_FIELD1; ?></td>\r
                        <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
                                </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
                                </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
                                </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
                                </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
                                </tr>\r
                        </table>\r
                </fieldset>\r
@@ -386,11 +405,11 @@ function showInstallForm() {
                        <table>\r
                                <tr>\r
                                        <td><?php echo _TEXT7_TAB_FIELD1; ?></td>\r
                        <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
                                </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
                                </tr>\r
                        </table>\r
                </fieldset>\r
@@ -401,7 +420,7 @@ function showInstallForm() {
                        <legend><?php echo _TEXT8_TAB_HEADER; ?></legend>\r
                        <table>\r
                                <tr>\r
                        <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
                                </tr>\r
                        </table>\r
                </fieldset>\r
@@ -410,7 +429,7 @@ function showInstallForm() {
 \r
                <?php echo _TEXT9; ?>\r
 \r
 \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
 \r
                </form>\r
        </body>\r
@@ -455,10 +474,21 @@ function doInstall() {
        $user_email        = postVar('User_email');\r
        $blog_name         = postVar('Blog_name');\r
        $blog_shortname    = postVar('Blog_shortname');\r
        $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
        $config_adminemail = $user_email;\r
        $config_sitename   = $blog_name;\r
        $weblog_ping       = postVar('Weblog_ping');\r
 \r
+       $_POST = array();\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
        $config_indexurl   = replaceDoubleBackslash($config_indexurl);\r
        $config_adminurl   = replaceDoubleBackslash($config_adminurl);\r
        $config_mediaurl   = replaceDoubleBackslash($config_mediaurl);\r
@@ -529,7 +559,7 @@ function doInstall() {
                showErrorMessages($errors);\r
        }\r
 \r
                showErrorMessages($errors);\r
        }\r
 \r
-       // 2. try to log in to mySQL\r
+       // 2-1. try to log in to mySQL\r
        global $MYSQL_CONN;\r
        $MYSQL_CONN = @mysql_connect($mysql_host, $mysql_user, $mysql_password);\r
 \r
        global $MYSQL_CONN;\r
        $MYSQL_CONN = @mysql_connect($mysql_host, $mysql_user, $mysql_password);\r
 \r
@@ -537,9 +567,29 @@ function doInstall() {
                _doError(_ERROR15 . ': ' . mysql_error() );\r
        }\r
 \r
                _doError(_ERROR15 . ': ' . mysql_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
+       } else {\r
+               mysql_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
        // 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
+                        . ' DEFAULT CHARACTER SET '\r
+                        .     $charset\r
+                        . ' COLLATE '\r
+                        .     $collation\r
+// </add for garble measure>*/\r
+                        . '';\r
+               mysql_query($sql) or _doError(_ERROR16 . ': ' . mysql_error());\r
        }\r
 \r
        // 4. try to select database\r
        }\r
 \r
        // 4. try to select database\r
@@ -612,13 +662,32 @@ function doInstall() {
                        if ($mysql_usePrefix == 1) {\r
                                        $query = str_replace($aTableNames, $aTableNamesPrefixed, $query);\r
                        }\r
                        if ($mysql_usePrefix == 1) {\r
                                        $query = str_replace($aTableNames, $aTableNamesPrefixed, $query);\r
                        }\r
+                       if ($mysql_create != 1 && strpos($query, 'CREATE TABLE') === 0) {\r
+                               $query .= ' DEFAULT CHARACTER SET ' . $charset . ' COLLATE ' . $collation;\r
+                       }\r
 \r
                        mysql_query($query) or _doError(_ERROR30 . ' (<small>' . htmlspecialchars($query) . '</small>): ' . mysql_error() );\r
                }\r
        }\r
 \r
        // 5a make first post\r
 \r
                        mysql_query($query) or _doError(_ERROR30 . ' (<small>' . htmlspecialchars($query) . '</small>): ' . mysql_error() );\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
+       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
        mysql_query($newpost) or _doError(_ERROR18 . ' (<small>' . htmlspecialchars($newpost) . '</small>): ' . mysql_error() );\r
 \r
        // 6. update global settings\r
        mysql_query($newpost) or _doError(_ERROR18 . ' (<small>' . htmlspecialchars($newpost) . '</small>): ' . mysql_error() );\r
 \r
        // 6. update global settings\r
@@ -630,6 +699,9 @@ function doInstall() {
        updateConfig('ActionURL',  $config_actionurl);\r
        updateConfig('AdminEmail', $config_adminemail);\r
        updateConfig('SiteName',   $config_sitename);\r
        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
 \r
        // 7. update GOD member\r
        $query = 'UPDATE ' . tableName('nucleus_member')\r
@@ -656,9 +728,16 @@ function doInstall() {
        mysql_query($query) or _doError(_ERROR20 . ': ' . mysql_error() );\r
 \r
        // 8-2. update category settings\r
        mysql_query($query) or _doError(_ERROR20 . ': ' . mysql_error() );\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
        $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
                   . " WHERE"\r
                   . " catid      = 1";\r
 \r
@@ -760,7 +839,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
 <!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
        <title><?php echo _TITLE; ?></title>\r
        <style>@import url('nucleus/styles/manual.css');</style>\r
 </head>\r
similarity index 97%
rename from utf8/install_lang_japanese-utf8.php
rename to utf8/install_lang_japanese.php
index 7cdb59c..0b792b5 100644 (file)
  * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
  * @version $Id$\r
  */\r
  * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
  * @version $Id$\r
  */\r
-define('_CHARSET',                             'UTF-8');\r
+define('_HEADER1_2',                   '使用するキャラクタセット');\r
+define('_TEXT1_2',                             'NucleusCMSで使用するキャラクタセットを選択します。「UTF-8」か「EUC-JP」かを、セレクトボックスから選択してください。');\r
+define('_TEXT1_2_TAB_HEAD',            'キャラクタセットの選択');\r
+define('_TEXT1_2_TAB_FIELD1',  'キャラクタセット');\r
 \r
 define('_ERROR1',                              '使用中のPHPはMySQLをサポートしていません :(');\r
 define('_ERROR2',                              'データベース名が見つかりません');\r
 \r
 define('_ERROR1',                              '使用中のPHPはMySQLをサポートしていません :(');\r
 define('_ERROR2',                              'データベース名が見つかりません');\r
index 1c109c2..421763c 100755 (executable)
@@ -518,6 +518,18 @@ function sql_connect() {
        $MYSQL_CONN = @mysql_connect($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD) or startUpError('<p>Could not connect to MySQL database.</p>', 'Connect Error');\r
        mysql_select_db($MYSQL_DATABASE) or startUpError('<p>Could not select database: ' . mysql_error() . '</p>', 'Connect Error');\r
 \r
        $MYSQL_CONN = @mysql_connect($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD) or startUpError('<p>Could not connect to MySQL database.</p>', 'Connect Error');\r
        mysql_select_db($MYSQL_DATABASE) or startUpError('<p>Could not select database: ' . mysql_error() . '</p>', 'Connect Error');\r
 \r
+/*/ <add for garble measure>\r
+       $resource = sql_query("show variables LIKE 'character_set_database'");\r
+       $fetchDat = mysql_fetch_assoc($resource);\r
+       $charset  = $fetchDat['Value'];\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
+       } else {\r
+               sql_query("SET NAMES " . $charset);\r
+       }\r
+// </add for garble measure>*/\r
+\r
        return $MYSQL_CONN;\r
 }\r
 \r
        return $MYSQL_CONN;\r
 }\r
 \r
@@ -1550,7 +1562,7 @@ function encoding_check($val, $key, $encoding=false, $exclude=false) {
          Don't set this permanently in nucleus_config table.\r
        */\r
        global $CONF;\r
          Don't set this permanently in nucleus_config table.\r
        */\r
        global $CONF;\r
-       if (!empty($CONF['DisableEncodingCheck'])) return true;\r
+//     if (!empty($CONF['DisableEncodingCheck'])) return true;\r
        /*\r
          When 3rd argument is set, return if checked already.\r
          When 4th argument is set, set the excluded key(s).\r
        /*\r
          When 3rd argument is set, return if checked already.\r
          When 4th argument is set, set the excluded key(s).\r