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');
31 require_once('./includes/api_user.php');
33 if (!$bugsys->userinfo
['userid'])
35 $message->error_permission();
38 $userapi = new UserAPI($bugsys);
39 $userapi->set('userid', $bugsys->userinfo
['userid']);
40 $userapi->set_condition();
42 $userinfo = $bugsys->userinfo
;
44 // ###################################################################
46 if (empty($_REQUEST['do']))
48 $_REQUEST['do'] = 'modify';
51 // ###################################################################
53 if ($_POST['do'] == 'update')
55 // -------------------------------------------------------------------
57 if (!empty($bugsys->in
['password']) OR !empty($bugsys->in
['email']))
59 if (empty($bugsys->in
['validate']))
61 $message->items
[] = $lang->string('You need to enter your current password to change your email or password');
65 if (md5(md5($bugsys->in
['validate']) . md5($bugsys->userinfo
['salt'])) != $bugsys->userinfo
['password'])
67 $message->items
[] = $lang->string('Your authentication password does not match the one in our records');
72 // -------------------------------------------------------------------
74 if (!empty($bugsys->in
['email']))
76 if (!empty($bugsys->in
['email']) AND empty($bugsys->in
['email_confirm']))
78 $message->items
[] = $lang->string('You need to enter both the email and confirm email fields to change your address');
81 if ($bugsys->in
['email'] != $bugsys->in
['email_confirm'])
83 $message->items
[] = $lang->string('Your email and confirm email addresses do not match');
86 $userapi->set('email', $bugsys->in
['email']);
91 // -------------------------------------------------------------------
92 // password validation
93 if (!empty($bugsys->in
['password']))
95 if (!empty($bugsys->in
['password']) AND empty($bugsys->in
['password_confirm']))
97 $message->items
[] = $lang->string('You need to enter both the password and confirm password fields to change your password');
101 if ($bugsys->in
['password'] != $bugsys->in
['password_confirm'])
103 $message->items
[] = $lang->string('Your password and confirm password do not match');
107 $userapi->set('password', $bugsys->in
['password']);
112 $userapi->set('displayname', $bugsys->in
['displayname']);
113 $userapi->set('showemail', $bugsys->in
['showemail']);
114 $userapi->set('showcolours', $bugsys->in
['showcolours']);
115 $userapi->set('languageid', $bugsys->in
['languageid']);
116 $userapi->set('timezone', $bugsys->in
['timezone']);
118 // -------------------------------------------------------------------
120 $userinfo['displayname'] = $bugsys->in
['displayname'];
121 $userinfo['showemail'] = $bugsys->in
['showemail'];
122 $userinfo['showcolours'] = $bugsys->in
['showcolours'];
123 $userinfo['languageid'] = $bugsys->in
['languageid'];
124 $userinfo['timezone'] = $bugsys->in
['timezone'];
126 $email = $bugsys->in
['email'];
127 $email_confirm = $bugsys->in
['email_confirm'];
129 // -------------------------------------------------------------------
133 $message->error_list_process();
135 $show['errors'] = true
;
136 $_REQUEST['do'] = 'modify';
142 if (can_perform('canbeassignedto'))
144 require_once('./includes/functions_datastore.php');
148 $message->redirect($lang->string('The changes to your account have been made.'), 'userctrl.php');
152 // ###################################################################
154 if ($_REQUEST['do'] == 'modify')
156 $langselect = construct_datastore_select('language', 'title', 'languageid', $userinfo['languageid']);
158 foreach ($datef->fetch_timezone_list() AS $value => $label)
160 $selected = ($value == $userinfo['timezone']);
161 eval('$tzselect .= "' . $template->fetch('selectoption') . '";');
164 eval('$template->flush("' . $template->fetch('userctrl') . '");');
167 /*=====================================================================*\
168 || ###################################################################
171 || ###################################################################
172 \*=====================================================================*/