mirror of
https://github.com/pi-hole/web.git
synced 2026-04-27 20:24:10 +01:00
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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user