1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
<?php
/**
* Site Mailings Subscription Maintenance page
*
* This page is used to maintain site mailings (currently, just
* unsubscribe specific user).
*
* Copyright 1999-2001 (c) VA Linux Systems
*
* @version $Id: unsubscribe.php 3296 2004-08-27 19:06:11Z tperdue $
*
* This file is part of GForge.
*
* GForge is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GForge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GForge; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once('pre.php');
require_once('www/admin/admin_utils.php');
session_require(array('group'=>'1','admin_flags'=>'A'));
if ($submit && $user_name) {
if (!$type) {
/*
Show form for unsubscription type selection
*/
site_admin_header(array('title'=>$Language->getText('admin_unsubscribe','title')));
?>
<h4><?php echo $Language->getText('admin_unsubscribe','unsubscribe_user'); ?> <?php echo $user_name; ?></h4>
<p>
<?php echo $Language->getText('admin_unsubscribe','you_can_unsubscribe'); ?>
</p>
<form action="<?php echo $PHP_SELF; ?>" method="post">
<input type="hidden" name="user_name" value="<?php echo $user_name?>" />
Unsubscription type: <?php echo html_build_select_box_from_arrays(
array($Language->getText('admin_unsubscribe','mail'),$Language->getText('admin_unsubscribe','all')),
array($Language->getText('admin_unsubscribe','admin_initiaded_mail'),$Language->getText('admin_unsubscribe','all_site_mailing')),
'type',false,false
); ?>
<input type="submit" name="submit" value="<?php echo $Language->getText('admin_unsubscribe','unsubscribe'); ?>" />
</form>
<?php
site_admin_footer(array());
exit();
} else {
/*
Perform unsubscription
*/
$u =& user_get_object_by_name($user_name);
if (!$u || !is_object($u)) {
exit_error('Error','Could Not Get User');
} elseif ($u->isError()) {
exit_error('Error',$u->getErrorMessage());
}
if (!$u->unsubscribeFromMailings($type=='ALL' ? 1 : 0)) {
exit_error(
$Language->getText('admin_unsubscribe','error_unsubscribe_user') .$u->getErrorMessage()
);
}
$feedback .= $Language->getText('admin_unsubscribe','user_unsubscribed').'<br />';
}
}
site_admin_header(array('title'=>$Language->getText('admin_unsubscribe','subscription_maintance')));
?>
<h4>
<?php echo $Language->getText('admin_unsubscribe','subscription_maintance'); ?>
</h4>
<p>
<?php echo $Language->getText('admin_unsubscribe','use_fields_bellow',array($GLOBALS['sys_name'])); ?>
</p>
<form action="<?php echo $PHP_SELF; ?>" method="post">
Pattern: <input type="text" name="pattern" value="<?php echo $pattern; ?>" />
<input type="submit" name="submit" value="<?php echo $Language->getText('admin_unsubscribe','show_user_matching'); ?>" />
</form>
<?php
if ($pattern) {
$res = db_query("
SELECT *
FROM users
WHERE user_name LIKE '%$pattern%'
OR realname ILIKE '%$pattern%'
OR email ILIKE '%$pattern%'
");
$title=array();
$title[]=' ';
$title[]=$Language->getText('admin_unsubscribe','user_id');
$title[]=$Language->getText('admin_unsubscribe','username');
$title[]=$Language->getText('admin_unsubscribe','real_name');
$title[]=$Language->getText('admin_unsubscribe','email');
$title[]=$Language->getText('admin_unsubscribe','site_mail');
$title[]=$Language->getText('admin_unsubscribe','comm_mail');
echo $GLOBALS['HTML']->listTableTop($title);
while ($row = db_fetch_array($res)) {
echo '
<tr '.$GLOBALS['HTML']->boxGetAltRowStyle($i++).'>
<td> </td>
<td>'.$row['user_id'].'</td>
<td><a href="unsubscribe.php?submit=1&user_name='.$row['user_name'].'">'.$row['user_name'].'</a></td>
<td>'.$row['realname'].'</td>
<td> '.$row['email'].'</td>
<td>'.$row['mail_siteupdates'].'</td>
<td> '.$row['mail_va'].'</td>
</tr>
';
}
echo $GLOBALS['HTML']->listTableBottom();
}
site_admin_footer(array());
?>
|