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


PHP sqimap_run_command函数代码示例

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


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

示例1: getMessage_RFC822_Attachment

function getMessage_RFC822_Attachment($message, $composeMessage, $passed_id, $passed_ent_id = '', $imapConnection)
{
    global $attachments, $attachment_dir, $username, $data_dir, $uid_support;
    $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
    if (!$passed_ent_id) {
        $body_a = sqimap_run_command($imapConnection, 'FETCH ' . $passed_id . ' RFC822', TRUE, $response, $readmessage, $uid_support);
    } else {
        $body_a = sqimap_run_command($imapConnection, 'FETCH ' . $passed_id . ' BODY[' . $passed_ent_id . ']', TRUE, $response, $readmessage, $uid_support);
        $message = $message->parent;
    }
    if ($response == 'OK') {
        $subject = encodeHeader($message->rfc822_header->subject);
        array_shift($body_a);
        $body = implode('', $body_a) . "\r\n";
        $localfilename = GenerateRandomString(32, 'FILE', 7);
        $full_localfilename = "{$hashed_attachment_dir}/{$localfilename}";
        $fp = fopen($full_localfilename, 'w');
        fwrite($fp, $body);
        fclose($fp);
        /* dirty relative dir fix */
        if (substr($attachment_dir, 0, 3) == '../') {
            $attachment_dir = substr($attachment_dir, 3);
            $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
        }
        $full_localfilename = "{$hashed_attachment_dir}/{$localfilename}";
        $composeMessage->initAttachment('message/rfc822', 'email.txt', $full_localfilename);
    }
    return $composeMessage;
}
开发者ID:jprice,项目名称:EHCP,代码行数:29,代码来源:spamcop.php

示例2: attachSelectedMessages

function attachSelectedMessages($msg, $imapConnection)
{
    global $username, $attachment_dir, $startMessage, $data_dir, $composesession, $uid_support, $msgs, $thread_sort_messages, $allow_server_sort, $show_num, $compose_messages;
    if (!isset($compose_messages)) {
        $compose_messages = array();
        sqsession_register($compose_messages, 'compose_messages');
    }
    if (!$composesession) {
        $composesession = 1;
        sqsession_register($composesession, 'composesession');
    } else {
        $composesession++;
        sqsession_register($composesession, 'composesession');
    }
    $hashed_attachment_dir = getHashedDir($username, $attachment_dir, $composesession);
    if ($thread_sort_messages || $allow_server_sort) {
        $start_index = 0;
    } else {
        $start_index = ($startMessage - 1) * $show_num;
    }
    $i = 0;
    $j = 0;
    $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
    $composeMessage = new Message();
    $rfc822_header = new Rfc822Header();
    $composeMessage->rfc822_header = $rfc822_header;
    $composeMessage->reply_rfc822_header = '';
    while ($j < count($msg)) {
        if (isset($msg[$i])) {
            $id = $msg[$i];
            $body_a = sqimap_run_command($imapConnection, "FETCH {$id} RFC822", true, $response, $readmessage, $uid_support);
            if ($response == 'OK') {
                // fetch the subject for the message with $id from msgs.
                // is there a more efficient way to do this?
                foreach ($msgs as $k => $vals) {
                    if ($vals['ID'] == $id) {
                        $subject = $msgs[$k]['SUBJECT'];
                        break;
                    }
                }
                array_shift($body_a);
                array_pop($body_a);
                $body = implode('', $body_a);
                $body .= "\r\n";
                $localfilename = GenerateRandomString(32, 'FILE', 7);
                $full_localfilename = "{$hashed_attachment_dir}/{$localfilename}";
                $fp = fopen($full_localfilename, 'wb');
                fwrite($fp, $body);
                fclose($fp);
                $composeMessage->initAttachment('message/rfc822', $subject . '.msg', $full_localfilename);
            }
            $j++;
        }
        $i++;
    }
    $compose_messages[$composesession] = $composeMessage;
    sqsession_register($compose_messages, 'compose_messages');
    session_write_close();
    return $composesession;
}
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:60,代码来源:move_messages.php

示例3: parse_viewheader

