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


PHP sqimap_logout函数代码示例

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


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

示例1: 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

示例2: parse_viewheader

function parse_viewheader($imapConnection, $id, $passed_ent_id)
{
    $header_full = 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 = 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);
        }
    }
    sqimap_logout($imapConnection);
    return $header_output;
}
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:53,代码来源:view_header.php

示例3: sent_subfolders_update_sentfolder

/**
 * Update sent_subfolders settings
 *
 * function updates default sent folder value and 
 * creates required imap folders
 */
function sent_subfolders_update_sentfolder()
{
    global $sent_folder, $auto_create_special, $auto_create_done;
    global $sent_subfolders_base, $sent_subfolders_setting;
    global $data_dir, $imapServerAddress, $imapPort;
    global $use_sent_subfolders, $move_to_sent, $imap_server_type;
    sqgetGlobalVar('username', $username, SQ_SESSION);
    sqgetGlobalVar('key', $key, SQ_COOKIE);
    sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
    if ($use_sent_subfolders || $move_to_sent) {
        $year = date('Y');
        $month = date('m');
        $quarter = sent_subfolder_getQuarter($month);
        /*
            Regarding the structure we've got three main possibilities.
            One sent holder. level 0.
            Multiple year holders with messages in it. level 1.
            Multiple year folders with holders in it. level 2.
        */
        /*
                if( $imap_server_type == 'uw' ) {
                    $cnd_delimiter = '';
                } else {
                    $cnd_delimiter = $delimiter;
                }
        */
        $cnd_delimiter = $delimiter;
        switch ($sent_subfolders_setting) {
            case SMPREF_SENT_SUBFOLDERS_YEARLY:
                $level = 1;
                $sent_subfolder = $sent_subfolders_base . $cnd_delimiter . $year;
                break;
            case SMPREF_SENT_SUBFOLDERS_QUARTERLY:
                $level = 2;
                $sent_subfolder = $sent_subfolders_base . $cnd_delimiter . $year . $delimiter . $quarter;
                $year_folder = $sent_subfolders_base . $year;
                break;
            case SMPREF_SENT_SUBFOLDERS_MONTHLY:
                $level = 2;
                $sent_subfolder = $sent_subfolders_base . $cnd_delimiter . $year . $delimiter . $month;
                $year_folder = $sent_subfolders_base . $year;
                break;
            case SMPREF_SENT_SUBFOLDERS_DISABLED:
            default:
                $level = 0;
                $sent_subfolder = $sent_folder;
                $year_folder = $sent_folder;
        }
        /* If this folder is NOT the current sent folder, update stuff. */
        if ($sent_subfolder != $sent_folder) {
            /* First, update the sent folder. */
            setPref($data_dir, $username, 'sent_folder', $sent_subfolder);
            setPref($data_dir, $username, 'move_to_sent', SMPREF_ON);
            $sent_folder = $sent_subfolder;
            $move_to_sent = SMPREF_ON;
            /* Auto-create folders, if they do not yet exist. */
            if ($sent_folder != 'none') {
                /* Create the imap connection. */
                $ic = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10);
                /* Auto-create the year folder, if it does not yet exist. */
                if (!sqimap_mailbox_exists($ic, $year_folder)) {
                    sqimap_mailbox_create($ic, $year_folder, $level == 1 ? '' : 'noselect');
                } else {
                    if (!sqimap_mailbox_is_subscribed($ic, $year_folder)) {
                        sqimap_subscribe($ic, $year_folder);
                    }
                }
                /* Auto-create the subfolder, if it does not yet exist. */
                if (!sqimap_mailbox_exists($ic, $sent_folder)) {
                    sqimap_mailbox_create($ic, $sent_folder, '');
                } else {
                    if (!sqimap_mailbox_is_subscribed($ic, $sent_subfolder)) {
                        sqimap_subscribe($ic, $sent_subfolder);
                    }
                }
                /* Close the imap connection. */
                sqimap_logout($ic);
            }
        }
    }
}
开发者ID:jin255ff,项目名称:company_website,代码行数:87,代码来源:setup.php

示例4: deliverMessage


