Exemplo n.º 1
0
 public function testDomainMatch()
 {
     $address = new Horde_Mail_Rfc822_Address('Test <*****@*****.**>');
     $this->assertTrue($address->matchDomain('example.com'));
     $this->assertFalse($address->matchDomain('foo.example.com'));
     $address2 = new Horde_Mail_Rfc822_Address('Test <*****@*****.**>');
     $this->assertTrue($address2->matchDomain('example.com'));
     $this->assertTrue($address2->matchDomain('foo.example.com'));
     $address3 = new Horde_Mail_Rfc822_Address('Test <*****@*****.**>');
     $this->assertTrue($address3->matchDomain('example.co.uk'));
     $this->assertFalse($address3->matchDomain('foo.example.co.uk'));
     $this->assertTrue($address3->matchDomain('co.uk'));
     $address4 = new Horde_Mail_Rfc822_Address('Test <*****@*****.**>');
     $this->assertTrue($address4->matchDomain('example.co.uk'));
     $this->assertTrue($address4->matchDomain('foo.example.co.uk'));
     $this->assertTrue($address4->matchDomain('co.uk'));
 }
Exemplo n.º 2
0
 /**
  * @dataProvider domainMatchProvider
  */
 public function testDomainMatch($addr, $tests)
 {
     $address = new Horde_Mail_Rfc822_Address($addr);
     foreach ($tests as $val) {
         $match = $address->matchDomain($val[0]);
         if ($val[1]) {
             $this->assertTrue($match);
         } else {
             $this->assertFalse($match);
         }
     }
 }
Exemplo n.º 3
0
 /**
  * Import an event response into a user's calendar. Used for updating
  * attendee information from a meeting response.
  *
  * @param Horde_Icalendar_vEvent $vEvent  The event data.
  * @param string $attendee                The attendee.
  */
 public function calendar_import_attendee(Horde_Icalendar_vEvent $vEvent, $attendee)
 {
     if ($this->_registry->hasMethod('calendar/updateAttendee')) {
         // If the mail interface (i.e., IMP) provides a mime driver for
         // iTips, check if we are allowed to autoupdate. If we have no
         // configuration, err on the side of caution and DO NOT auto import.
         $config = $GLOBALS['injector']->getInstance('Horde_Core_Factory_MimeViewer')->getViewerConfig('text/calendar', $this->_registry->hasInterface('mail'));
         if ($config[1]['driver'] == 'Itip' && !empty($config[1]['auto_update_eventreply'])) {
             if (is_array($config[1]['auto_update_eventreply'])) {
                 $adr = new Horde_Mail_Rfc822_Address($attendee);
                 $have_match = false;
                 foreach ($config[1]['auto_update_eventreply'] as $val) {
                     if ($adr->matchDomain($val)) {
                         $have_match = true;
                         break;
                     }
                 }
                 if (!$have_match) {
                     return;
                 }
             }
             try {
                 $this->_registry->calendar->updateAttendee($vEvent, $attendee);
             } catch (Horde_Exception $e) {
                 $this->_logger->err($e->getMessage());
             }
         }
     }
 }
Exemplo n.º 4
0
Arquivo: Itip.php Projeto: Gomez/horde
 /**
  * Determine if we are going to auto-update the reply.
  *
  * @param string $type    The type of reply. Must match one of the
  *                        'auto_update_*' configuration keys in the iTip
  *                        mime viewer configuration.
  * @param string $sender  The sender.
  *
  * @return boolean
  */
 protected function _autoUpdateReply($type, $sender)
 {
     if (!empty($this->_conf[$type])) {
         if (is_array($this->_conf[$type])) {
             $ob = new Horde_Mail_Rfc822_Address($sender);
             foreach ($this->_conf[$type] as $val) {
                 if ($ob->matchDomain($val)) {
                     return true;
                 }
             }
         } else {
             return true;
         }
     }
     return false;
 }