[-] BO : fix bug #PSFV-529 - AdminGeolocalisation : isCleanHtml control on checkbox
This commit is contained in:
@@ -481,8 +481,6 @@ class AdminControllerCore extends Controller
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!isset($this->table))
|
|
||||||
return false;
|
|
||||||
// set token
|
// set token
|
||||||
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
|
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
|
||||||
|
|
||||||
|
|||||||
@@ -64,8 +64,9 @@ class HelperOptionsCore extends Helper
|
|||||||
|
|
||||||
foreach ($category_data['fields'] as $key => $field)
|
foreach ($category_data['fields'] as $key => $field)
|
||||||
{
|
{
|
||||||
// Set field value
|
// Set field value unless explicitly denied
|
||||||
$field['value'] = $this->getOptionValue($key, $field);
|
if (!isset($field['auto_value']) || $field['auto_value'])
|
||||||
|
$field['value'] = $this->getOptionValue($key, $field);
|
||||||
|
|
||||||
// Check if var is invisible (can't edit it in current shop context), or disable (use default value for multishop)
|
// Check if var is invisible (can't edit it in current shop context), or disable (use default value for multishop)
|
||||||
$isDisabled = $isInvisible = false;
|
$isDisabled = $isInvisible = false;
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ class AdminGeolocationControllerCore extends AdminController
|
|||||||
'title' => $this->l('Select countries that can access your store:'),
|
'title' => $this->l('Select countries that can access your store:'),
|
||||||
'type' => 'checkbox_table',
|
'type' => 'checkbox_table',
|
||||||
'identifier' => 'iso_code',
|
'identifier' => 'iso_code',
|
||||||
'list' => Country::getCountries($this->context->language->id)
|
'list' => Country::getCountries($this->context->language->id),
|
||||||
|
'auto_value' => false
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -85,48 +86,48 @@ class AdminGeolocationControllerCore extends AdminController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postProcess()
|
/**
|
||||||
|
* @see AdminController::processUpdateOptions()
|
||||||
|
*/
|
||||||
|
public function processUpdateOptions($token)
|
||||||
{
|
{
|
||||||
if (Tools::isSubmit('submitGeolocationWhitelist'))
|
$redirectAdmin = false;
|
||||||
|
if ($this->isGeoLiteCityAvailable())
|
||||||
{
|
{
|
||||||
$redirectAdmin = false;
|
Configuration::updateValue('PS_GEOLOCATION_ENABLED', intval(Tools::getValue('PS_GEOLOCATION_ENABLED')));
|
||||||
if ($this->isGeoLiteCityAvailable())
|
$redirectAdmin = true;
|
||||||
{
|
}
|
||||||
Configuration::updateValue('PS_GEOLOCATION_ENABLED', intval(Tools::getValue('PS_GEOLOCATION_ENABLED')));
|
else
|
||||||
$redirectAdmin = true;
|
$this->errors[] = Tools::displayError('Geolocation database is unavailable.');
|
||||||
}
|
|
||||||
else
|
|
||||||
$this->errors[] = Tools::displayError('Geolocation database is unavailable.');
|
|
||||||
|
|
||||||
if (!is_array(Tools::getValue('countries')) || !count(Tools::getValue('countries')))
|
if (!is_array(Tools::getValue('countries')) || !count(Tools::getValue('countries')))
|
||||||
$this->errors[] = Tools::displayError('Country selection is invalid');
|
$this->errors[] = Tools::displayError('Country selection is invalid');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Configuration::updateValue(
|
Configuration::updateValue(
|
||||||
'PS_GEOLOCATION_BEHAVIOR',
|
'PS_GEOLOCATION_BEHAVIOR',
|
||||||
(!(int)Tools::getValue('PS_GEOLOCATION_BEHAVIOR') ? _PS_GEOLOCATION_NO_CATALOG_ : _PS_GEOLOCATION_NO_ORDER_)
|
(!(int)Tools::getValue('PS_GEOLOCATION_BEHAVIOR') ? _PS_GEOLOCATION_NO_CATALOG_ : _PS_GEOLOCATION_NO_ORDER_)
|
||||||
);
|
);
|
||||||
Configuration::updateValue('PS_GEOLOCATION_NA_BEHAVIOR', (int)Tools::getValue('PS_GEOLOCATION_NA_BEHAVIOR'));
|
Configuration::updateValue('PS_GEOLOCATION_NA_BEHAVIOR', (int)Tools::getValue('PS_GEOLOCATION_NA_BEHAVIOR'));
|
||||||
Configuration::updateValue('PS_ALLOWED_COUNTRIES', implode(';', Tools::getValue('countries')));
|
Configuration::updateValue('PS_ALLOWED_COUNTRIES', implode(';', Tools::getValue('countries')));
|
||||||
$redirectAdmin = true;
|
$redirectAdmin = true;
|
||||||
}
|
|
||||||
|
|
||||||
if (!Validate::isCleanHtml(Tools::getValue('PS_GEOLOCATION_WHITELIST')))
|
|
||||||
$this->errors[] = Tools::displayError('Invalid whitelist');
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Configuration::updateValue(
|
|
||||||
'PS_GEOLOCATION_WHITELIST',
|
|
||||||
str_replace("\n", ';', str_replace("\r", '', Tools::getValue('PS_GEOLOCATION_WHITELIST')))
|
|
||||||
);
|
|
||||||
$redirectAdmin = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($redirectAdmin)
|
|
||||||
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::postProcess();
|
if (!Validate::isCleanHtml(Tools::getValue('PS_GEOLOCATION_WHITELIST')))
|
||||||
|
$this->errors[] = Tools::displayError('Invalid whitelist');
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Configuration::updateValue(
|
||||||
|
'PS_GEOLOCATION_WHITELIST',
|
||||||
|
str_replace("\n", ';', str_replace("\r", '', Tools::getValue('PS_GEOLOCATION_WHITELIST')))
|
||||||
|
);
|
||||||
|
$redirectAdmin = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($redirectAdmin)
|
||||||
|
$this->redirect_after = self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4';
|
||||||
|
|
||||||
|
return parent::processUpdateOptions($token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderOptions()
|
public function renderOptions()
|
||||||
|
|||||||
Reference in New Issue
Block a user