From 1bb4a61a4213b8b46e7b9f34fcde4afbe29e2584 Mon Sep 17 00:00:00 2001
From: fBrignoli
', E_USER_WARNING);
+ $backtrace = debug_backtrace();
+ $callee = next($backtrace);
+ $error = 'Function '.$callee['function'].'() is deprecated in '.$callee['file'].' on line '.$callee['line'].'
';
+ $message = Tools::displayError('The function').' '.$callee['function'].' ('.Tools::displayError('Line').' '.$callee['line'].') '.Tools::displayError('is deprecated and will be removed in the next major version.');
- $message = Tools::displayError('The function').' '.$callee['function'].' ('.Tools::displayError('Line').' '.$callee['line'].') '.Tools::displayError('is deprecated and will be removed in the next major version.');
-
- Logger::addLog($message, 3, $callee['class']);
- }
+ self::throwDeprecated($error, $message, $callee['class']);
}
/**
* Display a warning message indicating that the parameter is deprecated
*/
public static function displayParameterAsDeprecated($parameter)
+ {
+ $backtrace = debug_backtrace();
+ $callee = next($backtrace);
+ $error = 'Parameter '.$parameter.' in function '.$callee['function'].'() is deprecated in '.$callee['file'].' on line '.$callee['Line'].'
';
+ $message = Tools::displayError('The parameter').' '.$parameter.' '.Tools::displayError(' in function ').' '.$callee['function'].' ('.Tools::displayError('Line').' '.$callee['Line'].') '.Tools::displayError('is deprecated and will be removed in the next major version.');
+
+ self::throwDeprecated($error, $message, $callee['class']);
+ }
+
+ public static function displayFileAsDeprecated()
+ {
+ $backtrace = debug_backtrace();
+ $callee = current($backtrace);
+ $error = 'File '.$callee['file'].' is deprecated
';
+ $message = Tools::displayError('The file').' '.$callee['file'].' '.Tools::displayError('is deprecated and will be removed in the next major version.');
+
+ self::throwDeprecated($error, $message, $callee['class']);
+ }
+
+ protected static function throwDeprecated($error, $message, $class)
{
if (_PS_DISPLAY_COMPATIBILITY_WARNING_)
{
- $backtrace = debug_backtrace();
- $callee = next($backtrace);
- trigger_error('Parameter '.$parameter.' in function '.$callee['function'].'() is deprecated in '.$callee['file'].' on line '.$callee['Line'].'
', E_USER_WARNING);
-
- $message = Tools::displayError('The parameter').' '.$parameter.' '.Tools::displayError(' in function ').' '.$callee['function'].' ('.Tools::displayError('Line').' '.$callee['Line'].') '.Tools::displayError('is deprecated and will be removed in the next major version.');
- Logger::addLog($message, 3, $callee['class']);
+ trigger_error($error, E_USER_WARNING);
+ Logger::addLog($message, 3, $class);
}
}
@@ -1776,7 +1793,7 @@ FileETag INode MTime Size
$s = str_replace($char, '\\'.$char, $s);
return $s;
}
-
+
public static function str_replace_once($needle , $replace , $haystack)
{
$pos = strpos($haystack, $needle);
diff --git a/cms.php b/cms.php
index 6dfc3f57a..1435b5703 100644
--- a/cms.php
+++ b/cms.php
@@ -1,6 +1,6 @@
run();
+Tools::displayFileAsDeprecated();
+
+// init front controller in order to use Tools::redirect
+$controller = new FrontController();
+$controller->init();
+
+$params = $_SERVER['QUERY_STRING'];
+if (!empty($params))
+ $params = '?'.$params;
+
+Tools::redirect('index.php/cms'.$params);
+
diff --git a/contact-form.php b/contact-form.php
index 92e6f5200..6e752aa71 100644
--- a/contact-form.php
+++ b/contact-form.php
@@ -1,6 +1,6 @@
run();
+Tools::displayFileAsDeprecated();
+
+// init front controller in order to use Tools::redirect
+$controller = new FrontController();
+$controller->init();
+
+$params = $_SERVER['QUERY_STRING'];
+if (!empty($params))
+ $params = '?'.$params;
+
+Tools::redirect('index.php/contact-form'.$params);
+
diff --git a/controllers/AddressController.php b/controllers/AddressController.php
index d697e368e..c38654de7 100644
--- a/controllers/AddressController.php
+++ b/controllers/AddressController.php
@@ -1,6 +1,6 @@
php_self = 'address.php';
$this->authRedirection = 'addresses.php';
$this->ssl = true;
-
+
parent::__construct();
}
-
+
public function preProcess()
{
parent::preProcess();
-
+
if ($back = Tools::getValue('back'))
self::$smarty->assign('back', Tools::safeOutput($back));
if ($mod = Tools::getValue('mod'))
self::$smarty->assign('mod', Tools::safeOutput($mod));
-
+
if (Tools::isSubmit('ajax') AND Tools::isSubmit('type'))
{
if (Tools::getValue('type') == 'delivery')
@@ -62,7 +62,7 @@ class AddressControllerCore extends FrontController
}
else
$id_address = (int)Tools::getValue('id_address', 0);
-
+
if ($id_address)
{
$this->_address = new Address((int)$id_address);
@@ -75,7 +75,7 @@ class AddressControllerCore extends FrontController
if (self::$cart->id_address_delivery == $this->_address->id)
unset(self::$cart->id_address_delivery);
if ($this->_address->delete())
- Tools::redirect('addresses.php');
+ Tools::redirect('index.php?controller=addresses');
$this->errors[] = Tools::displayError('This address cannot be deleted.');
}
self::$smarty->assign(array('address' => $this->_address, 'id_address' => (int)$id_address));
@@ -83,7 +83,7 @@ class AddressControllerCore extends FrontController
elseif (Tools::isSubmit('ajax'))
exit;
else
- Tools::redirect('addresses.php');
+ Tools::redirect('index.php?controller=addresses');
}
if (Tools::isSubmit('submitAddress'))
{
@@ -135,7 +135,7 @@ class AddressControllerCore extends FrontController
if ((int)($country->contains_states) AND !(int)($address->id_state))
$this->errors[] = Tools::displayError('This country requires a state selection.');
-
+
if (!sizeof($this->errors))
{
if (isset($id_address))
@@ -153,7 +153,7 @@ class AddressControllerCore extends FrontController
if (self::$cart->id_address_delivery == $address_old->id)
unset(self::$cart->id_address_delivery);
}
-
+
if ($address_old->isUsed())
$address_old->delete();
else
@@ -164,8 +164,8 @@ class AddressControllerCore extends FrontController
}
}
elseif (self::$cookie->is_guest)
- Tools::redirect('addresses.php');
-
+ Tools::redirect('index.php?controller=addresses');
+
if ($result = $address->save())
{
if ((bool)(Tools::getValue('select_address', false)) == true OR (Tools::isSubmit('ajax') AND Tools::getValue('type') == 'invoice'))
@@ -177,7 +177,7 @@ class AddressControllerCore extends FrontController
if (Tools::isSubmit('ajax'))
{
$return = array(
- 'hasError' => !empty($this->errors),
+ 'hasError' => !empty($this->errors),
'errors' => $this->errors,
'id_address_delivery' => self::$cart->id_address_delivery,
'id_address_invoice' => self::$cart->id_address_invoice
@@ -201,26 +201,26 @@ class AddressControllerCore extends FrontController
if (Tools::isSubmit('ajax') AND sizeof($this->errors))
{
$return = array(
- 'hasError' => !empty($this->errors),
+ 'hasError' => !empty($this->errors),
'errors' => $this->errors
);
die(Tools::jsonEncode($return));
}
}
-
+
public function setMedia()
{
parent::setMedia();
Tools::addJS(_THEME_JS_DIR_.'tools/statesManagement.js');
}
-
+
public function process()
{
parent::process();
/* Secure restriction for guest */
if (self::$cookie->is_guest)
- Tools::redirect('addresses.php');
+ Tools::redirect('index.php?controller=addresses');
if (Tools::isSubmit('id_country') AND Tools::getValue('id_country') != NULL AND is_numeric(Tools::getValue('id_country')))
$selectedCountry = (int)Tools::getValue('id_country');
@@ -234,7 +234,7 @@ class AddressControllerCore extends FrontController
}
else
$selectedCountry = (int)Configuration::get('PS_COUNTRY_DEFAULT');
-
+
$countries = Country::getCountries((int)self::$cookie->id_lang, true);
$countriesList = '';
foreach ($countries AS $country)
@@ -257,21 +257,12 @@ class AddressControllerCore extends FrontController
));
}
- protected function _processAddressFormat()
- {
-
- $id_country = is_null($this->_address)? 0 : (int)$this->_address->id_country;
-
- $dlv_adr_fields = AddressFormat::getOrderedAddressFields($id_country, $split_all = true);
- self::$smarty->assign('ordered_adr_fields', $dlv_adr_fields);
- }
-
public function displayHeader()
{
if (Tools::getValue('ajax') != 'true')
parent::displayHeader();
}
-
+
public function displayContent()
{
parent::displayContent();
@@ -279,7 +270,7 @@ class AddressControllerCore extends FrontController
$this->_processAddressFormat();
self::$smarty->display(_PS_THEME_DIR_.'address.tpl');
}
-
+
public function displayFooter()
{
if (Tools::getValue('ajax') != 'true')
diff --git a/controllers/AuthController.php b/controllers/AuthController.php
index af064c24d..e2bc58e87 100644
--- a/controllers/AuthController.php
+++ b/controllers/AuthController.php
@@ -40,7 +40,7 @@ class AuthControllerCore extends FrontController
parent::preProcess();
if (self::$cookie->isLogged() AND !Tools::isSubmit('ajax'))
- Tools::redirect('my-account.php');
+ Tools::redirect('index.php?controller=my-account');
if (Tools::getValue('create_account'))
{
@@ -203,7 +203,7 @@ class AuthControllerCore extends FrontController
}
if ($back = Tools::getValue('back'))
Tools::redirect($back);
- Tools::redirect('my-account.php');
+ Tools::redirect('index.php?controller=my-account');
}
}
}
@@ -272,7 +272,7 @@ class AuthControllerCore extends FrontController
{
if ($back = Tools::getValue('back'))
Tools::redirect($back);
- Tools::redirect('my-account.php');
+ Tools::redirect('index.php?controller=my-account');
}
}
}
diff --git a/controllers/CMSController.php b/controllers/CMSController.php
index 8de8f2973..cce554a1b 100644
--- a/controllers/CMSController.php
+++ b/controllers/CMSController.php
@@ -1,6 +1,6 @@
cms = new CMS($id_cms, self::$cookie->id_lang);
+ $this->cms = new CMS($id_cms, self::$cookie->id_lang);
elseif ($id_cms_category = (int)Tools::getValue('id_cms_category'))
- $this->cms_category = new CMSCategory($id_cms_category, self::$cookie->id_lang);
-
+ $this->cms_category = new CMSCategory($id_cms_category, self::$cookie->id_lang);
+
// Automatically redirect to the canonical URL if the current in is the right one
// $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
if ($this->cms AND $canonicalURL = self::$link->getCMSLink($this->cms))
@@ -56,17 +56,17 @@ class CmsControllerCore extends FrontController
die('[Debug] This page has moved
Please use the following URL instead: '.$canonicalURL.'');
Tools::redirectLink($canonicalURL);
}
-
+
parent::preProcess();
-
+
/* assignCase (1 = CMS page, 2 = CMS category) */
if (Validate::isLoadedObject($this->cms) AND ($this->cms->active OR (Tools::getValue('adtoken') == Tools::encrypt('PreviewCMS'.$this->cms->id) AND file_exists(dirname(__FILE__).'/../'.Tools::getValue('ad').'/ajax.php'))))
$this->assignCase = 1;
elseif (Validate::isLoadedObject($this->cms_category))
$this->assignCase = 2;
else
- Tools::redirect('404.php');
-
+ Tools::redirect('index.php?controller=404');
+
if((int)(Configuration::get('PS_REWRITING_SETTINGS')))
{
$rewrite_infos = (isset($id_cms) AND !isset($id_cms_category)) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
@@ -81,17 +81,17 @@ class CmsControllerCore extends FrontController
self::$smarty->assign('lang_rewrite_urls', $default_rewrite);
}
}
-
+
public function setMedia()
{
parent::setMedia();
-
+
if ($this->assignCase == 1)
Tools::addJS(_THEME_JS_DIR_.'cms.js');
-
+
Tools::addCSS(_THEME_CSS_DIR_.'cms.css');
}
-
+
public function process()
{
parent::process();
@@ -117,10 +117,11 @@ class CmsControllerCore extends FrontController
));
}
}
-
+
public function displayContent()
{
parent::displayContent();
self::$smarty->display(_PS_THEME_DIR_.'cms.tpl');
}
}
+
diff --git a/controllers/CartController.php b/controllers/CartController.php
index b2de43761..7904bc4cf 100644
--- a/controllers/CartController.php
+++ b/controllers/CartController.php
@@ -1,6 +1,6 @@
errors))
- Tools::redirect('order.php?'.(isset($idProduct) ? 'ipa='.(int)($idProduct) : ''));
+ Tools::redirect('index.php?controller=order&'.(isset($idProduct) ? 'ipa='.(int)($idProduct) : ''));
}
}
@@ -239,3 +239,4 @@ class CartControllerCore extends FrontController
self::$smarty->display(_PS_THEME_DIR_.'errors.tpl');
}
}
+
diff --git a/controllers/CompareController.php b/controllers/CompareController.php
index 2363e8cd1..abcdd7964 100644
--- a/controllers/CompareController.php
+++ b/controllers/CompareController.php
@@ -42,7 +42,7 @@ class CompareControllerCore extends FrontController
$postProducts = isset($product_list) ? rtrim($product_list,'|') : '';
if (!Configuration::get('PS_COMPARATOR_MAX_ITEM'))
- return Tools::redirect('404.php');
+ return Tools::redirect('index.php?controller=404');
if ($postProducts)
{
diff --git a/controllers/GuestTrackingController.php b/controllers/GuestTrackingController.php
index b34cba5b4..db9f6c98c 100644
--- a/controllers/GuestTrackingController.php
+++ b/controllers/GuestTrackingController.php
@@ -1,6 +1,6 @@
isLogged())
- Tools::redirect('history.php');
+ Tools::redirect('index.php?controller=history');
}
-
+
public function process()
{
parent::process();
-
+
if ($id_order = Tools::getValue('id_order') AND $email = Tools::getValue('email'))
{
$order = new Order((int)$id_order);
@@ -58,8 +58,7 @@ class GuestTrackingControllerCore extends FrontController
$products = $order->getProducts();
$customizedDatas = Product::getAllCustomizedDatas((int)($order->id_cart));
Product::addCustomizationPrice($products, $customizedDatas);
-
- $this->processAddressFormat($addressDelivery, $addressInvoice);
+
self::$smarty->assign(array(
'shop_name' => Configuration::get('PS_SHOP_NAME'),
'order' => $order,
@@ -86,7 +85,7 @@ class GuestTrackingControllerCore extends FrontController
self::$smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
self::$smarty->assign('HOOK_ORDERDETAILDISPLAYED', Module::hookExec('orderDetailDisplayed', array('order' => $order)));
Module::hookExec('OrderDetail', array('carrier' => $carrier, 'order' => $order));
-
+
if (Tools::isSubmit('submitTransformGuestToCustomer'))
{
if (!Validate::isPasswd(Tools::getValue('password')))
@@ -104,25 +103,25 @@ class GuestTrackingControllerCore extends FrontController
/* Handle brute force attacks */
sleep(1);
}
-
+
self::$smarty->assign(array(
'action' => 'guest-tracking.php',
'errors' => $this->errors
));
}
-
+
public function setMedia()
{
parent::setMedia();
-
+
Tools::addCSS(_THEME_CSS_DIR_.'history.css');
Tools::addCSS(_THEME_CSS_DIR_.'addresses.css');
}
-
+
public function displayContent()
{
parent::displayContent();
-
+
self::$smarty->display(_PS_THEME_DIR_.'guest-tracking.tpl');
}
@@ -137,3 +136,4 @@ class GuestTrackingControllerCore extends FrontController
}
}
+
diff --git a/controllers/OrderController.php b/controllers/OrderController.php
index 514f3bf97..98eb530ce 100644
--- a/controllers/OrderController.php
+++ b/controllers/OrderController.php
@@ -67,7 +67,7 @@ class OrderControllerCore extends ParentOrderController
}
if (!self::$cookie->isLogged(true) AND in_array($this->step, array(1, 2, 3)))
- Tools::redirect('authentication.php?back='.urlencode('order.php?step='.$this->step));
+ Tools::redirect('index.php?controller=authentication&back=order.php?step='.$this->step);
if ($this->nbProducts)
self::$smarty->assign('virtual_cart', $isVirtualCart);
@@ -109,10 +109,10 @@ class OrderControllerCore extends ParentOrderController
{
$email = self::$cookie->email;
self::$cookie->logout(); // If guest we clear the cookie for security reason
- Tools::redirect('guest-tracking.php?id_order='.(int)$id_order.'&email='.urlencode($email));
+ Tools::redirect('index.php?controller=guest-tracking&id_order='.(int)$id_order.'&email='.urlencode($email));
}
else
- Tools::redirect('history.php');
+ Tools::redirect('index.php?controller=history');
}
$this->_assignPayment();
break;
@@ -172,7 +172,7 @@ class OrderControllerCore extends ParentOrderController
global $isVirtualCart;
if ($this->step >= 2 AND (!self::$cart->id_address_delivery OR !self::$cart->id_address_invoice))
- Tools::redirect('order.php?step=1');
+ Tools::redirect('index.php?controller=order&step=1');
$delivery = new Address((int)(self::$cart->id_address_delivery));
$invoice = new Address((int)(self::$cart->id_address_invoice));
@@ -182,10 +182,10 @@ class OrderControllerCore extends ParentOrderController
unset(self::$cart->id_address_delivery);
if ($invoice->deleted)
unset(self::$cart->id_address_invoice);
- Tools::redirect('order.php?step=1');
+ Tools::redirect('index.php?controller=order&step=1');
}
elseif ($this->step >= 3 AND !self::$cart->id_carrier AND !$isVirtualCart)
- Tools::redirect('order.php?step=2');
+ Tools::redirect('index.php?controller=order&step=2');
}
/*
@@ -241,7 +241,7 @@ class OrderControllerCore extends ParentOrderController
self::$smarty->assign('cart', self::$cart);
if (self::$cookie->is_guest)
- Tools::redirect('order.php?step=2');
+ Tools::redirect('index.php?controller=order?step=2');
}
/* Carrier step */
@@ -268,7 +268,7 @@ class OrderControllerCore extends ParentOrderController
// Redirect instead of displaying payment modules if any module are grefted on
Hook::backBeforePayment('order.php?step=3');
-
+
/* We may need to display an order summary */
self::$smarty->assign(self::$cart->getSummaryDetails());
self::$smarty->assign(array(
@@ -276,7 +276,7 @@ class OrderControllerCore extends ParentOrderController
'taxes_enabled' => (int)(Configuration::get('PS_TAX'))
));
self::$cookie->checkedTOS = '1';
-
+
parent::_assignPayment();
}
}
diff --git a/controllers/OrderDetailController.php b/controllers/OrderDetailController.php
index a73313bbe..4ccf32f1a 100644
--- a/controllers/OrderDetailController.php
+++ b/controllers/OrderDetailController.php
@@ -84,7 +84,7 @@ class OrderDetailControllerCore extends FrontController
'{message}' => $message->message),
$to, $toName, $customer->email, $customer->firstname.' '.$customer->lastname);
if (Tools::getValue('ajax') != 'true')
- Tools::redirect('order-detail.php?id_order='.(int)($idOrder));
+ Tools::redirect('index.php?controller=order-detail&id_order='.(int)($idOrder));
}
else
{
diff --git a/controllers/OrderFollowController.php b/controllers/OrderFollowController.php
index 2fee624fc..e08b2441d 100644
--- a/controllers/OrderFollowController.php
+++ b/controllers/OrderFollowController.php
@@ -1,6 +1,6 @@
php_self = 'order-follow.php';
$this->authRedirection = 'order-follow.php';
$this->ssl = true;
-
+
parent::__construct();
}
-
+
public function preProcess()
{
parent::preProcess();
-
+
if (Tools::isSubmit('submitReturnMerchandise'))
{
$customizationQtyInput = Tools::getValue('customization_qty_input');
if (!$id_order = (int)(Tools::getValue('id_order')))
- Tools::redirect('history.php');
+ Tools::redirect('index.php?controller=history');
if (!$order_qte_input = Tools::getValue('order_qte_input'))
- Tools::redirect('order-follow.php?errorDetail1');
+ Tools::redirect('index.php?controller=order-follow&errorDetail1');
if ($customizationIds = Tools::getValue('customization_ids') AND !$customizationQtyInput)
- Tools::redirect('order-follow.php?errorDetail1');
+ Tools::redirect('index.php?controller=order-follow&errorDetail1');
if (!$ids_order_detail = Tools::getValue('ids_order_detail') AND !$customizationIds)
- Tools::redirect('order-follow.php?errorDetail2');
+ Tools::redirect('index.php?controller=order-follow&errorDetail2');
$order = new Order((int)($id_order));
- if (!$order->isReturnable()) Tools::redirect('order-follow.php?errorNotReturnable');
+ if (!$order->isReturnable()) Tools::redirect('index.php?controller=order-follow&errorNotReturnable');
if ($order->id_customer != self::$cookie->id_customer)
die(Tools::displayError());
$orderReturn = new OrderReturn();
@@ -63,15 +63,15 @@ class OrderFollowControllerCore extends FrontController
$orderReturn->id_order = $id_order;
$orderReturn->question = strval(Tools::getValue('returnText'));
if (empty($orderReturn->question))
- Tools::redirect('order-follow.php?errorMsg');
+ Tools::redirect('index.php?controller=order-follow&errorMsg');
if (!$orderReturn->checkEnoughProduct($ids_order_detail, $order_qte_input, $customizationIds, $customizationQtyInput))
- Tools::redirect('order-follow.php?errorQuantity');
+ Tools::redirect('index.php?controller=order-follow&errorQuantity');
$orderReturn->state = 1;
$orderReturn->add();
$orderReturn->addReturnDetail($ids_order_detail, $order_qte_input, $customizationIds, $customizationQtyInput);
Module::hookExec('orderReturn', array('orderReturn' => $orderReturn));
- Tools::redirect('order-follow.php');
+ Tools::redirect('index.php?controller=order-follow');
}
$ordersReturn = OrderReturn::getOrdersReturn((int)(self::$cookie->id_customer));
@@ -88,7 +88,7 @@ class OrderFollowControllerCore extends FrontController
self::$smarty->assign('ordersReturn', $ordersReturn);
}
-
+
public function setMedia()
{
parent::setMedia();
diff --git a/controllers/ParentOrderController.php b/controllers/ParentOrderController.php
index adcdf1ffa..11714f376 100644
--- a/controllers/ParentOrderController.php
+++ b/controllers/ParentOrderController.php
@@ -1,6 +1,6 @@
ssl = true;
parent::__construct();
-
+
/* Disable some cache related bugs on the cart/order */
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
}
-
+
public function init()
{
parent::init();
$this->nbProducts = self::$cart->nbProducts();
}
-
+
public function preProcess()
{
global $isVirtualCart;
-
+
parent::preProcess();
-
+
// Redirect to the good order process
- if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 0 AND strpos($_SERVER['PHP_SELF'], 'order.php') === false)
- Tools::redirect('order.php');
- if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1 AND strpos($_SERVER['PHP_SELF'], 'order-opc.php') === false)
+ if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 0 AND Tools::getValue('controller') != 'order')
+ Tools::redirect('index.php?controller=order');
+ if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1 AND Tools::getValue('controller') != 'order-opc')
{
if (isset($_GET['step']) AND $_GET['step'] == 3)
- Tools::redirect('order-opc.php?isPaymentStep=true');
- Tools::redirect('order-opc.php');
+ Tools::redirect('index.php?controller=order-opc&isPaymentStep=true');
+ Tools::redirect('index.php?controller=order-opc');
}
-
+
if (Configuration::get('PS_CATALOG_MODE'))
$this->errors[] = Tools::displayError('This store has not accepted your new order.');
-
+
if (Tools::isSubmit('submitReorder') AND $id_order = (int)Tools::getValue('id_order'))
{
$oldCart = new Cart(Order::getCartIdStatic((int)$id_order, (int)self::$cookie->id_customer));
@@ -80,11 +80,11 @@ class ParentOrderControllerCore extends FrontController
self::$cookie->id_cart = $duplication['cart']->id;
self::$cookie->write();
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1)
- Tools::redirect('order-opc.php');
- Tools::redirect('order.php');
+ Tools::redirect('index.php?controller=order-opc');
+ Tools::redirect('index.php?controller=order');
}
}
-
+
if ($this->nbProducts)
{
if (Tools::isSubmit('submitAddDiscount') AND Tools::getValue('discount_name'))
@@ -105,7 +105,7 @@ class ParentOrderControllerCore extends FrontController
if (!sizeof($this->errors))
{
self::$cart->addDiscount((int)($discount->id));
- Tools::redirect('order-opc.php');
+ Tools::redirect('index.php?controller=order-opc');
}
}
self::$smarty->assign(array(
@@ -116,21 +116,21 @@ class ParentOrderControllerCore extends FrontController
elseif (isset($_GET['deleteDiscount']) AND Validate::isUnsignedId($_GET['deleteDiscount']))
{
self::$cart->deleteDiscount((int)($_GET['deleteDiscount']));
- Tools::redirect('order-opc.php');
+ Tools::redirect('index.php?controller=order-opc');
}
-
+
/* Is there only virtual product in cart */
if ($isVirtualCart = self::$cart->isVirtualCart())
$this->_setNoCarrier();
}
-
+
self::$smarty->assign('back', Tools::safeOutput(Tools::getValue('back')));
}
-
+
public function setMedia()
{
parent::setMedia();
-
+
// Adding CSS style sheet
Tools::addCSS(_THEME_CSS_DIR_.'addresses.css');
Tools::addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen');
@@ -145,9 +145,9 @@ class ParentOrderControllerCore extends FrontController
Tools::addJS(_THEME_JS_DIR_.'cart-summary.js');
Tools::addJS(_PS_JS_DIR_.'jquery/jquery-typewatch.pack.js');
}
-
+
}
-
+
/**
* @return boolean
*/
@@ -162,7 +162,7 @@ class ParentOrderControllerCore extends FrontController
}
return false;
}
-
+
protected function _updateMessage($messageContent)
{
if ($messageContent)
@@ -194,7 +194,7 @@ class ParentOrderControllerCore extends FrontController
}
return true;
}
-
+
protected function _processCarrier()
{
self::$cart->recyclable = (int)(Tools::getValue('recyclable'));
@@ -206,7 +206,7 @@ class ParentOrderControllerCore extends FrontController
else
self::$cart->gift_message = strip_tags($_POST['gift_message']);
}
-
+
if (isset(self::$cookie->id_customer) AND self::$cookie->id_customer)
{
$address = new Address((int)(self::$cart->id_address_delivery));
@@ -215,21 +215,21 @@ class ParentOrderControllerCore extends FrontController
}
else
$id_zone = Country::getIdZone((int)Configuration::get('PS_COUNTRY_DEFAULT'));
-
+
if (Validate::isInt(Tools::getValue('id_carrier')) AND sizeof(Carrier::checkCarrierZone((int)(Tools::getValue('id_carrier')), (int)($id_zone))))
self::$cart->id_carrier = (int)(Tools::getValue('id_carrier'));
elseif (!self::$cart->isVirtualCart() AND (int)(Tools::getValue('id_carrier')) == 0)
$this->errors[] = Tools::displayError('Invalid carrier or no carrier selected');
-
+
Module::hookExec('processCarrier', array('cart' => self::$cart));
-
+
return self::$cart->update();
}
-
+
protected function _assignSummaryInformations()
{
global $currency;
-
+
if (file_exists(_PS_SHIP_IMG_DIR_.(int)(self::$cart->id_carrier).'.jpg'))
self::$smarty->assign('carrierPicture', 1);
$summary = self::$cart->getSummaryDetails();
@@ -273,11 +273,11 @@ class ParentOrderControllerCore extends FrontController
'HOOK_SHOPPING_CART_EXTRA' => Module::hookExec('shoppingCartExtra', $summary)
));
}
-
+
protected function _assignAddress()
{
if (!Customer::getAddressesTotalById((int)(self::$cookie->id_customer)))
- Tools::redirect('address.php?back=order.php?step=1');
+ Tools::redirect('index.php?controller=address&back=order.php&step=1');
$customer = new Customer((int)(self::$cookie->id_customer));
if (Validate::isLoadedObject($customer))
{
@@ -319,14 +319,14 @@ class ParentOrderControllerCore extends FrontController
if ($oldMessage = Message::getMessageByCartId((int)(self::$cart->id)))
self::$smarty->assign('oldMessage', $oldMessage['message']);
}
-
+
protected function _assignCarrier()
{
$customer = new Customer((int)(self::$cookie->id_customer));
$address = new Address((int)(self::$cart->id_address_delivery));
$id_zone = Address::getZoneById((int)($address->id));
$carriers = Carrier::getCarriersForOrder($id_zone, $customer->getGroups());
-
+
$checked = 0;
if (Validate::isUnsignedInt(self::$cart->id_carrier) AND self::$cart->id_carrier)
{
@@ -342,14 +342,14 @@ class ParentOrderControllerCore extends FrontController
'HOOK_BEFORECARRIER' => Module::hookExec('beforeCarrier', array('carriers' => $carriers))
));
}
-
+
protected function _assignWrappingAndTOS()
{
// Wrapping fees
$wrapping_fees = (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE'));
$wrapping_fees_tax = new Tax((int)(Configuration::get('PS_GIFT_WRAPPING_TAX')));
$wrapping_fees_tax_inc = $wrapping_fees * (1 + (((float)($wrapping_fees_tax->rate) / 100)));
-
+
// TOS
$cms = new CMS((int)(Configuration::get('PS_CONDITIONS_CMS_ID')), (int)(self::$cookie->id_lang));
$this->link_conditions = self::$link->getCMSLink($cms, $cms->link_rewrite, true);
@@ -357,7 +357,7 @@ class ParentOrderControllerCore extends FrontController
$this->link_conditions .= '?content_only=1';
else
$this->link_conditions .= '&content_only=1';
-
+
self::$smarty->assign(array(
'checkedTOS' => (int)(self::$cookie->checkedTOS),
'recyclablePackAllowed' => (int)(Configuration::get('PS_RECYCLABLE_PACK')),
@@ -370,7 +370,7 @@ class ParentOrderControllerCore extends FrontController
'total_wrapping_cost' => Tools::convertPrice($wrapping_fees_tax_inc, new Currency((int)(self::$cookie->id_currency))),
'total_wrapping_tax_exc_cost' => Tools::convertPrice($wrapping_fees, new Currency((int)(self::$cookie->id_currency)))));
}
-
+
protected function _assignPayment()
{
self::$smarty->assign(array(
@@ -378,7 +378,7 @@ class ParentOrderControllerCore extends FrontController
'HOOK_PAYMENT' => Module::hookExecPayment()
));
}
-
+
/**
* Set id_carrier to 0 (no shipping price)
*
@@ -389,3 +389,4 @@ class ParentOrderControllerCore extends FrontController
self::$cart->update();
}
}
+
diff --git a/controllers/PasswordController.php b/controllers/PasswordController.php
index 5d4dd6a25..a0f66eb51 100644
--- a/controllers/PasswordController.php
+++ b/controllers/PasswordController.php
@@ -1,6 +1,6 @@
php_self = 'password.php';
-
+ $this->php_self = 'password';
+
parent::__construct();
}
-
+
public function process()
{
parent::process();
@@ -55,13 +55,13 @@ class PasswordControllerCore extends FrontController
if ((strtotime($customer->last_passwd_gen.'+'.(int)($min_time = Configuration::get('PS_PASSWD_TIME_FRONT')).' minutes') - time()) > 0)
$this->errors[] = Tools::displayError('You can regenerate your password only each').' '.(int)($min_time).' '.Tools::displayError('minute(s)');
else
- {
- if (Mail::Send((int)(self::$cookie->id_lang), 'password_query', Mail::l('Password query confirmation'),
- array('{email}' => $customer->email,
- '{lastname}' => $customer->lastname,
+ {
+ if (Mail::Send((int)(self::$cookie->id_lang), 'password_query', Mail::l('Password query confirmation'),
+ array('{email}' => $customer->email,
+ '{lastname}' => $customer->lastname,
'{firstname}' => $customer->firstname,
- '{url}' => self::$link->getPageLink('password.php', true).'?token='.$customer->secure_key.'&id_customer='.(int)$customer->id),
- $customer->email,
+ '{url}' => self::$link->getPageLink('password', true).'?token='.$customer->secure_key.'&id_customer='.(int)$customer->id),
+ $customer->email,
$customer->firstname.' '.$customer->lastname))
self::$smarty->assign(array('confirmation' => 2, 'email' => $customer->email));
else
@@ -78,20 +78,20 @@ class PasswordControllerCore extends FrontController
$customer = new Customer();
$customer->getByemail($email);
if ((strtotime($customer->last_passwd_gen.'+'.(int)($min_time = Configuration::get('PS_PASSWD_TIME_FRONT')).' minutes') - time()) > 0)
- Tools::redirect('authentication.php?error_regen_pwd');
+ Tools::redirect('index.php?controller=authentication&error_regen_pwd');
else
{
$customer->passwd = Tools::encrypt($password = Tools::passwdGen((int)(MIN_PASSWD_LENGTH)));
$customer->last_passwd_gen = date('Y-m-d H:i:s', time());
if ($customer->update())
{
- if (Mail::Send((int)(self::$cookie->id_lang), 'password', Mail::l('Your password'),
- array('{email}' => $customer->email,
- '{lastname}' => $customer->lastname,
- '{firstname}' => $customer->firstname,
- '{passwd}' => $password),
- $customer->email,
- $customer->firstname.' '.$customer->lastname))
+ if (Mail::Send((int)(self::$cookie->id_lang), 'password', Mail::l('Your password'),
+ array('{email}' => $customer->email,
+ '{lastname}' => $customer->lastname,
+ '{firstname}' => $customer->firstname,
+ '{passwd}' => $password),
+ $customer->email,
+ $customer->firstname.' '.$customer->lastname))
self::$smarty->assign(array('confirmation' => 1, 'email' => $customer->email));
else
$this->errors[] = Tools::displayError('Error occured when sending the e-mail.');
@@ -106,7 +106,7 @@ class PasswordControllerCore extends FrontController
elseif (($token = Tools::getValue('token')) || ($id_customer = Tools::getValue('id_customer')))
$this->errors[] = Tools::displayError('We cannot regenerate your password with the data you submitted');
}
-
+
public function displayContent()
{
parent::displayContent();
diff --git a/controllers/ProductController.php b/controllers/ProductController.php
index ebc1a8b5a..27136835d 100644
--- a/controllers/ProductController.php
+++ b/controllers/ProductController.php
@@ -54,7 +54,7 @@ class ProductControllerCore extends FrontController
{
if ($id_product = (int)Tools::getValue('id_product'))
$this->product = new Product($id_product, true, self::$cookie->id_lang);
-
+
if (!Validate::isLoadedObject($this->product))
{
header('HTTP/1.1 404 Not Found');
@@ -67,6 +67,7 @@ class ProductControllerCore extends FrontController
if (Validate::isLoadedObject($this->product))
{
$canonicalURL = self::$link->getProductLink($this->product);
+ p($canonicalURL);
if (!preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/', Tools::getProtocol().$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']))
{
header('HTTP/1.0 301 Moved');
diff --git a/discount.php b/discount.php
index 973297f96..4ca652267 100644
--- a/discount.php
+++ b/discount.php
@@ -1,6 +1,6 @@
run();
+Tools::displayFileAsDeprecated();
+
+// init front controller in order to use Tools::redirect
+$controller = new FrontController();
+$controller->init();
+
+$params = $_SERVER['QUERY_STRING'];
+if (!empty($params))
+ $params = '?'.$params;
+
+Tools::redirect('index.php/discount'.$params);
+
diff --git a/get-file.php b/get-file.php
index c66cc201b..6a87631d0 100644
--- a/get-file.php
+++ b/get-file.php
@@ -68,7 +68,7 @@ if ($cookie->isLoggedBack() AND Tools::getValue('file'))
}
if (!file_exists($file))
- Tools::redirect('index.php');
+ Tools::redirect('index.php/index');
}
else
{
@@ -78,7 +78,7 @@ else
$cookie = new Cookie('ps');
Tools::setCookieLanguage();
if (!$cookie->isLogged() AND !Tools::getValue('secure_key') AND !Tools::getValue('id_order'))
- Tools::redirect('authentication.php?back=get-file.php&key='.$key);
+ Tools::redirect('index.php/authentication?back=get-file.php&key='.$key);
elseif (!$cookie->isLogged() AND Tools::getValue('secure_key') AND Tools::getValue('id_order'))
{
$order = new Order((int)Tools::getValue('id_order'));
diff --git a/guest-tracking.php b/guest-tracking.php
index c5ac5c5e3..ff7ecc538 100644
--- a/guest-tracking.php
+++ b/guest-tracking.php
@@ -1,6 +1,6 @@
run();
+Tools::displayFileAsDeprecated();
+
+// init front controller in order to use Tools::redirect
+$controller = new FrontController();
+$controller->init();
+
+$params = $_SERVER['QUERY_STRING'];
+if (!empty($params))
+ $params = '?'.$params;
+
+Tools::redirect('index.php/guest-tracking'.$params);
+
diff --git a/history.php b/history.php
index 11370d2ce..faf8d91ab 100644
--- a/history.php
+++ b/history.php
@@ -1,6 +1,6 @@
run();
+Tools::displayFileAsDeprecated();
+
+// init front controller in order to use Tools::redirect
+$controller = new FrontController();
+$controller->init();
+
+$params = $_SERVER['QUERY_STRING'];
+if (!empty($params))
+ $params = '?'.$params;
+
+Tools::redirect('index.php/history'.$params);
+
diff --git a/identity.php b/identity.php
index 4dac92f1c..36be0e8fc 100644
--- a/identity.php
+++ b/identity.php
@@ -1,6 +1,6 @@
run();
+Tools::displayFileAsDeprecated();
+
+// init front controller in order to use Tools::redirect
+$controller = new FrontController();
+$controller->init();
+
+$params = $_SERVER['QUERY_STRING'];
+if (!empty($params))
+ $params = '?'.$params;
+
+Tools::redirect('index.php/identity'.$params);
+
diff --git a/index.php b/index.php
index 47cef0884..eb9ad6a34 100644
--- a/index.php
+++ b/index.php
@@ -1,6 +1,7 @@
+
run();
+$dispatcher = new Dispatcher();
+$dispatcher->dispatch();
+
diff --git a/manufacturer.php b/manufacturer.php
index 13066d8f4..d08faf42f 100644
--- a/manufacturer.php
+++ b/manufacturer.php
@@ -1,6 +1,6 @@
run();
+Tools::displayFileAsDeprecated();
+
+// init front controller in order to use Tools::redirect
+$controller = new FrontController();
+$controller->init();
+
+$params = $_SERVER['QUERY_STRING'];
+if (!empty($params))
+ $params = '?'.$params;
+
+Tools::redirect('index.php/manufacturer'.$params);
+
diff --git a/modules/authorizeaim/validation.php b/modules/authorizeaim/validation.php
index 23e93219b..c86103ad9 100755
--- a/modules/authorizeaim/validation.php
+++ b/modules/authorizeaim/validation.php
@@ -60,7 +60,7 @@ if (!isset($response[7]) OR !isset($response[3]) OR !isset($response[9]))
}
if ($response[0] == 3)
- Tools::redirect('order.php?step=3&aimerror=1');
+ Tools::redirect('index.php/order?step=3&aimerror=1');
else
{
/* Does the cart exist and is valid? */
@@ -82,6 +82,6 @@ else
else
$authorizeaim->validateOrder((int)$cart->id, _PS_OS_ERROR_, (float)$response[9], $authorizeaim->displayName, $message);
- Tools::redirect('order-confirmation.php?id_module='.(int)$authorizeaim->id.'&id_cart='.(int)$cart->id.'&key='.$customer->secure_key);
+ Tools::redirect('index.php/order-confirmation?id_module='.(int)$authorizeaim->id.'&id_cart='.(int)$cart->id.'&key='.$customer->secure_key);
}
diff --git a/modules/bankwire/payment.php b/modules/bankwire/payment.php
index fefc3279a..36ad44ef6 100644
--- a/modules/bankwire/payment.php
+++ b/modules/bankwire/payment.php
@@ -33,7 +33,7 @@ include(dirname(__FILE__).'/../../header.php');
include(dirname(__FILE__).'/bankwire.php');
if (!$cookie->isLogged(true))
- Tools::redirect('authentication.php?back=order.php');
+ Tools::redirect('index.php/authentication?back=order.php');
$bankwire = new BankWire();
echo $bankwire->execPayment($cart);
diff --git a/modules/bankwire/payment_execution.tpl b/modules/bankwire/payment_execution.tpl
index b506447cc..1585c9984 100644
--- a/modules/bankwire/payment_execution.tpl
+++ b/modules/bankwire/payment_execution.tpl
@@ -73,7 +73,7 @@
{l s='Please confirm your order by clicking \'I confirm my order\'' mod='bankwire'}.
{l s='We noticed a problem with your order. If you think this is an error, you can contact our' mod='bankwire'} - {l s='customer support' mod='bankwire'}. + {l s='customer support' mod='bankwire'}.
{/if} diff --git a/modules/blockbestsellers/blockbestsellers.tpl b/modules/blockbestsellers/blockbestsellers.tpl index 74aff46b1..6dc45854b 100644 --- a/modules/blockbestsellers/blockbestsellers.tpl +++ b/modules/blockbestsellers/blockbestsellers.tpl @@ -26,7 +26,7 @@{l s='All best sellers' mod='blockbestsellers'}
+{l s='All best sellers' mod='blockbestsellers'}
{else}{l s='No best sellers at this time' mod='blockbestsellers'}
{/if} diff --git a/modules/blockcart/ajax-cart.js b/modules/blockcart/ajax-cart.js index b0c71a1fe..d4e0d49d1 100644 --- a/modules/blockcart/ajax-cart.js +++ b/modules/blockcart/ajax-cart.js @@ -119,11 +119,11 @@ var ajaxCart = { //send the ajax request to the server $.ajax({ type: 'GET', - url: baseDir + 'cart.php', + url: baseDir + 'index.php', async: true, cache: false, dataType : "json", - data: 'ajax=true&token=' + static_token, + data: 'controller=cart&ajax=true&token=' + static_token, success: function(jsonData) { ajaxCart.updateCart(jsonData); @@ -180,11 +180,11 @@ var ajaxCart = { //send the ajax request to the server $.ajax({ type: 'POST', - url: baseDir + 'cart.php', + url: baseDir + 'index.php', async: true, cache: false, dataType : "json", - data: 'add=1&ajax=true&qty=' + ((quantity && quantity != null) ? quantity : '1') + '&id_product=' + idProduct + '&token=' + static_token + ( (parseInt(idCombination) && idCombination != null) ? '&ipa=' + parseInt(idCombination): ''), + data: 'controller=cart&add=1&ajax=true&qty=' + ((quantity && quantity != null) ? quantity : '1') + '&id_product=' + idProduct + '&token=' + static_token + ( (parseInt(idCombination) && idCombination != null) ? '&ipa=' + parseInt(idCombination): ''), success: function(jsonData,textStatus,jqXHR) { // add appliance to whishlist module @@ -230,11 +230,11 @@ var ajaxCart = { //send the ajax request to the server $.ajax({ type: 'POST', - url: baseDir + 'cart.php', + url: baseDir + 'index.php', async: true, cache: false, dataType : "json", - data: 'delete=1&id_product=' + idProduct + '&ipa=' + ((idCombination != null && parseInt(idCombination)) ? idCombination : '') + ((customizationId && customizationId != null) ? '&id_customization=' + customizationId : '') + '&token=' + static_token + '&ajax=true', + data: 'controller=cart&delete=1&id_product=' + idProduct + '&ipa=' + ((idCombination != null && parseInt(idCombination)) ? idCombination : '') + ((customizationId && customizationId != null) ? '&id_customization=' + customizationId : '') + '&token=' + static_token + '&ajax=true', success: function(jsonData) { ajaxCart.updateCart(jsonData); if ($('body').attr('id') == 'order' || $('body').attr('id') == 'order-opc') @@ -327,7 +327,7 @@ var ajaxCart = { } var removeLinks = $('#cart_block_product_' + domIdProduct).find('a.ajax_cart_block_remove_link'); if (!product.hasCustomizedDatas && !removeLinks.length) - $('#' + domIdProduct + ' span.remove_link').html(' '); + $('#' + domIdProduct + ' span.remove_link').html(' '); }, doesCustomizationStillExist : function (product, customizationId) @@ -416,7 +416,7 @@ var ajaxCart = { content += '' + this.quantity + 'x'; var name = (this.name.length > 12 ? this.name.substring(0, 10) + '...' : this.name); content += '' + name + ''; - content += ' '; + content += ' '; content += '' + this.priceByLine + ''; content += ''; if (this.hasAttributes) @@ -483,7 +483,7 @@ var ajaxCart = { // If the customization is already displayed on the cart, no update's needed if($('#cart_block').find("div[id^=deleteCustomizableProduct_" + customizationId + "_]").length) return (''); - content += '