4b0d36c4458471d0860e1d3a0efb62a8c070c512
[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
18 // Configure the left frame for the help menu
19 // Maybe this should be a function but since I haven't done one it isn't
20
21 $ishelp = substr(getenv(REQUEST_URI),-8); // take the right 8 characters from the requested URL
22 if ($ishelp == "help.php") {
23 if (!isset($config_php))
24 include("../config/config.php");
25 if (!isset($i18n_php))
26 include("../functions/i18n.php");
27 include("../src/load_prefs.php");
28 echo "<HTML BGCOLOR=\"$color[3]\">";
29 echo "<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" BGCOLOR=\"$color[3]\" LINK=\"$color[11]\" VLINK=\"$color[6]\" ALINK=\"$color[11]\">\n";
30 $left_size = 250; //doesn't seem to work
31 /**
32 ** Array used to list the include .hlp files, we could use a dir function
33 ** to step through the directory and list its contents but it doesn't order those.
34 ** This should probably go in config.php but it might mess up conf.pl
35 **/
36 $helpdir[0] = "basic.hlp";
37 $helpdir[1] = "main_folder.hlp";
38 $helpdir[2] = "read_mail.hlp";
39 $helpdir[3] = "addresses.hlp";
40 $helpdir[4] = "compose.hlp";
41 $helpdir[5] = "folders.hlp";
42 $helpdir[6] = "options.hlp";
43 $helpdir[7] = "FAQ.hlp";
44
45 /**
46 ** Build a menu dynamically for the left frame from the HTML tagged right frame include (.hlp) files listed in the $helpdir var.
47 ** This is done by first listing all the .hlp files in the $helpdir array.
48 ** Next, we loop through the array, for every value of $helpdir we loop through the file and look for anchor tags (<A NAME=) and
49 ** header tags (<H1> or <H3>).
50 **/
51
52 if (!file_exists("../help/$user_language")) // If the selected language doesn't exist, use english
53 $user_language = "en";
54
55
56 while ( list( $key, $val ) = each( $helpdir ) ) { // loop through the array of files
57 $fcontents = file("../help/$user_language/$val"); // assign each line of the above file to another array
58 while ( list( $line_num, $line ) = each( $fcontents ) ) { // loop through the second array
59 $temphed="";
60 $tempanc="";
61
62 if ( eregi("<A NAME=", $line, $tempanc)) { // if a name anchor is found, make a link
63 $tempanc = $line;
64 $tempanc = ereg_replace("<A NAME=", "", $tempanc);
65 $tempanc = ereg_replace("></A>", "", $tempanc);
66 echo "<A HREF=\"help.php#$tempanc\" target=\"right\">";
67 }
68 if ( eregi("<H1>", $line, $temphed)) { // grab a description for the link made above
69 $temphed = $line;
70 $temphed = ereg_replace("<H1>", "", $temphed);
71 $temphed = ereg_replace("</H1>", "", $temphed);
72 echo "<BR>";
73 echo "<FONT SIZE=+1>" . _("$temphed") . "</FONT></A><BR>\n"; // make it bigger since it is a heading type 1
74 }
75 if ( eregi("<H3>", $line, $temphed)) { // grab a description for the link made above
76 $temphed = $line;
77 $temphed = ereg_replace("<H3>", "", $temphed);
78 $temphed = ereg_replace("</H3>", "", $temphed);
79 echo "" . _("$temphed") . "</A><BR>\n"; // keep same size since it is a normal entry
80 }
81 }
82 }
83 }
84 ?>