//.........这里部分代码省略.........
            $rfc822_header->encoding = '8bit';
        }
        if ($default_charset) {
            $content_type->properties['charset'] = $default_charset;
        }
    }
    $rfc822_header->content_type = $content_type;
    $composeMessage->rfc822_header = $rfc822_header;
    /* Here you can modify the message structure just before we hand
       it over to deliver */
    $hookReturn = do_hook('compose_send', $composeMessage);
    /* Get any changes made by plugins to $composeMessage. */
    if (is_object($hookReturn[1])) {
        $composeMessage = $hookReturn[1];
    }
    if (!$useSendmail && !$draft) {
        require_once SM_PATH . 'class/deliver/Deliver_SMTP.class.php';
        $deliver = new Deliver_SMTP();
        global $smtpServerAddress, $smtpPort, $pop_before_smtp, $smtp_auth_mech;
        $authPop = isset($pop_before_smtp) && $pop_before_smtp ? true : false;
        get_smtp_user($user, $pass);
        $stream = $deliver->initStream($composeMessage, $domain, 0, $smtpServerAddress, $smtpPort, $user, $pass, $authPop);
    } elseif (!$draft) {
        require_once SM_PATH . 'class/deliver/Deliver_SendMail.class.php';
        global $sendmail_path;
        $deliver = new Deliver_SendMail();
        $stream = $deliver->initStream($composeMessage, $sendmail_path);
    } elseif ($draft) {
        global $draft_folder;
        require_once SM_PATH . 'class/deliver/Deliver_IMAP.class.php';
        $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
        if (sqimap_mailbox_exists($imap_stream, $draft_folder)) {
            require_once SM_PATH . 'class/deliver/Deliver_IMAP.class.php';
            $imap_deliver = new Deliver_IMAP();
            $length = $imap_deliver->mail($composeMessage);
            sqimap_append($imap_stream, $draft_folder, $length);
            $imap_deliver->mail($composeMessage, $imap_stream);
            sqimap_append_done($imap_stream, $draft_folder);
            sqimap_logout($imap_stream);
            unset($imap_deliver);
            return $length;
        } else {
            $msg = '<br />' . sprintf(_("Error: Draft folder %s does not exist."), $draft_folder);
            plain_error_message($msg, $color);
            return false;
        }
    }
    $succes = false;
    if ($stream) {
        $length = $deliver->mail($composeMessage, $stream);
        $succes = $deliver->finalizeStream($stream);
    }
    if (!$succes) {
        $msg = $deliver->dlv_msg . '<br />' . _("Server replied: ") . $deliver->dlv_ret_nr . ' ' . $deliver->dlv_server_msg;
        plain_error_message($msg, $color);
    } else {
        unset($deliver);
        $move_to_sent = getPref($data_dir, $username, 'move_to_sent');
        $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
        /* Move to sent code */
        if (isset($default_move_to_sent) && $default_move_to_sent != 0) {
            $svr_allow_sent = true;
        } else {
            $svr_allow_sent = false;
        }
        if (isset($sent_folder) && ($sent_folder != '' || $sent_folder != 'none') && sqimap_mailbox_exists($imap_stream, $sent_folder)) {
            $fld_sent = true;
        } else {
            $fld_sent = false;
        }
        if (isset($move_to_sent) && $move_to_sent != 0 || !isset($move_to_sent)) {
            $lcl_allow_sent = true;
        } else {
            $lcl_allow_sent = false;
        }
        if ($fld_sent && $svr_allow_sent && !$lcl_allow_sent || $fld_sent && $lcl_allow_sent) {
            global $passed_id, $mailbox, $action;
            if ($action == 'reply' || $action == 'reply_all') {
                $save_reply_with_orig = getPref($data_dir, $username, 'save_reply_with_orig');
                if ($save_reply_with_orig) {
                    $sent_folder = $mailbox;
                }
            }
            sqimap_append($imap_stream, $sent_folder, $length);
            require_once SM_PATH . 'class/deliver/Deliver_IMAP.class.php';
            $imap_deliver = new Deliver_IMAP();
            $imap_deliver->mail($composeMessage, $imap_stream);
            sqimap_append_done($imap_stream, $sent_folder);
            unset($imap_deliver);
        }
        global $passed_id, $mailbox, $action;
        ClearAttachments($composeMessage);
        if ($action == 'reply' || $action == 'reply_all') {
            sqimap_mailbox_select($imap_stream, $mailbox);
            sqimap_messages_flag($imap_stream, $passed_id, $passed_id, 'Answered', false);
        }
        sqimap_logout($imap_stream);
    }
    return $succes;
}
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:101,代码来源:compose.php

示例5: sent_subfolders_update_sentfolder_do

/**
 * Update sent_subfolders settings
 *
 * function updates default sent folder value and
 * creates required imap folders
 */
function sent_subfolders_update_sentfolder_do()
{
    global $sent_folder, $username, $data_dir, $imapServerAddress, $imapPort, $imap_stream_options, $move_to_sent;
    sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
    $use_sent_subfolders = getPref($data_dir, $username, 'use_sent_subfolders', SMPREF_OFF);
    $sent_subfolders_setting = getPref($data_dir, $username, 'sent_subfolders_setting', SMPREF_SENT_SUBFOLDERS_DISABLED);
    $sent_subfolders_base = getPref($data_dir, $username, 'sent_subfolders_base', $sent_folder);
    if ($use_sent_subfolders || $move_to_sent) {
        $year = date('Y');
        $month = date('m');
        $quarter = sent_subfolder_getQuarter($month);
        /**
         * Regarding the structure we've got three main possibilities.
         * One sent holder. level 0.
         * Multiple year holders with messages in it. level 1.
         * Multiple year folders with holders in it. level 2.
         */
        switch ($sent_subfolders_setting) {
            case SMPREF_SENT_SUBFOLDERS_YEARLY:
                $level = 1;
                $sent_subfolder = $sent_subfolders_base . $delimiter . $year;
                break;
            case SMPREF_SENT_SUBFOLDERS_QUARTERLY:
                $level = 2;
                $sent_subfolder = $sent_subfolders_base . $delimiter . $year . $delimiter . $quarter;
                $year_folder = $sent_subfolders_base . $delimiter . $year;
                break;
            case SMPREF_SENT_SUBFOLDERS_MONTHLY:
                $level = 2;
                $sent_subfolder = $sent_subfolders_base . $delimiter . $year . $delimiter . $month;
                $year_folder = $sent_subfolders_base . $delimiter . $year;
                break;
            case SMPREF_SENT_SUBFOLDERS_DISABLED:
            default:
                $level = 0;
                $sent_subfolder = $sent_folder;
                $year_folder = $sent_folder;
        }
        /* If this folder is NOT the current sent folder, update stuff. */
        if ($sent_subfolder != $sent_folder) {
            /* Auto-create folders, if they do not yet exist. */
            if ($sent_subfolder != 'none') {
                /* Create the imap connection. */
                $ic = sqimap_login($username, false, $imapServerAddress, $imapPort, 10, $imap_stream_options);
                $boxes = false;
                /**
                 * If sent_subfolder can't store messages (noselect) ||
                 * year_folder can't store subfolders (noinferiors) in level=2 setup ||
                 * subfolder_base can't store subfolders (noinferiors), setup is broken
                 */
                if (sqimap_mailbox_is_noselect($ic, $sent_subfolder, $boxes) || $level == 2 && sqimap_mailbox_is_noinferiors($ic, $year_folder, $boxes) || sqimap_mailbox_is_noinferiors($ic, $sent_subfolders_base, $boxes)) {
                    error_box(_("Sent subfolders options are misconfigured."));
                } else {
                    if ($level == 2) {
                        /* Auto-create the year folder, if it does not yet exist. */
                        if (!sqimap_mailbox_exists($ic, $year_folder)) {
                            sqimap_mailbox_create($ic, $year_folder, 'noselect');
                            // TODO: safety check for imap servers that can't create subfolders
                        } else {
                            if (!sqimap_mailbox_is_subscribed($ic, $year_folder)) {
                                sqimap_subscribe($ic, $year_folder);
                            }
                        }
                    }
                    /* Auto-create the subfolder, if it does not yet exist. */
                    if (!sqimap_mailbox_exists($ic, $sent_subfolder)) {
                        sqimap_mailbox_create($ic, $sent_subfolder, '');
                    } else {
                        if (!sqimap_mailbox_is_subscribed($ic, $sent_subfolder)) {
                            sqimap_subscribe($ic, $sent_subfolder);
                        }
                    }
                    /* Update sent_folder setting in prefs only if the base
                       subfolders setting is not the same as the normal sent
                       folder...  otherwise, it is quite misleading to the user.
                       If the sent folder is the same as the subfolders base, it's
                       OK to leave the sent folder as is.
                       The sent_folder setting itself needs to be the actual
                       subfolder (not the base) for proper functionality */
                    if ($sent_subfolders_base != $sent_folder) {
                        setPref($data_dir, $username, 'sent_folder', $sent_subfolders_base);
                        setPref($data_dir, $username, 'move_to_sent', SMPREF_ON);
                        setPref($data_dir, $username, 'translate_special_folders', SMPREF_OFF);
                    }
                    $sent_folder = $sent_subfolder;
                    $move_to_sent = SMPREF_ON;
                }
                /* Close the imap connection. */
                sqimap_logout($ic);
            }
        }
    }
}
开发者ID:teammember8,项目名称:roundcube,代码行数:99,代码来源:functions.php