function parse_viewheader($imapConnection, $id, $passed_ent_id)
{
    $header_output = array();
    $second = array();
    $first = array();
    if (!$passed_ent_id) {
        $read = sqimap_run_command($imapConnection, "FETCH {$id} BODY[HEADER]", true, $a, $b, TRUE);
    } else {
        $query = "FETCH {$id} BODY[" . $passed_ent_id . '.HEADER]';
        $read = sqimap_run_command($imapConnection, $query, true, $a, $b, TRUE);
    }
    $cnum = 0;
    for ($i = 1; $i < count($read); $i++) {
        $line = sm_encode_html_special_chars($read[$i]);
        switch (true) {
            case preg_match('/^&gt;/i', $line):
                $second[$i] = $line;
                $first[$i] = '&nbsp;';
                $cnum++;
                break;
                // FIXME: is the pipe character below a mistake?  I think the original author might have thought it carried special meaning in the character class, which it does not... but then again, I am not currently trying to understand what this code actually does
            // FIXME: is the pipe character below a mistake?  I think the original author might have thought it carried special meaning in the character class, which it does not... but then again, I am not currently trying to understand what this code actually does
            case preg_match('/^[ |\\t]/', $line):
                $second[$i] = $line;
                $first[$i] = '';
                break;
            case preg_match('/^([^:]+):(.+)/', $line, $regs):
                $first[$i] = $regs[1] . ':';
                $second[$i] = $regs[2];
                $cnum++;
                break;
            default:
                $second[$i] = trim($line);
                $first[$i] = '';
                break;
        }
    }
    for ($i = 0; $i < count($second); $i = $j) {
        $f = isset($first[$i]) ? $first[$i] : '';
        $s = isset($second[$i]) ? nl2br($second[$i]) : '';
        $j = $i + 1;
        while ($first[$j] == '' && $j < count($first)) {
            $s .= '&nbsp;&nbsp;&nbsp;&nbsp;' . nl2br($second[$j]);
            $j++;
        }
        $lowf = strtolower($f);
        /* do not mark these headers as emailaddresses */
        if ($lowf != 'message-id:' && $lowf != 'in-reply-to:' && $lowf != 'references:') {
            parseEmail($s);
        }
        if ($f) {
            $header_output[] = array($f, $s);
        }
    }
    sqimap_logout($imapConnection);
    return $header_output;
}
开发者ID:teammember8,项目名称:roundcube,代码行数:57,代码来源:view_header.php

示例4: parse_viewheader

function parse_viewheader($imapConnection, $id, $passed_ent_id)
{
    global $uid_support;
    $header_full = array();
    $header_output = array();
    $second = array();
    $first = array();
    if (!$passed_ent_id) {
        $read = sqimap_run_command($imapConnection, "FETCH {$id} BODY[HEADER]", true, $a, $b, $uid_support);
    } else {
        $query = "FETCH {$id} BODY[" . $passed_ent_id . '.HEADER]';
        $read = sqimap_run_command($imapConnection, $query, true, $a, $b, $uid_support);
    }
    $cnum = 0;
    for ($i = 1; $i < count($read); $i++) {
        $line = htmlspecialchars($read[$i]);
        switch (true) {
            case eregi("^&gt;", $line):
                $second[$i] = $line;
                $first[$i] = '&nbsp;';
                $cnum++;
                break;
            case eregi("^[ |\t]", $line):
                $second[$i] = $line;
                $first[$i] = '';
                break;
            case eregi("^([^:]+):(.+)", $line, $regs):
                $first[$i] = $regs[1] . ':';
                $second[$i] = $regs[2];
                $cnum++;
                break;
            default:
                $second[$i] = trim($line);
                $first[$i] = '';
                break;
        }
    }
    for ($i = 0; $i < count($second); $i = $j) {
        $f = isset($first[$i]) ? $first[$i] : '';
        $s = isset($second[$i]) ? nl2br($second[$i]) : '';
        $j = $i + 1;
        while ($first[$j] == '' && $j < count($first)) {
            $s .= '&nbsp;&nbsp;&nbsp;&nbsp;' . nl2br($second[$j]);
            $j++;
        }
        $lowf = strtolower($f);
        /* do not mark these headers as emailaddresses */
        if ($lowf != 'message-id:' && $lowf != 'in-reply-to:' && $lowf != 'references:') {
            parseEmail($s);
        }
        if ($f) {
            $header_output[] = array($f, $s);
        }
    }
    return $header_output;
}
开发者ID:jin255ff,项目名称:company_website,代码行数:56,代码来源:view_header.php

示例5: sqimap_mailbox_tree

