示例#1
0
/**
 * @param string $mailbox mailbox name or special case 'All Folders'
 * @return string mailbox name ready to display (utf7 decoded or localized 'All Folders')
 * @since 1.5.0
 * @private
 */
function asearch_get_mailbox_display($mailbox)
{
    if ($mailbox == 'All Folders') {
        return _("All Folders");
    } elseif (strtoupper($mailbox) == 'INBOX') {
        return _("INBOX");
    }
    return imap_utf7_decode_local($mailbox);
}
示例#2
0
function error_message($message, $mailbox, $sort, $startMessage, $color)
{
    global $default_folder_prefix;
    $urlMailbox = urlencode($mailbox);
    $string = '<tr><td align="center">' . $message . '</td></tr>' . '<tr><td align="center">' . '<a href="' . sqm_baseuri() . "src/right_main.php?sort={$sort}&amp;startMessage={$startMessage}&amp;mailbox={$urlMailbox}\">";
    if (!empty($default_folder_prefix)) {
        if (strpos($mailbox, $default_folder_prefix) === 0) {
            $mailbox = substr($mailbox, strlen($default_folder_prefix));
        }
    }
    $string .= sprintf(_("Click here to return to %s"), htmlspecialchars(imap_utf7_decode_local($mailbox))) . '</a></td></tr>';
    error_box($string, $color);
}
示例#3
0
        }
        echo ' /> - ';
        if ($spam_filters[$Key]['link']) {
            echo '<a href="' . $spam_filters[$Key]['link'] . '" target="_blank">';
        }
        echo $spam_filters[$Key]['name'];
        if ($spam_filters[$Key]['link']) {
            echo '</a>';
        }
        echo '</td></tr>' . html_tag('tr', html_tag('td', '&nbsp;') . html_tag('td', $spam_filters[$Key]['comment'], 'left')) . "\n";
    }
    echo html_tag('tr', html_tag('td', '<input type="submit" name="spam_submit" value="' . _("Save") . '" />', 'center', '', 'colspan="2"')) . "\n" . '</table>' . '</center>' . '</form>';
} else {
    // action is not set or action is not spam
    echo html_tag('p', '', 'center') . '[<a href="spamoptions.php?action=spam">' . _("Edit") . '</a>]' . ' - [<a href="../../src/options.php">' . _("Done") . '</a>]</center><br /><br />';
    printf(_("Spam is sent to %s."), $filters_spam_folder ? '<b>' . htmlspecialchars(imap_utf7_decode_local($filters_spam_folder)) . '</b>' : '[<i>' . _("not set yet") . '</i>]');
    echo '<br />';
    printf(_("Spam scan is limited to %s."), '<b>' . ($filters_spam_scan == 'new' ? _("Unread messages only") : _("All messages")) . '</b>');
    echo '</p>' . '<table border="0" cellpadding="3" cellspacing="0" align="center" bgcolor="' . $color[0] . "\">\n";
    $spam_filters = load_spam_filters();
    foreach ($spam_filters as $Key => $Value) {
        echo html_tag('tr') . html_tag('th', '', 'center');
        if ($spam_filters[$Key]['enabled']) {
            echo _("ON");
        } else {
            echo _("OFF");
        }
        echo '</th>' . html_tag('td', '&nbsp;-&nbsp;', 'left') . html_tag('td', '', 'left');
        if ($spam_filters[$Key]['link']) {
            echo '<a href="' . $spam_filters[$Key]['link'] . '" target="_blank">';
        }
/**
 * Displays error message and URL to message listing
 *
 * Fifth argument ($color array) is removed in 1.5.2.
 * @param string $message error message
 * @param string $mailbox mailbox name
 * @param integer $sort sort order
 * @param integer $startMessage first message
 * @since 1.0
 */
function error_message($message, $mailbox, $sort, $startMessage)
{
    $urlMailbox = urlencode($mailbox);
    $link = array('URL' => sqm_baseuri() . "src/right_main.php?sort={$sort}&amp;startMessage={$startMessage}&amp;mailbox={$urlMailbox}", 'TEXT' => sprintf(_("Click here to return to %s"), strtoupper($mailbox) == 'INBOX' ? _("INBOX") : sm_encode_html_special_chars(imap_utf7_decode_local($mailbox))));
    error_box($message, $link);
}
/**
 * Outputs a complete SquirrelMail page header, starting with <!doctype> and
 * including the default menu bar. Uses displayHtmlHeader and takes
 * JavaScript and locale settings into account.
 *
 * @param array color the array of theme colors
 * @param string mailbox the current mailbox name to display
 * @param string xtra extra html code to add
 * @param bool session
 * @return void
 */
function displayPageHeader($color, $mailbox, $xtra = '', $session = false)
{
    global $hide_sm_attributions, $PHP_SELF, $frame_top, $compose_new_win, $compose_width, $compose_height, $attachemessages, $provider_name, $provider_uri, $javascript_on, $default_use_mdn, $mdn_user_support, $startMessage;
    sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
    sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
    $module = substr($PHP_SELF, (strlen($PHP_SELF) - strlen($base_uri)) * -1);
    if ($qmark = strpos($module, '?')) {
        $module = substr($module, 0, $qmark);
    }
    if (!isset($frame_top)) {
        $frame_top = '_top';
    }
    if ($session) {
        $compose_uri = $base_uri . 'src/compose.php?mailbox=' . urlencode($mailbox) . '&amp;attachedmessages=true&amp;session=' . "{$session}";
    } else {
        $compose_uri = $base_uri . 'src/compose.php?newmessage=1';
        $session = 0;
    }
    if ($javascript_on) {
        switch ($module) {
            case 'src/read_body.php':
                $js = '';
                // compose in new window code
                if ($compose_new_win == '1') {
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_width)) {
                        $compose_width = '640';
                    }
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_height)) {
                        $compose_height = '550';
                    }
                    $js .= "function comp_in_new_form(comp_uri, button, myform) {\n" . '   if (!comp_uri) {' . "\n" . '       comp_uri = "' . $compose_uri . "\";\n" . '   }' . "\n" . '   comp_uri += "&" + button.name + "=1";' . "\n" . '   for ( var i=0; i < myform.elements.length; i++ ) {' . "\n" . '      if ( myform.elements[i].type == "checkbox"  && myform.elements[i].checked )' . "\n" . '         comp_uri += "&" + myform.elements[i].name + "=1";' . "\n" . '   }' . "\n" . '   var newwin = window.open(comp_uri' . ', "_blank",' . '"width=' . $compose_width . ',height=' . $compose_height . ',scrollbars=yes,resizable=yes,status=yes");' . "\n" . "}\n\n";
                    $js .= "function comp_in_new(comp_uri) {\n" . "       if (!comp_uri) {\n" . '           comp_uri = "' . $compose_uri . "\";\n" . '       }' . "\n" . '    var newwin = window.open(comp_uri' . ', "_blank",' . '"width=' . $compose_width . ',height=' . $compose_height . ',scrollbars=yes,resizable=yes,status=yes");' . "\n" . "}\n\n";
                }
                // javascript for sending read receipts
                if ($default_use_mdn && $mdn_user_support) {
                    $js .= 'function sendMDN() {' . "\n" . "    mdnuri=window.location+'&sendreceipt=1'; " . "var newwin = window.open(mdnuri,'right');" . "\n}\n\n";
                }
                // if any of the above passes, add the JS tags too.
                if ($js) {
                    $js = "\n" . '<script language="JavaScript" type="text/javascript">' . "\n<!--\n" . $js . "// -->\n</script>\n";
                }
                displayHtmlHeader('SquirrelMail', $js);
                $onload = $xtra;
                break;
            case 'src/compose.php':
                $js = '<script language="JavaScript" type="text/javascript">' . "\n<!--\n" . "function checkForm() {\n";
                global $action, $reply_focus;
                if (strpos($action, 'reply') !== FALSE && $reply_focus) {
                    if ($reply_focus == 'select') {
                        $js .= "document.forms['compose'].body.select();}\n";
                    } else {
                        if ($reply_focus == 'focus') {
                            $js .= "document.forms['compose'].body.focus();}\n";
                        } else {
                            if ($reply_focus == 'none') {
                                $js .= "}\n";
                            }
                        }
                    }
                } else {
                    if ($reply_focus == 'none') {
                        $js .= "}\n";
                    } else {
                        $js .= "var f = document.forms.length;\n" . "var i = 0;\n" . "var pos = -1;\n" . "while( pos == -1 && i < f ) {\n" . "var e = document.forms[i].elements.length;\n" . "var j = 0;\n" . "while( pos == -1 && j < e ) {\n" . "if ( document.forms[i].elements[j].type == 'text' ) {\n" . "pos = j;\n" . "}\n" . "j++;\n" . "}\n" . "i++;\n" . "}\n" . "if( pos >= 0 ) {\n" . "document.forms[i-1].elements[pos].focus();\n" . "}\n" . "}\n";
                    }
                }
                $js .= "// -->\n" . "</script>\n";
                $onload = 'onload="checkForm();"';
                displayHtmlHeader('SquirrelMail', $js);
                break;
            default:
                $js = '<script language="JavaScript" type="text/javascript">' . "\n<!--\n" . "function checkForm() {\n" . "var f = document.forms.length;\n" . "var i = 0;\n" . "var pos = -1;\n" . "while( pos == -1 && i < f ) {\n" . "var e = document.forms[i].elements.length;\n" . "var j = 0;\n" . "while( pos == -1 && j < e ) {\n" . "if ( document.forms[i].elements[j].type == 'text' " . "|| document.forms[i].elements[j].type == 'password' ) {\n" . "pos = j;\n" . "}\n" . "j++;\n" . "}\n" . "i++;\n" . "}\n" . "if( pos >= 0 ) {\n" . "document.forms[i-1].elements[pos].focus();\n" . "}\n" . "{$xtra}\n" . "}\n";
                if ($compose_new_win == '1') {
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_width)) {
                        $compose_width = '640';
                    }
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_height)) {
                        $compose_height = '550';
                    }
                    $js .= "function comp_in_new(comp_uri) {\n" . "       if (!comp_uri) {\n" . '           comp_uri = "' . $compose_uri . "\";\n" . '       }' . "\n" . '    var newwin = window.open(comp_uri' . ', "_blank",' . '"width=' . $compose_width . ',height=' . $compose_height . ',scrollbars=yes,resizable=yes,status=yes");' . "\n" . "}\n\n";
                }
                $js .= "// -->\n" . "</script>\n";
                $onload = 'onload="checkForm();"';
                displayHtmlHeader('SquirrelMail', $js);
                break;
        }
    } else {
        /* do not use JavaScript */
        displayHtmlHeader('SquirrelMail');
        $onload = '';
    }
    echo "<body text=\"{$color['8']}\" bgcolor=\"{$color['4']}\" link=\"{$color['7']}\" vlink=\"{$color['7']}\" alink=\"{$color['7']}\" {$onload}>\n\n";
    /** Here is the header and wrapping table **/
    $shortBoxName = htmlspecialchars(imap_utf7_decode_local(readShortMailboxName($mailbox, $delimiter)));
    if ($shortBoxName == 'INBOX') {
        $shortBoxName = _("INBOX");
    }
    echo "<a name=\"pagetop\"></a>\n" . html_tag('table', '', '', $color[4], 'border="0" width="100%" cellspacing="0" cellpadding="2"') . "\n" . html_tag('tr', '', '', $color[9]) . "\n" . html_tag('td', '', 'left') . "\n";
    if ($shortBoxName != '' && strtolower($shortBoxName) != 'none') {
        echo '         ' . _("Current Folder") . ": <b>{$shortBoxName}&nbsp;</b>\n";
    } else {
        echo '&nbsp;';
    }
    echo "      </td>\n" . html_tag('td', '', 'right') . "<b>\n";
    displayInternalLink('src/signout.php', _("Sign Out"), $frame_top);
    echo "</b></td>\n" . "   </tr>\n" . html_tag('tr', '', '', $color[4]) . "\n" . ($hide_sm_attributions ? html_tag('td', '', 'left', '', 'colspan="2"') : html_tag('td', '', 'left')) . "\n";
    $urlMailbox = urlencode($mailbox);
    echo makeComposeLink('src/compose.php?mailbox=' . $urlMailbox . '&amp;startMessage=' . $startMessage);
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/addressbook.php', _("Addresses"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/folders.php', _("Folders"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/options.php', _("Options"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink("src/search.php?mailbox={$urlMailbox}", _("Search"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/help.php', _("Help"));
    echo "&nbsp;&nbsp;\n";
    do_hook('menuline');
    echo "      </td>\n";
    if (!$hide_sm_attributions) {
        echo html_tag('td', '', 'right') . "\n";
        if (!isset($provider_uri)) {
            $provider_uri = 'http://www.squirrelmail.org/';
        }
        if (!isset($provider_name)) {
            $provider_name = 'SquirrelMail';
        }
        echo '<a href="' . $provider_uri . '" target="_blank">' . $provider_name . '</a>';
        echo "</td>\n";
    }
    echo "   </tr>\n" . "</table><br />\n\n";
}
示例#6
0
/**
 * @param string $mailbox mailbox name utf7 encoded inc. special case INBOX
 * @return string mailbox name ready to display (utf7 decoded or localized INBOX)
 */
