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.0KB

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