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 @@ include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); - define('PS_ADMIN_DIR', getcwd()); + define('_PS_ADMIN_DIR_', getcwd()); require_once('../../config/config.inc.php'); require_once('../init.php'); $error = ''; diff --git a/admin-dev/ajaxfilemanager/ajax_file_upload.php b/admin-dev/ajaxfilemanager/ajax_file_upload.php index 6fbcf0a8b..454fe0003 100755 --- a/admin-dev/ajaxfilemanager/ajax_file_upload.php +++ b/admin-dev/ajaxfilemanager/ajax_file_upload.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'); diff --git a/admin-dev/ajaxfilemanager/ajax_image_editor.php b/admin-dev/ajaxfilemanager/ajax_image_editor.php index 81c1cacf7..4217a0205 100755 --- a/admin-dev/ajaxfilemanager/ajax_image_editor.php +++ b/admin-dev/ajaxfilemanager/ajax_image_editor.php @@ -1,5 +1,5 @@ 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 '