diff --git a/.gitignore b/.gitignore index c136b27fb..46dfd57d9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,18 @@ .settings .idea .svn +.DS_Store robots.txt sitemap.xml +cache/cachefs/* +!cache/cachefs/index.php +download/* +!download/index.php +upload/* +!upload/index.php +admin-dev/autoupgrade/* +admin-dev/backups/* +!admin-dev/backups/index.php cache/smarty/cache/* !cache/smarty/cache/index.php cache/smarty/compile/* @@ -15,6 +25,7 @@ cache/tcpdf/* !cache/tcpdf/index.php config/xml/*.xml config/settings.inc.php +config/settings.old.php log/*.log img/* !img/index.php @@ -25,4 +36,72 @@ tools/smarty*/compile/*.php !tools/smarty*/compile/index.php override/classes/*.php themes/default/cache/*.js -themes/default/cache/*.css \ No newline at end of file +themes/default/cache/*.css +themes/default/modules/*/*.php +!themes/default/modules/*/index.php +themes/default/lang/*.php +!themes/default/lang/index.php +modules/*/translations/*.php +!modules/*/translations/index.php +mails/* +!mails/en +modules/*/mails/* +!modules/*/mails/en +translations/* +!translations/*.gzip +modules/atos/* +modules/addshoppers +modules/alliedwallet +modules/authorizeaim +modules/autoupgrade +modules/avalaratax +modules/backwardcompatibility +modules/canadapost +modules/cloudcache +modules/ebay +modules/fedexcarrier +modules/fianetfraud +modules/fianetsceau +modules/fidbag +modules/firstdata +modules/gadwords +modules/gamification +modules/ganalytics +modules/gsitemap +modules/hipay +modules/iadvize +modules/itembase +modules/jirafe +modules/kiala +modules/kialasmall +modules/klarnaprestashop +modules/kwixo +modules/livezilla +modules/mailjet +modules/merchantware +modules/mobile_theme +modules/mondialrelay +modules/moneybookers +modules/nqgatewayneteven +modules/ogone +modules/pagseguro +modules/paypal +modules/payulatam +modules/prediggo +modules/prestafraud +modules/shipwire +modules/shoppingfeedexport +modules/shoppingfluxexport +modules/socolissimo +modules/stripejs +modules/themeinstallator +modules/tntcarrier +modules/treepodia +modules/trustedshops +modules/trustly +modules/twenga +modules/upscarrier +modules/uspscarrier +modules/wexpay +modules/yotpo +modules/zingaya \ No newline at end of file diff --git a/404.php b/404.php index 856c99e72..9fd4270f4 100644 --- a/404.php +++ b/404.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ -/* Send the proper status code in HTTP headers */ -header('HTTP/1.1 404 Not Found'); -header('Status: 404 Not Found'); - -if (in_array(substr($_SERVER['REQUEST_URI'], -3), array('png', 'jpg', 'gif'))) -{ - require_once(dirname(__FILE__).'/config/settings.inc.php'); - header('Location: '.__PS_BASE_URI__.'img/404.gif'); - exit; -} -elseif (in_array(substr($_SERVER['REQUEST_URI'], -3), array('.js', 'css'))) - die(''); - require_once(dirname(__FILE__).'/config/config.inc.php'); +Tools::displayFileAsDeprecated(); Controller::getController('PageNotFoundController')->run(); diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f9c682fca..29f1cdfdc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,5 +8,5 @@ All core files you commit in your pull request must have Open Software License ( All modules files you commit in your pull request must have Academic Free License (AFL 3.0) [1]: https://help.github.com/articles/using-pull-requests -[2]: http://docs.prestashop.com/display/PS15/Coding+Standard -[3]: http://docs.prestashop.com/display/PS15/Commit+norme \ No newline at end of file +[2]: http://docs.prestashop.com/display/PS15/Coding+Standards +[3]: http://docs.prestashop.com/display/PS15/How+to+write+a+commit+message diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index db8ff6095..06dcfe350 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,40 +1,80 @@ -CONTRIBUTORS -============ + - (d)oekia + - Alexander Otchenashev + - Benjamin PONGY + - Burhan + - Caleydon Media + - Damien Metzger + - DamienMetzger + - Damon Skelhorn + - Daniel + - David Gasperoni + - DrySs + - DrÿSs' + - François Gaillard + - Gabriel Schwardy + - Gregory Roussac + - Ha!*!*y + - Jonathan Danse + - Krystian Podemski + - Marco Cervellin + - Michel Courtade + - Milow + - Patanock + - Pierre + - PrestaEdit + - Raphaël Malié + - Rémi Gaillard + - Samy Rabih + - Sarah Lorenzini + - Shagshag + - Vincent Augagneur + - Xavier POITAU + - aFolletete + - aKorczak + - aNiassy + - adonis karavokyros + - anat + - bLeveque + - bMancone + - bumbu + - cmouleyre + - dMetzger + - dSevere + - djfm + - fBrignoli + - fSerny + - fram + - gBrunier + - gCharmes + - gPoulain + - gRoussac + - hAitmansour + - ivancasasempere + - jBreux + - jObregon + - jessylenne + - jmCollin + - kpodemski + - lBrieu + - lCherifi + - lLefevre + - mBertholino + - mDeflotte + - mMarinetti + - marcinsz101 + - montes + - nPellicari + - nezenmoins + - oleacorner + - rGaillard + - rMalie + - rMontagne + - root + - sLorenzini + - sThiebaut + - tDidierjean + - vAugagneur + - vChabot + - vKham + - vSchoener -- DamienMetzger -- François Gaillard -- Rémi Gaillard -- Vincent Augagneur -- aFolletete -- aKorczak -- aNiassy -- bLeveque -- bMancone -- dMetzger -- dSevere -- fBrignoli -- fSerny -- gBrunier -- gCharmes -- gPoulain -- hAitmansour -- jBreux -- jObregon -- jmCollin -- lBrieu -- lCherifi -- lLefevre -- mBertholino -- mDeflotte -- mMarinetti -- nPellicari -- rGaillard -- rMalie -- rMontagne -- sLorenzini -- sThiebaut -- tDidierjean -- vAugagneur -- vChabot -- vKham -- vSchoener \ No newline at end of file diff --git a/address.php b/address.php index 8d2a7ee75..4dbf1d223 100644 --- a/address.php +++ b/address.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -34,4 +34,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -Tools::redirect('index.php?controller=address'.($_REQUEST ? '&'.http_build_query($_REQUEST, '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file +Tools::redirect('index.php?controller=address'.((count($_GET) || count($_POST)) ? '&'.http_build_query(array_merge($_GET, $_POST), '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/addresses.php b/addresses.php index 71a0007c2..cda46efcf 100644 --- a/addresses.php +++ b/addresses.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -34,4 +34,4 @@ require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); -Tools::redirect('index.php?controller=addresses'.($_REQUEST ? '&'.http_build_query($_REQUEST, '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file +Tools::redirect('index.php?controller=addresses'.((count($_GET) || count($_POST)) ? '&'.http_build_query(array_merge($_GET, $_POST), '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); \ No newline at end of file diff --git a/admin-dev/ajax-tab.php b/admin-dev/ajax-tab.php index d3b865930..24c751f9d 100755 --- a/admin-dev/ajax-tab.php +++ b/admin-dev/ajax-tab.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @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()); -require(dirname(__FILE__).'/../config/config.inc.php'); -require(dirname(__FILE__).'/functions.php'); +require(_PS_ADMIN_DIR_.'/../config/config.inc.php'); +require(_PS_ADMIN_DIR_.'/functions.php'); // For retrocompatibility with "tab" parameter if (!isset($_GET['controller']) && isset($_GET['tab'])) diff --git a/admin-dev/ajax.php b/admin-dev/ajax.php index 01c35c7db..8f41e44cb 100644 --- a/admin-dev/ajax.php +++ b/admin-dev/ajax.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -27,7 +27,7 @@ define('_PS_ADMIN_DIR_', getcwd()); include(_PS_ADMIN_DIR_.'/../config/config.inc.php'); /* Getting cookie or logout */ -require_once(dirname(__FILE__).'/init.php'); +require_once(_PS_ADMIN_DIR_.'/init.php'); $context = Context::getContext(); @@ -171,110 +171,6 @@ if (Tools::isSubmit('updateElementEmployee') && Tools::getValue('updateElementEm die($notification->updateEmployeeLastElement(Tools::getValue('updateElementEmployeeType'))); } -if (Tools::isSubmit('syncImapMail')) -{ - if (!($url = Configuration::get('PS_SAV_IMAP_URL')) - || !($port = Configuration::get('PS_SAV_IMAP_PORT')) - || !($user = Configuration::get('PS_SAV_IMAP_USER')) - || !($password = Configuration::get('PS_SAV_IMAP_PWD'))) - die('{"hasError" : true, "errors" : ["Configuration is not correct"]}'); - - $conf = Configuration::getMultiple(array( - 'PS_SAV_IMAP_OPT_NORSH', 'PS_SAV_IMAP_OPT_SSL', - 'PS_SAV_IMAP_OPT_VALIDATE-CERT', 'PS_SAV_IMAP_OPT_NOVALIDATE-CERT', - 'PS_SAV_IMAP_OPT_TLS', 'PS_SAV_IMAP_OPT_NOTLS')); - - $conf_str = ''; - if ($conf['PS_SAV_IMAP_OPT_NORSH']) - $conf_str .= '/norsh'; - if ($conf['PS_SAV_IMAP_OPT_SSL']) - $conf_str .= '/ssl'; - if ($conf['PS_SAV_IMAP_OPT_VALIDATE-CERT']) - $conf_str .= '/validate-cert'; - if ($conf['PS_SAV_IMAP_OPT_NOVALIDATE-CERT']) - $conf_str .= '/novalidate-cert'; - if ($conf['PS_SAV_IMAP_OPT_TLS']) - $conf_str .= '/tls'; - if ($conf['PS_SAV_IMAP_OPT_NOTLS']) - $conf_str .= '/notls'; - - if (!function_exists('imap_open')) - die('{"hasError" : true, "errors" : ["imap is not installed on this server"]}'); - - $mbox = @imap_open('{'.$url.':'.$port.$conf_str.'}', $user, $password); - - //checks if there is no error when connecting imap server - $errors = imap_errors(); - $str_errors = ''; - $str_error_delete = ''; - if (sizeof($errors) && is_array($errors)) - { - var_dump($errors); - $str_errors = ''; - foreach($errors as $error) - $str_errors .= '"'.$error.'",'; - $str_errors = rtrim($str_errors, ',').''; - } - //checks if imap connexion is active - if (!$mbox) - die('{"hasError" : true, "errors" : ["Cannot connect to the mailbox"]}'); - - //Returns information about the current mailbox. Returns FALSE on failure. - $check = imap_check($mbox); - if (!$check) - die('{"hasError" : true, "errors" : ["Fail to get information about the current mailbox"]}'); - - 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) - { - //check if message exist in database - if (isset($overview->subject)) - $subject = $overview->subject; - else - $subject = ''; - - //Creating an md5 to check if message has been allready processed - $md5 = md5($overview->date.$overview->from.$subject.$overview->msgno); - $exist = Db::getInstance()->getValue( - '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')) - if (!imap_delete($mbox, $overview->msgno)) - $str_error_delete = ', "Fail to delete message"'; - } - else - { - //check if subject has id_order - preg_match('/\#ct([0-9]*)/', $subject, $matches1); - preg_match('/\#tc([0-9-a-z-A-Z]*)/', $subject, $matches2); - - if (isset($matches1[1]) && isset($matches2[1])) - { - //check if order exist in database - $ct = new CustomerThread((int)$matches1[1]); - - if (Validate::isLoadedObject($ct) && $ct->token == $matches2[1]) - { - $cm = new CustomerMessage(); - $cm->id_customer_thread = $ct->id; - $cm->message = imap_fetchbody($mbox, $overview->msgno, 1); - $cm->add(); - } - } - Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'customer_message_sync_imap` (`md5_header`) VALUES (\''.pSQL($md5).'\')'); - } - } - imap_expunge($mbox); - imap_close($mbox); - die('{"hasError" : false, "errors" : ["'.$str_errors.$str_error_delete.'"]}'); -} - if (Tools::isSubmit('searchCategory')) { $q = Tools::getValue('q'); diff --git a/admin-dev/ajax_products_list.php b/admin-dev/ajax_products_list.php index f3c747e18..f14a9a8c8 100644 --- a/admin-dev/ajax_products_list.php +++ b/admin-dev/ajax_products_list.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -27,7 +27,7 @@ define('_PS_ADMIN_DIR_', getcwd()); include(_PS_ADMIN_DIR_.'/../config/config.inc.php'); /* Getting cookie or logout */ -require_once(dirname(__FILE__).'/init.php'); +require_once(_PS_ADMIN_DIR_.'/init.php'); $query = Tools::getValue('q', false); if (!$query OR $query == '' OR strlen($query) < 1) @@ -51,13 +51,16 @@ else // Excluding downloadable products from packs because download from pack is not supported $excludeVirtuals = (bool)Tools::getValue('excludeVirtuals', false); +$exclude_packs = (bool)Tools::getValue('exclude_packs', false); $sql = 'SELECT p.`id_product`, `reference`, pl.name FROM `'._DB_PREFIX_.'product` p LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product AND pl.id_lang = '.(int)Context::getContext()->language->id.Shop::addSqlRestrictionOnLang('pl').') WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'. (!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' '). - ($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : ''); + ($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : ''). + ($exclude_packs ? 'AND (p.cache_is_pack IS NULL OR p.cache_is_pack = 0)' : ''); + $items = Db::getInstance()->executeS($sql); if ($items) diff --git a/admin-dev/ajaxfilemanager/ajax_file_upload.php b/admin-dev/ajaxfilemanager/ajax_file_upload.php index 309490e06..b21a39c13 100755 --- a/admin-dev/ajaxfilemanager/ajax_file_upload.php +++ b/admin-dev/ajaxfilemanager/ajax_file_upload.php @@ -60,7 +60,7 @@ $tem[$k] = $v; } - $tem['path'] = backslashToSlash($path); + $tem['path'] = addslashes(backslashToSlash($path)); $tem['type'] = "file"; $tem['size'] = transformFileSize($tem['size']); $tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']); @@ -73,7 +73,7 @@ $info .= sprintf(", %s:'%s'", $k, $v); } - $info .= sprintf(", url:'%s'", getFileUrl($path)); + $info .= sprintf(", url:'%s'", addslashes(getFileUrl($path))); $info .= sprintf(", tipedit:'%s'", TIP_DOC_RENAME); diff --git a/admin-dev/ajaxfilemanager/ajax_get_file_listing.php b/admin-dev/ajaxfilemanager/ajax_get_file_listing.php index 133486637..c72110344 100755 --- a/admin-dev/ajaxfilemanager/ajax_get_file_listing.php +++ b/admin-dev/ajaxfilemanager/ajax_get_file_listing.php @@ -99,9 +99,9 @@ { $v = transformFileSize($v); } - echo (($j++ > 1)?",":'') . "'" . $k . "':'" . $v . "'"; + echo (($j++ > 1)?",":'') . "'" . addslashes($k) . "':'" . addslashes($v) . "'"; } - echo (($j++ > 1)?",":'') . "'url':'" . getFileUrl($file['path']) . "'"; + echo (($j++ > 1)?",":'') . "'url':'" . addslashes(getFileUrl($file['path'])) . "'"; echo "}\n"; } echo "};\n"; diff --git a/admin-dev/ajaxfilemanager/inc/class.file.php b/admin-dev/ajaxfilemanager/inc/class.file.php index 85512eb02..d35ff7a33 100755 --- a/admin-dev/ajaxfilemanager/inc/class.file.php +++ b/admin-dev/ajaxfilemanager/inc/class.file.php @@ -33,15 +33,15 @@ $this->fileInfo['atime'] = $this->fileStat[8]; $this->fileInfo['ctime'] = $this->fileStat[10]; $this->fileInfo['mtime'] = $this->fileStat[9]; - $this->fileInfo['path'] = $path; - $this->fileInfo['name'] = basename($path); + $this->fileInfo['path'] = addslashes($path); + $this->fileInfo['name'] = addslashes(basename($path)); $this->fileInfo['is_writable'] = $this->isWritable(); $this->fileInfo['is_readable'] = $this->isReadable(); }elseif(is_dir($this->filePath)) { $this->fileStat = @stat($path); - $this->fileInfo['name'] = basename($path); - $this->fileInfo['path'] = $path; + $this->fileInfo['name'] = addslashes(basename($path)); + $this->fileInfo['path'] = addslashes($path); $this->fileInfo['atime'] = $this->fileStat[8]; $this->fileInfo['ctime'] = $this->fileStat[10]; $this->fileInfo['mtime'] = $this->fileStat[9]; diff --git a/admin-dev/ajaxfilemanager/inc/index.php b/admin-dev/ajaxfilemanager/inc/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/inc/index.php +++ b/admin-dev/ajaxfilemanager/inc/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/index.php b/admin-dev/ajaxfilemanager/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/index.php +++ b/admin-dev/ajaxfilemanager/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/jscripts/edit_area/images/index.php b/admin-dev/ajaxfilemanager/jscripts/edit_area/images/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/jscripts/edit_area/images/index.php +++ b/admin-dev/ajaxfilemanager/jscripts/edit_area/images/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/jscripts/edit_area/index.php b/admin-dev/ajaxfilemanager/jscripts/edit_area/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/jscripts/edit_area/index.php +++ b/admin-dev/ajaxfilemanager/jscripts/edit_area/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/jscripts/edit_area/langs/index.php b/admin-dev/ajaxfilemanager/jscripts/edit_area/langs/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/jscripts/edit_area/langs/index.php +++ b/admin-dev/ajaxfilemanager/jscripts/edit_area/langs/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/jscripts/edit_area/reg_syntax/index.php b/admin-dev/ajaxfilemanager/jscripts/edit_area/reg_syntax/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/jscripts/edit_area/reg_syntax/index.php +++ b/admin-dev/ajaxfilemanager/jscripts/edit_area/reg_syntax/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/jscripts/index.php b/admin-dev/ajaxfilemanager/jscripts/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/jscripts/index.php +++ b/admin-dev/ajaxfilemanager/jscripts/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/langs/index.php b/admin-dev/ajaxfilemanager/langs/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/langs/index.php +++ b/admin-dev/ajaxfilemanager/langs/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/session/index.php b/admin-dev/ajaxfilemanager/session/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/session/index.php +++ b/admin-dev/ajaxfilemanager/session/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/default/css/index.php b/admin-dev/ajaxfilemanager/theme/default/css/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/theme/default/css/index.php +++ b/admin-dev/ajaxfilemanager/theme/default/css/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/default/images/action/index.php b/admin-dev/ajaxfilemanager/theme/default/images/action/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/theme/default/images/action/index.php +++ b/admin-dev/ajaxfilemanager/theme/default/images/action/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/default/images/big_icon/index.php b/admin-dev/ajaxfilemanager/theme/default/images/big_icon/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/theme/default/images/big_icon/index.php +++ b/admin-dev/ajaxfilemanager/theme/default/images/big_icon/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/default/images/file_type/index.php b/admin-dev/ajaxfilemanager/theme/default/images/file_type/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/theme/default/images/file_type/index.php +++ b/admin-dev/ajaxfilemanager/theme/default/images/file_type/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/default/images/index.php b/admin-dev/ajaxfilemanager/theme/default/images/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/theme/default/images/index.php +++ b/admin-dev/ajaxfilemanager/theme/default/images/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/default/images/pagination/index.php b/admin-dev/ajaxfilemanager/theme/default/images/pagination/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/theme/default/images/pagination/index.php +++ b/admin-dev/ajaxfilemanager/theme/default/images/pagination/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/default/images/standard/index.php b/admin-dev/ajaxfilemanager/theme/default/images/standard/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/theme/default/images/standard/index.php +++ b/admin-dev/ajaxfilemanager/theme/default/images/standard/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/default/index.php b/admin-dev/ajaxfilemanager/theme/default/index.php index 7a626751d..319128b59 100644 --- a/admin-dev/ajaxfilemanager/theme/default/index.php +++ b/admin-dev/ajaxfilemanager/theme/default/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/index.php b/admin-dev/ajaxfilemanager/theme/index.php index 7a626751d..319128b59 100644 --- a/admin-dev/ajaxfilemanager/theme/index.php +++ b/admin-dev/ajaxfilemanager/theme/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/autoupgrade/index.php b/admin-dev/autoupgrade/index.php index cadb1ea6e..5ca842ada 100644 --- a/admin-dev/autoupgrade/index.php +++ b/admin-dev/autoupgrade/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/backup.php b/admin-dev/backup.php index bf13d08ad..8a4f66fef 100644 --- a/admin-dev/backup.php +++ b/admin-dev/backup.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @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()); - include(_PS_ADMIN_DIR_.'/../config/config.inc.php'); if (!Context::getContext()->employee->isLoggedBack()) @@ -34,15 +33,15 @@ if (!Context::getContext()->employee->isLoggedBack()) $tabAccess = Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminBackup')); if ($tabAccess['view'] !== '1') - die (Tools::displayError('You do not have permission to view here')); + die (Tools::displayError('You do not have permission to view this.')); $backupdir = realpath(_PS_ADMIN_DIR_ . '/backups/'); if ($backupdir === false) - die (Tools::displayError('Backups directory does not exist.')); + die (Tools::displayError('A "Backup" directory does not exist.')); if (!$backupfile = Tools::getValue('filename')) - die (Tools::displayError('No file specified')); + die (Tools::displayError('No file has been specified.')); // Check the realpath so we can validate the backup file is under the backup directory $backupfile = realpath($backupdir.'/'.$backupfile); @@ -59,7 +58,7 @@ else $fp = @fopen($backupfile, 'r'); if ($fp === false) - die (Tools::displayError('Unable to open backup file').' "'.addslashes($backupfile).'"'); + die (Tools::displayError('Unable to open backup file(s).').' "'.addslashes($backupfile).'"'); // Add the correct headers, this forces the file is saved header('Content-Type: '.$contentType); @@ -71,4 +70,4 @@ $ret = @fpassthru($fp); fclose($fp); if ($ret === false) - die (Tools::displayError('Unable to display backup file').' "'.addslashes($backupfile).'"'); \ No newline at end of file + die (Tools::displayError('Unable to display backup file(s).').' "'.addslashes($backupfile).'"'); \ No newline at end of file diff --git a/admin-dev/backups/index.php b/admin-dev/backups/index.php index 88e934d59..195fab225 100644 --- a/admin-dev/backups/index.php +++ b/admin-dev/backups/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/cron_currency_rates.php b/admin-dev/cron_currency_rates.php index 36015d7e5..2bf94de21 100644 --- a/admin-dev/cron_currency_rates.php +++ b/admin-dev/cron_currency_rates.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/displayImage.php b/admin-dev/displayImage.php index 17ac32918..f873fdb22 100644 --- a/admin-dev/displayImage.php +++ b/admin-dev/displayImage.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ -require_once(dirname(__FILE__).'/../config/config.inc.php'); -require_once(dirname(__FILE__).'/init.php'); +define('_PS_ADMIN_DIR_', getcwd()); +require_once(_PS_ADMIN_DIR_.'/../config/config.inc.php'); +require_once(_PS_ADMIN_DIR_.'/init.php'); if (isset($_GET['img']) AND Validate::isMd5($_GET['img']) AND isset($_GET['name']) AND Validate::isGenericName($_GET['name']) AND file_exists(_PS_UPLOAD_DIR_.$_GET['img'])) { diff --git a/admin-dev/drawer.php b/admin-dev/drawer.php index 6d6c78384..22baa705c 100644 --- a/admin-dev/drawer.php +++ b/admin-dev/drawer.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @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()); -include_once(dirname(__FILE__).'/../config/config.inc.php'); +include_once(_PS_ADMIN_DIR_.'/../config/config.inc.php'); $module = Tools::getValue('module'); $render = Tools::getValue('render'); @@ -37,7 +37,6 @@ $height = Tools::getValue('height'); $id_employee = Tools::getValue('id_employee'); $id_lang = Tools::getValue('id_lang'); - if (!isset($cookie->id_employee) || !$cookie->id_employee || $cookie->id_employee != $id_employee) die(Tools::displayError()); @@ -47,6 +46,51 @@ if (!Validate::isModuleName($module)) if (!Tools::file_exists_cache($module_path = dirname(__FILE__).'/../modules/'.$module.'/'.$module.'.php')) die(Tools::displayError()); +$shop_id = ''; +Shop::setContext(Shop::CONTEXT_ALL); +if (Context::getContext()->cookie->shopContext) +{ + $split = explode('-', Context::getContext()->cookie->shopContext); + if (count($split) == 2) + { + if ($split[0] == 'g') + { + if (Context::getContext()->employee->hasAuthOnShopGroup($split[1])) + Shop::setContext(Shop::CONTEXT_GROUP, $split[1]); + else + { + $shop_id = Context::getContext()->employee->getDefaultShopID(); + Shop::setContext(Shop::CONTEXT_SHOP, $shop_id); + } + } + else if (Shop::getShop($split[1]) && Context::getContext()->employee->hasAuthOnShop($split[1])) + { + $shop_id = $split[1]; + Shop::setContext(Shop::CONTEXT_SHOP, $shop_id); + } + else + { + $shop_id = Context::getContext()->employee->getDefaultShopID(); + Shop::setContext(Shop::CONTEXT_SHOP, $shop_id); + } + } +} + +// Check multishop context and set right context if need +if (Shop::getContext()) +{ + if (Shop::getContext() == Shop::CONTEXT_SHOP && !Shop::CONTEXT_SHOP) + Shop::setContext(Shop::CONTEXT_GROUP, Shop::getContextShopGroupID()); + if (Shop::getContext() == Shop::CONTEXT_GROUP && !Shop::CONTEXT_GROUP) + Shop::setContext(Shop::CONTEXT_ALL); +} + +// Replace existing shop if necessary +if (!$shop_id) + Context::getContext()->shop = new Shop(Configuration::get('PS_SHOP_DEFAULT')); +elseif (Context::getContext()->shop->id != $shop_id) + Context::getContext()->shop = new Shop($shop_id); + require_once($module_path); $graph = new $module(); @@ -57,4 +101,3 @@ if ($option) $graph->create($render, $type, $width, $height, $layers); $graph->draw(); - diff --git a/admin-dev/export/index.php b/admin-dev/export/index.php index 88e934d59..195fab225 100644 --- a/admin-dev/export/index.php +++ b/admin-dev/export/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/footer.inc.php b/admin-dev/footer.inc.php index e41c93db3..de8dc6a14 100644 --- a/admin-dev/footer.inc.php +++ b/admin-dev/footer.inc.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -30,14 +30,14 @@ echo '
diff --git a/admin-dev/functions.php b/admin-dev/functions.php index a79749b62..314d2b867 100644 --- a/admin-dev/functions.php +++ b/admin-dev/functions.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - require_once(dirname(__FILE__).'/../images.inc.php'); - function bindDatepicker($id, $time) { if ($time) @@ -96,6 +94,8 @@ function rewriteSettingsFile($baseUrls = NULL, $theme = NULL, $arrayDB = NULL) $defines['_DB_PASSWD_'] = (($arrayDB AND isset($arrayDB['_DB_PASSWD_'])) ? $arrayDB['_DB_PASSWD_'] : _DB_PASSWD_); $defines['_COOKIE_KEY_'] = addslashes(_COOKIE_KEY_); $defines['_COOKIE_IV_'] = addslashes(_COOKIE_IV_); + $defines['_PS_CREATION_DATE_'] = addslashes(_PS_CREATION_DATE_); + if (defined('_RIJNDAEL_KEY_')) $defines['_RIJNDAEL_KEY_'] = addslashes(_RIJNDAEL_KEY_); if (defined('_RIJNDAEL_IV_')) @@ -223,8 +223,16 @@ function checkPSVersion() return $upgrader->checkPSVersion(); } +/** + * Deprecated since > 1.5.4.1 + * Use Translate::getAdminTranslation($string) instead + * + * @param string $string + */ function translate($string) { + Tools::displayAsDeprecated(); + global $_LANGADM; if (!is_array($_LANGADM)) return str_replace('"', '"', $string); @@ -233,7 +241,6 @@ function translate($string) return str_replace('"', '"', stripslashes($str)); } - /** * Returns a new Tab object * @@ -252,7 +259,7 @@ function checkingTab($tab) { if (isset(AdminTab::$tabParenting[$tab])) Tools::redirectAdmin('?tab='.AdminTab::$tabParenting[$tab].'&token='.Tools::getAdminTokenLite(AdminTab::$tabParenting[$tab])); - echo sprintf(Tools::displayError('Page %s cannot be found.'),$tab); + echo sprintf(Tools::displayError('Page %s cannot be found..'),$tab); return false; } @@ -265,7 +272,7 @@ function checkingTab($tab) $adminObj = new $tab; if (!$adminObj->viewAccess() AND ($adminObj->table != 'employee' OR Context::getContext()->employee->id != Tools::getValue('id_employee') OR !Tools::isSubmit('updateemployee'))) { - $adminObj->_errors = array(Tools::displayError('Access denied')); + $adminObj->_errors = array(Tools::displayError('Access denied.')); echo $adminObj->displayErrors(); return false; } @@ -431,7 +438,7 @@ function runAdminTab($tab, $ajaxMode = false) $bread = ''; foreach ($tabs AS $key => $item) { - $bread .= '
';
+ $bread .= '
';
if (count($tabs) - 1 > $key)
$bread .= '';
@@ -461,7 +468,7 @@ function runAdminTab($tab, $ajaxMode = false)
echo '';
if (!$ajaxMode && Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL && Context::getContext()->controller->multishop_context != Shop::CONTEXT_ALL)
@@ -470,10 +477,10 @@ function runAdminTab($tab, $ajaxMode = false)
if (Shop::getContext() == Shop::CONTEXT_GROUP)
{
$shop_group = new ShopGroup((int)Shop::getContextShopGroupID());
- printf(translate('You are configuring your store for group shop %s'), ''.$shop_group->name.'');
+ printf(Translate::getAdminTranslation('You are configuring your store for group shop %s'), ''.$shop_group->name.'');
}
elseif (Shop::getContext() == Shop::CONTEXT_SHOP)
- printf(translate('You are configuring your store for shop %s'), ''.Context::getContext()->shop->name.'');
+ printf(Translate::getAdminTranslation('You are configuring your store for shop %s'), ''.Context::getContext()->shop->name.'');
echo '';
}
if (Validate::isLoadedObject($adminObj))
@@ -546,8 +553,8 @@ function runAdminTab($tab, $ajaxMode = false)
// we can display the correct url
- // die(Tools::jsonEncode(array(translate('Invalid security token'),$url)));
- die(Tools::jsonEncode(translate('Invalid security token')));
+ // die(Tools::jsonEncode(array(Translate::getAdminTranslation('Invalid security token'),$url)));
+ die(Tools::jsonEncode(Translate::getAdminTranslation('Invalid security token')));
}
else
{
@@ -559,17 +566,17 @@ function runAdminTab($tab, $ajaxMode = false)
if (false === strpos($url, '?token=') AND false === strpos($url, '&token='))
$url .= '&token='.$adminObj->token;
- $message = translate('Invalid security token');
+ $message = Translate::getAdminTranslation('Invalid security token');
echo '
'.$message.'