summaryrefslogtreecommitdiff
path: root/framework/Exceptions
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Exceptions')
-rw-r--r--framework/Exceptions/TErrorHandler.php48
-rw-r--r--framework/Exceptions/templates/error-fr.html3
-rw-r--r--framework/Exceptions/templates/error-zh.html11
-rw-r--r--framework/Exceptions/templates/error.html3
-rw-r--r--framework/Exceptions/templates/error404-en.html3
-rw-r--r--framework/Exceptions/templates/error404-fr.html3
-rw-r--r--framework/Exceptions/templates/error404-zh.html3
-rw-r--r--framework/Exceptions/templates/error404.html3
-rw-r--r--framework/Exceptions/templates/error500-en.html3
-rw-r--r--framework/Exceptions/templates/error500-fr.html3
-rw-r--r--framework/Exceptions/templates/error500-zh.html3
-rw-r--r--framework/Exceptions/templates/error500.html3
-rw-r--r--framework/Exceptions/templates/error503-en.html3
-rw-r--r--framework/Exceptions/templates/error503-fr.html3
-rw-r--r--framework/Exceptions/templates/error503-zh.html3
-rw-r--r--framework/Exceptions/templates/error503.html3
-rw-r--r--framework/Exceptions/templates/exception-en.html3
-rw-r--r--framework/Exceptions/templates/exception-fr.html7
-rw-r--r--framework/Exceptions/templates/exception-zh.html3
-rw-r--r--framework/Exceptions/templates/exception.html3
20 files changed, 41 insertions, 76 deletions
diff --git a/framework/Exceptions/TErrorHandler.php b/framework/Exceptions/TErrorHandler.php
index e9f48a2b..7d914fca 100644
--- a/framework/Exceptions/TErrorHandler.php
+++ b/framework/Exceptions/TErrorHandler.php
@@ -190,21 +190,14 @@ class TErrorHandler extends TComponent implements IModule
die("Unable to open error template file '$errorFile'.");
$serverAdmin=isset($_SERVER['SERVER_ADMIN'])?$_SERVER['SERVER_ADMIN']:'';
- $fields=array(
- '%%StatusCode%%',
- '%%ErrorMessage%%',
- '%%ServerAdmin%%',
- '%%Version%%',
- '%%Time%%'
+ $tokens=array(
+ '%%StatusCode%%' => "$statusCode",
+ '%%ErrorMessage%%' => htmlspecialchars($exception->getMessage()),
+ '%%ServerAdmin%%' => $serverAdmin,
+ '%%Version%%' => $_SERVER['SERVER_SOFTWARE'].' <a href="http://www.pradosoft.com/">PRADO</a>/'.Prado::getVersion(),
+ '%%Time%%' => strftime('%Y-%m-%d %H:%m',time())
);
- $values=array(
- "$statusCode",
- htmlspecialchars($exception->getMessage()),
- $serverAdmin,
- $_SERVER['SERVER_SOFTWARE'].' <a href="http://www.pradosoft.com/">PRADO</a>/'.Prado::getVersion(),
- strftime('%Y-%m-%d %H:%m',time())
- );
- echo str_replace($fields,$values,$content);
+ echo strtr($content,$tokens);
}
/**
@@ -257,23 +250,14 @@ class TErrorHandler extends TComponent implements IModule
$source.=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",' ',$lines[$i])));
}
- $fields=array(
- '%%ErrorType%%',
- '%%ErrorMessage%%',
- '%%SourceFile%%',
- '%%SourceCode%%',
- '%%StackTrace%%',
- '%%Version%%',
- '%%Time%%'
- );
- $values=array(
- get_class($exception),
- htmlspecialchars($exception->getMessage()),
- htmlspecialchars($exception->getFile()).' ('.$exception->getLine().')',
- $source,
- htmlspecialchars($exception->getTraceAsString()),
- $_SERVER['SERVER_SOFTWARE'].' <a href="http://www.pradosoft.com/">PRADO</a>/'.Prado::getVersion(),
- strftime('%Y-%m-%d %H:%m',time())
+ $tokens=array(
+ '%%ErrorType%%' => get_class($exception),
+ '%%ErrorMessage%%' => htmlspecialchars($exception->getMessage()),
+ '%%SourceFile%%' => htmlspecialchars($exception->getFile()).' ('.$exception->getLine().')',
+ '%%SourceCode%%' => $source,
+ '%%StackTrace%%' => htmlspecialchars($exception->getTraceAsString()),
+ '%%Version%%' => $_SERVER['SERVER_SOFTWARE'].' <a href="http://www.pradosoft.com/">PRADO</a>/'.Prado::getVersion(),
+ '%%Time%%' => strftime('%Y-%m-%d %H:%m',time())
);
$lang=Prado::getPreferredLanguage();
$exceptionFile=Prado::getFrameworkPath().'/Exceptions/templates/'.self::EXCEPTION_FILE_NAME.'-'.$lang.'.html';
@@ -281,7 +265,7 @@ class TErrorHandler extends TComponent implements IModule
$exceptionFile=Prado::getFrameworkPath().'/Exceptions/templates/'.self::EXCEPTION_FILE_NAME.'.html';
if(($content=@file_get_contents($exceptionFile))===false)
die("Unable to open exception template file '$exceptionFile'.");
- echo str_replace($fields,$values,$content);
+ echo strtr($content,$tokens);
}
}
diff --git a/framework/Exceptions/templates/error-fr.html b/framework/Exceptions/templates/error-fr.html
index edea47bc..5546dcdb 100644
--- a/framework/Exceptions/templates/error-fr.html
+++ b/framework/Exceptions/templates/error-fr.html
@@ -23,8 +23,7 @@ Cette erreur est survenue en essayant de répondre à votre requête.
Si vous pensez qu'il s'agit d'une erreur inattendue du serveur, merci de contacter l'<a href="mailto:%%ServerAdmin%%">administrateur</a>
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error-zh.html b/framework/Exceptions/templates/error-zh.html
index af921417..545f057c 100644
--- a/framework/Exceptions/templates/error-zh.html
+++ b/framework/Exceptions/templates/error-zh.html
@@ -1,4 +1,4 @@
-<html>
+<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset="utf-8"/>
<meta http-equiv="content-language" content="zh"/>
@@ -14,17 +14,16 @@ p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top
</head>
<body bgcolor="white">
-<h1>Error %%StatusCode%%</h1>
+<h1>错误%%StatusCode%%</h1>
<h2>%%ErrorMessage%%</h2>
<p>
-The above error happened when the server was processing your request.
+服务器在处理您的页面请求时出现了以上错误。
</p>
<p>
-If you think this is a server error, please contact the <a href="mailto:%%ServerAdmin%%">webmaster</a>.
+如果您认为这是服务器的原因,请联系通知<a href="mailto:%%ServerAdmin%%">系统管理员</a>。
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error.html b/framework/Exceptions/templates/error.html
index 0dd625b6..931f96a3 100644
--- a/framework/Exceptions/templates/error.html
+++ b/framework/Exceptions/templates/error.html
@@ -23,8 +23,7 @@ The above error happened when the server was processing your request.
If you think this is a server error, please contact the <a href="mailto:%%ServerAdmin%%">webmaster</a>.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error404-en.html b/framework/Exceptions/templates/error404-en.html
index 1f6610fe..92ac65b1 100644
--- a/framework/Exceptions/templates/error404-en.html
+++ b/framework/Exceptions/templates/error404-en.html
@@ -24,8 +24,7 @@ If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the <a href="mailto:%%ServerAdmin%%">webmaster</a>.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error404-fr.html b/framework/Exceptions/templates/error404-fr.html
index 76c219bb..181bd8a7 100644
--- a/framework/Exceptions/templates/error404-fr.html
+++ b/framework/Exceptions/templates/error404-fr.html
@@ -24,8 +24,7 @@ Si vous avez tapé cette URL manuellement dans la barre d'adresse, merci de vér
Si vous pensez qu'il s'agit d'une erreur inattendue du serveur, merci de contacter l'<a href="mailto:%%ServerAdmin%%">administrateur</a>
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error404-zh.html b/framework/Exceptions/templates/error404-zh.html
index 7766acd4..ae5d8275 100644
--- a/framework/Exceptions/templates/error404-zh.html
+++ b/framework/Exceptions/templates/error404-zh.html
@@ -24,8 +24,7 @@ p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top
如果您确认这是服务器错误,请联系<a href="mailto:%%ServerAdmin%%">系统管理员</a>。
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error404.html b/framework/Exceptions/templates/error404.html
index 1f6610fe..92ac65b1 100644
--- a/framework/Exceptions/templates/error404.html
+++ b/framework/Exceptions/templates/error404.html
@@ -24,8 +24,7 @@ If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the <a href="mailto:%%ServerAdmin%%">webmaster</a>.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error500-en.html b/framework/Exceptions/templates/error500-en.html
index 1c7c531e..25d4ad92 100644
--- a/framework/Exceptions/templates/error500-en.html
+++ b/framework/Exceptions/templates/error500-en.html
@@ -24,8 +24,7 @@ Please contact the <a href="mailto:%%ServerAdmin%%">webmaster</a> to report this
Thank you.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error500-fr.html b/framework/Exceptions/templates/error500-fr.html
index c7685e1c..804425ef 100644
--- a/framework/Exceptions/templates/error500-fr.html
+++ b/framework/Exceptions/templates/error500-fr.html
@@ -24,8 +24,7 @@ Veuillez contacter l'<a href="mailto:%%ServerAdmin%%">administrateur</a> pour lu
Merci de votre compréhension.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error500-zh.html b/framework/Exceptions/templates/error500-zh.html
index 647f8dec..a10dbba4 100644
--- a/framework/Exceptions/templates/error500-zh.html
+++ b/framework/Exceptions/templates/error500-zh.html
@@ -23,8 +23,7 @@ p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top
谢谢。
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error500.html b/framework/Exceptions/templates/error500.html
index 1c7c531e..25d4ad92 100644
--- a/framework/Exceptions/templates/error500.html
+++ b/framework/Exceptions/templates/error500.html
@@ -24,8 +24,7 @@ Please contact the <a href="mailto:%%ServerAdmin%%">webmaster</a> to report this
Thank you.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error503-en.html b/framework/Exceptions/templates/error503-en.html
index 007a498c..718dd4ea 100644
--- a/framework/Exceptions/templates/error503-en.html
+++ b/framework/Exceptions/templates/error503-en.html
@@ -22,8 +22,7 @@ Our system is currently under maintenance. Please come back later.
Thank you.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error503-fr.html b/framework/Exceptions/templates/error503-fr.html
index 34198a0f..699114de 100644
--- a/framework/Exceptions/templates/error503-fr.html
+++ b/framework/Exceptions/templates/error503-fr.html
@@ -22,8 +22,7 @@ Le service est actuellement en maintenance et indisponible. Merci de réessayer
Merci de votre compréhension.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error503-zh.html b/framework/Exceptions/templates/error503-zh.html
index 7ce0c29d..5babac19 100644
--- a/framework/Exceptions/templates/error503-zh.html
+++ b/framework/Exceptions/templates/error503-zh.html
@@ -22,8 +22,7 @@ p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top
谢谢。
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error503.html b/framework/Exceptions/templates/error503.html
index 007a498c..718dd4ea 100644
--- a/framework/Exceptions/templates/error503.html
+++ b/framework/Exceptions/templates/error503.html
@@ -22,8 +22,7 @@ Our system is currently under maintenance. Please come back later.
Thank you.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/exception-en.html b/framework/Exceptions/templates/exception-en.html
index 7dd133f5..45fc264c 100644
--- a/framework/Exceptions/templates/exception-en.html
+++ b/framework/Exceptions/templates/exception-en.html
@@ -35,8 +35,7 @@ td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
</pre></code>
</div>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/exception-fr.html b/framework/Exceptions/templates/exception-fr.html
index 7da91bfd..b6f1369b 100644
--- a/framework/Exceptions/templates/exception-fr.html
+++ b/framework/Exceptions/templates/exception-fr.html
@@ -1,4 +1,4 @@
-<html>
+<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset="utf-8"/>
<meta http-equiv="content-language" content="fr"/>
@@ -28,15 +28,14 @@ td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
%%SourceCode%%
</pre></code>
</div>
-<h3>Trace de la pile d'excution:</h3>
+<h3>Trace de la pile d'ex閏ution:</h3>
<div class="source">
<code><pre>
%%StackTrace%%
</pre></code>
</div>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/exception-zh.html b/framework/Exceptions/templates/exception-zh.html
index ed8db236..8568dde1 100644
--- a/framework/Exceptions/templates/exception-zh.html
+++ b/framework/Exceptions/templates/exception-zh.html
@@ -35,8 +35,7 @@ td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
</pre></code>
</div>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/exception.html b/framework/Exceptions/templates/exception.html
index 7dd133f5..45fc264c 100644
--- a/framework/Exceptions/templates/exception.html
+++ b/framework/Exceptions/templates/exception.html
@@ -35,8 +35,7 @@ td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
</pre></code>
</div>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file