From: <vb...@us...> - 2003-09-13 06:59:34
|
Update of /cvsroot/webnotes/webnotes/core In directory sc8-pr-cvs1:/tmp/cvs-serv24376/core Modified Files: email_api.php Log Message: Send email notifications to all moderators / administrators when new notes are submitted or updated. M note_add.php - Send email notification on updating bugs. M core/email_api.php - Support sending emails to all administrators/moderators on new notes / updated notes. Index: email_api.php =================================================================== RCS file: /cvsroot/webnotes/webnotes/core/email_api.php,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- email_api.php 12 Sep 2003 10:58:16 -0000 1.7 +++ email_api.php 13 Sep 2003 06:59:30 -0000 1.8 @@ -110,7 +110,7 @@ $content .= "Note Id: $note_id\n"; $content .= "Email: $note_email\n"; $content .= "IP: $note_ip\n"; - $content .= "Date Submitted: " . date( 'd-M-Y', $note_date_submitted ) . "\n"; + $content .= "Date Submitted: " . date( 'd-M-Y H:i:s', $note_date_submitted ) . "\n"; $content .= "Visible: " . ( $note_visible ? "Yes" : "No" ) . "\n"; $content .= str_pad( '', 70, '-' ) . "\n"; $content .= $note_note . "\n"; @@ -120,6 +120,28 @@ } # -------------------- + # build an array of recipients + function email_recipients( $p_note_id ) + { + global $g_phpWN_user_table; + + $query = "SELECT email FROM $g_phpWN_user_table + WHERE access_level >= " . MODERATOR . + " AND email <> ''"; + $result = db_query( $query ); + + $emails_array = array(); + while( $row = db_fetch_array( $result ) ) { + $emails_array[] = $row['email']; + } + + $emails_array = array_unique( $emails_array ); + $emails = implode( ',', $emails_array ); + + return $emails; + } + + # -------------------- # email note to administrator # @@@ Query the database to send to moderators / administrators, rather than # just the administrator in the configs. @@ -128,7 +150,17 @@ $content = ''; email_build_note_message( $p_note_id, $subject, $content ); + $t_recipients = email_recipients( $p_note_id ); + global $g_administrator_email; - email_send( $g_administrator_email, $subject, $content ); + email_send( $t_recipients, $subject, $content ); + } + + # -------------------- + # email note to administrator + # @@@ Query the database to send to moderators / administrators, rather than + # just the administrator in the configs. + function email_note_updated( $p_note_id ) { + email_note_added( $p_note_id ); } ?> |