home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 April / PCWorld_2005-04_cd.bin / akce / web / unitednuke / unitednuke.exe / html / modules / FAQ / index.php
PHP Script  |  2004-06-14  |  5KB  |  106 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", $_SERVER['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, $db, $module_name;
  34.     $categories = htmlentities($categories);
  35.     OpenTable();
  36.     echo"<center><font class=\"content\"><b>$sitename "._FAQ2."</b></font></center><br><br>"
  37.     ."<a name=\"top\"></a><br>" /* Bug fix : added missing closing hyperlink tag messes up display */
  38.     .""._CATEGORY.": <a href=\"modules.php?name=$module_name\">"._MAIN."</a> -> $categories"
  39.     ."<br><br>"
  40.     ."<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">"
  41.     ."<tr bgcolor=\"$bgcolor2\"><td colspan=\"2\"><font class=\"option\"><b>"._QUESTION."</b></font></td></tr><tr><td colspan=\"2\">";
  42.     $result = $db->sql_query("SELECT id, id_cat, question, answer FROM ".$prefix."_faqAnswer WHERE id_cat='$id_cat'");
  43.     while ($row = $db->sql_fetchrow($result)) {
  44.     $id = intval($row['id']);
  45.     $id_cat = intval($row['id_cat']);
  46.     $question = $row['question'];
  47.     $answer = $row['answer'];
  48.     echo"<strong><big>·</big></strong>  <a href=\"#$id\">$question</a><br>";
  49.     }
  50.     echo "</td></tr></table>
  51.     <br>";
  52. }
  53.  
  54. function ShowFaqAll($id_cat) {
  55.     global $bgcolor2, $prefix, $db, $module_name;
  56.     $id_cat = intval($id_cat);
  57.     echo "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">"
  58.     ."<tr bgcolor=\"$bgcolor2\"><td colspan=\"2\"><font class=\"option\"><b>"._ANSWER."</b></font></td></tr>";
  59.     $result = $db->sql_query("SELECT id, id_cat, question, answer FROM ".$prefix."_faqAnswer WHERE id_cat='$id_cat'");
  60.     while ($row = $db->sql_fetchrow($result)) {
  61.     $id = intval($row['id']);
  62.     $id_cat = intval($row['id_cat']);
  63.     $question = $row['question'];
  64.     $answer = $row['answer'];
  65.     echo"<tr><td><a name=\"$id\"></a>"
  66.         ."<strong><big>·</big></strong>  <b>$question</b>"
  67.         ."<p align=\"justify\">$answer</p>"
  68.         ."[ <a href=\"#top\">"._BACKTOTOP."</a> ]"
  69.         ."<br><br>"
  70.         ."</td></tr>";
  71.     }
  72.     echo "</table><br><br>"
  73.     ."<div align=\"center\"><b>[ <a href=\"modules.php?name=$module_name\">"._BACKTOFAQINDEX."</a> ]</b></div>";
  74. }
  75.  
  76. if (!$myfaq) {
  77.     global $currentlang, $multilingual;
  78.     if ($multilingual == 1) {
  79.         $querylang = "WHERE flanguage='$currentlang'";
  80.     } else {
  81.         $querylang = "";
  82.     }
  83.     include("header.php");
  84.     OpenTable();
  85.     echo "<center><font class=\"option\">"._FAQ2."</font></center><br><br>"
  86.     ."<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">"
  87.     ."<tr><td bgcolor=\"$bgcolor2\"><font class=\"option\"><b>"._CATEGORIES."</b></font></td></tr><tr><td>";
  88.     $result2 = $db->sql_query("SELECT id_cat, categories FROM ".$prefix."_faqCategories $querylang");
  89.     while ($row2 = $db->sql_fetchrow($result2)) {
  90.     $id_cat = intval($row2['id_cat']);
  91.     $categories = $row2['categories'];
  92.     $catname = urlencode($categories);
  93.     echo"<strong><big>·</big></strong> <a href=\"modules.php?name=$module_name&myfaq=yes&id_cat=$id_cat&categories=$catname\">$categories</a><br>";
  94.     }
  95.     echo "</td></tr></table>";
  96.     CloseTable();
  97.     include("footer.php");
  98. } else {
  99.     include("header.php");
  100.     ShowFaq($id_cat, $categories);
  101.     ShowFaqAll($id_cat);
  102.     CloseTable();
  103.     include("footer.php");
  104. }
  105.  
  106. ?>