--- lib/convert_html.php	2010-02-11 05:40:38.000000000 +0900
+++ lib/convert_html.php	2010-02-11 06:02:50.000000000 +0900
@@ -2,25 +2,79 @@
 /////////////////////////////////////////////////
 // PukiWiki - Yet another WikiWikiWeb clone.
 //
-// $Id: convert_html.php,v 1.1 2004/08/01 01:54:35 henoheno Exp $
+// $Id: convert_html.php,v 1.62 2004/03/18 09:52:52 arino Exp $
 //
 
+  // PHP5 mod: $this cannot be reassigned
+function &Factory_Inline($text)
+{
+	if (substr($text,0,1) == '~') // ¹ÔÆ¬~¡£¥Ñ¥é¥°¥é¥Õ³«»Ï
+	{
+		return new Paragraph(' '.substr($text,1));
+	}
+	return new Inline($text);
+}
+
+  // PHP5 mod: $this cannot be reassigned
+function &Factory_DList(&$root, $text)
+{
+	$out = explode('|', ltrim($text), 2);
+	if (count($out) < 2)
+	{
+		return Factory_Inline($text);
+	}
+
+	return new DList($out);
+}
+
+  // PHP5 mod: $this cannot be reassigned
+function &Factory_Table(&$root, $text)
+{
+	if (!preg_match("/^\|(.+)\|([hHfFcC]?)$/",$text,$out))
+	{
+		return Factory_Inline($text);
+	}
+	return new Table($out);
+}
+
+  // PHP5 mod: $this cannot be reassigned
+function &Factory_YTable(&$root,$text)
+{
+	$_value = csv_explode(',', substr($text,1));
+	if (count($_value) == 0)
+	{
+		return Factory_Inline($text);
+	}
+	return new YTable($_value);
+}
+
+  // PHP5 mod: $this cannot be reassigned
+function &Factory_Div(&$root,$text)
+{
+	if (!preg_match("/^\#([^\(]+)(?:\((.*)\))?/", $text, $out) or !exist_plugin_convert($out[1]))
+	{
+		return new Paragraph($text);
+	}
+	return new Div($out);
+}
+
+
 function convert_html($lines)
 {
-	global $vars, $digest;
+	global $script, $vars, $digest;
 	static $contents_id = 0;
-
+	
 	if (!is_array($lines))
 	{
 		$lines = explode("\n", $lines);
 	}
-
+	
 	$digest = md5(join('', get_source($vars['page'])));
-
+	
 	$body = &new Body(++$contents_id);
 	$body->parse($lines);
 	$ret = $body->toString();
-
+	
 	return $ret;
 }
 
@@ -29,45 +83,40 @@
 	var $parent;   // ¿ÆÍ×ÁÇ
 	var $last;     // ¼¡¤ËÍ×ÁÇ¤òÁÞÆþ¤¹¤ëÀè
 	var $elements; // Í×ÁÇ¤ÎÇÛÎó
-
+	
 	function Element()
 	{
 		$this->elements = array();
 		$this->last = &$this;
 	}
-
 	function setParent(&$parent)
 	{
 		$this->parent = &$parent;
 	}
-
 	function &add(&$obj)
 	{
 		if ($this->canContain($obj))
 		{
 			return $this->insert($obj);
 		}
-
+		
 		return $this->parent->add($obj);
 	}
-
 	function &insert(&$obj)
 	{
 		$obj->setParent($this);
 		$this->elements[] = &$obj;
-
+		
 		return $this->last = &$obj->last;
 	}
 	function canContain($obj)
 	{
 		return TRUE;
 	}
-
 	function wrap($string, $tag, $param = '', $canomit = TRUE)
 	{
 		return ($canomit and $string == '') ? '' : "<$tag$param>$string</$tag>";
 	}
-
 	function toString()
 	{
 		$ret = array();
@@ -75,63 +124,49 @@
 		{
 			$ret[] = $this->elements[$key]->toString();
 		}
-
+		
 		return join("\n",$ret);
 	}
-
 	function dump($indent = 0)
 	{
 		$ret = str_repeat(' ', $indent).get_class($this)."\n";
-
+		
 		$indent += 2;
-
+		
 		foreach (array_keys($this->elements) as $key)
 		{
 			$ret .= is_object($this->elements[$key]) ?
 				$this->elements[$key]->dump($indent) : '';
 				//str_repeat(' ',$indent).$this->elements[$key];
 		}
-
+		
 		return $ret;
 	}
 }
