/** * print tag fields * @return void */ function print_filter_tag_string() { if (!access_has_global_level(config_get('tag_view_threshold'))) { return; } global $g_filter; $t_tag_string = $g_filter[FILTER_PROPERTY_TAG_STRING]; if ($g_filter[FILTER_PROPERTY_TAG_SELECT] != 0 && tag_exists($g_filter[FILTER_PROPERTY_TAG_SELECT])) { $t_tag_string .= is_blank($t_tag_string) ? '' : config_get('tag_separator'); $t_tag_string .= tag_get_field($g_filter[FILTER_PROPERTY_TAG_SELECT], 'name'); } ?> <input type="hidden" id="tag_separator" value="<?php echo config_get('tag_separator'); ?> " /> <input type="text" name="<?php echo FILTER_PROPERTY_TAG_STRING; ?> " id="<?php echo FILTER_PROPERTY_TAG_STRING; ?> " size="40" value="<?php echo string_attribute($t_tag_string); ?> " /> <select <?php echo helper_get_tab_index(); ?> name="<?php echo FILTER_PROPERTY_TAG_SELECT; ?> " id="<?php echo FILTER_PROPERTY_TAG_SELECT; ?> "> <?php print_tag_option_list(); ?> </select> <?php }
require_api('gpc_api.php'); require_api('helper_api.php'); require_api('html_api.php'); require_api('lang_api.php'); require_api('print_api.php'); require_api('string_api.php'); require_api('tag_api.php'); require_api('user_api.php'); access_ensure_global_level(config_get('tag_view_threshold')); compress_enable(); $f_tag_id = gpc_get_int('tag_id'); $t_tag_row = tag_get($f_tag_id); $t_name = string_display_line($t_tag_row['name']); $t_description = string_display($t_tag_row['description']); $t_can_edit = access_has_global_level(config_get('tag_edit_threshold')); $t_can_edit_own = $t_can_edit || auth_get_current_user_id() == tag_get_field($f_tag_id, 'user_id') && access_has_global_level(config_get('tag_edit_own_threshold')); html_page_top(sprintf(lang_get('tag_details'), $t_name)); ?> <div id="tag-view-div" class="form-container"> <h2><?php echo sprintf(lang_get('tag_details'), $t_name); ?> </h2> <div class="section-link"> <?php print_bracket_link('search.php?tag_string=' . urlencode($t_tag_row['name']), sprintf(lang_get('tag_filter_default'), tag_stats_attached($f_tag_id))); ?> </div> <div class="field-container"> <span class="display-label"><span><?php
/** * Detach a tag from a bug. * @param integer Tag ID * @param integer Bug ID * @param boolean Add history entries to bug * @param integer User Id (or null for current logged in user) */ function tag_bug_detach($p_tag_id, $p_bug_id, $p_add_history = true, $p_user_id = null) { if ($p_user_id === null) { $t_user_id = auth_get_current_user_id(); } else { $t_user_id = $p_user_id; } if (!tag_bug_is_attached($p_tag_id, $p_bug_id)) { trigger_error(TAG_NOT_ATTACHED, ERROR); } $t_tag_row = tag_bug_get_row($p_tag_id, $p_bug_id); if ($t_user_id == tag_get_field($p_tag_id, 'user_id') || $t_user_id == $t_tag_row['user_id']) { $t_detach_level = config_get('tag_detach_own_threshold'); } else { $t_detach_level = config_get('tag_detach_threshold'); } access_ensure_bug_level($t_detach_level, $p_bug_id, $t_user_id); $c_tag_id = db_prepare_int($p_tag_id); $c_bug_id = db_prepare_int($p_bug_id); $t_bug_tag_table = db_get_table('bug_tag'); $query = "DELETE FROM {$t_bug_tag_table}\n\t\t\t\t\tWHERE tag_id=" . db_param() . ' AND bug_id=' . db_param(); db_query_bound($query, array($c_tag_id, $c_bug_id)); if ($p_add_history) { $t_tag_name = tag_get_field($p_tag_id, 'name'); history_log_event_special($p_bug_id, TAG_DETACHED, $t_tag_name); } # updated the last_updated date bug_update_date($p_bug_id); return true; }
/** * Detach a tag from a bug. * @param integer Tag ID * @param integer Bug ID * @param boolean Add history entries to bug * @param integer User Id (or null for current logged in user) */ function tag_bug_detach($p_tag_id, $p_bug_id, $p_add_history = true, $p_user_id = null) { if ($p_user_id === null) { $t_user_id = auth_get_current_user_id(); } else { $t_user_id = $p_user_id; } if (!tag_bug_is_attached($p_tag_id, $p_bug_id)) { trigger_error(TAG_NOT_ATTACHED, ERROR); } $t_tag_row = tag_bug_get_row($p_tag_id, $p_bug_id); if ($t_user_id == tag_get_field($p_tag_id, 'user_id') || $t_user_id == $t_tag_row['user_id']) { $t_detach_level = config_get('tag_detach_own_threshold'); } else { $t_detach_level = config_get('tag_detach_threshold'); } access_ensure_bug_level($t_detach_level, $p_bug_id, $t_user_id); $c_tag_id = db_prepare_int($p_tag_id); $c_bug_id = db_prepare_int($p_bug_id); $t_bug_tag_table = config_get('mantis_bug_tag_table'); $query = "DELETE FROM {$t_bug_tag_table} \r\n\t\t\t\t\tWHERE tag_id='{$c_tag_id}' AND bug_id='{$c_bug_id}'"; db_query($query); if ($p_add_history) { $t_tag_name = tag_get_field($p_tag_id, 'name'); history_log_event_special($p_bug_id, TAG_DETACHED, $t_tag_name); } return true; }
function print_filter_tag_string() { if (!access_has_global_level(config_get('tag_view_threshold'))) { return; } global $t_filter; $t_tag_string = $t_filter['tag_string']; if ($t_filter['tag_select'] != 0) { $t_tag_string .= is_blank($t_tag_string) ? '' : config_get('tag_separator'); $t_tag_string .= tag_get_field($t_filter['tag_select'], 'name'); } ?> <input type="hidden" id="tag_separator" value="<?php echo config_get('tag_separator'); ?> " /> <input type="text" name="tag_string" id="tag_string" size="40" value="<?php echo $t_tag_string; ?> " /> <select <?php echo helper_get_tab_index(); ?> name="tag_select" id="tag_select"> <?php print_tag_option_list(); ?> </select> <?php }
require_api( 'lang_api.php' ); require_api( 'print_api.php' ); require_api( 'string_api.php' ); require_api( 'tag_api.php' ); require_api( 'user_api.php' ); access_ensure_global_level( config_get( 'tag_view_threshold' ) ); compress_enable(); $f_tag_id = gpc_get_int( 'tag_id' ); $t_tag_row = tag_get( $f_tag_id ); $t_name = string_display_line( $t_tag_row['name'] ); $t_description = string_display( $t_tag_row['description'] ); $t_can_edit = access_has_global_level( config_get( 'tag_edit_threshold' ) ); $t_can_edit_own = $t_can_edit || auth_get_current_user_id() == tag_get_field( $f_tag_id, 'user_id' ) && access_has_global_level( config_get( 'tag_edit_own_threshold' ) ); html_page_top( sprintf( lang_get( 'tag_details' ), $t_name ) ); ?> <div id="tag-view-div" class="form-container"> <h2><?php echo sprintf( lang_get( 'tag_details' ), $t_name ) ?></h2> <div class="section-link"> <?php print_bracket_link( 'search.php?tag_string='.urlencode($t_tag_row['name']), sprintf( lang_get( 'tag_filter_default' ), tag_stats_attached( $f_tag_id ) ) ); ?> </div> <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>"> <span class="display-label"><span><?php echo lang_get( 'tag_id' ) ?></span></span> <span class="display-value"><span><?php echo $t_tag_row['id'] ?></span></span> <span class="label-style"></span> </div>