authorise('core.manage', $option)) { JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); $mainframe->redirect('index.php'); } // Determine action for rest checks $action = false; if ($mainframe->isAdmin() && $view != '' && $view != 'info') { switch($task) { case '' : case 'save' : case 'apply' : if (!$id) { $action = 'core.create'; } else { $action = 'core.edit'; } break; case 'trash' : case 'remove' : $action = 'core.delete'; break; case 'publish' : case 'unpublish' : $action = 'core.edit.state'; } // Edit or Edit own action if ($action == 'core.edit' && $view == 'item' && $id) { JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables'); $item = JTable::getInstance('K2Item', 'Table'); $item->load($id); if ($item->created_by == $user->id) { $action = 'core.edit.own'; } } // Check the determined action if ($action) { if (!$user->authorise($action, $option)) { JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); $mainframe->redirect('index.php?option=com_k2'); } } } } }