本文整理汇总了PHP中imap_base64函数的典型用法代码示例。如果您正苦于以下问题:PHP imap_base64函数的具体用法?PHP imap_base64怎么用?PHP imap_base64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了imap_base64函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getAttachments
function getAttachments($id, $path)
{
$parts = imap_fetchstructure($this->mailbox, $id);
$attachments = array();
//FIXME if we do an is_array() here it breaks howver if we don't
//we get foreach errors
foreach ($parts->parts as $key => $value) {
$encoding = $parts->parts[$key]->encoding;
if ($parts->parts[$key]->ifdparameters) {
$filename = $parts->parts[$key]->dparameters[0]->value;
$message = imap_fetchbody($this->mailbox, $id, $key + 1);
switch ($encoding) {
case 0:
$message = imap_8bit($message);
case 1:
$message = imap_8bit($message);
case 2:
$message = imap_binary($message);
case 3:
$message = imap_base64($message);
case 4:
$message = quoted_printable_decode($message);
case 5:
default:
$message = $message;
}
$fp = fopen($path . $filename, "w");
fwrite($fp, $message);
fclose($fp);
$attachments[] = $filename;
}
}
return $attachments;
}
开发者ID:sitracker,项目名称:sitracker_old,代码行数:34,代码来源:fetchSitMail.class.php
示例2: download
function download($VAR)
{
if (empty($VAR['id'])) {
return false;
}
$id = $VAR['id'];
// get ticket id
$db =& DB();
$rs = $db->Execute(sqlSelect($db, array("ticket_attachment", "ticket"), "A.ticket_id,B.department_id,B.account_id", "A.id=::{$id}:: AND A.ticket_id=B.id"));
if (!$rs || $rs->RecordCount() == 0) {
return false;
}
// is this an admin?
global $C_auth;
if ($C_auth->auth_method_by_name("ticket", "view")) {
// get the data & type
$rs = $db->Execute(sqlSelect($db, "ticket_attachment", "*", "id=::{$id}::"));
// set the header
require_once PATH_CORE . 'file_extensions.inc.php';
$ft = new file_extensions();
$type = $ft->set_headers_ext($rs->fields['type'], $rs->fields['name']);
if (empty($type)) {
echo imap_qprint($rs->fields['content']);
} elseif (preg_match("/^text/i", $type)) {
echo imap_base64($rs->fields['content']);
} else {
echo imap_base64($rs->fields['content']);
}
exit;
}
}
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:31,代码来源:ticket_attachment.inc.php
示例3: getReadme
public static function getReadme($owner, $repo)
{
$token = self::getAccessToken();
$readmeUrl = 'https://api.github.com/repos/' . $owner . '/' . $repo . '/readme?access_token=' . $token;
$client = self::getClient();
$res = $client->get($readmeUrl, []);
$readmeHash = json_decode($res->getBody(), true);
$readme = ['readme' => \Markdown::convertToHtml(imap_base64($readmeHash['content']))];
return $readme;
}
开发者ID:briscula,项目名称:astral,代码行数:10,代码来源:GithubClient.php
示例4: getAttachmentData
function getAttachmentData($clientObj, $xml)
{
$attachment = $clientObj->GetAttachmentsForBusinessObject('KnowledgeArticle', $xml->FieldList->Field[0]);
if ($attachment != "<Attachments />") {
$attachment_xml = simplexml_load_string($attachment);
if ($attachment_xml->Attachment->AttachmentType == 'html') {
$res = $clientObj->getAttachment($attachment_xml->Attachment['AttachmentId']);
$atl = simplexml_load_string($res);
$rawBody = imap_base64($atl);
} else {
$rawBody = '';
}
} else {
$rawBody = '';
}
return $rawBody;
}
开发者ID:jptingle,项目名称:php-soap,代码行数:17,代码来源:routeHelpers.php
示例5: getdecodevalue
function getdecodevalue($message,$coding) {
switch($coding) {
case 0:
case 1:
$message = imap_8bit($message);
break;
case 2:
$message = imap_binary($message);
break;
case 3:
case 5:
$message=imap_base64($message);
break;
case 4:
$message = imap_qprint($message);
break;
}
return $message;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:19,代码来源:checkmail_functions.php
示例6: _decodeMail
private function _decodeMail($encoding, $body)
{
switch ($encoding) {
case ENC7BIT:
return $body;
case ENC8BIT:
return $body;
case ENCBINARY:
return $body;
case ENCBASE64:
return imap_base64($body);
case ENCQUOTEDPRINTABLE:
return imap_qprint($body);
case ENCOTHER:
return $body;
default:
return $body;
}
}
开发者ID:rocwang,项目名称:incoming,代码行数:19,代码来源:SiteController.php
示例7: decodeBody
/**
* Attempts to Decode the message body. If a valid encoding is not passed then it will attempt to detect the encoding itself.
* @param $body
* @param int|null $encoding
* @return string
*/
public function decodeBody($body, $encoding = null)
{
switch ($encoding) {
case ENCBASE64:
return imap_base64($body);
case ENCQUOTEDPRINTABLE:
return imap_qprint($body);
case ENCBINARY:
return $body;
default:
// Let's check if the message is base64
if ($decoded = base64_decode($body, true)) {
return $decoded;
}
if ($this->isQuotedPrintable($body)) {
return imap_qprint($body);
}
return $body;
}
}
开发者ID:craigh411,项目名称:ImapMailManager,代码行数:26,代码来源:MessageDecoder.php
示例8: get_part
public static function get_part($stream, $msg_number, $mime_type, $structure = false, $part_number = false)
{
if (!$structure) {
$structure = imap_fetchstructure($stream, $msg_number);
}
if ($structure) {
if ($mime_type == self::get_mime_type($structure)) {
if (!$part_number) {
$part_number = "1";
}
$text = imap_fetchbody($stream, $msg_number, $part_number);
if ($structure->encoding == 3) {
return imap_base64($text);
} else {
if ($structure->encoding == 4) {
return imap_qprint($text);
} else {
return $text;
}
}
}
if ($structure->type == 1) {
while (list($index, $sub_structure) = each($structure->parts)) {
if ($part_number) {
$prefix = $part_number . '.';
} else {
$prefix = "";
}
$data = self::get_part($stream, $msg_number, $mime_type, $sub_structure, $prefix . ($index + 1));
if ($data) {
return $data;
}
}
// END OF WHILE
}
// END OF MULTIPART
}
// END OF STRUTURE
return false;
}
开发者ID:laiello,项目名称:time-travel,代码行数:40,代码来源:EmailUtil.php
示例9: get_part
function get_part($imap, $uid, $mimetype, $structure = false, $partNumber = false)
{
if (!$structure) {
//$imap_uid = imap_uid ($imap, $uid);
//echo "$uid->".$uid;
$structure = imap_fetchstructure($imap, $uid, FT_UID);
}
//echo "<br/>structure-><pre>".print_r($structure)."</pre>";
if ($structure) {
if ($mimetype == get_mime_type($structure)) {
if (!$partNumber) {
$partNumber = 1;
}
$text = imap_fetchbody($imap, $uid, $partNumber, FT_UID);
switch ($structure->encoding) {
case 3:
return imap_base64($text);
case 4:
return imap_qprint($text);
default:
return $text;
}
}
// multipart
if ($structure->type == 1) {
foreach ($structure->parts as $index => $subStruct) {
$prefix = "";
if ($partNumber) {
$prefix = $partNumber . ".";
}
$data = get_part($imap, $uid, $mimetype, $subStruct, $prefix . ($index + 1));
if ($data) {
return $data;
}
}
}
}
return false;
}
开发者ID:bhushansonar,项目名称:knewdog.com,代码行数:39,代码来源:list+-+Copy.php
示例10: fetchBody
/**
* Fetches email body
*
* @param int $msgno Message number
* @return string
*/
protected function fetchBody($msgno)
{
$body = imap_fetchbody($this->connection, $msgno, '1', FT_PEEK);
$structure = imap_fetchstructure($this->connection, $msgno);
$encoding = $structure->parts[0]->encoding;
$charset = null;
foreach ($structure->parts[0]->parameters as $param) {
if ($param->attribute == 'CHARSET') {
$charset = $param->value;
break;
}
}
if ($encoding == ENCBASE64) {
$body = imap_base64($body);
} elseif ($encoding == ENCQUOTEDPRINTABLE) {
$body = imap_qprint($body);
}
if ($charset) {
$body = iconv($charset, "UTF-8", $body);
}
return $body;
}
开发者ID:kacer,项目名称:FakturoidPairing,代码行数:28,代码来源:EmailStatement.php
示例11: read
private function read()
{
$allMails = imap_search($this->conn, 'ALL');
if ($allMails) {
rsort($allMails);
foreach ($allMails as $email_number) {
$overview = imap_fetch_overview($this->conn, $email_number, 0);
$structure = imap_fetchstructure($this->conn, $email_number);
$body = '';
if (isset($structure->parts) && is_array($structure->parts) && isset($structure->parts[1])) {
$part = $structure->parts[1];
$body = imap_fetchbody($this->conn, $email_number, 2);
if ($part->encoding == 3) {
$body = imap_base64($body);
} else {
if ($part->encoding == 1) {
$body = imap_8bit($body);
} else {
$body = imap_qprint($body);
}
}
}
$body = utf8_decode($body);
$fromaddress = utf8_decode(imap_utf7_encode($overview[0]->from));
$subject = mb_decode_mimeheader($overview[0]->subject);
$date = utf8_decode(imap_utf8($overview[0]->date));
$date = date('Y-m-d H:i:s', strtotime($date));
$key = md5($fromaddress . $subject . $body);
//save to MySQL
$sql = "SELECT count(*) FROM EMAIL_INFORMATION WHERE IDMAIL = " . $this->id . " AND CHECKVERS = \"" . $key . "\"";
$resul = $this->pdo->query($sql)->fetch();
if ($resul[0] == 0) {
$this->pdo->prepare("INSERT INTO EMAIL_INFORMATION (IDMAIL,FROMADDRESS,SUBJECT,DATE,BODY,CHECKVERS) VALUES (?,?,?,?,?,?)");
$this->pdo->execute(array($this->id, $fromaddress, $subject, $date, $body, $key));
}
}
}
}
开发者ID:GPierre-Antoine,项目名称:projetphp,代码行数:38,代码来源:Email.php
示例12: get_part
function get_part($imap, $uid, $mimetype, $structure = false, $partNumber = false)
{
if (!$structure) {
$structure = imap_fetchstructure($imap, $uid, FT_UID);
}
if ($structure) {
if ($mimetype == get_mime_type($structure)) {
if (!$partNumber) {
$partNumber = 1;
}
$text = imap_fetchbody($imap, $uid, $partNumber, FT_UID);
switch ($structure->encoding) {
case 3:
return imap_base64($text);
case 4:
return imap_qprint($text);
default:
return $text;
}
}
/*/ multipart */
if ($structure->type == 1) {
foreach ($structure->parts as $index => $subStruct) {
$prefix = "";
if ($partNumber) {
$prefix = $partNumber . ".";
}
$imap = '';
$data = get_part($imap, $uid, $mimetype, $subStruct, $prefix . ($index + 1));
if ($data) {
return $data;
}
}
}
}
return false;
}
开发者ID:linuxman,项目名称:uycodeka,代码行数:37,代码来源:GetBackup.php
示例13: get_part
function get_part($stream, $msg_number, $mime_type, $structure = false, $part_number = false)
{
if (!$structure) {
$structure = imap_fetchstructure($stream, $msg_number);
}
if ($structure) {
if ($mime_type == get_mime_type($structure)) {
if (!$part_number) {
$part_number = "1";
}
$text = imap_fetchbody($stream, $msg_number, $part_number);
if ($structure->encoding == 3) {
return imap_base64($text);
} else {
if ($structure->encoding == 4) {
return imap_qprint($text);
} else {
return $text;
}
}
}
if ($structure->type == 1) {
/* multipart */
while (list($index, $sub_structure) = each($structure->parts)) {
if ($part_number) {
$prefix = $part_number . '.';
}
$data = get_part($stream, $msg_number, $mime_type, $sub_structure, $prefix . ($index + 1));
if ($data) {
return $data;
}
}
}
}
return false;
}
开发者ID:kishorekumard,项目名称:SourceFiles,代码行数:36,代码来源:read_email_cattprjcts.php
示例14: str_replace
$content = $contentfirstline . str_replace($firstline, '', $content);
$content = trim($content);
//Please uncomment following line, only if you want to check user and password.
// echo "<p><b>Login:</b> $user_login, <b>Pass:</b> $user_pass</p>";
#Check to see if there is an attachment, if there is, save the filename in the temp directory
#First define some constants and message types
$type = array("text", "multipart", "message", "application", "audio", "image", "video", "other");
#message encodings
$encoding = array("7bit", "8bit", "binary", "base64", "quoted-printable", "other");
#parse message body (not really used yet, will be used for multiple attachments)
$attach = parse($struct);
$attach_parts = get_attachments($attach);
#get the attachment
$attachment = imap_fetchbody($mbox, $iCount, 2);
if ($attachment != '') {
$attachment = imap_base64($attachment);
$temp_file = mb_convert_encoding(mb_decode_mimeheader($struct->parts[1]->dparameters[0]->value), $blog_charset, "auto");
echo $temp_file;
if (!($temp_fp = fopen("attach/" . $temp_file, "w"))) {
echo "error1";
continue;
}
fputs($temp_fp, $attachment);
fclose($temp_fp);
wp_create_thumbnail("attach/" . $temp_file, 160, "");
} else {
$attachment = false;
}
if ($xooptDB) {
$sql = "SELECT ID, user_level FROM {$tableusers} WHERE user_login='{$user_login}' ORDER BY ID DESC LIMIT 1";
$result = $wpdb->get_row($sql);
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:wp-moblog.php
示例15: die
$ih = @imap_open("{" . ConfigHelper::getConfig('cashimport.server') . "}INBOX", ConfigHelper::getConfig('cashimport.username'), ConfigHelper::getConfig('cashimport.password'));
if (!$ih) {
die("Cannot connect to mail server!" . PHP_EOL);
}
$posts = imap_search($ih, ConfigHelper::checkValue(ConfigHelper::getConfig('cashimport.use_seen_flag', true)) ? 'UNSEEN' : 'ALL');
if (!empty($posts)) {
foreach ($posts as $postid) {
$post = imap_fetchstructure($ih, $postid);
if ($post->type == 1) {
$parts = $post->parts;
//print_r($parts);
foreach ($parts as $partid => $part) {
if ($part->ifdisposition && strtoupper($part->disposition) == 'ATTACHMENT' && $part->type == 0) {
$fname = $part->dparameters[0]->value;
$msg = imap_fetchbody($ih, $postid, $partid + 1);
if ($part->encoding == 3) {
$msg = imap_base64($msg);
}
if (ConfigHelper::checkValue(ConfigHelper::getConfig('cashimport.use_seen_flag', true))) {
imap_setflag_full($ih, $postid, "\\Seen");
}
parse_file($fname, $msg);
if (ConfigHelper::checkValue(ConfigHelper::getConfig('cashimport.autocommit', false))) {
commit_cashimport();
}
}
}
}
}
}
imap_close($ih);
开发者ID:itav,项目名称:lms,代码行数:31,代码来源:lms-cashimport.php
示例16: saveForwardAttachments
function saveForwardAttachments($id, $module, $file_details)
{
global $log;
$log->debug("Entering into saveForwardAttachments({$id},{$module},{$file_details}) method.");
global $adb, $current_user;
global $upload_badext;
require_once 'modules/Webmails/MailBox.php';
$mailbox = $_REQUEST["mailbox"];
$MailBox = new MailBox($mailbox);
$mail = $MailBox->mbox;
$binFile = sanitizeUploadFileName($file_details['name'], $upload_badext);
$filename = ltrim(basename(" " . $binFile));
//allowed filename like UTF-8 characters
$filetype = $file_details['type'];
$filesize = $file_details['size'];
$filepart = $file_details['part'];
$transfer = $file_details['transfer'];
$file = imap_fetchbody($mail, $_REQUEST['mailid'], $filepart);
if ($transfer == 'BASE64') {
$file = imap_base64($file);
} elseif ($transfer == 'QUOTED-PRINTABLE') {
$file = imap_qprint($file);
}
$current_id = $adb->getUniqueID("vtiger_crmentity");
$date_var = date('Y-m-d H:i:s');
//to get the owner id
$ownerid = $this->column_fields['assigned_user_id'];
if (!isset($ownerid) || $ownerid == '') {
$ownerid = $current_user->id;
}
$upload_file_path = decideFilePath();
file_put_contents($upload_file_path . $current_id . "_" . $filename, $file);
$sql1 = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(?,?,?,?,?,?,?)";
$params1 = array($current_id, $current_user->id, $ownerid, $module . " Attachment", $this->column_fields['description'], $adb->formatDate($date_var, true), $adb->formatDate($date_var, true));
$adb->pquery($sql1, $params1);
$sql2 = "insert into vtiger_attachments(attachmentsid, name, description, type, path) values(?,?,?,?,?)";
$params2 = array($current_id, $filename, $this->column_fields['description'], $filetype, $upload_file_path);
$result = $adb->pquery($sql2, $params2);
if ($_REQUEST['mode'] == 'edit') {
if ($id != '' && $_REQUEST['fileid'] != '') {
$delquery = 'delete from vtiger_seattachmentsrel where crmid = ? and attachmentsid = ?';
$adb->pquery($delquery, array($id, $_REQUEST['fileid']));
}
}
$sql3 = 'insert into vtiger_seattachmentsrel values(?,?)';
$adb->pquery($sql3, array($id, $current_id));
return true;
$log->debug("exiting from saveforwardattachment function.");
}
开发者ID:hardikk,项目名称:HNH,代码行数:49,代码来源:Emails.php
示例17: DecodificaMensagem
public function DecodificaMensagem($Mensagem, $Codificacao)
{
switch ($Codificacao) {
case 0:
case 1:
$Mensagem = imap_8bit($Mensagem);
break;
case 2:
$Mensagem = imap_binary($Mensagem);
break;
case 3:
case 5:
case 6:
case 7:
$Mensagem = imap_base64($Mensagem);
break;
case 4:
$Mensagem = imap_qprint($Mensagem);
break;
}
return $Mensagem;
}
开发者ID:tricardo,项目名称:CartorioPostal_old,代码行数:22,代码来源:ChamadoDAO.php
示例18: initMailPart
protected function initMailPart(IncomingMail $mail, $partStructure, $partNum, $markAsSeen = true)
{
$options = FT_UID;
if (!$markAsSeen) {
$options |= FT_PEEK;
}
$data = $partNum ? imap_fetchbody($this->getImapStream(), $mail->id, $partNum, $options) : imap_body($this->getImapStream(), $mail->id, $options);
if ($partStructure->encoding == 1) {
$data = imap_utf8($data);
} elseif ($partStructure->encoding == 2) {
$data = imap_binary($data);
} elseif ($partStructure->encoding == 3) {
$data = preg_replace('~[^a-zA-Z0-9+=/]+~s', '', $data);
// https://github.com/barbushin/php-imap/issues/88
$data = imap_base64($data);
} elseif ($partStructure->encoding == 4) {
$data = quoted_printable_decode($data);
}
$params = array();
if (!empty($partStructure->parameters)) {
foreach ($partStructure->parameters as $param) {
$params[strtolower($param->attribute)] = $param->value;
}
}
if (!empty($partStructure->dparameters)) {
foreach ($partStructure->dparameters as $param) {
$paramName = strtolower(preg_match('~^(.*?)\\*~', $param->attribute, $matches) ? $matches[1] : $param->attribute);
if (isset($params[$paramName])) {
$params[$paramName] .= $param->value;
} else {
$params[$paramName] = $param->value;
}
}
}
// attachments
$attachmentId = $partStructure->ifid ? trim($partStructure->id, " <>") : (isset($params['filename']) || isset($params['name']) ? mt_rand() . mt_rand() : null);
if ($attachmentId) {
if (empty($params['filename']) && empty($params['name'])) {
$fileName = $attachmentId . '.' . strtolower($partStructure->subtype);
} else {
$fileName = !empty($params['filename']) ? $params['filename'] : $params['name'];
$fileName = $this->decodeMimeStr($fileName, $this->serverEncoding);
$fileName = $this->decodeRFC2231($fileName, $this->serverEncoding);
}
$attachment = new IncomingMailAttachment();
$attachment->id = $attachmentId;
$attachment->name = $fileName;
$attachment->disposition = isset($partStructure->disposition) ? $partStructure->disposition : null;
if ($this->attachmentsDir) {
$replace = array('/\\s/' => '_', '/[^0-9a-zа-яіїє_\\.]/iu' => '', '/_+/' => '_', '/(^_)|(_$)/' => '');
$fileSysName = preg_replace('~[\\\\/]~', '', $mail->id . '_' . $attachmentId . '_' . preg_replace(array_keys($replace), $replace, $fileName));
$attachment->filePath = $this->attachmentsDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . $fileSysName;
file_put_contents($attachment->filePath, $data);
}
$mail->addAttachment($attachment);
} else {
if (!empty($params['charset'])) {
$data = $this->convertStringEncoding($data, $params['charset'], $this->serverEncoding);
}
if ($partStructure->type == 0 && $data) {
if (strtolower($partStructure->subtype) == 'plain') {
$mail->textPlain .= $data;
} else {
$mail->textHtml .= $data;
}
} elseif ($partStructure->type == 2 && $data) {
$mail->textPlain .= trim($data);
}
}
if (!empty($partStructure->parts)) {
foreach ($partStructure->parts as $subPartNum => $subPartStructure) {
if ($partStructure->type == 2 && $partStructure->subtype == 'RFC822') {
$this->initMailPart($mail, $subPartStructure, $partNum, $markAsSeen);
} else {
$this->initMailPart($mail, $subPartStructure, $partNum . '.' . ($subPartNum + 1), $markAsSeen);
}
}
}
}
开发者ID:ladybirdweb,项目名称:momo-email-listener,代码行数:79,代码来源:Mailbox.php
示例19: decode
function decode($text, $encoding)
{
switch ($encoding) {
case 1:
$text = imap_8bit($text);
break;
case 2:
$text = imap_binary($text);
break;
case 3:
// imap_base64 implies strict mode. If it refuses to decode the
// data, then fallback to base64_decode in non-strict mode
$text = ($conv = imap_base64($text)) ? $conv : base64_decode($text);
break;
case 4:
$text = imap_qprint($text);
break;
}
return $text;
}
开发者ID:KM-MFG,项目名称:osTicket-1.8,代码行数:20,代码来源:class.mailfetch.php
示例20: decodeString
private function decodeString($string, $encoding)
{
switch ($encoding) {
case self::ENC_7BIT:
return $string;
case self::ENC_8BIT:
return quoted_printable_decode(imap_8bit($string));
case self::ENC_BINARY:
return imap_binary($string);
case self::ENC_BASE64:
return imap_base64($string);
case self::ENC_QUOTED_PRINTABLE:
return quoted_printable_decode($string);
case self::ENC_OTHER:
return $string;
default:
return $string;
}
}
开发者ID:zalazdi,项目名称:laravel-imap,代码行数:19,代码来源:Message.php
注:本文中的imap_base64函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论