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 include('../src/validate.php');
14 include("../functions/page_header.php");
15 include("../functions/display_messages.php");
16 include("../functions/imap.php");
17 include("../functions/array.php");
18 include("../src/load_prefs.php");
21 displayPageHeader($color, "None");
23 $helpdir[0] = "basic.hlp";
24 $helpdir[1] = "main_folder.hlp";
25 $helpdir[2] = "read_mail.hlp";
26 $helpdir[3] = "compose.hlp";
27 $helpdir[4] = "addresses.hlp";
28 $helpdir[5] = "folders.hlp";
29 $helpdir[6] = "options.hlp";
30 $helpdir[7] = "search.hlp";
31 $helpdir[8] = "FAQ.hlp";
33 /****************[ HELP FUNCTIONS ]********************/
34 // parses through and gets the information from the different documents.
35 // this returns one section at a time. You must keep track of the position
36 // so that it knows where to start to look for the next section.
38 function get_info($doc, $pos) {
39 for ($n=$pos; $n < count($doc); $n++
) {
40 if (trim(strtolower($doc[$n])) == "<chapter>" ||
trim(strtolower($doc[$n])) == "<section>") {
41 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</section>") && (trim(strtolower($doc[$n])) != "</chapter>"); $n++
) {
42 if (trim(strtolower($doc[$n])) == "<title>") {
44 $ary[0] = trim($doc[$n]);
46 if (trim(strtolower($doc[$n])) == "<description>") {
48 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</description>"); $n++
) {
52 if (trim(strtolower($doc[$n])) == "<summary>") {
54 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</summary>"); $n++
) {
63 $ary[0] = "ERROR: Help files are not in the right format!";
64 $ary[1] = "ERROR: Help files are not in the right format!";
65 $ary[2] = "ERROR: Help files are not in the right format!";
70 $ary[0] = "ERROR: Help files are not in the right format!";
71 $ary[1] = "ERROR: Help files are not in the right format!";
75 /**************[ END HELP FUNCTIONS ]******************/
80 <table width
=95% align
=center cellpadding
=2 cellspacing
=2 border
=0>
81 <tr
><td bgcolor
="<?php echo $color[0] ?>">
82 <center
><b
><?php
echo _("Help") ?
></b
></center
>
85 <?php
do_hook("help_top") ?
>
87 <table width
=90% cellpadding
=0 cellspacing
=10 border
=0 align
=center
><tr
><td
>
90 $ref = strtolower($HTTP_REFERER);
91 if (strpos($ref, "src/compose"))
93 else if (strpos($ref, "src/addr"))
95 else if (strpos($ref, "src/folders"))
97 else if (strpos($ref, "src/options"))
99 else if (strpos($ref, "src/right_main"))
101 else if (strpos($ref, "src/read_body"))
103 else if (strpos($ref, "src/search"))
107 if (!$squirrelmail_language)
108 $squirrelmail_language = "en";
110 if (file_exists("../help/$squirrelmail_language")) {
112 $user_language = $squirrelmail_language;
113 } else if (file_exists("../help/en")) {
115 echo "<center><font color=\"$color[2]\">";
116 printf (_("The help has not been translated to %s. It will be displayed in English instead."), $languages[$squirrelmail_language]["NAME"]);
117 echo "</font></center><br>";
118 $user_language = "en";
120 $help_exists = false;
121 echo "<br><center><font color=\"$color[2]\">";
122 echo _("Some or all of the help documents are not present!");
123 echo "</font></center>";
124 echo "</td></tr></table>";
129 if (! isset($context))
131 if ($context == "compose")
133 else if ($context == "address")
135 else if ($context == "folders")
137 else if ($context == "options")
139 else if ($context == "index")
141 else if ($context == "read")
143 else if ($context == "search")
146 if (!isset($chapter)) {
147 echo "<table cellpadding=0 cellspacing=0 border=0 align=center><tr><td>\n";
148 echo "<b><center>" . _("Table of Contents") . "</center></b><br>";
149 do_hook("help_chapter");
151 for ($i=0; $i < count($helpdir); $i++
) {
152 $doc = file("../help/$user_language/$helpdir[$i]");
153 $help_info = get_info($doc, 0);
154 echo "<li><a href=\"../src/help.php?chapter=". ($i+
1) ."\">$help_info[0]</a>\n";
155 echo "<ul>$help_info[2]</ul>";
158 echo "</td></tr></table>\n";
160 $doc = file("../help/$user_language/".$helpdir[$chapter-1]);
161 $help_info = get_info($doc, 0);
163 echo "<small><center>";
165 if ($chapter <= 1) echo "<font color=\"$color[9]\">"._("Previous")."</font> | ";
166 else echo "<a href=\"../src/help.php?chapter=".($chapter-1)."\">"._("Previous")."</a> | ";
167 echo "<a href=\"../src/help.php\">"._("Table of Contents")."</a>";
168 if ($chapter >= count($helpdir)) echo " | <font color=\"$color[9]\">"._("Next")."</font>";
169 else echo " | <a href=\"../src/help.php?chapter=".($chapter+
1)."\">"._("Next")."</a>\n";
170 echo "</center></small><br>\n";
172 echo "<font size=5><b>$chapter - $help_info[0]</b></font><br><br>\n";
173 if (isset($help_info[1]))
174 echo "$help_info[1]\n";
176 echo "<p>$help_info[2]</p>\n";
179 for ($n = $help_info[3]; $n < count($doc); $n++
) {
181 $help_info = get_info($doc, $n);
182 echo "<b>$chapter.$section - $help_info[0]</b>";
184 echo "$help_info[1]";
189 echo "<br><center><a href=\"#pagetop\">" . _("Top") . "</a></center>\n";
192 do_hook("help_bottom");
194 <tr
><td bgcolor
="<?php echo $color[0] ?>"> 
;</td
></tr
></table
>