Index: trunk/core/units/categories/categories_event_handler.php =================================================================== diff -u -r5036 -r5173 --- trunk/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5036) +++ trunk/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5173) @@ -63,11 +63,10 @@ } $object->addFilter('parent_filter', 'ParentId = '.$parent_cat_id); - - $view_perm = 1; - $object->addFilter('perm_filter', 'PermId = '.$view_perm); - if ( !$this->Application->IsAdmin() ) - { + + $object->addFilter('perm_filter', 'PermId = 1'); // check for CATEGORY.VIEW permission + if ($this->Application->GetVar('u_id') > 0) { // !$this->Application->IsAdmin() || + // apply permission filters to all users except "root" $groups = explode(',',$this->Application->RecallVar('UserGroups')); foreach ($groups as $group) { $view_filters[] = 'FIND_IN_SET('.$group.', acl) || ((NOT FIND_IN_SET('.$group.',dacl)) AND acl=\'\')'; @@ -205,7 +204,7 @@ return parent::getPassedID($event); } - + /** * Rebuilds category cache * @@ -233,8 +232,40 @@ '*3600*24), 1, 0), %1$s.NewItem )'); - } + + + + /** + * Set cache modification mark if needed + * + * @param kEvent $event + */ + function OnBeforeDeleteFromLive(&$event) + { + $id = $event->getEventParam('id'); + if ($id == 0) { + // new category -> update chache + $this->Application->SetVar('require_cache_update', 1); + return ; + } + + // existing category was edited, check if in-cache fields are modified + $temp_object =& $event->getObject( Array('skip_autoload' => true) ); + $temp_object->Load($id); + + $live_object =& $this->Application->recallObject($event->Prefix.'.-item', null, Array('live_table' => true)); + $live_object->Load($id); + + $cached_fields = Array('Name', 'Filename', 'CategoryTemplate', 'ItemTemplate'); + + foreach ($cached_fields as $cached_field) { + if ($live_object->GetDBField($cached_field) != $temp_object->GetDBField($cached_field)) { + $this->Application->SetVar('require_cache_update', 1); + break; + } + } + } } ?> \ No newline at end of file