| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @subpackage Massmail 5 * @author Mambo Foundation Inc see README.php 6 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 7 * See COPYRIGHT.php for copyright notices and details. 8 * @license GNU/GPL Version 2, see LICENSE.php 9 * 10 * Redistributions of files must retain the above copyright notice. 11 * 12 * Mambo is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; version 2 of the License. 15 */ 16 17 /** ensure this file is being included by a parent file */ 18 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 19 20 // ensure user has access to this function 21 if (!$acl->acl_check( 'administration', 'manage', 'users', $my->usertype, 'components', 'com_massmail' )) { 22 mosRedirect( 'index2.php', T_('You are not authorized to view this resource.') ); 23 } 24 25 require_once( $mainframe->getPath( 'admin_html' ) ); 26 27 switch ($task) { 28 case 'send': 29 sendMail(); 30 break; 31 32 case 'cancel': 33 mosRedirect( 'index2.php' ); 34 break; 35 36 default: 37 messageForm( $option ); 38 break; 39 } 40 41 function messageForm( $option ) { 42 global $acl; 43 44 $gtree = array( 45 mosHTML::makeOption( 0, T_('- All User Groups -') ) 46 ); 47 48 // get list of groups 49 $lists = array(); 50 $gtree = array_merge( $gtree, $acl->get_group_children_tree( null, 'USERS', false ) ); 51 $lists['gid'] = mosHTML::selectList( $gtree, 'mm_group', 'size="10"', 'value', 'text', 0 ); 52 53 HTML_massmail::messageForm( $lists, $option ); 54 } 55 56 function sendMail() { 57 global $database, $my, $acl; 58 global $mosConfig_sitename; 59 global $mosConfig_mailfrom, $mosConfig_fromname; 60 61 $mode = mosGetParam( $_POST, 'mm_mode', 0 ); 62 $subject = mosGetParam( $_POST, 'mm_subject', '' ); 63 $gou = mosGetParam( $_POST, 'mm_group', NULL ); 64 $recurse = mosGetParam( $_POST, 'mm_recurse', 'NO_RECURSE' ); 65 $inc_blocked = mosGetParam( $_POST, 'inc_blocked', 0 ); 66 // pulls message inoformation either in text or html format 67 if ( $mode ) { 68 $message_body = $_POST['mm_message']; 69 } else { 70 // automatically removes html formatting 71 $message_body = mosGetParam( $_POST, 'mm_message', '' ); 72 } 73 $message_body = stripslashes( $message_body ); 74 75 if (!$message_body || !$subject || $gou === null) { 76 $msg = T_('Please fill in the form correctly'); 77 mosRedirect( 'index2.php?option=com_massmail&mosmsg='.$msg ); 78 } 79 80 // get users in the group out of the acl 81 $to = $acl->get_group_objects( $gou, 'ARO', $recurse ); 82 83 $rows = array(); 84 if ( count( $to['users'] ) || $gou === '0' ) { 85 // Get sending email address 86 // @RawSQLUse, trivial_implementation, SELECT 87 $query = "SELECT email FROM #__users WHERE id='$my->id'"; 88 $database->setQuery( $query ); 89 $my->email = $database->loadResult(); 90 91 // Get all users email and group except for senders 92 $query = "SELECT email FROM #__users" 93 . "\n WHERE id != '$my->id'" 94 . ( $inc_blocked !== '0' ? " AND block = 0 ": '' ) 95 . ( $gou !== '0' ? " AND id IN (" . implode( ',', $to['users'] ) . ")" : '' ) 96 ; 97 $database->setQuery( $query ); 98 $rows = $database->loadObjectList(); 99 100 // Build e-mail message format 101 $message_header = sprintf( T_("This is an email from '%s' 102 103 Message: 104 "), $mosConfig_sitename ); 105 $message = $message_header . $message_body; 106 $subject = $mosConfig_sitename. ' / '. stripslashes( $subject); 107 108 //Send email 109 foreach ($rows as $row) { 110 mosMail( $mosConfig_mailfrom, $mosConfig_fromname, $row->email, $subject, $message, $mode ); 111 } 112 } 113 114 $msg = sprintf(Tn_('E-mail sent to %d user.', 'E-mail sent to %d users.', count($rows)), count($rows)); 115 mosRedirect( 'index2.php?option=com_massmail', $msg ); 116 } 117 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |