From 403698f27e18320fec6696a0bd0914be72b237de Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 26 Apr 2010 16:33:10 +0200 Subject: [PATCH] LSattr_html_select_object : Added a check of the value_attribute parameter (Cf. Bug repport #1804) --- .../class/class.LSattr_html_select_object.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/public_html/includes/class/class.LSattr_html_select_object.php b/public_html/includes/class/class.LSattr_html_select_object.php index dd8f5dac..a6ad6262 100644 --- a/public_html/includes/class/class.LSattr_html_select_object.php +++ b/public_html/includes/class/class.LSattr_html_select_object.php @@ -99,6 +99,10 @@ class LSattr_html_select_object extends LSattr_html{ if(($conf['value_attribute']=='dn')||($conf['value_attribute']=='%{dn}')) { $val = $dn; } + elseif (!isset($obj->attrs[$conf['value_attribute']])) { + LSerror :: addErrorCode('LSattr_html_select_object_02',$this -> name); + return; + } else { $val = $obj -> getValue($conf['value_attribute']); $val = $val[0]; @@ -151,6 +155,10 @@ class LSattr_html_select_object extends LSattr_html{ } } else { + if (!isset($conf['value_attribute']) || (!is_array(LSconfig::get('LSobjects.'.$conf['object_type'].'.attrs.'.$conf['value_attribute'])))) { + LSerror :: addErrorCode('LSattr_html_select_object_02',$this -> name); + return; + } $filters=array(); foreach($values as $val) { if (!empty($val)) { @@ -203,5 +211,8 @@ class LSattr_html_select_object extends LSattr_html{ LSerror :: defineError('LSattr_html_select_object_01', _("LSattr_html_select_object : LSobject type is undefined (attribute : %{attr}).") ); +LSerror :: defineError('LSattr_html_select_object_02', +_("LSattr_html_select_object : the value of the parameter value_attribute in the configuration of the attribute %{attrs} is incorrect. This attribute does not exists.") +); ?>