function sqimap_mailbox_tree($imap_stream)
{
    global $default_folder_prefix, $unseen_notify, $unseen_type;
    if (true) {
        global $data_dir, $username, $list_special_folders_first, $folder_prefix, $delimiter, $trash_folder, $move_to_trash, $imap_server_type;
        $inbox_in_list = false;
        $inbox_subscribed = false;
        $noselect = false;
        $noinferiors = false;
        require_once SM_PATH . 'include/load_prefs.php';
        /* LSUB array */
        $lsub_ary = sqimap_run_command($imap_stream, "LSUB \"{$folder_prefix}\" \"*\"", true, $response, $message);
        $lsub_ary = compact_mailboxes_response($lsub_ary);
        /* Check to see if we have an INBOX */
        $has_inbox = false;
        for ($i = 0, $cnt = count($lsub_ary); $i < $cnt; $i++) {
            if (preg_match("/^\\*\\s+LSUB.*\\s\"?INBOX\"?[^(\\/\\.)].*\$/i", $lsub_ary[$i])) {
                $lsub_ary[$i] = strtoupper($lsub_ary[$i]);
                // in case of an unsubscribed inbox an imap server can
                // return the inbox in the lsub results with a \NoSelect
                // flag.
                if (!preg_match("/\\*\\s+LSUB\\s+\\(.*\\\\NoSelect.*\\).*/i", $lsub_ary[$i])) {
                    $has_inbox = true;
                } else {
                    // remove the result and request it again  with a list
                    // response at a later stage.
                    unset($lsub_ary[$i]);
                    // re-index the array otherwise the addition of the LIST
                    // response will fail in PHP 4.1.2 and probably other older versions
                    $lsub_ary = array_values($lsub_ary);
                }
                break;
            }
        }
        if ($has_inbox == false) {
            // do a list request for inbox because we should always show
            // inbox even if the user isn't subscribed to it.
            $inbox_ary = sqimap_run_command($imap_stream, 'LIST "" INBOX', true, $response, $message);
            $inbox_ary = compact_mailboxes_response($inbox_ary);
            if (count($inbox_ary)) {
                $lsub_ary[] = $inbox_ary[0];
            }
        }
        /*
         * Section about removing the last element was removed
         * We don't return "* OK" anymore from sqimap_read_data
         */
        $sorted_lsub_ary = array();
        $cnt = count($lsub_ary);
        for ($i = 0; $i < $cnt; $i++) {
            $mbx = find_mailbox_name($lsub_ary[$i]);
            // only do the noselect test if !uw, is checked later. FIX ME see conf.pl setting
            if ($imap_server_type != "uw") {
                $noselect = check_is_noselect($lsub_ary[$i]);
                $noinferiors = check_is_noinferiors($lsub_ary[$i]);
            }
            if (substr($mbx, -1) == $delimiter) {
                $mbx = substr($mbx, 0, strlen($mbx) - 1);
            }
            $sorted_lsub_ary[] = array('mbx' => $mbx, 'noselect' => $noselect, 'noinferiors' => $noinferiors);
        }
        // FIX ME this requires a config setting inside conf.pl instead of checking on server type
        if ($imap_server_type == "uw") {
            $aQuery = array();
            $aTag = array();
            // prepare an array with queries
            foreach ($sorted_lsub_ary as $aMbx) {
                $mbx = stripslashes($aMbx['mbx']);
                sqimap_prepare_pipelined_query('LIST "" ' . sqimap_encode_mailbox_name($mbx), $tag, $aQuery, false);
                $aTag[$tag] = $mbx;
            }
            $sorted_lsub_ary = array();
            // execute all the queries at once
            $aResponse = sqimap_run_pipelined_command($imap_stream, $aQuery, false, $aServerResponse, $aServerMessage);
            foreach ($aTag as $tag => $mbx) {
                if ($aServerResponse[$tag] == 'OK') {
                    $sResponse = implode('', $aResponse[$tag]);
                    $noselect = check_is_noselect($sResponse);
                    $noinferiors = check_is_noinferiors($sResponse);
                    $sorted_lsub_ary[] = array('mbx' => $mbx, 'noselect' => $noselect, 'noinferiors' => $noinferiors);
                }
            }
            $cnt = count($sorted_lsub_ary);
        }
        $sorted_lsub_ary = array_values($sorted_lsub_ary);
        usort($sorted_lsub_ary, 'mbxSort');
        $boxestree = sqimap_fill_mailbox_tree($sorted_lsub_ary, false, $imap_stream);
        return $boxestree;
    }
}
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:90,代码来源:imap_mailbox.php

