2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 09/28/2003 *
4 * =================== Last change: 06/10/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-lock_user.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Lock members *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Mitglieder sperren *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * Copyright (c) 2009, 2010 by Mailer Developer Team *
22 * For more information visit: http://www.mxchange.org *
24 * This program is free software; you can redistribute it and/or modify *
25 * it under the terms of the GNU General Public License as published by *
26 * the Free Software Foundation; either version 2 of the License, or *
27 * (at your option) any later version. *
29 * This program is distributed in the hope that it will be useful, *
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
32 * GNU General Public License for more details. *
34 * You should have received a copy of the GNU General Public License *
35 * along with this program; if not, write to the Free Software *
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
38 ************************************************************************/
40 // Some security stuff...
41 if ((!defined('__SECURITY')) || (!isAdmin())) {
45 // Add description as navigation point
46 addMenuDescription('admin', __FILE__);
49 if (isGetRequestParameterSet('userid')) {
50 // Action not performed by default
54 if (fetchUserData(getRequestParameter('userid'))) {
55 // Is a lock reason set?
56 if ((isPostRequestParameterSet('lock')) && (getUserData('status') != 'LOCKED')) {
57 // Ok, lock the account!
58 if (getExtensionVersion('user') >= '0.3.5') {
60 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `status`='LOCKED', `lock_reason`='%s', `lock_timestamp`=NOW() WHERE `userid`=%s LIMIT 1",
61 array(postRequestParameter('reason'), bigintval(getRequestParameter('userid'))), __FILE__, __LINE__);
63 // Lock with no lock reason saved
64 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `status`='LOCKED' WHERE `userid`=%s LIMIT 1",
65 array(bigintval(getRequestParameter('userid'))), __FILE__, __LINE__);
69 if (SQL_AFFECTEDROWS() == 1) {
70 // Send an email to the user! In later version you can optionally switch this feature off
71 $message = loadEmailTemplate('lock-user', array('text' => postRequestParameter('reason')), bigintval(getRequestParameter('userid')));
74 sendEmail(bigintval(getRequestParameter('userid')), getMessage('ADMIN_LOCKED_SUBJ'), $message);
78 $message = getMaskedMessage('USER_ACCOUNT_LOCKED', getRequestParameter('userid'));
80 } elseif ((isPostRequestParameterSet('unlock')) && (getUserData('status') == 'LOCKED')) {
81 // Ok, unlock the account!
82 if (getExtensionVersion('user') >= '0.3.5') {
83 // Reset lock reason as well
85 `{?_MYSQL_PREFIX?}_user_data`
89 `lock_timestamp`='0000-00-00 00:00'
93 array(bigintval(getRequestParameter('userid'))), __FILE__, __LINE__);
95 // No lock reason to reset
96 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `status`='CONFIRMED' WHERE `userid`=%s LIMIT 1",
97 array(bigintval(getRequestParameter('userid'))), __FILE__, __LINE__);
101 if (SQL_AFFECTEDROWS() == 1) {
102 // Send an email to the user! In later version you can optionally switch this feature off
103 $message = loadEmailTemplate('unlock-user', array('text' => postRequestParameter('reason')), bigintval(getRequestParameter('userid')));
106 sendEmail(bigintval(getRequestParameter('userid')), getMessage('ADMIN_UNLOCKED_SUBJ'), $message);
107 if (isExtensionActive('rallye')) {
108 addUserToReferalRallye(getRequestParameter('userid'));
113 $message = getMaskedMessage('USER_ACCOUNT_UNLOCKED', getRequestParameter('userid'));
115 } elseif (isPostRequestParameterSet('del')) {
116 // Delete the account
118 loadIncludeOnce('inc/modules/admin/what-del_user.php');
119 } elseif (isPostRequestParameterSet('no')) {
120 // Do not lock him...
121 $URL = adminCreateUserLink(getRequestParameter('userid'));
123 // Load user data we need
124 if (fetchUserData(getRequestParameter('userid'))) {
125 // Transfer data to constants for the template
126 $content['email'] = generateEmailLink(getUserData('email'), 'user_data');
127 $content['surname'] = getUserData('surname');
128 $content['family'] = getUserData('family');
129 $content['status'] = getUserData('status');
130 $content['userid'] = bigintval(getRequestParameter('userid'));
132 // Realy want to lock?
133 switch ($content['status']) {
134 case 'CONFIRMED': // Yes, lock him down... ;-)
135 $content['ok'] = 'lock';
136 $content['header'] = getMaskedMessage('ADMIN_HEADER_LOCK_ACCOUNT', $content['userid']);
137 $content['text'] = getMaskedMessage('ADMIN_TEXT_LOCK_ACCOUNT', $content['userid']);
140 case 'LOCKED': // Unlock the user
141 $content['ok'] = 'unlock';
142 $content['header'] = getMaskedMessage('ADMIN_HEADER_UNLOCK_ACCOUNT', $content['userid']);
143 $content['text'] = getMaskedMessage('ADMIN_TEXT_UNLOCK_ACCOUNT', $content['userid']);
146 case 'UNCONFIRMED': // Unconfirmed accounts cannot be unlocked!
147 $content['ok'] = 'del';
148 $content['header'] = getMaskedMessage('ADMIN_HEADER_DEL_ACCOUNT', $content['userid']);
149 $content['text'] = getMaskedMessage('ADMIN_TEXT_DEL_ACCOUNT', $content['userid']);
153 // Translate user status
154 $content['status'] = translateUserStatus($content['status']);
157 loadTemplate('admin_lock_user', false, $content);
159 // Account does not exists!
160 loadTemplate('admin_settings_saved', false, '<div class="admin_failed">' . getMaskedMessage('ADMIN_MEMBER_404', getRequestParameter('userid')) . '</div>');
169 // An action was performed...
170 if (!empty($message)) {
171 loadTemplate('admin_settings_saved', false, '<div class="admin_failed">' . $message . '</div>');
173 loadTemplate('admin_settings_saved', false, '<div class="admin_failed">' . getMessage('ADMIN_USER_UPDATED') . '</div>');
177 // Account does not exists!
178 loadTemplate('admin_settings_saved', false, '<div class="admin_failed">' . getMaskedMessage('ADMIN_MEMBER_404', getRequestParameter('userid')) . '</div>');
182 addMemberSelectionBox();