// Fix controllers file names + add missing files in override/ + ControllerFactory class is now deprecated, use Controller instead + fix NoticationCore

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8621 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-09-16 10:09:26 +00:00
parent e055c62066
commit abbcb7892d
22 changed files with 210 additions and 90 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -39,4 +39,4 @@ elseif (in_array(substr($_SERVER['REQUEST_URI'], -3), array('.js', 'css')))
die(''); die('');
require_once(dirname(__FILE__).'/config/config.inc.php'); require_once(dirname(__FILE__).'/config/config.inc.php');
ControllerFactory::getController('PageNotFoundController')->run(); Controller::getController('PageNotFoundController')->run();
+2 -2
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -27,4 +27,4 @@
define('PS_ADMIN_DIR', getcwd()); define('PS_ADMIN_DIR', getcwd());
require(dirname(dirname(__FILE__)).'/config/config.inc.php'); require(dirname(dirname(__FILE__)).'/config/config.inc.php');
ControllerFactory::getController('getFileController')->run(); Controller::getController('getFileController')->run();
+86 -3
View File
@@ -54,6 +54,8 @@
'Contact' => 'override/classes/Contact.php', 'Contact' => 'override/classes/Contact.php',
'ContextCore' => 'classes/Context.php', 'ContextCore' => 'classes/Context.php',
'Context' => 'override/classes/Context.php', 'Context' => 'override/classes/Context.php',
'ControllerCore' => 'classes/Controller.php',
'Controller' => 'override/classes/Controller.php',
'ControllerFactoryCore' => 'classes/ControllerFactory.php', 'ControllerFactoryCore' => 'classes/ControllerFactory.php',
'ControllerFactory' => 'override/classes/ControllerFactory.php', 'ControllerFactory' => 'override/classes/ControllerFactory.php',
'CookieCore' => 'classes/Cookie.php', 'CookieCore' => 'classes/Cookie.php',
@@ -93,13 +95,13 @@
'FileLoggerCore' => 'classes/FileLogger.php', 'FileLoggerCore' => 'classes/FileLogger.php',
'FileLogger' => 'override/classes/FileLogger.php', 'FileLogger' => 'override/classes/FileLogger.php',
'FileUploaderCore' => 'classes/FileUploader.php', 'FileUploaderCore' => 'classes/FileUploader.php',
'FileUploader' => '', 'FileUploader' => 'override/classes/FileUploader.php',
'FrontControllerCore' => 'classes/FrontController.php', 'FrontControllerCore' => 'classes/FrontController.php',
'FrontController' => 'override/classes/FrontController.php', 'FrontController' => 'override/classes/FrontController.php',
'GenderCore' => 'classes/Gender.php', 'GenderCore' => 'classes/Gender.php',
'Gender' => 'override/classes/Gender.php', 'Gender' => 'override/classes/Gender.php',
'GroupCore' => 'classes/Group.php', 'GroupCore' => 'classes/Group.php',
'Group' => '', 'Group' => 'override/classes/Group.php',
'GroupReductionCore' => 'classes/GroupReduction.php', 'GroupReductionCore' => 'classes/GroupReduction.php',
'GroupReduction' => 'override/classes/GroupReduction.php', 'GroupReduction' => 'override/classes/GroupReduction.php',
'GuestCore' => 'classes/Guest.php', 'GuestCore' => 'classes/Guest.php',
@@ -146,7 +148,8 @@
'ModuleGridEngine' => 'override/classes/ModuleGridEngine.php', 'ModuleGridEngine' => 'override/classes/ModuleGridEngine.php',
'MySQLCore' => 'classes/MySQL.php', 'MySQLCore' => 'classes/MySQL.php',
'MySQL' => 'override/classes/MySQL.php', 'MySQL' => 'override/classes/MySQL.php',
'Notification' => 'classes/Notification.php', 'NotificationCore' => 'classes/Notification.php',
'Notification' => 'override/classes/Notification.php',
'ObjectModelCore' => 'classes/ObjectModel.php', 'ObjectModelCore' => 'classes/ObjectModel.php',
'ObjectModel' => 'override/classes/ObjectModel.php', 'ObjectModel' => 'override/classes/ObjectModel.php',
'OrderCore' => 'classes/Order.php', 'OrderCore' => 'classes/Order.php',
@@ -271,4 +274,84 @@
'TaxRulesTaxManagerCore' => 'classes/tax/TaxRulesTaxManager.php', 'TaxRulesTaxManagerCore' => 'classes/tax/TaxRulesTaxManager.php',
'TaxRulesTaxManager' => 'override/classes/tax/TaxRulesTaxManager.php', 'TaxRulesTaxManager' => 'override/classes/tax/TaxRulesTaxManager.php',
'FB' => 'override/classes/fb.php', 'FB' => 'override/classes/fb.php',
'AddressControllerCore' => 'controllers/AddressController.php',
'AddressController' => 'override/controllers/AddressController.php',
'AddressesControllerCore' => 'controllers/AddressesController.php',
'AddressesController' => 'override/controllers/AddressesController.php',
'AttachmentControllerCore' => 'controllers/AttachmentController.php',
'AttachmentController' => 'override/controllers/AttachmentController.php',
'AuthControllerCore' => 'controllers/AuthController.php',
'AuthController' => 'override/controllers/AuthController.php',
'BestSalesControllerCore' => 'controllers/BestSalesController.php',
'BestSalesController' => 'override/controllers/BestSalesController.php',
'CartControllerCore' => 'controllers/CartController.php',
'CartController' => 'override/controllers/CartController.php',
'CategoryControllerCore' => 'controllers/CategoryController.php',
'CategoryController' => 'override/controllers/CategoryController.php',
'ChangeCurrencyControllerCore' => 'controllers/ChangeCurrencyController.php',
'ChangeCurrencyController' => 'override/controllers/ChangeCurrencyController.php',
'CmsControllerCore' => 'controllers/CmsController.php',
'CmsController' => 'override/controllers/CmsController.php',
'CompareControllerCore' => 'controllers/CompareController.php',
'CompareController' => 'override/controllers/CompareController.php',
'ContactControllerCore' => 'controllers/ContactController.php',
'ContactController' => 'override/controllers/ContactController.php',
'DiscountControllerCore' => 'controllers/DiscountController.php',
'DiscountController' => 'override/controllers/DiscountController.php',
'GetFileControllerCore' => 'controllers/GetFileController.php',
'GetFileController' => 'override/controllers/GetFileController.php',
'GuestTrackingControllerCore' => 'controllers/GuestTrackingController.php',
'GuestTrackingController' => 'override/controllers/GuestTrackingController.php',
'HistoryControllerCore' => 'controllers/HistoryController.php',
'HistoryController' => 'override/controllers/HistoryController.php',
'IdentityControllerCore' => 'controllers/IdentityController.php',
'IdentityController' => 'override/controllers/IdentityController.php',
'IndexControllerCore' => 'controllers/IndexController.php',
'IndexController' => 'override/controllers/IndexController.php',
'ManufacturerControllerCore' => 'controllers/ManufacturerController.php',
'ManufacturerController' => 'override/controllers/ManufacturerController.php',
'MyAccountControllerCore' => 'controllers/MyAccountController.php',
'MyAccountController' => 'override/controllers/MyAccountController.php',
'NewProductsControllerCore' => 'controllers/NewProductsController.php',
'NewProductsController' => 'override/controllers/NewProductsController.php',
'OrderConfirmationControllerCore' => 'controllers/OrderConfirmationController.php',
'OrderConfirmationController' => 'override/controllers/OrderConfirmationController.php',
'OrderControllerCore' => 'controllers/OrderController.php',
'OrderController' => 'override/controllers/OrderController.php',
'OrderDetailControllerCore' => 'controllers/OrderDetailController.php',
'OrderDetailController' => 'override/controllers/OrderDetailController.php',
'OrderFollowControllerCore' => 'controllers/OrderFollowController.php',
'OrderFollowController' => 'override/controllers/OrderFollowController.php',
'OrderOpcControllerCore' => 'controllers/OrderOpcController.php',
'OrderOpcController' => 'override/controllers/OrderOpcController.php',
'OrderReturnControllerCore' => 'controllers/OrderReturnController.php',
'OrderReturnController' => 'override/controllers/OrderReturnController.php',
'OrderSlipControllerCore' => 'controllers/OrderSlipController.php',
'OrderSlipController' => 'override/controllers/OrderSlipController.php',
'PageNotFoundControllerCore' => 'controllers/PageNotFoundController.php',
'PageNotFoundController' => 'override/controllers/PageNotFoundController.php',
'ParentOrderControllerCore' => 'controllers/ParentOrderController.php',
'ParentOrderController' => 'override/controllers/ParentOrderController.php',
'PasswordControllerCore' => 'controllers/PasswordController.php',
'PasswordController' => 'override/controllers/PasswordController.php',
'PdfInvoiceControllerCore' => 'controllers/PdfInvoiceController.php',
'PdfInvoiceController' => 'override/controllers/PdfInvoiceController.php',
'PdfOrderReturnControllerCore' => 'controllers/PdfOrderReturnController.php',
'PdfOrderReturnController' => 'override/controllers/pdfOrderReturnController.php',
'PdfOrderSlipControllerCore' => 'controllers/PdfOrderSlipController.php',
'PdfOrderSlipController' => 'override/controllers/pdfOrderSlipController.php',
'PricesDropControllerCore' => 'controllers/PricesDropController.php',
'PricesDropController' => 'override/controllers/PricesDropController.php',
'ProductControllerCore' => 'controllers/ProductController.php',
'ProductController' => 'override/controllers/ProductController.php',
'SearchControllerCore' => 'controllers/SearchController.php',
'SearchController' => 'override/controllers/SearchController.php',
'SitemapControllerCore' => 'controllers/SitemapController.php',
'SitemapController' => 'override/controllers/SitemapController.php',
'StatisticsControllerCore' => 'controllers/StatisticsController.php',
'StatisticsController' => 'override/controllers/StatisticsController.php',
'StoresControllerCore' => 'controllers/StoresController.php',
'StoresController' => 'override/controllers/StoresController.php',
'SupplierControllerCore' => 'controllers/SupplierController.php',
'SupplierController' => 'override/controllers/SupplierController.php',
); );
+4 -2
View File
@@ -122,8 +122,10 @@ class Autoload
public function generateIndex() public function generateIndex()
{ {
$classes = array_merge( $classes = array_merge(
$this->getClassesFromDir('classes/', true), $this->getClassesFromDir('classes/'),
$this->getClassesFromDir('override/classes/', false) $this->getClassesFromDir('override/classes/'),
$this->getClassesFromDir('controllers/'),
$this->getClassesFromDir('override/controllers/')
); );
$content = '<?php return '.var_export($classes, true).';'; $content = '<?php return '.var_export($classes, true).';';
+13 -2
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -25,12 +25,20 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
/**
* @deprecated since 1.5.0
*/
class ControllerFactoryCore class ControllerFactoryCore
{ {
/**
* @deprecated since 1.5.0
*/
public static function includeController($className) public static function includeController($className)
{ {
Tools::displayAsDeprecated();
if (!class_exists($className, false)) if (!class_exists($className, false))
{ {
require_once(dirname(__FILE__).'/../controllers/'.$className.'.php'); require_once(dirname(__FILE__).'/../controllers/'.$className.'.php');
if (file_exists(dirname(__FILE__).'/../override/controllers/'.$className.'.php')) if (file_exists(dirname(__FILE__).'/../override/controllers/'.$className.'.php'))
require_once(dirname(__FILE__).'/../override/controllers/'.$className.'.php'); require_once(dirname(__FILE__).'/../override/controllers/'.$className.'.php');
@@ -45,6 +53,9 @@ class ControllerFactoryCore
} }
} }
/**
* @deprecated since 1.5.0
*/
public static function getController($className, $auth = false, $ssl = false) public static function getController($className, $auth = false, $ssl = false)
{ {
ControllerFactory::includeController($className); ControllerFactory::includeController($className);
+1 -1
View File
@@ -193,7 +193,7 @@ class DispatcherCore
$this->controller = 'index'; $this->controller = 'index';
if (!isset($controllers[$this->controller])) if (!isset($controllers[$this->controller]))
$this->controller = 'pagenotfound'; $this->controller = 'pagenotfound';
ControllerFactory::getController($controllers[$this->controller])->run(); Controller::getController($controllers[$this->controller])->run();
} }
/** /**
+24 -24
View File
@@ -25,20 +25,20 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
class FrontControllerCore class FrontControllerCore extends ControllerCore
{ {
public $errors = array(); public $errors = array();
/** /**
* @var Context * @var Context
*/ */
protected $context; protected $context;
/* Deprecated shortcuts as of 1.5 - Use $context->var instead */ /* Deprecated shortcuts as of 1.5 - Use $context->var instead */
protected static $smarty; protected static $smarty;
protected static $cookie; protected static $cookie;
protected static $link; protected static $link;
protected static $cart; protected static $cart;
public $iso; public $iso;
public $orderBy; public $orderBy;
@@ -59,7 +59,7 @@ class FrontControllerCore
public static $initialized = false; public static $initialized = false;
protected static $currentCustomerGroups; protected static $currentCustomerGroups;
public $css_files; public $css_files;
public $js_files; public $js_files;
public $nb_items_per_page; public $nb_items_per_page;
@@ -94,17 +94,17 @@ class FrontControllerCore
self::$initialized = true; self::$initialized = true;
$this->context = Context::getContext(); $this->context = Context::getContext();
$this->id_current_shop = Context::getContext()->shop->getID(); $this->id_current_shop = Context::getContext()->shop->getID();
$this->id_current_group_shop = Context::getContext()->shop->getGroupID(); $this->id_current_group_shop = Context::getContext()->shop->getGroupID();
$this->css_files = array(); $this->css_files = array();
$this->js_files = array(); $this->js_files = array();
// For compatibility with globals, DEPRECATED as of version 1.5 // For compatibility with globals, DEPRECATED as of version 1.5
$css_files = $this->css_files; $css_files = $this->css_files;
$js_files = $this->js_files; $js_files = $this->js_files;
if ($this->ssl AND !Tools::usingSecureMode() AND Configuration::get('PS_SSL_ENABLED')) if ($this->ssl AND !Tools::usingSecureMode() AND Configuration::get('PS_SSL_ENABLED'))
{ {
header('HTTP/1.1 301 Moved Permanently'); header('HTTP/1.1 301 Moved Permanently');
@@ -126,13 +126,13 @@ class FrontControllerCore
$this->context->smarty->ps_currency = $currency; $this->context->smarty->ps_currency = $currency;
$this->context->smarty->ps_language = $this->context->language; $this->context->smarty->ps_language = $this->context->language;
$protocol_link = (Configuration::get('PS_SSL_ENABLED') OR Tools::usingSecureMode()) ? 'https://' : 'http://'; $protocol_link = (Configuration::get('PS_SSL_ENABLED') OR Tools::usingSecureMode()) ? 'https://' : 'http://';
$useSSL = ((isset($this->ssl) AND $this->ssl AND Configuration::get('PS_SSL_ENABLED')) OR Tools::usingSecureMode()) ? true : false; $useSSL = ((isset($this->ssl) AND $this->ssl AND Configuration::get('PS_SSL_ENABLED')) OR Tools::usingSecureMode()) ? true : false;
$protocol_content = ($useSSL) ? 'https://' : 'http://'; $protocol_content = ($useSSL) ? 'https://' : 'http://';
$link = new Link($protocol_link, $protocol_content); $link = new Link($protocol_link, $protocol_content);
$this->context->link = $link; $this->context->link = $link;
if ($this->auth AND !$this->context->customer->isLogged($this->guestAllowed)) if ($this->auth AND !$this->context->customer->isLogged($this->guestAllowed))
Tools::redirect('index.php?controller=authentication'.($this->authRedirection ? '&back='.$this->authRedirection : '')); Tools::redirect('index.php?controller=authentication'.($this->authRedirection ? '&back='.$this->authRedirection : ''));
@@ -165,8 +165,8 @@ class FrontControllerCore
if ($cart->OrderExists()) if ($cart->OrderExists())
unset($this->context->cookie->id_cart, $cart, $this->context->cookie->checkedTOS); unset($this->context->cookie->id_cart, $cart, $this->context->cookie->checkedTOS);
/* Delete product of cart, if user can't make an order from his country */ /* Delete product of cart, if user can't make an order from his country */
elseif (intval(Configuration::get('PS_GEOLOCATION_ENABLED')) AND elseif (intval(Configuration::get('PS_GEOLOCATION_ENABLED')) AND
!in_array(strtoupper($this->context->cookie->iso_code_country), explode(';', Configuration::get('PS_ALLOWED_COUNTRIES'))) AND !in_array(strtoupper($this->context->cookie->iso_code_country), explode(';', Configuration::get('PS_ALLOWED_COUNTRIES'))) AND
$cart->nbProducts() AND intval(Configuration::get('PS_GEOLOCATION_NA_BEHAVIOR')) != -1 AND $cart->nbProducts() AND intval(Configuration::get('PS_GEOLOCATION_NA_BEHAVIOR')) != -1 AND
!self::isInWhitelistForGeolocation()) !self::isInWhitelistForGeolocation())
unset($this->context->cookie->id_cart, $cart); unset($this->context->cookie->id_cart, $cart);
@@ -180,7 +180,7 @@ class FrontControllerCore
$cart->update(); $cart->update();
} }
/* Select an address if not set */ /* Select an address if not set */
if (isset($cart) && (!isset($cart->id_address_delivery) || $cart->id_address_delivery == 0 || if (isset($cart) && (!isset($cart->id_address_delivery) || $cart->id_address_delivery == 0 ||
!isset($cart->id_address_invoice) || $cart->id_address_invoice == 0) && $this->context->cookie->id_customer) !isset($cart->id_address_invoice) || $cart->id_address_invoice == 0) && $this->context->cookie->id_customer)
{ {
$to_update = false; $to_update = false;
@@ -344,14 +344,14 @@ class FrontControllerCore
$this->iso = $iso; $this->iso = $iso;
$this->setMedia(); $this->setMedia();
if($this->context->cookie->id_country) if($this->context->cookie->id_country)
$customer->geoloc_id_country = (int)$this->context->cookie->id_country; $customer->geoloc_id_country = (int)$this->context->cookie->id_country;
if($this->context->cookie->id_state) if($this->context->cookie->id_state)
$customer->geoloc_id_state = (int)$this->context->cookie->id_state; $customer->geoloc_id_state = (int)$this->context->cookie->id_state;
if($this->context->cookie->postcode) if($this->context->cookie->postcode)
$customer->geoloc_postcode = (int)$this->context->cookie->postcode; $customer->geoloc_postcode = (int)$this->context->cookie->postcode;
$this->context->cart = $cart; $this->context->cart = $cart;
$this->context->currency = $currency; $this->context->currency = $currency;
$this->context->controller = $this; $this->context->controller = $this;
@@ -419,7 +419,7 @@ class FrontControllerCore
$gi = geoip_open(realpath(_PS_GEOIP_DIR_.'GeoLiteCity.dat'), GEOIP_STANDARD); $gi = geoip_open(realpath(_PS_GEOIP_DIR_.'GeoLiteCity.dat'), GEOIP_STANDARD);
$record = geoip_record_by_addr($gi, '81.57.72.226');//Tools::getRemoteAddr()); $record = geoip_record_by_addr($gi, '81.57.72.226');//Tools::getRemoteAddr());
if (is_object($record)) if (is_object($record))
{ {
if (!in_array(strtoupper($record->country_code), explode(';', Configuration::get('PS_ALLOWED_COUNTRIES'))) AND !self::isInWhitelistForGeolocation()) if (!in_array(strtoupper($record->country_code), explode(';', Configuration::get('PS_ALLOWED_COUNTRIES'))) AND !self::isInWhitelistForGeolocation())
{ {
@@ -501,7 +501,7 @@ class FrontControllerCore
// if this function is called from a module, do a fast init // if this function is called from a module, do a fast init
else if (!$this->context) else if (!$this->context)
$this->context = Context::getContext(); $this->context = Context::getContext();
// P3P Policies (http://www.w3.org/TR/2002/REC-P3P-20020416/#compact_policies) // P3P Policies (http://www.w3.org/TR/2002/REC-P3P-20020416/#compact_policies)
header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"'); header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
@@ -521,7 +521,7 @@ class FrontControllerCore
'HOOK_TOP' => Module::hookExec('top'), 'HOOK_TOP' => Module::hookExec('top'),
'HOOK_LEFT_COLUMN' => Module::hookExec('leftColumn') 'HOOK_LEFT_COLUMN' => Module::hookExec('leftColumn')
)); ));
if ((Configuration::get('PS_CSS_THEME_CACHE') OR Configuration::get('PS_JS_THEME_CACHE')) AND is_writable(_PS_THEME_DIR_.'cache')) if ((Configuration::get('PS_CSS_THEME_CACHE') OR Configuration::get('PS_JS_THEME_CACHE')) AND is_writable(_PS_THEME_DIR_.'cache'))
{ {
// CSS compressor management // CSS compressor management
@@ -573,7 +573,7 @@ class FrontControllerCore
// 'orderbydefault' => Tools::getProductsOrder('by'), // 'orderbydefault' => Tools::getProductsOrder('by'),
// 'orderwayposition' => Tools::getProductsOrder('way'), // Deprecated: orderwayposition // 'orderwayposition' => Tools::getProductsOrder('way'), // Deprecated: orderwayposition
// 'orderwaydefault' => Tools::getProductsOrder('way'), // 'orderwaydefault' => Tools::getProductsOrder('way'),
$stock_management = (int)(Configuration::get('PS_STOCK_MANAGEMENT')) ? true : false; // no display quantity order if stock management disabled $stock_management = (int)(Configuration::get('PS_STOCK_MANAGEMENT')) ? true : false; // no display quantity order if stock management disabled
$orderByValues = array(0 => 'name', 1 => 'price', 2 => 'date_add', 3 => 'date_upd', 4 => 'position', 5 => 'manufacturer_name', 6 => 'quantity'); $orderByValues = array(0 => 'name', 1 => 'price', 2 => 'date_add', 3 => 'date_upd', 4 => 'position', 5 => 'manufacturer_name', 6 => 'quantity');
$orderWayValues = array(0 => 'asc', 1 => 'desc'); $orderWayValues = array(0 => 'asc', 1 => 'desc');
@@ -599,7 +599,7 @@ class FrontControllerCore
$this->init(); $this->init();
elseif (!$this->context) elseif (!$this->context)
$this->context = Context::getContext(); $this->context = Context::getContext();
$nArray = (int)(Configuration::get('PS_PRODUCTS_PER_PAGE')) != 10 ? array((int)(Configuration::get('PS_PRODUCTS_PER_PAGE')), 10, 20, 50) : array(10, 20, 50); $nArray = (int)(Configuration::get('PS_PRODUCTS_PER_PAGE')) != 10 ? array((int)(Configuration::get('PS_PRODUCTS_PER_PAGE')), 10, 20, 50) : array(10, 20, 50);
asort($nArray); asort($nArray);
$this->n = abs((int)(Tools::getValue('n', ((isset($this->context->cookie->nb_item_per_page) AND $this->context->cookie->nb_item_per_page >= 10) ? $this->context->cookie->nb_item_per_page : (int)(Configuration::get('PS_PRODUCTS_PER_PAGE')))))); $this->n = abs((int)(Tools::getValue('n', ((isset($this->context->cookie->nb_item_per_page) AND $this->context->cookie->nb_item_per_page >= 10) ? $this->context->cookie->nb_item_per_page : (int)(Configuration::get('PS_PRODUCTS_PER_PAGE'))))));
@@ -639,7 +639,7 @@ class FrontControllerCore
{ {
if (!Group::isFeatureActive()) if (!Group::isFeatureActive())
return array(); return array();
$context = Context::getContext(); $context = Context::getContext();
if (!$context->customer->id) if (!$context->customer->id)
return array(); return array();
@@ -664,7 +664,7 @@ class FrontControllerCore
$allowed = true; $allowed = true;
return $allowed; return $allowed;
} }
/** /**
* addCSS allows you to add stylesheet at any time. * addCSS allows you to add stylesheet at any time.
* *
@@ -680,7 +680,7 @@ class FrontControllerCore
$this->addCSS($file, $media_type); $this->addCSS($file, $media_type);
return true; return true;
} }
//overriding of modules css files //overriding of modules css files
$different = 0; $different = 0;
$override_path = str_replace(__PS_BASE_URI__.'modules/', _PS_ROOT_DIR_.'/themes/'._THEME_NAME_.'/css/modules/', $css_uri, $different); $override_path = str_replace(__PS_BASE_URI__.'modules/', _PS_ROOT_DIR_.'/themes/'._THEME_NAME_.'/css/modules/', $css_uri, $different);
@@ -707,7 +707,7 @@ class FrontControllerCore
return true; return true;
} }
/** /**
* addJS load a javascript file in the header * addJS load a javascript file in the header
* *
@@ -756,6 +756,6 @@ class FrontControllerCore
return true; return true;
} }
} }
+31 -31
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -25,18 +25,18 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
class Notification class NotificationCore
{ {
public $types; public $types;
public function __construct() public function __construct()
{ {
$this->types = array('order', 'message', 'customer'); $this->types = array('order', 'message', 'customer');
} }
/** /**
* getLastElements return all the notifications (new order, new customer registration, and new customer message) * getLastElements return all the notifications (new order, new customer registration, and new customer message)
* Get all the notifications * Get all the notifications
* *
* @return array containing the notifications * @return array containing the notifications
*/ */
@@ -44,38 +44,38 @@ class Notification
{ {
$notifications = array(); $notifications = array();
$employee_infos = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' $employee_infos = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT id_last_order, id_last_message, id_last_customer SELECT id_last_order, id_last_message, id_last_customer
FROM `'._DB_PREFIX_.'employee` FROM `'._DB_PREFIX_.'employee`
WHERE `id_employee` = '.(int)Context::getContext()->employee->id); WHERE `id_employee` = '.(int)Context::getContext()->employee->id);
foreach ($this->types as $type) foreach ($this->types as $type)
$notifications[$type] = Notification::getLastElementsIdsByType($type, $employee_infos['id_last_'.$type]); $notifications[$type] = Notification::getLastElementsIdsByType($type, $employee_infos['id_last_'.$type]);
return $notifications; return $notifications;
} }
/** /**
* getLastElementsIdsByType return all the element ids to show (order, customer registration, and customer message) * getLastElementsIdsByType return all the element ids to show (order, customer registration, and customer message)
* Get all the element ids * Get all the element ids
* *
* @param string $type contains the field name of the Employee table * @param string $type contains the field name of the Employee table
* @param integer $id_last_element contains the id of the last seen element * @param integer $id_last_element contains the id of the last seen element
* @return array containing the notifications * @return array containing the notifications
*/ */
public static function getLastElementsIdsByType($type, $id_last_element) public static function getLastElementsIdsByType($type, $id_last_element)
{ {
if ($type == 'order' || $type == 'message') if ($type == 'order' || $type == 'message')
$sql = 'SELECT id_order, id_customer, '.(($type == 'order') ? 'total_paid_real' : 'message').' $sql = 'SELECT id_order, id_customer, '.(($type == 'order') ? 'total_paid_real' : 'message').'
FROM `'._DB_PREFIX_.(($type == 'order') ? pSQL($type).'s' : pSQL($type)).'` FROM `'._DB_PREFIX_.(($type == 'order') ? pSQL($type).'s' : pSQL($type)).'`
WHERE `id_'.pSQL($type).'` > '.(int)$id_last_element.' WHERE `id_'.pSQL($type).'` > '.(int)$id_last_element.'
ORDER BY `id_'.pSQL($type).'` DESC LIMIT 5'; ORDER BY `id_'.pSQL($type).'` DESC LIMIT 5';
else else
$sql = 'SELECT id_'.pSQL($type).' $sql = 'SELECT id_'.pSQL($type).'
FROM `'._DB_PREFIX_.pSQL($type).'` FROM `'._DB_PREFIX_.pSQL($type).'`
WHERE `id_'.pSQL($type).'` > '.(int)$id_last_element.' WHERE `id_'.pSQL($type).'` > '.(int)$id_last_element.'
ORDER BY `id_'.pSQL($type).'` DESC LIMIT 5'; ORDER BY `id_'.pSQL($type).'` DESC LIMIT 5';
$json = array(); $json = array();
foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql) as $key => $value) foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql) as $key => $value)
{ {
@@ -93,28 +93,28 @@ class Notification
'message_customer' => ((isset($value['message'])) ? substr(strip_tags($value['message']), 0, 20) : '') 'message_customer' => ((isset($value['message'])) ? substr(strip_tags($value['message']), 0, 20) : '')
); );
} }
return $json; return $json;
} }
/** /**
* updateEmployeeLastElement return 0 if the field doesn't exists in Employee table. * updateEmployeeLastElement return 0 if the field doesn't exists in Employee table.
* Updates the last seen element by the employee * Updates the last seen element by the employee
* *
* @param string $type contains the field name of the Employee table * @param string $type contains the field name of the Employee table
* @return boolean if type exists or not * @return boolean if type exists or not
*/ */
public function updateEmployeeLastElement($type) public function updateEmployeeLastElement($type)
{ {
if (in_array($type, $this->types)) if (in_array($type, $this->types))
// We update the last item viewed // We update the last item viewed
return Db::getInstance()->Execute(' return Db::getInstance()->Execute('
UPDATE `'._DB_PREFIX_.'employee` UPDATE `'._DB_PREFIX_.'employee`
SET `id_last_'.pSQL($type).'` = (SELECT MAX(`id_'.$type.'`) SET `id_last_'.pSQL($type).'` = (SELECT MAX(`id_'.$type.'`)
FROM `'._DB_PREFIX_.(($type == 'order') ? pSQL($type).'s' : pSQL($type)).'`) FROM `'._DB_PREFIX_.(($type == 'order') ? pSQL($type).'s' : pSQL($type)).'`)
WHERE `id_employee` = '.(int)Context::getContext()->employee->id); WHERE `id_employee` = '.(int)Context::getContext()->employee->id);
else else
return false; return false;
} }
} }
?> ?>
@@ -20,7 +20,7 @@
* *
* @author PrestaShop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA * @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7331 $ * @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
class getFileControllerCore extends FrontController class GetFileControllerCore extends FrontController
{ {
public function run() public function run()
{ {
+6 -8
View File
@@ -25,8 +25,6 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
ControllerFactory::includeController('ParentOrderController');
class OrderControllerCore extends ParentOrderController class OrderControllerCore extends ParentOrderController
{ {
public $step; public $step;
@@ -98,11 +96,11 @@ class OrderControllerCore extends ParentOrderController
$this->_assignCarrier(); $this->_assignCarrier();
break; break;
case 3: case 3:
//Test that the conditions (so active) were accepted by the customer //Test that the conditions (so active) were accepted by the customer
$cgv = Tools::getValue('cgv'); $cgv = Tools::getValue('cgv');
if (Configuration::get('PS_CONDITIONS') AND (!Validate::isBool($cgv))) if (Configuration::get('PS_CONDITIONS') AND (!Validate::isBool($cgv)))
Tools::redirect('index.php?controller=order&step=2'); Tools::redirect('index.php?controller=order&step=2');
if(Tools::isSubmit('processCarrier')) if(Tools::isSubmit('processCarrier'))
$this->processCarrier(); $this->processCarrier();
$this->autoStep(); $this->autoStep();
@@ -135,7 +133,7 @@ class OrderControllerCore extends ParentOrderController
$invoiceAddressFields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country, false, true); $invoiceAddressFields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country, false, true);
$deliveryAddressFields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country, false, true); $deliveryAddressFields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country, false, true);
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'inv_adr_fields' => $invoiceAddressFields, 'inv_adr_fields' => $invoiceAddressFields,
'dlv_adr_fields' => $deliveryAddressFields)); 'dlv_adr_fields' => $deliveryAddressFields));
@@ -144,7 +142,7 @@ class OrderControllerCore extends ParentOrderController
public function displayContent() public function displayContent()
{ {
parent::displayContent(); parent::displayContent();
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'currencySign' => $this->context->currency->sign, 'currencySign' => $this->context->currency->sign,
'currencyRate' => $this->context->currency->conversion_rate, 'currencyRate' => $this->context->currency->conversion_rate,
@@ -277,7 +275,7 @@ class OrderControllerCore extends ParentOrderController
// Redirect instead of displaying payment modules if any module are grefted on // Redirect instead of displaying payment modules if any module are grefted on
Hook::backBeforePayment('order.php?step=3'); Hook::backBeforePayment('order.php?step=3');
/* We may need to display an order summary */ /* We may need to display an order summary */
$this->context->smarty->assign($this->context->cart->getSummaryDetails()); $this->context->smarty->assign($this->context->cart->getSummaryDetails());
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
@@ -285,7 +283,7 @@ class OrderControllerCore extends ParentOrderController
'taxes_enabled' => (int)(Configuration::get('PS_TAX')) 'taxes_enabled' => (int)(Configuration::get('PS_TAX'))
)); ));
$this->context->cart->checkedTOS = '1'; $this->context->cart->checkedTOS = '1';
parent::_assignPayment(); parent::_assignPayment();
} }
} }
-2
View File
@@ -25,8 +25,6 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
ControllerFactory::includeController('ParentOrderController');
class OrderOpcControllerCore extends ParentOrderController class OrderOpcControllerCore extends ParentOrderController
{ {
public $php_self = 'order-opc'; public $php_self = 'order-opc';
@@ -20,7 +20,7 @@
* *
* @author PrestaShop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA * @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7104 $ * @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
@@ -20,7 +20,7 @@
* *
* @author PrestaShop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA * @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7104 $ * @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
+7
View File
@@ -0,0 +1,7 @@
<?php
abstract class Controller extends ControllerCore
{
}
+7
View File
@@ -0,0 +1,7 @@
<?php
class FileUploader extends FileUploaderCore
{
}
+7
View File
@@ -0,0 +1,7 @@
<?php
class Group extends GroupCore
{
}
+7
View File
@@ -0,0 +1,7 @@
<?php
class Notification extends NotificationCore
{
}
-7
View File
@@ -1,7 +0,0 @@
<?php
class CMSController extends CMSControllerCore
{
}
+7
View File
@@ -0,0 +1,7 @@
<?php
class CmsController extends CmsControllerCore
{
}
@@ -1,6 +1,6 @@
<?php <?php
class pdfOrderReturnController extends pdfOrderReturnControllerCore class PdfOrderReturnController extends PdfOrderReturnControllerCore
{ {
} }
@@ -1,6 +1,6 @@
<?php <?php
class pdfOrderSlipController extends pdfOrderSlipControllerCore class PdfOrderSlipController extends PdfOrderSlipControllerCore
{ {
} }