@@ -337,9 +337,19 @@ define(
|
|||||||
complete: function (CSV) {
|
complete: function (CSV) {
|
||||||
for (var rowCount in CSV.data) {
|
for (var rowCount in CSV.data) {
|
||||||
var rowData = CSV.data[rowCount].map(function (el) {
|
var rowData = CSV.data[rowCount].map(function (el) {
|
||||||
return filterXSS(el.trim());
|
// sanitize data
|
||||||
}),
|
el = filterXSS(el.trim());
|
||||||
rowColumnCount = rowData.length;
|
var entityMap = {
|
||||||
|
"<": "<",
|
||||||
|
">": ">",
|
||||||
|
"/": '/'
|
||||||
|
};
|
||||||
|
el = String(el).replace(/[&<>"'\/]/g, function (s) {
|
||||||
|
return entityMap[s];
|
||||||
|
});
|
||||||
|
return el;
|
||||||
|
});
|
||||||
|
var rowColumnCount = rowData.length;
|
||||||
// set the number of row elements based on the first non-empty row
|
// set the number of row elements based on the first non-empty row
|
||||||
if (columnCount === null) {
|
if (columnCount === null) {
|
||||||
columnCount = rowColumnCount;
|
columnCount = rowColumnCount;
|
||||||
|
@@ -110,6 +110,8 @@ class Import {
|
|||||||
function validateSubscribersFields($subscribers_data, $validation_rules) {
|
function validateSubscribersFields($subscribers_data, $validation_rules) {
|
||||||
$invalid_records = array();
|
$invalid_records = array();
|
||||||
foreach($subscribers_data as $column => &$data) {
|
foreach($subscribers_data as $column => &$data) {
|
||||||
|
// sanitize each data field
|
||||||
|
$data = array_map('sanitize_text_field', $data);
|
||||||
$validation_rule = $validation_rules[$column];
|
$validation_rule = $validation_rules[$column];
|
||||||
// if this is a custom column
|
// if this is a custom column
|
||||||
if(in_array($column, $this->subscriber_custom_fields)) {
|
if(in_array($column, $this->subscriber_custom_fields)) {
|
||||||
|
Reference in New Issue
Block a user