summaryrefslogtreecommitdiff
path: root/lib/util.php
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-09-13 01:24:57 -0400
committerCraig Andrews <candrews@integralblue.com>2009-09-13 01:24:57 -0400
commit20997619b353faa94591800fbfc02bc19a4cdce3 (patch)
treee08aad033a3d0041f8df7eb0c3d355006be947f7 /lib/util.php
parent0a1d2635c1278a12a643c6ee684a9707df6e87dd (diff)
When viewing a page in https, all links to non-actions (links to CSS, JS, etc) should be https. Fixes the mixed content warnings that browsers display.
Fixes http://status.net/trac/ticket/1552
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/util.php b/lib/util.php
index b831859e9..5b57b79b5 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -750,8 +750,18 @@ function common_local_url($action, $args=null, $params=null, $fragment=null)
return $url;
}
-function common_path($relative, $ssl=false)
+function common_path($relative, $ssl=null)
{
+ if($ssl==null) {
+ //ssl was not specifically requested
+ if( $_SERVER['HTTPS'] && $_SERVER['HTTPS']!="off" ) {
+ //currently in https, so stay in https
+ $ssl=true;
+ } else {
+ //not in https, so stay not in https
+ $ssl=false;
+ }
+ }
$pathpart = (common_config('site', 'path')) ? common_config('site', 'path')."/" : '';
if (($ssl && (common_config('site', 'ssl') === 'sometimes'))