| [ 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 - 2010 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 require_once ( 'core.php' ); 40 require_api( 'access_api.php' ); 41 require_api( 'authentication_api.php' ); 42 require_api( 'config_api.php' ); 43 require_api( 'event_api.php' ); 44 require_api( 'form_api.php' ); 45 require_api( 'gpc_api.php' ); 46 require_api( 'html_api.php' ); 47 require_api( 'lang_api.php' ); 48 require_api( 'print_api.php' ); 49 require_api( 'user_api.php' ); 50 require_api( 'user_pref_api.php' ); 51 52 form_security_validate( 'account_prefs_update' ); 53 54 auth_ensure_user_authenticated(); 55 56 $f_user_id = gpc_get_int( 'user_id' ); 57 $f_redirect_url = gpc_get_string( 'redirect_url' ); 58 59 user_ensure_exists( $f_user_id ); 60 61 # This page is currently called from the manage_* namespace and thus we 62 # have to allow authorised users to update the accounts of other users. 63 # TODO: split this functionality into manage_user_prefs_update.php 64 if ( auth_get_current_user_id() != $f_user_id ) { 65 access_ensure_global_level( config_get( 'manage_user_threshold' ) ); 66 } else { 67 # Protected users should not be able to update the preferences of their 68 # user account. The anonymous user is always considered a protected 69 # user and hence will also not be allowed to update preferences. 70 user_ensure_unprotected( $f_user_id ); 71 } 72 73 $t_prefs = user_pref_get( $f_user_id ); 74 75 $t_prefs->redirect_delay = gpc_get_int( 'redirect_delay' ); 76 $t_prefs->refresh_delay = gpc_get_int( 'refresh_delay' ); 77 $t_prefs->default_project = gpc_get_int( 'default_project' ); 78 79 $t_lang = gpc_get_string( 'language' ); 80 if ( lang_language_exists( $t_lang ) ) { 81 $t_prefs->language = $t_lang; 82 } 83 84 $t_prefs->email_on_new = gpc_get_bool( 'email_on_new' ); 85 $t_prefs->email_on_assigned = gpc_get_bool( 'email_on_assigned' ); 86 $t_prefs->email_on_feedback = gpc_get_bool( 'email_on_feedback' ); 87 $t_prefs->email_on_resolved = gpc_get_bool( 'email_on_resolved' ); 88 $t_prefs->email_on_closed = gpc_get_bool( 'email_on_closed' ); 89 $t_prefs->email_on_reopened = gpc_get_bool( 'email_on_reopened' ); 90 $t_prefs->email_on_bugnote = gpc_get_bool( 'email_on_bugnote' ); 91 $t_prefs->email_on_status = gpc_get_bool( 'email_on_status' ); 92 $t_prefs->email_on_priority = gpc_get_bool( 'email_on_priority' ); 93 $t_prefs->email_on_new_min_severity = gpc_get_int( 'email_on_new_min_severity' ); 94 $t_prefs->email_on_assigned_min_severity = gpc_get_int( 'email_on_assigned_min_severity' ); 95 $t_prefs->email_on_feedback_min_severity = gpc_get_int( 'email_on_feedback_min_severity' ); 96 $t_prefs->email_on_resolved_min_severity = gpc_get_int( 'email_on_resolved_min_severity' ); 97 $t_prefs->email_on_closed_min_severity = gpc_get_int( 'email_on_closed_min_severity' ); 98 $t_prefs->email_on_reopened_min_severity = gpc_get_int( 'email_on_reopened_min_severity' ); 99 $t_prefs->email_on_bugnote_min_severity = gpc_get_int( 'email_on_bugnote_min_severity' ); 100 $t_prefs->email_on_status_min_severity = gpc_get_int( 'email_on_status_min_severity' ); 101 $t_prefs->email_on_priority_min_severity = gpc_get_int( 'email_on_priority_min_severity' ); 102 103 $t_prefs->bugnote_order = gpc_get_string( 'bugnote_order' ); 104 $t_prefs->email_bugnote_limit = gpc_get_int( 'email_bugnote_limit' ); 105 106 # make sure the delay isn't too low 107 if (( config_get( 'min_refresh_delay' ) > $t_prefs->refresh_delay )&& 108 ( $t_prefs->refresh_delay != 0 )) { 109 $t_prefs->refresh_delay = config_get( 'min_refresh_delay' ); 110 } 111 112 if ( function_exists( 'timezone_identifiers_list' ) ) { 113 $t_timezone = gpc_get_string( 'timezone' ); 114 if ( in_array( $t_timezone, timezone_identifiers_list() ) ) { 115 if ( $t_timezone == config_get_global( 'default_timezone' ) ) { 116 $t_prefs->timezone = ''; 117 } else { 118 $t_prefs->timezone = $t_timezone; 119 } 120 } 121 } 122 123 event_signal( 'EVENT_ACCOUNT_PREF_UPDATE', array( $f_user_id ) ); 124 125 user_pref_set( $f_user_id, $t_prefs ); 126 127 form_security_purge( 'account_prefs_update' ); 128 129 html_page_top( null, $f_redirect_url ); 130 131 echo '<br /><div align="center">'; 132 133 echo lang_get( 'operation_successful' ); 134 135 echo '<br />'; 136 print_bracket_link( $f_redirect_url, lang_get( 'proceed' ) ); 137 echo '<br /></div>'; 138 html_page_bottom();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat Mar 6 17:17:35 2010 | Cross-referenced by PHPXref 0.7 |