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


PHP Kronolith::isUserEmail方法代码示例

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


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

示例1: davDeleteObject

 /**
  */
 public function davDeleteObject($collection, $object)
 {
     $dav = $GLOBALS['injector']->getInstance('Horde_Dav_Storage');
     $internal = $dav->getInternalCollectionId($collection, 'calendar') ?: $collection;
     if (!Kronolith::hasPermission($internal, Horde_Perms::DELETE)) {
         throw new Kronolith_Exception(_("Calendar does not exist or no permission to delete"));
     }
     try {
         $object = $dav->getInternalObjectId($object, $internal) ?: preg_replace('/\\.ics$/', '', $object);
     } catch (Horde_Dav_Exception $e) {
     }
     $kronolith_driver = Kronolith::getDriver(null, $internal);
     $event = $kronolith_driver->getEvent($object);
     $kronolith_driver->deleteEvent($object);
     try {
         $dav->deleteExternalObjectId($object, $internal);
     } catch (Horde_Dav_Exception $e) {
     }
     // Send iTip messages unless organizer is external.
     // Notifications will get lost, there is no way to return messages to
     // clients.
     if ($event->organizer && !Kronolith::isUserEmail($event->creator, $event->organizer)) {
         return;
     }
     Kronolith::sendITipNotifications($event, new Horde_Notification_Handler(new Horde_Notification_Storage_Object()), Kronolith::ITIP_CANCEL);
 }
开发者ID:horde,项目名称:horde,代码行数:28,代码来源:Application.php

