home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 May / INTERNET103.ISO / pc / software / windows / building / php_nuke / html / modules / faq / index.php
Encoding:
PHP Script  |  2002-09-16  |  4.5 KB  |  94 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. /* ======================                                               */
  11. /* Based on Automated FAQ                                               */
  12. /* Copyright (c) 2001 by                                                */
  13. /*    Richard Tirtadji AKA King Richard (rtirtadji@hotmail.com)         */
  14. /*    Hutdik Hermawan AKA hotFix (hutdik76@hotmail.com)                 */
  15. /* http://www.phpnuke.web.id                                            */
  16. /*                                                                      */
  17. /* This program is free software. You can redistribute it and/or modify */
  18. /* it under the terms of the GNU General Public License as published by */
  19. /* the Free Software Foundation; either version 2 of the License.       */
  20. /************************************************************************/
  21.  
  22. if (!eregi("modules.php", $PHP_SELF)) {
  23.     die ("You can't access this file directly...");
  24. }
  25.  
  26. require_once("mainfile.php");
  27. $module_name = basename(dirname(__FILE__));
  28. get_lang($module_name);
  29.  
  30. $pagetitle = "- $module_name";
  31.  
  32. function ShowFaq($id_cat, $categories) {
  33.     global $bgcolor2, $sitename, $prefix, $dbi, $module_name;
  34.     OpenTable();
  35.     echo"<center><font class=\"content\"><b>$sitename "._FAQ2."</b></font></center><br><br>"
  36.     ."<a name=\"top\"></a><br>" /* Bug fix : added missing closing hyperlink tag messes up display */
  37.     .""._CATEGORY.": <a href=\"modules.php?name=$module_name\">"._MAIN."</a> -> $categories"
  38.     ."<br><br>"
  39.     ."<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">"
  40.     ."<tr bgcolor=\"$bgcolor2\"><td colspan=\"2\"><font class=\"option\"><b>"._QUESTION."</b></font></td></tr><tr><td colspan=\"2\">";
  41.     $result = sql_query("select id, id_cat, question, answer from ".$prefix."_faqAnswer where id_cat='$id_cat'", $dbi);
  42.     while(list($id, $id_cat, $question, $answer) = sql_fetch_row($result, $dbi)) {
  43.     echo"<strong><big>·</big></strong>  <a href=\"#$id\">$question</a><br>";
  44.     }
  45.     echo "</td></tr></table>
  46.     <br>";
  47. }
  48.  
  49. function ShowFaqAll($id_cat) {
  50.     global $bgcolor2, $prefix, $dbi, $module_name;
  51.     echo "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">"
  52.     ."<tr bgcolor=\"$bgcolor2\"><td colspan=\"2\"><font class=\"option\"><b>"._ANSWER."</b></font></td></tr>";
  53.     $result = sql_query("select id, id_cat, question, answer from ".$prefix."_faqAnswer where id_cat='$id_cat'", $dbi);
  54.     while(list($id, $id_cat, $question, $answer) = sql_fetch_row($result, $dbi)) {
  55.     echo"<tr><td><a name=\"$id\"></a>"
  56.         ."<strong><big>·</big></strong>  <b>$question</b>"
  57.         ."<p align=\"justify\">$answer</p>"
  58.         ."[ <a href=\"#top\">"._BACKTOTOP."</a> ]"
  59.         ."<br><br>"
  60.         ."</td></tr>";
  61.     }
  62.     echo "</table><br><br>"
  63.     ."<div align=\"center\"><b>[ <a href=\"modules.php?name=$module_name\">"._BACKTOFAQINDEX."</a> ]</b></div>";
  64. }
  65.  
  66. if (!$myfaq) {
  67.     global $currentlang, $multilingual;
  68.     if ($multilingual == 1) {
  69.         $querylang = "WHERE flanguage='$currentlang'";
  70.     } else {
  71.         $querylang = "";
  72.     }
  73.     include("header.php");
  74.     OpenTable();
  75.     echo "<center><font class=\"option\">"._FAQ2."</font></center><br><br>"
  76.     ."<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">"
  77.     ."<tr><td bgcolor=\"$bgcolor2\"><font class=\"option\"><b>"._CATEGORIES."</b></font></td></tr><tr><td>";
  78.     $result = sql_query("select id_cat, categories from ".$prefix."_faqCategories $querylang", $dbi);
  79.     while(list($id_cat, $categories) = sql_fetch_row($result, $dbi)) {
  80.     $catname = urlencode($categories);
  81.     echo"<strong><big>·</big></strong> <a href=\"modules.php?name=$module_name&myfaq=yes&id_cat=$id_cat&categories=$catname\">$categories</a><br>";
  82.     }
  83.     echo "</td></tr></table>";
  84.     CloseTable();
  85.     include("footer.php");
  86. } else {
  87.     include("header.php");
  88.     ShowFaq($id_cat, $categories);
  89.     ShowFaqAll($id_cat);
  90.     CloseTable();
  91.     include("footer.php");
  92. }
  93.  
  94. ?>