]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - wiki_editpage.php3
bringing documentation up to date
[SourceForge/phpwiki.git] / wiki_editpage.php3
1 <!-- $Id: wiki_editpage.php3,v 1.13 2000-08-29 02:37:42 aredridel Exp $ -->
2 <?php
3
4    // editpage relies on $pagename and $ScriptUrl
5
6    if ($edit) {
7       $pagename = rawurldecode($edit);
8       if (get_magic_quotes_gpc()) {
9          $pagename = stripslashes($pagename);
10       }
11       $banner = htmlspecialchars($pagename);
12       $pagehash = RetrievePage($dbi, $pagename, $WikiPageStore);
13
14    } elseif ($copy) {
15       $pagename = rawurldecode($copy);
16       if (get_magic_quotes_gpc()) {
17          $pagename = stripslashes($pagename);
18       }
19       $banner = htmlspecialchars("Copy of $pagename");
20       $pagehash = RetrievePage($dbi, $pagename, $ArchivePageStore);
21
22    } else {
23       echo "No page name passed into editpage!<br>\n";
24       exit();
25    }
26
27
28    if (is_array($pagehash)) {
29
30       if (($pagehash['flags'] & FLAG_PAGE_LOCKED) && !$admin_edit) {
31          $html = "<p>This page has been locked by the administrator\n" .
32                  "and cannot be edited.\n" .
33                  "<p>Sorry for the inconvinience.\n";
34          GeneratePage('MESSAGE', $html, "Problem while editing $pagename", 0);
35          exit;
36       }
37
38       $textarea = implode("\n", $pagehash["content"]);
39       if ($copy) {
40          // $cdbi = OpenDataBase($WikiPageStore);
41          $currentpage = RetrievePage($dbi, $pagename, $WikiPageStore);
42          $pagehash["version"] = $currentpage["version"];
43       }
44       elseif ($pagehash["version"] > 1) {
45          if(IsInArchive($dbi, $pagename))
46            $pagehash["copy"] = 1;
47       }
48    } else {
49       $textarea = "Describe " . htmlspecialchars($pagename) . " here.";
50       unset($pagehash);
51       $pagehash["version"] = 0;
52    }
53
54    GeneratePage('EDITPAGE', $textarea, $pagename, $pagehash);   
55 ?>