// Fix assignations in conditions with logical operators + normalize
This commit is contained in:
@@ -1340,7 +1340,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
if (!$new_path = $image->getPathForCreation())
|
||||
$this->errors[] = Tools::displayError('An error occurred during new folder creation');
|
||||
if (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') || !move_uploaded_file($_FILES['image_product']['tmp_name'], $tmpName))
|
||||
if (!($tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS')) || !move_uploaded_file($_FILES['image_product']['tmp_name'], $tmpName))
|
||||
$this->errors[] = Tools::displayError('An error occurred during the image upload');
|
||||
else if (!ImageManager::resize($tmpName, $new_path.'.'.$image->image_format))
|
||||
$this->errors[] = Tools::displayError('An error occurred while copying image.');
|
||||
|
||||
@@ -79,7 +79,7 @@ class AdminTagsControllerCore extends AdminController
|
||||
public function postProcess()
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1' && Tools::getValue('submitAdd'.$this->table))
|
||||
if ($id = (int)Tools::getValue($this->identifier) && $obj = new $this->className($id) && Validate::isLoadedObject($obj))
|
||||
if (($id = (int)Tools::getValue($this->identifier)) && ($obj = new $this->className($id)) && Validate::isLoadedObject($obj))
|
||||
$obj->setProducts($_POST['products']);
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
@@ -502,7 +502,7 @@ class AuthControllerCore extends FrontController
|
||||
{
|
||||
// if registration type is in one step, we save the address
|
||||
if (Configuration::get('PS_REGISTRATION_PROCESS_TYPE'))
|
||||
if (!$country = new Country($address->id_country, Configuration::get('PS_LANG_DEFAULT')) || !Validate::isLoadedObject($country))
|
||||
if (!($country = new Country($address->id_country, Configuration::get('PS_LANG_DEFAULT'))) || !Validate::isLoadedObject($country))
|
||||
die(Tools::displayError());
|
||||
$contains_state = isset($country) && is_object($country) ? (int)$country->contains_state: 0;
|
||||
$id_state = isset($address) && is_object($address) ? (int)$address->id_state: 0;
|
||||
|
||||
@@ -87,7 +87,7 @@ class BlockSpecials extends Module
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return ;
|
||||
|
||||
if (!$special = Product::getRandomSpecial((int)$params['cookie']->id_lang) AND !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY'))
|
||||
if (!($special = Product::getRandomSpecial((int)$params['cookie']->id_lang)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY'))
|
||||
return;
|
||||
|
||||
$this->smarty->assign(array(
|
||||
|
||||
@@ -49,9 +49,9 @@ class BlockTags extends Module
|
||||
function install()
|
||||
{
|
||||
if (parent::install() == false
|
||||
OR $this->registerHook('leftColumn') == false
|
||||
OR $this->registerHook('header') == false
|
||||
OR Configuration::updateValue('BLOCKTAGS_NBR', 10) == false)
|
||||
|| $this->registerHook('leftColumn') == false
|
||||
|| $this->registerHook('header') == false
|
||||
|| Configuration::updateValue('BLOCKTAGS_NBR', 10) == false)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -61,13 +61,13 @@ class BlockTags extends Module
|
||||
$output = '<h2>'.$this->displayName.'</h2>';
|
||||
if (Tools::isSubmit('submitBlockTags'))
|
||||
{
|
||||
if (!$tagsNbr = Tools::getValue('tagsNbr') OR empty($tagsNbr))
|
||||
if (!($tagsNbr = Tools::getValue('tagsNbr')) || empty($tagsNbr))
|
||||
$output .= '<div class="alert error">'.$this->l('Please fill in the "tags displayed" field.').'</div>';
|
||||
elseif ((int)($tagsNbr) == 0)
|
||||
$output .= '<div class="alert error">'.$this->l('Invalid number.').'</div>';
|
||||
else
|
||||
{
|
||||
Configuration::updateValue('BLOCKTAGS_NBR', (int)($tagsNbr));
|
||||
Configuration::updateValue('BLOCKTAGS_NBR', (int)$tagsNbr);
|
||||
$output .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="'.$this->l('Confirmation').'" />'.$this->l('Settings updated').'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,13 +62,13 @@ class BlockViewed extends Module
|
||||
$output = '<h2>'.$this->displayName.'</h2>';
|
||||
if (Tools::isSubmit('submitBlockViewed'))
|
||||
{
|
||||
if (!$productNbr = Tools::getValue('productNbr') OR empty($productNbr))
|
||||
if (!($productNbr = Tools::getValue('productNbr')) || empty($productNbr))
|
||||
$output .= '<div class="alert error">'.$this->l('You must fill in the \'Products displayed\' field.').'</div>';
|
||||
elseif ((int)($productNbr) == 0)
|
||||
$output .= '<div class="alert error">'.$this->l('Invalid number.').'</div>';
|
||||
else
|
||||
{
|
||||
Configuration::updateValue('PRODUCTS_VIEWED_NBR', (int)($productNbr));
|
||||
Configuration::updateValue('PRODUCTS_VIEWED_NBR', (int)$productNbr);
|
||||
$output .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="'.$this->l('Confirmation').'" />'.$this->l('Settings updated').'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,14 +153,14 @@ class Editorial extends Module
|
||||
$editorial->update();
|
||||
|
||||
/* upload the image */
|
||||
if (isset($_FILES['body_homepage_logo']) AND isset($_FILES['body_homepage_logo']['tmp_name']) AND !empty($_FILES['body_homepage_logo']['tmp_name']))
|
||||
if (isset($_FILES['body_homepage_logo']) && isset($_FILES['body_homepage_logo']['tmp_name']) && !empty($_FILES['body_homepage_logo']['tmp_name']))
|
||||
{
|
||||
Configuration::set('PS_IMAGE_GENERATION_METHOD', 1);
|
||||
if(file_exists(dirname(__FILE__).'/homepage_logo.jpg'))
|
||||
unlink(dirname(__FILE__).'/homepage_logo.jpg');
|
||||
if ($error = ImageManager::validateUpload($_FILES['body_homepage_logo']))
|
||||
$errors .= $error;
|
||||
elseif (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') OR !move_uploaded_file($_FILES['body_homepage_logo']['tmp_name'], $tmpName))
|
||||
elseif (!($tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS')) || !move_uploaded_file($_FILES['body_homepage_logo']['tmp_name'], $tmpName))
|
||||
return false;
|
||||
elseif (!ImageManager::resize($tmpName, dirname(__FILE__).'/homepage_logo.jpg'))
|
||||
$errors .= $this->displayError($this->l('An error occurred during the image upload.'));
|
||||
|
||||
Reference in New Issue
Block a user