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 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009, 2010 by Mailer Developer Team *
20 * For more information visit: http://www.mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if ((!defined('__SECURITY')) || (!isAdmin())) {
43 // Add description as navigation point
44 addYouAreHereLink('admin', __FILE__);
47 if (isGetRequestParameterSet('userid')) {
48 // Action not performed by default
52 if (fetchUserData(getRequestParameter('userid'))) {
53 // Is a lock reason set?
54 if ((isFormSent('lock')) && (getUserData('status') != 'LOCKED')) {
55 // Ok, lock the account!
56 if (isExtensionInstalledAndNewer('user', '0.3.5')) {
58 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `status`='LOCKED', `lock_reason`='%s', `lock_timestamp`=NOW() WHERE `userid`=%s LIMIT 1",
59 array(postRequestParameter('reason'), bigintval(getRequestParameter('userid'))), __FILE__, __LINE__);
61 // Lock with no lock reason saved
62 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `status`='LOCKED' WHERE `userid`=%s LIMIT 1",
63 array(bigintval(getRequestParameter('userid'))), __FILE__, __LINE__);
67 if (!SQL_HASZEROAFFECTED()) {
68 // Send an email to the user! In later version you can optionally switch this feature off
69 $message = loadEmailTemplate('lock-user', array('text' => postRequestParameter('reason')), bigintval(getRequestParameter('userid')));
72 sendEmail(bigintval(getRequestParameter('userid')), '{--ADMIN_LOCKED_SUBJECT--}', $message);
76 $message = getMaskedMessage('ADMIN_USER_ACCOUNT_LOCKED', bigintval(getRequestParameter('userid')));
78 } elseif ((isPostRequestParameterSet('unlock')) && (getUserData('status') == 'LOCKED')) {
79 // Ok, unlock the account!
80 if (isExtensionInstalledAndNewer('user', '0.3.5')) {
81 // Reset lock reason as well
83 `{?_MYSQL_PREFIX?}_user_data`
91 array(bigintval(getRequestParameter('userid'))), __FILE__, __LINE__);
93 // No lock reason to reset
94 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `status`='CONFIRMED' WHERE `userid`=%s LIMIT 1",
95 array(bigintval(getRequestParameter('userid'))), __FILE__, __LINE__);
99 if (!SQL_HASZEROAFFECTED()) {
100 // Send an email to the user! In later version you can optionally switch this feature off
101 $message = loadEmailTemplate('unlock-user', array('text' => postRequestParameter('reason')), bigintval(getRequestParameter('userid')));
104 sendEmail(bigintval(getRequestParameter('userid')), '{--ADMIN_UNLOCKED_SUBJECT--}', $message);
105 if (isExtensionActive('rallye')) {
106 addUserToReferalRallye(getRequestParameter('userid'));
111 $message = getMaskedMessage('ADMIN_USER_ACCOUNT_UNLOCKED', bigintval(getRequestParameter('userid')));
113 } elseif (isFormSent('delete')) {
114 // Delete the account
116 loadIncludeOnce('inc/modules/admin/what-del_user.php');
117 } elseif (isPostRequestParameterSet('no')) {
118 // Do not lock him...
119 $url = adminCreateUserLink(getRequestParameter('userid'));
121 // Load user data we need
122 if (fetchUserData(getRequestParameter('userid'))) {
123 // Transfer data to constants for the template
124 $content['userid'] = getRequestParameter('userid');
126 // Realy want to lock?
127 switch (getUserData('status')) {
128 case 'CONFIRMED': // Yes, lock him down... ;-)
129 $content['ok'] = 'lock';
130 $content['header'] = getMaskedMessage('ADMIN_HEADER_LOCK_ACCOUNT', $content['userid']);
131 $content['text'] = getMaskedMessage('ADMIN_TEXT_LOCK_ACCOUNT', $content['userid']);
134 case 'LOCKED': // Unlock the user
135 $content['ok'] = 'unlock';
136 $content['header'] = getMaskedMessage('ADMIN_HEADER_UNLOCK_ACCOUNT', $content['userid']);
137 $content['text'] = getMaskedMessage('ADMIN_TEXT_UNLOCK_ACCOUNT', $content['userid']);
140 case 'UNCONFIRMED': // Unconfirmed accounts cannot be unlocked!
141 $content['ok'] = 'delete';
142 $content['header'] = getMaskedMessage('ADMIN_HEADER_DELETE_ACCOUNT', $content['userid']);
143 $content['text'] = getMaskedMessage('ADMIN_TEXT_DELETE_ACCOUNT', $content['userid']);
148 loadTemplate('admin_lock_user', false, $content);
150 // Account does not exists!
151 loadTemplate('admin_settings_unsaved', false, getMaskedMessage('ADMIN_MEMBER_404', bigintval(getRequestParameter('userid'))) . '</div>');
159 } elseif ($isActive) {
160 // An action was performed...
161 if (!empty($message)) {
162 loadTemplate('admin_settings_unsaved', false, $message);
164 loadTemplate('admin_settings_saved', false, '{--ADMIN_USER_UPDATED--}');
168 // Account does not exists!
169 loadTemplate('admin_settings_unsaved', false, getMaskedMessage('ADMIN_MEMBER_404', bigintval(getRequestParameter('userid'))));
173 addMemberSelectionBox();