Fix incorrect regex removal code

If you had these in the regex list:
- example\.com
- example
- ^example.*

And you removed "example", then the list would look like this:
- \.com
- ^.*

This behavior is fixed.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This commit is contained in:
Mcat12
2018-07-08 16:27:38 -04:00
parent c837894bb5
commit fbe9516cbe

View File

@@ -28,12 +28,10 @@ switch($type) {
echo "Unable to read ${regexfile}<br>Error message: $err";
}
// Replace regex with empty line ...
$list = str_replace($_POST['domain'], '', $list);
// ... and remove all empty lines from the file
$tmp = explode("\n", $list);
$tmp = array_filter($tmp);
$list = implode("\n", $tmp);
// Remove the regex and any empty lines from the list
$list = explode("\n", $list);
$list = array_diff($list, array($_POST['domain'], ""));
$list = implode("\n", $list);
if(file_put_contents($regexfile, $list) === FALSE)
{