") != null) { $allow_ratings = false; } // process a user-supplied title to remove HTML stuff // function cleanup_title($title) { $x = trim(htmlspecialchars(strip_tags($title))); $x = stripslashes($x); // clean up funky old titles in DB if (strlen($x)==0) return "(no title)"; else return $x; } /* Check if user has special user bit enabled */ function isSpecialUser($user, $specialbit){ return (substr($user->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 logged in user is moderator, // let him see all posts - including hidden ones // if (isSpecialUser($logged_in_user,0)){ $show_hidden_posts = true; } else { $show_hidden_posts = false; } $posts = getPosts($thread->id, -1, -1, $sort_style, $show_hidden_posts); $postcount = mysql_num_rows($posts); $logged_in_user = getThreadLastVisited($logged_in_user,$thread); setThreadLastVisited($logged_in_user,$thread); $firstPost = getFirstPost($thread->id); $postnumber=0; $previous_post=0; if ($is_helpdesk) { if ($firstPost) { show_post($firstPost, $thread, $logged_in_user, $n, $controls, true,$filter); $postnumber=1; $previous_post=1; if ($firstPost->timestamp>$logged_in_user->thread_last_visited){ $first_unread_post=$firstPost; } } } //$logged_in_user->minimum_wrap_postcount=13; //$logged_in_user->display_wrap_postcount=12; $no_wraparound = get_str("nowrap",true); while ($post = mysql_fetch_object($posts)) { if (!$is_helpdesk || ($is_helpdesk && $post->id != $firstPost->id)) { $postnumber++; if ( (!$logged_in_user->minimum_wrap_postcount) //If the user hasn't enabled the feature to display only a certain amount of posts, simply display all of them. || ($postcount <= $logged_in_user->minimum_wrap_postcount) //If it is enabled and we havent yet hit the limit, simply display all || ($no_wraparound) // If the user has asked to display all the posts just display them || ( ($postcount > $logged_in_user->minimum_wrap_postcount) //If it is enabled and we have hit the limit AND we have the minimum wraparound number of posts or more && ( ($postnumber==1 || $postnumber==$postcount) // Let's display the post only if it is the first post || ( (($postnumber > $postcount-$logged_in_user->display_wrap_postcount) //or it is one of the last wrap_display_postcount posts. && ($sort_style=="timestamp_asc")) || (($postnumber <= $logged_in_user->display_wrap_postcount) //or it is one of the last wrap_display_postcount posts. && ($sort_style=="timestamp")) || (substr($sort_style,0,4)!="time") ) || ($post->timestamp > $logged_in_user->thread_last_visited) //or if this post is unread ) ) ){ if ($postnumber!=$previous_post+1){ //A number of posts were hidden, display a way to unhide them: echo " Only the first post and the last ".($logged_in_user->display_wrap_postcount)." posts (of the ".($postcount)." posts in this thread) are displayed.
id."&nowrap=true\">Click here to also display the remaining posts."; } $previous_post=$postnumber; 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) { global $allow_ratings; $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) { $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\">"; } if ($controls == FORUM_CONTROLS){ echo ""; } else { echo ""; } 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) { //no special controls in forum //echo ""; } else if ($controls == HELPDESK_CONTROLS && $separate) { echo " "; } else if ($controls == HELPDESK_CONTROLS && !$separate) { echo " "; } echo "\n"; if ($controls == FORUM_CONTROLS || $controls == HELPDESK_CONTROLS) { echo ""; } echo ""; //If either filtering is turned off of this post is not below the threshold if (!$filter || !$rated_below_threshold){ $posttext = $post->content; // If the creator of this post has a signature and // wants it to be shown for this post AND the logged in // user has signatures enabled: show it // if ($post->signature && !$logged_in_user->hide_signatures){ $posttext.="\n____________\n".$user->signature; } $options = get_transform_settings_from_user($logged_in_user); $posttext = output_transform($posttext,$options); 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 { if ($allow_ratings == true) { $rating = floor($post->score*$post->votes + 0.01); echo " | Rating: ", $rating, " | rate: id."&choice=p\">\"+\" / id."&choice=n\">\"-\" - id."\">\"Report"; } else { echo " | id."\">\"Report"; } } 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]"; } else { echo ""; } echo ""; } echo ""; echo ""; if ($separate) { $headings = array(array("Author","authorcol"), "Message",""); echo ""; start_forum_table($headings, "id=\"thread\" width=100%"); } } // utility functions function start_forum_table($headings, $extra="width=100%") { start_table($extra." cellspacing=0"); echo ""; for ($i=0; $i$title"; } echo "\n"; } function end_forum_table() { echo "\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) { $thread = getThread($post->thread); $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) { //Todo: factor this array out, it is also used elsewhere $deleted_text = array( "Obscene", "Flame/Hate", "Commercial spam", "Doublepost", "Off Topic", "Flamebait" ); $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 "

Rules:
  • No commercial advertisements.
  • No messages whose only intention is to annoy or antagonize other people.
  • No messages whose only intention is to hijack a thread.
  • No messages that are deliberately hostile or insulting.
  • No abusive comments involving race, religion, nationality, gender, class or sexuality.
  • No obscene language.
More info
"; } ?>