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
13 require_once('../src/validate.php');
14 require_once('../functions/display_messages.php');
15 require_once('../functions/imap.php');
16 require_once('../functions/array.php');
19 displayPageHeader($color, "None");
21 $helpdir[0] = "basic.hlp";
22 $helpdir[1] = "main_folder.hlp";
23 $helpdir[2] = "read_mail.hlp";
24 $helpdir[3] = "compose.hlp";
25 $helpdir[4] = "addresses.hlp";
26 $helpdir[5] = "folders.hlp";
27 $helpdir[6] = "options.hlp";
28 $helpdir[7] = "search.hlp";
29 $helpdir[8] = "FAQ.hlp";
31 /****************[ HELP FUNCTIONS ]********************/
32 // parses through and gets the information from the different documents.
33 // this returns one section at a time. You must keep track of the position
34 // so that it knows where to start to look for the next section.
36 function get_info($doc, $pos) {
37 for ($n=$pos; $n < count($doc); $n++
) {
38 if (trim(strtolower($doc[$n])) == "<chapter>" ||
trim(strtolower($doc[$n])) == "<section>") {
39 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</section>") && (trim(strtolower($doc[$n])) != "</chapter>"); $n++
) {
40 if (trim(strtolower($doc[$n])) == "<title>") {
42 $ary[0] = trim($doc[$n]);
44 if (trim(strtolower($doc[$n])) == "<description>") {
46 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</description>"); $n++
) {
50 if (trim(strtolower($doc[$n])) == "<summary>") {
52 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</summary>"); $n++
) {
61 $ary[0] = "ERROR: Help files are not in the right format!";
62 $ary[1] = "ERROR: Help files are not in the right format!";
63 $ary[2] = "ERROR: Help files are not in the right format!";
68 $ary[0] = "ERROR: Help files are not in the right format!";
69 $ary[1] = "ERROR: Help files are not in the right format!";
73 /**************[ END HELP FUNCTIONS ]******************/
78 <table width
=95% align
=center cellpadding
=2 cellspacing
=2 border
=0>
79 <tr
><td bgcolor
="<?php echo $color[0] ?>">
80 <center
><b
><?php
echo _("Help") ?
></b
></center
>
83 <?php
do_hook("help_top") ?
>
85 <table width
=90% cellpadding
=0 cellspacing
=10 border
=0 align
=center
><tr
><td
>
88 $ref = strtolower($HTTP_REFERER);
89 if (strpos($ref, "src/compose"))
91 else if (strpos($ref, "src/addr"))
93 else if (strpos($ref, "src/folders"))
95 else if (strpos($ref, "src/options"))
97 else if (strpos($ref, "src/right_main"))
99 else if (strpos($ref, "src/read_body"))
101 else if (strpos($ref, "src/search"))
105 if (!$squirrelmail_language)
106 $squirrelmail_language = "en";
108 if (file_exists("../help/$squirrelmail_language")) {
110 $user_language = $squirrelmail_language;
111 } else if (file_exists("../help/en")) {
113 echo "<center><font color=\"$color[2]\">";
114 printf (_("The help has not been translated to %s. It will be displayed in English instead."), $languages[$squirrelmail_language]["NAME"]);
115 echo "</font></center><br>";
116 $user_language = "en";
118 $help_exists = false;
119 echo "<br><center><font color=\"$color[2]\">";
120 echo _("Some or all of the help documents are not present!");
121 echo "</font></center>";
122 echo "</td></tr></table>";
127 if (! isset($context))
129 if ($context == "compose")
131 else if ($context == "address")
133 else if ($context == "folders")
135 else if ($context == "options")
137 else if ($context == "index")
139 else if ($context == "read")
141 else if ($context == "search")
144 if (!isset($chapter)) {
145 echo "<table cellpadding=0 cellspacing=0 border=0 align=center><tr><td>\n";
146 echo "<b><center>" . _("Table of Contents") . "</center></b><br>";
147 do_hook("help_chapter");
149 for ($i=0; $i < count($helpdir); $i++
) {
150 $doc = file("../help/$user_language/$helpdir[$i]");
151 $help_info = get_info($doc, 0);
152 echo "<li><a href=\"../src/help.php?chapter=". ($i+
1) ."\">$help_info[0]</a>\n";
153 echo "<ul>$help_info[2]</ul>";
156 echo "</td></tr></table>\n";
158 $doc = file("../help/$user_language/".$helpdir[$chapter-1]);
159 $help_info = get_info($doc, 0);
161 echo "<small><center>";
163 if ($chapter <= 1) echo "<font color=\"$color[9]\">"._("Previous")."</font> | ";
164 else echo "<a href=\"../src/help.php?chapter=".($chapter-1)."\">"._("Previous")."</a> | ";
165 echo "<a href=\"../src/help.php\">"._("Table of Contents")."</a>";
166 if ($chapter >= count($helpdir)) echo " | <font color=\"$color[9]\">"._("Next")."</font>";
167 else echo " | <a href=\"../src/help.php?chapter=".($chapter+
1)."\">"._("Next")."</a>\n";
168 echo "</center></small><br>\n";
170 echo "<font size=5><b>$chapter - $help_info[0]</b></font><br><br>\n";
171 if (isset($help_info[1]))
172 echo "$help_info[1]\n";
174 echo "<p>$help_info[2]</p>\n";
177 for ($n = $help_info[3]; $n < count($doc); $n++
) {
179 $help_info = get_info($doc, $n);
180 echo "<b>$chapter.$section - $help_info[0]</b>";
182 echo "$help_info[1]";
187 echo "<br><center><a href=\"#pagetop\">" . _("Top") . "</a></center>\n";
190 do_hook("help_bottom");
192 <tr
><td bgcolor
="<?php echo $color[0] ?>"> 
;</td
></tr
></table
>