/**
 * Log a checkin event on the issue
 *
 * @param string $p_username  The name of the user trying to access the issue.
 * @param string $p_password  The password of the user.
 * @param integer $p_issue_id The id of the issue to log a checkin.
 * @param string $p_comment   The comment to add
 * @param boolean $p_fixed    True if the issue is to be set to fixed
 * @return boolean  true success, false otherwise.
 */
function mc_issue_checkin($p_username, $p_password, $p_issue_id, $p_comment, $p_fixed)
{
    global $g_project_override;
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return mci_soap_fault_login_failed();
    }
    if (!bug_exists($p_issue_id)) {
        return SoapObjectsFactory::newSoapFault('Client', "Issue '{$p_issue_id}' not found.");
    }
    $t_project_id = bug_get_field($p_issue_id, 'project_id');
    $g_project_override = $t_project_id;
    if (!mci_has_readwrite_access($t_user_id, $t_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    helper_call_custom_function('checkin', array($p_issue_id, $p_comment, '', '', $p_fixed));
    return true;
}
Esempio n. 2
0
html_page_top2a();
echo "<br />";
?>
<br />
<div align="center">
<form name="lost_password_form" method="post" action="lost_pwd.php">
<table class="width50" cellspacing="1">
<tr>
	<td class="form-title" colspan="2">
		<?php 
echo lang_get('lost_password_title');
?>
	</td>
</tr>
<?php 
$t_allow_passwd = helper_call_custom_function('auth_can_change_password', array());
if ($t_allow_passwd) {
    ?>
<tr class="row-1">
	<td class="category" width="25%">
		<?php 
    echo lang_get('username');
    ?>
	</td>
	<td width="75%">
		<input type="text" name="username" size="32" maxlength="32" />
	</td>
</tr>
<tr class="row-2">
	<td class="category" width="25%">
		<?php 
Esempio n. 3
0
$f_captcha = gpc_get_string('captcha', '');
$f_username = trim($f_username);
$f_email = email_append_domain(trim($f_email));
$f_captcha = utf8_strtolower(trim($f_captcha));
# Retrieve captcha key now, as session might get cleared by logout
$t_form_key = session_get_int(CAPTCHA_KEY, null);
# force logout on the current user if already authenticated
if (auth_is_user_authenticated()) {
    auth_logout();
}
# Check to see if signup is allowed
if (OFF == config_get_global('allow_signup')) {
    print_header_redirect('login_page.php');
    exit;
}
if (ON == config_get('signup_use_captcha') && get_gd_version() > 0 && helper_call_custom_function('auth_can_change_password', array())) {
    # captcha image requires GD library and related option to ON
    $t_key = utf8_strtolower(utf8_substr(md5(config_get('password_confirm_hash_magic_string') . $t_form_key), 1, 5));
    if ($t_key != $f_captcha) {
        trigger_error(ERROR_SIGNUP_NOT_MATCHING_CAPTCHA, ERROR);
    }
    # Clear captcha cache
    session_delete(CAPTCHA_IMG);
}
email_ensure_not_disposable($f_email);
# notify the selected group a new user has signed-up
if (user_signup($f_username, $f_email)) {
    email_notify_new_account($f_username, $f_email);
}
form_security_purge('signup');
html_page_top1();
Esempio n. 4
0
<?php

# Mantis - a php based bugtracking system
# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
# Copyright (C) 2002 - 2004  Mantis Team   - mantisbt-dev@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
# --------------------------------------------------------
# $Id: bug_delete.php,v 1.40 2005/07/25 16:34:10 thraxisp Exp $
# --------------------------------------------------------
# Deletes the bug and re-directs to view_all_bug_page.php
require_once 'core.php';
$t_core_path = config_get('core_path');
require_once $t_core_path . 'bug_api.php';
$f_bug_id = gpc_get_int('bug_id');
access_ensure_bug_level(config_get('delete_bug_threshold'), $f_bug_id);
$t_bug = bug_get($f_bug_id, true);
if ($t_bug->project_id != helper_get_current_project()) {
    # in case the current project is not the same project of the bug we are viewing...
    # ... override the current project. This to avoid problems with categories and handlers lists etc.
    $g_project_override = $t_bug->project_id;
}
helper_ensure_confirmed(lang_get('delete_bug_sure_msg'), lang_get('delete_bug_button'));
$t_bug = bug_get($f_bug_id, true);
helper_call_custom_function('issue_delete_validate', array($f_bug_id));
bug_delete($f_bug_id);
helper_call_custom_function('issue_delete_notify', array($f_bug_id));
print_successful_redirect('view_all_bug_page.php');
Esempio n. 5
0
?>
		<input type="submit" class="button" value="<?php 
echo lang_get('update_user_button');
?>
" />
	</td>
</tr>
</table>
</form>
</div>

<br />

<!-- RESET AND DELETE -->
<?php 
$t_reset = $t_user['id'] != auth_get_current_user_id() && helper_call_custom_function('auth_can_change_password', array());
$t_unlock = OFF != config_get('max_failed_login_count') && $t_user['failed_login_count'] > 0;
$t_delete = !(user_is_administrator($t_user_id) && user_count_level(config_get_global('admin_site_threshold')) <= 1);
if ($t_reset || $t_unlock || $t_delete) {
    ?>
<div class="border center">

<!-- Reset/Unlock Button -->
<?php 
    if ($t_reset || $t_unlock) {
        ?>
	<form method="post" action="manage_user_reset.php">
<?php 
        echo form_security_field('manage_user_reset');
        ?>
		<input type="hidden" name="user_id" value="<?php 
Esempio n. 6
0
/**
 *
 * @param int $p_columns_target
 * @param bool $p_viewable_only
 * @param int $p_user_id
 * @return array
 */
function helper_get_columns_to_view($p_columns_target = COLUMNS_TARGET_VIEW_PAGE, $p_viewable_only = true, $p_user_id = null)
{
    $t_columns = helper_call_custom_function('get_columns_to_view', array($p_columns_target, $p_user_id));
    if (!$p_viewable_only) {
        return $t_columns;
    }
    $t_keys_to_remove = array();
    if ($p_columns_target == COLUMNS_TARGET_CSV_PAGE || $p_columns_target == COLUMNS_TARGET_EXCEL_PAGE) {
        $t_keys_to_remove[] = 'selection';
        $t_keys_to_remove[] = 'edit';
        $t_keys_to_remove[] = 'bugnotes_count';
        $t_keys_to_remove[] = 'attachment_count';
        $t_keys_to_remove[] = 'overdue';
    }
    if ($p_columns_target == COLUMNS_TARGET_CSV_PAGE || $p_columns_target == COLUMNS_TARGET_EXCEL_PAGE) {
        $t_keys_to_remove[] = 'attachment_count';
    }
    $t_current_project_id = helper_get_current_project();
    if ($t_current_project_id != ALL_PROJECTS && !access_has_project_level(config_get('view_handler_threshold'), $t_current_project_id)) {
        $t_keys_to_remove[] = 'handler_id';
    }
    if ($t_current_project_id != ALL_PROJECTS && !access_has_project_level(config_get('roadmap_view_threshold'), $t_current_project_id)) {
        $t_keys_to_remove[] = 'target_version';
    }
    foreach ($t_keys_to_remove as $t_key_to_remove) {
        $t_keys = array_keys($t_columns, $t_key_to_remove);
        foreach ($t_keys as $t_key) {
            unset($t_columns[$t_key]);
        }
    }
    # get the array values to remove gaps in the array which causes issue
    # if the array is accessed using an index.
    return array_values($t_columns);
}
Esempio n. 7
0
	<!-- Headings -->
	<tr>
		<td class="form-title">
			<?php 
echo lang_get('edit_account_title');
?>
		</td>
		<td class="right">
			<?php 
print_account_menu('account_page.php');
?>
		</td>
	</tr>

<?php 
if (!helper_call_custom_function('auth_can_change_password', array())) {
    ?>
 <!-- With LDAP -->

	<!-- Username -->
	<tr <?php 
    echo helper_alternate_class();
    ?>
>
		<td class="category" width="25%">
			<?php 
    echo lang_get('username');
    ?>
		</td>
		<td width="75%">
			<?php 
Esempio n. 8
0
        for ($i = 0; $i < $t_count; ++$i) {
            $t_fixed_issues[] = $t_matches[1][$i];
        }
    }
}
# If no issues found, then no work to do.
if (count($t_issues) == 0 && count($t_fixed_issues) == 0) {
    echo "Comment does not reference any issues.\n";
    exit(0);
}
# Login as source control user
if (!auth_attempt_script_login($t_username)) {
    echo "Unable to login\n";
    exit(1);
}
# history parameters are reserved for future use.
$t_history_old_value = '';
$t_history_new_value = '';
# add note to each bug only once
$t_issues = array_unique($t_issues);
$t_fixed_issues = array_unique($t_fixed_issues);
# Call the custom function to register the checkin on each issue.
foreach ($t_issues as $t_issue_id) {
    if (!in_array($t_issue_id, $t_fixed_issues)) {
        helper_call_custom_function('checkin', array($t_issue_id, $t_comment, $t_history_old_value, $t_history_new_value, false));
    }
}
foreach ($t_fixed_issues as $t_issue_id) {
    helper_call_custom_function('checkin', array($t_issue_id, $t_comment, $t_history_old_value, $t_history_new_value, true));
}
exit(0);
		<?php 
}
# @@@ thraxisp - could this be replaced by a call to filter_draw_selection_area2
$t_filter = current_user_get_bug_filter();
$t_filter = filter_ensure_valid_filter($t_filter);
$t_project_id = helper_get_current_project();
$t_current_user_access_level = current_user_get_access_level();
$t_accessible_custom_fields_ids = array();
$t_accessible_custom_fields_names = array();
$t_accessible_custom_fields_type = array();
$t_accessible_custom_fields_values = array();
$t_filter_cols = config_get('filter_custom_fields_per_row');
$t_custom_cols = 1;
$t_custom_rows = 0;
#get valid target fields
$t_fields = helper_call_custom_function('get_columns_to_view', array());
$t_n_fields = count($t_fields);
for ($i = 0; $i < $t_n_fields; $i++) {
    if (in_array($t_fields[$i], array('selection', 'edit', 'bugnotes_count', 'attachment'))) {
        unset($t_fields[$i]);
    }
}
if (ON == config_get('filter_by_custom_fields')) {
    $t_custom_cols = $t_filter_cols;
    $t_custom_fields = custom_field_get_linked_ids($t_project_id);
    foreach ($t_custom_fields as $t_cfid) {
        $t_field_info = custom_field_cache_row($t_cfid, true);
        if ($t_field_info['access_level_r'] <= $t_current_user_access_level) {
            $t_accessible_custom_fields_ids[] = $t_cfid;
            $t_accessible_custom_fields_names[] = $t_field_info['name'];
            $t_accessible_custom_fields_types[] = $t_field_info['type'];
Esempio n. 10
0
        while ($t_row = db_fetch_array($t_result)) {
            # hide private bugs if user doesn't have access to view them.
            if (!$t_can_view_private && $t_row['view_state'] == VS_PRIVATE) {
                continue;
            }
            # check limit_Reporter (Issue #4770)
            # reporters can view just issues they reported
            if (ON === $t_limit_reporters && $t_user_access_level_is_reporter && !bug_is_user_reporter($t_result->fields['id'], $t_user_id)) {
                continue;
            }
            $t_issue_id = $t_row['id'];
            if (!helper_call_custom_function('changelog_include_issue', array($t_issue_id))) {
                continue;
            }
            # Print the header for the version with the first changelog entry to be added.
            if ($t_first_entry && !$t_version_header_printed) {
                if ($i > 0) {
                    echo '<br />';
                }
                print_version_header($t_version_id);
                $t_version_header_printed = true;
                $t_first_entry = false;
            }
            helper_call_custom_function('changelog_print_issue', array($t_issue_id));
        }
        $i++;
    }
    echo '</tt>';
    $t_project_index++;
}
html_page_bottom1(__FILE__);
Esempio n. 11
0
/**
 * Log a checkin event on the issue
 *
 * @param string $p_username  The name of the user trying to access the issue.
 * @param string $p_password  The password of the user.
 * @param integer $p_issue_id The id of the issue to log a checkin.
 * @param string $p_comment   The comment to add
 * @param boolean $p_fixed    True if the issue is to be set to fixed
 * @return boolean  true success, false otherwise.
 */
function mc_issue_checkin($p_username, $p_password, $p_issue_id, $p_comment, $p_fixed)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return new soap_fault('Client', '', 'Access Denied');
    }
    if (!bug_exists($p_issue_id)) {
        return new soap_fault('Client', '', "Issue '{$p_issue_id}' not found.");
    }
    $t_project_id = bug_get_field($p_issue_id, 'project_id');
    if (!mci_has_readwrite_access($t_user_id, $t_project_id)) {
        return new soap_fault('Client', '', 'Access Denied');
    }
    helper_call_custom_function('checkin', array($p_issue_id, $p_comment, '', '', $p_fixed));
    return true;
}
Esempio n. 12
0
/**
 * updates the status field
 * @return bool 
 * @access public
 * @see bug_update.php
 */
function kanban_ajax_request_bug_update_status()
{
    $p_bug_id = gpc_get_int('id');
    $p_new_status = gpc_get_int('new_status');
    $t_project_id = gpc_get_int('project_id');
    $c_bug_id = (int) $p_bug_id;
    $f_new_status = (int) $p_new_status;
    $t_bug_data = bug_get($c_bug_id, true);
    $f_update_mode = gpc_get_bool('update_mode', FALSE);
    # set if called from generic update page
    if (!(access_has_bug_level(access_get_status_threshold($f_new_status, $t_project_id), $c_bug_id) || access_has_bug_level(config_get('update_bug_threshold'), $c_bug_id) || bug_get_field($c_bug_id, 'reporter_id') == auth_get_current_user_id() && (ON == config_get('allow_reporter_reopen') || ON == config_get('allow_reporter_close')))) {
        access_denied();
    }
    # extract current extended information
    $t_old_bug_status = $t_bug_data->status;
    log_event(LOG_AJAX, "Old bug status {$t_old_bug_status} - trying update to new status {$f_new_status}...");
    $t_bug_data->reporter_id = gpc_get_int('reporter_id', $t_bug_data->reporter_id);
    $t_bug_data->handler_id = gpc_get_int('handler_id', $t_bug_data->handler_id);
    $t_bug_data->duplicate_id = gpc_get_int('duplicate_id', $t_bug_data->duplicate_id);
    $t_bug_data->priority = gpc_get_int('priority', $t_bug_data->priority);
    $t_bug_data->severity = gpc_get_int('severity', $t_bug_data->severity);
    $t_bug_data->reproducibility = gpc_get_int('reproducibility', $t_bug_data->reproducibility);
    $t_bug_data->status = gpc_get_int('new_status', $t_bug_data->status);
    $t_bug_data->resolution = gpc_get_int('resolution', $t_bug_data->resolution);
    $t_bug_data->projection = gpc_get_int('projection', $t_bug_data->projection);
    $t_bug_data->category_id = gpc_get_int('category_id', $t_bug_data->category_id);
    $t_bug_data->eta = gpc_get_int('eta', $t_bug_data->eta);
    $t_bug_data->os = gpc_get_string('os', $t_bug_data->os);
    $t_bug_data->os_build = gpc_get_string('os_build', $t_bug_data->os_build);
    $t_bug_data->platform = gpc_get_string('platform', $t_bug_data->platform);
    $t_bug_data->version = gpc_get_string('version', $t_bug_data->version);
    $t_bug_data->build = gpc_get_string('build', $t_bug_data->build);
    $t_bug_data->fixed_in_version = gpc_get_string('fixed_in_version', $t_bug_data->fixed_in_version);
    $t_bug_data->view_state = gpc_get_int('view_state', $t_bug_data->view_state);
    $t_bug_data->summary = gpc_get_string('summary', $t_bug_data->summary);
    $t_due_date = gpc_get_string('due_date', null);
    if (access_has_project_level(config_get('roadmap_update_threshold'), $t_bug_data->project_id)) {
        $t_bug_data->target_version = gpc_get_string('target_version', $t_bug_data->target_version);
    }
    if ($t_due_date !== null) {
        if (is_blank($t_due_date)) {
            $t_bug_data->due_date = 1;
        } else {
            $t_bug_data->due_date = strtotime($t_due_date);
        }
    }
    $t_bug_data->description = gpc_get_string('description', $t_bug_data->description);
    $t_bug_data->steps_to_reproduce = gpc_get_string('steps_to_reproduce', $t_bug_data->steps_to_reproduce);
    $t_bug_data->additional_information = gpc_get_string('additional_information', $t_bug_data->additional_information);
    $f_private = gpc_get_bool('private');
    $f_bugnote_text = gpc_get_string('bugnote_text', '');
    $f_time_tracking = gpc_get_string('time_tracking', '0:00');
    $f_close_now = gpc_get_string('close_now', false);
    # Handle auto-assigning
    if (config_get('bug_submit_status') == $t_bug_data->status && $t_bug_data->status == $t_old_bug_status && 0 != $t_bug_data->handler_id && ON == config_get('auto_set_status_to_assigned')) {
        $t_bug_data->status = config_get('bug_assigned_status');
    }
    helper_call_custom_function('issue_update_validate', array($c_bug_id, $t_bug_data, $f_bugnote_text));
    $t_resolved = config_get('bug_resolved_status_threshold');
    $t_closed = config_get('bug_closed_status_threshold');
    $t_custom_status_label = "update";
    # default info to check
    if ($t_bug_data->status == $t_resolved) {
        $t_custom_status_label = "resolved";
    }
    if ($t_bug_data->status == $t_closed) {
        $t_custom_status_label = "closed";
    }
    $t_related_custom_field_ids = custom_field_get_linked_ids($t_bug_data->project_id);
    foreach ($t_related_custom_field_ids as $t_id) {
        $t_def = custom_field_get_definition($t_id);
        # Only update the field if it would have been display for editing
        if (!(!$f_update_mode && $t_def['require_' . $t_custom_status_label] || !$f_update_mode && $t_def['display_' . $t_custom_status_label] && in_array($t_custom_status_label, array("resolved", "closed")) || $f_update_mode && $t_def['display_update'] || $f_update_mode && $t_def['require_update'])) {
            continue;
        }
        # Do not set custom field value if user has no write access.
        if (!custom_field_has_write_access($t_id, $c_bug_id)) {
            continue;
        }
        if ($t_def['require_' . $t_custom_status_label] && !gpc_isset_custom_field($t_id, $t_def['type'])) {
            error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
            trigger_error(ERROR_EMPTY_FIELD, ERROR);
        }
        # Only update the field if it is posted,
        #	or if it is empty, and the current value isn't the default
        if (!gpc_isset_custom_field($t_id, $t_def['type']) && custom_field_get_value($t_id, $c_bug_id) == $t_def['default_value']) {
            continue;
        }
        if (!custom_field_set_value($t_id, $c_bug_id, gpc_get_custom_field("custom_field_{$t_id}", $t_def['type'], NULL))) {
            error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
            log_event(LOG_AJAX, "Error setting new status: " . ERROR_CUSTOM_FIELD_INVALID_VALUE . "\nBugdata: " . print_r($t_bug_data, true) . " Line: " . __LINE__);
            trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR);
        }
    }
    $t_notify = true;
    $t_bug_note_set = false;
    if ($t_old_bug_status != $t_bug_data->status && FALSE == $f_update_mode) {
        # handle status transitions that come from pages other than bug_*update_page.php
        # this does the minimum to act on the bug and sends a specific message
        if ($t_bug_data->status >= $t_resolved && $t_bug_data->status < $t_closed && $t_old_bug_status < $t_resolved) {
            # bug_resolve updates the status, fixed_in_version, resolution, handler_id and bugnote and sends message
            bug_resolve($c_bug_id, $t_bug_data->resolution, $t_bug_data->fixed_in_version, $f_bugnote_text, $t_bug_data->duplicate_id, $t_bug_data->handler_id, $f_private, $f_time_tracking);
            $t_notify = false;
            $t_bug_note_set = true;
            if ($f_close_now) {
                bug_set_field($c_bug_id, 'status', $t_closed);
            }
            // update bug data with fields that may be updated inside bug_resolve(), otherwise changes will be overwritten
            // in bug_update() call below.
            $t_bug_data->handler_id = bug_get_field($c_bug_id, 'handler_id');
            $t_bug_data->status = bug_get_field($c_bug_id, 'status');
        } else {
            if ($t_bug_data->status >= $t_closed && $t_old_bug_status < $t_closed) {
                # bug_close updates the status and bugnote and sends message
                bug_close($c_bug_id, $f_bugnote_text, $f_private, $f_time_tracking);
                $t_notify = false;
                $t_bug_note_set = true;
            } else {
                if ($t_bug_data->status == config_get('bug_reopen_status') && $t_old_bug_status >= $t_resolved) {
                    bug_set_field($c_bug_id, 'handler_id', $t_bug_data->handler_id);
                    # fix: update handler_id before calling bug_reopen
                    # bug_reopen updates the status and bugnote and sends message
                    bug_reopen($c_bug_id, $f_bugnote_text, $f_time_tracking, $f_private);
                    $t_notify = false;
                    $t_bug_note_set = true;
                    // update bug data with fields that may be updated inside bug_resolve(), otherwise changes will be overwritten
                    // in bug_update() call below.
                    $t_bug_data->status = bug_get_field($c_bug_id, 'status');
                    $t_bug_data->resolution = bug_get_field($c_bug_id, 'resolution');
                }
            }
        }
    }
    # Plugin support
    $t_new_bug_data = event_signal('EVENT_UPDATE_BUG', $t_bug_data, $c_bug_id);
    if (!is_null($t_new_bug_data)) {
        $t_bug_data = $t_new_bug_data;
    }
    # Add a bugnote if there is one
    if (false == $t_bug_note_set) {
        bugnote_add($c_bug_id, $f_bugnote_text, $f_time_tracking, $f_private, 0, '', NULL, FALSE);
    }
    # Update the bug entry, notify if we haven't done so already
    $t_bug_data->update(true, false == $t_notify);
    helper_call_custom_function('issue_update_notify', array($c_bug_id));
    return true;
}
Esempio n. 13
0
function print_filter_show_sort()
{
    global $t_filter;
    # get all of the displayed fields for sort, then drop ones that
    #  are not appropriate and translate the rest
    $t_fields = helper_call_custom_function('get_columns_to_view', array());
    $t_n_fields = count($t_fields);
    $t_shown_fields[""] = "";
    for ($i = 0; $i < $t_n_fields; $i++) {
        if (!in_array($t_fields[$i], array('selection', 'edit', 'bugnotes_count', 'attachment'))) {
            if (strpos($t_fields[$i], 'custom_') === 0) {
                $t_field_name = string_display(lang_get_defaulted(substr($t_fields[$i], strlen('custom_'))));
            } else {
                $t_field_name = string_get_field_name($t_fields[$i]);
            }
            $t_shown_fields[$t_fields[$i]] = $t_field_name;
        }
    }
    $t_shown_dirs[""] = "";
    $t_shown_dirs["ASC"] = lang_get('bugnote_order_asc');
    $t_shown_dirs["DESC"] = lang_get('bugnote_order_desc');
    # get default values from filter structure
    $t_sort_fields = split(',', $t_filter['sort']);
    $t_dir_fields = split(',', $t_filter['dir']);
    if (!isset($t_sort_fields[1])) {
        $t_sort_fields[1] = '';
        $t_dir_fields[1] = '';
    }
    # if there are fields to display, show the dropdowns
    if (count($t_fields) > 0) {
        # display a primary and secondary sort fields
        echo '<select name="sort_0">';
        foreach ($t_shown_fields as $key => $val) {
            echo "<option value=\"{$key}\"";
            check_selected($key, $t_sort_fields[0]);
            echo ">{$val}</option>";
        }
        echo '</select>';
        echo '<select name="dir_0">';
        foreach ($t_shown_dirs as $key => $val) {
            echo "<option value=\"{$key}\"";
            check_selected($key, $t_dir_fields[0]);
            echo ">{$val}</option>";
        }
        echo '</select>';
        echo ', ';
        # for secondary sort
        echo '<select name="sort_1">';
        foreach ($t_shown_fields as $key => $val) {
            echo "<option value=\"{$key}\"";
            check_selected($key, $t_sort_fields[1]);
            echo ">{$val}</option>";
        }
        echo '</select>';
        echo '<select name="dir_1">';
        foreach ($t_shown_dirs as $key => $val) {
            echo "<option value=\"{$key}\"";
            check_selected($key, $t_dir_fields[1]);
            echo ">{$val}</option>";
        }
        echo '</select>';
    } else {
        echo lang_get_defaulted('last_updated') . lang_get('bugnote_order_desc');
        echo "<input type=\"hidden\" name=\"sort_1\" value=\"last_updated\" />";
        echo "<input type=\"hidden\" name=\"dir_1\" value=\"DESC\" />";
    }
}
Esempio n. 14
0
 function save_bug($p_project_id, $p_user_id)
 {
     require 'ProfileAcraExt.php';
     $t_project_id = $p_project_id;
     global $g_cache_current_user_id;
     $g_cache_current_user_id = $p_user_id;
     $t_bug_data = new BugData();
     $t_bug_data->project_id = $t_project_id;
     $t_bug_data->reporter_id = $p_user_id;
     $t_bug_data->build = gpc_get_string('APP_VERSION_CODE', '');
     $t_bug_data->platform = "Android";
     $t_bug_data->os = gpc_get_string('ANDROID_VERSION', '');
     //gpc_get_string( 'os', '' );
     $t_os_build = gpc_get_string('BUILD', '');
     if (preg_match('/DISPLAY\\s*=\\s*(.*)/', $t_os_build, $t_match)) {
         var_dump($t_match);
         $t_os_build = $t_match[1];
     } else {
         $t_os_build = gpc_get_string('ANDROID_VERSION', '');
     }
     $t_bug_data->os_build = $t_os_build;
     //gpc_get_string( 'os_build', '' );
     $t_bug_data->version = gpc_get_string('APP_VERSION_NAME', '');
     $t_bug_data->profile_id = profile_create_unique(ALL_USERS, $t_bug_data->platform, $t_bug_data->os, $t_bug_data->os_build, "");
     $t_bug_data->handler_id = gpc_get_int('handler_id', 0);
     $t_bug_data->view_state = gpc_get_int('view_state', config_get('default_bug_view_status', 'VS_PRIVATE', 'acra_reporter'));
     $t_bug_data->category_id = $this->get_category_id($p_project_id);
     //gpc_get_int( 'category_id', 0 );
     $t_bug_data->reproducibility = 10;
     //gpc_get_int( 'reproducibility', config_get( 'default_bug_reproducibility' ) );
     $t_bug_data->severity = CRASH;
     //gpc_get_int( 'severity', config_get( 'default_bug_severity' ) );
     $t_bug_data->priority = HIGH;
     //gpc_get_int( 'priority', config_get( 'default_bug_priority' ) );
     $t_bug_data->projection = gpc_get_int('projection', config_get('default_bug_projection'));
     $t_bug_data->eta = gpc_get_int('eta', config_get('default_bug_eta'));
     $t_bug_data->resolution = OPEN;
     //gpc_get_string('resolution', config_get( 'default_bug_resolution' ) );
     $t_bug_data->status = NEW_;
     //gpc_get_string( 'status', config_get( 'bug_submit_status' ) );
     $t_bug_data->description = gpc_get_string('STACK_TRACE');
     //gpc_get_string( 'description' );
     $t_bug_data->summary = get_bug_summary_by_version(gpc_get_string('APP_VERSION_NAME', ''), $t_bug_data->description, $t_project_id);
     $t_bug_data->steps_to_reproduce = gpc_get_string('LOGCAT', "");
     $t_bug_data->additional_information = gpc_get_string('CRASH_CONFIGURATION', "");
     $t_bug_data->due_date = gpc_get_string('USER_CRASH_DATE', '');
     if (is_blank($t_bug_data->due_date)) {
         $t_bug_data->due_date = date_get_null();
     }
     $f_files = gpc_get_file('ufile', null);
     /** @todo (thraxisp) Note that this always returns a structure */
     $f_report_stay = gpc_get_bool('report_stay', false);
     $f_copy_notes_from_parent = gpc_get_bool('copy_notes_from_parent', false);
     helper_call_custom_function('issue_create_validate', array($t_bug_data));
     # Validate the custom fields before adding the bug.
     $t_related_custom_field_ids = custom_field_get_linked_ids($t_bug_data->project_id);
     foreach ($t_related_custom_field_ids as $t_id) {
         $t_def = custom_field_get_definition($t_id);
         # Produce an error if the field is required but wasn't posted
         if (!gpc_isset_custom_field($t_id, $t_def['type']) && $t_def['require_report']) {
             error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
             trigger_error(ERROR_EMPTY_FIELD, ERROR);
         }
         if (!custom_field_validate($t_id, gpc_get_custom_field("custom_field_{$t_id}", $t_def['type'], NULL))) {
             error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
             trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR);
         }
     }
     # Allow plugins to pre-process bug data
     $t_bug_data = event_signal('EVENT_REPORT_BUG_DATA', $t_bug_data);
     # Ensure that resolved bugs have a handler
     if ($t_bug_data->handler_id == NO_USER && $t_bug_data->status >= config_get('bug_resolved_status_threshold')) {
         $t_bug_data->handler_id = $this->get_user_id();
     }
     # Create the bug
     $t_bug_id = $t_bug_data->create();
     # Mark the added issue as visited so that it appears on the last visited list.
     last_visited_issue($t_bug_id);
     # Handle the file upload
     if ($f_files != null) {
         $t_files = helper_array_transpose($f_files);
         if ($t_files != null) {
             foreach ($t_files as $t_file) {
                 if (!empty($t_file['name'])) {
                     file_add($t_bug_id, $t_file, 'bug');
                 }
             }
         }
     }
     # Handle custom field submission
     foreach ($t_related_custom_field_ids as $t_id) {
         # Do not set custom field value if user has no write access
         if (!custom_field_has_write_access($t_id, $t_bug_id)) {
             continue;
         }
         $t_def = custom_field_get_definition($t_id);
         if (!custom_field_set_value($t_id, $t_bug_id, gpc_get_custom_field("custom_field_{$t_id}", $t_def['type'], $t_def['default_value']), false)) {
             error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
             trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR);
         }
     }
     $f_master_bug_id = gpc_get_int('m_id', 0);
     $f_rel_type = gpc_get_int('rel_type', -1);
     if ($f_master_bug_id > 0) {
         # it's a child generation... let's create the relationship and add some lines in the history
         # update master bug last updated
         bug_update_date($f_master_bug_id);
         # Add log line to record the cloning action
         history_log_event_special($t_bug_id, BUG_CREATED_FROM, '', $f_master_bug_id);
         history_log_event_special($f_master_bug_id, BUG_CLONED_TO, '', $t_bug_id);
         if ($f_rel_type >= 0) {
             # Add the relationship
             relationship_add($t_bug_id, $f_master_bug_id, $f_rel_type);
             # Add log line to the history (both issues)
             history_log_event_special($f_master_bug_id, BUG_ADD_RELATIONSHIP, relationship_get_complementary_type($f_rel_type), $t_bug_id);
             history_log_event_special($t_bug_id, BUG_ADD_RELATIONSHIP, $f_rel_type, $f_master_bug_id);
             # update relationship target bug last updated
             bug_update_date($t_bug_id);
             # Send the email notification
             email_relationship_added($f_master_bug_id, $t_bug_id, relationship_get_complementary_type($f_rel_type));
         }
         # copy notes from parent
         if ($f_copy_notes_from_parent) {
             $t_parent_bugnotes = bugnote_get_all_bugnotes($f_master_bug_id);
             foreach ($t_parent_bugnotes as $t_parent_bugnote) {
                 $t_private = $t_parent_bugnote->view_state == VS_PRIVATE;
                 bugnote_add($t_bug_id, $t_parent_bugnote->note, $t_parent_bugnote->time_tracking, $t_private, $t_parent_bugnote->note_type, $t_parent_bugnote->note_attr, $t_parent_bugnote->reporter_id, FALSE, FALSE);
             }
         }
     }
     helper_call_custom_function('issue_create_notify', array($t_bug_id));
     # Allow plugins to post-process bug data with the new bug ID
     event_signal('EVENT_REPORT_BUG', array($t_bug_data, $t_bug_id));
     email_new_bug($t_bug_id);
     // log status and resolution changes if they differ from the default
     if ($t_bug_data->status != config_get('bug_submit_status')) {
         history_log_event($t_bug_id, 'status', config_get('bug_submit_status'));
     }
     if ($t_bug_data->resolution != config_get('default_bug_resolution')) {
         history_log_event($t_bug_id, 'resolution', config_get('default_bug_resolution'));
     }
     return $t_bug_id;
 }
