3 * Site Mailings Subscription Maintenance page
5 * This page is used to maintain site mailings (currently, just
6 * unsubscribe specific user).
8 * Copyright 1999-2001 (c) VA Linux Systems
10 * This file is part of GForge.
12 * GForge is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * GForge is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with GForge; if not, write to the Free Software
24 * 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 $user_name = getStringFromRequest('user_name');
35 $pattern = getStringFromRequest('pattern');
37 if (getStringFromRequest('submit') && $user_name) {
38 $type = getStringFromRequest('type');
43 Show form for unsubscription type selection
46 site_admin_header(array('title'=>_('Site Mailings Subscription Maintenance')));
49 <h4><?php echo _('Unsubscribe user:'); ?> <?php echo $user_name; ?></h4>
51 <?php echo _('You can unsubscribe user either from admin-initiated sitewide mailings or from all site mailings (admin-initiated and automated mailings, like forum and file release notifications).'); ?>
53 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="post">
54 <input type="hidden" name="user_name" value="<?php echo $user_name?>" />
55 Unsubscription type: <?php echo html_build_select_box_from_arrays(
56 array(_('MAIL'),_('ALL')),
57 array(_('Admin-initiated mailings'),_('All site mailings')),
60 <input type="submit" name="submit" value="<?php echo _('Unsubscribe'); ?>" />
64 site_admin_footer(array());
69 Perform unsubscription
72 $u =& user_get_object_by_name($user_name);
73 if (!$u || !is_object($u)) {
74 exit_error('Error','Could Not Get User');
75 } elseif ($u->isError()) {
76 exit_error('Error',$u->getErrorMessage());
79 if (!$u->unsubscribeFromMailings($type=='ALL' ? 1 : 0)) {
81 _('Error, Could not unsubscribe user:') .$u->getErrorMessage()
85 $feedback .= _('User unsubscribed').'<br />';
89 site_admin_header(array('title'=>_('Site Mailings Subscription Maintenance')));
94 <?php echo _('Site Mailings Subscription Maintenance'); ?>
98 <?php printf(_('Use field below to find users which match given pattern with the %1$s username, real name, or email address (substring match is preformed, use \'%%\' in the middle of pattern to specify 0 or more arbitrary characters). Click on the username to unsubscribe user from site mailings (new form will appear).'), fusionforge_get_config ('core', 'forge_name')); ?>
101 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="post">
102 Pattern: <input type="text" name="pattern" value="<?php echo $pattern; ?>" />
103 <input type="submit" name="submit" value="<?php echo _('Show users matching pattern'); ?>" />
109 $res = db_query_params('SELECT *
111 WHERE lower(user_name) LIKE $1
112 OR lower(realname) LIKE $1
113 OR lower(email) LIKE $1',
114 array (strtolower ("%$pattern%")));
118 $title[]=_('user_id');
119 $title[]=_('User name');
120 $title[]=_('Real name');
122 $title[]=_('Site Mail.');
123 $title[]=_('Comm. Mail.');
125 echo $GLOBALS['HTML']->listTableTop($title);
128 while ($row = db_fetch_array($res)) {
130 <tr '.$GLOBALS['HTML']->boxGetAltRowStyle($i++).'>
132 <td>'.$row['user_id'].'</td>
133 <td><a href="unsubscribe.php?submit=1&user_name='.$row['user_name'].'">'.$row['user_name'].'</a></td>
134 <td>'.$row['realname'].'</td>
135 <td> '.$row['email'].'</td>
136 <td>'.$row['mail_siteupdates'].'</td>
137 <td> '.$row['mail_va'].'</td>
142 echo $GLOBALS['HTML']->listTableBottom();
146 site_admin_footer(array());
150 // c-file-style: "bsd"