*/
public function blacklistFrom($addresses)
{
- /* Check for '@' entries in $addresses - this would call all mail to
- * be blacklisted which is most likely not what is desired. */
- $addresses = array_flip($addresses);
- unset($addresses['@']);
-
if (!empty($addresses)) {
try {
$blacklist = $GLOBALS['ingo_storage']->retrieve(Ingo_Storage::ACTION_BLACKLIST);
- $blacklist->setBlacklist(array_merge($blacklist->getBlacklist(), array_keys($addresses)));
+ $blacklist->setBlacklist(array_merge($blacklist->getBlacklist(), $addresses));
$GLOBALS['ingo_storage']->store($blacklist);
Ingo::updateScript();
- foreach (array_keys($addresses) as $from) {
+ foreach ($addresses as $from) {
$GLOBALS['notification']->push(sprintf(_("The address \"%s\" has been added to your blacklist."), $from));
}
} catch (Ingo_Exception $e) {
*/
public function setBlacklist($data, $sort = true)
{
- $addr = $this->_addressList($data, $sort);
+ $addr = array_filter($this->_addressList($data, $sort), array('Ingo', 'filterEmptyAddress'));
if (!empty($GLOBALS['conf']['storage']['maxblacklist'])) {
$addr_count = count($addr);
if ($addr_count > $GLOBALS['conf']['storage']['maxblacklist']) {
*/
public function getBlacklist()
{
- return empty($this->_addr)
- ? array()
- : array_filter($this->_addr, array('Ingo', 'filterEmptyAddress'));
+ return $this->_addr;
}
/**
*/
public function setWhitelist($data, $sort = true)
{
- $addr = $this->_addressList($data, $sort);
- $addr = array_filter($addr, array('Ingo', 'filterEmptyAddress'));
+ $addr = array_filter($this->_addressList($data, $sort), array('Ingo', 'filterEmptyAddress'));
if (!empty($GLOBALS['conf']['storage']['maxwhitelist'])) {
$addr_count = count($addr);
if ($addr_count > $GLOBALS['conf']['storage']['maxwhitelist']) {
*/
public function getWhitelist()
{
- return empty($this->_addr)
- ? array()
- : array_filter($this->_addr, array('Ingo', 'filterEmptyAddress'));
+ return $this->_addr;
}
}