function imap_get_mailbox_display($mailbox)
{
    if (strtoupper($mailbox) == 'INBOX') {
        return _("INBOX");
    }
    return imap_utf7_decode_local($mailbox);
}
示例#7
0
/**
 * Presents a confirmation dialog to the user asking whether they're
 * sure they want to delete this folder.
 */
function folders_delete_ask($imapConnection, $folder_name)
{
    global $color, $default_folder_prefix, $oTemplate;
    if ($folder_name == '') {
        plain_error_message(_("You have not selected a folder to delete. Please do so.") . '<br /><a href="../src/folders.php">' . _("Click here to go back") . '</a>.', $color);
        sqimap_logout($imapConnection);
        $oTemplate->display('footer.tpl');
        exit;
    }
    // hide default folder prefix (INBOX., mail/ or other)
    $visible_folder_name = imap_utf7_decode_local($folder_name);
    $quoted_prefix = preg_quote($default_folder_prefix, '/');
    $prefix_length = preg_match("/^{$quoted_prefix}/", $visible_folder_name) ? strlen($default_folder_prefix) : 0;
    $visible_folder_name = substr($visible_folder_name, $prefix_length);
    sqimap_logout($imapConnection);
    $oTemplate->assign('dialog_type', 'delete');
    $oTemplate->assign('folder_name', sm_encode_html_special_chars($folder_name));
    $oTemplate->assign('visible_folder_name', sm_encode_html_special_chars($visible_folder_name));
    $oTemplate->display('folder_manip_dialog.tpl');
    $oTemplate->display('footer.tpl');
    exit;
}
function sqimap_utf7_decode_mbx_tree(&$mbx_tree)
{
    if (strtoupper($mbx_tree->mailboxname_full) == 'INBOX') {
        $mbx_tree->mailboxname_sub = _("INBOX");
    } else {
        $mbx_tree->mailboxname_sub = imap_utf7_decode_local($mbx_tree->mailboxname_sub);
    }
    if ($mbx_tree->mbxs) {
        $iCnt = count($mbx_tree->mbxs);
        for ($i = 0; $i < $iCnt; ++$i) {
            $mbxs_tree->mbxs[$i] = sqimap_utf7_decode_mbx_tree($mbx_tree->mbxs[$i]);
        }
    }
}
sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
sqgetGlobalVar('mailbox', $mailbox, SQ_POST);
/* end globals */
if ($mailbox == '') {
    displayPageHeader($color, 'None');
    plain_error_message(_("You have not selected a folder to delete. Please do so.") . '<br /><a href="../src/folders.php">' . _("Click here to go back") . '</a>.', $color);
    exit;
}
if (sqgetGlobalVar('backingout', $tmp, SQ_POST)) {
    $location = get_location();
    header("Location: {$location}/folders.php");
    exit;
}
if (!sqgetGlobalVar('confirmed', $tmp, SQ_POST)) {
    displayPageHeader($color, 'None');
    echo '<br />' . html_tag('table', '', 'center', '', 'width="95%" border="0"') . html_tag('tr', html_tag('td', '<b>' . _("Delete Folder") . '</b>', 'center', $color[0])) . html_tag('tr') . html_tag('td', '', 'center', $color[4]) . sprintf(_("Are you sure you want to delete %s?"), str_replace(array(' ', '<', '>'), array('&nbsp;', '&lt;', '&gt;'), imap_utf7_decode_local($mailbox))) . addForm('folders_delete.php', 'post') . "<p>\n" . addHidden('mailbox', $mailbox) . addSubmit(_("Yes"), 'confirmed') . addSubmit(_("No"), 'backingout') . '</p></form><br /></td></tr></table>';
    exit;
}
$imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
$boxes = sqimap_mailbox_list($imap_stream);
$numboxes = count($boxes);
global $delete_folder;
if (substr($mailbox, -1) == $delimiter) {
    $mailbox_no_dm = substr($mailbox, 0, strlen($mailbox) - 1);
} else {
    $mailbox_no_dm = $mailbox;
}
/** lets see if we CAN move folders to the trash.. otherwise,
 ** just delete them **/
