// Improve performance and bug fixes
This commit is contained in:
@@ -426,7 +426,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
if (isset($_GET['filename']) && file_exists(_PS_UPLOAD_DIR_.$_GET['filename']))
|
||||
if (isset($_GET['filename']) && file_exists(_PS_UPLOAD_DIR_.$_GET['filename']) && Validate::isFileName($_GET['filename']))
|
||||
AdminCustomerThreadsController::openUploadedFile();
|
||||
|
||||
return parent::initContent();
|
||||
@@ -449,7 +449,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
|
||||
'.jpg' => 'image/jpeg',
|
||||
);
|
||||
|
||||
$extension = '';
|
||||
$extension = false;
|
||||
foreach ($extensions as $key => $val)
|
||||
if (substr($filename, -4) == $key || substr($filename, -5) == $key)
|
||||
{
|
||||
@@ -457,6 +457,9 @@ class AdminCustomerThreadsControllerCore extends AdminController
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$extension || !Validate::isFileName($filename))
|
||||
die(Tools::displayError());
|
||||
|
||||
ob_end_clean();
|
||||
header('Content-Type: '.$extension);
|
||||
header('Content-Disposition:attachment;filename="'.$filename.'"');
|
||||
|
||||
@@ -144,29 +144,33 @@ class AdminLocalizationControllerCore extends AdminController
|
||||
{
|
||||
if (Tools::isSubmit('submitLocalizationPack'))
|
||||
{
|
||||
$version = str_replace('.', '', _PS_VERSION_);
|
||||
$version = substr($version, 0, 2);
|
||||
$version = str_replace('.', '', _PS_VERSION_);
|
||||
$version = substr($version, 0, 2);
|
||||
|
||||
$pack = @Tools::file_get_contents('http://api.prestashop.com/localization/'.$version.'/'.Tools::getValue('iso_localization_pack').'.xml');
|
||||
|
||||
if (!$pack && !($pack = @Tools::file_get_contents(dirname(__FILE__).'/../../localization/'.Tools::getValue('iso_localization_pack').'.xml')))
|
||||
$this->errors[] = Tools::displayError('Cannot load localization pack (from prestashop.com and from your local folder "localization")');
|
||||
|
||||
if (!$selection = Tools::getValue('selection'))
|
||||
$this->errors[] = Tools::displayError('Please select at least one item to import.');
|
||||
else
|
||||
if (Validate::isFileName(Tools::getValue('iso_localization_pack')))
|
||||
{
|
||||
foreach ($selection as $selected)
|
||||
if (!Validate::isLocalizationPackSelection($selected))
|
||||
{
|
||||
$this->errors[] = Tools::displayError('Invalid selection');
|
||||
return;
|
||||
}
|
||||
$localization_pack = new LocalizationPack();
|
||||
if (!$localization_pack->loadLocalisationPack($pack, $selection))
|
||||
$this->errors = array_merge($this->errors, $localization_pack->getErrors());
|
||||
|
||||
$pack = @Tools::file_get_contents('http://api.prestashop.com/localization/'.$version.'/'.Tools::getValue('iso_localization_pack').'.xml');
|
||||
|
||||
if (!$pack && !($pack = @Tools::file_get_contents(dirname(__FILE__).'/../../localization/'.Tools::getValue('iso_localization_pack').'.xml')))
|
||||
$this->errors[] = Tools::displayError('Cannot load localization pack (from prestashop.com and from your local folder "localization")');
|
||||
|
||||
if (!$selection = Tools::getValue('selection'))
|
||||
$this->errors[] = Tools::displayError('Please select at least one item to import.');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=23&token='.$this->token);
|
||||
{
|
||||
foreach ($selection as $selected)
|
||||
if (!Validate::isLocalizationPackSelection($selected))
|
||||
{
|
||||
$this->errors[] = Tools::displayError('Invalid selection');
|
||||
return;
|
||||
}
|
||||
$localization_pack = new LocalizationPack();
|
||||
if (!$localization_pack->loadLocalisationPack($pack, $selection))
|
||||
$this->errors = array_merge($this->errors, $localization_pack->getErrors());
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=23&token='.$this->token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -805,7 +805,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
elseif (Tools::isSubmit('submitAddOrder') && ($id_cart = Tools::getValue('id_cart')) &&
|
||||
($module_name = Tools::getValue('payment_module_name')) &&
|
||||
($id_order_state = Tools::getValue('id_order_state')))
|
||||
($id_order_state = Tools::getValue('id_order_state')) && Validate::isModuleName($module_name))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
|
||||
@@ -285,7 +285,8 @@ class AdminRequestSqlControllerCore extends AdminController
|
||||
public function generateExport()
|
||||
{
|
||||
$id = Tools::getValue($this->identifier);
|
||||
|
||||
if (!Validate::isFileName($id))
|
||||
die(Tools::displayError());
|
||||
$file = 'request_sql_'.$id.'.csv';
|
||||
if ($csv = fopen(_PS_ADMIN_DIR_.'/export/'.$file, 'w'))
|
||||
{
|
||||
|
||||
@@ -154,7 +154,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
{
|
||||
$tpl = $this->createTemplate('stats.tpl');
|
||||
|
||||
if (!($module_name = Tools::getValue('module')) && ($module_instance = Module::getInstanceByName('statsforecast')) && $module_instance->active)
|
||||
if ((!($module_name = Tools::getValue('module')) || !Validate::isModuleName($module_name)) && ($module_instance = Module::getInstanceByName('statsforecast')) && $module_instance->active)
|
||||
$module_name = 'statsforecast';
|
||||
|
||||
if ($module_name)
|
||||
@@ -163,7 +163,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
|
||||
if (!isset($module_instance))
|
||||
$module_instance = Module::getInstanceByName($module_name);
|
||||
|
||||
|
||||
if ($module_instance && $module_instance->active)
|
||||
$hook = Hook::exec('displayAdminStatsModules', null, $module_instance->id);
|
||||
}
|
||||
@@ -246,4 +246,4 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
$day = isset($this->context->cookie->stats_day) ? sprintf('%02d', $this->context->cookie->stats_day) : '%';
|
||||
return $year.'-'.$month.'-'.$day;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ class AdminStoresControllerCore extends AdminController
|
||||
|
||||
$hours = $this->getFieldValue($obj, 'hours');
|
||||
if (!empty($hours))
|
||||
$hours_unserialized = unserialize($hours);
|
||||
$hours_unserialized = Tools::unSerialize($hours);
|
||||
|
||||
$this->fields_value = array(
|
||||
'latitude' => $this->getFieldValue($obj, 'latitude') ? $this->getFieldValue($obj, 'latitude') : Configuration::get('PS_STORES_CENTER_LAT'),
|
||||
|
||||
Reference in New Issue
Block a user