示例6: addChildNodeToTree

    }
}
/** First create the top node in the tree **/
for ($i = 0; $i < $numboxes; $i++) {
    if ($boxes[$i]['unformatted-dm'] == $mailbox && strlen($boxes[$i]['unformatted-dm']) == strlen($mailbox)) {
        $foldersTree[0]['value'] = $mailbox;
        $foldersTree[0]['doIHaveChildren'] = false;
        continue;
    }
}
/* Now create the nodes for subfolders of the parent folder
   You can tell that it is a subfolder by tacking the mailbox delimiter
   on the end of the $mailbox string, and compare to that.  */
for ($i = 0; $i < $numboxes; $i++) {
    if (substr($boxes[$i]['unformatted'], 0, strlen($mailbox_no_dm . $delimiter)) == $mailbox_no_dm . $delimiter) {
        addChildNodeToTree($boxes[$i]["unformatted"], $boxes[$i]['unformatted-dm'], $foldersTree);
    }
}
/** Lets start removing the folders and messages **/
if ($move_to_trash == true && $can_move_to_trash == true) {
    /** if they wish to move messages to the trash **/
    walkTreeInPostOrderCreatingFoldersUnderTrash(0, $imap_stream, $foldersTree, $mailbox);
    walkTreeInPreOrderDeleteFolders(0, $imap_stream, $foldersTree);
} else {
    /** if they do NOT wish to move messages to the trash (or cannot)**/
    walkTreeInPreOrderDeleteFolders(0, $imap_stream, $foldersTree);
}
/** Log out this session **/
sqimap_logout($imap_stream);
$location = get_location();
header("Location: {$location}/folders.php?success=delete");
开发者ID:jin255ff,项目名称:company_website,代码行数:31,代码来源:folders_delete.php

示例7: load_optpage_data_folder

/**
 * This function builds an array with all the information about
 * the options available to the user, and returns it. The options
 * are grouped by the groups in which they are displayed.
 * For each option, the following information is stored:
 * - name: the internal (variable) name
 * - caption: the description of the option in the UI
 * - type: one of SMOPT_TYPE_*
 * - refresh: one of SMOPT_REFRESH_*
 * - size: one of SMOPT_SIZE_*
 * - save: the name of a function to call when saving this option
 * @return array all option information
 */
