<? <br />/* <br /># UBB.threads, Version 6 <br /># Official Release Date for UBB.threads Version6: 06/05/2002 <br /> <br /># First version of UBB.threads created July 30, 1996 (by Rick Baker). <br /># This entire program is copyright Infopop Corporation, 2002. <br /># For more info on the UBB.threads and other Infopop <br /># Products/Services, visit: http://www.infopop.com <br /> <br /># Program Author: Rick Baker. <br /> <br /># You may not distribute this program in any manner, modified or otherwise, <br /># without the express, written written consent from Infopop Corporation. <br /> <br /># Note: if you modify ANY code within UBB.threads, we at Infopop Corporation <br /># cannot offer you support-- thus modify at your own peril :) <br /># --------------------------------------------------------------------------- <br />*/ <br /> <br />// ------------------------------------------------- <br />// Variables Section - Edit these to suit your needs <br /> <br /> // Path to your main.inc.php script <br /> $path = "/www/sites/4701.dk/httpdocs/ubbthreads/"; <br /> <br /> // Top threads by "views" or by "replies" <br /> $topthreads = "replies"; <br /> <br /> // Post age threshold. How many days old can a thread be and still make <br /> // the list <br /> $threadage = 7; <br /> <br /> // Set this variable to the total number of threads that you wish to show <br /> $totalthreads = 3; <br /> <br /> // This varialbe will affect the way the thread is listed. Set this to none <br /> // and it will only show the thread Subject, with a link pointing to the <br /> // item on the board. Set it to "full" and it will show the body of the <br /> // item below the subject. Set it to a number and it will show <br /> // that many characters of the body with the subject clickable to read the <br /> // full item. <br /> $threadbody = 'none'; <br /> <br /> // The url to your UBB.threads installation <br /> $forumurl = "http://www.4701.dk/ubbthreads/"; <br /> <br /> // Include the date when the news was posted <br /> $includedate = "no"; <br /> <br /> // Include who it was posted by <br /> $includewho = "no"; <br /> <br /> // You may need to change the unshift line to the path of your UBB.threads <br /> // installation <br /> <br />// ----------------------------- <br />// End of the variables section <br /> require ("$path/main.inc.php"); <br /> <br />// ------------------- <br />// Setup the variables <br /> $html = new html; <br /> $date = $html -> get_date(); <br /> $date = $date - ($threadage * 86400); <br /> <br /> $sort; <br /> if ($topthreads == "views") { <br /> $sort = "t1.B_Counter"; <br /> } <br /> else { <br /> $sort = "t1.B_Replies"; <br /> } <br /> <br />// -------------------------- <br />// Let's grab the news items <br /> $query = " <br /> SELECT t1.B_Number,t1.B_Posted,t1.B_Last_Post,t2.B_Username,t1.B_Subject,t1.B_Body,t1.B_Main,t1.B_Replies,t1.B_Counter,t1.B_Board <br /> FROM {$config['tbprefix']}Posts AS t1, <br /> {$config['tbprefix']}Users AS t2 <br /> WHERE t1.B_Number = t1.B_Main <br /> AND t1.B_Last_Post > '$date' <br /> AND t1.B_PosterId = t2.U_Number <br /> ORDER BY $sort DESC <br /> LIMIT $totalthreads <br /> "; <br /> $sth = $dbh -> do_query($query); <br /> <br />// --------------------------- <br />// echo out the starting html <br /> echo "<DL>"; <br /> <br />// ----------------------- <br />// Cycle through the posts <br /> while ( list($Number,$Posted,$Last,$Username,$Subject,$Body,$Main,$Replies,$Counter,$Keyword) = $dbh -> fetch_array($sth)) { <br /> <br /> // --------------------------------- <br /> // Set up the variables for echoing <br /> $date = $html -> convert_time($Posted); <br /> if ($threadbody == "none") { <br /> $Body = ""; <br /> $Subject = "<a href=\"$forumurl/showflat.php?Board=$Keyword&Number=$Number\">$Subject</a>"; <br /> } <br /> if (ereg("[0123456789]",$threadbody)) { <br /> $Body =substr($Body,0,$threadbody); <br /> $Body .="..."; <br /> $Subject = "<a href=\"$forumurl/showflat.php?Board=$Keyword&Number=$Number\">$Subject</a>"; <br /> } <br /> if ($includedate == "yes") { <br /> $date = "<br>Posted on $date"; <br /> } <br /> else { <br /> $date = ""; <br /> } <br /> if ($includewho == "yes") { <br /> $Username = "<br>Posted by $Username"; <br /> } <br /> else { <br /> $Username = ""; <br /> } <br /> <br /> // ------------------------------- <br /> // The actual HTML that is put out <br /> echo " <br /> <b><font face=\"Verdana\" size=\"2\" color=\"#FFffff\">Top Indlæg</font></b><br> <br /> <table><tr><td width= 100% bgcolor= #CBCDCD ><DT><font size=2><b>$Subject</b> <br /> $date <br /> $Username <br /> <DD>$Body <br /> "; <br /> <br /> // --------------- <br /> // End of the HTML <br /> <br /> } <br /> echo "</DL><td></tr></table>"; <br /> $dbh -> finish_sth($sth);