-
Notifications
You must be signed in to change notification settings - Fork 0
/
site_admin_list.php
57 lines (50 loc) · 1.42 KB
/
site_admin_list.php
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
53
54
55
56
57
<?php
global $BODY_ID;
$BODY_ID = "admin";
include_once("bootstrap.inc.php");
if (!$currentUser || !$currentUser->isAdmin)
{
header("Location: ".ROOT_URL);
exit();
}
if (@$_POST["showcaseRemove"])
{
SQLLib::Query(sprintf_esc("update posts set showcase = 0 where id = %d",$_POST["showcaseRemove"]));
}
if (@$_POST["showcaseAdd"])
{
SQLLib::Query(sprintf_esc("update posts set showcase = 1 where id = %d",$_POST["showcaseAdd"]));
}
include_once("header.inc.php");
?>
<section id="content">
<div>
<article id='admin-showcase' class='box'>
<h2>Admin stuff</h2>
<div class='body'>
<dl>
<?php
$posts = SQLLib::SelectRows(sprintf_esc("SELECT * from posts WHERE closureReason = '%s'",$_GET["reason"]));
foreach($posts as $p)
{
printf("<dt>%s <small>(<a href='%spost/%d/%s'>link</a>)</small></dt>\n",_html($p->title),ROOT_URL,$p->id,hashify($p->title));
printf("<dd class='%s'>%s\n",$p->showcase?"showcased":"",_html($p->closureDescription));
if ($p->showcase)
{
printf("<form method='post'><input type='hidden' name='showcaseRemove' value='%d'/><input type='submit' value='Remove from showcase'/></form>",$p->id);
}
else
{
printf("<form method='post'><input type='hidden' name='showcaseAdd' value='%d'/><input type='submit' value='Add to showcase'/></form>",$p->id);
}
echo "</dd>";
}
?>
</dl>
</div>
</article>
</div>
</section>
<?php
include_once("footer.inc.php");
?>