diff -ruN -x index.php wiki/lib/auth.php wiki.new/lib/auth.php
--- wiki/lib/auth.php	2012-04-06 20:57:56.000000000 +0900
+++ wiki.new/lib/auth.php	2013-07-05 03:25:33.000000000 +0900
@@ -75,7 +75,7 @@
 	// LDAP MD5
 	case '{md5}'         :
 		$hash = ($prefix ? ($canonical ? '{MD5}' : $scheme) : '') .
-			base64_encode(hex2bin(md5($phrase)));
+			base64_encode(internal_hex2bin(md5($phrase)));
 		break;
 
 	// LDAP SMD5
@@ -83,13 +83,13 @@
 		// MD5 Key length = 128bits = 16bytes
 		$salt = ($salt != '' ? substr(base64_decode($salt), 16) : substr(crypt(''), -8));
 		$hash = ($prefix ? ($canonical ? '{SMD5}' : $scheme) : '') .
-			base64_encode(hex2bin(md5($phrase . $salt)) . $salt);
+			base64_encode(internal_hex2bin(md5($phrase . $salt)) . $salt);
 		break;
 
 	// LDAP SHA
 	case '{sha}'         :
 		$hash = ($prefix ? ($canonical ? '{SHA}' : $scheme) : '') .
-			base64_encode(hex2bin(sha1($phrase)));
+			base64_encode(internal_hex2bin(sha1($phrase)));
 		break;
 
 	// LDAP SSHA
@@ -97,7 +97,7 @@
 		// SHA-1 Key length = 160bits = 20bytes
 		$salt = ($salt != '' ? substr(base64_decode($salt), 20) : substr(crypt(''), -8));
 		$hash = ($prefix ? ($canonical ? '{SSHA}' : $scheme) : '') .
-			base64_encode(hex2bin(sha1($phrase . $salt)) . $salt);
+			base64_encode(internal_hex2bin(sha1($phrase . $salt)) . $salt);
 		break;
 
 	// LDAP CLEARTEXT and just cleartext
@@ -134,7 +134,7 @@
 		} else {
 			// With exit
 			$body = $title = str_replace('$1',
-				htmlspecialchars(strip_bracket($page)), $_title_cannotedit);
+				htmlsc(strip_bracket($page)), $_title_cannotedit);
 			if (is_freeze($page))
 				$body .= '(<a href="' . $script . '?cmd=unfreeze&amp;page=' .
 					rawurlencode($page) . '">' . $_msg_unfreeze . '</a>)';
@@ -225,7 +225,7 @@
 	}
 	if ($exit_flag) {
 		$body = $title = str_replace('$1',
-			htmlspecialchars(strip_bracket($page)), $title_cannot);
+			htmlsc(strip_bracket($page)), $title_cannot);
 		$page = str_replace('$1', make_search($page), $title_cannot);
 		catbody($title, $page, $body . '....');
 		exit;
diff -ruN -x index.php wiki/lib/backup.php wiki.new/lib/backup.php
--- wiki/lib/backup.php	2007-06-04 20:32:44.000000000 +0900
+++ wiki.new/lib/backup.php	2013-07-05 03:21:33.000000000 +0900
@@ -67,7 +67,7 @@
 		$body = preg_replace("/\n*$/", "\n", $body);
 
 		$fp = _backup_fopen($page, 'wb')
-			or die_message('Cannot open ' . htmlspecialchars(_backup_get_filename($page)) .
+			or die_message('Cannot open ' . htmlsc(_backup_get_filename($page)) .
 			'<br />Maybe permission is not writable or filename is too long');
 		_backup_fputs($fp, $strout);
 		_backup_fputs($fp, $body);
diff -ruN -x index.php wiki/lib/config.php wiki.new/lib/config.php
--- wiki/lib/config.php	2007-06-04 20:32:43.000000000 +0900
+++ wiki.new/lib/config.php	2013-07-05 00:49:42.000000000 +0900
@@ -39,7 +39,7 @@
 		if (! is_page($this->page)) return FALSE;
 
 		$this->objs = array();
-		$obj        = & new ConfigTable('');
+		$obj        = new ConfigTable('');
 		$matches = array();
 
 		foreach (get_source($this->page) as $line) {
@@ -57,22 +57,22 @@
 
 				if ($level == 1) {
 					$this->objs[$obj->title] = $obj;
-					$obj = & new ConfigTable($line);
+					$obj = new ConfigTable($line);
 				} else {
 					if (! is_a($obj, 'ConfigTable_Direct'))
-						$obj = & new ConfigTable_Direct('', $obj);
+						$obj = new ConfigTable_Direct('', $obj);
 					$obj->set_key($line);
 				}
 				
 			} else if ($head == '-' && $level > 1) {
 				if (! is_a($obj, 'ConfigTable_Direct'))
-					$obj = & new ConfigTable_Direct('', $obj);
+					$obj = new ConfigTable_Direct('', $obj);
 				$obj->add_value($line);
 
 			} else if ($head == '|' && preg_match('/^\|(.+)\|\s*$/', $line, $matches)) {
 				// Table row
 				if (! is_a($obj, 'ConfigTable_Sequential'))
-					$obj = & new ConfigTable_Sequential('', $obj);
+					$obj = new ConfigTable_Sequential('', $obj);
 				// Trim() each table cell
 				$obj->add_value(array_map('trim', explode('|', $matches[1])));
 			} else {
@@ -109,7 +109,7 @@
 	function & get_object($title)
 	{
 		if (! isset($this->objs[$title]))
-			$this->objs[$title] = & new ConfigTable('*' . trim($title) . "\n");
+			$this->objs[$title] = new ConfigTable('*' . trim($title) . "\n");
 		return $this->objs[$title];
 	}
 
diff -ruN -x index.php wiki/lib/convert_html.php wiki.new/lib/convert_html.php
--- wiki/lib/convert_html.php	2007-06-04 20:32:44.000000000 +0900
+++ wiki.new/lib/convert_html.php	2013-07-05 03:21:49.000000000 +0900
@@ -19,7 +19,7 @@
 
 	if (! is_array($lines)) $lines = explode("\n", $lines);
 
-	$body = & new Body(++$contents_id);
+	$body = new Body(++$contents_id);
 	$body->parse($lines);
 
 	return $body->toString();
@@ -60,7 +60,7 @@
 		return $this->last = & $obj->last;
 	}
 
-	function canContain($obj)
+	function canContain(& $obj)
 	{
 		return TRUE;
 	}
@@ -97,40 +97,44 @@
 {
 	// Check the first letter of the line
 	if (substr($text, 0, 1) == '~') {
-		return new Paragraph(' ' . substr($text, 1));
+		$ret_obj = new Paragraph(' ' . substr($text, 1));
 	} else {
-		return new Inline($text);
+		$ret_obj = new Inline($text);
 	}
+	return $ret_obj;
 }
 
 function & Factory_DList(& $root, $text)
 {
 	$out = explode('|', ltrim($text), 2);
 	if (count($out) < 2) {
-		return Factory_Inline($text);
+		$ret_obj = Factory_Inline($text);
 	} else {
-		return new DList($out);
+		$ret_obj = new DList($out);
 	}
+	return $ret_obj;
 }
 
 // '|'-separated table
 function & Factory_Table(& $root, $text)
 {
 	if (! preg_match('/^\|(.+)\|([hHfFcC]?)$/', $text, $out)) {
-		return Factory_Inline($text);
+		$ret_obj = Factory_Inline($text);
 	} else {
-		return new Table($out);
+		$ret_obj = new Table($out);
 	}
+	return $ret_obj;
 }
 
 // Comma-separated table
 function & Factory_YTable(& $root, $text)
 {
 	if ($text == ',') {
-		return Factory_Inline($text);
+		$ret_obj = Factory_Inline($text);
 	} else {
-		return new YTable(csv_explode(',', substr($text, 1)));
+		$ret_obj = new YTable(csv_explode(',', substr($text, 1)));
 	}
+	return $ret_obj;
 }
 
 function & Factory_Div(& $root, $text)
@@ -142,7 +146,8 @@
 		// Usual code
 		if (preg_match('/^\#([^\(]+)(?:\((.*)\))?/', $text, $matches) &&
 		    exist_plugin_convert($matches[1])) {
-			return new Div($matches);
+			$ret_obj = new Div($matches);
+			return $ret_obj;
 		}
 	} else {
 		// Hack code
@@ -151,15 +156,18 @@
 			$len  = strlen($matches[3]);
 			$body = array();
 			if ($len == 0) {
-				return new Div($matches); // Seems legacy block plugin
+				$ret_obj = new Div($matches); // Seems legacy block plugin
+				return $ret_obj;
 			} else if (preg_match('/\{{' . $len . '}\s*\r(.*)\r\}{' . $len . '}/', $text, $body)) { 
 				$matches[2] .= "\r" . $body[1] . "\r";
-				return new Div($matches); // Seems multiline-enabled block plugin
+				$ret_obj = new Div($matches); // Seems multiline-enabled block plugin
+				return $ret_obj;
 			}
 		}
 	}
 
-	return new Paragraph($text);
+	$ret_obj = new Paragraph($text);
+	return $ret_obj;
 }
 
 // Inline elements
@@ -178,7 +186,7 @@
 		return $this;
 	}
 
-	function canContain($obj)
+	function canContain(& $obj)
 	{
 		return is_a($obj, 'Inline');
 	}
@@ -191,7 +199,7 @@
 
 	function & toPara($class = '')
 	{
-		$obj = & new Paragraph('', $class);
+		$obj = new Paragraph('', $class);
 		$obj->insert($this);
 		return $obj;
 	}
@@ -214,7 +222,7 @@
 		$this->insert(Factory_Inline($text));
 	}
 
-	function canContain($obj)
+	function canContain(& $obj)
 	{
 		return is_a($obj, 'Inline');
 	}
@@ -496,10 +504,10 @@
 				$text = $matches[5];
 			} else if ($matches[3]) {
 				$name = $matches[2] ? 'background-color' : 'color';
-				$this->style[$name] = $name . ':' . htmlspecialchars($matches[3]) . ';';
+				$this->style[$name] = $name . ':' . htmlsc($matches[3]) . ';';
 				$text = $matches[5];
 			} else if ($matches[4]) {
-				$this->style['size'] = 'font-size:' . htmlspecialchars($matches[4]) . 'px;';
+				$this->style['size'] = 'font-size:' . htmlsc($matches[4]) . 'px;';
 				$text = $matches[5];
 			}
 		}
@@ -572,7 +580,7 @@
 		$is_template = ($this->type == 'c');
 		$row = array();
 		foreach ($cells as $cell)
-			$row[] = & new TableCell($cell, $is_template);
+			$row[] = new TableCell($cell, $is_template);
 		$this->elements[] = $row;
 	}
 
@@ -726,7 +734,7 @@
 	{
 		global $preformat_ltrim;
 		parent::Element();
-		$this->elements[] = htmlspecialchars(
+		$this->elements[] = htmlsc(
 			(! $preformat_ltrim || $text == '' || $text{0} != ' ') ? $text : substr($text, 1));
 	}
 
@@ -814,7 +822,7 @@
 	function Body($id)
 	{
 		$this->id            = $id;
-		$this->contents      = & new Element();
+		$this->contents      = new Element();
 		$this->contents_last = & $this->contents;
 		parent::Element();
 	}
diff -ruN -x index.php wiki/lib/diff.php wiki.new/lib/diff.php
--- wiki/lib/diff.php	2007-06-04 20:32:41.000000000 +0900
+++ wiki.new/lib/diff.php	2013-07-05 03:26:02.000000000 +0900
@@ -63,7 +63,7 @@
 			$do_update_diff_table .= '<tr>';
 			$params = array($_obj->get('left'), $_obj->get('right'), $_obj->text());
 			foreach ($params as $key=>$text) {
-				$text = htmlspecialchars($text);
+				$text = htmlsc($text);
 				if (trim($text) == '') $text = '&nbsp;';
 				$do_update_diff_table .= '<' . $tags[$key] .
 					' class="style_' . $tags[$key] . '">' . $text .
diff -ruN -x index.php wiki/lib/file.php wiki.new/lib/file.php
--- wiki/lib/file.php	2007-06-04 20:32:43.000000000 +0900
+++ wiki.new/lib/file.php	2013-07-05 03:22:19.000000000 +0900
@@ -223,14 +223,14 @@
 	// File replacement (Edit)
 
 	if (! is_pagename($page))
-		die_message(str_replace('$1', htmlspecialchars($page),
+		die_message(str_replace('$1', htmlsc($page),
 		            str_replace('$2', 'WikiName', $_msg_invalidiwn)));
 
 	$str = rtrim(preg_replace('/' . "\r" . '/', '', $str)) . "\n";
 	$timestamp = ($file_exists && $notimestamp) ? filemtime($file) : FALSE;
 
 	$fp = fopen($file, 'a') or die('fopen() failed: ' .
-		htmlspecialchars(basename($dir) . '/' . encode($page) . '.txt') .	
+		htmlsc(basename($dir) . '/' . encode($page) . '.txt') .	
 		'<br />' . "\n" .
 		'Maybe permission is not writable or filename is too long');
 	set_file_buffer($fp, 0);
@@ -285,7 +285,7 @@
 
 	// Add
 	array_unshift($lines, '-' . format_date(UTIME) . ' - ' . $_page .
-		htmlspecialchars($subject) . "\n");
+		htmlsc($subject) . "\n");
 
 	// Get latest $limit reports
 	$lines = array_splice($lines, 0, $limit);
@@ -293,7 +293,7 @@
 	// Update
 	$fp = fopen(get_filename($recentpage), 'w') or
 		die_message('Cannot write page file ' .
-		htmlspecialchars($recentpage) .
+		htmlsc($recentpage) .
 		'<br />Maybe permission is not writable or filename is too long');
 	set_file_buffer($fp, 0);
 	flock($fp, LOCK_EX);
@@ -377,7 +377,7 @@
 	// Open
 	pkwk_touch_file($file);
 	$fp = fopen($file, 'r+') or
-		die_message('Cannot open ' . htmlspecialchars($whatsnew));
+		die_message('Cannot open ' . htmlsc($whatsnew));
 	set_file_buffer($fp, 0);
 	flock($fp, LOCK_EX);
 
@@ -385,8 +385,8 @@
 	ftruncate($fp, 0);
 	rewind($fp);
 	foreach ($recent_pages as $_page=>$time)
-		fputs($fp, '-' . htmlspecialchars(format_date($time)) .
-			' - ' . '[[' . htmlspecialchars($_page) . ']]' . "\n");
+		fputs($fp, '-' . htmlsc(format_date($time)) .
+			' - ' . '[[' . htmlsc($_page) . ']]' . "\n");
 	fputs($fp, '#norelated' . "\n"); // :)
 
 	flock($fp, LOCK_UN);
@@ -441,15 +441,15 @@
 	$file = get_filename($whatsnew);
 	pkwk_touch_file($file);
 	$fp = fopen($file, 'r+') or
-		die_message('Cannot open ' . htmlspecialchars($whatsnew));
+		die_message('Cannot open ' . htmlsc($whatsnew));
 	set_file_buffer($fp, 0);
 	flock($fp, LOCK_EX);
 	ftruncate($fp, 0);
 	rewind($fp);
 	foreach (array_keys($recent_pages) as $page) {
 		$time      = $recent_pages[$page];
-		$s_lastmod = htmlspecialchars(format_date($time));
-		$s_page    = htmlspecialchars($page);
+		$s_lastmod = htmlsc(format_date($time));
+		$s_page    = htmlsc($page);
 		fputs($fp, '-' . $s_lastmod . ' - [[' . $s_page . ']]' . "\n");
 	}
 	fputs($fp, '#norelated' . "\n"); // :)
@@ -730,12 +730,12 @@
 	$lockfile = CACHE_DIR . 'pkwk_chown.lock';
 	$flock = fopen($lockfile, 'a') or
 		die('pkwk_chown(): fopen() failed for: CACHEDIR/' .
-			basename(htmlspecialchars($lockfile)));
+			basename(htmlsc($lockfile)));
 	flock($flock, LOCK_EX) or die('pkwk_chown(): flock() failed for lock');
 
 	// Check owner
 	$stat = stat($filename) or
-		die('pkwk_chown(): stat() failed for: '  . basename(htmlspecialchars($filename)));
+		die('pkwk_chown(): stat() failed for: '  . basename(htmlsc($filename)));
 	if ($stat[4] === $php_uid) {
 		// NOTE: Windows always here
 		$result = TRUE; // Seems the same UID. Nothing to do
@@ -746,7 +746,7 @@
 		// NOTE: Not 'r+'. Don't check write permission here
 		$ffile = fopen($filename, 'r') or
 			die('pkwk_chown(): fopen() failed for: ' .
-				basename(htmlspecialchars($filename)));
+				basename(htmlsc($filename)));
 
 		// Try to chown by re-creating files
 		// NOTE:
@@ -786,7 +786,7 @@
 		return $result;
 	} else {
 		die('pkwk_touch_file(): Invalid UID and (not writable for the directory or not a flie): ' .
-			htmlspecialchars(basename($filename)));
+			htmlsc(basename($filename)));
 	}
 }
 ?>
