[Broadcast] Use db_in_clause instead of a foreach loop

pull/24/head
Jan-Frederik Rieckers 9 years ago
parent 2e92eb5cd1
commit 7ee587bb87
No known key found for this signature in database
GPG Key ID: 664B03955EA04DEF

@ -59,11 +59,9 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$recipients = [];
foreach( $wanted_domains as $domain) {
$q = "SELECT username from $table_mailbox WHERE domain = '$domain'";
if(!isset($_POST['mailboxes_only']) || $_POST['mailboxes_only'] != "on") {
$q .= " UNION SELECT GOTO FROM $table_alias WHERE domain = '$domain' " .
" AND goto NOT IN ($q)";
$q = "SELECT username from $table_mailbox WHERE ".db_in_clause("domain", $wanted_domains);
if(!isset($_POST['bailboxes_only']) || $_POST['mailboxes_only'] != "on") {
$q .= " UNION SELECT goto FROM $table_alias WHERE ".db_in_clause("domain", $wanted_domains)."AND goto NOT IN ($q)";
}
$result = db_query($q);
if($result['rows'] > 0) {
@ -71,7 +69,6 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$recipients[] = $row[0];
}
}
}
$recipients = array_unique($recipients);

Loading…
Cancel
Save