2 rcs_id('$Id: removepage.php,v 1.15 2003-02-22 21:15:54 dairiki Exp $');
3 require_once('lib/Template.php');
5 function RemovePage (&$request) {
8 $page = $request->getPage();
9 $pagelink = WikiLink($page);
11 if ($request->getArg('cancel')) {
12 $request->redirect(WikiURL($page), false);
13 // The user probably doesn't see the rest of this.
14 $html = HTML(HTML::h2(_("Request Cancelled!")),
15 HTML::p(fmt("Return to %s.", $pagelink)));
18 $current = $page->getCurrentRevision();
19 $version = $current->getVersion();
21 if (!$request->isPost() || !$request->getArg('verify')) {
23 // FIXME: button should be class wikiadmin
24 $removeB = Button('submit:verify', _("Remove the page now"), 'wikiadmin');
25 $cancelB = Button('submit:cancel', _("Cancel"), 'button'); // use generic wiki button look
27 $html = HTML(HTML::h2(fmt("You are about to remove '%s' permanently!", $pagelink)),
28 HTML::form(array('method' => 'post',
29 'action' => $request->getPostURL()),
30 HiddenInputs(array('currentversion' => $version,
31 'pagename' => $page->getName(),
32 'action' => 'remove')),
34 HTML::div(array('class' => 'toolbar'),
36 $Theme->getButtonSeparator(),
39 elseif ($request->getArg('currentversion') != $version) {
40 $html = HTML(HTML::h2(_("Someone has edited the page!")),
41 HTML::p(fmt("Since you started the deletion process, someone has saved a new version of %s. Please check to make sure you still want to permanently remove the page from the database.", $pagelink)));
45 $pagename = $page->getName();
46 $dbi = $request->getDbh();
47 $dbi->deletePage($pagename);
49 $html = HTML(HTML::h2(fmt("Removed page '%s' succesfully.", $pagename)));
52 GeneratePage($html, _("Remove page"));
61 // c-hanging-comment-ender-p: nil
62 // indent-tabs-mode: nil