6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * Displays help for the user
14 /*****************************************************************/
15 /*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/
16 /*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/
17 /*** + Base level indent should begin at left margin, as ***/
18 /*** the require_once below looks. ***/
19 /*** + All identation should consist of four space blocks ***/
20 /*** + Tab characters are evil. ***/
21 /*** + all comments should use "slash-star ... star-slash" ***/
22 /*** style -- no pound characters, no slash-slash style ***/
23 /*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/
24 /*** ALWAYS USE { AND } CHARACTERS!!! ***/
25 /*** + Please use ' instead of ", when possible. Note " ***/
26 /*** should always be used in _( ) function calls. ***/
27 /*** Thank you for your help making the SM code more readable. ***/
28 /*****************************************************************/
30 require_once('../src/validate.php');
31 require_once('../functions/display_messages.php');
32 require_once('../functions/imap.php');
33 require_once('../functions/array.php');
36 displayPageHeader($color, 'None' );
38 $helpdir[0] = 'basic.hlp';
39 $helpdir[1] = 'main_folder.hlp';
40 $helpdir[2] = 'read_mail.hlp';
41 $helpdir[3] = 'compose.hlp';
42 $helpdir[4] = 'addresses.hlp';
43 $helpdir[5] = 'folders.hlp';
44 $helpdir[6] = 'options.hlp';
45 $helpdir[7] = 'search.hlp';
46 $helpdir[8] = 'FAQ.hlp';
48 /****************[ HELP FUNCTIONS ]********************/
49 // parses through and gets the information from the different documents.
50 // this returns one section at a time. You must keep track of the position
51 // so that it knows where to start to look for the next section.
53 function get_info($doc, $pos) {
54 for ($n=$pos; $n < count($doc); $n++
) {
55 if (trim(strtolower($doc[$n])) == "<chapter>" ||
trim(strtolower($doc[$n])) == "<section>") {
56 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</section>") && (trim(strtolower($doc[$n])) != "</chapter>"); $n++
) {
57 if (trim(strtolower($doc[$n])) == "<title>") {
59 $ary[0] = trim($doc[$n]);
61 if (trim(strtolower($doc[$n])) == "<description>") {
63 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</description>"); $n++
) {
67 if (trim(strtolower($doc[$n])) == "<summary>") {
69 for ($n++
;$n < count($doc) && (trim(strtolower($doc[$n])) != "</summary>"); $n++
) {
78 $ary[0] = "ERROR: Help files are not in the right format!";
79 $ary[1] = "ERROR: Help files are not in the right format!";
80 $ary[2] = "ERROR: Help files are not in the right format!";
85 $ary[0] = "ERROR: Help files are not in the right format!";
86 $ary[1] = "ERROR: Help files are not in the right format!";
90 /**************[ END HELP FUNCTIONS ]******************/
95 <table width
=95% align
=center cellpadding
=2 cellspacing
=2 border
=0>
96 <tr
><td bgcolor
="<?php echo $color[0] ?>">
97 <center
><b
><?php
echo _("Help") ?
></b
></center
>
100 <?php
do_hook("help_top") ?
>
102 <table width
=90% cellpadding
=0 cellspacing
=10 border
=0 align
=center
><tr
><td
>
105 $ref = strtolower($HTTP_REFERER);
106 if (strpos($ref, "src/compose"))
107 $context = "compose";
108 else if (strpos($ref, "src/addr"))
109 $context = "address";
110 else if (strpos($ref, "src/folders"))
111 $context = "folders";
112 else if (strpos($ref, "src/options"))
113 $context = "options";
114 else if (strpos($ref, "src/right_main"))
116 else if (strpos($ref, "src/read_body"))
118 else if (strpos($ref, "src/search"))
122 if (!$squirrelmail_language)
123 $squirrelmail_language = "en";
125 if (file_exists("../help/$squirrelmail_language")) {
127 $user_language = $squirrelmail_language;
128 } else if (file_exists("../help/en")) {
130 echo "<center><font color=\"$color[2]\">";
131 printf (_("The help has not been translated to %s. It will be displayed in English instead."), $languages[$squirrelmail_language]["NAME"]);
132 echo "</font></center><br>";
133 $user_language = "en";
135 $help_exists = false;
136 echo "<br><center><font color=\"$color[2]\">";
137 echo _("Some or all of the help documents are not present!");
138 echo "</font></center>";
139 echo "</td></tr></table>";
144 if (! isset($context))
146 if ($context == "compose")
148 else if ($context == "address")
150 else if ($context == "folders")
152 else if ($context == "options")
154 else if ($context == "index")
156 else if ($context == "read")
158 else if ($context == "search")
161 if (!isset($chapter)) {
162 echo "<table cellpadding=0 cellspacing=0 border=0 align=center><tr><td>\n";
163 echo "<b><center>" . _("Table of Contents") . "</center></b><br>";
164 do_hook("help_chapter");
166 for ($i=0; $i < count($helpdir); $i++
) {
167 $doc = file("../help/$user_language/$helpdir[$i]");
168 $help_info = get_info($doc, 0);
169 echo "<li><a href=\"../src/help.php?chapter=". ($i+
1) ."\">$help_info[0]</a>\n";
170 echo "<ul>$help_info[2]</ul>";
173 echo "</td></tr></table>\n";
175 $doc = file("../help/$user_language/".$helpdir[$chapter-1]);
176 $help_info = get_info($doc, 0);
178 echo "<small><center>";
180 if ($chapter <= 1) echo "<font color=\"$color[9]\">"._("Previous")."</font> | ";
181 else echo "<a href=\"../src/help.php?chapter=".($chapter-1)."\">"._("Previous")."</a> | ";
182 echo "<a href=\"../src/help.php\">"._("Table of Contents")."</a>";
183 if ($chapter >= count($helpdir)) echo " | <font color=\"$color[9]\">"._("Next")."</font>";
184 else echo " | <a href=\"../src/help.php?chapter=".($chapter+
1)."\">"._("Next")."</a>\n";
185 echo "</center></small><br>\n";
187 echo "<font size=5><b>$chapter - $help_info[0]</b></font><br><br>\n";
188 if (isset($help_info[1]))
189 echo "$help_info[1]\n";
191 echo "<p>$help_info[2]</p>\n";
194 for ($n = $help_info[3]; $n < count($doc); $n++
) {
196 $help_info = get_info($doc, $n);
197 echo "<b>$chapter.$section - $help_info[0]</b>";
199 echo "$help_info[1]";
204 echo "<br><center><a href=\"#pagetop\">" . _("Top") . "</a></center>\n";
207 do_hook("help_bottom");
209 <tr
><td bgcolor
="<?php echo $color[0] ?>"> 
;</td
></tr
></table
>