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.

add_alias.php 894B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. #declare(strict_types=1);
  3. authorize();
  4. if (!isset($_POST['article']) || !is_number($_POST['article'])) {
  5. error(0);
  6. }
  7. $ArticleID = (int)$_POST['article'];
  8. $DB->query("SELECT MinClassEdit FROM wiki_articles WHERE ID = $ArticleID");
  9. list($MinClassEdit) = $DB->next_record();
  10. if ($MinClassEdit > $LoggedUser['EffectiveClass']) {
  11. error(403);
  12. }
  13. $NewAlias = Wiki::normalize_alias($_POST['alias']);
  14. $Dupe = Wiki::alias_to_id($_POST['alias']);
  15. if ($NewAlias !== '' && $NewAlias!== 'addalias' && $Dupe === false) { // Not null, and not dupe
  16. $DB->query("INSERT INTO wiki_aliases (Alias, UserID, ArticleID) VALUES ('$NewAlias', '$LoggedUser[ID]', '$ArticleID')");
  17. } else {
  18. error('The alias you attempted to add was either null or already in the database.');
  19. }
  20. Wiki::flush_aliases();
  21. Wiki::flush_article($ArticleID);
  22. header('Location: wiki.php?action=article&id='.$ArticleID);