5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
8 ** Displays help for the user
15 if (!isset($strings_php))
16 include("../functions/strings.php");
17 if (!isset($config_php))
18 include("../config/config.php");
19 if (!isset($page_header_php))
20 include("../functions/page_header.php");
21 if (!isset($display_messages_php))
22 include("../functions/display_messages.php");
23 if (!isset($imap_php))
24 include("../functions/imap.php");
25 if (!isset($array_php))
26 include("../functions/array.php");
27 if (!isset($i18n_php))
28 include("../functions/i18n.php");
29 if (!isset($auth_php))
30 include ("../functions/auth.php");
32 include("../src/load_prefs.php");
33 displayPageHeader($color, "None");
36 $helpdir[0] = "basic.hlp";
37 $helpdir[1] = "main_folder.hlp";
38 $helpdir[2] = "read_mail.hlp";
39 $helpdir[3] = "compose.hlp";
40 $helpdir[4] = "addresses.hlp";
41 $helpdir[5] = "folders.hlp";
42 $helpdir[6] = "options.hlp";
43 $helpdir[7] = "search.hlp";
44 $helpdir[8] = "FAQ.hlp";
46 /****************[ HELP FUNCTIONS ]********************/
47 // parses through and gets the information from the different documents.
48 // this returns one section at a time. You must keep track of the position
49 // so that it knows where to start to look for the next section.
51 function get_info($doc, $pos) {
52 for ($n=$pos; $n < count($doc); $n++
) {
53 if (trim(strtolower($doc[$n])) == "<chapter>" ||
trim(strtolower($doc[$n])) == "<section>") {
54 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</section>") && (trim(strtolower($doc[$n])) != "</chapter>"); $n++
) {
55 if (trim(strtolower($doc[$n])) == "<title>") {
57 $ary[0] = trim($doc[$n]);
59 if (trim(strtolower($doc[$n])) == "<description>") {
61 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</description>"); $n++
) {
65 if (trim(strtolower($doc[$n])) == "<summary>") {
67 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</summary>"); $n++
) {
76 $ary[0] = "ERROR: Help files are not in the right format!";
77 $ary[1] = "ERROR: Help files are not in the right format!";
78 $ary[2] = "ERROR: Help files are not in the right format!";
83 $ary[0] = "ERROR: Help files are not in the right format!";
84 $ary[1] = "ERROR: Help files are not in the right format!";
88 /**************[ END HELP FUNCTIONS ]******************/
93 <table width
=95% align
=center cellpadding
=2 cellspacing
=2 border
=0>
94 <tr
><td bgcolor
="<?php echo $color[0] ?>">
95 <center
><b
><?php
echo _("Help") ?
></b
></center
>
98 <?php
do_hook("help_top") ?
>
100 <table width
=90% cellpadding
=0 cellspacing
=10 border
=0 align
=center
><tr
><td
>
103 $ref = strtolower($HTTP_REFERER);
104 if (strpos($ref, "src/compose"))
105 $context = "compose";
106 else if (strpos($ref, "src/addr"))
107 $context = "address";
108 else if (strpos($ref, "src/folders"))
109 $context = "folders";
110 else if (strpos($ref, "src/options"))
111 $context = "options";
112 else if (strpos($ref, "src/right_main"))
114 else if (strpos($ref, "src/read_body"))
116 else if (strpos($ref, "src/search"))
120 if (!$squirrelmail_language)
121 $squirrelmail_language = "en";
123 if (file_exists("../help/$squirrelmail_language")) {
125 $user_language = $squirrelmail_language;
126 } else if (file_exists("../help/en")) {
128 echo "<center><font color=\"$color[2]\">";
129 printf (_("The help has not been translated to %s. It will be displayed in English instead."), $languages[$squirrelmail_language]["NAME"]);
130 echo "</font></center><br>";
131 $user_language = "en";
133 $help_exists = false;
134 echo "<br><center><font color=\"$color[2]\">";
135 echo _("Some or all of the help documents are not present!");
136 echo "</font></center>";
137 echo "</td></tr></table>";
142 if (! isset($context))
144 if ($context == "compose")
146 else if ($context == "address")
148 else if ($context == "folders")
150 else if ($context == "options")
152 else if ($context == "index")
154 else if ($context == "read")
156 else if ($context == "search")
159 if (!isset($chapter)) {
160 echo "<table cellpadding=0 cellspacing=0 border=0 align=center><tr><td>\n";
161 echo "<b><center>" . _("Table of Contents") . "</center></b><br>";
162 do_hook("help_chapter");
164 for ($i=0; $i < count($helpdir); $i++
) {
165 $doc = file("../help/$user_language/$helpdir[$i]");
166 $help_info = get_info($doc, 0);
167 echo "<li><a href=\"../src/help.php?chapter=". ($i+
1) ."\">$help_info[0]</a>\n";
168 echo "<ul>$help_info[2]</ul>";
171 echo "</td></tr></table>\n";
173 $doc = file("../help/$user_language/".$helpdir[$chapter-1]);
174 $help_info = get_info($doc, 0);
176 echo "<small><center>";
178 if ($chapter <= 1) echo "<font color=\"$color[9]\">"._("Previous")."</font> | ";
179 else echo "<a href=\"../src/help.php?chapter=".($chapter-1)."\">"._("Previous")."</a> | ";
180 echo "<a href=\"../src/help.php\">"._("Table of Contents")."</a>";
181 if ($chapter >= count($helpdir)) echo " | <font color=\"$color[9]\">"._("Next")."</font>";
182 else echo " | <a href=\"../src/help.php?chapter=".($chapter+
1)."\">"._("Next")."</a>\n";
183 echo "</center></small><br>\n";
185 echo "<font size=5><b>$chapter - $help_info[0]</b></font><br><br>\n";
186 if (isset($help_info[1]))
187 echo "$help_info[1]\n";
189 echo "<p>$help_info[2]</p>\n";
192 for ($n = $help_info[3]; $n < count($doc); $n++
) {
194 $help_info = get_info($doc, $n);
195 echo "<b>$chapter.$section - $help_info[0]</b>";
197 echo "$help_info[1]";
202 echo "<br><center><a href=\"#pagetop\">" . _("Top") . "</a></center>\n";
205 do_hook("help_bottom");
207 <tr
><td bgcolor
="<?php echo $color[0] ?>"> 
;</td
></tr
></table
>