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


PHP Tinebase_Core::systemCommandExists方法代码示例

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


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

示例1: getAttachments

 /**
  * get attachments of message
  *
  * @param  array  $_structure
  * @return array
  */
 public function getAttachments($_messageId, $_partId = null)
 {
     if (!$_messageId instanceof Felamimail_Model_Message) {
         $message = $this->_backend->get($_messageId);
     } else {
         $message = $_messageId;
     }
     $structure = $message->getPartStructure($_partId);
     $attachments = array();
     if (!isset($structure['parts'])) {
         return $attachments;
     }
     foreach ($structure['parts'] as $part) {
         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
             Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($part, TRUE));
         }
         if ($part['type'] == 'multipart') {
             $attachments = $attachments + $this->getAttachments($message, $part['partId']);
         } else {
             $filename = $this->_getAttachmentFilename($part);
             if ($part['type'] == 'text' && (!is_array($part['disposition']) || $part['disposition']['type'] == Zend_Mime::DISPOSITION_INLINE && !(isset($part['disposition']["parameters"]) || array_key_exists("parameters", $part['disposition'])))) {
                 if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                     Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Skipping DISPOSITION_INLINE attachment with name ' . $filename);
                 }
                 if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
                     Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' part: ' . print_r($part, TRUE));
                 }
                 continue;
             }
             $expanded = array();
             // if a winmail.dat exists, try to expand it
             if (preg_match('/^winmail[.]*\\.dat/i', $filename) && Tinebase_Core::systemCommandExists('tnef')) {
                 if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                     Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Got winmail.dat attachment (contentType=' . $part['contentType'] . '). Trying to extract files ...');
                 }
                 if ($part['contentType'] == 'application/ms-tnef' || $part['contentType'] == 'text/plain') {
                     $expanded = $this->_expandWinMailDat($_messageId, $part['partId']);
                     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Extracted ' . count($expanded) . ' files from ' . $filename);
                     }
                     if (!empty($expanded)) {
                         $attachments = array_merge($attachments, $expanded);
                     }
                 }
             }
             // if its not a winmail.dat, or the winmail.dat couldn't be expanded
             // properly because it has richtext embedded, return attachment as it is
             if (empty($expanded)) {
                 $attachmentData = array('content-type' => $part['contentType'], 'filename' => $filename, 'partId' => $part['partId'], 'size' => $part['size'], 'description' => $part['description'], 'cid' => !empty($part['id']) ? $part['id'] : NULL);
                 if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                     Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Got attachment with name ' . $filename);
                 }
                 $attachments[] = $attachmentData;
             }
         }
     }
     return $attachments;
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:64,代码来源:Message.php

示例2: testTnefRichtext

 /**
  * test Tnef-Attachment (winmail.dat)
  *
  * @TODO: handle richtext encapsulated in tnef - this test assures, rtf-tnef won't produce any errors
  *
  * @see 0010076: Extract winmail.dat
  */
 public function testTnefRichtext()
 {
     if (!Tinebase_Core::systemCommandExists('tnef')) {
         $this->markTestSkipped('The tnef command could not be found!');
     }
     $cachedMessage = $this->messageTestHelper('winmail_dat_richtext.eml');
     $message = $this->_controller->getCompleteMessage($cachedMessage);
     $this->assertEquals(1, count($message->attachments));
     $this->assertEquals('winmail.dat', $message->attachments[0]['filename']);
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:17,代码来源:MessageTest.php


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