function load_optpage_data_folder()
{
    global $username, $key, $imapServerAddress, $imapPort;
    global $folder_prefix, $default_folder_prefix, $show_prefix_option;
    /* Get some imap data we need later. */
    $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
    $boxes = sqimap_mailbox_list($imapConnection);
    /* Build a simple array into which we will build options. */
    $optgrps = array();
    $optvals = array();
    /******************************************************/
    /* LOAD EACH GROUP OF OPTIONS INTO THE OPTIONS ARRAY. */
    /******************************************************/
    /*** Load the General Options into the array ***/
    $optgrps[SMOPT_GRP_SPCFOLDER] = _("Special Folder Options");
    $optvals[SMOPT_GRP_SPCFOLDER] = array();
    if (!isset($folder_prefix)) {
        $folder_prefix = $default_folder_prefix;
    }
    if ($show_prefix_option) {
        $optvals[SMOPT_GRP_SPCFOLDER][] = array('name' => 'folder_prefix', 'caption' => _("Folder Path"), 'type' => SMOPT_TYPE_STRING, 'refresh' => SMOPT_REFRESH_FOLDERLIST, 'size' => SMOPT_SIZE_LARGE);
    }
    $trash_folder_values = array(SMPREF_NONE => '[ ' . _("Do not use Trash") . ' ]', 'whatever' => $boxes);
    $optvals[SMOPT_GRP_SPCFOLDER][] = array('name' => 'trash_folder', 'caption' => _("Trash Folder"), 'type' => SMOPT_TYPE_FLDRLIST, 'refresh' => SMOPT_REFRESH_FOLDERLIST, 'posvals' => $trash_folder_values, 'save' => 'save_option_trash_folder');
    $draft_folder_values = array(SMPREF_NONE => '[ ' . _("Do not use Drafts") . ' ]', 'whatever' => $boxes);
    $optvals[SMOPT_GRP_SPCFOLDER][] = array('name' => 'draft_folder', 'caption' => _("Draft Folder"), 'type' => SMOPT_TYPE_FLDRLIST, 'refresh' => SMOPT_REFRESH_FOLDERLIST, 'posvals' => $draft_folder_values, 'save' => 'save_option_draft_folder');
    $sent_folder_values = array(SMPREF_NONE => '[ ' . _("Do not use Sent") . ' ]', 'whatever' => $boxes);
    $optvals[SMOPT_GRP_SPCFOLDER][] = array('name' => 'sent_folder', 'caption' => _("Sent Folder"), 'type' => SMOPT_TYPE_FLDRLIST, 'refresh' => SMOPT_REFRESH_FOLDERLIST, 'posvals' => $sent_folder_values, 'save' => 'save_option_sent_folder');
    /*** Load the General Options into the array ***/
    $optgrps[SMOPT_GRP_FOLDERLIST] = _("Folder List Options");
    $optvals[SMOPT_GRP_FOLDERLIST] = array();
    $optvals[SMOPT_GRP_FOLDERLIST][] = array('name' => 'location_of_bar', 'caption' => _("Location of Folder List"), 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_ALL, 'posvals' => array(SMPREF_LOC_LEFT => _("Left"), SMPREF_LOC_RIGHT => _("Right")));
    $left_size_values = array();
    for ($lsv = 100; $lsv <= 300; $lsv += 10) {
        $left_size_values[$lsv] = "{$lsv} " . _("pixels");
    }
    $optvals[SMOPT_GRP_FOLDERLIST][] = array('name' => 'left_size', 'caption' => _("Width of Folder List"), 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_ALL, 'posvals' => $left_size_values);
    $minute_str = _("Minutes");
    $left_refresh_values = array(SMPREF_NONE => _("Never"));
    foreach (array(30, 60, 120, 180, 300, 600, 1200) as $lr_val) {
        if ($lr_val < 60) {
            $left_refresh_values[$lr_val] = "{$lr_val} " . _("Seconds");
        } else {
            if ($lr_val == 60) {
                $left_refresh_values[$lr_val] = "1 " . _("Minute");
            } else {
                $left_refresh_values[$lr_val] = $lr_val / 60 . " {$minute_str}";
            }
        }
    }
    $optvals[SMOPT_GRP_FOLDERLIST][] = array('name' => 'left_refresh', 'caption' => _("Auto Refresh Folder List"), 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_FOLDERLIST, 'posvals' => $left_refresh_values);
    $optvals[SMOPT_GRP_FOLDERLIST][] = array('name' => 'unseen_notify', 'caption' => _("Enable Unread Message Notification"), 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_FOLDERLIST, 'posvals' => array(SMPREF_UNSEEN_NONE => _("No Notification"), SMPREF_UNSEEN_INBOX => _("Only INBOX"), SMPREF_UNSEEN_ALL => _("All Folders")));
    $optvals[SMOPT_GRP_FOLDERLIST][] = array('name' => 'unseen_type', 'caption' => _("Unread Message Notification Type"), 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_FOLDERLIST, 'posvals' => array(SMPREF_UNSEEN_ONLY => _("Only Unseen"), SMPREF_UNSEEN_TOTAL => _("Unseen and Total")));
    $optvals[SMOPT_GRP_FOLDERLIST][] = array('name' => 'collapse_folders', 'caption' => _("Enable Collapsable Folders"), 'type' => SMOPT_TYPE_BOOLEAN, 'refresh' => SMOPT_REFRESH_FOLDERLIST);
    $optvals[SMOPT_GRP_FOLDERLIST][] = array('name' => 'unseen_cum', 'caption' => _("Enable Cumulative Unread Message Notification"), 'type' => SMOPT_TYPE_BOOLEAN, 'refresh' => SMOPT_REFRESH_FOLDERLIST);
    $optvals[SMOPT_GRP_FOLDERLIST][] = array('name' => 'date_format', 'caption' => _("Show Clock on Folders Panel"), 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_FOLDERLIST, 'posvals' => array('0' => _("International date and time"), '1' => _("American date and time"), '2' => _("European date and time"), '3' => _("Show weekday and time"), '4' => _("Show time with seconds"), '5' => _("Show time"), '6' => _("No Clock")));
    $optvals[SMOPT_GRP_FOLDERLIST][] = array('name' => 'hour_format', 'caption' => _("Hour Format"), 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_FOLDERLIST, 'posvals' => array(SMPREF_TIME_12HR => _("12-hour clock"), SMPREF_TIME_24HR => _("24-hour clock")));
    $optvals[SMOPT_GRP_FOLDERLIST][] = array('name' => 'search_memory', 'caption' => _("Memory Search"), 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_NONE, 'posvals' => array(0 => _("Disabled"), 1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '6', 7 => '7', 8 => '8', 9 => '9'));
    /*** Load the General Options into the array ***/
    $optgrps[SMOPT_GRP_FOLDERSELECT] = _("Folder Selection Options");
    $optvals[SMOPT_GRP_FOLDERSELECT] = array();
    $delim = sqimap_get_delimiter($imapConnection);
    $optvals[SMOPT_GRP_FOLDERSELECT][] = array('name' => 'mailbox_select_style', 'caption' => _("Selection List Style"), 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_NONE, 'posvals' => array(0 => _("Long:") . ' "' . _("Folder") . $delim . _("Subfolder") . '"', 1 => _("Indented:") . ' "&nbsp;&nbsp;&nbsp;&nbsp;' . _("Subfolder") . '"', 2 => _("Delimited:") . ' ".&nbsp;' . _("Subfolder") . '"'), 'htmlencoded' => true);
    /* Assemble all this together and return it as our result. */
    $result = array('grps' => $optgrps, 'vals' => $optvals);
    sqimap_logout($imapConnection);
    return $result;
}
开发者ID:jprice,项目名称:EHCP,代码行数:81,代码来源:folder.php

示例8: folders_unsubscribe

/**
 * Given a list of folder names, unsubscribes from each of them.
 */
function folders_unsubscribe($imapConnection, $folder_names)
{
    global $color, $oTemplate;
    if (count($folder_names) == 0 || $folder_names[0] == '') {
        plain_error_message(_("You have not selected a folder to unsubscribe. Please do so.") . '<br /><a href="../src/folders.php">' . _("Click here to go back") . '</a>.', $color);
        sqimap_logout($imapConnection);
        $oTemplate->display('footer.tpl');
        exit;
    }
    foreach ($folder_names as $folder_name) {
        sqimap_unsubscribe($imapConnection, $folder_name);
    }
    return;
}
开发者ID:teammember8,项目名称:roundcube,代码行数:17,代码来源:folder_manip.php

