From ba0a2ee5595fc618e217617a3cbd261486e3fd52 Mon Sep 17 00:00:00 2001 From: rMalie Date: Tue, 17 Jan 2012 09:25:46 +0000 Subject: [PATCH] // Root old files now keep full $_REQUEST parameters in redirection (not only $_GET) in order to keep full retrocompatibility with 1.4 --- address.php | 6 +----- addresses.php | 6 +----- attachment.php | 6 +----- authentication.php | 6 +----- best-sales.php | 6 +----- cart.php | 6 +----- category.php | 6 +----- changecurrency.php | 6 +----- classes/Tools.php | 45 +++++++++++++++++++++++++++-------------- cms.php | 6 +----- contact-form.php | 6 +----- discount.php | 6 +----- get-file.php | 6 +----- guest-tracking.php | 6 +----- history.php | 6 +----- identity.php | 6 +----- index.php | 10 +++++++++ manufacturer.php | 6 +----- my-account.php | 6 +----- new-products.php | 6 +----- order-confirmation.php | 6 +----- order-detail.php | 6 +----- order-follow.php | 6 +----- order-opc.php | 6 +----- order-return.php | 6 +----- order-slip.php | 6 +----- order.php | 6 +----- password.php | 6 +----- pdf-invoice.php | 6 +----- pdf-order-return.php | 6 +----- pdf-order-slip.php | 6 +----- prices-drop.php | 6 +----- product-sort.php | 6 +----- product.php | 6 +----- products-comparison.php | 6 +----- search.php | 6 +----- sitemap.php | 6 +----- statistics.php | 6 +----- stores.php | 6 +----- supplier.php | 6 +----- 40 files changed, 78 insertions(+), 205 deletions(-) diff --git a/address.php b/address.php index 7fb1c1dc4..443051793 100644 --- a/address.php +++ b/address.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=address'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=address'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/addresses.php b/addresses.php index 9761770ed..42ae3dc29 100644 --- a/addresses.php +++ b/addresses.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=addresses'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=addresses'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/attachment.php b/attachment.php index d73e1594d..d2fedb319 100644 --- a/attachment.php +++ b/attachment.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=attachment'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=attachment'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/authentication.php b/authentication.php index f714c1a98..644e4d22e 100644 --- a/authentication.php +++ b/authentication.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=authentication'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=authentication'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/best-sales.php b/best-sales.php index 8b674f6c3..cab5d8fb3 100644 --- a/best-sales.php +++ b/best-sales.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=best-sales'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=best-sales'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/cart.php b/cart.php index 6ab3d2c19..42a809868 100644 --- a/cart.php +++ b/cart.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=cart'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=cart'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/category.php b/category.php index 5965f8d74..15b620d10 100644 --- a/category.php +++ b/category.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=category'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=category'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/changecurrency.php b/changecurrency.php index b8dc6ad81..226c5aa95 100644 --- a/changecurrency.php +++ b/changecurrency.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=change-currency'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=change-currency'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/classes/Tools.php b/classes/Tools.php index a6e5c059e..e4c567661 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -58,27 +58,32 @@ class ToolsCore return $passwd; } - public static function strReplaceFirst($search, $replace, $subject, $cur=0) { + public static function strReplaceFirst($search, $replace, $subject, $cur = 0) + { return (strpos($subject, $search, $cur))?substr_replace($subject, $replace, (int)strpos($subject, $search, $cur), strlen($search)):$subject; } /** - * Redirect user to another page - * - * @param string $url Desired URL - * @param string $baseUri Base URI (optional) - */ - public static function redirect($url, $baseUri = __PS_BASE_URI__, Link $link = null) + * Redirect user to another page + * + * @param string $url Desired URL + * @param string $baseUri Base URI (optional) + * @param Link $link + * @param string|array $headers A list of headers to send before redirection + */ + public static function redirect($url, $base_uri = __PS_BASE_URI__, Link $link = null, $headers = null) { if (!$link) $link = Context::getContext()->link; - if (strpos($url, 'http://') === FALSE && strpos($url, 'https://') === FALSE) + + if (strpos($url, 'http://') === false && strpos($url, 'https://') === false && $link) { - if (strpos($url, $baseUri) !== FALSE && strpos($url, $baseUri) == 0) - $url = substr($url, strlen($baseUri)); - if (strpos($url, 'index.php?controller=') !== FALSE && strpos($url, 'index.php/') == 0) { + if (strpos($url, $base_uri) === 0) + $url = substr($url, strlen($base_uri)); + if (strpos($url, 'index.php?controller=') !== false && strpos($url, 'index.php/') == 0) + { $url = substr($url, strlen('index.php?controller=')); - if((int)(Configuration::get('PS_REWRITING_SETTINGS') == 1)) + if (Configuration::get('PS_REWRITING_SETTINGS')) $url = self::strReplaceFirst('&', '?' , $url); } @@ -89,13 +94,23 @@ class ToolsCore $url = $link->getPageLink($explode[0], $useSSL); if (isset($explode[1])) $url .= '?'.$explode[1]; - $baseUri = ''; + $base_uri = ''; } - if (isset($_SERVER['HTTP_REFERER']) AND ($url == $_SERVER['HTTP_REFERER'])) + // Send additional headers + if ($headers) + { + if (!is_array($headers)) + $headers = array($headers); + + foreach ($headers as $header) + header($header); + } + + if (isset($_SERVER['HTTP_REFERER']) && $url == $_SERVER['HTTP_REFERER']) header('Location: '.$_SERVER['HTTP_REFERER']); else - header('Location: '.$baseUri.$url); + header('Location: '.$base_uri.$url); exit; } diff --git a/cms.php b/cms.php index 889987af6..e875f5e0c 100644 --- a/cms.php +++ b/cms.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=cms'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=cms'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/contact-form.php b/contact-form.php index cdcf04ad6..433d25eb2 100644 --- a/contact-form.php +++ b/contact-form.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=contact'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=contact'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/discount.php b/discount.php index dfae802d0..8ca74a69e 100644 --- a/discount.php +++ b/discount.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=discount'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=discount'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/get-file.php b/get-file.php index 24e4a41d6..222eca507 100644 --- a/get-file.php +++ b/get-file.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=get-file'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=get-file'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/guest-tracking.php b/guest-tracking.php index 9bef034aa..1b3d2d718 100644 --- a/guest-tracking.php +++ b/guest-tracking.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=guest-tracking'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=guest-tracking'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/history.php b/history.php index 1b40f010b..750ca81d8 100644 --- a/history.php +++ b/history.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=history'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=history'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/identity.php b/identity.php index f3a8b93aa..11b40f628 100644 --- a/identity.php +++ b/identity.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=identity'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=identity'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/index.php b/index.php index 61e8a05bb..90718c8dc 100644 --- a/index.php +++ b/index.php @@ -26,4 +26,14 @@ */ require(dirname(__FILE__).'/config/config.inc.php'); +/*$countries = new Collection('Country', 1); +$countries->where('zone.name', '=', 'Asia'); + +echo '
';
+$countries->getAll(true);
+exit;
+foreach ($countries->getAll(true) as $country)
+	echo $country->name.'
'; + +exit;*/ Dispatcher::getInstance()->dispatch(); \ No newline at end of file diff --git a/manufacturer.php b/manufacturer.php index 590e2af21..773563f16 100644 --- a/manufacturer.php +++ b/manufacturer.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=manufacturer'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=manufacturer'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/my-account.php b/my-account.php index 66b2f6a37..316c4554b 100644 --- a/my-account.php +++ b/my-account.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=my-account'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=my-account'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/new-products.php b/new-products.php index 25982ce27..3aecf38a3 100644 --- a/new-products.php +++ b/new-products.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=new-products'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=new-products'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/order-confirmation.php b/order-confirmation.php index 31d902a1b..d091f3b6c 100644 --- a/order-confirmation.php +++ b/order-confirmation.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=order-confirmation'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=order-confirmation'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/order-detail.php b/order-detail.php index 16606ef93..dd45174a5 100644 --- a/order-detail.php +++ b/order-detail.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=order-detail'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=order-detail'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/order-follow.php b/order-follow.php index bd2567ac5..e5c12eb05 100644 --- a/order-follow.php +++ b/order-follow.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=order-follow'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=order-follow'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/order-opc.php b/order-opc.php index c42a8e393..9141c849a 100755 --- a/order-opc.php +++ b/order-opc.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=order-opc'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=order-opc'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/order-return.php b/order-return.php index 0e1a4dbde..43276d5df 100644 --- a/order-return.php +++ b/order-return.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=order-return'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=order-return'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/order-slip.php b/order-slip.php index 8f39477b2..546ec6290 100644 --- a/order-slip.php +++ b/order-slip.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=order-slip'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=order-slip'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/order.php b/order.php index 3c4d406df..0abcbe94d 100644 --- a/order.php +++ b/order.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=order'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=order'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/password.php b/password.php index 1e8f336a1..a7f2acf36 100644 --- a/password.php +++ b/password.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=password'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=password'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/pdf-invoice.php b/pdf-invoice.php index ba90286a6..b6b728b98 100644 --- a/pdf-invoice.php +++ b/pdf-invoice.php @@ -28,8 +28,4 @@ include(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=pdf-invoice'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=pdf-invoice'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/pdf-order-return.php b/pdf-order-return.php index 1b9cc1825..8074d78e5 100644 --- a/pdf-order-return.php +++ b/pdf-order-return.php @@ -28,8 +28,4 @@ include(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=pdf-order-return'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=pdf-order-return'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/pdf-order-slip.php b/pdf-order-slip.php index e73da4497..b4ac980ba 100644 --- a/pdf-order-slip.php +++ b/pdf-order-slip.php @@ -28,8 +28,4 @@ include(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=pdf-order-slip'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=pdf-order-slip'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/prices-drop.php b/prices-drop.php index 82aa7c3b7..9145c4c6d 100644 --- a/prices-drop.php +++ b/prices-drop.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=prices-drop'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=prices-drop'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/product-sort.php b/product-sort.php index 1c34f6262..508951665 100644 --- a/product-sort.php +++ b/product-sort.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=product-sort'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=product-sort'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/product.php b/product.php index b610a1c75..2427b3cc4 100644 --- a/product.php +++ b/product.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=product'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=product'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/products-comparison.php b/products-comparison.php index ce7dbd37a..a6f92491a 100644 --- a/products-comparison.php +++ b/products-comparison.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=products-comparison'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=products-comparison'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/search.php b/search.php index a323469a4..765bb7ace 100644 --- a/search.php +++ b/search.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=search'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=search'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/sitemap.php b/sitemap.php index 4a16da3d3..d661cb8d2 100644 --- a/sitemap.php +++ b/sitemap.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=sitemap'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=sitemap'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/statistics.php b/statistics.php index 5fa348cac..12f6e8062 100644 --- a/statistics.php +++ b/statistics.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=statistics'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=statistics'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/stores.php b/stores.php index d2155c255..83fcee645 100644 --- a/stores.php +++ b/stores.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=stores'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=stores'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/supplier.php b/supplier.php index 3edcffc5b..095ab95d9 100644 --- a/supplier.php +++ b/supplier.php @@ -28,8 +28,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -// init front controller in order to use Tools::redirect -$controller = new FrontController(); -$controller->init(); - -Tools::redirect('index.php?controller=supplier'.(($_SERVER['QUERY_STRING']) ? '&'.$_SERVER['QUERY_STRING'] : '')); \ No newline at end of file +Tools::redirect('index.php?controller=supplier'.($_REQUEST ? '&'.http_build_query($_REQUEST) : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file