[ Index ] |
|
Code source de Mantis 1.1.0rc3 |
1 <?php 2 # Mantis - a php based bugtracking system 3 4 # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 5 # Copyright (C) 2002 - 2007 Mantis Team - mantisbt-dev@lists.sourceforge.net 6 7 # Mantis 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, either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # Mantis is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with Mantis. If not, see <http://www.gnu.org/licenses/>. 19 20 # -------------------------------------------------------- 21 # $Id: manage_config_email_set.php,v 1.10.2.1 2007-10-13 22:33:23 giallu Exp $ 22 # -------------------------------------------------------- 23 24 require_once ( 'core.php' ); 25 26 $t_core_path = config_get( 'core_path' ); 27 require_once( $t_core_path.'email_api.php' ); 28 29 auth_reauthenticate(); 30 31 $t_can_change_level = min( config_get_access( 'notify_flags' ), config_get_access( 'default_notify_flags' ) ); 32 access_ensure_project_level( $t_can_change_level ); 33 34 $t_redirect_url = 'manage_config_email_page.php'; 35 $t_project = helper_get_current_project(); 36 37 $f_flags = gpc_get( 'flag', array() ); 38 $f_thresholds = gpc_get( 'flag_threshold', array() ); 39 $f_actions_access = gpc_get_int( 'notify_actions_access' ); 40 41 html_page_top1( lang_get( 'manage_email_config' ) ); 42 html_meta_redirect( $t_redirect_url ); 43 html_page_top2(); 44 45 $t_access = current_user_get_access_level(); 46 $t_can_change_flags = $t_access >= config_get_access( 'notify_flags' ); 47 $t_can_change_defaults = $t_access >= config_get_access( 'default_notify_flags' ); 48 49 # build a list of the possible actions and flags 50 $t_valid_actions = array( 'owner', 'reopened', 'deleted', 'bugnote' ); 51 if( config_get( 'enable_sponsorship' ) == ON ) { 52 $t_valid_actions[] = 'sponsor'; 53 } 54 if( config_get( 'enable_relationship' ) == ON ) { 55 $t_valid_actions[] = 'relationship'; 56 } 57 58 $t_statuses = get_enum_to_array( config_get( 'status_enum_string' ) ); 59 ksort( $t_statuses ); 60 reset( $t_statuses ); 61 62 foreach( $t_statuses as $t_status => $t_label ) { 63 $t_valid_actions[] = $t_label; 64 } 65 $t_valid_flags = array( 'reporter', 'handler', 'monitor' , 'bugnotes' ); 66 67 # initialize the thresholds 68 foreach( $t_valid_actions as $t_action ) { 69 $t_thresholds_min[$t_action] = NOBODY; 70 $t_thresholds_max[$t_action] = ANYBODY; 71 } 72 73 74 # parse flags and thresholds 75 foreach( $f_flags as $t_flag_value ) { 76 list( $t_action, $t_flag ) = split( ':', $t_flag_value ); 77 $t_flags[$t_action][$t_flag] = ON; 78 } 79 foreach( $f_thresholds as $t_threshold_value ) { 80 list( $t_action, $t_threshold ) = split( ':', $t_threshold_value ); 81 if ( $t_threshold < $t_thresholds_min[$t_action] ) { 82 $t_thresholds_min[$t_action] = $t_threshold; 83 } 84 if ( $t_threshold > $t_thresholds_max[$t_action] ) { 85 $t_thresholds_max[$t_action] = $t_threshold; 86 } 87 } 88 89 # if we can set defaults, find them 90 if ( $t_can_change_defaults ) { 91 $t_first = true; 92 93 # for flags, assume they are true, unless one of the actions has them off 94 foreach ( $t_valid_flags as $t_flag ) { 95 $t_default_flags[$t_flag] = ON; 96 foreach ( $t_valid_actions as $t_action ) { 97 if ( ! isset( $t_flags[$t_action][$t_flag] ) ) { 98 unset( $t_default_flags[$t_flag] ); 99 } 100 } 101 } 102 # for thresholds, find the subset that matches all of the actions 103 $t_default_min = ANYBODY; 104 $t_default_max = NOBODY; 105 foreach ( $t_valid_actions as $t_action ) { 106 if ( $t_default_max > $t_thresholds_max[$t_action] ) { 107 $t_default_max = $t_thresholds_max[$t_action]; 108 } 109 if ( $t_default_min < $t_thresholds_min[$t_action] ) { 110 $t_default_min = $t_thresholds_min[$t_action]; 111 } 112 } 113 $t_default_flags['threshold_min'] = $t_default_min; 114 $t_default_flags['threshold_max'] = $t_default_max; 115 116 $t_existing_default_flags = config_get( 'default_notify_flags' ); 117 if ( $t_existing_default_flags != $t_default_flags ) { # only set the flags if they are different 118 config_set( 'default_notify_flags', $t_default_flags, NO_USER, $t_project, $f_actions_access ); 119 } 120 } else { 121 $t_default_flags = config_get( 'default_notify_flags' ); 122 } 123 124 # set the values for specific actions if different from the defaults 125 $t_notify_flags = array(); 126 foreach ( $t_valid_actions as $t_action ) { 127 $t_action_printed = false; 128 foreach ( $t_valid_flags as $t_flag ) { 129 if ( ! isset( $t_default_flags[$t_flag] ) ) { 130 $t_default_flags[$t_flag] = OFF; 131 } 132 if ( isset( $t_flags[$t_action][$t_flag] ) <> $t_default_flags[$t_flag] ) { 133 $t_notify_flags[$t_action][$t_flag] = isset( $t_flags[$t_action][$t_flag] ) ? ON : OFF; 134 } 135 } 136 if ( $t_default_flags['threshold_min'] <> $t_thresholds_min[$t_action] ) { 137 $t_notify_flags[$t_action]['threshold_min'] = $t_thresholds_min[$t_action]; 138 } 139 if ( $t_default_flags['threshold_max'] <> $t_thresholds_max[$t_action] ) { 140 $t_notify_flags[$t_action]['threshold_max'] = $t_thresholds_max[$t_action]; 141 } 142 } 143 if ( isset( $t_notify_flags ) ) { 144 $t_existing_flags = config_get( 'notify_flags' ); 145 if ( $t_existing_flags != $t_notify_flags ) { # only set the flags if they are different 146 config_set( 'notify_flags', $t_notify_flags, NO_USER, $t_project, $f_actions_access ); 147 } 148 } 149 150 151 ?> 152 153 <br /> 154 <div align="center"> 155 <?php 156 echo lang_get( 'operation_successful' ) . '<br />'; 157 print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); 158 ?> 159 </div> 160 161 <?php html_page_bottom1( __FILE__ ) ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 09:42:17 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |