// Changed base64 to urlencode in import (and fixed filename issue)
This commit is contained in:
@@ -147,14 +147,14 @@
|
|||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu" role="menu">
|
<ul class="dropdown-menu" role="menu">
|
||||||
<li>
|
<li>
|
||||||
<a href="{$current}&token={$token}&csvfilename={$filename|@base64_encode}" target="_blank">
|
<a href="{$current}&token={$token}&csvfilename={$filename|@urlencode}" target="_blank">
|
||||||
<i class="icon-download"></i>
|
<i class="icon-download"></i>
|
||||||
{l s='Download'}
|
{l s='Download'}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li>
|
<li>
|
||||||
<a href="{$current}&token={$token}&csvfilename={$filename|@base64_encode}&delete=1">
|
<a href="{$current}&token={$token}&csvfilename={$filename|@urlencode}&delete=1">
|
||||||
<i class="icon-trash"></i>
|
<i class="icon-trash"></i>
|
||||||
{l s='Delete'}
|
{l s='Delete'}
|
||||||
</a>
|
</a>
|
||||||
@@ -404,7 +404,7 @@
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
var file_add_button = Ladda.create( document.querySelector('#file-add-button' ));
|
var file_add_button = Ladda.create(document.querySelector('#file-add-button'));
|
||||||
var file_total_files = 0;
|
var file_total_files = 0;
|
||||||
|
|
||||||
$('#file').fileupload({
|
$('#file').fileupload({
|
||||||
@@ -427,15 +427,16 @@
|
|||||||
else {
|
else {
|
||||||
$(data.context).find('button').remove();
|
$(data.context).find('button').remove();
|
||||||
|
|
||||||
var name = encodeURIComponent(data.result.file.name);
|
console.log(data.result.file);
|
||||||
|
var filename = encodeURIComponent(data.result.file.filename);
|
||||||
var row = $('#csv_uploaded_history tr:first').clone();
|
var row = $('#csv_uploaded_history tr:first').clone();
|
||||||
|
|
||||||
$('#csv_uploaded_history').append(row);
|
$('#csv_uploaded_history').append(row);
|
||||||
row.removeClass('hide');
|
row.removeClass('hide');
|
||||||
row.find('td:first').html(data.result.file.filename);
|
row.find('td:first').html(data.result.file.filename);
|
||||||
row.find('button.csv-use-btn').data('filename', data.result.file.filename);
|
row.find('button.csv-use-btn').data('filename', data.result.file.filename);
|
||||||
row.find('a.csv-download-link').attr('href','{$current}&token={$token}&csvfilename='+name);
|
row.find('a.csv-download-link').attr('href','{$current}&token={$token}&csvfilename='+filename);
|
||||||
row.find('a.csv-delete-link').attr('href','{$current}&token={$token}&csvfilename='+name+'&delete=1');
|
row.find('a.csv-delete-link').attr('href','{$current}&token={$token}&csvfilename='+filename+'&delete=1');
|
||||||
csv_select(data.result.file.filename);
|
csv_select(data.result.file.filename);
|
||||||
var items = $('#csv_uploaded_history tr').length -1;
|
var items = $('#csv_uploaded_history tr').length -1;
|
||||||
$('.csv-history-nb').html(items);
|
$('.csv-history-nb').html(items);
|
||||||
|
|||||||
@@ -540,22 +540,22 @@ class AdminImportControllerCore extends AdminController
|
|||||||
$entity_selected = (int)$this->context->cookie->entity_selected;
|
$entity_selected = (int)$this->context->cookie->entity_selected;
|
||||||
|
|
||||||
$csv_selected = '';
|
$csv_selected = '';
|
||||||
if (isset($this->context->cookie->csv_selected) && file_exists(_PS_ADMIN_DIR_.'/import/'.base64_decode($this->context->cookie->csv_selected)))
|
if (isset($this->context->cookie->csv_selected) && file_exists(_PS_ADMIN_DIR_.'/import/'.urldecode($this->context->cookie->csv_selected)))
|
||||||
$csv_selected = base64_decode($this->context->cookie->csv_selected);
|
$csv_selected = urldecode($this->context->cookie->csv_selected);
|
||||||
else
|
else
|
||||||
$this->context->cookie->csv_selected = $csv_selected;
|
$this->context->cookie->csv_selected = $csv_selected;
|
||||||
|
|
||||||
$id_lang_selected = '';
|
$id_lang_selected = '';
|
||||||
if (isset($this->context->cookie->iso_lang_selected) && $this->context->cookie->iso_lang_selected)
|
if (isset($this->context->cookie->iso_lang_selected) && $this->context->cookie->iso_lang_selected)
|
||||||
$id_lang_selected = (int)Language::getIdByIso(base64_decode($this->context->cookie->iso_lang_selected));
|
$id_lang_selected = (int)Language::getIdByIso(urldecode($this->context->cookie->iso_lang_selected));
|
||||||
|
|
||||||
$separator_selected = $this->separator;
|
$separator_selected = $this->separator;
|
||||||
if (isset($this->context->cookie->separator_selected) && $this->context->cookie->separator_selected)
|
if (isset($this->context->cookie->separator_selected) && $this->context->cookie->separator_selected)
|
||||||
$separator_selected = base64_decode($this->context->cookie->separator_selected);
|
$separator_selected = urldecode($this->context->cookie->separator_selected);
|
||||||
|
|
||||||
$multiple_value_separator_selected = $this->multiple_value_separator;
|
$multiple_value_separator_selected = $this->multiple_value_separator;
|
||||||
if (isset($this->context->cookie->multiple_value_separator_selected) && $this->context->cookie->multiple_value_separator_selected)
|
if (isset($this->context->cookie->multiple_value_separator_selected) && $this->context->cookie->multiple_value_separator_selected)
|
||||||
$multiple_value_separator_selected = base64_decode($this->context->cookie->multiple_value_separator_selected);
|
$multiple_value_separator_selected = urldecode($this->context->cookie->multiple_value_separator_selected);
|
||||||
|
|
||||||
//get post max size
|
//get post max size
|
||||||
$post_max_size = ini_get('post_max_size');
|
$post_max_size = ini_get('post_max_size');
|
||||||
@@ -653,10 +653,10 @@ class AdminImportControllerCore extends AdminController
|
|||||||
$data[$i] = $this->generateContentTable($i, $nb_column, $handle, $this->separator);
|
$data[$i] = $this->generateContentTable($i, $nb_column, $handle, $this->separator);
|
||||||
|
|
||||||
$this->context->cookie->entity_selected = (int)Tools::getValue('entity');
|
$this->context->cookie->entity_selected = (int)Tools::getValue('entity');
|
||||||
$this->context->cookie->iso_lang_selected = base64_encode(Tools::getValue('iso_lang'));
|
$this->context->cookie->iso_lang_selected = urlencode(Tools::getValue('iso_lang'));
|
||||||
$this->context->cookie->separator_selected = base64_encode($this->separator);
|
$this->context->cookie->separator_selected = urlencode($this->separator);
|
||||||
$this->context->cookie->multiple_value_separator_selected = base64_encode($this->multiple_value_separator);
|
$this->context->cookie->multiple_value_separator_selected = urlencode($this->multiple_value_separator);
|
||||||
$this->context->cookie->csv_selected = base64_encode(Tools::getValue('csv'));
|
$this->context->cookie->csv_selected = urlencode(Tools::getValue('csv'));
|
||||||
|
|
||||||
$this->tpl_view_vars = array(
|
$this->tpl_view_vars = array(
|
||||||
'import_matchs' => Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'import_match'),
|
'import_matchs' => Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'import_match'),
|
||||||
@@ -3101,7 +3101,7 @@ class AdminImportControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
elseif ($filename = Tools::getValue('csvfilename'))
|
elseif ($filename = Tools::getValue('csvfilename'))
|
||||||
{
|
{
|
||||||
$filename = base64_decode($filename);
|
$filename = urldecode($filename);
|
||||||
$file = _PS_ADMIN_DIR_.'/import/'.basename($filename);
|
$file = _PS_ADMIN_DIR_.'/import/'.basename($filename);
|
||||||
if (realpath(dirname($file)) != _PS_ADMIN_DIR_.DIRECTORY_SEPARATOR.'import')
|
if (realpath(dirname($file)) != _PS_ADMIN_DIR_.DIRECTORY_SEPARATOR.'import')
|
||||||
exit();
|
exit();
|
||||||
@@ -3135,7 +3135,7 @@ class AdminImportControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
parent::postProcess();
|
return parent::postProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setLocale()
|
public static function setLocale()
|
||||||
|
|||||||
Reference in New Issue
Block a user