Kronolith::isUserEmail PHP Method

isUserEmail() public static method

Checks if an email address belongs to a user.
public static isUserEmail ( string $uid, string $email )
$uid string user id to check
$email string email address to check
    public static function isUserEmail($uid, $email)
    {
        static $emails = array();
        if (!isset($emails[$uid])) {
            $ident = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Identity')->create($uid);
            $addrs = $ident->getAll('from_addr');
            $addrs[] = $uid;
            $emails[$uid] = $addrs;
        }
        return in_array($email, $emails[$uid]);
    }

Usage Example

Example #1
0
 /**
  */
 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);
 }
All Usage Examples Of Kronolith::isUserEmail