Gazelle/sections/forums/main.php

90 lines
3.1 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
2013-08-28 23:08:41 +00:00
$LastRead = Forums::get_last_read($Forums);
2012-10-11 08:00:15 +00:00
View::show_header('Forums');
2011-03-28 14:21:28 +00:00
?>
<div class="thin">
<h2>Forums</h2>
2013-02-18 08:00:22 +00:00
<div class="forum_list">
2011-03-28 14:21:28 +00:00
<?
$Row = 'a';
2013-05-05 08:00:31 +00:00
$LastCategoryID = 0;
2011-03-28 14:21:28 +00:00
$OpenTable = false;
foreach ($Forums as $Forum) {
2012-03-28 08:00:20 +00:00
list($ForumID, $CategoryID, $ForumName, $ForumDescription, $MinRead, $MinWrite, $MinCreate, $NumTopics, $NumPosts, $LastPostID, $LastAuthorID, $LastTopicID, $LastTime, $SpecificRules, $LastTopic, $Locked, $Sticky) = array_values($Forum);
2013-08-28 23:08:41 +00:00
if (!Forums::check_forumperm($ForumID)) {
2011-03-28 14:21:28 +00:00
continue;
}
2013-08-28 23:08:41 +00:00
if ($ForumID == DONOR_FORUM) {
$ForumDescription = Donations::get_forum_description();
}
$Tooltip = $ForumID == DONOR_FORUM ? 'tooltip_gold' : 'tooltip';
$Row = $Row === 'a' ? 'b' : 'a';
2011-03-28 14:21:28 +00:00
$ForumDescription = display_str($ForumDescription);
2013-04-13 08:00:19 +00:00
if ($CategoryID != $LastCategoryID) {
2012-02-13 08:00:23 +00:00
$Row = 'b';
2013-04-13 08:00:19 +00:00
$LastCategoryID = $CategoryID;
if ($OpenTable) { ?>
2011-03-28 14:21:28 +00:00
</table>
<? } ?>
<h3><?=$ForumCats[$CategoryID]?></h3>
<table class="forum_index">
<tr class="colhead">
2013-04-30 18:18:07 +00:00
<td style="width: 2%;"></td>
<td style="width: 25%;">Forum</td>
2013-02-18 08:00:22 +00:00
<td>Last post</td>
2013-04-30 18:18:07 +00:00
<td style="width: 7%;">Topics</td>
<td style="width: 7%;">Posts</td>
2011-03-28 14:21:28 +00:00
</tr>
<?
$OpenTable = true;
}
2013-08-28 23:08:41 +00:00
$Read = Forums::is_unread($Locked, $Sticky, $LastPostID, $LastRead, $LastTopicID, $LastTime) ? 'unread' : 'read';
2011-03-28 14:21:28 +00:00
/* Removed per request, as distracting
2013-05-05 08:00:31 +00:00
if ($Locked) {
2013-08-28 23:08:41 +00:00
$Read .= '_locked';
2013-05-05 08:00:31 +00:00
}
if ($Sticky) {
2013-08-28 23:08:41 +00:00
$Read .= '_sticky';
2013-05-05 08:00:31 +00:00
}
2011-03-28 14:21:28 +00:00
*/
?>
<tr class="row<?=$Row?>">
2013-08-28 23:08:41 +00:00
<td class="<?=$Read?> <?=$Tooltip?>" title="<?=ucfirst($Read)?>"></td>
2011-03-28 14:21:28 +00:00
<td>
<h4 class="min_padding">
2013-08-28 23:08:41 +00:00
<a class="<?=$Tooltip?>" href="forums.php?action=viewforum&amp;forumid=<?=$ForumID?>" title="<?=display_str($ForumDescription)?>"><?=display_str($ForumName)?></a>
2011-03-28 14:21:28 +00:00
</h4>
</td>
<? if ($NumPosts == 0) { ?>
2013-08-28 23:08:41 +00:00
<td>
There are no topics here.<?=(($MinCreate <= $LoggedUser['Class']) ? ' <a href="forums.php?action=new&amp;forumid='.$ForumID.'">Create one!</a>' : '')?>
2011-03-28 14:21:28 +00:00
</td>
2013-08-28 23:08:41 +00:00
<td class="number_column">0</td>
<td class="number_column">0</td>
2011-03-28 14:21:28 +00:00
<? } else { ?>
<td>
2013-04-13 08:00:19 +00:00
<span style="float: left;" class="last_topic">
2013-08-28 23:08:41 +00:00
<a href="forums.php?action=viewthread&amp;threadid=<?=$LastTopicID?>" class="tooltip" data-title-plain="<?=$LastTopic?>"><?=display_str(Format::cut_string($LastTopic, 50, 1))?></a>
2011-03-28 14:21:28 +00:00
</span>
<? if (!empty($LastRead[$LastTopicID])) { ?>
2013-08-28 23:08:41 +00:00
<span style="float: left;" class="<?=$Tooltip?> last_read" title="Jump to last read">
2011-03-28 14:21:28 +00:00
<a href="forums.php?action=viewthread&amp;threadid=<?=$LastTopicID?>&amp;page=<?=$LastRead[$LastTopicID]['Page']?>#post<?=$LastRead[$LastTopicID]['PostID']?>"></a>
</span>
<? } ?>
2013-06-04 08:00:34 +00:00
<span style="float: right;" class="last_poster">by <?=Users::format_username($LastAuthorID, false, false, false)?> <?=time_diff($LastTime, 1)?></span>
2011-03-28 14:21:28 +00:00
</td>
2013-08-28 23:08:41 +00:00
<td class="number_column"><?=number_format($NumTopics)?></td>
<td class="number_column"><?=number_format($NumPosts)?></td>
2011-03-28 14:21:28 +00:00
<? } ?>
</tr>
<? } ?>
</table>
2013-02-18 08:00:22 +00:00
</div>
<div class="linkbox"><a href="forums.php?action=catchup&amp;forumid=all&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Catch up</a></div>
2011-03-28 14:21:28 +00:00
</div>
2013-08-28 23:08:41 +00:00
<? View::show_footer(); ?>