From 14de18d5f4636ca86ed8cac4c8c725e07bd2ff79 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Sun, 16 Nov 2008 03:53:10 -0500
Subject: [PATCH] - Fix setting locale to tr_TR, ku and az_AZ (#1485470)
---
program/include/rcmail.php | 37 +++++++++++++++++++++++++++++++------
1 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 10395b0..9690d8d 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -170,7 +170,11 @@
$_SESSION['language'] = $this->user->language = $this->language_prop($this->config->get('language', $_SESSION['language']));
// set localization
- setlocale(LC_ALL, $_SESSION['language'] . '.utf8');
+ setlocale(LC_ALL, $_SESSION['language'] . '.utf8', 'en_US.utf8');
+
+ // workaround for http://bugs.php.net/bug.php?id=18556
+ if (in_array($_SESSION['language'], array('tr_TR', 'ku', 'az_AZ')))
+ setlocale(LC_CTYPE, 'en_US' . '.utf8');
}
@@ -288,6 +292,14 @@
foreach (array('flag_for_deletion','read_when_deleted') as $js_config_var) {
$this->output->set_env($js_config_var, $this->config->get($js_config_var));
+ }
+
+ // set keep-alive/check-recent interval
+ if ($keep_alive = $this->config->get('keep_alive')) {
+ // be sure that it's less than session lifetime
+ if ($session_lifetime = $this->config->get('session_lifetime'))
+ $keep_alive = min($keep_alive, $session_lifetime * 60 - 30);
+ $this->output->set_env('keep_alive', max(60, $keep_alive));
}
if ($framed) {
@@ -433,7 +445,7 @@
// lowercase username if it's an e-mail address (#1484473)
if (strpos($username, '@'))
- $username = strtolower($username);
+ $username = rc_strtolower($username);
// user already registered -> overwrite username
if ($user = rcube_user::query($username, $host))
@@ -728,9 +740,7 @@
if (!$valid || ($_SERVER['REQUEST_METHOD']!='POST' && $now - $_SESSION['auth_time'] > 300)) {
$_SESSION['last_auth'] = $_SESSION['auth_time'];
$_SESSION['auth_time'] = $now;
- $cookie = session_get_cookie_params();
- setcookie('sessauth', $this->get_auth_hash(session_id(), $now), 0, $cookie['path'],
- $cookie['domain'], $_SERVER['HTTPS'] && ($_SERVER['HTTPS']!='off'));
+ rcmail::setcookie('sessauth', $this->get_auth_hash(session_id(), $now), 0);
}
}
else {
@@ -753,7 +763,7 @@
public function kill_session()
{
$_SESSION = array('language' => $this->user->language, 'auth_time' => time(), 'temp' => true);
- setcookie('sessauth', '-del-', time() - 60);
+ rcmail::setcookie('sessauth', '-del-', time() - 60);
$this->user->reset();
}
@@ -911,6 +921,21 @@
}
return $url;
}
+
+
+ /**
+ * Helper method to set a cookie with the current path and host settings
+ *
+ * @param string Cookie name
+ * @param string Cookie value
+ * @param string Expiration time
+ */
+ public static function setcookie($name, $value, $exp = 0)
+ {
+ $cookie = session_get_cookie_params();
+ setcookie($name, $value, $exp, $cookie['path'], $cookie['domain'],
+ ($_SERVER['HTTPS'] && ($_SERVER['HTTPS'] != 'off')));
+ }
}
--
Gitblit v1.9.1