From b45dd024525c5c786c3b57a2f9f0fda3570d0777 Mon Sep 17 00:00:00 2001 From: tDidierjean Date: Tue, 20 Sep 2011 15:53:57 +0000 Subject: [PATCH] // remove deprecated PS_ADMIN_DIR by _PS_ADMIN_DIR_ git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8666 b9a71923-0436-4b27-9f14-aed3839534dd --- admin-dev/ajax-tab.php | 7 +- admin-dev/ajax.php | 28 +- admin-dev/ajax_category_list.php | 2 +- admin-dev/ajax_lang_packs.php | 4 +- admin-dev/ajax_products_list.php | 4 +- admin-dev/ajax_send_mail_test.php | 2 +- .../ajaxfilemanager/_ajax_load_folders.php | 2 +- .../ajaxfilemanager/ajax_create_folder.php | 15 +- .../ajaxfilemanager/ajax_delete_file.php | 2 +- admin-dev/ajaxfilemanager/ajax_download.php | 2 +- .../ajaxfilemanager/ajax_editor_reset.php | 2 +- admin-dev/ajaxfilemanager/ajax_file_copy.php | 2 +- admin-dev/ajaxfilemanager/ajax_file_cut.php | 2 +- admin-dev/ajaxfilemanager/ajax_file_paste.php | 2 +- .../ajaxfilemanager/ajax_file_upload.php | 2 +- .../ajaxfilemanager/ajax_image_editor.php | 2 +- admin-dev/ajaxfilemanager/ajax_image_save.php | 2 +- .../ajaxfilemanager/ajax_image_thumbnail.php | 2 +- admin-dev/ajaxfilemanager/ajax_image_undo.php | 2 +- admin-dev/ajaxfilemanager/ajax_login.php | 2 +- admin-dev/ajaxfilemanager/ajax_preview.php | 2 +- .../ajaxfilemanager/ajax_save_as_form.php | 2 +- admin-dev/ajaxfilemanager/ajax_save_name.php | 2 +- admin-dev/ajaxfilemanager/ajax_save_text.php | 2 +- .../ajaxfilemanager/ajax_text_editor.php | 2 +- admin-dev/ajaxfilemanager/ajaxfilemanager.php | 2 +- admin-dev/backup.php | 6 +- admin-dev/drawer.php | 2 +- admin-dev/functions.php | 10 +- admin-dev/get-file-admin.php | 2 +- admin-dev/grider.php | 2 +- admin-dev/login.php | 8 +- admin-dev/password.php | 6 +- admin-dev/pdf.php | 4 +- admin-dev/tabs/AdminAccess.php | 2 +- admin-dev/tabs/AdminAddresses.php | 2 +- admin-dev/tabs/AdminAttachments.php | 2 +- admin-dev/tabs/AdminAttributeGenerator.php | 2 +- admin-dev/tabs/AdminAttributes.php | 2 +- admin-dev/tabs/AdminAttributesGroups.php | 4 +- admin-dev/tabs/AdminBackup.php | 12 +- admin-dev/tabs/AdminCMS.php | 2 +- admin-dev/tabs/AdminCMSCategories.php | 2 +- admin-dev/tabs/AdminCMSContent.php | 6 +- admin-dev/tabs/AdminCarriers.php | 2 +- admin-dev/tabs/AdminCarts.php | 2 +- admin-dev/tabs/AdminCatalog.php | 10 +- admin-dev/tabs/AdminContact.php | 4 +- admin-dev/tabs/AdminContacts.php | 2 +- admin-dev/tabs/AdminCountries.php | 2 +- admin-dev/tabs/AdminCurrencies.php | 2 +- admin-dev/tabs/AdminDb.php | 2 +- admin-dev/tabs/AdminEmails.php | 2 +- admin-dev/tabs/AdminFeatures.php | 2 +- admin-dev/tabs/AdminImport.php | 4 +- admin-dev/tabs/AdminInformation.php | 22 +- admin-dev/tabs/AdminLocalization.php | 2 +- admin-dev/tabs/AdminLogs.php | 2 +- admin-dev/tabs/AdminModules.php | 2 +- admin-dev/tabs/AdminOrdersStates.php | 4 +- admin-dev/tabs/AdminPDF.php | 2 +- admin-dev/tabs/AdminPPreferences.php | 2 +- admin-dev/tabs/AdminProducts.php | 2 +- admin-dev/tabs/AdminReferrers.php | 6 +- admin-dev/tabs/AdminSearchConf.php | 2 +- admin-dev/tabs/AdminStatsConf.php | 2 +- admin-dev/tabs/AdminStatsTab.php | 2 +- admin-dev/tabs/AdminStatuses.php | 4 +- admin-dev/tabs/AdminThemes.php | 2 +- admin-dev/tabs/AdminTranslations.php | 242 +++++++++--------- admin-dev/uploadProductFile.php | 4 +- classes/AdminTab.php | 2 +- classes/shop/Shop.php | 8 +- modules/autoupgrade/AdminPreferences.php | 2 +- modules/autoupgrade/AdminSelfTab.php | 4 +- modules/autoupgrade/AdminSelfUpgrade.php | 124 ++++----- modules/autoupgrade/ajax-upgradetab.php | 3 +- modules/autoupgrade/autoupgrade.php | 17 +- modules/autoupgrade/functions.php | 6 +- 79 files changed, 339 insertions(+), 339 deletions(-) diff --git a/admin-dev/ajax-tab.php b/admin-dev/ajax-tab.php index faf9d8df4..eea8aa04a 100755 --- a/admin-dev/ajax-tab.php +++ b/admin-dev/ajax-tab.php @@ -25,8 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -define('_PS_ADMIN_DIR_', getcwd()); -define('PS_ADMIN_DIR', _PS_ADMIN_DIR_); // Retro-compatibility +define('_PS_ADMIN_DIR_', dirname(__FILE__)); include(_PS_ADMIN_DIR_.'/../config/config.inc.php'); include(_PS_ADMIN_DIR_.'/functions.php'); @@ -49,7 +48,7 @@ if (empty($tab) and !sizeof($_POST)) $adminObj->ajax = true; if ($adminObj->checkToken()) { - // the differences with index.php is here + // the differences with index.php is here $adminObj->ajaxPreProcess(); $action = Tools::getValue('action'); @@ -60,7 +59,7 @@ if (empty($tab) and !sizeof($_POST)) $adminObj->{'ajaxProcess'.Tools::toCamelCase($action)}(); else $adminObj->ajaxProcess(); - + // @TODO We should use a displayAjaxError $adminObj->displayErrors(); if (!empty($action) AND method_exists($adminObj, 'displayAjax'.Tools::toCamelCase($action)) ) diff --git a/admin-dev/ajax.php b/admin-dev/ajax.php index bd380c7f4..40992b77f 100644 --- a/admin-dev/ajax.php +++ b/admin-dev/ajax.php @@ -25,8 +25,8 @@ * International Registered Trademark & Property of PrestaShop SA */ -define('PS_ADMIN_DIR', getcwd()); -include(PS_ADMIN_DIR.'/../config/config.inc.php'); +define('_PS_ADMIN_DIR_', getcwd()); +include(_PS_ADMIN_DIR_.'/../config/config.inc.php'); /* Getting cookie or logout */ require_once(dirname(__FILE__).'/init.php'); @@ -363,7 +363,7 @@ if (array_key_exists('ajaxProductImagesPositions', $_POST)) else die('{"hasError" : true, "errors" : "This image cannot be loaded"}'); } - + if (isset($_GET['ajaxProductPackItems'])) { @@ -396,7 +396,7 @@ if (isset($_GET['ajaxStates']) AND isset($_GET['id_country'])) $list = ''; if (Tools::getValue('no_empty') != true) { - $empty_value = (Tools::isSubmit('empty_value')) ? Tools::getValue('empty_value') : '----------'; + $empty_value = (Tools::isSubmit('empty_value')) ? Tools::getValue('empty_value') : '----------'; $list = ''."\n"; } @@ -655,7 +655,7 @@ if (Tools::isSubmit('getAdminHomeElement')) { $content = explode('|', $content); if ($content[0] == 'OK' && Validate::isCleanHtml($content[2]) && Validate::isCleanHtml($content[1])) - { + { $result['partner_preactivation'] = $content[2]; $content[1] = explode('#%#', $content[1]); foreach ($content[1] as $partnerPopUp) @@ -730,9 +730,9 @@ if (Tools::isSubmit('syncImapMail')) OR !$user = Configuration::get('PS_SAV_IMAP_USER') OR !$password = Configuration::get('PS_SAV_IMAP_PWD')) die('{"hasError" : true, "errors" : "Configuration is not correct"}'); - + $mbox = @imap_open('{'.$url.':'.$port.'}', $user, $password); - + $errors = imap_errors(); if (sizeof($errors)) { @@ -745,10 +745,10 @@ if (Tools::isSubmit('syncImapMail')) die('{"hasError" : true, "errors" : ["Can not connect to the mailbox"]}'); $check = imap_check($mbox); - + if ($check->Nmsgs == 0) die('{"hasError" : true, "errors" : ["NO message to sync"]}'); - + $result = imap_fetch_overview($mbox,"1:{$check->Nmsgs}",0); foreach ($result as $overview) { @@ -757,16 +757,16 @@ if (Tools::isSubmit('syncImapMail')) $subject = $overview->subject; else $subject = ''; - + $md5 = md5($overview->date.$overview->from.$subject); $exist = Db::getInstance()->getValue( - 'SELECT md5_header - FROM `'._DB_PREFIX_.'customer_message_sync_imap` + 'SELECT md5_header + FROM `'._DB_PREFIX_.'customer_message_sync_imap` WHERE md5_header = \''.pSQL($md5).'\''); if ($exist) { if (Configuration::get('PS_SAV_IMAP_DELETE_MSG')) - imap_delete($mbox, $overview->msgno); + imap_delete($mbox, $overview->msgno); } else { @@ -778,7 +778,7 @@ if (Tools::isSubmit('syncImapMail')) { //check if order exist in database $ct = new CustomerThread((int)$matches1[1]); - + if (Validate::isLoadedObject($ct) && $ct->token == $matches2[1]) { $cm = new CustomerMessage(); diff --git a/admin-dev/ajax_category_list.php b/admin-dev/ajax_category_list.php index 7e35f8328..1efd73142 100755 --- a/admin-dev/ajax_category_list.php +++ b/admin-dev/ajax_category_list.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ - define('PS_ADMIN_DIR', getcwd()); + define('_PS_ADMIN_DIR_', getcwd()); include_once('../config/config.inc.php'); include_once('tabs/AdminCatalog.php'); include_once('tabs/AdminProducts.php'); diff --git a/admin-dev/ajax_lang_packs.php b/admin-dev/ajax_lang_packs.php index ca36f579e..da46176a5 100644 --- a/admin-dev/ajax_lang_packs.php +++ b/admin-dev/ajax_lang_packs.php @@ -25,8 +25,8 @@ * International Registered Trademark & Property of PrestaShop SA */ -define('PS_ADMIN_DIR', getcwd()); -include(PS_ADMIN_DIR.'/../config/config.inc.php'); +define('_PS_ADMIN_DIR_', getcwd()); +include(_PS_ADMIN_DIR_.'/../config/config.inc.php'); /* Getting cookie or logout */ require_once(dirname(__FILE__).'/init.php'); diff --git a/admin-dev/ajax_products_list.php b/admin-dev/ajax_products_list.php index 734c7c078..ae1587903 100644 --- a/admin-dev/ajax_products_list.php +++ b/admin-dev/ajax_products_list.php @@ -25,8 +25,8 @@ * International Registered Trademark & Property of PrestaShop SA */ -define('PS_ADMIN_DIR', getcwd()); -include(PS_ADMIN_DIR.'/../config/config.inc.php'); +define('_PS_ADMIN_DIR_', getcwd()); +include(_PS_ADMIN_DIR_.'/../config/config.inc.php'); /* Getting cookie or logout */ require_once(dirname(__FILE__).'/init.php'); diff --git a/admin-dev/ajax_send_mail_test.php b/admin-dev/ajax_send_mail_test.php index 908043541..bb040e80f 100644 --- a/admin-dev/ajax_send_mail_test.php +++ b/admin-dev/ajax_send_mail_test.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ -define('PS_ADMIN_DIR', getcwd()); +define('_PS_ADMIN_DIR_', getcwd()); include_once(dirname(__FILE__).'/../config/config.inc.php'); /* Getting cookie or logout */ diff --git a/admin-dev/ajaxfilemanager/_ajax_load_folders.php b/admin-dev/ajaxfilemanager/_ajax_load_folders.php index ac6986890..9ef34f8e8 100755 --- a/admin-dev/ajaxfilemanager/_ajax_load_folders.php +++ b/admin-dev/ajaxfilemanager/_ajax_load_folders.php @@ -1,6 +1,6 @@ diff --git a/admin-dev/ajaxfilemanager/ajax_create_folder.php b/admin-dev/ajaxfilemanager/ajax_create_folder.php index c164d188e..c343ad85e 100755 --- a/admin-dev/ajaxfilemanager/ajax_create_folder.php +++ b/admin-dev/ajaxfilemanager/ajax_create_folder.php @@ -6,16 +6,15 @@ * @since 22/May/2007 * */ - define('PS_ADMIN_DIR', getcwd()); require_once('../../config/config.inc.php'); require_once('../init.php'); - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); @ob_start(); displayArray($_POST); - writeInfo(@ob_get_clean()); + writeInfo(@ob_get_clean()); echo "{"; $error = ""; - $info = ""; + $info = ""; /* $_POST['new_folder'] = substr(md5(time()), 1, 5); $_POST['currentFolderPath'] = "../../uploaded/";*/ if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_NEWFOLDER) @@ -45,12 +44,12 @@ $manager = new manager(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder'], false); $pathInfo = $manager->getFolderInfo(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder']); foreach($pathInfo as $k=>$v) - { + { switch ($k) { - case "ctime"; + case "ctime"; case "mtime": case "atime": $v = date(DATE_TIME_FORMAT, $v); @@ -61,10 +60,10 @@ case 'cssClass': $v = 'folderEmpty'; break; - } + } $info .= sprintf(", %s:'%s'", $k, $v); } - }else + }else { $error = ERR_FOLDER_CREATION_FAILED; } diff --git a/admin-dev/ajaxfilemanager/ajax_delete_file.php b/admin-dev/ajaxfilemanager/ajax_delete_file.php index 575d13186..21f244df9 100755 --- a/admin-dev/ajaxfilemanager/ajax_delete_file.php +++ b/admin-dev/ajaxfilemanager/ajax_delete_file.php @@ -6,7 +6,7 @@ * @since 22/April/2007 * */ - define('PS_ADMIN_DIR', getcwd()); + define('_PS_ADMIN_DIR_', getcwd()); require_once('../../config/config.inc.php'); require_once('../init.php'); require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); diff --git a/admin-dev/ajaxfilemanager/ajax_download.php b/admin-dev/ajaxfilemanager/ajax_download.php index b7ba3bde8..e1defee7f 100755 --- a/admin-dev/ajaxfilemanager/ajax_download.php +++ b/admin-dev/ajaxfilemanager/ajax_download.php @@ -6,7 +6,7 @@ * @since 22/April/2007 * */ - define('PS_ADMIN_DIR', getcwd()); + define('_PS_ADMIN_DIR_', getcwd()); require_once('../../config/config.inc.php'); require_once('../init.php'); require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); diff --git a/admin-dev/ajaxfilemanager/ajax_editor_reset.php b/admin-dev/ajaxfilemanager/ajax_editor_reset.php index e989e9bd2..b6e8c61b0 100755 --- a/admin-dev/ajaxfilemanager/ajax_editor_reset.php +++ b/admin-dev/ajaxfilemanager/ajax_editor_reset.php @@ -6,7 +6,7 @@ * @since 22/May/2007 * */ - define('PS_ADMIN_DIR', getcwd()); + define('_PS_ADMIN_DIR_', getcwd()); require_once('../../config/config.inc.php'); require_once('../init.php'); require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); diff --git a/admin-dev/ajaxfilemanager/ajax_file_copy.php b/admin-dev/ajaxfilemanager/ajax_file_copy.php index eb4b59fc9..c190de625 100755 --- a/admin-dev/ajaxfilemanager/ajax_file_copy.php +++ b/admin-dev/ajaxfilemanager/ajax_file_copy.php @@ -6,7 +6,7 @@ * @since 22/May/2007 * */ - define('PS_ADMIN_DIR', getcwd()); + define('_PS_ADMIN_DIR_', getcwd()); require_once('../../config/config.inc.php'); require_once('../init.php'); require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); diff --git a/admin-dev/ajaxfilemanager/ajax_file_cut.php b/admin-dev/ajaxfilemanager/ajax_file_cut.php index d9db2e949..ad0036abb 100755 --- a/admin-dev/ajaxfilemanager/ajax_file_cut.php +++ b/admin-dev/ajaxfilemanager/ajax_file_cut.php @@ -6,7 +6,7 @@ * @since 22/May/2007 * */ - define('PS_ADMIN_DIR', getcwd()); + define('_PS_ADMIN_DIR_', getcwd()); require_once('../../config/config.inc.php'); require_once('../init.php'); require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); diff --git a/admin-dev/ajaxfilemanager/ajax_file_paste.php b/admin-dev/ajaxfilemanager/ajax_file_paste.php index 229caebc5..a55557f0c 100755 --- a/admin-dev/ajaxfilemanager/ajax_file_paste.php +++ b/admin-dev/ajaxfilemanager/ajax_file_paste.php @@ -1,6 +1,6 @@ employee->isLoggedBack()) Tools::redirectAdmin('login.php'); @@ -37,7 +37,7 @@ $tabAccess = Profile::getProfileAccess(Context::getContext()->employee->id_profi if ($tabAccess['view'] !== '1') die (Tools::displayError('You do not have permission to view here')); -$backupdir = realpath( PS_ADMIN_DIR . '/backups/'); +$backupdir = realpath(_PS_ADMIN_DIR_ . '/backups/'); if ($backupdir === false) die (Tools::displayError('Backups directory does not exist.')); diff --git a/admin-dev/drawer.php b/admin-dev/drawer.php index 38ca6ffae..d5bbfe853 100644 --- a/admin-dev/drawer.php +++ b/admin-dev/drawer.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -define('PS_ADMIN_DIR', getcwd()); +define('_PS_ADMIN_DIR_', getcwd()); include_once(dirname(__FILE__).'/../config/config.inc.php'); $module = Tools::getValue('module'); diff --git a/admin-dev/functions.php b/admin-dev/functions.php index d7c618206..bd1a320ef 100644 --- a/admin-dev/functions.php +++ b/admin-dev/functions.php @@ -98,7 +98,7 @@ function rewriteSettingsFile($baseUrls = NULL, $theme = NULL, $arrayDB = NULL) foreach ($defines as $k => $value) $content .= 'define(\''.$k.'\', \''.addslashes($value).'\');'."\n"; $content .= "\n?>"; - if ($fd = @fopen(PS_ADMIN_DIR.'/../config/settings.inc.php', 'w')) + if ($fd = @fopen(_PS_ADMIN_DIR_.'/../config/settings.inc.php', 'w')) { fwrite($fd, $content); fclose($fd); @@ -255,9 +255,8 @@ function checkingTab($tab) } if ($row['module'] AND file_exists(_PS_MODULE_DIR_.'/'.$row['module'].'/'.$tab.'.php')) include_once(_PS_MODULE_DIR_.'/'.$row['module'].'/'.$tab.'.php'); - elseif (file_exists(PS_ADMIN_DIR.'/tabs/'.$tab.'.php')) - include_once(PS_ADMIN_DIR.'/tabs/'.$tab.'.php'); - + elseif (file_exists(_PS_ADMIN_DIR_.'/tabs/'.$tab.'.php')) + include_once(_PS_ADMIN_DIR_.'/tabs/'.$tab.'.php'); if (!class_exists($tab, false) OR !$row['id_tab']) { echo Tools::displayError('Tab file cannot be found.'); @@ -273,6 +272,9 @@ function checkingTab($tab) return $adminObj; } +/** + * @TODO deprecate for Tab::checkTabRights() + */ function checkTabRights($id_tab) { static $tabAccesses = NULL; diff --git a/admin-dev/get-file-admin.php b/admin-dev/get-file-admin.php index 077b167d3..61c06b289 100644 --- a/admin-dev/get-file-admin.php +++ b/admin-dev/get-file-admin.php @@ -25,6 +25,6 @@ * International Registered Trademark & Property of PrestaShop SA */ -define('PS_ADMIN_DIR', getcwd()); +define('_PS_ADMIN_DIR_', getcwd()); require(dirname(dirname(__FILE__)).'/config/config.inc.php'); Controller::getController('getFileController')->run(); \ No newline at end of file diff --git a/admin-dev/grider.php b/admin-dev/grider.php index b0b384bb4..3b002405e 100644 --- a/admin-dev/grider.php +++ b/admin-dev/grider.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -define('PS_ADMIN_DIR', getcwd()); +define('_PS_ADMIN_DIR_', getcwd()); include_once(dirname(__FILE__).'/../config/config.inc.php'); $module = Tools::getValue('module'); diff --git a/admin-dev/login.php b/admin-dev/login.php index f4df1a8c9..366f4ccf6 100644 --- a/admin-dev/login.php +++ b/admin-dev/login.php @@ -26,10 +26,10 @@ */ ob_start(); -define('PS_ADMIN_DIR', getcwd()); +define('_PS_ADMIN_DIR_', getcwd()); -include(PS_ADMIN_DIR.'/../config/config.inc.php'); -include(PS_ADMIN_DIR.'/functions.php'); +include(_PS_ADMIN_DIR_.'/../config/config.inc.php'); +include(_PS_ADMIN_DIR_.'/functions.php'); $clientIsMaintenanceOrLocal = in_array(Tools::getRemoteAddr(), array_merge(array('127.0.0.1'),explode(',', Configuration::get('PS_MAINTENANCE_IP')))); @@ -142,7 +142,7 @@ echo '
'; $randomNb = rand(100, 999); -if(file_exists(PS_ADMIN_DIR.'/../install') OR file_exists(PS_ADMIN_DIR.'/../admin')) +if(file_exists(_PS_ADMIN_DIR_.'/../install') OR file_exists(_PS_ADMIN_DIR_.'/../admin')) { echo ' '.translate('For security reasons, you cannot connect to the Back Office until after you have:').'

