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.

wiki.php 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. #declare(strict_types=1);
  3. if (!empty($_GET['id']) && is_number($_GET['id'])) {
  4. // Visiting article via ID
  5. $ArticleID = $_GET['id'];
  6. } elseif ($_GET['name'] !== '') {
  7. // Retrieve article ID via alias
  8. $ArticleID = Wiki::alias_to_id($_GET['name']);
  9. } else {
  10. json_die('failure');
  11. }
  12. // No article found
  13. if (!$ArticleID) {
  14. json_die('failure', 'article not found');
  15. }
  16. $Article = Wiki::get_article($ArticleID, false);
  17. if (!$Article) {
  18. json_die('failure', 'article not found');
  19. }
  20. list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName, $Aliases, $UserIDs) = array_shift($Article);
  21. if ($Read > $LoggedUser['EffectiveClass']) {
  22. json_die('failure', 'higher user class required to view article');
  23. }
  24. Text::$TOC = true;
  25. $TextBody = Text::full_format($Body, false);
  26. json_die('success', array(
  27. 'title' => $Title,
  28. 'bbBody' => $Body,
  29. 'body' => $TextBody,
  30. 'aliases' => $Aliases,
  31. 'authorID' => (int) $AuthorID,
  32. 'authorName' => $AuthorName,
  33. 'date' => $Date,
  34. 'revision' => (int) $Revision
  35. ));