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


PHP JEVHelper::rowCatids方法代码示例

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


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

示例1: canDeleteEvent

 /**
  * Test to see if user can delete event
  *
  * @param unknown_type $row
  * @param unknown_type $user
  * @return unknown
  */
 public static function canDeleteEvent($row, $user = null)
 {
     // store in static to save repeated database calls
     static $authdata_coredeleteall = array();
     // TODO make this call a plugin
     if ($user == null) {
         $user = JFactory::getUser();
     }
     // are we authorised to do anything with this category or calendar
     $jevuser = JEVHelper::getAuthorisedUser();
     if ($row->_icsid > 0 && $jevuser && $jevuser->calendars != "" && $jevuser->calendars != "all") {
         $allowedcals = explode("|", $jevuser->calendars);
         if (!in_array($row->_icsid, $allowedcals)) {
             return false;
         }
     }
     if ($row->_catid > 0 && $jevuser && $jevuser->categories != "" && $jevuser->categories != "all") {
         $allowedcats = explode("|", $jevuser->categories);
         if (!in_array($row->_catid, $allowedcats)) {
             return false;
         }
         // check multi cats too
         if (JEVHelper::rowCatids($row)) {
             if (count(array_diff(JEVHelper::rowCatids($row), $allowedcats))) {
                 return false;
             }
         }
     }
     $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
     $authorisedonly = $params->get("authorisedonly", 1);
     if ($authorisedonly) {
         if (!$jevuser) {
             return false;
         }
         if (!is_null($jevuser) && $jevuser->candeleteall) {
             return true;
         } else {
             if (!is_null($jevuser) && $jevuser->candeleteown && $row->created_by() == $user->id) {
                 return true;
             }
         }
         return false;
     }
     // This involes TOO many database queries in Joomla - one per category which can be a LOT
     /*
      $cats = JEVHelper::getAuthorisedCategories($user,'com_jevents', 'core.deleteall');
      if (in_array($row->_catid, $cats))
      return true;
     */
     $key = $row->catids() ? json_encode($row->catids()) : json_encode(intval($row->catid()));
     if (!isset($authdata_coredeleteall[$key])) {
         $authdata_coredeleteall[$key] = JEVHelper::authoriseCategories('core.deleteall', $key, $user);
     }
     if ($authdata_coredeleteall[$key]) {
         return $authdata_coredeleteall[$key];
     }
     // can delete all?
     if (JEVHelper::isEventDeletor(true)) {
         // any category restrictions on this?
         // This involes TOO many database queries in Joomla - one per category which can be a LOT
         /*
          $cats = JEVHelper::getAuthorisedCategories($user,'com_jevents', 'core.deleteall');
          if (in_array($row->_catid, $cats))
          return true;
         */
         $key = $row->catids() ? json_encode($row->catids()) : json_encode(intval($row->catid()));
         if (!isset($authdata_coredeleteall[$key])) {
             $authdata_coredeleteall[$key] = JEVHelper::authoriseCategories('core.deleteall', $key, $user);
         }
         if ($authdata_coredeleteall[$key]) {
             return $authdata_coredeleteall[$key];
         }
     }
     // There seems to be a problem with category permissions - sometimes Joomla ACL set to yes in category but result is false!
     // fall back to being able to delete own events if a publisher
     if ($row->created_by() == $user->id) {
         $jevuser = JEVHelper::getAuthorisedUser();
         if (!is_null($jevuser)) {
             return $jevuser->candeleteown;
         }
         // if a user can publish their own then cal delete their own too
         $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
         $authorisedonly = $params->get("authorisedonly", 1);
         $publishown = $params->get("jevpublishown", 0);
         if (!$authorisedonly && ($publishown || JEVHelper::canPublishEvent($row, $user))) {
             return true;
         }
     }
     return false;
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:97,代码来源:helper.php


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