2 rcs_id('$Id: editpage.php,v 1.12 2001-02-13 05:54:38 dairiki Exp $');
4 // editpage relies on $pagename, $version
6 $currentpage = RetrievePage($dbi, $pagename, $WikiPageStore);
7 $editing_copy = isset($version) && $version == 'archive';
10 $banner = htmlspecialchars (sprintf (gettext ("Copy of %s"), $pagename));
11 $pagehash = RetrievePage($dbi, $pagename, $ArchivePageStore);
13 $banner = htmlspecialchars($pagename);
14 $pagehash = $currentpage;
17 if (is_array($pagehash)) {
19 if (($pagehash['flags'] & FLAG_PAGE_LOCKED) && !$user->is_admin()) {
21 $html .= gettext ("This page has been locked by the administrator and cannot be edited.");
23 $html .= gettext ("Sorry for the inconvenience.");
25 echo GeneratePage('MESSAGE', $html,
26 sprintf (gettext ("Problem while editing %s"), $pagename), 0);
30 $textarea = implode("\n", $pagehash["content"]);
32 $pagehash["version"] = $currentpage["version"];
35 if ($pagehash["version"] > 1 && IsInArchive($dbi, $pagename)) {
36 $pagehash["copy"] = 1;
40 $textarea = sprintf(gettext ("Describe %s here."),
41 htmlspecialchars($pagename));
43 $pagehash["version"] = 0;
44 $pagehash["lastmodified"] = time();
45 $pagehash["author"] = '';
46 $currentpage = $pagehash;
49 if (empty($pagehash['copy']))
51 else if ( $user->is_admin() )
52 $do_archive = 'probably';
53 else if ( $user->id() == $currentpage['author'] )
55 $page_age = time() - $currentpage['lastmodified'];
56 if ($page_age < MINOR_EDIT_TIMEOUT)
57 $do_archive = 'maybe';
59 $do_archive = 'probably';
62 $do_archive = 'force';
64 if ($do_archive == 'probably' || $do_archive == 'maybe')
66 $pagehash['minor_edit_checkbox']
67 = Element('input', array('type' => 'checkbox',
68 'name' => 'minor_edit',
70 'checked' => ($do_archive == 'probably')));
73 echo GeneratePage('EDITPAGE', $textarea, $pagename, $pagehash);
78 // c-file-style: "ellemtel"