* $Id$
*/
-require_once('../functions/i18n.php');
-require_once('../functions/strings.php');
-require_once('../config/config.php');
-require_once('../functions/prefs.php');
-require_once('../functions/imap.php');
-require_once('../functions/plugin.php');
-require_once('../functions/constants.php');
-require_once('../functions/page_header.php');
+/* Path for SquirrelMail required files. */
+define('SM_PATH','../');
+
+/* SquirrelMail required files. */
+require_once(SM_PATH . 'functions/i18n.php');
+require_once(SM_PATH . 'functions/strings.php');
+require_once(SM_PATH . 'config/config.php');
+require_once(SM_PATH . 'functions/prefs.php');
+require_once(SM_PATH . 'functions/imap.php');
+require_once(SM_PATH . 'functions/plugin.php');
+require_once(SM_PATH . 'functions/constants.php');
+require_once(SM_PATH . 'functions/page_header.php');
+require_once(SM_PATH . 'functions/global.php');
// Remove slashes if PHP added them
if (get_magic_quotes_gpc()) {
/* Before starting the session, the base URI must be known. Assuming */
/* that this file is in the src/ subdirectory (or something). */
-ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
-$base_uri = $regs[1];
+if (!function_exists('sqm_baseuri')){
+ require_once(SM_PATH . 'functions/display_messages.php');
+}
+$base_uri = sqm_baseuri();
header('Pragma: no-cache');
$location = get_location();
}
set_up_language($squirrelmail_language, true);
/* Refresh the language cookie. */
-setcookie('squirrelmail_language', $squirrelmail_language, time()+2592000,$base_uri);
+setcookie('squirrelmail_language', $squirrelmail_language, time()+2592000,
+ $base_uri);
if (!isset($login_username)) {
include_once( '../functions/display_messages.php' );
logout_error( _("You must be logged in to access this page.") );
exit;
} else {
+ $sqimap_capabilities = sqimap_capability($imapConnection);
+ session_register('sqimap_capabilities');
$delimiter = sqimap_get_delimiter ($imapConnection);
}
sqimap_logout($imapConnection);
session_register('delimiter');
-
+ global $username;
$username = $login_username;
session_register ('username');
setcookie('key', $key, 0, $base_uri);
/* Update the prefs */
setPref($data_dir, $username, 'javascript_on', $js_pref);
+global $attachments;
+$attachments = unserialize(getPref($data_dir, $username, 'attachments', 0));
/* Compute the URL to forward the user to. */
-if(isset($rcptemail)) {
- $redirect_url = 'webmail.php?right_frame=compose.php&rcptaddress=';
- $redirect_url .= $rcptemail;
-} else {
- $redirect_url = 'webmail.php';
-}
+ global $session_expired_location, $session_expired_post;
+ if (isset($session_expired_location) && $session_expired_location) {
+ $compose_new_win = getPref($data_dir, $username, 'compose_new_win', 0);
+ if ($compose_new_win) {
+ $redirect_url = $session_expired_location;
+ } else {
+ $redirect_url = 'webmail.php?right_frame='.urldecode($session_expired_location);
+ }
+ session_unregister('session_expired_location');
+ unset($session_expired_location);
+ if (is_array($attachments)) {
+ session_register('attachments');
+ }
+ } else {
+ if (is_array($attachments)) {
+ $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
+ foreach ($attachments as $attachment) {
+ $attached_file = $hashed_attachment_dir.'/'.$attachment['localfilename'];
+ if (file_exists($attached_file)) {
+ unlink($attached_file);
+ }
+ }
+ removePref($data_dir, $username, 'attachments');
+ }
+ $redirect_url = 'webmail.php';
+ }
/* Send them off to the appropriate page. */
header("Location: $redirect_url");
}
-?>
\ No newline at end of file
+?>