mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-13 02:46:30 +00:00
41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?
|
|
include(SERVER_ROOT . '/classes/class_text.php');
|
|
include(SERVER_ROOT . '/classes/class_alias.php');
|
|
$Text = new TEXT(true);
|
|
$Alias = new ALIAS;
|
|
|
|
|
|
if (!empty($_GET['id']) && is_number($_GET['id'])) { //Visiting article via ID
|
|
$ArticleID = $_GET['id'];
|
|
} elseif ($_GET['name'] != '') { //Retrieve article ID via alias.
|
|
$ArticleID = $Alias->to_id($_GET['name']);
|
|
} else {
|
|
json_die("failure");
|
|
}
|
|
|
|
if (!$ArticleID) { //No article found
|
|
json_die("failure", "article not found");
|
|
}
|
|
$Article = $Alias->article($ArticleID, false);
|
|
|
|
if (!$Article) {
|
|
json_die("failure", "article not found");
|
|
}
|
|
list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName, $Aliases, $UserIDs) = array_shift($Article);
|
|
if ($Read > $LoggedUser['EffectiveClass']) {
|
|
json_die("failure", "higher user class required to view article");
|
|
}
|
|
|
|
$TextBody = $Text->full_format($Body, false);
|
|
|
|
json_die("success", array(
|
|
'title' => $Title,
|
|
'bbBody' => $Body,
|
|
'body' => $TextBody,
|
|
'aliases' => $Aliases,
|
|
'authorID' => (int) $AuthorID,
|
|
'authorName' => $AuthorName,
|
|
'date' => $Date,
|
|
'revision' => (int) $Revision
|
|
));
|
|
?>
|