Added error check and message for missing ../help/en dir and hlp files.
authorlbergman <lbergman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 16 Jun 2000 14:47:35 +0000 (14:47 +0000)
committerlbergman <lbergman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 16 Jun 2000 14:47:35 +0000 (14:47 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@542 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/help.php
src/left_help.php

index 84db77145c3525752033d3ed10c550c0a5ffc43a..81ad490bcd82bb42b873d57e8a7bf6dbae73eb7a 100644 (file)
 
    if (file_exists("../help/$user_language/basic.hlp")) {
        include ("../help/$user_language/basic.hlp");
-   } else {
+   } elseif(file_exists("../help/en/basic.hlp")) {
        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");
+   } else {
+       $nohelp = true;
    }
    if (file_exists("../help/$user_language/main_folder.hlp")) {
        include ("../help/$user_language/main_folder.hlp");
-   } else {
+   } elseif(file_exists("../help/en/main_folder.hlp")) {
        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");
+   } else {
+       $nohelp = true;
    }
    if (file_exists("../help/$user_language/read_mail.hlp")) {
        include ("../help/$user_language/read_mail.hlp");
-   } else {
+   } elseif(file_exists("../help/en/read_mail.hlp")) {
        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");
+   } else {
+       $nohelp = true;
    }
    if (file_exists("../help/$user_language/compose.hlp")) {
        include ("../help/$user_language/compose.hlp");
-   } else {
+   } elseif(file_exists("../help/en/compose.hlp")) {
        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");
+   } else {
+       $nohelp = true;
    }
    if (file_exists("../help/$user_language/addresses.hlp")) {
        include ("../help/$user_language/addresses.hlp");
-   } else {
+   } elseif(file_exists("../help/en/addresses.hlp")) {
        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");
+   } else {
+       $nohelp = true;
    }
    if (file_exists("../help/$user_language/folders.hlp")) {
        include ("../help/$user_language/folders.hlp");
-   } else {
+   } elseif(file_exists("../help/en/folders.hlp")) {
        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");
+   } else {
+       $nohelp = true;
    }
    if (file_exists("../help/$user_language/options.hlp")) {
        include ("../help/$user_language/options.hlp");
-   } else {
+   } elseif(file_exists("../help/en/options.hlp")) {
        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/options.hlp");
+   } else {
+       $nohelp = true;
    }
    if (file_exists("../help/$user_language/FAQ.hlp")) {
        include ("../help/$user_language/FAQ.hlp");
-   } else {
+   } elseif(file_exists("../help/en/FAQ.hlp")) {
        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/FAQ.hlp");
+   } else {
+       $nohelp = true;
+   }
+// If any of the standard help files aren't there, tell them.
+
+   if($nohelp) {
+       echo "<BR><CENTER><B><FONT COLOR=$color[2]>",_("ERROR: Some or all of the standard English help files ar missing."), "</FONT></B></CENTER><BR>";
    }
 
 ?>
index 96c2f932ff27447942deb639317dc4431f880197..b457293218e034f3ff855aff2315df9b99eb1da3 100644 (file)
    **  header tags (<H1> or <H3>).
    **/
 
-       if (!file_exists("../help/$user_language"))                     // If the selected language doesn't exist, use english
-          $user_language = "en";
+       if (file_exists("../help/$user_language")) {                    
+        } elseif(file_exists("../help/en")){                             // If the selected language doesn't exist, use english
+          $user_language = en;
+       } else {                                                         // If that is gone too, send a message
+          $nohelp = true;
+          echo "<BR><CENTER><B><FONT COLOR=$color[2]>",_("ERROR: Some or all of the standard English help files ar missing."), "</FONT></B></CENTER><BR>";
+        }
 
+       if(!$nohelp) {
+          while ( list( $key, $val ) = each( $helpdir ) ) {            // loop through the array of files
+             $fcontents = file("../help/$user_language/$val");         // assign each line of the above file to another array
+             while ( list( $line_num, $line ) = each( $fcontents ) ) { // loop through the second array
+                $temphed="";
+                $tempanc="";
 
-       while ( list( $key, $val ) = each( $helpdir ) ) {               // loop through the array of files
-          $fcontents = file("../help/$user_language/$val");            // assign each line of the above file to another array
-          while ( list( $line_num, $line ) = each( $fcontents ) ) {    // loop through the second array
-               $temphed="";
-               $tempanc="";
-
-               if ( eregi("<A NAME=", $line, $tempanc)) {              // if a name anchor is found, make a link
-                  $tempanc = trim($line);
-                  $tempanc = str_replace("<A NAME=", "", $tempanc);
-                  $tempanc = str_replace("></A>", "", $tempanc);
-                  echo "<A HREF=\"help.php#$tempanc\" target=\"right\">";
-               } 
-               if ( eregi("<H1>", $line, $temphed)) {                  // grab a description for the link made above
-                  $temphed = trim($line);
-                  $temphed = str_replace("<H1>", "", $temphed);
-                  $temphed = str_replace("</H1>", "", $temphed);
-                  echo "<BR>";
-                  echo "<FONT SIZE=+1>" . _("$temphed") . "</FONT></A><BR>\n"; // make it bigger since it is a heading type 1
-               }
-               if ( eregi("<H3>", $line, $temphed)) {                  // grab a description for the link made above
-                  $temphed = trim($line);
-                  $temphed = str_replace("<H3>", "", $temphed);
-                  $temphed = str_replace("</H3>", "", $temphed);
-                  echo "" . _("$temphed") . "</A><BR>\n";              // keep same size since it is a normal entry
-               }
+                if ( eregi("<A NAME=", $line, $tempanc)) {             // if a name anchor is found, make a link
+                   $tempanc = trim($line);
+                   $tempanc = str_replace("<A NAME=", "", $tempanc);
+                   $tempanc = str_replace("></A>", "", $tempanc);
+                   echo "<A HREF=\"help.php#$tempanc\" target=\"right\">";
+                }
+                if ( eregi("<H1>", $line, $temphed)) {                 // grab a description for the link made above
+                   $temphed = trim($line);
+                   $temphed = str_replace("<H1>", "", $temphed);
+                   $temphed = str_replace("</H1>", "", $temphed);
+                   echo "<BR>";
+                   echo "<FONT SIZE=+1>" . _("$temphed") . "</FONT></A><BR>\n";        // make it bigger since it is a heading type 1
+                }
+                if ( eregi("<H3>", $line, $temphed)) {                 // grab a description for the link made above
+                   $temphed = trim($line);
+                   $temphed = str_replace("<H3>", "", $temphed);
+                   $temphed = str_replace("</H3>", "", $temphed);
+                   echo "" . _("$temphed") . "</A><BR>\n";             // keep same size since it is a normal entry
+                }
+             }
           }
-       }                  
+       }
 ?>