Skip to content

Commit

Permalink
fix market issues over https. Fixes #783
Browse files Browse the repository at this point in the history
  • Loading branch information
maskas committed May 9, 2016
1 parent f7f163d commit ed18158
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
16 changes: 13 additions & 3 deletions Ip/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
class Config
{
protected $config;
protected $protocolUrl;
protected $protocol;

/**
Expand Down Expand Up @@ -69,10 +70,19 @@ public function __construct($config, $server = null)


if ((isset($server['HTTPS']) && strtolower($server['HTTPS']) == "on") || strtolower(getenv('HTTP_X_FORWARDED_PROTO')) === 'https') {
$this->protocol = 'https://';
$this->protocol = 'https';
} else {
$this->protocol = 'http://';
$this->protocol = 'http';
}
$this->protocolUrl = $this->protocol . '://';
}

/**
*
*/
public function protocol()
{
return $this->protocol;
}

public function database()
Expand All @@ -92,7 +102,7 @@ public function tablePrefix()
*/
public function baseUrl($protocol = null)
{
$prot = $this->protocol;
$prot = $this->protocolUrl;
if ($protocol !== null) {
$prot = $protocol;
}
Expand Down
2 changes: 1 addition & 1 deletion Ip/Internal/Design/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public function getMarketUrl()
return '';
}

return ipConfig()->get('themeMarketUrl', 'http://market.impresspages.org/themes-v1/?version=4&cms=1');
return ipConfig()->get('themeMarketUrl', ipConfig()->protocol() . '://market.impresspages.org/themes-v1/?version=4&cms=1');
}


Expand Down
2 changes: 1 addition & 1 deletion Ip/Internal/Plugins/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public static function marketUrl()
return '';
}

$marketUrl = ipConfig()->get('pluginMarketUrl', 'http://market.impresspages.org/plugins-v1/?version=4&cms=1');
$marketUrl = ipConfig()->get('pluginMarketUrl', ipConfig()->protocol() . '://market.impresspages.org/plugins-v1/?version=4&cms=1');

return $marketUrl;
}
Expand Down
2 changes: 1 addition & 1 deletion Ip/Internal/Repository/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static function ipBeforeController()
ipAddJs('Ip/Internal/System/assets/market.js');
ipAddJs('Ip/Internal/Core/assets/js/easyXDM/easyXDM.min.js');

$marketUrl = ipConfig()->get('imageMarketUrl', 'http://market.impresspages.org/images-v1/');
$marketUrl = ipConfig()->get('imageMarketUrl', ipConfig()->protocol() . '://market.impresspages.org/images-v1/');

$popupData = array(
'marketUrl' => $marketUrl,
Expand Down

0 comments on commit ed18158

Please sign in to comment.