From ab781af4385b77943975394eba606cd38f1e4fb1 Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 15 Feb 2006 20:26:03 +0000 Subject: Added duplicate property configuration check. --- framework/Exceptions/messages.txt | 1 + framework/Web/UI/TTemplateManager.php | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'framework') 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) { -- cgit v1.2.3