home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 May / INTERNET103.ISO / pc / software / windows / building / php_nuke / html / modules / forums / index.php < prev    next >
Encoding:
PHP Script  |  2002-09-16  |  15.8 KB  |  374 lines

  1. <?php
  2. ######################################################################
  3. # Modulo Splatt Forum per PHP-NUKE ver.5.6
  4. #-------------------------
  5. # Versione: 3.2
  6. #
  7. # Copyright (c) 2002 by:
  8. #
  9. # Giorgio Ciranni (~Splatt~)
  10. # (http://www.splatt.it)
  11. # (webmaster@splatt.it)
  12. #
  13. # Supporto tecnico disponibile sul Forum di www.splatt.it 
  14. ######################################################################
  15. # Splatt Forum is free software. You can redistribute it and/or modify
  16. # it under the terms of the GNU General Public License as published by
  17. # the Free Software Foundation; either version 2 of the License.
  18. # Splatt Forum is distributed in the hope that it will be useful,
  19. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21. # GNU General Public License for more details.
  22. #
  23. # You should have received a copy of the GNU General Public License
  24. # along with this program; if not, write to the Free Software
  25. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   
  26. # 02111-1307  USA
  27. ######################################################################
  28.  
  29. $mtime = microtime();
  30. $mtime = explode(" ",$mtime);
  31. $mtime = $mtime[1] + $mtime[0];
  32. $starttime = $mtime;
  33.  
  34. ######################################################################
  35. $avatarmod = 0; // set 1 if you want moderator avatar in index.page
  36. ######################################################################
  37. $collapse = 1; //set 1 only if you have modified theme for this
  38. ######################################################################
  39.  
  40. if (!eregi("modules.php", $PHP_SELF)) {
  41.     die ("Youn can't access this file directly...");
  42.     }
  43.  
  44. $module_name = "$name";
  45. include("config.php");
  46. require_once("modules/$module_name/functions.php");
  47. $pagetitle = " - Splatt Forum $forumver - >>Index<< -";
  48. include("modules/$module_name/auth.php");
  49. include("header.php");
  50. include ("modules/Forums/class.overlib.php"); 
  51. $ol = new Overlib();
  52.  
  53.     echo"<table width=\"100%\"><tr><td align=\"left\">"
  54.         ."<img src=\"images/forum/forumlogo11.gif\" width=\"168\" height=\"84\" alt=\"Forum\"></td>"
  55.         ."<td><center><b>"._BENV."$sitename</b><br><br>"
  56.         .""._HEAD1."<br>"
  57.         .""._HEAD2."<br><br>"
  58.         .""._HEAD3."</center><br></td></tr></table>";
  59.  
  60.  
  61.     if(!$result = mysql_query("SELECT * FROM ${prefix}_catagories ORDER BY cat_order"))
  62.         die("<font size=+1>"._ERRORE1."</font><hr>"._UNABLETOQUERY."");
  63.  
  64. Opentable2();
  65.  
  66. echo "..."._LASTVISIT.convertiData($userdata[lastvisit])."";
  67.  
  68. Closetable2();
  69.  
  70. echo"<table align=\"center\" border=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td align=\"center\">"
  71.    ."<table align=\"center\" border=\"0\" cellpadding=\"0\" width=\"100%\" BGCOLOR=\"$bgcolor2\"><tr><td align=\"center\">";
  72.  
  73. $totale_topics = mysql_num_rows(mysql_query("SELECT * FROM ${prefix}_forumtopics"));
  74.  
  75. $totale_posts = mysql_num_rows(mysql_query("SELECT * FROM ${prefix}_posts"));
  76.  
  77. echo "<font size=1>"._FATTACT."</font><font color=\"green\"><b> $totale_topics</b></font><font size=\"1\"> "._DISCTOT."</font><font color=\"green\"><b> $totale_posts </b></font><font size=\"1\"> "._FPOSTS."</font>";
  78.  
  79. echo"</td></tr></table>"
  80.     ."</td></tr></table>";
  81.  
  82. $risultato = mysql_query("select index_head from ${prefix}_forum_config");
  83.     list($index_head) = mysql_fetch_row($risultato);
  84. echo "<table width=\"100%\"><tr><td>";
  85.  
  86. Opentable();
  87.  
  88. $index_head = stripslashes($index_head);
  89.  
  90. echo "<center><i>$index_head</i></center>";
  91.  
  92. Closetable();
  93.  
  94. echo "</td></tr></table>";
  95. echo"<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"0\" ALIGN=\"CENTER\" VALIGN=\"TOP\" WIDTH=\"100%\"><TR><TD>";
  96. echo"<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"1\" WIDTH=\"100%\">";
  97. echo"<TR>";
  98. echo"<TD background=\"images/forum/cellpic3.gif\" ALIGN=\"LEFT\" VALIGN=\"MIDDLE\" colspan=\"2\" height=\"38\"><font color=\"#ffffff\"> <B>"._FORUM."</B></font></TD>";
  99. echo"<TD background=\"images/forum/cellpic3.gif\" ALIGN=\"CENTER\"><FONT COLOR=\"#ffffff\"> <B>"._FTOPICS."</B> </font></TD>";
  100. echo"<TD background=\"images/forum/cellpic3.gif\" ALIGN=\"CENTER\"><FONT SIZE=\"1\" COLOR=\"#ffffff\"> <B>"._FPOSTS."</B> </font></TD>";
  101. echo"<TD background=\"images/forum/cellpic3.gif\" ALIGN=\"CENTER\"><FONT SIZE=\"1\" COLOR=\"#ffffff\"> <B>"._FLPOSTS."</B> </font></TD>";
  102. echo"<TD background=\"images/forum/cellpic3.gif\" ALIGN=\"CENTER\"><FONT SIZE=\"1\" COLOR=\"#ffffff\"> <B>"._FFMOD."</B> </font></TD></TR>";
  103.  
  104. $row = @mysql_fetch_array($result);
  105.  
  106.     do {
  107.  
  108.         $sub_sql = "SELECT f.*, u.uname, m.user_id, m.forum_id FROM ${prefix}_forums f, ".$user_prefix."_users u, ${prefix}_forum_mods m WHERE f.cat_id = '$row[cat_id]' AND m.forum_id = f.forum_id AND m.user_id = u.uid ORDER BY f.forum_id";
  109.       
  110.         if(!$sub_result = mysql_query($sub_sql, $db))
  111.             die("<font size=+1>"._ERRORE1."</font><hr>"._UNABLETOQUERY."");
  112.  
  113.         if($myrow = mysql_fetch_array($sub_result)) {
  114.  
  115.             $title = stripslashes($row[cat_title]);
  116.  
  117.             echo "<TR ALIGN=\"LEFT\" VALIGN=\"MIDDLE\"><TD background=\"images/forum/cellpic1.gif\" COLSPAN=6 height=\"25\"><FONT SIZE=2 COLOR=\"$textcolor2\"> <B>$title</B></FONT></TD></TR>";
  118.  
  119. // Keledan
  120.             $prevForum = ""; // variabile di controllo, memorizza il forum_id del ciclo precedente
  121.  
  122.                 do {
  123. // Keledan
  124.                      if ($prevForum != $myrow[forum_id])  // fa il ciclo solo se
  125.                      {
  126.                          $last_post = get_last_post($myrow[forum_id], $db, "forum");
  127.                          echo "<TR  ALIGN=\"LEFT\" VALIGN=\"TOP\">";
  128.                          $total_topics = get_total_topics($myrow[forum_id], $db);
  129.  
  130.                         if(($userdata["lastvisit"] < $last_post[post_time]) && $last_post[post_time] != "No posts") {
  131.  
  132.                                 echo "<TD BGCOLOR=\"$bgcolor1\" ALIGN=\"CENTER\" VALIGN=\"TOP\" WIDTH=5%><IMG SRC=\"images/forum/icons/status_del.gif\"></TD>";
  133.  
  134.                         }
  135.  
  136.                         else {
  137.                                 echo "<TD BGCOLOR=\"$bgcolor1\" ALIGN=\"CENTER\" VALIGN=\"TOP\" WIDTH=5%><IMG SRC=\"images/forum/icons/status_del1.gif\"></TD>";
  138.                         }
  139.  
  140.         if($myrow[forum_atch]==1)
  141.                         {
  142.                             $allegati = ""._FSI."";
  143.                         }
  144.                         else
  145.                             {
  146.                                 $allegati =""._FNO."";
  147.                             }
  148. $foname = stripslashes($myrow[forum_name]);
  149.  
  150.                         echo "<TD BGCOLOR=\"$bgcolor3\"><FONT SIZE=2 COLOR=\"$textcolor2\"><table width=\"100%\" bgcolor=\"$bgcolor2\"><tr><td><a href=\"modules.php?op=modload&name=$module_name&file=viewforum&forum=$myrow[forum_id]\">$foname </a></font></td></tr></table>\n";
  151.  
  152.                         $desc = stripslashes($myrow[forum_desc]);
  153.  
  154.                         echo "<br><FONT SIZE=1 COLOR=\"$textcolor2\">$desc</font><br>";
  155.                         echo"<a href=\"modules.php?op=modload&name=".$module_name."&file=newtopic&forum=$myrow[forum_id]\"><img src=\"images/forum/componi.gif\" border=\"0\" ";
  156. $ol->pover(""._HSH1."",""._SFHS."");
  157.                         echo"></a>";
  158.  
  159.                         if ($myrow[forum_access]=="0" && $myrow[forum_type] == "0")
  160.                         echo "<font color=\"FB9260\">["._FACCE.": <i>"._FFA."</i>";
  161.  
  162.                         if ($myrow[forum_access]=="1" && $myrow[forum_type] == "0")
  163.                         echo "<font color=\"FB9260\">["._FACCE.": <i>"._FREG."</i>";
  164.  
  165.                         if ($myrow[forum_access]=="2" && $myrow[forum_type] == "0")
  166.                         echo "<font color=\"FB9260\">["._FACCE.": <i>"._FMODS."</i>";
  167.  
  168.                         if ($myrow[forum_type] == "1")
  169.                         echo "<font color=\"FB9260\">["._FACCE.": <i>"._PASSW."</i>";
  170.                         echo "]   ["._FORUMATCHM.": <i>$allegati</i>]</font></TD>\n";
  171.                         echo "<TD BGCOLOR=\"$bgcolor3\" WIDTH=5% ALIGN=\"CENTER\" VALIGN=\"MIDDLE\"><FONT SIZE=1 COLOR=\"$textcolor2\">$total_topics</font></TD>\n";
  172.  
  173.                         $total_posts = get_total_posts($myrow[forum_id], $db, "forum");
  174.  
  175.                         echo "<TD BGCOLOR=\"$bgcolor1\" WIDTH=5% ALIGN=\"CENTER\" VALIGN=\"MIDDLE\"><FONT SIZE=1 COLOR=\"$textcolor2\">$total_posts</font></TD>\n";
  176.                         echo "<TD BGCOLOR=\"$bgcolor3\" WIDTH=15% ALIGN=\"CENTER\" VALIGN=\"MIDDLE\"><FONT SIZE=1 COLOR=\"$textcolor2\">";
  177.  
  178.             if($last_post[post_time]==""){
  179.                 echo""._NONEPOST."";
  180.             }
  181.             else{
  182.                     echo"".convertiData($last_post[post_time])." "._BY." <a href=\"modules.php?name=Your_Account&op=userinfo&uname=$last_post[user]\">$last_post[user]</a></font><br><br><a href=\"modules.php?op=modload&name=".$module_name."&file=viewtopic&topic=$last_post[topic_id]&forum=$myrow[forum_id]\"><img src=\"images/forum/icons/icon_ultima.gif\" border=\"0\"";
  183. $ol->pover(""._HSH2."",""._SFHS."");
  184.                     echo"></a>";
  185.                     echo"</TD>\n";
  186.         }
  187.  
  188.                         $forum_moderator = $myrow[uname];
  189.                         $moderators = get_moderators($myrow[forum_id], $db);
  190.  
  191.                         echo "<TD BGCOLOR=\"$bgcolor1\" WIDTH=5% ALIGN=\"CENTER\" VALIGN=\"MIDDLE\"><FONT SIZE=\"1\" COLOR=\"$textcolor2\">";
  192.  
  193.                         $count = 0;
  194.                         reset ($moderators);
  195.                         while(list($null, $mods) = each($moderators)) {
  196.                                 while(list($mod_id, $mod_name) = each($mods)) {
  197.                         if($avatarmod== 1){
  198.                             $ri = mysql_query("select user_avatar from ${user_prefix}_users where uname = '$mod_name'");
  199.  
  200.                             list($modicon) = mysql_fetch_row($ri);                                      
  201.                                         echo "<BR><a href=\"modules.php?name=Your_Account&op=userinfo&uname=$mod_name\"><IMG SRC=\"images/forum/avatar/$modicon\" BORDER=\"0\" alt=\"$mod_name\"></a><br>";
  202.  
  203.     }
  204.     else {
  205.         echo "$mod_name<BR><a href=\"modules.php?name=Your_Account&op=userinfo&uname=$mod_name\"><IMG SRC=\"images/forum/subject/icon35.gif\" BORDER=\"0\"></a><br>";
  206.  
  207.     }
  208.                                    
  209.                                    $count++;
  210.                 
  211.                             }
  212.                     }
  213.  
  214.                         echo "</font></TD></TR>\n";
  215.  
  216. //                      Keledan
  217.                         $prevForum = $myrow[forum_id];
  218. }
  219.                 } while($myrow = mysql_fetch_array($sub_result));
  220.         }
  221. } while($row = mysql_fetch_array($result));
  222.  
  223. ?>
  224.  
  225. </TD></TR>
  226. <TR ALIGN="RIGHT" >
  227. <TD COLSPAN=6 BGCOLOR="<?php echo $bgcolor2?>" ><font color="<?php echo $textcolor1;?>"><b><?php bbsearchblock()?></b></font></TD></TR>
  228.  
  229. <?php 
  230.  
  231.     if($totale_topics != 0){
  232.         $mediarisposte = $totale_posts / $totale_topics;
  233.     }
  234.     else
  235.     {
  236.         $mediarisposte="(dato attualmente non disponibile)";
  237. }
  238.  
  239. echo"<TR><TD COLSPAN=6 BGCOLOR=\"$bgcolor2\">";
  240.  
  241. Opentable();
  242.  
  243. ?>
  244.  
  245. <font color="<?php echo $textcolor1;?>"><b> <?php echo _FLEGEN; ?>:</b><br> <IMG SRC="images/forum/icons/status_del.gif"> = <?php echo _NPO; ?><BR> <IMG SRC="images/forum/icons/status_del1.gif"> = <?php echo _NNPO; ?><br><br> 
  246. <?php
  247. echo""._FNOTA." </td></tr>"; 
  248.  
  249. Closetable();
  250.  
  251. Opentable();
  252.  
  253. echo"<tr><TD background=\"images/forum/cellpic1.gif\" height=\"25\">";
  254.  
  255. echo"<center>--- "._FMEDRI."  <b> $mediarisposte </b>    "._FRISPS." ---</center></font></TD></tr>";
  256.  
  257. Closetable();
  258.  
  259. echo"</font></center><TD></TR>"
  260.     ."</TABLE></TD></TR></TABLE>"
  261.     ."<TABLE bgcolor=\"$bgcolor1\" ALIGN=\"CENTER\" BORDER=\"0\" WIDTH=\"100%\">";
  262.  
  263. $result = mysql_query("SELECT   t1.topic_id,t1.topic_title,t1.topic_time, t1.topic_views,t1.forum_id  FROM ${prefix}_forums t0,${prefix}_forumtopics t1   WHERE t0.forum_type = 0  AND t0.forum_id = t1.forum_id     ORDER BY t1.topic_views  DESC  LIMIT 0, 10");
  264.  
  265. while(list($topic_id, $topic_title, $topic_time, $topic_views, $forum_id) = mysql_fetch_row($result)) 
  266.  
  267. {
  268.  
  269. $res = mysql_query("select image from ".$prefix."_posts where topic_id='$topic_id'");
  270.  
  271.  list ($image) = mysql_fetch_row($res);
  272.  
  273.     if($image == "")
  274.     {
  275.         $image= "icon33.gif";
  276.     }
  277.  
  278. $title2 = ereg_replace("_", " ", $topic_title);
  279. $title3 = substr("$title2", 0,35);
  280.  
  281. $content1 .= "<table><tr><td width=\"20\"><img src=\"images/forum/subject/$image\" alt=\"$title2 - $topic_time\"></td><td><a href=\"modules.php?op=modload&name=$module_name&file=viewtopic&topic=$topic_id&forum=$forum_id \">$title2</a>    ($topic_views)</td></tr></table>";
  282.  
  283. }
  284.  
  285. $result = mysql_query("SELECT   t1.topic_id,t1.topic_title,t1.topic_time,t1.forum_id  FROM ${prefix}_forums t0,${prefix}_forumtopics t1   WHERE t0.forum_type = 0  AND t0.forum_id = t1.forum_id     ORDER BY t1.topic_time  DESC  LIMIT 0, 10");
  286.  
  287. while(list($topic_id, $topic_title, $topic_time, $forum_id) = mysql_fetch_row($result)) 
  288.  
  289. {
  290.  
  291. $res = mysql_query("select image from ".$prefix."_posts where topic_id='$topic_id'");
  292.  
  293.     list ($image) = mysql_fetch_row($res);
  294.  
  295.     if($image == "")
  296.     {
  297.         $image= "icon33.gif";
  298.     }
  299.  
  300. $title2 = ereg_replace("_", " ", $topic_title);
  301. $title2 = stripslashes($title2);
  302. $title3 = substr("$title2", 0,40);
  303.  
  304. $content2 .= "<table><tr><td width=\"30\"><img src=\"images/forum/subject/$image\" alt=\"$title2 - $topic_time\"></td><td><a href=\"modules.php?op=modload&name=".$module_name."&file=viewtopic&topic=$topic_id&forum=$forum_id \">  $title3</a></td></tr></table>";
  305.  
  306. }
  307.  
  308. echo"<TR ALIGN=\"CENTER\" >"
  309.     ."<TD height=\"5\" COLSPAN=6 BGCOLOR=\"$bgcolor2\"><TD></TR>"
  310.     ."<tr><td height=\"38\" background=\"images/forum/cellpic3.gif\" valign=\"middle\" width=\"40%\" align=\"left\"> <img src=\"images/forum/question.gif\"";
  311.  
  312. $ol->pover(""._HSH5."",""._SFHS."");
  313.  
  314. echo">  <font color=\"white\">  <b>"._FMPIUL."</b></font></td>"
  315.     ."<td  colspan=\"3\" width=\"20%\" align=\"left\"></td>"
  316.     ."<td height=\"38\" background=\"images/forum/cellpic3.gif\" valign=\"middle\" width=\"40%\" align=\"left\"> <img src=\"images/forum/question.gif\"";
  317.  
  318. $ol->pover(""._HSH6."",""._SFHS."");
  319.  
  320. echo">  <font color=\"white\">  <b>"._FULTM."</b></font></td></tr>";
  321. echo"<TR ALIGN=\"CENTER\" >"
  322.     ."<TD height=\"5\" COLSPAN=6 BGCOLOR=\"$bgcolor2\"></TD></TR>"
  323.     ."<tr><td background=\"images/forum/cellpic1.gif\" valign=\"top\" width=\"40%\" align=\"left\" height=\"25\">$content1</td>"
  324.     ."<td  colspan=\"3\" width=\"20%\" align=\"left\"></td>"
  325.     ."<td background=\"images/forum/cellpic1.gif\" valign=\"top\" width=\"40%\" align=\"left\" height=\"25\">$content2</td></tr>"
  326.     ."<TR ALIGN=\"CENTER\" >"
  327.     ."<TD height=\"5\" COLSPAN=6 BGCOLOR=\"$bgcolor2\"></TD></TR>"
  328.     ."<TR><TD background=\"images/forum/cellpic1.gif\" COLSPAN=\"6\">";
  329.  
  330.     if($collapse == 1){
  331.  
  332.         if($index == 2){
  333.  
  334.             echo"<center><font color=\"white\"><a href=\"modules.php?op=modload&name=".$module_name."&file=index&indexut=0\"";
  335. $ol->pover(""._HSH4."",""._SFHS."");
  336. echo">"._FVISBS."</a></font></center></TR></TD>";
  337.  
  338.         }
  339.     else 
  340.         {
  341.             echo"<center><font color=\"white\"><a href=\"modules.php?op=modload&name=".$module_name."&file=index&indexut=2\"";
  342. $ol->pover(""._HSH3."",""._SFHS."");
  343. echo">"._FNASCBS."</a></font></center></TR></TD>";
  344.  
  345.         }
  346. }
  347.  
  348. echo"<TR ALIGN=\"CENTER\" >"
  349.     ."<TD height=\"5\" COLSPAN=6 BGCOLOR=\"$bgcolor2\"></TD></TR></TABLE>";
  350.  
  351.  
  352.     if(is_admin($admin))
  353.     {
  354.         echo"<br>";
  355. Opentable2();
  356.         echo"<center><i>Ciao Admin!</i></center><br><img src =\"images/forum/subject/icon4.gif\">  -- <a href=\"admin.php?op=SplattForumConfig\">Forum Admin Page</a> --  <img src =\"images/forum/subject/icon4.gif\">";
  357. Closetable2();
  358.     }
  359.  
  360. //<!-- Don't touch the lines below please! --> 
  361.  
  362. echo"<p align=\"center\">Splatt Forum © By: <a href=\"http://www.splatt.it\" target=\"_blank\">Splatt.it</a><br>Version: $forumver</font></p><br><br>";
  363.  
  364.  
  365. $mtime = microtime();
  366. $mtime = explode(" ",$mtime);
  367. $mtime = $mtime[1] + $mtime[0];
  368. $endtime = $mtime;
  369. $totaltime = ($endtime - $starttime);
  370. printf("<center><font size=-2>Elaboration time:  %f  seconds.</font></center><br>", $totaltime);
  371.  
  372. include("footer.php");
  373.  
  374. ?>