summaryrefslogtreecommitdiff
path: root/lib/util.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php23
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/util.php b/lib/util.php
index 50bd0e2ac..90d4a6532 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -809,14 +809,33 @@ function common_path($relative, $ssl=false)
} else if (common_config('site', 'server')) {
$serverpart = common_config('site', 'server');
} else {
- common_log(LOG_ERR, 'Site Sever not configured, unable to determine site name.');
+ common_log(LOG_ERR, 'Site server not configured, unable to determine site name.');
}
} else {
$proto = 'http';
if (common_config('site', 'server')) {
$serverpart = common_config('site', 'server');
} else {
- common_log(LOG_ERR, 'Site Sever not configured, unable to determine site name.');
+ common_log(LOG_ERR, 'Site server not configured, unable to determine site name.');
+ }
+ }
+
+ if (common_have_session()) {
+
+ $currentServer = $_SERVER['HTTP_HOST'];
+
+ // Are we pointing to another server (like an SSL server?)
+
+ if (!empty($currentServer) &&
+ 0 != strcasecmp($currentServer, $serverpart)) {
+ // Pass the session ID as a GET parameter
+ $sesspart = session_name() . '=' . session_id();
+ $i = strpos($relative, '?');
+ if ($i === false) { // no GET params, just append
+ $relative .= '?' . $sesspart;
+ } else {
+ $relative = substr($relative, 0, $i + 1).$sesspart.'&'.substr($relative, $i + 1);
+ }
}
}