-
 class Inline extends Element
 { // ¥¤¥ó¥é¥¤¥óÍ×ÁÇ
-
 	function Inline($text)
 	{
 		parent::Element();
-
-		if (substr($text,0,1) == '~') // ¹ÔÆ¬~¡£¥Ñ¥é¥°¥é¥Õ³«»Ï
-		{
-			$this = new Paragraph(' '.substr($text,1));
-			$this->last = &$this;
-
-			return;
-		}
+		
 		$this->elements[] = trim((substr($text, 0, 1) == "\n") ? $text : make_link($text));
 	}
-
 	function &insert(&$obj)
 	{
 		$this->elements[] = $obj->elements[0];
-
+		
 		return $this;
 	}
-
 	function canContain($obj)
 	{
 		return is_a($obj,'Inline');
 	}
-
 	function toString()
 	{
 		global $line_break;
-
+		
 		return join($line_break ? "<br />\n" : "\n",$this->elements);
 	}
-
 	function &toPara($class = '')
 	{
 		$obj = &new Paragraph('', $class);
@@ -139,15 +174,14 @@
 		return $obj;
 	}
 }
-
 class Paragraph extends Element
 { // ÃÊÍî
 	var $param;
-
+	
 	function Paragraph($text, $param = '')
 	{
 		parent::Element();
-
+		
 		$this->param = $param;
 		if ($text == '')
 		{
@@ -157,14 +191,12 @@
 		{
 			$text = ' '.substr($text, 1);
 		}
-		$this->insert(new Inline($text));
+		$this->insert(Factory_Inline($text));
 	}
-
 	function canContain($obj)
 	{
 		return is_a($obj,'Inline');
 	}
-
 	function toString()
 	{
 		return $this->wrap(parent::toString(), 'p', $this->param);
@@ -176,55 +208,47 @@
 	var $level;
 	var $id;
 	var $msg_top;
-
+	
 	function Heading(&$root, $text)
 	{
 		parent::Element();
-
+		
 		$this->level = min(3, strspn($text, '*'));
 		list($text, $this->msg_top, $this->id) = $root->getAnchor($text, $this->level);
-		$this->insert(new Inline($text));
+		$this->insert(Factory_Inline($text));
 		$this->level++; // h2,h3,h4
 	}
-
 	function &insert(&$obj)
 	{
 		parent::insert($obj);
 		return $this->last = &$this;
 	}
-
 	function canContain(&$obj)
 	{
 		return FALSE;
 	}
-
 	function toString()
 	{
 		return $this->msg_top.$this->wrap(parent::toString(), 'h'.$this->level, " id=\"{$this->id}\"");
 	}
 }
-
 class HRule extends Element
 { // ----
-
 	function HRule(&$root, $text)
 	{
 		parent::Element();
 	}
-
 	function canContain(&$obj)
 	{
 		return FALSE;
 	}
-
 	function toString()
 	{
 		global $hr;
-
+		
 		return $hr;
 	}
 }
-
 class ListContainer extends Element
 {
 	var $tag;
@@ -233,43 +257,42 @@
 	var $style;
 	var $margin;
 	var $left_margin;
-
+	
 	function ListContainer($tag, $tag2, $head, $text)
 	{
 		parent::Element();
-
+		
 		//¥Þ¡¼¥¸¥ó¤ò¼èÆÀ
 		$var_margin = "_{$tag}_margin";
 		$var_left_margin = "_{$tag}_left_margin";
 		global $$var_margin, $$var_left_margin;
 		$this->margin = $$var_margin;
 		$this->left_margin = $$var_left_margin;
-
+		
 		//½é´ü²½
 		$this->tag = $tag;
 		$this->tag2 = $tag2;
 		$this->level = min(3, strspn($text, $head));
 		$text = ltrim(substr($text, $this->level));
-
+		
 		parent::insert(new ListElement($this->level, $tag2));
 		if ($text != '')
 		{
-			$this->last = &$this->last->insert(new Inline($text));
+			$this->last = &$this->last->insert(Factory_Inline($text));
 		}
 	}
-
+	
 	function canContain(&$obj)
 	{
 		return (!is_a($obj, 'ListContainer')
 			or ($this->tag == $obj->tag and $this->level == $obj->level));
 	}
-
 	function setParent(&$parent)
 	{
 		global $_list_pad_str;
-
+		
 		parent::setParent($parent);
-
+		
 		$step = $this->level;
 		if (isset($parent->parent) and is_a($parent->parent, 'ListContainer'))
 		{
@@ -282,7 +305,6 @@
 		}
 		$this->style = sprintf($_list_pad_str, $this->level, $margin, $margin);
 	}
-
 	function &insert(&$obj)
 	{
 		if (!is_a($obj, get_class($this)))
@@ -290,7 +312,7 @@
 			return $this->last = &$this->last->insert($obj);
 		}
         // ¹ÔÆ¬Ê¸»ú¤Î¤ß¤Î»ØÄê»þ¤ÏUL/OL¥Ö¥í¥Ã¥¯¤òÃ¦½Ð
-        // BugTrack/524
+        // BugTrack/524 
 		if (count($obj->elements) == 1 && count($obj->elements[0]->elements) == 0)
 		{
 			return $this->last->parent; // up to ListElement.
@@ -300,16 +322,14 @@
 		{
 			parent::insert($obj->elements[$key]);
 		}
-
+		
 		return $this->last;
 	}
-
 	function toString()
 	{
 		return $this->wrap(parent::toString(), $this->tag, $this->style);
 	}
 }
-
 class ListElement extends Element
 {
 	function ListElement($level, $head)
@@ -318,18 +338,15 @@
 		$this->level = $level;
 		$this->head = $head;
 	}
-
 	function canContain(&$obj)
 	{
 		return (!is_a($obj, 'ListContainer') or ($obj->level > $this->level));
 	}
-
 	function toString()
 	{
 		return $this->wrap(parent::toString(), $this->head);
 	}
 }
-
 class UList extends ListContainer
 { // -
 	function UList(&$root, $text)
@@ -337,7 +354,6 @@
 		parent::ListContainer('ul', 'li', '-', $text);
 	}
 }