diff -ruN -x index.php wiki/lib/func.php wiki.new/lib/func.php
--- wiki/lib/func.php	2007-06-04 20:32:42.000000000 +0900
+++ wiki.new/lib/func.php	2013-07-05 02:56:07.000000000 +0900
@@ -8,6 +8,12 @@
 //
 // General functions
 
+// Sugar with default settings
+function htmlsc($string = '', $flags = ENT_QUOTES, $charset = CONTENT_CHARSET)
+{
+    return htmlspecialchars($string, $flags, $charset);
+}
+
 function is_interwiki($str)
 {
 	global $InterWikiName;
@@ -80,12 +86,12 @@
 		return FALSE;
 	} else {
 		$fp = fopen(get_filename($page), 'rb') or
-			die('is_freeze(): fopen() failed: ' . htmlspecialchars($page));
+			die('is_freeze(): fopen() failed: ' . htmlsc($page));
 		flock($fp, LOCK_SH) or die('is_freeze(): flock() failed');
 		rewind($fp);
 		$buffer = fgets($fp, 9);
 		flock($fp, LOCK_UN) or die('is_freeze(): flock() failed');
-		fclose($fp) or die('is_freeze(): fclose() failed: ' . htmlspecialchars($page));
+		fclose($fp) or die('is_freeze(): fclose() failed: ' . htmlsc($page));
 
 		$is_freeze[$page] = ($buffer != FALSE && rtrim($buffer, "\r\n") == '#freeze');
 		return $is_freeze[$page];
@@ -182,7 +188,7 @@
 			$char = mb_substr($word_nm, $pos, 1, SOURCE_ENCODING);
 
 			// Just normalized one? (ASCII char or Zenkaku-Katakana?)
-			$or = array(preg_quote($do_escape ? htmlspecialchars($char) : $char, $quote));
+			$or = array(preg_quote($do_escape ? htmlsc($char) : $char, $quote));
 			if (strlen($char) == 1) {
 				// An ASCII (single-byte) character
 				foreach (array(strtoupper($char), strtolower($char)) as $_char) {
@@ -263,7 +269,7 @@
 	if ($non_format) return array_keys($pages);
 
 	$r_word = rawurlencode($word);
-	$s_word = htmlspecialchars($word);
+	$s_word = htmlsc($word);
 	if (empty($pages))
 		return str_replace('$1', $s_word, $_msg_notfoundresult);
 
@@ -272,7 +278,7 @@
 	$retval = '<ul>' . "\n";
 	foreach (array_keys($pages) as $page) {
 		$r_page  = rawurlencode($page);
-		$s_page  = htmlspecialchars($page);
+		$s_page  = htmlsc($page);
 		$passage = $show_passage ? ' ' . get_passage(get_filetime($page)) : '';
 		$retval .= ' <li><a href="' . $script . '?cmd=read&amp;page=' .
 			$r_page . '&amp;word=' . $r_word . '">' . $s_page .
@@ -304,11 +310,11 @@
 // Decode page name
 function decode($key)
 {
-	return hex2bin($key);
+	return internal_hex2bin($key);
 }
 
 // Inversion of bin2hex()
-function hex2bin($hex_string)
+function internal_hex2bin($hex_string)
 {
 	// preg_match : Avoid warning : pack(): Type H: illegal hex digit ...
 	// (string)   : Always treat as string (not int etc). See BugTrack2/31
@@ -356,14 +362,14 @@
 
 	foreach($pages as $file=>$page) {
 		$r_page  = rawurlencode($page);
-		$s_page  = htmlspecialchars($page, ENT_QUOTES);
+		$s_page  = htmlsc($page, ENT_QUOTES);
 		$passage = get_pg_passage($page);
 
 		$str = '   <li><a href="' . $href . $r_page . '">' .
 			$s_page . '</a>' . $passage;
 
 		if ($withfilename) {
-			$s_file = htmlspecialchars($file);
+			$s_file = htmlsc($file);
 			$str .= "\n" . '    <ul><li>' . $s_file . '</li></ul>' .
 				"\n" . '   ';
 		}
@@ -431,7 +437,7 @@
 	global $rule_page;
 
 	if (! is_page($rule_page)) {
-		return '<p>Sorry, page \'' . htmlspecialchars($rule_page) .
+		return '<p>Sorry, page \'' . htmlsc($rule_page) .
 			'\' unavailable.</p>';
 	} else {
 		return convert_html(get_source($rule_page));
@@ -528,7 +534,7 @@
 {
 	global $WikiName, $autolink, $nowikiname;
 
-	$config = &new Config('AutoLink');
+	$config = new Config('AutoLink');
 	$config->read();
 	$ignorepages      = $config->get('IgnoreList');
 	$forceignorepages = $config->get('ForceIgnoreList');
@@ -631,7 +637,7 @@
 	if (isset($script_directory_index)) {
 		if (! file_exists($script_directory_index))
 			die_message('Directory index file not found: ' .
-				htmlspecialchars($script_directory_index));
+				htmlsc($script_directory_index));
 		$matches = array();
 		if (preg_match('#^(.+/)' . preg_quote($script_directory_index, '#') . '$#',
 			$script, $matches)) $script = $matches[1];
diff -ruN -x index.php wiki/lib/html.php wiki.new/lib/html.php
--- wiki/lib/html.php	2008-02-08 01:33:04.000000000 +0900
+++ wiki.new/lib/html.php	2013-07-05 03:24:50.000000000 +0900
@@ -117,7 +117,7 @@
 
 	// Search words
 	if ($search_word_color && isset($vars['word'])) {
-		$body = '<div class="small">' . $_msg_word . htmlspecialchars($vars['word']) .
+		$body = '<div class="small">' . $_msg_word . htmlsc($vars['word']) .
 			'</div>' . $hr . "\n" . $body;
 
 		// BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5
@@ -132,7 +132,7 @@
 		$keys = get_search_words(array_keys($keys), TRUE);
 		$id = 0;
 		foreach ($keys as $key=>$pattern) {
-			$s_key    = htmlspecialchars($key);
+			$s_key    = htmlsc($key);
 			$pattern  = '/' .
 				'<textarea[^>]*>.*?<\/textarea>' .	// Ignore textareas
 				'|' . '<[^>]*>' .			// Ignore tags
@@ -190,7 +190,7 @@
 		foreach(get_existpages() as $_page) {
 			if ($_page == $whatsnew || check_non_list($_page))
 				continue;
-			$s_page = htmlspecialchars($_page);
+			$s_page = htmlsc($_page);
 			$pages[$_page] = '   <option value="' . $s_page . '">' .
 				$s_page . '</option>';
 		}
@@ -210,10 +210,10 @@
 	}
 
 	$r_page      = rawurlencode($page);
-	$s_page      = htmlspecialchars($page);
-	$s_digest    = htmlspecialchars($digest);
-	$s_postdata  = htmlspecialchars($refer . $postdata);
-	$s_original  = isset($vars['original']) ? htmlspecialchars($vars['original']) : $s_postdata;
+	$s_page      = htmlsc($page);
+	$s_digest    = htmlsc($digest);
+	$s_postdata  = htmlsc($refer . $postdata);
+	$s_original  = isset($vars['original']) ? htmlsc($vars['original']) : $s_postdata;
 	$b_preview   = isset($vars['preview']); // TRUE when preview
 	$btn_preview = $b_preview ? $_btn_repreview : $_btn_preview;
 
@@ -293,7 +293,7 @@
 		if (check_non_list($page)) continue;
 
 		$r_page   = rawurlencode($page);
-		$s_page   = htmlspecialchars($page);
+		$s_page   = htmlsc($page);
 		$passage  = get_passage($lastmod);
 		$_links[] = $tag ?
 			'<a href="' . $script . '?' . $r_page . '" title="' .
@@ -367,7 +367,7 @@
 {
 	global $script;
 
-	$s_page = htmlspecialchars($page);
+	$s_page = htmlsc($page);
 	$r_page = rawurlencode($page);
 
 	return '<a href="' . $script . '?plugin=related&amp;page=' . $r_page .
@@ -429,7 +429,7 @@
 	if (version_compare(PHP_VERSION, '4.3.0', '>=')) {
 		if (headers_sent($file, $line))
 		    die('Headers already sent at ' .
-		    	htmlspecialchars($file) .
+		    	htmlsc($file) .
 			' line ' . $line . '.');
 	} else {
 		if (headers_sent())
@@ -509,7 +509,7 @@
 		break;
 	}
 
-	$charset = htmlspecialchars($charset);
+	$charset = htmlsc($charset);
 
 	// Output XML or not
 	if ($type == PKWK_DTD_TYPE_XHTML) echo '<?xml version="1.0" encoding="' . $charset . '" ?>' . "\n";
diff -ruN -x index.php wiki/lib/init.php wiki.new/lib/init.php
--- wiki/lib/init.php	2007-06-04 20:32:44.000000000 +0900
+++ wiki.new/lib/init.php	2013-07-05 01:09:50.000000000 +0900
@@ -22,6 +22,10 @@
 /////////////////////////////////////////////////
 // Init server variables
 
+if (!isset($HTTP_SERVER_VARS)) {
+	$HTTP_SERVER_VARS = input_filter($_SERVER);
+}
+
 foreach (array('SCRIPT_NAME', 'SERVER_ADMIN', 'SERVER_NAME',
 	'SERVER_PORT', 'SERVER_SOFTWARE') as $key) {
 	define($key, isset($_SERVER[$key]) ? $_SERVER[$key] : '');
diff -ruN -x index.php wiki/lib/link.php wiki.new/lib/link.php
--- wiki/lib/link.php	2007-06-04 20:32:44.000000000 +0900
+++ wiki.new/lib/link.php	2013-07-05 03:21:33.000000000 +0900
@@ -89,7 +89,7 @@
 		// ¥Ú¡¼¥¸¤¬Â¸ºß¤·¤Æ¤¤¤ë
 		if (! empty($rel_new)) {
     			$fp = fopen($rel_file, 'w')
-    				or die_message('cannot write ' . htmlspecialchars($rel_file));
+    				or die_message('cannot write ' . htmlsc($rel_file));
 			fputs($fp, join("\t", $rel_new));
 			fclose($fp);
 		}
@@ -162,7 +162,7 @@
 		$rel = array_unique($rel);
 		if (! empty($rel)) {
 			$fp = fopen(CACHE_DIR . encode($page) . '.rel', 'w')
-				or die_message('cannot write ' . htmlspecialchars(CACHE_DIR . encode($page) . '.rel'));
+				or die_message('cannot write ' . htmlsc(CACHE_DIR . encode($page) . '.rel'));
 			fputs($fp, join("\t", $rel));
 			fclose($fp);
 		}
@@ -170,7 +170,7 @@
 
 	foreach ($ref as $page=>$arr) {
 		$fp  = fopen(CACHE_DIR . encode($page) . '.ref', 'w')
-			or die_message('cannot write ' . htmlspecialchars(CACHE_DIR . encode($page) . '.ref'));
+			or die_message('cannot write ' . htmlsc(CACHE_DIR . encode($page) . '.ref'));
 		foreach ($arr as $ref_page=>$ref_auto)
 			fputs($fp, $ref_page . "\t" . $ref_auto . "\n");
 		fclose($fp);
@@ -199,7 +199,7 @@
 		}
 		if ($is_page || ! $all_auto) {
 			$fp = fopen($ref_file, 'w')
-				 or die_message('cannot write ' . htmlspecialchars($ref_file));
+				 or die_message('cannot write ' . htmlsc($ref_file));
 			fputs($fp, $ref);
 			fclose($fp);
 		}
@@ -228,7 +228,7 @@
 		unlink($ref_file);
 		if (($is_page || ! $all_auto) && $ref != '') {
 			$fp = fopen($ref_file, 'w')
-				or die_message('cannot write ' . htmlspecialchars($ref_file));
+				or die_message('cannot write ' . htmlsc($ref_file));
 			fputs($fp, $ref);
 			fclose($fp);
 		}
@@ -240,7 +240,7 @@
 	static $obj;
 
 	if (! isset($obj) || $refresh)
-		$obj = & new InlineConverter(NULL, array('note'));
+		$obj = new InlineConverter(NULL, array('note'));
 
 	$result = $obj->get_objects(join('', preg_grep('/^(?!\/\/|\s)./', get_source($page))), $page);
 	return $result;
diff -ruN -x index.php wiki/lib/make_link.php wiki.new/lib/make_link.php
--- wiki/lib/make_link.php	2007-06-04 20:32:42.000000000 +0900
+++ wiki.new/lib/make_link.php	2013-07-05 03:23:34.000000000 +0900
@@ -95,7 +95,7 @@
 		$string = preg_replace_callback('/' . $this->pattern . '/x',
 			array(& $this, 'replace'), $string);
 
-		$arr = explode("\x08", make_line_rules(htmlspecialchars($string)));
+		$arr = explode("\x08", make_line_rules(htmlsc($string)));
 		$retval = '';
 		while (! empty($arr)) {
 			$retval .= array_shift($arr) . array_shift($this->result);
@@ -108,7 +108,7 @@
 		$obj = $this->get_converter($arr);
 
 		$this->result[] = ($obj !== NULL && $obj->set($arr, $this->page) !== FALSE) ?
-			$obj->toString() : make_line_rules(htmlspecialchars($arr[0]));
+			$obj->toString() : make_line_rules(htmlsc($arr[0]));
 
 		return "\x08"; // Add a mark into latest processed part
 	}
@@ -187,7 +187,7 @@
 		$this->type = $type;
 		if (! PKWK_DISABLE_INLINE_IMAGE_FROM_URI &&
 			is_url($alias) && preg_match('/\.(gif|png|jpe?g)$/i', $alias)) {
-			$alias = '<img src="' . htmlspecialchars($alias) . '" alt="' . $name . '" />';
+			$alias = '<img src="' . htmlsc($alias) . '" alt="' . $name . '" />';
 		} else if ($alias != '') {
 			if ($converter === NULL)
 				$converter = new InlineConverter(array('plugin'));
@@ -270,7 +270,7 @@
 		} else {
 			// No such plugin, or Failed
 			$body = (($body == '') ? '' : '{' . $body . '}') . ';';
-			return make_line_rules(htmlspecialchars('&' . $this->plain) . $body);
+			return make_line_rules(htmlsc('&' . $this->plain) . $body);
 		}
 	}
 }
@@ -374,7 +374,7 @@
 	function set($arr, $page)
 	{
 		list(, , $alias, $name) = $this->splice($arr);
-		return parent::setParam($page, htmlspecialchars($name),
+		return parent::setParam($page, htmlsc($name),
 			'', 'url', $alias == '' ? $name : $alias);
 	}
 
@@ -418,7 +418,7 @@
 	function set($arr, $page)
 	{
 		list(, $name, $alias) = $this->splice($arr);
-		return parent::setParam($page, htmlspecialchars($name), '', 'url', $alias);
+		return parent::setParam($page, htmlsc($name), '', 'url', $alias);
 	}
 
 	function toString()
@@ -520,11 +520,11 @@
 		$url = get_interwiki_url($name, $this->param);
 		$this->url = ($url === FALSE) ?
 			$script . '?' . rawurlencode('[[' . $name . ':' . $this->param . ']]') :
-			htmlspecialchars($url);
+			htmlsc($url);
 
 		return parent::setParam(
 			$page,
-			htmlspecialchars($name . ':' . $this->param),
+			htmlsc($name . ':' . $this->param),
 			'',
 			'InterWikiName',
 			$alias == '' ? $name . ':' . $this->param : $alias
@@ -708,7 +708,7 @@
 {
 	global $script, $vars, $link_compact, $related, $_symbol_noexists;
 
-	$s_page = htmlspecialchars(strip_bracket($page));
+	$s_page = htmlsc(strip_bracket($page));
 	$s_alias = ($alias == '') ? $s_page : $alias;
 
 	if ($page == '') return '<a href="' . $anchor . '">' . $s_alias . '</a>';
diff -ruN -x index.php wiki/lib/plugin.php wiki.new/lib/plugin.php
--- wiki/lib/plugin.php	2007-06-04 20:32:43.000000000 +0900
+++ wiki.new/lib/plugin.php	2013-07-05 03:22:22.000000000 +0900
@@ -27,7 +27,7 @@
 	$name = strtolower($name);
 	if(isset($exist[$name])) {
 		if (++$count[$name] > PKWK_PLUGIN_CALL_TIME_LIMIT)
-			die('Alert: plugin "' . htmlspecialchars($name) .
+			die('Alert: plugin "' . htmlsc($name) .
 			'" was called over ' . PKWK_PLUGIN_CALL_TIME_LIMIT .
 			' times. SPAM or someting?<br />' . "\n" .
 			'<a href="' . get_script_uri() . '?cmd=edit&amp;page='.
@@ -135,7 +135,7 @@
 	$digest  = $_digest; // Revert
 
 	if ($retvar === FALSE) {
-		return htmlspecialchars('#' . $name .
+		return htmlsc('#' . $name .
 			($args != '' ? '(' . $args . ')' : ''));
 	} else if (PKWK_ENCODING_HINT != '') {
 		// Insert a hidden field, supports idenrtifying text enconding
@@ -170,7 +170,7 @@
 
 	if($retvar === FALSE) {
 		// Do nothing
-		return htmlspecialchars('&' . $name . ($args ? '(' . $args . ')' : '') . ';');
+		return htmlsc('&' . $name . ($args ? '(' . $args . ')' : '') . ';');
 	} else {
 		return $retvar;
 	}
diff -ruN -x index.php wiki/lib/pukiwiki.php wiki.new/lib/pukiwiki.php
--- wiki/lib/pukiwiki.php	2007-06-04 20:32:41.000000000 +0900
+++ wiki.new/lib/pukiwiki.php	2013-07-05 03:26:23.000000000 +0900
@@ -94,14 +94,14 @@
 		}
 	} else {
 		// Not found
-		$msg = 'plugin=' . htmlspecialchars($plugin) .
+		$msg = 'plugin=' . htmlsc($plugin) .
 			' is not implemented.';
 		$retvars = array('msg'=>$msg,'body'=>$msg);
 		$base    = & $defaultpage;
 	}
 }
 
-$title = htmlspecialchars(strip_bracket($base));
+$title = htmlsc(strip_bracket($base));
 $page  = make_search($base);
 if (isset($retvars['msg']) && $retvars['msg'] != '') {
 	$title = str_replace('$1', $title, $retvars['msg']);
@@ -113,7 +113,7 @@
 } else {
 	if ($base == '' || ! is_page($base)) {
 		$base  = & $defaultpage;
-		$title = htmlspecialchars(strip_bracket($base));
+		$title = htmlsc(strip_bracket($base));
 		$page  = make_search($base);
 	}
 
diff -ruN -x index.php wiki/plugin/amazon.inc.php wiki.new/plugin/amazon.inc.php
--- wiki/plugin/amazon.inc.php	2007-06-04 20:33:35.000000000 +0900
+++ wiki.new/plugin/amazon.inc.php	2013-07-05 03:01:55.000000000 +0900
@@ -125,7 +125,7 @@
 		// ¥ì¥Ó¥å¡¼ºîÀ®
 		if (PKWK_READONLY) return ''; // Show nothing
 
-		$s_page = htmlspecialchars($vars['page']);
+		$s_page = htmlsc($vars['page']);
 		if ($s_page == '') $s_page = isset($vars['refer']) ? $vars['refer'] : '';
 		$ret = <<<EOD
 <form action="$script" method="post">
@@ -147,12 +147,12 @@
 	if ($align == 'clear') return '<div style="clear:both"></div>'; // ²þ¹ÔÁÞÆþ
 	if ($align != 'left') $align = 'right'; // ÇÛÃÖ·èÄê
 
-	$asin_all = htmlspecialchars($aryargs[0]);  // for XSS
+	$asin_all = htmlsc($aryargs[0]);  // for XSS
 	if (is_asin() == FALSE && $align != 'clear') return FALSE;
 
 	if ($aryargs[2] != '') {
 		// ¥¿¥¤¥È¥ë»ØÄê
-		$title = $alt = htmlspecialchars($aryargs[2]); // for XSS
+		$title = $alt = htmlsc($aryargs[2]); // for XSS
 		if ($alt == 'image') {
 			$alt = plugin_amazon_get_asin_title();
 			if ($alt == '') return FALSE;
@@ -195,7 +195,7 @@
 
 	$s_page   = isset($vars['refer']) ? $vars['refer'] : '';
 	$asin_all = isset($vars['asin']) ?
-		htmlspecialchars(rawurlencode(strip_bracket($vars['asin']))) : '';
+		htmlsc(rawurlencode(strip_bracket($vars['asin']))) : '';
 
 	if (! is_asin()) {
 		$retvars['msg']   = '¥Ö¥Ã¥¯¥ì¥Ó¥å¡¼ÊÔ½¸';
@@ -236,7 +236,7 @@
 
 	list($asin_all) = func_get_args();
 
-	$asin_all = htmlspecialchars($asin_all); // for XSS
+	$asin_all = htmlsc($asin_all); // for XSS
 	if (! is_asin()) return FALSE;
 
 	$title = plugin_amazon_get_asin_title();
diff -ruN -x index.php wiki/plugin/aname.inc.php wiki.new/plugin/aname.inc.php
--- wiki/plugin/aname.inc.php	2007-06-04 20:33:34.000000000 +0900
+++ wiki.new/plugin/aname.inc.php	2013-07-05 03:04:22.000000000 +0900
@@ -94,12 +94,12 @@
 			return plugin_aname_usage($convert, 'ID too long');
 		if (! preg_match(PLUGIN_ANAME_ID_REGEX, $id))
 			return plugin_aname_usage($convert, 'Invalid ID string: ' .
-				htmlspecialchars($id));
+				htmlsc($id));
 		$_id[$id] = TRUE; // Set
 	}
 
-	if ($convert) $body = htmlspecialchars($body);
-	$id = htmlspecialchars($id); // Insurance
+	if ($convert) $body = htmlsc($body);
+	$id = htmlsc($id); // Insurance
 	$class   = $f_super ? 'anchor_super' : 'anchor';
 	$attr_id = $f_noid  ? '' : ' id="' . $id . '"';
 	$url     = $f_full  ? get_script_uri() . '?' . rawurlencode($vars['page']) : '';
diff -ruN -x index.php wiki/plugin/article.inc.php wiki.new/plugin/article.inc.php
--- wiki/plugin/article.inc.php	2007-06-04 20:33:40.000000000 +0900
+++ wiki.new/plugin/article.inc.php	2013-07-05 02:56:40.000000000 +0900
@@ -93,9 +93,9 @@
 
 		$body = $_msg_collided . "\n";
 
-		$s_refer    = htmlspecialchars($post['refer']);
-		$s_digest   = htmlspecialchars($post['digest']);
-		$s_postdata = htmlspecialchars($postdata_input);
+		$s_refer    = htmlsc($post['refer']);
+		$s_digest   = htmlsc($post['digest']);
+		$s_postdata = htmlsc($postdata_input);
 		$body .= <<<EOD
 <form action="$script?cmd=preview" method="post">
  <div>
@@ -152,8 +152,8 @@
 
 	$article_no = $numbers[$vars['page']]++;
 
-	$s_page   = htmlspecialchars($vars['page']);
-	$s_digest = htmlspecialchars($digest);
+	$s_page   = htmlsc($vars['page']);
+	$s_digest = htmlsc($digest);
 	$name_cols = PLUGIN_ARTICLE_NAME_COLS;
 	$subject_cols = PLUGIN_ARTICLE_SUBJECT_COLS;
 	$article_rows = PLUGIN_ARTICLE_ROWS;
diff -ruN -x index.php wiki/plugin/attach.inc.php wiki.new/plugin/attach.inc.php
--- wiki/plugin/attach.inc.php	2007-06-04 20:33:30.000000000 +0900
+++ wiki.new/plugin/attach.inc.php	2013-07-05 03:16:20.000000000 +0900
@@ -65,7 +65,7 @@
 
 	$ret = '';
 	if (! $nolist) {
-		$obj  = & new AttachPages($page);
+		$obj  = new AttachPages($page);
 		$ret .= $obj->toString($page, TRUE);
 	}
 	if (! $noform) {
@@ -139,7 +139,7 @@
 
 	$page = isset($vars['page']) ? $vars['page'] : '';
 
-	$obj = & new AttachPages($page, 0);
+	$obj = new AttachPages($page, 0);
 
 	if (! isset($obj->pages[$page])) {
 		return '';
@@ -186,7 +186,7 @@
 			'msg'=>$_attach_messages['err_adminpass']);
 	}
 
-	$obj = & new AttachFile($page, $file['name']);
+	$obj = new AttachFile($page, $file['name']);
 	if ($obj->exist)
 		return array('result'=>FALSE,
 			'msg'=>$_attach_messages['err_exists']);
@@ -236,7 +236,7 @@
 	foreach (array('refer', 'file', 'age') as $var)
 		${$var} = isset($vars[$var]) ? $vars[$var] : '';
 
-	$obj = & new AttachFile($refer, $file, $age);
+	$obj = new AttachFile($refer, $file, $age);
 	return $obj->getstatus() ?
 		$obj->info($err) :
 		array('msg'=>$_attach_messages['err_notfound']);
@@ -253,7 +253,7 @@
 	if (is_freeze($refer) || ! is_editable($refer))
 		return array('msg'=>$_attach_messages['err_noparm']);
 
-	$obj = & new AttachFile($refer, $file, $age);
+	$obj = new AttachFile($refer, $file, $age);
 	if (! $obj->getstatus())
 		return array('msg'=>$_attach_messages['err_notfound']);
 		
@@ -272,7 +272,7 @@
 	if (is_freeze($refer) || ! is_editable($refer)) {
 		return array('msg'=>$_attach_messages['err_noparm']);
 	} else {
-		$obj = & new AttachFile($refer, $file, $age);
+		$obj = new AttachFile($refer, $file, $age);
 		return $obj->getstatus() ?
 			$obj->freeze($freeze, $pass) :
 			array('msg'=>$_attach_messages['err_notfound']);
@@ -291,7 +291,7 @@
 	if (is_freeze($refer) || ! is_editable($refer)) {
 		return array('msg'=>$_attach_messages['err_noparm']);
 	}
-	$obj = & new AttachFile($refer, $file, $age);
+	$obj = new AttachFile($refer, $file, $age);
 	if (! $obj->getstatus())
 		return array('msg'=>$_attach_messages['err_notfound']);
 
@@ -308,7 +308,7 @@
 		${$var} = isset($vars[$var]) ? $vars[$var] : '';
 	}
 
-	$obj = & new AttachFile($refer, $file, $age);
+	$obj = new AttachFile($refer, $file, $age);
 	return $obj->getstatus() ?
 		$obj->open() :
 		array('msg'=>$_attach_messages['err_notfound']);
@@ -321,7 +321,7 @@
 
 	$refer = isset($vars['refer']) ? $vars['refer'] : '';
 
-	$obj = & new AttachPages($refer);
+	$obj = new AttachPages($refer);
 
 	$msg = $_attach_messages[($refer == '') ? 'msg_listall' : 'msg_listpage'];
 	$body = ($refer == '' || isset($obj->pages[$refer])) ?
@@ -389,7 +389,7 @@
 	global $script, $vars, $_attach_messages;
 
 	$r_page = rawurlencode($page);
-	$s_page = htmlspecialchars($page);
+	$s_page = htmlsc($page);
 	$navi = <<<EOD
   <span class="small">
    [<a href="$script?plugin=attach&amp;pcmd=list&amp;refer=$r_page">{$_attach_messages['msg_list']}</a>]
@@ -490,7 +490,7 @@
 	}
 
 	// ÆüÉÕ¤ÎÈæ³Ó´Ø¿ô
-	function datecomp($a, $b) {
+	static function datecomp($a, $b) {
 		return ($a->time == $b->time) ? 0 : (($a->time > $b->time) ? -1 : 1);
 	}
 
@@ -502,7 +502,7 @@
 		$param  = '&amp;file=' . rawurlencode($this->file) . '&amp;refer=' . rawurlencode($this->page) .
 			($this->age ? '&amp;age=' . $this->age : '');
 		$title = $this->time_str . ' ' . $this->size_str;
-		$label = ($showicon ? PLUGIN_ATTACH_FILE_ICON : '') . htmlspecialchars($this->file);
+		$label = ($showicon ? PLUGIN_ATTACH_FILE_ICON : '') . htmlsc($this->file);
 		if ($this->age) {
 			$label .= ' (backup No.' . $this->age . ')';
 		}
@@ -522,8 +522,8 @@
 		global $script, $_attach_messages;
 
 		$r_page = rawurlencode($this->page);
-		$s_page = htmlspecialchars($this->page);
-		$s_file = htmlspecialchars($this->file);
+		$s_page = htmlsc($this->page);
+		$s_file = htmlsc($this->file);
 		$s_err = ($err == '') ? '' : '<p style="font-weight:bold">' . $_attach_messages[$err] . '</p>';
 
 		$msg_rename  = '';
@@ -564,7 +564,7 @@
 		}
 		$info = $this->toString(TRUE, FALSE);
 
-		$retval = array('msg'=>sprintf($_attach_messages['msg_info'], htmlspecialchars($this->file)));
+		$retval = array('msg'=>sprintf($_attach_messages['msg_info'], htmlsc($this->file)));
 		$retval['body'] = <<< EOD
 <p class="small">
  [<a href="$script?plugin=attach&amp;pcmd=list&amp;refer=$r_page">{$_attach_messages['msg_list']}</a>]
@@ -711,7 +711,7 @@
 				break;
 			}
 		}
-		$filename = htmlspecialchars($filename);
+		$filename = htmlsc($filename);
 
 		ini_set('default_charset', '');
 		mb_http_output('pass');
@@ -739,7 +739,7 @@
 
 	function add($file, $age)
 	{
-		$this->files[$file][$age] = & new AttachFile($this->page, $file, $age);
+		$this->files[$file][$age] = new AttachFile($this->page, $file, $age);
 	}
 
 	// ¥Õ¥¡¥¤¥ë°ìÍ÷¤ò¼èÆÀ
@@ -763,7 +763,7 @@
 				$_files[$age] = $this->files[$file][$age]->toString(FALSE, TRUE);
 			}
 			if (! isset($_files[0])) {
-				$_files[0] = htmlspecialchars($file);
+				$_files[0] = htmlsc($file);
 			}
 			ksort($_files);
 			$_file = $_files[0];
@@ -787,7 +787,7 @@
 				$files[$file] = & $this->files[$file][0];
 			}
 		}
-		uasort($files, array('AttachFile', 'datecomp'));
+		uasort($files, 'AttachFile::datecomp');
 		foreach (array_keys($files) as $file) {
 			$ret .= $files[$file]->toString(TRUE, TRUE) . ' ';
 		}
@@ -821,7 +821,7 @@
 			$_file = decode($matches[2]);
 			$_age  = isset($matches[3]) ? $matches[3] : 0;
 			if (! isset($this->pages[$_page])) {
-				$this->pages[$_page] = & new AttachFiles($_page);
+				$this->pages[$_page] = new AttachFiles($_page);
 			}
 			$this->pages[$_page]->add($_file, $_age);
 		}
diff -ruN -x index.php wiki/plugin/back.inc.php wiki.new/plugin/back.inc.php
--- wiki/plugin/back.inc.php	2007-06-04 20:33:35.000000000 +0900
+++ wiki.new/plugin/back.inc.php	2013-07-05 03:24:29.000000000 +0900
@@ -23,7 +23,7 @@
 	list($word, $align, $hr, $href) = array_pad(func_get_args(), 4, '');
 
 	$word = trim($word);
-	$word = ($word == '') ? $_msg_back_word : htmlspecialchars($word);
+	$word = ($word == '') ? $_msg_back_word : htmlsc($word);
 
 	$align = strtolower(trim($align));
 	switch($align){
diff -ruN -x index.php wiki/plugin/backlinks.inc.php wiki.new/plugin/backlinks.inc.php
--- wiki/plugin/backlinks.inc.php	2008-02-08 01:41:34.000000000 +0900
+++ wiki.new/plugin/backlinks.inc.php	2013-07-05 03:03:17.000000000 +0900
@@ -29,7 +29,7 @@
 		if (check_non_list($page)) continue;
 
 		$r_page   = rawurlencode($page);
-		$s_page   = htmlspecialchars($page);
+		$s_page   = htmlsc($page);
 		$passage  = get_passage($lastmod);
 		$_links[] = $tag ?
 			'<a href="' . $script . '?' . $r_page . '" title="' . 
diff -ruN -x index.php wiki/plugin/backup.inc.php wiki.new/plugin/backup.inc.php
--- wiki/plugin/backup.inc.php	2007-06-04 20:33:35.000000000 +0900
+++ wiki.new/plugin/backup.inc.php	2013-07-05 03:03:48.000000000 +0900
@@ -25,7 +25,7 @@
 	if ($page == '') return array('msg'=>$_title_backuplist, 'body'=>plugin_backup_get_list_all());
 
 	check_readable($page, true, true);
-	$s_page = htmlspecialchars($page);
+	$s_page = htmlsc($page);
 	$r_page = rawurlencode($page);
 
 	$action = isset($vars['action']) ? $vars['action'] : '';
@@ -33,7 +33,7 @@
 
 	$s_action = $r_action = '';
 	if ($action != '') {
-		$s_action = htmlspecialchars($action);
+		$s_action = htmlsc($action);
 		$r_action = rawurlencode($action);
 	}
 
@@ -107,7 +107,7 @@
 		$body .= plugin_backup_diff(do_diff($old, $cur));
 	} else if ($s_action == 'source') {
 		$title = & $_title_backupsource;
-		$body .= '<pre>' . htmlspecialchars(join('', $backups[$s_age]['data'])) .
+		$body .= '<pre>' . htmlsc(join('', $backups[$s_age]['data'])) .
 			'</pre>' . "\n";
 	} else {
 		if (PLUGIN_BACKUP_DISABLE_BACKUP_RENDERING) {
@@ -145,7 +145,7 @@
 	}
 
 	$script = get_script_uri();
-	$s_page = htmlspecialchars($page);
+	$s_page = htmlsc($page);
 	$body .= <<<EOD
 <p>$_msg_backup_adminpass</p>
 <form action="$script" method="post">
@@ -172,7 +172,7 @@
 </ul>
 EOD;
 
-	return $ul . '<pre>' . diff_style_to_css(htmlspecialchars($str)) . '</pre>' . "\n";
+	return $ul . '<pre>' . diff_style_to_css(htmlsc($str)) . '</pre>' . "\n";
 }
 
 function plugin_backup_get_list($page)
@@ -182,7 +182,7 @@
 
 	$script = get_script_uri();
 	$r_page = rawurlencode($page);
-	$s_page = htmlspecialchars($page);
+	$s_page = htmlsc($page);
 	$retval = array();
 	$retval[0] = <<<EOD
 <ul>
diff -ruN -x index.php wiki/plugin/bugtrack.inc.php wiki.new/plugin/bugtrack.inc.php
--- wiki/plugin/bugtrack.inc.php	2007-06-04 20:33:32.000000000 +0900
+++ wiki.new/plugin/bugtrack.inc.php	2013-07-05 03:06:10.000000000 +0900
@@ -74,14 +74,14 @@
 	$selected = '';
 	for ($i = 0; $i < $count; ++$i) {
 		if ($i == ($count - 1)) $selected = ' selected="selected"'; // The last one
-		$priority_list = htmlspecialchars($_plugin_bugtrack['priority_list'][$i]);
+		$priority_list = htmlsc($_plugin_bugtrack['priority_list'][$i]);
 		$select_priority .= '    <option value="' . $priority_list . '"' .
 			$selected . '>' . $priority_list . '</option>' . "\n";
 	}
 
 	$select_state = "\n";
 	for ($i = 0; $i < count($_plugin_bugtrack['state_list']); ++$i) {
-		$state_list = htmlspecialchars($_plugin_bugtrack['state_list'][$i]);
+		$state_list = htmlsc($_plugin_bugtrack['state_list'][$i]);
 		$select_state .= '    <option value="' . $state_list . '">' .
 			$state_list . '</option>' . "\n";
 	}
@@ -92,7 +92,7 @@
 	} else {
 		$encoded_category = '<select name="category" id="_p_bugtrack_category_' . $id . '">';
 		foreach ($category as $_category) {
-			$s_category = htmlspecialchars($_category);
+			$s_category = htmlsc($_category);
 			$encoded_category .= '<option value="' . $s_category . '">' .
 				$s_category . '</option>' . "\n";
 		}
@@ -100,18 +100,18 @@
 	}
 
 	$script     = get_script_uri();
-	$s_base     = htmlspecialchars($base);
-	$s_name     = htmlspecialchars($_plugin_bugtrack['name']);
-	$s_category = htmlspecialchars($_plugin_bugtrack['category']);
-	$s_priority = htmlspecialchars($_plugin_bugtrack['priority']);
-	$s_state    = htmlspecialchars($_plugin_bugtrack['state']);
-	$s_pname    = htmlspecialchars($_plugin_bugtrack['pagename']);
-	$s_pnamec   = htmlspecialchars($_plugin_bugtrack['pagename_comment']);
-	$s_version  = htmlspecialchars($_plugin_bugtrack['version']);
-	$s_versionc = htmlspecialchars($_plugin_bugtrack['version_comment']);
-	$s_summary  = htmlspecialchars($_plugin_bugtrack['summary']);
-	$s_body     = htmlspecialchars($_plugin_bugtrack['body']);
-	$s_submit   = htmlspecialchars($_plugin_bugtrack['submit']);
+	$s_base     = htmlsc($base);
+	$s_name     = htmlsc($_plugin_bugtrack['name']);
+	$s_category = htmlsc($_plugin_bugtrack['category']);
+	$s_priority = htmlsc($_plugin_bugtrack['priority']);
+	$s_state    = htmlsc($_plugin_bugtrack['state']);
+	$s_pname    = htmlsc($_plugin_bugtrack['pagename']);
+	$s_pnamec   = htmlsc($_plugin_bugtrack['pagename_comment']);
+	$s_version  = htmlsc($_plugin_bugtrack['version']);
+	$s_versionc = htmlsc($_plugin_bugtrack['version_comment']);
+	$s_summary  = htmlsc($_plugin_bugtrack['summary']);
+	$s_body     = htmlsc($_plugin_bugtrack['body']);
+	$s_submit   = htmlsc($_plugin_bugtrack['submit']);
 	$body = <<<EOD
 <form action="$script" method="post">
  <table border="0">
@@ -277,12 +277,12 @@
 	foreach ($data as $line) {
 		list($page, $no, $summary, $name, $priority, $state, $category) = $line;
 		foreach (array('summary', 'name', 'priority', 'state', 'category') as $item)
-			$$item = htmlspecialchars($$item);
+			$$item = htmlsc($$item);
 		$page_link = make_pagelink($page);
 
 		$state_no = array_search($state, $_plugin_bugtrack['state_sort']);
 		if ($state_no === NULL || $state_no === FALSE) $state_no = $count_list;
-		$bgcolor = htmlspecialchars($_plugin_bugtrack['state_bgcolor'][$state_no]);
+		$bgcolor = htmlsc($_plugin_bugtrack['state_bgcolor'][$state_no]);
 
 		$row = <<<EOD
  <tr>
@@ -298,10 +298,10 @@
 	}
 
 	$table_html = ' <tr>' . "\n";
-	$bgcolor = htmlspecialchars($_plugin_bugtrack['header_bgcolor']);
+	$bgcolor = htmlsc($_plugin_bugtrack['header_bgcolor']);
 	foreach (array('pagename', 'state', 'priority', 'category', 'name', 'summary') as $item)
 		$table_html .= '  <th style="background-color:' . $bgcolor . '">' .
-			htmlspecialchars($_plugin_bugtrack[$item]) . '</th>' . "\n";
+			htmlsc($_plugin_bugtrack[$item]) . '</th>' . "\n";
 	$table_html .= ' </tr>' . "\n";
 
 	for ($i = 0; $i <= $count_list; ++$i) {
diff -ruN -x index.php wiki/plugin/calendar.inc.php wiki.new/plugin/calendar.inc.php
--- wiki/plugin/calendar.inc.php	2007-06-04 20:33:28.000000000 +0900
+++ wiki.new/plugin/calendar.inc.php	2013-07-05 03:20:50.000000000 +0900
@@ -97,7 +97,7 @@
 		$dt     = sprintf('%04d%02d%02d', $year, $m_num, $day);
 		$name   = $prefix . $dt;
 		$r_page = rawurlencode($name);
-		$s_page = htmlspecialchars($name);
+		$s_page = htmlsc($name);
 
 		$refer = ($cmd == 'edit') ? '&amp;refer=' . rawurlencode($page) : '';
 
diff -ruN -x index.php wiki/plugin/calendar2.inc.php wiki.new/plugin/calendar2.inc.php
--- wiki/plugin/calendar2.inc.php	2007-06-04 20:33:40.000000000 +0900
+++ wiki.new/plugin/calendar2.inc.php	2013-07-05 02:57:33.000000000 +0900
@@ -35,9 +35,9 @@
 		$prefix = $base . '/';
 	}
 	$r_base   = rawurlencode($base);
-	$s_base   = htmlspecialchars($base);
+	$s_base   = htmlsc($base);
 	$r_prefix = rawurlencode($prefix);
-	$s_prefix = htmlspecialchars($prefix);
+	$s_prefix = htmlsc($prefix);
 
 	$yr  = substr($date_str, 0, 4);
 	$mon = substr($date_str, 4, 2);
@@ -106,7 +106,7 @@
 		$dt     = sprintf('%4d-%02d-%02d', $year, $m_num, $day);
 		$page   = $prefix . $dt;
 		$r_page = rawurlencode($page);
-		$s_page = htmlspecialchars($page);
+		$s_page = htmlsc($page);
 
 		if ($wday == 0 && $day > 1)
 			$ret .=
@@ -188,7 +188,7 @@
 	$yy = sprintf('%04d.%02d', substr($date, 0, 4),substr($date, 4, 2));
 
 	$aryargs = array($vars['page'], $date);
-	$s_page  = htmlspecialchars($vars['page']);
+	$s_page  = htmlsc($vars['page']);
 
 	$ret['msg']  = 'calendar ' . $s_page . '/' . $yy;
 	$ret['body'] = call_user_func_array('plugin_calendar2_convert', $aryargs);
diff -ruN -x index.php wiki/plugin/calendar_viewer.inc.php wiki.new/plugin/calendar_viewer.inc.php
--- wiki/plugin/calendar_viewer.inc.php	2007-06-04 20:33:32.000000000 +0900
+++ wiki.new/plugin/calendar_viewer.inc.php	2013-07-05 03:07:11.000000000 +0900
@@ -101,7 +101,7 @@
 
 	// Avoid Loop etc.
 	if (isset($viewed[$pagename])) {
-		$s_page = htmlspecialchars($pagename);
+		$s_page = htmlsc($pagename);
 		return "#calendar_viewer(): You already view: $s_page<br />";
 	} else {
 		$viewed[$pagename] = TRUE; // Valid
@@ -176,17 +176,17 @@
 		if (PLUGIN_CALENDAR_VIEWER_DATE_FORMAT !== FALSE) {
 			$time = strtotime(basename($page)); // $date_sep must be assumed '-' or ''!
 			if ($time == -1) {
-				$s_page = htmlspecialchars($page); // Failed. Why?
+				$s_page = htmlsc($page); // Failed. Why?
 			} else {
 				$week   = $weeklabels[date('w', $time)];
-				$s_page = htmlspecialchars(str_replace(
+				$s_page = htmlsc(str_replace(
 						array('$w' ),
 						array($week),
 						date(PLUGIN_CALENDAR_VIEWER_DATE_FORMAT, $time)
 					));
 			}
 		} else {
-			$s_page = htmlspecialchars($page);
+			$s_page = htmlsc($page);
 		}
 
 		if (PKWK_READONLY) {
@@ -259,7 +259,7 @@
 
 	// ¥Ê¥Ó¥²¡¼¥ÈÍÑ¤Î¥ê¥ó¥¯¤òËöÈø¤ËÄÉ²Ã
 	if ($left_YM != '' || $right_YM != '') {
-		$s_date_sep = htmlspecialchars($date_sep);
+		$s_date_sep = htmlsc($date_sep);
 		$left_link = $right_link = '';
 		$link = $script . '?plugin=calendar_viewer&amp;mode=' . $mode .
 			'&amp;file=' . $enc_pagename . '&amp;date_sep=' . $s_date_sep . '&amp;';
@@ -304,12 +304,12 @@
 	$return_vars_array['body'] = call_user_func_array('plugin_calendar_viewer_convert', $args_array);
 
 	//$return_vars_array['msg'] = 'calendar_viewer ' . $vars['page'] . '/' . $page_YM;
-	$return_vars_array['msg'] = 'calendar_viewer ' . htmlspecialchars($vars['page']);
+	$return_vars_array['msg'] = 'calendar_viewer ' . htmlsc($vars['page']);
 	if ($vars['page'] != '') $return_vars_array['msg'] .= '/';
 	if (preg_match('/\*/', $page_YM)) {
 		// ¤¦¡¼¤ó¡¢n·ïÉ½¼¨¤Î»þ¤Ï¤Ê¤ó¤Æ¥Ú¡¼¥¸Ì¾¤Ë¤·¤¿¤é¤¤¤¤¡©
 	} else {
-		$return_vars_array['msg'] .= htmlspecialchars($page_YM);
+		$return_vars_array['msg'] .= htmlsc($page_YM);
 	}
 
 	$vars['page'] = $page;
diff -ruN -x index.php wiki/plugin/color.inc.php wiki.new/plugin/color.inc.php
--- wiki/plugin/color.inc.php	2007-06-04 20:33:30.000000000 +0900
+++ wiki.new/plugin/color.inc.php	2013-07-05 03:16:03.000000000 +0900
@@ -17,12 +17,12 @@
 	global $pkwk_dtd;
 
 	$args = func_get_args();
-	$text = strip_autolink(array_pop($args)); // Already htmlspecialchars(text)
+	$text = strip_autolink(array_pop($args)); // Already htmlsc(text)
 
 	list($color, $bgcolor) = array_pad($args, 2, '');
 	if ($color != '' && $bgcolor != '' && $text == '') {
 		// Maybe the old style: '&color(foreground,text);'
-		$text    = htmlspecialchars($bgcolor);
+		$text    = htmlsc($bgcolor);
 		$bgcolor = '';
 	}
 	if (($color == '' && $bgcolor == '') || $text == '' || func_num_args() > 3)
@@ -31,7 +31,7 @@
 	// Invalid color
 	foreach(array($color, $bgcolor) as $col){
 		if ($col != '' && ! preg_match(PLUGIN_COLOR_REGEX, $col))
-			return '&color():Invalid color: ' . htmlspecialchars($col) . ';';
+			return '&color():Invalid color: ' . htmlsc($col) . ';';
 	}
 
 	if (PLUGIN_COLOR_ALLOW_CSS === TRUE || ! isset($pkwk_dtd) || $pkwk_dtd == PKWK_DTD_XHTML_1_1) {
diff -ruN -x index.php wiki/plugin/comment.inc.php wiki.new/plugin/comment.inc.php
--- wiki/plugin/comment.inc.php	2007-06-04 20:33:36.000000000 +0900
+++ wiki.new/plugin/comment.inc.php	2013-07-05 03:02:21.000000000 +0900
@@ -110,7 +110,7 @@
 		(in_array('below', $options) ? '0' : PLUGIN_COMMENT_DIRECTION_DEFAULT);
 
 	$script = get_script_uri();
-	$s_page = htmlspecialchars($vars['page']);
+	$s_page = htmlsc($vars['page']);
 	$string = <<<EOD
 <br />
 <form action="$script" method="post">
diff -ruN -x index.php wiki/plugin/diff.inc.php wiki.new/plugin/diff.inc.php
--- wiki/plugin/diff.inc.php	2007-06-04 20:33:35.000000000 +0900
+++ wiki.new/plugin/diff.inc.php	2013-07-05 03:03:48.000000000 +0900
@@ -30,7 +30,7 @@
 	global $_title_diff_delete;
 
 	$r_page = rawurlencode($page);
-	$s_page = htmlspecialchars($page);
+	$s_page = htmlsc($page);
 
 	$menu = array(
 		'<li>' . $_msg_addline . '</li>',
@@ -51,9 +51,9 @@
 			$menu[] = '<li><a href="' . $script . '?cmd=diff&amp;action=delete&amp;page=' .
 				$r_page . '">' . str_replace('$1', $s_page, $_title_diff_delete) . '</a></li>';
 		}
-		$msg = '<pre>' . diff_style_to_css(htmlspecialchars(join('', file($filename)))) . '</pre>' . "\n";
+		$msg = '<pre>' . diff_style_to_css(htmlsc(join('', file($filename)))) . '</pre>' . "\n";
 	} else if ($is_page) {
-		$diffdata = trim(htmlspecialchars(join('', get_source($page))));
+		$diffdata = trim(htmlsc(join('', get_source($page))));
 		$msg = '<pre><span class="diff_added">' . $diffdata . '</span></pre>' . "\n";
 	} else {
 		return array('msg'=>$_title_diff, 'body'=>$_msg_notfound);
@@ -94,7 +94,7 @@
 		}
 	}
 
-	$s_page = htmlspecialchars($page);
+	$s_page = htmlsc($page);
 	$body .= <<<EOD
 <p>$_msg_diff_adminpass</p>
 <form action="$script" method="post">
diff -ruN -x index.php wiki/plugin/edit.inc.php wiki.new/plugin/edit.inc.php
--- wiki/plugin/edit.inc.php	2007-06-04 20:33:37.000000000 +0900
+++ wiki.new/plugin/edit.inc.php	2013-07-05 02:59:26.000000000 +0900
@@ -115,11 +115,11 @@
 	$ispage   = is_page($s_page);
 
 	// Paragraph edit enabled or not
-	$short = htmlspecialchars('Edit');
+	$short = htmlsc('Edit');
 	if ($fixed_heading_anchor_edit && $editable && $ispage && ! $isfreeze) {
 		// Paragraph editing
 		$id    = rawurlencode($id);
-		$title = htmlspecialchars(sprintf('Edit %s', $page));
+		$title = htmlsc(sprintf('Edit %s', $page));
 		$icon = '<img src="' . IMAGE_DIR . 'paraedit.png' .
 			'" width="9" height="9" alt="' .
 			$short . '" title="' . $title . '" /> ';
@@ -134,7 +134,7 @@
 			$title = 'Edit %s';
 			$icon  = 'edit.png';
 		}
-		$title = htmlspecialchars(sprintf($title, $s_page));
+		$title = htmlsc(sprintf($title, $s_page));
 		$icon = '<img src="' . IMAGE_DIR . $icon .
 			'" width="20" height="20" alt="' .
 			$short . '" title="' . $title . '" />';
@@ -220,7 +220,7 @@
 	if ($postdata == '') {
 		page_write($page, $postdata);
 		$retvars['msg' ] = $_title_deleted;
-		$retvars['body'] = str_replace('$1', htmlspecialchars($page), $_title_deleted);
+		$retvars['body'] = str_replace('$1', htmlsc($page), $_title_deleted);
 
 		if ($trackback) tb_delete($page);
 
diff -ruN -x index.php wiki/plugin/freeze.inc.php wiki.new/plugin/freeze.inc.php
--- wiki/plugin/freeze.inc.php	2007-06-04 20:33:32.000000000 +0900
+++ wiki.new/plugin/freeze.inc.php	2013-07-05 03:06:09.000000000 +0900
@@ -22,7 +22,7 @@
 	if (is_freeze($page)) {
 		// Freezed already
 		$msg  = & $_title_isfreezed;
-		$body = str_replace('$1', htmlspecialchars(strip_bracket($page)),
+		$body = str_replace('$1', htmlsc(strip_bracket($page)),
 			$_title_isfreezed);
 
 	} else if ($pass !== NULL && pkwk_login($pass)) {
@@ -40,7 +40,7 @@
 	} else {
 		// Show a freeze form
 		$msg    = & $_title_freeze;
-		$s_page = htmlspecialchars($page);
+		$s_page = htmlsc($page);
 		$body   = ($pass === NULL) ? '' : "<p><strong>$_msg_invalidpass</strong></p>\n";
 		$body  .= <<<EOD
 <p>$_msg_freezing</p>
diff -ruN -x index.php wiki/plugin/include.inc.php wiki.new/plugin/include.inc.php
--- wiki/plugin/include.inc.php	2007-06-04 20:33:38.000000000 +0900
+++ wiki.new/plugin/include.inc.php	2013-07-05 02:59:09.000000000 +0900
@@ -77,7 +77,7 @@
 		}
 	}
 
-	$s_page = htmlspecialchars($page);
+	$s_page = htmlsc($page);
 	$r_page = rawurlencode($page);
 	$link = '<a href="' . $script . '?' . $r_page . '">' . $s_page . '</a>'; // Read link
 
diff -ruN -x index.php wiki/plugin/includesubmenu.inc.php wiki.new/plugin/includesubmenu.inc.php
--- wiki/plugin/includesubmenu.inc.php	2007-06-04 20:33:30.000000000 +0900
+++ wiki.new/plugin/includesubmenu.inc.php	2013-07-05 03:18:31.000000000 +0900
@@ -48,7 +48,7 @@
 
   if ($ShowPageName) {
     $r_page = rawurlencode($SubMenuPageName);
-    $s_page = htmlspecialchars($SubMenuPageName);
+    $s_page = htmlsc($SubMenuPageName);
     $link = "<a href=\"$script?cmd=edit&amp;page=$r_page\">$s_page</a>";
     $body = "<h1>$link</h1>\n$body";
   }
diff -ruN -x index.php wiki/plugin/insert.inc.php wiki.new/plugin/insert.inc.php
--- wiki/plugin/insert.inc.php	2007-06-04 20:33:32.000000000 +0900
+++ wiki.new/plugin/insert.inc.php	2013-07-05 03:05:30.000000000 +0900
@@ -40,9 +40,9 @@
 		$title = $_title_collided;
 		$body = $_msg_collided . "\n";
 
-		$s_refer  = htmlspecialchars($vars['refer']);
-		$s_digest = htmlspecialchars($vars['digest']);
-		$s_postdata_input = htmlspecialchars($postdata_input);
+		$s_refer  = htmlsc($vars['refer']);
+		$s_digest = htmlsc($vars['digest']);
+		$s_postdata_input = htmlsc($postdata_input);
 
 		$body .= <<<EOD
 <form action="$script?cmd=preview" method="post">
@@ -78,8 +78,8 @@
 
 	$insert_no = $numbers[$vars['page']]++;
 
-	$s_page   = htmlspecialchars($vars['page']);
-	$s_digest = htmlspecialchars($digest);
+	$s_page   = htmlsc($vars['page']);
+	$s_digest = htmlsc($digest);
 	$s_cols = INSERT_COLS;
 	$s_rows = INSERT_ROWS;
 	$string = <<<EOD
diff -ruN -x index.php wiki/plugin/interwiki.inc.php wiki.new/plugin/interwiki.inc.php
--- wiki/plugin/interwiki.inc.php	2007-06-04 20:33:37.000000000 +0900
+++ wiki.new/plugin/interwiki.inc.php	2013-07-05 02:58:23.000000000 +0900
@@ -28,7 +28,7 @@
 	return array(
 		'msg'  => $_title_invalidiwn,
 		'body' => str_replace(array('$1', '$2'),
-			array(htmlspecialchars(''),
+			array(htmlsc(''),
 			make_pagelink('InterWikiName')),
 			$_msg_invalidiwn));
 }
diff -ruN -x index.php wiki/plugin/login.inc.php wiki.new/plugin/login.inc.php
--- wiki/plugin/login.inc.php	2012-04-06 20:57:56.000000000 +0900
+++ wiki.new/plugin/login.inc.php	2013-07-05 02:57:25.000000000 +0900
@@ -3,7 +3,7 @@
 // login.inc.php
 // 
 // 2007/5/11	ÌµÂÌ¤ÊÊÑ¿ô¤ò½ü¤¤¤Æ¡¢Ê¬¤«¤ê¤ä¤¹¤¯ÊÑ¹¹. get_script_uri()¤ò»ÈÍÑ
-//		htmlspecialchars¤ò¤Ä¤±¤¿¡£
+//		htmlsc¤ò¤Ä¤±¤¿¡£
 // 2007/5/9	¥ª¥ê¥¸¥Ê¥ë//
 /////////////////////////////////////////////////
 
@@ -58,7 +58,7 @@
 	{
 		$body = '';
 		if( isset($_SESSION['login_user'])) {
-			$body = htmlspecialchars($_SESSION['login_user']) . " Logout.";
+			$body = htmlsc($_SESSION['login_user']) . " Logout.";
 			unset($_SESSION['login_user']);
 		}
 		$body .= _get_login_form();
@@ -76,8 +76,8 @@
 
 function _get_login_form(){
 	global $vars;
-	$script = htmlspecialchars(get_script_uri());
-	$s_referer= htmlspecialchars($vars['referer']);
+	$script = htmlsc(get_script_uri());
+	$s_referer= htmlsc($vars['referer']);
 	
 	return <<<EOD
 <div>
@@ -95,8 +95,8 @@
 
 function _get_logout_form(){
 	global $vars;
-	$script = htmlspecialchars(get_script_uri());
-	$s_referer= htmlspecialchars($vars['referer']);
+	$script = htmlsc(get_script_uri());
+	$s_referer= htmlsc($vars['referer']);
 	$user = $_SESSION['login_user'];
 	
 	return  <<<EOD
diff -ruN -x index.php wiki/plugin/lookup.inc.php wiki.new/plugin/lookup.inc.php
--- wiki/plugin/lookup.inc.php	2007-06-04 20:33:37.000000000 +0900
+++ wiki.new/plugin/lookup.inc.php	2013-07-05 03:00:50.000000000 +0900
@@ -19,11 +19,11 @@
 	if ($num == 0 || $num > 3) return PLUGIN_LOOKUP_USAGE;
 
 	$args = func_get_args();
-	$interwiki = htmlspecialchars(trim($args[0]));
+	$interwiki = htmlsc(trim($args[0]));
 	$button    = isset($args[1]) ? trim($args[1]) : '';
-	$button    = ($button != '') ? htmlspecialchars($button) : 'lookup';
-	$default   = ($num > 2) ? htmlspecialchars(trim($args[2])) : '';
-	$s_page    = htmlspecialchars($vars['page']);
+	$button    = ($button != '') ? htmlsc($button) : 'lookup';
+	$default   = ($num > 2) ? htmlsc(trim($args[2])) : '';
+	$s_page    = htmlsc($vars['page']);
 	++$id;
 
 	$script = get_script_uri();
@@ -54,7 +54,7 @@
 	$url = get_interwiki_url($inter, $page);
 	if ($url === FALSE) {
 		$msg = sprintf('InterWikiName "%s" not found', $inter);
-		$msg = htmlspecialchars($msg);
+		$msg = htmlsc($msg);
 		return array('msg'=>'Not found', 'body'=>$msg);
 	}
 
diff -ruN -x index.php wiki/plugin/ls2.inc.php wiki.new/plugin/ls2.inc.php
--- wiki/plugin/ls2.inc.php	2007-06-04 20:33:31.000000000 +0900
+++ wiki.new/plugin/ls2.inc.php	2013-07-05 03:15:15.000000000 +0900
@@ -41,7 +41,7 @@
 	$body = plugin_ls2_show_lists($prefix, $params);
 
 	return array('body'=>$body,
-		'msg'=>str_replace('$1', htmlspecialchars($prefix), $_ls2_msg_title));
+		'msg'=>str_replace('$1', htmlsc($prefix), $_ls2_msg_title));
 }
 
 function plugin_ls2_convert()
@@ -66,10 +66,12 @@
 	}
 	if ($prefix == '') $prefix = strip_bracket($vars['page']) . '/';
 
-	array_walk($args, 'plugin_ls2_check_arg', & $params);
+	foreach ($args as $key => $arg) {
+		plugin_ls2_check_arg($arg, $key, $params);
+	}
 
 	$title = (! empty($params['_args'])) ? join(',', $params['_args']) :   // Manual
-		str_replace('$1', htmlspecialchars($prefix), $_ls2_msg_title); // Auto
+		str_replace('$1', htmlsc($prefix), $_ls2_msg_title); // Auto
 
 	if (! $params['link'])
 		return plugin_ls2_show_lists($prefix, $params);
@@ -102,7 +104,7 @@
 	foreach ($pages as $page) $params["page_$page"] = 0;
 
 	if (empty($pages)) {
-		return str_replace('$1', htmlspecialchars($prefix), $_ls2_err_nopages);
+		return str_replace('$1', htmlsc($prefix), $_ls2_err_nopages);
 	} else {
 		$params['result'] = $params['saved'] = array();
 		foreach ($pages as $page)
@@ -121,7 +123,7 @@
 	if (! $is_done) $params["page_$page"] = ++$_ls2_anchor;
 
 	$r_page = rawurlencode($page);
-	$s_page = htmlspecialchars($page);
+	$s_page = htmlsc($page);
 	$title  = $s_page . ' ' . get_pg_passage($page, FALSE);
 	$href   = $script . '?cmd=read&amp;page=' . $r_page;
 
@@ -214,6 +216,6 @@
 		$params['_done'] = TRUE;
 	}
 
-	$params['_args'][] = htmlspecialchars($value); // Link title
+	$params['_args'][] = htmlsc($value); // Link title
 }
 ?>
diff -ruN -x index.php wiki/plugin/map.inc.php wiki.new/plugin/map.inc.php
--- wiki/plugin/map.inc.php	2007-06-04 20:33:28.000000000 +0900
+++ wiki.new/plugin/map.inc.php	2013-07-05 03:23:36.000000000 +0900
@@ -44,7 +44,7 @@
 	// Generate a tree
 	$nodes = array();
 	foreach ($pages as $page)
-		$nodes[$page] = & new MapNode($page, $reverse);
+		$nodes[$page] = new MapNode($page, $reverse);
 
 	// Node not found: Because of filtererd by $non_list
 	if (! isset($nodes[$refer])) $vars['refer'] = $refer = $defaultpage;
@@ -74,7 +74,7 @@
 		$nodes[$refer]->chain($nodes);
 		$retval['body'] .= '<ul>' . "\n" . $nodes[$refer]->toString($nodes) . '</ul>' . "\n";
 		$retval['body'] .= '<hr />' . "\n" .
-			'<p>Not related from ' . htmlspecialchars($refer) . '</p>' . "\n";
+			'<p>Not related from ' . htmlsc($refer) . '</p>' . "\n";
 		$keys = array_keys($nodes);
 		sort($keys);
 		$retval['body'] .= '<ul>' . "\n";
@@ -166,7 +166,7 @@
 		if ($this->parent_id == 0) $this->parent_id = -1;
 
 		foreach ($this->rels as $page) {
-			if (! isset($nodes[$page])) $nodes[$page] = & new MapNode($page);
+			if (! isset($nodes[$page])) $nodes[$page] = new MapNode($page);
 			if ($nodes[$page]->parent_id == 0)
 				$nodes[$page]->parent_id = $this->id;
 		}
diff -ruN -x index.php wiki/plugin/md5.inc.php wiki.new/plugin/md5.inc.php
--- wiki/plugin/md5.inc.php	2007-06-04 20:33:39.000000000 +0900
+++ wiki.new/plugin/md5.inc.php	2013-07-05 03:00:07.000000000 +0900
@@ -60,7 +60,7 @@
 	if (strlen($value) > PKWK_PASSPHRASE_LIMIT_LENGTH)
 		die_message('Limit: malicious message length');
 
-	if ($value != '') $value = 'value="' . htmlspecialchars($value) . '" ';
+	if ($value != '') $value = 'value="' . htmlsc($value) . '" ';
 
 	$sha1_enabled = function_exists('sha1');
 	$sha1_checked = $md5_checked = '';
diff -ruN -x index.php wiki/plugin/memo.inc.php wiki.new/plugin/memo.inc.php
--- wiki/plugin/memo.inc.php	2007-06-04 20:33:34.000000000 +0900
+++ wiki.new/plugin/memo.inc.php	2013-07-05 03:04:22.000000000 +0900
@@ -40,9 +40,9 @@
 		$title = $_title_collided;
 		$body  = $_msg_collided . "\n";
 
-		$s_refer  = htmlspecialchars($vars['refer']);
-		$s_digest = htmlspecialchars($vars['digest']);
-		$s_postdata_input = htmlspecialchars($postdata_input);
+		$s_refer  = htmlsc($vars['refer']);
+		$s_digest = htmlsc($vars['digest']);
+		$s_postdata_input = htmlsc($postdata_input);
 
 		$body .= <<<EOD
 <form action="$script?cmd=preview" method="post">
@@ -79,7 +79,7 @@
 	$data = implode(',', $data);	// Care all arguments
 	$data = str_replace('&#x2c;', ',', $data); // Unescape commas
 	$data = str_replace('&#x22;', '"', $data); // Unescape double quotes
-	$data = htmlspecialchars(str_replace('\n', "\n", $data));
+	$data = htmlsc(str_replace('\n', "\n", $data));
 
 	if (PKWK_READONLY) {
 		$_script = '';
@@ -89,8 +89,8 @@
 		$_submit = '<input type="submit" name="memo"    value="' . $_btn_memo_update . '" />';
 	}
 
-	$s_page   = htmlspecialchars($vars['page']);
-	$s_digest = htmlspecialchars($digest);
+	$s_page   = htmlsc($vars['page']);
+	$s_digest = htmlsc($digest);
 	$s_cols   = MEMO_COLS;
 	$s_rows   = MEMO_ROWS;
 	$string   = <<<EOD
diff -ruN -x index.php wiki/plugin/menu.inc.php wiki.new/plugin/menu.inc.php
--- wiki/plugin/menu.inc.php	2007-06-04 20:33:31.000000000 +0900
+++ wiki.new/plugin/menu.inc.php	2013-07-05 03:08:43.000000000 +0900
@@ -20,10 +20,10 @@
 	if ($num > 0) {
 		// Try to change default 'MenuBar' page name (only)
 		if ($num > 1)       return '#menu(): Zero or One argument needed';
-		if ($menu !== NULL) return '#menu(): Already set: ' . htmlspecialchars($menu);
+		if ($menu !== NULL) return '#menu(): Already set: ' . htmlsc($menu);
 		$args = func_get_args();
 		if (! is_page($args[0])) {
-			return '#menu(): No such page: ' . htmlspecialchars($args[0]);
+			return '#menu(): No such page: ' . htmlsc($args[0]);
 		} else {
 			$menu = $args[0]; // Set
 			return '';
@@ -48,7 +48,7 @@
 		if (! is_page($page)) {
 			return '';
 		} else if ($vars['page'] == $page) {
-			return '<!-- #menu(): You already view ' . htmlspecialchars($page) . ' -->';
+			return '<!-- #menu(): You already view ' . htmlsc($page) . ' -->';
 		} else {
 			// Cut fixed anchors
 			$menutext = preg_replace('/^(\*{1,3}.*)\[#[A-Za-z][\w-]+\](.*)$/m', '$1$2', get_source($page));
diff -ruN -x index.php wiki/plugin/navi.inc.php wiki.new/plugin/navi.inc.php
--- wiki/plugin/navi.inc.php	2007-06-04 20:33:35.000000000 +0900
+++ wiki.new/plugin/navi.inc.php	2013-07-05 03:03:48.000000000 +0900
@@ -59,12 +59,12 @@
 		$is_home = ($home == $current);
 		if (! is_page($home)) {
 			return '#navi(contents-page-name): No such page: ' .
-				htmlspecialchars($home) . '<br />';
+				htmlsc($home) . '<br />';
 		} else if (! $is_home &&
 		    ! preg_match('/^' . preg_quote($home, '/') . '/', $current)) {
-			return '#navi(' . htmlspecialchars($home) .
+			return '#navi(' . htmlsc($home) .
 				'): Not a child page like: ' .
-				htmlspecialchars($home . '/' . basename($current)) .
+				htmlsc($home . '/' . basename($current)) .
 				'<br />';
 		}
 		$reverse = (strtolower($reverse) == 'reverse');
@@ -128,7 +128,7 @@
 			foreach (array('start'=>$home, 'next'=>$next,
 			    'prev'=>$prev, 'up'=>$up) as $rel=>$_page) {
 				if ($_page != '') {
-					$s_page = htmlspecialchars($_page);
+					$s_page = htmlsc($_page);
 					$r_page = rawurlencode($_page);
 					$head_tags[] = ' <link rel="' .
 						$rel . '" href="' . $script .
@@ -148,7 +148,7 @@
 			return '#navi(contents-page-name): You already view the result<br />';
 		} else if ($count == 1) {
 			// Sentinel only: Show usage and warning
-			$home = htmlspecialchars($home);
+			$home = htmlsc($home);
 			$ret .= '#navi(' . $home . '): No child page like: ' .
 				$home . '/Foo';
 		} else {
diff -ruN -x index.php wiki/plugin/new.inc.php wiki.new/plugin/new.inc.php
--- wiki/plugin/new.inc.php	2007-06-04 20:33:36.000000000 +0900
+++ wiki.new/plugin/new.inc.php	2013-07-05 03:02:20.000000000 +0900
@@ -38,7 +38,7 @@
 		if ($timestamp === -1) return '&new([nodate]){date}: Invalid date string;';
 		$timestamp -= ZONETIME;
 
-		$retval = in_array('nodate', $args) ? '' : htmlspecialchars($date);
+		$retval = in_array('nodate', $args) ? '' : htmlsc($date);
 	} else {
 		// Show 'New!' message by the timestamp of the page
 		if (func_num_args() > 3) return '&new(pagename[,nolink]);';
diff -ruN -x index.php wiki/plugin/newpage.inc.php wiki.new/plugin/newpage.inc.php
--- wiki/plugin/newpage.inc.php	2007-06-04 20:33:39.000000000 +0900
+++ wiki.new/plugin/newpage.inc.php	2013-07-05 02:59:52.000000000 +0900
@@ -14,8 +14,8 @@
 	if (func_num_args()) list($newpage) = func_get_args();
 	if (! preg_match('/^' . $BracketName . '$/', $newpage)) $newpage = '';
 
-	$s_page    = htmlspecialchars(isset($vars['refer']) ? $vars['refer'] : $vars['page']);
-	$s_newpage = htmlspecialchars($newpage);
+	$s_page    = htmlsc(isset($vars['refer']) ? $vars['refer'] : $vars['page']);
+	$s_newpage = htmlsc($newpage);
 	++$id;
 
 	$ret = <<<EOD
diff -ruN -x index.php wiki/plugin/paint.inc.php wiki.new/plugin/paint.inc.php
--- wiki/plugin/paint.inc.php	2007-06-04 20:33:33.000000000 +0900
+++ wiki.new/plugin/paint.inc.php	2013-07-05 03:05:30.000000000 +0900
@@ -85,7 +85,7 @@
 		if (array_key_exists('refer',$vars))
 		{
 			$r_refer = rawurlencode($vars['refer']);
-			$s_refer = htmlspecialchars($vars['refer']);
+			$s_refer = htmlsc($vars['refer']);
 		}
 		$link = "<p><a href=\"$script?$r_refer\">$s_refer</a></p>";;
 
@@ -109,7 +109,7 @@
 		$f_w = (is_numeric($width) and $width > 0) ? $width : PAINT_DEFAULT_WIDTH;
 		$f_h = (is_numeric($height) and $height > 0) ? $height : PAINT_DEFAULT_HEIGHT;
 		$f_refer = array_key_exists('refer',$vars) ? encode($vars['refer']) : ''; // BBSPainter.jar¤¬shift-jis¤ËÊÑ´¹¤¹¤ë¤Î¤ò²óÈò
-		$f_digest = array_key_exists('digest',$vars) ? htmlspecialchars($vars['digest']) : '';
+		$f_digest = array_key_exists('digest',$vars) ? htmlsc($vars['digest']) : '';
 		$f_no = (array_key_exists('paint_no',$vars) and is_numeric($vars['paint_no'])) ?
 			$vars['paint_no'] + 0 : 0;
 
@@ -185,7 +185,7 @@
 	}
 
 	//XSSÀÈ¼åÀ­ÌäÂê - ³°Éô¤«¤éÍè¤¿ÊÑ¿ô¤ò¥¨¥¹¥±¡¼¥×
-	$f_page = htmlspecialchars($vars['page']);
+	$f_page = htmlsc($vars['page']);
 
 	$max = sprintf($_paint_messages['msg_max'],PAINT_MAX_WIDTH,PAINT_MAX_HEIGHT);
 
diff -ruN -x index.php wiki/plugin/pcomment.inc.php wiki.new/plugin/pcomment.inc.php
--- wiki/plugin/pcomment.inc.php	2007-06-04 20:33:37.000000000 +0900
+++ wiki.new/plugin/pcomment.inc.php	2013-07-05 02:58:06.000000000 +0900
@@ -80,7 +80,9 @@
 
 	// BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5
 	$args = func_get_args(); // with array_walk()
-	array_walk($args, 'plugin_pcomment_check_arg', & $params);
+	foreach ($args as $key => $arg) {
+		plugin_pcomment_check_arg($arg, $key, $params);
+	}
 
 	$vars_page = isset($vars['page']) ? $vars['page'] : '';
 	$page  = (isset($params['_args'][0]) && $params['_args'][0] != '') ? $params['_args'][0] :
@@ -91,7 +93,7 @@
 
 	$_page = get_fullname(strip_bracket($page), $vars_page);
 	if (!is_pagename($_page))
-		return sprintf($_pcmt_messages['err_pagename'], htmlspecialchars($_page));
+		return sprintf($_pcmt_messages['err_pagename'], htmlsc($_page));
 
 	$dir = PLUGIN_PCOMMENT_DIRECTION_DEFAULT;
 	if ($params['below']) {
@@ -119,10 +121,10 @@
 			'<input type="radio" name="reply" value="0" tabindex="0" checked="checked" />' : '';
 		$comment = '<input type="text" name="msg" size="' . PLUGIN_PCOMMENT_SIZE_MSG . '" />';
 
-		$s_page   = htmlspecialchars($page);
-		$s_refer  = htmlspecialchars($vars_page);
-		$s_nodate = htmlspecialchars($params['nodate']);
-		$s_count  = htmlspecialchars($count);
+		$s_page   = htmlsc($page);
+		$s_refer  = htmlsc($vars_page);
+		$s_nodate = htmlsc($params['nodate']);
+		$s_count  = htmlsc($count);
 
 		$form_start = '<form action="' . get_script_uri() . '" method="post">' . "\n";
 		$form = <<<EOD
@@ -207,7 +209,7 @@
 	$msg = rtrim($msg);
 
 	if (! is_page($page)) {
-		$postdata = '[[' . htmlspecialchars(strip_bracket($refer)) . ']]' . "\n\n" .
+		$postdata = '[[' . htmlsc(strip_bracket($refer)) . ']]' . "\n\n" .
 			'-' . $msg . "\n";
 	} else {
 		$postdata = get_source($page);
diff -ruN -x index.php wiki/plugin/popular.inc.php wiki.new/plugin/popular.inc.php
--- wiki/plugin/popular.inc.php	2007-06-04 20:33:31.000000000 +0900
+++ wiki.new/plugin/popular.inc.php	2013-07-05 03:12:32.000000000 +0900
@@ -76,7 +76,7 @@
 		foreach ($counters as $page=>$count) {
 			$page = substr($page, 1);
 
-			$s_page = htmlspecialchars($page);
+			$s_page = htmlsc($page);
 			if ($page == $vars['page']) {
 				// No need to link itself, notifies where you just read
 				$pg_passage = get_pg_passage($page,FALSE);
diff -ruN -x index.php wiki/plugin/random.inc.php wiki.new/plugin/random.inc.php
--- wiki/plugin/random.inc.php	2007-06-04 20:33:39.000000000 +0900
+++ wiki.new/plugin/random.inc.php	2013-07-05 02:59:10.000000000 +0900
@@ -30,7 +30,7 @@
 
 	return "<p><a href=\"$script?plugin=random&amp;refer=" .
 		rawurlencode($vars['page']) . '">' .
-		htmlspecialchars($title) . '</a></p>';
+		htmlsc($title) . '</a></p>';
 }
 
 function plugin_random_action()
diff -ruN -x index.php wiki/plugin/read.inc.php wiki.new/plugin/read.inc.php
--- wiki/plugin/read.inc.php	2007-06-04 20:33:31.000000000 +0900
+++ wiki.new/plugin/read.inc.php	2013-07-05 03:24:16.000000000 +0900
@@ -27,7 +27,7 @@
 		// Ìµ¸ú¤Ê¥Ú¡¼¥¸Ì¾
 		return array(
 			'msg'=>$_title_invalidwn,
-			'body'=>str_replace('$1', htmlspecialchars($page),
+			'body'=>str_replace('$1', htmlsc($page),
 				str_replace('$2', 'WikiName', $_msg_invalidiwn))
 		);
 	}
diff -ruN -x index.php wiki/plugin/recent.inc.php wiki.new/plugin/recent.inc.php
--- wiki/plugin/recent.inc.php	2007-06-04 20:33:30.000000000 +0900
+++ wiki.new/plugin/recent.inc.php	2013-07-05 03:17:26.000000000 +0900
@@ -67,7 +67,7 @@
 				'<ul class="recent_list">' . "\n";
 		}
 
-		$s_page = htmlspecialchars($page);
+		$s_page = htmlsc($page);
 		if($page == $vars['page']) {
 			// No need to link to the page you just read, or notify where you just read
 			$items .= ' <li>' . $s_page . '</li>' . "\n";
diff -ruN -x index.php wiki/plugin/ref.inc.php wiki.new/plugin/ref.inc.php
--- wiki/plugin/ref.inc.php	2007-06-04 20:33:37.000000000 +0900
+++ wiki.new/plugin/ref.inc.php	2013-07-05 02:59:09.000000000 +0900
@@ -187,7 +187,7 @@
 				// Promote new design
 				if ($is_file_default && $is_file_second) {
 					// Because of race condition NOW
-					$params['_error'] = htmlspecialchars('The same file name "' .
+					$params['_error'] = htmlsc('The same file name "' .
 						$name . '" at both page: "' .  $page . '" and "' .  $_arg .
 						'". Try ref(pagename/filename) to specify one of them');
 				} else {
@@ -204,7 +204,7 @@
 			$is_file = is_file($file);
 		}
 		if (! $is_file) {
-			$params['_error'] = htmlspecialchars('File not found: "' .
+			$params['_error'] = htmlsc('File not found: "' .
 				$name . '" at page "' . $page . '"');
 			return $params;
 		}
@@ -233,13 +233,13 @@
 		if (PKWK_DISABLE_INLINE_IMAGE_FROM_URI) {
 			//$params['_error'] = 'PKWK_DISABLE_INLINE_IMAGE_FROM_URI prohibits this';
 			//return $params;
-			$url = htmlspecialchars($name);
+			$url = htmlsc($name);
 			$params['_body'] = '<a href="' . $url . '">' . $url . '</a>';
 			return $params;
 		}
 
-		$url = $url2 = htmlspecialchars($name);
-		$title = htmlspecialchars(preg_match('/([^\/]+)$/', $name, $matches) ? $matches[1] : $url);
+		$url = $url2 = htmlsc($name);
+		$title = htmlsc(preg_match('/([^\/]+)$/', $name, $matches) ? $matches[1] : $url);
 
 		$is_image = (! $params['noimg'] && preg_match(PLUGIN_REF_IMAGE, $name));
 
@@ -254,7 +254,7 @@
 
 	} else { // ÅºÉÕ¥Õ¥¡¥¤¥ë
 
-		$title = htmlspecialchars($name);
+		$title = htmlsc($name);
 
 		$is_image = (! $params['noimg'] && preg_match(PLUGIN_REF_IMAGE, $name));
 
@@ -306,7 +306,7 @@
 		}
 
 		if (! empty($_title)) {
-			$title = htmlspecialchars(join(',', $_title));
+			$title = htmlsc(join(',', $_title));
 			if ($is_image) $title = make_line_rules($title);
 		}
 	}
@@ -420,7 +420,7 @@
 			break;
 		}
 	}
-	$file = htmlspecialchars($filename);
+	$file = htmlsc($filename);
 	$size = filesize($ref);
 
 	// Output
diff -ruN -x index.php wiki/plugin/referer.inc.php wiki.new/plugin/referer.inc.php
--- wiki/plugin/referer.inc.php	2007-06-04 20:33:38.000000000 +0900
+++ wiki.new/plugin/referer.inc.php	2013-07-05 02:58:06.000000000 +0900
@@ -99,8 +99,8 @@
 		list($ltime, $stime, $count, $url, $enable) = $arr;
 
 		// ÈóASCII¥­¥ã¥é¥¯¥¿(¤À¤±)¤òURL¥¨¥ó¥³¡¼¥É¤·¤Æ¤ª¤¯ BugTrack/440
-		$e_url = htmlspecialchars(preg_replace('/([" \x80-\xff]+)/e', 'rawurlencode("$1")', $url));
-		$s_url = htmlspecialchars(mb_convert_encoding(rawurldecode($url), SOURCE_ENCODING, 'auto'));
+		$e_url = htmlsc(preg_replace('/([" \x80-\xff]+)/e', 'rawurlencode("$1")', $url));
+		$s_url = htmlsc(mb_convert_encoding(rawurldecode($url), SOURCE_ENCODING, 'auto'));
 
 		$lpass = get_passage($ltime, FALSE); // ºÇ½ª¹¹¿·Æü»þ¤«¤é¤Î·Ð²á»þ´Ö
 		$spass = get_passage($stime, FALSE); // ½é²óÅÐÏ¿Æü»þ¤«¤é¤Î·Ð²á»þ´Ö
@@ -164,7 +164,7 @@
 		// BGCOLOR(#88ff88)
 		$matches = array();
 		foreach ($pconfig_color as $x)
-			$color[$x[0]] = htmlspecialchars(
+			$color[$x[0]] = htmlsc(
 				preg_match('/BGCOLOR\(([^)]+)\)/si', $x[1], $matches) ?
 					$matches[1] : $x[1]);
 	}
diff -ruN -x index.php wiki/plugin/related.inc.php wiki.new/plugin/related.inc.php
--- wiki/plugin/related.inc.php	2007-06-04 20:33:32.000000000 +0900
+++ wiki.new/plugin/related.inc.php	2013-07-05 03:08:07.000000000 +0900
@@ -31,7 +31,7 @@
 
 	// Result
 	$r_word = rawurlencode($_page);
-	$s_word = htmlspecialchars($_page);
+	$s_word = htmlsc($_page);
 	$msg = 'Backlinks for: ' . $s_word;
 	$retval  = '<a href="' . $script . '?' . $r_word . '">' .
 		'Return to ' . $s_word .'</a><br />'. "\n";
@@ -44,7 +44,7 @@
 		$retval .= '<ul>' . "\n";
 		foreach ($data as $page=>$time) {
 			$r_page  = rawurlencode($page);
-			$s_page  = htmlspecialchars($page);
+			$s_page  = htmlsc($page);
 			$passage = get_passage($time);
 			$retval .= ' <li><a href="' . $script . '?' . $r_page . '">' . $s_page .
 				'</a> ' . $passage . '</li>' . "\n";
diff -ruN -x index.php wiki/plugin/rename.inc.php wiki.new/plugin/rename.inc.php
--- wiki/plugin/rename.inc.php	2007-06-04 20:33:35.000000000 +0900
+++ wiki.new/plugin/rename.inc.php	2013-07-05 03:02:37.000000000 +0900
@@ -78,7 +78,7 @@
 		foreach ($page as $_page) $tmp .= '<br />' . $_page;
 		$page = $tmp;
 	}
-	if ($page != '') $body = sprintf($body, htmlspecialchars($page));
+	if ($page != '') $body = sprintf($body, htmlsc($page));
 
 	$msg = sprintf($_rename_messages['err'], $body);
 	return $msg;
@@ -101,8 +101,8 @@
 	}
 	$select_refer = plugin_rename_getselecttag($refer);
 
-	$s_src = htmlspecialchars(plugin_rename_getvar('src'));
-	$s_dst = htmlspecialchars(plugin_rename_getvar('dst'));
+	$s_src = htmlsc(plugin_rename_getvar('src'));
+	$s_dst = htmlsc(plugin_rename_getvar('dst'));
 
 	$ret = array();
 	$ret['msg']  = $_rename_messages['msg_title'];
@@ -143,8 +143,8 @@
 		'<input type="checkbox" name="related" id="_p_rename_related" value="1" checked="checked" /><br />';
 
 	$msg_rename = sprintf($_rename_messages['msg_rename'], make_pagelink($refer));
-	$s_page  = htmlspecialchars($page);
-	$s_refer = htmlspecialchars($refer);
+	$s_page  = htmlsc($page);
+	$s_refer = htmlsc($refer);
 
 	$ret = array();
 	$ret['msg']  = $_rename_messages['msg_title'];
@@ -228,16 +228,16 @@
 
 	$method = plugin_rename_getvar('method');
 	if ($method == 'regex') {
-		$s_src = htmlspecialchars(plugin_rename_getvar('src'));
-		$s_dst = htmlspecialchars(plugin_rename_getvar('dst'));
+		$s_src = htmlsc(plugin_rename_getvar('src'));
+		$s_dst = htmlsc(plugin_rename_getvar('dst'));
 		$msg   .= $_rename_messages['msg_regex'] . '<br />';
 		$input .= '<input type="hidden" name="method" value="regex" />';
 		$input .= '<input type="hidden" name="src"    value="' . $s_src . '" />';
 		$input .= '<input type="hidden" name="dst"    value="' . $s_dst . '" />';
 	} else {
-		$s_refer   = htmlspecialchars(plugin_rename_getvar('refer'));
-		$s_page    = htmlspecialchars(plugin_rename_getvar('page'));
-		$s_related = htmlspecialchars(plugin_rename_getvar('related'));
+		$s_refer   = htmlsc(plugin_rename_getvar('refer'));
+		$s_page    = htmlsc(plugin_rename_getvar('page'));
+		$s_related = htmlsc(plugin_rename_getvar('related'));
 		$msg   .= $_rename_messages['msg_page'] . '<br />';
 		$input .= '<input type="hidden" name="method"  value="page" />';
 		$input .= '<input type="hidden" name="refer"   value="' . $s_refer   . '" />';
@@ -250,7 +250,7 @@
 		foreach ($exists as $page=>$arr) {
 			$msg .= '<li>' . make_pagelink(decode($page));
 			$msg .= $_rename_messages['msg_arrow'];
-			$msg .= htmlspecialchars(decode($pages[$page]));
+			$msg .= htmlsc(decode($pages[$page]));
 			if (! empty($arr)) {
 				$msg .= '<ul>' . "\n";
 				foreach ($arr as $ofile=>$nfile)
@@ -289,7 +289,7 @@
 	foreach ($pages as $old=>$new)
 		$ret['body'] .= '<li>' .  make_pagelink(decode($old)) .
 			$_rename_messages['msg_arrow'] .
-			htmlspecialchars(decode($new)) .  '</li>' . "\n";
+			htmlsc(decode($new)) .  '</li>' . "\n";
 	$ret['body'] .= '</ul>' . "\n";
 	return $ret;
 }
@@ -407,7 +407,7 @@
 		if ($_page == $whatsnew) continue;
 
 		$selected = ($_page == $page) ? ' selected' : '';
-		$s_page = htmlspecialchars($_page);
+		$s_page = htmlsc($_page);
 		$pages[$_page] = '<option value="' . $s_page . '"' . $selected . '>' .
 			$s_page . '</option>';
 	}
diff -ruN -x index.php wiki/plugin/ruby.inc.php wiki.new/plugin/ruby.inc.php
--- wiki/plugin/ruby.inc.php	2007-06-04 20:33:30.000000000 +0900
+++ wiki.new/plugin/ruby.inc.php	2013-07-05 03:26:59.000000000 +0900
@@ -23,7 +23,7 @@
 	if ($ruby == '' || $body == '') return PLUGIN_RUBY_USAGE;
 
 	return '<ruby><rb>' . $body . '</rb>' . '<rp>(</rp>' .
-		'<rt>' .  htmlspecialchars($ruby) . '</rt>' . '<rp>)</rp>' .
+		'<rt>' .  htmlsc($ruby) . '</rt>' . '<rp>)</rp>' .
 		'</ruby>';
 }
 ?>
diff -ruN -x index.php wiki/plugin/search.inc.php wiki.new/plugin/search.inc.php
--- wiki/plugin/search.inc.php	2007-06-04 20:33:34.000000000 +0900
+++ wiki.new/plugin/search.inc.php	2013-07-05 03:09:07.000000000 +0900
@@ -30,9 +30,9 @@
 	global $post, $vars, $_title_result, $_title_search, $_msg_searching;
 
 	if (PLUGIN_SEARCH_DISABLE_GET_ACCESS) {
-		$s_word = isset($post['word']) ? htmlspecialchars($post['word']) : '';
+		$s_word = isset($post['word']) ? htmlsc($post['word']) : '';
 	} else {
-		$s_word = isset($vars['word']) ? htmlspecialchars($vars['word']) : '';
+		$s_word = isset($vars['word']) ? htmlsc($vars['word']) : '';
 	}
 	if (strlen($s_word) > PLUGIN_SEARCH_MAX_LENGTH) {
 		unset($vars['word']); // Stop using $_msg_word at lib/html.php
@@ -81,7 +81,7 @@
 			++$_num;
 			if (PLUGIN_SEARCH_MAX_BASE < $_num) break;
 			$label_id = '_p_search_base_id_' . $_num;
-			$s_base   = htmlspecialchars($base);
+			$s_base   = htmlsc($base);
 			$base_str = '<strong>' . $s_base . '</strong>';
 			$base_label = str_replace('$1', $base_str, $_search_pages);
 			$base_msg  .=<<<EOD
diff -ruN -x index.php wiki/plugin/setlinebreak.inc.php wiki.new/plugin/setlinebreak.inc.php
--- wiki/plugin/setlinebreak.inc.php	2007-06-04 20:33:35.000000000 +0900
+++ wiki.new/plugin/setlinebreak.inc.php	2013-07-05 03:01:57.000000000 +0900
@@ -41,7 +41,7 @@
 
 		default:
 			return '#setlinebreak: Invalid argument: ' .
-				htmlspecialchars($args[0]) . '<br />';
+				htmlsc($args[0]) . '<br />';
 		}
 	}
 	return '';
diff -ruN -x index.php wiki/plugin/showrss.inc.php wiki.new/plugin/showrss.inc.php
--- wiki/plugin/showrss.inc.php	2007-06-04 20:33:28.000000000 +0900
+++ wiki.new/plugin/showrss.inc.php	2013-07-05 03:20:24.000000000 +0900
@@ -53,11 +53,11 @@
 
 	$class = ($template == '' || $template == 'default') ? 'ShowRSS_html' : 'ShowRSS_html_' . $template;
 	if (! is_numeric($cachehour))
-		return '#showrss: Cache-lifetime seems not numeric: ' . htmlspecialchars($cachehour) . '<br />' . "\n";
+		return '#showrss: Cache-lifetime seems not numeric: ' . htmlsc($cachehour) . '<br />' . "\n";
 	if (! class_exists($class))
-		return '#showrss: Template not found: ' . htmlspecialchars($template) . '<br />' . "\n";
+		return '#showrss: Template not found: ' . htmlsc($template) . '<br />' . "\n";
 	if (! is_url($uri))
-		return '#showrss: Seems not URI: ' . htmlspecialchars($uri) . '<br />' . "\n";
+		return '#showrss: Seems not URI: ' . htmlsc($uri) . '<br />' . "\n";
 
 	list($rss, $time) = plugin_showrss_get_rss($uri, $cachehour);
 	if ($rss === FALSE) return '#showrss: Failed fetching RSS from the server<br />' . "\n";
@@ -247,10 +247,10 @@
 
 	function escape($str)
 	{
-		// Unescape already-escaped chars (&lt;, &gt;, &amp;, ...) in RSS body before htmlspecialchars()
+		// Unescape already-escaped chars (&lt;, &gt;, &amp;, ...) in RSS body before htmlsc()
 		$str = strtr($str, array_flip(get_html_translation_table(ENT_COMPAT)));
 		// Escape
-		$str = htmlspecialchars($str);
+		$str = htmlsc($str);
 		// Encoding conversion
 		$str = mb_convert_encoding($str, SOURCE_ENCODING, $this->encoding);
 		return trim($str);
diff -ruN -x index.php wiki/plugin/source.inc.php wiki.new/plugin/source.inc.php
--- wiki/plugin/source.inc.php	2007-06-04 20:33:28.000000000 +0900
+++ wiki.new/plugin/source.inc.php	2013-07-05 03:19:51.000000000 +0900
@@ -20,6 +20,6 @@
 
 	return array('msg' => $_source_messages['msg_title'],
 		'body' => '<pre id="source">' .
-		htmlspecialchars(join('', get_source($page))) . '</pre>');
+		htmlsc(join('', get_source($page))) . '</pre>');
 }
 ?>
diff -ruN -x index.php wiki/plugin/stationary.inc.php wiki.new/plugin/stationary.inc.php
--- wiki/plugin/stationary.inc.php	2007-06-04 20:33:36.000000000 +0900
+++ wiki.new/plugin/stationary.inc.php	2013-07-05 03:00:36.000000000 +0900
@@ -40,7 +40,7 @@
 		$result = join(',', $args);
 	}
 
-	return '#stationary(' . htmlspecialchars($result) . ')<br />';
+	return '#stationary(' . htmlsc($result) . ')<br />';
 }
 
 // In-line type plugin: &stationary; or &stationary(foo); , or &stationary(foo){bar};
@@ -56,7 +56,7 @@
 		$args[$key] = trim($args[$key]);
 	$result = join(',', $args);
 
-	return '&amp;stationary(' . htmlspecialchars($result) . '){' . $body . '};';
+	return '&amp;stationary(' . htmlsc($result) . '){' . $body . '};';
 }
 
 // Action-type plugin: ?plugin=stationary&foo=bar
@@ -69,6 +69,6 @@
 	$msg  = 'Message';
 	$body = 'Message body';
 
-	return array('msg'=>htmlspecialchars($msg), 'body'=>htmlspecialchars($body));
+	return array('msg'=>htmlsc($msg), 'body'=>htmlsc($body));
 }
 ?>
diff -ruN -x index.php wiki/plugin/tb.inc.php wiki.new/plugin/tb.inc.php
--- wiki/plugin/tb.inc.php	2007-06-04 20:33:31.000000000 +0900
+++ wiki.new/plugin/tb.inc.php	2013-07-05 03:23:59.000000000 +0900
@@ -140,7 +140,7 @@
 		// _utime_, title, excerpt, _blog_name_
 		array_shift($arr); // Cut utime
 		list ($url, $title, $excerpt) = array_map(
-			create_function('$a', 'return htmlspecialchars($a);'), $arr);
+			create_function('$a', 'return htmlsc($a);'), $arr);
 		$items .= <<<EOD
 
    <item>
@@ -151,7 +151,7 @@
 EOD;
 	}
 
-	$title = htmlspecialchars($page);
+	$title = htmlsc($page);
 	$link  = $script . '?' . rawurlencode($page);
 	$vars['page'] = $page;
 	$excerpt = strip_htmltag(convert_html(get_source($page)));
diff -ruN -x index.php wiki/plugin/template.inc.php wiki.new/plugin/template.inc.php
--- wiki/plugin/template.inc.php	2007-06-04 20:33:29.000000000 +0900
+++ wiki.new/plugin/template.inc.php	2013-07-05 03:07:11.000000000 +0900
@@ -43,7 +43,7 @@
 	}
 	$begin_select = $end_select = '';
 	for ($i = 0; $i < count($lines); $i++) {
-		$line = htmlspecialchars(mb_strimwidth($lines[$i], 0, MAX_LEN, '...'));
+		$line = htmlsc(mb_strimwidth($lines[$i], 0, MAX_LEN, '...'));
 
 		$tag = ($i == $begin) ? ' selected="selected"' : '';
 		$begin_select .= "<option value=\"$i\"$tag>$line</option>\n";
@@ -52,7 +52,7 @@
 		$end_select .= "<option value=\"$i\"$tag>$line</option>\n";
 	}
 
-	$_page = htmlspecialchars($page);
+	$_page = htmlsc($page);
 	$msg = $tag = '';
 	if ($is_page) {
 		$msg = $_err_template_already;
@@ -61,7 +61,7 @@
 		$msg = str_replace('$1', $_page, $_err_template_invalid);
 	}
 
-	$s_refer = htmlspecialchars($vars['refer']);
+	$s_refer = htmlsc($vars['refer']);
 	$s_page  = ($page == '') ? str_replace('$1', $s_refer, $_msg_template_page) : $_page;
 	$ret     = <<<EOD
 <form action="$script" method="post">
diff -ruN -x index.php wiki/plugin/topicpath.inc.php wiki.new/plugin/topicpath.inc.php
--- wiki/plugin/topicpath.inc.php	2007-06-04 20:33:36.000000000 +0900
+++ wiki.new/plugin/topicpath.inc.php	2013-07-05 03:07:12.000000000 +0900
@@ -44,7 +44,7 @@
 	while (! empty($parts)) {
 		$_landing = join('/', $parts);
 		$landing  = rawurlencode($_landing);
-		$element = htmlspecialchars(array_pop($parts));
+		$element = htmlsc(array_pop($parts));
 		if (! $b_link)  {
 			// This page ($_landing == $page)
 			$b_link = TRUE;
diff -ruN -x index.php wiki/plugin/tracker.inc.php wiki.new/plugin/tracker.inc.php
--- wiki/plugin/tracker.inc.php	2007-06-04 20:33:29.000000000 +0900
+++ wiki.new/plugin/tracker.inc.php	2013-07-05 03:18:07.000000000 +0900
@@ -44,7 +44,7 @@
 
 	if (!$config->read())
 	{
-		return "<p>config file '".htmlspecialchars($config_name)."' not found.</p>";
+		return "<p>config file '".htmlsc($config_name)."' not found.</p>";
 	}
 
 	$config->config_name = $config_name;
@@ -89,7 +89,7 @@
 	$config = new Config('plugin/tracker/'.$config_name);
 	if (!$config->read())
 	{
-		return "<p>config file '".htmlspecialchars($config_name)."' not found.</p>";
+		return "<p>config file '".htmlsc($config_name)."' not found.</p>";
 	}
 	$config->config_name = $config_name;
 	$source = $config->page.'/page';
@@ -100,14 +100,14 @@
 	{
 		return array(
 			'msg'=>'cannot write',
-			'body'=>'page name ('.htmlspecialchars($refer).') is not valid.'
+			'body'=>'page name ('.htmlsc($refer).') is not valid.'
 		);
 	}
 	if (!is_page($source))
 	{
 		return array(
 			'msg'=>'cannot write',
-			'body'=>'page template ('.htmlspecialchars($source).') is not exist.'
+			'body'=>'page template ('.htmlsc($source).') is not exist.'
 		);
 	}
 	// ¥Ú¡¼¥¸Ì¾¤ò·èÄê
@@ -197,7 +197,7 @@
 
 	if (!$config->read())
 	{
-		return "config file '".htmlspecialchars($config_name)."' not found.";
+		return "config file '".htmlsc($config_name)."' not found.";
 	}
 
 	$config->config_name = $config_name;
@@ -227,7 +227,7 @@
 		) as $field=>$class)
 	{
 		$class = 'Tracker_field_'.$class;
-		$fields[$field] = &new $class(array($field,$_tracker_messages["btn$field"],'','20',''),$base,$refer,$config);
+		$fields[$field] = new $class(array($field,$_tracker_messages["btn$field"],'','20',''),$base,$refer,$config);
 	}
 
 	foreach ($config->get('fields') as $field)
@@ -240,7 +240,7 @@
 			$field[2] = 'text';
 			$field[3] = '20';
 		}
-		$fields[$field[0]] = &new $class($field,$base,$refer,$config);
+		$fields[$field[0]] = new $class($field,$base,$refer,$config);
 	}
 	return $fields;
 }
@@ -299,9 +299,9 @@
 
 	function get_tag()
 	{
-		$s_name = htmlspecialchars($this->name);
-		$s_size = htmlspecialchars($this->values[0]);
-		$s_value = htmlspecialchars($this->default_value);
+		$s_name = htmlsc($this->name);
+		$s_size = htmlsc($this->values[0]);
+		$s_value = htmlsc($this->default_value);
 		return "<input type=\"text\" name=\"$s_name\" size=\"$s_size\" value=\"$s_value\" />";
 	}
 }
@@ -341,10 +341,10 @@
 
 	function get_tag()
 	{
-		$s_name = htmlspecialchars($this->name);
-		$s_cols = htmlspecialchars($this->values[0]);
-		$s_rows = htmlspecialchars($this->values[1]);
-		$s_value = htmlspecialchars($this->default_value);
+		$s_name = htmlsc($this->name);
+		$s_cols = htmlsc($this->values[0]);
+		$s_rows = htmlsc($this->values[1]);
+		$s_value = htmlsc($this->default_value);
 		return "<textarea name=\"$s_name\" cols=\"$s_cols\" rows=\"$s_rows\">$s_value</textarea>";
 	}
 	function format_cell($str)
@@ -383,8 +383,8 @@
 	}
 	function get_tag()
 	{
-		$s_name = htmlspecialchars($this->name);
-		$s_size = htmlspecialchars($this->values[0]);
+		$s_name = htmlsc($this->name);
+		$s_size = htmlsc($this->values[0]);
 		return "<input type=\"text\" name=\"$s_name\" size=\"$s_size\" />";
 	}
 	function get_key($str)
@@ -412,8 +412,8 @@
 
 	function get_tag()
 	{
-		$s_name = htmlspecialchars($this->name);
-		$s_size = htmlspecialchars($this->values[0]);
+		$s_name = htmlsc($this->name);
+		$s_size = htmlsc($this->values[0]);
 		return "<input type=\"file\" name=\"$s_name\" size=\"$s_size\" />";
 	}
 	function format_value($str)
@@ -437,12 +437,12 @@
 
 	function get_tag()
 	{
-		$s_name = htmlspecialchars($this->name);
+		$s_name = htmlsc($this->name);
 		$retval = '';
 		$id = 0;
 		foreach ($this->config->get($this->name) as $option)
 		{
-			$s_option = htmlspecialchars($option[0]);
+			$s_option = htmlsc($option[0]);
 			$checked = trim($option[0]) == trim($this->default_value) ? ' checked="checked"' : '';
 			++$id;
 			$s_id = '_p_tracker_' . $s_name . '_' . $this->id . '_' . $id;
@@ -473,9 +473,9 @@
 
 	function get_tag($empty=FALSE)
 	{
-		$s_name = htmlspecialchars($this->name);
+		$s_name = htmlsc($this->name);
 		$s_size = (array_key_exists(0,$this->values) and is_numeric($this->values[0])) ?
-			' size="'.htmlspecialchars($this->values[0]).'"' : '';
+			' size="'.htmlsc($this->values[0]).'"' : '';
 		$s_multiple = (array_key_exists(1,$this->values) and strtolower($this->values[1]) == 'multiple') ?
 			' multiple="multiple"' : '';
 		$retval = "<select name=\"{$s_name}[]\"$s_size$s_multiple>\n";
@@ -486,7 +486,7 @@
 		$defaults = array_flip(preg_split('/\s*,\s*/',$this->default_value,-1,PREG_SPLIT_NO_EMPTY));
 		foreach ($this->config->get($this->name) as $option)
 		{
-			$s_option = htmlspecialchars($option[0]);
+			$s_option = htmlsc($option[0]);
 			$selected = array_key_exists(trim($option[0]),$defaults) ? ' selected="selected"' : '';
 			$retval .= " <option value=\"$s_option\"$selected>$s_option</option>\n";
 		}
@@ -501,13 +501,13 @@
 
 	function get_tag($empty=FALSE)
 	{
-		$s_name = htmlspecialchars($this->name);
+		$s_name = htmlsc($this->name);
 		$defaults = array_flip(preg_split('/\s*,\s*/',$this->default_value,-1,PREG_SPLIT_NO_EMPTY));
 		$retval = '';
 		$id = 0;
 		foreach ($this->config->get($this->name) as $option)
 		{
-			$s_option = htmlspecialchars($option[0]);
+			$s_option = htmlsc($option[0]);
 			$checked = array_key_exists(trim($option[0]),$defaults) ?
 				' checked="checked"' : '';
 			++$id;
@@ -526,8 +526,8 @@
 
 	function get_tag($empty=FALSE)
 	{
-		$s_name = htmlspecialchars($this->name);
-		$s_default = htmlspecialchars($this->default_value);
+		$s_name = htmlsc($this->name);
+		$s_default = htmlsc($this->default_value);
 		$retval = "<input type=\"hidden\" name=\"$s_name\" value=\"$s_default\" />\n";
 
 		return $retval;
@@ -537,10 +537,10 @@
 {
 	function get_tag()
 	{
-		$s_title = htmlspecialchars($this->title);
-		$s_page = htmlspecialchars($this->page);
-		$s_refer = htmlspecialchars($this->refer);
-		$s_config = htmlspecialchars($this->config->config_name);
+		$s_title = htmlsc($this->title);
+		$s_page = htmlsc($this->page);
+		$s_refer = htmlsc($this->refer);
+		$s_config = htmlsc($this->config->config_name);
 
 		return <<<EOD
 <input type="submit" value="$s_title" />
@@ -626,7 +626,7 @@
 
 	if (!$config->read())
 	{
-		return "<p>config file '".htmlspecialchars($config_name)."' is not exist.";
+		return "<p>config file '".htmlsc($config_name)."' is not exist.";
 	}
 
 	$config->config_name = $config_name;
@@ -636,7 +636,7 @@
 		return "<p>config file '".make_pagelink($config->page.'/'.$list)."' not found.</p>";
 	}
 
-	$list = &new Tracker_list($page,$refer,$config,$list);
+	$list = new Tracker_list($page,$refer,$config,$list);
 	$list->sort($order);
 	return $list->toString($limit);
 }
diff -ruN -x index.php wiki/plugin/unfreeze.inc.php wiki.new/plugin/unfreeze.inc.php
--- wiki/plugin/unfreeze.inc.php	2007-06-04 20:33:33.000000000 +0900
+++ wiki.new/plugin/unfreeze.inc.php	2013-07-05 03:05:30.000000000 +0900
@@ -22,7 +22,7 @@
 	if (! is_freeze($page)) {
 		// Unfreezed already
 		$msg  = & $_title_isunfreezed;
-		$body = str_replace('$1', htmlspecialchars(strip_bracket($page)),
+		$body = str_replace('$1', htmlsc(strip_bracket($page)),
 			$_title_isunfreezed);
 
 	} else if ($pass !== NULL && pkwk_login($pass)) {
@@ -47,7 +47,7 @@
 	} else {
 		// Show unfreeze form
 		$msg    = & $_title_unfreeze;
-		$s_page = htmlspecialchars($page);
+		$s_page = htmlsc($page);
 		$body   = ($pass === NULL) ? '' : "<p><strong>$_msg_invalidpass</strong></p>\n";
 		$body  .= <<<EOD
 <p>$_msg_unfreezing</p>
diff -ruN -x index.php wiki/plugin/versionlist.inc.php wiki.new/plugin/versionlist.inc.php
--- wiki/plugin/versionlist.inc.php	2007-06-04 20:33:29.000000000 +0900
+++ wiki.new/plugin/versionlist.inc.php	2013-07-05 03:16:44.000000000 +0900
@@ -44,12 +44,12 @@
 				continue;
 			}
 			$data = join('',file($sdir.$file));
-			$comment = array('file'=>htmlspecialchars($sdir.$file),'rev'=>'','date'=>'');
+			$comment = array('file'=>htmlsc($sdir.$file),'rev'=>'','date'=>'');
 			if (preg_match('/\$'.'Id: (.+),v (\d+\.\d+) (\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2})/',$data,$matches))
 			{
-//				$comment['file'] = htmlspecialchars($sdir.$matches[1]);
-				$comment['rev'] = htmlspecialchars($matches[2]);
-				$comment['date'] = htmlspecialchars($matches[3]);
+//				$comment['file'] = htmlsc($sdir.$matches[1]);
+				$comment['rev'] = htmlsc($matches[2]);
+				$comment['date'] = htmlsc($matches[3]);
 			}
 			$comments[$sdir.$file] = $comment;
 		}
diff -ruN -x index.php wiki/plugin/vote.inc.php wiki.new/plugin/vote.inc.php
--- wiki/plugin/vote.inc.php	2007-06-04 20:33:34.000000000 +0900
+++ wiki.new/plugin/vote.inc.php	2013-07-05 03:04:46.000000000 +0900
@@ -48,9 +48,9 @@
 	if (md5(@join('', get_source($vars['refer']))) != $vars['digest']) {
 		$title = $_title_collided;
 
-		$s_refer          = htmlspecialchars($vars['refer']);
-		$s_digest         = htmlspecialchars($vars['digest']);
-		$s_postdata_input = htmlspecialchars($postdata_input);
+		$s_refer          = htmlsc($vars['refer']);
+		$s_digest         = htmlsc($vars['digest']);
+		$s_postdata_input = htmlsc($postdata_input);
 		$body = <<<EOD
 $_msg_collided
 <form action="$script?cmd=preview" method="post">
@@ -95,8 +95,8 @@
 	}
 
 	$args     = func_get_args();
-	$s_page   = htmlspecialchars($page);
-	$s_digest = htmlspecialchars($digest);
+	$s_page   = htmlsc($page);
+	$s_digest = htmlsc($digest);
 
 	$body = <<<EOD
 <form action="$_script" method="post">
diff -ruN -x index.php wiki/plugin/yetlist.inc.php wiki.new/plugin/yetlist.inc.php
--- wiki/plugin/yetlist.inc.php	2007-06-04 20:33:33.000000000 +0900
+++ wiki.new/plugin/yetlist.inc.php	2013-07-05 03:05:30.000000000 +0900
@@ -44,12 +44,12 @@
 			foreach ($refer as $_refer) {
 				$r_refer = rawurlencode($_refer);
 				$link_refs[] = '<a href="' . $script . '?' . $r_refer . '">' .
-					htmlspecialchars($_refer) . '</a>';
+					htmlsc($_refer) . '</a>';
 			}
 			$link_ref = join(' ', $link_refs);
 			unset($link_refs);
 
-			$s_page = htmlspecialchars($page);
+			$s_page = htmlsc($page);
 			if (PKWK_READONLY) {
 				$href = $s_page;
 			} else {
diff -ruN -x index.php wiki/skin/tdiary.skin.php wiki.new/skin/tdiary.skin.php
--- wiki/skin/tdiary.skin.php	2007-06-04 20:32:47.000000000 +0900
+++ wiki.new/skin/tdiary.skin.php	2013-07-05 03:03:17.000000000 +0900
@@ -56,7 +56,7 @@
 	$theme_css = SKIN_DIR . 'theme/' . $theme . '/' . $theme . '.css';
 	if (! file_exists($theme_css)) {
 		echo 'tDiary theme wrapper: ';
-		echo 'Theme not found: ' . htmlspecialchars($theme_css) . '<br />';
+		echo 'Theme not found: ' . htmlsc($theme_css) . '<br />';
 		echo 'You can get tdiary-theme from: ';
 		echo 'http://sourceforge.net/projects/tdiary/';
 		exit;
@@ -589,7 +589,7 @@
 
 <?php echo $head_tag ?>
 </head>
-<body><!-- Theme:<?php echo htmlspecialchars($theme) . ' Sidebar:' . $sidebar ?> -->
+<body><!-- Theme:<?php echo htmlsc($theme) . ' Sidebar:' . $sidebar ?> -->
 
 <?php if ($menu && $sidebar == 'strict') { ?>
 <!-- Sidebar top -->
@@ -701,7 +701,7 @@
 $title = '';
 if ($disable_backlink) {
 	if ($_page != '') {
-		$title = htmlspecialchars($_page);
+		$title = htmlsc($_page);
 	} else {
 		$title = $page; // Search, or something message
 	}
@@ -709,7 +709,7 @@
 	if ($page != '') {
 		$title = $page;
 	} else {
-		$title =  htmlspecialchars($_page);
+		$title =  htmlsc($_page);
 	}
 }
 $title_date = $title_text = '';
