summaryrefslogtreecommitdiff
path: root/htdocs/moderate/pages/index.php
blob: ab005523baa52e2367e0764f225b6304d517e480 (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
50
51
52
<?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 = '';

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

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

echo "<p><a class=\"bigbutton\" href=\"editor.php\">Create Page</a></p>";

$pi = new PageIterator();
$pi->query();

if ($pi->valid()) {
    echo "<div class=\"userrow header\">"
        . "<span class=\"name\">Title</span>"
        . " <span class=\"actions\">Actions</span></div>";

    foreach ($pi as $page) {
        printf("<div class=\"userrow\">"
            . "<span class=\"name\"><a href=\"%s.html\">%s</a></span>"
            . " <span class=\"actions\">"
            . " <a class=\"smallbutton\" href=\"editor.php?id=%s\">edit</a>"
            . " <a class=\"smallbutton\" href=\"delete.php?id=%s\">delete</a></span></div>",
            buildUrl('page/' . $page->getURL()), $page->getTitle(),
            $page->getId(), $page->getId()
            );
    }

} else {
    echo "<p>There are no pages to edit. Click the button above to create one.</p>";
}

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

?>