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); //Only the creator can edit the post //$can_edit = ((isSpecialUser($logged_in_user,0)) || ($logged_in_user && $user->id == $logged_in_user->id));// Everybody assumes we can edit posts, why not make it so? echo " \n\t\t
id\"> "; echo user_links($user, URL_BASE); echo "
"; global $special_user_bitfield; $fstatus=""; if ($user->special_user) { //If this user is somehow special $keys = array_keys($special_user_bitfield); for ($i=0; $i"; } } else { if ($user->create_time>time()-ST_NEW_TIME) $fstatus=ST_NEW."
"; /*...*/ } if ($fstatus) echo "$fstatus"; echo ""; if (!$filter || !$rated_below_threshold){ if ($user->has_avatar and $logged_in_user->hide_avatars!=1) { echo "avatar."\" alt=\"Avatar\">
"; } echo "Joined: ", gmdate('M j, Y', $user->create_time), "
Posts: $user->posts
"; } // circumvent various forms of identity spoofing // by displaying the user id of the poster. // its cheap, easy, and doesn't require any additional database calls. echo "ID: $user->id
"; // printf("Credit: %.0f
", $user->total_credit); echo "Credit: ".number_format($user->total_credit)."
"; // printf("RAC: %.1f
", $user->expavg_credit); echo "RAC: ".number_format($user->expavg_credit)."
"; echo "
\n\t\t "; if ($controls == FORUM_CONTROLS || $controls == HELPDESK_CONTROLS) { echo "
id, "\" method=\"post\">"; } echo " \n"; if ($controls == FORUM_CONTROLS) { //no special controls in forum } else if ($controls == HELPDESK_CONTROLS && $separate) { echo " "; } else if ($controls == HELPDESK_CONTROLS && !$separate) { echo " "; } echo "\n
"; if ($post->timestamp>$logged_in_user->thread_last_visited){ echo "\"Unread"; } if ($rated_above_threshold){ echo "\"!\""; } echo " id\">Message $post->id - "; if ($post->hidden) echo "[deleted] "; echo " Posted ", pretty_time_str($post->timestamp); ; if ($post->parent_post) echo " - in response to parent_post\">Message ID $post->parent_post."; if ($can_edit && $controls != NO_CONTROLS) echo " id\">[Edit this post]"; if (isSpecialUser($logged_in_user,0)) show_post_moderation_links($post); //If user is moderator, show links if ($post->modified) echo "
Last modified: ", pretty_time_Str($post->modified); if ($rated_below_threshold && $filter){ if ($user_is_on_ignorelist) $andtext=" and the user is on your ignore list"; echo "
This post has been filtered (rating: ".($post->score * $post->votes).")$andtext, press id."&filter=false#".$post->id."\">here to view this thread without filtering"; } echo "\n
\n"; if ($controls == FORUM_CONTROLS || $controls == HELPDESK_CONTROLS) { echo "
"; } //If either filtering is turned off of this post is not below the threshold if (!$filter || !$rated_below_threshold){ $posttext = $post->content; if ($post->signature && !$logged_in_user->hide_signatures){ //If the creator of this post has a signature and $posttext.="\n____________\n".$user->signature; //wants it to be shown for this post AND the logged in } //user has signatures enabled: show it $options = get_transform_settings_from_user($logged_in_user); $posttext = output_transform($posttext,$options); echo "

", $posttext, "

"; echo ""; } else if ($controls == HELPDESK_CONTROLS && !$separate) { echo " / Score: ", round(($post->score * $post->votes),0), ""; } else { $rating = floor($post->score*$post->votes + 0.01); echo " | Rating: ", $rating, " | rate: id."&choice=p\">\"+\" / id."&choice=n\">\"-\""; } if ($controls == FORUM_CONTROLS) { echo ""; } else if ($controls == HELPDESK_CONTROLS && !$separate) { echo ""; } echo "
ID: ", $post->id; if ($controls == HELPDESK_CONTROLS && $separate) { echo "[id . "&post=" . $post->id . "#input\">Reply to this post][id . "&post=" . $post->id . "&helpdesk=1#input\">Reply to this answer]
"; } echo ""; if ($separate) { echo "

"; } } // utility functions function start_forum_table($headings, $extra="width=100%") { start_table($extra); echo ""; for ($i=0; $i$title"; } echo "\n"; } function end_forum_table() { echo "
Author Answers
\n"; } // generate a "select" element from an array of values // function select_from_array($name, $array, $selection) { $out= ""; return $out; } function show_select_from_array($name, $array, $selection) { echo select_from_array($name,$array,$selection); } function show_forum_title($forum=NULL, $thread=NULL, $helpdesk=false) { 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 "
"; } else if ($forum && $thread) { echo ""; if ($helpdesk) { echo "", " Questions and problems : "; } else { echo "", " Message boards : "; } echo "id\">", $forum->title, " : "; echo cleanup_title($thread->title); echo "
"; } else { echo "Invalid input to show_forum_title
"; } echo "

\n"; } // show a thread with its context (e.g. for search results) // function show_thread($thread, $n) { $forum = getForum($thread->forum); $category = getCategory($forum->category); $first_post = getFirstPost($thread->id); $title = cleanup_title($thread->title); $where = $category->is_helpdesk?"Questions and answers":"Message boards"; $top_url = $category->is_helpdesk?"forum_help_desk.php":"forum_index.php"; $excerpt = sub_sentence(stripslashes($first_post->content), ' ', EXCERPT_LENGTH, true); $posted = time_diff_str($thread->create_time, time()); $last = time_diff_str($thread->timestamp, time()); $m = $n%2; echo " $n) Posted $posted
Last response $last $where : $category->name : id\">$forum->title : id\">$title
$excerpt "; } // show a post with its context (e.g. for search results) // function show_post2($post, $n) { // This is such a lovely function I think I will $thread = getThread($post->thread); // do away with it sometime soon. $forum = getForum($thread->forum); $category = getCategory($forum->category); $where = $category->is_helpdesk?"Questions and answers":"Message boards"; $top_url = $category->is_helpdesk?"forum_help_desk.php":"forum_index.php"; $content = output_transform($post->content); $when = time_diff_str($post->timestamp, time()); $user = lookup_user_id($post->user); $title = cleanup_title($thread->title); $m = $n%2; if($post->hidden) { $deleted_text = array( "Obscene", "Flame/Hate", "Commercial spam" ); //Todo: factor this array out, it is also used elsewhere $deleted = "
[Deleted " . "by a moderator as " . $deleted_text[$post->hidden-1] . "] "; } else { $deleted = ""; }; echo " $n) $where : $category->name : id\">$forum->title : id\">$title
Posted $when by $user->name $deleted
$content "; } function show_forum_summary($forum) { $x = time_diff_str($forum->timestamp, time()); echo " id>", $forum->title, "
", $forum->description, " ", $forum->threads, " ", $forum->posts, " ", $x, " "; } function post_warning() { return "

Do not use obscene language or threaten other participants; we may delete such messages. "; } ?>