X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fhelp.php;h=4f75306fc1a4b1399ff72a055decba34164f8014;hb=7111b0daa5f74c1c96d3bcf87da7a05e4ba6e189;hp=dbc577b690df6d32b4585584fa69f04b82b6a861;hpb=0493a8d937329a655ce2a95d3210ecdd13dc1c1c;p=squirrelmail.git
diff --git a/src/help.php b/src/help.php
index dbc577b6..4f75306f 100644
--- a/src/help.php
+++ b/src/help.php
@@ -1,203 +1,264 @@
" || trim(strtolower($doc[$n])) == "
- |
-";
- printf (_("The help has not been translated to %s. It will be displayed in English instead."), $languages[$squirrelmail_language]["NAME"]);
- echo " "; - $user_language = "en"; - } else { - $help_exists = false; - echo " |
\n";
- echo " "; - do_hook("help_chapter"); - echo "
'; + $user_language = 'en_US'; +} else { + error_box( _("Help is not available. Please contact your system administrator for assistance.")); + // display footer (closes html tags) and stop script execution + $oTemplate->display('footer.tpl'); + exit(); +} + + +/* take the chapternumber from the GET-vars, + * else see if we can get a relevant chapter from the referer */ +$chapter = 0; + +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, + 'src/read_body' => 3, 'src/search' => 8 ); + + foreach($contexts as $path => $chap) { + if(strpos($ref, $path)) { + $chapter = $chap; + break; + } + } +} + +if ( $chapter == 0 || !isset( $helpdir[$chapter-1] ) ) { + // Initialise the needed variables. + $toc = array(); + + // Get the chapter numbers, title and decriptions. + for ($i=0, $cnt = count($helpdir); $i < $cnt; $i++) { + if (file_exists("../help/$user_language/$helpdir[$i]")) { + // First try the selected language. $doc = file("../help/$user_language/$helpdir[$i]"); $help_info = get_info($doc, 0); - echo " |
$help_info[2]
\n"; - - for ($n = $help_info[3]; $n < count($doc); $n++) { + $toc[] = array($i+1, $help_info[0], $help_info[2]); + } elseif (file_exists("../help/en_US/$helpdir[$i]")) { + // If the selected language can't be found, try English. + $doc = file("../help/en_US/$helpdir[$i]"); + $help_info = get_info($doc, 0); + $toc[] = array($i+1, $help_info[0], + _("This chapter is not available in the selected language. It will be displayed in English instead.") . + '