2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 $fetchtemplates = array(
17 define('SVN', '$Id$');
19 $focus['user'] = 'focus';
21 require_once('./global.php');
23 if (!$bugsys->userinfo
['userid'])
25 $message->error_permission();
28 $userinfo = $bugsys->userinfo
;
30 // ###################################################################
32 if (empty($_REQUEST['do']))
34 $_REQUEST['do'] = 'modify';
37 // ###################################################################
39 if ($_POST['do'] == 'update')
41 // -------------------------------------------------------------------
42 // display name validation
43 $count = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "user WHERE displayname = '" . $bugsys->in
['displayname'] . "' AND userid <> " . $bugsys->userinfo
['userid']);
46 $message->phrase
[] = $lang->string('That display name is already in use by another user');
49 // -------------------------------------------------------------------
51 if (!empty($bugsys->in
['password']) OR !empty($bugsys->in
['email']))
53 if (empty($bugsys->in
['validate']))
55 $message->phrase
[] = $lang->string('You need to enter your current password to change your email or password');
59 if (md5(md5($bugsys->in
['validate']) . md5($bugsys->userinfo
['salt'])) != $bugsys->userinfo
['password'])
61 $message->phrase
[] = $lang->string('Your authentication password does not match the one in our records');
66 // -------------------------------------------------------------------
68 if (!empty($bugsys->in
['email']))
70 if (!empty($bugsys->in
['email']) AND empty($bugsys->in
['email_confirm']))
72 $message->phrase
[] = $lang->string('You need to enter both the email and confirm email fields to change your address');
75 if ($bugsys->in
['email'] != $bugsys->in
['email_confirm'])
77 $message->phrase
[] = $lang->string('Your email and confirm email addresses do not match');
80 if ($bugsys->in
['email'])
82 $count = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "user WHERE email = '" . $bugsys->in
['email'] . "' AND userid <> " . $bugsys->userinfo
['userid']);
85 $message->phrase
[] = $lang->string('That email address is already in use');
92 // -------------------------------------------------------------------
93 // password validation
94 if (!empty($bugsys->in
['password']))
96 if (!empty($bugsys->in
['password']) AND empty($bugsys->in
['password_confirm']))
98 $message->phrase
[] = $lang->string('You need to enter both the password and confirm password fields to change your password');
102 if ($bugsys->in
['password'] != $bugsys->in
['password_confirm'])
104 $message->phrase
[] = $lang->string('Your password and confirm password do not match');
111 // -------------------------------------------------------------------
113 $userinfo['displayname'] = $bugsys->in
['displayname'];
114 $userinfo['showemail'] = $bugsys->in
['showemail'];
115 $userinfo['languageid'] = $bugsys->in
['languageid'];
116 $userinfo['timezone'] = $bugsys->in
['timezone'];
118 $email = $bugsys->in
['email'];
119 $email_confirm = $bugsys->in
['email_confirm'];
121 // -------------------------------------------------------------------
123 if ($message->phrase
)
125 $message->error_list_process();
127 $show['errors'] = true
;
128 $_REQUEST['do'] = 'modify';
133 UPDATE " . TABLE_PREFIX
. "user
134 SET displayname = '" . $bugsys->in
['displayname'] . "',
135 showemail = " . intval($bugsys->in
['showemail']) . ",
136 languageid = " . intval($bugsys->in
['languageid']) . ",
137 timezone = " . intval($bugsys->in
['timezone']) . ($email ?
"
138 email = '" . $bugsys->in
['email'] . "'" : '') . ($password ?
"
139 password = '" . md5(md5($bugsys->in
['password']) . md5($bugsys->userinfo
['salt'])) . "'" : '') . "
140 WHERE userid = " . $bugsys->userinfo
['userid']
143 $message->redirect($lang->string('The changes to your account have been made.'), 'userctrl.php');
147 // ###################################################################
149 if ($_REQUEST['do'] == 'modify')
151 $langselect = construct_datastore_select('language', 'title', 'languageid', $userinfo['languageid']);
153 foreach ($datef->fetch_timezone_list() AS $value => $label)
155 $selected = ($value == $userinfo['timezone']);
156 eval('$tzselect .= "' . $template->fetch('selectoption') . '";');
159 eval('$template->flush("' . $template->fetch('userctrl') . '");');
162 /*=====================================================================*\
163 || ###################################################################
166 || ###################################################################
167 \*=====================================================================*/