special_user, $specialbit,1)==1); } function getHasRated($user, $postid){ return (strstr($user->rated_posts,"|".$postid)); } function getSortStyle($user,$place){ if ($user->id!=""){ list($forum,$thread,$faq,$answer)=explode("|",$user->sorting); } else { list($forum,$thread,$faq,$answer)=explode("|",$_COOKIE['sorting']); } return $$place; } // display functions function show_posts($thread, $sort_style, $filter, $show_controls=true, $do_coloring=true, $is_helpdesk=false) { global $logged_in_user; $n = 1; if ($show_controls && !$is_helpdesk) { $controls = FORUM_CONTROLS; } else if ($show_controls && $is_helpdesk) { $controls = HELPDESK_CONTROLS; } else { $controls = NO_CONTROLS; } if (isSpecialUser($logged_in_user,0)){ // If logged in user is moderator $show_hidden_posts = true; // let him see all posts - including hidden ones } else { $show_hidden_posts = false; } $posts = getPosts($thread->id, -1, -1, $sort_style, $show_hidden_posts); $logged_in_user = getThreadLastVisited($logged_in_user,$thread); setThreadLastVisited($logged_in_user,$thread); $firstPost = getFirstPost($thread->id); if ($is_helpdesk) { if ($firstPost) { show_post($firstPost, $thread, $logged_in_user, $n, $controls, true,$filter); if ($firstPost->timestamp>$logged_in_user->thread_last_visited){ $first_unread_post=$firstPost; } } } while ($post = mysql_fetch_object($posts)) { if (!$is_helpdesk || ($is_helpdesk && $post->id != $firstPost->id)) { show_post($post, $thread, $logged_in_user, $n, $controls, false, $filter); if ($do_coloring) $n = ($n+1)%2; if (($post->timestamp>$logged_in_user->thread_last_visited) && (($post->timestamp<$first_unread_post->timestamp) || $first_unread_post->timestamp==0)){ $first_unread_post=$post; } } } if ($logged_in_user->jump_to_unread){ if ($first_unread_post->id!=""){ echo ""; } else { echo ""; } } } function show_post($post, $thread, $logged_in_user, $n, $controls=FORUM_CONTROLS, $separate=false, $filter=true) { $user = lookup_user_id($post->user); $user = getForumPreferences($user); $user->has_avatar = ($user->avatar != ""); //If the user that made this post is on the list of people to ignore, change thresholds to be more strict if (in_array($user->id,explode("|",$logged_in_user->ignorelist))){ $user_is_on_ignorelist=true; $rated_below_threshold = ($logged_in_user->high_rating_threshold>($post->score*$post->votes)); $rated_above_threshold = ($logged_in_user->high_rating_threshold+abs($logged_in_user->low_rating_threshold)<($post->score*$post->votes)); } else { //Use normal threshold values $rated_below_threshold = ($logged_in_user->low_rating_threshold>($post->score*$post->votes)); $rated_above_threshold = ($logged_in_user->high_rating_threshold<($post->score*$post->votes)); } $can_edit = $logged_in_user && $user->id == $logged_in_user->id; echo "
", $posttext, "
"; echo "ID: ", $post->id; if ($controls == HELPDESK_CONTROLS && $separate) { echo " | "; } else if ($controls == HELPDESK_CONTROLS && !$separate) { echo " / Score: ", round(($post->score * $post->votes),0), ""; } else { echo " / Rating: ", round(intval(($post->score * $post->votes)+0.01),0), " - rate: id."&choice=p\"> / id."&choice=n\">"; } if ($controls == FORUM_CONTROLS) { echo "[id . "&post=" . $post->id . "#input\">Reply to this post] | "; } else if ($controls == HELPDESK_CONTROLS && !$separate) { echo "[id . "&post=" . $post->id . "&helpdesk=1#input\">Reply to this answer] | "; } echo "
Author | Answers | "; } } // utility functions function externalize_links($text){ $i=0;$linkpos=true; while (true){ //Find a link $linkpos=strpos($text,"]+)>@si'; // Gives us the URL in ${1}... $replacement = '[Image Link]'; // Turns that URL into a hyperlink $text = preg_replace($pattern, $replacement, $text); return $text; } function cleanTextBox($content) { /* Cleans the contents of a post for dropping in a text box * Currently I'm only replacing <'s and >'s with the proper HTML entities * ...are there others we should handle? & itself is being escaped somewhere * else, probably by the slash stuff in the calling function. */ $answer = preg_replace('/</','<',preg_replace('/>/','>',$content)); return $answer; } function start_forum_table($headings) { start_table(); echo "
---|---|
\n"; if (!$forum && !$thread) { echo "
"; if ($helpdesk) { echo " Questions and problems
"; } else { echo " Message boards"; } } else if ($forum && !$thread) { echo ""; if ($helpdesk) { echo "", " Questions and problems : "; } else { echo "", " Message boards : "; } echo $forum->title; echo "