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 / FAQ / index.php
PHP Script  |  2004-08-21  |  5KB  |  111 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. /*         Additional security & Abstraction layer conversion           */
  22. /*                           2003 chatserv                              */
  23. /*      http://www.nukefixes.com -- http://www.nukeresources.com        */
  24. /************************************************************************/
  25.  
  26. if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
  27.     die ("You can't access this file directly...");
  28. }
  29.  
  30. require_once("mainfile.php");
  31. $module_name = basename(dirname(__FILE__));
  32. get_lang($module_name);
  33.  
  34. $pagetitle = "- $module_name";
  35.  
  36. function ShowFaq($id_cat, $categories) {
  37.     global $bgcolor2, $sitename, $prefix, $db, $module_name;
  38.     OpenTable();
  39.     echo"<center><font class=\"content\"><b>$sitename "._FAQ2."</b></font></center><br><br>"
  40.         ."<a name=\"top\"></a><br>" /* Bug fix : added missing closing hyperlink tag messes up display */
  41.         .""._CATEGORY.": <a href=\"modules.php?name=$module_name\">"._MAIN."</a> -> $categories"
  42.         ."<br><br>"
  43.         ."<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">"
  44.         ."<tr bgcolor=\"$bgcolor2\"><td colspan=\"2\"><font class=\"option\"><b>"._QUESTION."</b></font></td></tr><tr><td colspan=\"2\">";
  45.     $id_cat = intval($id_cat);
  46.     $result = $db->sql_query("SELECT id, id_cat, question, answer FROM ".$prefix."_faqanswer WHERE id_cat='$id_cat'");
  47.     while ($row = $db->sql_fetchrow($result)) {
  48.         $id = intval($row['id']);
  49.         $id_cat = intval($row['id_cat']);
  50.         $question = stripslashes(check_html($row['question'], "nohtml"));
  51.         $answer = stripslashes($row['answer']);
  52.         echo"<strong><big>·</big></strong>  <a href=\"#$id\">$question</a><br>";
  53.     }
  54.     echo "</td></tr></table>
  55.     <br>";
  56. }
  57.  
  58. function ShowFaqAll($id_cat) {
  59.     global $bgcolor2, $prefix, $db, $module_name;
  60.     $id_cat = intval($id_cat);
  61.     echo "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">"
  62.         ."<tr bgcolor=\"$bgcolor2\"><td colspan=\"2\"><font class=\"option\"><b>"._ANSWER."</b></font></td></tr>";
  63.     $id_cat = intval($id_cat);
  64.     $result = $db->sql_query("SELECT id, id_cat, question, answer FROM ".$prefix."_faqanswer WHERE id_cat='$id_cat'");
  65.     while ($row = $db->sql_fetchrow($result)) {
  66.         $id = intval($row['id']);
  67.         $id_cat = intval($row['id_cat']);
  68.          $question = stripslashes(check_html($row['question'], "nohtml"));
  69.          $answer = stripslashes($row['answer']);
  70.         echo"<tr><td><a name=\"$id\"></a>"
  71.             ."<strong><big>·</big></strong>  <b>$question</b>"
  72.             ."<p align=\"justify\">$answer</p>"
  73.             ."[ <a href=\"#top\">"._BACKTOTOP."</a> ]"
  74.             ."<br><br>"
  75.             ."</td></tr>";
  76.     }
  77.     echo "</table><br><br>"
  78.         ."<div align=\"center\"><b>[ <a href=\"modules.php?name=$module_name\">"._BACKTOFAQINDEX."</a> ]</b></div>";
  79. }
  80.  
  81. if (!$myfaq) {
  82.     global $currentlang, $multilingual;
  83.     if ($multilingual == 1) {
  84.         $querylang = "WHERE flanguage='$currentlang'";
  85.     } else {
  86.         $querylang = "";
  87.     }
  88.     include("header.php");
  89.     OpenTable();
  90.     echo "<center><font class=\"option\">"._FAQ2."</font></center><br><br>"
  91.     ."<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">"
  92.     ."<tr><td bgcolor=\"$bgcolor2\"><font class=\"option\"><b>"._CATEGORIES."</b></font></td></tr><tr><td>";
  93.     $result2 = $db->sql_query("SELECT id_cat, categories FROM ".$prefix."_faqcategories $querylang");
  94.     while ($row2 = $db->sql_fetchrow($result2)) {
  95.     $id_cat = intval($row2['id_cat']);
  96.     $categories = stripslashes($row2['categories']);
  97.     $catname = urlencode($categories);
  98.     echo"<strong><big>·</big></strong> <a href=\"modules.php?name=$module_name&myfaq=yes&id_cat=$id_cat&categories=$catname\">$categories</a><br>";
  99.     }
  100.     echo "</td></tr></table>";
  101.     CloseTable();
  102.     include("footer.php");
  103. } else {
  104.     include("header.php");
  105.     ShowFaq($id_cat, $categories);
  106.     ShowFaqAll($id_cat);
  107.     CloseTable();
  108.     include("footer.php");
  109. }
  110.  
  111. ?>