/**
* Uses the BulkQuery executable to query all the RBLs at once
- * @param array $filters Array of SPAM Fitlers
+ * @param array $filters Array of SPAM Filters
* @param array $IPs Array of IP Addresses
* @access private
*/
}
}
+ // No user filters, and no spam filters, no need to continue //
if (!$AllowSpamFilters && empty($filters)) {
return;
}
/**
* Creates and runs the IMAP command to filter messages
+ * @param string $imap_stream TODO: Document this parameter
* @param string $where Which part of the message to search (TO, CC, SUBJECT, etc...)
* @param string $what String to search for
* @param string $where_to Folder it will move to
* @param string $user_scan Whether to search all or just unseen
* @param string $should_expunge
- * @param boolean $where Which part of location to search
* @access private
*/
function filter_search_and_delete($imap_stream, $where, $what, $where_to, $user_scan,
// see comments in squirrelmail sqimap_search function
if ($imap_server_type == 'macosx' || $imap_server_type == 'hmailserver') {
- $search_str .= ' ' . $where . ' ' . $what;
+ $search_str .= ' ' . $where . ' ' . $what;
/* read data back from IMAP */
$read = sqimap_run_command($imap_stream, $search_str, true, $response, $message, TRUE);
} else {
for ($i = 0, $iCnt = count($read); $i < $iCnt; ++$i) {
if (preg_match("/^\* SEARCH (.+)$/", $read[$i], $regs)) {
$search_array = explode(' ', trim($regs[1]));
- break;
+ break;
}
}
}
$aSpamIds[] = $MsgNum;
$isspam = true;
}
+
if ($bulkquery) {
array_shift($aMatch);
- $IP = explode('.',$aMatch);
+ $IP = explode('.', $aMatch);
foreach ($filters as $key => $value) {
if ($filters[$key]['enabled'] && $filters[$key]['dns']) {
if (strlen($SpamFilters_DNScache[$IP.'.'.$filters[$key]['dns']]) == 0) {
- $IPs[$IP] = true;
- break;
+ $IPs[$IP] = true;
+ break;
}
}
}
}
// Lookie! It's spam! Yum!
if (count($aSpamIds) && sqimap_mailbox_exists($imap_stream, $filters_spam_folder)) {
- sqimap_msgs_list_move ($imap_stream, $aSpamIds, $filters_spam_folder);
+ sqimap_msgs_list_move($imap_stream, $aSpamIds, $filters_spam_folder);
sqimap_mailbox_expunge($imap_stream, 'INBOX');
}
foreach ($filters as $key => $value) {
if ($filters[$key]['enabled']) {
if ($filters[$key]['dns']) {
+
/**
- * RFC allows . on end of hostname to force domain lookup
- * to not use search domain from resolv.conf
+ * RFC allows . on end of hostname to force domain lookup to
+ * not use search domain from resolv.conf, i.e. to ensure
+ * search domain isn't used if no hostname is found
*/
$filter_revip = $d . '.' . $c . '.' . $b . '.' . $a . '.' .
$filters[$key]['dns'] . '.';
/**
* gethostbyname returns ip if resolved, or returns original
- * host query if no resolution
+ * host supplied to function if there is no resolution
*/
if ($SpamFilters_DNScache[$filter_revip]['L'] != $filter_revip) {
return 1;
* @access private
*/
function update_for_folder ($args) {
-
$old_folder = $args[0];
$new_folder = $args[2];
$action = $args[1];