2 /////////////////////////////////////////////////
3 // PukiWiki - Yet another WikiWikiWeb clone.
5 // $Id: include.inc.php,v 1.15 2004/08/10 11:38:21 henoheno Exp $
8 define('INCLUDE_MAX', 4); // °ìÅ٤˥¤¥ó¥¯¥ë¡¼¥É¤Ç¤¤ë¥Ú¡¼¥¸¤ÎºÇÂç¿ô
10 // ¥Ú¡¼¥¸¤ò(²Äǽ¤Ê¤é¤ÐºÆµ¢Åª¤Ë)¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë
11 function plugin_include_convert()
13 global $script, $vars, $get, $post, $menubar, $_msg_include_restrict;
14 static $included = array();
17 if (func_num_args() == 0) return '#include(): No argument<br />';
20 list($page) = func_get_args();
21 $page = strip_bracket($page);
22 $s_page = htmlspecialchars($page);
23 $r_page = rawurlencode($page);
24 $link = "<a href=\"$script?$r_page\">$s_page</a>"; // Read link
27 $root = isset($vars['page']) ? $vars['page'] : '';
28 $included[$root] = TRUE;
31 if (isset($included[$page])) {
32 return "#include(): Included already: $link<br />";
33 } if (! is_page($page)) {
34 return "#include(): No such page: $s_page<br />";
35 } if ($count > INCLUDE_MAX) {
36 return "#include(): Limit exceeded: $link<br />";
41 // One page, only one time, at a time
42 $included[$page] = TRUE;
44 // Include A page, that probably includes another pages
45 $get['page'] = $post['page'] = $vars['page'] = $page;
46 if (check_readable($page, false, false)) {
47 $body = convert_html(get_source($page));
49 $body = str_replace('$1', $page, $_msg_include_restrict);
51 $get['page'] = $post['page'] = $vars['page'] = $root;
53 // Add a title with edit link, before included document
54 $link = "<a href=\"$script?cmd=edit&page=$r_page\">$s_page</a>";
56 if ($page == $menubar) {
57 $body = "<span align=\"center\"><h5 class=\"side_label\">$link</h5></span>" .
58 "<small>$body</small>";
60 $body = "<h1>$link</h1>\n" .