Browse Source

Added error check and message for missing ../help/en dir and hlp files.

lbergman 25 years ago
parent
commit
1a10feb141
2 changed files with 63 additions and 36 deletions
  1. 29 8
      src/help.php
  2. 34 28
      src/left_help.php

+ 29 - 8
src/help.php

@@ -26,68 +26,89 @@
 
 
    if (file_exists("../help/$user_language/basic.hlp")) {
    if (file_exists("../help/$user_language/basic.hlp")) {
 	include ("../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 "<CENTER><B><FONT COLOR=$color[2]>";
 	echo _("Your preferred language is not yet translated. English will be substituted here.");
 	echo _("Your preferred language is not yet translated. English will be substituted here.");
 	echo "</FONT></B></CENTER><BR>";
 	echo "</FONT></B></CENTER><BR>";
 	include ("../help/en/basic.hlp");
 	include ("../help/en/basic.hlp");
+   } else {
+	$nohelp = true;
    }
    }
    if (file_exists("../help/$user_language/main_folder.hlp")) {
    if (file_exists("../help/$user_language/main_folder.hlp")) {
 	include ("../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 "<CENTER><B><FONT COLOR=$color[2]>";
 	echo _("Your preferred language is not yet translated. English will be substituted here.");
 	echo _("Your preferred language is not yet translated. English will be substituted here.");
 	echo "</FONT></B></CENTER><BR>";
 	echo "</FONT></B></CENTER><BR>";
 	include ("../help/en/main_folder.hlp");
 	include ("../help/en/main_folder.hlp");
+   } else {
+	$nohelp = true;
    }
    }
    if (file_exists("../help/$user_language/read_mail.hlp")) {
    if (file_exists("../help/$user_language/read_mail.hlp")) {
 	include ("../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 "<CENTER><B><FONT COLOR=$color[2]>";
 	echo _("Your preferred language is not yet translated. English will be substituted here.");
 	echo _("Your preferred language is not yet translated. English will be substituted here.");
 	echo "</FONT></B></CENTER><BR>";
 	echo "</FONT></B></CENTER><BR>";
 	include ("../help/en/read_mail.hlp");
 	include ("../help/en/read_mail.hlp");
+   } else {
+	$nohelp = true;
    }
    }
    if (file_exists("../help/$user_language/compose.hlp")) {
    if (file_exists("../help/$user_language/compose.hlp")) {
 	include ("../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]>Your preferred language is not yet translated. English will be substituted here.</FONT></B></CENTER><BR>";
 	echo "<CENTER><B><FONT COLOR=$color[2]>";
 	echo "<CENTER><B><FONT COLOR=$color[2]>";
 	echo _("Your preferred language is not yet translated. English will be substituted here.");
 	echo _("Your preferred language is not yet translated. English will be substituted here.");
 	echo "</FONT></B></CENTER><BR>";
 	echo "</FONT></B></CENTER><BR>";
 	include ("../help/en/compose.hlp");
 	include ("../help/en/compose.hlp");
+   } else {
+	$nohelp = true;
    }
    }
    if (file_exists("../help/$user_language/addresses.hlp")) {
    if (file_exists("../help/$user_language/addresses.hlp")) {
 	include ("../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 "<CENTER><B><FONT COLOR=$color[2]>";
 	echo _("Your preferred language is not yet translated. English will be substituted here.");
 	echo _("Your preferred language is not yet translated. English will be substituted here.");
 	echo "</FONT></B></CENTER><BR>";
 	echo "</FONT></B></CENTER><BR>";
 	include ("../help/en/addresses.hlp");
 	include ("../help/en/addresses.hlp");
+   } else {
+	$nohelp = true;
    }
    }
    if (file_exists("../help/$user_language/folders.hlp")) {
    if (file_exists("../help/$user_language/folders.hlp")) {
 	include ("../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 "<CENTER><B><FONT COLOR=$color[2]>";
 	echo _("Your preferred language is not yet translated. English will be substituted here.");
 	echo _("Your preferred language is not yet translated. English will be substituted here.");
 	echo "</FONT></B></CENTER><BR>";
 	echo "</FONT></B></CENTER><BR>";
 	include ("../help/en/folders.hlp");
 	include ("../help/en/folders.hlp");
+   } else {
+	$nohelp = true;
    }
    }
    if (file_exists("../help/$user_language/options.hlp")) {
    if (file_exists("../help/$user_language/options.hlp")) {
 	include ("../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 "<CENTER><B><FONT COLOR=$color[2]>";
 	echo _("Your preferred language is not yet translated. English will be substituted here.");
 	echo _("Your preferred language is not yet translated. English will be substituted here.");
 	echo "</FONT></B></CENTER><BR>";
 	echo "</FONT></B></CENTER><BR>";
 	include ("../help/en/options.hlp");
 	include ("../help/en/options.hlp");
+   } else {
+	$nohelp = true;
    }
    }
    if (file_exists("../help/$user_language/FAQ.hlp")) {
    if (file_exists("../help/$user_language/FAQ.hlp")) {
 	include ("../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 "<CENTER><B><FONT COLOR=$color[2]>";
 	echo _("Your preferred language is not yet translated. English will be substituted here.");
 	echo _("Your preferred language is not yet translated. English will be substituted here.");
 	echo "</FONT></B></CENTER><BR>";
 	echo "</FONT></B></CENTER><BR>";
 	include ("../help/en/FAQ.hlp");
 	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>";
    }
    }
 
 
 ?>
 ?>

+ 34 - 28
src/left_help.php

@@ -42,35 +42,41 @@
    **  header tags (<H1> or <H3>).
    **  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
+    	   	 }
+	      }
 	   }
 	   }
-	}                  
+	}
 ?>
 ?>