• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Horde_Icalendar类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _create

 /**
  */
 protected function _create($mbox, $subject, $body)
 {
     global $notification, $registry;
     $list = str_replace(self::TASKLIST_EDIT, '', $mbox);
     /* Create a new iCalendar. */
     $vCal = new Horde_Icalendar();
     $vCal->setAttribute('PRODID', '-//The Horde Project//IMP ' . $registry->getVersion() . '//EN');
     $vCal->setAttribute('METHOD', 'PUBLISH');
     /* Create a new vTodo object using this message's contents. */
     $vTodo = Horde_Icalendar::newComponent('vtodo', $vCal);
     $vTodo->setAttribute('SUMMARY', $subject);
     $vTodo->setAttribute('DESCRIPTION', $body);
     $vTodo->setAttribute('PRIORITY', '3');
     /* Get the list of editable tasklists. */
     $lists = $this->getTasklists(true);
     /* Attempt to add the new vTodo item to the requested tasklist. */
     try {
         $res = $registry->call('tasks/import', array($vTodo, 'text/calendar', $list));
     } catch (Horde_Exception $e) {
         $notification->push($e);
         return;
     }
     if (!$res) {
         $notification->push(_("An unknown error occured while creating the new task."), 'horde.error');
     } elseif (!empty($lists)) {
         $name = '"' . htmlspecialchars($subject) . '"';
         /* Attempt to convert the object name into a hyperlink. */
         if ($registry->hasLink('tasks/show')) {
             $name = sprintf('<a href="%s">%s</a>', Horde::url($registry->link('tasks/show', array('uid' => $res))), $name);
         }
         $notification->push(sprintf(_("%s was successfully added to \"%s\"."), $name, htmlspecialchars($lists[$list]->get('name'))), 'horde.success', array('content.raw'));
     }
 }
开发者ID:horde,项目名称:horde,代码行数:35,代码来源:Tasklist.php