示例2: fromDriver

 /**
  * Imports a backend specific event object.
  *
  * @param array $event  Backend specific event object that this object
  *                      will represent.
  */
 public function fromDriver($event)
 {
     $this->uid = $event['uid'];
     $this->id = Horde_Url::uriB64Encode($event['uid']);
     if (isset($event['summary'])) {
         $this->title = $event['summary'];
     }
     if (isset($event['body'])) {
         $this->description = $event['body'];
     }
     if (isset($event['location'])) {
         $this->location = $event['location'];
     }
     if (isset($event['sensitivity']) && ($event['sensitivity'] == 'private' || $event['sensitivity'] == 'confidential')) {
         $this->private = true;
     }
     if (isset($event['organizer']['smtp-address'])) {
         if (Kronolith::isUserEmail($GLOBALS['registry']->getAuth(), $event['organizer']['smtp-address'])) {
             $this->creator = $GLOBALS['registry']->getAuth();
         } else {
             $this->creator = $event['organizer']['smtp-address'];
         }
     }
     if (isset($event['alarm'])) {
         $this->alarm = $event['alarm'];
     }
     if (isset($event['horde-alarm-methods'])) {
         $this->methods = @unserialize($event['horde-alarm-methods']);
     }
     $tz_local = date_default_timezone_get();
     $this->start = new Horde_Date($event['start-date']);
     $this->start->setTimezone($tz_local);
     $this->end = new Horde_Date($event['end-date']);
     $this->end->setTimezone($tz_local);
     $this->durMin = ($this->end->timestamp() - $this->start->timestamp()) / 60;
     if (!empty($event['creation-date'])) {
         $this->created = new Horde_Date($event['creation-date']);
     }
     if (!empty($event['last-modification-date'])) {
         $this->modified = new Horde_Date($event['last-modification-date']);
     }
     if (isset($event['show-time-as'])) {
         switch ($event['show-time-as']) {
             case 'free':
                 $this->status = Kronolith::STATUS_FREE;
                 break;
             case 'tentative':
                 $this->status = Kronolith::STATUS_TENTATIVE;
                 break;
             case 'busy':
             case 'outofoffice':
             default:
                 $this->status = Kronolith::STATUS_CONFIRMED;
         }
     } else {
         $this->status = Kronolith::STATUS_CONFIRMED;
     }
     // Recurrence
     if (isset($event['recurrence'])) {
         if (isset($event['recurrence']['exclusion'])) {
             $exceptions = array();
             foreach ($event['recurrence']['exclusion'] as $exclusion) {
                 if (!empty($exclusion)) {
                     $exceptions[] = $exclusion->format('Ymd');
                 }
             }
             $event['recurrence']['exceptions'] = $exceptions;
         }
         if (isset($event['recurrence']['complete'])) {
             $completions = array();
             foreach ($event['recurrence']['complete'] as $complete) {
                 if (!empty($complete)) {
                     $completions[] = $complete->format('Ymd');
                 }
             }
             $event['recurrence']['completions'] = $completions;
         }
         $this->recurrence = new Horde_Date_Recurrence($this->start);
         $this->recurrence->fromKolab($event['recurrence']);
     }
     // Attendees
     $attendee_count = 0;
     if (!empty($event['attendee'])) {
         foreach ($event['attendee'] as $attendee) {
             $name = $attendee['display-name'];
             $email = $attendee['smtp-address'];
             $role = $attendee['role'];
             switch ($role) {
                 case 'optional':
                     $role = Kronolith::PART_OPTIONAL;
                     break;
                 case 'resource':
                     $role = Kronolith::PART_NONE;
                     break;
//.........这里部分代码省略.........
开发者ID:horde,项目名称:horde,代码行数:101,代码来源:Kolab.php

示例3: sendITipNotifications

 /**
  * Sends out iTip event notifications to all attendees of a specific
  * event.
  *
  * Can be used to send event invitations, event updates as well as event
  * cancellations.
  *
  * @param Kronolith_Event $event
  *        The event in question.
  * @param Horde_Notification_Handler $notification
  *        A notification object used to show result status.
  * @param integer $action
  *        The type of notification to send. One of the Kronolith::ITIP_*
  *        values.
  * @param Horde_Date $instance
  *        If cancelling a single instance of a recurring event, the date of
  *        this instance.
  * @param  string $range  The range parameter if this is a recurring event.
  *                        Possible values are self::RANGE_THISANDFUTURE
  * @param Kronolith_Attendee_List $cancellations  If $action is 'CANCEL',
  *                                                but it is due to removing
  *                                                attendees and not
  *                                                canceling the entire
  *                                                event, these are the
  *                                                uninvited attendees and
  *                                                are the ONLY people that
  *                                                will receive the CANCEL
  *                                                iTIP.  @since 4.2.10
  */
 public static function sendITipNotifications(Kronolith_Event $event, Horde_Notification_Handler $notification, $action, Horde_Date $instance = null, $range = null, Kronolith_Attendee_List $cancellations = null)
 {
     global $injector, $prefs, $registry;
     if (!count($event->attendees) || $prefs->getValue('itip_silent')) {
         return;
     }
     $ident = $injector->getInstance('Horde_Core_Factory_Identity')->create($event->creator);
     if (!$ident->getValue('from_addr')) {
         $notification->push(sprintf(_("You do not have an email address configured in your Personal Information Preferences. You must set one %shere%s before event notifications can be sent."), $registry->getServiceLink('prefs', 'kronolith')->add(array('app' => 'horde', 'group' => 'identities'))->link(), '</a>'), 'horde.error', array('content.raw'));
         return;
     }
     // Generate image mime part first and only once, because we
     // need the Content-ID.
     $image = self::getImagePart('big_invitation.png');
     $share = $injector->getInstance('Kronolith_Shares')->getShare($event->calendar);
     $view = new Horde_View(array('templatePath' => KRONOLITH_TEMPLATES . '/itip'));
     new Horde_View_Helper_Text($view);
     $view->identity = $ident;
     $view->event = $event;
     $view->imageId = $image->getContentId();
     if ($action == self::ITIP_CANCEL && count($cancellations)) {
         $mail_attendees = $cancellations;
     } elseif ($event->organizer && !self::isUserEmail($event->creator, $event->organizer)) {
         /* Only send updates to organizer if the user is not the
          * organizer */
         if (isset($event->attendees['email:' . $event->organizer])) {
             $organizer = $event->attendees['email:' . $event->organizer];
         } else {
             $organizer = new Kronolith_Attendee(array('email' => $event->organizer));
         }
         $mail_attendees = new Kronolith_Attendee_List(array($organizer));
     } else {
         $mail_attendees = $event->attendees;
     }
     foreach ($mail_attendees as $attendee) {
         /* Don't send notifications to the ORGANIZER if this is the
          * ORGANIZER's copy of the event. */
         if (!$event->organizer && Kronolith::isUserEmail($event->creator, $attendee->email)) {
             continue;
         }
         /* Don't bother sending an invitation/update if the recipient does
          * not need to participate, or has declined participating, or
          * doesn't have an email address. */
         if (strpos($attendee->email, '@') === false || $attendee->response == self::RESPONSE_DECLINED) {
             continue;
         }
         /* Determine all notification-specific strings. */
         switch ($action) {
             case self::ITIP_CANCEL:
                 /* Cancellation. */
                 $method = 'CANCEL';
                 $filename = 'event-cancellation.ics';
                 $view->subject = sprintf(_("Cancelled: %s"), $event->getTitle());
                 if (empty($instance)) {
                     $view->header = sprintf(_("%s has cancelled \"%s\"."), $ident->getName(), $event->getTitle());
                 } else {
                     $view->header = sprintf(_("%s has cancelled an instance of the recurring \"%s\"."), $ident->getName(), $event->getTitle());
                 }
                 break;
             case self::ITIP_REPLY:
                 $filename = 'event-reply.ics';
                 $events = $event->toiCalendar(new Horde_Icalendar());
                 $vEvent = array_shift($events);
                 $itipIdentity = new Horde_Itip_Resource_Identity($ident, $vEvent->getAttribute('ATTENDEE'), (string) $ident->getFromAddress());
                 /* Find which of the creator's mail addresses is used here */
                 foreach ($event->attendees as $attendee) {
                     if (self::isUserEmail($event->creator, $attendee->email)) {
                         switch ($attendee->response) {
                             case self::RESPONSE_ACCEPTED:
                                 $type = new Horde_Itip_Response_Type_Accept($itipIdentity);
                                 break;
//.........这里部分代码省略.........
开发者ID:horde,项目名称:horde,代码行数:101,代码来源:Kronolith.php

示例4: _postSave

 protected function _postSave(Kronolith_Event $event)
 {
     global $registry;
     if (!$this->_dav->getInternalObjectId($this->_params['object'], $this->_calendar)) {
         $this->_dav->addObjectMap($event->id, $this->_params['object'], $this->_calendar);
     }
     // Send iTip messages if necessary.
     $type = Kronolith::ITIP_REQUEST;
     if ($event->organizer && !Kronolith::isUserEmail($event->creator, $event->organizer)) {
         $type = Kronolith::ITIP_REPLY;
     }
     $event_copy = clone $event;
     $event_copy->attendees = $event->attendees->without($this->_noItips);
     $notification = new Horde_Notification_Handler(new Horde_Notification_Storage_Object());
     Kronolith::sendITipNotifications($event_copy, $notification, $type);
     // Send ITIP_CANCEL to any attendee that was removed, but only if this
     // is the ORGANZIER's copy of the event.
     if (empty($event->organizer) || $registry->getAuth() == $event->creator && Kronolith::isUserEmail($event->creator, $event->organizer)) {
         $removed_attendees = new Kronolith_Attendee_List();
         foreach ($this->_oldAttendees as $old_attendee) {
             if (!$event->attendees->has($old_attendee)) {
                 $removed_attendees->add($old_attendee);
             }
         }
         if (count($removed_attendees)) {
             $cancelEvent = clone $event;
             Kronolith::sendITipNotifications($cancelEvent, $notification, Kronolith::ITIP_CANCEL, null, null, $removed_attendees);
         }
     }
 }
开发者ID:horde,项目名称:horde,代码行数:30,代码来源:Dav.php

示例5: readForm


//.........这里部分代码省略.........
     if (!$attendees) {
         $attendees = new Kronolith_Attendee_List();
     }
     $newattendees = Horde_Util::getFormData('attendees');
     $userattendees = Horde_Util::getFormData('users');
     if (!is_null($newattendees) || !is_null($userattendees)) {
         if ($newattendees) {
             $newattendees = Kronolith_Attendee_List::parse(trim($newattendees), $notification);
         } else {
             $newattendees = new Kronolith_Attendee_List();
         }
         if ($userattendees) {
             foreach (explode(',', $userattendees) as $user) {
                 if (!($newUser = Kronolith::validateUserAttendee($user))) {
                     $notification->push(sprintf(_("The user \"%s\" does not exist."), $newUser), 'horde.error');
                 } else {
                     $newattendees->add($newUser);
                 }
             }
         }
         // First add new attendees missing in the current list.
         foreach ($newattendees as $attendee) {
             if (!$attendees->has($attendee)) {
                 $attendees->add($attendee);
             }
         }
         // Now check for attendees in the current list that don't exist in
         // the new attendee list anymore.
         $finalAttendees = new Kronolith_Attendee_List();
         foreach ($attendees as $attendee) {
             if (!$newattendees->has($attendee)) {
                 continue;
             }
             if (Kronolith::isUserEmail($this->creator, $attendee->email)) {
                 $attendee->response = Horde_Util::getFormData('attendance');
             }
             $finalAttendees->add($attendee);
         }
         $attendees = $finalAttendees;
     }
     $this->attendees = $attendees;
     // Event start.
     $allDay = Horde_Util::getFormData('whole_day');
     if ($start_date = Horde_Util::getFormData('start_date')) {
         // From ajax interface.
         $this->start = Kronolith::parseDate($start_date . ' ' . Horde_Util::getFormData('start_time'), true, $this->timezone);
         if ($allDay) {
             $this->start->hour = $this->start->min = $this->start->sec = 0;
         }
     } elseif ($start = Horde_Util::getFormData('start')) {
         // From traditional interface.
         $start_year = $start['year'];
         $start_month = $start['month'];
         $start_day = $start['day'];
         $start_hour = Horde_Util::getFormData('start_hour');
         $start_min = Horde_Util::getFormData('start_min');
         $am_pm = Horde_Util::getFormData('am_pm');
         if (!$prefs->getValue('twentyFour')) {
             if ($am_pm == 'PM') {
                 if ($start_hour != 12) {
                     $start_hour += 12;
                 }
             } elseif ($start_hour == 12) {
                 $start_hour = 0;
             }
         }
开发者ID:horde,项目名称:horde,代码行数:67,代码来源:Event.php


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