From 97a8c8dbd0c6e107c75c3eaee3633551265e84cb Mon Sep 17 00:00:00 2001 From: xue <> Date: Sun, 20 Nov 2005 15:55:59 +0000 Subject: --- framework/Exceptions/TErrorHandler.php | 17 +++++++++++------ framework/Exceptions/exception-en.html | 3 +++ framework/Exceptions/exception-zh.html | 3 +++ framework/Exceptions/exception.html | 3 +++ framework/Exceptions/messages.txt | 6 ++++++ 5 files changed, 26 insertions(+), 6 deletions(-) (limited to 'framework/Exceptions') diff --git a/framework/Exceptions/TErrorHandler.php b/framework/Exceptions/TErrorHandler.php index 69166561..e9ef1f33 100644 --- a/framework/Exceptions/TErrorHandler.php +++ b/framework/Exceptions/TErrorHandler.php @@ -59,6 +59,10 @@ class TErrorHandler extends TComponent implements IModule * exception template file basename */ const EXCEPTION_FILE_NAME='exception'; + /** + * number of lines to be displayed in case of an exception + */ + const SOURCE_LINES=12; /** * @var string module ID @@ -223,6 +227,7 @@ class TErrorHandler extends TComponent implements IModule } } + /** * Displays exception information. * Exceptions are displayed with rich context information, including @@ -234,19 +239,19 @@ class TErrorHandler extends TComponent implements IModule { $lines=file($exception->getFile()); $errorLine=$exception->getLine(); - $beginLine=$errorLine-9>=0?$errorLine-9:0; - $endLine=$errorLine+8<=count($lines)?$errorLine+8:count($lines); + $beginLine=$errorLine-self::SOURCE_LINES>=0?$errorLine-self::SOURCE_LINES:0; + $endLine=$errorLine+self::SOURCE_LINES<=count($lines)?$errorLine+self::SOURCE_LINES:count($lines); $source=''; - for($i=$beginLine;$i<$endLine;++$i) + for($i=$beginLine-1;$i<$endLine;++$i) { if($i===$errorLine-1) { - $line=highlight_string(sprintf("Line %4d: %s",$i+1,$lines[$i]),true); - $source.="
".$line."
"; + $line=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",' ',$lines[$i]))); + $source.="
".$line."
"; } else - $source.=highlight_string(sprintf("Line %4d: %s",$i+1,$lines[$i]),true); + $source.=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",' ',$lines[$i]))); } $fields=array( diff --git a/framework/Exceptions/exception-en.html b/framework/Exceptions/exception-en.html index 1d76c7f2..67e15dfe 100644 --- a/framework/Exceptions/exception-en.html +++ b/framework/Exceptions/exception-en.html @@ -10,6 +10,7 @@ p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top code,pre {font-family:"Lucida Console";} td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;} .source {font-family:"Lucida Console";font-weight:normal;background-color:#ffffee;} +.error {background-color: #ffeeee;} @@ -21,7 +22,9 @@ td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}

Source File

%%SourceFile%%

+
 %%SourceCode%%
+

Stack Trace

diff --git a/framework/Exceptions/exception-zh.html b/framework/Exceptions/exception-zh.html index 8f56ec9e..e0897688 100644 --- a/framework/Exceptions/exception-zh.html +++ b/framework/Exceptions/exception-zh.html @@ -10,6 +10,7 @@ p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top code,pre {font-family:"Lucida Console";} td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;} .source {font-family:"Lucida Console";font-weight:normal;background-color:#ffffee;} +.error {background-color: #ffeeee;} @@ -21,7 +22,9 @@ td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}

错误代码文件

%%SourceFile%%

+
 %%SourceCode%%
+

错误堆栈信息

diff --git a/framework/Exceptions/exception.html b/framework/Exceptions/exception.html index 1d76c7f2..67e15dfe 100644 --- a/framework/Exceptions/exception.html +++ b/framework/Exceptions/exception.html @@ -10,6 +10,7 @@ p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top code,pre {font-family:"Lucida Console";} td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;} .source {font-family:"Lucida Console";font-weight:normal;background-color:#ffffee;} +.error {background-color: #ffeeee;} @@ -21,7 +22,9 @@ td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}

Source File

%%SourceFile%%

+
 %%SourceCode%%
+

Stack Trace

diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt index 49160370..209c0124 100644 --- a/framework/Exceptions/messages.txt +++ b/framework/Exceptions/messages.txt @@ -79,6 +79,12 @@ xmldocument_file_write_failed = TXmlDocument is unable to write file '%s'. authorizationrule_action_invalid = TAuthorizationRule.Action can only take 'allow' or 'deny' as the value. authorizationrule_verb_invalid = TAuthorizationRule.Verb can only take 'get' or 'post' as the value. +authmanager_usermanager_required = TAuthManager.UserManager must be assigned a value. +authmanager_usermanager_inexistent = TAuthManager.UserManager '%s' does not refer to an ID of application module. +authmanager_usermanager_invalid = TAuthManager.UserManager '%s' does not refer to a valid TUserManager application module. +authmanager_usermanager_unchangeable = TAuthManager.UserManager cannot be modified after the module is initialized. +authmanager_session_required = TAuthManager requires a session application module. + body_contents_not_allowed = %s: body contents are not allowed. control_id_not_unique = Control ID '%s' is not unique for control type '%s'. control_not_found = Unable to find a control with ID '%s'. -- cgit v1.2.3