See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
저자: Michael J Rubinsky (mrubinsk@horde.org)
예제 #1
0
파일: Tnef.php 프로젝트: raz0rsdge/horde
 /**
  * Decodes TNEF attributes.
  *
  * @param  [type] &$data [description]
  * @return [type]        [description]
  */
 protected function _decodeMessageProperty(&$data)
 {
     // This contains the type AND the attribute name. We should only check
     // against the name since this is very confusing  (everything else is
     // checked against just name). Can't change until Horde 6 though since
     // the constants would have to change. Also, the type identifiers are
     // different between MAPI and TNEF. Of course...
     // $type = $this->_geti($data, 16);
     // $attribute = $this->_geti($data, 16);
     $attribute = $this->_geti($data, 32);
     $this->_logger->debug(sprintf('TNEF: Message property 0x%X found.', $attribute));
     $value = false;
     switch ($attribute) {
         case self::AMCLASS:
             // Start of a new message.
             $message_class = trim($this->_decodeAttribute($data));
             $this->_logger->debug(sprintf('TNEF: Message class: %s', $message_class));
             switch ($message_class) {
                 case self::IPM_MEETING_REQUEST:
                     $this->_currentObject = new Horde_Compress_Tnef_Icalendar($this->_logger);
                     $this->_currentObject->setMethod('REQUEST', $message_class);
                     $this->_files[] = $this->_currentObject;
                     break;
                 case self::IPM_MEETING_RESPONSE_TENT:
                 case self::IPM_MEETING_RESPONSE_NEG:
                 case self::IPM_MEETING_RESPONSE_POS:
                     $this->_currentObject = new Horde_Compress_Tnef_Icalendar($this->_logger);
                     $this->_currentObject->setMethod('REPLY', $message_class);
                     $this->_files[] = $this->_currentObject;
                     break;
                 case self::IPM_MEETING_REQUEST_CANCELLED:
                     $this->_currentObject = new Horde_Compress_Tnef_Icalendar($this->_logger);
                     $this->_currentObject->setMethod('CANCEL', $message_class);
                     $this->_files[] = $this->_currentObject;
                     break;
                 case self::IPM_TASK_REQUEST:
                     $this->_currentObject = new Horde_Compress_Tnef_VTodo($this->_logger, null, array('parent' => &$this));
                     $this->_files[] = $this->_currentObject;
                     break;
                 default:
                     $this->_logger->debug(sprintf('Unknown message class: %s', $message_class));
             }
             break;
         case self::AMAPIPROPS:
             $this->_logger->debug('TNEF: Extracting encapsulated message properties (idMsgProps)');
             $properties = $this->_decodeAttribute($data);
             $this->_extractMapiAttributes($properties);
             break;
         case self::APRIORITY:
         case self::AOWNER:
         case self::ARECIPIENTTABLE:
         case self::ABODY:
         case self::ASTATUS:
         case self::ACONVERSATIONID:
         case self::APARENTID:
         case self::AMESSAGEID:
         case self::ASUBJECT:
         case self::AORIGINALMCLASS:
             $value = $this->_decodeAttribute($data);
             break;
         case self::ADATERECEIVED:
         case self::ADATESENT:
         case self::ADATEMODIFIED:
         case self::ID_DATE_END:
             try {
                 $value = new Horde_Date(Horde_Mapi::filetimeToUnixtime($this->_decodeAttribute($data)), 'UTC');
             } catch (Horde_Mapi_Exception $e) {
                 throw new Horde_Compress_Exception($e);
             } catch (Horde_Date_Exception $e) {
                 throw new Horde_Compress_Exception($e);
             }
             break;
         case self::AFROM:
         case self::ASENTFOR:
             $msgObj = $this->_decodeAttribute($data);
             $display_name = $this->_getx($msgObj, $this->_geti($msgObj, 16));
             $email = $this->_getx($msgObj, $this->_geti($msgObj, 16));
             $value = $email;
             // @todo - Do we need to pass display name too?
             break;
         default:
             $size = $this->_geti($data, 32);
             $value = $this->_getx($data, $size);
             $this->_geti($data, 16);
             // Checksum.
     }
     if ($value && $this->_currentObject) {
         $this->_currentObject->setTnefAttribute($attribute, $value, empty($size) ? strlen($value) : $size);
     }
 }
예제 #2
0
파일: Rtf.php 프로젝트: raz0rsdge/horde
 public function __construct($logger, $data)
 {
     parent::__construct($logger, $data);
     $this->_decode();
 }