]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/editpage.php
another gettext() patch from Jan (fix plus translation of savepage)
[SourceForge/phpwiki.git] / lib / editpage.php
1 <!-- $Id: editpage.php,v 1.5 2000-10-26 15:38:38 ahollosi 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 (sprintf (gettext ("Copy of %s"), $pagename));
20       $pagehash = RetrievePage($dbi, $pagename, $ArchivePageStore);
21
22    } else {
23       ExitWiki(gettext ("No page name passed into editpage!"));
24    }
25
26
27    if (is_array($pagehash)) {
28
29       if (($pagehash['flags'] & FLAG_PAGE_LOCKED) && !$admin_edit) {
30          $html = "<p>";
31          $html .= gettext ("This page has been locked by the administrator and cannot be edited.");
32          $html .= "\n<p>";
33          $html .= gettext ("Sorry for the inconvenience.");
34          $html .= "\n";
35          GeneratePage('MESSAGE', $html, sprintf (gettext ("Problem while editing %s"), $pagename), 0);
36          ExitWiki ("");
37       }
38
39       $textarea = implode("\n", $pagehash["content"]);
40       if ($copy) {
41          // $cdbi = OpenDataBase($WikiPageStore);
42          $currentpage = RetrievePage($dbi, $pagename, $WikiPageStore);
43          $pagehash["version"] = $currentpage["version"];
44       }
45       elseif ($pagehash["version"] > 1) {
46          if(IsInArchive($dbi, $pagename))
47            $pagehash["copy"] = 1;
48       }
49    } else {
50       $textarea = sprintf(gettext ("Describe %s here."),
51                                 htmlspecialchars($pagename));
52       unset($pagehash);
53       $pagehash["version"] = 0;
54    }
55
56    GeneratePage('EDITPAGE', $textarea, $pagename, $pagehash);   
57 ?>