示例#1
0
    // send NULL for the flag - ALL folders are eligible for rename!
    // use long format to make sure folder names make sense when parents may be missing.
    echo sqimap_mailbox_option_list($imapConnection, 0, $skip_folders, $boxes, NULL, true);
    echo "</select></tt>\n" . '<input type="submit" value="' . _("Rename") . "\" />\n" . "</form></td></tr>\n";
} else {
    echo _("No folders found") . '<br /><br /></td></tr>';
}
$boxes_sub = $boxes;
echo html_tag('tr', html_tag('td', '&nbsp;', 'left', $color[4])) . "\n";
/** DELETING FOLDERS **/
echo html_tag('tr', html_tag('td', '<b>' . _("Delete Folder") . '</b>', 'center', $color[9])) . html_tag('tr') . html_tag('td', '', 'center', $color[0]);
if ($count_special_folders < count($boxes)) {
    echo addForm('folders_delete.php') . "<tt><select name=\"mailbox\">\n" . '         <option value="">[ ' . _("Select a folder") . " ]</option>\n";
    // send NULL for the flag - ALL folders are eligible for delete (except what we've got in skiplist)
    // use long format to make sure folder names make sense when parents may be missing.
    echo sqimap_mailbox_option_list($imapConnection, 0, $skip_folders, $boxes, NULL, true);
    echo "</select></tt>\n" . '<input type="submit" value="' . _("Delete") . "\" />\n" . "</form></td></tr>\n";
} else {
    echo _("No folders found") . "<br /><br /></td></tr>";
}
echo html_tag('tr', html_tag('td', '&nbsp;', 'left', $color[4])) . "</table>\n";
/** UNSUBSCRIBE FOLDERS **/
echo html_tag('table', '', 'center', '', 'width="70%" cellpadding="4" cellspacing="0" border="0"') . html_tag('tr', html_tag('td', '<b>' . _("Unsubscribe") . '/' . _("Subscribe") . '</b>', 'center', $color[9], 'colspan="2"')) . html_tag('tr') . html_tag('td', '', 'center', $color[0], 'width="50%"');
if ($count_special_folders < count($boxes)) {
    echo addForm('folders_subscribe.php?method=unsub') . "<tt><select name=\"mailbox[]\" multiple=\"multiple\" size=\"8\">\n";
    for ($i = 0; $i < count($boxes); $i++) {
        $use_folder = true;
        if (strtolower($boxes[$i]["unformatted"]) != "inbox" && $boxes[$i]["unformatted"] != $trash_folder && $boxes[$i]["unformatted"] != $sent_folder && $boxes[$i]["unformatted"] != $draft_folder) {
            $box = htmlspecialchars($boxes[$i]["unformatted-dm"]);
            $box2 = str_replace(' ', '&nbsp;', htmlspecialchars(imap_utf7_decode_local($boxes[$i]["unformatted-disp"])));
            echo "         <option value=\"{$box}\">{$box2}</option>\n";
示例#2
0
            for ($i = 0; $i < $mailfetch_server_number; $i++) {
                echo "<option value=\"{$i}\">" . sm_encode_html_special_chars($mailfetch_alias_[$i] == '' ? $mailfetch_server_[$i] : $mailfetch_alias_[$i]) . "</option>";
            }
            echo '</select>' . '&nbsp;&nbsp;<input type="submit" name="mf_action_mod" value="' . _("Modify") . '" />' . '&nbsp;&nbsp;<input type="submit" name="mf_action_del" value="' . _("Delete") . '" />' . '</form>';
        } else {
            echo _("No servers known.");
        }
        echo '</td></tr></table>';
        break;
    case 'Delete':
        //erase confirmation about a server
        echo html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Fetching Servers") . '</b>', 'center', $color[0])), 'center', '', 'width="95%" cellpadding="5" cellspacing="1"') . '<br />' . html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Confirm Deletion of a Server") . '</b>', 'center', $color[9])) . html_tag('tr', html_tag('td', "<input type=\"hidden\" name=\"mf_sn\" value=\"{$mf_sn}\" />" . '<input type="hidden" name="mf_action" value="confirm_delete" />' . '<br />' . _("Selected Server:") . " <b>" . sm_encode_html_special_chars($mailfetch_server_[$mf_sn]) . "</b><br />" . _("Confirm delete of selected server?") . '<br /><br />' . '<input type="submit" name="submit_mailfetch" value="' . _("Confirm Delete") . '" />' . '<br /></form>', 'center', $color[9])), 'center', '', 'width="70%" cellpadding="5" cellspacing="1"');
        break;
        //modify a server
    //modify a server
    case 'Modify':
        echo html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Fetching Servers") . '</b>', 'center', $color[0])), 'center', '', 'width="95%" cellpadding="5" cellspacing="1"') . '<br />' . html_tag('table', '', 'center', '', 'width="70%" cellpadding="5" cellspacing="1"') . html_tag('tr', html_tag('td', '<b>' . _("Modify Server") . '</b>', 'center', $color[9])) . html_tag('tr') . html_tag('td', '', 'center', $color[0]) . "<input type=\"hidden\" name=\"mf_sn\" value=\"{$mf_sn}\" />" . '<input type="hidden" name="mf_action" value="confirm_modify" />' . html_tag('table') . html_tag('tr', html_tag('th', _("Server:"), 'right') . html_tag('td', '<input type="text" name="mf_server" value="' . sm_encode_html_special_chars($mailfetch_server_[$mf_sn]) . '" size="40" />', 'left')) . html_tag('tr', html_tag('th', _("Port:"), 'right') . html_tag('td', '<input type="text" name="mf_port" value="' . sm_encode_html_special_chars($mailfetch_port_[$mf_sn]) . '" size="40" />', 'left')) . html_tag('tr', html_tag('th', _("Alias:"), 'right') . html_tag('td', '<input type="text" name="mf_alias" value="' . sm_encode_html_special_chars($mailfetch_alias_[$mf_sn]) . '" size="40" />', 'left')) . html_tag('tr', html_tag('th', _("Username:"******"text" name="mf_user" value="' . sm_encode_html_special_chars($mailfetch_user_[$mf_sn]) . '" size="20" />', 'left')) . html_tag('tr', html_tag('th', _("Password:"******"password" name="mf_pass" value="' . sm_encode_html_special_chars($mailfetch_pass_[$mf_sn]) . '" size="20" />', 'left')) . html_tag('tr', html_tag('th', _("Authentication type:"), 'right') . html_tag('td', addSelect('mf_auth', array(MAIL_FETCH_AUTH_USER => _("USER"), MAIL_FETCH_AUTH_APOP => _("APOP"), MAIL_FETCH_AUTH_RFC1939 => _("APOP or USER")), $mailfetch_auth_[$mf_sn], true), 'left')) . html_tag('tr', html_tag('th', _("Connection type:"), 'right') . html_tag('td', addSelect('mf_type', array(MAIL_FETCH_USE_PLAIN => _("Plain text"), MAIL_FETCH_USE_TLS => _("Use TLS"), MAIL_FETCH_USE_STLS => _("Use StartTLS")), $mailfetch_type_[$mf_sn], true), 'left')) . html_tag('tr') . html_tag('th', _("Store in Folder:"), 'right') . html_tag('td', '', 'left');
        $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imap_stream_options);
        $boxes = sqimap_mailbox_list($imapConnection);
        echo '<select name="mf_subfolder">';
        $selected = 0;
        if (isset($mailfetch_subfolder_[$mf_sn])) {
            $selected = array(strtolower($mailfetch_subfolder_[$mf_sn]));
        }
        echo sqimap_mailbox_option_list($imapConnection, $selected) . '</select></td></tr>' . html_tag('tr', html_tag('th', '&nbsp;', 'right') . html_tag('td', '<input type="checkbox" name="mf_lmos" ' . ($mailfetch_lmos_[$mf_sn] == 'on' ? 'checked="checked"' : '') . ' />' . _("Leave Mail on Server"), 'left')) . html_tag('tr', html_tag('th', '&nbsp;', 'right') . html_tag('td', '<input type="checkbox" name="mf_login" ' . ($mailfetch_login_[$mf_sn] == 'on' ? 'checked="checked"' : '') . ' />' . _("Check mail at login"), 'left')) . html_tag('tr', html_tag('th', '&nbsp;', 'right') . html_tag('td', '<input type="checkbox" name="mf_fref" ' . ($mailfetch_fref_[$mf_sn] == 'on' ? 'checked="checked"' : '') . ' />' . _("Check mail at folder refresh"), 'left')) . html_tag('tr', html_tag('td', '<input type="submit" name="submit_mailfetch" value="' . _("Modify Server") . '" />', 'center', '', 'colspan="2"')) . '</table></form></td></tr></table>';
        break;
    default:
        //unsupported action
        echo '</form>' . html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Fetching Servers") . '</b>', 'center', $color[0])), 'center', '', 'width="95%"') . '<br />' . html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Undefined Function") . '</b>', 'center', $color[9]) . html_tag('td', '<b>' . _("The function you requested is unknown.") . '</b>', 'center', $color[0])), 'center', '', 'width="70%"');
}
$oTemplate->display('footer.tpl');
示例#3
0
if (isset($action) && $action == 'spam') {
    $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
    $boxes = sqimap_mailbox_list($imapConnection);
    sqimap_logout($imapConnection);
    $numboxes = count($boxes);
    for ($i = 0; $i < $numboxes && $filters_spam_folder == ''; $i++) {
        if (isset($boxes[$i]['flags'][0]) && $boxes[$i]['flags'][0] != 'noselect' && (isset($boxes[$i]['flags'][1]) && $boxes[$i]['flags'][1] != 'noselect') && (isset($boxes[$i]['flags'][2]) && $boxes[$i]['flags'][2] != 'noselect')) {
            $filters_spam_folder = $boxes[$i]['unformatted'];
        }
    }
    echo '<form method="post" action="spamoptions.php">' . '<center>' . html_tag('table', '', '', '', 'width="85%" border="0" cellpadding="2" cellspacing="0"') . html_tag('tr') . html_tag('th', _("Move spam to:"), 'right', '', 'nowrap') . html_tag('td', '', 'left') . '<select name="filters_spam_folder_set">';
    $selected = 0;
    if (isset($filters_spam_folder)) {
        $selected = array(strtolower($filters_spam_folder));
    }
    echo sqimap_mailbox_option_list(0, $selected, 0, $boxes);
    echo '</select>' . '</td>' . '</tr>' . html_tag('tr', html_tag('td', '&nbsp;') . html_tag('td', _("Moving spam directly to the trash may not be a good idea at first, since messages from friends and mailing lists might accidentally be marked as spam. Whatever folder you set this to, make sure that it gets cleaned out periodically, so that you don't have an excessively large mailbox hanging around."), 'left')) . html_tag('tr') . html_tag('th', _("What to Scan:"), 'right', '', 'nowrap') . html_tag('td') . '<select name="filters_spam_scan_set">' . '<option value=""';
    if ($filters_spam_scan == '') {
        echo ' selected="selected"';
    }
    echo '>' . _("All messages") . '</option>' . '<option value="new"';
    if ($filters_spam_scan == 'new') {
        echo ' selected="selected"';
    }
    echo '>' . _("Unread messages only") . '</option>' . '</select>' . '</td>' . '</tr>' . html_tag('tr', html_tag('td', '&nbsp;') . html_tag('td', _("The more messages scanned, the longer it takes. It's recommended to scan unread messages only. If a change to the filters is made, it's recommended to set it to scan all messages, then go view the INBOX, then come back and set it to scan unread messages only. That way, the new spam filters will be applied and even the spam you didn't catch with the old filters will be scanned."), 'left'));
    $spam_filters = load_spam_filters();
    foreach ($spam_filters as $Key => $Value) {
        echo html_tag('tr') . html_tag('th', $Key, 'right', '', 'nowrap') . "\n" . html_tag('td') . '<input type="checkbox" name="' . $spam_filters[$Key]['prefname'] . '_set"';
        if ($spam_filters[$Key]['enabled']) {
            echo ' checked="checked"';
        }
/**
 * Displays the standard message list header.
 *
 * To finish the table, you need to do a "</table></table>";
 *
 * @param resource $imapConnection
 * @param array    $aMailbox associative array with mailbox related information
 * @param string   $msg_cnt_str
 * @param string   $paginator Paginator string
 */
function mail_message_listing_beginning($imapConnection, $aMailbox, $msg_cnt_str = '', $paginator = '&nbsp;')
{
    global $color, $show_flag_buttons, $PHP_SELF;
    global $lastTargetMailbox, $boxes;
    $php_self = $PHP_SELF;
    $urlMailbox = urlencode($aMailbox['NAME']);
    if (preg_match('/^(.+)\\?.+$/', $php_self, $regs)) {
        $source_url = $regs[1];
    } else {
        $source_url = $php_self;
    }
    if (!isset($msg)) {
        $msg = '';
    }
    $moveFields = addHidden('msg', $msg) . addHidden('mailbox', $aMailbox['NAME']) . addHidden('startMessage', $aMailbox['PAGEOFFSET']);
    /* build thread sorting links */
    $sort = $aMailbox['SORT'];
    if ($aMailbox['ALLOW_THREAD']) {
        if ($aMailbox['SORT'] & SQSORT_THREAD) {
            $sort -= SQSORT_THREAD;
            $thread_name = _("Unthread View");
        } else {
            $thread_name = _("Thread View");
            $sort = $aMailbox['SORT'] + SQSORT_THREAD;
        }
        $thread_link_str = '<small>[<a href="' . $source_url . '?srt=' . $sort . '&start_messages=1' . '&mailbox=' . urlencode($aMailbox['NAME']) . '">' . $thread_name . '</a>]</small>';
    } else {
        $thread_link_str = '';
    }
    /*
     * This is the beginning of the message list table.
     * It wraps around all messages
     */
    $safe_name = preg_replace("/[^0-9A-Za-z_]/", '_', $aMailbox['NAME']);
    $form_name = "FormMsgs" . $safe_name;
    echo '<form name="' . $form_name . '" method="post" action="' . $php_self . '">' . "\n" . $moveFields;
    $button_str = '';
    // display flag buttons only if supported
    if ($show_flag_buttons && in_array('\\flagged', $aMailbox['PERMANENTFLAGS'], true)) {
        $button_str .= getButton('submit', 'markUnflagged', _("Unflag"));
        $button_str .= getButton('submit', 'markFlagged', _("Flag"));
        $button_str .= "&nbsp;\n";
    }
    if (in_array('\\seen', $aMailbox['PERMANENTFLAGS'], true)) {
        $button_str .= getButton('submit', 'markUnread', _("Unread"));
        $button_str .= getButton('submit', 'markRead', _("Read"));
        $button_str .= "&nbsp;\n";
    }
    $button_str .= getButton('submit', 'attache', _("Forward")) . "&nbsp;\n";
    if (in_array('\\deleted', $aMailbox['PERMANENTFLAGS'], true)) {
        $button_str .= getButton('submit', 'delete', _("Delete"));
        $button_str .= '<input type="checkbox" name="bypass_trash" />' . _("Bypass Trash");
        $button_str .= "&nbsp;\n";
    }
    if (!$aMailbox['AUTO_EXPUNGE'] && $aMailbox['RIGHTS'] != 'READ-ONLY') {
        $button_str .= getButton('submit', 'expungeButton', _("Expunge")) . '&nbsp;' . _("mailbox") . "\n";
        $button_str .= '&nbsp;';
    }
    ?>
    <table width="100%" cellpadding="1"  cellspacing="0" style="border: 1px solid <?php 
    echo $color[0];
    ?>
">
        <tr>
        <td>
            <table bgcolor="<?php 
    echo $color[4];
    ?>
" border="0" width="100%" cellpadding="1"  cellspacing="0">
            <tr>
                <?php 
    echo html_tag('td', '<small>' . $paginator . $thread_link_str . '</small>', 'left') . "\n";
    ?>
                <?php 
    echo html_tag('td', '', 'center') . "\n";
    ?>
                <?php 
    echo html_tag('td', '<small>' . $msg_cnt_str . '</small>', 'right') . "\n";
    ?>
            </tr>
            </table>
        </td>
        </tr>
        <tr width="100%" cellpadding="1"  cellspacing="0" border="0" bgcolor="<?php 
    echo $color[0];
    ?>
">
        <td>
            <table border="0" width="100%" cellpadding="1"  cellspacing="0">
            <tr>
                <?php 
    echo html_tag('td', '', 'left') . "\n";
    ?>
                <small>
                    <?php 
    echo $button_str;
    ?>
                    <?php 
    do_hook('mailbox_display_buttons');
    ?>
                </small>
                </td>
                <?php 
    if (in_array('\\deleted', $aMailbox['PERMANENTFLAGS'], true)) {
        ?>
                <?php 
        echo html_tag('td', '', 'right');
        ?>
                    <small>&nbsp;<tt>
                        <select name="targetMailbox">
                            <?php 
        echo sqimap_mailbox_option_list($imapConnection, array(strtolower($lastTargetMailbox)), 0, $boxes);
        ?>
                        </select></tt>&nbsp;
                        <?php 
        echo getButton('submit', 'moveButton', _("Move"));
        ?>
                    </small>
                <?php 
    }
    ?>
                </td>
            </tr>
            </table>
        </td>
        </tr>
    </table>
<?php 
    do_hook('mailbox_form_before');
}
示例#5
0
/** Build the mailbox select
 */
function asearch_get_form_mailbox($imapConnection, &$boxes, $mailbox, $row_num = 0)
{
    if ($mailbox != 'All Folders' && !asearch_mailbox_exists($mailbox, $boxes)) {
        $missing = asearch_opt($mailbox, $mailbox, '[' . _("Missing") . '] ' . asearch_get_mailbox_display($mailbox));
    } else {
        $missing = '';
    }
    return '<select name="mailbox[' . $row_num . ']">' . $missing . asearch_opt('All Folders', $mailbox, '[' . asearch_get_mailbox_display('All Folders') . ']') . sqimap_mailbox_option_list($imapConnection, array(strtolower($mailbox)), 0, $boxes, NULL) . '</select>';
}
示例#6
0
 function createWidget_FolderList()
 {
     $selected = array(strtolower($this->value));
     /* Begin the select tag. */
     $result = "<select name=\"new_{$this->name}\" {$this->script}>\n";
     /* Add each possible value to the select list. */
     foreach ($this->possible_values as $real_value => $disp_value) {
         if (is_array($disp_value)) {
             /* For folder list, we passed in the array of boxes.. */
             $new_option = sqimap_mailbox_option_list(0, $selected, 0, $disp_value);
         } else {
             /* Start the next new option string. */
             $new_option = '<option value="' . htmlspecialchars($real_value) . '"';
             /* If this value is the current value, select it. */
             if ($real_value == $this->value) {
                 $new_option .= ' selected="selected"';
             }
             /* Add the display value to our option string. */
             $new_option .= '>' . htmlspecialchars($disp_value) . "</option>\n";
         }
         /* And add the new option string to our select tag. */
         $result .= $new_option;
     }
     /* Close the select tag and return our happy result. */
     $result .= "</select>\n";
     return $result;
 }
示例#7
0
function getMbxList($imapConnection)
{
    global $lastTargetMailbox;
    echo '         <small>&nbsp;<tt><select name="targetMailbox">';
    echo sqimap_mailbox_option_list($imapConnection, array(strtolower($lastTargetMailbox)));
    echo '         </select></tt>&nbsp;';
}
示例#8
0
/**
 * This function loops through a group of messages in the mailbox
 * and shows them to the user.
 *
 * @param resource $imapConnection
 * @param array    $aMailbox associative array with mailbox related vars
 * @param array    $aProps
 * @param int      $iError error code, 0 is no error
 */
function showMessagesForMailbox($imapConnection, &$aMailbox, $aProps, &$iError)
{
    global $PHP_SELF;
    global $boxes, $show_copy_buttons;
    $highlight_list = isset($aProps['config']['highlight_list']) ? $aProps['config']['highlight_list'] : false;
    $fancy_index_highlite = isset($aProps['config']['fancy_index_highlite']) ? $aProps['config']['fancy_index_highlite'] : true;
    $aColumnsDesc = isset($aProps['columns']) ? $aProps['columns'] : false;
    $iAccount = isset($aProps['account']) ? (int) $aProps['account'] : 0;
    $sMailbox = isset($aProps['mailbox']) ? $aProps['mailbox'] : false;
    $sTargetModule = isset($aProps['module']) ? $aProps['module'] : 'read_body';
    $show_flag_buttons = isset($aProps['config']['show_flag_buttons']) ? $aProps['config']['show_flag_buttons'] : true;
    /* allows to control copy button in function call. If array key is not set, code follows user preferences */
    if (isset($aProps['config']['show_copy_buttons'])) {
        $show_copy_buttons = $aProps['config']['show_copy_buttons'];
    }
    $lastTargetMailbox = isset($aProps['config']['lastTargetMailbox']) ? $aProps['config']['lastTargetMailbox'] : '';
    $aOrder = array_keys($aProps['columns']);
    $trash_folder = isset($aProps['config']['trash_folder']) && $aProps['config']['trash_folder'] ? $aProps['config']['trash_folder'] : false;
    $sent_folder = isset($aProps['config']['sent_folder']) && $aProps['config']['sent_folder'] ? $aProps['config']['sent_folder'] : false;
    $draft_folder = isset($aProps['config']['draft_folder']) && $aProps['config']['draft_folder'] ? $aProps['config']['draft_folder'] : false;
    $page_selector = isset($aProps['config']['page_selector']) ? $aProps['config']['page_selector'] : false;
    $page_selector_max = isset($aProps['config']['page_selector_max']) ? $aProps['config']['page_selector_max'] : 10;
    $color = $aProps['config']['color'];
    /*
     * Form ID
     */
    static $iFormId;
    if (!isset($iFormId)) {
        $iFormId = 1;
    } else {
        ++$iFormId;
    }
    // store the columns to fetch so we can pick them up in read_body
    // where we validate the cache.
    calcFetchColumns($aMailbox, $aProps);
    $iError = fetchMessageHeaders($imapConnection, $aMailbox);
    if ($iError) {
        return array();
    } else {
        $aMessages = prepareMessageList($aMailbox, $aProps);
    }
    $iSetIndx = $aMailbox['SETINDEX'];
    $iLimit = $aMailbox['SHOWALL'][$iSetIndx] ? $aMailbox['EXISTS'] : $aMailbox['LIMIT'];
    $iEnd = $aMailbox['PAGEOFFSET'] + ($iLimit - 1) < $aMailbox['EXISTS'] ? $aMailbox['PAGEOFFSET'] + $iLimit - 1 : $aMailbox['EXISTS'];
    $iNumberOfMessages = $aMailbox['TOTAL'][$iSetIndx];
    $iEnd = min($iEnd, $iNumberOfMessages);
    $php_self = $PHP_SELF;
    $urlMailbox = urlencode($aMailbox['NAME']);
    if (preg_match('/^(.+)\\?.+$/', $php_self, $regs)) {
        $source_url = $regs[1];
    } else {
        $source_url = $php_self;
    }
    $baseurl = $source_url . '?mailbox=' . urlencode($aMailbox['NAME']) . '&amp;account=' . $aMailbox['ACCOUNT'] . (strpos($source_url, 'src/search.php') ? '&amp;smtoken=' . sm_generate_security_token() : '');
    $where = urlencode($aMailbox['SEARCH'][$iSetIndx][0]);
    $what = urlencode($aMailbox['SEARCH'][$iSetIndx][1]);
    $baseurl .= '&amp;where=' . $where . '&amp;what=' . $what;
    /* build thread sorting links */
    $newsort = $aMailbox['SORT'];
    if (sqimap_capability($imapConnection, 'THREAD')) {
        if ($aMailbox['SORT'] & SQSORT_THREAD) {
            $newsort -= SQSORT_THREAD;
            $thread_name = _("Unthread View");
        } else {
            $thread_name = _("Thread View");
            $newsort = $aMailbox['SORT'] + SQSORT_THREAD;
        }
        $thread_link_uri = $baseurl . '&amp;srt=' . $newsort . '&amp;startMessage=1';
    } else {
        $thread_link_uri = '';
        $thread_name = '';
    }
    $sort = $aMailbox['SORT'];
    /* FIX ME ADD CHECKBOX CONTROL. No checkbox => no buttons */
    /* future admin control over displayable buttons */
    $aAdminControl = array('markFlagged' => 1, 'markUnflagged' => 1, 'markRead' => 1, 'markUnread' => 1, 'forward' => 1, 'delete' => 1, 'undeleteButton' => 1, 'bypass_trash' => 1, 'expungeButton' => 1, 'moveButton' => 1, 'copyButton' => 1);
    /* user prefs control */
    $aUserControl = array('markFlagged' => $show_flag_buttons, 'markUnflagged' => $show_flag_buttons, 'markRead' => 1, 'markUnread' => 1, 'forward' => 1, 'delete' => 1, 'undeleteButton' => 1, 'bypass_trash' => 1, 'expungeButton' => 1, 'moveButton' => 1, 'copyButton' => $show_copy_buttons);
    $showDelete = $aMailbox['RIGHTS'] != 'READ-ONLY' && in_array('\\deleted', $aMailbox['PERMANENTFLAGS'], true) ? true : false;
    $showByPassTrash = $aMailbox['AUTO_EXPUNGE'] && $aMailbox['RIGHTS'] != 'READ-ONLY' && in_array('\\deleted', $aMailbox['PERMANENTFLAGS'], true) && $trash_folder ? true : false;
    //
    $showUndelete = !$aMailbox['AUTO_EXPUNGE'] && $aMailbox['RIGHTS'] != 'READ-ONLY' && in_array('\\deleted', $aMailbox['PERMANENTFLAGS'], true) ? true : false;
    $showMove = $aMailbox['RIGHTS'] != 'READ-ONLY' ? true : false;
    $showExpunge = !$aMailbox['AUTO_EXPUNGE'] && $aMailbox['RIGHTS'] != 'READ-ONLY' && in_array('\\deleted', $aMailbox['PERMANENTFLAGS'], true) ? true : false;
    /* Button options that depend on IMAP server and selected folder */
    $aImapControl = array('markUnflagged' => in_array('\\flagged', $aMailbox['PERMANENTFLAGS'], true), 'markFlagged' => in_array('\\flagged', $aMailbox['PERMANENTFLAGS'], true), 'markRead' => in_array('\\seen', $aMailbox['PERMANENTFLAGS'], true), 'markUnread' => in_array('\\seen', $aMailbox['PERMANENTFLAGS'], true), 'forward' => 1, 'delete' => $showDelete, 'undeleteButton' => $showUndelete, 'bypass_trash' => $showByPassTrash, 'expungeButton' => $showExpunge, 'moveButton' => $showMove, 'copyButton' => 1);
    /* Button strings */
    $aButtonStrings = array('markFlagged' => _("Flag"), 'markUnflagged' => _("Unflag"), 'markRead' => _("Read"), 'markUnread' => _("Unread"), 'forward' => _("Forward"), 'delete' => _("Delete"), 'undeleteButton' => _("Undelete"), 'bypass_trash' => _("Bypass Trash"), 'expungeButton' => _("Expunge"), 'moveButton' => _("Move"), 'copyButton' => _("Copy"));
    /* Button access keys */
    global $accesskey_mailbox_flag, $accesskey_mailbox_unflag, $accesskey_mailbox_read, $accesskey_mailbox_unread, $accesskey_mailbox_forward, $accesskey_mailbox_delete, $accesskey_mailbox_undelete, $accesskey_mailbox_bypass_trash, $accesskey_mailbox_expunge, $accesskey_mailbox_move, $accesskey_mailbox_copy, $accesskey_mailbox_move_to;
    $aButtonAccessKeys = array('markFlagged' => $accesskey_mailbox_flag, 'markUnflagged' => $accesskey_mailbox_unflag, 'markRead' => $accesskey_mailbox_read, 'markUnread' => $accesskey_mailbox_unread, 'forward' => $accesskey_mailbox_forward, 'delete' => $accesskey_mailbox_delete, 'undeleteButton' => $accesskey_mailbox_undelete, 'bypass_trash' => $accesskey_mailbox_bypass_trash, 'expungeButton' => $accesskey_mailbox_expunge, 'moveButton' => $accesskey_mailbox_move, 'copyButton' => $accesskey_mailbox_copy);
    /**
     * Register buttons in order to an array
     * The key is the "name", the first element of the value array is the "value", second argument is the type.
     */
    $aFormElements = array();
    foreach ($aAdminControl as $k => $v) {
        if ($v & $aUserControl[$k] & $aImapControl[$k]) {
            switch ($k) {
                case 'markFlagged':
                case 'markUnflagged':
                case 'markRead':
                case 'markUnread':
                case 'delete':
                case 'undeleteButton':
                case 'expungeButton':
                case 'forward':
                    $aFormElements[$k] = array('value' => $aButtonStrings[$k], 'type' => 'submit', 'accesskey' => isset($aButtonAccessKeys[$k]) ? $aButtonAccessKeys[$k] : 'NONE');
                    break;
                case 'bypass_trash':
                    $aFormElements[$k] = array('value' => $aButtonStrings[$k], 'type' => 'checkbox', 'accesskey' => isset($aButtonAccessKeys[$k]) ? $aButtonAccessKeys[$k] : 'NONE');
                    break;
                case 'moveButton':
                case 'copyButton':
                    $aFormElements['targetMailbox'] = array('options_list' => sqimap_mailbox_option_list($imapConnection, array(strtolower($lastTargetMailbox)), 0, $boxes), 'type' => 'select', 'accesskey' => $accesskey_mailbox_move_to);
                    $aFormElements['mailbox'] = array('value' => $aMailbox['NAME'], 'type' => 'hidden');
                    $aFormElements['startMessage'] = array('value' => $aMailbox['PAGEOFFSET'], 'type' => 'hidden');
                    $aFormElements[$k] = array('value' => $aButtonStrings[$k], 'type' => 'submit', 'accesskey' => isset($aButtonAccessKeys[$k]) ? $aButtonAccessKeys[$k] : 'NONE');
                    break;
            }
        }
        $aFormElements['account'] = array('value' => $iAccount, 'type' => 'hidden');
    }
    do_hook('message_list_controls', $aFormElements);
    /*
     * This is the beginning of the message list table.
     * It wraps around all messages
     */
    $safe_name = preg_replace("/[^0-9A-Za-z_]/", '_', $aMailbox['NAME']);
    $form_name = "FormMsgs" . $safe_name;
    //if (!sqgetGlobalVar('align',$align,SQ_SESSION)) {
    $align = array('left' => 'left', 'right' => 'right');
    //}
    //sm_print_r($align);
    /* finally set the template vars */
    // FIXME, before we support multiple templates we must review the names of the vars
    // BUMP!
    $aTemplate['color'] = $color;
    $aTemplate['form_name'] = "FormMsgs" . $safe_name;
    $aTemplate['form_id'] = 'mbx_' . $iFormId;
    $aTemplate['page_selector'] = $page_selector;
    $aTemplate['page_selector_max'] = $page_selector_max;
    $aTemplate['messagesPerPage'] = $aMailbox['LIMIT'];
    $aTemplate['showall'] = $aMailbox['SHOWALL'][$iSetIndx];
    $aTemplate['end_msg'] = $iEnd;
    $aTemplate['align'] = $align;
    $aTemplate['iNumberOfMessages'] = $iNumberOfMessages;
    $aTemplate['aOrder'] = $aOrder;
    $aTemplate['aFormElements'] = $aFormElements;
    $aTemplate['sort'] = $sort;
    $aTemplate['pageOffset'] = $aMailbox['PAGEOFFSET'];
    $aTemplate['baseurl'] = $baseurl;
    $aTemplate['aMessages'] =& $aMessages;
    $aTemplate['trash_folder'] = $trash_folder;
    $aTemplate['sent_folder'] = $sent_folder;
    $aTemplate['draft_folder'] = $draft_folder;
    $aTemplate['thread_link_uri'] = $thread_link_uri;
    $aTemplate['thread_name'] = $thread_name;
    $aTemplate['php_self'] = str_replace('&', '&amp;', $php_self);
    $aTemplate['mailbox'] = $sMailbox;
    //FIXME: javascript_on is always assigned to the template object in places like init.php; is there some reason to reassign it here?  is there some chance that it was changed?  if not, please remove this line!
    $aTemplate['javascript_on'] = isset($aProps['config']['javascript_on']) ? $aProps['config']['javascript_on'] : false;
    $aTemplate['enablesort'] = isset($aProps['config']['enablesort']) ? $aProps['config']['enablesort'] : false;
    $aTemplate['icon_theme'] = isset($aProps['config']['icon_theme']) ? $aProps['config']['icon_theme'] : false;
    $aTemplate['use_icons'] = isset($aProps['config']['use_icons']) ? $aProps['config']['use_icons'] : false;
    $aTemplate['alt_index_colors'] = isset($aProps['config']['alt_index_colors']) ? $aProps['config']['alt_index_colors'] : false;
    $aTemplate['fancy_index_highlite'] = $fancy_index_highlite;
    /**
     * Set up sort possibilities; one could argue that this is best
     * placed in the template, but most template authors won't understand
     * or need to understand it, so some advanced templates can override 
     * it if they do something different.
     */
    if (!($aTemplate['sort'] & SQSORT_THREAD) && $aTemplate['enablesort']) {
        $aTemplate['aSortSupported'] = array(SQM_COL_SUBJ => array(SQSORT_SUBJ_ASC, SQSORT_SUBJ_DESC), SQM_COL_DATE => array(SQSORT_DATE_DESC, SQSORT_DATE_ASC), SQM_COL_INT_DATE => array(SQSORT_INT_DATE_DESC, SQSORT_INT_DATE_ASC), SQM_COL_FROM => array(SQSORT_FROM_ASC, SQSORT_FROM_DESC), SQM_COL_TO => array(SQSORT_TO_ASC, SQSORT_TO_DESC), SQM_COL_CC => array(SQSORT_CC_ASC, SQSORT_CC_DESC), SQM_COL_SIZE => array(SQSORT_SIZE_ASC, SQSORT_SIZE_DESC));
    } else {
        $aTemplate['aSortSupported'] = array();
    }
    /**
     * Figure out which columns should serve as labels for checkbox:
     * we try to grab the two columns before and after the checkbox,
     * except the subject column, since it is the link that opens
     * the message view
     *
     * if $javascript_on is set, then the highlighting code takes
     * care of this; just skip it
     *
     * This code also might be more appropriate in a template file, but
     * we are moving this complex stuff out of the way of template 
     * authors; advanced template sets are always free to override
     * the resultant values.
     *
     */
    $show_label_columns = array();
    $index_order_part = array();
    if (!($aTemplate['javascript_on'] && $aTemplate['fancy_index_highlite'])) {
        $get_next_two = 0;
        $last_order_part = 0;
        $last_last_order_part = 0;
        foreach ($aTemplate['aOrder'] as $index_order_part) {
            if ($index_order_part == SQM_COL_CHECK) {
                $get_next_two = 1;
                if ($last_last_order_part != SQM_COL_SUBJ) {
                    $show_label_columns[] = $last_last_order_part;
                }
                if ($last_order_part != SQM_COL_SUBJ) {
                    $show_label_columns[] = $last_order_part;
                }
            } else {
                if ($get_next_two > 0 && $get_next_two < 3 && $index_order_part != SQM_COL_SUBJ) {
                    $show_label_columns[] = $index_order_part;
                    $get_next_two++;
                }
            }
            $last_last_order_part = $last_order_part;
            $last_order_part = $index_order_part;
        }
    }
    $aTemplate['show_label_columns'] = $show_label_columns;
    return $aTemplate;
}
示例#9
0
文件: setup.php 项目: jprice/EHCP
function get_move_target_list()
{
    global $imapConnection, $lastTargetMailbox;
    if (isset($lastTargetMailbox) && !empty($lastTargetMailbox)) {
        echo sqimap_mailbox_option_list($imapConnection, array(strtolower($lastTargetMailbox)));
    } else {
        echo sqimap_mailbox_option_list($imapConnection);
    }
}
示例#10
0
文件: search.php 项目: jprice/EHCP
    $use_mailbox_cache = 0;
}*/
/* There is a problem with registered vars in 4.1 */
/*
if( substr( phpversion(), 0, 3 ) == '4.1'  ) {
    $use_mailbox_cache = FALSE;
}
*/
/* Search Form */
echo html_tag('div', '<b>' . _("Current Search") . '</b>', 'left') . "\n" . '<form action="search.php" name="s">' . html_tag('table', '', '', '', 'width="95%" cellpadding="0" cellspacing="0" border="0"') . html_tag('tr') . html_tag('td', '', 'left') . '<select name="mailbox">' . '<option value="All Folders"';
if ($mailbox == 'All Folders') {
    echo ' selected="selected"';
}
echo '>[ ' . _("All Folders") . " ]</option>\n";
$show_selected = array(strtolower($mailbox));
echo sqimap_mailbox_option_list($imapConnection, $show_selected, 0, $boxes);
echo '         </select>' . "       </td>\n";
// FIXME: explain all str_replace calls.
$what_disp = str_replace(',', ' ', $what);
$what_disp = str_replace('\\\\', '\\', $what_disp);
$what_disp = str_replace('\\"', '"', $what_disp);
$what_disp = str_replace('"', '&quot;', $what_disp);
echo html_tag('td', '<input type="text" size="35" name="what" value="' . $what_disp . '" />' . "\n", 'center') . html_tag('td', '', 'right') . "<select name=\"where\">";
s_opt('BODY', $where, _("Body"));
s_opt('TEXT', $where, _("Everywhere"));
s_opt('SUBJECT', $where, _("Subject"));
s_opt('FROM', $where, _("From"));
s_opt('CC', $where, _("Cc"));
s_opt('TO', $where, _("To"));
echo "         </select>\n" . "        </td>\n" . html_tag('td', '<input type="submit" name="submit" value="' . _("Search") . '" />' . "\n", 'center', '', 'colspan="3"') . "     </tr>\n" . "   </table>\n" . "</form>\n";
do_hook('search_after_form');
示例#11
0
/**
 * Format message toolbar
 *
 * @param string $mailbox Name of current mailbox
 * @param int $passed_id UID of current message
 * @param int $passed_ent_id Id of entity within message
 * @param object $message Current message object
 * @param object $mbx_response
 */
function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removedVar, $nav_on_top = TRUE)
{
    global $base_uri, $draft_folder, $where, $what, $color, $sort, $startMessage, $PHP_SELF, $save_as_draft, $enable_forward_as_attachment, $imapConnection, $lastTargetMailbox, $data_dir, $username, $delete_prev_next_display, $compose_new_win, $javascript_on;
    //FIXME cleanup argument list, use $aMailbox where possible
    $mailbox = $aMailbox['NAME'];
    $topbar_delimiter = '&nbsp;|&nbsp;';
    $double_delimiter = '&nbsp;&nbsp;&nbsp;&nbsp;';
    $urlMailbox = urlencode($mailbox);
    $msgs_url = $base_uri . 'src/';
    // BEGIN NAV ROW - PREV/NEXT, DEL PREV/NEXT, LINKS TO INDEX, etc.
    $nav_row = '<tr><td align="left" colspan="2" style="border: 1px solid ' . $color[9] . ';"><small>';
    // Create Prev & Next links
    // Handle nested entities first (i.e. Mime Attach parts)
    if (isset($passed_ent_id) && $passed_ent_id) {
        // code for navigating through attached message/rfc822 messages
        $url = set_url_var($PHP_SELF, 'passed_ent_id', 0);
        $entities = array();
        $entity_count = array();
        $c = 0;
        foreach ($message->parent->entities as $ent) {
            if ($ent->type0 == 'message' && $ent->type1 == 'rfc822') {
                $c++;
                $entity_count[$c] = $ent->entity_id;
                $entities[$ent->entity_id] = $c;
            }
        }
        $prev_link = _("Previous");
        if ($entities[$passed_ent_id] > 1) {
            $prev_ent_id = $entity_count[$entities[$passed_ent_id] - 1];
            $prev_link = '<a href="' . set_url_var($PHP_SELF, 'passed_ent_id', $prev_ent_id) . '">' . $prev_link . '</a>';
        }
        $next_link = _("Next");
        if ($entities[$passed_ent_id] < $c) {
            $next_ent_id = $entity_count[$entities[$passed_ent_id] + 1];
            $next_link = '<a href="' . set_url_var($PHP_SELF, 'passed_ent_id', $next_ent_id) . '">' . $next_link . '</a>';
        }
        $par_ent_id = $message->parent->entity_id;
        $up_link = '';
        if ($par_ent_id) {
            $par_ent_id = substr($par_ent_id, 0, -2);
            if ($par_ent_id != 0) {
                $up_link = $topbar_delimiter;
                $url = set_url_var($PHP_SELF, 'passed_ent_id', $par_ent_id);
                $up_link .= '<a href="' . $url . '">' . _("Up") . '</a>';
            }
        }
        $nav_row .= $prev_link . $up_link . $topbar_delimiter . $next_link;
        $nav_row .= $double_delimiter . '[<a href="' . $url . '">' . _("View Message") . '</a>]';
        // Prev/Next links for regular messages
    } else {
        if (true) {
            //!(isset($where) && isset($what)) ) {
            /**
             * Check if cache is still valid
             */
            if (!is_array($aMailbox['UIDSET'][$what])) {
                fetchMessageHeaders($imapConnection, $aMailbox);
            }
            $prev = findPreviousMessage($aMailbox['UIDSET'][$what], $passed_id);
            $next = findNextMessage($aMailbox['UIDSET'][$what], $passed_id);
            $prev_link = _("Previous");
            if ($prev >= 0) {
                $uri = $base_uri . 'src/read_body.php?passed_id=' . $prev . '&amp;mailbox=' . $urlMailbox . '&amp;sort=' . $sort . "&amp;where={$where}&amp;what={$what}" . '&amp;startMessage=' . $startMessage . '&amp;show_more=0';
                $prev_link = '<a href="' . $uri . '">' . $prev_link . '</a>';
            }
            $next_link = _("Next");
            if ($next >= 0) {
                $uri = $base_uri . 'src/read_body.php?passed_id=' . $next . '&amp;mailbox=' . $urlMailbox . '&amp;sort=' . $sort . "&amp;where={$where}&amp;what={$what}" . '&amp;startMessage=' . $startMessage . '&amp;show_more=0';
                $next_link = '<a href="' . $uri . '">' . $next_link . '</a>';
            }
            // Only bother with Delete & Prev and Delete & Next IF
            // top display is enabled.
            if ($delete_prev_next_display == 1 && in_array('\\deleted', $aMailbox['PERMANENTFLAGS'], true)) {
                $del_prev_link = _("Delete & Prev");
                if ($prev >= 0) {
                    $uri = $base_uri . 'src/read_body.php?passed_id=' . $prev . '&amp;mailbox=' . $urlMailbox . '&amp;sort=' . $sort . '&amp;startMessage=' . $startMessage . '&amp;show_more=0' . "&amp;where={$where}&amp;what={$what}" . '&amp;delete_id=' . $passed_id;
                    $del_prev_link = '<a href="' . $uri . '">' . $del_prev_link . '</a>';
                }
                $del_next_link = _("Delete & Next");
                if ($next >= 0) {
                    $uri = $base_uri . 'src/read_body.php?passed_id=' . $next . '&amp;mailbox=' . $urlMailbox . '&amp;sort=' . $sort . '&amp;startMessage=' . $startMessage . '&amp;show_more=0' . "&amp;where={$where}&amp;what={$what}" . '&amp;delete_id=' . $passed_id;
                    $del_next_link = '<a href="' . $uri . '">' . $del_next_link . '</a>';
                }
            }
            $nav_row .= '[' . $prev_link . $topbar_delimiter . $next_link . ']';
            if (isset($del_prev_link) && isset($del_next_link)) {
                $nav_row .= $double_delimiter . '[' . $del_prev_link . $topbar_delimiter . $del_next_link . ']';
            }
        }
    }
    // Start with Search Results or Message List link.
    $msgs_url .= "{$where}?where=read_body.php&amp;what={$what}&amp;mailbox=" . $urlMailbox . "&amp;startMessage={$startMessage}";
    if ($where == 'search.php') {
        $msgs_str = _("Search Results");
    } else {
        $msgs_str = _("Message List");
    }
    $nav_row .= $double_delimiter . '[<a href="' . $msgs_url . '">' . $msgs_str . '</a>]';
    $nav_row .= '</small></td></tr>';
    // BEGIN MENU ROW - DELETE/REPLY/FORWARD/MOVE/etc.
    $menu_row = '<tr bgcolor="' . $color[0] . '"><td><small>';
    $comp_uri = $base_uri . 'src/compose.php' . '?passed_id=' . $passed_id . '&amp;mailbox=' . $urlMailbox . '&amp;startMessage=' . $startMessage . (isset($passed_ent_id) ? '&amp;passed_ent_id=' . $passed_ent_id : '');
    // Start form for reply/reply all/forward..
    $target = '';
    $on_click = '';
    $method = 'method="post" ';
    if ($compose_new_win == '1') {
        if ($javascript_on) {
            $on_click = ' onclick="comp_in_new_form(\'' . $comp_uri . '\', this, this.form)"';
            $comp_uri = 'javascript:void(0)';
            $method = 'method="get" ';
        } else {
            $target = 'target="_blank"';
        }
    }
    $menu_row .= "\n" . '<form name="composeForm" action="' . $comp_uri . '" ' . $method . $target . ' style="display: inline">' . "\n";
    // If Draft folder - create Resume link
    if ($mailbox == $draft_folder && $save_as_draft) {
        $new_button = 'smaction_draft';
        $comp_alt_string = _("Resume Draft");
    } else {
        if (handleAsSent($mailbox)) {
            // If in Sent folder, edit as new
            $new_button = 'smaction_edit_new';
            $comp_alt_string = _("Edit Message as New");
        }
    }
    // Show Alt URI for Draft/Sent
    if (isset($comp_alt_string)) {
        $menu_row .= getButton('submit', $new_button, $comp_alt_string, $on_click) . "\n";
    }
    $menu_row .= getButton('submit', 'smaction_reply', _("Reply"), $on_click) . "\n";
    $menu_row .= getButton('submit', 'smaction_reply_all', _("Reply All"), $on_click) . "\n";
    $menu_row .= getButton('submit', 'smaction_forward', _("Forward"), $on_click);
    if ($enable_forward_as_attachment) {
        $menu_row .= '<input type="checkbox" name="smaction_attache" />' . _("As Attachment") . '&nbsp;&nbsp;' . "\n";
    }
    $menu_row .= '</form>&nbsp;';
    if (in_array('\\deleted', $aMailbox['PERMANENTFLAGS'], true)) {
        // Form for deletion. Form is handled by the originating display in $where. This is right_main.php or search.php
        $delete_url = $base_uri . "src/{$where}";
        $menu_row .= '<form name="deleteMessageForm" action="' . $delete_url . '" method="post" style="display: inline">';
        if (!(isset($passed_ent_id) && $passed_ent_id)) {
            $menu_row .= addHidden('mailbox', $aMailbox['NAME']);
            $menu_row .= addHidden('msg[0]', $passed_id);
            $menu_row .= addHidden('startMessage', $startMessage);
            $menu_row .= getButton('submit', 'delete', _("Delete"));
            $menu_row .= '<input type="checkbox" name="bypass_trash" />' . _("Bypass Trash");
        } else {
            $menu_row .= getButton('submit', 'delete', _("Delete"), '', FALSE) . "\n";
            // delete button is disabled
        }
        $menu_row .= '</form>';
    }
    // Add top move link
    $menu_row .= '</small></td><td align="right">';
    if (!(isset($passed_ent_id) && $passed_ent_id) && in_array('\\deleted', $aMailbox['PERMANENTFLAGS'], true)) {
        $menu_row .= '<form name="moveMessageForm" action="' . $base_uri . 'src/' . $where . '?' . '" method="post" style="display: inline">' . '<small>' . addHidden('mailbox', $aMailbox['NAME']) . addHidden('msg[0]', $passed_id) . _("Move to:") . '<select name="targetMailbox" style="padding: 0px; margin: 0px">';
        if (isset($lastTargetMailbox) && !empty($lastTargetMailbox)) {
            $menu_row .= sqimap_mailbox_option_list($imapConnection, array(strtolower($lastTargetMailbox)));
        } else {
            $menu_row .= sqimap_mailbox_option_list($imapConnection);
        }
        $menu_row .= '</select> ';
        $menu_row .= getButton('submit', 'moveButton', _("Move")) . "\n" . '</form>';
    }
    $menu_row .= '</td></tr>';
    // echo rows, with hooks
    $ret = do_hook_function('read_body_menu_top', array($nav_row, $menu_row));
    if (is_array($ret)) {
        if (isset($ret[0]) && !empty($ret[0])) {
            $nav_row = $ret[0];
        }
        if (isset($ret[1]) && !empty($ret[1])) {
            $menu_row = $ret[1];
        }
    }
    echo '<table width="100%" cellpadding="3" cellspacing="0" align="center" border="0">';
    echo $nav_on_top ? $nav_row . $menu_row : $menu_row . $nav_row;
    echo '</table>' . "\n";
    do_hook('read_body_menu_bottom');
}
示例#12
0
文件: options.php 项目: jprice/EHCP
 /**
  * Create folder selection box
  *
  * @param boolean $multiple_select When TRUE, the select widget
  *                                 will allow multiple selections
  *                                 (OPTIONAL; default is FALSE
  *                                 (single select list))
  *
  * @return string html formated selection box
  *
  */
 function createWidget_FolderList($multiple_select = FALSE)
 {
     switch ($this->size) {
         //FIXME: not sure about these sizes... seems like we could add another on the "large" side...
         case SMOPT_SIZE_TINY:
             $height = 3;
             break;
         case SMOPT_SIZE_SMALL:
             $height = 8;
             break;
         case SMOPT_SIZE_LARGE:
             $height = 15;
             break;
         case SMOPT_SIZE_HUGE:
             $height = 25;
             break;
         case SMOPT_SIZE_NORMAL:
         default:
             $height = 5;
     }
     // multiple select lists should already have array values
     if (is_array($this->value)) {
         $selected = $this->value;
     } else {
         $selected = array(strtolower($this->value));
     }
     /* Begin the select tag. */
     $result = '<select name="new_' . $this->name . ($multiple_select ? '[]" multiple="multiple" size="' . $height . '"' : '"') . " {$this->script}>\n";
     /* Add each possible value to the select list. */
     foreach ($this->possible_values as $real_value => $disp_value) {
         if (is_array($disp_value)) {
             /* For folder list, we passed in the array of boxes.. */
             $selected_lowercase = array();
             foreach ($selected as $i => $box) {
                 $selected_lowercase[$i] = strtolower($box);
             }
             $new_option = sqimap_mailbox_option_list(0, $selected_lowercase, 0, $disp_value);
         } else {
             /* Start the next new option string. */
             $new_option = '<option value="' . htmlspecialchars($real_value) . '"';
             // multiple select lists have possibly more than one default selection
             if ($multiple_select) {
                 foreach ($selected as $default) {
                     if ((string) $default == (string) $real_value) {
                         $new_option .= ' selected="selected"';
                         break;
                     }
                 }
             } else {
                 if ($real_value == $this->value) {
                     $new_option .= ' selected="selected"';
                 }
             }
             /* Add the display value to our option string. */
             $new_option .= '>' . htmlspecialchars($disp_value) . "</option>\n";
         }
         /* And add the new option string to our select tag. */
         $result .= $new_option;
     }
     /* Close the select tag and return our happy result. */
     $result .= '</select>' . htmlspecialchars($this->trailing_text) . "\n";
     return $result;
 }