diff options
author | xue <> | 2006-02-15 20:26:03 +0000 |
---|---|---|
committer | xue <> | 2006-02-15 20:26:03 +0000 |
commit | ab781af4385b77943975394eba606cd38f1e4fb1 (patch) | |
tree | f330817bfa1b1c2d92890db86d1b99e68a76ae5f | |
parent | ba1933d83922e3eb42e93b3fa476f4614a58aebc (diff) |
Added duplicate property configuration check.
-rw-r--r-- | framework/Exceptions/messages.txt | 1 | ||||
-rw-r--r-- | framework/Web/UI/TTemplateManager.php | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt index d0c1a7be..d258a70d 100644 --- a/framework/Exceptions/messages.txt +++ b/framework/Exceptions/messages.txt @@ -105,6 +105,7 @@ template_component_required = '%s' is not a component. Only components can ap template_format_invalid = Error in %s (line %d) : %s
template_format_invalid2 = Error at line %d of the following template: %s %s
template_eventhandler_invalid = An invalid event handler is attached to %s's event '%s'.
+template_property_duplicated = Property %s is configured twice or more.
xmldocument_file_read_failed = TXmlDocument is unable to read file '%s'.
xmldocument_file_write_failed = TXmlDocument is unable to write file '%s'.
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index 59d15698..4c71de51 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -568,6 +568,8 @@ class TTemplate extends TComponent implements ITemplate $value=$this->parseAttribute($value);
$type=$tpl[$container][1];
$this->validateAttributes($type,array($prop=>$value));
+ if(isset($tpl[$container][2][$prop]))
+ throw new TConfigurationException('template_property_duplicated',$prop);
$tpl[$container][2][$prop]=$value;
$textStart=$matchEnd+1;
}
@@ -630,6 +632,8 @@ class TTemplate extends TComponent implements ITemplate {
$match=&$matches[$i];
$name=strtolower($match[1][0]);
+ if(isset($attributes[$name]))
+ throw new TConfigurationException('template_property_duplicated',$name);
$value=$match[2][0];
if(strrpos($name,'template')===strlen($name)-8)
{
|