Keep params when redirect on mobile
This commit is contained in:
parent
a12ab8132a
commit
4280d4960b
@ -59,10 +59,19 @@ class CategoryControllerCore extends FrontController
|
||||
$currentURL = preg_replace('/[?&].*$/', '', self::$link->getCategoryLink($this->category));
|
||||
if (!preg_match('/^'.Tools::pRegexp($currentURL, '/').'([&?].*)?$/', Tools::getProtocol().$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']))
|
||||
{
|
||||
$params = '';
|
||||
$excludedKey = array('isolang', 'id_lang', 'id_category');
|
||||
foreach($_GET as $key => $value) {
|
||||
if(!in_array($key, $excludedKey)) {
|
||||
$params .= ($params == '' ? '?' : '&').$key.'='.$value;
|
||||
}
|
||||
}
|
||||
echo "coucou : ".$currentURL.$params; exit;
|
||||
if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_ ) {
|
||||
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="'.$currentURL.$params.'">'.$currentURL.$params.'</a>');
|
||||
}
|
||||
header('HTTP/1.0 301 Moved');
|
||||
if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_ )
|
||||
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="'.$currentURL.'">'.$currentURL.'</a>');
|
||||
Tools::redirectLink($currentURL);
|
||||
Tools::redirectLink($currentURL.$params);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -118,7 +127,7 @@ class CategoryControllerCore extends FrontController
|
||||
|
||||
$this->category->description = nl2br2($this->category->description);
|
||||
$subCategories = $this->category->getSubCategories((int)self::$cookie->id_lang);
|
||||
self::$smarty->assign('category', $this->category);
|
||||
self::$smarty->assign('category', $this->category);
|
||||
|
||||
if (isset($subCategories) AND !empty($subCategories) AND $subCategories)
|
||||
{
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
class FrontController extends FrontControllerCore {
|
||||
public function __construct() {
|
||||
class FrontController extends FrontControllerCore
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $useSSL;
|
||||
|
||||
if($_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')) {
|
||||
@ -20,7 +22,8 @@ class FrontController extends FrontControllerCore {
|
||||
parent::displayHeader();
|
||||
}
|
||||
|
||||
public function init() {
|
||||
public function init()
|
||||
{
|
||||
global $useSSL, $cookie, $smarty, $cart, $iso, $defaultCountry, $protocol_link, $protocol_content, $link, $css_files, $js_files, $site_version;
|
||||
|
||||
if (self::$initialized)
|
||||
@ -334,7 +337,8 @@ class FrontController extends FrontControllerCore {
|
||||
$this->setMedia();
|
||||
}
|
||||
|
||||
protected function canonicalRedirection() {
|
||||
protected function canonicalRedirection()
|
||||
{
|
||||
global $link, $cookie;
|
||||
|
||||
if(Configuration::get('PS_CANONICAL_REDIRECT')) {
|
||||
@ -343,7 +347,6 @@ class FrontController extends FrontControllerCore {
|
||||
// $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
|
||||
$canonicalURL = $link->getPageLink($this->php_self, $this->ssl, $cookie->id_lang);
|
||||
if(!Tools::getValue('ajax') && !preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/', (($_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://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'])) {
|
||||
header('HTTP/1.0 301 Moved');
|
||||
$params = '';
|
||||
$excludedKey = array('isolang', 'id_lang');
|
||||
foreach($_GET as $key => $value) {
|
||||
@ -354,17 +357,15 @@ class FrontController extends FrontControllerCore {
|
||||
if(defined('_PS_MODE_DEV_') && _PS_MODE_DEV_ && $_SERVER['REQUEST_URI'] != __PS_BASE_URI__) {
|
||||
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="'.$canonicalURL.$params.'">'.$canonicalURL.$params.'</a>');
|
||||
}
|
||||
header('HTTP/1.0 301 Moved');
|
||||
Tools::redirectLink($canonicalURL.$params);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function preProcess() {
|
||||
/* ini_set('display_errors', 'on');
|
||||
$cmd = 'cd '._PS_ROOT_DIR_.'/themes/site/css/ && /home/www/bebeboutik.com/node_modules/less/bin/lessc --line-numbers=all style.less > style.css';
|
||||
exec($cmd);*/
|
||||
|
||||
public function preProcess()
|
||||
{
|
||||
global $page_name, $cookie;
|
||||
|
||||
if(!isset($this->php_self)) {
|
||||
@ -470,22 +471,23 @@ class FrontController extends FrontControllerCore {
|
||||
parent::preProcess();
|
||||
}
|
||||
|
||||
public function setMedia() {
|
||||
public function setMedia()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
Tools::addCSS(_THEME_CSS_DIR_.'style.css?v=31');
|
||||
|
||||
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_))) {
|
||||
if (Tools::isSubmit('live_edit') AND Tools::getValue('ad') AND (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_))) {
|
||||
Tools::addJS(array(
|
||||
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::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');
|
||||
}
|
||||
$language = new Language($cookie->id_lang);
|
||||
if($language->is_rtl) {
|
||||
if ($language->is_rtl) {
|
||||
Tools::addCSS(_THEME_CSS_DIR_.'rtl.css');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user