Index: branches/5.2.x/units/private_messages/private_message_eh.php =================================================================== diff -u -N -r14848 -r14985 --- branches/5.2.x/units/private_messages/private_message_eh.php (.../private_message_eh.php) (revision 14848) +++ branches/5.2.x/units/private_messages/private_message_eh.php (.../private_message_eh.php) (revision 14985) @@ -1,6 +1,6 @@ Array('self' => true), - 'OnCreate' => Array('self' => true), - 'OnDelete' => Array('self' => true), + + $permissions = Array ( + 'OnItemBuild' => Array ('self' => true), + 'OnCreate' => Array ('self' => true), + 'OnDelete' => Array ('self' => true), ); $this->permMapping = array_merge($this->permMapping, $permissions); @@ -36,10 +44,13 @@ * @access protected * @see kDBEventHandler::OnListBuild() */ - protected function SetCustomQuery(&$event) + protected function SetCustomQuery(kEvent &$event) { + parent::SetCustomQuery($event); + $folder_id = $this->Application->GetVar('folder_id'); - if ($folder_id === false) { + + if ( $folder_id === false ) { $folder_id = PM_FOLDER_INBOX; $this->Application->SetVar('folder_id', $folder_id); } @@ -48,13 +59,15 @@ /* @var $object kDBList */ $user_id = $this->Application->RecallVar('user_id'); - if ($folder_id == PM_FOLDER_INBOX) { - $object->addFilter('owner_filter', '%1$s.ToId = '.$user_id); + + if ( $folder_id == PM_FOLDER_INBOX ) { + $object->addFilter('owner_filter', '%1$s.ToId = ' . $user_id); } else { - $object->addFilter('owner_filter', '%1$s.FromId = '.$user_id); + $object->addFilter('owner_filter', '%1$s.FromId = ' . $user_id); } - $object->addFilter('folder_filter', '%1$s.FolderId = '.$folder_id); + + $object->addFilter('folder_filter', '%1$s.FolderId = ' . $folder_id); } /** @@ -224,11 +237,14 @@ * * @param kEvent $event * @return bool + * @access protected */ - function checkItemStatus(&$event) + protected function checkItemStatus(kEvent &$event) { $object =& $event->getObject(); - if (!$object->isLoaded()) { + /* @var $object kDBItem */ + + if ( !$object->isLoaded() ) { return true; } Index: branches/5.2.x/units/topics/topics_event_handler.php =================================================================== diff -u -N -r14848 -r14985 --- branches/5.2.x/units/topics/topics_event_handler.php (.../topics_event_handler.php) (revision 14848) +++ branches/5.2.x/units/topics/topics_event_handler.php (.../topics_event_handler.php) (revision 14985) @@ -1,6 +1,6 @@ Name == 'OnTopicLockToggle') { + if ( $event->Name == 'OnTopicLockToggle' ) { $object =& $event->getObject(); /* @var $object kCatDBItem */ - if (!$object->isLoaded()) { + if ( !$object->isLoaded() ) { $event->status = kEvent::erPERM_FAIL; return false; } $category_id = $object->GetDBField('CategoryId'); $perm_status = $this->Application->CheckPermission('TOPIC.LOCK', 0, $category_id); - if (!$perm_status) { + if ( !$perm_status ) { $event->status = kEvent::erPERM_FAIL; } Index: branches/5.2.x/units/posts/post_eh.php =================================================================== diff -u -N -r14956 -r14985 --- branches/5.2.x/units/posts/post_eh.php (.../post_eh.php) (revision 14956) +++ branches/5.2.x/units/posts/post_eh.php (.../post_eh.php) (revision 14985) @@ -1,6 +1,6 @@ Name, $events)) { + $events = Array ('OnUpdate', 'OnDelete'); + + if ( in_array($event->Name, $events) ) { return true; } Index: branches/5.2.x/units/poll_comments/poll_comment_eh.php =================================================================== diff -u -N -r14848 -r14985 --- branches/5.2.x/units/poll_comments/poll_comment_eh.php (.../poll_comment_eh.php) (revision 14848) +++ branches/5.2.x/units/poll_comments/poll_comment_eh.php (.../poll_comment_eh.php) (revision 14985) @@ -1,6 +1,6 @@ Array('self' => true, 'subitem' => true,), - 'OnItemBuild' => Array('self' => true, 'subitem' => true,), - ); + + $permissions = Array ( + 'OnCreate' => Array ('self' => true, 'subitem' => true,), + 'OnItemBuild' => Array ('self' => true, 'subitem' => true,), + ); + $this->permMapping = array_merge($this->permMapping, $permissions); } @@ -58,16 +63,18 @@ * @access protected * @see kDBEventHandler::OnListBuild() */ - protected function SetCustomQuery(&$event) + protected function SetCustomQuery(kEvent &$event) { - if ($this->Application->isAdminUser) { - return ; + parent::SetCustomQuery($event); + + if ( $this->Application->isAdminUser ) { + return; } $object =& $event->getObject(); /* @var $object kDBList */ - $object->addFilter('comment_status', '(%1$s.Status = ' .STATUS_ACTIVE. ')'); + $object->addFilter('comment_status', '%1$s.Status = ' . STATUS_ACTIVE); } /** Index: branches/5.2.x/units/polls/poll_eh.php =================================================================== diff -u -N -r14676 -r14985 --- branches/5.2.x/units/polls/poll_eh.php (.../poll_eh.php) (revision 14676) +++ branches/5.2.x/units/polls/poll_eh.php (.../poll_eh.php) (revision 14985) @@ -1,6 +1,6 @@ Array('self' => 'edit'), - 'OnMakeVote' => Array('self' => true), - 'OnItemBuild' => Array('self' => true), - ); + + $permissions = Array ( + 'OnResetVotes' => Array ('self' => 'edit'), + 'OnMakeVote' => Array ('self' => true), + 'OnItemBuild' => Array ('self' => true), + ); + $this->permMapping = array_merge($this->permMapping, $permissions); } @@ -39,17 +44,19 @@ * @access protected * @see kDBEventHandler::OnListBuild() */ - protected function SetCustomQuery(&$event) + protected function SetCustomQuery(kEvent &$event) { - if ($this->Application->isAdminUser) { - return ; + parent::SetCustomQuery($event); + + if ( $this->Application->isAdminUser ) { + return; } $object =& $event->getObject(); /* @var $object kDBList */ - $object->addFilter('poll_range_filter', '(%1$s.StartDate <= ' .adodb_mktime(). ') AND (%1$s.EndDate >= ' .adodb_mktime(). ' OR EndDate IS NULL)'); - $object->addFilter('poll_status', '(%1$s.Status = ' .STATUS_ACTIVE. ')'); + $object->addFilter('poll_range_filter', '(%1$s.StartDate <= ' . adodb_mktime() . ') AND (%1$s.EndDate >= ' . adodb_mktime() . ' OR EndDate IS NULL)'); + $object->addFilter('poll_status', '(%1$s.Status = ' . STATUS_ACTIVE . ')'); } /**