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] = "FAQ.hlp";
44 /****************[ HELP FUNCTIONS ]********************/
45 // parses through and gets the information from the different documents.
46 // this returns one section at a time. You must keep track of the position
47 // so that it knows where to start to look for the next section.
49 function get_info($doc, $pos) {
50 for ($n=$pos; $n < count($doc); $n++
) {
51 if (trim(strtolower($doc[$n])) == "<chapter>" ||
trim(strtolower($doc[$n])) == "<section>") {
52 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</section>") && (trim(strtolower($doc[$n])) != "</chapter>"); $n++
) {
53 if (trim(strtolower($doc[$n])) == "<title>") {
55 $ary[0] = trim($doc[$n]);
57 if (trim(strtolower($doc[$n])) == "<description>") {
58 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</description>"); $n++
) {
62 if (trim(strtolower($doc[$n])) == "<summary>") {
63 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</summary>"); $n++
) {
72 $ary[0] = "ERROR: Help files are not in the right format!";
73 $ary[1] = "ERROR: Help files are not in the right format!";
74 $ary[2] = "ERROR: Help files are not in the right format!";
79 $ary[0] = "ERROR: Help files are not in the right format!";
80 $ary[1] = "ERROR: Help files are not in the right format!";
84 /**************[ END HELP FUNCTIONS ]******************/
89 <table width
=95% align
=center cellpadding
=2 cellspacing
=2 border
=0>
90 <tr
><td bgcolor
="<?php echo $color[0] ?>">
91 <center
><b
><?php
echo _("Help") ?
></b
></center
>
94 <?
do_hook("help_top") ?
>
96 <table width
=90% cellpadding
=0 cellspacing
=10 border
=0 align
=center
><tr
><td
>
99 $ref = strtolower($HTTP_REFERER);
100 if (strpos($ref, "src/compose"))
101 $context = "compose";
102 else if (strpos($ref, "src/addr"))
103 $context = "address";
104 else if (strpos($ref, "src/folders"))
105 $context = "folders";
106 else if (strpos($ref, "src/options"))
107 $context = "options";
108 else if (strpos($ref, "src/right_main"))
110 else if (strpos($ref, "src/read_body"))
114 if (file_exists("../help/$squirrelmail_language")) {
116 $user_language = $squirrelmail_language;
117 } else if (file_exists("../help/en")) {
119 echo "<center><font color=\"$color[2]\">";
120 printf (_("The help has not been translated to %s. It will be displayed in English instead."), $languages[$squirrelmail_language]["NAME"]);
121 echo "</font></center><br>";
122 $user_language = "en";
124 $help_exists = false;
125 echo "<br><center><font color=\"$color[2]\">";
126 echo _("Some or all of the help documents are not present!");
127 echo "</font></center>";
128 echo "</td></tr></table>";
133 if ($context == "compose")
135 else if ($context == "address")
137 else if ($context == "folders")
139 else if ($context == "options")
141 else if ($context == "index")
143 else if ($context == "read")
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>";
170 echo "</center></small><br>\n";
172 echo "<font size=5><b>$chapter - $help_info[0]</b></font><br><br>\n";
174 echo "$help_info[1]";
176 echo "<p>$help_info[2]</p>";
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>";
191 do_hook("help_bottom");
193 <tr
><td bgcolor
="<?php echo $color[0] ?>"> 
;</td
></tr
></table
>