本文整理汇总了PHP中Horde_Mime_Part::buildMimeIds方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Mime_Part::buildMimeIds方法的具体用法?PHP Horde_Mime_Part::buildMimeIds怎么用?PHP Horde_Mime_Part::buildMimeIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Mime_Part
的用法示例。
在下文中一共展示了Horde_Mime_Part::buildMimeIds方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trim
$command = trim($vars->php);
$title = _("PHP Shell");
$view = new Horde_View(array('templatePath' => HORDE_TEMPLATES . '/admin'));
$view->addHelper('Horde_Core_View_Helper_Help');
$view->addHelper('Text');
$view->action = Horde::url('admin/phpshell.php');
$view->application = $application;
$view->apps = $apps;
$view->command = $command;
$view->title = $title;
if ($command) {
$pushed = $registry->pushApp($application);
$part = new Horde_Mime_Part();
$part->setContents($command);
$part->setType('application/x-httpd-phps');
$part->buildMimeIds();
$pretty = $injector->getInstance('Horde_Core_Factory_MimeViewer')->create($part)->render('inline');
$view->pretty = $pretty[1]['data'];
Horde::startBuffer();
try {
eval($command);
} catch (Exception $e) {
echo $e;
}
$view->command_exec = Horde::endBuffer();
if ($pushed) {
$registry->popApp();
}
}
$page_output->addScriptFile('stripe.js', 'horde');
$page_output->header(array('title' => $title));
示例2: getMultipartMimeMessage
private function getMultipartMimeMessage($mime_type)
{
$envelope = new Horde_Mime_Part();
$envelope->setType('multipart/mixed');
$foo = new Horde_Mime_Part();
$foo->setType('foo/bar');
$envelope->addPart($foo);
$kolab = new Horde_Mime_Part();
$kolab->setType($mime_type);
$envelope->addPart($kolab);
$envelope->buildMimeIds();
return $envelope;
}
示例3: _getTestPart
protected function _getTestPart()
{
$part = new Horde_Mime_Part();
$part->setType('multipart/mixed');
$part1 = new Horde_Mime_Part();
$part1->setType('text/plain');
$part1->setContents('Test');
$part[] = $part1;
$part2 = new Horde_Mime_Part();
$part2->setType('application/octet-stream');
$part[] = $part2;
$part3 = new Horde_Mime_Part();
$part3->setType('multipart/mixed');
$part[] = $part3;
$part3_1 = new Horde_Mime_Part();
$part3_1->setType('text/plain');
$part3_1->setContents('Test 2');
$part3[] = $part3_1;
$part3_2 = new Horde_Mime_Part();
$part3_2->setType('multipart/mixed');
$part3[] = $part3_2;
$part3_2_1 = new Horde_Mime_Part();
$part3_2_1->setType('text/plain');
$part3_2_1->setContents('Test 3.2.1');
$part3_2[] = $part3_2_1;
$part3_2_2 = new Horde_Mime_Part();
$part3_2_2->setType('application/octet-stream');
$part3_2_2->setContents('Test 3.2.2');
$part3_2[] = $part3_2_2;
$part->buildMimeIds();
return $part;
}
示例4:
<?php
$part1 = new Horde_Mime_Part();
$part1->setType('text/plain');
$part1->setTransferEncoding('quoted-printable');
$part1->setCharset('UTF-8');
$part1->setDisposition('inline');
$part1->setBytes(249);
$part2 = new Horde_Mime_Part();
$part2->setType('application/x-vnd.kolab.note');
$part2->setTransferEncoding('quoted-printable');
$part2->setName('kolab.xml');
$part2->setDisposition('attachment');
$part2->setBytes(704);
$message = new Horde_Mime_Part();
$message->setType('multipart/mixed');
$message->addPart($part1);
$message->addPart($part2);
$message->buildMimeIds(0);
return $message;
示例5: _saveToSentMail
/**
* Save message to sent-mail mailbox, if configured to do so.
*
* @param Horde_Mime_Headers $headers Headers object.
* @param Horde_Mime_Part $save_msg Message data to save.
* @param Horde_Mail_Rfc822_List $recips Recipient list.
* @param array $opts See buildAndSendMessage()
*/
protected function _saveToSentMail(Horde_Mime_Headers $headers, Horde_Mime_Part $save_msg, Horde_Mail_Rfc822_List $recips, $opts)
{
global $injector, $language, $notification, $prefs;
if (empty($opts['sent_mail']) || $prefs->isLocked('save_sent_mail') && !$prefs->getValue('save_sent_mail') || !$prefs->isLocked('save_sent_mail') && empty($opts['save_sent'])) {
return;
}
$imp_imap = $injector->getInstance('IMP_Factory_Imap')->create();
/* If message contains EAI addresses, we need to verify that the IMAP
* server can handle this data in order to save. */
foreach ($recips as $val) {
if ($val->eai) {
if ($imp_imap->client_ob->capability->query('UTF8', 'ACCEPT')) {
break;
}
$notification->push(sprintf(_("Message sent successfully, but not saved to %s."), $sent_mail->display));
return;
}
}
/* Strip attachments if requested. */
if (!empty($opts['strip_attachments'])) {
$save_msg->buildMimeIds();
/* Don't strip any part if this is a text message with both
* plaintext and HTML representation. */
if ($save_msg->getType() != 'multipart/alternative') {
for ($i = 2;; ++$i) {
if (!($oldPart = $save_msg[$i])) {
break;
}
$replace_part = new Horde_Mime_Part();
$replace_part->setType('text/plain');
$replace_part->setCharset($this->charset);
$replace_part->setLanguage($language);
$replace_part->setContents('[' . _("Attachment stripped: Original attachment type") . ': "' . $oldPart->getType() . '", ' . _("name") . ': "' . $oldPart->getName(true) . '"]');
$save_msg[$i] = $replace_part;
}
}
}
/* Generate the message string. */
$fcc = $save_msg->toString(array('defserver' => $imp_imap->config->maildomain, 'headers' => $headers, 'stream' => true));
/* Make sure sent mailbox is created. */
$sent_mail = IMP_Mailbox::get($opts['sent_mail']);
$sent_mail->create();
$flags = array(Horde_Imap_Client::FLAG_SEEN, Horde_Imap_Client::FLAG_MDNSENT);
try {
$imp_imap->append($sent_mail, array(array('data' => $fcc, 'flags' => $flags)));
} catch (IMP_Imap_Exception $e) {
$notification->push(sprintf(_("Message sent successfully, but not saved to %s."), $sent_mail->display));
}
}
示例6: _getTestPart
protected function _getTestPart()
{
$part = new Horde_Mime_Part();
$part->setType('multipart/mixed');
$part1 = new Horde_Mime_Part();
$part1->setType('text/plain');
$part1->setContents('Test');
$part->addPart($part1);
$part2 = new Horde_Mime_Part();
$part2->setType('application/octet-stream');
$part->addPart($part2);
$part3 = new Horde_Mime_Part();
$part3->setType('multipart/mixed');
$part->addPart($part3);
$part3_1 = new Horde_Mime_Part();
$part3_1->setType('text/plain');
$part3_1->setContents('Test 2');
$part3->addPart($part3_1);
$part->buildMimeIds();
return $part;
}
示例7: catch
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('turba');
$source = Horde_Util::getFormData('source');
$key = Horde_Util::getFormData('key');
$filename = Horde_Util::getFormData('file');
$type = Horde_Util::getFormData('type');
/* Get the object. */
if (!isset($cfgSources[$source])) {
throw new Turba_Exception(_("The contact you requested does not exist."));
}
$driver = $injector->getInstance('Turba_Factory_Driver')->create($source);
$object = $driver->getObject($key);
/* Check permissions. */
if (!$object->hasPermission(Horde_Perms::READ)) {
throw new Turba_Exception(_("You do not have permission to view this contact."));
}
try {
$data = $object->vfsInit()->read(Turba::VFS_PATH . '/' . $object->getValue('__uid'), $filename);
} catch (Horde_Vfs_Exception $e) {
Horde::log($e, 'ERR');
throw new Turba_Exception(sprintf(_("Access denied to %s"), $filename));
}
$mime_part = new Horde_Mime_Part();
$mime_part->setType(Horde_Mime_Magic::extToMime($type));
$mime_part->setContents($data);
$mime_part->setName($filename);
$mime_part->buildMimeIds();
$content = $injector->getInstance('Horde_Core_Factory_MimeViewer')->create($mime_part)->render('full');
$body = $content[1]['data'];
$browser->downloadHeaders($filename, $content[1]['type'], true, strlen($body));
echo $body;