Esempio n. 15
0
/**
 * $p_possible_values: possible values to be pre-processed.  If it has enumeration values,
 * it will be left as is.  If it has a method, it will be replaced by the list.
 * @param string $p_possible_values Possible values for custom field.
 * @return string|array
 * @access public
 */
function custom_field_prepare_possible_values($p_possible_values)
{
    if (!is_blank($p_possible_values) && $p_possible_values[0] == '=') {
        return helper_call_custom_function('enum_' . utf8_substr($p_possible_values, 1), array());
    }
    return $p_possible_values;
}
Esempio n. 16
0
                }
                array_splice($t_issue_ids, $k, 1);
                array_splice($t_issue_parents, $k, 1);
                $t_cycle_ids = array();
            } else {
                $k++;
            }
            if (count($t_issue_ids) <= $k) {
                $k = 0;
            }
        }
        $t_count_ids = count($t_issue_set_ids);
        for ($j = 0; $j < $t_count_ids; $j++) {
            $t_issue_set_id = $t_issue_set_ids[$j];
            $t_issue_set_level = $t_issue_set_levels[$j];
            helper_call_custom_function('roadmap_print_issue', array($t_issue_set_id, $t_issue_set_level));
            $t_issues_found = true;
        }
        if ($t_issues_planned > 0) {
            echo '<br />';
            echo sprintf(lang_get('resolved_progress'), $t_issues_resolved, $t_issues_planned, $t_progress);
            echo '<br /></tt>';
        }
    }
}
if (!$t_issues_found) {
    if (access_has_project_level(config_get('manage_project_threshold'), $t_project_id_for_access_check)) {
        $t_string = 'roadmap_empty_manager';
    } else {
        $t_string = 'roadmap_empty';
    }
Esempio n. 17
0
/**
 * Output Bug Rows
 *
 * @param array array of bug objects
 */
function write_bug_rows($p_rows)
{
    global $t_columns, $t_filter;
    $t_in_stickies = $t_filter && 'on' == $t_filter[FILTER_PROPERTY_STICKY];
    # pre-cache custom column data
    columns_plugin_cache_issue_data($p_rows);
    # -- Loop over bug rows --
    $t_rows = count($p_rows);
    for ($i = 0; $i < $t_rows; $i++) {
        $t_row = $p_rows[$i];
        if (0 == $t_row->sticky && 0 == $i) {
            $t_in_stickies = false;
        }
        if (0 == $t_row->sticky && $t_in_stickies) {
            # demarcate stickies, if any have been shown
            ?>
		   <tr>
				   <td class="left" colspan="<?php 
            echo count($t_columns);
            ?>
" bgcolor="#999999">&#160;</td>
		   </tr>
<?php 
            $t_in_stickies = false;
        }
        # choose color based on status
        $status_label = html_get_status_css_class($t_row->status, auth_get_current_user_id(), $t_row->project_id);
        echo '<tr class="' . $status_label . '">';
        $t_column_value_function = 'print_column_value';
        foreach ($t_columns as $t_column) {
            helper_call_custom_function($t_column_value_function, array($t_column, $t_row));
        }
        echo '</tr>';
    }
}
Esempio n. 18
0
function write_bug_rows($p_rows)
{
    global $t_columns, $t_filter;
    $t_in_stickies = $t_filter && 'on' == $t_filter['sticky_issues'];
    mark_time('begin loop');
    # -- Loop over bug rows --
    $t_rows = sizeof($p_rows);
    for ($i = 0; $i < $t_rows; $i++) {
        $t_row = $p_rows[$i];
        if (0 == $t_row['sticky'] && 0 == $i) {
            $t_in_stickies = false;
        }
        if (0 == $t_row['sticky'] && $t_in_stickies) {
            # demarcate stickies, if any have been shown
            ?>
               <tr>
                       <td class="left" colspan="<?php 
            echo sizeof($t_columns);
            ?>
" bgcolor="#999999">&nbsp;</td>
               </tr>
<?php 
            $t_in_stickies = false;
        }
        # choose color based on status
        $status_color = get_status_color($t_row['status']);
        echo '<tr bgcolor="', $status_color, '" border="1">';
        foreach ($t_columns as $t_column) {
            $t_column_value_function = 'print_column_value';
            helper_call_custom_function($t_column_value_function, array($t_column, $t_row));
        }
        echo '</tr>';
    }
}
Esempio n. 19
0
function csv_get_columns()
{
    $t_columns = helper_call_custom_function('get_columns_to_view', array(COLUMNS_TARGET_CSV_PAGE));
    return $t_columns;
}
Esempio n. 20
0
 private function add_bug(&$p_email, $p_overwrite_project_id = FALSE)
 {
     $this->show_memory_usage('Start add bug');
     //Merge References and In-Reply-To headers into one array
     $t_references = $p_email['References'];
     $t_references[] = $p_email['In-Reply-To'];
     if ($this->_mail_add_bugnotes) {
         $t_bug_id = $this->mail_is_a_bugnote($p_email['Subject'], $t_references);
     } else {
         $t_bug_id = FALSE;
     }
     if ($t_bug_id !== FALSE && !bug_is_readonly($t_bug_id)) {
         // @TODO@ Disabled for now until we find a good solution on how to handle the reporters possible lack of access permissions
         //			access_ensure_bug_level( config_get( 'add_bugnote_threshold' ), $f_bug_id );
         $t_description = $p_email['X-Mantis-Body'];
         $t_description = $this->identify_replies($t_description);
         $t_description = $this->strip_signature($t_description);
         $t_description = $this->add_additional_info('note', $p_email, $t_description);
         $t_project_id = bug_get_field($t_bug_id, 'project_id');
         ERP_set_temporary_overwrite('project_override', $t_project_id);
         # Event integration
         # Core mantis event already exists within bugnote_add function
         $t_description = event_signal('EVENT_ERP_BUGNOTE_DATA', $t_description, $t_bug_id);
         if (bug_is_resolved($t_bug_id)) {
             # Reopen issue and add a bug note
             bug_reopen($t_bug_id, $t_description);
         } elseif (!is_blank($t_description)) {
             # Add a bug note
             bugnote_add($t_bug_id, $t_description);
         }
     } elseif ($this->_mail_add_bug_reports) {
         // @TODO@ Disabled for now until we find a good solution on how to handle the reporters possible lack of access permissions
         //			access_ensure_project_level( config_get('report_bug_threshold' ) );
         $f_master_bug_id = $t_bug_id !== FALSE && bug_is_readonly($t_bug_id) ? $t_bug_id : 0;
         $this->fix_empty_fields($p_email);
         $t_project_id = $p_overwrite_project_id === FALSE ? $this->_mailbox['project_id'] : $p_overwrite_project_id;
         ERP_set_temporary_overwrite('project_override', $t_project_id);
         $t_bug_data = new BugData();
         $t_bug_data->build = '';
         $t_bug_data->platform = '';
         $t_bug_data->os = '';
         $t_bug_data->os_build = '';
         $t_bug_data->version = '';
         $t_bug_data->profile_id = 0;
         $t_bug_data->handler_id = 0;
         $t_bug_data->view_state = (int) config_get('default_bug_view_status');
         $t_bug_data->category_id = (int) $this->_mailbox['global_category_id'];
         $t_bug_data->reproducibility = (int) config_get('default_bug_reproducibility');
         $t_bug_data->severity = (int) config_get('default_bug_severity');
         $t_bug_data->priority = (int) ($this->_mail_use_bug_priority ? $p_email['Priority'] : config_get('default_bug_priority'));
         $t_bug_data->projection = (int) config_get('default_bug_projection');
         $t_bug_data->eta = (int) config_get('default_bug_eta');
         $t_bug_data->resolution = config_get('default_bug_resolution');
         $t_bug_data->status = config_get('bug_submit_status');
         $t_bug_data->summary = $p_email['Subject'];
         $t_description = $p_email['X-Mantis-Body'];
         $t_description = $this->strip_signature($t_description);
         $t_description = $this->add_additional_info('issue', $p_email, $t_description);
         $t_bug_data->description = $t_description;
         $t_bug_data->steps_to_reproduce = config_get('default_bug_steps_to_reproduce');
         $t_bug_data->additional_information = config_get('default_bug_additional_info');
         $t_bug_data->due_date = date_get_null();
         $t_bug_data->project_id = $t_project_id;
         $t_bug_data->reporter_id = $p_email['Reporter_id'];
         // This function might do stuff that EmailReporting cannot handle. Disabled
         //helper_call_custom_function( 'issue_create_validate', array( $t_bug_data ) );
         // @TODO@ Disabled for now but possibly needed for other future features
         # Validate the custom fields before adding the bug.
         /*			$t_related_custom_field_ids = custom_field_get_linked_ids( $t_bug_data->project_id );
         			foreach( $t_related_custom_field_ids as $t_id )
         			{
         				$t_def = custom_field_get_definition( $t_id );
         
         				# Produce an error if the field is required but wasn't posted
         				if ( !gpc_isset_custom_field( $t_id, $t_def['type'] ) &&
         					( $t_def['require_report'] ||
         						$t_def['type'] == CUSTOM_FIELD_TYPE_ENUM ||
         						$t_def['type'] == CUSTOM_FIELD_TYPE_LIST ||
         						$t_def['type'] == CUSTOM_FIELD_TYPE_MULTILIST ||
         						$t_def['type'] == CUSTOM_FIELD_TYPE_RADIO ) ) {
         					error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) );
         					trigger_error( ERROR_EMPTY_FIELD, ERROR );
         				}
         				if ( !custom_field_validate( $t_id, gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], NULL ) ) )
         				{
         					error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) );
         					trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR );
         				}
         			}*/
         # Allow plugins to pre-process bug data
         $t_bug_data = event_signal('EVENT_REPORT_BUG_DATA', $t_bug_data);
         $t_bug_data = event_signal('EVENT_ERP_REPORT_BUG_DATA', $t_bug_data);
         # Create the bug
         $t_bug_id = $t_bug_data->create();
         // @TODO@ Disabled for now but possibly needed for other future features
         # Handle custom field submission
         /*			foreach( $t_related_custom_field_ids as $t_id )
         {
         				# Do not set custom field value if user has no write access.
         				if( !custom_field_has_write_access( $t_id, $t_bug_id ) )
         				{
         					continue;
         				}
         
         				$t_def = custom_field_get_definition( $t_id );
         				if( !custom_field_set_value( $t_id, $t_bug_id, gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], '' ), false ) ) {
         				{
         					error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) );
         					trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR );
         				}
         			}*/
         // Lets link a readonly already existing bug to the newly created one
         if ($f_master_bug_id > 0) {
             $f_rel_type = BUG_RELATED;
             # update master bug last updated
             bug_update_date($f_master_bug_id);
             # Add the relationship
             relationship_add($t_bug_id, $f_master_bug_id, $f_rel_type);
             # Add log line to the history (both issues)
             history_log_event_special($f_master_bug_id, BUG_ADD_RELATIONSHIP, relationship_get_complementary_type($f_rel_type), $t_bug_id);
             history_log_event_special($t_bug_id, BUG_ADD_RELATIONSHIP, $f_rel_type, $f_master_bug_id);
             # Send the email notification
             email_relationship_added($f_master_bug_id, $t_bug_id, relationship_get_complementary_type($f_rel_type));
         }
         helper_call_custom_function('issue_create_notify', array($t_bug_id));
         # Allow plugins to post-process bug data with the new bug ID
         event_signal('EVENT_REPORT_BUG', array($t_bug_data, $t_bug_id));
         email_new_bug($t_bug_id);
     } else {
         // Not allowed to add issues and not allowed / able to add notes. Need to stop processing
         $this->custom_error('Not allowed to create a new issue. Email ignored');
         return;
     }
     $this->custom_error('Reporter: ' . $p_email['Reporter_id'] . ' - ' . $p_email['From_parsed']['email'] . ' --> Issue ID: #' . $t_bug_id, FALSE);
     $this->show_memory_usage('Finished add bug');
     $this->show_memory_usage('Start processing attachments');
     # Add files
     if ($this->_allow_file_upload) {
         if (count($p_email['X-Mantis-Parts']) > 0) {
             $t_rejected_files = NULL;
             while ($t_part = array_shift($p_email['X-Mantis-Parts'])) {
                 $t_file_rejected = $this->add_file($t_bug_id, $t_part);
                 if ($t_file_rejected !== TRUE) {
                     $t_rejected_files .= $t_file_rejected;
                 }
             }
             if ($t_rejected_files !== NULL) {
                 $t_part = array('name' => 'Rejected files.txt', 'ctype' => 'text/plain', 'body' => 'List of rejected files' . "\n\n" . $t_rejected_files);
                 $t_reject_rejected_files = $this->add_file($t_bug_id, $t_part);
                 if ($t_reject_rejected_files !== TRUE) {
                     $t_part['body'] .= $t_reject_rejected_files;
                     $this->custom_error('Failed to add "' . $t_part['name'] . '" to the issue. See below for all errors.' . "\n" . $t_part['body']);
                 }
             }
         }
     }
     //Add the users in Cc and To list in mail header
     $this->add_monitors($t_bug_id, $p_email);
     //Add the message-id to the database
     $this->add_msg_id($t_bug_id, $p_email['Message-ID']);
     ERP_set_temporary_overwrite('project_override', NULL);
     $this->show_memory_usage('Finished processing attachments');
 }
Esempio n. 21
0
function html_buttons_view_bug_page($p_bug_id)
{
    $t_resolved = config_get('bug_resolved_status_threshold');
    $t_status = bug_get_field($p_bug_id, 'status');
    $t_readonly = bug_is_readonly($p_bug_id);
    print '<table><tr class="vcenter">';
    if (!$t_readonly) {
        # UPDATE button
        echo '<td class="center">';
        html_button_bug_update($p_bug_id);
        echo '</td>';
        # ASSIGN button
        echo '<td class="center">';
        html_button_bug_assign_to($p_bug_id);
        echo '</td>';
        # Change State button
        echo '<td class="center">';
        html_button_bug_change_status($p_bug_id);
        echo '</td>';
    }
    # MONITOR/UNMONITOR button
    echo '<td class="center">';
    if (!current_user_is_anonymous()) {
        if (user_is_monitoring_bug(auth_get_current_user_id(), $p_bug_id)) {
            html_button_bug_unmonitor($p_bug_id);
        } else {
            html_button_bug_monitor($p_bug_id);
        }
    }
    echo '</td>';
    if (!$t_readonly) {
        # CREATE CHILD button
        echo '<td class="center">';
        html_button_bug_create_child($p_bug_id);
        echo '</td>';
    }
    if ($t_resolved <= $t_status) {
        # resolved is not the same as readonly
        print '<td class="center">';
        # REOPEN button
        html_button_bug_reopen($p_bug_id);
        print '</td>';
    }
    if (!$t_readonly) {
        # MOVE button
        echo '<td class="center">';
        html_button_bug_move($p_bug_id);
        echo '</td>';
        # DELETE button
        echo '<td class="center">';
        html_button_bug_delete($p_bug_id);
        echo '</td>';
    }
    helper_call_custom_function('print_bug_view_page_custom_buttons', array($p_bug_id));
    echo '</tr></table>';
}
/**
 *
 * @param int $p_columns_target
 * @param bool $p_viewable_only
 * @param int $p_user_id
 * @return array
 */
function helper_get_columns_to_view($p_columns_target = COLUMNS_TARGET_VIEW_PAGE, $p_viewable_only = true, $p_user_id = null)
{
    $t_columns = helper_call_custom_function('get_columns_to_view', array($p_columns_target, $p_user_id));
    # An associative array that is used to map older column names to newer ones.  This is useful when a column is renamed in the database
    # or if the value is replaced with a foreign key.
    $t_columns_map = array('category' => 'category_id');
    foreach ($t_columns as $t_key => $t_value) {
        if (isset($t_columns_map[$t_value])) {
            $t_columns[$t_key] = $t_columns_map[$t_value];
        }
    }
    if (!$p_viewable_only) {
        return $t_columns;
    }
    $t_keys_to_remove = array();
    if ($p_columns_target == COLUMNS_TARGET_CSV_PAGE || $p_columns_target == COLUMNS_TARGET_EXCEL_PAGE) {
        $t_keys_to_remove[] = 'selection';
        $t_keys_to_remove[] = 'edit';
        $t_keys_to_remove[] = 'bugnotes_count';
        $t_keys_to_remove[] = 'attachment_count';
        $t_keys_to_remove[] = 'overdue';
    }
    $t_enable_sponsorship = config_get('enable_sponsorship');
    if (OFF == $t_enable_sponsorship) {
        $t_keys_to_remove[] = 'sponsorship_total';
    }
    if ($p_columns_target == COLUMNS_TARGET_CSV_PAGE || $p_columns_target == COLUMNS_TARGET_EXCEL_PAGE) {
        $t_keys_to_remove[] = 'attachment_count';
    }
    $t_keys_to_remove[] = 'duplicate_id';
    $t_current_project_id = helper_get_current_project();
    if ($t_current_project_id != ALL_PROJECTS && !access_has_project_level(config_get('view_handler_threshold'), $t_current_project_id)) {
        $t_keys_to_remove[] = 'handler_id';
    }
    if ($t_current_project_id != ALL_PROJECTS && !access_has_project_level(config_get('roadmap_view_threshold'), $t_current_project_id)) {
        $t_keys_to_remove[] = 'target_version';
    }
    foreach ($t_keys_to_remove as $t_key_to_remove) {
        $t_keys = array_keys($t_columns, $t_key_to_remove);
        foreach ($t_keys as $t_key) {
            unset($t_columns[$t_key]);
        }
    }
    # get the array values to remove gaps in the array which causes issue
    # if the array is accessed using an index.
    return array_values($t_columns);
}
Esempio n. 23
0
require_api('html_api.php');
require_api('lang_api.php');
require_api('print_api.php');
require_api('user_api.php');
form_security_validate('manage_user_reset');
auth_reauthenticate();
access_ensure_global_level(config_get('manage_user_threshold'));
$f_user_id = gpc_get_int('user_id');
user_ensure_exists($f_user_id);
$t_user = user_get_row($f_user_id);
# Ensure that the account to be reset is of equal or lower access to the
# current user.
access_ensure_global_level($t_user['access_level']);
# If the password can be changed, we reset it, otherwise we unlock
# the account (i.e. reset failed login count)
$t_reset = helper_call_custom_function('auth_can_change_password', array());
if ($t_reset) {
    $t_result = user_reset_password($f_user_id);
} else {
    $t_result = user_reset_failed_login_count_to_zero($f_user_id);
}
$t_redirect_url = 'manage_user_page.php';
form_security_purge('manage_user_reset');
html_page_top(null, $t_result ? $t_redirect_url : null);
echo '<div class="success-msg">';
if ($t_reset) {
    if (false == $t_result) {
        # PROTECTED
        echo lang_get('account_reset_protected_msg');
    } else {
        # SUCCESSFUL RESET
                    $t_issue_set_levels = array_merge($t_issue_set_levels, $t_issue_set_levels_end);
                } else {
                    $t_issue_set_ids[] = $t_issue_id;
                    $t_issue_set_levels[] = 0;
                }
                array_splice($t_issue_ids, $k, 1);
                array_splice($t_issue_parents, $k, 1);
                $t_cycle_ids = array();
            } else {
                $k++;
            }
            if (count($t_issue_ids) <= $k) {
                $k = 0;
            }
        }
        for ($j = 0; $j < count($t_issue_set_ids); $j++) {
            $t_issue_set_id = $t_issue_set_ids[$j];
            $t_issue_set_level = $t_issue_set_levels[$j];
            helper_call_custom_function('changelog_print_issue', array($t_issue_set_id, $t_issue_set_level));
        }
        $t_bug_string = $t_issues_resolved == 1 ? 'bug' : 'bugs';
        echo "<br />[{$t_issues_resolved} " . lang_get($t_bug_string) . ']<br />';
    }
    if ($t_project_header_printed) {
        echo '</tt>';
    }
    $t_project_index++;
}
if ($t_project_index == 0) {
    echo '<br /><span class="pagetitle">' . lang_get('changelog_empty') . '</span>';
}
Esempio n. 25
0
                helper_call_custom_function('issue_update_notify', array($t_bug_id));
            } else {
                $t_failed_ids[$t_bug_id] = lang_get('bug_actiongroup_access');
            }
            break;
        case 'CUSTOM':
            if (0 === $f_custom_field_id) {
                trigger_error(ERROR_GENERIC, ERROR);
            }
            # @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) );
            $t_form_var = 'custom_field_' . $f_custom_field_id;
            $t_custom_field_value = gpc_get_custom_field($t_form_var, $t_custom_field_def['type'], null);
            custom_field_set_value($f_custom_field_id, $t_bug_id, $t_custom_field_value);
            bug_update_date($t_bug_id);
            email_bug_updated($t_bug_id);
            helper_call_custom_function('issue_update_notify', array($t_bug_id));
            break;
        default:
            trigger_error(ERROR_GENERIC, ERROR);
    }
    # Bug Action Event
    event_signal('EVENT_BUG_ACTION', array($f_action, $t_bug_id));
}
form_security_purge($t_form_name);
$t_redirect_url = 'view_all_bug_page.php';
if (count($t_failed_ids) > 0) {
    html_page_top();
    echo '<div><br />';
    echo '<table class="width75">';
    $t_separator = lang_get('word_separator');
    foreach ($t_failed_ids as $t_id => $t_reason) {
Esempio n. 26
0
/**
 * return the bug summary
 *  this is a wrapper for the custom function
 * @param int p_bug_id integer representing bug id
 * @param int p_context representing SUMMARY_CAPTION, SUMMARY_FIELD
 * @return string
 * @access public
 * @uses helper_api.php
 */
function bug_format_summary($p_bug_id, $p_context)
{
    return helper_call_custom_function('format_issue_summary', array($p_bug_id, $p_context));
}
Esempio n. 27
0
function helper_get_columns_to_view($p_columns_target = COLUMNS_TARGET_VIEW_PAGE)
{
    $t_columns = helper_call_custom_function('get_columns_to_view', array($p_columns_target));
    $t_enable_sponsorship = config_get('enable_sponsorship');
    if (OFF == $t_enable_sponsorship) {
        $t_keys = array_keys($t_columns, 'sponsorship_total');
        foreach ($t_keys as $t_key) {
            unset($t_columns[$t_key]);
        }
    }
    $t_show_attachments = config_get('show_attachment_indicator');
    if (OFF == $t_show_attachments) {
        $t_keys = array_keys($t_columns, 'attachment');
        foreach ($t_keys as $t_key) {
            unset($t_columns[$t_key]);
        }
    }
    if (OFF == config_get('enable_relationship')) {
        $t_keys = array_keys($t_columns, 'duplicate_id');
        foreach ($t_keys as $t_key) {
            unset($t_columns[$t_key]);
        }
    }
    $t_current_project_id = helper_get_current_project();
    if ($t_current_project_id != ALL_PROJECTS && !access_has_project_level(config_get('roadmap_view_threshold'), $t_current_project_id)) {
        $t_keys = array_keys($t_columns, 'target_version');
        foreach ($t_keys as $t_key) {
            unset($t_columns[$t_key]);
        }
    }
    # get the array values to remove gaps in the array which causes issue
    # if the array is accessed using an index.
    return array_values($t_columns);
}
Esempio n. 28
0
/**
 * Print all buttons for view bug pages
 * @param int $p_bug_id
 * @return null
 */
function html_buttons_view_bug_page($p_bug_id)
{
    $t_resolved = config_get('bug_resolved_status_threshold');
    $t_closed = config_get('bug_closed_status_threshold');
    $t_status = bug_get_field($p_bug_id, 'status');
    $t_readonly = bug_is_readonly($p_bug_id);
    $t_sticky = config_get('set_bug_sticky_threshold');
    $t_bug = bug_get($p_bug_id);
    echo '<table><tr class="vcenter">';
    if (!$t_readonly) {
        # UPDATE button
        echo '<td class="center">';
        html_button_bug_update($p_bug_id);
        echo '</td>';
        # ASSIGN button
        echo '<td class="center">';
        html_button_bug_assign_to($t_bug);
        echo '</td>';
    }
    # Change status button/dropdown
    if (!$t_readonly) {
        echo '<td class="center">';
        html_button_bug_change_status($t_bug);
        echo '</td>';
    }
    # MONITOR/UNMONITOR button
    if (!current_user_is_anonymous()) {
        echo '<td class="center">';
        if (user_is_monitoring_bug(auth_get_current_user_id(), $p_bug_id)) {
            html_button_bug_unmonitor($p_bug_id);
        } else {
            html_button_bug_monitor($p_bug_id);
        }
        echo '</td>';
    }
    # STICK/UNSTICK button
    if (access_has_bug_level($t_sticky, $p_bug_id)) {
        echo '<td class="center">';
        if (!bug_get_field($p_bug_id, 'sticky')) {
            html_button_bug_stick($p_bug_id);
        } else {
            html_button_bug_unstick($p_bug_id);
        }
        echo '</td>';
    }
    # CLONE button
    if (!$t_readonly) {
        echo '<td class="center">';
        html_button_bug_create_child($p_bug_id);
        echo '</td>';
    }
    # REOPEN button
    echo '<td class="center">';
    html_button_bug_reopen($t_bug);
    echo '</td>';
    # CLOSE button
    echo '<td class="center">';
    html_button_bug_close($t_bug);
    echo '</td>';
    # MOVE button
    echo '<td class="center">';
    html_button_bug_move($p_bug_id);
    echo '</td>';
    # DELETE button
    echo '<td class="center">';
    html_button_bug_delete($p_bug_id);
    echo '</td>';
    helper_call_custom_function('print_bug_view_page_custom_buttons', array($p_bug_id));
    echo '</tr></table>';
}
</tr>
<?php 
for ($i = 0; $i < $row_count; $i++) {
    $t_row = $result[$i];
    # alternate row colors
    $status_color = helper_alternate_colors($i, '#ffffff', '#dddddd');
    if (isset($t_bug_arr_sort[$t_row->id]) || $t_show_flag == 0) {
        ?>
<tr bgcolor="<?php 
        echo $status_color;
        ?>
" border="1" valign="top">
<?php 
        foreach ($t_columns as $t_column) {
            $t_column_value_function = 'print_column_value';
            helper_call_custom_function($t_column_value_function, array($t_column, $t_row, COLUMNS_TARGET_PRINT_PAGE));
        }
        ?>
</tr>
<?php 
    }
    # isset_loop
}
# for_loop
?>
<input type="hidden" name="show_flag" value="1" />
</table>

<br />

<input type="submit" class="button" value="<?php 
/**
 * Print all buttons for view bug pages
 * @param int $p_bug_id
 * @return null
 */
function html_buttons_view_bug_page($p_bug_id)
{
    $t_resolved = config_get('bug_resolved_status_threshold');
    $t_closed = config_get('bug_closed_status_threshold');
    $t_status = bug_get_field($p_bug_id, 'status');
    $t_readonly = bug_is_readonly($p_bug_id);
    // WK/BFE: Folgende Zeile ist eine Kopie der vorigen., LB/BFE 2015
    //	bug_is_readonly -> bug_is_readonly_BFE
    //	$t_readonly -> $t_readonly_BFE
    $t_readonly_BFE = bug_is_readonly_BFE($p_bug_id);
    $t_sticky = config_get('set_bug_sticky_threshold');
    $t_bug = bug_get($p_bug_id);
    echo '<table><tr class="vcenter">';
    // WK/BFE: Bedingund von $t_readonly auf $t_readonly_BFE geändert., LB/BFE 2015
    if (!$t_readonly_BFE) {
        # UPDATE button
        echo '<td class="center">';
        html_button_bug_update($p_bug_id);
        echo '</td>';
    }
    if (!$t_readonly) {
        # ASSIGN button
        echo '<td class="center">';
        html_button_bug_assign_to($t_bug);
        echo '</td>';
    }
    # Change status button/dropdown
    if (!$t_readonly) {
        echo '<td class="center">';
        html_button_bug_change_status($t_bug);
        echo '</td>';
    }
    # MONITOR/UNMONITOR button
    if (!current_user_is_anonymous()) {
        echo '<td class="center">';
        if (user_is_monitoring_bug(auth_get_current_user_id(), $p_bug_id)) {
            html_button_bug_unmonitor($p_bug_id);
        } else {
            html_button_bug_monitor($p_bug_id);
        }
        echo '</td>';
    }
    # STICK/UNSTICK button
    if (access_has_bug_level($t_sticky, $p_bug_id)) {
        echo '<td class="center">';
        if (!bug_get_field($p_bug_id, 'sticky')) {
            html_button_bug_stick($p_bug_id);
        } else {
            html_button_bug_unstick($p_bug_id);
        }
        echo '</td>';
    }
    # CLONE button
    if (!$t_readonly) {
        echo '<td class="center">';
        html_button_bug_create_child($p_bug_id);
        echo '</td>';
    }
    # REOPEN button
    echo '<td class="center">';
    html_button_bug_reopen($t_bug);
    echo '</td>';
    # CLOSE button
    # LB/BFE 2015 Schließen-Button entfernt: https://issuetracking.bfe.tv/view.php?id=18093
    /*
    echo '<td class="center">';
    html_button_bug_close( $t_bug );
    echo '</td>';
    */
    # MOVE button
    echo '<td class="center">';
    html_button_bug_move($p_bug_id);
    echo '</td>';
    # DELETE button
    echo '<td class="center">';
    html_button_bug_delete($p_bug_id);
    echo '</td>';
    helper_call_custom_function('print_bug_view_page_custom_buttons', array($p_bug_id));
    echo '</tr></table>';
}