diff --git a/cache/class_index.php b/cache/class_index.php index 606505b20..c286aa5cf 100644 --- a/cache/class_index.php +++ b/cache/class_index.php @@ -1,6 +1,8 @@ 'classes/AbstractLogger.php', 'AbstractLogger' => 'override/classes/AbstractLogger.php', + 'AccountingCore' => 'classes/Accounting.php', + 'Accounting' => '', 'AddressCore' => 'classes/Address.php', 'Address' => 'override/classes/Address.php', 'AddressFormatCore' => 'classes/AddressFormat.php', @@ -32,6 +34,8 @@ 'CarrierModule' => 'override/classes/CarrierModule.php', 'CartCore' => 'classes/Cart.php', 'Cart' => 'override/classes/Cart.php', + 'CartRuleCore' => 'classes/CartRule.php', + 'CartRule' => '', 'CategoryCore' => 'classes/Category.php', 'Category' => 'override/classes/Category.php', 'ChartCore' => 'classes/Chart.php', @@ -110,6 +114,8 @@ 'HelperList' => '', 'HelperOptionsCore' => 'classes/HelperOptions.php', 'HelperOptions' => '', + 'HelperViewCore' => 'classes/HelperView.php', + 'HelperView' => '', 'HookCore' => 'classes/Hook.php', 'Hook' => 'override/classes/Hook.php', 'ImageCore' => 'classes/Image.php', @@ -152,6 +158,8 @@ 'ObjectModel' => 'override/classes/ObjectModel.php', 'OrderCore' => 'classes/Order.php', 'Order' => 'override/classes/Order.php', + 'OrderCartRuleCore' => 'classes/OrderCartRule.php', + 'OrderCartRule' => '', 'OrderDetailCore' => 'classes/OrderDetail.php', 'OrderDetail' => 'override/classes/OrderDetail.php', 'OrderDiscountCore' => 'classes/OrderDiscount.php', @@ -278,6 +286,16 @@ 'StockMvt' => 'override/classes/StockMvt.php', 'StockMvtReasonCore' => 'classes/stock/StockMvtReason.php', 'StockMvtReason' => 'override/classes/StockMvtReason.php', + 'SupplyOrderCore' => 'classes/stock/SupplyOrder.php', + 'SupplyOrder' => '', + 'SupplyOrderDetailCore' => 'classes/stock/SupplyOrderDetail.php', + 'SupplyOrderDetail' => '', + 'SupplyOrderHistoryCore' => 'classes/stock/SupplyOrderHistory.php', + 'SupplyOrderHistory' => '', + 'SupplyOrderReceiptHistoryCore' => 'classes/stock/SupplyOrderReceiptHistory.php', + 'SupplyOrderReceiptHistory' => '', + 'SupplyOrderStateCore' => 'classes/stock/SupplyOrderState.php', + 'SupplyOrderState' => '', 'WarehouseCore' => 'classes/stock/Warehouse.php', 'Warehouse' => '', 'TaxCore' => 'classes/tax/Tax.php', @@ -312,21 +330,41 @@ 'WebserviceSpecificManagementSearchCore' => 'classes/webservice/WebserviceSpecificManagementSearch.php', 'WebserviceSpecificManagementSearch' => 'override/classes/webservice/WebserviceSpecificManagementSearch.php', 'FB' => 'override/classes/fb.php', + 'AdminAccessController' => 'controllers/admin/AdminAccessController.php', + 'AdminAccountingExportControllerCore' => 'controllers/admin/AdminAccountingExportController.php', + 'AdminAccountingExportController' => '', + 'AdminAccountingManagementControllerCore' => 'controllers/admin/AdminAccountingManagementController.php', + 'AdminAccountingManagementController' => '', 'AdminAddressesControllerCore' => 'controllers/admin/AdminAddressesController.php', 'AdminAddressesController' => '', 'AdminAliasesControllerCore' => 'controllers/admin/AdminAliasesController.php', 'AdminAliasesController' => '', + 'AdminAttachmentsControllerCore' => 'controllers/admin/AdminAttachmentsController.php', + 'AdminAttachmentsController' => '', + 'AdminAttributeGeneratorControllerCore' => 'controllers/admin/AdminAttributeGeneratorController.php', + 'AdminAttributeGeneratorController' => '', + 'AdminAttributesGroupsControllerCore' => 'controllers/admin/AdminAttributesGroupsController.php', + 'AdminAttributesGroupsController' => '', 'AdminBackupControllerCore' => 'controllers/admin/AdminBackupController.php', 'AdminBackupController' => '', 'AdminCarriersControllerCore' => 'controllers/admin/AdminCarriersController.php', 'AdminCarriersController' => '', + 'AdminCartRulesControllerCore' => 'controllers/admin/AdminCartRulesController.php', + 'AdminCartRulesController' => '', + 'AdminCartsController' => 'controllers/admin/AdminCartsController.php', 'AdminCatalogController' => 'controllers/admin/AdminCatalogController.php', + 'AdminCategoriesControllerCore' => 'controllers/admin/AdminCategoriesController.php', + 'AdminCategoriesController' => '', + 'AdminContactControllerCore' => 'controllers/admin/AdminContactController.php', + 'AdminContactController' => '', 'AdminContactsControllerCore' => 'controllers/admin/AdminContactsController.php', 'AdminContactsController' => '', 'AdminCountriesControllerCore' => 'controllers/admin/AdminCountriesController.php', 'AdminCountriesController' => '', 'AdminCurrenciesControllerCore' => 'controllers/admin/AdminCurrenciesController.php', 'AdminCurrenciesController' => '', + 'AdminCustomerThreadsControllerCore' => 'controllers/admin/AdminCustomerThreadsController.php', + 'AdminCustomerThreadsController' => '', 'AdminCustomersControllerCore' => 'controllers/admin/AdminCustomersController.php', 'AdminCustomersController' => '', 'AdminDbControllerCore' => 'controllers/admin/AdminDbController.php', @@ -337,7 +375,11 @@ 'AdminEmailsController' => '', 'AdminEmployeesControllerCore' => 'controllers/admin/AdminEmployeesController.php', 'AdminEmployeesController' => '', + 'AdminFeaturesControllerCore' => 'controllers/admin/AdminFeaturesController.php', + 'AdminFeaturesController' => '', 'AdminGendersController' => 'controllers/admin/AdminGendersController.php', + 'AdminGeneratorControllerCore' => 'controllers/admin/AdminGeneratorController.php', + 'AdminGeneratorController' => '', 'AdminGeolocationControllerCore' => 'controllers/admin/AdminGeolocationController.php', 'AdminGeolocationController' => '', 'AdminGroupShopControllerCore' => 'controllers/admin/AdminGroupShopController.php', @@ -345,16 +387,25 @@ 'AdminHomeControllerCore' => 'controllers/admin/AdminHomeController.php', 'AdminHomeController' => 'override/controllers/admin/AdminHomeController.php', 'AdminImagesController' => 'controllers/admin/AdminImagesController.php', + 'AdminImportController' => 'controllers/admin/AdminImportController.php', 'AdminInformationControllerCore' => 'controllers/admin/AdminInformationController.php', 'AdminInformationController' => '', 'AdminInvoicesControllerCore' => 'controllers/admin/AdminInvoicesController.php', 'AdminInvoicesController' => '', 'AdminLanguagesControllerCore' => 'controllers/admin/AdminLanguagesController.php', 'AdminLanguagesController' => '', + 'AdminLocalizationControllerCore' => 'controllers/admin/AdminLocalizationController.php', + 'AdminLocalizationController' => '', 'AdminLogsControllerCore' => 'controllers/admin/AdminLogsController.php', 'AdminLogsController' => '', + 'AdminManufacturersControllerCore' => 'controllers/admin/AdminManufacturersController.php', + 'AdminManufacturersController' => '', 'AdminMetaControllerCore' => 'controllers/admin/AdminMetaController.php', 'AdminMetaController' => '', + 'AdminModulesPositionsControllerCore' => 'controllers/admin/AdminModulesPositionsController.php', + 'AdminModulesPositionsController' => '', + 'AdminNotFoundControllerCore' => 'controllers/admin/AdminNotFoundController.php', + 'AdminNotFoundController' => '', 'AdminOrderMessageController' => 'controllers/admin/AdminOrderMessageController.php', 'AdminOrdersControllerCore' => 'controllers/admin/AdminOrdersController.php', 'AdminOrdersController' => '', @@ -364,18 +415,47 @@ 'AdminPPreferencesController' => '', 'AdminPaymentControllerCore' => 'controllers/admin/AdminPaymentController.php', 'AdminPaymentController' => '', + 'AdminPerformanceController' => 'controllers/admin/AdminPerformanceController.php', + 'AdminPreferencesControllerCore' => 'controllers/admin/AdminPreferencesController.php', + 'AdminPreferencesController' => '', 'AdminProductsController' => 'controllers/admin/AdminProductsController.php', 'AdminProfilesControllerCore' => 'controllers/admin/AdminProfilesController.php', 'AdminProfilesController' => '', 'AdminQuickAccessesController' => 'controllers/admin/AdminQuickAccessesController.php', + 'AdminRangePriceControllerCore' => 'controllers/admin/AdminRangePriceController.php', + 'AdminRangePriceController' => '', + 'AdminRangeWeightControllerCore' => 'controllers/admin/AdminRangeWeightController.php', + 'AdminRangeWeightController' => '', + 'AdminReferrersControllerCore' => 'controllers/admin/AdminReferrersController.php', + 'AdminReferrersController' => '', 'AdminRequestSqlControllerCore' => 'controllers/admin/AdminRequestSqlController.php', 'AdminRequestSqlController' => '', + 'AdminReturnControllerCore' => 'controllers/admin/AdminReturnController.php', + 'AdminReturnController' => '', + 'AdminScenesControllerCore' => 'controllers/admin/AdminScenesController.php', + 'AdminScenesController' => '', + 'AdminSearchConfControllerCore' => 'controllers/admin/AdminSearchConfController.php', + 'AdminSearchConfController' => '', + 'AdminSearchControllerCore' => 'controllers/admin/AdminSearchController.php', + 'AdminSearchController' => '', 'AdminSearchEnginesControllerCore' => 'controllers/admin/AdminSearchEnginesController.php', 'AdminSearchEnginesController' => '', + 'AdminShippingControllerCore' => 'controllers/admin/AdminShippingController.php', + 'AdminShippingController' => '', 'AdminShopUrlControllerCore' => 'controllers/admin/AdminShopUrlController.php', 'AdminShopUrlController' => '', + 'AdminSlipControllerCore' => 'controllers/admin/AdminSlipController.php', + 'AdminSlipController' => '', 'AdminStatesControllerCore' => 'controllers/admin/AdminStatesController.php', 'AdminStatesController' => '', + 'AdminStatsConfControllerCore' => 'controllers/admin/AdminStatsConfController.php', + 'AdminStatsConfController' => '', + 'AdminStatsControllerCore' => 'controllers/admin/AdminStatsController.php', + 'AdminStatsController' => '', + 'AdminStatsTabControllerCore' => 'controllers/admin/AdminStatsTabController.php', + 'AdminStatsTabController' => '', + 'AdminStatusesControllerCore' => 'controllers/admin/AdminStatusesController.php', + 'AdminStatusesController' => '', 'AdminStockCoverControllerCore' => 'controllers/admin/AdminStockCoverController.php', 'AdminStockCoverController' => '', 'AdminStockInstantStateControllerCore' => 'controllers/admin/AdminStockInstantStateController.php', @@ -386,11 +466,33 @@ 'AdminStockMvtController' => '', 'AdminStoresControllerCore' => 'controllers/admin/AdminStoresController.php', 'AdminStoresController' => '', + 'AdminSubDomainsControllerCore' => 'controllers/admin/AdminSubDomainsController.php', + 'AdminSubDomainsController' => '', + 'AdminSuppliersControllerCore' => 'controllers/admin/AdminSuppliersController.php', + 'AdminSuppliersController' => '', + 'AdminSupplyOrdersControllerCore' => 'controllers/admin/AdminSupplyOrdersController.php', + 'AdminSupplyOrdersController' => '', + 'AdminTabsControllerCore' => 'controllers/admin/AdminTabsController.php', + 'AdminTabsController' => '', + 'AdminTagsControllerCore' => 'controllers/admin/AdminTagsController.php', + 'AdminTagsController' => '', + 'AdminTaxRulesGroupControllerCore' => 'controllers/admin/AdminTaxRulesGroupController.php', + 'AdminTaxRulesGroupController' => '', + 'AdminTaxesControllerCore' => 'controllers/admin/AdminTaxesController.php', + 'AdminTaxesController' => '', + 'AdminThemesControllerCore' => 'controllers/admin/AdminThemesController.php', + 'AdminThemesController' => '', 'AdminToolsControllerCore' => 'controllers/admin/AdminToolsController.php', 'AdminToolsController' => 'override/controllers/admin/AdminToolsController.php', 'AdminTrackingController' => 'controllers/admin/AdminTrackingController.php', + 'AdminTranslationsControllerCore' => 'controllers/admin/AdminTranslationsController.php', + 'AdminTranslationsController' => '', 'AdminWarehousesControllerCore' => 'controllers/admin/AdminWarehousesController.php', 'AdminWarehousesController' => '', + 'AdminWebserviceControllerCore' => 'controllers/admin/AdminWebserviceController.php', + 'AdminWebserviceController' => '', + 'AdminZonesControllerCore' => 'controllers/admin/AdminZonesController.php', + 'AdminZonesController' => '', 'AddressControllerCore' => 'controllers/front/AddressController.php', 'AddressController' => 'override/controllers/front/AddressController.php', 'AddressesControllerCore' => 'controllers/front/AddressesController.php', diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index b9c04860d..b6cac4293 100755 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -514,7 +514,7 @@ class AdminOrdersControllerCore extends AdminController } // Smarty assign - $this->context->smarty->assign(array( + $this->tpl_view_vars = array( 'order' => $order, 'cart' => new Cart($order->id), 'customer' => $customer, @@ -544,14 +544,13 @@ class AdminOrdersControllerCore extends AdminController 'carrierModuleCall' => $carrier_module_call, 'iso_code_lang' => $this->context->language->iso_code, 'id_lang' => $this->context->language->id, - 'paymentCCDetails' => PaymentCC::getByOrderId($order->id) - )); + 'paymentCCDetails' => PaymentCC::getByOrderId($order->id), - // Assign Hook - $this->context->smarty->assign(array( 'HOOK_INVOICE' => Hook::exec('invoice', array('id_order' => $order->id)), 'HOOK_ADMIN_ORDER' => Hook::exec('adminOrder', array('id_order' => $order->id)) - )); + ); + + return parent::initView(); } public function ajaxProcessSearchCustomers() { diff --git a/modules/autoupgrade/AdminSelfUpgrade.php b/modules/autoupgrade/AdminSelfUpgrade.php index 4e40da611..8aeb8c242 100644 --- a/modules/autoupgrade/AdminSelfUpgrade.php +++ b/modules/autoupgrade/AdminSelfUpgrade.php @@ -27,7 +27,7 @@ if(!defined('_PS_ADMIN_DIR_')) - define('_PS_ADMIN_DIR_', _PS_ADMIN_DIR_); + define('_PS_ADMIN_DIR_', PS_ADMIN_DIR); if(!defined('_PS_USE_SQL_SLAVE_')) define('_PS_USE_SQL_SLAVE_',false); @@ -60,7 +60,7 @@ if(empty($_POST['action']) OR !in_array($_POST['action'],array('upgradeDb'))) require_once(_PS_ROOT_DIR_.'/override/classes/Upgrader.php'); else eval('class Upgrader extends UpgraderCore{}'); - } + } @@ -102,7 +102,6 @@ class AdminSelfUpgrade extends AdminSelfTab 'manualMode', 'desactivateCustomModule', - // 'backupDbFilename', 'backupFilesFilename', @@ -145,7 +144,7 @@ class AdminSelfUpgrade extends AdminSelfTab */ public static $loopUpgradeFiles = 1000; /** - * intloopRemoveSamples : if your server has a low memory size, lower this value + * int loopRemoveSamples : if your server has a low memory size, lower this value */ public static $loopRemoveSamples = 1000; /** @@ -155,7 +154,7 @@ class AdminSelfUpgrade extends AdminSelfTab /* usage : key = the step you want to ski * value = the next step you want instead - * example : public static $skipAction = array('download'=>'upgradeFiles'); + * example : public static $skipAction = array('download' => 'upgradeFiles'); */ public static $skipAction; public $useSvn; @@ -284,6 +283,7 @@ class AdminSelfUpgrade extends AdminSelfTab return $allowed; } + /** * isUpgradeAllowed checks if all server configuration is valid for upgrade * @@ -326,16 +326,9 @@ class AdminSelfUpgrade extends AdminSelfTab if (!in_array($this->action,array('upgradeFile', 'upgradeDb', 'upgradeComplete','rollback','restoreFiles','restoreDb'))) { - // checkPSVersion will be not $this->upgrader = new Upgrader(); - $this->upgrader->checkPSVersion(); + $this->upgrader->checkPSVersion(); $this->nextParams['install_version'] = $this->upgrader->version_num; - - if ($this->upgrader->autoupgrade_module) - $this->standalone = true; - else - $this->standalone = false; -$this->standalone = true; } // If you have defined this somewhere, you know what you do if (defined('_PS_ALLOW_UPGRADE_UNSTABLE_') AND _PS_ALLOW_UPGRADE_UNSTABLE_ AND function_exists('svn_checkout')) @@ -498,7 +491,6 @@ $this->standalone = true; } else { - // echo ' '. $this->nextParams['msg'] = ($testOrigCore?$this->l('Core files are ok'):sprintf($this->l('%1$s core files have been modified (%2$s total)'), count($changedFileList['core']), count(array_merge($changedFileList['core'], $changedFileList['mail'], $changedFileList['translation'])))); } $this->nextParams['result'] = $changedFileList; @@ -516,7 +508,7 @@ $this->standalone = true; else { $this->next = 'download'; - $this->nextDesc = $this->l('Shop desactivated. Now downloading (this can takes some times )...'); + $this->nextDesc = $this->l('Shop deactivated. Now downloading (this can takes some times )...'); } } @@ -632,19 +624,19 @@ $this->standalone = true; { if ($file[0] != '.') { - $fullPath = $dir.DIRECTORY_SEPARATOR.$file; + $fullPath = $dir.DIRECTORY_SEPARATOR.$file; if (!$this->_skipFile($file, $fullPath, $way)) - { + { if (is_dir($fullPath)) $list = array_merge($list, $this->_listFilesInDir($fullPath, $way)); else $list[] = $fullPath; - } - else + } + else $list[] = $fullPath; + } } - } return $list; } @@ -661,10 +653,10 @@ $this->standalone = true; $list[] = $fullPath; // if is_dir, we will create it :) if (is_dir($fullPath)) - if (strpos($dir.DIRECTORY_SEPARATOR.$file, 'install') === false) - $this->_listFilesToUpgrade($fullPath); - } - } + if (strpos($dir.DIRECTORY_SEPARATOR.$file, 'install') === false) + $this->_listFilesToUpgrade($fullPath); + } + } file_put_contents($this->autoupgradePath.DIRECTORY_SEPARATOR.$this->toUpgradeFileList,serialize($list)); $this->nextParams['filesToUpgrade'] = $this->toUpgradeFileList; @@ -696,7 +688,7 @@ $this->standalone = true; } // @TODO : does not upgrade files in modules, translations if they have not a correct md5 (or crc32, or whatever) from previous version - for ($i=0;$istandalone = true; ){ @ini_set('memory_limit','128M'); } - require_once($this->prodRootDir.'/config/autoload.php'); + require_once($this->prodRootDir.'/config/autoload.php'); /* Redefine REQUEST_URI if empty (on some webservers...) */ if (!isset($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == '') @@ -752,11 +744,11 @@ $this->standalone = true; define('PS_INSTALLATION_IN_PROGRESS', true); - require_once(INSTALL_PATH.'/classes/ToolsInstall.php'); + require_once(INSTALL_PATH.'/classes/ToolsInstall.php'); define('SETTINGS_FILE', $this->prodRootDir . '/config/settings.inc.php'); - define('DEFINES_FILE', $this->prodRootDir .'/config/defines.inc.php'); + define('DEFINES_FILE', $this->prodRootDir .'/config/defines.inc.php'); define('INSTALLER__PS_BASE_URI', substr($_SERVER['REQUEST_URI'], 0, -1 * (strlen($_SERVER['REQUEST_URI']) - strrpos($_SERVER['REQUEST_URI'], '/')) - strlen(substr(dirname($_SERVER['REQUEST_URI']), strrpos(dirname($_SERVER['REQUEST_URI']), '/')+1)))); - define('INSTALLER__PS_BASE_URI_ABSOLUTE', 'http://'.ToolsInstall::getHttpHost(false, true).INSTALLER__PS_BASE_URI); + define('INSTALLER__PS_BASE_URI_ABSOLUTE', 'http://'.ToolsInstall::getHttpHost(false, true).INSTALLER__PS_BASE_URI); // XML Header header('Content-Type: text/xml'); @@ -792,13 +784,13 @@ $this->standalone = true; break; case 'doUpgrade' : - require_once(INSTALL_PATH.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'doUpgrade.php'); + require_once(INSTALL_PATH.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'doUpgrade.php'); break; case 'getVersionFromDb' : require_once(INSTALL_PATH.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'getVersionFromDb.php'); break; - } + } } public function ajaxProcessUpgradeDb() { @@ -815,41 +807,41 @@ $this->standalone = true; $this->nextDesc = 'upgrading database'; $this->nextResponseType = 'xml'; } - switch ($this->currentParams['upgradeDbStep']) - { - default: - // 1) confirm version is correct(DB) - // install/model.php?method=getVersionFromDb&language=0 - case '1': + switch ($this->currentParams['upgradeDbStep']) + { + default: + // 1) confirm version is correct(DB) + // install/model.php?method=getVersionFromDb&language=0 + case '1': $this->_modelDo('getVersionFromDb'); break; - // 2) confirm config is correct (r/w rights) - // install/model.php?method=checkConfig&firsttime=0 - case '2': + // 2) confirm config is correct (r/w rights) + // install/model.php?method=checkConfig&firsttime=0 + case '2': if(!$this->_modelDo('checkConfig')) - { - $this->next = 'error'; + { + $this->next = 'error'; $this->nextDesc = $this->l('error when checking configuration'); - } + } break; - case '3': + case '3': if (!$this->_modelDo('doUpgrade')) { $this->next = 'error'; $this->nextDesc = $this->l('error during upgrade Db. You may need to restore your database'); } break; - case '4': - $this->next = 'upgradeComplete'; - $this->nextResponseType = 'json'; - $this->nextDesc = $this->l('Way to go ! Upgrade complete. You can now reactivate your shop.'); - break; - } + case '4': + $this->next = 'upgradeComplete'; + $this->nextResponseType = 'json'; + $this->nextDesc = $this->l('Way to go ! Upgrade complete. You can now reactivate your shop.'); + break; + } // 5) compare activated modules and reactivate them // @TODO - return true; + return true; } @@ -887,15 +879,14 @@ $this->standalone = true; else { $this->next = 'error'; - $this->nextQuickInfo[] = sprintf($this->l('error when creating directory %s'),$dest); - $this->nextDesc = sprintf($this->l('error when creating directory %s'),$dest); + $this->nextQuickInfo[] = sprintf($this->l('error when creating directory %s'), $dest); + $this->nextDesc = sprintf($this->l('error when creating directory %s'), $dest); return false; } } - else - // directory already exists + else // directory already exists return true; - } + } else { if (copy($file,$dest)) @@ -903,8 +894,8 @@ $this->standalone = true; else { $this->next = 'error'; - $this->nextQuickInfo[] = sprintf($this->l('error for copy %1$s in %2$s'),$file,$dest); - $this->nextDesc = sprintf($this->l('error for copy %1$s in %2$s'),$file,$dest); + $this->nextQuickInfo[] = sprintf($this->l('error for copy %1$s in %2$s'), $file, $dest); + $this->nextDesc = sprintf($this->l('error for copy %1$s in %2$s'), $file, $dest); return false; } } @@ -941,7 +932,7 @@ $this->standalone = true; if (isset($this->currentParams['firstTime'])) $this->nextDesc = $this->l('Nothing has to be restored'); else - $this->nextDesc = $this->l('All your site is restored... '); + $this->nextDesc = $this->l('All your site is restored... '); } } } @@ -964,28 +955,28 @@ $this->standalone = true; file_put_contents($this->autoupgradePath.DIRECTORY_SEPARATOR.$this->fromArchiveFileList, serialize($fromArchive)); //$this->_cleanUp($this->prodRootDir.'/'); - $this->nextQuickInfo[] = $this->l('root directory cleaned.'); + $this->nextQuickInfo[] = $this->l('root directory cleaned.'); - $filepath = $this->backupFilesFilename; - $destExtract = $this->prodRootDir; + $filepath = $this->backupFilesFilename; + $destExtract = $this->prodRootDir; - if (self::ZipExtract($filepath, $destExtract)) - { + if (self::ZipExtract($filepath, $destExtract)) + { $this->next = 'restoreFiles'; // get new file list $this->nextDesc = $this->l('Files restored. Removing files added by upgrade ...'); - // once it's restored, do not delete the archive file. This has to be done manually - // but we can empty the var, to avoid loop. - $this->backupFilesFilename = ''; - return true; - } - else - { - $this->next = "error"; - $this->nextDesc = sprintf($this->l('unable to extract $1$s into %2$s .'), $filepath, $destExtract); - return false; - } + // once it's restored, do not delete the archive file. This has to be done manually + // but we can empty the var, to avoid loop. + $this->backupFilesFilename = ''; + return true; } + else + { + $this->next = "error"; + $this->nextDesc = sprintf($this->l('unable to extract $1$s into %2$s .'), $filepath, $destExtract); + return false; + } + } // very second restoreFiles step : remove new files that shouldn't be there // for that, we will make a diff between the current filelist in root dir @@ -1013,8 +1004,8 @@ $this->standalone = true; $this->nextQuickInfo[] = $this->l('files from upgrade has been removed.'); break; } - else - { + else + { $checkFile = array_shift($toRemove); // if (in_array($checkFile, $toRemove) @@ -1028,12 +1019,12 @@ $this->standalone = true; } else { - $this->next = 'error'; + $this->next = 'error'; $this->nextDesc = sprintf($this->l('error when removing %1$s'), $file); $this->nextQuickInfo[] = sprintf($this->l('%s not removed'), $file); - return false; - } - } + return false; + } + } } } file_put_contents($this->autoupgradePath.DIRECTORY_SEPARATOR.$this->toRemoveFileList,serialize($toRemove)); @@ -1165,9 +1156,9 @@ $this->standalone = true; eval('Class Backup extends BackupCore{}'); } - if(!defined('_PS_MAGIC_QUOTES_GPC_')) + if (!defined('_PS_MAGIC_QUOTES_GPC_')) define('_PS_MAGIC_QUOTES_GPC_', get_magic_quotes_gpc()); - if(!defined('_PS_MYSQL_REAL_ESCAPE_STRING_')) + if (!defined('_PS_MYSQL_REAL_ESCAPE_STRING_')) define('_PS_MYSQL_REAL_ESCAPE_STRING_', function_exists('mysql_real_escape_string')); Configuration::loadConfiguration(); } @@ -1417,12 +1408,12 @@ $this->standalone = true; if ($res){ if (md5_file(realpath($this->autoupgradePath).DIRECTORY_SEPARATOR.$this->destDownloadFilename) == $this->upgrader->md5 ) { - $this->next = 'unzip'; - $this->nextDesc = $this->l('Download complete. Now extracting'); - } - else - { - $this->next = 'error'; + $this->next = 'unzip'; + $this->nextDesc = $this->l('Download complete. Now extracting'); + } + else + { + $this->next = 'error'; $this->nextDesc = $this->l('Download complete but md5sum does not match. Operation aborted.'); } } @@ -1470,17 +1461,19 @@ $this->standalone = true; */ public function displayConf() { - if(!$this->standalone) - { - if (version_compare(_PS_VERSION_,'1.4.5.0','<') AND false) - $this->_errors[] = Tools::displayError('This class depends of several files modified in 1.4.5.0 version and should not be used in an older version'); - } - parent::displayConf(); + if (version_compare(_PS_VERSION_,'1.4.6.0','<') AND false) + $this->_errors[] = Tools::displayError('This class depends of several files modified in 1.4.5.0 version and should not be used in an older version'); + parent::displayConf(); } public function ajaxPreProcess() { + /* PrestaShop demo mode */ + if (_PS_MODE_DEMO_) + return; + /* PrestaShop demo mode*/ + if (!empty($_POST['responseType']) AND $_POST['responseType'] == 'json') header('Content-Type: application/json'); @@ -1623,35 +1616,35 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where { $srcAutoupgrade = '../img/admin/disabled.gif'; $content .= ''.$this->l('Upgrade available').' : '.''.$this->l('You already have the last version.').'

