1 <?php // $Id: admin.php,v 1.5.2.3 2005-01-07 14:23:04 rurban Exp $
3 function rcs_id($id) {} // otherwise this gets in the way
5 define('WIKI_ADMIN', true); // has to be before includes
6 if (!ini_get('register_globals')) {
7 extract($HTTP_SERVER_VARS);
10 include("lib/config.php");
11 include("lib/stdlib.php");
12 if (!ini_get('register_globals')) {
13 import_request_variables('gps');
16 // set these to your preferences. For heaven's sake
17 // pick a good password!
21 // Do not tolerate sloppy systems administration
22 if (empty($wikiadmin) || empty($adminpasswd)) {
23 echo "Set the administrator account and password first.\n";
27 // from the manual, Chapter 16
28 if (($PHP_AUTH_USER != $wikiadmin ) ||
29 ($PHP_AUTH_PW != $adminpasswd)) {
30 Header("WWW-Authenticate: Basic realm=\"PhpWiki\"");
31 Header("HTTP/1.0 401 Unauthorized");
32 echo gettext ("You entered an invalid login or password.");
36 // All requests require the database
37 $dbi = OpenDataBase($WikiPageStore);
39 if (isset($lock) || isset($unlock)) {
40 include ('admin/lockpage.php');
41 $QUERY_STRING = $pagename;
42 } elseif (isset($zip)) {
43 include ('lib/ziplib.php');
44 include ('admin/zip.php');
46 } elseif (isset($dumpserial)) {
47 include ('admin/dumpserial.php');
48 } elseif (isset($loadserial)) {
49 include ('admin/loadserial.php');
50 } elseif (isset($remove)) {
51 if (get_magic_quotes_gpc())
52 $remove = stripslashes($remove);
53 if (function_exists('RemovePage')) {
54 $html .= sprintf(gettext ("You are about to remove '%s' permanently!"), htmlspecialchars($remove));
56 $url = rawurlencode($remove);
57 $html .= sprintf(gettext ("Click %shere%s to remove the page now."),
58 "<A HREF=\"$ScriptUrl?removeok=$url\">", "</A>");
60 $html .= gettext ("Otherwise press the \"Back\" button of your browser.");
62 $html = gettext ("Function not yet implemented.");
64 GeneratePage('MESSAGE', $html, gettext ("Remove page"), 0);
66 } elseif (isset($removeok)) {
67 if (get_magic_quotes_gpc())
68 $removeok = stripslashes($removeok);
69 RemovePage($dbi, $removeok);
70 $html = sprintf(gettext ("Removed page '%s' succesfully."),
71 htmlspecialchars($removeok));
72 GeneratePage('MESSAGE', $html, gettext ("Remove page"), 0);