2 // PukiWiki - Yet another WikiWikiWeb clone.
3 // $Id: pukiwiki.php,v 1.23 2011/01/25 15:01:01 henoheno Exp $
6 // Copyright (C) 2002-2005 by PukiWiki Developers Team
7 // http://pukiwiki.sourceforge.jp/
10 // Copyright (C) 2002-2004 by PukiWiki Developers Team
11 // http://pukiwiki.sourceforge.jp/
13 // PukiWiki 1.3 (Base)
14 // Copyright (C) 2001-2002 by yu-ji <sng@factage.com>
15 // http://factage.com/sng/pukiwiki/
18 // YukiWiki by Hiroshi Yuki <hyuki@hyuki.com>
19 // http://www.hyuki.com/yukiwiki/
21 // This program is free software; you can redistribute it and/or modify
22 // it under the terms of the GNU General Public License as published by
23 // the Free Software Foundation; either version 2 of the License, or
24 // (at your option) any later version.
26 // This program is distributed in the hope that it will be useful,
27 // but WITHOUT ANY WARRANTY; without even the implied warranty of
28 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 // GNU General Public License for more details.
31 if (! defined('DATA_HOME')) define('DATA_HOME', '');
33 /////////////////////////////////////////////////
34 // Include subroutines
36 if (! defined('LIB_DIR')) define('LIB_DIR', '');
38 require(LIB_DIR . 'func.php');
39 require(LIB_DIR . 'file.php');
40 require(LIB_DIR . 'plugin.php');
41 require(LIB_DIR . 'html.php');
42 require(LIB_DIR . 'backup.php');
44 require(LIB_DIR . 'convert_html.php');
45 require(LIB_DIR . 'make_link.php');
46 require(LIB_DIR . 'diff.php');
47 require(LIB_DIR . 'config.php');
48 require(LIB_DIR . 'link.php');
49 require(LIB_DIR . 'auth.php');
50 require(LIB_DIR . 'proxy.php');
51 if (! extension_loaded('mbstring')) {
52 require(LIB_DIR . 'mbstring.php');
58 // Load *.ini.php files and init PukiWiki
59 require(LIB_DIR . 'init.php');
61 // Load optional libraries
63 require(LIB_DIR . 'mail.php'); // Mail notification
66 /////////////////////////////////////////////////
71 if (isset($vars['cmd'])) {
73 $plugin = & $vars['cmd'];
74 } else if (isset($vars['plugin'])) {
75 $plugin = & $vars['plugin'];
80 ensure_valid_auth_user();
81 if (exist_plugin_action($plugin)) {
83 $retvars = do_plugin_action($plugin);
84 if ($retvars === FALSE) exit; // Done
87 $base = isset($vars['page']) ? $vars['page'] : '';
89 $base = isset($vars['refer']) ? $vars['refer'] : '';
93 $msg = 'plugin=' . htmlsc($plugin) .
94 ' is not implemented.';
95 $retvars = array('msg'=>$msg,'body'=>$msg);
96 $base = & $defaultpage;
100 $title = htmlsc(strip_bracket($base));
101 $page = make_search($base);
102 if (isset($retvars['msg']) && $retvars['msg'] != '') {
103 $title = str_replace('$1', $title, $retvars['msg']);
104 $page = str_replace('$1', $page, $retvars['msg']);
107 if (isset($retvars['body']) && $retvars['body'] != '') {
108 $body = & $retvars['body'];
110 if ($base == '' || ! is_page($base)) {
111 $base = & $defaultpage;
112 $title = htmlsc(strip_bracket($base));
113 $page = make_search($base);
116 $vars['cmd'] = 'read';
117 $vars['page'] = & $base;
119 $body = convert_html(get_source($base));
123 catbody($title, $page, $body);