convert_time($Posted,$offset); $alt = "."; $thisone = ",$PNumber,"; $imagesize = $images['icons']; if ( ($Posted >= $unread) && (!strstr($read,$thisone ) ) ) { $alt = "*"; $rowcolor = "new$color"; } else { $alt = "*"; $rowcolor = "$color"; } if ( ($Open == "C") || ($Open == "M") ){ $Icon = "lock.gif"; } // --------------------------------------- // If it isn't approved we need to mark it if ($Approved == "no") { $Subject = "({$ubbt_lang['NOT_APPROVED']}) $Subject"; } if ($Number != $PNumber) { $Subjectlinkstart = ""; $Subjectlinkstop = ""; } else { $Subjectlinkstart = ""; $Subjectlinkstop = ""; } $UserStatus = ""; if ($Reged == "n") { // ------------------------------------------------------------------ // If we aren't allowing anon users to choose their own username then // we display the basic anon user in the user's selected lang if (!$config['anonnames']){ $Username = $ubbt_lang['ANON_TEXT']; } else { $Username = $AnonName; } } else { $PPoster = $Poster; if ($Color) { $PPoster = "$PPoster"; } // --------------------------------------------------------- // We need to know if this was made by an admin or moderator if ($PostStatus == "Administrator") { $UserStatus = "\"{$ubbt_lang['USER_ADMIN']}\""; } elseif ( ($PostStatus == "Moderator") && (stristr($modcheck,$UserNumber)) ) { $UserStatus = "\"{$ubbt_lang['USER_MOD']}\""; } $Username = "$PPoster"; } $postrow[$z]['color'] = $rowcolor; $postrow[$z]['indentsize'] = $indentsize; $postrow[$z]['icon'] = $Icon; $postrow[$z]['Subjectlinkstart'] = $Subjectlinkstart; $postrow[$z]['Subject'] = $Subject; $postrow[$z]['Subjectlinkstop'] = $Subjectlinkstop; $postrow[$z]['Username'] = $Username; $postrow[$z]['UserStatus'] = $UserStatus; $postrow[$z]['time'] = $time; $z++; // -------------------- // alternate the colors $color = $html -> switch_colors($color); if (isset($tree[$PNumber]['children'])) { $color = show_replies($Cat,$Board,$PNumber,$Number,$page,$view,$sb,$indent,$color,$unread,$Viewable,$read,$offset,$o,$PNumber); } } $indent--; return $color; } // --------------------------------- // END OF THE SHOW_REPLIES FUNCTION $html = new html; // -------------------------------------------------------------- // Grab the cookie or session to mark the posts as read or unread if (isset(${$config['cookieprefix']."w3t_visit"})) { $piece['0'] = ""; preg_match("/-$Board=(.*?)-/",${$config['cookieprefix']."w3t_visit"},$piece); if (isset($piece['1'])) { $unread = $piece['1']; } else { $unread = ""; } } else { $unread = ""; } // ----------------- // Get the user info $userob = new user; $user = $userob -> authenticate("U_Display, U_Groups, U_PostsPer, U_PicturePosts, U_FlatPosts, U_TempRead, U_TimeOffset,U_ShowSigs"); $Username = $user['U_Username']; // ------------------------------------------------------------- // If we didn't get a board or number then we give them an error if (!$Board) { $html -> not_right($ubbt_lang['NO_B_INFO'],$Cat); } // ------------------------------------------------------------ // Update the last visit to this board $Username_q = addslashes($Username); $LastViewed = "$Board"."Last"; $Board_q = addslashes($Board); if ( ($Username) && (!strstr(${$config['cookieprefix']."w3t_visit"},"-$Board=") ) ) { $query = " SELECT L_Last FROM {$config['tbprefix']}Last WHERE L_Uid = '{$user['U_Number']}' AND L_Board = '$Board_q' "; $sth = $dbh -> do_query($query); list($oldlast) = $dbh -> fetch_array($sth); $dbh -> finish_sth($sth); // --------------------------------------- // Set a cookie, or register a session var if ($config['tracking'] == "sessions") { session_register("{$config['cookieprefix']}w3t_visit"); ${$config['cookieprefix']."w3t_visit"} .= "-$Board=$oldlast-"; } else { ${$config['cookieprefix']."w3t_visit"} .= "-$Board=$oldlast-"; setcookie("{$config['cookieprefix']}w3t_visit",${$config['cookieprefix']."w3t_visit"},0,$config['cookiepath']); } $unread = $oldlast; // Since we didn't find a cookie that means they bypassed the postlist // screen so we need to update the last visited timestamp $currtime = $html -> get_date(); $query = " DELETE FROM {$config['tbprefix']}Last WHERE L_Uid = '{$user['U_Number']}' AND L_Board = '$Board_q' "; $dbh -> do_query($query); $query = " INSERT INTO {$config['tbprefix']}Last (L_Uid,L_Last,L_Board) VALUES ('{$user['U_Number']}',$currtime,'$Board_q') "; $dbh -> do_query($query); } // ----------------------------------- // Set the default for a few variables isset($user['U_PicturePosts']) && $PicturePosts = $user['U_PicturePosts']; if (!isset($PicturePosts)) { $PicturePosts = $theme['PicturePosts']; } $toffset = ""; $showsigs = ""; isset($user['U_TimeOffset']) && $toffset = $user['U_TimeOffset']; isset($user['U_ShowSigs']) && $showsigs = $user['U_ShowSigs']; // ---------------------------------------- // Need to figure out the active thread age if ( ($o) && ($o != "all") ) { $time = time(); $time = $time - ($o * 86400); $activethread = "AND B_Last_Post > $time"; } // ---------------------------------------------------------------- // If they are logged in then we check their groups, otherwise they // get set to the guest group $Groups = $user['U_Groups']; if (!$Groups) { $Groups = "-4-"; } // -------------------------------------------------------------- // Let's make sure they are supposed to be looking at this board $Grouparray = split("-",$Groups); $gsize = sizeof($Grouparray); $groupquery = "AND ("; $g = 0; for ($i=0; $i<$gsize;$i++) { if (!preg_match("/[0-9]/",$Grouparray[$i])) { continue; }; $g++; if ($g > 1) { $groupquery .= " OR "; } $groupquery .= "Bo_Read_Perm LIKE '%-$Grouparray[$i]-%'"; } $groupquery .= ")"; $jumpbox = $html -> jump_box($Cat,$groupquery,$Board); // Find out how many are browsing this forum $query = " SELECT O_Type,O_Extra,COUNT(*) FROM {$config['tbprefix']}Online WHERE O_Extra LIKE '$Board%' GROUP BY O_Type "; $sth = $dbh -> do_query($query); $a = "0"; $r = "0"; while (list($Type,$Extra,$onlinecount) = $dbh -> fetch_array($sth)) { ${$Type} = $onlinecount; } // --------------------------- // Grab some forum information $Board_q = addslashes($Board); $query = " SELECT Bo_Title,Bo_Write_Perm,Bo_CatName,Bo_Cat,Bo_Reply_Perm,Bo_Read_Perm,Bo_HTML,Bo_Markup,Bo_Write_Perm,Bo_SpecialHeader,Bo_StyleSheet FROM {$config['tbprefix']}Boards WHERE Bo_Keyword = '$Board_q' $groupquery "; $sth = $dbh -> do_query($query); list($title,$CanWrite,$CatName,$CatNumber,$CanReply,$ReadPerm,$HTML,$Markup,$CanWrite,$fheader,$fstyle) = $dbh -> fetch_array($sth); $dbh -> finish_sth($sth); // ---------------------------------- // Grab all moderators for this board $query = " SELECT t1.Mod_Uid,t2.U_Username FROM {$config['tbprefix']}Moderators AS t1, {$config['tbprefix']}Users AS t2 WHERE t1.Mod_Board='$Board_q' AND t1.Mod_Uid = t2.U_Number "; $sth = $dbh -> do_query($query); $moderatorlist = ","; while (list($modid,$modname) = $dbh -> fetch_array($sth)) { $moderator[$modid] = $modname; $moderatorlist .="$modid,"; } // ------------------------------------------------- // Here we need to figure out what stylesheet to use $mystyle = ""; isset($user['U_StyleSheet']) && $mystyle = $user['U_StyleSheet']; if (!$mystyle) { $mystyle = "usedefault"; } if ($mystyle == "usedefault") { $mystyle = $fstyle; if ($mystyle == "usedefault") { $mystyle = $theme['stylesheet']; } } // fstyle will now be a global variable to use in send_header $fstyle = $mystyle; // ---------------- // SHow moderators? $modarray = split(",",$moderatorlist); $modsize = sizeof($modarray); $comma =0; $modlist = ""; $modcheck = ","; for ($i=0;$i<$modsize;$i++) { if ($modarray[$i]) { if ($comma) { $modlist .= ", "; } $modcheck .="{$modarray[$i]},"; $modlist .= "{$moderator[$modarray[$i]]}"; $comma++; } else { $modlist .= " "; } } // Let's see if the can post or reply $replyperm = $ubbt_lang['CANTREPLY']; $writeperm = $ubbt_lang['CANTWRITE']; for ($i=0; $i<$gsize; $i++) { if (strstr($CanReply,"-$Grouparray[$i]-") ) { $replyperm = $ubbt_lang['CANREPLY']; $canreply = 1; } if (strstr($CanWrite,"-$Grouparray[$i]-") ) { $writeperm = $ubbt_lang['CANWRITE']; $canwrite = 1; } if (($canwrite) && ($canreply)) { break; } } if ($Markup == "On") { $ubbcode = "{$ubbt_lang['UBBCODE']} {$ubbt_lang['ENABLED']}"; } else { $ubbcode = "{$ubbt_lang['UBBCODE']} {$ubbt_lang['DISABLED']}"; } if ($HTML == "On") { $htmlcode = "{$ubbt_lang['HTMLIS']} {$ubbt_lang['ENABLED']}"; } else { $htmlcode = "{$ubbt_lang['HTMLIS']} {$ubbt_lang['DISABLED']}"; } if (!$title) { $html -> not_right($ubbt_lang['BAD_GROUP'],$Cat); } // --------------------------------------------------------------- // If they are a normal user then they can only see approved posts $ismod = "no"; $Viewable = "AND B_Approved = 'yes'"; if ($user['U_Status'] == "Administrator") { $Viewable = ""; } if ($user['U_Status'] == "Moderator") { // Check if they moderate this board if (preg_match("/(,|^){$user['U_Number']}(,|$)/i",$moderatorlist)) { $Viewable = ""; $ismod = "yes"; } } // ---------------------------------------------------- // If we don't have a post number then we can't view it if (!$Number) { $html -> not_right($ubbt_lang['POST_PROB'],$Cat); } // ----------------------------------------- // Grab the main post number for this thread $query = " SELECT B_Main, B_Last_Post,B_Subject,B_Rating,B_Rates,B_RealRating FROM {$config['tbprefix']}Posts WHERE B_Number = $Number AND B_Board = '$Board' "; $sth = $dbh -> do_query($query); list ($current,$posted,$tsubject,$Rating,$Rates,$stars) = $dbh -> fetch_array($sth); $dbh -> finish_sth($sth); $ThreadRating = ""; if ($stars) { for ($x=1;$x<=$stars;$x++) { $ThreadRating .= "\"*\""; } } // --------------------------------------- // Set the flat switch to the Main Number $Flat = $current; // ------------------------------------ // Let's see if they rated this thread $username_q = addslashes($user['U_Username']); $query = " SELECT R_Rating FROM {$config['tbprefix']}Ratings WHERE R_What = '$Flat' AND R_Rater = '{$user['U_Number']}' AND R_Type = 't' "; $sth = $dbh -> do_query($query); list($myrating) = $dbh -> fetch_array($sth); // ----------------------------------- // Figure out what we need to display if (!$myrating) { $ratinghtml = << {$ubbt_lang['RATETHIS']} EOF; } else { $ratinghtml = "{$ubbt_lang['YOURATED']} $myrating."; } // ------------------------------------------------------------- // If we didn't find the main post, then this post doesn't exist if (!$current) { $html -> not_right($ubbt_lang['POST_PROB'],$Cat); } if (!$vc) { $query = " UPDATE {$config['tbprefix']}Posts SET B_Counter = B_Counter + 1 WHERE B_Main = $current "; $dbh -> do_query($query); } // ------------------------------------------------------------------- // Mark this message as read, appending it to the others $read = $user['U_TempRead']; $check = ",$Number,"; if ($config['newcounter']) { if ( (!strstr($read,$check)) && ($posted > $unread) ) { $read = $read . ",$Number,"; $Username_q = addslashes($Username); $read_q = addslashes($read); $query = " UPDATE {$config['tbprefix']}Users SET U_TempRead = '$read_q' WHERE U_Username = '$Username_q' "; $dbh -> do_query($query); } } // -------------------------- // Give the start of the page $Extra = $Board . "_SEP_" .$Number. "_SEP_" .$tsubject; $html -> send_header($tsubject,$Cat,0,$user,$Extra,$ReadPerm); // -------------------------------------------------------------------- // If dateslip is on, we sort by Last_Post, otherwise we sort by Posted if (!$config['dateslip']) { $sort_opt = array( 1 => 'B_Subject DESC', 2 => 'B_Subject ASC', 3 => 'B_Posterid DESC', 4 => 'B_Posterid ASC', 5 => 'B_Posted DESC', 6 => 'B_Posted ASC' ); $sort_by = $sort_opt[$sb]; if (!$sort_by) { $sort_by = "B_Posted DESC"; } } else { $sort_opt = array( 1 => 'B_Subject DESC', 2 => 'B_Subject ASC', 3 => 'B_Posterid DESC', 4 => 'B_Posterid ASC', 5 => 'B_Last_Post DESC', 6 => 'B_Last_Post ASC' ); $sort_by = $sort_opt[$sb]; if(!$sort_by) {$sort_by = "B_Last_Post DESC";} } // ------------------------------------------------------------------------- // Grab all of the main posts from the database that are on the current page // We also need to grab one from the page before and one from the next page // just so we can check if there needs to be a previous or next thread link // But we only need to do this if they aren't coming from the search page if ($Search != "true") { $PostsPer = $user['U_PostsPer']; if (!$PostsPer) { $PostsPer = $theme['postsperpage']; } if ($page < 1) { $Totalgrab = $PostsPer + 2; $Posts = $PostsPer + 2; } else { $Startat = $page * $PostsPer - 1; $Posts = $PostsPer + 2; $Totalgrab = "$Startat, $Posts"; } $limit = "LIMIT $Totalgrab"; $query = " SELECT B_Number,B_Main,B_Subject,B_Posted,B_Approved FROM {$config['tbprefix']}Posts WHERE B_Topic = 1 AND B_Board = '$Board_q' $activethread $Viewable ORDER BY $sort_by $limit "; $sth = $dbh -> do_query($query); $total = $dbh -> total_rows($sth); $newpage = 0; $prevoption = "greyprevious.gif"; $nextoption = "greynext.gif"; $linktext = $ubbt_lang['INDEX_ICON']; // In case we are linking to an old post, we need to force the link // to the first page in postlist.php $currentlinkstart = ""; $currentlinkstop = ""; for ($i = 0; $i < $total; $i++) { $OldNumber = $PNumber; $OldMain = $Main; $OldSubject = $Subject; $OldPosted = $Posted; $OldApproved = $Approved; list ($PNumber,$Main,$Subject,$Posted,$Approved) = $dbh -> fetch_array($sth); // ----------------------------------------------- // Check to see if they get a previous link button if ( ( ($PNumber == $current) && ($page == 0) && ($i > 0) ) || ( ($PNumber == $current) && ($page != 0) ) ) { if ($i == 1) { $whichpage = $page - 1; } else { $whichpage = $page; } if ($whichpage < 0) { $whichpage = 0; } $prevlinkstart = ""; $prevoption = "previous.gif"; $prevlinkstop = ""; $previous = 1; } // ----------------------------------------------------------------------- // If we are on the current thread then we give the link for all threads if ($PNumber == $current) { $currentlinkstart = ""; $currentlinkstop = ""; // --------------------------- // Now we grab the next thread $i++; list ($PNumber,$Main,$Subject,$Posted,$Approved) = $dbh -> fetch_array($sth); // --------------------------------------------------------------- // If there is a next thread then give them a link to it otherwise // they get the greyed out image $nextoption = "next.gif"; if ($PNumber) { if ( ($i == $total) && ($i > $PostsPer) ) { $whichpage = $page + 1; } else { $whichpage = $page; } $nextlinkstart = ""; $nextlinkstop = ""; } // -------------------------------------------------------------------- // If we got here then we are listing the original thread starting post // so we set original to 1 $original = 1; break; } } $dbh -> finish_sth($sth); } else { // ------------------------------------------------------ // Otherwise we came from the search so we can only return $nextoption = "greynext.gif"; $Words = rawurlencode($Words); $Forum = rawurlencode($Forum); $Match = rawurlencode($Match); $currentlinkstart = ""; $currentlinkstop = ""; $linktext = $ubbt_lang['INDEX_ICON']; $prevoption = "greyprevious.gif"; } // -------------------------------------- // Give a link to switch to threaded mode if (!$Flat) { $Flat = $Number; } // ------------------------------------------------- // Only certain options for users that are logged in if ($user['U_Username']) { $addfavoption = " {$ubbt_lang['ADD_FAV']} "; } // ----------------------- // Grab the post $query = " SELECT t1.B_Number,t1.B_Posted,t2.U_Username,t1.B_IP,t1.B_Subject,t1.B_Body,t1.B_File,t1.B_Status,t1.B_Approved,t2.U_Picture,t1.B_Reged,t2.U_Title,t2.U_Color,t1.B_Icon,t1.B_Poll,t1.B_Parent,t2.U_Status,t2.U_Signature,t1.B_LastEdit,t1.B_LastEditBy,t2.U_Location,t2.U_TotalPosts,t2.U_Registered,t2.U_Rating,t2.U_Rates,t2.U_RealRating,t2.U_PicWidth,t2.U_PicHeight,t2.U_Number,t1.B_FileCounter,t1.B_AnonName FROM {$config['tbprefix']}Posts AS t1, {$config['tbprefix']}Users AS t2 WHERE t1.B_Number = '$Number' AND t1.B_PosterId = t2.U_Number $Viewable "; $sth = $dbh -> do_query($query); list ($Number,$Posted,$Username,$IP,$SubjectMain,$Body,$File,$Open,$Approved,$Picture,$Reged,$Title,$Color,$Icon,$Poll,$ParentPost,$PostStatus,$Signature,$LastEdit,$LastEditBy,$Location,$TotalPosts,$Registered,$Rating,$Rates,$stars,$picwidth,$picheight,$usernum,$downloads,$anonname) = $dbh -> fetch_array($sth); $dbh -> finish_sth($sth); # Added by LK $Title = stripslashes($Title); $Rating = ""; $color = "darktable"; if ( ($Reged == "y") && ($usernum != 1) ){ $Registered = $html -> convert_time($Registered,$toffset); list ($one,$two,$three) = split(" ",$Registered); if (stristr($three," ")) { list ($three,$four) = split(" ",$three); } if ($theme['timeformat'] == "long") { $Registered = "$two $three $four"; } else { $Registered = "$one"; } if ($theme['timeformat'] == "short5") { $Registered = "$two"; } $Registered = "{$ubbt_lang['REGED_ON']} $Registered"; if ($Location) { $Location = "{$ubbt_lang['USER_LOC']} $Location"; } $TotalPosts = "{$ubbt_lang['POSTS_TEXT']}: $TotalPosts"; if ($Signature) { $Signature = str_replace("\n","
",$Signature); $Signature = "

