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


PHP imap_base64函数代码示例

本文整理汇总了PHP中imap_base64函数的典型用法代码示例。如果您正苦于以下问题:PHP imap_base64函数的具体用法?PHP imap_base64怎么用?PHP imap_base64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了imap_base64函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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