1 <!-- $Id: editpage.php,v 1.8.2.5 2005-01-07 14:23:04 rurban Exp $ -->
4 // editpage relies on $pagename and $ScriptUrl
7 $pagename = rawurldecode($edit);
8 if (get_magic_quotes_gpc()) {
9 $pagename = stripslashes($pagename);
11 $banner = htmlspecialchars($pagename);
12 $pagehash = RetrievePage($dbi, $pagename, $WikiPageStore);
15 $pagename = rawurldecode($copy);
16 if (get_magic_quotes_gpc()) {
17 $pagename = stripslashes($pagename);
19 $banner = htmlspecialchars (sprintf (gettext ("Copy of %s"), $pagename));
20 $pagehash = RetrievePage($dbi, $pagename, $ArchivePageStore);
23 ExitWiki(gettext ("No page name passed into editpage!"));
27 if (is_array($pagehash)) {
29 if (($pagehash['flags'] & FLAG_PAGE_LOCKED) && !defined('WIKI_ADMIN')) {
31 $html .= gettext ("This page has been locked by the administrator and cannot be edited.");
33 $html .= gettext ("Sorry for the inconvenience.");
35 GeneratePage('MESSAGE', $html, sprintf (gettext ("Problem while editing %s"), $pagename), 0);
39 $textarea = htmlspecialchars(implode("\n", $pagehash["content"]));
41 // $cdbi = OpenDataBase($WikiPageStore);
42 $currentpage = RetrievePage($dbi, $pagename, $WikiPageStore);
43 $pagehash["version"] = $currentpage["version"];
45 elseif ($pagehash["version"] > 1) {
46 if(IsInArchive($dbi, $pagename))
47 $pagehash["copy"] = 1;
50 if (preg_match("/^${WikiNameRegexp}\$/", $pagename))
53 $newpage = "[$pagename]";
55 $textarea = htmlspecialchars(
56 sprintf(gettext ("Describe %s here."), $newpage));
59 $pagehash["version"] = 0;
60 $pagehash["lastmodified"] = time();
61 $pagehash["author"] = '';
64 GeneratePage('EDITPAGE', $textarea, $pagename, $pagehash);