示例6: sqimap_toggle_flag

function sqimap_toggle_flag($imap_stream, $id, $flag, $set, $handle_errors)
{
    global $uid_support;
    $msgs_id = sqimap_message_list_squisher($id);
    $set_string = $set ? '+' : '-';
    $read = sqimap_run_command($imap_stream, "STORE {$msgs_id} " . $set_string . "FLAGS ({$flag})", $handle_errors, $response, $message, $uid_support);
}
开发者ID:jprice,项目名称:EHCP,代码行数:7,代码来源:imap_messages.php

示例7: attachSelectedMessages

/**
 * Attach messages to a compose session
 *
 * @param  resource $imapConnection imap connection
 * @param  array $aMsgHeaders
 * @return int $composesession unique compose_session_id where the attached messages belong to
 * @author Marc Groot Koerkamp
 */
function attachSelectedMessages($imapConnection, $aMsgHeaders)
{
    sqgetGlobalVar('composesession', $composesession, SQ_SESSION);
    sqgetGlobalVar('compose_messages', $compose_messages, SQ_SESSION);
    if (!isset($compose_messages) || is_null($compose_messages)) {
        $compose_messages = array();
        sqsession_register($compose_messages, 'compose_messages');
    }
    if (!$composesession) {
        $composesession = 1;
        sqsession_register($composesession, 'composesession');
    } else {
        $composesession++;
        sqsession_register($composesession, 'composesession');
    }
    $composeMessage = new Message();
    $rfc822_header = new Rfc822Header();
    $composeMessage->rfc822_header = $rfc822_header;
    $composeMessage->reply_rfc822_header = '';
    foreach ($aMsgHeaders as $iUid => $aMsgHeader) {
        /**
         * Retrieve the full message
         */
        $body_a = sqimap_run_command($imapConnection, "FETCH {$iUid} RFC822", true, $response, $readmessage, TRUE);
        if ($response == 'OK') {
            $subject = isset($aMsgHeader['subject']) ? $aMsgHeader['subject'] : $iUid;
            array_shift($body_a);
            array_pop($body_a);
            $body = implode('', $body_a);
            $body .= "\r\n";
            global $username, $attachment_dir;
            $filename = sq_get_attach_tempfile();
            $fullpath = getHashedDir($username, $attachment_dir) . '/' . $filename;
            $fp = fopen($fullpath, 'wb');
            fwrite($fp, $body);
            fclose($fp);
            $composeMessage->initAttachment('message/rfc822', $subject . '.eml', $filename);
            // create subject for new message
            //
            $subject = decodeHeader($subject, false, false, true);
            $subject = str_replace('"', "'", $subject);
            $subject = trim($subject);
            if (substr(strtolower($subject), 0, 4) != 'fwd:') {
                $subject = 'Fwd: ' . $subject;
            }
            $composeMessage->rfc822_header->subject = $subject;
        }
    }
    $compose_messages[$composesession] = $composeMessage;
    sqsession_register($compose_messages, 'compose_messages');
    return $composesession;
}
开发者ID:teammember8,项目名称:roundcube,代码行数:60,代码来源:mailbox_display.php

示例8: spam_filters

/**
 * FIXME: Undocumented function
 * @access private
 */