-
 class OList extends ListContainer
 { // +
 	function OList(&$root, $text)
@@ -345,41 +361,31 @@
 		parent::ListContainer('ol', 'li', '+', $text);
 	}
 }
-
 class DList extends ListContainer
 { // :
-	function DList(&$root, $text)
+	function DList($out)
 	{
-		$out = explode('|', $text, 2);
-		if (count($out) < 2)
-		{
-			$this = new Inline($text);
-			$this->last = &$this;
-
-			return;
-		}
 		parent::ListContainer('dl', 'dt', ':', $out[0]);
-
+		
 		$this->last = &Element::insert(new ListElement($this->level, 'dd'));
 		if ($out[1] != '')
 		{
-			$this->last = &$this->last->insert(new Inline($out[1]));
+			$this->last = &$this->last->insert(Factory_Inline($out[1]));
 		}
 	}
 }
-
 class BQuote extends Element
 { // >
 	var $level;
-
+	
 	function BQuote(&$root, $text)
 	{
 		parent::Element();
-
+		
 		$head = substr($text, 0, 1);
 		$this->level = min(3, strspn($text, $head));
 		$text = ltrim(substr($text, $this->level));
-
+		
 		if ($head == '<') //blockquote close
 		{
 			$level = $this->level;
@@ -387,20 +393,18 @@
 			$this->last = &$this->end($root, $level);
 			if ($text != '')
 			{
-				$this->last = &$this->last->insert(new Inline($text));
+				$this->last = &$this->last->insert(Factory_Inline($text));
 			}
 		}
 		else
 		{
-			$this->insert(new Inline($text));
+			$this->insert(Factory_Inline($text));
 		}
 	}
-
 	function canContain(&$obj)
 	{
 		return (!is_a($obj, get_class($this)) or $obj->level >= $this->level);
 	}
-
 	function &insert(&$obj)
 	{
         // BugTrack/521, BugTrack/545
@@ -417,16 +421,14 @@
 		}
 		return parent::insert($obj);
 	}
-
 	function toString()
 	{
 		return $this->wrap(parent::toString(), 'blockquote');
 	}
-
 	function &end(&$root, $level)
 	{
 		$parent = &$root->last;
-
+		
 		while (is_object($parent))
 		{
 			if (is_a($parent,'BQuote') and $parent->level == $level)
@@ -438,19 +440,18 @@
 		return $this;
 	}
 }
-
 class TableCell extends Element
 {
 	var $tag = 'td'; // {td|th}
 	var $colspan = 1;
 	var $rowspan = 1;
 	var $style; // is array('width'=>, 'align'=>...);
-
+	
 	function TableCell($text, $is_template = FALSE)
 	{
 		parent::Element();
-		$this->style = $matches = array();
-
+		$this->style = array();
+		
 		while (preg_match('/^(?:(LEFT|CENTER|RIGHT)|(BG)?COLOR\(([#\w]+)\)|SIZE\((\d+)\)):(.*)$/',$text,$matches))
 		{
 			if ($matches[1])
@@ -490,7 +491,7 @@
 		if ($text != '' and $text{0} == '#')
 		{
 			// ¥»¥ëÆâÍÆ¤¬'#'¤Ç»Ï¤Þ¤ë¤È¤­¤ÏDiv¥¯¥é¥¹¤òÄÌ¤·¤Æ¤ß¤ë
-			$obj = &new Div($this, $text);
+			$obj = &Factory_Div($this, $text);
 			if (is_a($obj, 'Paragraph'))
 			{
 				$obj = &$obj->elements[0];
@@ -498,11 +499,10 @@
 		}
 		else
 		{
-			$obj = &new Inline($text);
+			$obj = &Factory_Inline($text);
 		}
 		$this->insert($obj);
 	}
-
 	function setStyle(&$style)
 	{
 		foreach ($style as $key=>$value)
@@ -513,7 +513,6 @@
 			}
 		}
 	}
-
 	function toString()
 	{
 		if ($this->rowspan == 0 or $this->colspan == 0)
@@ -534,29 +533,20 @@
 		{
 			$param .= ' style="'.join(' ', $this->style).'"';
 		}
-
+		
 		return $this->wrap(parent::toString(), $this->tag, $param, FALSE);
 	}
 }
