Пример #1
0
/**
 * Posts a twitter update when a bug is resolved.
 *
 * @param $p_bug_id The bug id that was resolved.
 * @access public
 */
function twitter_issue_resolved($p_bug_id)
{
    if (!twitter_enabled()) {
        return true;
    }
    $t_bug = bug_get($p_bug_id, false);
    # Do not twitter except fixed issues
    if ($t_bug->resolution < config_get('bug_resolution_fixed_threshold') || $t_bug->resolution >= config_get('bug_resolution_not_fixed_threshold')) {
        return true;
    }
    # Do not twitter private bugs.
    if ($t_bug->view_state != VS_PUBLIC) {
        return true;
    }
    # Do not twitter bugs belonging to private projects.
    if (VS_PRIVATE == project_get_field($t_bug->project_id, 'view_state')) {
        return true;
    }
    $c_bug_id = db_prepare_int($p_bug_id);
    if (is_blank($t_bug->fixed_in_version)) {
        $t_message = sprintf(lang_get('twitter_resolved_no_version'), $c_bug_id, category_full_name($t_bug->category_id, false), $t_bug->summary, user_get_name($t_bug->handler_id));
    } else {
        $t_message = sprintf(lang_get('twitter_resolved'), $c_bug_id, category_full_name($t_bug->category_id, false), $t_bug->summary, user_get_name($t_bug->handler_id), $t_bug->fixed_in_version);
    }
    return twitter_update($t_message);
}
Пример #2
0
 function worklogmenu()
 {
     if (ON == plugin_config_get('promote_text')) {
         $bugid = gpc_get_int('id');
         if (access_has_bug_level(plugin_config_get('promote_threshold'), $bugid)) {
             $t_bug_p = bug_get($bugid, true);
             if (OFF == plugin_config_get('project_text')) {
                 $proj_id = 0;
             } else {
                 $proj_id = $t_bug_p->project_id;
             }
             $subject = urlencode($t_bug_p->description);
             $subject .= " ";
             $subject .= urlencode($t_bug_p->additional_information);
             $content = category_full_name($t_bug_p->category_id);
             $content .= " -> ";
             $content .= urlencode($t_bug_p->summary);
             if (ON == plugin_config_get('worklog_view_check')) {
                 $import_page = 'worklog_add_page2.php';
             } else {
                 $import_page = 'worklog_add.php';
             }
             $import_page .= '&log_type=0&';
             $import_page .= '&ref_log_ids=';
             $import_page .= '&ref_issue_ids=';
             $import_page .= '&log_begin=';
             $import_page .= '&log_end=';
             $import_page .= '&content=';
             $import_page .= $content;
             $import_page .= '&subject=';
             $import_page .= $subject;
             $import_page .= '&project_id=';
             $import_page .= $proj_id;
             if (ON == plugin_config_get('worklog_view_check')) {
                 return array(plugin_lang_get('import_worklog') => plugin_page($import_page) . '" target=_new>');
             } else {
                 return array(plugin_lang_get('import_worklog') => plugin_page($import_page));
             }
         }
     }
 }
Пример #3
0
 function faqmenu()
 {
     if (ON == plugin_config_get('promote_text')) {
         $bugid = gpc_get_int('id');
         if (access_has_bug_level(plugin_config_get('promote_threshold'), $bugid)) {
             $t_bug_p = bug_get($bugid, true);
             if (OFF == plugin_config_get('project_text')) {
                 $proj_id = 0;
             } else {
                 $proj_id = $t_bug_p->project_id;
             }
             $answer = urlencode($t_bug_p->description);
             $answer .= " ";
             $answer .= urlencode($t_bug_p->additional_information);
             $question = category_full_name($t_bug_p->category_id);
             $question .= " -> ";
             $question .= urlencode($t_bug_p->summary);
             if (ON == plugin_config_get('faq_view_check')) {
                 $import_page = 'faq_add_page2.php';
             } else {
                 $import_page = 'faq_add.php';
             }
             $import_page .= '&question=';
             $import_page .= $question;
             $import_page .= '&answere=';
             $import_page .= $answer;
             $import_page .= '&project_id=';
             $import_page .= $proj_id;
             if (ON == plugin_config_get('faq_view_check')) {
                 return array(plugin_lang_get('import_faq') => plugin_page($import_page) . '" target=_new>');
             } else {
                 return array(plugin_lang_get('import_faq') => plugin_page($import_page));
             }
         }
     }
 }
Пример #4
0
/**
 * Build the bug raw data visible for specified user to be translated and sent by email to the user
 * (Filter the bug data according to user access level)
 * return array with bug data. See usage in email_format_bug_message(...)
 * @param int $p_user_id
 * @param int $p_bug_id
 * @param string $p_message_id
 * @return array
 */
