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 "
";
}
$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) {
$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 "
";
//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 "
\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 "