]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - admin.php
Removed the notice that PhpWiki did not work with 4.0.4 out of the
[SourceForge/phpwiki.git] / admin.php
1 <?php // $Id: admin.php,v 1.5 2000-11-13 10:59:27 ahollosi Exp $
2
3    function rcs_id($id) {}   // otherwise this gets in the way
4
5    define('WIKI_ADMIN', true);  // has to be before includes
6
7    include("lib/config.php");
8    include("lib/stdlib.php");
9
10    // set these to your preferences. For heaven's sake
11    // pick a good password!
12    $wikiadmin   = "";
13    $adminpasswd = "";
14
15    // Do not tolerate sloppy systems administration
16    if (empty($wikiadmin) || empty($adminpasswd)) {
17       echo "Set the administrator account and password first.\n";
18       exit;
19    }
20
21    // from the manual, Chapter 16
22    if (($PHP_AUTH_USER != $wikiadmin  )  ||
23        ($PHP_AUTH_PW   != $adminpasswd)) {
24       Header("WWW-Authenticate: Basic realm=\"PhpWiki\"");
25       Header("HTTP/1.0 401 Unauthorized");
26       echo gettext ("You entered an invalid login or password.");
27       exit;
28    }
29
30    // All requests require the database
31    $dbi = OpenDataBase($WikiPageStore);
32
33    if (isset($lock) || isset($unlock)) {
34       include ('admin/lockpage.php');
35    } elseif (isset($zip)) {
36       include ('lib/ziplib.php');
37       include ('admin/zip.php');
38       ExitWiki('');
39    } elseif (isset($dumpserial)) {
40       include ('admin/dumpserial.php');
41    } elseif (isset($loadserial)) {
42       include ('admin/loadserial.php');
43    } elseif (isset($remove)) {
44       if (get_magic_quotes_gpc())
45          $remove = stripslashes($remove);
46       if (function_exists('RemovePage')) {
47          $html .= sprintf(gettext ("You are about to remove '%s' permanently!"), htmlspecialchars($remove));
48          $html .= "\n<P>";
49          $url = rawurlencode($remove);
50          $html .= sprintf(gettext ("Click %shere%s to remove the page now."),
51                   "<A HREF=\"$ScriptUrl?removeok=$url\">", "</A>");
52          $html .= "\n<P>";
53          $html .= gettext ("Otherwise press the \"Back\" button of your browser.");
54       } else {
55          $html = gettext ("Function not yet implemented.");
56       }
57       GeneratePage('MESSAGE', $html, gettext ("Remove page"), 0);
58       ExitWiki('');
59    } elseif (isset($removeok)) {
60       if (get_magic_quotes_gpc())
61          $removeok = stripslashes($removeok);
62       RemovePage($dbi, $removeok);
63       $html = sprintf(gettext ("Removed page '%s' succesfully."),
64                       htmlspecialchars($removeok));
65       GeneratePage('MESSAGE', $html, gettext ("Remove page"), 0);
66       ExitWiki('');
67    }
68
69    include('index.php');
70 ?>