function open_mailbox($auth_user, $accountid)
{
    global $HTTP_SESSION_VARS;
    // select mailbox if there is only one
    if (number_of_accounts($auth_user) == 1) {
        $accounts = get_account_list($auth_user);
        $HTTP_SESSION_VARS['selected_account'] = $accounts[0];
        $accountid = $accounts[0];
    }
    // connect to the POP3 or IMAP server the user has selected
    $settings = get_account_settings($auth_user, $accountid);
    if (!sizeof($settings)) {
        return 0;
    }
    $mailbox = '{' . $settings[server];
    if ($settings[type] == 'POP3') {
        $mailbox .= '/pop3';
    }
    $mailbox .= ':' . $settings[port] . '}INBOX';
    // suppress warning, remember to check return value
    @($imap = imap_open($mailbox, $settings['remoteuser'], $settings['remotepassword']));
    return $imap;
}
function display_account_select($auth_user, $selected_account)
{
    // show the dropdown box for the user to select from their accounts
    $list = get_account_list($auth_user);
    $accounts = sizeof($list);
    if ($accounts > 1) {
        echo "<select onchange=\"window.location=this.options[selectedIndex].value name=account\">";
        if ($selected_account == '') {
            echo "<option value=\"0\" selected>Choose Account</a>";
        }
        for ($i = 0; $i < $accounts; $i++) {
            $account = get_account_settings($auth_user, $list[$i]);
            echo "<option value=\"index.php?action=select-account&account=" . $list[$i] . "\"";
            if ($list[$i] == $selected_account) {
                echo " selected";
            }
            echo ">" . $account['server'] . "</option>";
        }
        echo "</select>";
    }
}
Exemple #3
0
    $subject = $_POST['subject'];
}
if (isset($_POST['message'])) {
    $message = $_POST['message'];
}
$buttons = array();
//append to this string if anything processed before header has output
$status = '';
// need to process log in or out requests before anything else
if (isset($username) || isset($password)) {
    if (login($username, $passwd)) {
        $status .= '<p>Logged in successfully.</p><br /><br /><br /><br />
       <br /><br />';
        $_SESSION['auth_user'] = $username;
        if (number_of_accounts($_SESSION['auth_user']) == 1) {
            $accounts = get_account_list($_SESSION['auth_user']);
            $_SESSION['selected_account'] = $accounts[0];
        }
    } else {
        $status .= '<p>Sorry, we could not log you in with that 
                  username and password.</p><br /><br /><br /><br />
                  <br /><br />';
    }
}
if (isset($action) && $action == 'log-out') {
    session_destroy();
    unset($action);
    $_SESSION = array();
}
//need to process choose, delete or store account before drawing header
if (isset($action)) {
    <a data-toggle="modal" href="#myModal" id="modal-account_list"></a>
    
    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
              <h4 class="modal-title"><?php 
lang('Account List');
?>
</h4>
            </div>
            <div class="modal-body">
                <?php 
get_account_list(array('account_id' => 'account_id', 'account_name' => 'account_name'));
?>
            </div>
            
          </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->



<div class="row">
<div class="col-md-8">

<?php 
$invoice['account_id'] = '';
$account['account_name'] = '';
$messageid = $HTTP_GET_VARS['messageid'];
$to = $HTTP_POST_VARS['to'];
$cc = $HTTP_POST_VARS['cc'];
$subject = $HTTP_POST_VARS['subject'];
$message = $HTTP_POST_VARS['message'];
$buttons = array();
//append to this string if anything processed before header has output
$status = '';
// need to process log in or out requests before anything else
if ($username || $password) {
    if (login($username, $passwd)) {
        $status .= '<p>Logged in successfully.</p><br /><br /><br /><br />
       <br /><br />';
        $HTTP_SESSION_VARS['auth_user'] = $username;
        if (number_of_accounts($HTTP_SESSION_VARS['auth_user']) == 1) {
            $accounts = get_account_list($HTTP_SESSION_VARS['auth_user']);
            $HTTP_SESSION_VARS['selected_account'] = $accounts[0];
        }
    } else {
        $status .= '<p>Sorry, we could not log you in with that 
                  username and password.</p><br /><br /><br /><br />
                  <br /><br />';
    }
}
if ($action == 'log-out') {
    session_destroy();
    unset($action);
    unset($HTTP_SESSION_VARS);
}
//need to process choose, delete or store account before drawing header
switch ($action) {
    <a data-toggle="modal" href="#myModal" id="modal-account_list"></a>
    
    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
              <h4 class="modal-title"><?php 
lang('Account List');
?>
</h4>
            </div>
            <div class="modal-body">
                <?php 
get_account_list(array('account_id' => 'account_id', 'account_name' => 'account_name', 'account_balance' => 'old_balance', 'RUN' => 'calc_payment();'));
?>
            </div>
            
          </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->



<div class="row">
<div class="col-md-8">

<?php 
$invoice['account_id'] = '';
$account['name'] = '';
Exemple #7
0
<?php

include_once '_approot.php';
include_once APPROOT . '/lib/header.php';
session_check(null);
$method = $_REQUEST['method'];
switch ($method) {
    case 'getAccountManageData':
        get_account_manage_data();
        break;
    case 'getAccountList':
        get_account_list();
        break;
    case 'getAccount':
        get_account();
        break;
    case 'setAccountDefault':
        set_account_default();
        break;
    case 'updateAccount':
        update_account();
        break;
    case 'deleteAccount':
        delete_account();
        break;
    case 'getAccountSimpleList':
        get_account_simple_list();
    default:
        break;
}
/**
Exemple #8
0
function open_mailbox($auth_user, $accountid)
{
    //    echo "Debug: open_mailbox()<br />";
    if (number_of_accounts($auth_user) == 1) {
        $accounts = get_account_list($auth_user);
        $_SESSION['selected_account'] = $accounts[0];
        $accountid = $accounts[0];
    }
    $settings = get_account_settings($auth_user, $accountid);
    //    echo "Debug: settings[server]: ".$settings['server']."<br />";
    if (!sizeof($settings)) {
        return 0;
    }
    $mailbox = '{' . $settings['server'];
    if ($settings['type'] == 'POP3') {
        $mailbox .= '/pop3';
    }
    $mailbox .= ':' . $settings['port'] . '/ssl}INBOX';
    //    echo "mailbox: ".$mailbox."<br />";
    $imap = imap_open($mailbox, $settings['remoteuser'], $settings['remotepassword']);
    return $imap;
}