function email_build_visible_bug_data($p_user_id, $p_bug_id, $p_message_id)
{
    $t_project_id = bug_get_field($p_bug_id, 'project_id');
    $t_user_access_level = user_get_access_level($p_user_id, $t_project_id);
    $t_user_bugnote_order = user_pref_get_pref($p_user_id, 'bugnote_order');
    $t_user_bugnote_limit = user_pref_get_pref($p_user_id, 'email_bugnote_limit');
    $row = bug_get_extended_row($p_bug_id);
    $t_bug_data = array();
    $t_bug_data['email_bug'] = $p_bug_id;
    if ($p_message_id !== 'email_notification_title_for_action_bug_deleted') {
        $t_bug_data['email_bug_view_url'] = string_get_bug_view_url_with_fqdn($p_bug_id);
    }
    if (access_compare_level($t_user_access_level, config_get('view_handler_threshold'))) {
        if (0 != $row['handler_id']) {
            $t_bug_data['email_handler'] = user_get_name($row['handler_id']);
        } else {
            $t_bug_data['email_handler'] = '';
        }
    }
    $t_bug_data['email_reporter'] = user_get_name($row['reporter_id']);
    $t_bug_data['email_project_id'] = $row['project_id'];
    $t_bug_data['email_project'] = project_get_field($row['project_id'], 'name');
    $t_category_name = category_full_name($row['category_id'], false);
    $t_bug_data['email_category'] = $t_category_name;
    $t_bug_data['email_date_submitted'] = $row['date_submitted'];
    $t_bug_data['email_last_modified'] = $row['last_updated'];
    $t_bug_data['email_status'] = $row['status'];
    $t_bug_data['email_severity'] = $row['severity'];
    $t_bug_data['email_priority'] = $row['priority'];
    $t_bug_data['email_reproducibility'] = $row['reproducibility'];
    $t_bug_data['email_resolution'] = $row['resolution'];
    $t_bug_data['email_fixed_in_version'] = $row['fixed_in_version'];
    if (!is_blank($row['target_version']) && access_compare_level($t_user_access_level, config_get('roadmap_view_threshold'))) {
        $t_bug_data['email_target_version'] = $row['target_version'];
    }
    $t_bug_data['email_summary'] = $row['summary'];
    $t_bug_data['email_description'] = $row['description'];
    $t_bug_data['email_additional_information'] = $row['additional_information'];
    $t_bug_data['email_steps_to_reproduce'] = $row['steps_to_reproduce'];
    $t_bug_data['set_category'] = '[' . $t_bug_data['email_project'] . '] ' . $t_category_name;
    $t_bug_data['custom_fields'] = custom_field_get_linked_fields($p_bug_id, $t_user_access_level);
    $t_bug_data['bugnotes'] = bugnote_get_all_visible_bugnotes($p_bug_id, $t_user_bugnote_order, $t_user_bugnote_limit, $p_user_id);
    # put history data
    if (ON == config_get('history_default_visible') && access_compare_level($t_user_access_level, config_get('view_history_threshold'))) {
        $t_bug_data['history'] = history_get_raw_events_array($p_bug_id, $p_user_id);
    }
    # Sponsorship Information
    if (config_get('enable_sponsorship') == ON && access_has_bug_level(config_get('view_sponsorship_total_threshold'), $p_bug_id, $p_user_id)) {
        $t_sponsorship_ids = sponsorship_get_all_ids($p_bug_id);
        $t_bug_data['sponsorship_total'] = sponsorship_get_amount($t_sponsorship_ids);
        if (access_has_bug_level(config_get('view_sponsorship_details_threshold'), $p_bug_id, $p_user_id)) {
            $t_bug_data['sponsorships'] = array();
            foreach ($t_sponsorship_ids as $id) {
                $t_bug_data['sponsorships'][] = sponsorship_get($id);
            }
        }
    }
    $t_bug_data['relations'] = relationship_get_summary_text($p_bug_id);
    return $t_bug_data;
}
Пример #5
0
/**
 * Gets the formatted category.
 * @param object $p_bug the bug
 * @returns the category.
 */
function excel_format_category_id($p_bug)
{
    return excel_prepare_string(category_full_name($p_bug->category_id, false));
}
Пример #6
0
/**
 * Remove all categories associated with a project
 * @param int $p_project_id Project ID
 * @param int $p_new_category_id new category id (to replace existing category)
 * @return bool
 * @access public
 */
 function category_remove_all( $p_project_id, $p_new_category_id = 0 ) {

	project_ensure_exists( $p_project_id );
	if( 0 != $p_new_category_id ) {
		category_ensure_exists( $p_new_category_id );
	}

	# cache category names
	category_get_all_rows( $p_project_id );

	$t_category_table = db_get_table( 'category' );
	$t_bug_table = db_get_table( 'bug' );

	# get a list of affected categories
	$t_query = "SELECT id FROM $t_category_table WHERE project_id=" . db_param();
	$t_result = db_query_bound( $t_query, array( $p_project_id ) );

	$t_category_ids = array();
	while( $t_row = db_fetch_array( $t_result ) ) {
		$t_category_ids[] = $t_row['id'];
	}

	# Handle projects with no categories
	if( count( $t_category_ids ) < 1 ) {
		return true;
	}

	$t_category_ids = join( ',', $t_category_ids );

	# update bug history entries
	$t_query = "SELECT id, category_id FROM $t_bug_table WHERE category_id IN ( $t_category_ids )";
	$t_result = db_query_bound( $t_query );

	while( $t_bug_row = db_fetch_array( $t_result ) ) {
		history_log_event_direct( $t_bug_row['id'], 'category', category_full_name( $t_bug_row['category_id'], false ), category_full_name( $p_new_category_id, false ) );
	}

	# update bug data
	$t_query = "UPDATE $t_bug_table SET category_id=" . db_param() . " WHERE category_id IN ( $t_category_ids )";
	db_query_bound( $t_query, array( $p_new_category_id ) );

	# delete categories
	$t_query = "DELETE FROM $t_category_table WHERE project_id=" . db_param();
	db_query_bound( $t_query, array( $p_project_id ) );

	return true;
}
Пример #7
0
/**
 * Since categories can be orphaned we need to grab all unique instances of category
 * We check in the project category table and in the bug table
 * We put them all in one array and make sure the entries are unique
 *
 * @param integer $p_category_id A category identifier.
 * @param integer $p_project_id  A project identifier.
 * @return void
 */
function print_category_option_list($p_category_id = 0, $p_project_id = null)
{
    if (null === $p_project_id) {
        $t_project_id = helper_get_current_project();
    } else {
        $t_project_id = $p_project_id;
    }
    $t_cat_arr = category_get_all_rows($t_project_id, null, true);
    if (config_get('allow_no_category')) {
        echo '<option value="0"';
        check_selected($p_category_id, 0);
        echo '>';
        echo category_full_name(0, false), '</option>';
    } else {
        if (0 == $p_category_id) {
            if (count($t_cat_arr) == 1) {
                $p_category_id = (int) $t_cat_arr[0]['id'];
            } else {
                echo '<option value="0"';
                echo check_selected($p_category_id, 0);
                echo '>';
                echo string_attribute(lang_get('select_option')) . '</option>';
            }
        }
    }
    foreach ($t_cat_arr as $t_category_row) {
        $t_category_id = (int) $t_category_row['id'];
        echo '<option value="' . $t_category_id . '"';
        check_selected($p_category_id, $t_category_id);
        echo '>' . string_attribute(category_full_name($t_category_id, $t_category_row['project_id'] != $t_project_id)) . '</option>';
    }
}
Пример #8
0
/**
 * Print column content for column category id
 *
 * @param BugData $p_bug bug object
 * @param int $p_columns_target see COLUMNS_TARGET_* in constant_inc.php
 * @return null
 * @access public
 */
