BioTorrents.de’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 805B

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