Skip to content

Commit 10c1d4b

Browse files
bramleymarianaballa
authored andcommitted
Validate the $_GET parameter.
Improve the presentation of the field delimiter warning.
1 parent 82a99d7 commit 10c1d4b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

public_html/lists/admin/import2.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,11 @@
171171
}
172172

173173
if (isset($_GET['delimiter'])) {
174-
// Reprocess the file using the selected delimiter
175-
$_SESSION['import_field_delimiter'] = $_GET['delimiter'];
176-
$_SESSION['import_attribute'] = [];
174+
if (is_string($_GET['delimiter']) && strlen($_GET['delimiter']) == 1) {
175+
// Reprocess the file using the selected delimiter
176+
$_SESSION['import_field_delimiter'] = $_GET['delimiter'];
177+
$_SESSION['import_attribute'] = [];
178+
}
177179
unset($_GET['delimiter']);
178180
}
179181

@@ -363,12 +365,12 @@
363365
$ls->addButton($GLOBALS['I18N']->get('Continue'), 'javascript:document.importform.submit()');
364366

365367
if (count($headers) == 1) {
368+
echo '<div class="clearfix"></div><div class="note">';
366369
// try to identify the actual field delimiter from commonly-used values
367370
if (preg_match('/([,;:|])/', $headers[0], $matches)) {
368371
$delimiter = $matches[1];
369372
$warning = s(
370-
"The file appears to be using '%s' as the field delimiter. Click Resubmit to use '%s' as the delimiter.",
371-
$delimiter,
373+
"The file appears to be using '%s' as the field delimiter. Click Resubmit to use that delimiter.",
372374
$delimiter
373375
);
374376
$url = sprintf('import2&delimiter=%s', urlencode($delimiter));
@@ -377,6 +379,7 @@
377379
$warning = s('The entered field delimiter might not be correct.');
378380
printf('<p class="information">%s</p>', $warning);
379381
}
382+
echo '</div>';
380383
}
381384
echo '<p class="information">'.$GLOBALS['I18N']->get('Please identify the target of the following unknown columns').'</p>';
382385
echo '<form name="importform" method="post">';

0 commit comments

Comments
 (0)