1 <?php $RCS_IDS[] = '$Id: main.php,v 1.1 2001-02-12 01:43:10 dairiki Exp $';
2 function rcs_id($id) { $GLOBALS['RCS_IDS'][] = $id; }
3 include "lib/config.php";
4 include "lib/stdlib.php";
5 include "lib/userauth.php";
8 function DeducePagename ()
10 global $pagename, $PATH_INFO;
13 return fix_magic_quotes_gpc($pagename);
16 if (ereg('^' . PATH_INFO_PREFIX . '(.*)$', $PATH_INFO, $m))
19 return gettext("FrontPage");
22 $pagename = DeducePagename();
26 $action = trim(fix_magic_quotes_gpc($action));
28 else if (isset($diff))
30 // Fix for compatibility with very old diff links in RecentChanges.
31 // (The [phpwiki:?diff=PageName] style links are fixed elsewhere.)
33 $pagename = fix_magic_quotes_gpc($diff);
42 function IsSafeAction ($action)
44 if (! ZIPDUMP_AUTH and $action == 'zip')
46 return in_array ( $action, array('browse',
47 'info', 'diff', 'search',
52 function get_auth_mode ($action)
60 if (IsSafeAction($action))
63 return 'REQUIRE_AUTH';
67 $user = new WikiUser(get_auth_mode($action));
69 // All requests require the database
70 $dbi = OpenDataBase($WikiPageStore);
72 // if there is no FrontPage, create a basic set of Wiki pages
73 if ( ! IsWikiPage($dbi, gettext("FrontPage")) )
75 include_once("lib/loadsave.php");
81 // FIXME: I think this is redundant.
82 if (!IsSafeAction($action))
83 $user->must_be_admin($action);
88 include "lib/editpage.php";
92 if (isset($searchtype) && ($searchtype == 'full')) {
93 include "lib/fullsearch.php";
96 include "lib/search.php";
101 include "lib/savepage.php";
104 include "lib/pageinfo.php";
107 include "lib/diff.php";
111 include_once("lib/loadsave.php");
112 MakeWikiZip($dbi, isset($include) && $include == 'all');
116 include_once("lib/loadsave.php");
117 LoadPostFile($dbi, 'file');
121 if (empty($directory))
122 ExitWiki(gettext("You must specify a directory to dump to"));
124 include_once("lib/loadsave.php");
125 DumpToDir($dbi, fix_magic_quotes_gpc($directory));
130 ExitWiki(gettext("You must specify a source to read from"));
132 include_once("lib/loadsave.php");
133 LoadFileOrDir($dbi, fix_magic_quotes_gpc($source));
137 include 'admin/removepage.php';
142 include "admin/lockpage.php";
143 include "lib/display.php";
149 include "lib/display.php"; // defaults to FrontPage
153 echo QElement('p', sprintf("Bad action: '%s'", urlencode($action)));
161 // c-file-style: "ellemtel"