X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=lib%2Finit.php;h=4f20bc63bbb90dc39306b74304ee93f11fd9db18;hb=465e91a4d3f888489ece10cb6fa4a91d68c50eb6;hp=570b6f97d061e336fc70ee63f320b6803bf7167b;hpb=9953e95b85f698e07bdbaed9c5f5aa248b3fdd34;p=pukiwiki%2Fpukiwiki.git
diff --git a/lib/init.php b/lib/init.php
index 570b6f9..4f20bc6 100644
--- a/lib/init.php
+++ b/lib/init.php
@@ -1,23 +1,23 @@
PukiWiki ' . S_VERSION . '' .
- ' Copyright © 2001-2004' .
- ' PukiWiki Developers Team.' .
+ ' Copyright © 2001-2005' .
+ ' PukiWiki Developers Team.' .
' License is GPL.
' .
' Based on "PukiWiki" 1.3 by yu-ji'
);
/////////////////////////////////////////////////
-// ½é´üÀßÄê (¥µ¡¼¥ÐÊÑ¿ô)
+// Init server variables
+
foreach (array('SCRIPT_NAME', 'SERVER_ADMIN', 'SERVER_NAME',
'SERVER_PORT', 'SERVER_SOFTWARE') as $key) {
define($key, isset($_SERVER[$key]) ? $_SERVER[$key] : '');
@@ -25,26 +25,26 @@ foreach (array('SCRIPT_NAME', 'SERVER_ADMIN', 'SERVER_NAME',
}
/////////////////////////////////////////////////
-// ½é´üÀßÄê (¥°¥í¡¼¥Ð¥ëÊÑ¿ô)
+// Init grobal variables
-$foot_explain = array(); // µÓÃí
-$related = array(); // ´ØÏ¢¤¹¤ë¥Ú¡¼¥¸
-$head_tags = array(); //
Æâ¤ËÄɲ乤륿¥°
+$foot_explain = array(); // Footnotes
+$related = array(); // Related pages
+$head_tags = array(); // XHTML tags in
/////////////////////////////////////////////////
-// ½é´üÀßÄê(»þ´Ö)
+// Time settings
+
define('LOCALZONE', date('Z'));
define('UTIME', time() - LOCALZONE);
define('MUTIME', getmicrotime());
/////////////////////////////////////////////////
-// ½é´üÀßÄê(ÀßÄê¥Õ¥¡¥¤¥ë¤Î¾ì½ê)
-define('INI_FILE', DATA_HOME . 'pukiwiki.ini.php');
+// Require INI_FILE
-// ¥Õ¥¡¥¤¥ëÆɤ߹þ¤ß
+define('INI_FILE', DATA_HOME . 'pukiwiki.ini.php');
$die = '';
if (! file_exists(INI_FILE) || ! is_readable(INI_FILE)) {
- $die = "${die}File is not found. (INI_FILE)\n";
+ $die .= 'File is not found. (INI_FILE)' . "\n";
} else {
require(INI_FILE);
}
@@ -80,32 +80,38 @@ mb_http_output('pass');
mb_detect_order('auto');
/////////////////////////////////////////////////
-// INI_FILE: UI_LANG ½é´üÀßÄê(¸À¸ì¥Õ¥¡¥¤¥ë¤Î¾ì½ê)
-define('LANG_FILE', DATA_HOME . UI_LANG . '.lng.php');
+// INI_FILE: Require LANG_FILE
-// ¥Õ¥¡¥¤¥ëÆɤ߹þ¤ß
+define('LANG_FILE_HINT', DATA_HOME . LANG . '.lng.php'); // For encoding hint
+define('LANG_FILE', DATA_HOME . UI_LANG . '.lng.php'); // For UI resource
$die = '';
-if (! file_exists(LANG_FILE) || ! is_readable(LANG_FILE)) {
- $die = "${die}File is not found. (LANG_FILE)\n";
-} else {
- require(LANG_FILE);
+foreach (array('LANG_FILE_HINT', 'LANG_FILE') as $langfile) {
+ if (! file_exists(constant($langfile)) || ! is_readable(constant($langfile))) {
+ $die .= 'File is not found or not readable. (' . $langfile . ')' . "\n";
+ } else {
+ require_once(constant($langfile));
+ }
}
if ($die) die_message(nl2br("\n\n" . $die));
/////////////////////////////////////////////////
-// LANG_FILE: ÍËÆüÇÛÎó
+// LANG_FILE: Init encoding hint
+
+define('PKWK_ENCODING_HINT', isset($_LANG['encode_hint'][LANG]) ? $_LANG['encode_hint'][LANG] : '');
+unset($_LANG['encode_hint']);
+
+/////////////////////////////////////////////////
+// LANG_FILE: Init severn days of the week
$weeklabels = $_msg_week;
/////////////////////////////////////////////////
-// INI_FILE: $script: ½é´üÀßÄê
+// INI_FILE: Init $script
if (isset($script)) {
- // Init manually
- get_script_uri($script);
+ get_script_uri($script); // Init manually
} else {
- // Init automatically
- $script = get_script_uri();
+ $script = get_script_uri(); // Init automatically
}
/////////////////////////////////////////////////
@@ -147,27 +153,27 @@ unset($user_agent); // Unset after reading UA_INI_FILE
$die = '';
foreach(array('DATA_DIR', 'DIFF_DIR', 'BACKUP_DIR', 'CACHE_DIR') as $dir){
if (! is_writable(constant($dir)))
- $die = "${die}Directory is not found or not writable ($dir)\n";
+ $die .= 'Directory is not found or not writable (' . $dir . ')' . "\n";
}
// ÀßÄê¥Õ¥¡¥¤¥ë¤ÎÊÑ¿ô¥Á¥§¥Ã¥¯
$temp = '';
foreach(array('rss_max', 'page_title', 'note_hr', 'related_link', 'show_passage',
'rule_related_str', 'load_template_func') as $var){
- if (! isset(${$var})) $temp .= "\$$var\n";
+ if (! isset(${$var})) $temp .= '$' . $var . "\n";
}
if ($temp) {
if ($die) $die .= "\n"; // A breath
- $die .= "Variable(s) not found: (Maybe the old *.ini.php?)\n" . $temp;
+ $die .= 'Variable(s) not found: (Maybe the old *.ini.php?)' . "\n" . $temp;
}
$temp = '';
foreach(array('LANG', 'PLUGIN_DIR') as $def){
- if (! defined($def)) $temp .= "$def\n";
+ if (! defined($def)) $temp .= $def . "\n";
}
if ($temp) {
if ($die) $die .= "\n"; // A breath
- $die .= "Define(s) not found: (Maybe the old *.ini.php?)\n" . $temp;
+ $die .= 'Define(s) not found: (Maybe the old *.ini.php?)' . "\n" . $temp;
}
if($die) die_message(nl2br("\n\n" . $die));
@@ -185,7 +191,7 @@ foreach(array($defaultpage, $whatsnew, $interwiki) as $page){
// Prohibit $_GET attack
foreach (array('msg', 'pass') as $key) {
- if (isset($_GET[$key])) die_message("Sorry, already reserved: $key=");
+ if (isset($_GET[$key])) die_message('Sorry, already reserved: ' . $key . '=');
}
// Expire risk
@@ -202,7 +208,7 @@ $_COOKIE = input_filter($_COOKIE);
// POST method ¤Ï¾ï¤Ë form ·Ðͳ¤Ê¤Î¤Ç¡¢É¬¤ºÊÑ´¹¤¹¤ë
//
if (isset($_POST['encode_hint']) && $_POST['encode_hint'] != '') {
- // html.php ¤ÎÃæ¤Ç¡¢