当前位置: 首页>>代码示例>>PHP>>正文


PHP FlexicontentHelperPerm::checkAllItemAccess方法代码示例

本文整理汇总了PHP中FlexicontentHelperPerm::checkAllItemAccess方法的典型用法代码示例。如果您正苦于以下问题:PHP FlexicontentHelperPerm::checkAllItemAccess方法的具体用法?PHP FlexicontentHelperPerm::checkAllItemAccess怎么用?PHP FlexicontentHelperPerm::checkAllItemAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FlexicontentHelperPerm的用法示例。


在下文中一共展示了FlexicontentHelperPerm::checkAllItemAccess方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

                     $row_css = 'color:darkred;';
                     $padcount--;
                     for ($icnt = 0; $icnt < $padcount; $icnt++) {
                         $padspacer .= "&nbsp;|_&nbsp;";
                     }
                 }
             }
         }
     } else {
         $row_css = '';
         for ($icnt = 0; $icnt < $padcount; $icnt++) {
             $padspacer .= "&nbsp;|_&nbsp;";
         }
     }
 }
 $rights = FlexicontentHelperPerm::checkAllItemAccess($user->id, 'field', $row->id);
 $canEdit = in_array('editfield', $rights);
 $canPublish = in_array('publishfield', $rights);
 $canDelete = in_array('deletefield', $rights);
 $link = 'index.php?option=com_flexicontent&amp;' . $fields_task . 'edit&amp;cid[]=' . $row->id;
 if ($row->id < 7) {
     // First 6 core field are not unpublishable
     $published = JHTML::image('administrator/components/com_flexicontent/assets/images/tick_f2.png', JText::_('FLEXI_NOT_AVAILABLE'), ' class="fc-man-icon-s" ');
 } else {
     if (!$canPublish && $row->published) {
         // No privilige published
         $published = JHTML::image('administrator/components/com_flexicontent/assets/images/tick_f2.png', JText::_('FLEXI_NOT_AVAILABLE'), ' class="fc-man-icon-s" ');
     } else {
         if (!$canPublish && !$row->published) {
             // No privilige unpublished
             $published = JHTML::image('administrator/components/com_flexicontent/assets/images/publish_x_f2.png', JText::_('FLEXI_NOT_AVAILABLE'), ' class="fc-man-icon-s" ');
开发者ID:noxidsoft,项目名称:flexicontent-cck,代码行数:31,代码来源:default.php

示例2: remove

 /**
  * Logic to delete items
  *
  * @access public
  * @return void
  * @since 1.0
  */
 function remove()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $cid = JRequest::getVar('cid', array(0), 'post', 'array');
     $model = $this->getModel('items');
     $itemmodel = $this->getModel('item');
     $msg = '';
     if (!is_array($cid) || count($cid) < 1) {
         JError::raiseNotice(500, JText::_('FLEXI_SELECT_ITEM_DELETE'));
     } else {
         // Remove unauthorized (undeletable) items
         $auth_cid = array();
         $non_auth_cid = array();
         // Get owner and other item data
         $q = "SELECT id, created_by, catid FROM #__content WHERE id IN (" . implode(',', $cid) . ")";
         $db->setQuery($q);
         $itemdata = $db->loadObjectList('id');
         // Check authorization for delete operation
         foreach ($cid as $id) {
             $rights = FlexicontentHelperPerm::checkAllItemAccess($user->id, 'item', $itemdata[$id]->id);
             $canDelete = in_array('delete', $rights);
             $canDeleteOwn = in_array('delete.own', $rights) && $itemdata[$id]->created_by == $user->id;
             if ($canDelete || $canDeleteOwn) {
                 $auth_cid[] = $id;
             } else {
                 $non_auth_cid[] = $id;
             }
         }
     }
     //echo "<pre>"; echo "authorized:\n"; print_r($auth_cid); echo "\n\nNOT authorized:\n"; print_r($non_auth_cid); echo "</pre>"; exit;
     // Set warning for undeletable items
     if (count($non_auth_cid)) {
         if (count($non_auth_cid) < 2) {
             $msg_noauth = JText::_('FLEXI_CANNOT_DELETE_ITEM');
         } else {
             $msg_noauth = JText::_('FLEXI_CANNOT_DELETE_ITEMS');
         }
         $msg_noauth .= ": " . implode(',', $non_auth_cid) . " - " . JText::_('FLEXI_REASON_NO_DELETE_PERMISSION') . " - " . JText::_('FLEXI_IDS_SKIPPED');
         JError::raiseNotice(500, $msg_noauth);
     }
     // Try to delete
     if (count($auth_cid) && !$model->delete($auth_cid, $itemmodel)) {
         JError::raiseWarning(500, JText::_('FLEXI_OPERATION_FAILED'));
     } else {
         $msg = count($auth_cid) . ' ' . JText::_('FLEXI_ITEMS_DELETED');
         $cache = FLEXIUtilities::getCache($group = '', 0);
         $cache->clean('com_flexicontent_items');
         $cache->clean('com_flexicontent_filters');
         $cache = FLEXIUtilities::getCache($group = '', 1);
         $cache->clean('com_flexicontent_items');
         $cache->clean('com_flexicontent_filters');
     }
     $this->setRedirect('index.php?option=com_flexicontent&view=items', $msg);
 }
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:64,代码来源:items.php

示例3: candelete

 /**
  * Method to check if we can remove an item
  * return false if the user doesn't have rights to do it
  *
  * @access	public
  * @return	boolean	True on success
  * @since	1.5
  */
 function candelete($cid = array())
 {
     $user = JFactory::getUser();
     if (FLEXI_J16GE) {
         // Not needed we will check individual item's permissions
         //$permission = FlexicontentHelperPerm::getPerm();
     } else {
         if ($user->gid > 24) {
             // Return true for super administrators
             return true;
         } else {
             if (!FLEXI_ACCESS) {
                 // Return true if flexi_access component is not used,
                 // since all backend user groups can delete content (manager, administrator, super administrator)
                 return true;
             }
         }
     }
     $n = count($cid);
     if ($n) {
         $query = 'SELECT id, catid, created_by FROM #__content' . ' WHERE id IN ( ' . implode(',', $cid) . ' )';
         $this->_db->setQuery($query);
         $items = $this->_db->loadObjectList();
         // This is not needed since functionality is already included in checkAllItemAccess() ???
         //if (FLEXI_ACCESS) {
         //$canDeleteAll			= FAccess::checkAllContentAccess('com_content','delete','users',$user->gmid,'content','all');
         //$canDeleteOwnAll	= FAccess::checkAllContentAccess('com_content','deleteown','users',$user->gmid,'content','all');
         //}
         foreach ($items as $item) {
             $rights = FlexicontentHelperPerm::checkAllItemAccess($user->id, 'item', $item->id);
             $canDelete = in_array('delete', $rights);
             $canDeleteOwn = in_array('delete.own', $rights) && $item->created_by == $user->id;
             if (!$canDelete && !$canDeleteOwn) {
                 return false;
             }
         }
         return true;
     }
 }
开发者ID:nettdotkomm,项目名称:flexicontent-cck,代码行数:47,代码来源:items.php

示例4: display

 function display($tpl = null)
 {
     global $globalcats;
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     if (FLEXI_J16GE) {
         JFactory::getLanguage()->load('com_categories', JPATH_ADMINISTRATOR, 'en-GB', true);
         JFactory::getLanguage()->load('com_categories', JPATH_ADMINISTRATOR, null, true);
     }
     // ***********************************************************
     // Get category data, and check if item is already checked out
     // ***********************************************************
     // Get data from the model
     $model = $this->getModel();
     if (FLEXI_J16GE) {
         $row = $this->get('Item');
         $form = $this->get('Form');
     } else {
         $row = $this->get('Category');
     }
     $catparams = FLEXI_J16GE ? new JRegistry($row->params) : new JParameter($row->params);
     $cid = $row->id;
     $isnew = !$cid;
     // Check category is checked out by different editor / administrator
     if (!$isnew && $model->isCheckedOut($user->get('id'))) {
         JError::raiseWarning('SOME_ERROR_CODE', $row->title . ' ' . JText::_('FLEXI_EDITED_BY_ANOTHER_ADMIN'));
         $app->redirect('index.php?option=com_flexicontent&view=categories');
     }
     // ***************************************************************************
     // Currently access checking for category add/edit form , it is done here, for
     // most other views we force going though the controller and checking it there
     // ***************************************************************************
     // *********************************************************************************************
     // Global Permssions checking (needed because this view can be called without a controller task)
     // *********************************************************************************************
     // Get global permissions
     $perms = FlexicontentHelperPerm::getPerm();
     // handles super admins correctly
     // Check no access to categories management (Global permission)
     if (!$perms->CanCats) {
         $app->redirect('index.php?option=com_flexicontent', JText::_('FLEXI_NO_ACCESS'));
     }
     // Check no privilege to create new categories (Global permission)
     if ($isnew && !$perms->CanAddCats) {
         JError::raiseWarning(403, JText::_('FLEXI_NO_ACCESS_CREATE'));
         $app->redirect('index.php?option=com_flexicontent');
     }
     // ************************************************************************************
     // Record Permssions (needed because this view can be called without a controller task)
     // ************************************************************************************
     // Get edit privilege for current category
     if (!$isnew) {
         if (FLEXI_J16GE) {
             $isOwner = $row->get('created_by') == $user->id;
             $rights = FlexicontentHelperPerm::checkAllItemAccess($user->id, 'category', $cid);
             $canedit_cat = in_array('edit', $rights) || in_array('edit.own', $rights) && $isOwner;
         } else {
             if (FLEXI_ACCESS) {
                 $rights = FAccess::checkAllItemAccess('com_content', 'users', $user->gmid, 0, $row->id);
                 $canedit_cat = $user->gid < 25 ? in_array('edit', $rights) || in_array('editown', $rights) : 1;
             } else {
                 $canedit_cat = true;
             }
         }
     }
     // Get if we can create inside at least one (com_content) category
     if (!FLEXI_J16GE || $user->authorise('core.create', 'com_flexicontent')) {
         $cancreate_cat = true;
     } else {
         $usercats = FlexicontentHelperPerm::getAllowedCats($user, $actions_allowed = array('core.create'), $require_all = true, $check_published = true, $specific_catids = false, $find_first = true);
         $cancreate_cat = count($usercats) > 0;
     }
     // Creating new category: Check if user can create inside any existing category
     if ($isnew && !$cancreate_cat) {
         $acc_msg = JText::_('FLEXI_NO_ACCESS_CREATE') . "<br/>" . (FLEXI_J16GE ? JText::_('FLEXI_CANNOT_ADD_CATEGORY_REASON') : "");
         JError::raiseWarning(403, $acc_msg);
         $app->redirect('index.php?option=com_flexicontent&view=categories');
     }
     // Editing existing category: Check if user can edit existing (current) category
     if (!$isnew && !$canedit_cat) {
         $acc_msg = JText::_('FLEXI_NO_ACCESS_EDIT') . "<br/>" . JText::_('FLEXI_CANNOT_EDIT_CATEGORY_REASON');
         JError::raiseWarning(403, $acc_msg);
         $app->redirect('index.php?option=com_flexicontent&view=categories');
     }
     // **************************************************
     // Include needed files and add needed js / css files
     // **************************************************
     FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools');
     flexicontent_html::loadFramework('jQuery');
     flexicontent_html::loadFramework('select2');
     // Load pane behavior
     jimport('joomla.html.pane');
     // Load tooltips
     JHTML::_('behavior.tooltip');
     // Add css to document
     $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css');
     if (FLEXI_J30GE) {
         $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css');
     } else {
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:view.html.php

示例5: display

 function display($tpl = null)
 {
     global $globalcats;
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     JFactory::getLanguage()->load('com_categories', JPATH_ADMINISTRATOR, 'en-GB', true);
     JFactory::getLanguage()->load('com_categories', JPATH_ADMINISTRATOR, null, true);
     // ***********************************************************
     // Get category data, and check if item is already checked out
     // ***********************************************************
     // Get data from the model
     $model = $this->getModel();
     if (FLEXI_J16GE) {
         $row = $this->get('Item');
         $form = $this->get('Form');
     } else {
         $row = $this->get('Category');
     }
     $catparams = new JRegistry($row->params);
     $cid = $row->id;
     $isnew = !$cid;
     // Check category is checked out by different editor / administrator
     if (!$isnew && $model->isCheckedOut($user->get('id'))) {
         JError::raiseWarning('SOME_ERROR_CODE', $row->title . ' ' . JText::_('FLEXI_EDITED_BY_ANOTHER_ADMIN'));
         $app->redirect('index.php?option=com_flexicontent&view=categories');
     }
     // ***************************************************************************
     // Currently access checking for category add/edit form , it is done here, for
     // most other views we force going though the controller and checking it there
     // ***************************************************************************
     // *********************************************************************************************
     // Global Permssions checking (needed because this view can be called without a controller task)
     // *********************************************************************************************
     // Get global permissions
     $perms = FlexicontentHelperPerm::getPerm();
     // handles super admins correctly
     // Check no access to categories management (Global permission)
     if (!$perms->CanCats) {
         $app->redirect('index.php?option=com_flexicontent', JText::_('FLEXI_NO_ACCESS'));
     }
     // Check no privilege to create new categories (Global permission)
     if ($isnew && !$perms->CanAddCats) {
         JError::raiseWarning(403, JText::_('FLEXI_NO_ACCESS_CREATE'));
         $app->redirect('index.php?option=com_flexicontent');
     }
     // ************************************************************************************
     // Record Permssions (needed because this view can be called without a controller task)
     // ************************************************************************************
     // Get edit privilege for current category
     if (!$isnew) {
         if (FLEXI_J16GE) {
             $isOwner = $row->get('created_by') == $user->id;
             $rights = FlexicontentHelperPerm::checkAllItemAccess($user->id, 'category', $cid);
             $canedit_cat = in_array('edit', $rights) || in_array('edit.own', $rights) && $isOwner;
         } else {
             if (FLEXI_ACCESS) {
                 $rights = FAccess::checkAllItemAccess('com_content', 'users', $user->gmid, 0, $row->id);
                 $canedit_cat = $user->gid < 25 ? in_array('edit', $rights) || in_array('editown', $rights) : 1;
             } else {
                 $canedit_cat = true;
             }
         }
     }
     // Get if we can create inside at least one (com_content) category
     if ($user->authorise('core.create', 'com_flexicontent')) {
         $cancreate_cat = true;
     } else {
         $usercats = FlexicontentHelperPerm::getAllowedCats($user, $actions_allowed = array('core.create'), $require_all = true, $check_published = true, $specific_catids = false, $find_first = true);
         $cancreate_cat = count($usercats) > 0;
     }
     // Creating new category: Check if user can create inside any existing category
     if ($isnew && !$cancreate_cat) {
         $acc_msg = JText::_('FLEXI_NO_ACCESS_CREATE') . "<br/>" . (FLEXI_J16GE ? JText::_('FLEXI_CANNOT_ADD_CATEGORY_REASON') : "");
         JError::raiseWarning(403, $acc_msg);
         $app->redirect('index.php?option=com_flexicontent&view=categories');
     }
     // Editing existing category: Check if user can edit existing (current) category
     if (!$isnew && !$canedit_cat) {
         $acc_msg = JText::_('FLEXI_NO_ACCESS_EDIT') . "<br/>" . JText::_('FLEXI_CANNOT_EDIT_CATEGORY_REASON');
         JError::raiseWarning(403, $acc_msg);
         $app->redirect('index.php?option=com_flexicontent&view=categories');
     }
     // **************************************************
     // Include needed files and add needed js / css files
     // **************************************************
     // Add css to document
     $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VERSION);
     $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VERSION);
     // Add JS frameworks
     flexicontent_html::loadFramework('select2');
     // Add js function to overload the joomla submitform validation
     JHTML::_('behavior.formvalidation');
     // load default validation JS to make sure it is overriden
     $document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/admin.js', FLEXI_VERSION);
     $document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/validate.js', FLEXI_VERSION);
     //Load pane behavior
     jimport('joomla.html.pane');
     // ********************
     // Initialise variables
//.........这里部分代码省略.........
开发者ID:nettdotkomm,项目名称:flexicontent-cck,代码行数:101,代码来源:view.html.php


注:本文中的FlexicontentHelperPerm::checkAllItemAccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。