| [ Index ] |
PHP Cross Reference of Nucleus CMS 3.32 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) 4 * Copyright (C) 2002-2007 The Nucleus Group 5 * 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) 11 */ 12 /** 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). 15 * 16 * @license http://nucleuscms.org/license.txt GNU General Public License 17 * @copyright Copyright (C) 2002-2007 The Nucleus Group 18 * @version $Id: NOTIFICATION.php 1116 2007-02-03 08:24:29Z kimitake $ 19 */ 20 class NOTIFICATION { 21 22 // array of addresses that need to get a notification 23 var $addresses = array(); 24 25 /** 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 29 */ 30 function NOTIFICATION($addresses) { 31 $this->addresses = explode(';' , $addresses); 32 } 33 34 /** 35 * returns true if all addresses are valid 36 */ 37 function validAddresses() { 38 foreach ( $this->addresses as $address ) { 39 if (!isValidMailAddress(trim($address))) 40 return 0; 41 } 42 return 1; 43 } 44 45 /** 46 * Sends email messages to all the email addresses 47 */ 48 function notify($title, $message, $from) { 49 global $member; 50 51 foreach ( $this->addresses as $address ) { 52 $address = trim($address); 53 54 if (!$address) 55 continue; 56 57 // don't send messages to yourself 58 if ($member->isLoggedIn() && ($member->getEmail() == $address)) 59 continue; 60 61 @mail($address, $title, $message , "From: ". $from . "\nContent-Type: text/plain; charset=utf-8"); 62 } 63 } 64 } 65 66 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Tue Feb 12 15:34:36 2008 | Cross-referenced by PHPXref 0.7 |