Skip to content
Snippets Groups Projects
Commit d37ac884 authored by Jared Hancock's avatar Jared Hancock
Browse files

banlist: Trim new entries and updates via web form

parent 91d65d97
No related branches found
No related tags found
No related merge requests found
...@@ -36,7 +36,7 @@ if($_POST && !$errors && $filter){ ...@@ -36,7 +36,7 @@ if($_POST && !$errors && $filter){
}elseif(!$errors){ }elseif(!$errors){
$vars=array('w'=>'email', $vars=array('w'=>'email',
'h'=>'equal', 'h'=>'equal',
'v'=>$_POST['val'], 'v'=>trim($_POST['val']),
'filter_id'=>$filter->getId(), 'filter_id'=>$filter->getId(),
'isactive'=>$_POST['isactive'], 'isactive'=>$_POST['isactive'],
'notes'=>$_POST['notes']); 'notes'=>$_POST['notes']);
...@@ -52,9 +52,9 @@ if($_POST && !$errors && $filter){ ...@@ -52,9 +52,9 @@ if($_POST && !$errors && $filter){
$errors['err']='Unknown or invalid ban list'; $errors['err']='Unknown or invalid ban list';
}elseif(!$_POST['val'] || !Validator::is_email($_POST['val'])) { }elseif(!$_POST['val'] || !Validator::is_email($_POST['val'])) {
$errors['err']=$errors['val']='Valid email address required'; $errors['err']=$errors['val']='Valid email address required';
}elseif(BanList::includes($_POST['val'])) { }elseif(BanList::includes(trim($_POST['val']))) {
$errors['err']=$errors['val']='Email already in the ban list'; $errors['err']=$errors['val']='Email already in the ban list';
}elseif($filter->addRule('email','equal',$_POST['val'],array('isactive'=>$_POST['isactive'],'notes'=>$_POST['notes']))) { }elseif($filter->addRule('email','equal',trim($_POST['val']),array('isactive'=>$_POST['isactive'],'notes'=>$_POST['notes']))) {
$msg='Email address added to ban list successfully'; $msg='Email address added to ban list successfully';
$_REQUEST['a']=null; $_REQUEST['a']=null;
//Add filter rule here. //Add filter rule here.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment