389e8badb21f150dc8c5cc30ab001fef535a05c0
6 * Displays help for the user
8 * @copyright © 1999-2006 The SquirrelMail Project Team
9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
11 * @package squirrelmail
15 * Include the SquirrelMail initialization file.
17 require('../include/init.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 ]********************/
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.
39 function get_info($doc, $pos) {
42 $cntdoc = count($doc);
44 for ($n=$pos; $n < $cntdoc; $n++
) {
45 if (trim(strtolower($doc[$n])) == '<chapter>'
46 ||
trim(strtolower($doc[$n])) == '<section>') {
47 for ($n++
; $n < $cntdoc
48 && (trim(strtolower($doc[$n])) != '</section>')
49 && (trim(strtolower($doc[$n])) != '</chapter>'); $n++
) {
50 if (trim(strtolower($doc[$n])) == '<title>') {
52 $ary[0] = trim($doc[$n]);
54 if (trim(strtolower($doc[$n])) == '<description>') {
56 for ($n++
;$n < $cntdoc
57 && (trim(strtolower($doc[$n])) != '</description>');
62 if (trim(strtolower($doc[$n])) == '<summary>') {
64 for ($n++
; $n < $cntdoc
65 && (trim(strtolower($doc[$n])) != '</summary>');
74 $ary[0] = _("ERROR: Help files are not in the right format!");
79 } else if (!trim(strtolower($doc[$n]))) {
86 $ary[0] = _("ERROR: Help files are not in the right format!");
93 /**************[ END HELP FUNCTIONS ]******************/
96 echo html_tag( 'table',
98 html_tag( 'td','<div style="text-align: center;"><b>' . _("Help") .'</b></div>', 'center', $color[0] )
100 'center', '', 'width="95%" cellpadding="1" cellspacing="2" border="0"' );
104 echo html_tag( 'table', '', 'center', '', 'width="90%" cellpadding="0" cellspacing="10" border="0"' ) .
108 if (!isset($squirrelmail_language)) {
109 $squirrelmail_language = 'en_US';
112 if (file_exists("../help/$squirrelmail_language")) {
113 $user_language = $squirrelmail_language;
114 } else if (file_exists('../help/en_US')) {
115 echo "<div style=\"text-align: center;\"><font color=\"$color[2]\">"
116 ._("The help has not been translated to the selected language. It will be displayed in English instead.");
117 echo '</font></div><br />';
118 $user_language = 'en_US';
120 error_box( _("Some or all of the help documents are not present!"), $color );
125 /* take the chapternumber from the GET-vars,
126 * else see if we can get a relevant chapter from the referer */
129 if ( sqgetGlobalVar('chapter', $temp, SQ_GET
) ) {
130 $chapter = (int) $temp;
131 } elseif ( sqgetGlobalVar('HTTP_REFERER', $temp, SQ_SERVER
) ) {
132 $ref = strtolower($temp);
134 $contexts = array ( 'src/compose' => 4, 'src/addr' => 5,
135 'src/folders' => 6, 'src/options' => 7, 'src/right_main' => 2,
136 'src/read_body' => 3, 'src/search' => 8 );
138 foreach($contexts as $path => $chap) {
139 if(strpos($ref, $path)) {
146 if ( $chapter == 0 ||
!isset( $helpdir[$chapter-1] ) ) {
147 echo html_tag( 'table', '', 'center', '', 'cellpadding="0" cellspacing="0" border="0"' ) .
150 '<div style="text-align: center;"><b>' . _("Table of Contents") . '</b></div><br />';
151 echo html_tag( 'ol' );
152 for ($i=0, $cnt = count($helpdir); $i < $cnt; $i++
) {
153 $doc = file("../help/$user_language/$helpdir[$i]");
154 $help_info = get_info($doc, 0);
155 echo '<li><a href="../src/help.php?chapter=' . ($i+
1)
156 . '">' . $help_info[0] . '</a>' .
157 html_tag( 'ul', $help_info[2] );
159 do_hook('help_chapter');
160 echo '</ol></td></tr></table>';
162 $doc = file("../help/$user_language/" . $helpdir[$chapter-1]);
163 $help_info = get_info($doc, 0);
164 echo '<div style="text-align: center;"><small>';
166 echo '<font color="' . $color[9] . '">' . _("Previous")
169 echo '<a href="../src/help.php?chapter=' . ($chapter-1)
170 . '">' . _("Previous") . '</a> | ';
172 echo '<a href="../src/help.php">' . _("Table of Contents") . '</a>';
173 if ($chapter >= count($helpdir)){
174 echo ' | <font color="' . $color[9] . '">' . _("Next") . '</font>';
176 echo ' | <a href="../src/help.php?chapter=' . ($chapter+
1)
177 . '">' . _("Next") . '</a>';
179 echo '</small></div><br />';
181 echo '<font size="5"><b>' . $chapter . ' - ' . $help_info[0]
182 . '</b></font><br /><br />';
184 if (isset($help_info[1]) && $help_info[1]) {
187 echo html_tag( 'p', $help_info[2], 'left' );
191 for ($n = $help_info[3], $cnt = count($doc); $n < $cnt; $n++
) {
193 $help_info = get_info($doc, $n);
194 echo "<b>$chapter.$section - $help_info[0]</b>" .
195 html_tag( 'ul', $help_info[1] );
199 echo '<br /><div style="text-align: center;"><a href="#pagetop">' . _("Top") . '</a></div>';
202 do_hook('help_bottom');
205 html_tag( 'td', ' ', 'left', $color[0] )
211 $oTemplate->display('footer.tpl');