Index: branches/5.1.x/core/units/configuration/configuration_event_handler.php =================================================================== diff -u -N -r12657 -r13086 --- branches/5.1.x/core/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 12657) +++ branches/5.1.x/core/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 13086) @@ -1,6 +1,6 @@ Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) { - $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); + if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) { + $event->status = erFAIL; + return ; + } - // 1. save user selected module root category - $new_category_id = getArrayValue($items_info, 'ModuleRootCategory', 'VariableValue'); - if ($new_category_id !== false) { - unset($items_info['ModuleRootCategory']); - } + $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); - $object =& $event->getObject( Array('skip_autoload' => true) ); - /* @var $object kDBItem */ + // 1. save user selected module root category + $new_category_id = getArrayValue($items_info, 'ModuleRootCategory', 'VariableValue'); + if ($new_category_id !== false) { + unset($items_info['ModuleRootCategory']); + } - if ($items_info) { - $has_error = false; - foreach ($items_info as $id => $field_values) { - $object->Clear(); // clear validation errors from previous variable - $object->Load($id); - $object->SetFieldsFromHash($field_values); + $object =& $event->getObject( Array('skip_autoload' => true) ); + /* @var $object kDBItem */ - if (!$object->Update($id)) { - // don't stop when error found ! - $has_error = true; - } - } + if ($items_info) { + $has_error = false; + foreach ($items_info as $id => $field_values) { + $object->Clear(); // clear validation errors from previous variable + $object->Load($id); + $object->SetFieldsFromHash($field_values); - $event->status = $has_error ? erFAIL : erSUCCESS; + if (!$object->Update($id)) { + // don't stop when error found ! + $has_error = true; + } } - if ($event->status == erSUCCESS) { - if ($new_category_id !== false) { - // root category was submitted - $module = $this->Application->GetVar('module'); - $root_category_id = $this->Application->findModule('Name', $module, 'RootCat'); + $event->status = $has_error ? erFAIL : erSUCCESS; + } - if ($root_category_id != $new_category_id) { - // root category differs from one in db - $fields_hash = Array('RootCat' => $new_category_id); - $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Modules', 'Name = '.$this->Conn->qstr($module)); - } + if ($event->status == erSUCCESS) { + if ($new_category_id !== false) { + // root category was submitted + $module = $this->Application->GetVar('module'); + $root_category_id = $this->Application->findModule('Name', $module, 'RootCat'); + + if ($root_category_id != $new_category_id) { + // root category differs from one in db + $fields_hash = Array('RootCat' => $new_category_id); + $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Modules', 'Name = '.$this->Conn->qstr($module)); } + } - // reset cache - $changed = $this->Application->GetVar($event->getPrefixSpecial() . '_changed', Array ()); - $require_refresh = Array ( - 'AdvancedUserManagement', 'Site_Name', 'AdminConsoleInterface' - ); + // reset cache + $changed = $this->Application->GetVar($event->getPrefixSpecial() . '_changed', Array ()); + $require_refresh = Array ( + 'AdvancedUserManagement', 'Site_Name', 'AdminConsoleInterface' + ); - $refresh_sections = array_intersect($require_refresh, $changed); - $require_full_refresh = Array ('Site_Name', 'AdminConsoleInterface'); + $refresh_sections = array_intersect($require_refresh, $changed); + $require_full_refresh = Array ('Site_Name', 'AdminConsoleInterface'); - if (array_intersect($require_full_refresh, $changed)) { - $event->SetRedirectParam('refresh_all', 1); - } elseif ($refresh_sections) { - // reset sections too, because of AdvancedUserManagement - $event->SetRedirectParam('refresh_tree', 1); - } - - $this->Application->UnitConfigReader->ResetParsedData($refresh_sections ? true : false); + if (array_intersect($require_full_refresh, $changed)) { + $event->SetRedirectParam('refresh_all', 1); + } elseif ($refresh_sections) { + // reset sections too, because of AdvancedUserManagement + $event->SetRedirectParam('refresh_tree', 1); } - elseif ($this->Application->GetVar('errors_' . $event->getPrefixSpecial())) { - // because we have list out there, and this is item - $this->Application->removeObject( $event->getPrefixSpecial() ); - } + + $this->Application->UnitConfigReader->ResetParsedData($refresh_sections ? true : false); } + elseif ($this->Application->GetVar('errors_' . $event->getPrefixSpecial())) { + // because we have list out there, and this is item + $this->Application->removeObject( $event->getPrefixSpecial() ); + } // keeps module and section in REQUEST to ensure, that last admin template will work $event->SetRedirectParam('module', $this->Application->GetVar('module'));