summaryrefslogtreecommitdiff
path: root/framework/Exceptions
diff options
context:
space:
mode:
authorxue <>2005-11-20 15:55:59 +0000
committerxue <>2005-11-20 15:55:59 +0000
commit97a8c8dbd0c6e107c75c3eaee3633551265e84cb (patch)
tree4a95588160b38e67856502056baf01cc5542deac /framework/Exceptions
parent4767317d3dcc4316609154287b643eb85afbd9e2 (diff)
Diffstat (limited to 'framework/Exceptions')
-rw-r--r--framework/Exceptions/TErrorHandler.php17
-rw-r--r--framework/Exceptions/exception-en.html3
-rw-r--r--framework/Exceptions/exception-zh.html3
-rw-r--r--framework/Exceptions/exception.html3
-rw-r--r--framework/Exceptions/messages.txt6
5 files changed, 26 insertions, 6 deletions
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.="<div style=\"background-color: #ffeeee\">".$line."</div>";
+ $line=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",' ',$lines[$i])));
+ $source.="<div class=\"error\">".$line."</div>";
}
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;}
</style>
</head>
@@ -21,7 +22,9 @@ td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
<h3>Source File</h3>
<p>%%SourceFile%%</p>
<div class="source">
+<code><pre>
%%SourceCode%%
+</pre></code>
</div>
<h3>Stack Trace</h3>
<div class="source">
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;}
</style>
</head>
@@ -21,7 +22,9 @@ td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
<h3>错误代码文件</h3>
<p>%%SourceFile%%</p>
<div class="source">
+<code><pre>
%%SourceCode%%
+</pre></code>
</div>
<h3>错误堆栈信息</h3>
<div class="source">
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;}
</style>
</head>
@@ -21,7 +22,9 @@ td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
<h3>Source File</h3>
<p>%%SourceFile%%</p>
<div class="source">
+<code><pre>
%%SourceCode%%
+</pre></code>
</div>
<h3>Stack Trace</h3>
<div class="source">
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'.