- ** help.php
- **
- ** This checks if the user's preferred language has a directory and file present
- ** then loads it or english if preferred is not found.
- **
- **/
-
- if (!isset($config_php))
- include("../config/config.php");
-
-/** If it was a successful login, lets load their preferences **/
- include("../src/load_prefs.php");
- echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
-
-/**
- ** Check to see if the help files have been translated into the users language
- ** If so, include them, if not, give them english. The po file should really have
- ** The echo line put in it.
- **/
-
- if (file_exists("../help/$user_language/basic.hlp")) {
- include ("../help/$user_language/basic.hlp");
- } else {
- echo "<CENTER><B><FONT COLOR=$color[2]>";
- echo _("Your preferred language is not yet translated. English will be substituted here.");
- echo "</FONT></B></CENTER><BR>";
- include ("../help/en/basic.hlp");
- }
- if (file_exists("../help/$user_language/main_folder.hlp")) {
- include ("../help/$user_language/main_folder.hlp");
- } else {
- echo "<CENTER><B><FONT COLOR=$color[2]>";
- echo _("Your preferred language is not yet translated. English will be substituted here.");
- echo "</FONT></B></CENTER><BR>";
- include ("../help/en/main_folder.hlp");
- }
- if (file_exists("../help/$user_language/read_mail.hlp")) {
- include ("../help/$user_language/read_mail.hlp");
- } else {
- echo "<CENTER><B><FONT COLOR=$color[2]>";
- echo _("Your preferred language is not yet translated. English will be substituted here.");
- echo "</FONT></B></CENTER><BR>";
- include ("../help/en/read_mail.hlp");
- }
- if (file_exists("../help/$user_language/compose.hlp")) {
- include ("../help/$user_language/compose.hlp");
- } else {
- echo "<CENTER><B><FONT COLOR=$color[2]>Your preferred language is not yet translated. English will be substituted here.</FONT></B></CENTER><BR>";
- echo "<CENTER><B><FONT COLOR=$color[2]>";
- echo _("Your preferred language is not yet translated. English will be substituted here.");
- echo "</FONT></B></CENTER><BR>";
- include ("../help/en/compose.hlp");
- }
- if (file_exists("../help/$user_language/addresses.hlp")) {
- include ("../help/$user_language/addresses.hlp");
- } else {
- echo "<CENTER><B><FONT COLOR=$color[2]>";
- echo _("Your preferred language is not yet translated. English will be substituted here.");
- echo "</FONT></B></CENTER><BR>";
- include ("../help/en/addresses.hlp");
- }
- if (file_exists("../help/$user_language/folders.hlp")) {
- include ("../help/$user_language/folders.hlp");
- } else {
- echo "<CENTER><B><FONT COLOR=$color[2]>";
- echo _("Your preferred language is not yet translated. English will be substituted here.");
- echo "</FONT></B></CENTER><BR>";
- include ("../help/en/folders.hlp");
+ * help.php
+ *
+ * Copyright (c) 1999-2001 The Squirrelmail Development Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * Displays help for the user
+ *
+ * $Id$
+ */
+
+/*****************************************************************/
+/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/
+/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/
+/*** + Base level indent should begin at left margin, as ***/
+/*** the require_once below looks. ***/
+/*** + All identation should consist of four space blocks ***/
+/*** + Tab characters are evil. ***/
+/*** + all comments should use "slash-star ... star-slash" ***/
+/*** style -- no pound characters, no slash-slash style ***/
+/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/
+/*** ALWAYS USE { AND } CHARACTERS!!! ***/
+/*** + Please use ' instead of ", when possible. Note " ***/
+/*** should always be used in _( ) function calls. ***/
+/*** Thank you for your help making the SM code more readable. ***/
+/*****************************************************************/
+
+require_once('../src/validate.php');
+require_once('../functions/display_messages.php');
+require_once('../functions/imap.php');
+require_once('../functions/array.php');
+
+
+ displayPageHeader($color, 'None' );
+
+ $helpdir[0] = 'basic.hlp';
+ $helpdir[1] = 'main_folder.hlp';
+ $helpdir[2] = 'read_mail.hlp';
+ $helpdir[3] = 'compose.hlp';
+ $helpdir[4] = 'addresses.hlp';
+ $helpdir[5] = 'folders.hlp';
+ $helpdir[6] = 'options.hlp';
+ $helpdir[7] = 'search.hlp';
+ $helpdir[8] = 'FAQ.hlp';
+
+ /****************[ HELP FUNCTIONS ]********************/
+ // parses through and gets the information from the different documents.
+ // this returns one section at a time. You must keep track of the position
+ // so that it knows where to start to look for the next section.
+
+ function get_info($doc, $pos) {
+ for ($n=$pos; $n < count($doc); $n++) {
+ if (trim(strtolower($doc[$n])) == "<chapter>" || trim(strtolower($doc[$n])) == "<section>") {
+ for ($n++;$n < count($doc) && (trim(strtolower($doc[$n])) != "</section>") && (trim(strtolower($doc[$n])) != "</chapter>"); $n++) {
+ if (trim(strtolower($doc[$n])) == "<title>") {
+ $n++;
+ $ary[0] = trim($doc[$n]);
+ }
+ if (trim(strtolower($doc[$n])) == "<description>") {
+ $ary[1] = "";
+ for ($n++;$n < count($doc) && (trim(strtolower($doc[$n])) != "</description>"); $n++) {
+ $ary[1] .= $doc[$n];
+ }
+ }
+ if (trim(strtolower($doc[$n])) == "<summary>") {
+ $ary[2] = "";
+ for ($n++;$n < count($doc) && (trim(strtolower($doc[$n])) != "</summary>"); $n++) {
+ $ary[2] .= $doc[$n];
+ }
+ }
+ }
+ if (isset($ary)) {
+ $ary[3] = $n;
+ return $ary;
+ } else {
+ $ary[0] = "ERROR: Help files are not in the right format!";
+ $ary[1] = "ERROR: Help files are not in the right format!";
+ $ary[2] = "ERROR: Help files are not in the right format!";
+ return $ary;
+ }
+ }
+ }
+ $ary[0] = "ERROR: Help files are not in the right format!";
+ $ary[1] = "ERROR: Help files are not in the right format!";
+ return $ary;