示例2: _addOrganizer

 /**
  * Yet another problem: Outlook seems to remove the organizer from
  * the iCal when forwarding -- we put the original sender back in
  * as organizer.
  *
  * @param string        $icaltext  The ical message.
  * @param MIME_Headers  $from      The message sender.
  */
 function _addOrganizer(&$icaltxt, $from)
 {
     global $conf;
     if (isset($conf['kolab']['filter']['email_domain'])) {
         $email_domain = $conf['kolab']['filter']['email_domain'];
     } else {
         $email_domain = 'localhost';
     }
     $iCal = new Horde_Icalendar();
     $iCal->parsevCalendar($icaltxt);
     $vevent =& $iCal->findComponent('VEVENT');
     if ($vevent) {
         $organizer = $vevent->getAttribute('ORGANIZER', true);
         if (is_a($organizer, 'PEAR_Error')) {
             $adrs = imap_rfc822_parse_adrlist($from, $email_domain);
             if (count($adrs) > 0) {
                 $org_email = 'mailto:' . $adrs[0]->mailbox . '@' . $adrs[0]->host;
                 $org_name = $adrs[0]->personal;
                 if ($org_name) {
                     $vevent->setAttribute('ORGANIZER', $org_email, array('CN' => $org_name), false);
                 } else {
                     $vevent->setAttribute('ORGANIZER', $org_email, array(), false);
                 }
                 Horde::log(sprintf("Adding missing organizer '%s <%s>' to iCal.", $org_name, $org_email), 'DEBUG');
                 $icaltxt = $iCal->exportvCalendar();
             }
         }
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:37,代码来源:Outlook.php


示例3: testInvite

 /**
  * Test creating a Horde_ActiveSync_Message_MeetingRequest from a MIME Email
  */
 public function testInvite()
 {
     $this->markTestIncomplete('Has issues on 32bit systems');
     $fixture = file_get_contents(__DIR__ . '/fixtures/invitation_one.eml');
     $mime = Horde_Mime_Part::parseMessage($fixture);
     $msg = new Horde_ActiveSync_Message_MeetingRequest();
     foreach ($mime->contentTypeMap() as $id => $type) {
         if ($type == 'text/calendar') {
             $vcal = new Horde_Icalendar();
             $vcal->parseVcalendar($mime->getPart($id)->getContents());
             $msg->fromvEvent($vcal);
             break;
         }
     }
     $stream = fopen('php://memory', 'wb+');
     $encoder = new Horde_ActiveSync_Wbxml_Encoder($stream);
     $msg->encodeStream($encoder);
     rewind($stream);
     $results = stream_get_contents($stream);
     fclose($stream);
     $stream = fopen(__DIR__ . '/fixtures/meeting_request_one.wbxml', 'r+');
     $expected = '';
     // Using file_get_contents or even fread mangles the binary data for some
     // reason.
     while ($line = fgets($stream)) {
         $expected .= $line;
     }
     fclose($stream);
     $this->assertEquals($expected, $results);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:33,代码来源:InviteTest.php


示例4: _getFixture

 private function _getFixture($element)
 {
     $iCal = new Horde_Icalendar();
     $iCal->parsevCalendar(file_get_contents(__DIR__ . '/../fixtures/allday.ics'));
     $components = $iCal->getComponents();
     return $components[$element];
 }
开发者ID:horde,项目名称:horde,代码行数:7,代码来源:AllDayTest.php


示例5: _handle

 /**
  * Variables required in form input:
  *   - imple_submit: vcard action. Contains import and source properties
  *   - mime_id
  *   - muid
  *
  * @return boolean  True on success.
  */
 protected function _handle(Horde_Variables $vars)
 {
     global $registry, $injector, $notification;
     $iCal = new Horde_Icalendar();
     try {
         $contents = $injector->getInstance('IMP_Factory_Contents')->create(new IMP_Indices_Mailbox($vars));
         if (!($mime_part = $contents->getMimePart($vars->mime_id))) {
             throw new IMP_Exception(_("Cannot retrieve vCard data from message."));
         } elseif (!$iCal->parsevCalendar($mime_part->getContents(), 'VCALENDAR', $mime_part->getCharset())) {
             throw new IMP_Exception(_("Error reading the contact data."));
         }
         $components = $iCal->getComponents();
     } catch (Exception $e) {
         $notification->push($e, 'horde.error');
     }
     $import = !empty($vars->imple_submit->import) ? $vars->imple_submit->import : false;
     $source = !empty($vars->imple_submit->source) ? $vars->imple_submit->source : false;
     if ($import && $source && $registry->hasMethod('contacts/import')) {
         $count = 0;
         foreach ($components as $c) {
             if ($c->getType() == 'vcard') {
                 try {
                     $registry->call('contacts/import', array($c, null, $source));
                     ++$count;
                 } catch (Horde_Exception $e) {
                     $notification->push(Horde_Core_Translation::t("There was an error importing the contact data:") . ' ' . $e->getMessage(), 'horde.error');
                 }
             }
         }
         $notification->push(sprintf(Horde_Core_Translation::ngettext("%d contact was successfully added to your address book.", "%d contacts were successfully added to your address book.", $count), $count), 'horde.success');
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:40,代码来源:VcardImport.php


示例6: _renderInline

 /**
  * Return the rendered inline version of the Horde_Mime_Part object.
  *
  * @return array  See parent::render().
  */
 protected function _renderInline()
 {
     $GLOBALS['page_output']->growler = true;
     $data = $this->_mimepart->getContents();
     $mime_id = $this->_mimepart->getMimeId();
     // Parse the iCal file.
     $vCal = new Horde_Icalendar();
     if (!$vCal->parsevCalendar($data, 'VCALENDAR', $this->_mimepart->getCharset())) {
         $status = new IMP_Mime_Status(_("The calendar data is invalid"));
         $status->action(IMP_Mime_Status::ERROR);
         return array($mime_id => array('data' => '', 'status' => $status, 'type' => 'text/html; charset=UTF-8'));
     }
     // Check if we got vcard data with the wrong vcalendar mime type.
     $imp_contents = $this->getConfigParam('imp_contents');
     $c = $vCal->getComponentClasses();
     if (count($c) == 1 && !empty($c['horde_icalendar_vcard'])) {
         return $imp_contents->renderMIMEPart($mime_id, IMP_Contents::RENDER_INLINE, array('type' => 'text/x-vcard'));
     }
     $imple = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Imple')->create('IMP_Ajax_Imple_ItipRequest', array('mime_id' => $mime_id, 'muid' => strval($imp_contents->getIndicesOb())));
     // Get the method type.
     try {
         $method = $vCal->getAttribute('METHOD');
     } catch (Horde_Icalendar_Exception $e) {
         $method = '';
     }
     $out = array();
     $components = $vCal->getComponents();
     foreach ($components as $key => $component) {
         switch ($component->getType()) {
             case 'vEvent':
                 try {
                     if ($component->getAttribute('RECURRENCE-ID')) {
                         break;
                     }
                 } catch (Horde_ICalendar_Exception $e) {
                 }
                 $out[] = $this->_vEvent($component, $key, $method, $components);
                 break;
             case 'vTodo':
                 $out[] = $this->_vTodo($component, $key, $method);
                 break;
             case 'vTimeZone':
                 // Ignore them.
                 break;
             case 'vFreebusy':
                 $out[] = $this->_vFreebusy($component, $key, $method);
                 break;
                 // @todo: handle stray vcards here as well.
             // @todo: handle stray vcards here as well.
             default:
                 $out[] = sprintf(_("Unhandled component of type: %s"), $component->getType());
                 break;
         }
     }
     $view = $this->_getViewOb();
     $view->formid = $imple->getDomId();
     $view->out = implode('', $out);
     return array($mime_id => array('data' => $view->render('base'), 'type' => 'text/html; charset=UTF-8'));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:64,代码来源:Itip.php


示例7: testGeo

 public function testGeo()
 {
     $ical = new Horde_Icalendar();
     $ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/geo1.vcf'));
     $this->assertEquals(array('latitude' => -17.87, 'longitude' => 37.24), $ical->getComponent(0)->getAttribute('GEO'));
     $ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/geo2.vcf'));
     $this->assertEquals(array('latitude' => 37.386013, 'longitude' => -122.082932), $ical->getComponent(0)->getAttribute('GEO'));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:8,代码来源:AttributeTest.php


示例8: testIgnoringMultipleAttributeValues

 public function testIgnoringMultipleAttributeValues()
 {
     $ical = new Horde_Icalendar();
     $ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/multiple-summary.ics'));
     $result = $ical->getComponent(0)->getAttributeSingle('SUMMARY');
     $this->assertInternalType('string', $result);
     $this->assertEquals('Summary 1', $result);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:8,代码来源:AttributeTest.php


示例9: testFiles

 public function testFiles()
 {
     $test_files = glob(__DIR__ . '/fixtures/charset*.ics');
     foreach ($test_files as $file) {
         $ical = new Horde_Icalendar();
         $ical->parsevCalendar(file_get_contents($file));
         $this->assertEquals('möchen', $ical->getComponent(0)->getAttribute('SUMMARY'));
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:9,代码来源:CharsetTest.php


示例10: _getFixture

 private function _getFixture($name, $item = 0)
 {
     $iCal = new Horde_Icalendar();
     $iCal->parsevCalendar(file_get_contents(__DIR__ . '/../fixtures/' . $name));
     $components = $iCal->getComponents();
     $event = new Kronolith_Event_Sql(new Kronolith_Stub_Driver());
     $event->fromiCalendar($components[$item]);
     return $event;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:9,代码来源:FromIcalendarTest.php


示例11: testBug14132

 public function testBug14132()
 {
     $ical = new Horde_Icalendar();
     $ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/bug14132.ics'));
     $params = $ical->getComponent(1)->getAttribute('DTSTART', true);
     $tz = $params[0]['TZID'];
     $start = $ical->getComponent(1)->getAttribute('DTSTART');
     $dtstart = new Horde_Date($start, $tz);
     $this->assertEquals((string) $dtstart, '2015-10-09 03:00:00');
 }
开发者ID:kossamums,项目名称:horde,代码行数:10,代码来源:ParseTest.php


示例12: getVevent

 /**
  * Return the response as an iCalendar vEvent object.
  *
  * @param Horde_Itip_Response_Type $type The response type.
  * @param Horde_Icalendar|boolean  $vCal The parent container or false if not
  *                                       provided.
  *
  * @return Horde_Icalendar_Vevent The response object.
  */
 public function getVevent(Horde_Itip_Response_Type $type, $vCal = false)
 {
     $itip_reply = new Horde_Itip_Event_Vevent(Horde_Icalendar::newComponent('VEVENT', $vCal));
     $this->_request->copyEventInto($itip_reply);
     $type->setRequest($this->_request);
     $itip_reply->setAttendee($this->_resource->getMailAddress(), $this->_resource->getCommonName(), $type->getStatus());
     return $itip_reply->getVevent();
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:17,代码来源:Response.php


示例13: testFile

 /**
  * @dataProvider timezones
  */
 public function testFile($file)
 {
     $result = '';
     $ical = new Horde_Icalendar();
     $ical->parsevCalendar(file_get_contents($file));
     foreach ($ical->getComponents() as $component) {
         if ($component->getType() != 'vEvent') {
             continue;
         }
         $date = $component->getAttribute('DTSTART');
         if (is_array($date)) {
             continue;
         }
         $result .= str_replace("\r", '', $component->getAttribute('SUMMARY')) . "\n";
         $d = new Horde_Date($date);
         $result .= $d->format('H:i') . "\n";
     }
     $this->assertStringEqualsFile(__DIR__ . '/fixtures/vTimezone/' . basename($file, 'ics') . 'txt', $result, 'Failed parsing file ' . basename($file));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:22,代码来源:TimezonesTest.php


示例14: _process

 /**
  * Process the iCalendar data.
  *
  * @return array A hash of UID => id.
  * @throws Kronolith_Exception
  */
 protected function _process()
 {
     $ids = array();
     $components = $this->_iCal->getComponents();
     if (count($components) == 0) {
         throw new Kronolith_Exception(_("No iCalendar data was found."));
     }
     foreach ($components as $component) {
         if (!$this->_preSave($component)) {
             continue;
         }
         try {
             // RECURRENCE-ID - must import after base event is
             // imported/saved so defer these until all other data is
             // processed.
             $component->getAttribute('RECURRENCE-ID');
             $this->_exceptions[] = $component;
         } catch (Horde_Icalendar_Exception $e) {
             $event = $this->_driver->getEvent();
             $event->fromiCalendar($component, true);
             // Delete existing exception events. There is no efficient way
             // to determine if any existing events have been changed/deleted
             // so we just remove them all since they will be re-added during
             // the import process.
             foreach ($event->boundExceptions() as $exception) {
                 $this->_driver->deleteEvent($exception->id);
             }
             // Save and post-process.
             $event->save();
             $this->_postSave($event);
             $ids[$event->uid] = $event->id;
         }
     }
     // Save exception events.
     foreach ($this->_exceptions as $exception) {
         $event = $this->_driver->getEvent();
         $event->fromiCalendar($exception);
         $event->save();
     }
     return $ids;
 }
开发者ID:horde,项目名称:horde,代码行数:47,代码来源:Base.php


示例15: testRead

 public function testRead()
 {
     $ical = new Horde_Icalendar();
     $ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/vfreebusy1.ics'));
     // Get the vFreeBusy component
     $vfb = $ical->getComponent(0);
     // Dump the type
     $this->assertEquals('vFreebusy', $vfb->getType());
     // Dump the vfreebusy component again (the duration should be
     // converted to start/end
     $this->assertStringEqualsFile(__DIR__ . '/fixtures/vfreebusy2.ics', $vfb->exportvCalendar());
     // Dump organizer name
     $this->assertEquals('GunnarWrobel', $vfb->getName());
     // Dump organizer mail
     $this->assertEquals('[email protected]', $vfb->getEmail());
     // Dump busy periods
     $this->assertEquals(array(1164258000 => 1164261600, 1164268800 => 1164276000), $vfb->getBusyPeriods());
     // Decode the summary information
     $extra = $vfb->getExtraParams();
     $this->assertEquals('testtermin', base64_decode($extra[1164258000]['X-SUMMARY']));
     // Dump the free periods in between the two given time stamps
     $this->assertEquals(array(1164261600 => 1164268800), $vfb->getFreePeriods(1164261500, 1164268900));
     // Dump start of the free/busy information
     $this->assertEquals(1164236400, $vfb->getStart());
     // Dump end of the free/busy information
     $this->assertEquals(1169420400, $vfb->getEnd());
     // Free periods don't get added
     $vfb->addBusyPeriod('FREE', 1164261600, 1164268800);
     $this->assertEquals(array(1164258000 => 1164261600, 1164268800 => 1164276000), $vfb->getBusyPeriods());
     // Add a busy period with start/end (11:00 / 12:00)
     $vfb->addBusyPeriod('BUSY', 1164279600, 1164283200);
     // Add a busy period with start/duration (14:00 / 2h)
     $vfb->addBusyPeriod('BUSY', 1164290400, null, 7200, array('X-SUMMARY' => 'dGVzdA=='));
     // Dump busy periods
     $this->assertEquals(array(1164258000 => 1164261600, 1164268800 => 1164276000, 1164279600 => 1164283200, 1164290400 => 1164297600), $vfb->getBusyPeriods());
     // Dump the extra parameters
     $this->assertEquals(array(1164258000 => array('X-UID' => 'MmZlNWU3NDRmMGFjNjZkNjRjZjFkZmFmYTE4NGFiZTQ=', 'X-SUMMARY' => 'dGVzdHRlcm1pbg=='), 1164268800 => array(), 1164279600 => array(), 1164290400 => array('X-SUMMARY' => 'dGVzdA==')), $vfb->getExtraParams());
     return $vfb;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:39,代码来源:FreeBusyTest.php


示例16: get

 /**
  * Retrieve Free/Busy data for the specified resource.
  *
  * @param string $resource Fetch the Free/Busy data for this resource.
  *
  * @return Horde_Icalendar_Vfreebusy The Free/Busy data.
  */
 public function get($resource)
 {
     global $conf;
     $url = self::getUrl($resource);
     Horde::log(sprintf('Freebusy URL for resource %s is %s', $resource, $url), 'DEBUG');
     list($user, $domain) = explode('@', $resource);
     if (empty($domain)) {
         $domain = $conf['kolab']['filter']['email_domain'];
     }
     /**
      * This section matches Kronolith_Freebusy and should be merged with it
      * again in a single Horde_Freebusy module.
      */
     $options = array('method' => 'GET', 'timeout' => 5, 'allowRedirects' => true);
     if (!empty($conf['http']['proxy']['proxy_host'])) {
         $options = array_merge($options, $conf['http']['proxy']);
     }
     $http = new HTTP_Request($url, $options);
     $http->setBasicAuth($conf['kolab']['filter']['calendar_id'] . '@' . $domain, $conf['kolab']['filter']['calendar_pass']);
     @$http->sendRequest();
     if ($http->getResponseCode() != 200) {
         throw new Horde_Kolab_Resource_Exception(sprintf('Unable to retrieve free/busy information for %s', $resource), Horde_Kolab_Resource_Exception::NO_FREEBUSY);
     }
     $vfb_text = $http->getResponseBody();
     // Detect the charset of the iCalendar data.
     $contentType = $http->getResponseHeader('Content-Type');
     if ($contentType && strpos($contentType, ';') !== false) {
         list(, $charset, ) = explode(';', $contentType);
         $vfb_text = Horde_String::convertCharset($vfb_text, trim(str_replace('charset=', '', $charset)), 'UTF-8');
     }
     $iCal = new Horde_Icalendar();
     $iCal->parsevCalendar($vfb_text, 'VCALENDAR');
     $vfb =& $iCal->findComponent('VFREEBUSY');
     if ($vfb === false) {
         throw new Horde_Kolab_Resource_Exception(sprintf('Invalid or no free/busy information available for %s', $resource), Horde_Kolab_Resource_Exception::NO_FREEBUSY);
     }
     $vfb->simplify();
     return $vfb;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:46,代码来源:Kolab.php


示例17: __construct

 /**
  * @param mixed Kronolith_Event|string $event  The event object or error
  *                                             string to display.
  */
 public function __construct($event)
 {
     if (!$event) {
         echo '<h3>' . _("Event not found") . '</h3>';
         exit;
     }
     if (is_string($event)) {
         echo '<h3>' . $event . '</h3>';
         exit;
     }
     $iCal = new Horde_Icalendar('2.0');
     if ($event->calendarType == 'internal') {
         try {
             $share = $GLOBALS['injector']->getInstance('Kronolith_Shares')->getShare($event->calendar);
             $iCal->setAttribute('X-WR-CALNAME', $share->get('name'));
         } catch (Exception $e) {
         }
     }
     $iCal->addComponent($event->toiCalendar($iCal));
     $content = $iCal->exportvCalendar();
     $GLOBALS['browser']->downloadHeaders($event->getTitle() . '.ics', 'text/calendar; charset=UTF-8', true, strlen($content));
     echo $content;
     exit;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:28,代码来源:ExportEvent.php


示例18: _renderInline

 /**
  * Return the full rendered version of the Horde_Mime_Part object.
  *
  * URL parameters used by this function:
  *   - c: (integer) The VCARD component that contains an image.
  *   - p: (integer) The index of image inside the component to display.
  *
  * @return array  See parent::render().
  * @throws Horde_Exception
  */
 protected function _renderInline()
 {
     $vars = $GLOBALS['injector']->getInstance('Horde_Variables');
     if (!isset($vars->p)) {
         $imp_contents = $this->getConfigParam('imp_contents');
         $GLOBALS['injector']->getInstance('Horde_Core_Factory_Imple')->create('IMP_Ajax_Imple_VcardImport', array('mime_id' => $this->_mimepart->getMimeId(), 'muid' => strval($imp_contents->getIndicesOb())));
         $this->_imageUrl = $this->getConfigParam('imp_contents')->urlView($this->_mimepart, 'download_render', array('params' => array('mode' => IMP_Contents::RENDER_INLINE)));
         return parent::_renderInline();
     }
     /* Send the requested photo. */
     $data = $this->_mimepart->getContents();
     $ical = new Horde_Icalendar();
     if (!$ical->parsevCalendar($data, 'VCALENDAR', $this->_mimepart->getCharset())) {
         // TODO: Error reporting
         return array();
     }
     $components = $ical->getComponents();
     if (!isset($components[$vars->c])) {
         // TODO: Error reporting
         return array();
     }
     $name = $components[$vars->c]->getAttributeDefault('FN', false);
     if ($name === false) {
         $name = $components[$vars->c]->printableName();
     }
     if (empty($name)) {
         $name = preg_replace('/\\..*?$/', '', $this->_mimepart->getName());
     }
     $photos = $components[$vars->c]->getAllAttributes('PHOTO');
     if (!isset($photos[$vars->p])) {
         // TODO: Error reporting
         return array();
     }
     $type = 'image/' . Horde_String::lower($photos[$vars->p]['params']['TYPE']);
     return array($this->_mimepart->getMimeId() => array('data' => base64_decode($photos[$vars->p]['value']), 'name' => $name . '.' . Horde_Mime_Magic::mimeToExt($type), 'type' => $type));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:46,代码来源:Vcard.php


示例19: search

 /**
  * @throws Kronolith_Exception
  */
 public function search($email, $private_only = false)
 {
     $server = $GLOBALS['injector']->getInstance('Horde_Kolab_Session')->getFreebusyServer();
     if (empty($server)) {
         throw new Horde_Exception_NotFound();
     }
     $http = $GLOBALS['injector']->getInstance('Horde_Core_Factory_HttpClient')->create(array('request.username' => $GLOBALS['registry']->getAuth(), 'request.password' => $GLOBALS['registry']->getAuthCredential('password')));
     try {
         $response = $http->get(sprintf('%s/%s.xfb', $server, $email));
     } catch (Horde_Http_Exception $e) {
         throw new Horde_Exception_NotFound();
     }
     if ($response->code != 200) {
         throw new Horde_Exception_NotFound();
     }
     $vfb_text = $response->getBody();
     $iCal = new Horde_Icalendar();
     $iCal->parsevCalendar($vfb_text);
     $vfb = $iCal->findComponent('VFREEBUSY');
     if ($vfb === false) {
         throw new Horde_Exception_NotFound();
     }
     return $vfb;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:27,代码来源:Kolab.php


示例20: _handle

 /**
  * Variables required in form input:
  *   - identity (TODO: ? Code uses it, but it is never set anywhere)
  *   - imple_submit: itip_action(s)
  *   - mime_id
  *   - muid
  *
  * @return boolean  True on success.
  */
 protected function _handle(Horde_Variables $vars)
 {
     global $injector, $notification, $registry;
     $actions = (array) $vars->imple_submit;
     $result = false;
     $vCal = new Horde_Icalendar();
     /* Retrieve the calendar data from the message. */
     try {
         $contents = $injector->getInstance('IMP_Factory_Contents')->create(new IMP_Indices_Mailbox($vars));
         $mime_part = $contents->getMIMEPart($vars->mime_id);
         if (empty($mime_part)) {
             throw new IMP_Exception(_("Cannot retrieve calendar data from message."));
         } elseif (!$vCal->parsevCalendar($mime_part->getContents(), 'VCALENDAR', $mime_part->getCharset())) {
             throw new IMP_Exception(_("The calendar data is invalid"));
         }
         $components = $vCal->getComponents();
     } catch (Exception $e) {
         $notification->push($e, 'horde.error');
         $actions = array();
     }
     foreach ($actions as $key => $action) {
         $pos = strpos($key, '[');
         $key = substr($key, $pos + 1, strlen($key) - $pos - 2);
         switch ($action) {
             case 'delete':
                 // vEvent cancellation.
                 if ($registry->hasMethod('calendar/delete')) {
                     $guid = $components[$key]->getAttribute('UID');
                     $recurrenceId = null;
                     try {
                         // This is a cancellation of a recurring event instance.
                         $recurrenceId = $components[$key]->getAttribute('RECURRENCE-ID');
                         $atts = $components[$key]->getAttribute('RECURRENCE-ID', true);
                         $range = null;
                         foreach ($atts as $att) {
                             if (array_key_exists('RANGE', $att)) {
                                 $range = $att['RANGE'];
                             }
                         }
                     } catch (Horde_Icalendar_Exception $e) {
                     }
                     try {
                         $registry->call('calendar/delete', array($guid, $recurrenceId, $range));
                         $notification->push(_("Event successfully deleted."), 'horde.success');
                         $result = true;
                     } catch (Horde_Exception $e) {
                         $notification->push(sprintf(_("There was an error deleting the event: %s"), $e->getMessage()), 'horde.error');
                     }
                 } else {
                     $notification->push(_("This action is not supported."), 'horde.warning');
                 }
                 break;
             case 'update':
                 // vEvent reply.
                 if ($registry->hasMethod('calendar/updateAttendee')) {
                     try {
                         $from = $contents->getHeader()->getOb('from');
                         $registry->call('calendar/updateAttendee', array($components[$key], $from[0]->bare_address));
                         $notification->push(_("Respondent Status Updated."), 'horde.success');
                         $result = true;
                     } catch (Horde_Exception $e) {
                         $notification->push(sprintf(_("There was an error updating the event: %s"), $e->getMessage()), 'horde.error');
                     }
                 } else {
                     $notification->push(_("This action is not supported."), 'horde.warning');
                 }
                 break;
             case 'import':
             case 'accept-import':
                 // vFreebusy reply.
                 // vFreebusy publish.
                 // vEvent request.
                 // vEvent publish.
                 // vTodo publish.
                 // vJournal publish.
                 switch ($components[$key]->getType()) {
                     case 'vEvent':
                         $result = $this->_handlevEvent($key, $components, $mime_part);
                         // Must check for exceptions.
                         foreach ($components as $k => $component) {
                             try {
                                 if ($component->getType() == 'vEvent' && $component->getAttribute('RECURRENCE-ID')) {
                                     $uid = $component->getAttribute('UID');
                                     if ($uid == $components[$key]->getAttribute('UID')) {
                                         $this->_handlevEvent($k, $components, $mime_part);
                                     }
                                 }
                             } catch (Horde_Icalendar_Exception $e) {
                             }
                         }
                         break;
//.........这里部分代码省略.........
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:101,代码来源:ItipRequest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Horde_Imap_Client_Fetch_Query类代码示例发布时间:2022-05-23
下一篇:
PHP Horde_Form类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap