Source for file admin.massmail.php
Documentation is available at admin.massmail.php
* @copyright Refer to copyright.php
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @author Mambo Foundation Inc see README.php
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
// ensure user has access to this function
if (!$acl->acl_check( 'administration', 'manage', 'users', $my->usertype, 'components', 'com_massmail' )) {
mosRedirect( 'index2.php', T_('You are not authorized to view this resource.') );
require_once( $mainframe->getPath( 'admin_html' ) );
$gtree =
array_merge( $gtree, $acl->get_group_children_tree( null, 'USERS', false ) );
$lists['gid'] =
mosHTML::selectList( $gtree, 'mm_group', 'size="10"', 'value', 'text', 0 );
global $database, $my, $acl;
global $mosConfig_sitename;
global $mosConfig_mailfrom, $mosConfig_fromname;
$recurse =
mosGetParam( $_POST, 'mm_recurse', 'NO_RECURSE' );
// pulls message inoformation either in text or html format
$message_body =
$_POST['mm_message'];
// automatically removes html formatting
$message_body =
mosGetParam( $_POST, 'mm_message', '' );
if (!$message_body ||
!$subject ||
$gou ===
null) {
$msg =
T_('Please fill in the form correctly');
mosRedirect( 'index2.php?option=com_massmail&mosmsg='.
$msg );
// get users in the group out of the acl
$to =
$acl->get_group_objects( $gou, 'ARO', $recurse );
if ( count( $to['users'] ) ||
$gou ===
'0' ) {
// Get sending email address
$query =
"SELECT email FROM #__users WHERE id='$my->id'";
$database->setQuery( $query );
$my->email =
$database->loadResult();
// Get all users email and group except for senders
$query =
"SELECT email FROM #__users"
.
"\n WHERE id != '$my->id'"
.
( $gou !==
'0' ?
" AND id IN (" .
implode( ',', $to['users'] ) .
")" :
'' )
$database->setQuery( $query );
$rows =
$database->loadObjectList();
// Build e-mail message format
$message_header =
sprintf( T_("This is an email from '%s'
"), $mosConfig_sitename );
$message =
$message_header .
$message_body;
$subject =
$mosConfig_sitename.
' / '.
stripslashes( $subject);
foreach ($rows as $row) {
mosMail( $mosConfig_mailfrom, $mosConfig_fromname, $row->email, $subject, $message, $mode );
$msg =
sprintf(Tn_('E-mail sent to %d user.', 'E-mail sent to %d users.', count($rows)), count($rows));
Documentation generated on Mon, 05 May 2008 16:15:27 +0400 by phpDocumentor 1.4.0