- '.translate('delete the /install folder').'
diff --git a/admin-dev/password.php b/admin-dev/password.php index 0fc59ce20..e8ac846dc 100644 --- a/admin-dev/password.php +++ b/admin-dev/password.php @@ -25,10 +25,10 @@ * International Registered Trademark & Property of PrestaShop SA */ -define('PS_ADMIN_DIR', getcwd()); +define('_PS_ADMIN_DIR_', getcwd()); -include(PS_ADMIN_DIR.'/../config/config.inc.php'); -include(PS_ADMIN_DIR.'/functions.php'); +include(_PS_ADMIN_DIR_.'/../config/config.inc.php'); +include(_PS_ADMIN_DIR_.'/functions.php'); $errors = array(); diff --git a/admin-dev/pdf.php b/admin-dev/pdf.php index c1116e983..4fa1ea20c 100644 --- a/admin-dev/pdf.php +++ b/admin-dev/pdf.php @@ -25,9 +25,9 @@ * International Registered Trademark & Property of PrestaShop SA */ -define('PS_ADMIN_DIR', getcwd()); +define('_PS_ADMIN_DIR_', getcwd()); -include(PS_ADMIN_DIR.'/../config/config.inc.php'); +include(_PS_ADMIN_DIR_.'/../config/config.inc.php'); if (!Context::getContext()->employee->id) Tools::redirectAdmin('login.php'); diff --git a/admin-dev/tabs/AdminAccess.php b/admin-dev/tabs/AdminAccess.php index 3f669d13d..141226d1d 100644 --- a/admin-dev/tabs/AdminAccess.php +++ b/admin-dev/tabs/AdminAccess.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); class AdminAccess extends AdminTab { diff --git a/admin-dev/tabs/AdminAddresses.php b/admin-dev/tabs/AdminAddresses.php index 0489f0579..ea2142347 100644 --- a/admin-dev/tabs/AdminAddresses.php +++ b/admin-dev/tabs/AdminAddresses.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); if(Configuration::get('VATNUMBER_MANAGEMENT') AND file_exists(_PS_MODULE_DIR_.'vatnumber/vatnumber.php')) include_once(_PS_MODULE_DIR_.'vatnumber/vatnumber.php'); diff --git a/admin-dev/tabs/AdminAttachments.php b/admin-dev/tabs/AdminAttachments.php index fe7064623..e255d8c4c 100644 --- a/admin-dev/tabs/AdminAttachments.php +++ b/admin-dev/tabs/AdminAttachments.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); class AdminAttachments extends AdminTab { diff --git a/admin-dev/tabs/AdminAttributeGenerator.php b/admin-dev/tabs/AdminAttributeGenerator.php index c76c61a45..2ebd91044 100644 --- a/admin-dev/tabs/AdminAttributeGenerator.php +++ b/admin-dev/tabs/AdminAttributeGenerator.php @@ -26,7 +26,7 @@ */ @ini_set('max_execution_time', 3600); -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); class AdminAttributeGenerator extends AdminTab { diff --git a/admin-dev/tabs/AdminAttributes.php b/admin-dev/tabs/AdminAttributes.php index 0547b7c8a..e034a3f2b 100644 --- a/admin-dev/tabs/AdminAttributes.php +++ b/admin-dev/tabs/AdminAttributes.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); class AdminAttributes extends AdminTab { diff --git a/admin-dev/tabs/AdminAttributesGroups.php b/admin-dev/tabs/AdminAttributesGroups.php index 5022a97e4..2541fc414 100644 --- a/admin-dev/tabs/AdminAttributesGroups.php +++ b/admin-dev/tabs/AdminAttributesGroups.php @@ -25,8 +25,8 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); -include_once(PS_ADMIN_DIR.'/tabs/AdminAttributes.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); +include_once(_PS_ADMIN_DIR_.'/tabs/AdminAttributes.php'); class AdminAttributesGroups extends AdminTab { diff --git a/admin-dev/tabs/AdminBackup.php b/admin-dev/tabs/AdminBackup.php index 66871184e..e3612e210 100644 --- a/admin-dev/tabs/AdminBackup.php +++ b/admin-dev/tabs/AdminBackup.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); class AdminBackup extends AdminTab { @@ -87,7 +87,7 @@ class AdminBackup extends AdminTab */ public function displayForm($isMainTab = true) { - if(is_writable(PS_ADMIN_DIR.'/backups/')) + if(is_writable(_PS_ADMIN_DIR_.'/backups/')) { if (!($object = $this->loadObject())) return; @@ -179,7 +179,7 @@ class AdminBackup extends AdminTab public function displayList() { // Test if the backup dir is writable - if(!is_writable(PS_ADMIN_DIR.'/backups/')) + if(!is_writable(_PS_ADMIN_DIR_.'/backups/')) $this->displayWarning($this->l('"Backups" Directory in admin directory must be writeable (CHMOD 755 / 777)')); $this->displayErrors(); @@ -235,10 +235,10 @@ class AdminBackup extends AdminTab $this->_list = array(); // Find all the backups - $dh = @opendir(PS_ADMIN_DIR.'/backups/'); + $dh = @opendir(_PS_ADMIN_DIR_.'/backups/'); if ($dh === false) { - $this->_errors[] = Tools::displayError('Unable to open backup directory .').addslashes(PS_ADMIN_DIR.'/backups/').'"'; + $this->_errors[] = Tools::displayError('Unable to open backup directory .').addslashes(_PS_ADMIN_DIR_.'/backups/').'"'; return; } while (($file = readdir($dh)) !== false) @@ -260,7 +260,7 @@ class AdminBackup extends AdminTab $age = floor($age / 86400); $age = $age.' '.(($age == 1) ? $this->l('day') : $this->l('days')); } - $size = filesize(PS_ADMIN_DIR.'/backups/'.$file); + $size = filesize(_PS_ADMIN_DIR_.'/backups/'.$file); $this->_list[] = array( 'filename' => $file, 'age' => $age, diff --git a/admin-dev/tabs/AdminCMS.php b/admin-dev/tabs/AdminCMS.php index df35ead49..8e133f68c 100644 --- a/admin-dev/tabs/AdminCMS.php +++ b/admin-dev/tabs/AdminCMS.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); class AdminCMS extends AdminTab { diff --git a/admin-dev/tabs/AdminCMSCategories.php b/admin-dev/tabs/AdminCMSCategories.php index 1d6aa57d6..7a5b0538e 100644 --- a/admin-dev/tabs/AdminCMSCategories.php +++ b/admin-dev/tabs/AdminCMSCategories.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); class AdminCMSCategories extends AdminTab { diff --git a/admin-dev/tabs/AdminCMSContent.php b/admin-dev/tabs/AdminCMSContent.php index 7e117437a..4d65a6b2b 100644 --- a/admin-dev/tabs/AdminCMSContent.php +++ b/admin-dev/tabs/AdminCMSContent.php @@ -25,9 +25,9 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); -include(PS_ADMIN_DIR.'/tabs/AdminCMSCategories.php'); -include(PS_ADMIN_DIR.'/tabs/AdminCMS.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); +include(_PS_ADMIN_DIR_.'/tabs/AdminCMSCategories.php'); +include(_PS_ADMIN_DIR_.'/tabs/AdminCMS.php'); class AdminCMSContent extends AdminTab { diff --git a/admin-dev/tabs/AdminCarriers.php b/admin-dev/tabs/AdminCarriers.php index 76bbd0745..45de6569b 100644 --- a/admin-dev/tabs/AdminCarriers.php +++ b/admin-dev/tabs/AdminCarriers.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); class AdminCarriers extends AdminTab { diff --git a/admin-dev/tabs/AdminCarts.php b/admin-dev/tabs/AdminCarts.php index 25e041a04..27c398fc0 100644 --- a/admin-dev/tabs/AdminCarts.php +++ b/admin-dev/tabs/AdminCarts.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); class AdminCarts extends AdminTab { diff --git a/admin-dev/tabs/AdminCatalog.php b/admin-dev/tabs/AdminCatalog.php index ab0b59475..b1262aad3 100644 --- a/admin-dev/tabs/AdminCatalog.php +++ b/admin-dev/tabs/AdminCatalog.php @@ -25,9 +25,9 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); -include(PS_ADMIN_DIR.'/tabs/AdminCategories.php'); -include(PS_ADMIN_DIR.'/tabs/AdminProducts.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); +include(_PS_ADMIN_DIR_.'/tabs/AdminCategories.php'); +include(_PS_ADMIN_DIR_.'/tabs/AdminProducts.php'); class AdminCatalog extends AdminTab { @@ -105,7 +105,7 @@ class AdminCatalog extends AdminTab { if (!isset($this->attributeGenerator)) { - include_once(PS_ADMIN_DIR.'/tabs/AdminAttributeGenerator.php'); + include_once(_PS_ADMIN_DIR_.'/tabs/AdminAttributeGenerator.php'); $this->attributeGenerator = new AdminAttributeGenerator(); } $this->attributeGenerator->postProcess(); @@ -153,7 +153,7 @@ class AdminCatalog extends AdminTab { if (!isset($this->attributeGenerator)) { - include_once(PS_ADMIN_DIR.'/tabs/AdminAttributeGenerator.php'); + include_once(_PS_ADMIN_DIR_.'/tabs/AdminAttributeGenerator.php'); $this->attributeGenerator = new AdminAttributeGenerator(); } $this->attributeGenerator->displayForm(); diff --git a/admin-dev/tabs/AdminContact.php b/admin-dev/tabs/AdminContact.php index cfba3ebdb..b15f3e627 100644 --- a/admin-dev/tabs/AdminContact.php +++ b/admin-dev/tabs/AdminContact.php @@ -25,8 +25,8 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); -include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); +include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php'); class AdminContact extends AdminPreferences { diff --git a/admin-dev/tabs/AdminContacts.php b/admin-dev/tabs/AdminContacts.php index 67409e576..eb5271e6c 100644 --- a/admin-dev/tabs/AdminContacts.php +++ b/admin-dev/tabs/AdminContacts.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); class AdminContacts extends AdminTab { diff --git a/admin-dev/tabs/AdminCountries.php b/admin-dev/tabs/AdminCountries.php index d5bbe97ac..c1b501bce 100644 --- a/admin-dev/tabs/AdminCountries.php +++ b/admin-dev/tabs/AdminCountries.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); class AdminCountries extends AdminTab { diff --git a/admin-dev/tabs/AdminCurrencies.php b/admin-dev/tabs/AdminCurrencies.php index 610aedecd..3ffec7c49 100644 --- a/admin-dev/tabs/AdminCurrencies.php +++ b/admin-dev/tabs/AdminCurrencies.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); class AdminCurrencies extends AdminTab { diff --git a/admin-dev/tabs/AdminDb.php b/admin-dev/tabs/AdminDb.php index 333886770..9586a7908 100644 --- a/admin-dev/tabs/AdminDb.php +++ b/admin-dev/tabs/AdminDb.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php'); +include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php'); class AdminDb extends AdminPreferences { diff --git a/admin-dev/tabs/AdminEmails.php b/admin-dev/tabs/AdminEmails.php index 1a141f30f..45ee96040 100644 --- a/admin-dev/tabs/AdminEmails.php +++ b/admin-dev/tabs/AdminEmails.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php'); +include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php'); class AdminEmails extends AdminPreferences { diff --git a/admin-dev/tabs/AdminFeatures.php b/admin-dev/tabs/AdminFeatures.php index cfda801a5..8f55c54b4 100644 --- a/admin-dev/tabs/AdminFeatures.php +++ b/admin-dev/tabs/AdminFeatures.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/tabs/AdminFeaturesValues.php'); +include_once(_PS_ADMIN_DIR_.'/tabs/AdminFeaturesValues.php'); class AdminFeatures extends AdminTab { diff --git a/admin-dev/tabs/AdminImport.php b/admin-dev/tabs/AdminImport.php index 0d8551480..13b663c55 100644 --- a/admin-dev/tabs/AdminImport.php +++ b/admin-dev/tabs/AdminImport.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../images.inc.php'); +include_once(_PS_ADMIN_DIR_.'/../images.inc.php'); @ini_set('max_execution_time', 0); // No max line limit since the lines can be more than 4096. Performance impact is not significant. define('MAX_LINE_SIZE', 0); @@ -1325,7 +1325,7 @@ class AdminImport extends AdminTab if ((Tools::getValue('import')) AND (isset($this->_warnings) AND !sizeof($this->_warnings))) echo '
'.$this->l('The .CSV file has been imported into your shop.').'
'; - if(!is_writable(PS_ADMIN_DIR.'/import/')) + if(!is_writable(_PS_ADMIN_DIR_.'/import/')) $this->displayWarning($this->l('directory import on admin directory must be writable (CHMOD 755 / 777)')); if(isset($this->_warnings) AND sizeof($this->_warnings)) diff --git a/admin-dev/tabs/AdminInformation.php b/admin-dev/tabs/AdminInformation.php index 55e0e9d19..fbb2e18cc 100644 --- a/admin-dev/tabs/AdminInformation.php +++ b/admin-dev/tabs/AdminInformation.php @@ -40,17 +40,17 @@ class AdminInformation extends AdminTab 'system' => $funcs, 'gd' => false, 'mysql_support' => false, - 'config_dir' => PS_ADMIN_DIR.'/../config/', - 'tools_dir' => PS_ADMIN_DIR.'/../tools/smarty/compile', - 'cache_dir' => PS_ADMIN_DIR.'/../tools/smarty/cache/', - 'sitemap' => PS_ADMIN_DIR.'/../sitemap.xml', - 'img_dir' => PS_ADMIN_DIR.'/../img/', - 'mails_dir' => PS_ADMIN_DIR.'/../mails/', - 'module_dir' => PS_ADMIN_DIR.'/../modules/', - 'theme_lang_dir' => PS_ADMIN_DIR.'/../themes/'._THEME_NAME_.'/lang/', - 'translations_dir' => PS_ADMIN_DIR.'/../translations/', - 'customizable_products_dir' => PS_ADMIN_DIR.'/../upload/', - 'virtual_products_dir' => PS_ADMIN_DIR.'/../download/' + 'config_dir' => _PS_ADMIN_DIR_.'/../config/', + 'tools_dir' => _PS_ADMIN_DIR_.'/../tools/smarty/compile', + 'cache_dir' => _PS_ADMIN_DIR_.'/../tools/smarty/cache/', + 'sitemap' => _PS_ADMIN_DIR_.'/../sitemap.xml', + 'img_dir' => _PS_ADMIN_DIR_.'/../img/', + 'mails_dir' => _PS_ADMIN_DIR_.'/../mails/', + 'module_dir' => _PS_ADMIN_DIR_.'/../modules/', + 'theme_lang_dir' => _PS_ADMIN_DIR_.'/../themes/'._THEME_NAME_.'/lang/', + 'translations_dir' => _PS_ADMIN_DIR_.'/../translations/', + 'customizable_products_dir' => _PS_ADMIN_DIR_.'/../upload/', + 'virtual_products_dir' => _PS_ADMIN_DIR_.'/../download/' ); $tests_op = array( diff --git a/admin-dev/tabs/AdminLocalization.php b/admin-dev/tabs/AdminLocalization.php index 6586255e2..cc1d409ce 100644 --- a/admin-dev/tabs/AdminLocalization.php +++ b/admin-dev/tabs/AdminLocalization.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php'); +include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php'); class AdminLocalization extends AdminPreferences { diff --git a/admin-dev/tabs/AdminLogs.php b/admin-dev/tabs/AdminLogs.php index 3ae2f3375..86bdfe9bc 100644 --- a/admin-dev/tabs/AdminLogs.php +++ b/admin-dev/tabs/AdminLogs.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); +include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php'); class AdminLogs extends AdminTab { diff --git a/admin-dev/tabs/AdminModules.php b/admin-dev/tabs/AdminModules.php index 7a43a9260..6ac3a3f85 100644 --- a/admin-dev/tabs/AdminModules.php +++ b/admin-dev/tabs/AdminModules.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/../tools/tar/Archive_Tar.php'); +include_once(_PS_ADMIN_DIR_.'/../tools/tar/Archive_Tar.php'); class AdminModules extends AdminTab { diff --git a/admin-dev/tabs/AdminOrdersStates.php b/admin-dev/tabs/AdminOrdersStates.php index dbbde9014..834c0ae35 100644 --- a/admin-dev/tabs/AdminOrdersStates.php +++ b/admin-dev/tabs/AdminOrdersStates.php @@ -96,9 +96,9 @@ class AdminOrdersStates extends AdminTab private function getTemplates($iso_code) { $array = array(); - if (!file_exists(PS_ADMIN_DIR.'/../mails/'.$iso_code)) + if (!file_exists(_PS_ADMIN_DIR_.'/../mails/'.$iso_code)) return false; - $templates = scandir(PS_ADMIN_DIR.'/../mails/'.$iso_code); + $templates = scandir(_PS_ADMIN_DIR_.'/../mails/'.$iso_code); foreach ($templates AS $template) if (!strncmp(strrev($template), 'lmth.', 5)) $array[] = substr($template, 0, -5); diff --git a/admin-dev/tabs/AdminPDF.php b/admin-dev/tabs/AdminPDF.php index 155a6ea07..a4d7f9b9c 100644 --- a/admin-dev/tabs/AdminPDF.php +++ b/admin-dev/tabs/AdminPDF.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php'); +include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php'); class AdminPDF extends AdminPreferences { diff --git a/admin-dev/tabs/AdminPPreferences.php b/admin-dev/tabs/AdminPPreferences.php index 18598ff96..c33d6b57d 100644 --- a/admin-dev/tabs/AdminPPreferences.php +++ b/admin-dev/tabs/AdminPPreferences.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php'); +include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php'); class AdminPPreferences extends AdminPreferences { diff --git a/admin-dev/tabs/AdminProducts.php b/admin-dev/tabs/AdminProducts.php index abcedc299..f956c314e 100644 --- a/admin-dev/tabs/AdminProducts.php +++ b/admin-dev/tabs/AdminProducts.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/tabs/AdminProfiles.php'); +include_once(_PS_ADMIN_DIR_.'/tabs/AdminProfiles.php'); class AdminProducts extends AdminTab { diff --git a/admin-dev/tabs/AdminReferrers.php b/admin-dev/tabs/AdminReferrers.php index 28084cddd..e87e9274f 100644 --- a/admin-dev/tabs/AdminReferrers.php +++ b/admin-dev/tabs/AdminReferrers.php @@ -25,9 +25,9 @@ * International Registered Trademark & Property of PrestaShop SA */ -if (!defined('PS_ADMIN_DIR')) define('PS_ADMIN_DIR', getcwd().'/..'); -include_once(PS_ADMIN_DIR.'/../config/config.inc.php'); -include_once(PS_ADMIN_DIR.'/init.php'); +if (!defined('_PS_ADMIN_DIR_')) define('_PS_ADMIN_DIR_', getcwd().'/..'); +include_once(_PS_ADMIN_DIR_.'/../config/config.inc.php'); +include_once(_PS_ADMIN_DIR_.'/init.php'); if (Tools::getValue('token') == Tools::getAdminToken('AdminReferrers'.(int)(Tab::getIdFromClassName('AdminReferrers')).(int)(Tools::getValue('id_employee')))) { diff --git a/admin-dev/tabs/AdminSearchConf.php b/admin-dev/tabs/AdminSearchConf.php index feb4927b2..7c2c859ea 100644 --- a/admin-dev/tabs/AdminSearchConf.php +++ b/admin-dev/tabs/AdminSearchConf.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php'); +include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php'); class AdminSearchConf extends AdminPreferences { diff --git a/admin-dev/tabs/AdminStatsConf.php b/admin-dev/tabs/AdminStatsConf.php index 2c6e62d71..882ee5755 100644 --- a/admin-dev/tabs/AdminStatsConf.php +++ b/admin-dev/tabs/AdminStatsConf.php @@ -26,7 +26,7 @@ */ include_once(dirname(__FILE__).'/AdminStatsTab.php'); -include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php'); +include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php'); class AdminStatsConf extends AdminPreferences { diff --git a/admin-dev/tabs/AdminStatsTab.php b/admin-dev/tabs/AdminStatsTab.php index b2d1a184c..956cf71f8 100644 --- a/admin-dev/tabs/AdminStatsTab.php +++ b/admin-dev/tabs/AdminStatsTab.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php'); +include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php'); abstract class AdminStatsTab extends AdminPreferences { diff --git a/admin-dev/tabs/AdminStatuses.php b/admin-dev/tabs/AdminStatuses.php index 4e6083909..dd6109946 100644 --- a/admin-dev/tabs/AdminStatuses.php +++ b/admin-dev/tabs/AdminStatuses.php @@ -25,8 +25,8 @@ * International Registered Trademark & Property of PrestaShop SA */ -include(PS_ADMIN_DIR.'/tabs/AdminOrdersStates.php'); -include(PS_ADMIN_DIR.'/tabs/AdminReturnStates.php'); +include(_PS_ADMIN_DIR_.'/tabs/AdminOrdersStates.php'); +include(_PS_ADMIN_DIR_.'/tabs/AdminReturnStates.php'); class AdminStatuses extends AdminTab { diff --git a/admin-dev/tabs/AdminThemes.php b/admin-dev/tabs/AdminThemes.php index 5d4de0141..f80aa2caf 100644 --- a/admin-dev/tabs/AdminThemes.php +++ b/admin-dev/tabs/AdminThemes.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php'); +include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php'); class AdminThemes extends AdminPreferences { diff --git a/admin-dev/tabs/AdminTranslations.php b/admin-dev/tabs/AdminTranslations.php index a0fe7af16..498770a6d 100644 --- a/admin-dev/tabs/AdminTranslations.php +++ b/admin-dev/tabs/AdminTranslations.php @@ -1,6 +1,6 @@ l\(\''._PS_TRANS_PATTERN_.'\'(, ?\'(.+)\')?(, ?(.+))?\)/U'; } - + /** - * This method merge each arrays of modules translation in + * This method merge each arrays of modules translation in * the array of modules translations - * + * * @param boolean $is_default if true a prefix is set before each keys in global $_MODULES array */ protected function getModuleTranslations($is_default = false) @@ -80,15 +80,15 @@ class AdminTranslations extends AdminTab $_MODULES = (is_array($_MODULES) AND is_array($_MODULE)) ? array_merge($_MODULES, $_MODULE) : $_MODULE; } } - + /** * This method is only used by AdminTranslations::submitCopyLang(). - * + * * It try to create folder in new theme. - * + * * When a translation file is copied for a module, its translation key is wrong. * We have to change the translation key and rewrite the file. - * + * * @param string $dest file name * @return bool */ @@ -151,7 +151,7 @@ class AdminTranslations extends AdminTab { $bool &= $this->checkDirAndCreate($dest); $bool &= @copy($source, $dest); - + if (strpos($dest, 'modules') AND basename($source) === $fromLang.'.php' AND $bool !== false) { $bool &= $this->changeModulesKeyTranslation($dest, $fromTheme, $toTheme); @@ -161,10 +161,10 @@ class AdminTranslations extends AdminTab Tools::redirectAdmin(self::$currentIndex.'&conf=14&token='.$this->token); $this->_errors[] = $this->l('a part of the data has been copied but some language files could not be found or copied'); } - + /** * Change the key translation to according it to theme name. - * + * * @param string $path * @param string $theme_from * @param string $theme_to @@ -200,7 +200,7 @@ class AdminTranslations extends AdminTab } $this->_errors[] = Tools::displayError('Please choose a language and theme.'); } - + public function checkAndAddMailsFiles ($iso_code, $files_list) { $mails = scandir(_PS_MAIL_DIR_.'en/'); @@ -244,7 +244,7 @@ class AdminTranslations extends AdminTab $this->_errors[] = Tools::displayError('Archive cannot be extracted.'); } } - + public function submitAddLang() { $arr_import_lang = explode('|', Tools::getValue('params_import_language')); /* 0 = Language ISO code, 1 = PS version */ @@ -279,11 +279,11 @@ class AdminTranslations extends AdminTab else $this->_errors[] = Tools::displayError('Invalid parameter'); } - + /** * This method check each file (tpl or php file), get its sentences to translate, * compare with posted values and write in iso code translation file. - * + * * @param string $file_name * @param array $files * @param string $theme_name @@ -297,10 +297,10 @@ class AdminTranslations extends AdminTab static $_cache_file = array(); static $str_write = ''; static $array_check_duplicate = array(); - + // Default translations and Prestashop overriding themes are distinguish $is_default = $theme_name === self::DEFAULT_THEME_NAME ? true : false; - + // Set file_name in static var, this allow to open and wright the file just one time if (!isset($_cache_file[($is_default ? self::DEFAULT_THEME_NAME : $theme_name).'-'.$file_name]) ) { @@ -310,15 +310,15 @@ class AdminTranslations extends AdminTab file_put_contents($file_name, ''); if (!is_writable($file_name)) die ($this->l('Cannot write the theme\'s language file ').'('.$file_name.')'.$this->l('. Please check write permissions.')); - + // this string is initialized one time for a file $str_write .= "'.Tools::strtolower($template_name).'_'.md5($key); @@ -519,7 +519,7 @@ class AdminTranslations extends AdminTab $array_lang_src = Language::getLanguages(false); foreach ($array_lang_src as $language) $this->all_iso_lang[] = $language['iso_code']; - + $lang = Tools::strtolower($_POST['lang']); if (!Validate::isLanguageIsoCode($lang)) die(Tools::displayError()); @@ -530,14 +530,14 @@ class AdminTranslations extends AdminTab $arr_find_and_write = array(); $arr_files = $this->getAllModuleFiles($modules, _PS_MODULE_DIR_, $lang, true); $arr_find_and_write = array_merge($arr_find_and_write, $arr_files); - + if(file_exists(_PS_THEME_DIR_.'/modules/')) { $modules = scandir(_PS_THEME_DIR_.'/modules/'); $arr_files = $this->getAllModuleFiles($modules, _PS_THEME_DIR_.'modules/', $lang); $arr_find_and_write = array_merge($arr_find_and_write, $arr_files); } - + foreach ($arr_find_and_write as $key=>$value) $this->findAndWriteTranslationsIntoFile($value['file_name'], $value['files'], $value['theme'], $value['module'], $value['dir']); Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); @@ -563,17 +563,17 @@ class AdminTranslations extends AdminTab } /** * This method is used to wright translation for mails. - * This wrights subject translation files + * This wrights subject translation files * (in root/mails/lang_choosen/lang.php or root/_PS_THEMES_DIR_/mails/lang_choosen/lang.php) - * and mails files. - * + * and mails files. + * * @param int $id_lang */ protected function submitTranslationsMails ($id_lang) { $obj_lang = new Language($id_lang); $params_redirect = (Tools::isSubmit('submitTranslationsMailsAndStay') ? '&lang='.Tools::getValue('lang').'&type='.Tools::getValue('type') : ''); - + $arr_mail_content = array(); $arr_mail_path = array(); if (Tools::getValue('core_mail')) { @@ -592,7 +592,7 @@ class AdminTranslations extends AdminTab $arr_mail_content['theme_module_mail'] = Tools::getValue('theme_module_mail'); $arr_mail_path['theme_module_mail'] = _PS_THEME_DIR_.'modules/{module}'.'/mails/'.$obj_lang->iso_code.'/'; } - + // Save each mail content foreach ($arr_mail_content as $group_name=>$all_content) { @@ -600,7 +600,7 @@ class AdminTranslations extends AdminTab { foreach ($mails as $mail_name=>$content) { - + $module_name = false; $module_name_pipe_pos = stripos($mail_name, '|'); if ($module_name_pipe_pos) @@ -608,14 +608,14 @@ class AdminTranslations extends AdminTab $module_name = substr($mail_name, 0, $module_name_pipe_pos); $mail_name = substr($mail_name, $module_name_pipe_pos+1); } - + if ($type_content == 'html') { $content = Tools::htmlentitiesUTF8($content); $content = htmlspecialchars_decode($content); // replace correct end of line $content = str_replace("\r\n", PHP_EOL, $content); - + $title = ''; if (Tools::getValue('title_'.$group_name.'_'.$mail_name)) { @@ -643,7 +643,7 @@ class AdminTranslations extends AdminTab } } } - + // Update subjects $array_subjects = array(); if ($subjects = Tools::getValue('subject') AND is_array($subjects)) @@ -651,7 +651,7 @@ class AdminTranslations extends AdminTab $array_subjects['core_and_modules'] = array('translations'=>array(), 'path'=>$arr_mail_path['core_mail'].'lang.php'); if (isset($arr_mail_path['theme_mail'])) $array_subjects['themes_and_modules'] = array('translations'=>array(), 'path'=>$arr_mail_path['theme_mail'].'lang.php'); - + foreach ($subjects AS $group => $subject_translation) { if ($group == 'core_mail' || $group == 'module_mail') { @@ -711,25 +711,25 @@ class AdminTranslations extends AdminTab

'.$this->l('You can add or update a language directly from prestashop.com here').'

'; $this->displayWarning($this->l('If you choose to update an existing language pack, all your previous customization in the theme named prestashop will be lost. This includes front office expressions and default e-mail templates.')); echo '
'.$this->l('Language you want to add or update:').' '; - + if ($lang_packs = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_each_language_pack.php?version='._PS_VERSION_, false, stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 5))))) { - // Notice : for php < 5.2 compatibility, Tools::jsonDecode. The second parameter to true will set us + // Notice : for php < 5.2 compatibility, Tools::jsonDecode. The second parameter to true will set us if ($lang_packs != '' AND $lang_packs = Tools::jsonDecode($lang_packs,true)) { echo '  '; @@ -853,14 +853,14 @@ class AdminTranslations extends AdminTab '; return $str_output; } - + protected function displaySubmitButtons($name) { return ' '; } - + public function displayAutoTranslate() { $languageCode = Tools::htmlentitiesUTF8(Language::getLanguageCodeByIso(Tools::getValue('lang'))); @@ -915,7 +915,7 @@ class AdminTranslations extends AdminTab } '; } - + public function displayLimitPostWarning($count) { $str_output = ''; @@ -929,7 +929,7 @@ class AdminTranslations extends AdminTab .''.ini_get('suhosin.post.max_vars').' '.$this->l('for suhosin.post.max_vars.').'
' .''.ini_get('suhosin.request.max_vars').' '.$this->l('for suhosin.request.max_vars.').'
' .$this->l('Please ask your hosting provider to increase the suhosin post and request limit to') - .' '.((int)$count + 100).' '.$this->l('at least.').' '.$this->l('or edit the translation file manually.').'
'; + .' '.((int)$count + 100).' '.$this->l('at least.').' '.$this->l('or edit the translation file manually.').'
'; } } return $str_output; @@ -939,7 +939,7 @@ class AdminTranslations extends AdminTab { $_LANG = $this->fileExists(_PS_THEME_DIR_.'lang', Tools::strtolower($lang).'.php', '_LANG'); $str_output = ''; - + /* List templates to parse */ $templates = array_merge(scandir(_PS_THEME_DIR_), scandir(_PS_ALL_THEMES_DIR_)); $count = 0; @@ -1023,11 +1023,11 @@ class AdminTranslations extends AdminTab $str_output = ''; /* List templates to parse */ $count = 0; - $tabs = scandir(PS_ADMIN_DIR.'/tabs'); + $tabs = scandir(_PS_ADMIN_DIR_.'/tabs'); $tabs[] = '../../classes/AdminTab.php'; $files = array(); foreach ($tabs AS $tab) - if (preg_match('/^(.*)\.php$/', $tab) AND file_exists($tpl = PS_ADMIN_DIR.'/tabs/'.$tab)) + if (preg_match('/^(.*)\.php$/', $tab) AND file_exists($tpl = _PS_ADMIN_DIR_.'/tabs/'.$tab)) { $tab = basename(substr($tab, 0, -4)); $fd = fopen($tpl, 'r'); @@ -1041,7 +1041,7 @@ class AdminTranslations extends AdminTab } foreach (array('header.inc', 'footer.inc', 'index', 'login', 'password', 'functions') AS $tab) { - $tab = PS_ADMIN_DIR.'/'.$tab.'.php'; + $tab = _PS_ADMIN_DIR_.'/'.$tab.'.php'; $fd = fopen($tab, 'r'); $content = fread($fd, filesize($tab)); fclose($fd); @@ -1093,18 +1093,18 @@ class AdminTranslations extends AdminTab public function displayFormErrors($lang) { $_ERRORS = $this->fileExists(_PS_TRANSLATIONS_DIR_.$lang, 'errors.php', '_ERRORS'); - + $str_output = ''; - + /* List files to parse */ $stringToTranslate = array(); - $dirToParse = array(PS_ADMIN_DIR.'/../', - PS_ADMIN_DIR.'/../classes/', - PS_ADMIN_DIR.'/../controllers/', - PS_ADMIN_DIR.'/../override/classes/', - PS_ADMIN_DIR.'/../override/controllers/', - PS_ADMIN_DIR.'/', - PS_ADMIN_DIR.'/tabs/'); + $dirToParse = array(_PS_ADMIN_DIR_.'/../', + _PS_ADMIN_DIR_.'/../classes/', + _PS_ADMIN_DIR_.'/../controllers/', + _PS_ADMIN_DIR_.'/../override/classes/', + _PS_ADMIN_DIR_.'/../override/controllers/', + _PS_ADMIN_DIR_.'/', + _PS_ADMIN_DIR_.'/tabs/'); if (!file_exists(_PS_MODULE_DIR_)) die($this->displayWarning(Tools::displayError('Fatal error: Module directory is not here anymore ').'('._PS_MODULE_DIR_.')')); if (!is_writable(_PS_MODULE_DIR_)) @@ -1211,10 +1211,10 @@ class AdminTranslations extends AdminTab } echo $str_output; } - + /** * Get each informations for each mails founded in the folder $dir. - * + * * @since 1.4.0.14 * @param string $dir * @param string $lang @@ -1223,7 +1223,7 @@ class AdminTranslations extends AdminTab public function getMailFiles($dir, $lang, $group_name = 'mail') { $arr_return = array(); - + // Very usefull to name input and textarea fields $arr_return['group_name'] = $group_name; $arr_return['empty_values'] = 0; @@ -1243,7 +1243,7 @@ class AdminTranslations extends AdminTab $arr_return['files'][$email_name] = array(); } $arr_return['files'][$email_name][$type]['en'] = $this->getMailContent($dir, $email_file, 'en'); - + // check if the file exists in the language to translate if (file_exists($dir.$lang.'/'.$email_file)) { $arr_return['files'][$email_name][$type][$lang] = $this->getMailContent($dir, $email_file, $lang); @@ -1260,10 +1260,10 @@ class AdminTranslations extends AdminTab } return $arr_return; } - + /** * Get content of the mail file. - * + * * @since 1.4.0.14 * @param string $dir * @param string $file @@ -1273,17 +1273,17 @@ class AdminTranslations extends AdminTab { $arr_return = array(); $content = file_get_contents($dir.$lang.'/'.$file); - + if (Tools::strlen($content) === 0) { $content = ''; } return $content; } - + /** * Display mails in html format. * This was create for factorize the html displaying - * + * * @since 1.4.0.14 * @param array $mails * @param array $all_subject_mail @@ -1357,7 +1357,7 @@ class AdminTranslations extends AdminTab } /** * Just build the html structure for display txt mails - * + * * @since 1.4.0.14 * @param array $content with english and language needed contents * @param string $lang iso code of the needed language @@ -1376,31 +1376,31 @@ class AdminTranslations extends AdminTab '; } /** - * Just build the html structure for display html mails. - * + * Just build the html structure for display html mails. + * * @since 1.4.0.14 * @param array $content with english and language needed contents * @param string $lang iso code of the needed language * @param string $url for the html page and displaying an outline * @param string $mail_name name of the file to translate (same for txt and html files) - * @param string $group_name group name allow to distinguish each block of mail. - * @param string|boolean $name_for_module is not false define add a name for disntiguish mails module + * @param string $group_name group name allow to distinguish each block of mail. + * @param string|boolean $name_for_module is not false define add a name for disntiguish mails module */ protected function displayMailBlockHtml($content, $lang, $url, $mail_name, $group_name, $name_for_module = false) { $title = array(); - + // Because TinyMCE don't work correctly with , and tags if (stripos($content[$lang], '([^<]+)#Ui', $title[$language], $matches); $title[$language] = empty($matches[1])?'':$matches[1]; - + // The 2 lines below allow to exlude tag from the content. // This allow to exclude body tag even if attributs are setted. $content[$language] = substr($content[$language], stripos($content[$language], '')); } } - + $str_return = ''; $str_return .= '
@@ -1429,10 +1429,10 @@ class AdminTranslations extends AdminTab
'; return $str_return; } - + /** * Check in each module if contains mails folder. - * + * * @return array of module which has mails */ public function getModulesHasMails() @@ -1444,7 +1444,7 @@ class AdminTranslations extends AdminTab { $arr_modules[$module_dir] = _PS_MODULE_DIR_.$module_dir; } - + } return $arr_modules; } @@ -1454,7 +1454,7 @@ class AdminTranslations extends AdminTab $isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso_lang.'.js') ? $iso_lang : 'en'); $ad = dirname($_SERVER["PHP_SELF"]); return ' - '; - if (!is_writable(PS_ADMIN_DIR.'/../config/settings.inc.php') AND $name == 'themes') + if (!is_writable(_PS_ADMIN_DIR_.'/../config/settings.inc.php') AND $name == 'themes') echo '

'.$this->l('if you change the theme, the settings.inc.php file must be writable (CHMOD 755 / 777)').'

'; echo '
diff --git a/modules/autoupgrade/AdminSelfTab.php b/modules/autoupgrade/AdminSelfTab.php index ef80165c5..2df06e7f7 100644 --- a/modules/autoupgrade/AdminSelfTab.php +++ b/modules/autoupgrade/AdminSelfTab.php @@ -390,7 +390,7 @@ abstract class AdminSelfTab if (get_class($this) == 'Adminemails') echo '
'; - if (!is_writable(PS_ADMIN_DIR.'/../config/settings.inc.php') AND $name == 'themes') + if (!is_writable(_PS_ADMIN_DIR_.'/../config/settings.inc.php') AND $name == 'themes') echo '

'.$this->l('if you change the theme, the settings.inc.php file must be writable (CHMOD 755 / 777)').'

'; echo '
@@ -550,7 +550,7 @@ abstract class AdminSelfTab $classname = 'Admin'.$subtab; if ($module = Db::getInstance()->getValue('SELECT `module` FROM `'._DB_PREFIX_.'tab` WHERE `class_name` = \''.pSQL($classname).'\'') AND file_exists(_PS_MODULE_DIR_.'/'.$module.'/'.$classname.'.php')) include_once(_PS_MODULE_DIR_.'/'.$module.'/'.$classname.'.php'); - elseif (file_exists(PS_ADMIN_DIR.'/tabs/'.$classname.'.php')) + elseif (file_exists(_PS_ADMIN_DIR_.'/tabs/'.$classname.'.php')) include_once('tabs/'.$classname.'.php'); if (!isset($this->_includeObj[$key])) $this->_includeObj[$key] = new $classname; diff --git a/modules/autoupgrade/AdminSelfUpgrade.php b/modules/autoupgrade/AdminSelfUpgrade.php index 105e2ff83..6c318bce0 100644 --- a/modules/autoupgrade/AdminSelfUpgrade.php +++ b/modules/autoupgrade/AdminSelfUpgrade.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ 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); @@ -44,7 +44,7 @@ if(empty($_POST['action']) OR !in_array($_POST['action'],array('upgradeDb'))) require_once(dirname(__FILE__).'/AdminSelfTab.php'); require_once(dirname(__FILE__).'/SelfModule.php'); -// Add Upgrader class +// Add Upgrader class if(!version_compare(_PS_VERSION_,'1.4.5.0','<') AND file_exists(_PS_ROOT_DIR_.'/classes/Upgrader.php')) require_once(_PS_ROOT_DIR_.'/classes/Upgrader.php'); else @@ -70,10 +70,10 @@ class AdminSelfUpgrade extends AdminSelfTab public $ajax = false; public $nextResponseType = 'json'; // json, xml public $next = 'N/A'; - + public $upgrader = null; public $standalone = true; - + /** * set to false if the current step is a loop * @@ -102,12 +102,12 @@ class AdminSelfUpgrade extends AdminSelfTab 'backupDbFilename', 'backupFilesFilename', - + ); public $autoupgradePath = null; /** - * autoupgradeDir - * + * autoupgradeDir + * * @var string directory relative to admin dir */ public $autoupgradeDir = 'autoupgrade'; @@ -127,7 +127,7 @@ class AdminSelfUpgrade extends AdminSelfTab private $backupFilesFilename = ''; private $backupDbFilename = ''; - + /** * int loopBackupFiles : if your server has a low memory size, lower this value * @TODO remove the static, add a const, and use it like this : min(AdminUpgrade::DEFAULT_LOOP_ADD_FILE_TO_ZIP,Configuration::get('LOOP_ADD_FILE_TO_ZIP'); @@ -170,7 +170,7 @@ class AdminSelfUpgrade extends AdminSelfTab public function createCustomToken() { // ajax-mode for autoupgrade, we can't use the classic authentication - // so, we'll create a cookie in admin dir, based on cookie key + // so, we'll create a cookie in admin dir, based on cookie key global $cookie; $id_employee = $cookie->id_employee; @@ -224,7 +224,7 @@ class AdminSelfUpgrade extends AdminSelfTab /** * _setFields function to set fields (only when we need it). - * + * * @return void */ private function _setFields() @@ -263,7 +263,7 @@ class AdminSelfUpgrade extends AdminSelfTab ); } } - + public function configOk() { $allowed = (ConfigurationTest::test_fopen() && $this->rootWritable); @@ -274,7 +274,7 @@ class AdminSelfUpgrade extends AdminSelfTab } /** * isUpgradeAllowed checks if all server configuration is valid for upgrade - * + * * @return void */ public function isUpgradeAllowed() @@ -314,7 +314,7 @@ class AdminSelfUpgrade extends AdminSelfTab if (!in_array($this->action,array('upgradeFile', 'upgradeDb', 'upgradeComplete','rollback','restoreFiles','restoreDb'))) { - // checkPSVersion will be not + // checkPSVersion will be not $this->upgrader = new Upgrader(); $this->upgrader->checkPSVersion(); $this->nextParams['install_version'] = $this->upgrader->version_num; @@ -333,7 +333,7 @@ $this->standalone = true; } else $this->useSvn = false; - + // If not exists in this sessions, "create" // session handling : from current to next params @@ -361,7 +361,7 @@ $this->standalone = true; $this->backupDbFilename = Configuration::get('UPGRADER_BACKUPDB_FILENAME'); if(!file_exists($this->backupDbFilename)) { - // If not exists, the filename is generated by Backup.php + // If not exists, the filename is generated by Backup.php $this->backupDbFilename = ''; Configuration::updateValue('UPGRADER_BACKUPDB_FILENAME', $this->backupDbFilename); } @@ -402,7 +402,7 @@ $this->standalone = true; $this->manualMode = $this->currentParams['manualMode']; $this->desactivateCustomModule = $this->currentParams['desactivateCustomModule']; } - // We can add any file or directory in the exclude dir : theses files will be not removed or overwritten + // We can add any file or directory in the exclude dir : theses files will be not removed or overwritten // @TODO cache should be ignored recursively, but we have to reconstruct it after upgrade // - compiled from smarty // - .svn @@ -425,18 +425,18 @@ $this->standalone = true; if ($this->dontBackupImages) $this->backupIgnoreAbsoluteFiles[] = "/img"; - - + + if ($this->keepDefaultTheme) $this->excludeAbsoluteFilesFromUpgrade[] = "/themes/prestashop"; - + if ($this->keepTrad) $this->excludeFilesFromUpgrade[] = "translations"; } /** * getFilePath return the path to the zipfile containing prestashop. - * + * * @return void */ private function getFilePath() @@ -594,13 +594,13 @@ $this->standalone = true; if ($file[0] != '.') { $fullPath = $dir.DIRECTORY_SEPARATOR.$file; - + if (!$this->_skipFile($file, $fullPath,'backup')) { if (is_dir($fullPath)) $this->_listBackupFiles($fullPath); else - $list[] = $fullPath; + $list[] = $fullPath; } else $list[] = $fullPath; @@ -616,7 +616,7 @@ $this->standalone = true; foreach ($allFiles as $file) { $fullPath = $dir.DIRECTORY_SEPARATOR.$file; - + if (!$this->_skipFile($file, $fullPath, "upgrade")) { $list[] = $fullPath; @@ -698,7 +698,7 @@ $this->standalone = true; @ini_set('memory_limit','128M'); } require_once($this->prodRootDir.'/config/autoload.php'); - + /* Redefine REQUEST_URI if empty (on some webservers...) */ if (!isset($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == '') $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; @@ -753,7 +753,7 @@ $this->standalone = true; case 'doUpgrade' : 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; @@ -913,7 +913,7 @@ $this->standalone = true; /** * ajaxProcessRestoreFiles restore the previously saved files. - * + * * @return boolean true if succeed */ public function ajaxProcessRestoreFiles() @@ -1015,7 +1015,7 @@ $this->standalone = true; // @TODO need to check if a ";" in description could block that (I suppose it can at the end of a line) preg_match_all('/(.*;)[\n\r]+/Usm', $content, $requests); /* @TODO maybe improve regex pattern ... */ - $db = Db::getInstance(); + $db = Db::getInstance(); if (count($requests[0])>0) { foreach ($requests[1] as $request) @@ -1062,7 +1062,7 @@ $this->standalone = true; if(!class_exists('MySQL',false)) eval('Class MySQL extends MySQLCore{}'); } - + if(!class_exists('Validate',false)) { require_once(_PS_ROOT_DIR_.'/classes/Validate.php'); @@ -1104,7 +1104,7 @@ $this->standalone = true; if ($res) { $this->nextParams['backupDbFilename'] = $backup->id; - // We need to load configuration to use it ... + // We need to load configuration to use it ... Configuration::loadConfiguration(); Configuration::updateValue('UPGRADER_BACKUPDB_FILENAME', $backup->id); @@ -1147,12 +1147,12 @@ $this->standalone = true; //$current = crc32(file_get_contents($file)); //$file = $this->nextParams['filesForBackup'][0]; //$latestFile = str_replace(_PS_ROOT_DIR_,$this->latestRootDir,$file); - + // if (file_exists($latestFile)) // $latest = crc32($latestFile); // else // $latest = ''; - + $zip = new ZipArchive(); if ($zip->open($this->backupFilesFilename, ZIPARCHIVE::CREATE)) { @@ -1269,13 +1269,13 @@ $this->standalone = true; return $resRemove; } - + public function ajaxProcessSvnCheckout() { $this->nextParams = $this->currentParams; if ($this->useSvn){ $dest = $this->autoupgradePath . DIRECTORY_SEPARATOR . $this->svnDir; - + $svnStatus = svn_status($dest); if (is_array($svnStatus)) { @@ -1363,7 +1363,7 @@ $this->standalone = true; $this->nextParams[$v] = $this->$v; $return['nextParams'] = $this->nextParams; - + $return['nextParams']['typeResult'] = $this->nextResponseType; $return['nextQuickInfo'] = $this->nextQuickInfo; @@ -1383,14 +1383,14 @@ $this->standalone = true; $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() { if (!empty($_POST['responseType']) AND $_POST['responseType'] == 'json') header('Content-Type: application/json'); - + if(!empty($_POST['action'])) { $action = $_POST['action']; @@ -1424,10 +1424,10 @@ $this->standalone = true; if(function_exists('apache_get_modules')) { static $apacheModuleList = null; - + if (!is_array($apacheModuleList)) $apacheModuleList = apache_get_modules(); - + // we need strpos (example can be evasive20 foreach($apacheModuleList as $module) { @@ -1437,7 +1437,7 @@ $this->standalone = true; } else{ // If apache_get_modules does not exists, - // one solution should be parsing httpd.conf, + // one solution should be parsing httpd.conf, // but we could simple parse phpinfo(INFO_MODULES) return string ob_start(); phpinfo(INFO_MODULES); @@ -1547,7 +1547,7 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where else $srcRootWritable = '../img/admin/disabled.gif'; echo ''.$this->l('Root directory status').' : '.' '.($this->rootWritable?$this->l('fully writable'):$this->l('not writable recursively')).'