'; - } + } - if (Configuration::get('PS_SHOP_ENABLE')) - { - $srcShopStatus = '../img/admin/disabled.gif'; - $label = $this->l('No'); - } - else - { - $srcShopStatus = '../img/admin/enabled.gif'; - $label = $this->l('Yes'); - } + if (Configuration::get('PS_SHOP_ENABLE')) + { + $srcShopStatus = '../img/admin/disabled.gif'; + $label = $this->l('No'); + } + else + { + $srcShopStatus = '../img/admin/enabled.gif'; + $label = $this->l('Yes'); + } if (method_exists('Tools','getAdminTokenLite')) $token_preferences = Tools::getAdminTokenLite('AdminPreferences'); else $token_preferences = Tools14::getAdminTokenLite('AdminPreferences'); - $content .= ''.$this->l('Shop desactivated').' : '.''.$label.'

'; - $max_exec_time = ini_get('max_execution_time'); - if ($max_exec_time == 0) - $srcExecTime = '../img/admin/enabled.gif'; - else - $srcExecTime = '../img/admin/warning.gif'; + $content .= ''.$this->l('Shop deactivated').' : '.''.$label.'

'; + $max_exec_time = ini_get('max_execution_time'); + if ($max_exec_time == 0) + $srcExecTime = '../img/admin/enabled.gif'; + else + $srcExecTime = '../img/admin/warning.gif'; $content .= ''.$this->l('PHP time limit').' : '.''.($max_exec_time == 0?$this->l('disabled'):$max_exec_time.' '.$this->l('seconds')).'

