6 ** Copyright (c) 1999-2001 The SquirrelMail development team
7 ** Licensed under the GNU GPL. For full terms see the file COPYING.
9 ** Displays help for the user
14 require_once('../src/validate.php');
15 require_once('../functions/display_messages.php');
16 require_once('../functions/imap.php');
17 require_once('../functions/array.php');
20 displayPageHeader($color, 'None' );
22 $helpdir[0] = 'basic.hlp';
23 $helpdir[1] = 'main_folder.hlp';
24 $helpdir[2] = 'read_mail.hlp';
25 $helpdir[3] = 'compose.hlp';
26 $helpdir[4] = 'addresses.hlp';
27 $helpdir[5] = 'folders.hlp';
28 $helpdir[6] = 'options.hlp';
29 $helpdir[7] = 'search.hlp';
30 $helpdir[8] = 'FAQ.hlp';
32 /****************[ HELP FUNCTIONS ]********************/
33 // parses through and gets the information from the different documents.
34 // this returns one section at a time. You must keep track of the position
35 // so that it knows where to start to look for the next section.
37 function get_info($doc, $pos) {
38 for ($n=$pos; $n < count($doc); $n++
) {
39 if (trim(strtolower($doc[$n])) == "<chapter>" ||
trim(strtolower($doc[$n])) == "<section>") {
40 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</section>") && (trim(strtolower($doc[$n])) != "</chapter>"); $n++
) {
41 if (trim(strtolower($doc[$n])) == "<title>") {
43 $ary[0] = trim($doc[$n]);
45 if (trim(strtolower($doc[$n])) == "<description>") {
47 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</description>"); $n++
) {
51 if (trim(strtolower($doc[$n])) == "<summary>") {
53 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</summary>"); $n++
) {
62 $ary[0] = "ERROR: Help files are not in the right format!";
63 $ary[1] = "ERROR: Help files are not in the right format!";
64 $ary[2] = "ERROR: Help files are not in the right format!";
69 $ary[0] = "ERROR: Help files are not in the right format!";
70 $ary[1] = "ERROR: Help files are not in the right format!";
74 /**************[ END HELP FUNCTIONS ]******************/
79 <table width
=95% align
=center cellpadding
=2 cellspacing
=2 border
=0>
80 <tr
><td bgcolor
="<?php echo $color[0] ?>">
81 <center
><b
><?php
echo _("Help") ?
></b
></center
>
84 <?php
do_hook("help_top") ?
>
86 <table width
=90% cellpadding
=0 cellspacing
=10 border
=0 align
=center
><tr
><td
>
89 $ref = strtolower($HTTP_REFERER);
90 if (strpos($ref, "src/compose"))
92 else if (strpos($ref, "src/addr"))
94 else if (strpos($ref, "src/folders"))
96 else if (strpos($ref, "src/options"))
98 else if (strpos($ref, "src/right_main"))
100 else if (strpos($ref, "src/read_body"))
102 else if (strpos($ref, "src/search"))
106 if (!$squirrelmail_language)
107 $squirrelmail_language = "en";
109 if (file_exists("../help/$squirrelmail_language")) {
111 $user_language = $squirrelmail_language;
112 } else if (file_exists("../help/en")) {
114 echo "<center><font color=\"$color[2]\">";
115 printf (_("The help has not been translated to %s. It will be displayed in English instead."), $languages[$squirrelmail_language]["NAME"]);
116 echo "</font></center><br>";
117 $user_language = "en";
119 $help_exists = false;
120 echo "<br><center><font color=\"$color[2]\">";
121 echo _("Some or all of the help documents are not present!");
122 echo "</font></center>";
123 echo "</td></tr></table>";
128 if (! isset($context))
130 if ($context == "compose")
132 else if ($context == "address")
134 else if ($context == "folders")
136 else if ($context == "options")
138 else if ($context == "index")
140 else if ($context == "read")
142 else if ($context == "search")
145 if (!isset($chapter)) {
146 echo "<table cellpadding=0 cellspacing=0 border=0 align=center><tr><td>\n";
147 echo "<b><center>" . _("Table of Contents") . "</center></b><br>";
148 do_hook("help_chapter");
150 for ($i=0; $i < count($helpdir); $i++
) {
151 $doc = file("../help/$user_language/$helpdir[$i]");
152 $help_info = get_info($doc, 0);
153 echo "<li><a href=\"../src/help.php?chapter=". ($i+
1) ."\">$help_info[0]</a>\n";
154 echo "<ul>$help_info[2]</ul>";
157 echo "</td></tr></table>\n";
159 $doc = file("../help/$user_language/".$helpdir[$chapter-1]);
160 $help_info = get_info($doc, 0);
162 echo "<small><center>";
164 if ($chapter <= 1) echo "<font color=\"$color[9]\">"._("Previous")."</font> | ";
165 else echo "<a href=\"../src/help.php?chapter=".($chapter-1)."\">"._("Previous")."</a> | ";
166 echo "<a href=\"../src/help.php\">"._("Table of Contents")."</a>";
167 if ($chapter >= count($helpdir)) echo " | <font color=\"$color[9]\">"._("Next")."</font>";
168 else echo " | <a href=\"../src/help.php?chapter=".($chapter+
1)."\">"._("Next")."</a>\n";
169 echo "</center></small><br>\n";
171 echo "<font size=5><b>$chapter - $help_info[0]</b></font><br><br>\n";
172 if (isset($help_info[1]))
173 echo "$help_info[1]\n";
175 echo "<p>$help_info[2]</p>\n";
178 for ($n = $help_info[3]; $n < count($doc); $n++
) {
180 $help_info = get_info($doc, $n);
181 echo "<b>$chapter.$section - $help_info[0]</b>";
183 echo "$help_info[1]";
188 echo "<br><center><a href=\"#pagetop\">" . _("Top") . "</a></center>\n";
191 do_hook("help_bottom");
193 <tr
><td bgcolor
="<?php echo $color[0] ?>"> 
;</td
></tr
></table
>