function display_follow_up($cid, $level, $display, $filter, $link, $comment_table) { $follow = mysql_query("SELECT story_id,id,subject,writer,date FROM {$comment_table} WHERE parent={$cid}", $link) or die("ERROR: Query failed"); while ($follow_row = mysql_fetch_array($follow)) { for ($i = 0; $i < $level; $i++) { printf("   "); } print "<a href=\"ViewComment.php?comment_table={$comment_table}&storyId=" . $follow_row["story_id"] . "&commentId=" . $follow_row["id"] . "&filter={$filter}&display={$display}\">" . $follow_row["subject"] . "</a> by " . getUserName($follow_row["writer"], $link) . " on " . $follow_row["date"] . "<br>\n"; if ($follow_row["childs"] > 0) { display_follow_up($follow_row["id"], $level + 1, $display, $filter, $link, $comment_table); } } }
function display_follow_up($cid, $level, $display, $filter, $link, $comment_table, $separator) { $follow = mysql_query("SELECT * FROM {$comment_table} WHERE parent={$cid} AND rating>={$filter}", $link) or die("ERROR: Query failed"); while ($follow_row = mysql_fetch_array($follow)) { if ($rating >= $filter) { if (!$separator) { print "<br><hr><br>"; $separator = true; } if ($display == 1) { for ($i = 0; $i < $level; $i++) { printf("       "); } print "<a href=\"/PHP/ViewComment.php?comment_table={$comment_table}&storyId=" . $follow_row["story_id"] . "&commentId=" . $follow_row["id"] . "&filter={$filter}&display={$display}\">" . $follow_row["subject"] . "</a> by " . getUserName($follow_row["writer"], $link) . " on " . $follow_row["date"] . "<br>\n"; } else { $username = getUserName($follow_row["writer"], $link); print "<TABLE bgcolor=\"#CCCCFF\"><TR>"; for ($i = 0; $i < $level; $i++) { printf("<TD>   "); } print "<TD><FONT size=\"4\" color=\"#000000\"><B><a href=\"/PHP/ViewComment.php?comment_table={$comment_table}&storyId=" . $follow_row["story_id"] . "&commentId=" . $follow_row["id"] . "&filter={$filter}&display={$display}\">" . $follow_row["subject"] . "</a></B> </FONT> (Score:" . $follow_row["rating"] . ")</TABLE>\n"; print "<TABLE>"; for ($i = 0; $i < $level; $i++) { printf("<TD>   "); } print "<TD><B>Posted by " . $username . " on " . $follow_row["date"] . "</B><p><TR>\n"; for ($i = 0; $i < $level; $i++) { printf("<TD>   "); } print "<TD>" . $follow_row["comment"] . "<TR>"; for ($i = 0; $i < $level; $i++) { printf("<TD>   "); } print "<TD><p>[ <a href=\"/PHP/PostComment.php?comment_table={$comment_table}&storyId=" . $follow_row["story_id"] . "&parent=" . $follow_row["id"] . "\">Reply to this</a>" . " | <a href=\"/PHP/ViewComment.php?comment_table={$comment_table}&storyId=" . $follow_row["story_id"] . "&commentId=" . $follow_row["parent"] . "&filter={$filter}&display={$display}\">Parent</a> | <a href=\"/PHP/ModerateComment.php?comment_table={$comment_table}&commentId=" . $follow_row["id"] . "\">Moderate</a> ]</TABLE><br>"; } } if ($follow_row["childs"] > 0) { display_follow_up($follow_row["id"], $level + 1, $display, $filter, $link, $comment_table, $separator); } } }