function spam_filters($imap_stream)
{
    global $data_dir, $username, $uid_support;
    global $SpamFilters_YourHop;
    global $SpamFilters_DNScache;
    global $SpamFilters_SharedCache;
    global $SpamFilters_BulkQuery;
    $filters_spam_scan = getPref($data_dir, $username, 'filters_spam_scan');
    $filters_spam_folder = getPref($data_dir, $username, 'filters_spam_folder');
    $filters = load_spam_filters();
    if ($SpamFilters_SharedCache) {
        filters_LoadCache();
    }
    $run = 0;
    foreach ($filters as $Key => $Value) {
        if ($Value['enabled']) {
            $run++;
        }
    }
    // short-circuit
    if ($run == 0) {
        return;
    }
    sqimap_mailbox_select($imap_stream, 'INBOX');
    // Ask for a big list of all "Received" headers in the inbox with
    // flags for each message.  Kinda big.
    if ($filters_spam_scan != 'new') {
        $read = sqimap_run_command($imap_stream, 'FETCH 1:* (FLAGS BODY.PEEK[HEADER.FIELDS ' . '(RECEIVED)])', true, $response, $message, $uid_support);
    } else {
        $read = sqimap_run_command($imap_stream, 'SEARCH UNSEEN', true, $response, $message, $uid_support);
        if ($response != 'OK' || trim($read[0]) == '* SEARCH') {
            $read = sqimap_run_command($imap_stream, 'FETCH 1:* (FLAGS BODY.PEEK[HEADER.FIELDS ' . '(RECEIVED)])', true, $response, $message, $uid_support);
        } else {
            if (isset($read[0])) {
                if (preg_match("/^\\* SEARCH (.+)\$/", $read[0], $regs)) {
                    $search_array = preg_split("/ /", trim($regs[1]));
                }
            }
            $msgs_str = sqimap_message_list_squisher($search_array);
            $imap_query = 'FETCH ' . $msgs_str;
            $imap_query .= ' (FLAGS BODY.PEEK[HEADER.FIELDS ';
            $imap_query .= '(RECEIVED)])';
            $read = sqimap_run_command($imap_stream, $imap_query, true, $response, $message, $uid_support);
        }
    }
    if (isset($response) && $response != 'OK') {
        return;
    }
    if (strlen($SpamFilters_BulkQuery) > 0) {
        filters_bulkquery($filters_spam_scan, $filters, $read);
    }
    $i = 0;
    while ($i < count($read)) {
        // EIMS will give funky results
        $Chunks = explode(' ', $read[$i]);
        if ($Chunks[0] != '*') {
            $i++;
            continue;
        }
        $MsgNum = $Chunks[1];
        $IPs = array();
        $i++;
        $IsSpam = 0;
        // Look through all of the Received headers for IP addresses
        // Stop when I get ")" on a line
        // Stop if I get "*" on a line (don't advance)
        // and above all, stop if $i is bigger than the total # of lines
        while ($i < count($read) && ($read[$i][0] != ')' && $read[$i][0] != '*' && $read[$i][0] != "\n") && !$IsSpam) {
            // Check to see if this line is the right "Received from" line
            // to check
            if (is_int(strpos($read[$i], $SpamFilters_YourHop))) {
                // short-circuit and skip work if we don't scan this one
                $read[$i] = ereg_replace('[^0-9\\.]', ' ', $read[$i]);
                $elements = explode(' ', $read[$i]);
                foreach ($elements as $value) {
                    if ($value != '' && ereg('[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}', $value, $regs)) {
                        $Chunks = explode('.', $value);
                        if (filters_spam_check_site($Chunks[0], $Chunks[1], $Chunks[2], $Chunks[3], $filters)) {
                            $IsSpam++;
                            break;
                            // no sense in checking more IPs
                        }
                        // If we've checked one IP and YourHop is
                        // just a space
                        if ($SpamFilters_YourHop == ' ') {
                            break;
                            // don't check any more
                        }
                    }
                }
            }
            $i++;
        }
        // Lookie!  It's spam!  Yum!
        if ($IsSpam) {
            if (sqimap_mailbox_exists($imap_stream, $filters_spam_folder)) {
//.........这里部分代码省略.........
开发者ID:jin255ff,项目名称:company_website,代码行数:101,代码来源:filters.php

示例9: sqimap_get_mailboxes

/**
 * Gets the list of mailboxes for sqimap_maolbox_tree and sqimap_mailbox_list
 *
 * This is because both of those functions had duplicated logic, but with slightly different
 * implementations. This will make both use the same implementation, which should make it
 * easier to maintain and easier to modify in the future
 * @param stream $imap_stream imap connection resource
 * @param bool $force force a reload and ignore cache
 * @param bool $show_only_subscribed controls listing of visible or all folders
 * @param bool $session_register controls registration of retrieved data in session.
 * @return object boxesnew - array of mailboxes and their attributes
 * @since 1.5.1
 */
function sqimap_get_mailboxes($imap_stream, $force = false, $show_only_subscribed = true, $session_register = true)
{
    global $show_only_subscribed_folders, $noselect_fix_enable, $folder_prefix, $list_special_folders_first, $imap_server_type;
    $inbox_subscribed = false;
    $listsubscribed = sqimap_capability($imap_stream, 'LIST-SUBSCRIBED');
    if ($show_only_subscribed) {
        $show_only_subscribed = $show_only_subscribed_folders;
    }
    //require_once(SM_PATH . 'include/load_prefs.php');
    /**
     * There are three main listing commands we can use in IMAP:
     * LSUB        shows just the list of subscribed folders
     *            may include flags, but these are not necessarily accurate or authoratative
     *            \NoSelect has special meaning: the folder does not exist -OR- it means this
     *            folder is not subscribed but children may be
     *            [RFC-2060]
     * LIST        this shows every mailbox on the system
     *            flags are always included and are accurate and authoratative
     *            \NoSelect means folder should not be selected
     *            [RFC-2060]
     * LIST (SUBSCRIBED)    implemented with LIST-SUBSCRIBED extension
     *            this is like list but returns only subscribed folders
     *            flag meanings are like LIST, not LSUB
     *            \NonExistent means mailbox doesn't exist
     *            \PlaceHolder means parent is not valid (selectable), but one or more children are
     *            \NoSelect indeed means that the folder should not be selected
     *            IMAPEXT-LIST-EXTENSIONS-04 August 2003 B. Leiba
     */
    if (!$show_only_subscribed) {
        $lsub = 'LIST';
        $sub_cache_name = 'list_cache';
    } elseif ($listsubscribed) {
        $lsub = 'LIST (SUBSCRIBED)';
        $sub_cache_name = 'listsub_cache';
    } else {
        $lsub = 'LSUB';
        $sub_cache_name = 'lsub_cache';
    }
    // Some IMAP servers allow subfolders to exist even if the parent folders do not
    // This fixes some problems with the folder list when this is the case, causing the
    // NoSelect folders to be displayed
    if ($noselect_fix_enable) {
        $lsub_args = "{$lsub} \"{$folder_prefix}\" \"*%\"";
        $list_args = "LIST \"{$folder_prefix}\" \"*%\"";
    } else {
        $lsub_args = "{$lsub} \"{$folder_prefix}\" \"*\"";
        $list_args = "LIST \"{$folder_prefix}\" \"*\"";
    }
    // get subscribed mailbox list from cache (session)
    // if not there, then get it from the imap server and store in cache
    if (!$force) {
        sqgetGlobalVar($sub_cache_name, $lsub_cache, SQ_SESSION);
    }
    $lsub_assoc_ary = array();
    if (!empty($lsub_cache)) {
        $lsub_assoc_ary = $lsub_cache;
    } else {
        $lsub_ary = sqimap_run_command($imap_stream, $lsub_args, true, $response, $message);
        $lsub_ary = compact_mailboxes_response($lsub_ary);
        if (!empty($lsub_ary)) {
            foreach ($lsub_ary as $rawline) {
                $temp_mailbox_name = find_mailbox_name($rawline);
                $lsub_assoc_ary[$temp_mailbox_name] = $rawline;
            }
            unset($lsub_ary);
            sqsession_register($lsub_assoc_ary, $sub_cache_name);
        }
    }
    // Now to get the mailbox flags
    // The LSUB response may return \NoSelect flags, etc. but it is optional
    // according to RFC3501, and even when returned it may not be accurate
    // or authoratative. LIST will always return accurate results.
    if ($lsub == 'LIST' || $lsub == 'LIST (SUBSCRIBED)') {
        // we've already done a LIST or LIST (SUBSCRIBED)
        // and NOT a LSUB, so no need to do it again
        $list_assoc_ary = $lsub_assoc_ary;
    } else {
        // we did a LSUB so now we need to do a LIST
        // first see if it is in cache
        $list_cache_name = 'list_cache';
        if (!$force) {
            sqgetGlobalVar($list_cache_name, $list_cache, SQ_SESSION);
        }
        if (!empty($list_cache)) {
            $list_assoc_ary = $list_cache;
            // we could store this in list_cache_name but not necessary
        } else {
//.........这里部分代码省略.........
开发者ID:teammember8,项目名称:roundcube,代码行数:101,代码来源:imap_mailbox.php

示例10: getMessage_RFC822_Attachment

function getMessage_RFC822_Attachment($message, $composeMessage, $passed_id, $passed_ent_id = '', $imapConnection)
{
    if (!$passed_ent_id) {
        $body_a = sqimap_run_command($imapConnection, 'FETCH ' . $passed_id . ' RFC822', TRUE, $response, $readmessage, TRUE);
    } else {
        $body_a = sqimap_run_command($imapConnection, 'FETCH ' . $passed_id . ' BODY[' . $passed_ent_id . ']', TRUE, $response, $readmessage, TRUE);
        $message = $message->parent;
    }
    if ($response == 'OK') {
        $subject = encodeHeader($message->rfc822_header->subject);
        array_shift($body_a);
        array_pop($body_a);
        $body = implode('', $body_a) . "\r\n";
        global $username, $attachment_dir;
        $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
        $localfilename = sq_get_attach_tempfile();
        $fp = fopen($hashed_attachment_dir . '/' . $localfilename, 'wb');
        fwrite($fp, $body);
        fclose($fp);
        $composeMessage->initAttachment('message/rfc822', $subject . '.eml', $localfilename);
    }
    return $composeMessage;
}
开发者ID:teammember8,项目名称:roundcube,代码行数:23,代码来源:compose.php

示例11: sqimap_get_mime_ent_header

function sqimap_get_mime_ent_header($imap_stream, $id, $mailbox, $ent)
{
    global $uid_support;
    $read = sqimap_run_command($imap_stream, "FETCH {$id}:{$id} BODY[{$ent}.MIME]", true, $response, $message, $uid_support);
    $header = sqimap_get_header($imap_stream, $read);
    $header->id = $id;
    $header->mailbox = $mailbox;
    return $header;
}
开发者ID:innomatic-libs,项目名称:squirrelmaillib,代码行数:9,代码来源:imap_messages.php

示例12: attachSelectedMessages

function attachSelectedMessages($imapConnection, $aMsgHeaders)
{
    global $username, $attachment_dir, $data_dir, $composesession, $compose_messages;
    if (!isset($compose_messages)) {
        $compose_messages = array();
        sqsession_register($compose_messages, 'compose_messages');
    }
    if (!$composesession) {
        $composesession = 1;
        sqsession_register($composesession, 'composesession');
    } else {
        $composesession++;
        sqsession_register($composesession, 'composesession');
    }
    $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
    $composeMessage = new Message();
    $rfc822_header = new Rfc822Header();
    $composeMessage->rfc822_header = $rfc822_header;
    $composeMessage->reply_rfc822_header = '';
    foreach ($aMsgHeaders as $iUid => $aMsgHeader) {
        /**
         * Retrieve the full message
         */
        $body_a = sqimap_run_command($imapConnection, "FETCH {$iUid} RFC822", true, $response, $readmessage, TRUE);
        if ($response == 'OK') {
            $subject = isset($aMsgHeader['SUBJECT']) ? $aMsgHeader['SUBJECT'] : $iUid;
            array_shift($body_a);
            array_pop($body_a);
            $body = implode('', $body_a);
            $body .= "\r\n";
            $localfilename = GenerateRandomString(32, 'FILE', 7);
            $full_localfilename = "{$hashed_attachment_dir}/{$localfilename}";
            $fp = fopen($full_localfilename, 'wb');
            fwrite($fp, $body);
            fclose($fp);
            $composeMessage->initAttachment('message/rfc822', $subject . '.msg', $full_localfilename);
        }
    }
    $compose_messages[$composesession] = $composeMessage;
    sqsession_register($compose_messages, 'compose_messages');
    return $composesession;
}
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:42,代码来源:mailbox_display.php

示例13: attachSelectedMessages

function attachSelectedMessages($msg, $imapConnection)
{
    global $username, $attachment_dir, $startMessage, $data_dir, $composesession, $uid_support, $mailbox, $msgs, $thread_sort_messages, $allow_server_sort, $show_num, $compose_messages;
    if (!isset($compose_messages)) {
        $compose_messages = array();
        sqsession_register($compose_messages, 'compose_messages');
    }
    if (!$composesession) {
        $composesession = 1;
        sqsession_register($composesession, 'composesession');
    } else {
        $composesession++;
        sqsession_register($composesession, 'composesession');
    }
    $hashed_attachment_dir = getHashedDir($username, $attachment_dir, $composesession);
    if ($thread_sort_messages || $allow_server_sort) {
        $start_index = 0;
    } else {
        $start_index = ($startMessage - 1) * $show_num;
    }
    $i = 0;
    $j = 0;
    $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
    $composeMessage = new Message();
    $rfc822_header = new Rfc822Header();
    $composeMessage->rfc822_header = $rfc822_header;
    $composeMessage->reply_rfc822_header = '';
    while ($j < count($msg)) {
        if (isset($msg[$i])) {
            $id = $msg[$i];
            $body_a = sqimap_run_command($imapConnection, "FETCH {$id} RFC822", true, $response, $readmessage, $uid_support);
            if ($response == 'OK') {
                $message = sqimap_get_message($imapConnection, $id, $mailbox);
                // fetch the subject for the message from the object
                $filename = $message->rfc822_header->subject;
                if (empty($filename)) {
                    $filename = "untitled-" . $message->entity_id;
                }
                $filename .= '.msg';
                $filename = decodeHeader($filename, false, false);
                array_shift($body_a);
                array_pop($body_a);
                $body = implode('', $body_a);
                $body .= "\r\n";
                $localfilename = GenerateRandomString(32, 'FILE', 7);
                $full_localfilename = "{$hashed_attachment_dir}/{$localfilename}";
                while (file_exists($full_localfilename)) {
                    $localfilename = GenerateRandomString(32, 'FILE', 7);
                    $full_localfilename = "{$hashed_attachment_dir}/{$localfilename}";
                }
                $fp = fopen($full_localfilename, 'wb');
                fwrite($fp, $body);
                fclose($fp);
                $composeMessage->initAttachment('message/rfc822', $filename, $localfilename);
            }
            $j++;
        }
        $i++;
    }
    $compose_messages[$composesession] = $composeMessage;
    sqsession_register($compose_messages, 'compose_messages');
    session_write_close();
    return $composesession;
}
开发者ID:jprice,项目名称:EHCP,代码行数:64,代码来源:move_messages.php

示例14: mime_print_body_lines

function mime_print_body_lines($imap_stream, $id, $ent_id = 1, $encoding)
{
    /* Don't kill the connection if the browser is over a dialup
     * and it would take over 30 seconds to download it.
     * Don't call set_time_limit in safe mode.
     */
    if (!ini_get('safe_mode')) {
        set_time_limit(0);
    }
    /* in case of base64 encoded attachments, do not buffer them.
       Instead, echo the decoded attachment directly to screen */
    if (strtolower($encoding) == 'base64') {
        if (!$ent_id) {
            $query = "FETCH {$id} BODY[]";
        } else {
            $query = "FETCH {$id} BODY[{$ent_id}]";
        }
        sqimap_run_command($imap_stream, $query, true, $response, $message, TRUE, 'sqimap_base64_decode', 'php://stdout', true);
    } else {
        $body = mime_fetch_body($imap_stream, $id, $ent_id);
        echo decodeBody($body, $encoding);
    }
    /*
       TODO, use the same method for quoted printable.
       However, I assume that quoted printable attachments aren't that large
       so the performancegain / memory usage drop will be minimal.
       If we decide to add that then we need to adapt sqimap_fread because
       we need to split te result on \n and fread doesn't stop at \n. That
       means we also should provide $results from sqimap_fread (by ref) to
       te function and set $no_return to false. The $filter function for
       quoted printable should handle unsetting of $results.
    */
    /*
       TODO 2: find out how we write to the output stream php://stdout. fwrite
       doesn't work because 'php://stdout isn't a stream.
    */
    return;
    /*
        fputs ($imap_stream, "$sid FETCH $id BODY[$ent_id]\r\n");
        $cnt = 0;
        $continue = true;
        $read = fgets ($imap_stream,8192);
    
    
        // This could be bad -- if the section has sqimap_session_id() . ' OK'
        // or similar, it will kill the download.
        while (!ereg("^".$sid_s." (OK|BAD|NO)(.*)$", $read, $regs)) {
            if (trim($read) == ')==') {
                $read1 = $read;
                $read = fgets ($imap_stream,4096);
                if (ereg("^".$sid." (OK|BAD|NO)(.*)$", $read, $regs)) {
                    return;
                } else {
                    echo decodeBody($read1, $encoding) .
                         decodeBody($read, $encoding);
                }
            } else if ($cnt) {
                echo decodeBody($read, $encoding);
            }
            $read = fgets ($imap_stream,4096);
            $cnt++;
    //      break;
        }
    */
}
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:65,代码来源:mime.php

示例15: sqimap_messages_flag

/**
 * Deprecated !!!!!!! DO NOT USE THIS, use sqimap_toggle_flag instead
 * Set a flag on the provided uid list
 * @param  resource imap connection
 */
function sqimap_messages_flag($imap_stream, $start, $end, $flag, $handle_errors)
{
    $read = sqimap_run_command($imap_stream, "STORE {$start}:{$end} +FLAGS (\\{$flag})", $handle_errors, $response, $message, TRUE);
}
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:9,代码来源:imap_messages.php


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