/** * Delete the specified option for the specified user across all projects. * * @param string $p_option The configuration option to be deleted. * @param integer $p_user_id The user id. * @return void */ function config_delete_for_user($p_option, $p_user_id) { if (!config_can_delete($p_option)) { return; } # Delete the corresponding bugnote texts $t_query = 'DELETE FROM {config} WHERE config_id=' . db_param() . ' AND user_id=' . db_param(); db_query($t_query, array($p_option, $p_user_id)); }
# end while loop ?> </tbody> </table> </div> </div> <?php # Only display the edit form if user is authorized to change configuration if ($t_read_write_access) { ?> <!-- Config Set Form --> <?php if (config_can_delete($t_edit_option)) { ?> <div id="config-edit-div" class="form-container"> <form id="config_set_form" method="post" action="adm_config_set.php"> <fieldset> <?php echo form_security_field('adm_config_set'); ?> <!-- Title --> <legend><span> <?php echo lang_get('set_configuration_option'); ?> </span></legend>
/** * Delete the specified option for the specified user.across all projects. * @param $p_option - The configuration option to be deleted. * @param $p_user_id - The user id */ function config_delete_for_user( $p_option, $p_user_id ) { if( !config_can_delete( $p_option ) ) { return; } $t_config_table = db_get_table( 'config' ); $c_user_id = db_prepare_int( $p_user_id ); # Delete the corresponding bugnote texts $query = "DELETE FROM $t_config_table WHERE config_id=" . db_param() . " AND user_id=" . db_param(); db_query_bound( $query, array( $p_option, $c_user_id ) ); }
access_ensure_global_level(config_get('set_configuration_threshold')); if ($f_project_id != ALL_PROJECTS) { project_ensure_exists($f_project_id); } # make sure that configuration option specified is a valid one. $t_not_found_value = '***CONFIG OPTION NOT FOUND***'; if (config_get($f_config_option, $t_not_found_value) === $t_not_found_value) { error_parameters($f_config_option); trigger_error(ERROR_CONFIG_OPT_NOT_FOUND, ERROR); } # make sure that configuration option specified can be stored in the database if (!config_can_set_in_database($f_config_option)) { error_parameters($f_config_option); trigger_error(ERROR_CONFIG_OPT_CANT_BE_SET_IN_DB, ERROR); } if (!config_can_delete($f_config_option)) { error_parameters($f_config_option); # @TODO define an error code for values that cant be set in DB, nor config_inc trigger_error(ERROR_CONFIG_OPT_CANT_BE_SET_IN_DB, ERROR); } # For 'default', behavior is based on the global variable's type # If value is empty, process as per default to ensure proper typecast if ($f_type == CONFIG_TYPE_DEFAULT || empty($f_value)) { $t_config_global_value = config_get_global($f_config_option); if (is_string($t_config_global_value)) { $t_type = CONFIG_TYPE_STRING; } else { if (is_int($t_config_global_value)) { $t_type = CONFIG_TYPE_INT; } else { if (is_float($t_config_global_value)) {
?> </td> <td style="overflow-x:auto;"><?php print_config_value_as_string($v_type, $v_value); ?> </td> <td><?php echo get_enum_element('access_levels', $v_access_reqd); ?> </td> <?php if ($t_read_write_access) { ?> <td class="center"> <?php if (config_can_delete($v_config_id)) { # Update button (will populate edit form at page bottom) print_button('#config_set_form', lang_get('edit_link'), array('user_id' => $v_user_id, 'project_id' => $v_project_id, 'config_option' => $v_config_id, 'type' => $v_type, 'value' => $v_value), OFF); # Delete button print_button('adm_config_delete.php', lang_get('delete_link'), array('user_id' => $v_user_id, 'project_id' => $v_project_id, 'config_option' => $v_config_id), $t_form_security_token); } else { echo ' '; } ?> </td> <?php } # end if config_can_delete ?> </tr> <?php
function config_delete($p_option, $p_user = ALL_USERS, $p_project = ALL_PROJECTS) { global $g_cache_config, $g_cache_config_access; # bypass table lookup for certain options $t_bypass_lookup = !config_can_set_in_database($p_option); # @@ debug @@ if ($t_bypass_lookup) { echo "bp=$p_option match=$t_match_pattern <br />"; } # @@ debug @@ if ( ! db_is_connected() ) { echo "no db"; } if (!$t_bypass_lookup && TRUE === db_is_connected() && db_table_exists(config_get_global('mantis_config_table'))) { if (!config_can_delete($p_option)) { return; } $t_config_table = config_get_global('mantis_config_table'); # @@ debug @@ echo "lu table=" . ( db_table_exists( $t_config_table ) ? "yes" : "no" ); # @@ debug @@ error_print_stack_trace(); $c_option = db_prepare_string($p_option); $c_user = db_prepare_int($p_user); $c_project = db_prepare_int($p_project); $query = "DELETE FROM {$t_config_table}\r\n\t\t\t\tWHERE config_id = '{$c_option}' AND\r\n\t\t\t\t\tproject_id={$c_project} AND\r\n\t\t\t\t\tuser_id={$c_user}"; $result = @db_query($query); } config_flush_cache($p_option, $p_user, $p_project); }