Added basic support for message highlighting. Note that this needs quite
[squirrelmail.git] / src / left_help.php
1 <?php
2 /**
3 ** left_help.php
4 **
5 ** This is the code for the left bar. The left bar normally shows the folders
6 ** available, and has cookie information. This file is only used for the help system.
7 ** To be used, webmail must be called with ?help.php.
8 **
9 **/
10
11 session_start();
12
13 if(!isset($username)) {
14 echo "You need a valid user and password to access this page!";
15 exit;
16 }
17 if (!isset($config_php))
18 include("../config/config.php");
19 if (!isset($i18n_php))
20 include("../functions/i18n.php");
21 include("../src/load_prefs.php");
22 echo "<HTML BGCOLOR=\"$color[3]\">";
23 echo "<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" BGCOLOR=\"$color[3]\" LINK=\"$color[11]\" VLINK=\"$color[6]\" ALINK=\"$color[11]\">\n";
24 /**
25 ** Array used to list the include .hlp files, we could use a dir function
26 ** to step through the directory and list its contents but it doesn't order those.
27 ** This should probably go in config.php but it might mess up conf.pl
28 **/
29 $helpdir[0] = "basic.hlp";
30 $helpdir[1] = "main_folder.hlp";
31 $helpdir[2] = "read_mail.hlp";
32 $helpdir[3] = "addresses.hlp";
33 $helpdir[4] = "compose.hlp";
34 $helpdir[5] = "folders.hlp";
35 $helpdir[6] = "options.hlp";
36 $helpdir[7] = "FAQ.hlp";
37
38 /**
39 ** Build a menu dynamically for the left frame from the HTML tagged right frame include (.hlp) files listed in the $helpdir var.
40 ** This is done by first listing all the .hlp files in the $helpdir array.
41 ** Next, we loop through the array, for every value of $helpdir we loop through the file and look for anchor tags (<A NAME=) and
42 ** header tags (<H1> or <H3>).
43 **/
44
45 if (file_exists("../help/$user_language")) {
46 } elseif(file_exists("../help/en")){ // If the selected language doesn't exist, use english
47 $user_language = en;
48 } else { // If that is gone too, send a message
49 $nohelp = true;
50 echo "<BR><CENTER><B><FONT COLOR=$color[2]>",_("ERROR: Some or all of the standard English help files ar missing."), "</FONT></B></CENTER><BR>";
51 }
52
53 if(!$nohelp) {
54 while ( list( $key, $val ) = each( $helpdir ) ) { // loop through the array of files
55 $fcontents = file("../help/$user_language/$val"); // assign each line of the above file to another array
56 while ( list( $line_num, $line ) = each( $fcontents ) ) { // loop through the second array
57 $temphed="";
58 $tempanc="";
59
60 if ( eregi("<A NAME=", $line, $tempanc)) { // if a name anchor is found, make a link
61 $tempanc = trim($line);
62 $tempanc = str_replace("<A NAME=", "", $tempanc);
63 $tempanc = str_replace("></A>", "", $tempanc);
64 echo "<A HREF=\"help.php#$tempanc\" target=\"right\">";
65 }
66 if ( eregi("<H1>", $line, $temphed)) { // grab a description for the link made above
67 $temphed = trim($line);
68 $temphed = str_replace("<H1>", "", $temphed);
69 $temphed = str_replace("</H1>", "", $temphed);
70 echo "<BR>";
71 echo "<FONT SIZE=+1>" . _("$temphed") . "</FONT></A><BR>\n"; // make it bigger since it is a heading type 1
72 }
73 if ( eregi("<H3>", $line, $temphed)) { // grab a description for the link made above
74 $temphed = trim($line);
75 $temphed = str_replace("<H3>", "", $temphed);
76 $temphed = str_replace("</H3>", "", $temphed);
77 echo "" . _("$temphed") . "</A><BR>\n"; // keep same size since it is a normal entry
78 }
79 }
80 }
81 }
82 ?>