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
12 * This file is part of GForge.
14 * GForge 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 * GForge 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 GForge; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 require_once('../env.inc.php');
31 require_once $gfwww.'include/pre.php';
32 require_once $gfwww.'admin/admin_utils.php';
33 session_require(array('group'=>'1','admin_flags'=>'A'));
35 $user_name = getStringFromRequest('user_name');
36 if (getStringFromRequest('submit') && $user_name) {
37 $type = getStringFromRequest('type');
42 Show form for unsubscription type selection
45 site_admin_header(array('title'=>_('Site Mailings Subscription Maintenance')));
48 <h4><?php echo _('Unsubscribe user:'); ?> <?php echo $user_name; ?></h4>
50 <?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).'); ?>
52 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="post">
53 <input type="hidden" name="user_name" value="<?php echo $user_name?>" />
54 Unsubscription type: <?php echo html_build_select_box_from_arrays(
55 array(_('MAIL'),_('ALL')),
56 array(_('Admin-initiated mailings'),_('All site mailings')),
59 <input type="submit" name="submit" value="<?php echo _('Unsubscribe'); ?>" />
63 site_admin_footer(array());
68 Perform unsubscription
71 $u =& user_get_object_by_name($user_name);
72 if (!$u || !is_object($u)) {
73 exit_error('Error','Could Not Get User');
74 } elseif ($u->isError()) {
75 exit_error('Error',$u->getErrorMessage());
78 if (!$u->unsubscribeFromMailings($type=='ALL' ? 1 : 0)) {
80 _('Error, Could not unsubscribe user:') .$u->getErrorMessage()
84 $feedback .= _('User unsubscribed').'<br />';
88 site_admin_header(array('title'=>_('Site Mailings Subscription Maintenance')));
93 <?php echo _('Site Mailings Subscription Maintenance'); ?>
97 <?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).'), $GLOBALS['sys_name']); ?>
100 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="post">
101 Pattern: <input type="text" name="pattern" value="<?php echo $pattern; ?>" />
102 <input type="submit" name="submit" value="<?php echo _('Show users matching pattern'); ?>" />
107 $pattern = getStringFromRequest('pattern');
112 if ( $sys_database_type == "mysql" ) {
114 WHERE user_name LIKE '%$pattern%'
115 OR realname LIKE '%$pattern%'
116 OR email LIKE '%$pattern%'
120 WHERE user_name LIKE '%$pattern%'
121 OR realname ILIKE '%$pattern%'
122 OR email ILIKE '%$pattern%'
125 $res = db_query($sql);
129 $title[]=_('user_id');
130 $title[]=_('User name');
131 $title[]=_('Real name');
133 $title[]=_('Site Mail.');
134 $title[]=_('Comm. Mail.');
136 echo $GLOBALS['HTML']->listTableTop($title);
139 while ($row = db_fetch_array($res)) {
141 <tr '.$GLOBALS['HTML']->boxGetAltRowStyle($i++).'>
143 <td>'.$row['user_id'].'</td>
144 <td><a href="unsubscribe.php?submit=1&user_name='.$row['user_name'].'">'.$row['user_name'].'</a></td>
145 <td>'.$row['realname'].'</td>
146 <td> '.$row['email'].'</td>
147 <td>'.$row['mail_siteupdates'].'</td>
148 <td> '.$row['mail_va'].'</td>
153 echo $GLOBALS['HTML']->listTableBottom();
157 site_admin_footer(array());
161 // c-file-style: "bsd"