//error_reporting(E_ALL);
-
/**
* Make sure we have a page name
*
* When session.auto_start is On we want to destroy/close the session
*/
$sSessionAutostartName = session_name();
-$sCookiePath = null;
-if (isset($sSessionAutostartName) && $sSessionAutostartName !== $session_name) {
+$sSessionAutostartID = session_id();
+if (!empty($sSessionAutostartID) && $sSessionAutostartName !== $session_name) {
$sCookiePath = ini_get('session.cookie_path');
$sCookieDomain = ini_get('session.cookie_domain');
// reset the cookie
- setcookie($sSessionAutostartName,'',time() - 604800,$sCookiePath,$sCookieDomain);
+ sqsetcookie($sSessionAutostartName,'',1,$sCookiePath,$sCookieDomain);
@session_destroy();
session_write_close();
}
}
+/**
+ * In some cases, buffering all output allows more complex functionality,
+ * especially for plugins that want to add headers on hooks that are beyond
+ * the point of output having been sent to the browser otherwise.
+ *
+ * Note that we don't turn this on any earlier since we want to allow plugins
+ * to turn it on themselves via a configuration override on the prefs_backend
+ * hook.
+ *
+ */
+if ($buffer_output) ob_start(!empty($buffered_output_handler) ? $buffered_output_handler : NULL);
+
+
/**
* Do something special for some pages. This is based on the PAGE_NAME constant
* set at the top of every page.
*/
$icon_theme_path = (!$use_icons || $icon_theme=='none') ? NULL : ($icon_theme == 'template' ? SM_PATH . Template::calculate_template_images_directory($sTemplateID) : $icon_theme);
- /**
- * cleanup old cookies with a cookie path the same as the standard php.ini
- * cookie path. All previous SquirrelMail version used the standard php.ini
- * cookie path for storing the session name. That behaviour changed.
- */
- if ($sCookiePath !== SM_BASE_URI) {
- /**
- * do not delete the standard sessions with session.name is i.e. PHPSESSID
- * because they probably belong to other php apps
- */
- if (ini_get('session.name') !== $sSessionAutostartName) {
- // This does not work. Sometimes the cookie with SQSESSID=deleted and path /
- // is picked up in webmail.php => login will fail
- //sqsetcookie(ini_get('session.name'),'',0,$sCookiePath);
- }
- }
break;
default:
require(SM_PATH . 'functions/display_messages.php' );