home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 May / INTERNET103.ISO / pc / software / windows / building / php_nuke / html / modules / topics / index.php
Encoding:
PHP Script  |  2002-09-16  |  2.7 KB  |  69 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. if (!eregi("modules.php", $PHP_SELF)) {
  16.     die ("You can't access this file directly...");
  17. }
  18.  
  19. require_once("mainfile.php");
  20. $module_name = basename(dirname(__FILE__));
  21. get_lang($module_name);
  22. $pagetitle = "- "._ACTIVETOPICS."";
  23. include("header.php");
  24.  
  25. $result = sql_query("select topicid, topicname, topicimage, topictext from ".$prefix."_topics order by topicname", $dbi);
  26. if (sql_num_rows($result, $dbi)==0) {
  27.     include("header.php");
  28.     include("footer.php");
  29. }
  30. if (sql_num_rows($result, $dbi)>0) {
  31.     OpenTable();
  32.     echo "<center><font class=\"title\"><b>"._ACTIVETOPICS."</b></font><br>\n"
  33.     ."<font class=\"content\">"._CLICK2LIST."</font><br><br>\n"
  34.     ."<form action=\"modules.php?name=Search\" method=\"post\">"
  35.     ."<input type=\"name\" name=\"query\" size=\"30\">  "
  36.     ."<input type=\"submit\" value=\""._SEARCH."\">"
  37.     ."</form></center><br><br>"
  38.     ."<table border=\"0\" width=\"100%\" align=\"center\" cellpadding=\"2\"><tr>\n";
  39.     while(list($topicid, $topicname, $topicimage, $topictext) = sql_fetch_row($result, $dbi)) {
  40.         if ($count == 5) {
  41.         echo "<tr>\n";
  42.         $count = 0;
  43.     }
  44.     $ThemeSel = get_theme();
  45.     if (@file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
  46.         $t_image = "themes/$ThemeSel/images/topics/$topicimage";
  47.     } else {
  48.         $t_image = "$tipath/$topicimage";
  49.     }
  50.     echo "<td align=\"center\">\n"
  51.         ."<a href=\"modules.php?name=News&new_topic=$topicid\"><img src=\"$t_image\" border=\"0\" alt=\"$topictext\" title=\"$topictext\"></a><br>\n"
  52.         ."<font class=\"content\"><b>$topictext</b></font>\n"
  53.         ."</td>\n";
  54.     /* Thanks to John Hoffmann from softlinux.org for the next 5 lines ;) */
  55.     $count++;
  56.     if ($count == 5) {
  57.         echo "</tr>\n";
  58.     }
  59.     }
  60.     if ($count == 5) {
  61.     echo "</table>\n";
  62.     } else {
  63.     echo "</tr></table>\n";
  64.     }
  65. CloseTable();
  66. include("footer.php");
  67.  
  68. ?>