'; - + if ($this->upgrader->needUpgrade) { if ($this->upgrader->autoupgrade) @@ -1621,19 +1621,19 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where { echo ''.$this->l('Your shop is already up to date.').' '; } - echo '

'.sprintf($this->l('last datetime check : %s '),date('Y-m-d H:i:s',Configuration::get('PS_LAST_VERSION_CHECK'))).' + echo '

'.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').' '; - + echo'
'; echo ''; - - + + if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_ AND $this->manualMode) { @@ -1720,10 +1720,10 @@ echo '';

'.$this->l('Your current configuration indicate you want to upgrade your system from the unstable development branch, with no version number. If you upgrade, you will not be able to follow the official release process anymore').'.

'; $this->_displayUpgraderForm(); - + echo '
'; $this->_displayRollbackForm(); - + echo '
'; $this->_displayForm('autoUpgradeOptions',$this->_fieldsAutoUpgrade,''.$this->l('Options').'', '','prefs'); @@ -1776,7 +1776,7 @@ function addQuickInfo(arrQuickInfo){ $("#quickInfo").show(); for(i=0;i"); - + $("#quickInfo").attr({ scrollTop: $("#quickInfo").attr("scrollHeight") }); } }'; @@ -1800,11 +1800,11 @@ $(document).ready(function(){ // more convenient to have that param for handling success and error var requestParams; - + // set timeout to 5 minutes (download can be long)? $.ajaxSetup({timeout:300000}); - + // prepare available button here, without params ? prepareNextButton("#upgradeNow",firstTimeParams); prepareNextButton("#rollback",firstTimeParams); @@ -1845,7 +1845,7 @@ function handleXMLResult(xmlRet, previousParams) // this will be used in after** javascript functions resGlobal = $.xml2json(xmlRet); - switch(previousParams.upgradeDbStep) + switch(previousParams.upgradeDbStep) { case 0: // getVersionFromDb result = "ok"; @@ -1886,7 +1886,7 @@ function handleXMLResult(xmlRet, previousParams) .show("slow"); $("#dbCreateResultCheck") .hide("slow"); - + // propose rollback if there is an error if (confirm("An error happen\r\n'.$this->l('Do you want to rollback ?').'")) resGlobal = {next:"rollback",nextParams:{typeResult:"json"},status:"error"}; @@ -1915,8 +1915,8 @@ function afterUpgradeComplete() $("#infoStep").html("

'.$this->l('Upgrade Complete ! ').'

"); } /** - * afterBackupDb display the button - * + * afterBackupDb display the button + * */ function afterBackupDb() { @@ -1999,7 +1999,7 @@ function doAjaxRequest(action, nextParams){ $("#"+action).addClass("done"); if (res.stepDone) $("#"+action).addClass("stepok"); - + // if a function "after[action name]" exists, it should be called. // This is used for enabling restore buttons for example funcName = "after"+ucFirst(action); @@ -2107,7 +2107,7 @@ function handleError(res) { $("#rollback").click(); } - + } } '; @@ -2132,7 +2132,7 @@ $js.= '$(document).ready(function(){ $("#checkPrestaShopFilesVersion").append("'.$this->l('See or hide the list').'
"); $("#checkPrestaShopFilesVersion").append("
"); - + $("#changedList").html("
    "); $(answer.result).each(function(k,v){ $("#changedList ul").append("
  • "+v+"
  • "); @@ -2192,7 +2192,7 @@ $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedL return true; } - + /** * @desc extract a zip file to the given directory * @return bool success @@ -2230,7 +2230,7 @@ $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedL return true; } } - + private function _listArchivedFiles() { if (!empty($this->nextParams['backupFilesFilepath'])) @@ -2242,7 +2242,7 @@ $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedL { while ($entry=zip_read($zip)) $files[] = zip_entry_name($entry); - + zip_close($zip); } } @@ -2255,7 +2255,7 @@ $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedL } return false; } - + /** * bool _skipFile : check whether a file is in backup or restore skip list * @@ -2282,7 +2282,7 @@ $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedL case 'upgrade': if (in_array($file, $this->excludeFilesFromUpgrade)) return true; - + foreach ($this->excludeAbsoluteFilesFromUpgrade as $path) if (strpos($fullpath, $rootpath.$path) !== false) return true; diff --git a/modules/autoupgrade/ajax-upgradetab.php b/modules/autoupgrade/ajax-upgradetab.php index e0be1d26a..3fad4e966 100644 --- a/modules/autoupgrade/ajax-upgradetab.php +++ b/modules/autoupgrade/ajax-upgradetab.php @@ -44,7 +44,6 @@ if ( _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$_POST['dir'] !== realpath(_PS_ROOT_DIR_ die('not allowed'); define('_PS_ADMIN_DIR_', _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$_POST['dir']); -define('PS_ADMIN_DIR', _PS_ADMIN_DIR_); // Retro-compatibility //require(_PS_ADMIN_DIR_.'/functions.php'); include(AUTOUPGRADE_MODULE_DIR.'init.php'); @@ -56,7 +55,7 @@ $adminObj->ajax = true; { if ($adminObj->checkToken()) { - // the differences with index.php is here + // the differences with index.php is here $adminObj->ajaxPreProcess(); $action = Tools14::getValue('action'); diff --git a/modules/autoupgrade/autoupgrade.php b/modules/autoupgrade/autoupgrade.php index 5f193fe5f..7ba666a07 100644 --- a/modules/autoupgrade/autoupgrade.php +++ b/modules/autoupgrade/autoupgrade.php @@ -1,4 +1,5 @@ _errors[] = $this->l('This version of PrestaShop cannot be upgraded : PS_ADMIN_DIR constant is missing'); + $this->_errors[] = $this->l('This version of PrestaShop cannot be upgraded :_PS_ADMIN_DIR_ constant is missing'); $autoupgradeCanWork = false; } } @@ -36,7 +37,7 @@ class Autoupgrade extends Module $tab = new Tab($idTab); $res &= $tab->delete(); } - + $idTab = Tab::getIdFromClassName('AdminSelfUpgrade'); // Then we add AdminSelfUpgrade only if not exists if (!$idTab) @@ -58,11 +59,11 @@ class Autoupgrade extends Module if(file_exists($autoupgradeDir.DIRECTORY_SEPARATOR.'ajax-upgradetab.php')) $res &= unlink($autoupgradeDir.DIRECTORY_SEPARATOR.'ajax-upgradetab.php'); $path = dirname(__FILE__).'/'; - + $res &= copy($path.'ajax-upgradetab.php',$autoupgradeDir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php'); $res &= copy($path.'logo.gif',_PS_ROOT_DIR_. DIRECTORY_SEPARATOR . 'img/t/AdminSelfUpgrade.gif'); - - if (!$res + + if (!$res OR !Tab::getIdFromClassName('AdminSelfUpgrade') OR !parent::install() ) @@ -85,7 +86,7 @@ class Autoupgrade extends Module } $res &= unlink(_PS_ADMIN_DIR_.DIRECTORY_SEPARATOR.'tabs'.'AdminUpgrade.php'); } - + if (file_exists(_PS_ADMIN_DIR_.DIRECTORY_SEPARATOR.'autoupgrade'.DIRECTORY_SEPARATOR.'ajax-upgradetab.php')) $res &= @unlink(_PS_ADMIN_DIR_.DIRECTORY_SEPARATOR.'autoupgrade'.DIRECTORY_SEPARATOR.'ajax-upgradetab.php'); if (!$res OR !parent::uninstall()) diff --git a/modules/autoupgrade/functions.php b/modules/autoupgrade/functions.php index da95502c1..ed9cd7046 100644 --- a/modules/autoupgrade/functions.php +++ b/modules/autoupgrade/functions.php @@ -101,7 +101,7 @@ function rewriteSettingsFile($baseUrls = NULL, $theme = NULL, $arrayDB = NULL) foreach ($defines as $k => $value) $content .= 'define(\''.$k.'\', \''.addslashes($value).'\');'."\n"; $content .= "\n?>"; - if ($fd = @fopen(PS_ADMIN_DIR.'/../config/settings.inc.php', 'w')) + if ($fd = @fopen(_PS_ADMIN_DIR_.'/../config/settings.inc.php', 'w')) { fwrite($fd, $content); fclose($fd); @@ -254,8 +254,8 @@ function checkingTab($tab) } if ($row['module'] AND file_exists(_PS_MODULE_DIR_.'/'.$row['module'].'/'.$tab.'.php')) include_once(_PS_MODULE_DIR_.'/'.$row['module'].'/'.$tab.'.php'); - elseif (file_exists(PS_ADMIN_DIR.'/tabs/'.$tab.'.php')) - include_once(PS_ADMIN_DIR.'/tabs/'.$tab.'.php'); + elseif (file_exists(_PS_ADMIN_DIR_.'/tabs/'.$tab.'.php')) + include_once(_PS_ADMIN_DIR_.'/tabs/'.$tab.'.php'); if (!class_exists($tab, false) OR !$row['id_tab']) {