/*
+-------------------------------------------------------------------------+
| RoundCube Webmail IMAP Client |
- | Version 0.3-stable |
+ | Version 0.3.1-20091031 |
| |
| Copyright (C) 2005-2009, RoundCube Dev. - Switzerland |
| |
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-------------------------------------------------------------------------+
- $Id: index.php 2916 2009-09-04 10:58:29Z thomasb $
+ $Id: index.php 3081 2009-10-31 13:20:02Z thomasb $
*/
}
// check if https is required (for login) and redirect if necessary
-if ($RCMAIL->config->get('force_https', false) && empty($_SESSION['user_id']) && !(isset($_SERVER['HTTPS']) || $_SERVER['SERVER_PORT'] == 443)) {
- header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
- exit;
+if (empty($_SESSION['user_id']) && ($force_https = $RCMAIL->config->get('force_https', false))) {
+ $https_port = is_bool($force_https) ? 443 : $force_https;
+ if (!rcube_https_check($https_port)) {
+ header('Location: https://' . $_SERVER['HTTP_HOST'] . ($https_port != 443 ? ':' . $https_port : '') . $_SERVER['REQUEST_URI']);
+ exit;
+ }
}
// trigger startup plugin hook
$RCMAIL->set_task($startup['task']);
$RCMAIL->action = $startup['action'];
-
// try to log in
if ($RCMAIL->action=='login' && $RCMAIL->task=='mail') {
// purge the session in case of new login when a session already exists
// check client X-header to verify request origin
if ($OUTPUT->ajax_call) {
- if (!$RCMAIL->config->get('devel_mode') && rc_request_header('X-RoundCube-Request') != $RCMAIL->get_request_token()) {
+ if (!$RCMAIL->config->get('devel_mode') && rc_request_header('X-RoundCube-Request') != $RCMAIL->get_request_token() && !empty($RCMAIL->user->ID)) {
header('HTTP/1.1 404 Not Found');
die("Invalid Request");
}
$OUTPUT->send($RCMAIL->task);
}
-
// not logged in -> show login page
if (empty($RCMAIL->user->ID)) {
-
if ($OUTPUT->ajax_call)
$OUTPUT->redirect(array(), 2000);
+ if (!empty($_REQUEST['_framed']))
+ $OUTPUT->command('redirect', '?');
+
// check if installer is still active
if ($RCMAIL->config->get('enable_installer') && is_readable('./installer/index.php')) {
$OUTPUT->add_footer(html::div(array('style' => "background:#ef9398; border:2px solid #dc5757; padding:0.5em; margin:2em auto; width:50em"),