2 rcs_id('$Id: removepage.php,v 1.12 2002-02-14 03:40:00 carstenklapp 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));
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' => WikiURL($page)),
30 HTML::input(array('type' => 'hidden',
31 'name' => 'currentversion',
32 'value' => $version)),
33 HTML::input(array('type' => 'hidden',
35 'value' => 'remove')),
36 HTML::div(array('class' => 'toolbar'),
38 $Theme->getButtonSeparator(),
41 elseif ($request->getArg('currentversion') != $version) {
42 $html = HTML(HTML::h2(_("Someone has edited the page!")),
43 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)));
47 $pagename = $page->getName();
48 $dbi = $request->getDbh();
49 $dbi->deletePage($pagename);
50 $html = HTML(HTML::h2(fmt("Removed page '%s' succesfully.", $pagename)));
53 GeneratePage($html, _("Remove page"));
62 // c-hanging-comment-ender-p: nil
63 // indent-tabs-mode: nil