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['showcolours
'] = $bugsys->in['showcolours
'];
116 $userinfo['languageid
'] = $bugsys->in['languageid
'];
117 $userinfo['timezone
'] = $bugsys->in['timezone
'];
119 $email = $bugsys->in['email
'];
120 $email_confirm = $bugsys->in['email_confirm
'];
122 // -------------------------------------------------------------------
124 if ($message->phrase)
126 $message->error_list_process();
128 $show['errors
'] = true;
129 $_REQUEST['do'] = 'modify
';
134 UPDATE " . TABLE_PREFIX . "user
135 SET displayname = '" . $bugsys->in['displayname'] . "',
136 showemail = " . intval($bugsys->in['showemail
']) . ",
137 showcolours = " . intval($bugsys->in['showcolours
']) . ",
138 languageid = " . intval($bugsys->in['languageid
']) . ",
139 timezone = " . intval($bugsys->in['timezone
']) . ($email ? "
140 email = '" . $bugsys->in['email'] . "'" : '') . ($password ? "
141 password = '" . md5(md5($bugsys->in['password']) . md5($bugsys->userinfo['salt'])) . "'" : '') . "
142 WHERE userid = " . $bugsys->userinfo['userid
']
145 if (can_perform('canbeassignedto
'))
147 require_once('./includes
/functions_datastore
.php
');
151 $message->redirect($lang->string('The changes to your account have been made
.'), 'userctrl
.php
');
155 // ###################################################################
157 if ($_REQUEST['do'] == 'modify
')
159 $langselect = construct_datastore_select('language
', 'title
', 'languageid
', $userinfo['languageid
']);
161 foreach ($datef->fetch_timezone_list() AS $value => $label)
163 $selected = ($value == $userinfo['timezone
']);
164 eval('$tzselect .= "' . $template->fetch('selectoption') . '";');
167 eval('$template->flush("' . $template->fetch('userctrl') . '");');
170 /*=====================================================================*\
171 || ###################################################################
174 || ###################################################################
175 \*=====================================================================*/