Corrected UGLY html output, now looks more common sense.
[squirrelmail.git] / src / left_help.php
CommitLineData
ba850e7d 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 }
ba850e7d 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";
ba850e7d 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")) // If the selected language doesn't exist, use english
46 $user_language = "en";
47
48
49 while ( list( $key, $val ) = each( $helpdir ) ) { // loop through the array of files
50 $fcontents = file("../help/$user_language/$val"); // assign each line of the above file to another array
51 while ( list( $line_num, $line ) = each( $fcontents ) ) { // loop through the second array
52 $temphed="";
53 $tempanc="";
54
55 if ( eregi("<A NAME=", $line, $tempanc)) { // if a name anchor is found, make a link
14e6044f 56 $tempanc = trim($line);
57 $tempanc = str_replace("<A NAME=", "", $tempanc);
58 $tempanc = str_replace("></A>", "", $tempanc);
ba850e7d 59 echo "<A HREF=\"help.php#$tempanc\" target=\"right\">";
60 }
61 if ( eregi("<H1>", $line, $temphed)) { // grab a description for the link made above
14e6044f 62 $temphed = trim($line);
63 $temphed = str_replace("<H1>", "", $temphed);
64 $temphed = str_replace("</H1>", "", $temphed);
ba850e7d 65 echo "<BR>";
66 echo "<FONT SIZE=+1>" . _("$temphed") . "</FONT></A><BR>\n"; // make it bigger since it is a heading type 1
67 }
68 if ( eregi("<H3>", $line, $temphed)) { // grab a description for the link made above
14e6044f 69 $temphed = trim($line);
70 $temphed = str_replace("<H3>", "", $temphed);
71 $temphed = str_replace("</H3>", "", $temphed);
ba850e7d 72 echo "" . _("$temphed") . "</A><BR>\n"; // keep same size since it is a normal entry
73 }
74 }
75 }
ba850e7d 76?>