Oppaitime's version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

delete.php 762B

12345678910111213141516171819202122232425262728293031323334
  1. <?
  2. if (!check_perms('admin_manage_wiki')) {
  3. error(403);
  4. }
  5. if (!isset($_GET['id']) || !is_number($_GET['id'])) {
  6. error(404);
  7. }
  8. $ID = (int)$_GET['id'];
  9. if ($ID == INDEX_ARTICLE) {
  10. error('You cannot delete the main wiki article.');
  11. }
  12. $DB->query("
  13. SELECT Title
  14. FROM wiki_articles
  15. WHERE ID = $ID");
  16. if (!$DB->has_results()) {
  17. error(404);
  18. }
  19. list($Title) = $DB->next_record(MYSQLI_NUM, false);
  20. //Log
  21. Misc::write_log("Wiki article $ID ($Title) was deleted by ".$LoggedUser['Username']);
  22. //Delete
  23. $DB->query("DELETE FROM wiki_articles WHERE ID = $ID");
  24. $DB->query("DELETE FROM wiki_aliases WHERE ArticleID = $ID");
  25. $DB->query("DELETE FROM wiki_revisions WHERE ID = $ID");
  26. Wiki::flush_aliases();
  27. Wiki::flush_article($ID);
  28. header("location: wiki.php");