diff options
author | xue <> | 2006-03-01 01:22:28 +0000 |
---|---|---|
committer | xue <> | 2006-03-01 01:22:28 +0000 |
commit | 83cce043e7364367d4365752ba8c1ed807dd5557 (patch) | |
tree | 46b737ce676f5133a853c0b67a4c792765466291 /framework | |
parent | 3b91e1039d8bd9dcc3db14734eca4e88fdbcb2f0 (diff) |
Added some more sanity checks of template usage.
Diffstat (limited to 'framework')
-rw-r--r-- | framework/Exceptions/messages.txt | 5 | ||||
-rw-r--r-- | framework/Web/UI/TTemplateControl.php | 7 | ||||
-rw-r--r-- | framework/Web/UI/TTemplateManager.php | 7 |
3 files changed, 17 insertions, 2 deletions
diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt index c9b9af7a..c5c26fe0 100644 --- a/framework/Exceptions/messages.txt +++ b/framework/Exceptions/messages.txt @@ -113,8 +113,10 @@ template_databind_forbidden = {0} is a non-control component. No databinding template_component_required = '{0}' is not a component. Only components can appear in a template.
template_format_invalid = Error in {0} (line {1}) : {2}
template_format_invalid2 = Error at line {0} of the following template: {1} {2}
-template_eventhandler_invalid = An invalid event handler is attached to {0}'s event '{1}'.
template_property_duplicated = Property {0} is configured twice or more.
+template_eventhandler_invalid = {0}.{1} can only accept a static string.
+template_controlid_invalid = {0}.ID can only accept a static text string.
+template_controlskinid_invalid = {0}.SkinID can only accept a static text string.
xmldocument_file_read_failed = TXmlDocument is unable to read file '{0}'.
xmldocument_file_write_failed = TXmlDocument is unable to write file '{0}'.
@@ -156,6 +158,7 @@ control_id_nonunique = {0}.ID '{1}' is not unique among all controls under t templatecontrol_mastercontrol_invalid = Master control must be of type TTemplateControl or a child class.
templatecontrol_contentid_duplicated = TContent ID '{0}' is duplicated.
templatecontrol_placeholderid_duplicated= TContentPlaceHolder ID '{0}' is duplicated.
+templatecontrol_directive_invalid = {0}.{1} can only accept a static text string through a template directive.
page_form_duplicated = A page can contain at most one TForm. Use regular HTML form tags for the rest forms.
page_isvalid_unknown = TPage.IsValid has not been evaluated yet.
diff --git a/framework/Web/UI/TTemplateControl.php b/framework/Web/UI/TTemplateControl.php index 18766102..c902295c 100644 --- a/framework/Web/UI/TTemplateControl.php +++ b/framework/Web/UI/TTemplateControl.php @@ -128,7 +128,12 @@ class TTemplateControl extends TControl implements INamingContainer if($tpl=$this->getTemplate(true))
{
foreach($tpl->getDirective() as $name=>$value)
- $this->setSubProperty($name,$value);
+ {
+ if(is_string($value))
+ $this->setSubProperty($name,$value);
+ else
+ throw new TConfigurationException('templatecontrol_directive_invalid',get_class($this),$name);
+ }
$tpl->instantiateIn($this);
}
}
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index 843331e9..0d2471f3 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -714,6 +714,13 @@ class TTemplate extends TApplicationComponent implements ITemplate else
throw new TConfigurationException('template_property_unknown',$type,$name);
}
+ else if(!is_string($att))
+ {
+ if(strcasecmp($name,'id')===0)
+ throw new TConfigurationException('template_controlid_invalid',$type);
+ else if(strcasecmp($name,'skinid')===0)
+ throw new TConfigurationException('template_controlskinid_invalid',$type);
+ }
}
}
}
|