-
 class Table extends Element
 { // |
 	var $type;
 	var $types;
 	var $col; // number of column
-
-	function Table(&$root, $text)
+	
+	function Table($out)
 	{
 		parent::Element();
-
-		$out = array();
-		if (!preg_match("/^\|(.+)\|([hHfFcC]?)$/", $text, $out))
-		{
-			$this = new Inline($text);
-			$this->last = &$this;
-
-			return;
-		}
+		
 		$cells = explode('|', $out[1]);
 		$this->col = count($cells);
 		$this->type = strtolower($out[2]);
@@ -569,24 +559,21 @@
 		}
 		$this->elements[] = $row;
 	}
-
 	function canContain(&$obj)
 	{
 		return is_a($obj, 'Table') and ($obj->col == $this->col);
 	}
-
 	function &insert(&$obj)
 	{
 		$this->elements[] = $obj->elements[0];
 		$this->types[] = $obj->type;
-
+		
 		return $this;
 	}
-
 	function toString()
 	{
 		static $parts = array('h'=>'thead', 'f'=>'tfoot', ''=>'tbody');
-
+		
 		// rowspan¤òÀßÄê(²¼¤«¤é¾å¤Ø)
 		for ($ncol = 0; $ncol < $this->col; $ncol++)
 		{
@@ -661,24 +648,16 @@
 		return $this->wrap($string, 'div', ' class="ie5"');
 	}
 }
-
 class YTable extends Element
 { // ,
 	var $col;
-
-	function YTable(&$root, $text)
+	
+	function YTable($_value)
 	{
 		parent::Element();
-
-		$_value = csv_explode(',', substr($text,1));
-		if (count($_value) == 0)
-		{
-			$this = new Inline($text);
-			$this->last = &$this;
-
-			return;
-		}
-		$align = $value = $matches = array();
+		
+		$align = array();
+		$value = array();
 		foreach($_value as $val)
 		{
 			if (preg_match('/^(\s+)?(.+?)(\s+)?$/', $val, $matches))
@@ -716,19 +695,16 @@
 		}
 		$this->elements[] = $str;
 	}
-
 	function canContain(&$obj)
 	{
 		return is_a($obj, 'YTable') and ($obj->col == $this->col);
 	}
-
 	function &insert(&$obj)
 	{
 		$this->elements[] = $obj->elements[0];
-
+		
 		return $this;
 	}
-
 	function toString()
 	{
 		$rows = '';
@@ -740,89 +716,71 @@
 		return $this->wrap($rows, 'div', ' class="ie5"');
 	}
 }
-
 class Pre extends Element
 { // ' '
 	function Pre(&$root,$text)
 	{
 		global $preformat_ltrim;
-
+		
 		parent::Element();
 		$this->elements[] = htmlspecialchars(
 			(!$preformat_ltrim or $text == '' or $text{0} != ' ') ? $text : substr($text, 1)
 		);
 	}
-
 	function canContain(&$obj)
 	{
 		return is_a($obj, 'Pre');
 	}
-
 	function &insert(&$obj)
 	{
 		$this->elements[] = $obj->elements[0];
-
+		
 		return $this;
 	}
-
 	function toString()
 	{
 		return $this->wrap(join("\n", $this->elements), 'pre');
 	}
 }
-
 class Div extends Element
 { // #
 	var $name;
 	var $param;
-
-	function Div(&$root, $text)
+	
+	function Div($out)
 	{
 		parent::Element();
-
-		if (!preg_match("/^\#([^\(]+)(?:\((.*)\))?/", $text, $out) or !exist_plugin_convert($out[1]))
-		{
-			$this = new Paragraph($text);
-			$this->last = &$this;
-
-			return;
-		}
+		
 		list(, $this->name, $this->param) = array_pad($out,3,'');
 	}
-
 	function canContain(&$obj)
 	{
 		return FALSE;
 	}
-
 	function toString()
 	{
 		return do_plugin_convert($this->name,$this->param);
 	}
 }
-
 class Align extends Element
 { // LEFT:/CENTER:/RIGHT:
 	var $align;
-
+	
 	function Align($align)
 	{
 		parent::Element();
-
+		
 		$this->align = $align;
 	}
-
 	function canContain(&$obj)
 	{
 		return is_a($obj, 'Inline');
 	}
-
 	function toString()
 	{
 		return $this->wrap(parent::toString(), 'div', ' style="text-align:'.$this->align.'"');
 	}
 }
