From f7942326da7bb7ec5c6422750d00988e0057bb68 Mon Sep 17 00:00:00 2001 From: lbergman Date: Fri, 16 Jun 2000 14:47:35 +0000 Subject: [PATCH] Added error check and message for missing ../help/en dir and hlp files. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@542 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/help.php | 37 ++++++++++++++++++++++------ src/left_help.php | 62 ++++++++++++++++++++++++++--------------------- 2 files changed, 63 insertions(+), 36 deletions(-) diff --git a/src/help.php b/src/help.php index 84db7714..81ad490b 100644 --- a/src/help.php +++ b/src/help.php @@ -26,68 +26,89 @@ if (file_exists("../help/$user_language/basic.hlp")) { include ("../help/$user_language/basic.hlp"); - } else { + } elseif(file_exists("../help/en/basic.hlp")) { echo "
"; echo _("Your preferred language is not yet translated. English will be substituted here."); echo "

"; 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 "
"; echo _("Your preferred language is not yet translated. English will be substituted here."); echo "

"; 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 "
"; echo _("Your preferred language is not yet translated. English will be substituted here."); echo "

"; 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 "
Your preferred language is not yet translated. English will be substituted here.

"; echo "
"; echo _("Your preferred language is not yet translated. English will be substituted here."); echo "

"; 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 "
"; echo _("Your preferred language is not yet translated. English will be substituted here."); echo "

"; 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 "
"; echo _("Your preferred language is not yet translated. English will be substituted here."); echo "

"; 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 "
"; echo _("Your preferred language is not yet translated. English will be substituted here."); echo "

"; 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 "
"; echo _("Your preferred language is not yet translated. English will be substituted here."); echo "

"; include ("../help/en/FAQ.hlp"); + } else { + $nohelp = true; + } +// If any of the standard help files aren't there, tell them. + + if($nohelp) { + echo "
",_("ERROR: Some or all of the standard English help files ar missing."), "

"; } ?> diff --git a/src/left_help.php b/src/left_help.php index 96c2f932..b4572932 100644 --- a/src/left_help.php +++ b/src/left_help.php @@ -42,35 +42,41 @@ ** header tags (

or

). **/ - 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 "
",_("ERROR: Some or all of the standard English help files ar missing."), "

"; + } + 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("", "", $tempanc); - echo ""; - } - if ( eregi("

", $line, $temphed)) { // grab a description for the link made above - $temphed = trim($line); - $temphed = str_replace("

", "", $temphed); - $temphed = str_replace("

", "", $temphed); - echo "
"; - echo "" . _("$temphed") . "

\n"; // make it bigger since it is a heading type 1 - } - if ( eregi("

", $line, $temphed)) { // grab a description for the link made above - $temphed = trim($line); - $temphed = str_replace("

", "", $temphed); - $temphed = str_replace("

", "", $temphed); - echo "" . _("$temphed") . "
\n"; // keep same size since it is a normal entry - } + if ( eregi("", "", $tempanc); + echo ""; + } + if ( eregi("

", $line, $temphed)) { // grab a description for the link made above + $temphed = trim($line); + $temphed = str_replace("

", "", $temphed); + $temphed = str_replace("

", "", $temphed); + echo "
"; + echo "" . _("$temphed") . "

\n"; // make it bigger since it is a heading type 1 + } + if ( eregi("

", $line, $temphed)) { // grab a description for the link made above + $temphed = trim($line); + $temphed = str_replace("

", "", $temphed); + $temphed = str_replace("

", "", $temphed); + echo "" . _("$temphed") . "
\n"; // keep same size since it is a normal entry + } + } } - } + } ?> -- 2.25.1