// Fix assignations in conditions with logical operators + normalize

This commit is contained in:
rMalie
2012-02-01 16:42:20 +00:00
parent 4c97888a66
commit 7501cb424c
7 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -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(
+5 -5
View File
@@ -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>';
}
}
+2 -2
View File
@@ -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>';
}
}
+2 -2
View File
@@ -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.'));