--------------------
$Signature"; } if ($showsigs == "no") { $Signature = ""; } if ( ($stars) && ($config['uratings']) ) { for ($x=1;$x<=$stars;$x++) { $Rating .= "\"*\""; } } // --------------------------------------------------------- // We need to know if this was made by an admin or moderator if ($PostStatus == "Administrator") { $MainUserStatus = "\"{$ubbt_lang['USER_ADMIN']}\""; } elseif ( ($PostStatus == "Moderator") && (stristr($modcheck,$usernum)) ){ $MainUserStatus = "\"{$ubbt_lang['USER_MOD']}\""; } if ( ($Picture) && ($Picture != "http://") && ( ($PicturePosts == 1) || ($PicturePosts == "on") ) ) { $picsize = ""; if ($picwidth && $picheight) { $picsize = "width=\"$picwidth\" height=\"$picheight\""; } else { $picsize = "width=\"{$theme['PictureWidth']}\" height=\"{$theme['PictureHeight']}\""; } $Picture = "\"\""; } else { $Picture = ""; } $PUsername = $Username; if ($Color) { $PUsername = "$PUsername"; } } else { $Picture = ""; $Registered = ""; $TotalPosts = ""; $Location = ""; } $PrintLastEdit = ""; if ($LastEdit) { $LastEdit = $html -> convert_time($LastEdit,$toffset); $PrintLastEdit = "

