diff options
Diffstat (limited to 'pages/admin.php')
| -rw-r--r-- | pages/admin.php | 661 |
1 files changed, 661 insertions, 0 deletions
| diff --git a/pages/admin.php b/pages/admin.php new file mode 100644 index 0000000..ca7a7fa --- /dev/null +++ b/pages/admin.php | |||
| @@ -0,0 +1,661 @@ | |||
| 1 | <?php | ||
| 2 | /* | ||
| 3 | 444444444 | ||
| 4 | 4::::::::4 | ||
| 5 | 4:::::::::4 | ||
| 6 | 4::::44::::4 | ||
| 7 | 4::::4 4::::4 Four Island | ||
| 8 | 4::::4 4::::4 | ||
| 9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
| 10 | 4::::444444::::444 | ||
| 11 | 4::::::::::::::::4 pages/admin.php | ||
| 12 | 4444444444:::::444 | ||
| 13 | 4::::4 Please do not use, reproduce or steal the | ||
| 14 | 4::::4 contents of this file without explicit | ||
| 15 | 4::::4 permission from Hatkirby. | ||
| 16 | 44::::::44 | ||
| 17 | 4::::::::4 | ||
| 18 | 4444444444 | ||
| 19 | */ | ||
| 20 | |||
| 21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
| 22 | |||
| 23 | require('headerproc.php'); | ||
| 24 | |||
| 25 | $pageCategory = 'panel'; | ||
| 26 | |||
| 27 | if (isLoggedIn()) | ||
| 28 | { | ||
| 29 | if (getUserlevel() == 1) | ||
| 30 | { | ||
| 31 | if (!isset($_GET['page'])) | ||
| 32 | { | ||
| 33 | $template = new FITemplate('admin/index'); | ||
| 34 | } else if ($_GET['page'] == 'writePost') | ||
| 35 | { | ||
| 36 | if (!isset($_GET['submit'])) | ||
| 37 | { | ||
| 38 | $template = new FITemplate('admin/write'); | ||
| 39 | } else { | ||
| 40 | if ($_POST['type'] == 'draft') | ||
| 41 | { | ||
| 42 | $insdraft = "INSERT INTO drafts (title,author,text,tag1,tag2,tag3,slug) VALUES (\"" . addslashes($_POST['title']) . "\",\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\",\"" . $_POST['tag1'] . "\",\"" . $_POST['tag2'] . "\",\"" . $_POST['tag3'] . "\",\"" . generateSlug($_POST['title'],'updates') . "\")"; | ||
| 43 | $insdraft2 = mysql_query($insdraft); | ||
| 44 | |||
| 45 | $getdraft = "SELECT * FROM drafts ORDER BY id DESC LIMIT 0,1"; | ||
| 46 | $getdraft2 = mysql_query($getdraft); | ||
| 47 | $getdraft3 = mysql_fetch_array($getdraft2); | ||
| 48 | |||
| 49 | $template = new FITemplate('admin/draftSuccess'); | ||
| 50 | $template->add('ID', $getdraft3['id']); | ||
| 51 | } else if ($_POST['type'] == 'instant') | ||
| 52 | { | ||
| 53 | postBlogPost($_POST['title'], sess_get('uname'), $_POST['tag1'], $_POST['tag2'], $_POST['tag3'], $_POST['text']); | ||
| 54 | |||
| 55 | $getpost = "SELECT * FROM updates ORDER BY id DESC LIMIT 0,1"; | ||
| 56 | $getpost2 = mysql_query($getpost); | ||
| 57 | $getpost3 = mysql_fetch_array($getpost2); | ||
| 58 | |||
| 59 | $template = new FITemplate('admin/postSuccess'); | ||
| 60 | $template->add('ID', $getpost3['id']); | ||
| 61 | $template->add('CODED', $getpost3['slug']); | ||
| 62 | } else { | ||
| 63 | if ($_POST['type'] == 'normal') | ||
| 64 | { | ||
| 65 | $getpending = "SELECT * FROM pending ORDER BY id DESC LIMIT 0,1"; | ||
| 66 | $getpending2 = mysql_query($getpending); | ||
| 67 | $getpending3 = mysql_fetch_array($getpending2); | ||
| 68 | if (isset($getpending3['id']) === FALSE) | ||
| 69 | { | ||
| 70 | $id = 50; | ||
| 71 | } else { | ||
| 72 | $id = $getpending3['id']+1; | ||
| 73 | } | ||
| 74 | } else if ($_POST['type'] == 'priority') | ||
| 75 | { | ||
| 76 | $getpending = "SELECT * FROM pending ORDER BY id ASC LIMIT 0,1"; | ||
| 77 | $getpending2 = mysql_query($getpending); | ||
| 78 | $getpending3 = mysql_fetch_array($getpending2); | ||
| 79 | if (isset($getpending3['id']) === FALSE) | ||
| 80 | { | ||
| 81 | $id = 50; | ||
| 82 | } else { | ||
| 83 | $id = $getpending3['id']-1; | ||
| 84 | } | ||
| 85 | } else { | ||
| 86 | generateError(404); | ||
| 87 | } | ||
| 88 | |||
| 89 | $inspending = "INSERT INTO pending (id,title,author,text,tag1,tag2,tag3,slug) VALUES (" . $id . ",\"" . addslashes($_POST['title']) . "\",\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\",\"" . $_POST['tag1'] . "\",\"" . $_POST['tag2'] . "\",\"" . $_POST['tag3'] . "\",\"" . generateSlug($_POST['title'],'updates') . "\")"; | ||
| 90 | $inspending2 = mysql_query($inspending); | ||
| 91 | |||
| 92 | $template = new FITemplate('admin/pendingSuccess'); | ||
| 93 | $template->add('ID', $id); | ||
| 94 | } | ||
| 95 | } | ||
| 96 | } else if ($_GET['page'] == 'manageDrafts') | ||
| 97 | { | ||
| 98 | $template = new FITemplate('admin/manageDrafts'); | ||
| 99 | |||
| 100 | $getdrafts = "SELECT * FROM drafts ORDER BY id ASC"; | ||
| 101 | $getdrafts2 = mysql_query($getdrafts); | ||
| 102 | $i=0; | ||
| 103 | while ($getdrafts3[$i] = mysql_fetch_array($getdrafts2)) | ||
| 104 | { | ||
| 105 | $template->adds_block('DRAFT', array( 'TITLE' => $getdrafts3[$i]['title'], | ||
| 106 | 'AUTHOR' => $getdrafts3[$i]['author'], | ||
| 107 | 'ID' => $getdrafts3[$i]['id'])); | ||
| 108 | $i++; | ||
| 109 | } | ||
| 110 | } else if ($_GET['page'] == 'editDraft') | ||
| 111 | { | ||
| 112 | $getdraft = "SELECT * FROM drafts WHERE id = " . $_GET['id']; | ||
| 113 | $getdraft2 = mysql_query($getdraft); | ||
| 114 | $getdraft3 = mysql_fetch_array($getdraft2); | ||
| 115 | |||
| 116 | if ($getdraft3['id'] == $_GET['id']) | ||
| 117 | { | ||
| 118 | if (!isset($_GET['submit'])) | ||
| 119 | { | ||
| 120 | $template = new FITemplate('admin/editDraft'); | ||
| 121 | $template->add('ID', $_GET['id']); | ||
| 122 | $template->add('TEXT', $getdraft3['text']); | ||
| 123 | $template->add('TAG1', $getdraft3['tag1']); | ||
| 124 | $template->add('TAG2', $getdraft3['tag2']); | ||
| 125 | $template->add('TAG3', $getdraft3['tag3']); | ||
| 126 | $template->add('TITLE', $getdraft3['title']); | ||
| 127 | } else { | ||
| 128 | if ($_POST['type'] == 'draft') | ||
| 129 | { | ||
| 130 | $setdraft = "UPDATE drafts SET title = \"" . addslashes($_POST['title']) . "\", text = \"" . addslashes($_POST['text']) . "\", tag1 = \"" . $_POST['tag1'] . "\", tag2 = \"" . $_POST['tag2'] . "\", tag3 = \"" . $_POST['tag3'] . "\" WHERE id = " . $_GET['id']; | ||
| 131 | $setdraft2 = mysql_query($setdraft); | ||
| 132 | |||
| 133 | $template = new FITemplate('admin/draftSuccess'); | ||
| 134 | $template->add('ID', $_GET['id']); | ||
| 135 | } else if ($_POST['type'] == 'instant') | ||
| 136 | { | ||
| 137 | postBlogPost($_POST['title'], sess_get('uname'), $_POST['tag1'], $_POST['tag2'], $_POST['tag3'], $_POST['text']); | ||
| 138 | |||
| 139 | $deldraft = "DELETE FROM drafts WHERE id = " . $_GET['id']; | ||
| 140 | $deldraft2 = mysql_query($deldraft); | ||
| 141 | |||
| 142 | $getpost = "SELECT * FROM updates ORDER BY id DESC LIMIT 0,1"; | ||
| 143 | $getpost2 = mysql_query($getpost); | ||
| 144 | $getpost3 = mysql_fetch_array($getpost2); | ||
| 145 | |||
| 146 | $template = new FITemplate('admin/postSuccess'); | ||
| 147 | $template->add('ID', $getpost3['id']); | ||
| 148 | $template->add('CODED', $getpost3['slug']); | ||
| 149 | } else { | ||
| 150 | if ($_POST['type'] == 'normal') | ||
| 151 | { | ||
| 152 | $getpending = "SELECT * FROM pending ORDER BY id DESC LIMIT 0,1"; | ||
| 153 | $getpending2 = mysql_query($getpending); | ||
| 154 | $getpending3 = mysql_fetch_array($getpending2); | ||
| 155 | if (isset($getpending3['id']) === FALSE) | ||
| 156 | { | ||
| 157 | $id = 50; | ||
| 158 | } else { | ||
| 159 | $id = $getpending3['id']+1; | ||
| 160 | } | ||
| 161 | } else if ($_POST['type'] == 'priority') | ||
| 162 | { | ||
| 163 | $getpending = "SELECT * FROM pending ORDER BY id ASC LIMIT 0,1"; | ||
| 164 | $getpending2 = mysql_query($getpending); | ||
| 165 | $getpending3 = mysql_fetch_array($getpending2); | ||
| 166 | if (isset($getpending3['id']) === FALSE) | ||
| 167 | { | ||
| 168 | $id = 50; | ||
| 169 | } else { | ||
| 170 | $id = $getpending3['id']-1; | ||
| 171 | } | ||
| 172 | } else { | ||
| 173 | generateError(404); | ||
| 174 | } | ||
| 175 | |||
| 176 | $inspending = "INSERT INTO pending (id,title,author,text,tag1,tag2,tag3,slug) VALUES (" . $id . ",\"" . addslashes($_POST['title']) . "\",\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\",\"" . $_POST['tag1'] . "\",\"" . $_POST['tag2'] . "\",\"" . $_POST['tag3'] . "\",\"" . generateSlug($_POST['title'],'updates') . "\")"; | ||
| 177 | $inspending2 = mysql_query($inspending); | ||
| 178 | |||
| 179 | $deldraft = "DELETE FROM drafts WHERE id = " . $_GET['id']; | ||
| 180 | $deldraft2 = mysql_query($deldraft); | ||
| 181 | |||
| 182 | $template = new FITemplate('admin/pendingSuccess'); | ||
| 183 | $template->add('ID', $id); | ||
| 184 | } | ||
| 185 | } | ||
| 186 | } else { | ||
| 187 | $template = new FITemplate('msg'); | ||
| 188 | $template->add('BACK', 'the previous page'); | ||
| 189 | $template->add('MSG', 'I\'m sorry, that draft doesn\'t exist.'); | ||
| 190 | } | ||
| 191 | } else if ($_GET['page'] == 'deleteDraft') | ||
| 192 | { | ||
| 193 | $getdraft = "SELECT * FROM drafts WHERE id = " . $_GET['id']; | ||
| 194 | $getdraft2 = mysql_query($getdraft); | ||
| 195 | $getdraft3 = mysql_fetch_array($getdraft2); | ||
| 196 | |||
| 197 | if ($getdraft3['id'] == $_GET['id']) | ||
| 198 | { | ||
| 199 | if (!isset($_GET['submit'])) | ||
| 200 | { | ||
| 201 | $template = new FITemplate('admin/deleteDraft'); | ||
| 202 | $template->add('ID', $_GET['id']); | ||
| 203 | } else { | ||
| 204 | $deldraft = "DELETE FROM drafts WHERE id = " . $_GET['id']; | ||
| 205 | $deldraft2 = mysql_query($deldraft); | ||
| 206 | |||
| 207 | $template = new FITemplate('admin/deletedDraft'); | ||
| 208 | } | ||
| 209 | } else { | ||
| 210 | $template = new FITemplate('msg'); | ||
| 211 | $template->add('BACK', 'the previous page'); | ||
| 212 | $template->add('MSG', 'I\'m sorry, that draft doesn\'t exist.'); | ||
| 213 | } | ||
| 214 | } else if ($_GET['page'] == 'viewDraft') | ||
| 215 | { | ||
| 216 | $getdraft = "SELECT * FROM drafts WHERE id = " . $_GET['id']; | ||
| 217 | $getdraft2 = mysql_query($getdraft); | ||
| 218 | $getdraft3 = mysql_fetch_array($getdraft2); | ||
| 219 | |||
| 220 | if ($getdraft3['id'] == $_GET['id']) | ||
| 221 | { | ||
| 222 | $template = new FITemplate('post'); | ||
| 223 | $template->adds_block('INTERNAL',array('exi'=>1)); | ||
| 224 | $template->adds_block('POST', array( 'ID' => $getdraft3['id'], | ||
| 225 | 'YEARID' => ((date('Y')-2006) % 4), | ||
| 226 | 'DATE' => date('F dS Y \a\\t g:i:s a'), | ||
| 227 | 'MONTH' => date('M'), | ||
| 228 | 'DAY' => date('d'), | ||
| 229 | 'CODED' => $getdraft3['slug'], | ||
| 230 | 'TITLE' => $getdraft3['title'], | ||
| 231 | 'AUTHOR' => $getdraft3['author'], | ||
| 232 | 'TAG1' => $getdraft3['tag1'], | ||
| 233 | 'TAG2' => $getdraft3['tag2'], | ||
| 234 | 'TAG3' => $getdraft3['tag3'], | ||
| 235 | 'RATING' => 0, | ||
| 236 | 'TEXT' => parseBBCode($getdraft3['text']))); | ||
| 237 | } else { | ||
| 238 | $template = new FITemplate('msg'); | ||
| 239 | $template->add('BACK', 'the previous page'); | ||
| 240 | $template->add('MSG', 'I\'m sorry, that draft doesn\'t exist.'); | ||
| 241 | } | ||
| 242 | } else if ($_GET['page'] == 'managePending') | ||
| 243 | { | ||
| 244 | $template = new FITemplate('admin/managePending'); | ||
| 245 | |||
| 246 | $getpending = "SELECT * FROM pending ORDER BY id ASC"; | ||
| 247 | $getpending2 = mysql_query($getpending); | ||
| 248 | $i=0; | ||
| 249 | while ($getpending3[$i] = mysql_fetch_array($getpending2)) | ||
| 250 | { | ||
| 251 | $template->adds_block('PENDING', array( 'TITLE' => $getpending3[$i]['title'], | ||
| 252 | 'AUTHOR' => $getpending3[$i]['author'], | ||
| 253 | 'ID' => $getpending3[$i]['id'])); | ||
| 254 | $i++; | ||
| 255 | } | ||
| 256 | } else if ($_GET['page'] == 'editPending') | ||
| 257 | { | ||
| 258 | $getpending = "SELECT * FROM pending WHERE id = " . $_GET['id']; | ||
| 259 | $getpending2 = mysql_query($getpending); | ||
| 260 | $getpending3 = mysql_fetch_array($getpending2); | ||
| 261 | |||
| 262 | if ($getpending3['id'] == $_GET['id']) | ||
| 263 | { | ||
| 264 | if (!isset($_GET['submit'])) | ||
| 265 | { | ||
| 266 | $template = new FITemplate('admin/editPending'); | ||
| 267 | $template->add('ID', $_GET['id']); | ||
| 268 | $template->add('TEXT', $getpending3['text']); | ||
| 269 | $template->add('TAG1', $getpending3['tag1']); | ||
| 270 | $template->add('TAG2', $getpending3['tag2']); | ||
| 271 | $template->add('TAG3', $getpending3['tag3']); | ||
| 272 | $template->add('TITLE', $getpending3['title']); | ||
| 273 | } else { | ||
| 274 | $setpending = "UPDATE pending SET title = \"" . addslashes($_POST['title']) . "\", text = \"" . addslashes($_POST['text']) . "\", tag1 = \"" . $_POST['tag1'] . "\", tag2 = \"" . $_POST['tag2'] . "\", tag3 = \"" . $_POST['tag3'] . "\" WHERE id = " . $_GET['id']; | ||
| 275 | $setpending2 = mysql_query($setpending); | ||
| 276 | |||
| 277 | $template = new FITemplate('admin/pendingSuccess'); | ||
| 278 | $template->add('ID', $_GET['id']); | ||
| 279 | } | ||
| 280 | } else { | ||
| 281 | $template = new FITemplate('msg'); | ||
| 282 | $template->add('BACK', 'the previous page'); | ||
| 283 | $template->add('MSG', 'I\'m sorry, that pending post doesn\'t exist.'); | ||
| 284 | } | ||
| 285 | } else if ($_GET['page'] == 'deletePending') | ||
| 286 | { | ||
| 287 | $getpending = "SELECT * FROM pending WHERE id = " . $_GET['id']; | ||
| 288 | $getpending2 = mysql_query($getpending); | ||
| 289 | $getpending3 = mysql_fetch_array($getpending2); | ||
| 290 | |||
| 291 | if ($getpending3['id'] == $_GET['id']) | ||
| 292 | { | ||
| 293 | if (!isset($_GET['submit'])) | ||
| 294 | { | ||
| 295 | $template = new FITemplate('admin/deletePending'); | ||
| 296 | $template->add('ID', $_GET['id']); | ||
| 297 | } else { | ||
| 298 | $delpending = "DELETE FROM pending WHERE id = " . $_GET['id']; | ||
| 299 | $delpending2 = mysql_query($delpending); | ||
| 300 | |||
| 301 | $template = new FITemplate('admin/deletedPending'); | ||
| 302 | } | ||
| 303 | } else { | ||
| 304 | $template = new FITemplate('msg'); | ||
| 305 | $template->add('BACK', 'the previous page'); | ||
| 306 | $template->add('MSG', 'I\'m sorry, that pending post doesn\'t exist.'); | ||
| 307 | } | ||
| 308 | } else if ($_GET['page'] == 'viewPending') | ||
| 309 | { | ||
| 310 | $getpending = "SELECT * FROM pending WHERE id = " . $_GET['id']; | ||
| 311 | $getpending2 = mysql_query($getpending); | ||
| 312 | $getpending3 = mysql_fetch_array($getpending2); | ||
| 313 | |||
| 314 | if ($getpending3['id'] == $_GET['id']) | ||
| 315 | { | ||
| 316 | $template = new FITemplate('post'); | ||
| 317 | $template->adds_block('INTERNAL',array('exi'=>1)); | ||
| 318 | $template->adds_block('POST', array( 'ID' => $getpending3['id'], | ||
| 319 | 'YEARID' => ((date('Y')-2006) % 4), | ||
| 320 | 'DATE' => date('F dS Y \a\\t g:i:s a'), | ||
| 321 | 'MONTH' => date('M'), | ||
| 322 | 'DAY' => date('d'), | ||
| 323 | 'CODED' => $getpending3['slug'], | ||
| 324 | 'TITLE' => $getpending3['title'], | ||
| 325 | 'AUTHOR' => $getpending3['author'], | ||
| 326 | 'TAG1' => $getpending3['tag1'], | ||
| 327 | 'TAG2' => $getpending3['tag2'], | ||
| 328 | 'TAG3' => $getpending3['tag3'], | ||
| 329 | 'RATING' => 0, | ||
| 330 | 'TEXT' => parseBBCode($getpending3['text']))); | ||
| 331 | } else { | ||
| 332 | $template = new FITemplate('msg'); | ||
| 333 | $template->add('BACK', 'the previous page'); | ||
| 334 | $template->add('MSG', 'I\'m sorry, that pending post doesn\'t exist.'); | ||
| 335 | } | ||
| 336 | } else if ($_GET['page'] == 'managePosts') | ||
| 337 | { | ||
| 338 | $template = new FITemplate('admin/managePosts'); | ||
| 339 | |||
| 340 | $getposts = "SELECT * FROM updates ORDER BY id ASC"; | ||
| 341 | $getposts2 = mysql_query($getposts); | ||
| 342 | $i=0; | ||
| 343 | while ($getposts3[$i] = mysql_fetch_array($getposts2)) | ||
| 344 | { | ||
| 345 | $template->adds_block('POST', array( 'TITLE' => $getposts3[$i]['title'], | ||
| 346 | 'AUTHOR' => $getposts3[$i]['author'], | ||
| 347 | 'ID' => $getposts3[$i]['id'], | ||
| 348 | 'CODED' => $getposts3[$i]['slug'])); | ||
| 349 | $i++; | ||
| 350 | } | ||
| 351 | } else if ($_GET['page'] == 'editPost') | ||
| 352 | { | ||
| 353 | $getpost = "SELECT * FROM updates WHERE id = " . $_GET['id']; | ||
| 354 | $getpost2 = mysql_query($getpost); | ||
| 355 | $getpost3 = mysql_fetch_array($getpost2); | ||
| 356 | |||
| 357 | if ($getpost3['id'] == $_GET['id']) | ||
| 358 | { | ||
| 359 | if (!isset($_GET['submit'])) | ||
| 360 | { | ||
| 361 | $template = new FITemplate('admin/editPost'); | ||
| 362 | $template->add('ID', $_GET['id']); | ||
| 363 | $template->add('TEXT', $getpost3['text']); | ||
| 364 | $template->add('TAG1', $getpost3['tag1']); | ||
| 365 | $template->add('TAG2', $getpost3['tag2']); | ||
| 366 | $template->add('TAG3', $getpost3['tag3']); | ||
| 367 | $template->add('TITLE', $getpost3['title']); | ||
| 368 | } else { | ||
| 369 | $setpost = "UPDATE updates SET title = \"" . addslashes($_POST['title']) . "\", text = \"" . addslashes($_POST['text']) . "\", tag1 = \"" . $_POST['tag1'] . "\", tag2 = \"" . $_POST['tag2'] . "\", tag3 = \"" . $_POST['tag3'] . "\" WHERE id = " . $_GET['id']; | ||
| 370 | $setpost2 = mysql_query($setpost); | ||
| 371 | |||
| 372 | $template = new FITemplate('admin/postSuccess'); | ||
| 373 | $template->add('ID', $_GET['id']); | ||
| 374 | $template->add('CODED', $getpost3['slug']); | ||
| 375 | } | ||
| 376 | } else { | ||
| 377 | $template = new FITemplate('msg'); | ||
| 378 | $template->add('BACK', 'the previous page'); | ||
| 379 | $template->add('MSG', 'I\'m sorry, that post doesn\'t exist.'); | ||
| 380 | } | ||
| 381 | } else if ($_GET['page'] == 'deletePost') | ||
| 382 | { | ||
| 383 | $getpost = "SELECT * FROM updates WHERE id = " . $_GET['id']; | ||
| 384 | $getpost2 = mysql_query($getpost); | ||
| 385 | $getpost3 = mysql_fetch_array($getpost2); | ||
| 386 | |||
| 387 | if ($getpost3['id'] == $_GET['id']) | ||
| 388 | { | ||
| 389 | if (!isset($_GET['submit'])) | ||
| 390 | { | ||
| 391 | $template = new FITemplate('admin/deletePost'); | ||
| 392 | $template->add('ID', $_GET['id']); | ||
| 393 | } else { | ||
| 394 | $delpost = "DELETE FROM updates WHERE id = " . $_GET['id']; | ||
| 395 | $delpost2 = mysql_query($delpost); | ||
| 396 | |||
| 397 | $template = new FITemplate('admin/deletedPost'); | ||
| 398 | } | ||
| 399 | } else { | ||
| 400 | $template = new FITemplate('msg'); | ||
| 401 | $template->add('BACK', 'the previous page'); | ||
| 402 | $template->add('MSG', 'I\'m sorry, that post doesn\'t exist.'); | ||
| 403 | } | ||
| 404 | } else if ($_GET['page'] == 'moderateComments') | ||
| 405 | { | ||
| 406 | $template = new FITemplate('admin/moderateComments'); | ||
| 407 | |||
| 408 | $getcomments = "SELECT * FROM moderation ORDER BY id ASC"; | ||
| 409 | $getcomments2 = mysql_query($getcomments); | ||
| 410 | $i=0; | ||
| 411 | while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) | ||
| 412 | { | ||
| 413 | $comType = substr($getcomments3[$i]['page_id'],0,strpos($getcomments3[$i]['page_id'],'-')); | ||
| 414 | $comID = substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); | ||
| 415 | |||
| 416 | if ($comType == 'updates') | ||
| 417 | { | ||
| 418 | $getpost = "SELECT * FROM updates WHERE id = " . $comID; | ||
| 419 | $getpost2 = mysql_query($getpost); | ||
| 420 | $getpost3 = mysql_fetch_array($getpost2); | ||
| 421 | $title = $getpost3['title']; | ||
| 422 | } else if ($comType = 'polloftheweek') | ||
| 423 | { | ||
| 424 | $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $comID; | ||
| 425 | $getpoll2 = mysql_query($getpoll); | ||
| 426 | $getpoll3 = mysql_fetch_array($getpoll2); | ||
| 427 | $title = $getpoll3['question']; | ||
| 428 | } else if ($comType = 'quotes') | ||
| 429 | { | ||
| 430 | $getquote = "SELECT * FROM rash_quotes WHERE id = " . $comID; | ||
| 431 | $getquote2 = mysql_query($getquote); | ||
| 432 | $getquote3 = mysql_fetch_array($getquote2); | ||
| 433 | $title = '#' . $getquote3['id']; | ||
| 434 | } | ||
| 435 | |||
| 436 | $template->adds_block('COMMENT', array( 'TITLE' => $title, | ||
| 437 | 'AUTHOR' => $getcomments3[$i]['author'], | ||
| 438 | 'ID' => $getcomments3[$i]['id'])); | ||
| 439 | $i++; | ||
| 440 | } | ||
| 441 | } else if ($_GET['page'] == 'viewComment') | ||
| 442 | { | ||
| 443 | $getcomment = "SELECT * FROM moderation WHERE id = " . $_GET['id']; | ||
| 444 | $getcomment2 = mysql_query($getcomment); | ||
| 445 | $getcomment3 = mysql_fetch_array($getcomment2); | ||
| 446 | |||
| 447 | if ($getcomment3['id'] == $_GET['id']) | ||
| 448 | { | ||
| 449 | $getuser = "SELECT * FROM users WHERE username = \"" . $getcomment3['author'] . "\""; | ||
| 450 | $getuser2 = mysql_query($getuser); | ||
| 451 | $getuser3 = mysql_fetch_array($getuser2); | ||
| 452 | |||
| 453 | $template = new FITemplate('admin/viewComment'); | ||
| 454 | $template->add('ID', $_GET['id']); | ||
| 455 | $template->add('USERNAME', $getcomment3['author']); | ||
| 456 | $template->add('CODEDEMAIL', md5(strtolower($getuser3['email']))); | ||
| 457 | $template->add('TEXT', parseBBCode($getcomment3['comment'])); | ||
| 458 | $template->add('DATE', date("F dS Y \a\\t g:i:s a",strtotime($getcomment3['pubDate']))); | ||
| 459 | $template->add('CODEDDEF',urlencode('http://www.fourisland.com/images/error404.png')); | ||
| 460 | } else { | ||
| 461 | $template = new FITemplate('msg'); | ||
| 462 | $template->add('BACK', 'the previous page'); | ||
| 463 | $template->add('MSG', 'I\'m sorry, that comment doesn\'t exist.'); | ||
| 464 | } | ||
| 465 | } else if ($_GET['page'] == 'actionComment') | ||
| 466 | { | ||
| 467 | $getcomment = "SELECT * FROM moderation WHERE id = " . $_GET['id']; | ||
| 468 | $getcomment2 = mysql_query($getcomment); | ||
| 469 | $getcomment3 = mysql_fetch_array($getcomment2); | ||
| 470 | |||
| 471 | if ($getcomment3['id'] == $_GET['id']) | ||
| 472 | { | ||
| 473 | if (isset($_GET['approve'])) | ||
| 474 | { | ||
| 475 | $insanon = "INSERT INTO anon_commenters (username,email,website) VALUES (\"" . $getcomment3['author'] . "\",\"" . $getcomment3['email'] . "\",\"" . $getcomment3['website'] . "\")"; | ||
| 476 | $insanon2 = mysql_query($insanon); | ||
| 477 | |||
| 478 | $inscomment = "INSERT INTO comments (page_id,username,comment) VALUES (\"" . $getcomment3['page_id'] . "\",\"" . $getcomment3['author'] . "\",\"" . $getcomment3['comment'] . "\")"; | ||
| 479 | $inscomment2 = mysql_query($inscomment); | ||
| 480 | |||
| 481 | $delcomment = "DELETE FROM moderation WHERE id = " . $getcomment3['id']; | ||
| 482 | $delcomment2 = mysql_query($delcomment); | ||
| 483 | |||
| 484 | $template = new FITemplate('msg'); | ||
| 485 | $template->add('BACK', 'Comment Moderation'); | ||
| 486 | $template->add('MSG', 'You\'ve successfully approved this comment.'); | ||
| 487 | } else if (isset($_GET['deny'])) | ||
| 488 | { | ||
| 489 | $delcomment = "DELETE FROM moderation WHERE id = " . $getcomment3['id']; | ||
| 490 | $delcomment2 = mysql_query($delcomment); | ||
| 491 | |||
| 492 | $template = new FITemplate('msg'); | ||
| 493 | $template->add('BACK', 'Comment Moderation'); | ||
| 494 | $template->add('MSG', 'You\'ve successfully denied this comment.'); | ||
| 495 | } else { | ||
| 496 | $template = new FITemplate('msg'); | ||
| 497 | $template->add('BACK', 'the previous page'); | ||
| 498 | $template->add('MSG', "Um, what on earth are you doing?"); | ||
| 499 | } | ||
| 500 | } else { | ||
| 501 | $template = new FITemplate('msg'); | ||
| 502 | $template->add('BACK', 'the previous page'); | ||
| 503 | $template->add('MSG', 'I\'m sorry, that comment doesn\'t exist.'); | ||
| 504 | } | ||
| 505 | } else if ($_GET['page'] == 'managePages') | ||
| 506 | { | ||
| 507 | $template = new FITemplate('admin/managePages'); | ||
| 508 | |||
| 509 | $getpages = "SELECT wiki_pages.*, wiki_revisions.author FROM wiki_pages, wiki_revisions WHERE wiki_revisions.id = wiki_pages.revision ORDER BY id ASC"; | ||
| 510 | $getpages2 = mysql_query($getpages); | ||
| 511 | $i=0; $template = new FITemplate('msg'); | ||
| 512 | $template->add('BACK', 'the previous page'); | ||
| 513 | $template->add('MSG', 'I\'m sorry, but this page doesn\'t exist.'); | ||
| 514 | while ($getpages3[$i] = mysql_fetch_array($getpages2)) | ||
| 515 | { | ||
| 516 | $template->adds_block('PAGE', array( 'TITLE' => $getpages3[$i]['title'], | ||
| 517 | 'AUTHOR' => $getpages3[$i]['author'], | ||
| 518 | 'ID' => $getpages3[$i]['id'], | ||
| 519 | 'CODED' => $getpages3[$i]['slug'])); | ||
| 520 | $i++; | ||
| 521 | } | ||
| 522 | } else if ($_GET['page'] == 'pageHistory') | ||
| 523 | { | ||
| 524 | $getpage = "SELECT * FROM wiki_pages WHERE id = " . $_GET['id'] . " ORDER BY id ASC"; | ||
| 525 | $getpage2 = mysql_query($getpage); | ||
| 526 | $getpage3 = mysql_fetch_array($getpage2); | ||
| 527 | |||
| 528 | if ($getpage3['id'] == $_GET['id']) | ||
| 529 | { | ||
| 530 | $template = new FITemplate('admin/pageHistory'); | ||
| 531 | |||
| 532 | $getrev = "SELECT * FROM wiki_revisions WHERE id = " . $getpage3['revision']; | ||
| 533 | $getrev2 = mysql_query($getrev); | ||
| 534 | $getrev3 = mysql_fetch_array($getrev2); | ||
| 535 | |||
| 536 | $template->adds_block('REV', array( 'AUTHOR' => $getrev3['author'], | ||
| 537 | 'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getrev3['pubDate'])), | ||
| 538 | 'ID' => $getrev3['id'])); | ||
| 539 | |||
| 540 | while ($getrev3['previous'] != 0) | ||
| 541 | { | ||
| 542 | $getrev = "SELECT * FROM wiki_revisions WHERE id = " . $getrev3['previous']; | ||
| 543 | $getrev2 = mysql_query($getrev); | ||
| 544 | $getrev3 = mysql_fetch_array($getrev2); | ||
| 545 | |||
| 546 | $template->adds_block('REV', array( 'AUTHOR' => $getrev3['author'], | ||
| 547 | 'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getrev3['pubDate'])), | ||
| 548 | 'ID' => $getrev3['id'])); | ||
| 549 | } | ||
| 550 | } else { | ||
| 551 | $template = new FITemplate('msg'); | ||
| 552 | $template->add('BACK', 'the previous page'); | ||
| 553 | $template->add('MSG', 'I\'m sorry, but this page doesn\'t exist.'); | ||
| 554 | } | ||
| 555 | } else if ($_GET['page'] == 'viewRevision') | ||
| 556 | { | ||
| 557 | $getrev = "SELECT * FROM wiki_revisions WHERE id = " . $_GET['id']; | ||
| 558 | $getrev2 = mysql_query($getrev); | ||
| 559 | $getrev3 = mysql_fetch_array($getrev2); | ||
| 560 | |||
| 561 | if ($getrev3['id'] == $_GET['id']) | ||
| 562 | { | ||
| 563 | $template = new FITemplate('admin/viewRevision'); | ||
| 564 | $template->add('TEXT', $getrev3['text']); | ||
| 565 | } else { | ||
| 566 | $template = new FITemplate('msg'); | ||
| 567 | $template->add('BACK', 'the previous page'); | ||
| 568 | $template->add('MSG', 'I\'m sorry, but this revision doesn\'t exist.'); | ||
| 569 | } | ||
| 570 | } else if ($_GET['page'] == 'pollProcess') | ||
| 571 | { | ||
| 572 | if (!isset($_GET['step'])) | ||
| 573 | { | ||
| 574 | $template = new FITemplate('admin/pollrss'); | ||
| 575 | } else if ($_GET['step'] == 2) | ||
| 576 | { | ||
| 577 | $insrss = "INSERT INTO pollrss (author,rss) VALUES (\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\")"; | ||
| 578 | $insrss2 = mysql_query($insrss); | ||
| 579 | |||
| 580 | $template = new FITemplate('admin/newPoll'); | ||
| 581 | } else if ($_GET['step'] == 3) | ||
| 582 | { | ||
| 583 | $inspoll = "INSERT INTO polloftheweek (question,option1,option2,option3,option4) VALUES (\"" . addslashes($_POST['question']) . "\",\"" . $_POST['option1'] . "\",\"" . $_POST['option2'] . "\",\"" . $_POST['option3'] . "\",\"" . $_POST['option4'] . "\")"; | ||
| 584 | $inspoll2 = mysql_query($inspoll); | ||
| 585 | |||
| 586 | $cleardid = "TRUNCATE TABLE didpollalready"; | ||
| 587 | $cleardid2 = mysql_query($cleardid); | ||
| 588 | |||
| 589 | $template = new FITemplate('msg2'); | ||
| 590 | $template->add('BACK', 'Back to the Admin Panel'); | ||
| 591 | $template->add('LINK', '/admin/'); | ||
| 592 | $template->add('MSG', "You've successfully created a poll!"); | ||
| 593 | } else { | ||
| 594 | $template = new FITemplate('msg'); | ||
| 595 | $template->add('BACK', 'the previous page'); | ||
| 596 | $template->add('MSG', "Um, what on earth are you doing?"); | ||
| 597 | } | ||
| 598 | } else if ($_GET['page'] == 'managePendingQuotes') | ||
| 599 | { | ||
| 600 | $template = new FITemplate('admin/managePendingQuotes'); | ||
| 601 | |||
| 602 | $getpending = "SELECT * FROM rash_queue ORDER BY id ASC"; | ||
| 603 | $getpending2 = mysql_query($getpending); | ||
| 604 | $i=0; | ||
| 605 | while ($getpending3[$i] = mysql_fetch_array($getpending2)) | ||
| 606 | { | ||
| 607 | $template->adds_block('QUOTE', array( 'ID' => $getpending3[$i]['id'], | ||
| 608 | 'TEXT' => $getpending3[$i]['quote'])); | ||
| 609 | $i++; | ||
| 610 | } | ||
| 611 | } else if ($_GET['page'] == 'actionPendingQuotes') | ||
| 612 | { | ||
| 613 | $getpending = "SELECT * FROM rash_queue WHERE id = " . $_GET['id']; | ||
| 614 | $getpending2 = mysql_query($getpending); | ||
| 615 | $getpending3 = mysql_fetch_array($getpending2); | ||
| 616 | |||
| 617 | if ($getpending3['id'] == $_GET['id']) | ||
| 618 | { | ||
| 619 | if (isset($_GET['approve'])) | ||
| 620 | { | ||
| 621 | $insquote = "INSERT INTO rash_quotes (quote) VALUES (\"" . addslashes($getpending3['quote']) . "\")"; | ||
| 622 | $insquote2 = mysql_query($insquote); | ||
| 623 | |||
| 624 | $delpending = "DELETE FROM rash_queue WHERE id = " . $_GET['id']; | ||
| 625 | $delpending2 = mysql_query($delpending); | ||
| 626 | |||
| 627 | $template = new FITemplate('msg2'); | ||
| 628 | $template->add('BACK', 'Back to the Admin Panel'); | ||
| 629 | $template->add('LINK', '/admin/'); | ||
| 630 | $template->add('MSG', "You've successfully approved this quote."); | ||
| 631 | } else if (isset($_GET['deny'])) | ||
| 632 | { | ||
| 633 | $delpending = "DELETE FROM rash_queue WHERE id = " . $_GET['id']; | ||
| 634 | $delpending2 = mysql_query($delpending); | ||
| 635 | |||
| 636 | $template = new FITemplate('msg2'); | ||
| 637 | $template->add('BACK', 'Back to the Admin Panel'); | ||
| 638 | $template->add('LINK', '/admin/'); | ||
| 639 | $template->add('MSG', "You've successfully denied this quote."); | ||
| 640 | } else { | ||
| 641 | $template = new FITemplate('msg'); | ||
| 642 | $template->add('BACK', 'the previous page'); | ||
| 643 | $template->add('MSG', "Um, what on earth are you doing?"); | ||
| 644 | } | ||
| 645 | } else { | ||
| 646 | $template = new FITemplate('msg'); | ||
| 647 | $template->add('BACK', 'the previous page'); | ||
| 648 | $template->add('MSG', 'I\'m sorry, but this pending quote doesn\'t exist.'); | ||
| 649 | } | ||
| 650 | } else { | ||
| 651 | generateError(404); | ||
| 652 | } | ||
| 653 | @$template->display(); | ||
| 654 | } else { | ||
| 655 | generateError(404); | ||
| 656 | } | ||
| 657 | } else { | ||
| 658 | generateError(404); | ||
| 659 | } | ||
| 660 | |||
| 661 | ?> | ||
