Gazelle/sections/wiki/article.php

140 lines
5.1 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
2013-12-12 08:01:01 +00:00
Text::$TOC = true;
2011-03-28 14:21:28 +00:00
2013-04-20 08:01:01 +00:00
if (!empty($_GET['id']) && is_number($_GET['id'])) { //Visiting article via ID
2011-03-28 14:21:28 +00:00
$ArticleID = $_GET['id'];
} elseif ($_GET['name'] != '') { //Retrieve article ID via alias.
$ArticleID = $Alias->to_id($_GET['name']);
} else { //No ID, No Name
//error(404);
error('Unknown article ['.display_str($_GET['id']).']');
}
2013-04-20 08:01:01 +00:00
if (!$ArticleID) { //No article found
2012-10-11 08:00:15 +00:00
View::show_header('No article found');
2011-03-28 14:21:28 +00:00
?>
<div class="thin">
2012-08-19 08:00:19 +00:00
<div class="header">
<h2>No article found</h2>
</div>
2013-04-20 08:01:01 +00:00
<div class="box pad" style="padding: 10px 10px 10px 20px;">
2011-03-28 14:21:28 +00:00
There is no article matching the name you requested.
<ul>
<li><a href="wiki.php?action=search&amp;search=<?=display_str($_GET['name'])?>">Search</a> for an article similar to this.</li>
<li><a href="wiki.php?action=link&amp;alias=<?=display_str($Alias->convert($_GET['name']))?>">Link</a> this to an existing article.</li>
<li><a href="wiki.php?action=create&amp;alias=<?=display_str($Alias->convert($_GET['name']))?>">Create</a> an article in its place.</li>
</ul>
</div>
</div>
<?
2012-10-11 08:00:15 +00:00
View::show_footer();
2011-03-28 14:21:28 +00:00
die();
}
$Article = $Alias->article($ArticleID);
list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName, $Aliases, $UserIDs) = array_shift($Article);
2013-04-20 08:01:01 +00:00
if ($Read > $LoggedUser['EffectiveClass']) {
error('You must be a higher user class to view this wiki article');
}
2011-03-28 14:21:28 +00:00
2013-12-12 08:01:01 +00:00
$TextBody = Text::full_format($Body, false);
$TOC = Text::parse_toc(0);
2012-10-27 08:00:09 +00:00
2012-10-11 08:00:15 +00:00
View::show_header($Title,'wiki,bbcode');
2011-03-28 14:21:28 +00:00
?>
<div class="thin">
2012-08-19 08:00:19 +00:00
<div class="header">
<h2><?=$Title?></h2>
2013-02-11 08:00:34 +00:00
<div class="linkbox">
2013-01-24 08:00:24 +00:00
<a href="wiki.php?action=create" class="brackets">Create</a>
<a href="wiki.php?action=edit&amp;id=<?=$ArticleID?>" class="brackets">Contribute</a>
<a href="wiki.php?action=revisions&amp;id=<?=$ArticleID?>" class="brackets">History</a>
2013-04-20 08:01:01 +00:00
<? if (check_perms('admin_manage_wiki') && $_GET['id'] != '136') { ?>
2013-01-24 08:00:24 +00:00
<a href="wiki.php?action=delete&amp;id=<?=$ArticleID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>" class="brackets" onclick="return confirm('Are you sure you want to delete?\nYes, DELETE, not as in \'Oh hey, if this is wrong we can get someone to magically undelete it for us later\' it will be GONE.\nGiven this new information, do you still want to DELETE this article and all its revisions and all its alias\' and act like it never existed?')">Delete</a>
2011-03-28 14:21:28 +00:00
<? } ?>
2013-01-24 08:00:24 +00:00
<!--<a href="reports.php?action=submit&amp;type=wiki&amp;article=<?=$ArticleID ?>" class="brackets">Report</a>-->
2012-08-19 08:00:19 +00:00
</div>
2011-03-28 14:21:28 +00:00
</div>
<div class="sidebar">
2012-10-27 08:00:09 +00:00
<div class="box">
2013-02-24 08:00:18 +00:00
<div class="head">Search</div>
<div class="pad">
2012-09-15 08:00:25 +00:00
<form class="search_form" name="articles" action="wiki.php" method="get">
2011-03-28 14:21:28 +00:00
<input type="hidden" name="action" value="search" />
2012-10-27 08:00:09 +00:00
<input
2013-08-28 23:08:41 +00:00
onfocus="if (this.value == 'Search articles') { this.value = ''; }"
onblur="if (this.value == '') { this.value = 'Search articles'; }"
2013-06-07 08:00:54 +00:00
value="Search articles" type="text" name="search" size="20"
2011-03-28 14:21:28 +00:00
/>
<input value="Search" type="submit" class="hidden" />
</form>
2013-04-30 18:18:07 +00:00
<br style="line-height: 10px;" />
2013-06-07 08:00:54 +00:00
<a href="wiki.php?action=browse" class="brackets">Browse articles</a>
2011-03-28 14:21:28 +00:00
</div>
2013-02-24 08:00:18 +00:00
</div>
<div class="box">
<div class="head">Table of Contents</div>
<div class="body">
<?=$TOC?>
</div>
</div>
2012-08-17 08:00:13 +00:00
<div class="box box_info pad">
2011-03-28 14:21:28 +00:00
<ul>
<li>
<strong>Protection:</strong>
<ul>
<li>Read: <?=$ClassLevels[$Read]['Name']?></li>
<li>Edit: <?=$ClassLevels[$Edit]['Name']?></li>
</ul>
</li>
<li>
<strong>Details:</strong>
<ul>
<li>Version: r<?=$Revision?></li>
2012-10-11 08:00:15 +00:00
<li>Last edited by: <?=Users::format_username($AuthorID, false, false, false)?></li>
2011-03-28 14:21:28 +00:00
<li>Last updated: <?=time_diff($Date)?></li>
</ul>
</li>
<li>
<strong>Aliases:</strong>
<ul>
2013-04-20 08:01:01 +00:00
<? if ($Aliases != $Title) {
2011-03-28 14:21:28 +00:00
$AliasArray = explode(',', $Aliases);
$UserArray = explode(',', $UserIDs);
$i = 0;
2013-04-20 08:01:01 +00:00
foreach ($AliasArray as $AliasItem) {
2011-03-28 14:21:28 +00:00
?>
2013-08-28 23:08:41 +00:00
<li id="alias_<?=$AliasItem?>"><a href="wiki.php?action=article&amp;name=<?=$AliasItem?>"><?=Format::cut_string($AliasItem, 20, 1)?></a><? if (check_perms('admin_manage_wiki')) { ?> <a href="#" onclick="Remove_Alias('<?=$AliasItem?>'); return false;" class="brackets tooltip" title="Delete alias">X</a> <a href="user.php?id=<?=$UserArray[$i]?>" class="brackets tooltip" title="View user">U</a><? } ?></li>
2011-03-28 14:21:28 +00:00
<? $i++;
2012-10-27 08:00:09 +00:00
}
2011-03-28 14:21:28 +00:00
}
?>
</ul>
</li>
</ul>
</div>
2013-04-20 08:01:01 +00:00
<? if ($Edit <= $LoggedUser['EffectiveClass']) { ?>
2012-08-17 08:00:13 +00:00
<div class="box box_addalias">
2013-04-20 08:01:01 +00:00
<div style="padding: 5px;">
2012-09-15 08:00:25 +00:00
<form class="add_form" name="aliases" action="wiki.php" method="post">
2011-03-28 14:21:28 +00:00
<input type="hidden" name="action" value="add_alias" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="article" value="<?=$ArticleID?>" />
<input
2013-06-07 08:00:54 +00:00
onfocus="if (this.value == 'Add alias') this.value='';"
onblur="if (this.value == '') this.value='Add alias';"
value="Add alias" type="text" name="alias" size="20"
2011-03-28 14:21:28 +00:00
/>
<input type="submit" value="+" />
</form>
</div>
</div>
<? } ?>
</div>
<div class="main_column">
2013-11-10 08:00:49 +00:00
<div class="box wiki_article">
2012-10-27 08:00:09 +00:00
<div class="pad"><?=$TextBody?></div>
2011-03-28 14:21:28 +00:00
</div>
</div>
</div>
2012-10-11 08:00:15 +00:00
<? View::show_footer(); ?>