'; if ($testConfigDone = (Configuration::get('PS_AUTOUP_DONT_SAVE_IMAGES') !== false)) - $configurationDone = '../img/admin/enabled.gif'; - else - $configurationDone = '../img/admin/disabled.gif'; + $configurationDone = '../img/admin/enabled.gif'; + else + $configurationDone = '../img/admin/disabled.gif'; $content .= ''.$this->l('Options chosen').' : '.' ' .($testConfigDone @@ -1670,9 +1663,9 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where $pleaseUpdate = $this->upgrader->checkPSVersion(); $content .= $this->getCurrentConfiguration(); - $content .= '
'; + $content .= '
'; - $content .= '
'.$this->l('Update').''; + $content .= '
'.$this->l('Update').''; $content .= ''.$this->l('PrestaShop Original version').' : '.' @@ -1710,15 +1703,14 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where $content .= '

'.sprintf($this->l('last datetime check : %s '),date('Y-m-d H:i:s',Configuration::get('PS_LAST_VERSION_CHECK'))).'
'.$this->l('Please click to refresh').' '; + + $content .= ' + - '; - - $content .= '
'; +
'.$this->l('I\'m waiting for your command, sir').'
'; + $content .= ''; + $content .= '
'; if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_ AND $this->manualMode) @@ -1780,6 +1772,15 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where public function display() { + /* PrestaShop demo mode */ + if (_PS_MODE_DEMO_) + { + echo '
'.Tools::displayError('This functionnality has been disabled.').'
'; + return; + } + /* PrestaShop demo mode*/ + + if(isset($_GET['refreshCurrentVersion'])) { $upgrader = new Upgrader(); @@ -1823,10 +1824,10 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where // @todo manual upload with a form // We need jquery 1.6 for json - echo ' - '; + echo ' + '; echo ''; echo ''; @@ -1881,12 +1882,12 @@ function addQuickInfo(arrQuickInfo){ } }'; - if ($this->manualMode) - $js .= 'var manualMode = true;'; - else - $js .= 'var manualMode = false;'; + if ($this->manualMode) + $js .= 'var manualMode = true;'; + else + $js .= 'var manualMode = false;'; - $js .= ' + $js .= ' var firstTimeParams = '.$this->buildAjaxResult().'; firstTimeParams = firstTimeParams.nextParams; firstTimeParams.firstTime = "1"; @@ -1967,15 +1968,15 @@ function handleXMLResult(xmlRet, previousParams) if (result == "ok") { nextParams = previousParams; - nextParams.upgradeDbStep = parseInt(previousParams.upgradeDbStep)+1; - if(nextParams.upgradeDbStep >= 4) - { - resGlobal.next = "upgradeComplete"; - nextParams.typeResult = "json"; - } - else - resGlobal.next = "upgradeDb"; - resGlobal = {next:resGlobal.next,nextParams:nextParams,status:"ok"}; + nextParams.upgradeDbStep = parseInt(previousParams.upgradeDbStep)+1; + if(nextParams.upgradeDbStep >= 4) + { + resGlobal.next = "upgradeComplete"; + nextParams.typeResult = "json"; + } + else + resGlobal.next = "upgradeDb"; + resGlobal = {next:resGlobal.next,nextParams:nextParams,status:"ok"}; } else @@ -2049,7 +2050,7 @@ function doAjaxRequest(action, nextParams){ myNext = nextParams; req = $.ajax({ type:"POST", - url : "'.($this->standalone? __PS_BASE_URI__ . trim($this->adminDir,DIRECTORY_SEPARATOR).'/autoupgrade/ajax-upgradetab.php' : str_replace('index','ajax-tab',$currentIndex)).'", + url : "'. __PS_BASE_URI__ .trim($this->adminDir,DIRECTORY_SEPARATOR).'/autoupgrade/ajax-upgradetab.php'.'", async: true, data : { dir:"'.trim($this->adminDir,DIRECTORY_SEPARATOR).'", @@ -2148,7 +2149,7 @@ function prepareNextButton(button_selector, nextParams) '; if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_) $js .= 'addQuickInfo(["[DEV] request : "+$(this).attr("id")]);'; - $js .= ' + $js .= ' action = button_selector.substr(1); res = doAjaxRequest(action, nextParams); }); @@ -2195,7 +2196,7 @@ function handleError(res) // display error message in the main process thing updateInfoStep(res.nextDesc); addQuickInfo(res.nextQuickInfo); - // In case the rollback button has been desactivated, just re-enable it + // In case the rollback button has been deactivated, just re-enable it prepareNextButton("#rollback",res.nextParams); // ask if you want to rollback // @TODO !!! @@ -2225,7 +2226,7 @@ function handleError(res) }'; -$js.= '$(document).ready(function(){ + $js.= '$(document).ready(function(){ $.ajax({ type:"POST", url : "'. __PS_BASE_URI__ . trim($this->adminDir,DIRECTORY_SEPARATOR).'/autoupgrade/ajax-upgradetab.php", @@ -2241,13 +2242,13 @@ $js.= '$(document).ready(function(){ { res = $.parseJSON(res); answer = res.nextParams; - $("#checkPrestaShopFilesVersion").html(""+answer.msg+" "); + $("#checkPrestaShopFilesVersion").html(" "+answer.msg+" "); if (answer.status == "error") $("#checkPrestaShopFilesVersion").prepend(" "); else { $("#checkPrestaShopFilesVersion").prepend(" "); - $("#checkPrestaShopFilesVersion").append("'.$this->l('See or hide the list').'
"); + $("#checkPrestaShopFilesVersion").append("'.$this->l('See or hide the list').'
"); $("#checkPrestaShopFilesVersion").append("

"); if(answer.result.core.length) addModifiedFileList("'.$this->l('Core file(s)').'", answer.result.core, "changedImportant"); @@ -2256,9 +2257,9 @@ $js.= '$(document).ready(function(){ if(answer.result.translation.length) addModifiedFileList("'.$this->l('Translation file(s)').'", answer.result.translation, "changedNotice"); -$("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedList").toggle();}); + $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedList").toggle();}); $(".toggleSublist").live("click",function(e){e.preventDefault();$(this).parent().next().toggle();}); - } + } } , error: function(res,textStatus,jqXHR) @@ -2277,41 +2278,6 @@ $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedL return $js; } - private function _cleanUp($path) - { - // as we need theses files for restore operation, we can't remove them. - // They will be overwritten - $skipDirs = array('backups', 'pclzip', 'autoupgrade', '.', '..', '.svn'); - $skipFiles = array('autoload.php', 'init.php', 'settings.inc.php', 'config.inc.php', 'Tools.php', 'AdminUpgrade.php'); - $skipFiles[] = $this->standalone?'ajax-upgradetab.php':'ajax-tab.php'; - if (is_dir($path)) - { - $fp = opendir($path); - while ($file = readdir($fp)) - { - if (!in_array($file, $skipDirs) AND !$this->_skipFile('', $path.$file, 'backup')) - { - $fullpath = $path.$file; - if (is_dir($fullpath)) - $this->_cleanUp($fullpath.'/'); - else - { - if (!in_array($file, $skipFiles)) - { - unlink($fullpath); - } - } - } - } - closedir($fp); - /* fortunately not empty dir won't be removed by the following */ - @rmdir($path); - } - else - if (!$this->_skipFile($file, '', 'backup')) unlink($path); - - return true; - } /** * @desc extract a zip file to the given directory @@ -2333,21 +2299,21 @@ $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedL $zip = new ZipArchive(); if ($zip->open($fromFile) === true) { - if(@$zip->extractTo($toDir.'/') + if (@$zip->extractTo($toDir.'/') && $zip->close() ) { - return true; + return true; } else { $this->next = 'error'; $this->nextDesc = '[TECHNICAL ERROR] Error on extract'; } - return false; - } - else - { + return false; + } + else + { $this->next = 'error'; $this->nextDesc = '[TECHNICAL ERROR] Error on zip open'; } diff --git a/override/classes/Tools.php b/override/classes/Tools.php index 78819632d..5a8f424d6 100644 --- a/override/classes/Tools.php +++ b/override/classes/Tools.php @@ -1,6 +1,314 @@ +* @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 ou pas

'.$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($message = null) + { + 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); + } +} +