function print_column_category_id($p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE)
{
    global $t_sort, $t_dir;
    # grab the project name
    $t_project_name = project_get_field($p_bug->project_id, 'name');
    echo '<td class="column-category">';
    # type project name if viewing 'all projects' or if issue is in a subproject
    if (ON == config_get('show_bug_project_links') && helper_get_current_project() != $p_bug->project_id) {
        echo '<small class="project">[';
        print_view_bug_sort_link(string_display_line($t_project_name), 'project_id', $t_sort, $t_dir, $p_columns_target);
        echo ']</small><br />';
    }
    echo string_display_line(category_full_name($p_bug->category_id, false));
    echo '</td>';
}
Пример #9
0
$t_show_versions = version_should_show_product_version($t_bug->project_id);
$t_show_product_version = $t_show_versions && in_array('product_version', $t_fields);
$t_show_product_build = $t_show_versions && in_array('product_build', $t_fields) && config_get('enable_product_build');
$t_show_fixed_in_version = $t_show_versions && in_array('fixed_in_version', $t_fields);
$t_show_target_version = $t_show_versions && in_array('target_version', $t_fields) && access_has_bug_level(config_get('roadmap_view_threshold'), $f_bug_id);
$t_show_summary = in_array('summary', $t_fields);
$t_show_description = in_array('description', $t_fields);
$t_show_steps_to_reproduce = in_array('steps_to_reproduce', $t_fields);
$t_show_additional_information = in_array('additional_info', $t_fields);
$t_show_tags = in_array('tags', $t_fields);
$t_show_attachments = in_array('attachments', $t_fields);
$t_show_history = access_has_bug_level(config_get('view_history_threshold'), $f_bug_id);
$t_window_title = string_display_line(config_get('window_title'));
$t_project_name = $t_show_project ? string_display_line(project_get_name($t_bug->project_id)) : '';
$t_formatted_bug_id = $t_show_id ? bug_format_id($f_bug_id) : '';
$t_category_name = $t_show_category ? string_display_line(category_full_name($t_bug->category_id)) : '';
$t_severity = string_display_line(get_enum_element('severity', $t_bug->severity));
$t_reproducibility = string_display_line(get_enum_element('reproducibility', $t_bug->reproducibility));
$t_date_submitted = $t_show_date_submitted ? string_display_line(date(config_get('normal_date_format'), $t_bug->date_submitted)) : '';
$t_last_updated = $t_show_last_updated ? string_display_line(date(config_get('normal_date_format'), $t_bug->last_updated)) : '';
$t_platform = string_display_line($t_bug->platform);
$t_os = string_display_line($t_bug->os);
$t_os_version = string_display_line($t_bug->os_build);
$t_is = string_display_line($t_bug->os);
$t_status = string_display_line(get_enum_element('status', $t_bug->status));
$t_priority = string_display_line(get_enum_element('priority', $t_bug->priority));
$t_resolution = string_display_line(get_enum_element('resolution', $t_bug->resolution));
$t_product_build = string_display_line($t_bug->build);
$t_projection = string_display_line(get_enum_element('projection', $t_bug->projection));
$t_eta = string_display_line(get_enum_element('eta', $t_bug->eta));
$t_summary = string_display_line_links(bug_format_summary($f_bug_id, SUMMARY_FIELD));
Пример #10
0
	</form><?php
	$t_categories = category_get_all_rows( $f_project_id );
	if ( count( $t_categories ) > 0 ) { ?>
	<table cellspacing="1" cellpadding="5" border="1">
		<tr class="row-category">
			<th><?php echo lang_get( 'category' ) ?></th>
			<th><?php echo lang_get( 'assign_to' ) ?></th>
			<th colspan="2" class="center"><?php echo lang_get( 'actions' ) ?></th>
		</tr><?php

		foreach ( $t_categories as $t_category ) {
			$t_id = $t_category['id'];
			$t_inherited = ( $t_category['project_id'] != $f_project_id );
		?>
		<tr <?php echo helper_alternate_class() ?>>
			<td><?php echo string_display( category_full_name( $t_id, /* showProject */ $t_inherited, $f_project_id ) )  ?></td>
			<td><?php echo prepare_user_name( $t_category['user_id'] ) ?></td>
			<td class="center">
				<?php if ( !$t_inherited ) {
					$t_id = urlencode( $t_id );
					$t_project_id = urlencode( $f_project_id );

					print_button( 'manage_proj_cat_edit_page.php?id=' . $t_id . '&project_id=' . $t_project_id, lang_get( 'edit_link' ) );
				} ?>
			</td>
			<td class="center">
				<?php if ( !$t_inherited ) {
					print_button( 'manage_proj_cat_delete.php?id=' . $t_id . '&project_id=' . $t_project_id, lang_get( 'delete_link' ) );
				} ?>
			</td>
		</tr><?php
Пример #11
0
    $t_id = $t_category['id'];
    $t_name = $t_category['name'];
    if (NO_USER != $t_category['user_id'] && user_exists($t_category['user_id'])) {
        $t_user_name = user_get_name($t_category['user_id']);
    } else {
        $t_user_name = '';
    }
    ?>
<!-- Repeated Info Row -->
		<tr <?php 
    echo helper_alternate_class();
    ?>
>
			<td>
				<?php 
    echo string_display(category_full_name($t_category['id'], false));
    ?>
			</td>
			<td>
				<?php 
    echo string_display_line($t_user_name);
    ?>
			</td>
			<td class="center">
				<?php 
    $t_id = urlencode($t_id);
    $t_project_id = urlencode(ALL_PROJECTS);
    print_button("manage_proj_cat_edit_page.php?id={$t_id}&project_id={$t_project_id}", lang_get('edit_link'));
    echo '&nbsp;';
    print_button("manage_proj_cat_delete.php?id={$t_id}&project_id={$t_project_id}", lang_get('delete_link'));
    ?>
Пример #12
0
<?php endif ?>
<?php if (isset($bugs[$status])) foreach ($bugs[$status] as $bug):
$sevcolor = $sevcolors[$bug->severity];
$rescolor = $rescolors[$bug->resolution];
?>

<div class="scrumblock">
<p class="priority"><?php print_status_icon($bug->priority) ?></p>
<p class="bugid"></p>
<p class="commits"><?php echo $source_count[$bug->id] ?></p>
<p class="category">
<?php if ($bug->project_id != $current_project) {
	$project_name = project_get_name($bug->project_id);
	echo "<span class=\"project\">{$project_name}</span> - ";
}
echo category_full_name($bug->category_id, false) ?>
</p>
<p class="summary"><?php echo print_bug_link($bug->id) ?>: <?php echo $bug->summary ?></p>
<p class="severity" style="background: <?php echo $sevcolor ?>" title="Severity: <?php echo get_enum_element("severity", $bug->severity) ?>"></p>
<p class="resolution" style="background: <?php echo $rescolor ?>" title="Resolution: <?php echo get_enum_element("resolution", $bug->resolution) ?>"></p>
<p class="handler"><?php echo $bug->handler_id > 0 ? user_get_name($bug->handler_id) : "" ?></p>
</div>

<?php endforeach ?>
<?php endif ?>
<?php endforeach ?>
</td>
<?php endforeach ?>

</tr>
</table>
Пример #13
0
	<?php 
    # -- Summary --
    ?>
	<td class="left" valign="top" width="100%">
		<span class="small">
		<?php 
    if (ON == config_get('show_bug_project_links') && helper_get_current_project() != $t_bug->project_id) {
        echo '[', string_display_line(project_get_name($t_bug->project_id)), '] ';
    }
    echo $t_summary;
    ?>
		<br />
		<?php 
    # type project name if viewing 'all projects' or bug is in subproject
    echo string_display_line(category_full_name($t_bug->category_id, true, $t_bug->project_id));
    if ($t_bug->last_updated > strtotime('-' . $t_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED] . ' hours')) {
        echo ' - <b>' . $t_last_updated . '</b>';
    } else {
        echo ' - ' . $t_last_updated;
    }
    ?>
		</span>
	</td>
</tr>
<?php 
    # -- end of Repeating bug row --
}
# -- ====================== end of BUG LIST ========================= --
?>
</table>
Пример #14
0
/**
 * Remove all categories associated with a project.
 * This will skip processing of categories that can't be deleted.
 * @param integer $p_project_id      A Project identifier.
 * @param integer $p_new_category_id New category id (to replace existing category).
 * @return boolean
 * @access public
 */
