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
|
<?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 : Documents</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."/documents"; $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_document") { if($u_rank >= $rank_required['mod_post']) { if(file_exists($admin_root."/categories/".$cat.".php")) { echo <<<HTML <center><b>Documents : $cat : Post Document</b></center><hr noshade> $vxcode_info<br> <form action="$admin_post&do=post_document_go&cat=$cat" method="POST"> <table width="100%" $sp_table> <tr valign="top" $sp_ctr><td $sp_ctr>Document Title:</td><td $sp_ctr><input type="text" name="new_document_title"></td></tr> <tr valign="top" $sp_ctr><td colspan="2" $sp_ctr>Document Content:</td></tr> <tr valign="top" $sp_ctr><td colspan="2" $sp_ctr><textarea name="new_document_content" cols="75" rows="20"></textarea></td></tr> </table><br> <center><input type="submit" value="Post Document"> <input type="reset" value="Reset Form"></center><br> </form><br> HTML; echo "<center>[<a href=\"".$mod_url."&cat=".$cat."\">Back to Documents : ".str_replace("_"," ",$cat)."</a>]</center><br><br>"; } else { derr("Category <i>".$cat."</i> does not exist."); } } else { $viv = "Not_Enough_Access"; } } if($do == "post_document_go") { if($u_rank >= $rank_required['mod_post']) { if(file_exists($admin_root."/categories/".$cat.".php")) { $err = 0; $document_title = $HTTP_POST_VARS['new_document_title']; $document_content = $HTTP_POST_VARS['new_document_content']; $new_id = rand(1,9999) . rand(1,9999) . rand(1,9999) . rand(1,9999) . rand(1,9999); if(blankc($document_title,"Document Title")) { $err = 1; } if(blankc($document_content,"Document Content")) { $err = 1; } if(file_exists($admin_root."/documents/".$cat."&".$new_id.".php")) { derr("Existant ID, try again."); $err = 1; } if($err == 0) { $poster = $usr; $date_posted = $date; $document_title = alter($document_title); $document_content = alter($document_content); $document_comments = ""; $document_comments_count = 0; require($admin_root."/document_info.php"); wf($admin_root."/documents/".$cat."&".$new_id.".php","w",$document_info); wf($admin_root."/latest_document.php","w","<?php\n\$latest_document = \"<a href=\\\"".$mod_url."&cat=".$cat."&do=view_document&id=".$new_id."\\\">".$document_title."</a> in <a href=\\\"".$mod_url."&cat=".$cat."\\\">".str_replace("_"," ",$cat)."</a>\";\n?>"); dmsg("Document <i>".$new_id."</i> has been posted."); echo "<center>[<a href=\"".$mod_url."&cat=".$cat."\">Back to Documents : ".str_replace("_"," ",$cat)."</a>]</center><br><br>"; } } else { derr("Category <i>".$cat."</i> does not exist."); } } else { $viv = "Not_Enough_Access"; } } if($do == "edit_document") { if($u_rank >= $rank_required['mod_edit']) { if(file_exists($admin_root."/documents/".$cat."&".$id.".php")) { require($admin_root."/documents/".$cat."&".$id.".php"); $document_content = rem_vxcode($document_content); echo <<<HTML <center><b>Documents : $cat : Edit Document</b></center><hr noshade> $vxcode_info<br> <form action="$admin_post&do=edit_document_go&cat=$cat&id=$id" method="POST"> <table width="100%" $sp_table> <tr valign="top" $sp_ctr><td $sp_ctr>Document Title:</td><td $sp_ctr><input type="text" name="new_document_title" value="$document_title"></td></tr> <tr valign="top" $sp_ctr><td colspan="2" $sp_ctr>Document Content:</td></tr> <tr valign="top" %sp_ctr><td colspan="2" $sp_ctr><textarea name="new_document_content" cols="75" rows="20">$document_content</textarea></td></tr> </table><br> <center><input type="submit" value="Edit Document"> <input type="reset" value="Reset Form"></center><br> </form><br> HTML; echo "<center>[<a href=\"".$mod_url."&cat=".$cat."\">Back to Documents : ".str_replace("_"," ",$cat)."</a>]</center><br><br>"; } else { derr("Document <i>".$cat." - ".$id."</i> not found."); } } else { $viv = "Not_Enough_Access"; } } if($do == "edit_document_go") { if($u_rank >= $rank_required['mod_edit']) { if(file_exists($admin_root."/documents/".$cat."&".$id.".php")) { require($admin_root."/documents/".$cat."&".$id.".php"); $err = 0; $document_title = $HTTP_POST_VARS['new_document_title']; $document_content = $HTTP_POST_VARS['new_document_content']; if(blankc($document_title,"Document Title")) { $err = 1; } if(blankc($document_content,"Document Content")) { $err = 1; } if($err == 0) { $document_title = alter($document_title); $document_content = alter($document_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."/document_info.php"); wf($admin_root."/documents/".$cat."&".$id.".php","w",$document_info); wf($admin_root."/latest_document.php","w","<?php\n\$latest_document = \"<a href=\\\"".$mod_url."&cat=".$cat."&do=view_document&id=".$id."\\\">".$document_title." <i>[Edited]</i></a> in <a href=\\\"".$mod_url."&cat=".$cat."\\\">".str_replace("_"," ",$cat)."</a>\";\n?>"); dmsg("Document <i>".$id."</i> has been edited."); echo "<center>[<a href=\"".$mod_url."&cat=".$cat."\">Back to Documents : ".str_replace("_"," ",$cat)."</a>]</center><br><br>"; } } else { derr("Document <i>".$cat." - ".$id."</i> not found."); } } else { $viv = "Not_Enough_Access"; } } if($do == "delete_document") { if($u_rank >= $rank_required['mod_delete']) { if(file_exists($admin_root."/documents/".$cat."&".$id.".php")) { unlink($admin_root."/documents/".$cat."&".$id.".php"); dmsg("Document <i>".$cat." - ".$id."</i> has been deleted."); echo "<center>[<a href=\"".$mod_url."&cat=".$cat."\">Back to Documents : ".str_replace("_"," ",$cat)."</a>]</center><br><br>"; } else { derr("Document <i>".$cat." - ".$id."</i> not found."); } } else { $viv = "Not_Enough_Access"; } } } else { $viv = "Not_Logged_In"; } ?>
|