if (isset($delete_folder) && $delete_folder || eregi('^' . $trash_folder . '.+', $mailbox)) {
    $can_move_to_trash = FALSE;
示例#10
0
if ($show_only_subscribed_folders && !$no_list_for_subscribe) {
    // FIXME: fix subscription options when top folder is not subscribed and sub folder is subscribed
    // TODO: use checkboxes instead of select options.
    // DONE Steve Brown 2006-08-08
    /** SUBSCRIBE TO FOLDERS **/
    $boxes_all = sqimap_mailbox_list_all($imapConnection);
    // here we filter out all boxes we're already subscribed to,
    // so we keep only the unsubscribed ones.
    foreach ($boxes_all as $box_a) {
        $use_folder = true;
        foreach ($boxes as $box) {
            if ($box_a['unformatted'] == $box['unformatted'] || $box_a['unformatted-dm'] == $folder_prefix) {
                $use_folder = false;
            }
        }
        if ($use_folder) {
            $box_enc = sm_encode_html_special_chars($box_a['unformatted-dm']);
            $box_disp = sm_encode_html_special_chars(imap_utf7_decode_local($box_a['unformatted-disp']));
            $subbox_option_list[] = array('Value' => $box_enc, 'Display' => $box_disp);
        }
    }
}
sqimap_logout($imapConnection);
$oTemplate->assign('show_subfolders_option', $show_contain_subfolders_option);
$oTemplate->assign('show_only_subscribed_folders', $show_only_subscribed_folders == 1);
$oTemplate->assign('no_list_for_subscribe', $no_list_for_subscribe);
$oTemplate->assign('mbx_option_list', $mbx_option_list);
$oTemplate->assign('rendel_folder_list', $rendel_folder_list);
$oTemplate->assign('subbox_option_list', $subbox_option_list);
$oTemplate->display('folder_manip.tpl');
$oTemplate->display('footer.tpl');
示例#11
0
/**
 *  Returns a list of all folders, subscribed or not
 */
function sqimap_mailbox_list_all($imap_stream)
{
    global $list_special_folders_first, $folder_prefix, $delimiter;
    $ssid = sqimap_session_id();
    $lsid = strlen($ssid);
    fputs($imap_stream, $ssid . " LIST \"{$folder_prefix}\" *\r\n");
    $read_ary = sqimap_read_data($imap_stream, $ssid, true, $response, $message);
    $g = 0;
    $phase = 'inbox';
    $fld_pre_length = strlen($folder_prefix);
    for ($i = 0, $cnt = count($read_ary); $i < $cnt; $i++) {
        /* Another workaround for EIMS */
        if (isset($read_ary[$i + 1]) && ereg("^(\\* [A-Z]+.*)\\{[0-9]+\\}([ \n\r\t]*)\$", $read_ary[$i], $regs)) {
            $i++;
            $read_ary[$i] = $regs[1] . '"' . addslashes(trim($read_ary[$i])) . '"' . $regs[2];
        }
        if (substr($read_ary[$i], 0, $lsid) != $ssid) {
            /* Store the raw IMAP reply */
            $boxes[$g]['raw'] = $read_ary[$i];
            /* Count number of delimiters ($delimiter) in folder name */
            $mailbox = find_mailbox_name($read_ary[$i]);
            $dm_count = substr_count($mailbox, $delimiter);
            if (substr($mailbox, -1) == $delimiter) {
                /* If name ends in delimiter - decrement count by one */
                $dm_count--;
            }
            /* Format folder name, but only if it's a INBOX.* or has a parent. */
            $boxesallbyname[$mailbox] = $g;
            $parentfolder = readMailboxParent($mailbox, $delimiter);
            if (eregi('^inbox' . quotemeta($delimiter), $mailbox) || ereg('^' . $folder_prefix, $mailbox) || isset($boxesallbyname[$parentfolder]) && strlen($parentfolder) > 0) {
                if ($dm_count) {
                    $boxes[$g]['formatted'] = str_repeat('&nbsp;&nbsp;', $dm_count);
                } else {
                    $boxes[$g]['formatted'] = '';
                }
                $boxes[$g]['formatted'] .= imap_utf7_decode_local(readShortMailboxName($mailbox, $delimiter));
            } else {
                $boxes[$g]['formatted'] = imap_utf7_decode_local($mailbox);
            }
            $boxes[$g]['unformatted-dm'] = $mailbox;
            if (substr($mailbox, -1) == $delimiter) {
                $mailbox = substr($mailbox, 0, strlen($mailbox) - 1);
            }
            $boxes[$g]['unformatted'] = $mailbox;
            $boxes[$g]['unformatted-disp'] = substr($mailbox, $fld_pre_length);
            $boxes[$g]['id'] = $g;
            /* Now lets get the flags for this mailbox */
            $read_mlbx = $read_ary[$i];
            //            $read_mlbx = sqimap_run_command ($imap_stream, "LIST \"\" \"$mailbox\"",
            //                                             true, $response, $message);
            /* Another workaround for EIMS */
            //            if (isset($read_mlbx[1]) &&
            //                ereg("^(\\* [A-Z]+.*)\\{[0-9]+\\}([ \n\r\t]*)$", $read_mlbx[0], $regs)) {
            //                $read_mlbx[0] = $regs[1] . '"' . addslashes(trim($read_mlbx[1])) . '"' . $regs[2];
            //            }
            //            echo  $read_mlbx[0] .' raw 2 <br>';
            $flags = substr($read_mlbx, strpos($read_mlbx, '(') + 1);
            $flags = substr($flags, 0, strpos($flags, ')'));
            $flags = str_replace('\\', '', $flags);
            $flags = trim(strtolower($flags));
            if ($flags) {
                $boxes[$g]['flags'] = explode(' ', $flags);
            } else {
                $boxes[$g]['flags'] = array();
            }
        }
        $g++;
    }
    if (is_array($boxes)) {
        sort($boxes);
    }
    return $boxes;
}
示例#12
0
function displayPageHeader($color, $mailbox, $xtra = '', $session = false)
{
    global $hide_sm_attributions, $frame_top, $compose_new_win, $compose_width, $compose_height, $attachemessages, $provider_name, $provider_uri, $javascript_on, $default_use_mdn, $mdn_user_support, $startMessage, $org_title;
    sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
    sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
    if (!isset($frame_top)) {
        $frame_top = '_top';
    }
    if ($session) {
        $compose_uri = $base_uri . 'src/compose.php?mailbox=' . urlencode($mailbox) . '&amp;session=' . "{$session}";
    } else {
        $compose_uri = $base_uri . 'src/compose.php?newmessage=1';
        $session = 0;
    }
    // only output JavaScript if actually turned on
    if ($javascript_on || strpos($xtra, 'new_js_autodetect_results.value')) {
        if (!defined('PAGE_NAME')) {
            define('PAGE_NAME', NULL);
        }
        switch (PAGE_NAME) {
            case 'read_body':
                $js = '';
                // compose in new window code
                if ($compose_new_win == '1') {
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_width)) {
                        $compose_width = '640';
                    }
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_height)) {
                        $compose_height = '550';
                    }
                    $js .= "function comp_in_new(comp_uri) {\n" . "       if (!comp_uri) {\n" . '           comp_uri = "' . $compose_uri . "\";\n" . '       }' . "\n" . '    var newwin = window.open(comp_uri' . ', "_blank",' . '"width=' . $compose_width . ',height=' . $compose_height . ',scrollbars=yes,resizable=yes,status=yes");' . "\n" . "}\n\n";
                }
                // javascript for sending read receipts
                if ($default_use_mdn && $mdn_user_support) {
                    $js .= "function sendMDN() {\n" . "    mdnuri=window.location+'&sendreceipt=1';\n" . "    window.location = mdnuri;\n" . "\n}\n\n";
                }
                // if any of the above passes, add the JS tags too.
                if ($js) {
                    $js = "\n" . '<script language="JavaScript" type="text/javascript">' . "\n<!--\n" . $js . "// -->\n</script>\n";
                }
                displayHtmlHeader($org_title, $js);
                $onload = $xtra;
                break;
            case 'compose':
                $js = '<script language="JavaScript" type="text/javascript">' . "\n<!--\n" . "var alreadyFocused = false;\n" . "function checkForm() {\n" . "\n    if (alreadyFocused) return;\n";
                global $action, $reply_focus;
                if (strpos($action, 'reply') !== FALSE && $reply_focus) {
                    if ($reply_focus == 'select') {
                        $js .= "document.forms['compose'].body.select();}\n";
                    } else {
                        if ($reply_focus == 'focus') {
                            $js .= "document.forms['compose'].body.focus();}\n";
                        } else {
                            if ($reply_focus == 'none') {
                                $js .= "}\n";
                            }
                        }
                    }
                } else {
                    if ($reply_focus == 'none') {
                        $js .= "}\n";
                    } else {
                        $js .= "    var f = document.forms.length;\n" . "    var i = 0;\n" . "    var pos = -1;\n" . "    while( pos == -1 && i < f ) {\n" . "        var e = document.forms[i].elements.length;\n" . "        var j = 0;\n" . "        while( pos == -1 && j < e ) {\n" . "            if ( document.forms[i].elements[j].type == 'text' ) {\n" . "                pos = j;\n" . "            }\n" . "            j++;\n" . "        }\n" . "        i++;\n" . "    }\n" . "    if( pos >= 0 ) {\n" . "        document.forms[i-1].elements[pos].focus();\n" . "    }\n" . "}\n";
                    }
                }
                $js .= "// -->\n" . "</script>\n";
                $onload = 'onload="checkForm();"';
                displayHtmlHeader($org_title, $js);
                break;
            default:
                $js = '<script language="JavaScript" type="text/javascript">' . "\n<!--\n" . "function checkForm() {\n" . "   var f = document.forms.length;\n" . "   var i = 0;\n" . "   var pos = -1;\n" . "   while( pos == -1 && i < f ) {\n" . "       var e = document.forms[i].elements.length;\n" . "       var j = 0;\n" . "       while( pos == -1 && j < e ) {\n" . "           if ( document.forms[i].elements[j].type == 'text' " . "           || document.forms[i].elements[j].type == 'password' ) {\n" . "               pos = j;\n" . "           }\n" . "           j++;\n" . "       }\n" . "   i++;\n" . "   }\n" . "   if( pos >= 0 ) {\n" . "       document.forms[i-1].elements[pos].focus();\n" . "   }\n" . "   {$xtra}\n" . "}\n";
                if ($compose_new_win == '1') {
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_width)) {
                        $compose_width = '640';
                    }
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_height)) {
                        $compose_height = '550';
                    }
                    $js .= "function comp_in_new(comp_uri) {\n" . "       if (!comp_uri) {\n" . '           comp_uri = "' . $compose_uri . "\";\n" . '       }' . "\n" . '    var newwin = window.open(comp_uri' . ', "_blank",' . '"width=' . $compose_width . ',height=' . $compose_height . ',scrollbars=yes,resizable=yes,status=yes");' . "\n" . "}\n\n";
                }
                $js .= "// -->\n" . "</script>\n";
                $onload = 'onload="checkForm();"';
                displayHtmlHeader($org_title, $js);
        }
        // end switch module
    } else {
        // JavaScript off
        displayHtmlHeader($org_title);
        $onload = '';
    }
    $google = "\n<script type=\"text/javascript\"><!--\ngoogle_ad_client = \"pub-0768633782379013\";\n//ehcp-webmail-468x60\ngoogle_ad_slot = \"6865422642\";\ngoogle_ad_width = 468;\ngoogle_ad_height = 60;\n//--></script>\n<script type=\"text/javascript\"\nsrc=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">\n</script>\n";
    echo "<body text=\"{$color['8']}\" bgcolor=\"{$color['4']}\" link=\"{$color['7']}\" vlink=\"{$color['7']}\" alink=\"{$color['7']}\" {$onload}>\n\n {$google} ";
    /** Here is the header and wrapping table **/
    $shortBoxName = htmlspecialchars(imap_utf7_decode_local(readShortMailboxName($mailbox, $delimiter)));
    if ($shortBoxName == 'INBOX') {
        $shortBoxName = _("INBOX");
    }
    echo "<a name=\"pagetop\"></a>\n" . html_tag('table', '', '', $color[4], 'border="0" width="100%" cellspacing="0" cellpadding="2"') . "\n" . html_tag('tr', '', '', $color[9]) . "\n" . html_tag('td', '', 'left') . "\n";
    if ($shortBoxName != '' && strtolower($shortBoxName) != 'none') {
        echo '         ' . _("Current Folder") . ": <b>{$shortBoxName}&nbsp;</b>\n";
    } else {
        echo '&nbsp;';
    }
    echo "      </td>\n" . html_tag('td', '', 'right') . "<b>\n";
    displayInternalLink('src/signout.php', _("Sign Out"), $frame_top);
    echo "</b></td>\n" . "   </tr>\n" . html_tag('tr', '', '', $color[4]) . "\n" . ($hide_sm_attributions ? html_tag('td', '', 'left', '', 'colspan="2"') : html_tag('td', '', 'left')) . "\n";
    $urlMailbox = urlencode($mailbox);
    $startMessage = (int) $startMessage;
    echo makeComposeLink('src/compose.php?mailbox=' . $urlMailbox . '&amp;startMessage=' . $startMessage);
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/addressbook.php', _("Addresses"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/folders.php', _("Folders"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/options.php', _("Options"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink("src/search.php?mailbox={$urlMailbox}", _("Search"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/help.php', _("Help"));
    echo "&nbsp;&nbsp;\n";
    do_hook('menuline');
    echo "      </td>\n";
    if (!$hide_sm_attributions) {
        echo html_tag('td', '', 'right') . "\n";
        if (!isset($provider_uri)) {
            $provider_uri = 'http://squirrelmail.org/';
        }
        if (!isset($provider_name)) {
            $provider_name = 'SquirrelMail';
        }
        echo '<a href="' . $provider_uri . '" target="_blank">' . $provider_name . '</a>';
        echo "</td>\n";
    }
    echo "   </tr>\n" . "</table><br>\n\n";
}
示例#13
0
文件: search.php 项目: jprice/EHCP
function printSearchMessages($msgs, $mailbox, $cnt, $imapConnection, $where, $what, $usecache = false, $newsort = false)
{
    global $sort, $color, $allow_server_sort, $allow_server_thread;
    if ($cnt > 0) {
        if (!empty($allow_server_sort) && $allow_server_sort || !empty($allow_server_thread) && $allow_server_thread) {
            $msort = $msgs;
        } else {
            $msort = calc_msort($msgs, $sort);
        }
        if ($mailbox == 'INBOX') {
            $showbox = _("INBOX");
        } else {
            $showbox = imap_utf7_decode_local($mailbox);
        }
        echo html_tag('div', '<b><big>' . _("Folder:") . ' ' . htmlspecialchars($showbox) . '</big></b>', 'center') . "\n";
        $msg_cnt_str = get_msgcnt_str(1, $cnt, $cnt);
        $toggle_all = get_selectall_link(1, $sort);
        $safe_name = preg_replace("/[^0-9A-Za-z_]/", '_', $mailbox);
        $form_name = "FormMsgs" . $safe_name;
        echo '<form name="' . $form_name . '" method="post" action="move_messages.php">' . "\n" . '<input type="hidden" name="mailbox" value="' . htmlspecialchars($mailbox) . '">' . "\n" . '<input type="hidden" name="startMessage" value="1">' . "\n";
        echo '<table border="0" width="100%" cellpadding="0" cellspacing="0">';
        echo '<tr><td>';
        mail_message_listing_beginning($imapConnection, $mailbox, $sort, $msg_cnt_str, $toggle_all, 1);
        echo '</td></tr>';
        echo '<tr><td height="5" bgcolor="' . $color[4] . '"></td></tr>';
        echo '<tr><td>';
        echo '    <table width="100%" cellpadding="1" cellspacing="0" align="center"' . ' border="0" bgcolor="' . $color[9] . '">';
        echo '     <tr><td>';
        echo '       <table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="' . $color[5] . '">';
        echo '<tr><td>';
        printHeader($mailbox, 6, $color, false);
        displayMessageArray($imapConnection, $cnt, 1, $msort, $mailbox, $sort, $color, $cnt, $where, $what);
        echo '</td></tr></table></td></tr></table>';
        mail_message_listing_end($cnt, '', $msg_cnt_str, $color);
        echo "\n</table></form>\n\n";
    }
}
示例#14
0
/**
 * @param object $mbx_tree
 * @since 1.5.0
 */
