Index: trunk/kernel/units/configuration/configuration_event_handler.php =================================================================== diff -u -N -r1875 -r4043 --- trunk/kernel/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 1875) +++ trunk/kernel/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 4043) @@ -13,21 +13,11 @@ { $object =& $event->getObject(); - $module_owner=$this->Application->GetVar('module'); - if ($module_owner===false) { - $module_owner=$this->myUrlDecode($this->Application->GetVar('conf_module')); - $this->Application->SetVar("module", $module_owner); - } - - $section=$this->Application->GetVar('section'); - if ($section===false){ - $section=$this->myUrlDecode($this->Application->GetVar('conf_section')); - $this->Application->SetVar("section", $section); - } + $module_owner = $this->Application->GetLinkedVar('module'); + $section = $this->Application->GetLinkedVar('section'); - $object->addFilter('module_filter', '%1$s.ModuleOwner = "'.$module_owner.'"'); - $object->addFilter('section_filter', '%1$s.Section = "'.$section.'"'); - $object->AddOrderField('DisplayOrder', 'ASC'); + $object->addFilter('module_filter', '%1$s.ModuleOwner = '.$this->Conn->qstr($module_owner)); + $object->addFilter('section_filter', '%1$s.Section = '.$this->Conn->qstr($section)); } /** @@ -38,13 +28,12 @@ function OnBeforeItemUpdate(&$event) { $object =& $event->getObject(); - if($object->GetDBField('element_type') == 'password') - { - if (trim($object->GetDBField('VariableValue'))=='') { - $field_options=$object->GetFieldOptions('VariableValue'); - $field_options['skip_empty']=1; + if ($object->GetDBField('element_type') == 'password') { + if (trim($object->GetDBField('VariableValue')) == '') { + $field_options = $object->GetFieldOptions('VariableValue'); + $field_options['skip_empty'] = 1; $object->SetFieldOptions('VariableValue', $field_options); - }else{ + }else { $object->SetDBField('VariableValue', md5($object->GetDBField('VariableValue'))); } } @@ -54,7 +43,7 @@ //$this->country_state_pairs = Array('Comm_Country' => 'Comm_State', 'Comm_Shipping_Country' => 'Comm_Shipping_State'); $this->state_country_pairs = Array('Comm_State' => 'Comm_Country', 'Comm_Shipping_State' => 'Comm_Shipping_Country'); - if ( isset($this->state_country_pairs[$object->GetDBField('VariableName')]) ){ + if ( isset($this->state_country_pairs[$object->GetDBField('VariableName')]) ) { //$this->state_country_codes[$this->country_state_pairs[$object->GetDBField('VariableName')]]=$object->GetDBField('VariableValue'); $check_state = $object->GetDBField('VariableValue'); $check_country = $submitted_vars[$this->state_country_pairs[$object->GetDBField('VariableName')]]['VariableValue']; @@ -93,51 +82,39 @@ function OnAfterItemUpdate(&$event) { $object =& $event->getObject(); - if($object->GetDBField('element_type') == 'password') - { - if (trim($object->GetDBField('VariableValue'))=='') { - $field_options=$object->GetFieldOptions('VariableValue'); + if ($object->GetDBField('element_type') == 'password') { + if (trim($object->GetDBField('VariableValue')) == '') { + $field_options = $object->GetFieldOptions('VariableValue'); unset($field_options['skip_empty']); $object->SetFieldOptions('VariableValue', $field_options); } } } + /** + * Enter description here... + * + * @param kEvent $event + */ function OnUpdate(&$event) { if (!$this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 0)) { parent::OnUpdate($event); } - $module_owner=$this->Application->GetVar('module'); - $section=$this->Application->GetVar('section'); - $event->redirect_params = Array('opener' => 's','conf_section'=>$this->myUrlEncode($section), 'conf_module'=>$this->myUrlEncode($module_owner),'pass'=>'all,conf'); //stay! - if ($this->Application->GetVar('errormsgs')){ + $event->SetRedirectParam('opener', 's'); + + if ($this->Application->GetVar('errormsgs')) { $event->redirect = false; } } function OnCancel(&$event) { parent::OnCancel($event); - $module_owner=$this->Application->GetVar('module'); - $section=$this->Application->GetVar('section'); - - $event->redirect_params = Array('opener' => 's','conf_section'=>$this->myUrlEncode($section), 'conf_module'=>$this->myUrlEncode($module_owner),'pass'=>'all,conf'); //stay! + $event->SetRedirectParam('opener', 's'); } - - function myUrlDecode($str){ - $str=str_replace(';',':', $str); - $str=str_replace('!','-', $str); - return $str; - } - function myUrlEncode($str){ - $str=str_replace('-', '!', $str); - $str=str_replace(':', ';', $str); - return $str; - } - /** * Enter description here... * @@ -161,8 +138,6 @@ $event->redirect = false; } - - }