forked from GNUsocial/gnu-social
try to show HTTPS-encrypted theme files for HTTPS-encrypted pages
This commit is contained in:
parent
40c64388e6
commit
d91f894ccb
@ -116,6 +116,36 @@ class Theme
|
||||
|
||||
protected function relativeThemePath($group, $fallbackSubdir, $name)
|
||||
{
|
||||
if (StatusNet::isHTTPS()) {
|
||||
|
||||
$sslserver = common_config($group, 'sslserver');
|
||||
|
||||
if (empty($sslserver)) {
|
||||
$server = common_config('site', 'server');
|
||||
$path = common_config('site', 'path') . '/';
|
||||
if ($fallbackSubdir) {
|
||||
$path .= $fallbackSubdir . '/';
|
||||
}
|
||||
} else {
|
||||
$server = $sslserver;
|
||||
$path = common_config($group, 'sslpath');
|
||||
if (empty($path)) {
|
||||
$path = common_config($group, 'path');
|
||||
}
|
||||
}
|
||||
|
||||
if ($path[strlen($path)-1] != '/') {
|
||||
$path .= '/';
|
||||
}
|
||||
|
||||
if ($path[0] != '/') {
|
||||
$path = '/'.$path;
|
||||
}
|
||||
|
||||
return 'https://'.$server.$path.$name;
|
||||
|
||||
} else {
|
||||
|
||||
$path = common_config($group, 'path');
|
||||
|
||||
if (empty($path)) {
|
||||
@ -139,23 +169,10 @@ class Theme
|
||||
$server = common_config('site', 'server');
|
||||
}
|
||||
|
||||
$ssl = common_config($group, 'ssl');
|
||||
|
||||
if (is_null($ssl)) { // null -> guess
|
||||
if (common_config('site', 'ssl') == 'always' &&
|
||||
!common_config($group, 'server')) {
|
||||
$ssl = true;
|
||||
} else {
|
||||
$ssl = false;
|
||||
return 'http://'.$server.$path.$name;
|
||||
}
|
||||
}
|
||||
|
||||
$protocol = ($ssl) ? 'https' : 'http';
|
||||
|
||||
$path = $protocol . '://'.$server.$path.$name;
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the full local filename of a file in this theme.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user