-
 class Body extends Element
 { // Body
 	var $id;
@@ -832,14 +790,16 @@
 	var $classes = array(
 		'-' => 'UList',
 		'+' => 'OList',
+		'>' => 'BQuote',
+		'<' => 'BQuote'
+	);
+	var $factories = array(
 		':' => 'DList',
 		'|' => 'Table',
 		',' => 'YTable',
-		'>' => 'BQuote',
-		'<' => 'BQuote',
 		'#' => 'Div'
 	);
-
+	
 	function Body($id)
 	{
 		$this->id = $id;
@@ -847,20 +807,20 @@
 		$this->contents_last = &$this->contents;
 		parent::Element();
 	}
-
 	function parse(&$lines)
 	{
 		$this->last = &$this;
-
+		
 		while (count($lines))
 		{
 			$line = array_shift($lines);
-
+			
 			if (substr($line,0,2) == '//') //¥³¥á¥ó¥È¤Ï½èÍý¤·¤Ê¤¤
 			{
 				continue;
 			}
-
+			
+			$align = '';
 			if (preg_match('/^(LEFT|CENTER|RIGHT):(.*)$/',$line,$matches))
 			{
 				$this->last = &$this->last->add(new Align(strtolower($matches[1]))); // <div style="text-align:...">
@@ -870,9 +830,9 @@
 				}
 				$line = $matches[2];
 			}
-
+			
 			$line = preg_replace("/[\r\n]*$/",'',$line);
-
+			
 			// Empty
 			if ($line == '')
 			{
@@ -887,7 +847,7 @@
 			}
 			// ¹ÔÆ¬Ê¸»ú
 			$head = $line{0};
-
+			
 			// Heading
 			if ($head == '*')
 			{
@@ -912,26 +872,24 @@
 				$this->last = &$this->last->add(new $classname($this,$line));
 				continue;
 			}
-
+			
 			// Default
-			$this->last = &$this->last->add(new Inline($line));
+			$this->last = &$this->last->add(Factory_Inline($line));
 		}
 	}
-
 	function getAnchor($text,$level)
 	{
 		global $top,$_symbol_anchor;
-
+		
 		$anchor = (($id = make_heading($text,FALSE)) == '') ?
 			'' : " &aname($id,super,full)\{$_symbol_anchor};";
 		$text = ' '.$text;
 		$id = "content_{$this->id}_{$this->count}";
 		$this->count++;
 		$this->contents_last = &$this->contents_last->add(new Contents_UList($text,$level,$id));
-
+		
 		return array($text. $anchor, $this->count > 1 ? "\n$top" : '', $id);
 	}
-
 	function &insert(&$obj)
 	{
 		if (is_a($obj, 'Inline'))
@@ -940,23 +898,21 @@
 		}
 		return parent::insert($obj);
 	}
-
 	function toString()
 	{
 		global $vars;
-
+		
 		$text = parent::toString();
-
+		
 		// #contents
 		$text = preg_replace_callback('/(<p[^>]*>)<del>#contents<\/del>(\s*)(<\/p>)/', array(&$this,'replace_contents'),$text);
-
+		
 		// ´ØÏ¢¤¹¤ë¥Ú¡¼¥¸
 		// <p>¤Î¤È¤­¤Ï¹ÔÆ¬¤«¤é¡¢<del>¤Î¤È¤­¤ÏÂ¾¤ÎÍ×ÁÇ¤Î»ÒÍ×ÁÇ¤È¤·¤ÆÂ¸ºß
 		$text = preg_replace_callback('/(<p[^>]*>)<del>#related<\/del>(\s*)(<\/p>)/', array(&$this, 'replace_related'), $text);
 		$text = preg_replace('/<del>#related<\/del>/',make_related($vars['page'],'del'),$text);
 		return "$text\n";
 	}
-
 	function replace_contents($arr)
 	{
 		$contents  = "<div class=\"contents\">\n";
@@ -964,25 +920,23 @@
 		$contents .= $this->contents->toString();
 		$contents .= "</div>\n";
 		array_shift($arr);
-
+		
 		return ($arr[1] != '') ? $contents.join('',$arr) : $contents;
 	}
-
 	function replace_related($arr)
 	{
 		global $vars;
 		static $related = NULL;
-
+		
 		if (is_null($related))
 		{
 			$related = make_related($vars['page'],'p');
 		}
 		array_shift($arr);
-
+		
 		return ($arr[1] != '') ? $related.join('',$arr) : $related;
 	}
 }
-
 class Contents_UList extends ListContainer
 {
 	function Contents_UList($text,$level,$id)
@@ -992,13 +946,12 @@
 		make_heading($text);
 		$text = "\n<a href=\"#$id\">$text</a>\n";
 		parent::ListContainer('ul', 'li', '-', str_repeat('-',$level));
-		$this->insert(new Inline($text));
+		$this->insert(Factory_Inline($text));
 	}
