//just show the message boxes one after another $ret_val .= forum_show_a_nested_message($result, $i) . '<BR>'; } else { /* no-comments or threaded use the "old" colored-row style phorum-esque threaded list of messages, not showing message bodies */ $ret_val .= ' <TR class="' . util_get_alt_row_color($total_rows) . '"><TD><A HREF="/forum/message.php?msg_id=' . db_result($result, $i, 'msg_id') . '">' . '<IMG SRC="' . util_get_image_theme("msg.png") . '" BORDER=0 HEIGHT=12 WIDTH=10> '; /* See if this message is new or not If so, highlite it in bold */ if (get_forum_saved_date($forum_id) < db_result($result, $i, 'date')) { $ret_val .= '<B>'; } /* show the subject and poster */ $poster = UserManager::instance()->getUserByUserName(db_result($result, $i, 'user_name')); $ret_val .= db_result($result, $i, 'subject') . '</A></TD>' . '<TD>' . UserHelper::instance()->getLinkOnUser($poster) . '</TD>' . '<TD>' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, $i, 'date')) . '</TD></TR>'; /* Show subjects for submessages in this thread show_submessages() is recursive */ if ($style == 'threaded') { if (db_result($result, $i, 'has_followups') > 0) { $ret_val .= show_submessages(db_result($result, $i, 'thread_id'), db_result($result, $i, 'msg_id'), 1, 0); }
function show_submessages($msg_arr, $msg_id, $level) { /* Recursive. Selects this message's id in this thread, then checks if any messages are nested underneath it. If there are, it calls itself, incrementing $level $level is used for indentation of the threads. */ global $total_rows, $sys_datefmt, $forum_id, $current_message; $rows = count($msg_arr[$msg_id]); if ($rows > 0) { for ($i = 0; $i < $rows; $i++) { /* Is this row's background shaded or not? */ $total_rows++; $ret_val .= ' <TR BGCOLOR="' . html_get_alt_row_color($total_rows) . '"><TD NOWRAP>'; /* How far should it indent? */ for ($i2 = 0; $i2 < $level; $i2++) { $ret_val .= ' '; } /* If it this is the message being displayed, don't show a link to it */ $ret_val .= ($current_message != $msg_arr[$msg_id][$i]['msg_id'] ? '<A HREF="/forum/message.php?msg_id=' . $msg_arr[$msg_id][$i]['msg_id'] . '">' : '') . html_image("images/msg.gif", "10", "12", array("BORDER" => "0")); /* See if this message is new or not */ if (get_forum_saved_date($forum_id) < $msg_arr[$msg_id][$i]['date']) { $ret_val .= '<B>'; } $ret_val .= ' ' . $msg_arr[$msg_id][$i]['subject'] . '</A></TD>' . '<TD>' . $msg_arr[$msg_id][$i]['user_name'] . '</TD>' . '<TD>' . date($sys_datefmt, $msg_arr[$msg_id][$i]['date']) . '</TD></TR>'; if ($msg_arr[$msg_id][$i]['has_followups'] > 0) { /* Call yourself, incrementing the level */ $ret_val .= show_submessages($msg_arr, $msg_arr[$msg_id][$i]['msg_id'], $level + 1); } } } return $ret_val; }
function show_submessages($thread_id, $msg_id, $level, $et = 0) { /* Recursive. Selects this message's id in this thread, then checks if any messages are nested underneath it. If there are, it calls itself, incrementing $level $level is used for indentation of the threads. */ global $total_rows, $forum_id, $current_message; $sql = "SELECT user.user_name,forum.has_followups,forum.msg_id,forum.subject,forum.thread_id,forum.body,forum.date,forum.is_followup_to " . "FROM forum,user WHERE forum.thread_id=" . db_ei($thread_id) . " AND user.user_id=forum.posted_by AND forum.is_followup_to=" . db_ei($msg_id) . " " . "ORDER BY forum.msg_id ASC;"; $result = db_query($sql); $rows = db_numrows($result); $ret_val = ''; if ($result && $rows > 0) { for ($i = 0; $i < $rows; $i++) { /* Is this row's background shaded or not? */ $total_rows++; $ret_val .= ' <TR class="' . util_get_alt_row_color($total_rows) . '"><TD NOWRAP>'; /* How far should it indent? */ for ($i2 = 0; $i2 < $level; $i2++) { $ret_val .= ' '; } /* If it this is the message being displayed, don't show a link to it */ $ret_val .= ($current_message != db_result($result, $i, 'msg_id') ? '<A HREF="/forum/message.php?msg_id=' . db_result($result, $i, 'msg_id') . '">' : '') . '<IMG SRC="' . util_get_image_theme("msg.png") . '" BORDER=0 HEIGHT=12 WIDTH=10> '; /* See if this message is new or not */ if (get_forum_saved_date($forum_id) < db_result($result, $i, 'date')) { $ret_val .= '<B>'; } $poster = UserManager::instance()->getUserByUserName(db_result($result, $i, 'user_name')); $ret_val .= db_result($result, $i, 'subject') . '</A></TD>' . '<TD>' . UserHelper::instance()->getLinkOnUser($poster) . '</TD>' . '<TD>' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, $i, 'date')) . '</TD></TR>'; /* Show the body/message if requested */ if ($et == 1) { $ret_val .= ' <TR class="' . util_get_alt_row_color($total_rows) . '"><TD> </TD><TD COLSPAN=2>' . nl2br(db_result($result, $i, 'body')) . '</TD><TR>'; } if (db_result($result, $i, 'has_followups') > 0) { /* Call yourself, incrementing the level */ $ret_val .= show_submessages($thread_id, db_result($result, $i, 'msg_id'), $level + 1, $et); } } } return $ret_val; }
//echo "In Ultimate View"; $title_arr = array(); $title_arr[] = 'Topic'; $title_arr[] = 'Topic Starter'; $title_arr[] = 'Replies'; $title_arr[] = 'Last Post'; $ret_val .= html_build_list_table_top($title_arr); $i = 0; while (($row = db_fetch_array($result)) && $i < $max_rows) { $ret_val .= ' <TR BGCOLOR="' . html_get_alt_row_color($i) . '"><TD><A HREF="/forum/forum.php?thread_id=' . $row['thread_id'] . '&forum_id=' . $forum_id . '">' . html_image("images/ic/cfolder15.png", "15", "13", array("border" => "0")); /* See if this message is new or not If so, highlite it in bold */ if (get_forum_saved_date($forum_id) < $row['recent']) { $ret_val .= '<B>'; } /* show the subject and poster */ $ret_val .= ' ' . $row['subject'] . '</A></TD>' . '<TD>' . $row['user_name'] . '</TD>' . '<TD>' . $row['followups'] . '</TD>' . '<TD>' . date($sys_datefmt, $row['recent']) . '</TD></TR>'; $i++; } $ret_val .= '</TABLE>'; } } } /* This code puts the nice next/prev. */