diff options
-rw-r--r-- | .gitattributes | 2 | ||||
-rw-r--r-- | framework/Exceptions/TErrorHandler.php | 4 | ||||
-rw-r--r-- | framework/Exceptions/TException.php | 8 | ||||
-rw-r--r-- | framework/Exceptions/messages.txt (renamed from framework/Exceptions/messages.en) | 0 |
4 files changed, 8 insertions, 6 deletions
diff --git a/.gitattributes b/.gitattributes index ab16e7b4..0056eab6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -49,7 +49,7 @@ framework/Exceptions/error500.tpl -text framework/Exceptions/exception-en.tpl -text framework/Exceptions/exception-zh.tpl -text framework/Exceptions/exception.tpl -text -framework/Exceptions/messages.en -text +framework/Exceptions/messages.txt -text framework/IO/TTextWriter.php -text framework/Security/TAuthManager.php -text framework/Security/TAuthorizationRule.php -text diff --git a/framework/Exceptions/TErrorHandler.php b/framework/Exceptions/TErrorHandler.php index fe756e32..efcbe831 100644 --- a/framework/Exceptions/TErrorHandler.php +++ b/framework/Exceptions/TErrorHandler.php @@ -94,7 +94,7 @@ class TErrorHandler extends TComponent implements IModule $base=$this->_templatePath.'/'.self::ERROR_FILE_NAME;
$lang=array_shift(explode('-',array_shift(Prado::getUserLanguages())));
if(!empty($lang) && !ctype_alpha($lang))
- die('No hack attempt please.');
+ $lang='';
if(is_file("$base$statusCode-$lang.tpl"))
$errorFile="$base$statusCode-$lang.tpl";
else if(is_file("$base$statusCode.tpl"))
@@ -177,7 +177,7 @@ class TErrorHandler extends TComponent implements IModule );
$lang=array_shift(explode('-',array_shift(Prado::getUserLanguages())));
if(!empty($lang) && !ctype_alpha($lang))
- die('No hack attempt please.');
+ $lang='';
$exceptionFile=dirname(__FILE__).'/'.self::EXCEPTION_FILE_NAME.'-'.$lang.'.tpl';
if(!is_file($exceptionFile))
$exceptionFile=dirname(__FILE__).'/'.self::EXCEPTION_FILE_NAME.'.tpl';
diff --git a/framework/Exceptions/TException.php b/framework/Exceptions/TException.php index a90c14dd..d920f373 100644 --- a/framework/Exceptions/TException.php +++ b/framework/Exceptions/TException.php @@ -51,10 +51,12 @@ class TException extends Exception protected function translateErrorMessage($key)
{
- $languages=Prado::getUserLanguages();
- $msgFile=dirname(__FILE__).'/messages.'.$languages[0];
+ $lang=array_shift(explode('-',array_shift(Prado::getUserLanguages())));
+ if(!empty($lang) && !ctype_alpha($lang))
+ $lang='';
+ $msgFile=dirname(__FILE__).'/messages-'.$lang.'.txt';
if(!is_file($msgFile))
- $msgFile=dirname(__FILE__).'/messages.en';
+ $msgFile=dirname(__FILE__).'/messages.txt';
if(($entries=@file($msgFile))===false)
return $key;
else
diff --git a/framework/Exceptions/messages.en b/framework/Exceptions/messages.txt index 688901c2..688901c2 100644 --- a/framework/Exceptions/messages.en +++ b/framework/Exceptions/messages.txt |