3 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4 * Copyright (C) 2002-2009 The Nucleus Group
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 * (see nucleus/documentation/index.html#license for more info)
13 * Class used to represent a collection of e-mail addresses, to which a
14 * message can be sent (e.g. comment or karma vote notification).
16 * @license http://nucleuscms.org/license.txt GNU General Public License
17 * @copyright Copyright (C) 2002-2009 The Nucleus Group
18 * @version $Id: NOTIFICATION.php 1534 2011-06-22 06:13:23Z sakamocchi $
22 // array of addresses that need to get a notification
23 var $addresses = array();
26 * takes one string as argument, containing multiple e-mail addresses
27 * separated by semicolons
28 * eg: site@demuynck.org;nucleus@demuynck.org;foo@bar.com
30 function NOTIFICATION($addresses) {
31 $this->addresses = i18n::explode(';' , $addresses);
35 * returns true if all addresses are valid
37 function validAddresses() {
38 foreach ( $this->addresses as $address ) {
39 if (!isValidMailAddress(trim($address)))
46 * Sends email messages to all the email addresses
48 function notify($title, $message, $from)
53 foreach ($this->addresses as $address)
55 if ( $member->isLoggedIn() && ($member->getEmail() == $address) )
59 $addresses[] = $address;
62 i18n::mail(implode(',', $addresses), $title, $message , $from);