From 2c2810c7d2cb3d4453d880bfeb13f2cde673895d Mon Sep 17 00:00:00 2001 From: lLefevre Date: Tue, 11 Oct 2011 16:39:19 +0000 Subject: [PATCH] // revert commit 9252 --- admin-dev/themes/template/adminShopUrl.tpl | 2 +- cache/class_index.php | 188 ++++++----- .../admin/AdminRequestSqlController.php | 80 ++--- override/classes/Tools.php | 307 ------------------ 4 files changed, 128 insertions(+), 449 deletions(-) diff --git a/admin-dev/themes/template/adminShopUrl.tpl b/admin-dev/themes/template/adminShopUrl.tpl index 8a796b3ae..bbe05ff5c 100644 --- a/admin-dev/themes/template/adminShopUrl.tpl +++ b/admin-dev/themes/template/adminShopUrl.tpl @@ -131,7 +131,7 @@

{l s ='Enable or disable URL'}

- +
* {l s ='Required field'}
diff --git a/cache/class_index.php b/cache/class_index.php index 7c4b229ca..0927fde94 100644 --- a/cache/class_index.php +++ b/cache/class_index.php @@ -1,10 +1,10 @@ 'classes/AbstractLogger.php', 'AbstractLogger' => 'override/classes/AbstractLogger.php', - 'AddressFormatCore' => 'classes/AddressFormat.php', - 'AddressFormat' => 'override/classes/AddressFormat.php', 'AddressCore' => 'classes/Address.php', 'Address' => 'override/classes/Address.php', + 'AddressFormatCore' => 'classes/AddressFormat.php', + 'AddressFormat' => 'override/classes/AddressFormat.php', 'AdminControllerCore' => 'classes/AdminController.php', 'AdminController' => 'override/classes/AdminController.php', 'AdminTabCore' => 'classes/AdminTab.php', @@ -13,39 +13,29 @@ 'Alias' => 'override/classes/Alias.php', 'AttachmentCore' => 'classes/Attachment.php', 'Attachment' => 'override/classes/Attachment.php', - 'AttributeGroupCore' => 'classes/AttributeGroup.php', - 'AttributeGroup' => 'override/classes/AttributeGroup.php', 'AttributeCore' => 'classes/Attribute.php', 'Attribute' => 'override/classes/Attribute.php', + 'AttributeGroupCore' => 'classes/AttributeGroup.php', + 'AttributeGroup' => 'override/classes/AttributeGroup.php', 'Autoload' => 'classes/Autoload.php', 'BackupCore' => 'classes/Backup.php', 'Backup' => 'override/classes/Backup.php', 'BlowfishCore' => 'classes/Blowfish.php', 'Blowfish' => 'override/classes/Blowfish.php', - 'CacheApcCore' => 'classes/cache/CacheApc.php', - 'CacheApc' => 'override/classes/cache/CacheApc.php', - 'CacheFsCore' => 'classes/cache/CacheFs.php', - 'CacheFs' => 'override/classes/cache/CacheFs.php', - 'CacheMemcacheCore' => 'classes/cache/CacheMemcache.php', - 'CacheMemcache' => 'override/classes/cache/CacheMemcache.php', - 'CacheCore' => 'classes/cache/Cache.php', - 'Cache' => 'override/classes/cache/Cache.php', - 'CacheXcacheCore' => 'classes/cache/CacheXcache.php', - 'CacheXcache' => 'override/classes/cache/CacheXcache.php', - 'CarrierModuleCore' => 'classes/CarrierModule.php', - 'CarrierModule' => 'override/classes/CarrierModule.php', + 'CMSCore' => 'classes/CMS.php', + 'CMS' => 'override/classes/CMS.php', + 'CMSCategoryCore' => 'classes/CMSCategory.php', + 'CMSCategory' => 'override/classes/CMSCategory.php', 'CarrierCore' => 'classes/Carrier.php', 'Carrier' => 'override/classes/Carrier.php', + 'CarrierModuleCore' => 'classes/CarrierModule.php', + 'CarrierModule' => 'override/classes/CarrierModule.php', 'CartCore' => 'classes/Cart.php', 'Cart' => 'override/classes/Cart.php', 'CategoryCore' => 'classes/Category.php', 'Category' => 'override/classes/Category.php', 'ChartCore' => 'classes/Chart.php', 'Chart' => 'override/classes/Chart.php', - 'CMSCategoryCore' => 'classes/CMSCategory.php', - 'CMSCategory' => 'override/classes/CMSCategory.php', - 'CMSCore' => 'classes/CMS.php', - 'CMS' => 'override/classes/CMS.php', 'CombinationCore' => 'classes/Combination.php', 'Combination' => 'override/classes/Combination.php', 'CompareProductCore' => 'classes/CompareProduct.php', @@ -62,10 +52,10 @@ 'Contact' => 'override/classes/Contact.php', 'ContextCore' => 'classes/Context.php', 'Context' => 'override/classes/Context.php', - 'ControllerFactoryCore' => 'classes/ControllerFactory.php', - 'ControllerFactory' => 'override/classes/ControllerFactory.php', 'ControllerCore' => 'classes/Controller.php', 'Controller' => 'override/classes/Controller.php', + 'ControllerFactoryCore' => 'classes/ControllerFactory.php', + 'ControllerFactory' => 'override/classes/ControllerFactory.php', 'CookieCore' => 'classes/Cookie.php', 'Cookie' => 'override/classes/Cookie.php', 'CountryCore' => 'classes/Country.php', @@ -74,26 +64,16 @@ 'County' => 'override/classes/County.php', 'CurrencyCore' => 'classes/Currency.php', 'Currency' => 'override/classes/Currency.php', - 'CustomerMessageCore' => 'classes/CustomerMessage.php', - 'CustomerMessage' => 'override/classes/CustomerMessage.php', 'CustomerCore' => 'classes/Customer.php', 'Customer' => 'override/classes/Customer.php', + 'CustomerMessageCore' => 'classes/CustomerMessage.php', + 'CustomerMessage' => 'override/classes/CustomerMessage.php', 'CustomerThreadCore' => 'classes/CustomerThread.php', 'CustomerThread' => 'override/classes/CustomerThread.php', 'CustomizationCore' => 'classes/Customization.php', 'Customization' => 'override/classes/Customization.php', 'DateRangeCore' => 'classes/DateRange.php', 'DateRange' => 'override/classes/DateRange.php', - 'DbMySQLiCore' => 'classes/db/DbMySQLi.php', - 'DbMySQLi' => 'override/classes/db/DbMySQLi.php', - 'DbPDOCore' => 'classes/db/DbPDO.php', - 'DbPDO' => 'override/classes/db/DbPDO.php', - 'DbCore' => 'classes/db/Db.php', - 'Db' => 'override/classes/db/Db.php', - 'DbQueryCore' => 'classes/db/DbQuery.php', - 'DbQuery' => 'override/classes/db/DbQuery.php', - 'MySQLCore' => 'classes/db/MySQL.php', - 'MySQL' => 'override/classes/db/MySQL.php', 'DeliveryCore' => 'classes/Delivery.php', 'Delivery' => 'override/classes/Delivery.php', 'DiscountCore' => 'classes/Discount.php', @@ -102,14 +82,6 @@ 'Dispatcher' => 'override/classes/Dispatcher.php', 'EmployeeCore' => 'classes/Employee.php', 'Employee' => 'override/classes/Employee.php', - 'PrestashopDatabaseExceptionCore' => 'classes/exception/PrestashopDatabaseException.php', - 'PrestashopDatabaseException' => 'override/classes/exception/PrestashopDatabaseException.php', - 'PrestashopExceptionCore' => 'classes/exception/PrestashopException.php', - 'PrestashopException' => 'override/classes/exception/PrestashopException.php', - 'PrestashopModuleExceptionCore' => 'classes/exception/PrestashopModuleException.php', - 'PrestashopModuleException' => 'override/classes/exception/PrestashopModuleException.php', - 'PrestashopPaymentExceptionCore' => 'classes/exception/PrestashopPaymentException.php', - 'PrestashopPaymentException' => 'override/classes/exception/PrestashopPaymentException.php', 'FeatureCore' => 'classes/Feature.php', 'Feature' => 'override/classes/Feature.php', 'FeatureValueCore' => 'classes/FeatureValue.php', @@ -130,12 +102,10 @@ 'Guest' => 'override/classes/Guest.php', 'HelpAccessCore' => 'classes/HelpAccess.php', 'HelpAccess' => 'override/classes/HelpAccess.php', - 'HelperFormCore' => 'classes/HelperForm.php', - 'HelperForm' => '', - 'HelperListCore' => 'classes/HelperList.php', - 'HelperList' => '', 'HelperCore' => 'classes/Helper.php', 'Helper' => 'override/classes/Helper.php', + 'HelperListCore' => 'classes/HelperList.php', + 'HelperList' => '', 'HookCore' => 'classes/Hook.php', 'Hook' => 'override/classes/Hook.php', 'ImageCore' => 'classes/Image.php', @@ -162,20 +132,22 @@ 'Message' => 'override/classes/Message.php', 'MetaCore' => 'classes/Meta.php', 'Meta' => 'override/classes/Meta.php', - 'ModuleGraphEngineCore' => 'classes/ModuleGraphEngine.php', - 'ModuleGraphEngine' => 'override/classes/ModuleGraphEngine.php', - 'ModuleGraphCore' => 'classes/ModuleGraph.php', - 'ModuleGraph' => 'override/classes/ModuleGraph.php', - 'ModuleGridEngineCore' => 'classes/ModuleGridEngine.php', - 'ModuleGridEngine' => 'override/classes/ModuleGridEngine.php', - 'ModuleGridCore' => 'classes/ModuleGrid.php', - 'ModuleGrid' => 'override/classes/ModuleGrid.php', 'ModuleCore' => 'classes/Module.php', 'Module' => 'override/classes/Module.php', + 'ModuleGraphCore' => 'classes/ModuleGraph.php', + 'ModuleGraph' => 'override/classes/ModuleGraph.php', + 'ModuleGraphEngineCore' => 'classes/ModuleGraphEngine.php', + 'ModuleGraphEngine' => 'override/classes/ModuleGraphEngine.php', + 'ModuleGridCore' => 'classes/ModuleGrid.php', + 'ModuleGrid' => 'override/classes/ModuleGrid.php', + 'ModuleGridEngineCore' => 'classes/ModuleGridEngine.php', + 'ModuleGridEngine' => 'override/classes/ModuleGridEngine.php', 'NotificationCore' => 'classes/Notification.php', 'Notification' => 'override/classes/Notification.php', 'ObjectModelCore' => 'classes/ObjectModel.php', 'ObjectModel' => 'override/classes/ObjectModel.php', + 'OrderCore' => 'classes/Order.php', + 'Order' => 'override/classes/Order.php', 'OrderDetailCore' => 'classes/OrderDetail.php', 'OrderDetail' => 'override/classes/OrderDetail.php', 'OrderDiscountCore' => 'classes/OrderDiscount.php', @@ -184,8 +156,6 @@ 'OrderHistory' => 'override/classes/OrderHistory.php', 'OrderMessageCore' => 'classes/OrderMessage.php', 'OrderMessage' => 'override/classes/OrderMessage.php', - 'OrderCore' => 'classes/Order.php', - 'Order' => 'override/classes/Order.php', 'OrderReturnCore' => 'classes/OrderReturn.php', 'OrderReturn' => 'override/classes/OrderReturn.php', 'OrderReturnStateCore' => 'classes/OrderReturnState.php', @@ -194,6 +164,8 @@ 'OrderSlip' => 'override/classes/OrderSlip.php', 'OrderStateCore' => 'classes/OrderState.php', 'OrderState' => 'override/classes/OrderState.php', + 'PDFCore' => 'classes/PDF.php', + 'PDF' => 'override/classes/PDF.php', 'PackCore' => 'classes/Pack.php', 'Pack' => 'override/classes/Pack.php', 'PageCore' => 'classes/Page.php', @@ -202,12 +174,10 @@ 'PaymentCC' => 'override/classes/PaymentCC.php', 'PaymentModuleCore' => 'classes/PaymentModule.php', 'PaymentModule' => 'override/classes/PaymentModule.php', - 'PDFCore' => 'classes/PDF.php', - 'PDF' => 'override/classes/PDF.php', - 'ProductDownloadCore' => 'classes/ProductDownload.php', - 'ProductDownload' => 'override/classes/ProductDownload.php', 'ProductCore' => 'classes/Product.php', 'Product' => 'override/classes/Product.php', + 'ProductDownloadCore' => 'classes/ProductDownload.php', + 'ProductDownload' => 'override/classes/ProductDownload.php', 'ProductSaleCore' => 'classes/ProductSale.php', 'ProductSale' => 'override/classes/ProductSale.php', 'ProfileCore' => 'classes/Profile.php', @@ -226,34 +196,20 @@ 'Rijndael' => 'override/classes/Rijndael.php', 'SceneCore' => 'classes/Scene.php', 'Scene' => 'override/classes/Scene.php', - 'SearchEngineCore' => 'classes/SearchEngine.php', - 'SearchEngine' => 'override/classes/SearchEngine.php', 'SearchCore' => 'classes/Search.php', 'Search' => 'override/classes/Search.php', - 'GroupShopCore' => 'classes/shop/GroupShop.php', - 'GroupShop' => 'override/classes/shop/GroupShop.php', - 'ShopCore' => 'classes/shop/Shop.php', - 'Shop' => 'override/classes/shop/Shop.php', - 'ShopUrlCore' => 'classes/shop/ShopUrl.php', - 'ShopUrl' => 'override/classes/shop/ShopUrl.php', + 'SearchEngineCore' => 'classes/SearchEngine.php', + 'SearchEngine' => 'override/classes/SearchEngine.php', 'SpecificPriceCore' => 'classes/SpecificPrice.php', 'SpecificPrice' => 'override/classes/SpecificPrice.php', 'StateCore' => 'classes/State.php', 'State' => 'override/classes/State.php', - 'StockManagerFactoryCore' => 'classes/stock/StockManagerFactory.php', - 'StockManagerFactory' => '', - 'StockManagerInterface' => 'classes/stock/StockManagerInterface.php', - 'StockManagerModule' => 'classes/stock/StockManagerModule.php', - 'StockManagerCore' => 'classes/stock/StockManager.php', - 'StockManager' => '', - 'WarehouseCore' => 'classes/stock/Warehouse.php', - 'Warehouse' => '', + 'StockCore' => 'classes/Stock.php', + 'Stock' => 'override/classes/Stock.php', 'StockMvtCore' => 'classes/StockMvt.php', 'StockMvt' => 'override/classes/StockMvt.php', 'StockMvtReasonCore' => 'classes/StockMvtReason.php', 'StockMvtReason' => 'override/classes/StockMvtReason.php', - 'StockCore' => 'classes/Stock.php', - 'Stock' => 'override/classes/Stock.php', 'StoreCore' => 'classes/Store.php', 'Store' => 'override/classes/Store.php', 'SubDomainCore' => 'classes/SubDomain.php', @@ -264,21 +220,6 @@ 'Tab' => 'override/classes/Tab.php', 'TagCore' => 'classes/Tag.php', 'Tag' => 'override/classes/Tag.php', - 'TaxCalculatorCore' => 'classes/tax/TaxCalculator.php', - 'TaxCalculator' => 'override/classes/tax/TaxCalculator.php', - 'TaxManagerFactoryCore' => 'classes/tax/TaxManagerFactory.php', - 'TaxManagerFactory' => 'override/classes/tax/TaxManagerFactory.php', - 'TaxManagerInterface' => 'classes/tax/TaxManagerInterface.php', - 'TaxManagerModuleCore' => 'classes/tax/TaxManagerModule.php', - 'TaxManagerModule' => 'override/classes/tax/TaxManagerModule.php', - 'TaxCore' => 'classes/tax/Tax.php', - 'Tax' => 'override/classes/tax/Tax.php', - 'TaxRuleCore' => 'classes/tax/TaxRule.php', - 'TaxRule' => 'override/classes/tax/TaxRule.php', - 'TaxRulesGroupCore' => 'classes/tax/TaxRulesGroup.php', - 'TaxRulesGroup' => 'override/classes/tax/TaxRulesGroup.php', - 'TaxRulesTaxManagerCore' => 'classes/tax/TaxRulesTaxManager.php', - 'TaxRulesTaxManager' => 'override/classes/tax/TaxRulesTaxManager.php', 'ThemeCore' => 'classes/Theme.php', 'Theme' => 'override/classes/Theme.php', 'ToolsCore' => 'classes/Tools.php', @@ -289,6 +230,65 @@ 'Upgrader' => 'override/classes/Upgrader.php', 'ValidateCore' => 'classes/Validate.php', 'Validate' => 'override/classes/Validate.php', + 'ZoneCore' => 'classes/Zone.php', + 'Zone' => 'override/classes/Zone.php', + 'CacheCore' => 'classes/cache/Cache.php', + 'Cache' => 'override/classes/cache/Cache.php', + 'CacheApcCore' => 'classes/cache/CacheApc.php', + 'CacheApc' => 'override/classes/cache/CacheApc.php', + 'CacheFsCore' => 'classes/cache/CacheFs.php', + 'CacheFs' => 'override/classes/cache/CacheFs.php', + 'CacheMemcacheCore' => 'classes/cache/CacheMemcache.php', + 'CacheMemcache' => 'override/classes/cache/CacheMemcache.php', + 'CacheXcacheCore' => 'classes/cache/CacheXcache.php', + 'CacheXcache' => 'override/classes/cache/CacheXcache.php', + 'DbCore' => 'classes/db/Db.php', + 'Db' => 'override/classes/db/Db.php', + 'DbMySQLiCore' => 'classes/db/DbMySQLi.php', + 'DbMySQLi' => 'override/classes/db/DbMySQLi.php', + 'DbPDOCore' => 'classes/db/DbPDO.php', + 'DbPDO' => 'override/classes/db/DbPDO.php', + 'DbQueryCore' => 'classes/db/DbQuery.php', + 'DbQuery' => 'override/classes/db/DbQuery.php', + 'MySQLCore' => 'classes/db/MySQL.php', + 'MySQL' => 'override/classes/db/MySQL.php', + 'PrestashopDatabaseExceptionCore' => 'classes/exception/PrestashopDatabaseException.php', + 'PrestashopDatabaseException' => 'override/classes/exception/PrestashopDatabaseException.php', + 'PrestashopExceptionCore' => 'classes/exception/PrestashopException.php', + 'PrestashopException' => 'override/classes/exception/PrestashopException.php', + 'PrestashopModuleExceptionCore' => 'classes/exception/PrestashopModuleException.php', + 'PrestashopModuleException' => 'override/classes/exception/PrestashopModuleException.php', + 'PrestashopPaymentExceptionCore' => 'classes/exception/PrestashopPaymentException.php', + 'PrestashopPaymentException' => 'override/classes/exception/PrestashopPaymentException.php', + 'GroupShopCore' => 'classes/shop/GroupShop.php', + 'GroupShop' => 'override/classes/shop/GroupShop.php', + 'ShopCore' => 'classes/shop/Shop.php', + 'Shop' => 'override/classes/shop/Shop.php', + 'ShopUrlCore' => 'classes/shop/ShopUrl.php', + 'ShopUrl' => 'override/classes/shop/ShopUrl.php', + 'StockManagerCore' => 'classes/stock/StockManager.php', + 'StockManager' => '', + 'StockManagerFactoryCore' => 'classes/stock/StockManagerFactory.php', + 'StockManagerFactory' => '', + 'StockManagerInterface' => 'classes/stock/StockManagerInterface.php', + 'StockManagerModule' => 'classes/stock/StockManagerModule.php', + 'StockWarehouseCore' => 'classes/stock/StockWarehouse.php', + 'StockWarehouse' => '', + 'TaxCore' => 'classes/tax/Tax.php', + 'Tax' => 'override/classes/tax/Tax.php', + 'TaxCalculatorCore' => 'classes/tax/TaxCalculator.php', + 'TaxCalculator' => 'override/classes/tax/TaxCalculator.php', + 'TaxManagerFactoryCore' => 'classes/tax/TaxManagerFactory.php', + 'TaxManagerFactory' => 'override/classes/tax/TaxManagerFactory.php', + 'TaxManagerInterface' => 'classes/tax/TaxManagerInterface.php', + 'TaxManagerModuleCore' => 'classes/tax/TaxManagerModule.php', + 'TaxManagerModule' => 'override/classes/tax/TaxManagerModule.php', + 'TaxRuleCore' => 'classes/tax/TaxRule.php', + 'TaxRule' => 'override/classes/tax/TaxRule.php', + 'TaxRulesGroupCore' => 'classes/tax/TaxRulesGroup.php', + 'TaxRulesGroup' => 'override/classes/tax/TaxRulesGroup.php', + 'TaxRulesTaxManagerCore' => 'classes/tax/TaxRulesTaxManager.php', + 'TaxRulesTaxManager' => 'override/classes/tax/TaxRulesTaxManager.php', 'WebserviceExceptionCore' => 'classes/webservice/WebserviceException.php', 'WebserviceException' => 'override/classes/webservice/WebserviceException.php', 'WebserviceKeyCore' => 'classes/webservice/WebserviceKey.php', @@ -305,8 +305,6 @@ 'WebserviceSpecificManagementInterface' => 'classes/webservice/WebserviceSpecificManagementInterface.php', 'WebserviceSpecificManagementSearchCore' => 'classes/webservice/WebserviceSpecificManagementSearch.php', 'WebserviceSpecificManagementSearch' => 'override/classes/webservice/WebserviceSpecificManagementSearch.php', - 'ZoneCore' => 'classes/Zone.php', - 'Zone' => 'override/classes/Zone.php', 'FB' => 'override/classes/fb.php', 'AdminAddressesControllerCore' => 'controllers/admin/AdminAddressesController.php', 'AdminAddressesController' => '', diff --git a/controllers/admin/AdminRequestSqlController.php b/controllers/admin/AdminRequestSqlController.php index 8b136b631..cca728ee6 100644 --- a/controllers/admin/AdminRequestSqlController.php +++ b/controllers/admin/AdminRequestSqlController.php @@ -27,6 +27,9 @@ class AdminRequestSqlControllerCore extends AdminController { + private $info = true; + private $warning = true; + public function __construct() { $this->table = 'request_sql'; @@ -38,7 +41,6 @@ class AdminRequestSqlControllerCore extends AdminController $this->export = true; $this->requiredDatabase = true; $this->context = Context::getContext(); - $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')), 'export' => array('text' => $this->l('Export selected'))); @@ -51,32 +53,7 @@ class AdminRequestSqlControllerCore extends AdminController 'sql' => array('title' => $this->l('Request'), 'width' => 500) ); - $this->fields_form = array( - 'legend' => array( - 'title' => $this->l('Request') - ), - 'input' => array( - array( - 'type' => 'text', - 'label' => $this->l('Name:'), - 'name' => 'name', - 'size' => 103, - 'required' => true - ), - array( - 'type' => 'textarea', - 'label' => $this->l('Request:'), - 'name' => 'sql', - 'cols' => 100, - 'rows' => 10, - 'required' => true - ) - ), - 'submit' => array( - 'title' => $this->l(' Save '), - 'class' => 'button' - ) - ); + $this->template = 'adminRequestSql.tpl'; parent::__construct(); } @@ -157,7 +134,7 @@ class AdminRequestSqlControllerCore extends AdminController return $val; } - public function viewRequestSql() + public function viewRequest_sql() { if (!($obj = $this->loadObject(true))) return; @@ -168,19 +145,17 @@ class AdminRequestSqlControllerCore extends AdminController { foreach (array_keys($results[0]) as $key) $tab_key[] = $key; - + $view['name'] = $obj->name; $view['key'] = $tab_key; $view['results'] = $results; - + $request_sql = new RequestSql(); $view['attributes'] = $request_sql->attributes; } else $view['error'] = true; - - $this->context->smarty->assign('view', $view); - return $this->context->smarty->fetch('requestSql/view.tpl'); + return $view; } public function _childValidation() @@ -283,6 +258,23 @@ class AdminRequestSqlControllerCore extends AdminController } } + public function displayForm($isMainTab = true) + { + $this->content .= parent::displayForm(); + + if (!($obj = $this->loadObject(true))) + return; + + $smarty = $this->context->smarty; + $smarty->assign('tab_form', array( + 'current' => self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token, + 'id' => $obj->id, + 'table' => $this->table, + 'name' => $this->getFieldValue($obj, 'name'), + 'sql' => $this->getFieldValue($obj, 'sql') + )); + } + public function init() { if (isset($_GET['view'.$this->table]) && isset($_GET['id_'.$this->table])) @@ -297,31 +289,27 @@ class AdminRequestSqlControllerCore extends AdminController public function initContent() { - $this->displayWarning($this->l('When saving the query, only the request type "SELECT" are allowed.')); - $this->displayInformation(''.$this->l('How to create a new sql query?').' -
- '); - $smarty = $this->context->smarty; switch ($this->display) { case 'edit': - $this->informations = false; + $this->info = false; break; case 'view': - $this->informations = false; - $smarty->assign('view', $this->viewRequestSql()); + $this->info = false; + $this->warning = false; + $smarty->assign('view', $this->viewRequest_sql()); break; default: $this->display = 'list'; break; } + $smarty->assign(array( + 'info' => $this->info, + 'warning' =>$this->warning, + )); + parent::initContent(); } diff --git a/override/classes/Tools.php b/override/classes/Tools.php index 2fa87facf..55c14e2ea 100644 --- a/override/classes/Tools.php +++ b/override/classes/Tools.php @@ -1,314 +1,7 @@ -* @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision$ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -// -// IMPORTANT : don't forget to delete the underscore _ in the file name if you want to use it ! -// - -// if FB class is already loaded, just enable it. else, enable it only if fb.php exists and is loaded -if (!defined('PS_USE_FIREPHP') AND class_exists('FB')) - define('PS_USE_FIREPHP',true); -elseif (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'fb.php')) -{ - if (!defined('PS_USE_FIREPHP')) - { - require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'fb.php'); - define('PS_USE_FIREPHP',true); - } - else - define('PS_USE_FIREPHP',false); -} -else - define('PS_USE_FIREPHP',class_exists('FB')); class Tools extends ToolsCore { - /** - * Redirect user to another page after 5 sec - * - * @param string $url Desired URL - * @param string $baseUri Base URI (optional) - */ - public static function redirect($url, $baseUri = __PS_BASE_URI__, Link $link = null) - { - if (!$link) - $link = Context::getContext()->link; - if (strpos($url, 'http://') === FALSE && strpos($url, 'https://') === FALSE) - { - if (strpos($url, $baseUri) !== FALSE && strpos($url, $baseUri) == 0) - $url = substr($url, strlen($baseUri)); - $explode = explode('?', $url); - $url = $link->getPageLink($explode[0], true); - if (isset($explode[1])) - $url .= '?'.$explode[1]; - $baseUri = ''; - } - if (isset($_SERVER['HTTP_REFERER']) AND ($url == $_SERVER['HTTP_REFERER'])) - header('Refresh: 5; url='.$_SERVER['HTTP_REFERER']); - else - header('Refresh: 5; url='.$baseUri.$url); - echo '

Redirection automatique dans 5 secondes

'.$url.''; - exit; - } - - - /** - * Redirect url wich allready PS_BASE_URI after 5 sec - * - * @param string $url Desired URL - */ - public static function redirectLink($url) - { - if (!preg_match('@^https?://@i', $url)) - { - if (strpos($url, __PS_BASE_URI__) !== FALSE && strpos($url, __PS_BASE_URI__) == 0) - $url = substr($url, strlen(__PS_BASE_URI__)); - $explode = explode('?', $url); - $url = Context::getContext()->link->getPageLink($explode[0]); - if (isset($explode[1])) - $url .= '?'.$explode[1]; - } - - header('Refresh: 5; url='.$url); - echo '

Redirection automatique dans 5 secondes

'.$url.''; - exit; - } - /** - * Redirect user to another admin page after 5 sec - * - * @param string $url Desired URL - */ - public static function redirectAdmin($url) - { - header('Refresh: 5; url='.$url); - echo '

Redirection automatique dans 5 secondes

'.$url.''; - exit; - } - - - /** - * Display an error with detailed object - * (display in firefox console if Firephp is enabled) - * - * @param mixed $object - * @param boolean $kill - * @return $object if $kill = false; - */ - public static function dieObject($object, $kill = true) - { - if(PS_USE_FIREPHP) - FB::error($object); - else - return parent::dieObject($object,$kill); - - if ($kill) - die('END'); - return $object; - } - - /** - * ALIAS OF dieObject() - Display an error with detailed object - * (display in firefox console if Firephp is enabled) - * - * @param object $object Object to display - */ - public static function d($obj, $kill = true) - { - if(PS_USE_FIREPHP) - FB::error($obj); - else - parent::d($obj,$kill); - - if ($kill) - die('END'); - return $object; - } - - /** - * ALIAS OF dieObject() - Display an error with detailed object but don't stop the execution - * (display in firefox console if Firephp is enabled) - * - * @param object $object Object to display - */ - public static function p($object) - { - if(PS_USE_FIREPHP) - FB::info($object); - else - return parent::p($object); - return $object; - } - - /** - * Display a warning message indicating that the method is deprecated - * (display in firefox console if Firephp is enabled) - */ - public static function displayAsDeprecated() - { - if (_PS_DISPLAY_COMPATIBILITY_WARNING_) - { - $backtrace = debug_backtrace(); - $callee = next($backtrace); - if (PS_USE_FIREPHP) - FB::warn('Function '.$callee['function'].'() is deprecated in '.$callee['file'].' on line '.$callee['line'].'
', 'Deprecated method'); - else - trigger_error('Function '.$callee['function'].'() is deprecated in '.$callee['file'].' on line '.$callee['line'].'
', E_USER_WARNING); - - $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']); - } - } - - /** - * Display a warning message indicating that the parameter is deprecated - * (display in firefox console if Firephp is enabled) - */ - public static function displayParameterAsDeprecated($parameter) - { - 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); - - if(PS_USE_FIREPHP) - FB::trace('Parameter '.$parameter.' in function '.$callee['function'].'() is deprecated in '.$callee['file'].' on line '.$callee['Line'].'
', 'deprecated parameter'); - else - $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']); - } - } - - /** - * use of FirePHP::error() if allowed - * - * @param mixed $obj - * @param string $label - * @return void - */ - public static function error($obj, $label = '') - { - if(PS_USE_FIREPHP) - FB::error($obj, $label); - } - - /** - * use of FirePHP::warn() if allowed - * - * @param mixed $obj - * @param string $label - * @return void - */ - public static function warn($obj, $label = '') - { - if(PS_USE_FIREPHP) - FB::warn($obj, $label); - } - - /** - * use of FirePHP::info() if allowed - * - * @param mixed $obj - * @param string $label - * @return void - */ - public static function info($obj, $label = '') - { - if(PS_USE_FIREPHP) - FB::info($obj, $label); - } - - /** - * use of FirePHP::log() if allowed - * - * @param mixed $obj - * @param string $label - * @return void - */ - public static function log($obj, $label = '') - { - if(PS_USE_FIREPHP) - FB::log($obj,$label); - } - /** - * display debug_backtrace() - * (display in firefox console if Firephp is enabled) - * - * @param mixed $obj - * @return void - */ - public static function trace($obj = NULL, $label = '') - { - if(PS_USE_FIREPHP) - FB::trace($obj, $label); - else{ - Tools::p($obj); - echo'

'.$label.'


'; - debug_print_backtrace(); - echo '
'; - } - } -} -// Add some convenient shortcut - -if (!function_exists('error')) -{ - function error($obj, $label = ''){ - return Tools::error($obj, $label); - } -} - -if (!function_exists('warn')) -{ - function warn($obj, $label = ''){ - return Tools::warn($obj,$label); - } -} - -if (!function_exists('info')) -{ - function info($obj, $label = ''){ - return Tools::info($obj, $label); - } -} - -if (!function_exists('log')) -{ - function log($obj, $label = ''){ - return Tools::log($obj, $label); - } -} - -if (!function_exists('trace')) -{ - function trace($obj, $label = ''){ - return Tools::trace($obj, $label); - } }