X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=classes%2FDesign.php;h=f4834c714e80038e928ab01c2067bf1f6e4c93e9;hb=39f8d2c72830d7bc3c08f60d1df38d19c846a74b;hp=4e7d7dfb257854a4a898ae44524b9a0739671e72;hpb=78fc9483d4d1fde4561905edf6594b86c4dc374e;p=quix0rs-gnu-social.git diff --git a/classes/Design.php b/classes/Design.php index 4e7d7dfb25..f4834c714e 100644 --- a/classes/Design.php +++ b/classes/Design.php @@ -107,7 +107,7 @@ class Design extends Memcached_DataObject static function toWebColor($color) { - if ($color == null) { + if ($color === null || $color === '') { return null; } @@ -139,7 +139,42 @@ class Design extends Memcached_DataObject static function url($filename) { - $path = common_config('background', 'path'); + if (StatusNet::isHTTPS()) { + + $sslserver = common_config('background', 'sslserver'); + + if (empty($sslserver)) { + // XXX: this assumes that background dir == site dir + /background/ + // not true if there's another server + if (is_string(common_config('site', 'sslserver')) && + mb_strlen(common_config('site', 'sslserver')) > 0) { + $server = common_config('site', 'sslserver'); + } else if (common_config('site', 'server')) { + $server = common_config('site', 'server'); + } + $path = common_config('site', 'path') . '/background/'; + } else { + $server = $sslserver; + $path = common_config('background', 'sslpath'); + if (empty($path)) { + $path = common_config('background', 'path'); + } + } + + $protocol = 'https'; + + } else { + + $path = common_config('background', 'path'); + + $server = common_config('background', 'server'); + + if (empty($server)) { + $server = common_config('site', 'server'); + } + + $protocol = 'http'; + } if ($path[strlen($path)-1] != '/') { $path .= '/'; @@ -149,15 +184,7 @@ class Design extends Memcached_DataObject $path = '/'.$path; } - $server = common_config('background', 'server'); - - if (empty($server)) { - $server = common_config('site', 'server'); - } - - // XXX: protocol - - return 'http://'.$server.$path.$filename; + return $protocol.'://'.$server.$path.$filename; } function setDisposition($on, $off, $tile)