示例9: deliverMessage


//.........这里部分代码省略.........
       it over to deliver; plugin authors note that $composeMessage
       is sent and modified by reference since 1.5.2 */
    do_hook('compose_send', $composeMessage);
    if (!$useSendmail && !$draft) {
        require_once SM_PATH . 'class/deliver/Deliver_SMTP.class.php';
        $deliver = new Deliver_SMTP();
        global $smtpServerAddress, $smtpPort, $smtp_stream_options, $pop_before_smtp, $pop_before_smtp_host;
        $authPop = isset($pop_before_smtp) && $pop_before_smtp ? true : false;
        if (empty($pop_before_smtp_host)) {
            $pop_before_smtp_host = $smtpServerAddress;
        }
        get_smtp_user($user, $pass);
        $stream = $deliver->initStream($composeMessage, $domain, 0, $smtpServerAddress, $smtpPort, $user, $pass, $authPop, $pop_before_smtp_host, $smtp_stream_options);
    } elseif (!$draft) {
        require_once SM_PATH . 'class/deliver/Deliver_SendMail.class.php';
        global $sendmail_path, $sendmail_args;
        // Check for outdated configuration
        if (!isset($sendmail_args)) {
            if ($sendmail_path == '/var/qmail/bin/qmail-inject') {
                $sendmail_args = '';
            } else {
                $sendmail_args = '-i -t';
            }
        }
        $deliver = new Deliver_SendMail(array('sendmail_args' => $sendmail_args));
        $stream = $deliver->initStream($composeMessage, $sendmail_path);
    } elseif ($draft) {
        global $draft_folder;
        $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imap_stream_options);
        if (sqimap_mailbox_exists($imap_stream, $draft_folder)) {
            require_once SM_PATH . 'class/deliver/Deliver_IMAP.class.php';
            $imap_deliver = new Deliver_IMAP();
            $success = $imap_deliver->mail($composeMessage, $imap_stream, $reply_id, $reply_ent_id, $imap_stream, $draft_folder);
            sqimap_logout($imap_stream);
            unset($imap_deliver);
            $composeMessage->purgeAttachments();
            return $success;
        } else {
            $msg = '<br />' . sprintf(_("Error: Draft folder %s does not exist."), sm_encode_html_special_chars($draft_folder));
            plain_error_message($msg);
            return false;
        }
    }
    $success = false;
    if ($stream) {
        $deliver->mail($composeMessage, $stream, $reply_id, $reply_ent_id);
        $success = $deliver->finalizeStream($stream);
    }
    if (!$success) {
        // $deliver->dlv_server_msg is not always server's reply
        $msg = _("Message not sent.") . "<br />\n" . (isset($deliver->dlv_msg) ? $deliver->dlv_msg : '');
        if (!empty($deliver->dlv_server_msg)) {
            // add 'server replied' part only when it is not empty.
            // Delivery error can be generated by delivery class itself
            $msg .= '<br />' . _("Server replied:") . ' ' . (isset($deliver->dlv_ret_nr) ? $deliver->dlv_ret_nr . ' ' : '') . nl2br(sm_encode_html_special_chars($deliver->dlv_server_msg));
        }
        plain_error_message($msg);
    } else {
        unset($deliver);
        $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imap_stream_options);
        // mark as replied or forwarded if applicable
        //
        global $what, $iAccount, $startMessage, $passed_id, $fwduid, $mailbox;
        if ($action == 'reply' || $action == 'reply_all' || $action == 'forward' || $action == 'forward_as_attachment') {
            require SM_PATH . 'functions/mailbox_display.php';
            $aMailbox = sqm_api_mailbox_select($imap_stream, $iAccount, $mailbox, array('setindex' => $what, 'offset' => $startMessage), array());
开发者ID:teammember8,项目名称:roundcube,代码行数:67,代码来源:compose.php

示例10: mail

 /**
  * function mail - send the message parts to the SMTP stream
  *
  * @param Message  $message      Message object to send
  *                               NOTE that this is passed by
  *                               reference and will be modified
  *                               upon return with updated
  *                               fields such as Message ID, References,
  *                               In-Reply-To and Date headers.
  * @param resource $stream       Handle to the outgoing stream
  *                               (when FALSE, nothing will be
  *                               written to the stream; this can
  *                               be used to determine the actual
  *                               number of bytes that will be 
  *                               written to the stream)
  * @param string   $reply_id     Identifies message being replied to
  *                               (OPTIONAL; caller should ONLY specify
  *                               a value for this when the message
  *                               being sent is a reply)
  * @param string   $reply_ent_id Identifies message being replied to
  *                               in the case it was an embedded/attached
  *                               message inside another (OPTIONAL; caller
  *                               should ONLY specify a value for this 
  *                               when the message being sent is a reply)
  * @param resource $imap_stream  If there is an open IMAP stream in 
  *                               the caller's context, it should be
  *                               passed in here.  This is OPTIONAL,
  *                               as one will be created if not given,
  *                               but as some IMAP servers may baulk
  *                               at opening more than one connection
  *                               at a time, the caller should always
  *                               abide if possible.  Currently, this
  *                               stream is only used when $reply_id
  *                               is also non-zero, but that is subject
  *                               to change.
  * @param mixed    $extra        Any implementation-specific variables
  *                               can be passed in here and used in
  *                               an overloaded version of this method
  *                               if needed.
  *
  * @return integer The number of bytes written (or that would have been
  *                 written) to the output stream.
  *
  */
 function mail(&$message, $stream = false, $reply_id = 0, $reply_ent_id = 0, $imap_stream = NULL, $extra = NULL)
 {
     $rfc822_header =& $message->rfc822_header;
     if (count($message->entities)) {
         $boundary = $this->mimeBoundary();
         $rfc822_header->content_type->properties['boundary'] = '"' . $boundary . '"';
     } else {
         $boundary = '';
     }
     $raw_length = 0;
     // calculate reply header if needed
     //
     if ($reply_id) {
         global $imapConnection, $username, $key, $imapServerAddress, $imapPort, $mailbox;
         // try our best to use an existing IMAP handle
         //
         $close_imap_stream = FALSE;
         if (is_resource($imap_stream)) {
             $my_imap_stream = $imap_stream;
         } else {
             if (is_resource($imapConnection)) {
                 $my_imap_stream = $imapConnection;
             } else {
                 $close_imap_stream = TRUE;
                 $my_imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
             }
         }
         sqimap_mailbox_select($my_imap_stream, $mailbox);
         $reply_message = sqimap_get_message($my_imap_stream, $reply_id, $mailbox);
         if ($close_imap_stream) {
             sqimap_logout($my_imap_stream);
         }
         if ($reply_ent_id) {
             /* redefine the messsage in case of message/rfc822 */
             $reply_message = $message->getEntity($reply_ent_id);
             /* message is an entity which contains the envelope and type0=message
              * and type1=rfc822. The actual entities are childs from
              * $reply_message->entities[0]. That's where the encoding and is located
              */
             $orig_header = $reply_message->rfc822_header;
             /* here is the envelope located */
         } else {
             $orig_header = $reply_message->rfc822_header;
         }
         $message->reply_rfc822_header = $orig_header;
     }
     $reply_rfc822_header = isset($message->reply_rfc822_header) ? $message->reply_rfc822_header : '';
     $header = $this->prepareRFC822_Header($rfc822_header, $reply_rfc822_header, $raw_length);
     $this->send_mail($message, $header, $boundary, $stream, $raw_length, $extra);
     return $raw_length;
 }
开发者ID:jprice,项目名称:EHCP,代码行数:95,代码来源:Deliver.class.php

示例11: get_system_specs

/**
 * Retrieve long text string containing semi-formatted (simple text
 * with newlines and spaces for indentation) SquirrelMail system
 * specs
 *
 * @return array A three-element array, the first element containing
 *               the string of system specs, the second one containing 
 *               a list of any warnings that may have occurred, keyed
 *               by a warning "type" (which is used to key the corrections
 *               array next), and the third element of which is a list
 *               of sub-arrays keyed by warning "type": the sub-arrays
 *               are lists of correction messages associated with the
 *               warnings.  The second and third return elements may
 *               be empty arrays if no warnings were found.
 *
 * @since 1.5.2
 *
 */
function get_system_specs()
{
    //FIXME: configtest and this plugin should be using the same code to generate the basic SM system specifications and setup detection
    global $imapServerAddress, $username, $imapPort, $imap_server_type, $use_imap_tls, $ldap_server;
    // load required libraries
    //
    include_once SM_PATH . 'functions/imap_general.php';
    $browscap = ini_get('browscap');
    if (!empty($browscap)) {
        $browser = get_browser();
    }
    $warnings = array();
    $corrections = array();
    sqgetGlobalVar('HTTP_USER_AGENT', $HTTP_USER_AGENT, SQ_SERVER);
    if (!sqgetGlobalVar('HTTP_USER_AGENT', $HTTP_USER_AGENT, SQ_SERVER)) {
        $HTTP_USER_AGENT = "Browser information is not available.";
    }
    $body_top = "My browser information:\n" . '  ' . $HTTP_USER_AGENT . "\n";
    if (isset($browser)) {
        $body_top .= "  get_browser() information (List)\n" . Show_Array((array) $browser);
    }
    $body_top .= "\nMy web server information:\n" . "  PHP Version " . phpversion() . "\n" . "  PHP Extensions (List)\n" . Show_Array(get_loaded_extensions()) . "\nSquirrelMail-specific information:\n" . "  Version:  " . SM_VERSION . "\n" . "  Plugins (List)\n" . br_show_plugins() . "\n";
    if (!empty($ldap_server[0]) && $ldap_server[0] && !extension_loaded('ldap')) {
        $warnings['ldap'] = "LDAP server defined in SquirrelMail config, " . "but the module is not loaded in PHP";
        $corrections['ldap'][] = "Reconfigure PHP with the option '--with-ldap'";
        $corrections['ldap'][] = "Then recompile PHP and reinstall";
        $corrections['ldap'][] = "-- OR --";
        $corrections['ldap'][] = "Reconfigure SquirrelMail to not use LDAP";
    }
    $body = "\nMy IMAP server information:\n" . "  Server type:  {$imap_server_type}\n";
    $imapServerAddress = sqimap_get_user_server($imapServerAddress, $username);
    $imap_stream = sqimap_create_stream($imapServerAddress, $imapPort, $use_imap_tls);
    if ($imap_stream) {
        $body .= '  Capabilities: ';
        if ($imap_capabilities = sqimap_capability($imap_stream)) {
            foreach ($imap_capabilities as $capability => $value) {
                if (is_array($value)) {
                    foreach ($value as $val) {
                        $body .= $capability . "={$val} ";
                    }
                } else {
                    $body .= $capability . (is_bool($value) ? ' ' : "={$value} ");
                }
            }
        }
        $body .= "\n";
        sqimap_logout($imap_stream);
    } else {
        $body .= "  Unable to connect to IMAP server to get information.\n";
        $warnings['imap'] = "Unable to connect to IMAP server";
        $corrections['imap'][] = "Make sure you specified the correct mail server";
        $corrections['imap'][] = "Make sure the mail server is running IMAP, not POP";
        $corrections['imap'][] = "Make sure the server responds to port {$imapPort}";
    }
    $warning_num = 0;
    if (!empty($warnings)) {
        foreach ($warnings as $key => $value) {
            if ($warning_num == 0) {
                $body_top .= "WARNINGS WERE REPORTED WITH YOUR SETUP:\n";
                $body_top = "WARNINGS WERE REPORTED WITH YOUR SETUP -- SEE BELOW\n\n{$body_top}";
            }
            $warning_num++;
            $body_top .= "\n{$value}\n";
            foreach ($corrections[$key] as $corr_val) {
                $body_top .= "  * {$corr_val}\n";
            }
        }
        $body_top .= "\n{$warning_num} warning(s) reported.\n";
        $body_top .= "----------------------------------------------\n";
    }
    $body = $body_top . $body;
    return array($body, $warnings, $corrections);
}
开发者ID:teammember8,项目名称:roundcube,代码行数:91,代码来源:system_specs.php

示例12: sqimap_mailbox_select

/**
 * Selects a mailbox
 * Before 1.3.0 used more arguments and returned data depended on those arguments.
 * @param stream $imap_stream imap connection resource
 * @param string $mailbox mailbox name
 * @return array results of select command (on success - permanentflags, flags and rights)
 * @since 1.0 or older
 */
function sqimap_mailbox_select($imap_stream, $mailbox)
{
    if (empty($mailbox)) {
        return;
    }
    // cleanup $mailbox in order to prevent IMAP injection attacks
    $mailbox = str_replace(array("\r", "\n"), array("", ""), $mailbox);
    /**
     * Default UW IMAP server configuration allows to access other files
     * on server. $imap_server_type is not checked because interface can
     * be used with 'other' or any other server type setting. $mailbox
     * variable can be modified in any script that uses variable from GET
     * or POST. This code blocks all standard SquirrelMail IMAP API requests
     * that use mailbox with full path (/etc/passwd) or with ../ characters
     * in path (../../etc/passwd)
     */
    if (strstr($mailbox, '../') || substr($mailbox, 0, 1) == '/') {
        global $oTemplate;
        error_box(sprintf(_("Invalid mailbox name: %s"), sm_encode_html_special_chars($mailbox)));
        sqimap_logout($imap_stream);
        $oTemplate->display('footer.tpl');
        die;
    }
    $read = sqimap_run_command($imap_stream, 'SELECT ' . sqimap_encode_mailbox_name($mailbox), true, $response, $message);
    $result = array();
    for ($i = 0, $cnt = count($read); $i < $cnt; $i++) {
        if (preg_match('/^\\*\\s+OK\\s\\[(\\w+)\\s(\\w+)\\]/', $read[$i], $regs)) {
            $result[strtoupper($regs[1])] = $regs[2];
        } else {
            if (preg_match('/^\\*\\s([0-9]+)\\s(\\w+)/', $read[$i], $regs)) {
                $result[strtoupper($regs[2])] = $regs[1];
            } else {
                if (preg_match("/PERMANENTFLAGS(.*)/i", $read[$i], $regs)) {
                    $regs[1] = trim(preg_replace(array("/\\(/", "/\\)/", "/\\]/"), '', $regs[1]));
                    $result['PERMANENTFLAGS'] = explode(' ', strtolower($regs[1]));
                } else {
                    if (preg_match("/FLAGS(.*)/i", $read[$i], $regs)) {
                        $regs[1] = trim(preg_replace(array("/\\(/", "/\\)/"), '', $regs[1]));
                        $result['FLAGS'] = explode(' ', strtolower($regs[1]));
                    }
                }
            }
        }
    }
    if (!isset($result['PERMANENTFLAGS'])) {
        $result['PERMANENTFLAGS'] = $result['FLAGS'];
    }
    if (preg_match('/^\\[(.+)\\]/', $message, $regs)) {
        $result['RIGHTS'] = strtoupper($regs[1]);
    }
    return $result;
}
开发者ID:teammember8,项目名称:roundcube,代码行数:60,代码来源:imap_mailbox.php

示例13: sqimap_login


//.........这里部分代码省略.........
                // OK so far..
                fputs($imap_stream, "{$auth}\r\n");
                $read = sqimap_fgets($imap_stream);
            }
        }
        $results = explode(" ", $read, 3);
        $response = $results[1];
        $message = $results[2];
    } else {
        $response = "BAD";
        $message = "Internal SquirrelMail error - unknown IMAP authentication method chosen.  Please contact the developers.";
    }
    /* If the connection was not successful, lets see why */
    if ($response != 'OK') {
        if (!$hide || $hide == 3) {
            //FIXME: UUURG... We don't want HTML in error messages, should also do html sanitizing of error messages elsewhere; should't assume output is destined for an HTML browser here
            if ($response != 'NO') {
                /* "BAD" and anything else gets reported here. */
                $message = sm_encode_html_special_chars($message);
                set_up_language($squirrelmail_language, true);
                if ($response == 'BAD') {
                    if ($hide == 3) {
                        return sprintf(_("Bad request: %s"), $message);
                    }
                    $string = sprintf(_("Bad request: %s") . "<br />\r\n", $message);
                } else {
                    if ($hide == 3) {
                        return sprintf(_("Unknown error: %s"), $message);
                    }
                    $string = sprintf(_("Unknown error: %s") . "<br />\n", $message);
                }
                if (isset($read) && is_array($read)) {
                    $string .= '<br />' . _("Read data:") . "<br />\n";
                    foreach ($read as $line) {
                        $string .= sm_encode_html_special_chars($line) . "<br />\n";
                    }
                }
                error_box($string);
                exit;
            } else {
                /*
                 * If the user does not log in with the correct
                 * username and password it is not possible to get the
                 * correct locale from the user's preferences.
                 * Therefore, apply the same hack as on the login
                 * screen.
                 *
                 * $squirrelmail_language is set by a cookie when
                 * the user selects language and logs out
                 */
                set_up_language($squirrelmail_language, true);
                sqsession_destroy();
                /* terminate the session nicely */
                sqimap_logout($imap_stream);
                // determine what error message to use
                //
                $fail_msg = _("Unknown user or password incorrect.");
                if ($display_imap_login_error) {
                    // See if there is an error message from the server
                    // Skip any rfc5530 response code: '[something]' at the
                    // start of the message
                    if (!empty($message) && $message[0] == '[' && ($end = strstr($message, ']')) && $end != ']') {
                        $message = substr($end, 1);
                    }
                    // Remove surrounding spaces and if there
                    // is anything left, display that as the
                    // error message:
                    $message = trim($message);
                    if (strlen($message)) {
                        $fail_msg = _($message);
                    }
                }
                if ($hide == 3) {
                    return $fail_msg;
                }
                logout_error($fail_msg);
                exit;
            }
        } else {
            if ($hide == 2) {
                return FALSE;
            }
            exit;
        }
    }
    /* Special error case:
     * Login referrals. The server returns:
     * ? OK [REFERRAL <imap url>]
     * Check RFC 2221 for details. Since we do not support login referrals yet
     * we log the user out.
     */
    if (stristr($message, 'REFERRAL imap') === TRUE) {
        sqimap_logout($imap_stream);
        set_up_language($squirrelmail_language, true);
        sqsession_destroy();
        logout_error(_("Your mailbox is not located at this server. Try a different server or consult your system administrator"));
        exit;
    }
    return $imap_stream;
}
开发者ID:teammember8,项目名称:roundcube,代码行数:101,代码来源:imap_general.php

