2 /////////////////////////////////////////////////
3 // PukiWiki - Yet another WikiWikiWeb clone.
5 // $Id: include.inc.php,v 1.16 2004/08/19 11:36:08 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();
16 $usage = "#include(): Usage: (a-page-name-you-want-to-include)<br />\n";
18 if (func_num_args() == 0) return $usage;
21 list($page) = func_get_args();
22 $page = strip_bracket($page);
23 $s_page = htmlspecialchars($page);
24 $r_page = rawurlencode($page);
25 $link = "<a href=\"$script?$r_page\">$s_page</a>"; // Read link
28 $root = isset($vars['page']) ? $vars['page'] : '';
29 $included[$root] = TRUE;
32 if (isset($included[$page])) {
33 return "#include(): Included already: $link<br />\n";
34 } if (! is_page($page)) {
35 return "#include(): No such page: $s_page<br />\n";
36 } if ($count > INCLUDE_MAX) {
37 return "#include(): Limit exceeded: $link<br />\n";
42 // One page, only one time, at a time
43 $included[$page] = TRUE;
45 // Include A page, that probably includes another pages
46 $get['page'] = $post['page'] = $vars['page'] = $page;
47 if (check_readable($page, false, false)) {
48 $body = convert_html(get_source($page));
50 $body = str_replace('$1', $page, $_msg_include_restrict);
52 $get['page'] = $post['page'] = $vars['page'] = $root;
54 // Add a title with edit link, before included document
55 $link = "<a href=\"$script?cmd=edit&page=$r_page\">$s_page</a>";
57 if ($page == $menubar) {
58 $body = "<span align=\"center\"><h5 class=\"side_label\">$link</h5></span>" .
59 "<small>$body</small>";
61 $body = "<h1>$link</h1>\n" .