C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\portal\modules\gallery\admin.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<?php
require("code.php");
if(
$code != $xcode) {
exit;
}
$cat strip_dir_illegals($cat);
$id strip_dir_illegals($id);
if(
$online == 1) {
if(
$do == "") {
if(
$u_rank >= $rank_required['mod_admin']) {
echo 
"<center><b>Admin : Gallerys</b></center><hr noshade>";
if(
$act == "add_category") {
$err 0;
if(
$new_category == "") { derr("<i>Category</i> is blank."); $err 1; }
if(
dir_illegals($new_category)) { derr("<i>Category</i> contains illegal characters."); $err 1; }
if(
$err == 0) {
if(!
file_exists($admin_root."/categories/".$new_category.".php")) {
wf($admin_root."/categories/".str_replace(" ","_",$new_category).".php","w","");
dmsg("Category <i>$new_category</i> successfully added.");
}
else {
derr("Category <i>".$new_category."</i> already exists.");
}
}
}
if(
$act == "delete_category") {
$cat strip_dir_illegals($cat);
if(
file_exists($admin_root."/categories/".$cat.".php")) {
$dir2 $mod_root."/gallery";
$handle2=@opendir($dir2);
  while (
$file2 readdir($handle2))
 {
  if (
$file2 != "." && $file2 != ".." && $file2 != "index.html")
  {
$fn str_replace(".php","",$file2);
if(
str_replace($cat."&","",$fn) != $fn) {
if(
str_replace($cat."&","",$fn) > 0) {
unlink($dir2."/".$file2);
}
}
  }
 }
closedir($handle2);
unlink($admin_root."/categories/".$cat.".php");
dmsg("Category <i>".$cat."</i> successfully deleted.");
}
else {
derr("Category <i>".$cat."</i> does not exist.");
}
}
echo <<<HTML

<b>Add Category:</b><br>
<br>
<form action="
$admin_post&act=add_category" method="POST">
Category: <input type="text" name="new_category"> <input type="submit" value="Add Category">
</form>
<hr noshade>
<b>Current Categories:</b><br>
<br>
<ul>
HTML;
$dir $mod_root."/categories/";
$handle = @opendir($dir);
if (
$handle) {
while (
$file readdir($handle)) {
if ((
$file != ".") && ($file != "..")) {
if (!
is_dir($dir $file)) $filelist[] = $file;
}
}
closedir($handle);
}
if (!empty(
$filelist)) {
natcasesort($filelist);
foreach (
$filelist as $singleFile) {
$f_size filesize($dir $singleFile);
$atime date("Y-m-d, H:i:s"fileatime($dir $singleFile));
$mtime date("Y-m-d, H:i:s"filemtime($dir $singleFile));
$path = @pathinfo($dir $singleFile);
if((
$singleFile != ".") && ($singleFile != "..") && ($singleFile != "index.html")) {
require(
$dir.$singleFile);
}
$info_arr[] = $file_name."||".$singleFile."||".$f_size;
clearstatcache();
}
if (
$sort == "date") {
arsort($info_arr);
}
natcasesort($info_arr);
foreach (
$info_arr as $single_z) {
$all explode("||"$single_z);
if(
$all[1] != "index.html") {
$category_name str_replace(".php","",$all[1]);
echo <<<HTML

<li>
$category_name [<a href="$admin_url&act=delete_category&cat=$category_name">Delete</a>]</li>
HTML;
}
}
}
echo 
"</ul><br><br>";
}
else { 
$viv "Not_Enough_Access"; }
}
if(
$do == "post_gallery") {
if(
$u_rank >= $rank_required['mod_post']) {
if(
file_exists($admin_root."/categories/".$cat.".php")) {
echo <<<HTML

<center><b>Gallerys : 
$cat : Post Image</b></center><hr noshade>
$vxcode_info<br>
<form action="
$admin_post&do=post_gallery_go&cat=$cat" method="POST">
<table width="100%" 
$sp_table>
<tr valign="top" 
$sp_ctr><td $sp_ctr>Title:</td><td $sp_ctr><input type="text" name="new_gallery_title"></td></tr>
<tr valign="top" 
$sp_ctr><td $sp_ctr>Image Location:</td><td $sp_ctr><input type="text" name="new_gallery_image"></td></tr>
<tr valign="top" 
$sp_ctr><td colspan="2" $sp_ctr>Comments:</td></tr>
<tr valign="top" 
$sp_ctr><td colspan="2" $sp_ctr><textarea name="new_gallery_content" cols="75" rows="20"></textarea></td></tr>
</table><br>
<center><input type="submit" value="Post Image"> <input type="reset" value="Reset Form"></center><br>
</form><br>
HTML;
echo 
"<center>[<a href=\"".$mod_url."&cat=".$cat."\">Back to Gallery : ".str_replace("_"," ",$cat)."</a>]</center><br><br>";
}
else { 
derr("Category <i>".$cat."</i> does not exist."); }
}
else { 
$viv "Not_Enough_Access"; }
}
if(
$do == "post_gallery_go") {
if(
$u_rank >= $rank_required['mod_post']) {
if(
file_exists($admin_root."/categories/".$cat.".php")) {
$err 0;
$gallery_title $HTTP_POST_VARS['new_gallery_title'];
$gallery_image $HTTP_POST_VARS['new_gallery_image'];
$gallery_content $HTTP_POST_VARS['new_gallery_content'];
$new_id rand(1,9999) . rand(1,9999) . rand(1,9999) . rand(1,9999) . rand(1,9999);
if(
blankc($gallery_title,"Title")) {
$err 1;
}
if(
blankc($gallery_image,"Image")) {
$err 1;
}
if(
blankc($gallery_content,"Comments")) {
$err 1;
}
if(
in_illegals($gallery_title)) {
derr("Title has illegal characters.");
$err 1;
}
if(
file_exists($admin_root."/gallery/".$cat."&".$new_id.".php")) {
derr("Existant ID, try again.");
$err 1;
}
if(
$err == 0) {
$poster $usr;
$date_posted $date;
$gallery_title alter($gallery_title);
$gallery_image alter($gallery_image);
$gallery_content alter($gallery_content);
$gallery_comments "";
$gallery_comments_count 0;
require(
$admin_root."/gallery_info.php");
wf($admin_root."/gallery/".$cat."&".$new_id.".php","w",$gallery_info);
wf($admin_root."/latest_gallery.php","w","<?php\n\$latest_gallery = \"<a href=\\\"".$mod_url."&cat=".$cat."&do=view_gallery&id=".$new_id."\\\">".$gallery_title."</a> in <a href=\\\"".$mod_url."&cat=".$cat."\\\">".str_replace("_"," ",$cat)."</a>\";\n?>");
dmsg("Gallery <i>".$new_id."</i> has been posted.");
echo 
"<center>[<a href=\"".$mod_url."&cat=".$cat."\">Back to Gallery : ".str_replace("_"," ",$cat)."</a>]</center><br><br>";
}
}
else { 
derr("Category <i>".$cat."</i> does not exist."); }
}
else { 
$viv "Not_Enough_Access"; }
}
if(
$do == "edit_gallery") {
if(
$u_rank >= $rank_required['mod_edit']) {
if(
file_exists($admin_root."/gallery/".$cat."&".$id.".php")) {
require(
$admin_root."/gallery/".$cat."&".$id.".php");
$gallery_content rem_vxcode($gallery_content);
echo <<<HTML

<center><b>Gallerys : 
$cat : Edit Image</b></center><hr noshade>
$vxcode_info<br>
<form action="
$admin_post&do=edit_gallery_go&cat=$cat&id=$id" method="POST">
<table width="100%" 
$sp_table>
<tr valign="top" 
$sp_ctr><td $sp_ctr>Title:</td><td $sp_ctr><input type="text" name="new_gallery_title" value="$gallery_title"></td></tr>
<tr valign="top" 
$sp_ctr><td $sp_ctr>Image Location:</td><td $sp_ctr><input type="text" name="new_gallery_image" value="$gallery_image"></td></tr>
<tr valign="top" 
$sp_ctr><td colspan="2" $sp_ctr>Comments:</td></tr>
<tr valign="top" %sp_ctr><td colspan="2" 
$sp_ctr><textarea name="new_gallery_content" cols="75" rows="20">$gallery_content</textarea></td></tr>
</table><br>
<center><input type="submit" value="Edit Image"> <input type="reset" value="Reset Form"></center><br>
</form><br>
HTML;
echo 
"<center>[<a href=\"".$mod_url."&cat=".$cat."\">Back to Gallery : ".str_replace("_"," ",$cat)."</a>]</center><br><br>";
}
else { 
derr("Gallery <i>".$cat." - ".$id."</i> not found."); }
}
else { 
$viv "Not_Enough_Access"; }
}
if(
$do == "edit_gallery_go") {
if(
$u_rank >= $rank_required['mod_edit']) {
if(
file_exists($admin_root."/gallery/".$cat."&".$id.".php")) {
require(
$admin_root."/gallery/".$cat."&".$id.".php");
$err 0;
$gallery_title $HTTP_POST_VARS['new_gallery_title'];
$gallery_image $HTTP_POST_VARS['new_gallery_image'];
$gallery_content $HTTP_POST_VARS['new_gallery_content'];
if(
blankc($gallery_title,"Title")) {
$err 1;
}
if(
blankc($gallery_image,"Image")) {
$err 1;
}
if(
blankc($gallery_content,"Comments")) {
$err 1;
}
if(
in_illegals($gallery_title)) {
derr("Title has illegal characters.");
$err 1;
}
if(
$err == 0) {
$gallery_title alter($gallery_title);
$gallery_image alter($gallery_image);
//$gallery_content = alter($gallery_content) . "\n<br><br><i>Edited by <a href='load.php?viv=Profile&user=$usr' target='_blank'>$usr</a> at $date.</i>";
require($admin_root."/gallery_info.php");
wf($admin_root."/gallery/".$cat."&".$id.".php","w",$gallery_info);
wf($admin_root."/latest_gallery.php","w","<?php\n\$latest_gallery = \"<a href=\\\"".$mod_url."&cat=".$cat."&do=view_gallery&id=".$id."\\\">".$gallery_title." <i>[Edited]</i></a> in <a href=\\\"".$mod_url."&cat=".$cat."\\\">".str_replace("_"," ",$cat)."</a>\";\n?>");
dmsg("Gallery <i>".$id."</i> has been edited.");
echo 
"<center>[<a href=\"".$mod_url."&cat=".$cat."\">Back to Gallery : ".str_replace("_"," ",$cat)."</a>]</center><br><br>";
}
}
else { 
derr("Gallery <i>".$cat." - ".$id."</i> not found."); }
}
else { 
$viv "Not_Enough_Access"; }
}
if(
$do == "delete_gallery") {
if(
$u_rank >= $rank_required['mod_delete']) {
if(
file_exists($admin_root."/gallery/".$cat."&".$id.".php")) {
unlink($admin_root."/gallery/".$cat."&".$id.".php");
dmsg("Gallery <i>".$cat." - ".$id."</i> has been deleted.");
echo 
"<center>[<a href=\"".$mod_url."&cat=".$cat."\">Back to Gallery : ".str_replace("_"," ",$cat)."</a>]</center><br><br>";
}
else { 
derr("Gallery <i>".$cat." - ".$id."</i> not found."); }
}
else { 
$viv "Not_Enough_Access"; }
}
}
else { 
$viv "Not_Logged_In"; }
?>