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


PHP JEVHelper::canCreateEvent方法代码示例

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


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

示例1: doSave

 private function doSave(&$msg)
 {
     if (!JEVHelper::isEventCreator()) {
         JError::raiseError(403, JText::_('ALERTNOTAUTH'));
     }
     // clean out the cache
     $cache =& JFactory::getCache('com_jevents');
     $cache->clean(JEV_COM_COMPONENT);
     // JREQUEST_ALLOWHTML requires at least Joomla 1.5 svn9979 (past 1.5 stable)
     $array = JRequest::get('request', JREQUEST_ALLOWHTML);
     // Should we allow raw content through unfiltered
     $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
     if ($params->get("allowraw", 0)) {
         $array['jevcontent'] = JRequest::getString("jevcontent", "", "POST", JREQUEST_ALLOWRAW);
     }
     if (!JEVHelper::canCreateEvent($array)) {
         JError::raiseError(403, JText::_('ALERTNOTAUTH'));
     }
     $rrule = SaveIcalEvent::generateRRule($array);
     // ensure authorised
     if (isset($array["evid"]) && $array["evid"] > 0) {
         $event = $this->queryModel->getEventById(intval($array["evid"]), 1, "icaldb");
         if (!$event || !JEVHelper::canEditEvent($event)) {
             JError::raiseError(403, JText::_('ALERTNOTAUTH'));
         }
     }
     $clearout = false;
     // remove all exceptions since they are no longer needed
     if (isset($array["evid"]) && $array["evid"] > 0) {
         $clearout = true;
     }
     if ($event = SaveIcalEvent::save($array, $this->queryModel, $rrule)) {
         $row = new jIcalEventDB($event);
         if (JEVHelper::canPublishEvent($row)) {
             $msg = JText::_("Event_Saved", true);
         } else {
             $msg = JText::_("EVENT_SAVED_UNDER_REVIEW", true);
         }
         if ($clearout) {
             $db = JFactory::getDBO();
             $query = "DELETE FROM #__jevents_exception WHERE eventid = " . $array["evid"];
             $db->setQuery($query);
             $db->query();
             // TODO clear out old exception details
         }
     } else {
         $msg = JText::_("Event Not Saved", true);
     }
     return $row;
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:50,代码来源:icalevent.php

示例2: doSave

 private function doSave(&$msg)
 {
     if (!JEVHelper::isEventCreator()) {
         throw new Exception(JText::_('ALERTNOTAUTH'), 403);
         return false;
     }
     // clean out the cache
     $cache = JFactory::getCache('com_jevents');
     $cache->clean(JEV_COM_COMPONENT);
     // JREQUEST_ALLOWHTML requires at least Joomla 1.5 svn9979 (past 1.5 stable)
     $array = JRequest::get('request', JREQUEST_ALLOWHTML);
     // Should we allow raw content through unfiltered
     $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
     if ($params->get("allowraw", 0)) {
         $array['jevcontent'] = JRequest::getString("jevcontent", "", "POST", JREQUEST_ALLOWRAW);
         $array['extra_info'] = JRequest::getString("extra_info", "", "POST", JREQUEST_ALLOWRAW);
     }
     // convert nl2br if there is no HTML
     if (strip_tags($array['jevcontent']) == $array['jevcontent']) {
         $array['jevcontent'] = nl2br($array['jevcontent']);
     }
     if (strip_tags($array['extra_info']) == $array['extra_info']) {
         $array['extra_info'] = nl2br($array['extra_info']);
     }
     // convert event data to objewct so we can test permissions
     $eventobj = new stdClass();
     foreach ($array as $key => $val) {
         $newkey = "_" . $key;
         $eventobj->{$newkey} = $val;
     }
     $eventobj->_icsid = $eventobj->_ics_id;
     if (is_array($eventobj->_catid)) {
         $eventobj->_catid = current($eventobj->_catid);
     }
     if (!JEVHelper::canCreateEvent($eventobj)) {
         throw new Exception(JText::_('ALERTNOTAUTH'), 403);
         return false;
     }
     $rrule = SaveIcalEvent::generateRRule($array);
     // ensure authorised
     if (isset($array["evid"]) && $array["evid"] > 0) {
         $event = $this->queryModel->getEventById(intval($array["evid"]), 1, "icaldb");
         if (!$event || !JEVHelper::canEditEvent($event)) {
             throw new Exception(JText::_('ALERTNOTAUTH'), 403);
             return false;
         }
     }
     $clearout = false;
     // remove all exceptions since they are no longer needed
     if (isset($array["evid"]) && $array["evid"] > 0 && JRequest::getInt("updaterepeats", 1)) {
         $clearout = true;
     }
     if ($event = SaveIcalEvent::save($array, $this->queryModel, $rrule)) {
         $row = new jIcalEventRepeat($event);
         if (JEVHelper::canPublishEvent($row)) {
             $msg = JText::_("Event_Saved", true);
         } else {
             $msg = JText::_("EVENT_SAVED_UNDER_REVIEW", true);
         }
         if ($clearout) {
             $db = JFactory::getDBO();
             $query = "DELETE FROM #__jevents_exception WHERE eventid = " . $array["evid"];
             $db->setQuery($query);
             $db->query();
             // TODO clear out old exception details
         }
     } else {
         $msg = JText::_("Event Not Saved", true);
         $row = null;
     }
     return $row;
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:72,代码来源:icalevent.php


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