<?php
-/////////////////////////////////////////////////
// PukiWiki - Yet another WikiWikiWeb clone.
+// $Id: init.php,v 1.27 2005/03/05 14:20:12 henoheno Exp $
//
-// $Id: init.php,v 1.18 2004/10/31 03:45:52 henoheno Exp $
-//
+// Init PukiWiki here
-/////////////////////////////////////////////////
// PukiWiki version / Copyright / Licence
-define('S_VERSION', '1.4.4');
+define('S_VERSION', '1.4.5_1');
define('S_COPYRIGHT',
'<strong>PukiWiki ' . S_VERSION . '</strong>' .
- ' Copyright © 2001-2004' .
- ' <a href="http://pukiwiki.org">PukiWiki Developers Team</a>.' .
+ ' Copyright © 2001-2005' .
+ ' <a href="http://pukiwiki.org/">PukiWiki Developers Team</a>.' .
' License is <a href="http://www.gnu.org/licenses/gpl.html">GPL</a>.<br />' .
' Based on "PukiWiki" 1.3 by <a href="http://factage.com/yu-ji/">yu-ji</a>'
);
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);
}
$die = '';
foreach (array('LANG_FILE_HINT', 'LANG_FILE') as $langfile) {
if (! file_exists(constant($langfile)) || ! is_readable(constant($langfile))) {
- $die = "${die}File is not found or not readable. ($langfile)\n";
+ $die .= 'File is not found or not readable. (' . $langfile . ')' . "\n";
} else {
require_once(constant($langfile));
}
$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));
// 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
// ¥Ú¡¼¥¸Ì¾¤«InterWikiName¤Ç¤¢¤ë¤È¤ß¤Ê¤¹
$arg = '';
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) {
- $arg = $_SERVER['QUERY_STRING'];
-} else if (isset($_SERVER['argv']) && count($_SERVER['argv'])) {
- $arg = $_SERVER['argv'][0];
+ $arg = & $_SERVER['QUERY_STRING'];
+} else if (isset($_SERVER['argv']) && ! empty($_SERVER['argv'])) {
+ $arg = & $_SERVER['argv'][0];
+}
+if (PKWK_QUERY_STRING_MAX && strlen($arg) > PKWK_QUERY_STRING_MAX) {
+ // Something nasty attack?
+ pkwk_common_headers();
+ sleep(1); // Fake processing, and/or process other threads
+ echo('Query string too long');
+ exit;
}
$arg = input_filter($arg); // \0 ½üµî
$BracketName = '(?!\s):?[^\r\n\t\f\[\]<>#&":]+:?(?<!\s)';
// InterWiki
-$InterWikiName = "(\[\[)?((?:(?!\s|:|\]\]).)+):(.+)(?(1)\]\])";
+$InterWikiName = '(\[\[)?((?:(?!\s|:|\]\]).)+):(.+)(?(1)\]\])';
// Ãí¼á
$NotePattern = '/\(\(((?:(?>(?:(?!\(\()(?!\)\)(?:[^\)]|$)).)+)|(?R))*)\)\)/ex';
// ¸½ºß»þ¹ï
$now = format_date(UTIME);
-// skinÆâ¤ÇDTDÀë¸À¤òÀÚ¤êÂؤ¨¤ë¤Î¤Ë»ÈÍÑ¡£paint.inc.phpÂкö
-$html_transitional = FALSE;
-// FALSE:XHTML 1.1
-// TRUE :XHTML 1.0 Transitional
+// Æü»þÃÖ´¹¥ë¡¼¥ë¤ò$line_rules¤Ë²Ã¤¨¤ë
+if ($usedatetime) $line_rules += $datetime_rules;
+unset($datetime_rules);
// ¥Õ¥§¥¤¥¹¥Þ¡¼¥¯¤ò$line_rules¤Ë²Ã¤¨¤ë
if ($usefacemark) $line_rules += $facemark_rules;
$line_rules = array_merge(array(
'&(#[0-9]+|#x[0-9a-f]+|' . $entity_pattern . ');' => '&$1;',
- "\r" => "<br />\n", /* ¹ÔËö¤Ë¥Á¥ë¥À¤Ï²þ¹Ô */
+ "\r" => '<br />' . "\n", /* ¹ÔËö¤Ë¥Á¥ë¥À¤Ï²þ¹Ô */
'#related$' => '<del>#related</del>',
'^#contents$' => '<del>#contents</del>'
), $line_rules);