function do_html_header($auth_user, $title = '', $selected_account) { // print an HTML header including cute logo :) global $table_width; //draw title bar ?> <html> <head> <title><?php echo $title; ?> </title> <style> h1 { font-family: 'Comic Sans MS', sans-serif; font-size: 32; font-weight: bold; color: black; margin-bottom: 0} b { font-family: 'Arial', sans-serif; font-size: 13; font-weight: bold; color: black } th { font-family: 'Comic Sans MS', sans-serif; font-size: 18 font-weight: bold; color: black; } body, li, td { font-family: Arial, Helvetica, sans-serif; font-size: 12; margin = 5px } a { color: #000000 } </style> </head> <body> <table width = <?php echo $table_width; ?> cellspacing = 0 cellpadding = 3 bgcolor = "#ff6600" border = 0> <tr bgcolor = "#ff6600"> <td bgcolor = "#ff6600" width = 103><img src = "images/warm-mail.gif" width = 103 height = 45 alt ="" valign = middle></td> <td bgcolor = "#ff6600" width = <?php echo $table_width - 110; ?> ><h1><?php echo $title; ?> </h1></td> <?php // include the account select box only if the user has more than one account if (number_of_accounts($auth_user) > 1) { echo '<form target="index.php?action=open-mailbox" method=post>'; echo '<td bgcolor = "#ff6600" align = right valign = middle>'; display_account_select($auth_user, $selected_account); echo '</td>'; echo '</form>'; } ?> </tr> </table> <table width = <?php echo $table_width; ?> cellpadding = 0 cellspacing = 0 border = 0> <tr><td> <?php }
function do_html_header($title = '', $auth_user = '', $selected_account = '') { // print an HTML header including cute logo :) global $table_width; //draw title bar ?> <table width = <?php echo $table_width; ?> cellspacing = 0 cellpadding = 3 bgcolor = "#ff6600" border = 0> <tr bgcolor = "#ff6600"> <td bgcolor = "#ff6600" width = 103><img src = "<?php echo base_url('images/webemail/warm-mail.gif'); ?> " width = 103 height = 45 alt ="" valign = "middle" /></td> <td bgcolor = "#ff6600" width = <?php echo $table_width - 110; ?> ><h1><?php echo $title; ?> </h1></td> <?php // include the account select box only if the user has more than one account if (number_of_accounts($auth_user) > 1) { echo '<form target="' . base_url('index.php/webemail?action=open-mailbox') . '" method="post">'; echo '<td bgcolor = "#ff6600" align = "right" valign = "middle">'; display_account_select($auth_user, $selected_account); echo '</td>'; echo '</form>'; } ?> </tr> </table> <table width = <?php echo $table_width; ?> cellpadding = 0 cellspacing = 0 border = 0> <tr><td> <?php }
function do_html_header($auth_user = '', $title, $selected_account = '') { ?> <html> <head> <title><?php echo $title; ?> </title> </head> <body> <h1><?php echo $title; ?> </h1> <?php if (number_of_accounts($auth_user) > 1) { echo "<form action=\"index.php?action=open-mailbox\" method=\"post\">\n <td bgcolor=\"#ff6600\" align=\"right\" valign=\"middle\">"; display_account_select($auth_user, $selected_account); echo "</td>\n </form>"; } }
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; }
if (isset($_POST['subject'])) { $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
} $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
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; }