function category_remove_all($p_project_id, $p_new_category_id = 0)
{
    project_ensure_exists($p_project_id);
    if (0 != $p_new_category_id) {
        category_ensure_exists($p_new_category_id);
    }
    # cache category names
    category_get_all_rows($p_project_id);
    # get a list of affected categories
    db_param_push();
    $t_query = 'SELECT id FROM {category} WHERE project_id=' . db_param();
    $t_result = db_query($t_query, array($p_project_id));
    $t_category_ids = array();
    while ($t_row = db_fetch_array($t_result)) {
        # Don't add category to the list if it can't be deleted
        if (!category_can_remove($t_row['id'])) {
            continue;
        }
        $t_category_ids[] = $t_row['id'];
    }
    # Handle projects with no categories
    if (count($t_category_ids) < 1) {
        return true;
    }
    $t_category_ids = join(',', $t_category_ids);
    # update bug history entries
    $t_query = 'SELECT id, category_id FROM {bug} WHERE category_id IN ( ' . $t_category_ids . ' )';
    $t_result = db_query($t_query);
    while ($t_bug_row = db_fetch_array($t_result)) {
        history_log_event_direct($t_bug_row['id'], 'category', category_full_name($t_bug_row['category_id'], false), category_full_name($p_new_category_id, false));
    }
    # update bug data
    db_param_push();
    $t_query = 'UPDATE {bug} SET category_id=' . db_param() . ' WHERE category_id IN ( ' . $t_category_ids . ' )';
    db_query($t_query, array($p_new_category_id));
    # delete categories
    db_param_push();
    $t_query = 'DELETE FROM {category} WHERE project_id=' . db_param();
    db_query($t_query, array($p_project_id));
    return true;
}
Пример #15
0
 public function replacePlaceHolders($s_text, $i_bugId)
 {
     /*
      * @local string
      */
     $s_modifiedText = '';
     $s_modifiedText = str_replace("{bug_id}", $i_bugId, $s_text);
     $s_modifiedText = str_replace("{bug_summary}", bug_get_field($i_bugId, 'summary'), $s_modifiedText);
     $s_modifiedText = str_replace("{bug_description}", bug_get_text_field($i_bugId, 'description'), $s_modifiedText);
     $s_modifiedText = str_replace("{bug_category}", category_full_name(bug_get_field($i_bugId, 'category_id'), false), $s_modifiedText);
     $s_modifiedText = str_replace("{project_id}", bug_get_field($i_bugId, 'project_id'), $s_modifiedText);
     $s_modifiedText = str_replace("{project_name}", project_get_name(bug_get_field($i_bugId, 'project_id')), $s_modifiedText);
     $s_modifiedText = str_replace("{user_id}", current_user_get_field('id'), $s_modifiedText);
     $s_modifiedText = str_replace("{user_name}", current_user_get_field('username'), $s_modifiedText);
     # '@L@' is a special placeholder for a '+' since jquery's serialize function
     # replaces all spaces also with a '+'
     ############################################################################'
     $s_modifiedText = str_replace("@L@", "+", $s_modifiedText);
     return $s_modifiedText;
 }
