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
11 * This file is part of GForge.
13 * GForge is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * GForge is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with GForge; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 require_once('../env.inc.php');
29 require_once $gfwww.'include/pre.php';
30 require_once $gfwww.'admin/admin_utils.php';
32 session_require(array('group'=>'1','admin_flags'=>'A'));
34 if (getStringFromRequest('submit')) {
35 if (!form_key_is_valid(getStringFromRequest('form_key'))) {
36 exit_form_double_submit();
38 $mail_type = getStringFromRequest('mail_type');
39 $mail_message = getStringFromRequest('mail_message');
40 $mail_subject = getStringFromRequest('mail_subject');
43 form_release_key(getStringFromRequest('form_key'));
45 _('Missing parameter, You must select target audience for mailing')
49 if (!trim($mail_message)) {
50 form_release_key(getStringFromRequest('form_key'));
52 _('Missing parameter, You are trying to send empty message')
56 if (trim($mail_subject) == '['.forge_get_config ('forge_name').']') {
57 form_release_key(getStringFromRequest('form_key'));
59 _('Missing parameter, You must give proper subject to the mailing')
63 $res = db_query_params ('
64 INSERT INTO massmail_queue(type,subject,message,queued_date)
72 if (!$res || db_affected_rows($res)<1) {
73 form_release_key(getStringFromRequest('form_key'));
75 _('Error Scheduling Mailing, Could not schedule mailing, database error:') .db_error()
79 site_admin_header(array('title'=>_('Massmail admin')));
80 print "<p>" ._('Mailing successfully scheduled for delivery'). "</p>";
81 site_admin_footer(array());
85 site_admin_header(array('title'=>_('Massmail admin')));
89 .sprintf(_('Mail Engine for %1$s Subscribers'), forge_get_config ('forge_name')) .
95 <a href="#active">' ._('Active Deliveries').'</a>
98 <p>' ._('Be <span class="important">VERY</span> careful with this form, because submitting it WILL lead to sending email to lots of users.').
103 <form action="'.getStringFromServer('PHP_SELF').'" method="post">'
104 .'<input type="hidden" name="form_key" value="'.form_generate_key().'" />'
105 .'<strong>Target Audience:</strong>'.utils_requiredField().'<br />'.html_build_select_box_from_arrays(
106 array(0,'SITE','COMMNTY','DVLPR','ADMIN','ALL','SFDVLPR'),
109 _('Subscribers to "Site Updates"'),
110 _('Subscribers to "Additional Community Mailings"'),
111 _('All Project Developers'),
112 _('All Project Admins'),
114 forge_get_config ('forge_name'). _('Developers (test)')
116 'mail_type',false,false
124 <strong>' ._('Subject').':</strong>'.utils_requiredField().'
125 <br /><input type="text" name="mail_subject" size="50" value="['.forge_get_config ('forge_name').'] " /></p>
127 <p><strong>'._('Text of Message'). ':</strong>'.utils_requiredField(). _('(will be appended with unsubscription information, if applicable)').'</p>
128 <pre><textarea name="mail_message" cols="70" rows="20">
132 <p><input type="submit" name="submit" value="' ._('Schedule for Mailing').'" /></p>
138 $res = db_query_params ('
141 WHERE finished_date=0
150 $title[]=_('Subject');
152 $title[]=_('Last user_id mailed');
154 print '<a name="active">'._('Active Deliveries').':</a>';
156 echo $GLOBALS['HTML']->listTableTop($title);
158 while ($row = db_fetch_array($res)) {
160 <tr '.$GLOBALS['HTML']->boxGetAltRowStyle($i++).'>
161 <td> <a href="massmail-del.php?id='.$row['id'].'"></a></td>
162 <td>'.$row['id'].'</td>
163 <td>'.$row['type'].'</td>
164 <td>'.$row['subject'].'</td>
165 <td>'.date(_('Y-m-d H:i'), $row['queued_date']).'</td>
166 <td> '.$row['last_userid'].'</td>
171 echo $GLOBALS['HTML']->listTableBottom();
173 site_admin_footer(array());
177 // c-file-style: "bsd"