]> git.mxchange.org Git - mailer.git/blob - inc/modules/admin/what-edit_user.php
- Rewrites to use more the userid than the actual email address when sending
[mailer.git] / inc / modules / admin / what-edit_user.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 09/28/2003 *
4  * ===================                          Last change: 06/10/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-edit_user.php                               *
8  * -------------------------------------------------------------------- *
9  * Short description : Edit member's profiles                           *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Mitgliederprofile aendern                        *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * -------------------------------------------------------------------- *
18  * @TODO Add support for ext-country                                    *
19  * -------------------------------------------------------------------- *
20  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
21  * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
22  * For more information visit: http://www.mxchange.org                  *
23  *                                                                      *
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.                                  *
28  *                                                                      *
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.                         *
33  *                                                                      *
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,               *
37  * MA  02110-1301  USA                                                  *
38  ************************************************************************/
39
40 // Some security stuff...
41 if ((!defined('__SECURITY')) || (!isAdmin())) {
42         die();
43 } // END - if
44
45 // Add description as navigation point
46 addYouAreHereLink('admin', __FILE__);
47
48 // Fix a notice
49 $result_main = false;
50 if (isGetRequestParameterSet('userid')) {
51         // Load user entry
52         $result_main = SQL_QUERY_ESC("SELECT
53         `userid`, `gender`, `surname`, `family`, `street_nr`, `zip`, `city`, `country`,
54         `email`,
55         `birth_day`, `birth_month`, `birth_year`,
56         `max_mails`
57 FROM
58         `{?_MYSQL_PREFIX?}_user_data`
59 WHERE
60         `userid`=%s
61 LIMIT 1",
62                 array(
63                         bigintval(getRequestParameter('userid'))
64                 ), __FILE__, __LINE__);
65 } // END - if
66
67 if ((!isGetRequestParameterSet('userid')) || (SQL_NUMROWS($result_main) == 1)) {
68         // User found
69         if (!isGetRequestParameterSet('userid')) {
70                 // Output selection form with all confirmed user accounts listed
71                 addMemberSelectionBox();
72         } elseif (isFormSent('edit')) {
73                 // Ok, change the account...
74                 $updateUser = false; $add = '';
75                 if ((!isPostRequestParameterSet('pass1')) && (!isPostRequestParameterSet('pass2'))) {
76                         // Don't change the password
77                         $updateUser = true;
78                 } elseif ((postRequestParameter('pass1') == postRequestParameter('pass2'))) {
79                         // Change the password
80                         $updateUser = true;
81                         $add = ", `password`='" . generateHash(postRequestParameter('pass1')) . "'";
82                 }
83
84                 if ($updateUser === true) {
85                         // We have to add the following things: birthday and max receive mails
86                         SQL_QUERY_ESC("UPDATE
87         `{?_MYSQL_PREFIX?}_user_data`
88 SET
89         `gender`='%s',
90         `surname`='%s',
91         `family`='%s',
92         `street_nr`='%s',
93         `country`='%s',
94         `zip`=%s,
95         `city`='%s',
96         `email`='%s'
97         ".$add."
98 WHERE
99         `userid`=%s
100 LIMIT 1",
101                         array(
102                                 substr(postRequestParameter('gender'), 0, 1),
103                                 postRequestParameter('surname'),
104                                 postRequestParameter('family'),
105                                 postRequestParameter('street_nr'),
106                                 postRequestParameter('country'),
107                                 bigintval(postRequestParameter('zip')),
108                                 postRequestParameter('city'),
109                                 postRequestParameter('email'),
110                                 bigintval(getRequestParameter('userid')),
111                         ), __FILE__, __LINE__);
112                         $content = '{--ADMIN_USER_ACCOUNT_SAVED--}';
113                 } else {
114                         // Problem while saving data
115                         $content = '{--ADMIN_USER_ACCOUNT_NOT_SAVED--}';
116                 }
117
118                 // Load template
119                 displayMessage($content);
120         } else {
121                 // Load entry
122                 $content = SQL_FETCHARRAY($result_main);
123
124                 // Load template
125                 loadTemplate('admin_edit_user', false, $content);
126         }
127 } else {
128         // Account does not exists!
129         loadTemplate('admin_settings_unsaved', false, '{%message,ADMIN_MEMBER_404=' . bigintval(getRequestParameter('userid')) . '%}');
130 }
131
132 // Free the result
133 SQL_FREERESULT($result_main);
134
135 // [EOF]
136 ?>