Merge branch 'ticket-12487-HTTPS' into develop
This commit is contained in:
commit
d847224f01
@ -452,12 +452,12 @@ class FrontController extends FrontControllerCore {
|
||||
|
||||
Tools::addCSS(_THEME_CSS_DIR_.'style.css?v=31');
|
||||
|
||||
Tools::addJS(array(_PS_JS_DIR_.'scripts.js'));
|
||||
Tools::addJS(array(Tools::getShopDomain(true)._PS_JS_DIR_.'scripts.js'));
|
||||
if(Tools::isSubmit('live_edit') AND Tools::getValue('ad') AND (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_))) {
|
||||
Tools::addJS(array(
|
||||
_PS_JS_DIR_.'jquery/jquery-ui-1.8.10.custom.min.js',
|
||||
_PS_JS_DIR_.'jquery/jquery.fancybox-1.3.4.js',
|
||||
_PS_JS_DIR_.'hookLiveEdit.js')
|
||||
Tools::getShopDomain(true)._PS_JS_DIR_.'jquery/jquery-ui-1.8.10.custom.min.js',
|
||||
Tools::getShopDomain(true)._PS_JS_DIR_.'jquery/jquery.fancybox-1.3.4.js',
|
||||
Tools::getShopDomain(true)._PS_JS_DIR_.'hookLiveEdit.js')
|
||||
);
|
||||
Tools::addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css');
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ class Tools extends ToolsCore {
|
||||
$domain = htmlspecialchars($domain, ENT_COMPAT, 'UTF-8');
|
||||
}
|
||||
if($http) {
|
||||
$domain = (($_SERVER['SERVER_PORT'] == _PS_SSL_PORT_ || !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' || Configuration::get('PS_SSL_ENABLED'))? 'https://': 'http://').$domain;
|
||||
$domain = (($_SERVER['SERVER_PORT'] == _PS_SSL_PORT_ || !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PORT'] == '443') || Configuration::get('PS_SSL_ENABLED'))? 'https://': 'http://').$domain;
|
||||
}
|
||||
|
||||
return $domain;
|
||||
@ -46,7 +46,7 @@ class Tools extends ToolsCore {
|
||||
$domain = htmlspecialchars($domain, ENT_COMPAT, 'UTF-8');
|
||||
}
|
||||
if($http) {
|
||||
$domain = (($_SERVER['SERVER_PORT'] == _PS_SSL_PORT_ || !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' || Configuration::get('PS_SSL_ENABLED'))? 'https://': 'http://').$domain;
|
||||
$domain = (($_SERVER['SERVER_PORT'] == _PS_SSL_PORT_ || !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PORT'] == '443') || Configuration::get('PS_SSL_ENABLED'))? 'https://': 'http://').$domain;
|
||||
}
|
||||
return $domain;
|
||||
|
||||
@ -66,7 +66,7 @@ class Tools extends ToolsCore {
|
||||
|
||||
|
||||
public static function getProtocol($use_ssl=NULL) {
|
||||
return (!is_null($use_ssl) && $use_ssl || $_SERVER['SERVER_PORT'] == _PS_SSL_PORT_ || !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' || Configuration::get('PS_SSL_ENABLED')? 'https://': 'http://');
|
||||
return (!is_null($use_ssl) && $use_ssl || $_SERVER['SERVER_PORT'] == _PS_SSL_PORT_ || !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PORT'] == '443') || Configuration::get('PS_SSL_ENABLED')? 'https://': 'http://');
|
||||
}
|
||||
|
||||
public static function setCookieLanguage() {
|
||||
@ -90,4 +90,43 @@ class Tools extends ToolsCore {
|
||||
return $iso;
|
||||
}
|
||||
|
||||
public static function addCSS($css_uri, $css_media_type = 'all')
|
||||
{
|
||||
global $css_files;
|
||||
|
||||
if (is_array($css_uri))
|
||||
{
|
||||
foreach ($css_uri as $file => $media_type){
|
||||
self::addCSS(self::getShopDomain(true).$file, $media_type);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//overriding of modules css files
|
||||
$different = 0;
|
||||
$override_path = str_replace(__PS_BASE_URI__.'modules/', _PS_ROOT_DIR_.'/themes/'._THEME_NAME_.'/css/modules/', $css_uri, $different);
|
||||
if ($different && file_exists($override_path))
|
||||
$css_uri = str_replace(__PS_BASE_URI__.'modules/', __PS_BASE_URI__.'themes/'._THEME_NAME_.'/css/modules/', $css_uri, $different);
|
||||
else
|
||||
{
|
||||
// remove PS_BASE_URI on _PS_ROOT_DIR_ for the following
|
||||
$url_data = parse_url($css_uri);
|
||||
$file_uri = _PS_ROOT_DIR_.self::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']);
|
||||
// check if css files exists
|
||||
if (!file_exists($file_uri))
|
||||
return true;
|
||||
}
|
||||
|
||||
// detect mass add
|
||||
$css_uri = array(self::getShopDomain(true).$css_uri => $css_media_type);
|
||||
|
||||
// adding file to the big array...
|
||||
if (is_array($css_files))
|
||||
$css_files = array_merge($css_files, $css_uri);
|
||||
else
|
||||
$css_files = $css_uri;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user