X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=classes%2FDesign.php;h=f4834c714e80038e928ab01c2067bf1f6e4c93e9;hb=6c236ab0ff4309c883d7856324f409e043f7db56;hp=9354bfcda8c6fab07b662521e28a8a0f5ba28218;hpb=44b2b6424714f82dc199fbe9780843638122e3ad;p=quix0rs-gnu-social.git diff --git a/classes/Design.php b/classes/Design.php index 9354bfcda8..f4834c714e 100644 --- a/classes/Design.php +++ b/classes/Design.php @@ -1,7 +1,7 @@ . */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -101,13 +101,13 @@ class Design extends Memcached_DataObject } if (0 != mb_strlen($css)) { - $out->element('style', array('type' => 'text/css'), $css); + $out->style($css); } } 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) @@ -204,7 +231,10 @@ class Design extends Memcached_DataObject 'disposition'); foreach ($attrs as $attr) { - $siteDesign->$attr = common_config('design', $attr); + $val = common_config('design', $attr); + if ($val !== false) { + $siteDesign->$attr = $val; + } } }