Gazelle/sections/wiki/revisions.php

71 lines
1.9 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
2013-04-20 08:01:01 +00:00
if (!isset($_GET['id']) || !is_number($_GET['id'])) {
error(404);
}
2013-12-24 08:00:55 +00:00
$ArticleID = (int)$_GET['id'];
2011-03-28 14:21:28 +00:00
2013-12-24 08:00:55 +00:00
$Latest = Wiki::get_article($ArticleID);
2011-03-28 14:21:28 +00:00
list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName) = array_shift($Latest);
2013-04-20 08:01:01 +00:00
if ($Read > $LoggedUser['EffectiveClass']) {
error(404);
}
if ($Edit > $LoggedUser['EffectiveClass']) {
error(403);
}
2011-03-28 14:21:28 +00:00
2012-10-11 08:00:15 +00:00
View::show_header("Revisions of ".$Title);
2011-03-28 14:21:28 +00:00
?>
<div class="thin">
2012-08-19 08:00:19 +00:00
<div class="header">
2012-09-09 08:00:26 +00:00
<h2>Revision history for <a href="wiki.php?action=article&amp;id=<?=$ArticleID?>"><?=$Title?></a></h2>
2012-08-19 08:00:19 +00:00
</div>
2011-03-28 14:21:28 +00:00
<form action="wiki.php" method="get">
<input type="hidden" name="action" id="action" value="compare" />
<input type="hidden" name="id" id="id" value="<?=$ArticleID?>" />
<table>
<tr class="colhead">
<td>Revision</td>
<td>Title</td>
<td>Author</td>
<td>Age</td>
<td>Old</td>
<td>New</td>
</tr>
<tr>
<td><?=$Revision?></td>
<td><?=$Title?></td>
2012-10-11 08:00:15 +00:00
<td><?=Users::format_username($AuthorID, false, false, false)?></td>
2011-03-28 14:21:28 +00:00
<td><?=time_diff($Date)?></td>
2012-12-27 08:00:27 +00:00
<td><input type="radio" name="old" value="<?=$Revision?>" disabled="disabled" /></td>
<td><input type="radio" name="new" value="<?=$Revision?>" checked="checked" /></td>
2011-03-28 14:21:28 +00:00
</tr>
2013-02-22 08:00:24 +00:00
<?
2013-04-20 08:01:01 +00:00
$DB->query("
SELECT
2013-11-17 08:00:47 +00:00
Revision,
Title,
Author,
Date
FROM wiki_revisions
WHERE ID = '$ArticleID'
2011-03-28 14:21:28 +00:00
ORDER BY Revision DESC");
2013-04-20 08:01:01 +00:00
while (list($Revision, $Title, $AuthorID, $Date) = $DB->next_record()) { ?>
2011-03-28 14:21:28 +00:00
<tr>
<td><?=$Revision?></td>
<td><?=$Title?></td>
2012-10-11 08:00:15 +00:00
<td><?=Users::format_username($AuthorID, false, false, false)?></td>
2011-03-28 14:21:28 +00:00
<td><?=time_diff($Date)?></td>
<td><input type="radio" name="old" value="<?=$Revision?>" /></td>
<td><input type="radio" name="new" value="<?=$Revision?>" /></td>
</tr>
<? } ?>
<tr>
<td class="center" colspan="6">
<input type="submit" value="Compare" />
</td>
</tr>
</table>
</form>
</div>
2012-10-11 08:00:15 +00:00
<? View::show_footer(); ?>