convert_time($Posted,$offset); $alt = "."; $thisone = ",$PNumber,"; // ---------------- // Folder or icon? $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 ($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; } $UserStatus = ""; } else { $PUsername = $Username; if ($Color) { $PUsername = "$PUsername"; } // --------------------------------------------------------- // We need to know if this was made by an admin or moderator if ($UserStatus == "Administrator") { $UserStatus = "\"{$ubbt_lang['USER_ADMIN']}\""; } elseif (($UserStatus == "Moderator") && (stristr($modlist,",$Uid,"))) { $UserStatus = "\"{$ubbt_lang['USER_MOD']}\""; } else { $UserStatus = ""; } $Username = "$PUsername"; } // Setup the postrow array $postrow[$z]['color'] = $rowcolor; $postrow[$z]['indentsize'] = $indentsize; $postrow[$z]['icon'] = $icon; $postrow[$z]['imagesize'] = $imagesize; $postrow[$z]['Number'] = $PNumber; $postrow[$z]['Subject'] = $Subject; $postrow[$z]['Username'] = $Username; $postrow[$z]['UserStatus'] = $UserStatus; $postrow[$z]['Views'] = " "; $postrow[$z]['Replies'] = " "; $postrow[$z]['time'] = $time; $postrow[$z]['pageprint'] = ""; $postrow[$z]['UserNumber'] = $Uid; $postrow[$z]['Rating'] = ""; $postrow[$z]['fpart'] = ""; $postrow[$z]['jumper'] = ""; // -------------------- // alternate the colors $color = $html -> switch_colors($color); if (isset($tree[$PNumber]['children'])) { $color = show_replies($Cat,$PNumber,$Board,$indent,$unread,$read,$color,$page,$view,$sb,$sort,$Viewable,$offset,$C,$mode,$o,$PNumber); } } $indent--; return $color; } // -------------------------------- // END OF THE SHOW_REPLIES FUNCTION // ----------------- // Get the user info $html = new html; $userob = new user; $user = $userob -> authenticate("U_Display, U_Groups, U_Sort, U_View, U_PostsPer, U_TempRead, U_FlatPosts, U_TimeOffset,U_ActiveThread"); $Username = $user['U_Username']; isset($user['U_Display']) && $mode = $user['U_Display']; isset($user['U_Groups']) && $Groups = $user['U_Groups']; isset($user['U_Sort']) && $usersort = $user['U_Sort']; isset($user['U_View']) && $userview = $user['U_View']; isset($user['U_StyleSheet']) && $mystyle = $user['U_StyleSheet']; isset($user['U_ActiveThread']) && $useractivethread = $user['U_ActiveThread']; isset($user['U_TempRead']) && $read = $user['U_TempRead']; isset($user['U_PostsPer']) && $PostsPer = $user['U_PostsPer']; isset($user['U_Status']) && $userstatus = $user['U_Status']; isset($user['U_TimeOffset']) && $useroffset = $user['U_TimeOffset']; // -------------------------------- // Get some default display options if (empty($user['U_FlatPosts'])) { $user['U_FlatPosts'] = $theme['flatposts']; } // Postrow array key holder $z=0; // -------------------------------------- // Do we link to showthreaded or showflat if (!$mode) { $mode = $theme['postlist']; } $mode = "show$mode"; // ---------------------------------------------------------------- // If they are logged in then we check their groups, otherwise they // get set to the guest group if (!$Groups) { $Groups = "-4-"; } // -------------------------- // Set the default sort order if ( (empty($sb)) && ($usersort) ) { $sb = $user['U_Sort']; } elseif( (empty($sb)) && (!$usersort) ) { $sb = $theme['sort']; } // ------------------------------------------------------- // If $view isn't set then it gets set to the default view if ( (empty($view)) && ($userview) ) { $view = $user['U_View']; } elseif ( (empty($view)) && (!$userview) ) { $view = $theme['threaded']; } // ---------------------------------------- // If $page isn't set then it defaults to 0 if (empty($page)) { $page = 0; } // -------------------------------------------------------------- // 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 .= ")"; // ------------------- // Grab the board info $Board_q = addslashes($Board); $query = " SELECT Bo_Title,Bo_Last,Bo_Read_Perm,Bo_Write_Perm,Bo_Moderated,Bo_Cat,Bo_CatName,Bo_ThreadAge,Bo_Reply_Perm,Bo_HTML,Bo_Markup,Bo_SpecialHeader,Bo_StyleSheet FROM {$config['tbprefix']}Boards WHERE Bo_Keyword = '$Board_q' $groupquery "; $sth = $dbh -> do_query($query); $rows = $dbh -> fetch_array($sth); list($Title,$Last,$CanRead,$CanWrite,$Moderated,$C,$CatName,$ThreadAge,$CanReply,$HTML,$Markup,$fheader,$fstyle) = $rows; $dbh -> finish_sth($rows); if (!$Title) { $html -> not_right($ubbt_lang['BAD_GROUP'],$Cat); } // ---------------------------------- // 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); $modlist = ","; while (list($modid,$modname) = $dbh -> fetch_array($sth)) { $moderator[$modid] = $modname; $modlist .="$modid,"; } // ------------------------------------------------- // Here we need to figure out what stylesheet to use 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; // --------------------- // Give them the jump box $jumpbox = $html -> jump_box($Cat,$groupquery,$Board); // 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']}"; } // --------------------------------------- // How old of threads should we be showing if (!isset($o)) { $o = $useractivethread; if (!$o) { $o = $ThreadAge; } if ($o == "999") { $o = $ThreadAge; } } if ( (!empty($o)) && ($o != "all") ) { $time = $html -> get_date(); $time = $time - ($o * 86400); $activethread = "AND (t1.B_Last_Post > $time OR t1.B_Sticky = '1')"; } if (empty($o)) { $o = ""; } if ($o == "1") { $d1 = "selected=\"selected\""; } elseif ($o == 2) { $d2 = "selected=\"selected\""; } elseif ($o == 7) { $w1 = "selected=\"selected\""; } elseif ($o == 14) { $w2 = "selected=\"selected\""; } elseif ($o == 21) { $w3 = "selected=\"selected\""; } elseif ($o == 31) { $m1 = "selected=\"selected\""; } elseif ($o == 93) { $m3 = "selected=\"selected\""; } elseif ($o == 186) { $m6 = "selected=\"selected\""; } elseif ($o == 365) { $y1 = "selected=\"selected\""; } else { $allofthem = "selected=\"selected\""; } // ------------------------------------------------------------ // Set up some stuff so we know what the last post they saw was // and update this to the current last post of the board $Username_q = addslashes($Username); $LastViewed = "$Board"."Last"; if(empty(${$config['cookieprefix']."w3t_visit"})) { ${$config['cookieprefix']."w3t_visit"} = ""; } if ( ($Username) && (!strstr(${$config['cookieprefix']."w3t_visit"},"-$Board=") ) ) { $currtime = $html -> get_date(); $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; } // ---------------------------------------------- // Only update the database if they are logged in if ($Username) { $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); } // ------------------------------------------------------------------- // If we don't already have the time that they last visited this forum // then we need to get it out of the cookie or session if (empty($unread)) { $script['0'] = ""; preg_match ("/-$Board=(.*?)-/",${$config['cookieprefix']."w3t_visit"},$script); if (isset($script['1'])) { $unread = $script['1']; } } // ------------------------------------------------------------------- // If this is a non logged in user we pad the field so it doesn't show // them all as new if (!$unread) { $unread = "4294967295"; } // ------------------ // Send a html header $html -> send_header("{$ubbt_lang['VIEWFORUM']} $Title",$Cat,0,$user,$Board,$CanRead); // 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,$count) = $dbh -> fetch_array($sth)) { ${$Type} = $count; } // ------------------------- // Set up some sorting stuff if ($sb == 1) { $SubjectS = "\"\""; } elseif ($sb == 2) { $SubjectS = "\"\""; } elseif ($sb == 3) { $PosterS = "\"\""; } elseif ($sb == 4) { $PosterS = "\"\""; } elseif ($sb == 5) { $LastS = "\"\""; } elseif ($sb == 6) { $LastS = "\"\""; } elseif ($sb == 7) { $ViewsS = "\"\""; } elseif ($sb == 8) { $ViewsS = "\"\""; } elseif ($sb == 9) { $RepliesS = "\"\""; } elseif ($sb == 10) { $RepliesS = "\"\""; } elseif ($sb == 11) { $RatingS = "\"\""; } elseif ($sb == 12) { $RatingS = "\"\""; } // --------------------------------------------------------------------- // We need to check and see if they have write privileges for this forum $gsize = sizeof($Grouparray); for ($i=0; $i <$gsize; $i++) { if (strstr($CanWrite,"-$Grouparray[$i]-") ) { $makepost = "yes"; break; } } if ($makepost == "yes") { $newpoststart = ""; $postoption = "newpost.gif"; $newpoststop = ""; } else { $postoption = "greynewpost.gif"; } // --------------------- // Set some sorting opts $sortsubject = 1; $sortposter = 3; $sortdate = 6; $sortviews = 7; $sortreplies = 9; $sortrating = 11; // ----------------------------------------------- // Make sure we are giving the proper sort options if ($sb == 1) { $sortsubject = 2; } else { $sortsubject = 1; } if ($sb == 3) { $sortposter = 4; } else { $sortposter = 3; } if ($sb == 5) { $sortdate = 6; } else { $sortdate = 5; } if ($sb == 7) { $sortviews = 8; } else { $sortviews = 7; } if ($sb == 9) { $sortreplies = 10; } else { $sortreplies = 9; } if ($sb == 11) { $sortrating = 12; } else { $sortrating = 11; } // -------------------------------------------------------------------- // If dateslip is on, we sort by Last_Post, otherwise we sort by Posted if (!$config['dateslip']) { $sort_opt = array( 1 => 't1.B_Sticky DESC,t1.B_Subject DESC', 2 => 't1.B_Sticky DESC,t1.B_Subject ASC', 3 => 't1.B_Sticky DESC,t2.U_Username DESC', 4 => 't1.B_Sticky DESC,t2.U_Username ASC', 5 => 't1.B_Sticky DESC,t1.B_Posted DESC', 6 => 't1.B_Sticky DESC,t1.B_Posted ASC', 7 => 't1.B_Sticky DESC,t1.B_Counter DESC', 8 => 't1.B_Sticky DESC,t1.B_Counter ASC', 9 => 't1.B_Sticky DESC,t1.B_Replies DESC', 10 => 't1.B_Sticky DESC,t1.B_Replies ASC', 11 => 't1.B_Sticky DESC,t1.B_RealRating DESC', 12 => 't1.B_Sticky DESC,t1.B_RealRating ASC' ); $sort_by = $sort_opt[$sb]; } else { $sort_opt = array( 1 => 't1.B_Sticky DESC,t1.B_Subject DESC', 2 => 't1.B_Sticky DESC,t1.B_Subject ASC', 3 => 't1.B_Sticky DESC,t2.U_Username DESC', 4 => 't1.B_Sticky DESC,t2.U_Username ASC', 5 => 't1.B_Sticky DESC,t1.B_Last_Post DESC', 6 => 't1.B_Sticky DESC,t1.B_Last_Post ASC', 7 => 't1.B_Sticky DESC,t1.B_Counter DESC', 8 => 't1.B_Sticky DESC,t1.B_Counter ASC', 9 => 't1.B_Sticky DESC,t1.B_Replies DESC', 10 => 't1.B_Sticky DESC,t1.B_Replies ASC', 11 => 't1.B_Sticky DESC,t1.B_RealRating DESC', 12 => 't1.B_Sticky DESC,t1.B_RealRating ASC' ); $sort_by = $sort_opt[$sb]; } // ----------------------------------------- // Find out how many posts to show per page if (!$PostsPer) { $PostsPer = $theme['postsperpage']; } // --------------------------------------------------------------------- // Now we calculate which posts to grab for this page. We want to grab // one from the previous page and one from the next page so we know what // the previous and nexts posts will be if (!($page > 0)) { $Totalgrab = $PostsPer + 1; $Posts = $PostsPer + 1; } else { $Startat = $page * $PostsPer; $Posts = $PostsPer + 1; $Totalgrab = "$Startat, $Posts"; } // --------------------------------------------------------------- // If they are a normal user then they can only see approved posts $t1Viewable = "AND t1.B_Approved = 'yes'"; $Viewable = "AND B_Approved = 'yes'"; if ($userstatus == "Administrator") { $Viewable = ""; $t1Viewable = ""; } if ($userstatus == "Moderator") { if (preg_match("/(,|^){$user['U_Number']}(,|$)/i",$modlist)) { $Viewable = ""; $t1Viewable = ""; } } // -------------------- // Setup the limit call $endpage = 1; $limit = "LIMIT $Totalgrab"; $query = " SELECT t1.B_Number,t1.B_Parent,t2.U_Username,t1.B_Posted,t1.B_Last_Post,t1.B_Subject,t1.B_Main,t1.B_Status,t1.B_Approved,t1.B_Icon,t1.B_Reged,t1.B_Counter,t1.B_Replies,t1.B_Rating,t1.B_Rates,t1.B_RealRating,t2.U_Color,t2.U_Status,t1.B_PosterId,t1.B_File,t2.U_Number,t1.B_Sticky,t1.B_AnonName FROM {$config['tbprefix']}Posts AS t1, {$config['tbprefix']}Users AS t2 WHERE t1.B_Topic = 1 AND t1.B_Board = '$Board_q' AND t1.B_PosterId = t2.U_Number $activethread $t1Viewable ORDER BY $sort_by $limit "; $sth = $dbh -> do_query($query); $nums = $dbh -> total_rows($sth); // ------------------------------------------------------------------- // If $page is greater than 0 then we need a link to the previous page if ($page > 0) { $prev = $page - 1; $prevstart = ""; $prevoption = "previous.gif"; $prevstop = ""; } else { $prevoption = "greyprevious.gif"; } // ---------------------------------------------------------------------- // If total parent posts is greater than $PostsPer*Page then we give them // a link to the next page if ($nums >= ($PostsPer + 1) ) { $next = $page + 1; $nextstart = ""; $nextstop = ""; $nextoption = "next.gif"; } else { $nextoption = "greynext.gif"; } // ------------------------------------------------------------- // If $postlist is threaded then we need to give them the proper // button to expand or collapse the threads $expandstart = ""; $expandstop = ""; if ($view == "collapsed") { $expandstart = ""; $expandstop = ""; $expandoption = "expand.gif"; $collapseoption = "greycollapse.gif"; } else { $collapsestart = ""; $collapsestop = ""; $collapseoption = "collapse.gif"; $expandoption = "greyexpand.gif"; } if ( ($config['dateslip']) && ($view != "expanded") ){ $datecolumn = $ubbt_lang['LAST_POST']; } else { $datecolumn = $ubbt_lang['POSTON_TEXT']; } // ---------------------------- // List the posts for this page $color = "lighttable"; for ($i=0; $i<$nums;$i++) { // ------------------------------------------------------------- // We need to break out of here if we are over $PostPer, we just // needed to know if there was a next page or not if ($i == ($PostsPer * $endpage) ) { break; } list($Number,$Parent,$Username,$Posted,$Last_Post,$Subject,$Main,$Open,$Approved,$icon,$Reged,$Counter,$Replies,$Rating,$Rates,$stars,$Color,$PostStatus,$posterid,$file,$UserNumber,$Sticky,$anonname) = $dbh -> fetch_array($sth); // ------------------------- // Standard icon is the note if (!$icon) { $icon = "book.gif"; } // ---------------------------------------------------------- // If this post is sticky then we need to add a sticky icon if ($Sticky) { $Subject = "\"\"$Subject"; } if ($view != "expanded") { $time = $html -> convert_time($Last_Post,$useroffset); } else { $time = $html -> convert_time($Posted,$useroffset); } // ----------------------------------------------------------- // If there is a file attachment we mark it with the disk icon if ($file) { $Subject = "\"\"$Subject"; } $thisone = ",$Number,"; $alt = "."; $newthread = ""; $imagesize = $images['icons']; if ( ($Posted > $unread) && ( !strstr($read,$thisone) ) ) { $rowcolor = "new$color"; $alt = "*"; $newthread = 1; } else { $rowcolor = "$color"; $alt = "."; } if ( ($Open == "C") || ($Open == "M") ) { $icon = "lock.gif"; } // ------------------------------------------------------------------- // If we are doing flat posts or the view is collapsed we need to list // the number of replies // We also need to do this before printing out the initial folder/icon // color so we can let the user know there are new messages in the thread $printreplies = ""; $pagejump = 1; $postmarker = ""; $partnumber = ""; // ------------------------------------------------------------------ // We only want to show the number of new replies if it is configured // in the config file to do the extra queries needed $isset = 0; $newreplies = 0; $replies = $Replies; $printreplies = ""; $new=""; $postrow[$i]['fpart'] = 1; $postrow[$i]['jumper'] = ""; if ( ($config['newcounter']) && ($Last_Post > $unread) ) { $query = " SELECT t1.B_Number,t1.B_Parent,t1.B_Posted FROM {$config['tbprefix']}Posts AS t1 WHERE t1.B_Main = $Number $t1Viewable AND t1.B_Number <> $Number ORDER BY t1.B_Posted "; $sti = $dbh -> do_query($query); $replies = $dbh -> total_rows($sti); $new = "no"; $cycle = 0; for ($j=0; $j<$replies;$j++) { $cycle++; if ($cycle == $user['U_FlatPosts']) { $pagejump++; $cycle = 0; } list($No,$Pa,$Po) = $dbh -> fetch_array($sti); $checkthis = ",$No,"; if ( ($Po > $unread) && ( !stristr($read,$checkthis) ) ){ $new = "yes"; $newreplies++; if (!$isset) { if (!$newthread) { $postrow[$i]['jumper'] = "#Post$No"; $postrow[$i]['fpart'] = $pagejump; $isset = 1; } } } } $dbh -> finish_sth($sti); if ($replies < 1) { $replies = 0; } } if (!isset($postrow[$i]['jumper'])) { $postrow[$i]['jumper'] = ""; } $printreplies = "$replies"; if ($new == "yes") { $printreplies .= " ($newreplies)"; } if ( ($new == "yes") || ( ($Last_Post > $unread) && (!$config['newcounter']) ) ) { if ($rowcolor == "$color") { $rowcolor = "new$color"; $alt = "*"; } } else { $printreplies .= "   "; } // ------------------------------------------------------ // If the post isn't approved we show it in the new color if ($Approved == "no") { $Subject = "({$ubbt_lang['NOT_APPROVED']}) $Subject"; } // ---------------------------------------------------------------- // If we are going to be viewing in flat mode, let's show all pages $pageprint = ""; if ( ($mode == "showflat") && ($Replies >= $user['U_FlatPosts']) ) { $pages = $Replies; if ($Replies <= $user['U_FlatPosts']) { $pages= $pages + 1; } if ($user['U_FlatPosts']) { $pages = ($pages) / $user['U_FlatPosts']; } $pageprint = " ( {$ubbt_lang['PAGE_TEXT']} "; $midprint = ""; for ($prints = 1; $prints <= ($pages + 1); $prints++) { if ($pages > 9) { if ( ($prints < 5) || ($prints > ($pages - 2) ) ) { $pageprint .= "$prints "; } else { if (!$midprint) { $half = ($pages +1) / 2; @list($plink,$extra) = @split("\.",$half); $pageprint .= "... "; $midprint = 1; } } } else { $pageprint .= "$prints "; } } $pageprint .= "{$ubbt_lang['TEXT_ALL']} )"; } 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; } $UserStatus = ""; } else { $PUsername = $Username; if ($Color) { $PUsername = "$PUsername"; } // --------------------------------------------------------- // We need to know if this was made by an admin or moderator $UserStatus = ""; if ($PostStatus == "Administrator") { $UserStatus = "\"{$ubbt_lang['USER_ADMIN']}\""; } elseif (($PostStatus == "Moderator") && (stristr($modlist,",$posterid,"))) { $UserStatus = "\"{$ubbt_lang['USER_MOD']}\""; } else { $UserStatus = ""; } $Username = "$PUsername"; } $ThreadRating = " "; if ($stars) { $ThreadRating = ""; for ($x=1;$x<=$stars;$x++) { $ThreadRating .= "\"*\""; } } if (!$ThreadRating) { $ThreadRating = " "; } // Setup the postrow array $postrow[$z]['color'] = $rowcolor; $postrow[$z]['indentsize'] = "0"; $postrow[$z]['icon'] = $icon; $postrow[$z]['imagesize'] = $imagesize; $postrow[$z]['Number'] = $Number; $postrow[$z]['Subject'] = $Subject; $postrow[$z]['Username'] = $Username; $postrow[$z]['UserStatus'] = $UserStatus; $postrow[$z]['Views'] = $Counter; $postrow[$z]['Replies'] = $printreplies; $postrow[$z]['time'] = $time; $postrow[$z]['pageprint'] = $pageprint; $postrow[$z]['Rating'] = $ThreadRating; $postrow[$z]['posterid'] = $posterid; $postrow[$z]['UserNumber'] = $UserNumber; // -------------------- // alternate the colors $color = $html -> switch_colors($color); // --------------------------------------------------------------- // If we are not doing flat posts and the view is expanded then we // will list all the replies out in a threaded format $tree = array(); if ($view == "expanded") { $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 = $Number AND t1.B_Number <> $Number AND t1.B_PosterId = t2.U_Number $Viewable ORDER BY t1.B_Number Desc "; $stj = $dbh -> do_query($query); $results = 0; while(list($anumber,$aparent,$aposted,$ausername,$asubject,$astatus,$aapproved,$aicon,$areged,$acolor,$austatus,$ausernumber,$aanonname) = $dbh -> fetch_array($stj)) { if ($aparent == 0) { $aparent = $Number; } $results = 1; $tree[$aparent][$anumber]['Uid'] = $ausernumber; $tree[$aparent][$anumber]['Posted'] = $aposted; $tree[$aparent][$anumber]['Username'] = $ausername; $tree[$aparent][$anumber]['Subject'] = $asubject; $tree[$aparent][$anumber]['Approved'] = $aapproved; $tree[$aparent][$anumber]['Icon'] = $aicon; $tree[$aparent][$anumber]['Reged'] = $areged; $tree[$aparent][$anumber]['Color'] = $acolor; $tree[$aparent][$anumber]['UserStatus'] = $austatus; $tree[$aparent][$anumber]['Number'] = $anumber; $tree[$aparent][$anumber]['Status'] = $astatus; $tree[$aparent][$anumber]['AnonName'] = $aanonname; } if ($results) { // Find out the number of replies to each parent $parentkeys = array_keys($tree); $parentsize = sizeof($parentkeys); for($x=0;$x<$parentsize;$x++) { $childkeys = array_keys($tree[$parentkeys[$x]]); $childsize = sizeof($childkeys); $tree[$parentkeys[$x]]['children'] = $childsize; } $color = show_replies($Cat,$Number,$Board,0,$unread,$read,$color,$page,$view,$sb,$sort,$Viewable,$user['U_TimeOffset'],$C,$mode,$o,$Number); } } $z++; } $dbh -> finish_sth($sth); // ------------------------------------------- // Here is where we let them jump around pages $query = " SELECT COUNT(*) FROM {$config['tbprefix']}Posts AS t1 WHERE t1.B_Topic = 1 $activethread AND t1.B_Board = '$Board_q' $t1Viewable "; $sth = $dbh -> do_query($query); $rows = $dbh -> fetch_array($sth); $dbh -> finish_sth($sth); $Threads = $rows['0']; $TotalPages = $Threads / $PostsPer ; $TotalP = $TotalPages; $Leftover = ""; if (stristr($TotalPages,".")) { list($TotalP,$Leftover) = split("\.",$TotalPages); } if ($Leftover > 0) { $TotalP++; } if ($TotalP > 1) { $pagejumpers = "{$ubbt_lang['PAGE_TEXT']}: "; } $Startpage = $page - 10; $Endpage = $page + 10; if ($Startpage < 0) { $Endpage = $Endpage - $Startpage; $Startpage = 0; } if ($Endpage > $TotalP) { $Endpage = $TotalP; $Startpage = $Endpage - 20; } if ($Startpage < 0) { $Startpage = 0; } if ($Startpage > 0) { $prev = $page - 1; $pagejumpers .= "<< "; } if ($Threads > $PostsPer) { for ($i = $Startpage; $i < $Endpage; $i++) { $printedpage = $i + 1; if ($i == $page) { $pagejumpers .= "$printedpage "; } else { $pagejumpers .= "$printedpage "; } } } if ($Endpage < $TotalP) { $next = $page + 1; $pagejumpers .= ">> "; } if ($TotalP > 1) { $pagejumpers .= ""; } // Only give the favorite board and subscribe links to users that have // logged in if ($Username) { $favoriteboardlink = "{$ubbt_lang['FORUM_FAV']}
"; if ($config['subscriptions']) { $subscribeboardlink = "{$ubbt_lang['FORUM_SUB']}
"; } } $postrowsize = ""; if (isset($postrow)) { $postrowsize = sizeof($postrow); } // Moderators $modarray = split(",",$modlist); $modsize = sizeof($modarray); $comma =0; $modlist = ""; for ($i=0;$i<$modsize;$i++) { if ($modarray[$i]) { if ($comma) { $modlist .= ", "; } $modlist .= "{$moderator[$modarray[$i]]}"; $comma++; } else { $modlist .= " "; } } // --------------------- // Grab the tablewrapper list($tbopen,$tbclose) = $html -> table_wrapper(); if (!$debug) { include ("$thispath/templates/$tempstyle/postlist.tmpl"); } // Send the footer $html -> send_footer(); ?>