• R/O
  • HTTP
  • SSH
  • HTTPS

nucleus-jp-ancient: Commit

Nucleus CMS日本語版SVNをgit-svnしたもの。リポジトリの変換作業用


Commit MetaInfo

Revisionb6b097a07bb52ff7aec2f7e960271717f09b3d99 (tree)
Zeit2009-03-17 18:01:31
Autorshizuki <shizuki@1ca2...>
Commitershizuki

Log Message

インストールスクリプトを統合
$CONF['DisableEncodingCheck'] の設定をコメントアウト

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

Ändern Zusammenfassung

Diff

--- a/install.php
+++ b/install.php
@@ -30,7 +30,7 @@
3030 -- Start Of Configurable Part --
3131 */
3232
33-include('./install_lang_japanese-utf8.php');
33+include('./install_lang_japanese.php');
3434
3535 // array with names of plugins to install. Plugin files must be present in the nucleus/plugin/
3636 // directory.
@@ -93,7 +93,7 @@ function showInstallForm() {
9393 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
9494 <html xmlns="http://www.w3.org/1999/xhtml">
9595 <head>
96- <meta http-equiv="content-type" content="application/xhtml+xml; charset=<?php echo _CHARSET; ?>" />
96+ <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
9797 <title><?php echo _TITLE; ?></title>
9898 <style type="text/css"><!--
9999 @import url('nucleus/documentation/styles/manual.css');
@@ -120,6 +120,25 @@ function showInstallForm() {
120120
121121 <?php echo _TEXT1; ?>
122122
123+ <h1><?php echo _HEADER1_2 ?></h1>
124+
125+ <?php echo _TEXT1_2; ?>
126+
127+ <fieldset>
128+ <legend><?php echo _TEXT1_2_TAB_HEAD; ?></legend>
129+ <table>
130+ <tr>
131+ <td><?php echo _TEXT1_2_TAB_FIELD1; ?></td>
132+ <td>
133+ <select name="charset" tabindex="10000">
134+ <option value="utf8" selected="selected">UTF-8</option>
135+ <option value="ujis" >EUC-JP</option>
136+ </select>
137+ </td>
138+ </tr>
139+ </table>
140+ </fieldset>
141+
123142 <h1><?php echo _HEADER2; ?></h1>
124143
125144 <?php echo _TEXT2; ?>
@@ -205,7 +224,7 @@ function showInstallForm() {
205224 <table>
206225 <tr>
207226 <td><?php echo _TEXT4_TAB_FIELD1; ?></td>
208- <td><input name="mySQL_host" value="<?php echo htmlspecialchars(@ini_get('mysql.default_host') )?>" /></td>
227+ <td><input name="mySQL_host" value="<?php echo htmlspecialchars(@ini_get('mysql.default_host') )?>" tabindex="10010" /></td>
209228 </tr>
210229 <tr>
211230 <td><?php echo _TEXT4_TAB_FIELD2; ?></td>
@@ -213,11 +232,11 @@ function showInstallForm() {
213232 </tr>
214233 <tr>
215234 <td><?php echo _TEXT4_TAB_FIELD3; ?></td>
216- <td><input name="mySQL_password" type="password" /></td>
235+ <td><input name="mySQL_password" type="password" tabindex="10030" /></td>
217236 </tr>
218237 <tr>
219238 <td><?php echo _TEXT4_TAB_FIELD4; ?></td>
220- <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>
239+ <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>
221240 </tr>
222241 </table>
223242 </fieldset>
@@ -226,8 +245,8 @@ function showInstallForm() {
226245 <legend><?php echo _TEXT4_TAB2_HEAD; ?></legend>
227246 <table>
228247 <tr>
229- <td><input name="mySQL_usePrefix" value="1" type="checkbox" id="mySQL_usePrefix" /><label for="mySQL_usePrefix"><?php echo _TEXT4_TAB2_FIELD; ?></label></td>
230- <td><input name="mySQL_tablePrefix" value="" /></td>
248+ <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>
249+ <td><input name="mySQL_tablePrefix" value="" tabindex="10070" /></td>
231250 </tr>
232251 </table>
233252
@@ -278,42 +297,42 @@ function showInstallForm() {
278297 $url .= '/';
279298 }
280299
281- echo $url; ?>" /></td>
300+ echo $url; ?>" tabindex="10080" /></td>
282301 </tr>
283302 <tr>
284303 <td><?php echo _TEXT5_TAB_FIELD2; ?></td>
285304 <td><input name="AdminURL" size="60" value="<?php
286305 if ($url) {
287306 echo $url . 'nucleus/';
288- } ?>" /></td>
307+ } ?>" tabindex="10090" /></td>
289308 </tr>
290309 <tr>
291310 <td><?php echo _TEXT5_TAB_FIELD3; ?></td>
292311 <td><input name="AdminPath" size="60" value="<?php
293312 if($basePath) {
294313 echo $basePath . 'nucleus/';
295- } ?>" /></td>
314+ } ?>" tabindex="10100" /></td>
296315 </tr>
297316 <tr>
298317 <td><?php echo _TEXT5_TAB_FIELD4; ?></td>
299318 <td><input name="MediaURL" size="60" value="<?php
300319 if ($url) {
301320 echo $url . 'media/';
302- } ?>" /></td>
321+ } ?>" tabindex="10110" /></td>
303322 </tr>
304323 <tr>
305324 <td><?php echo _TEXT5_TAB_FIELD5; ?></td>
306325 <td><input name="MediaPath" size="60" value="<?php
307326 if ($basePath) {
308327 echo $basePath . 'media/';
309- } ?>" /></td>
328+ } ?>" tabindex="10120" /></td>
310329 </tr>
311330 <tr>
312331 <td><?php echo _TEXT5_TAB_FIELD6; ?></td>
313332 <td><input name="SkinsURL" size="60" value="<?php
314333 if ($url) {
315334 echo $url . 'skins/';
316- } ?>" />
335+ } ?>" tabindex="10130" />
317336 <br />(<?php echo _TEXT5_TAB_FIELD7_2; ?>)
318337 </td>
319338 </tr>
@@ -322,7 +341,7 @@ function showInstallForm() {
322341 <td><input name="SkinsPath" size="60" value="<?php
323342 if ($basePath) {
324343 echo $basePath . 'skins/';
325- } ?>" />
344+ } ?>" tabindex="10140" />
326345 <br />(<?php echo _TEXT5_TAB_FIELD7_2; ?>)
327346 </td>
328347 </tr>
@@ -331,14 +350,14 @@ function showInstallForm() {
331350 <td><input name="PluginURL" size="60" value="<?php
332351 if ($url) {
333352 echo $url . 'nucleus/plugins/';
334- } ?>" /></td>
353+ } ?>" tabindex="10150" /></td>
335354 </tr>
336355 <tr>
337356 <td><?php echo _TEXT5_TAB_FIELD9; ?></td>
338357 <td><input name="ActionURL" size="60" value="<?php
339358 if ($url) {
340359 echo $url . 'action.php';
341- } ?>" />
360+ } ?>" tabindex="10160" />
342361 <br />(<?php echo _TEXT5_TAB_FIELD9_2;?>)
343362 </td>
344363 </tr>
@@ -356,23 +375,23 @@ function showInstallForm() {
356375 <table>
357376 <tr>
358377 <td><?php echo _TEXT6_TAB_FIELD1; ?></td>
359- <td><input name="User_name" value="" /> <small>(<?php echo _TEXT6_TAB_FIELD1_2; ?>)</small></td>
378+ <td><input name="User_name" value="" tabindex="10170" /> <small>(<?php echo _TEXT6_TAB_FIELD1_2; ?>)</small></td>
360379 </tr>
361380 <tr>
362381 <td><?php echo _TEXT6_TAB_FIELD2; ?></td>
363- <td><input name="User_realname" value="" /></td>
382+ <td><input name="User_realname" value="" tabindex="10180" /></td>
364383 </tr>
365384 <tr>
366385 <td><?php echo _TEXT6_TAB_FIELD3; ?></td>
367- <td><input name="User_password" type="password" value="" /></td>
386+ <td><input name="User_password" type="password" value="" tabindex="10190" /></td>
368387 </tr>
369388 <tr>
370389 <td><?php echo _TEXT6_TAB_FIELD4; ?></td>
371- <td><input name="User_password2" type="password" value="" /></td>
390+ <td><input name="User_password2" type="password" value="" tabindex="10200" /></td>
372391 </tr>
373392 <tr>
374393 <td><?php echo _TEXT6_TAB_FIELD5; ?></td>
375- <td><input name="User_email" value="" /> <small>(<?php echo _TEXT6_TAB_FIELD5_2; ?>)</small></td>
394+ <td><input name="User_email" value="" tabindex="10210" /> <small>(<?php echo _TEXT6_TAB_FIELD5_2; ?>)</small></td>
376395 </tr>
377396 </table>
378397 </fieldset>
@@ -386,11 +405,11 @@ function showInstallForm() {
386405 <table>
387406 <tr>
388407 <td><?php echo _TEXT7_TAB_FIELD1; ?></td>
389- <td><input name="Blog_name" size="60" value="My Nucleus CMS" /></td>
408+ <td><input name="Blog_name" size="60" value="My Nucleus CMS" tabindex="10220" /></td>
390409 </tr>
391410 <tr>
392411 <td><?php echo _TEXT7_TAB_FIELD2; ?></td>
393- <td><input name="Blog_shortname" value="mynucleuscms" /> <small>(<?php echo _TEXT7_TAB_FIELD2_2; ?>)</small></td>
412+ <td><input name="Blog_shortname" value="mynucleuscms" tabindex="10230" /> <small>(<?php echo _TEXT7_TAB_FIELD2_2; ?>)</small></td>
394413 </tr>
395414 </table>
396415 </fieldset>
@@ -401,7 +420,7 @@ function showInstallForm() {
401420 <legend><?php echo _TEXT8_TAB_HEADER; ?></legend>
402421 <table>
403422 <tr>
404- <td><input name="Weblog_ping" value="1" type="checkbox" id="Weblog_ping" /><?php echo _TEXT8_TAB_FIELD1; ?></td>
423+ <td><input name="Weblog_ping" value="1" type="checkbox" id="Weblog_ping" tabindex="10240" /><?php echo _TEXT8_TAB_FIELD1; ?></td>
405424 </tr>
406425 </table>
407426 </fieldset>
@@ -410,7 +429,7 @@ function showInstallForm() {
410429
411430 <?php echo _TEXT9; ?>
412431
413- <p><input name="action" value="go" type="hidden" /> <input type="submit" value="<?php echo _BUTTON1; ?>" onclick="return checkSubmit();" /></p>
432+ <p><input name="action" value="go" type="hidden" /> <input type="submit" value="<?php echo _BUTTON1; ?>" onclick="return checkSubmit();" tabindex="10250" /></p>
414433
415434 </form>
416435 </body>
@@ -455,10 +474,21 @@ function doInstall() {
455474 $user_email = postVar('User_email');
456475 $blog_name = postVar('Blog_name');
457476 $blog_shortname = postVar('Blog_shortname');
477+ $charset = postVar('charset');
458478 $config_adminemail = $user_email;
459479 $config_sitename = $blog_name;
460480 $weblog_ping = postVar('Weblog_ping');
461481
482+ $_POST = array();
483+ if ($charset == 'ujis') {
484+ define('_CHARSET', 'EUC-JP');
485+ $config_sitename = mb_convert_encoding($config_sitename, _CHARSET, 'UTF-8');
486+ $user_realname = mb_convert_encoding($user_realname, _CHARSET, 'UTF-8');
487+ $blog_name = mb_convert_encoding($blog_name, _CHARSET, 'UTF-8');
488+ } else {
489+ define('_CHARSET', 'UTF-8');
490+ }
491+
462492 $config_indexurl = replaceDoubleBackslash($config_indexurl);
463493 $config_adminurl = replaceDoubleBackslash($config_adminurl);
464494 $config_mediaurl = replaceDoubleBackslash($config_mediaurl);
@@ -529,7 +559,7 @@ function doInstall() {
529559 showErrorMessages($errors);
530560 }
531561
532- // 2. try to log in to mySQL
562+ // 2-1. try to log in to mySQL
533563 global $MYSQL_CONN;
534564 $MYSQL_CONN = @mysql_connect($mysql_host, $mysql_user, $mysql_password);
535565
@@ -537,9 +567,29 @@ function doInstall() {
537567 _doError(_ERROR15 . ': ' . mysql_error() );
538568 }
539569
570+/*/ <add for garble measure>
571+ // 2-2. set DEFAULT CHARSET and COLLATE
572+ $mySqlVer = implode('.', array_map('intval', explode('.', mysql_get_server_info($MYSQL_CONN))));
573+ if ($mySqlVer >= '5.0.7' && phpversion() >= '5.2.3') {
574+ mysql_set_charset($charset);
575+ } else {
576+ mysql_query("SET NAMES " . $charset);
577+ }
578+ $collation = ($charset == 'utf8') ? 'utf8_unicode_ci' : 'ujis_japanese_ci';
579+// </add for garble measure>*/
580+
540581 // 3. try to create database (if needed)
541582 if ($mysql_create == 1) {
542- mysql_query('CREATE DATABASE ' . $mysql_database) or _doError(_ERROR16 . ': ' . mysql_error() );
583+ $sql = 'CREATE DATABASE '
584+ . $mysql_database
585+/*/ <add for garble measure>
586+ . ' DEFAULT CHARACTER SET '
587+ . $charset
588+ . ' COLLATE '
589+ . $collation
590+// </add for garble measure>*/
591+ . '';
592+ mysql_query($sql) or _doError(_ERROR16 . ': ' . mysql_error());
543593 }
544594
545595 // 4. try to select database
@@ -612,13 +662,32 @@ function doInstall() {
612662 if ($mysql_usePrefix == 1) {
613663 $query = str_replace($aTableNames, $aTableNamesPrefixed, $query);
614664 }
665+ if ($mysql_create != 1 && strpos($query, 'CREATE TABLE') === 0) {
666+ $query .= ' DEFAULT CHARACTER SET ' . $charset . ' COLLATE ' . $collation;
667+ }
615668
616669 mysql_query($query) or _doError(_ERROR30 . ' (<small>' . htmlspecialchars($query) . '</small>): ' . mysql_error() );
617670 }
618671 }
619672
620673 // 5a make first post
621- $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);";
674+ if ($charset == 'ujis') {
675+ $itm_title = mb_convert_encoding(_1ST_POST_TITLE, _CHARSET, 'UTF-8');
676+ $itm_body = mb_convert_encoding(_1ST_POST, _CHARSET, 'UTF-8');
677+ $itm_more = mb_convert_encoding(_1ST_POST2, _CHARSET, 'UTF-8');
678+ } else {
679+ $itm_title = _1ST_POST_TITLE;
680+ $itm_body = _1ST_POST;
681+ $itm_more = _1ST_POST2;
682+ }
683+ $newpost = "INSERT INTO "
684+ . tableName('nucleus_item')
685+ . " VALUES ("
686+ . "1, "
687+ . "'" . $itm_title . "',"
688+ . " '" . $itm_body . "',"
689+ . " '" . $itm_more . "',"
690+ . " 1, 1, '2005-08-15 11:04:26', 0, 0, 0, 1, 0, 1);";
622691 mysql_query($newpost) or _doError(_ERROR18 . ' (<small>' . htmlspecialchars($newpost) . '</small>): ' . mysql_error() );
623692
624693 // 6. update global settings
@@ -630,6 +699,9 @@ function doInstall() {
630699 updateConfig('ActionURL', $config_actionurl);
631700 updateConfig('AdminEmail', $config_adminemail);
632701 updateConfig('SiteName', $config_sitename);
702+ if ($charset == 'ujis') {
703+ updateConfig('Language', 'japanese-euc');
704+ }
633705
634706 // 7. update GOD member
635707 $query = 'UPDATE ' . tableName('nucleus_member')
@@ -656,9 +728,16 @@ function doInstall() {
656728 mysql_query($query) or _doError(_ERROR20 . ': ' . mysql_error() );
657729
658730 // 8-2. update category settings
731+ if ($charset == 'ujis') {
732+ $cat_name = mb_convert_encoding(_GENERALCAT_NAME, _CHARSET, 'UTF-8');
733+ $cat_desc = mb_convert_encoding(_GENERALCAT_DESC, _CHARSET, 'UTF-8');
734+ } else {
735+ $cat_name = _GENERALCAT_NAME;
736+ $cat_desc = _GENERALCAT_DESC;
737+ }
659738 $query = 'UPDATE ' . tableName('nucleus_category')
660- . " SET cname = '" . addslashes(_GENERALCAT_NAME) . "',"
661- . " cdesc = '" . addslashes(_GENERALCAT_DESC) . "'"
739+ . " SET cname = '" . $cat_name . "',"
740+ . " cdesc = '" . $cat_desc . "'"
662741 . " WHERE"
663742 . " catid = 1";
664743
@@ -760,7 +839,7 @@ function doInstall() {
760839 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
761840 <html xmlns="http://www.w3.org/1999/xhtml">
762841 <head>
763- <meta http-equiv="Content-Type" content="text/html; charset=<?php echo _CHARSET; ?>" />
842+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
764843 <title><?php echo _TITLE; ?></title>
765844 <style>@import url('nucleus/styles/manual.css');</style>
766845 </head>
--- a/install_lang_japanese-utf8.php
+++ b/install_lang_japanese.php
@@ -15,7 +15,10 @@
1515 * @copyright Copyright (C) 2002-2009 The Nucleus Group
1616 * @version $Id$
1717 */
18-define('_CHARSET', 'UTF-8');
18+define('_HEADER1_2', '使用するキャラクタセット');
19+define('_TEXT1_2', 'NucleusCMSで使用するキャラクタセットを選択します。「UTF-8」か「EUC-JP」かを、セレクトボックスから選択してください。');
20+define('_TEXT1_2_TAB_HEAD', 'キャラクタセットの選択');
21+define('_TEXT1_2_TAB_FIELD1', 'キャラクタセット');
1922
2023 define('_ERROR1', '使用中のPHPはMySQLをサポートしていません :(');
2124 define('_ERROR2', 'データベース名が見つかりません');
--- a/nucleus/libs/globalfunctions.php
+++ b/nucleus/libs/globalfunctions.php
@@ -518,6 +518,18 @@ function sql_connect() {
518518 $MYSQL_CONN = @mysql_connect($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD) or startUpError('<p>Could not connect to MySQL database.</p>', 'Connect Error');
519519 mysql_select_db($MYSQL_DATABASE) or startUpError('<p>Could not select database: ' . mysql_error() . '</p>', 'Connect Error');
520520
521+/*/ <add for garble measure>
522+ $resource = sql_query("show variables LIKE 'character_set_database'");
523+ $fetchDat = mysql_fetch_assoc($resource);
524+ $charset = $fetchDat['Value'];
525+ $mySqlVer = implode('.', array_map('intval', explode('.', mysql_get_server_info($MYSQL_CONN))));
526+ if ($mySqlVer >= '5.0.7' && phpversion() >= '5.2.3') {
527+ mysql_set_charset($charset);
528+ } else {
529+ sql_query("SET NAMES " . $charset);
530+ }
531+// </add for garble measure>*/
532+
521533 return $MYSQL_CONN;
522534 }
523535
@@ -1550,7 +1562,7 @@ function encoding_check($val, $key, $encoding=false, $exclude=false) {
15501562 Don't set this permanently in nucleus_config table.
15511563 */
15521564 global $CONF;
1553- if (!empty($CONF['DisableEncodingCheck'])) return true;
1565+// if (!empty($CONF['DisableEncodingCheck'])) return true;
15541566 /*
15551567 When 3rd argument is set, return if checked already.
15561568 When 4th argument is set, set the excluded key(s).
Show on old repository browser