MyBB Community Forums

Full Version: forums posts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
we have a tracker with mybb forums in them was wondering if this block would work with torrentstrike source code

begin_block("Forums");?>
<?
         ////--- Begin last  phpBB2 forum posts by Stonebreath - Changes made to suit Torrent Strike by Fireknight---//////



         $res = mysql_query("SELECT count(*) as topic_total FROM mybb_topics") or sqlErr();
         if ($res){

         $row = mysql_fetch_array($res);
         $topics = $row['topic_total'];

         $res1 = mysql_query("SELECT COUNT(*) AS post_total FROM mybb_posts");
         if ($res1) {

         $row = mysql_fetch_array($res1);
         $posts = $row['post_total'];
         }
         } else {
         $topics = 0;
         $posts = 0;
         }

         print("<table cellpadding=\"4\" cellspacing=\"1\" width=\"100%\">\n<tr><td class=\"lista\">\n");
         print("<table width=\"50%\" cellspacing=\"2\" cellpading=\"2\" align=\"center\">\n");

         print("<tr><td align=\"center\" width=\"25%\" class=\"row2\">Topics</td><td align=\"center\" width=\"25%\" class=\"row1\">" . number_format($topics) . "</td>");
         print("<td align=\"center\" width=\"25%\" class=\"row2\">Posts</td><td align=\"center\" width=\"25%\" class=\"row1\">" . number_format($posts) . "</td></tr>\n");

         print("</table>\n</td></tr>\n");

         if ( $topics > 0 ) {
         if (isset($GLOBALS["block_forumlimit"])){
         $limit="LIMIT " . $GLOBALS["block_forumlimit"];
         } else {
         $limit="LIMIT 10";
         }

         print("\n");
         $ares = mysql_query("SELECT forum_id FROM mybb_forums WHERE auth_read = 0") or die(mysql_error());
         $where = "WHERE (P.forum_id = ";
         $fids = array();
         while($arow = mysql_fetch_assoc($ares)) {
         $fids[] = $arow["forum_id"];
         }
         $where .= implode(" OR P.forum_id = ", $fids).")";

         $tres = mysql_query("SELECT T.topic_id, T.topic_title, T.topic_last_post_id, P.post_time AS lastpost, U.user_id, U.username FROM mybb_topics T LEFT JOIN phpbb_posts P ON T.topic_last_post_id = P.post_id LEFT JOIN mybb_users U ON P.poster_id = U.user_id $where ORDER BY `lastpost` DESC $limit") or die(mysql_error());
         print("<td><table width=\"100%\" cellspacing=\"2\" cellpading=\"2\" align=\"center\">\n");
         print("<center><b>Latest Posts</b></center>");
         $uc=0;
         while ($trow = mysql_fetch_array($tres)) {
         $uc++;
         print("<tr>");
         if($uc%2 == 0)
         $utc = "row1";
         else
         $utc = "row2";
         print("<td class='$utc' align='left' colspan='2'>");
         print("<b><a href=\"/".$GLOBALS["FORUMLINK"]."index.php?page=viewtopic&t=" . $trow['topic_id'] . "\"> Post Re-<br> " . $trow['topic_title'] . "</a>:</b><br>");
            print("post by");
         if($trow["user_id"]==-1)

         {
         print("Guest");
         } else {
         print("&nbsp &nbsp<a href=\"/".$GLOBALS["FORUMLINK"]."index.php?page=profile&mode=viewprofile&u=".$trow["user_id"]."\">".stripslashes($trow["username"])."</a><br>");
         }
         print("".date("d-m-Y",$trow["lastpost"]));
         print(" <a href=\"index.php?page=viewtopic&p=".$trow['topic_last_post_id']."#".$trow['topic_last_post_id']."\">&nbsp <b>View</b></a>");
         print("</td>");
         print("</tr>\n");
         }
         }
         else
         {
         print("<tr><td class=\"row1\">No Topics</td></tr>\n");
         }
         print("</table></td></tr>\n");
         print("</table>\n");




         ////--- End last  phpBB2 forum posts by Stonebreath - Changes made to suit Torrent Strike by Fireknight---//////

