Added support for using Squirrelmail without frames
[squirrelmail.git] / src / help.php
index 513db530ea0ee9d1b34748ce30895fdf7f62adc3..d37b17041dc0287a928c577ba0356ca7c8b27eb9 100644 (file)
@@ -3,19 +3,21 @@
 /**
  * help.php
  *
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2003 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * Displays help for the user
  *
  * $Id$
+ * @package squirrelmail
  */
 
-/* Path for SquirrelMail required files. */
+/** Path for SquirrelMail required files. */
 define('SM_PATH','../');
 
 /* SquirrelMail required files. */
 require_once(SM_PATH . 'include/validate.php');
+require_once(SM_PATH . 'functions/global.php');
 require_once(SM_PATH . 'functions/display_messages.php');
 
 displayPageHeader($color, 'None' );
@@ -128,13 +130,10 @@ if (file_exists("../help/$squirrelmail_language")) {
  * else see if we can get a relevant chapter from the referer */
 $chapter = 0;
 
-if ( isset( $_GET['chapter'] ) )
-{
-    $chapter = intval( $_GET['chapter']);
-}
-elseif (isset($_SERVER['HTTP_REFERER']))
-{
-    $ref = strtolower($_SERVER['HTTP_REFERER']);
+if ( sqgetGlobalVar('chapter', $temp, SQ_GET) ) {
+    $chapter = (int) $temp;
+} elseif ( sqgetGlobalVar('HTTP_REFERER', $temp, SQ_SERVER) ) {
+    $ref = strtolower($temp);
 
     $contexts = array ( 'src/compose' => 4, 'src/addr' => 5,
         'src/folders' => 6, 'src/options' => 7, 'src/right_main' => 2,
@@ -153,7 +152,6 @@ if ( $chapter == 0 || !isset( $helpdir[$chapter-1] ) ) {
                html_tag( 'tr' ) .
                     html_tag( 'td' ) .
                          '<b><center>' . _("Table of Contents") . '</center></b><br>';
-    do_hook('help_chapter');
     echo html_tag( 'ol' );
     for ($i=0, $cnt = count($helpdir); $i < $cnt; $i++) {
         $doc = file("../help/$user_language/$helpdir[$i]");
@@ -162,6 +160,7 @@ if ( $chapter == 0 || !isset( $helpdir[$chapter-1] ) ) {
              . '">' . $help_info[0] . '</a>' .
              html_tag( 'ul', $help_info[2] );
     }
+    do_hook('help_chapter');
     echo '</ol></td></tr></table>';
 } else {
     $doc = file("../help/$user_language/" . $helpdir[$chapter-1]);
@@ -209,5 +208,6 @@ do_hook('help_bottom');
 echo html_tag( 'tr',
             html_tag( 'td', '&nbsp;', 'left', $color[0] )
         ).
-       '</table></body></html>';
-?>
+       '</table>';
+       noframes_bottom();
+?>
\ No newline at end of file