Пример #16
0
 /**
  * Update a bug from the given data structure
  *  If the third parameter is true, also update the longer strings table
  * @param bool p_update_extended
  * @param bool p_bypass_email Default false, set to true to avoid generating emails (if sending elsewhere)
  * @return bool (always true)
  * @access public
  */
 function update($p_update_extended = false, $p_bypass_mail = false)
 {
     self::validate($p_update_extended);
     $c_bug_id = $this->id;
     if (is_blank($this->due_date)) {
         $this->due_date = date_get_null();
     }
     $t_old_data = bug_get($this->id, true);
     $t_bug_table = db_get_table('mantis_bug_table');
     # Update all fields
     # Ignore date_submitted and last_updated since they are pulled out
     #  as unix timestamps which could confuse the history log and they
     #  shouldn't get updated like this anyway.  If you really need to change
     #  them use bug_set_field()
     $query = "UPDATE {$t_bug_table}\n\t\t\t\t\tSET project_id=" . db_param() . ', reporter_id=' . db_param() . ",\n\t\t\t\t\t\thandler_id=" . db_param() . ', duplicate_id=' . db_param() . ",\n\t\t\t\t\t\tpriority=" . db_param() . ', severity=' . db_param() . ",\n\t\t\t\t\t\treproducibility=" . db_param() . ', status=' . db_param() . ",\n\t\t\t\t\t\tresolution=" . db_param() . ', projection=' . db_param() . ",\n\t\t\t\t\t\tcategory_id=" . db_param() . ', eta=' . db_param() . ",\n\t\t\t\t\t\tos=" . db_param() . ', os_build=' . db_param() . ",\n\t\t\t\t\t\tplatform=" . db_param() . ', version=' . db_param() . ",\n\t\t\t\t\t\tbuild=" . db_param() . ', fixed_in_version=' . db_param() . ',';
     $t_fields = array($this->project_id, $this->reporter_id, $this->handler_id, $this->duplicate_id, $this->priority, $this->severity, $this->reproducibility, $this->status, $this->resolution, $this->projection, $this->category_id, $this->eta, $this->os, $this->os_build, $this->platform, $this->version, $this->build, $this->fixed_in_version);
     $t_roadmap_updated = false;
     if (access_has_project_level(config_get('roadmap_update_threshold'))) {
         $query .= "\n\t\t\t\t\t\ttarget_version=" . db_param() . ",";
         $t_fields[] = $this->target_version;
         $t_roadmap_updated = true;
     }
     $query .= "\n\t\t\t\t\t\tview_state=" . db_param() . ",\n\t\t\t\t\t\tsummary=" . db_param() . ",\n\t\t\t\t\t\tsponsorship_total=" . db_param() . ",\n\t\t\t\t\t\tsticky=" . db_param() . ",\n\t\t\t\t\t\tdue_date=" . db_param() . "\n\t\t\t\t\tWHERE id=" . db_param();
     $t_fields[] = $this->view_state;
     $t_fields[] = $this->summary;
     $t_fields[] = $this->sponsorship_total;
     $t_fields[] = (bool) $this->sticky;
     $t_fields[] = $this->due_date;
     $t_fields[] = $this->id;
     db_query_bound($query, $t_fields);
     bug_clear_cache($this->id);
     # log changes
     history_log_event_direct($c_bug_id, 'project_id', $t_old_data->project_id, $this->project_id);
     history_log_event_direct($c_bug_id, 'reporter_id', $t_old_data->reporter_id, $this->reporter_id);
     history_log_event_direct($c_bug_id, 'handler_id', $t_old_data->handler_id, $this->handler_id);
     history_log_event_direct($c_bug_id, 'priority', $t_old_data->priority, $this->priority);
     history_log_event_direct($c_bug_id, 'severity', $t_old_data->severity, $this->severity);
     history_log_event_direct($c_bug_id, 'reproducibility', $t_old_data->reproducibility, $this->reproducibility);
     history_log_event_direct($c_bug_id, 'status', $t_old_data->status, $this->status);
     history_log_event_direct($c_bug_id, 'resolution', $t_old_data->resolution, $this->resolution);
     history_log_event_direct($c_bug_id, 'projection', $t_old_data->projection, $this->projection);
     history_log_event_direct($c_bug_id, 'category', category_full_name($t_old_data->category_id, false), category_full_name($this->category_id, false));
     history_log_event_direct($c_bug_id, 'eta', $t_old_data->eta, $this->eta);
     history_log_event_direct($c_bug_id, 'os', $t_old_data->os, $this->os);
     history_log_event_direct($c_bug_id, 'os_build', $t_old_data->os_build, $this->os_build);
     history_log_event_direct($c_bug_id, 'platform', $t_old_data->platform, $this->platform);
     history_log_event_direct($c_bug_id, 'version', $t_old_data->version, $this->version);
     history_log_event_direct($c_bug_id, 'build', $t_old_data->build, $this->build);
     history_log_event_direct($c_bug_id, 'fixed_in_version', $t_old_data->fixed_in_version, $this->fixed_in_version);
     if ($t_roadmap_updated) {
         history_log_event_direct($c_bug_id, 'target_version', $t_old_data->target_version, $this->target_version);
     }
     history_log_event_direct($c_bug_id, 'view_state', $t_old_data->view_state, $this->view_state);
     history_log_event_direct($c_bug_id, 'summary', $t_old_data->summary, $this->summary);
     history_log_event_direct($c_bug_id, 'sponsorship_total', $t_old_data->sponsorship_total, $this->sponsorship_total);
     history_log_event_direct($c_bug_id, 'sticky', $t_old_data->sticky, $this->sticky);
     history_log_event_direct($c_bug_id, 'due_date', $t_old_data->due_date != date_get_null() ? $t_old_data->due_date : null, $this->due_date != date_get_null() ? $this->due_date : null);
     # Update extended info if requested
     if ($p_update_extended) {
         $t_bug_text_table = db_get_table('mantis_bug_text_table');
         $t_bug_text_id = bug_get_field($c_bug_id, 'bug_text_id');
         $query = "UPDATE {$t_bug_text_table}\n\t\t\t\t\t\t\tSET description=" . db_param() . ",\n\t\t\t\t\t\t\t\tsteps_to_reproduce=" . db_param() . ",\n\t\t\t\t\t\t\t\tadditional_information=" . db_param() . "\n\t\t\t\t\t\t\tWHERE id=" . db_param();
         db_query_bound($query, array($this->description, $this->steps_to_reproduce, $this->additional_information, $t_bug_text_id));
         bug_text_clear_cache($c_bug_id);
         $t_current_user = auth_get_current_user_id();
         if ($t_old_data->description != $this->description) {
             if (bug_revision_count($c_bug_id, REV_DESCRIPTION) < 1) {
                 $t_revision_id = bug_revision_add($c_bug_id, $t_old_data->reporter_id, REV_DESCRIPTION, $t_old_data->description, 0, $t_old_data->date_submitted);
             }
             $t_revision_id = bug_revision_add($c_bug_id, $t_current_user, REV_DESCRIPTION, $this->description);
             history_log_event_special($c_bug_id, DESCRIPTION_UPDATED, $t_revision_id);
         }
         if ($t_old_data->steps_to_reproduce != $this->steps_to_reproduce) {
             if (bug_revision_count($c_bug_id, REV_STEPS_TO_REPRODUCE) < 1) {
                 $t_revision_id = bug_revision_add($c_bug_id, $t_old_data->reporter_id, REV_STEPS_TO_REPRODUCE, $t_old_data->steps_to_reproduce, 0, $t_old_data->date_submitted);
             }
             $t_revision_id = bug_revision_add($c_bug_id, $t_current_user, REV_STEPS_TO_REPRODUCE, $this->steps_to_reproduce);
             history_log_event_special($c_bug_id, STEP_TO_REPRODUCE_UPDATED, $t_revision_id);
         }
         if ($t_old_data->additional_information != $this->additional_information) {
             if (bug_revision_count($c_bug_id, REV_ADDITIONAL_INFO) < 1) {
                 $t_revision_id = bug_revision_add($c_bug_id, $t_old_data->reporter_id, REV_ADDITIONAL_INFO, $t_old_data->additional_information, 0, $t_old_data->date_submitted);
             }
             $t_revision_id = bug_revision_add($c_bug_id, $t_current_user, REV_ADDITIONAL_INFO, $this->additional_information);
             history_log_event_special($c_bug_id, ADDITIONAL_INFO_UPDATED, $t_revision_id);
         }
     }
     # Update the last update date
     bug_update_date($c_bug_id);
     # allow bypass if user is sending mail separately
     if (false == $p_bypass_mail) {
         # bug assigned
         if ($t_old_data->handler_id != $this->handler_id) {
             email_generic($c_bug_id, 'owner', 'email_notification_title_for_action_bug_assigned');
             return true;
         }
         # status changed
         if ($t_old_data->status != $this->status) {
             $t_status = MantisEnum::getLabel(config_get('status_enum_string'), $this->status);
             $t_status = str_replace(' ', '_', $t_status);
             email_generic($c_bug_id, $t_status, 'email_notification_title_for_status_bug_' . $t_status);
             return true;
         }
         # @todo handle priority change if it requires special handling
         # generic update notification
         email_generic($c_bug_id, 'updated', 'email_notification_title_for_action_bug_updated');
     }
     return true;
 }
