95 lines
2.9 KiB
PHP
95 lines
2.9 KiB
PHP
<?php
|
|
require_once("include/globals.php");
|
|
|
|
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
|
header("Location: /");
|
|
exit();
|
|
}
|
|
|
|
|
|
|
|
echo("<br>\n");
|
|
$message_width = $default_data_width;
|
|
include "form.messages.php";
|
|
|
|
|
|
?>
|
|
<center>
|
|
<table width='<?php echo($default_data_width) ?>' cellpadding='10' cellspacing='1' border='0' class='big-content-table'>
|
|
<tr class='heading'>
|
|
<td width='60%'>Forum</td>
|
|
<td align='center'>Topics</td>
|
|
<td align='center'>Posts</td>
|
|
<td width='20%'>Last Post</td>
|
|
</tr>
|
|
<?php
|
|
$count = 0;
|
|
while ($row = db_fetch_array($results)) {
|
|
extract($row);
|
|
|
|
$bgclass = 'data-even';
|
|
if ($count % 2) $bgclass = 'data-odd';
|
|
$count++;
|
|
|
|
// Get last post info
|
|
$last_posted_by = "";
|
|
$last_post = "No Posts";
|
|
|
|
// Get last post data
|
|
$query = "select posted_by,posted_time from forum_threads " .
|
|
"where school_num = $school_num " .
|
|
"and forum_num = $record_num " .
|
|
"order by posted_time desc " .
|
|
"limit 0,1";
|
|
$result = db_query($query);
|
|
if (db_num_rows($result)) {
|
|
$row = db_fetch_array($result);
|
|
$last_post = date("D M jS @ g:ia",$row['posted_time']);
|
|
$user_num = $row['posted_by'];
|
|
$query = "select userid from users " .
|
|
"where school_num = $base_school_num " .
|
|
"and record_num = $user_num";
|
|
$last_posted_by = "posted by :: " . db_getVal($query);
|
|
}
|
|
|
|
// Update the posts and topics counts for this forum
|
|
$query = "select count(*) from forum_threads " .
|
|
"where school_num = $school_num " .
|
|
"and forum_num = $record_num " .
|
|
"and top_thread_id = 0";
|
|
$total_topics = db_getVal($query);
|
|
|
|
$query = "select count(*) from forum_threads " .
|
|
"where school_num = $school_num " .
|
|
"and forum_num = $record_num";
|
|
$total_posts = db_getVal($query);
|
|
|
|
$query = "update forums " .
|
|
"set topics = $total_topics, posts = $total_posts " .
|
|
"where school_num = $school_num " .
|
|
"and record_num = $record_num";
|
|
db_query($query);
|
|
|
|
?>
|
|
<tr class='<?php echo($bgclass) ?>'>
|
|
<td valign='top'>
|
|
<b><a href='?action=forums&forum=<?php echo($record_num) ?>'><?php echo($forum_title) ?></a> (<?php echo($status) ?>)</b><br>
|
|
<?php echo(nl2br($description)) ?>
|
|
</td>
|
|
<td align='center' valign='top'><?php echo(number_format($topics,0)) ?></td>
|
|
<td align='center' valign='top'><?php echo(number_format($posts,0)) ?></td>
|
|
<td valign='top'>
|
|
<?php echo($last_post) ?><br>
|
|
<?php echo($last_posted_by) ?>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
|
|
$current_forum_title = "";
|
|
if ($count == 1) $current_forum_title = "<br> - Forum :: <b>$forum_title</b>";
|
|
?>
|
|
</table>
|
|
</center>
|
|
<br>
|