summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-06-11 15:21:14 +0000
committerDries Buytaert <dries@buytaert.net>2007-06-11 15:21:14 +0000
commit53420729ea164c0cc6244316a3001f64e919dc2c (patch)
treef3d13483601738a2563ba5e72ebd20960e2e0062 /includes
parentbc1c4defa2962db7c32a92dfa759a27eb3645caf (diff)
downloadbrdo-53420729ea164c0cc6244316a3001f64e919dc2c.tar.gz
brdo-53420729ea164c0cc6244316a3001f64e919dc2c.tar.bz2
- Patch #101927 by cooferat: fixed problem with post information.
Diffstat (limited to 'includes')
-rw-r--r--includes/bootstrap.inc26
-rw-r--r--includes/common.inc2
-rw-r--r--includes/locale.inc2
3 files changed, 28 insertions, 2 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index a2aa44742..5e7591f2a 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -253,6 +253,32 @@ function drupal_unset_globals() {
}
}
}
+
+ if ($cookie_domain) {
+ // If the user specifies the cookie domain, also use it for session name.
+ $session_name = $cookie_domain;
+ }
+ else {
+ // Otherwise use $base_url for session name.
+ $session_name = $base_url;
+ // We try to set the cookie domain to the hostname.
+ if (!empty($_SERVER['HTTP_HOST'])) {
+ $cookie_domain = $_SERVER['HTTP_HOST'];
+ }
+ }
+ // Strip leading periods, www., and port numbers from cookie domain.
+ $cookie_domain = ltrim($cookie_domain, '.');
+ if (strpos($cookie_domain, 'www.') === 0) {
+ $cookie_domain = substr($cookie_domain, 4);
+ }
+ $cookie_domain = explode(':', $cookie_domain);
+ $cookie_domain = '.'. array_shift($cookie_domain);
+ // Per RFC 2109, cookie domains must contain at least one dot other than the
+ // first. For hosts such as 'localhost' or IP Addresses we don't set a cookie domain.
+ if (count(explode('.', $cookie_domain)) > 2 && !is_numeric(str_replace('.', '', $cookie_domain))) {
+ ini_set('session.cookie_domain', $cookie_domain);
+ }
+ session_name('SESS'. md5($session_name));
}
/**
diff --git a/includes/common.inc b/includes/common.inc
index 5bd1ac781..29911dd9e 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -1752,7 +1752,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL) {
if (function_exists('locale_inc_callback')) {
locale_inc_callback('_locale_update_js_files');
}
-
+
if (!isset($javascript)) {
$javascript = drupal_add_js(NULL, NULL, $scope);
}
diff --git a/includes/locale.inc b/includes/locale.inc
index e0735ce04..49677a8bc 100644
--- a/includes/locale.inc
+++ b/includes/locale.inc
@@ -778,7 +778,7 @@ function locale_translate_edit_form(&$form_state, $lid) {
'#default_value' => '',
);
}
-
+
// Fetch translations and fill in default values in the form.
$result = db_query("SELECT DISTINCT translation, language FROM {locales_target} WHERE lid = %d AND language != '%s'", $lid, $omit);
while ($translation = db_fetch_object($result)) {