{$ubbt_lang['EDITED_BY']} $LastEditBy ($LastEdit)"; } $timeMain = $html -> convert_time($Posted,$toffset); // ------------------------------------------------------------------ // If we came from the search engine then we bold the search keywords if ( ($Search == "true" && $Match != 'Username') && ($Words) ){ $searchwords = split(" +",$Words); $size = sizeof($searchwords); for ($x=0; $x<$size; $x++) { $Body = str_replace($searchwords[$x],"".$searchwords[$x]."",$Body); $Body = preg_replace("/(<(a|img)\s*[^>]+)($searchwords[$x])<\/i><\/b>([^>]*>)/i","\\1\\3\\4",$Body); } } if ( ($notread[$Number] == "true") && ($Posted > $unread) ) { $newimage = "\"{$ubbt_lang['NEW_TEXT']}\""; }; // ------------------------------------------ // Set both the reply and edit buttons to off $reply = "off"; $edit = "off"; // ------------------- // Can they post here? $gsize = sizeof($Grouparray); for ($y=0; $y <$gsize; $y++) { if ( (strstr($CanWrite,"-$Grouparray[$y]-") ) || (strstr($CanReply,"-$Grouparray[$y]-") ) ) { $makepost = "yes"; break; } } if ( ($makepost == "yes") && ($Open != "C") && ($Open != "M") ){ $reply = "on"; } // ----------------------------------------------------------- // If this thread has been moved we need to send them properly if ($Open == "M") { @list($NewBoard,$NewNumber,$Body) = split("-ML-",$Body); $Body = "{$ubbt_lang['POINTER']}$Body"; } // --------------------------- // Do they get an edit button? if ($user['U_Username']) { if ( ($user['U_Number'] == $usernum) || ($ismod == "yes") || ($user['U_Status'] == "Administrator") ) { $edit = "on"; } } // ------------------------- // Mark it if it isn't approved if ($Approved == "no") { $Subject = "({$ubbt_lang['NOT_APPROVED']}) $Subject"; } // --------------------------------------------------------------- // If this is a new post then we need to set the rowcolor properly if ($newimage) { $rowcolor = "new$color"; } else { $rowcolor = "$color"; } if (!$Icon) { $Icon = "book.gif"; } // -------------------------------------------------------------- // If it is an anonymous post, don't give a link to their profile if ($Reged == "n") { if (!$config['anonnames']){ $Username = $ubbt_lang['ANON_TEXT']; } else { $Username = $anonname; } $Title = $ubbt_lang['UNREGED_USER']; } else { $Username = "$PUsername"; } if ( ($config['showip'] == 1) && $IP) { $IP = "($IP)"; } elseif ( ($config['showip'] == 2) && ( ($user['U_Status'] == "Administrator") || ($ismod == 'yes') ) && ($IP) ) { $IP = "($IP)"; } elseif ( ($config['showip'] == 3) && ($user['U_Status'] == "Administrator") && ($IP) ) { $IP = "($IP)"; } else { $IP = ""; } if ($File) { $File = rawurlencode($File); if (!$downloads) {$downloads = 0; } $filelink = "{$ubbt_lang['FILE_ATTACH']} ($downloads {$ubbt_lang['DOWNLOADS']})
"; } if ( ($edit == "on") || ($reply == "on") ) { if ($edit == "on") { $editlinkstart = ""; $editlinkstop = ""; } if ($reply == "on") { $replylinkstart = ""; $replylinkstop = ""; $quotelinkstart = ""; $quotelinkstop = ""; } } // ----------------------------------------------------------------------- // If there is a poll in this post, we need to give a link to view results if ($Poll) { $Body = str_replace("","
{$ubbt_lang['VIEW_POLL']}",$Body); $Body = str_replace("\$ubbt_lang[SUB_VOTE]'}","{$ubbt_lang['SUB_VOTE']}",$Body); } // ------------------------------------------------- // Only certain options for users that are logged in if ($user['U_Username']) { $addfavlinkstart = " "; $addfavlinkstop = ""; if ($config['mailpost']) { $mailpostlink = " \"{$ubbt_lang['EMAIL_POST']}\" "; } $notifylinkstart = ""; $notifylinkstop = ""; } // -------------------------------------- // Are there any replies to this message? $color = "lighttable"; $indent = 0; // ----------------------------------- // List the first post for this thread $query = " SELECT t1.B_Number,t1.B_Parent,t1.B_Posted,t2.U_Username,t1.B_Subject,t1.B_Status,t1.B_Approved,t1.B_Icon,t2.U_Color,t1.B_Reged,t2.U_Status,t1.B_Counter,t2.U_Number,t1.B_AnonName FROM {$config['tbprefix']}Posts AS t1, {$config['tbprefix']}Users AS t2 WHERE t1.B_Number = '$current' AND t1.B_Posterid = t2.U_Number "; $sth = $dbh -> do_query($query); list ($PNumber,$Parent,$Posted,$Username1,$Subject,$Locked,$Approved,$icon,$Color,$Reged,$PostStatus,$counter,$usernumber,$anonname) = $dbh -> fetch_array($sth); $dbh -> finish_sth($sth); if (!$icon) { $icon = "book.gif"; } $time = $html -> convert_time($Posted,$toffset); $thisone = ",$PNumber,"; $alt = "."; $imagesize = $images['icons']; if ( ($Posted > $unread) && (!strstr($read,$thisone ) ) ) { $alt = "*"; $rowcolor = "new$color"; } else { $alt = "*"; $rowcolor = "$color"; } if ( ($Open == "C") || ($Open == "M") ) { $icon = "lock.gif"; } // --------------------------------------- // If it isn't approved we need to mark it if ($Approved == "no") { $Subject = "({$ubbt_lang['NOT_APPROVED']}) $Subject"; } if ($Number != $PNumber) { $Subjectlinkstart = ""; $Subjectlinkstop = ""; } if ($Reged == "n") { // ------------------------------------------------------------------ // If we aren't allowing anon users to choose their own username then // we display the basic anon user in the user's selected lang if (!$config['anonnames']) { $Username1 = $ubbt_lang['ANON_TEXT']; } else { $Username1 = $anonname; } } else { $PUsername = $Username1; if ($Color) { $PUsername = "$PUsername"; } // --------------------------------------------------------- // We need to know if this was made by an admin or moderator if ($PostStatus == "Administrator") { $RowUserStatus = "\"{$ubbt_lang['USER_ADMIN']}\""; } elseif ( ($PostStatus == "Moderator") && (stristr($modcheck,$usernum)) ){ $RowUserStatus = "\"{$ubbt_lang['USER_MOD']}\""; } $Username1 = "$PUsername"; } // alternate the colors $color = $html -> switch_colors($color); // -------------------------------------- // Grab all of the replies in this thread $query = " SELECT t1.B_Number,t1.B_Parent,t1.B_Posted,t2.U_Username,t1.B_Subject,t1.B_Status,t1.B_Approved,t1.B_Icon,t1.B_Reged,t2.U_Color,t2.U_Status,t2.U_Number,t1.B_AnonName FROM {$config['tbprefix']}Posts AS t1, {$config['tbprefix']}Users AS t2 WHERE t1.B_Main=$current AND t1.B_Posterid = t2.U_Number $Viewable ORDER BY t1.B_Number DESC "; $sth = $dbh -> do_query($query); while(list($anumber,$aparent,$aposted,$ausername,$asubject,$aopen,$aapproved,$aicon,$areged,$acolor,$austatus,$ausernumber,$aanonname) = $dbh -> fetch_array($sth)) { if ($aparent == "0") { continue; } $tree[$aparent][$anumber]['Posted'] = $aposted; $tree[$aparent][$anumber]['Username'] = $ausername; $tree[$aparent][$anumber]['Subject'] = $asubject; $tree[$aparent][$anumber]['Approved'] = $aapproved; $tree[$aparent][$anumber]['Open'] = $aopen; $tree[$aparent][$anumber]['Icon'] = $aicon; $tree[$aparent][$anumber]['Reged'] = $areged; $tree[$aparent][$anumber]['Color'] = $acolor; $tree[$aparent][$anumber]['Status'] = $austatus; $tree[$aparent][$anumber]['Number'] = $anumber; $tree[$aparent][$anumber]['UserNumber'] = $ausernumber; $tree[$aparent][$anumber]['AnonName'] = $aanonname; $istree = 1; } // Find out the number of replies to each parent if (isset($istree)) { $parentkeys = array_keys($tree); $parentsize = sizeof($parentkeys); for($i=0;$i<$parentsize;$i++) { $childkeys = array_keys($tree[$parentkeys[$i]]); $childsize = sizeof($childkeys); $tree[$parentkeys[$i]]['children'] = $childsize; } $z = 0; $color = show_replies($Cat,$Board,$current,$Number,$page,$view,$sb,$indent,$color,$unread,$Viewable,$read,$toffset,$o,$current); } if (isset($postrow)) { $postrowsize = sizeof($postrow); } else { $postrowsize = "0"; } $alttext = $ubbt_lang['ALL_THREADS']; // --------------------- // Grab the tablewrapper list($tbopen,$tbclose) = $html -> table_wrapper(); if (!$debug) { include("$thispath/templates/$tempstyle/showthreaded.tmpl"); } // Send the footer $html -> send_footer(); ?>