Index: branches/5.2.x/units/topics/topics_event_handler.php =================================================================== diff -u -r14985 -r15060 --- branches/5.2.x/units/topics/topics_event_handler.php (.../topics_event_handler.php) (revision 14985) +++ branches/5.2.x/units/topics/topics_event_handler.php (.../topics_event_handler.php) (revision 15060) @@ -1,6 +1,6 @@ getObject(); + /* @var $object kDBItem */ $new_type = $object->GetDBField('TopicType') ? 0 : 1; $object->SetDBField('TopicType', $new_type); @@ -68,7 +69,7 @@ * @return void * @access protected */ - protected function OnBeforeItemUpdate(&$event) + protected function OnBeforeItemUpdate(kEvent &$event) { parent::OnBeforeItemUpdate($event); @@ -82,7 +83,7 @@ * @return void * @access protected */ - protected function OnBeforeItemCreate(&$event) + protected function OnBeforeItemCreate(kEvent &$event) { parent::OnBeforeItemCreate($event); @@ -108,7 +109,7 @@ * @return void * @access protected */ - protected function OnAfterItemCreate(&$event) + protected function OnAfterItemCreate(kEvent &$event) { parent::OnAfterItemCreate($event); @@ -140,23 +141,27 @@ * Approves 1st post when topic got approved * * @param kEvent $event + * @return void + * @access protected */ - function OnAfterItemUpdate(&$event) + protected function OnAfterItemUpdate(kEvent &$event) { - if (!$this->Application->isAdminUser) { - return ; + parent::OnAfterItemUpdate($event); + + if ( !$this->Application->isAdminUser ) { + return; } $object =& $event->getObject(); /* @var $object kCatDBItem */ - if ($object->GetDBField('Posts') == 1) { - $post =& $this->Application->recallObject($event->Prefix.'-post', null, Array('skip_autoload' => true)); + if ( $object->GetDBField('Posts') == 1 ) { + $post =& $this->Application->recallObject($event->Prefix . '-post', null, Array ('skip_autoload' => true)); /* @var $post kDBItem */ $main_status = $object->GetDBField('Status'); $post->Load($object->GetDBField('LastPostId')); - if ($post->isLoaded()) { + if ( $post->isLoaded() ) { $post->SetDBField('Pending', $main_status == STATUS_ACTIVE ? 0 : 1); $post->Update(); } @@ -170,7 +175,7 @@ * @return void * @access protected */ - protected function OnAfterItemLoad(&$event) + protected function OnAfterItemLoad(kEvent &$event) { parent::OnAfterItemLoad($event); @@ -223,12 +228,14 @@ * [HOOK] Allows to add cloned subitem to given prefix * * @param kEvent $event + * @return void + * @access protected */ - function OnCloneSubItem(&$event) + protected function OnCloneSubItem(kEvent &$event) { parent::OnCloneSubItem($event); - if ($event->MasterEvent->Prefix == 'rev') { + if ( $event->MasterEvent->Prefix == 'rev' ) { $clones = $this->Application->getUnitOption($event->MasterEvent->Prefix, 'Clones'); $subitem_prefix = $event->Prefix . '-' . $event->MasterEvent->Prefix;