New function fetchUserData() introduced to API, total rewrite (not all)
[mailer.git] / inc / modules / admin / what-del_user.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 09/28/2003 *
4  * ===============                              Last change: 06/10/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-del_user.php                                *
8  * -------------------------------------------------------------------- *
9  * Short description : Delete members                                   *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Mitglieder loeschen                              *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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  * For more information visit: http://www.mxchange.org                  *
22  *                                                                      *
23  * This program is free software; you can redistribute it and/or modify *
24  * it under the terms of the GNU General Public License as published by *
25  * the Free Software Foundation; either version 2 of the License, or    *
26  * (at your option) any later version.                                  *
27  *                                                                      *
28  * This program is distributed in the hope that it will be useful,      *
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
31  * GNU General Public License for more details.                         *
32  *                                                                      *
33  * You should have received a copy of the GNU General Public License    *
34  * along with this program; if not, write to the Free Software          *
35  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if ((!defined('__SECURITY')) || (!isAdmin())) {
41         die();
42 } // END - if
43
44 // Display only title when no form was submitted
45 addMenuDescription('admin', __FILE__);
46
47 // User exists..
48 if ((isFormSent()) || ((isPostRequestElementSet('del')) && (isPostRequestElementSet(('reason'))))) {
49         // Is the account there?
50         if (fetchUserData(getRequestElement('userid'))) {
51                 // Delete user account
52                 deleteUserAccount(getRequestElement('userid'), postRequestElement('reason'));
53
54                 // Output message
55                 loadTemplate('admin_settings_saved', false, getMessage('ADMIN_DEL_COMPLETED'));
56         } else {
57                 // Account does not exists!
58                 loadTemplate('admin_settings_saved', false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), getRequestElement('userid'))."</div>");
59         }
60 } elseif (isPostRequestElementSet('no')) {
61         // Do not delete him...
62         redirectToUrl(adminCreateUserLink(getRequestElement('userid')));
63 } elseif (!isGetRequestElementSet('userid')) {
64         // Output selection form with all confirmed user accounts listed
65         addMemberSelectionBox();
66 } else {
67         // Realy want to delete?
68         if (fetchUserData(getRequestElement('userid'))) {
69                 // Prepare content
70                 $content = array(
71                         'email'   => generateEmailLink(getUserData('email'), 'user_data'),
72                         'surname' => getUserData('surname'),
73                         'family'  => getUserData('family'),
74                         'header'  => sprintf(getMessage('ADMIN_HEADER_DEL_ACCOUNT'), getRequestElement('userid')),
75                         'text'    => sprintf(getMessage('ADMIN_TEXT_DEL_ACCOUNT'), getRequestElement('userid')),
76                         'userid'  => getRequestElement('userid')
77                 );
78
79                 // Display form
80                 loadTemplate('admin_del_user', false, $content);
81         } else {
82                 // Account does not exists!
83                 loadTemplate('admin_settings_saved', false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), getRequestElement('userid'))."</div>");
84         }
85 }
86
87 // [EOF]
88 ?>