Пример #17
0
/**
 * return the category
 * @param object $p_bug the bug
 * @return string formatted category string
 * @access public
 */
function csv_format_category_id($p_bug)
{
    return csv_escape_string(category_full_name($p_bug->category_id, false));
}
 * @package MantisBT
 * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
 * @copyright Copyright (C) 2002 - 2012  MantisBT Team - mantisbt-dev@lists.sourceforge.net
 * @link http://www.mantisbt.org
 */
/**
 * MantisBT Core API's
 */
require_once 'core.php';
require_once 'category_api.php';
form_security_validate('manage_proj_cat_delete');
auth_reauthenticate();
$f_category_id = gpc_get_int('id');
$f_project_id = gpc_get_int('project_id');
$t_row = category_get_row($f_category_id);
$t_name = category_full_name($f_category_id);
$t_project_id = $t_row['project_id'];
access_ensure_project_level(config_get('manage_project_threshold'), $t_project_id);
# Get a bug count
$t_bug_table = db_get_table('mantis_bug_table');
$t_query = "SELECT COUNT(id) FROM {$t_bug_table} WHERE category_id=" . db_param();
$t_bug_count = db_result(db_query_bound($t_query, array($f_category_id)));
# Confirm with the user
helper_ensure_confirmed(sprintf(lang_get('category_delete_sure_msg'), string_display_line($t_name), $t_bug_count), lang_get('delete_category_button'));
category_remove($f_category_id);
form_security_purge('manage_proj_cat_delete');
if ($f_project_id == ALL_PROJECTS) {
    $t_redirect_url = 'manage_proj_page.php';
} else {
    $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id;
}
Пример #19
0
 function format_value($bug, $field_name)
 {
     $values = array('id' => function ($bug) {
         return sprintf('%s <%s>', $bug->id, string_get_bug_view_url_with_fqdn($bug->id));
     }, 'project_id' => function ($bug) {
         return project_get_name($bug->project_id);
     }, 'reporter_id' => function ($bug) {
         return '@' . user_get_name($bug->reporter_id);
     }, 'handler_id' => function ($bug) {
         return empty($bug->handler_id) ? plugin_lang_get('no_user') : '@' . user_get_name($bug->handler_id);
     }, 'duplicate_id' => function ($bug) {
         return sprintf('%s <%s>', $bug->duplicate_id, string_get_bug_view_url_with_fqdn($bug->duplicate_id));
     }, 'priority' => function ($bug) {
         return get_enum_element('priority', $bug->priority);
     }, 'severity' => function ($bug) {
         return get_enum_element('severity', $bug->severity);
     }, 'reproducibility' => function ($bug) {
         return get_enum_element('reproducibility', $bug->reproducibility);
     }, 'status' => function ($bug) {
         return get_enum_element('status', $bug->status);
     }, 'resolution' => function ($bug) {
         return get_enum_element('resolution', $bug->resolution);
     }, 'projection' => function ($bug) {
         return get_enum_element('projection', $bug->projection);
     }, 'category_id' => function ($bug) {
         return category_full_name($bug->category_id, false);
     }, 'eta' => function ($bug) {
         return get_enum_element('eta', $bug->eta);
     }, 'view_state' => function ($bug) {
         return $bug->view_state == VS_PRIVATE ? lang_get('private') : lang_get('public');
     }, 'sponsorship_total' => function ($bug) {
         return sponsorship_format_amount($bug->sponsorship_total);
     }, 'os' => function ($bug) {
         return $bug->os;
     }, 'os_build' => function ($bug) {
         return $bug->os_build;
     }, 'platform' => function ($bug) {
         return $bug->platform;
     }, 'version' => function ($bug) {
         return $bug->version;
     }, 'fixed_in_version' => function ($bug) {
         return $bug->fixed_in_version;
     }, 'target_version' => function ($bug) {
         return $bug->target_version;
     }, 'build' => function ($bug) {
         return $bug->build;
     }, 'summary' => function ($bug) {
         return HipChatPlugin::clean_summary(bug_format_summary($bug->id, SUMMARY_FIELD));
     }, 'last_updated' => function ($bug) {
         return date(config_get('short_date_format'), $bug->last_updated);
     }, 'date_submitted' => function ($bug) {
         return date(config_get('short_date_format'), $bug->date_submitted);
     }, 'due_date' => function ($bug) {
         return date(config_get('short_date_format'), $bug->due_date);
     }, 'description' => function ($bug) {
         return string_display_links($bug->description);
     }, 'steps_to_reproduce' => function ($bug) {
         return string_display_links($bug->steps_to_reproduce);
     }, 'additional_information' => function ($bug) {
         return string_display_links($bug->additional_information);
     });
     // Discover custom fields.
     $t_related_custom_field_ids = custom_field_get_linked_ids($bug->project_id);
     foreach ($t_related_custom_field_ids as $t_id) {
         $t_def = custom_field_get_definition($t_id);
         $values['custom_' . $t_def['name']] = function ($bug) use($t_id) {
             return custom_field_get_value($t_id, $bug->id);
         };
     }
     if (isset($values[$field_name])) {
         $func = $values[$field_name];
         return $func($bug);
     } else {
         return sprintf(plugin_lang_get('unknown_field'), $field_name);
     }
 }
