2 # MantisBT - A PHP based bugtracking system
4 # MantisBT is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
9 # MantisBT is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
19 * This page is called from:
21 * - print_account_menu()
22 * - header redirects from account_*.php
23 * - included by verify.php to allow user to change their password
26 * - Display the user's current settings
27 * - Allow the user to edit their settings
28 * - Allow the user to save their changes
29 * - Allow the user to delete their account if account deletion is enabled
32 * This page calls the following pages:
33 * - account_update.php (to save changes)
34 * - account_delete.php (to delete the user's account)
36 * RESTRICTIONS & PERMISSIONS
37 * - User must be authenticated
38 * - The user's account must not be protected
41 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
42 * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
43 * @link http://www.mantisbt.org
46 * @uses authentication_api.php
47 * @uses config_api.php
48 * @uses constant_inc.php
49 * @uses current_user_api.php
51 * @uses helper_api.php
56 * @uses string_api.php
58 * @uses utility_api.php
61 require_once( 'core.php' );
62 require_api( 'authentication_api.php' );
63 require_api( 'config_api.php' );
64 require_api( 'constant_inc.php' );
65 require_api( 'current_user_api.php' );
66 require_api( 'form_api.php' );
67 require_api( 'helper_api.php' );
68 require_api( 'html_api.php' );
69 require_api( 'lang_api.php' );
70 require_api( 'ldap_api.php' );
71 require_api( 'print_api.php' );
72 require_api( 'string_api.php' );
73 require_api( 'user_api.php' );
74 require_api( 'utility_api.php' );
76 #============ Parameters ============
79 #============ Permissions ============
80 auth_ensure_user_authenticated();
82 current_user_ensure_unprotected();
84 # extracts the user information for the currently logged in user
85 # and prefixes it with u_
86 $row = user_get_row( auth_get_current_user_id() );
87 extract( $row, EXTR_PREFIX_ALL
, 'u' );
89 $t_ldap = ( LDAP
== config_get( 'login_method' ) );
91 # In case we're using LDAP to get the email address... this will pull out
92 # that version instead of the one in the DB
93 $u_email = user_get_email( $u_id, $u_username );
95 # note if we are being included by a script of a different name, if so,
96 # this is a mandatory password change request
97 $t_force_pw_reset = is_page_name( 'verify.php' );
99 # Only show the update button if there is something to update.
100 $t_show_update_button = false;
102 html_page_top( lang_get( 'account_link' ) );
105 <!-- # Edit Account Form BEGIN -->
107 <?php
if ( $t_force_pw_reset ) { ?
>
108 <center
><div style
="color:red; width:75%">
110 echo lang_get( 'verify_warning' );
111 if ( helper_call_custom_function( 'auth_can_change_password', array() ) ) {
112 echo '<br />' . lang_get( 'verify_change_password' );
119 <form method
="post" action
="account_update.php">
120 <?php
echo form_security_field( 'account_update' ); ?
>
121 <table
class="width75" cellspacing
="1">
124 <td
class="form-title">
125 <?php
echo lang_get( 'edit_account_title' ) ?
>
128 <?php
print_account_menu( 'account_page.php' ) ?
>
132 <?php
if ( !helper_call_custom_function( 'auth_can_change_password', array() ) ) { ?
> <!-- With LDAP
-->
135 <tr
<?php
echo helper_alternate_class() ?
>>
136 <td
class="category" width
="25%">
137 <?php
echo lang_get( 'username' ) ?
>
140 <?php
echo $u_username ?
>
145 <tr
<?php
echo helper_alternate_class() ?
>>
146 <td
class="category">
147 <?php
echo lang_get( 'password' ) ?
>
150 <?php
echo lang_get( 'no_password_change' ) ?
>
154 <!-- Without LDAP
-->
156 $t_show_update_button = true;
160 <tr
<?php
echo helper_alternate_class() ?
>>
161 <td
class="category" width
="25%">
162 <?php
echo lang_get( 'username' ) ?
>
165 <?php
echo $u_username ?
>
170 <tr
<?php
echo helper_alternate_class() ?
>>
171 <td
class="category">
173 echo lang_get( 'password' );
174 if ( $t_force_pw_reset ) {
176 <span
class="required">*</span
>
180 <input type
="password" size
="32" maxlength
="<?php echo PASSLEN;?>" name
="password" />
184 <!-- Password confirmation
-->
185 <tr
<?php
echo helper_alternate_class() ?
>>
186 <td
class="category">
188 echo lang_get( 'confirm_password' );
189 if ( $t_force_pw_reset ) {
191 <span
class="required">*</span
>
195 <input type
="password" size
="32" maxlength
="<?php echo PASSLEN;?>" name
="password_confirm" />
200 } // End LDAP conditional
202 if ( $t_ldap && ON
== config_get( 'use_ldap_email' ) ) { ?
> <!-- With LDAP Email
-->
205 <tr
<?php
echo helper_alternate_class() ?
>>
206 <td
class="category">
207 <?php
echo lang_get( 'email' ) ?
>
210 <?php
echo $u_email ?
>
214 <?php
} else { ?
> <!-- Without LDAP Email
-->
217 <tr
<?php
echo helper_alternate_class() ?
>>
218 <td
class="category">
219 <?php
echo lang_get( 'email' ) ?
>
223 $t_show_update_button = true;
224 print_email_input( 'email', $u_email );
229 <?php
} ?
> <!-- End LDAP Email conditional
-->
232 <tr
<?php
echo helper_alternate_class() ?
> valign
="top">
233 <td
class="category">
234 <?php
echo lang_get( 'realname' ) ?
>
238 if ( $t_ldap && ON
== config_get( 'use_ldap_realname' ) ) {
239 echo string_display( ldap_realname_from_username( $u_username ) );
241 $t_show_update_button = true;
243 <input type
="text" size
="32" maxlength
="<?php echo REALLEN;?>" name
="realname" value
="<?php echo string_attribute( $u_realname ) ?>" />
248 <!-- Access level
-->
249 <tr
<?php
echo helper_alternate_class() ?
>>
250 <td
class="category">
251 <?php
echo lang_get( 'access_level' ) ?
>
254 <?php
echo get_enum_element( 'access_levels', $u_access_level ) ?
>
258 <!-- Project access level
-->
259 <tr
<?php
echo helper_alternate_class() ?
>>
260 <td
class="category">
261 <?php
echo lang_get( 'access_level_project' ) ?
>
264 <?php
echo get_enum_element( 'access_levels', current_user_get_access_level() ) ?
>
268 <!-- Assigned project
list -->
269 <tr
<?php
echo helper_alternate_class() ?
> valign
="top">
270 <td
class="category">
271 <?php
echo lang_get( 'assigned_projects' ) ?
>
274 <?php
print_project_user_list( auth_get_current_user_id(), false ) ?
>
278 <?php
if ( $t_show_update_button ) { ?
>
282 <?php
if ( $t_force_pw_reset ) { ?
>
283 <span
class="required"> * <?php
echo lang_get( 'required' ) ?
></span
>
286 <!-- Update Button
-->
288 <input type
="submit" class="button" value
="<?php echo lang_get( 'update_user_button' ) ?>" />
297 <?php
# Delete Account Form BEGIN ?>
299 # check if users can't delete their own accounts
300 if ( ON
== config_get( 'allow_account_delete' ) ) {
303 <!-- Delete Button
-->
304 <div
class="border center">
305 <form method
="post" action
="account_delete.php">
306 <?php
echo form_security_field( 'account_delete' ) ?
>
307 <input type
="submit" class="button" value
="<?php echo lang_get( 'delete_account_button' ) ?>" />
313 # Delete Account Form END