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


PHP unknown_type::created_by方法代码示例

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


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

示例1: canPublishEvent

 /**
  * Test to see if user can publish event
  *
  * @param unknown_type $row
  * @param unknown_type $user
  * @return unknown
  */
 public static function canPublishEvent($row, $user = null)
 {
     // store in static to save repeated database calls
     static $authdata_editstate = 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();
     $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
     $authorisedonly = $params->get("authorisedonly", 0);
     if ($authorisedonly) {
         if (!$jevuser) {
             // paid subs plugin may override this
             if ($row->created_by() == $user->id && $user->id > 0) {
                 $frontendPublish = JEVHelper::isEventPublisher(false);
                 return $frontendPublish;
             }
             return false;
         }
         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;
                 }
             }
         }
         if ($jevuser->canpublishall) {
             return true;
         }
         if ($row->created_by() == $user->id && $jevuser->canpublishown) {
             return true;
         }
         return false;
     }
     // can publish all?
     if (JEVHelper::isEventPublisher(true)) {
         // This involes TOO many database queries in Joomla - one per category which can be a LOT
         /*
          $cats = JEVHelper::getAuthorisedCategories($user,'com_jevents', 'core.edit.state');
          if (in_array($row->_catid, $cats))
          return true;
         */
         // allow multi-categories
         $key = $row->catids() ? json_encode($row->catids()) : json_encode(intval($row->catid()));
         $authdata_editstate[$key] = JEVHelper::authoriseCategories('core.edit.state', $key, $user);
         return $authdata_editstate[$key];
         return true;
     } else {
         if ($row->created_by() == $user->id) {
             // Use generic helper method that can call the plugin to see if user can publish any events
             $isEventPublisher = JEVHelper::isEventPublisher();
             if ($isEventPublisher) {
                 return true;
             }
             $jevuser = JEVHelper::getAuthorisedUser();
             if (!is_null($jevuser)) {
                 return $jevuser->canpublishown;
             }
             $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
             $authorisedonly = $params->get("authorisedonly", 1);
             $publishown = $params->get("jevpublishown", 0);
             if (!$authorisedonly && $publishown) {
                 return true;
             }
             // This involes TOO many database queries in Joomla - one per category which can be a LOT
             /*
              $cats = JEVHelper::getAuthorisedCategories($user,'com_jevents', 'core.edit.state');
              if (in_array($row->_catid, $cats))
              return true;
             */
             $key = $row->catids() ? json_encode($row->catids()) : json_encode(intval($row->catid()));
             if (!isset($authdata_editstate[$key])) {
                 $authdata_editstate[$key] = JEVHelper::authoriseCategories('core.edit.state', $key, $user);
             }
             return $authdata_editstate[$key];
         }
     }
     if ($user->id > 0 && $row->catid() > 0) {
         $key = $row->catids() ? json_encode($row->catids()) : json_encode(intval($row->catid()));
         if (!isset($authdata_editstate[$key])) {
//.........这里部分代码省略.........
开发者ID:madcsaba,项目名称:li-de,代码行数:101,代码来源:helper.php

示例2: canDeleteEvent

 /**
  * Test to see if user can delete event
  *
  * @param unknown_type $row
  * @param unknown_type $user
  * @return unknown
  */
 function canDeleteEvent($row, $user = null)
 {
     // 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;
         }
     }
     if (JVersion::isCompatible("1.6.0")) {
         $cats = $user->getAuthorisedCategories('com_jevents', 'core.edit.state');
         if (in_array($row->_catid, $cats)) {
             return true;
         }
     }
     // can publish all?
     if (JEVHelper::isEventDeletor(true)) {
         return true;
     } else {
         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) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:53,代码来源:helper.php


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