Ensure preg does not output empty array elements.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2019-08-07 21:44:01 +02:00
parent 07af532b09
commit 838516e558
3 changed files with 2 additions and 10 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ if(in_array($list, $check_lists)) {
}
// Split individual domains into array
$domains = preg_split('/\s+/', $_POST['domain']);
$domains = preg_split('/\s+/', $_POST['domain'], -1, PREG_SPLIT_NO_EMPTY);
require_once("func.php");
require_once("database.php");
-8
View File
@@ -85,10 +85,6 @@ function add_to_table($db, $table, $domains, $wildcardstyle=false)
$num = 0;
foreach($domains as $domain)
{
// Skip empty domains
if(strlen($domain) == 0)
continue;
if($wildcardstyle)
$domain = "(\\.|^)".str_replace(".","\\.",$domain)."$";
@@ -132,10 +128,6 @@ function remove_from_table($db, $table, $domains)
$num = 0;
foreach($domains as $domain)
{
// Skip empty domains
if(strlen($domain) == 0)
continue;
$stmt->bindValue(":domain", $domain, SQLITE3_TEXT);
if($stmt->execute() && $stmt->reset())
+1 -1
View File
@@ -17,7 +17,7 @@ if (empty($api)) {
}
// Split individual domains into array
$domains = preg_split('/\s+/', $_POST['domain']);
$domains = preg_split('/\s+/', $_POST['domain'], -1, PREG_SPLIT_NO_EMPTY);
require_once("func.php");