Skip to content

Commit

Permalink
Fixed conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosomb committed Nov 6, 2023
2 parents 5016048 + e98003d commit 768cde4
Show file tree
Hide file tree
Showing 42 changed files with 114 additions and 87 deletions.
2 changes: 1 addition & 1 deletion admin-dev/filemanager/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
$cms_accesses = Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminCmsContent'));

if (!$products_accesses['edit'] && !$cms_accesses['edit']) {
die(Tools::displayError());
die(Tools::displayError('Access forbidden.'));
}
//------------------------------------------------------------------------------
// DON'T COPY THIS VARIABLES IN FOLDERS config.php FILES
Expand Down
13 changes: 8 additions & 5 deletions classes/CMSCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,11 @@ public static function recurseCMSCategory($categories, $current, $id_cms_categor
*/
protected function recursiveDelete(&$to_delete, $id_cms_category)
{
if (!is_array($to_delete) || !$id_cms_category) {
die(Tools::displayError());
if (!is_array($to_delete)) {
die(Tools::displayError('Parameter "to_delete" is invalid.'));
}
if (!$id_cms_category) {
die(Tools::displayError('Parameter "id_cms_category" is invalid.'));
}

$result = Db::getInstance()->executeS('
Expand Down Expand Up @@ -341,7 +344,7 @@ public function calcLevelDepth()
public static function getCategories($id_lang, $active = true, $order = true)
{
if (!Validate::isBool($active)) {
die(Tools::displayError());
die(Tools::displayError('Parameter "active" is invalid.'));
}

$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
Expand Down Expand Up @@ -385,7 +388,7 @@ public static function getSimpleCategories($id_lang)
public function getSubCategories($id_lang, $active = true)
{
if (!Validate::isBool($active)) {
die(Tools::displayError());
die(Tools::displayError('Parameter "active" is invalid.'));
}

$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
Expand Down Expand Up @@ -433,7 +436,7 @@ public static function getHomeCategories($id_lang, $active = true)
public static function getChildren($id_parent, $id_lang, $active = true)
{
if (!Validate::isBool($active)) {
die(Tools::displayError());
die(Tools::displayError('Parameter "active" is invalid.'));
}

$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
Expand Down
9 changes: 6 additions & 3 deletions classes/Carrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,11 @@ public static function getIdTaxRulesGroupMostUsed()
*/
public static function getDeliveredCountries($id_lang, $active_countries = false, $active_carriers = false, $contain_states = null)
{
if (!Validate::isBool($active_countries) || !Validate::isBool($active_carriers)) {
die(Tools::displayError());
if (!Validate::isBool($active_countries)) {
die(Tools::displayError('Parameter "active_countries" is invalid.'));
}
if (!Validate::isBool($active_carriers)) {
die(Tools::displayError('Parameter "active_carriers" is invalid.'));
}

$states = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
Expand Down Expand Up @@ -1244,7 +1247,7 @@ public static function getIdTaxRulesGroupByIdCarrier($id_carrier, Context $conte
public function setTaxRulesGroup($id_tax_rules_group, $all_shops = false)
{
if (!Validate::isUnsignedId($id_tax_rules_group)) {
die(Tools::displayError());
die(Tools::displayError('Parameter "id_tax_rules_group" is invalid.'));
}

if (!$all_shops) {
Expand Down
4 changes: 2 additions & 2 deletions classes/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@ public function updateQty(
}

if (!Validate::isLoadedObject($product)) {
die(Tools::displayError());
die(Tools::displayError(sprintf('Product with ID "%s" could not be loaded.', $id_product)));
}

if (isset(self::$_nbProducts[$this->id])) {
Expand Down Expand Up @@ -1892,7 +1892,7 @@ public static function getTotalCart($id_cart, $use_tax_display = false, $type =
{
$cart = new Cart($id_cart);
if (!Validate::isLoadedObject($cart)) {
die(Tools::displayError());
die(Tools::displayError(sprintf('Cart with ID "%s" could not be loaded.', $id_cart)));
}

$with_taxes = $use_tax_display ? $cart->_taxCalculationMethod != PS_TAX_EXC : true;
Expand Down
21 changes: 12 additions & 9 deletions classes/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,11 @@ public function recurseLiteCategTree($maxDepth = 3, $currentDepth = 0, $idLang =
*/
protected function recursiveDelete(&$toDelete, $idCategory)
{
if (!is_array($toDelete) || !$idCategory) {
die(Tools::displayError());
if (!is_array($toDelete)) {
die(Tools::displayError('Parameter "toDelete" is invalid.'));
}
if (!$idCategory) {
die(Tools::displayError('Parameter "idCategory" is invalid.'));
}

$sql = new DbQuery();
Expand Down Expand Up @@ -614,7 +617,7 @@ public function recalculateLevelDepth($idParentCategory)
public static function getCategories($idLang = false, $active = true, $order = true, $sqlFilter = '', $orderBy = '', $limit = '')
{
if (!Validate::isBool($active)) {
die(Tools::displayError());
die(Tools::displayError('Parameter "active" is invalid.'));
}
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
'
Expand Down Expand Up @@ -684,11 +687,11 @@ public static function getAllCategoriesName(
$limit = ''
) {
if (isset($idRootCategory) && !Validate::isInt($idRootCategory)) {
die(Tools::displayError());
die(Tools::displayError('Parameter "idRootCategory" was provided, but it\'s not a valid integer.'));
}

if (!Validate::isBool($active)) {
die(Tools::displayError());
die(Tools::displayError('Parameter "active" is invalid.'));
}

if (isset($groups) && Group::isFeatureActive() && !is_array($groups)) {
Expand Down Expand Up @@ -759,11 +762,11 @@ public static function getNestedCategories(
$limit = ''
) {
if (isset($idRootCategory) && !Validate::isInt($idRootCategory)) {
die(Tools::displayError());
die(Tools::displayError('Parameter "idRootCategory" was provided, but it\'s not a valid integer.'));
}

if (!Validate::isBool($active)) {
die(Tools::displayError());
die(Tools::displayError('Parameter "active" is invalid.'));
}

if (isset($groups) && Group::isFeatureActive() && !is_array($groups)) {
Expand Down Expand Up @@ -1134,7 +1137,7 @@ public static function getRootCategory($idLang = null, Shop $shop = null)
public static function getChildren($idParent, $idLang, $active = true, $idShop = false)
{
if (!Validate::isBool($active)) {
die(Tools::displayError());
die(Tools::displayError('Parameter "active" is invalid.'));
}

$cacheId = 'Category::getChildren_' . (int) $idParent . '-' . (int) $idLang . '-' . (bool) $active . '-' . (int) $idShop;
Expand Down Expand Up @@ -1170,7 +1173,7 @@ public static function getChildren($idParent, $idLang, $active = true, $idShop =
public static function hasChildren($idParent, $idLang, $active = true, $idShop = false)
{
if (!Validate::isBool($active)) {
die(Tools::displayError());
die(Tools::displayError('Parameter "active" is invalid.'));
}

$cacheId = 'Category::hasChildren_' . (int) $idParent . '-' . (int) $idLang . '-' . (bool) $active . '-' . (int) $idShop;
Expand Down
2 changes: 1 addition & 1 deletion classes/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public function __isset($key)
public function __set($key, $value)
{
if (is_array($value)) {
die(Tools::displayError());
die(Tools::displayError('Cookie value can\'t be an array.'));
}
if (preg_match('/¤|\|/', $key . $value)) {
throw new Exception('Forbidden chars in cookie');
Expand Down
11 changes: 7 additions & 4 deletions classes/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public static function getCountriesByIdShop($idShop, $idLang)
public static function getByIso($isoCode, $active = false)
{
if (!Validate::isLanguageIsoCode($isoCode)) {
die(Tools::displayError());
die(Tools::displayError('Given iso code (' . $isoCode . ') is not valid.'));
}
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(
'
Expand All @@ -211,7 +211,7 @@ public static function getByIso($isoCode, $active = false)
public static function getIdZone($idCountry)
{
if (!Validate::isUnsignedId($idCountry)) {
die(Tools::displayError());
die(Tools::displayError('Country ID is invalid.'));
}

if (isset(self::$_idZones[$idCountry])) {
Expand Down Expand Up @@ -362,8 +362,11 @@ public static function getZipCodeFormat($idCountry)
*/
public static function getCountriesByZoneId($idZone, $idLang)
{
if (empty($idZone) || empty($idLang)) {
die(Tools::displayError());
if (empty($idZone)) {
die(Tools::displayError('Zone ID is invalid.'));
}
if (empty($idLang)) {
die(Tools::displayError('Lang ID is invalid.'));
}

$sql = ' SELECT DISTINCT c.*, cl.*
Expand Down
2 changes: 1 addition & 1 deletion classes/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ public static function getAddressesTotalById($idCustomer)
public static function checkPassword($idCustomer, $passwordHash)
{
if (!Validate::isUnsignedId($idCustomer)) {
die(Tools::displayError());
die(Tools::displayError('Customer ID is invalid.'));
}

// Check that customers password hasn't changed since last login
Expand Down
6 changes: 3 additions & 3 deletions classes/Employee.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public static function getEmployees($activeOnly = true)
public function getByEmail($email, $plaintextPassword = null, $activeOnly = true)
{
if (!Validate::isEmail($email)) {
die(Tools::displayError());
die(Tools::displayError('Email address is invalid.'));
}

$sql = new DbQuery();
Expand Down Expand Up @@ -359,7 +359,7 @@ public function getByEmail($email, $plaintextPassword = null, $activeOnly = true
public static function employeeExists($email)
{
if (!Validate::isEmail($email)) {
die(Tools::displayError());
die(Tools::displayError('Email address is invalid.'));
}

return (bool) Db::getInstance()->getValue('
Expand All @@ -379,7 +379,7 @@ public static function employeeExists($email)
public static function checkPassword($idEmployee, $passwordHash)
{
if (!Validate::isUnsignedId($idEmployee)) {
die(Tools::displayError());
die(Tools::displayError('Employee ID is invalid.'));
}

$sql = new DbQuery();
Expand Down
2 changes: 1 addition & 1 deletion classes/Feature.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function update($nullValues = false)
foreach ($fields as $field) {
foreach (array_keys($field) as $key) {
if (!Validate::isTableOrIdentifier($key)) {
die(Tools::displayError());
die(Tools::displayError('Invalid column name in feature_lang table.'));
}
}

Expand Down
2 changes: 1 addition & 1 deletion classes/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ public static function getHighestPosition($idProduct)
public static function deleteCover($idProduct)
{
if (!Validate::isUnsignedId($idProduct)) {
die(Tools::displayError());
die(Tools::displayError('Product ID is invalid.'));
}

if (file_exists(_PS_TMP_IMG_DIR_ . 'product_' . $idProduct . '.jpg')) {
Expand Down
2 changes: 1 addition & 1 deletion classes/ImageType.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public static function getImageTypeById(int $id): array
public static function typeAlreadyExists($typeName)
{
if (!Validate::isImageTypeName($typeName)) {
die(Tools::displayError());
die(Tools::displayError(sprintf('"%s" is not valid image type name.', $typeName)));
}

Db::getInstance()->executeS('
Expand Down
2 changes: 1 addition & 1 deletion classes/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ public function delete()
public function deleteSelection($selection)
{
if (!is_array($selection)) {
die(Tools::displayError());
die(Tools::displayError('Parameter "selection" must be an array.'));
}

$result = true;
Expand Down
4 changes: 2 additions & 2 deletions classes/Manufacturer.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function delete()
public function deleteSelection($selection)
{
if (!is_array($selection)) {
die(Tools::displayError());
die(Tools::displayError('Parameter "selection" must be an array.'));
}

$result = true;
Expand Down Expand Up @@ -404,7 +404,7 @@ public static function getProducts(
}

if (!Validate::isOrderBy($orderBy) || !Validate::isOrderWay($orderWay)) {
die(Tools::displayError());
die(Tools::displayError('Invalid sorting parameters provided.'));
}

$groups = FrontController::getCurrentCustomerGroups();
Expand Down
11 changes: 7 additions & 4 deletions classes/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static function getMessageByCartId($idCart)
public static function getMessagesByOrderId($idOrder, $private = false, Context $context = null)
{
if (!Validate::isBool($private)) {
die(Tools::displayError());
die(Tools::displayError('Parameter "private" is invalid.'));
}

if (!$context) {
Expand Down Expand Up @@ -149,7 +149,7 @@ public static function getMessagesByOrderId($idOrder, $private = false, Context
public static function getMessagesByCartId($idCart, $private = false, Context $context = null)
{
if (!Validate::isBool($private)) {
die(Tools::displayError());
die(Tools::displayError('Parameter "private" is invalid.'));
}

if (!$context) {
Expand Down Expand Up @@ -180,8 +180,11 @@ public static function getMessagesByCartId($idCart, $private = false, Context $c
*/
public static function markAsReaded($idMessage, $idEmployee)
{
if (!Validate::isUnsignedId($idMessage) || !Validate::isUnsignedId($idEmployee)) {
die(Tools::displayError());
if (!Validate::isUnsignedId($idMessage)) {
die(Tools::displayError('Message ID is invalid.'));
}
if (!Validate::isUnsignedId($idEmployee)) {
die(Tools::displayError('Employee ID is invalid.'));
}

$result = Db::getInstance()->execute('
Expand Down
2 changes: 1 addition & 1 deletion classes/Meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public function delete()
public function deleteSelection($selection)
{
if (!is_array($selection)) {
die(Tools::displayError());
die(Tools::displayError('Parameter "selection" must be an array.'));
}
$result = true;
foreach ($selection as $id) {
Expand Down
6 changes: 3 additions & 3 deletions classes/PaymentModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,12 @@ public function validateOrder(
if (!Validate::isLoadedObject($order_status)) {
PrestaShopLogger::addLog('PaymentModule::validateOrder - Order Status cannot be loaded', 3, null, 'Cart', (int) $id_cart, true);

throw new PrestaShopException('Can\'t load Order status');
throw new PrestaShopException('Error processing order. Can\'t load Order status.');
}

if (!$this->active) {
PrestaShopLogger::addLog('PaymentModule::validateOrder - Module is not active', 3, null, 'Cart', (int) $id_cart, true);
die(Tools::displayError());
die(Tools::displayError('Error processing order. Payment module is not active.'));
}

// Make sure cart is loaded and not related to an existing order
Expand All @@ -257,7 +257,7 @@ public function validateOrder(

if ($secure_key !== false && $secure_key != $this->context->cart->secure_key) {
PrestaShopLogger::addLog('PaymentModule::validateOrder - Secure key does not match', 3, null, 'Cart', (int) $id_cart, true);
die(Tools::displayError());
die(Tools::displayError('Error processing order. Secure key does not match.'));
}

// For each package, generate an order
Expand Down
2 changes: 1 addition & 1 deletion classes/PrestaShopBackup.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static function getBackupPath($filename = '')
}

if ($backupfile === false || strncmp($backupdir, $backupfile, strlen($backupdir)) != 0) {
die(Tools::displayError());
die(Tools::displayError('Invalid backup file.'));
}

return $backupfile;
Expand Down
Loading

0 comments on commit 768cde4

Please sign in to comment.