-
 	function setParent(&$parent)
 	{
 		global $_list_pad_str;
-
+		
 		parent::setParent($parent);
 		$step = $this->level;
 		$margin = $this->left_margin;

--- lib/make_link.php	2010-02-11 06:05:01.000000000 +0900
+++ lib/make_link.php	2010-02-11 06:06:47.000000000 +0900
@@ -2,7 +2,7 @@
 /////////////////////////////////////////////////
 // PukiWiki - Yet another WikiWikiWeb clone.
 //
-// $Id: make_link.php,v 1.1 2004/08/01 01:54:35 henoheno Exp $
+// $Id: make_link.php,v 1.64 2003/11/22 04:50:26 arino Exp $
 //
 
 // ¥ê¥ó¥¯¤òÉÕ²Ã¤¹¤ë
@@ -10,12 +10,14 @@
 {
 	global $vars;
 	static $converter;
-
+	
 	if (!isset($converter))
 	{
 		$converter = new InlineConverter();
 	}
-	$_converter = $converter; // copy
+	//$_converter = $converter; // copy [reenable this line for php4, and comment line below]
+	  // PHP5 mod: object copy
+	$_converter = clone $converter;
 	return $_converter->convert($string, ($page != '') ? $page : $vars['page']);
 }
 //¥¤¥ó¥é¥¤¥óÍ×ÁÇ¤òÃÖ´¹¤¹¤ë
@@ -26,13 +28,21 @@
 	var $pos;
 	var $result;
 
+	function __clone() {
+		$converters = array();
+		foreach ($this->converters as $key=>$converter) {
+			$converters[$key] = clone $converter;
+		}
+		$this->converters = $converters;
+	}
+	
 	function InlineConverter($converters=NULL,$excludes=NULL)
 	{
 		if ($converters === NULL)
 		{
 			$converters = array(
 				'plugin',        // ¥¤¥ó¥é¥¤¥ó¥×¥é¥°¥¤¥ó
-				'note',          // Ãí¼á
+				'note',          // Ãí¼á 
 				'url',           // URL
 				'url_interwiki', // URL (interwiki definition)
 				'mailto',        // mailto:
@@ -50,7 +60,7 @@
 		$this->converters = array();
 		$patterns = array();
 		$start = 1;
-
+		
 		foreach ($converters as $name)
 		{
 			$classname = "Link_$name";
@@ -71,9 +81,9 @@
 	{
 		$this->page = $page;
 		$this->result = array();
-
+		
 		$string = preg_replace_callback("/{$this->pattern}/x",array(&$this,'replace'),$string);
-
+		
 		$arr = explode("\x08",make_line_rules(htmlspecialchars($string)));
 		$retval = '';
 		while (count($arr))
@@ -85,23 +95,30 @@
 	function replace($arr)
 	{
 		$obj = $this->get_converter($arr);
-
+		
 		$this->result[] = ($obj !== NULL and $obj->set($arr,$this->page) !== FALSE) ?
 			$obj->toString() : make_line_rules(htmlspecialchars($arr[0]));
-
+		
 		return "\x08"; //½èÍýºÑ¤ß¤ÎÉôÊ¬¤Ë¥Þ¡¼¥¯¤òÆþ¤ì¤ë
 	}
 	function get_objects($string,$page)
 	{
 		preg_match_all("/{$this->pattern}/x",$string,$matches,PREG_SET_ORDER);
-
+		
 		$arr = array();
 		foreach ($matches as $match)
 		{
 			$obj = $this->get_converter($match);
 			if ($obj->set($match,$page) !== FALSE)
 			{
-				$arr[] = $obj; // copy
+				  // PHP5 mod: object copy
+				$arr[] = clone $obj;
+				  // replace above line with the 4 following ones when using lower than PHP5
+				//$classname = get_class($obj);
+				//$obj = new $classname($obj->start);
+				//$obj->set($match,$page);
+				//$arr[] = $obj;
+
 				if ($obj->body != '')
 				{
 					$arr = array_merge($arr,$this->get_objects($obj->body,$page));
@@ -155,7 +172,7 @@
 	function toString()
 	{
 	}
-
+	
 	//private
 	// ¥Þ¥Ã¥Á¤·¤¿ÇÛÎó¤«¤é¡¢¼«Ê¬¤ËÉ¬Í×¤ÊÉôÊ¬¤À¤±¤ò¼è¤ê½Ð¤¹
 	function splice($arr)
@@ -169,7 +186,7 @@
 	function setParam($page,$name,$body,$type='',$alias='')
 	{
 		static $converter = NULL;
-
+		
 		$this->page = $page;
 		$this->name = $name;
 		$this->body = $body;
@@ -188,7 +205,7 @@
 			$alias = make_line_rules($converter->convert($alias,$page));
 		}
 		$this->alias = $alias;
-
+		
 		return TRUE;
 	}
 }
@@ -197,7 +214,7 @@
 {
 	var $pattern;
 	var $plain,$param;
-
+	
 	function Link_plugin($start)
 	{
 		parent::Link($start);
@@ -232,8 +249,11 @@
 	function set($arr,$page)
 	{
 		list($all,$this->plain,$name,$this->param,$body) = $this->splice($arr);
-
+		
 		// ËÜÍè¤Î¥×¥é¥°¥¤¥óÌ¾¤ª¤è¤Ó¥Ñ¥é¥á¡¼¥¿¤ò¼èÆÀ¤·¤Ê¤ª¤¹ PHP4.1.2 (?R)ÂÐºö
+		if (!isset($this->pattern)) {
+			$this->get_pattern();
+		}
 		if (preg_match("/^{$this->pattern}/x",$all,$matches)
 			and $matches[1] != $this->plain)
 		{
@@ -244,7 +264,7 @@
 	function toString()
 	{
 		$body = ($this->body == '') ? '' : make_link($this->body);
-
+		
 		// ¥×¥é¥°¥¤¥ó¸Æ¤Ó½Ð¤·
 		if (exist_plugin_inline($this->name))
 		{
@@ -254,7 +274,7 @@
 				return $str;
 			}
 		}
-
+		
 		// ¥×¥é¥°¥¤¥ó¤¬Â¸ºß¤·¤Ê¤¤¤«¡¢ÊÑ´¹¤Ë¼ºÇÔ
 		$body = ($body == '') ? ';' : "\{$body};";
 		return make_line_rules(htmlspecialchars('&'.$this->plain).$body);
@@ -283,19 +303,19 @@
 	{
 		global $foot_explain;
 		static $note_id = 0;
-
+		
 		list(,$body) = $this->splice($arr);
-
+		
 		$id = ++$note_id;
 		$note = make_link($body);
-
+		
 		$foot_explain[$id] = <<<EOD
 <a id="notefoot_$id" href="#notetext_$id" class="note_super">*$id</a>
 <span class="small">$note</span>
 <br />
 EOD;
 		$name = "<a id=\"notetext_$id\" href=\"#notefoot_$id\" class=\"note_super\">*$id</a>";
-
+		
 		return parent::setParam($page,$name,$body);
 	}
 	function toString()
@@ -375,7 +395,7 @@
 class Link_mailto extends Link
 {
 	var $is_image,$image;
-
+	
 	function Link_mailto($start)
 	{
 		parent::Link($start);
@@ -412,7 +432,7 @@
 	var $url = '';
 	var $param = '';
 	var $anchor = '';
-
+	
 	function Link_interwikiname($start)
 	{
 		parent::Link($start);
@@ -446,9 +466,9 @@
 	function set($arr,$page)
 	{
 		global $script;
-
+		
 		list(,$alias,,$name,$this->param) = $this->splice($arr);
-
+		
 		if (preg_match('/^([^#]+)(#[A-Za-z][\w-]*)$/',$this->param,$matches))
 		{
 			list(,$this->param,$this->anchor) = $matches;
@@ -457,7 +477,7 @@
 		$this->url = ($url === FALSE) ?
 			$script.'?'.rawurlencode('[['.$name.':'.$this->param.']]') :
 			htmlspecialchars($url);
-
+		
 		return parent::setParam(
 			$page,
 			htmlspecialchars($name.':'.$this->param),
@@ -475,7 +495,7 @@
 class Link_bracketname extends Link
 {
 	var $anchor,$refer;
-
+	
 	function Link_bracketname($start)
 	{
 		parent::Link($start);
@@ -483,7 +503,7 @@
 	function get_pattern()
 	{
 		global $WikiName,$BracketName;
-
+		
 		$s2 = $this->start + 2;
 		return <<<EOD
 \[\[                     # open bracket
@@ -506,9 +526,9 @@
 	function set($arr,$page)
 	{
 		global $WikiName;
-
+		
 		list(,$alias,,$name,$this->anchor) = $this->splice($arr);
-
+		
 		if ($name == '' and $this->anchor == '')
 		{
 			return FALSE;
@@ -558,7 +578,7 @@
 	function get_pattern()
 	{
 		global $WikiName,$nowikiname;
-
+		
 		return $nowikiname ? FALSE : "($WikiName)";
 	}
 	function get_count()
@@ -586,20 +606,20 @@
 	var $forceignorepages = array();
 	var $auto;
 	var $auto_a; // alphabet only
-
+	
 	function Link_autolink($start)
 	{
 		global $autolink;
-
+		
 		parent::Link($start);
-
+		
 		if (!$autolink or !file_exists(CACHE_DIR.'autolink.dat'))
 		{
 			return;
 		}
 		@list($auto,$auto_a,$forceignorepages) = file(CACHE_DIR.'autolink.dat');
 		$this->auto = $auto;
-		$this->auto_a = $auto_a;
+		$this->auto_a = $auto_a; 
 		$this->forceignorepages = explode("\t",trim($forceignorepages));
 	}
 	function get_pattern()
@@ -613,7 +633,7 @@
 	function set($arr,$page)
 	{
 		global $WikiName;
-
+		
 		list($name) = $this->splice($arr);
 		// Ìµ»ë¥ê¥¹¥È¤Ë´Þ¤Þ¤ì¤Æ¤¤¤ë¡¢¤¢¤ë¤¤¤ÏÂ¸ºß¤·¤Ê¤¤¥Ú¡¼¥¸¤ò¼Î¤Æ¤ë
 		if (in_array($name,$this->forceignorepages) or !is_page($name))
@@ -649,23 +669,23 @@
 {
 	global $script,$vars,$show_title,$show_passage,$link_compact,$related;
 	global $_symbol_noexists;
-
+	
 	$s_page = htmlspecialchars(strip_bracket($page));
 	$s_alias = ($alias == '') ? $s_page : $alias;
-
+	
 	if ($page == '')
 	{
 		return "<a href=\"$anchor\">$s_alias</a>";
 	}
-
+	
 	$r_page = rawurlencode($page);
 	$r_refer = ($refer == '') ? '' : '&amp;refer='.rawurlencode($refer);
-
+	
 	if (!array_key_exists($page,$related) and $page != $vars['page'] and is_page($page))
 	{
 		$related[$page] = get_filetime($page);
 	}
-
+	
 	if (is_page($page))
 	{
 		$passage = get_pg_passage($page,FALSE);
@@ -686,35 +706,35 @@
 function get_fullname($name,$refer)
 {
 	global $defaultpage;
-
+	
 	if ($name == '')
 	{
 		return $refer;
 	}
-
+	
 	if ($name{0} == '/')
 	{
 		$name = substr($name,1);
 		return ($name == '') ? $defaultpage : $name;
 	}
-
+	
 	if ($name == './')
 	{
 		return $refer;
 	}
-
+	
 	if (substr($name,0,2) == './')
 	{
 		$arrn = preg_split('/\//',$name,-1,PREG_SPLIT_NO_EMPTY);
 		$arrn[0] = $refer;
 		return join('/',$arrn);
 	}
-
+	
 	if (substr($name,0,3) == '../')
 	{
 		$arrn = preg_split('/\//',$name,-1,PREG_SPLIT_NO_EMPTY);
 		$arrp = preg_split('/\//',$refer,-1,PREG_SPLIT_NO_EMPTY);
-
+		
 		while (count($arrn) > 0 and $arrn[0] == '..')
 		{
 			array_shift($arrn);
@@ -732,7 +752,7 @@
 	global $WikiName,$interwiki;
 	static $interwikinames;
 	static $encode_aliases = array('sjis'=>'SJIS','euc'=>'EUC-JP','utf8'=>'UTF-8');
-
+	
 	if (!isset($interwikinames))
 	{
 		$interwikinames = array();
@@ -749,7 +769,7 @@
 		return FALSE;
 	}
 	list($url,$opt) = $interwikinames[$name];
-
+	
 	// Ê¸»ú¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°
 	switch ($opt)
 	{
@@ -761,24 +781,24 @@
 			}
 //			$param = htmlspecialchars($param);
 			break;
-
+		
 		// moin·Ï
 		case 'moin':
 			$param = str_replace('%','_',rawurlencode($param));
 			break;
-
+		
 		// ÆâÉôÊ¸»ú¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤Î¤Þ¤ÞURL¥¨¥ó¥³¡¼¥É
 		case '':
 		case 'std':
 			$param = rawurlencode($param);
 			break;
-
+		
 		// URL¥¨¥ó¥³¡¼¥É¤·¤Ê¤¤
 		case 'asis':
 		case 'raw':
 //			$param = htmlspecialchars($param);
 			break;
-
+		
 		default:
 			// ¥¨¥¤¥ê¥¢¥¹¤ÎÊÑ´¹
 			if (array_key_exists($opt,$encode_aliases))
@@ -788,7 +808,7 @@
 			// »ØÄê¤µ¤ì¤¿Ê¸»ú¥³¡¼¥É¤Ø¥¨¥ó¥³¡¼¥É¤·¤ÆURL¥¨¥ó¥³¡¼¥É
 			$param = rawurlencode(mb_convert_encoding($param,$opt,'auto'));
 	}
-
+	
 	// ¥Ñ¥é¥á¡¼¥¿¤òÃÖ´¹
 	if (strpos($url,'$1') !== FALSE)
 	{
@@ -798,7 +818,7 @@
 	{
 		$url .= $param;
 	}
-
+	
 	return $url;
 }
 ?>

--- plugin/dump.inc.php	2009-04-05 21:36:45.000000000 +0900
+++ plugin/dump.inc.php	2010-02-11 06:23:45.000000000 +0900
@@ -42,9 +42,9 @@
 // ¥×¥é¥°¥¤¥óËÜÂÎ
 function plugin_dump_action()
 {
-	global $vars;
+	global $vars, $adminpass;
 
-	if (PKWK_READONLY) die_message('PKWK_READONLY prohibits this');
+//	if (PKWK_READONLY) die_message('PKWK_READONLY prohibits this');
 
 	$pass = isset($_POST['pass']) ? $_POST['pass'] : NULL;
 	$act  = isset($vars['act'])   ? $vars['act']   : NULL;
@@ -52,7 +52,7 @@
 	$body = '';
 
 	if ($pass !== NULL) {
-		if (! pkwk_login($pass)) {
+		if (md5($pass) != $adminpass) {
 			$body = "<p><strong>¥Ñ¥¹¥ï¡¼¥É¤¬°ã¤¤¤Þ¤¹¡£</strong></p>\n";
 		} else {
 			switch($act){
@@ -194,7 +194,7 @@
 		$filename .= '.tar';
 	}
 
-	pkwk_common_headers();
+//	pkwk_common_headers();
 	header('Content-Disposition: attachment; filename="' . $filename . '"');
 	header('Content-Length: ' . $size);
 	header('Content-Type: application/octet-stream');