?>
<?end_block();
any one or am i not important enough Huh
(2009-01-18, 12:42 PM)clocktower Wrote: [ -> ]any one or am i not important enough Huh


begin_block("Forums");?>
<?
         ////--- Begin last  phpBB2 forum posts by Stonebreath - Changes made to suit Torrent Strike by Fireknight---//////



         $res = mysql_query("SELECT count(*) as topic_total FROM mybb_threads") or sqlErr();
         if ($res){

         $row = mysql_fetch_array($res);
         $topics = $row['topic_total'];

         $res1 = mysql_query("SELECT COUNT(*) AS post_total FROM mybb_posts");
         if ($res1) {

         $row = mysql_fetch_array($res1);
         $posts = $row['post_total'];
         }
         } else {
         $topics = 0;
         $posts = 0;
         }

         print("<table cellpadding=\"4\" cellspacing=\"1\" width=\"100%\">\n<tr><td class=\"lista\">\n");
         print("<table width=\"50%\" cellspacing=\"2\" cellpading=\"2\" align=\"center\">\n");

         print("<tr><td align=\"center\" width=\"25%\" class=\"row2\">Topics</td><td align=\"center\" width=\"25%\" class=\"row1\">" . number_format($topics) . "</td>");
         print("<td align=\"center\" width=\"25%\" class=\"row2\">Posts</td><td align=\"center\" width=\"25%\" class=\"row1\">" . number_format($posts) . "</td></tr>\n");

         print("</table>\n</td></tr>\n");

         if ( $topics > 0 ) {
         if (isset($GLOBALS["block_forumlimit"])){
         $limit="LIMIT " . $GLOBALS["block_forumlimit"];
         } else {
         $limit="LIMIT 10";
         }

         print("\n");
         $res = mysql_query("SELECT count(*) as topic_total FROM mybb_threads") or sqlErr();
         $where = "WHERE (P.forum_id = ";
         $fids = array();
         while($arow = mysql_fetch_assoc($ares)) {
         $fids[] = $arow["forum_id"];
         }
         $where .= implode(" OR P.forum_id = ", $fids).")";

         $tres = mysql_query("SELECT T.topic_id, T.topic_title, T.topic_last_post_id, P.post_time AS lastpost, U.user_id, U.username FROM mybb_topics T LEFT JOIN mybb_posts P ON T.topic_last_post_id = P.post_id LEFT JOIN phpbb_users U ON P.poster_id = U.user_id $where ORDER BY `lastpost` DESC $limit") or die(mysql_error());
         print("<td><table width=\"100%\" cellspacing=\"2\" cellpading=\"2\" align=\"center\">\n");
         print("<center><b>Latest Posts</b></center>");
         $uc=0;
         while ($trow = mysql_fetch_array($tres)) {
         $uc++;
         print("<tr>");
         if($uc%2 == 0)
         $utc = "row1";
         else
         $utc = "row2";
         print("<td class='$utc' align='left' colspan='2'>");
         print("<b><a href=\"/".$GLOBALS["FORUMLINK"]."phpbb2.php?page=viewtopic&t=" . $trow['topic_id'] . "\"> Post Re-<br> " . $trow['topic_title'] . "</a>:</b><br>");
            print("post by");
         if($trow["user_id"]==-1)

         {
         print("Guest");
         } else {
         print("&nbsp &nbsp<a href=\"/".$GLOBALS["FORUMLINK"]."index.php?page=profile&mode=viewprofile&u=".$trow["user_id"]."\">".stripslashes($trow["username"])."</a><br>");
         }
         print("".date("d-m-Y",$trow["lastpost"]));
         print(" <a href=\"index.php?page=viewtopic&p=".$trow['topic_last_post_id']."#".$trow['topic_last_post_id']."\">&nbsp <b>View</b></a>");
         print("</td>");
         print("</tr>\n");
         }
         }
         else
         {
         print("<tr><td class=\"row1\">No Topics</td></tr>\n");
         }
         print("</table></td></tr>\n");
         print("</table>\n");




         ////--- End last  phpBB2 forum posts by Stonebreath - Changes made to suit Torrent Strike by Fireknight---//////

?>
<?end_block();