3 * Site Admin page for setting up massmailings.
5 * This is frontend of SF massmail facility, which allows to prepare
6 * messages for delivery to target categories of site users. very
7 * delivery is performed via cronjob.
9 * Copyright 1999-2001 (c) VA Linux Systems
10 * Copyright 2010 (c) Franck Villaume - Capgemini
12 * This file is part of FusionForge.
14 * FusionForge is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * FusionForge is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with FusionForge; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 require_once('../env.inc.php');
30 require_once $gfcommon.'include/pre.php';
31 require_once $gfwww.'admin/admin_utils.php';
33 session_require_global_perm ('forge_admin');
35 if (getStringFromRequest('submit')) {
36 if (!form_key_is_valid(getStringFromRequest('form_key'))) {
37 exit_form_double_submit('admin');
39 $mail_type = getStringFromRequest('mail_type');
40 $mail_message = getStringFromRequest('mail_message');
41 $mail_subject = getStringFromRequest('mail_subject');
44 form_release_key(getStringFromRequest('form_key'));
45 exit_missing_param('',array(_('Target Audience')),'admin');
48 if (!trim($mail_message)) {
49 form_release_key(getStringFromRequest('form_key'));
50 exit_missing_param('',array(_('No Message')),'admin');
53 if (trim($mail_subject) == '['.forge_get_config ('forge_name').']') {
54 form_release_key(getStringFromRequest('form_key'));
55 exit_missing_param('',array(_('No Subject')),'admin');
58 $res = db_query_params ('
59 INSERT INTO massmail_queue(type,subject,message,queued_date)
67 if (!$res || db_affected_rows($res)<1) {
68 form_release_key(getStringFromRequest('form_key'));
69 exit_error(_('Scheduling Mailing, Could not schedule mailing, database error: ').db_error(),'admin');
72 site_admin_header(array('title'=>_('Massmail admin')));
73 print "<p>" ._('Mailing successfully scheduled for delivery'). "</p>";
74 site_admin_footer(array());
78 site_admin_header(array('title'=>_('Massmail admin')));
82 .sprintf(_('Mail Engine for %1$s Subscribers'), forge_get_config ('forge_name')) .
88 <a href="#active">' ._('Active Deliveries').'</a>
91 <p>' ._('Be <span class="important">VERY</span> careful with this form, because submitting it WILL lead to sending email to lots of users.').
96 <form action="'.getStringFromServer('PHP_SELF').'" method="post">'
97 .'<input type="hidden" name="form_key" value="'.form_generate_key().'" />'
98 .'<strong>Target Audience:</strong>'.utils_requiredField().'<br />'.html_build_select_box_from_arrays(
99 array(0,'SITE','COMMNTY','DVLPR','ADMIN','ALL','SFDVLPR'),
102 _('Subscribers to "Site Updates"'),
103 _('Subscribers to "Additional Community Mailings"'),
104 _('All Project Developers'),
105 _('All Project Admins'),
107 forge_get_config ('forge_name'). _('Developers (test)')
109 'mail_type',false,false
117 <strong>' ._('Subject').':</strong>'.utils_requiredField().'
118 <br /><input type="text" name="mail_subject" size="50" value="['.forge_get_config ('forge_name').'] " /></p>
120 <p><strong>'._('Text of Message'). ':</strong>'.utils_requiredField(). _('(will be appended with unsubscription information, if applicable)').'</p>
121 <pre><textarea name="mail_message" cols="70" rows="20">
125 <p><input type="submit" name="submit" value="' ._('Schedule for Mailing').'" /></p>
131 $res = db_query_params ('
134 WHERE finished_date=0
143 $title[]=_('Subject');
145 $title[]=_('Last user_id mailed');
147 print '<a name="active">'._('Active Deliveries').':</a>';
149 echo $GLOBALS['HTML']->listTableTop($title);
152 while ($row = db_fetch_array($res)) {
154 <tr '.$GLOBALS['HTML']->boxGetAltRowStyle($i++).'>
155 <td> <a href="massmail-del.php?id='.$row['id'].'"></a></td>
156 <td>'.$row['id'].'</td>
157 <td>'.$row['type'].'</td>
158 <td>'.$row['subject'].'</td>
159 <td>'.date(_('Y-m-d H:i'), $row['queued_date']).'</td>
160 <td> '.$row['last_userid'].'</td>
165 echo $GLOBALS['HTML']->listTableBottom();
167 site_admin_footer(array());
171 // c-file-style: "bsd"