Index: branches/5.2.x/core/kernel/db/cat_event_handler.php =================================================================== diff -u -N -r14955 -r14989 --- branches/5.2.x/core/kernel/db/cat_event_handler.php (.../cat_event_handler.php) (revision 14955) +++ branches/5.2.x/core/kernel/db/cat_event_handler.php (.../cat_event_handler.php) (revision 14989) @@ -1,6 +1,6 @@ Array ('self' => 'add|edit|advanced:import'), 'OnResetSettings' => Array ('self' => 'add|edit|advanced:import'), @@ -47,7 +51,7 @@ * @return void * @access protected */ - function LoadItem(&$event) + protected function LoadItem(kEvent &$event) { $object =& $event->getObject(); /* @var $object kDBItem */ @@ -78,27 +82,27 @@ * @return bool * @access public */ - public function CheckPermission(&$event) + public function CheckPermission(kEvent &$event) { - if (!$this->Application->isAdmin) { - if ($event->Name == 'OnSetSortingDirect') { + if ( !$this->Application->isAdmin ) { + if ( $event->Name == 'OnSetSortingDirect' ) { // allow sorting on front event without view permission return true; } } - if ($event->Name == 'OnExport') { + if ( $event->Name == 'OnExport' ) { // save category_id before doing export $this->Application->LinkVar('m_cat_id'); } - if (in_array($event->Name, $this->_getMassPermissionEvents())) { + if ( in_array($event->Name, $this->_getMassPermissionEvents()) ) { $items = $this->_getPermissionCheckInfo($event); $perm_helper =& $this->Application->recallObject('PermissionsHelper'); /* @var $perm_helper kPermissionsHelper */ - if (($event->Name == 'OnSave') && array_key_exists(0, $items)) { + if ( ($event->Name == 'OnSave') && array_key_exists(0, $items) ) { // adding new item (ID = 0) $perm_value = $perm_helper->AddCheckPermission($items[0]['CategoryId'], $event->Prefix) > 0; } @@ -107,12 +111,12 @@ $ids = Array (); $check_method = in_array($event->Name, Array ('OnMassDelete', 'OnCut')) ? 'DeleteCheckPermission' : 'ModifyCheckPermission'; foreach ($items as $item_id => $item_data) { - if ($perm_helper->$check_method($item_data['CreatedById'], $item_data['CategoryId'], $event->Prefix) > 0) { + if ( $perm_helper->$check_method($item_data['CreatedById'], $item_data['CategoryId'], $event->Prefix) > 0 ) { $ids[] = $item_id; } } - if (!$ids) { + if ( !$ids ) { // no items left for editing -> no permission return $perm_helper->finalizePermissionCheck($event, false); } @@ -125,13 +129,13 @@ } $export_events = Array ('OnSaveSettings', 'OnResetSettings', 'OnExportBegin'); - if (in_array($event->Name, $export_events)) { + if ( in_array($event->Name, $export_events) ) { // when import settings before selecting target import category return $this->Application->CheckPermission('in-portal:main_import.view'); } - if ($event->Name == 'OnProcessSelected') { - if ($this->Application->RecallVar('dst_field') == 'ImportCategory') { + if ( $event->Name == 'OnProcessSelected' ) { + if ( $this->Application->RecallVar('dst_field') == 'ImportCategory' ) { // when selecting target import category return $this->Application->CheckPermission('in-portal:main_import.view'); } @@ -587,7 +591,7 @@ * @access protected * @see kDBEventHandler::OnListBuild() */ - protected function SetCustomQuery(&$event) + protected function SetCustomQuery(kEvent &$event) { parent::SetCustomQuery($event); @@ -743,13 +747,12 @@ * @return void * @access protected */ - protected function prepareObject(&$object, &$event) + protected function prepareObject(&$object, kEvent &$event) { $this->prepareItemStatuses($event); + $object->addCalculatedField('CachedNavbar', 'l' . $this->Application->GetVar('m_lang') . '_CachedNavbar'); - $object->addCalculatedField('CachedNavbar', 'l'.$this->Application->GetVar('m_lang').'_CachedNavbar'); - - if ($event->Special == 'export' || $event->Special == 'import') { + if ( $event->Special == 'export' || $event->Special == 'import' ) { $export_helper =& $this->Application->recallObject('CatItemExportHelper'); /* @var $export_helper kCatDBItemExportHelper */ @@ -2639,8 +2642,9 @@ * * @param kEvent $event * @return bool + * @access protected */ - function checkItemStatus(&$event) + protected function checkItemStatus(kEvent &$event) { $object =& $event->getObject(); /* @var $object kDBItem */