function sqimap_utf7_decode_mbx_tree(&$mbx_tree)
{
    global $draft_folder, $sent_folder, $trash_folder, $translate_special_folders;
    /* decode folder name and set mailboxname_sub */
    if ($translate_special_folders && strtoupper($mbx_tree->mailboxname_full) == 'INBOX') {
        $mbx_tree->mailboxname_sub = _("INBOX");
    } elseif ($translate_special_folders && $mbx_tree->mailboxname_full == $draft_folder) {
        $mbx_tree->mailboxname_sub = _("Drafts");
    } elseif ($translate_special_folders && $mbx_tree->mailboxname_full == $sent_folder) {
        $mbx_tree->mailboxname_sub = _("Sent");
    } elseif ($translate_special_folders && $mbx_tree->mailboxname_full == $trash_folder) {
        $mbx_tree->mailboxname_sub = _("Trash");
    } else {
        $mbx_tree->mailboxname_sub = imap_utf7_decode_local($mbx_tree->mailboxname_sub);
    }
    if ($mbx_tree->mbxs) {
        $iCnt = count($mbx_tree->mbxs);
        for ($i = 0; $i < $iCnt; ++$i) {
            sqimap_utf7_decode_mbx_tree($mbx_tree->mbxs[$i]);
        }
    }
}
示例#15
0
    $box = $box2 = array();
    for ($i = 0, $q = 0; $i < count($boxes_all); $i++) {
        $use_folder = true;
        for ($p = 0; $p < count($boxes); $p++) {
            if ($boxes_all[$i]['unformatted'] == $boxes[$p]['unformatted']) {
                $use_folder = false;
                continue;
            } else {
                if ($boxes_all[$i]['unformatted-dm'] == $folder_prefix) {
                    $use_folder = false;
                }
            }
        }
        if ($use_folder == true) {
            $box[$q] = $boxes_all[$i]['unformatted-dm'];
            $box2[$q] = imap_utf7_decode_local($boxes_all[$i]['unformatted-disp']);
            $q++;
        }
    }
    if (count($box) > 0) {
        echo addForm('folders_subscribe.php?method=sub') . '<tt><select name="mailbox[]" multiple="multiple" size="8">';
        for ($q = 0; $q < count($box); $q++) {
            echo '         <option value="' . $box[$q] . '">' . str_replace(array(' ', '<', '>'), array('&nbsp;', '&lt;', '&gt;'), $box2[$q]) . "</option>\n";
        }
        echo '</select></tt><br /><br />' . '<input type="submit" value="' . _("Subscribe") . "\" />\n" . "</form></td></tr></table><br />\n";
    } else {
        echo _("No folders were found to subscribe to!") . '</td></tr></table>';
    }
} else {
    /* don't perform the list action -- this is much faster */
    echo addForm('folders_subscribe.php?method=sub') . _("Subscribe to:") . '<br />' . '<tt><input type="text" name="mailbox[]" size="35" />' . '<input type="submit" value="' . _("Subscribe") . "\" />\n" . "</form></td></tr></table>\n";
示例#16
0
sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
sqgetGlobalVar('old', $old, SQ_POST);
/* end of get globals */
if ($old == '') {
    displayPageHeader($color, 'None');
    plain_error_message(_("You have not selected a folder to rename. Please do so.") . '<br /><a href="../src/folders.php">' . _("Click here to go back") . '</a>.', $color);
    exit;
}
if (substr($old, strlen($old) - strlen($delimiter)) == $delimiter) {
    $isfolder = TRUE;
    $old = substr($old, 0, strlen($old) - 1);
} else {
    $isfolder = FALSE;
}
$old = imap_utf7_decode_local($old);
// displayable mailbox format is without folder prefix on front
global $folder_prefix;
if (substr($old, 0, strlen($folder_prefix)) == $folder_prefix) {
    $displayable_old = substr($old, strlen($folder_prefix));
} else {
    $displayable_old = $old;
}
if (strpos($displayable_old, $delimiter)) {
    $old_name = substr($displayable_old, strrpos($displayable_old, $delimiter) + 1);
    $parent = htmlspecialchars(substr($displayable_old, 0, strrpos($displayable_old, $delimiter)) . ' ' . $delimiter);
} else {
    $old_name = $displayable_old;
    $parent = '';
}
displayPageHeader($color, 'None');
function error_message($message, $mailbox, $sort, $startMessage, $color)
{
    $urlMailbox = urlencode($mailbox);
    $string = '<tr><td align="center">' . $message . '</td></tr>' . '<tr><td align="center">' . '<a href="' . sqm_baseuri() . "src/right_main.php?sort={$sort}&amp;startMessage={$startMessage}&amp;mailbox={$urlMailbox}\">" . sprintf(_("Click here to return to %s"), strtoupper($mailbox) == 'INBOX' ? _("INBOX") : imap_utf7_decode_local($mailbox)) . '</a></td></tr>';
    error_box($string, $color);
}
示例#18
0
    $box2 = '';
    for ($i = 0, $q = 0; $i < count($boxes_all); $i++) {
        $use_folder = true;
        for ($p = 0; $p < count($boxes); $p++) {
            if ($boxes_all[$i]['unformatted'] == $boxes[$p]['unformatted']) {
                $use_folder = false;
                continue;
            } else {
                if ($boxes_all[$i]['unformatted-dm'] == $folder_prefix) {
                    $use_folder = false;
                }
            }
        }
        if ($use_folder == true) {
            $box[$q] = htmlspecialchars($boxes_all[$i]['unformatted-dm']);
            $box2[$q] = htmlspecialchars(imap_utf7_decode_local($boxes_all[$i]['unformatted-disp']));
            $q++;
        }
    }
    if ($box && $box2) {
        echo addForm('folders_subscribe.php?method=sub') . '<tt><select name="mailbox[]" multiple="multiple" size="8">';
        for ($q = 0; $q < count($box); $q++) {
            echo '         <option value="' . $box[$q] . '">' . $box2[$q] . "</option>\n";
        }
        echo '</select></tt><br /><br />' . '<input type="submit" value="' . _("Subscribe") . "\" />\n" . "</form></td></tr></table><br />\n";
    } else {
        echo _("No folders were found to subscribe to!") . '</td></tr></table>';
    }
} else {
    /* don't perform the list action -- this is much faster */
    echo addForm('folders_subscribe.php?method=sub') . _("Subscribe to:") . '<br />' . '<tt><input type="text" name="mailbox[]" size="35" />' . '<input type="submit" value="' . _("Subscribe") . "\" />\n" . "</form></td></tr></table><br />\n";
示例#19
0
文件: options.php 项目: jprice/EHCP
    $selected = 0;
    if (isset($filters[$theid]['folder'])) {
        $selected = array(strtolower($filters[$theid]['folder']));
    }
    echo sqimap_mailbox_option_list(0, $selected, 0, $boxes);
    echo '</tt>' . '</select>' . '</td>' . '</tr>' . '</table>' . '<input type="submit" name="filter_submit" value="' . _("Submit") . "\" />\n" . addHidden('theid', $theid) . '</form>' . '</div>';
}
echo html_tag('table', '', 'center', '', 'border="0" cellpadding="3" cellspacing="0"');
for ($i = 0, $num = count($filters); $i < $num; $i++) {
    $clr = $i % 2 ? $color[0] : $color[9];
    $fdr = $folder_prefix ? str_replace($folder_prefix, "", $filters[$i]["folder"]) : $filters[$i]["folder"];
    echo html_tag('tr', '', '', $clr) . html_tag('td', '<small>' . "[<a href=\"options.php?theid={$i}&amp;action=edit\">" . _("Edit") . '</a>]' . '</small>', 'left') . html_tag('td', '<small>' . "[<a href=\"options.php?theid={$i}&amp;action=delete\">" . _("Delete") . '</a>]' . '</small>', 'left');
    if ($num > 1) {
        echo html_tag('td', '', 'center') . '<small>[';
        if (isset($filters[$i + 1])) {
            echo "<a href=\"options.php?theid={$i}&amp;action=move_down\">" . _("Down") . '</a>';
            if ($i > 0) {
                echo '&nbsp;|&nbsp;';
            }
        }
        if ($i > 0) {
            echo "<a href=\"options.php?theid={$i}&amp;action=move_up\">" . _("Up") . '</a>';
        }
        echo ']</small></td>';
    }
    echo html_tag('td', '-', 'left') . html_tag('td', '', 'left');
    printf(_("If %s contains %s then move to %s"), '<b>' . $filters[$i]['where'] . '</b>', '<b>' . $filters[$i]['what'] . '</b>', '<b>' . htmlspecialchars(imap_utf7_decode_local($fdr)) . '</b>');
    echo '</td></tr>';
}
echo '</table>' . html_tag('table', html_tag('tr', html_tag('td', '&nbsp;', 'left')), 'center', '', 'width="80%" border="0" cellpadding="2" cellspacing="0"');
echo '</body></html>';