本文整理匯總了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;
}
}