示例14: email_error

function email_error()
{
    global $imapConnection;
    require $GO_THEME->theme_path . 'header.inc';
    echo '<table border="0" cellpadding="10" width="100%"><tr><td>';
    echo '<p class="Error">' . $ml_connect_failed . ' \'' . $account['host'] . '\' ' . $ml_at_port . ': ' . $account['port'] . '</p>';
    echo '<p class="Error">' . imap_last_error() . '</p>';
    require $GO_THEME->theme_path . 'footer.inc';
    sqimap_logout($imapConnection);
    exit;
}
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:11,代码来源:message.php

示例15: mail_fetch_login


//.........这里部分代码省略.........
            $mailfetch_lmos_[$i_loop] = getPref($data_dir, $username, "mailfetch_lmos_{$i_loop}");
            $mailfetch_uidl_[$i_loop] = getPref($data_dir, $username, "mailfetch_uidl_{$i_loop}");
            $mailfetch_subfolder_[$i_loop] = getPref($data_dir, $username, "mailfetch_subfolder_{$i_loop}");
            $mailfetch_server = $mailfetch_server_[$i_loop];
            $mailfetch_port = $mailfetch_port_[$i_loop];
            $mailfetch_user = $mailfetch_user_[$i_loop];
            $mailfetch_alias = $mailfetch_alias_[$i_loop];
            $mailfetch_pass = $mailfetch_pass_[$i_loop];
            $mailfetch_lmos = $mailfetch_lmos_[$i_loop];
            $mailfetch_login = $mailfetch_login_[$i_loop];
            $mailfetch_uidl = $mailfetch_uidl_[$i_loop];
            $mailfetch_subfolder = $mailfetch_subfolder_[$i_loop];
            // $outMsg .= "$mailfetch_alias checked<br>";
            // $outMsg .= "$mailfetch_alias_[$i_loop]<br>";
            $pop3 = new POP3($mailfetch_server, 60);
            if (!$pop3->connect($mailfetch_server, $mailfetch_port)) {
                $outMsg .= _("Warning, ") . $pop3->ERROR;
                continue;
            }
            $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10);
            $Count = $pop3->login($mailfetch_user, $mailfetch_pass);
            if (($Count == false || $Count == -1) && $pop3->ERROR != '') {
                $outMsg .= _("Login Failed:") . $pop3->ERROR;
                continue;
            }
            //   register_shutdown_function($pop3->quit());
            $msglist = $pop3->uidl();
            $i = 1;
            for ($j = 1; $j < sizeof($msglist); $j++) {
                if ($msglist["{$j}"] == $mailfetch_uidl) {
                    $i = $j + 1;
                    break;
                }
            }
            if ($Count < $i) {
                $pop3->quit();
                continue;
            }
            if ($Count == 0) {
                $pop3->quit();
                continue;
            } else {
                $newmsgcount = $Count - $i + 1;
            }
            // Faster to get them all at once
            $mailfetch_uidl = $pop3->uidl();
            if (!is_array($mailfetch_uidl) && $mailfetch_lmos == 'on') {
                $outMsg .= _("Server does not support UIDL.");
            }
            for (; $i <= $Count; $i++) {
                if (!ini_get('safe_mode')) {
                    set_time_limit(20);
                }
                // 20 seconds per message max
                $Message = "";
                $MessArray = $pop3->get($i);
                if (!$MessArray or gettype($MessArray) != "array") {
                    $outMsg .= _("Warning, ") . $pop3->ERROR;
                    continue 2;
                }
                while (list($lineNum, $line) = each($MessArray)) {
                    $Message .= $line;
                }
                /**
                 * check if mail folder is not null and subscribed
                 * Function can check if mail folder is only unsubscribed 
                 * and use unsubscribed mail folder.
                 */
                if ($mailfetch_subfolder == '' || !mail_fetch_check_folder($imap_stream, $mailfetch_subfolder)) {
                    fputs($imap_stream, "A3{$i} APPEND INBOX {" . strlen($Message) . "}\r\n");
                } else {
                    fputs($imap_stream, "A3{$i} APPEND {$mailfetch_subfolder} {" . strlen($Message) . "}\r\n");
                }
                $Line = fgets($imap_stream, 1024);
                if (substr($Line, 0, 1) == '+') {
                    fputs($imap_stream, $Message);
                    fputs($imap_stream, "\r\n");
                    sqimap_read_data($imap_stream, "A3{$i}", false, $response, $message);
                    if ($mailfetch_lmos != 'on') {
                        $pop3->delete($i);
                    }
                } else {
                    echo "{$Line}";
                    $outMsg .= _("Error Appending Message!");
                }
            }
            $pop3->quit();
            sqimap_logout($imap_stream);
            if (is_array($mailfetch_uidl)) {
                setPref($data_dir, $username, "mailfetch_uidl_{$i_loop}", array_pop($mailfetch_uidl));
            }
        }
    }
    if (trim($outMsg) != '') {
        echo '<br><font size="1">' . _("Mail Fetch Result:") . "<br>{$outMsg}</font>";
    }
    if ($mailfetch_newlog == 'on') {
        setPref($data_dir, $username, 'mailfetch_newlog', 'off');
    }
}
开发者ID:jprice,项目名称:EHCP,代码行数:101,代码来源:setup.php


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