[ Index ] |
|
Code source de Joomla 1.0.13 |
1 <?php 2 /** 3 * @version $Id: admin.massmail.php 4999 2006-09-10 20:01:47Z friesengeist $ 4 * @package Joomla 5 * @subpackage Massmail 6 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. 7 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php 8 * Joomla! is free software. This version may have been modified pursuant 9 * to the GNU General Public License, and as distributed it includes or 10 * is derivative of works licensed under the GNU General Public License or 11 * other free or open source software licenses. 12 * See COPYRIGHT.php for copyright notices and details. 13 */ 14 15 // no direct access 16 defined( '_VALID_MOS' ) or die( 'Restricted access' ); 17 18 // ensure user has access to this function 19 if (!$acl->acl_check( 'administration', 'manage', 'users', $my->usertype, 'components', 'com_massmail' )) { 20 mosRedirect( 'index2.php', _NOT_AUTH ); 21 } 22 23 require_once( $mainframe->getPath( 'admin_html' ) ); 24 25 switch ($task) { 26 case 'send': 27 sendMail(); 28 break; 29 30 case 'cancel': 31 mosRedirect( 'index2.php' ); 32 break; 33 34 default: 35 messageForm( $option ); 36 break; 37 } 38 39 function messageForm( $option ) { 40 global $acl; 41 42 $gtree = array( 43 mosHTML::makeOption( 0, '- All User Groups -' ) 44 ); 45 46 // get list of groups 47 $lists = array(); 48 $gtree = array_merge( $gtree, $acl->get_group_children_tree( null, 'USERS', false ) ); 49 $lists['gid'] = mosHTML::selectList( $gtree, 'mm_group', 'size="10"', 'value', 'text', 0 ); 50 51 HTML_massmail::messageForm( $lists, $option ); 52 } 53 54 function sendMail() { 55 global $database, $my, $acl; 56 global $mosConfig_sitename; 57 global $mosConfig_mailfrom, $mosConfig_fromname; 58 59 $mode = intval( mosGetParam( $_POST, 'mm_mode', 0 ) ); 60 $subject = strval( mosGetParam( $_POST, 'mm_subject', '' ) ); 61 $gou = mosGetParam( $_POST, 'mm_group', NULL ); 62 $recurse = strval( mosGetParam( $_POST, 'mm_recurse', 'NO_RECURSE' ) ); 63 // pulls message inoformation either in text or html format 64 if ( $mode ) { 65 $message_body = $_POST['mm_message']; 66 } else { 67 // automatically removes html formatting 68 $message_body = strval( mosGetParam( $_POST, 'mm_message', '' ) ); 69 } 70 $message_body = stripslashes( $message_body ); 71 72 if (!$message_body || !$subject || $gou === null) { 73 mosRedirect( 'index2.php?option=com_massmail&mosmsg=Please fill in the form correctly' ); 74 } 75 76 // get users in the group out of the acl 77 $to = $acl->get_group_objects( $gou, 'ARO', $recurse ); 78 79 $rows = array(); 80 if ( count( $to['users'] ) || $gou === '0' ) { 81 // Get sending email address 82 $query = "SELECT email" 83 . "\n FROM #__users" 84 . "\n WHERE id = " . (int) $my->id 85 ; 86 $database->setQuery( $query ); 87 $my->email = $database->loadResult(); 88 89 mosArrayToInts( $to['users'] ); 90 $user_ids = 'id=' . implode( ' OR id=', $to['users'] ); 91 92 // Get all users email and group except for senders 93 $query = "SELECT email" 94 . "\n FROM #__users" 95 . "\n WHERE id != " . (int) $my->id 96 . ( $gou !== '0' ? " AND ( $user_ids )" : '' ) 97 ; 98 $database->setQuery( $query ); 99 $rows = $database->loadObjectList(); 100 101 // Build e-mail message format 102 $message_header = sprintf( _MASSMAIL_MESSAGE, html_entity_decode($mosConfig_sitename, ENT_QUOTES) ); 103 $message = $message_header . $message_body; 104 $subject = html_entity_decode($mosConfig_sitename, ENT_QUOTES) . ' / '. stripslashes( $subject); 105 106 //Send email 107 foreach ($rows as $row) { 108 mosMail( $mosConfig_mailfrom, $mosConfig_fromname, $row->email, $subject, $message, $mode ); 109 } 110 } 111 112 $msg = 'E-mail sent to '. count( $rows ) .' users'; 113 mosRedirect( 'index2.php?option=com_massmail', $msg ); 114 } 115 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 14:43:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |