| [ Index ] |
PHP Cross Reference of MantisBT |
[Summary view] [Print] [Text view]
1 <?php 2 # MantisBT - A PHP based bugtracking system 3 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. 8 # 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. 13 # 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/>. 16 17 /** 18 * Updates prefs then redirect to account_prefs_page.php 19 * 20 * @package MantisBT 21 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 22 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net 23 * @link http://www.mantisbt.org 24 * 25 * @uses core.php 26 * @uses access_api.php 27 * @uses authentication_api.php 28 * @uses config_api.php 29 * @uses event_api.php 30 * @uses form_api.php 31 * @uses gpc_api.php 32 * @uses html_api.php 33 * @uses lang_api.php 34 * @uses print_api.php 35 * @uses user_api.php 36 * @uses user_pref_api.php 37 */ 38 39 /** 40 * MantisBT Core API's 41 */ 42 require_once ( 'core.php' ); 43 require_api( 'access_api.php' ); 44 require_api( 'authentication_api.php' ); 45 require_api( 'config_api.php' ); 46 require_api( 'event_api.php' ); 47 require_api( 'form_api.php' ); 48 require_api( 'gpc_api.php' ); 49 require_api( 'html_api.php' ); 50 require_api( 'lang_api.php' ); 51 require_api( 'print_api.php' ); 52 require_api( 'user_api.php' ); 53 require_api( 'user_pref_api.php' ); 54 55 form_security_validate( 'account_prefs_update' ); 56 57 auth_ensure_user_authenticated(); 58 59 $f_user_id = gpc_get_int( 'user_id' ); 60 $f_redirect_url = gpc_get_string( 'redirect_url' ); 61 62 user_ensure_exists( $f_user_id ); 63 64 $t_user = user_get_row( $f_user_id ); 65 66 # This page is currently called from the manage_* namespace and thus we 67 # have to allow authorised users to update the accounts of other users. 68 # TODO: split this functionality into manage_user_prefs_update.php 69 if ( auth_get_current_user_id() != $f_user_id ) { 70 access_ensure_global_level( config_get( 'manage_user_threshold' ) ); 71 access_ensure_global_level( $t_user['access_level'] ); 72 } else { 73 # Protected users should not be able to update the preferences of their 74 # user account. The anonymous user is always considered a protected 75 # user and hence will also not be allowed to update preferences. 76 user_ensure_unprotected( $f_user_id ); 77 } 78 79 $t_prefs = user_pref_get( $f_user_id ); 80 81 $t_prefs->redirect_delay = gpc_get_int( 'redirect_delay' ); 82 $t_prefs->refresh_delay = gpc_get_int( 'refresh_delay' ); 83 $t_prefs->default_project = gpc_get_int( 'default_project' ); 84 85 $t_lang = gpc_get_string( 'language' ); 86 if ( lang_language_exists( $t_lang ) ) { 87 $t_prefs->language = $t_lang; 88 } 89 90 $t_prefs->email_on_new = gpc_get_bool( 'email_on_new' ); 91 $t_prefs->email_on_assigned = gpc_get_bool( 'email_on_assigned' ); 92 $t_prefs->email_on_feedback = gpc_get_bool( 'email_on_feedback' ); 93 $t_prefs->email_on_resolved = gpc_get_bool( 'email_on_resolved' ); 94 $t_prefs->email_on_closed = gpc_get_bool( 'email_on_closed' ); 95 $t_prefs->email_on_reopened = gpc_get_bool( 'email_on_reopened' ); 96 $t_prefs->email_on_bugnote = gpc_get_bool( 'email_on_bugnote' ); 97 $t_prefs->email_on_status = gpc_get_bool( 'email_on_status' ); 98 $t_prefs->email_on_priority = gpc_get_bool( 'email_on_priority' ); 99 $t_prefs->email_on_new_min_severity = gpc_get_int( 'email_on_new_min_severity' ); 100 $t_prefs->email_on_assigned_min_severity = gpc_get_int( 'email_on_assigned_min_severity' ); 101 $t_prefs->email_on_feedback_min_severity = gpc_get_int( 'email_on_feedback_min_severity' ); 102 $t_prefs->email_on_resolved_min_severity = gpc_get_int( 'email_on_resolved_min_severity' ); 103 $t_prefs->email_on_closed_min_severity = gpc_get_int( 'email_on_closed_min_severity' ); 104 $t_prefs->email_on_reopened_min_severity = gpc_get_int( 'email_on_reopened_min_severity' ); 105 $t_prefs->email_on_bugnote_min_severity = gpc_get_int( 'email_on_bugnote_min_severity' ); 106 $t_prefs->email_on_status_min_severity = gpc_get_int( 'email_on_status_min_severity' ); 107 $t_prefs->email_on_priority_min_severity = gpc_get_int( 'email_on_priority_min_severity' ); 108 109 $t_prefs->bugnote_order = gpc_get_string( 'bugnote_order' ); 110 $t_prefs->email_bugnote_limit = gpc_get_int( 'email_bugnote_limit' ); 111 112 # make sure the delay isn't too low 113 if (( config_get( 'min_refresh_delay' ) > $t_prefs->refresh_delay )&& 114 ( $t_prefs->refresh_delay != 0 )) { 115 $t_prefs->refresh_delay = config_get( 'min_refresh_delay' ); 116 } 117 118 if ( function_exists( 'timezone_identifiers_list' ) ) { 119 $t_timezone = gpc_get_string( 'timezone' ); 120 if ( in_array( $t_timezone, timezone_identifiers_list() ) ) { 121 if ( $t_timezone == config_get_global( 'default_timezone' ) ) { 122 $t_prefs->timezone = ''; 123 } else { 124 $t_prefs->timezone = $t_timezone; 125 } 126 } 127 } 128 129 event_signal( 'EVENT_ACCOUNT_PREF_UPDATE', array( $f_user_id ) ); 130 131 user_pref_set( $f_user_id, $t_prefs ); 132 133 form_security_purge( 'account_prefs_update' ); 134 135 html_page_top( null, $f_redirect_url ); 136 137 echo '<br /><div>'; 138 139 echo lang_get( 'operation_successful' ); 140 141 echo '<br />'; 142 print_bracket_link( $f_redirect_url, lang_get( 'proceed' ) ); 143 echo '<br /></div>'; 144 html_page_bottom();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jul 28 15:48:31 2011 | Cross-referenced by PHPXref 0.7 |