forked from Znote/ZnoteAAC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_gallery.php
122 lines (116 loc) · 3.58 KB
/
admin_gallery.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
protect_page();
admin_only($user_data);
// start
// Delete
if (isset($_POST['delete'])) {
$data = explode(":", $_POST['delete']);
echo 'Image '. $data[0] .' deleted.';
updateImage($data[0], 3);
}
// Accept
if (isset($_POST['accept'])) {
$data = explode(":", $_POST['accept']);
echo 'Image '. $data[0] .' accepted and is now public.';
updateImage($data[0], 2);
}
// Wether we accept or delete, re-create the cache
if (isset($_POST['accept']) || isset($_POST['delete'])) {
$cache = new Cache('engine/cache/gallery');
$images = fetchImages(2);
if ($images != false) {
$data = array();
foreach ($images as $image) {
$row['title'] = $image['title'];
$row['desc'] = $image['desc'];
$row['date'] = $image['date'];
$row['image'] = $image['image'];
$data[] = $row;
}
} else $data = "";
$cache->setContent($data);
$cache->save();
}
?><h1>Images in need of moderation:</h1><?php
$images = fetchImages(1);
if ($images != false) {
foreach($images as $image) {
$pw = explode("!", $image['image']);
?>
<table>
<tr class="yellow">
<td><h2><?php echo $image['title']; ?><form action="" method="post"><input type="submit" name="accept" value="<?php echo $image['id']; ?>:Accept Image"/></form><form action="" method="post"><input type="submit" name="delete" value="<?php echo $image['id']; ?>:Delete Image"/></form></h2></td>
</tr>
<tr>
<td>
<a href="<?php echo 'http://'. $pw[0] .'.ii.gl/'. $pw[1] .'.'. $pw[2]; ?>"><img src="<?php echo 'http://'. $pw[0] .'.ii.gl/'. $pw[1] .'.'. $pw[2]; ?>" width="650"/></a>
</td>
</tr>
<tr>
<td>
<?php
$descr = str_replace("\\r", "", $image['desc']);
$descr = str_replace("\\n", "<br />", $descr);
?>
<p><?php echo $descr; ?></p>
</td>
</tr>
</table>
<?php }
} else echo '<h2>All good, no new images to moderate.</h2>';
?><h1>Public Images:</h1><?php
$images = fetchImages(2);
if ($images != false) {
foreach($images as $image) {
$pw = explode("!", $image['image']);
?>
<table>
<tr class="yellow">
<td><h2><?php echo $image['title']; ?><form action="" method="post"><input type="submit" name="delete" value="<?php echo $image['id']; ?>:Delete Image"/></form></h2></td>
</tr>
<tr>
<td>
<a href="<?php echo 'http://'. $pw[0] .'.ii.gl/'. $pw[1] .'.'. $pw[2]; ?>"><img src="<?php echo 'http://'. $pw[0] .'.ii.gl/'. $pw[1] .'.'. $pw[2]; ?>" width="650"/></a>
</td>
</tr>
<tr>
<td>
<?php
$descr = str_replace("\\r", "", $image['desc']);
$descr = str_replace("\\n", "<br />", $descr);
?>
<p><?php echo $descr; ?></p>
</td>
</tr>
</table>
<?php }
} else echo '<h2>There are currently no public images.</h2>';
?><h1>Deleted Images:</h1><?php
$images = fetchImages(3);
if ($images != false) {
foreach($images as $image) {
$pw = explode("!", $image['image']);
?>
<table>
<tr class="yellow">
<td><h2><?php echo $image['title']; ?><form action="" method="post"><input type="submit" name="accept" value="<?php echo $image['id']; ?>:Recover Image"/></form></h2></td>
</tr>
<tr>
<td>
<a href="<?php echo 'http://'. $pw[0] .'.ii.gl/'. $pw[1] .'.'. $pw[2]; ?>"><img src="<?php echo 'http://'. $pw[0] .'.ii.gl/'. $pw[1] .'.'. $pw[2]; ?>" width="650"/></a>
</td>
</tr>
<tr>
<td>
<?php
$descr = str_replace("\\r", "", $image['desc']);
$descr = str_replace("\\n", "<br />", $descr);
?>
<p><?php echo $descr; ?></p>
</td>
</tr>
</table>
<?php }
} else echo '<h2>There are currently no deleted images.</h2>';
// end
include 'layout/overall/footer.php'; ?>