[+] Dispatcher

This commit is contained in:
fBrignoli
2011-06-15 16:32:06 +00:00
parent 5f0fb35a1d
commit 1bb4a61a42
140 changed files with 936 additions and 534 deletions
+20 -29
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -38,19 +38,19 @@ class AddressControllerCore extends FrontController
$this->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')
+3 -3
View File
@@ -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');
}
}
}
+15 -14
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -30,14 +30,14 @@ class CmsControllerCore extends FrontController
public $assignCase;
public $cms;
public $cms_category;
public function preProcess()
{
if ($id_cms = (int)Tools::getValue('id_cms'))
$this->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<br />Please use the following URL instead: <a href="'.$canonicalURL.'">'.$canonicalURL.'</a>');
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');
}
}
+5 -4
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -70,7 +70,7 @@ class CartControllerCore extends FrontController
public function includeCartModule()
{
require_once(_PS_MODULE_DIR_.'/blockcart/blockcart-ajax.php');
require_once(_PS_MODULE_DIR_.'/blockcart/blockcart-ajax.php');
}
public function preProcess()
@@ -216,7 +216,7 @@ class CartControllerCore extends FrontController
{
$queryString = Tools::safeOutput(Tools::getValue('query', NULL));
if ($queryString AND !Configuration::get('PS_CART_REDIRECT'))
Tools::redirect('search.php?search='.$queryString);
Tools::redirect('index.php?controller=search&search='.$queryString);
if (isset($_SERVER['HTTP_REFERER']))
{
// Redirect to previous page
@@ -227,7 +227,7 @@ class CartControllerCore extends FrontController
}
}
if (Tools::getValue('ajax') != 'true' AND !sizeof($this->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');
}
}
+1 -1
View File
@@ -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)
{
+13 -13
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -30,15 +30,15 @@ class GuestTrackingControllerCore extends FrontController
public function preProcess()
{
parent::preProcess();
if (self::$cookie->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
}
}
+9 -9
View File
@@ -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();
}
}
+1 -1
View File
@@ -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
{
+13 -13
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -33,29 +33,29 @@ class OrderFollowControllerCore extends FrontController
$this->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();
+43 -42
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -31,42 +31,42 @@ class FreeOrder extends PaymentModule {}
class ParentOrderControllerCore extends FrontController
{
public $nbProducts;
public function __construct()
{
$this->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();
}
}
+19 -19
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -31,11 +31,11 @@ class PasswordControllerCore extends FrontController
{
public function __construct()
{
$this->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();
+2 -1
View File
@@ -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');