OSDN Git Service

Remove redundat LIB_DIR
[pukiwiki/pukiwiki.git] / lib / pukiwiki.php
1 <?php
2 // PukiWiki - 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.2 2004/08/01 02:22:36 henoheno Exp $
33 /////////////////////////////////////////////////
34
35 /////////////////////////////////////////////////
36 // ¥Ç¡¼¥¿¤ò³ÊǼ¤¹¤ë¥Ç¥£¥ì¥¯¥È¥ê¤äÀßÄê¥Õ¥¡¥¤¥ë¤òÃÖ¤¯¥Ç¥£¥ì¥¯¥È¥ê
37
38 if (! defined('DATA_HOME')) define('DATA_HOME', '');
39
40 /////////////////////////////////////////////////
41 // ¥µ¥Ö¥ë¡¼¥Á¥ó¤Î³ÊǼÀè¥Ç¥£¥ì¥¯¥È¥ê (¾¤Î *.php¥Õ¥¡¥¤¥ë)
42
43 if (! defined('LIB_DIR')) define('LIB_DIR', '');
44
45 /////////////////////////////////////////////////
46 // ¥µ¥Ö¥ë¡¼¥Á¥ó¤ÎÆɤ߹þ¤ß
47
48 require('func.php');
49 require('file.php');
50 require('plugin.php');
51 require('html.php');
52 require('backup.php');
53
54 require('convert_html.php');
55 require('make_link.php');
56 require('diff.php');
57 require('config.php');
58 require('link.php');
59 require('trackback.php');
60 require('auth.php');
61 require('proxy.php');
62 require('mail.php');
63 if (!extension_loaded('mbstring')) {
64         require('mbstring.php');
65 }
66
67 // ½é´ü²½: ÀßÄê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß
68 require('init.php');
69
70 /////////////////////////////////////////////////
71 // ¥á¥¤¥ó½èÍý
72
73 $base = $defaultpage;
74 $retvars = array();
75
76 // Plug-in action
77 if (!empty($vars['plugin'])) {
78         if (!exist_plugin_action($vars['plugin'])) {
79                 $s_plugin = htmlspecialchars($vars['plugin']);
80                 $msg = "plugin=$s_plugin is not implemented.";
81                 $retvars = array('msg'=>$msg,'body'=>$msg);
82         }
83         else {
84                 $retvars = do_plugin_action($vars['plugin']);
85                 if ($retvars !== FALSE) {
86                         $base = array_key_exists('refer',$vars) ? $vars['refer'] : '';
87                 }
88         }
89 }
90 // Command action
91 else if (!empty($vars['cmd'])) {
92         if (!exist_plugin_action($vars['cmd'])) {
93                 $s_cmd = htmlspecialchars($vars['cmd']);
94                 $msg = "cmd=$s_cmd is not implemented.";
95                 $retvars = array('msg'=>$msg,'body'=>$msg);
96         }
97         else {
98                 $retvars = do_plugin_action($vars['cmd']);
99                 $base = $vars['page'];
100         }
101 }
102
103 if ($retvars !== FALSE) {
104         $title = htmlspecialchars(strip_bracket($base));
105         $page = make_search($base);
106
107         if (array_key_exists('msg',$retvars) and $retvars['msg'] != '') {
108                 $title = str_replace('$1',$title,$retvars['msg']);
109                 $page = str_replace('$1',$page,$retvars['msg']);
110         }
111
112         if (array_key_exists('body',$retvars) and $retvars['body'] != '') {
113                 $body = $retvars['body'];
114         }
115         else {
116                 if ($base == '' or !is_page($base)) {
117                         $base = $defaultpage;
118                         $title = htmlspecialchars(strip_bracket($base));
119                         $page = make_search($base);
120                 }
121
122                 $vars['cmd'] = 'read';
123                 $vars['page'] = $base;
124                 $body = convert_html(get_source($base));
125                 $body .= tb_get_rdf($vars['page']);
126                 ref_save($vars['page']);
127         }
128
129         // ** ½ÐÎϽèÍý **
130         catbody($title,$page,$body);
131 }
132 // ** ½ªÎ» **
133 ?>