home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 April / PCWorld_2005-04_cd.bin / akce / web / phpnuke / PHP-Nuke-7.5.exe / html / modules / Topics / index.php < prev   
PHP Script  |  2004-08-23  |  5KB  |  102 lines

  1. <?php
  2.  
  3. /************************************************************************/
  4. /* PHP-NUKE: Web Portal System                                          */
  5. /* ===========================                                          */
  6. /*                                                                      */
  7. /* Copyright (c) 2002 by Francisco Burzi                                */
  8. /* http://phpnuke.org                                                   */
  9. /*                                                                      */
  10. /* This program is free software. You can redistribute it and/or modify */
  11. /* it under the terms of the GNU General Public License as published by */
  12. /* the Free Software Foundation; either version 2 of the License.       */
  13. /*                                                                      */
  14. /************************************************************************/
  15. /* Additional security checking code 2003 by chatserv                   */
  16. /* http://www.nukefixes.com -- http://www.nukeresources.com             */
  17. /************************************************************************/
  18.  
  19. if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
  20.     die ("You can't access this file directly...");
  21. }
  22.  
  23. require_once("mainfile.php");
  24. $module_name = basename(dirname(__FILE__));
  25. get_lang($module_name);
  26. $pagetitle = "- "._ACTIVETOPICS."";
  27. include("header.php");
  28. global $prefix, $db;
  29. $result = $db->sql_query("SELECT topicid, topicname, topicimage, topictext FROM ".$prefix."_topics ORDER BY topictext");
  30. if ($db->sql_numrows($result) == 0) {
  31.     include("header.php");
  32.     include("footer.php");
  33. }
  34. if ($db->sql_numrows($result) > 0) {
  35.     $r_options = "";
  36.     if (isset($cookie[4])) { $r_options .= "&mode=$cookie[4]"; }
  37.     if (isset($cookie[5])) { $r_options .= "&order=$cookie[5]"; }
  38.     if (isset($cookie[6])) { $r_options .= "&thold=$cookie[6]"; }
  39.     OpenTable();
  40.     echo "<center><font class=\"title\"><b>"._ACTIVETOPICS."</b></font><br>\n"
  41.     ."<font class=\"content\">"._CLICK2LIST."</font><br><br>\n"
  42.     ."<form action=\"modules.php?name=Search\" method=\"post\">"
  43.     ."<input type=\"name\" name=\"query\" size=\"30\">  "
  44.     ."<input type=\"submit\" value=\""._SEARCH."\">"
  45.     ."</form></center><br><br>";
  46.     while ($row = $db->sql_fetchrow($result)) {
  47.     $topicid = intval($row['topicid']);
  48.     $topicname = stripslashes($row['topicname']);
  49.     $topicimage = stripslashes($row['topicimage']);
  50.     $topictext = stripslashes(check_html($row['topictext'], "nohtml"));
  51.     $ThemeSel = get_theme();
  52.     if (@file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
  53.         $t_image = "themes/$ThemeSel/images/topics/$topicimage";
  54.     } else {
  55.         $t_image = "$tipath$topicimage";
  56.     }
  57.     $res = $db->sql_query("SELECT counter FROM ".$prefix."_stories WHERE topic='$topicid'");
  58.     $numrows = $db->sql_numrows($res);
  59.     $reads = 0;
  60.     while ($counting = $db->sql_fetchrow($res)) {
  61.         $ccounter = $counting[counter];
  62.         $reads = $reads+$ccounter;
  63.     }
  64.     title($topictext);
  65.     echo "<table border=\"1\" width=\"100%\" align=\"center\" cellpadding=\"2\">\n"
  66.         ."<tr><td valign=\"top\" width='25%'>\n"
  67.         ."<a href=\"modules.php?name=News&new_topic=$topicid\"><img src=\"$t_image\" border=\"0\" alt=\"$topictext\" title=\"$topictext\" hspace='5' vspace='5'></a><br><br>\n"
  68.         ."<font class=\"content\">\n"
  69.         ."<big><strong>·</strong></big> <b>"._TOPIC.":</b> $topictext<br>\n"
  70.         ."<big><strong>·</strong></big> <b>"._TOTNEWS.":</b> $numrows<br>\n"
  71.         ."<big><strong>·</strong></big> <b>"._TOTREADS.":</b> $reads</font>\n"
  72.         ."</td>\n"
  73.         ."<td valign='top'>";
  74.     $result2 = $db->sql_query("SELECT sid, catid, title FROM ".$prefix."_stories WHERE topic='$topicid' ORDER BY sid DESC LIMIT 0,10");
  75.     $num = $db->sql_numrows($result2);
  76.     if ($num != 0) {
  77.         while ($row2 = $db->sql_fetchrow($result2)) {
  78.             $sid = intval($row2['sid']);
  79.             $catid = intval($row2['catid']);
  80.             $title = stripslashes(check_html($row2['title'], "nohtml"));
  81.             $row3 = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_stories_cat WHERE catid='$catid'"));
  82.             $rtitle = stripslashes(check_html($row3['title'], "nohtml"));
  83.             if ($catid == 0) {
  84.                 $cat_link = "";
  85.             } else {
  86.                 $cat_link = "<a href='modules.php?name=News&file=categories&op=newindex&catid=$catid'><b>$rtitle</b></a>: ";
  87.             }
  88.             echo "<img src='modules/$module_name/images/arrow.gif' border='0' alt='' title=''>  $cat_link<a href='modules.php?name=News&file=article&sid=$sid$r_options'>$title</a><br>";
  89.         }
  90.         if ($num == 10) {
  91.             echo "<div align='right'><big><strong>·</strong></big> <a href='modules.php?name=News&new_topic=$topicid'><b>"._MORE." --></b></a>  </div>";
  92.         }
  93.     } else {
  94.         echo "<i>"._NONEWSYET."</i>";
  95.     }
  96.     echo "</td></tr></table><br><br>";
  97.     }
  98. CloseTable();
  99. include("footer.php");
  100.  
  101. ?>