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
14 if (!isset($config_php))
15 include("../config/config.php");
16 if (!isset($strings_php))
17 include("../functions/strings.php");
18 if (!isset($page_header_php))
19 include("../functions/page_header.php");
20 if (!isset($display_messages_php))
21 include("../functions/display_messages.php");
22 if (!isset($imap_php))
23 include("../functions/imap.php");
24 if (!isset($array_php))
25 include("../functions/array.php");
26 if (!isset($i18n_php))
27 include("../functions/i18n.php");
28 if (!isset($auth_php))
29 include ("../functions/auth.php");
31 include("../src/load_prefs.php");
32 displayPageHeader($color, "None");
35 $helpdir[0] = "basic.hlp";
36 $helpdir[1] = "main_folder.hlp";
37 $helpdir[2] = "read_mail.hlp";
38 $helpdir[3] = "compose.hlp";
39 $helpdir[4] = "addresses.hlp";
40 $helpdir[5] = "folders.hlp";
41 $helpdir[6] = "options.hlp";
42 $helpdir[7] = "search.hlp";
43 $helpdir[8] = "FAQ.hlp";
45 /****************[ HELP FUNCTIONS ]********************/
46 // parses through and gets the information from the different documents.
47 // this returns one section at a time. You must keep track of the position
48 // so that it knows where to start to look for the next section.
50 function get_info($doc, $pos) {
51 for ($n=$pos; $n < count($doc); $n++
) {
52 if (trim(strtolower($doc[$n])) == "<chapter>" ||
trim(strtolower($doc[$n])) == "<section>") {
53 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</section>") && (trim(strtolower($doc[$n])) != "</chapter>"); $n++
) {
54 if (trim(strtolower($doc[$n])) == "<title>") {
56 $ary[0] = trim($doc[$n]);
58 if (trim(strtolower($doc[$n])) == "<description>") {
59 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</description>"); $n++
) {
63 if (trim(strtolower($doc[$n])) == "<summary>") {
64 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</summary>"); $n++
) {
73 $ary[0] = "ERROR: Help files are not in the right format!";
74 $ary[1] = "ERROR: Help files are not in the right format!";
75 $ary[2] = "ERROR: Help files are not in the right format!";
80 $ary[0] = "ERROR: Help files are not in the right format!";
81 $ary[1] = "ERROR: Help files are not in the right format!";
85 /**************[ END HELP FUNCTIONS ]******************/
90 <table width
=95% align
=center cellpadding
=2 cellspacing
=2 border
=0>
91 <tr
><td bgcolor
="<?php echo $color[0] ?>">
92 <center
><b
><?php
echo _("Help") ?
></b
></center
>
95 <?php
do_hook("help_top") ?
>
97 <table width
=90% cellpadding
=0 cellspacing
=10 border
=0 align
=center
><tr
><td
>
100 $ref = strtolower($HTTP_REFERER);
101 if (strpos($ref, "src/compose"))
102 $context = "compose";
103 else if (strpos($ref, "src/addr"))
104 $context = "address";
105 else if (strpos($ref, "src/folders"))
106 $context = "folders";
107 else if (strpos($ref, "src/options"))
108 $context = "options";
109 else if (strpos($ref, "src/right_main"))
111 else if (strpos($ref, "src/read_body"))
113 else if (strpos($ref, "src/search"))
117 if (!$squirrelmail_language)
118 $squirrelmail_language = "en";
120 if (file_exists("../help/$squirrelmail_language")) {
122 $user_language = $squirrelmail_language;
123 } else if (file_exists("../help/en")) {
125 echo "<center><font color=\"$color[2]\">";
126 printf (_("The help has not been translated to %s. It will be displayed in English instead."), $languages[$squirrelmail_language]["NAME"]);
127 echo "</font></center><br>";
128 $user_language = "en";
130 $help_exists = false;
131 echo "<br><center><font color=\"$color[2]\">";
132 echo _("Some or all of the help documents are not present!");
133 echo "</font></center>";
134 echo "</td></tr></table>";
139 if ($context == "compose")
141 else if ($context == "address")
143 else if ($context == "folders")
145 else if ($context == "options")
147 else if ($context == "index")
149 else if ($context == "read")
151 else if ($context == "search")
155 echo "<table cellpadding=0 cellspacing=0 border=0 align=center><tr><td>\n";
156 echo "<b><center>" . _("Table of Contents") . "</center></b><br>";
157 do_hook("help_chapter");
159 for ($i=0; $i < count($helpdir); $i++
) {
160 $doc = file("../help/$user_language/$helpdir[$i]");
161 $help_info = get_info($doc, 0);
162 echo "<li><a href=\"../src/help.php?chapter=". ($i+
1) ."\">$help_info[0]</a>\n";
163 echo "<ul>$help_info[2]</ul>";
166 echo "</td></tr></table>\n";
168 $doc = file("../help/$user_language/".$helpdir[$chapter-1]);
169 $help_info = get_info($doc, 0);
171 echo "<small><center>";
173 if ($chapter <= 1) echo "<font color=\"$color[9]\">"._("Previous")."</font> | ";
174 else echo "<a href=\"../src/help.php?chapter=".($chapter-1)."\">"._("Previous")."</a> | ";
175 echo "<a href=\"../src/help.php\">"._("Table of Contents")."</a>";
176 if ($chapter >= count($helpdir)) echo " | <font color=\"$color[9]\">"._("Next")."</font>";
177 else echo " | <a href=\"../src/help.php?chapter=".($chapter+
1)."\">"._("Next")."</a>\n";
178 echo "</center></small><br>\n";
180 echo "<font size=5><b>$chapter - $help_info[0]</b></font><br><br>\n";
182 echo "$help_info[1]\n";
184 echo "<p>$help_info[2]</p>\n";
186 for ($n = $help_info[3]; $n < count($doc); $n++
) {
188 $help_info = get_info($doc, $n);
189 echo "<b>$chapter.$section - $help_info[0]</b>";
191 echo "$help_info[1]";
196 echo "<br><center><a href=\"#pagetop\">" . _("Top") . "</a></center>\n";
199 do_hook("help_bottom");
201 <tr
><td bgcolor
="<?php echo $color[0] ?>"> 
;</td
></tr
></table
>