Merge branch 'origin/develop' into gli-1078
This commit is contained in:
@@ -881,7 +881,7 @@ class AdminControllerCore extends Controller
|
||||
$key = isset($tmp_tab[1]) ? $tmp_tab[0].'.`'.$tmp_tab[1].'`' : '`'.$tmp_tab[0].'`';
|
||||
|
||||
// as in database 0 means position 1 in the renderlist
|
||||
if (isset($field['position'])) {
|
||||
if (isset($field['position']) && Validate::isInt($value)) {
|
||||
$value -= 1;
|
||||
}
|
||||
|
||||
@@ -4018,9 +4018,23 @@ class AdminControllerCore extends Controller
|
||||
$object = new $this->className((int)$id);
|
||||
$object->setFieldsToUpdate(array('active' => true));
|
||||
$object->active = (int)$status;
|
||||
$result &= $object->update();
|
||||
$isUpdated = (bool) $object->update();
|
||||
$result &= $isUpdated;
|
||||
|
||||
if (!$isUpdated) {
|
||||
$this->errors[] = sprintf($this->l('Can\'t update #%d status.'), (int) $id);
|
||||
}
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
$this->redirect_after = self::$currentIndex.'&conf=5&token='.$this->token;
|
||||
} else {
|
||||
$this->errors[] = $this->l('An error occurred while updating the status.');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('You must select at least one item to perform a bulk action.');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@@ -796,6 +796,9 @@ class FrontControllerCore extends Controller
|
||||
'HOOK_MAINTENANCE' => Hook::exec('displayMaintenance', array()),
|
||||
'allowEmployee' => Configuration::get('PS_ALLOW_EMP'),
|
||||
'maintenance' => $this->context->link->getAdminLink('AdminMaintenance', false),
|
||||
'languages' => Language::getLanguages(true, $this->context->shop->id),
|
||||
'lang_iso' => $this->context->language->iso_code,
|
||||
'link' => $this->context->link,
|
||||
));
|
||||
// If the controller is a module, then getTemplatePath will try to find the template in the modules, so we need to instanciate a real frontcontroller
|
||||
$front_controller = preg_match('/ModuleFrontController$/', get_class($this)) ? new FrontController() : $this;
|
||||
@@ -918,8 +921,16 @@ class FrontControllerCore extends Controller
|
||||
}
|
||||
$excluded_key = array('isolang', 'id_lang', 'controller', 'fc', 'id_product', 'id_category', 'id_manufacturer', 'id_supplier', 'id_cms');
|
||||
foreach ($_GET as $key => $value) {
|
||||
if (!in_array($key, $excluded_key) && Validate::isUrl($key) && Validate::isUrl($value)) {
|
||||
$params[Tools::safeOutput($key)] = Tools::safeOutput($value);
|
||||
if (!in_array($key, $excluded_key)) {
|
||||
if (is_array($value)) {
|
||||
if (Validate::isUrl($key)) {
|
||||
$params[Tools::safeOutput($key)] = $this->sanitizeQueryOutput($value);
|
||||
}
|
||||
} else {
|
||||
if (Validate::isUrl($key) && Validate::isUrl($value)) {
|
||||
$params[Tools::safeOutput($key)] = Tools::safeOutput($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -944,6 +955,24 @@ class FrontControllerCore extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
protected function sanitizeQueryOutput($query)
|
||||
{
|
||||
$params = array();
|
||||
foreach ($query as $key => $value) {
|
||||
if (Validate::isUrl($key)) {
|
||||
if (is_array($value)) {
|
||||
$params[Tools::safeOutput($key)] = $this->sanitizeQueryOutput($value);
|
||||
} else {
|
||||
if (Validate::isUrl($value)) {
|
||||
$params[Tools::safeOutput($key)] = Tools::safeOutput($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Geolocation management
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user