Пример #20
0
    }
    $t_custom_filter = filter_deserialize($t_custom_filter);
}
$t_issues = filter_get_bug_rows($t_page_number, $t_issues_per_page, $t_page_count, $t_issues_count, $t_custom_filter, $t_project_id, $t_user_id, $t_show_sticky);
$t_issues_count = count($t_issues);
# Loop through results
for ($i = 0; $i < $t_issues_count; $i++) {
    $t_bug = $t_issues[$i];
    $about = $link = $t_path . "view.php?id=" . $t_bug->id;
    $title = bug_format_id($t_bug->id) . ': ' . $t_bug->summary;
    if ($t_bug->view_state == VS_PRIVATE) {
        $title .= ' [' . lang_get('private') . ']';
    }
    $description = string_rss_links($t_bug->description);
    # subject is category.
    $subject = category_full_name($t_bug->category_id, false);
    # optional DC value
    $date = $t_bug->last_updated;
    # author of item
    $author = '';
    if (access_has_global_level(config_get('show_user_email_threshold'))) {
        $t_author_name = user_get_name($t_bug->reporter_id);
        $t_author_email = user_get_field($t_bug->reporter_id, 'email');
        if (!is_blank($t_author_email)) {
            if (!is_blank($t_author_name)) {
                $author = $t_author_name . ' <' . $t_author_email . '>';
            } else {
                $author = $t_author_email;
            }
        }
    }
    if ($j % 50 == 0) {
        # to save ram as report will list data once, clear cache after 50 bugs
        bug_text_clear_cache();
        bug_clear_cache();
        bugnote_clear_cache();
    }
    # display the available and selected bugs
    if (in_array($t_id, $f_bug_arr) || !$f_show_flag) {
        if ($t_count_exported > 0) {
            echo '<br style="mso-special-character: line-break; page-break-before: always" />';
        }
        $t_count_exported++;
        $t_last_updated = date($g_short_date_format, $t_bug->last_updated);
        # grab the project name
        $t_project_name = project_get_field($t_bug->project_id, 'name');
        $t_category_name = category_full_name($t_bug->category_id, false);
        ?>
<br />
<table class="width100" cellspacing="1">
<tr>
	<td class="form-title" colspan="3">
		<?php 
        echo $t_lang_bug_view_title;
        ?>
	</td>
</tr>
<tr>
	<td class="print-spacer" colspan="6">
		<hr />
	</td>
</tr>
Пример #22
0
    }
    $t_name = $t_category['name'];
    if (NO_USER != $t_category['user_id'] && user_exists($t_category['user_id'])) {
        $t_user_name = user_get_name($t_category['user_id']);
    } else {
        $t_user_name = '';
    }
    ?>
<!-- Repeated Info Row -->
		<tr <?php 
    echo helper_alternate_class();
    ?>
>
			<td>
				<?php 
    echo string_display(category_full_name($t_category['id'], $t_inherited, $f_project_id));
    ?>
			</td>
			<td>
				<?php 
    echo string_display_line($t_user_name);
    ?>
			</td>
			<td class="center">
				<?php 
    if (!$t_inherited) {
        $t_id = urlencode($t_id);
        $t_project_id = urlencode($f_project_id);
        print_button('manage_proj_cat_edit_page.php?id=' . $t_id . '&project_id=' . $t_project_id, lang_get('edit_link'));
        echo '&nbsp;';
        print_button('manage_proj_cat_delete.php?id=' . $t_id . '&project_id=' . $t_project_id, lang_get('delete_link'));
Пример #23
0
	<?php 
    # -- Summary --
    ?>
	<td class="left my-buglist-description">
		<?php 
    if (ON == config_get('show_bug_project_links') && helper_get_current_project() != $t_bug->project_id) {
        echo '<span class="small project">[', string_display_line(project_get_name($t_bug->project_id)), '] </span>';
    }
    $t_bug_url = string_get_bug_view_url($t_bug->id, null);
    $t_bug_url_title = string_html_specialchars(sprintf(lang_get('label'), lang_get('issue_id') . $t_bug->id) . lang_get('word_separator') . $t_bug->summary);
    echo "<span class=\"small summary\"><a href=\"{$t_bug_url}\" title=\"{$t_bug_url_title}\">{$t_summary}</a></span><br />";
    ?>
		<?php 
    # type project name if viewing 'all projects' or bug is in subproject
    echo '<span class="small category">', string_display_line(category_full_name($t_bug->category_id, true, $t_bug->project_id)), '</span>';
    echo '<span class="small last-modified"> - ';
    if ($t_bug->last_updated > strtotime('-' . $t_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED] . ' hours')) {
        echo '<strong>' . $t_last_updated . '</strong>';
    } else {
        echo $t_last_updated;
    }
    echo '</span>';
    ?>
	</td>
</tr>
<?php 
    # -- end of Repeating bug row --
}
# -- ====================== end of BUG LIST ========================= --
?>
Пример #24
0
function print_category_option_list($p_category_id = 0, $p_project_id = null)
{
    $t_category_table = db_get_table('category');
    $t_project_table = db_get_table('project');
    if (null === $p_project_id) {
        $t_project_id = helper_get_current_project();
    } else {
        $t_project_id = $p_project_id;
    }
    if (config_get('allow_no_category')) {
        echo "<option value=\"0\"", check_selected($p_category_id, 0), '>';
        echo category_full_name(0, false), '</option>';
    } else {
        if (0 == $p_category_id) {
            echo "<option value=\"0\"", check_selected($p_category_id, 0), '>';
            echo string_attribute(lang_get('select_option')), '</option>';
        }
    }
    $cat_arr = category_get_all_rows($t_project_id, null, true);
    foreach ($cat_arr as $t_category_row) {
        $t_category_id = (int) $t_category_row['id'];
        echo "<option value=\"{$t_category_id}\"";
        check_selected($p_category_id, $t_category_id);
        echo '>' . string_attribute(category_full_name($t_category_id, $t_category_row['project_id'] != $t_project_id)) . '</option>';
    }
}
/**
 * Gen update catgegory bug message.
 */
