summaryrefslogtreecommitdiff
path: root/htdocs/moderate/pages/delete.php
blob: beacd4516d1b153b1e7bc1727179b4dbfcf22e28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php

/* Foursquare Community Site
 * 
 * Copyright (C) 2011 Foursquare Church.
 * 
 * Developers: Jesse Morgan <jmorgan@foursquarestaff.com>
 *
 */

require_once('../../src/base.inc.php');

// Verify User is admin
if (!isset($_SESSION['currentUser']) or !$_SESSION['currentUser']->isAdmin()) {
    header('Location: ' . buildUrl('moderate/'));
    exit;
}

$error = '';

$page = false;
if (isset($_GET['id']) and is_numeric($_GET['id'])) {
    $page = Page::getById($_GET['id']);
    
    if ($page !== false and isset($_GET['confirmed'])) {
        $page->delete();
        
        header('Location: index.php');
    }

}

require_once('../src/header.inc.php');

echo "<h3>Delete Pages</h3>";

if ($page !== false) {
    echo "<p>Are you sure you want to delete " . $page->getTitle() ."?</p>"
        . "<p><a href=\"delete.php?id=". $page->getId() ."&confirmed\">Yes</a>"
        . " <a href=\"index.php\">No</a></p>";

} else {
    echo "<p>No page to delete.</p>";
}

require_once('../src/footer.inc.php');

?>