OSDN Git Service

quote array key. (notice)
[pukiwiki/pukiwiki.git] / pukiwiki.php
1 <?php
2 // pukiwiki.php - Yet another WikiWikiWeb clone.
3 //
4 // PukiWiki 1.4.* 
5 //  Copyright (C) 2002 by PukiWiki Developers Team
6 //  http://pukiwiki.org/
7 //
8 // PukiWiki 1.3.* 
9 //  Copyright (C) 2002 by PukiWiki Developers Team
10 //  http://pukiwiki.org/
11 //
12 // PukiWiki 1.3 (Base)
13 //  Copyright (C) 2001,2002 by sng.
14 //  <sng@factage.com>
15 //  http://factage.com/sng/pukiwiki/
16 //
17 // Special thanks
18 //  YukiWiki by Hiroshi Yuki
19 //  <hyuki@hyuki.com>
20 //  http://www.hyuki.com/yukiwiki/
21 //
22 // This program is free software; you can redistribute it and/or modify
23 // it under the terms of the GNU General Public License as published by
24 // the Free Software Foundation; either version 2 of the License, or
25 // (at your option) any later version.
26 //
27 // This program is distributed in the hope that it will be useful,
28 // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30 // GNU General Public License for more details.
31 //
32 // $Id: pukiwiki.php,v 1.19 2003/02/15 13:25:15 panda Exp $
33 /////////////////////////////////////////////////
34
35
36 /////////////////////////////////////////////////
37 // ¥×¥í¥°¥é¥à¥Õ¥¡¥¤¥ëÆɤ߹þ¤ß
38 require('func.php');
39 require('file.php');
40 require('plugin.php');
41 require('html.php');
42 require('backup.php');
43
44 require('convert_html.php');
45 require('make_link.php');
46 require('diff.php');
47
48 /////////////////////////////////////////////////
49 // ¥×¥í¥°¥é¥à¥Õ¥¡¥¤¥ëÆɤ߹þ¤ß
50 require('init.php');
51
52 if (defined('LINK_DB')) {
53         require(LINK_DB.'.php');
54 }
55
56 /////////////////////////////////////////////////
57 // ¥á¥¤¥ó½èÍý
58
59 $base = $defaultpage;
60 $retvars = array();
61
62 // Plug-in action
63 if (!empty($vars['plugin'])) {
64         if (!exist_plugin_action($vars['plugin'])) {
65                 $msg = "plugin={$vars['plugin']} is not implemented.";
66                 $retvars = array('msg'=>$msg,'body'=>$msg);
67         }
68         else {
69                 $retvars = do_plugin_action($vars['plugin']);
70                 $base = array_key_exists('refer',$vars) ? $vars['refer'] : '';
71         }
72 }
73 // Command action
74 else if (!empty($vars['cmd'])) {
75         if (!exist_plugin_action($vars['cmd'])) {
76                 $msg = "cmd={$vars['cmd']} is not implemented.";
77                 $retvars = array('msg'=>$msg,'body'=>$msg);
78         }
79         else {
80                 $retvars = do_plugin_action($vars['cmd']);
81                 $base = $vars['page'];
82         }
83 }
84
85 $title = htmlspecialchars(strip_bracket($base));
86 $page = make_search($base);
87
88 if (array_key_exists('msg',$retvars) and $retvars['msg'] != '') {
89         $title = str_replace('$1',$title,$retvars['msg']);
90         $page = str_replace('$1',$page,$retvars['msg']);
91 }
92
93 if (array_key_exists('body',$retvars) and $retvars['body'] != '') {
94         $body = $retvars['body'];
95 }
96 else {
97         if ($base == '' or !is_page($base)) {
98                 $base = $defaultpage;
99                 $title = htmlspecialchars(strip_bracket($base));
100                 $page = make_search($base);
101         }
102         
103         $vars['cmd'] = 'read';
104         $vars['page'] = $base;
105         $body = convert_html(get_source($base));
106 }
107
108 // ** ½ÐÎϽèÍý **
109 catbody($title,$page,$body);
110
111 // ** ½ªÎ» **
112 ?>