2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 $fetchtemplates = array(
26 define('SVN', '$Id$');
28 $focus['user'] = 'focus';
30 require_once('./global.php');
32 if (!$bugsys->userinfo
['userid'])
34 $message->error_permission();
37 $userinfo = $bugsys->userinfo
;
39 // ###################################################################
41 if (empty($_REQUEST['do']))
43 $_REQUEST['do'] = 'modify';
46 // ###################################################################
48 if ($_POST['do'] == 'update')
50 // -------------------------------------------------------------------
51 // display name validation
52 $count = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "user WHERE displayname = '" . $bugsys->in
['displayname'] . "' AND userid <> " . $bugsys->userinfo
['userid']);
55 $message->items
[] = $lang->string('That display name is already in use by another user');
58 // -------------------------------------------------------------------
60 if (!empty($bugsys->in
['password']) OR !empty($bugsys->in
['email']))
62 if (empty($bugsys->in
['validate']))
64 $message->items
[] = $lang->string('You need to enter your current password to change your email or password');
68 if (md5(md5($bugsys->in
['validate']) . md5($bugsys->userinfo
['salt'])) != $bugsys->userinfo
['password'])
70 $message->items
[] = $lang->string('Your authentication password does not match the one in our records');
75 // -------------------------------------------------------------------
77 if (!empty($bugsys->in
['email']))
79 if (!empty($bugsys->in
['email']) AND empty($bugsys->in
['email_confirm']))
81 $message->items
[] = $lang->string('You need to enter both the email and confirm email fields to change your address');
84 if ($bugsys->in
['email'] != $bugsys->in
['email_confirm'])
86 $message->items
[] = $lang->string('Your email and confirm email addresses do not match');
89 if ($bugsys->in
['email'])
91 $count = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "user WHERE email = '" . $bugsys->in
['email'] . "' AND userid <> " . $bugsys->userinfo
['userid']);
94 $message->items
[] = $lang->string('That email address is already in use');
101 // -------------------------------------------------------------------
102 // password validation
103 if (!empty($bugsys->in
['password']))
105 if (!empty($bugsys->in
['password']) AND empty($bugsys->in
['password_confirm']))
107 $message->items
[] = $lang->string('You need to enter both the password and confirm password fields to change your password');
111 if ($bugsys->in
['password'] != $bugsys->in
['password_confirm'])
113 $message->items
[] = $lang->string('Your password and confirm password do not match');
120 // -------------------------------------------------------------------
122 $userinfo['displayname'] = $bugsys->in
['displayname'];
123 $userinfo['showemail'] = $bugsys->in
['showemail'];
124 $userinfo['showcolours'] = $bugsys->in
['showcolours'];
125 $userinfo['languageid'] = $bugsys->in
['languageid'];
126 $userinfo['timezone'] = $bugsys->in
['timezone'];
128 $email = $bugsys->in
['email'];
129 $email_confirm = $bugsys->in
['email_confirm'];
131 // -------------------------------------------------------------------
135 $message->error_list_process();
137 $show['errors'] = true
;
138 $_REQUEST['do'] = 'modify';
143 UPDATE " . TABLE_PREFIX
. "user
144 SET displayname = '" . $bugsys->in
['displayname'] . "',
145 showemail = " . intval($bugsys->in
['showemail']) . ",
146 showcolours = " . intval($bugsys->in
['showcolours']) . ",
147 languageid = " . intval($bugsys->in
['languageid']) . ",
148 timezone = " . intval($bugsys->in
['timezone']) . ($email ?
",
149 email = '" . $bugsys->in
['email'] . "'" : '') . ($password ?
",
150 password = '" . md5(md5($bugsys->in
['password']) . md5($bugsys->userinfo
['salt'])) . "'" : '') . "
151 WHERE userid = " . $bugsys->userinfo
['userid']
154 if (can_perform('canbeassignedto'))
156 require_once('./includes/functions_datastore.php');
160 $message->redirect($lang->string('The changes to your account have been made.'), 'userctrl.php');
164 // ###################################################################
166 if ($_REQUEST['do'] == 'modify')
168 $langselect = construct_datastore_select('language', 'title', 'languageid', $userinfo['languageid']);
170 foreach ($datef->fetch_timezone_list() AS $value => $label)
172 $selected = ($value == $userinfo['timezone']);
173 eval('$tzselect .= "' . $template->fetch('selectoption') . '";');
176 eval('$template->flush("' . $template->fetch('userctrl') . '");');
179 /*=====================================================================*\
180 || ###################################################################
183 || ###################################################################
184 \*=====================================================================*/