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