97 lines
2.6 KiB
PHP
97 lines
2.6 KiB
PHP
<?php
|
|
require_once("include/globals.php");
|
|
|
|
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
|
header("Location: /");
|
|
exit();
|
|
}
|
|
|
|
|
|
// Update views for this topic
|
|
$query = "update forum_threads " .
|
|
"set thread_views = thread_views + 1 " .
|
|
"where school_num = $school_num " .
|
|
"and forum_num = $forum " .
|
|
"and record_num = $topic";
|
|
db_query($query);
|
|
|
|
|
|
// Get records to display
|
|
$query = "select * " .
|
|
"from forum_threads " .
|
|
"where school_num = $school_num " .
|
|
"and forum_num = $forum " .
|
|
"and thread_status != 'Deleted' " .
|
|
"and top_thread_id = $topic " .
|
|
"order by last_post_time desc";
|
|
$results = db_query($query);
|
|
|
|
|
|
// Check forum status
|
|
$forum_status = db_getVal("select status from forums where school_num = $school_num and record_num = $forum");
|
|
|
|
|
|
?>
|
|
<center>
|
|
<?php
|
|
if (db_num_rows($results)) {
|
|
?>
|
|
<table width='<?php echo($default_data_width) ?>' cellpadding='10' cellspacing='1' border='0' class='big-content-table'>
|
|
<tr class='success'>
|
|
<td width='60%'>Replies to this Topic</td>
|
|
</tr>
|
|
<?php
|
|
$count = 0;
|
|
while ($row = db_fetch_array($results)) {
|
|
extract($row);
|
|
|
|
$bgclass = 'data-even';
|
|
if ($count % 2) $bgclass = 'data-odd';
|
|
$count++;
|
|
|
|
// Get userid of the person who posted this thread
|
|
$query = "select userid from users " .
|
|
"where school_num = $base_school_num " .
|
|
"and record_num = $posted_by";
|
|
$posted_id = db_getVal($query);
|
|
|
|
$edit = "";
|
|
if ($forum_status != 'Closed' && $posted_by == $_SESSION['UserInfo']['record_num'])
|
|
$edit = " [<a href='?action=forums&naction=edit-thread&forum=$forum&topic=$record_num&reply=$record_num'>Edit</a>]";
|
|
|
|
|
|
if (strlen($message)) $message = nl2br($message) . "<br>\n<hr size='1'>\n";
|
|
|
|
?>
|
|
<tr class='<?php echo($bgclass) ?>'>
|
|
<td valign='top'>
|
|
<b><?php echo($subject) ?></b><br>
|
|
<?php echo($message) ?>
|
|
<span class='small'>Posted By :: <?php echo($posted_id) ?> <?php echo($edit) ?></span>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</table>
|
|
<?php
|
|
}
|
|
|
|
// Check forum status
|
|
$status = db_getVal("select status from forums where school_num = $school_num and record_num = $forum");
|
|
|
|
|
|
// Setup form values
|
|
if ($status == 'Open' && isset($topic)) {
|
|
$TitleText = "Post a Reply to this Forum Topic";
|
|
$ButtonText = "Post Reply";
|
|
$next_naction = "new-thread";
|
|
$subject = "";
|
|
$message = "";
|
|
include "forums.topic-form.php";
|
|
}
|
|
|
|
?>
|
|
</center>
|
|
<br>
|