/////////////////////////////////////////////////
// PukiWiki - Yet another WikiWikiWeb clone.
//
-// $Id: include.inc.php,v 1.12 2004/08/06 16:06:31 henoheno Exp $
+// $Id: include.inc.php,v 1.13 2004/08/09 14:47:55 henoheno Exp $
//
-// ¥Ú¡¼¥¸¤ò¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë
+define('INCLUDE_MAX', 4); // °ìÅÙ¤Ë(Ï¢º¿Åª¤Ë)¥¤¥ó¥¯¥ë¡¼¥É¤Ç¤¤ëºÇÂç¿ô
+
+// ¥Ú¡¼¥¸¤ò(ºÆµ¢)¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë
function plugin_include_convert()
{
global $script, $vars, $get, $post, $menubar, $_msg_include_restrict;
static $included = array();
+ static $count = 0;
+
+ if (func_num_args() == 0) return '#include(): No argument<br />';
// Get an argument
- if (func_num_args() == 0) return;
list($page) = func_get_args();
$page = strip_bracket($page);
+ $s_page = htmlspecialchars($page);
// Loop yourself
$self = isset($vars['page']) ? $vars['page'] : '';
$included[$self] = TRUE;
// I'm stuffed
- if (isset($included[$page]) || ! is_page($page)) return '';
+ if (isset($included[$page])) return "#include(): Already included: $s_page<br />";
+ if (! is_page($page)) return "#include(): No such page: $s_page<br />";
+ if(++$count > INCLUDE_MAX) return '#include(): Include-max reached(' . INCLUDE_MAX . ")<br />";
// One page, only one time, at a time
$included[$page] = TRUE;
$get['page'] = $post['page'] = $vars['page'] = $self;
// Add a title with edit link, before included document
- $s_page = htmlspecialchars($page);
$r_page = rawurlencode($page);
$link = "<a href=\"$script?cmd=edit&page=$r_page\">$s_page</a>";