function gen_up_category_bug_msg($user_id, $bug_id, $bugnote_text)
{
    $send_msg = plugin_lang_get('msg_call') . ' ' . get_username($user_id) . '! ' . plugin_lang_get('msg_action_bug_up_category') . "\n" . plugin_lang_get('msg_bug_id') . ' ' . bug_format_id($bug_id, 'category_id') . "\n" . plugin_lang_get('msg_state') . ' ' . get_enum_element('status', bug_get_field($bug_id, 'status')) . "\n" . plugin_lang_get('msg_proj_id') . ' ' . project_get_name(bug_get_field($bug_id, 'project_id')) . "\n" . plugin_lang_get('msg_header') . ' ' . bug_get_field($bug_id, 'summary') . "\n" . plugin_lang_get('separator') . "\n" . plugin_lang_get('msg_action_bug_up_category_str') . ' ' . category_full_name(gpc_get_int('category')) . "\n" . plugin_lang_get('msg_initiator') . ' ' . get_auth_username() . "\n" . plugin_lang_get('separator') . "\n" . plugin_lang_get('msg_link_bug') . ' ' . get_bug_link($bug_id);
    return $send_msg;
}
Пример #26
0
    }
    ?>
		</tr>
<?php 
}
foreach ($t_categories as $t_category) {
    $t_id = $t_category['id'];
    ?>
<!-- Repeated Info Row -->
		<tr <?php 
    echo helper_alternate_class();
    ?>
>
			<td>
				<?php 
    echo string_display(category_full_name($t_id, false));
    ?>
			</td>
			<td>
				<?php 
    echo prepare_user_name($t_category['user_id']);
    ?>
			</td>
<?php 
    if ($t_can_update_global_cat) {
        ?>
			<td class="center">
				<?php 
        $t_id = urlencode($t_id);
        $t_project_id = urlencode(ALL_PROJECTS);
        print_button("manage_proj_cat_edit_page.php?id={$t_id}&project_id={$t_project_id}", lang_get('edit_link'));
Пример #27
0
        ?>
 kanbanColumn kanbanColumn<?php 
        echo $column['status'][0];
        ?>
"><?php 
        echo '<h2 style="background-color:' . $column['color'] . '">' . $title . ' (' . $t_bug_count . ')';
        if ($column['wip_limit'] > 0) {
            echo " Limit: " . $column['wip_limit'];
        }
        echo ' </h2>';
        if (!empty($rows)) {
            $i = 0;
            foreach ($rows as $row) {
                if ($i < 150) {
                    $t_bug = $row;
                    echo '<div data-userid="' . $t_current_user_id . '"  data-ticketid="' . $t_bug->id . '" data-projectid="' . $t_bug->project_id . '" class="card ' . ($i % 2 == 1 ? 'cardOdd' : 'cardEven') . ' card' . category_full_name($t_bug->category_id, false) . '">';
                    echo icon_get_status_icon($t_bug->priority);
                    echo '	<a href="' . string_get_bug_view_url($t_bug->id) . '" class="bugLink">' . string_display_line_links($t_bug->summary) . '</a>';
                    echo '	<a href="' . string_get_bug_view_url($t_bug->id) . '" class="bugLink right"> #' . $t_bug->id . '</a>';
                    $priority = get_enum_element('priority', $t_bug->priority);
                    /*
                                    echo '<div class="info">';
                    echo '<img src="images/plus.png" alt="'.$bug_desc_title.'" title="'.$bug_desc_title.'" border="0"/>';
                    echo bug_get_text_field($t_bug->id, 'description');
                    echo string_display_line_links( $t_bug->summary );
                                    echo project_get_name( $t_bug->project_id );
                                    if( !bug_is_readonly( $t_bug->id ) && access_has_bug_level( $t_update_bug_threshold, $t_bug->id ) ) {
                                        echo '<a href="' . string_get_bug_update_url( $t_bug->id ) . '"><img border="0" src="plugins/MantisKanban/files/pencil.png' . '" alt="' . lang_get( 'update_bug_button' ) . '" /></a>';
                            echo '<br>' . kanban_ajax_button_bug_change_status( $t_bug->id, $t_bug->project_id, $t_current_user_id );
                                    }