Skip to content

Commit ba8507f

Browse files
committed
sanitise categories, only allow numbers letters and spaces
1 parent fa71629 commit ba8507f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

public_html/lists/admin/configure.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@
8585
$value = str_replace('[DOMAIN]', '', $value);
8686
$value = str_replace('[WEBSITE]', '', $value);
8787
}
88+
if ($id == 'list_categories') {
89+
$categories = explode(',',$value);
90+
$clean = array();
91+
foreach ($categories as $category) {
92+
$clean[] = preg_replace('/[^A-Z0-9\. ]+/i','',$category);
93+
}
94+
$value = implode(',',$clean);
95+
}
8896
if (empty($value) && !$info['allowempty']) {
8997
// Error($info['description']. ' ' . $GLOBALS['I18N']->get('cannot be empty'));
9098
$haserror = $info['description'].' '.$GLOBALS['I18N']->get('cannot be empty');

public_html/lists/admin/list.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ function listMemberCounts($listId)
177177
}
178178
$tabs = new WebblerTabs();
179179
foreach ($aListCategories as $category) {
180-
$category = trim($category);
180+
$category = trim(htmlspecialchars($category));
181181
if ($category == '') {
182182
$category = s('Uncategorised');
183183
}

0 commit comments

Comments
 (0)