本文整理汇总了PHP中K2HelperPermissions::canAddTag方法的典型用法代码示例。如果您正苦于以下问题:PHP K2HelperPermissions::canAddTag方法的具体用法?PHP K2HelperPermissions::canAddTag怎么用?PHP K2HelperPermissions::canAddTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类K2HelperPermissions
的用法示例。
在下文中一共展示了K2HelperPermissions::canAddTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkPermissions
public static function checkPermissions()
{
$view = JRequest::getCmd('view');
if ($view != 'item') {
return;
}
$task = JRequest::getCmd('task');
$user = JFactory::getUser();
if ($user->guest && ($task == 'add' || $task == 'edit')) {
$mainframe = JFactory::getApplication();
$uri = JURI::getInstance();
$return = base64_encode($uri->toString());
$mainframe->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice');
if (K2_JVERSION == '15') {
$mainframe->redirect('index.php?option=com_user&view=login&return=' . $return . '&tmpl=component');
} else {
$mainframe->redirect('index.php?option=com_users&view=login&return=' . $return . '&tmpl=component');
}
}
switch ($task) {
case 'add':
if (!K2HelperPermissions::canAddItem()) {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
break;
case 'edit':
case 'deleteAttachment':
case 'checkin':
$cid = JRequest::getInt('cid');
if (!$cid) {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables');
$item = JTable::getInstance('K2Item', 'Table');
$item->load($cid);
if (!K2HelperPermissions::canEditItem($item->created_by, $item->catid)) {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
break;
case 'save':
$cid = JRequest::getInt('id');
if ($cid) {
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables');
$item = JTable::getInstance('K2Item', 'Table');
$item->load($cid);
if (!K2HelperPermissions::canEditItem($item->created_by, $item->catid)) {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
} else {
if (!K2HelperPermissions::canAddItem()) {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
}
break;
case 'tag':
if (!K2HelperPermissions::canAddTag()) {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
break;
case 'extraFields':
if (!K2HelperPermissions::canRenderExtraFields()) {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
break;
}
}
示例2: checkPermissions
function checkPermissions()
{
$view = JRequest::getCmd('view');
if ($view != 'item') {
return;
}
$task = JRequest::getCmd('task');
switch ($task) {
case 'add':
if (!K2HelperPermissions::canAddItem()) {
JError::raiseError(403, JText::_("ALERTNOTAUTH"));
}
break;
case 'edit':
case 'deleteAttachment':
case 'checkin':
$cid = JRequest::getInt('cid');
if (!$cid) {
JError::raiseError(403, JText::_("ALERTNOTAUTH"));
}
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables');
$item =& JTable::getInstance('K2Item', 'Table');
$item->load($cid);
if (!K2HelperPermissions::canEditItem($item->created_by, $item->catid)) {
JError::raiseError(403, JText::_("ALERTNOTAUTH"));
}
break;
case 'save':
$cid = JRequest::getInt('id');
if ($cid) {
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables');
$item =& JTable::getInstance('K2Item', 'Table');
$item->load($cid);
if (!K2HelperPermissions::canEditItem($item->created_by, $item->catid)) {
JError::raiseError(403, JText::_("ALERTNOTAUTH"));
}
} else {
if (!K2HelperPermissions::canAddItem()) {
JError::raiseError(403, JText::_("ALERTNOTAUTH"));
}
}
break;
case 'tag':
if (!K2HelperPermissions::canAddTag()) {
JError::raiseError(403, JText::_("ALERTNOTAUTH"));
}
break;
case 'extraFields':
if (!K2HelperPermissions::canRenderExtraFields()) {
JError::raiseError(403, JText::_("ALERTNOTAUTH"));
}
break;
}
}