Example #1
0
/**
 * Get the value for the specified user preference.
 *
 * @param string   $p_username    The user's username
 * @param string   $p_password    The user's password
 * @param int      $p_project_id  Project ID (0 = ALL_PROJECTS (mantisbt/core/constant_inc.php))
 * @param string   $p_pref_name   The name of the preference
 * @return string  $t_user_pref   The requested preference value
 */
function mc_user_pref_get_pref($p_username, $p_password, $p_project_id, $p_pref_name)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return mci_soap_fault_login_failed();
    }
    if (!mci_has_readonly_access($t_user_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    return user_pref_get_pref($t_user_id, $p_pref_name, $p_project_id);
}
    $f_eta = $t_bug->eta;
    $f_severity = $t_bug->severity;
    $f_priority = $t_bug->priority;
    $f_summary = $t_bug->summary;
    $f_description = $t_bug->description;
    $f_steps_to_reproduce = $t_bug->steps_to_reproduce;
    $f_additional_info = $t_bug->additional_information;
    $f_view_state = (int) $t_bug->view_state;
    $f_due_date = $t_bug->due_date;
    $t_project_id = $t_bug->project_id;
} else {
    # Get Project Id and set it as current
    $t_current_project = helper_get_current_project();
    $t_project_id = gpc_get_int('project_id', $t_current_project);
    # If all projects, use default project if set
    $t_default_project = user_pref_get_pref(auth_get_current_user_id(), 'default_project');
    if (ALL_PROJECTS == $t_project_id && ALL_PROJECTS != $t_default_project) {
        $t_project_id = $t_default_project;
    }
    if ((ALL_PROJECTS == $t_project_id || project_exists($t_project_id)) && $t_project_id != $t_current_project) {
        helper_set_current_project($t_project_id);
        # Reloading the page is required so that the project browser
        # reflects the new current project
        print_header_redirect($_SERVER['REQUEST_URI'], true, false, true);
    }
    # New issues cannot be reported for the 'All Project' selection
    if (ALL_PROJECTS == $t_current_project) {
        print_header_redirect('login_select_proj_page.php?ref=bug_report_page.php');
    }
    access_ensure_project_level(config_get('report_bug_threshold'));
    $f_build = gpc_get_string('build', '');
Example #3
0
if (!isset($g_login_anonymous)) {
    $g_login_anonymous = true;
}
# Attempt to set the current timezone to the user's desired value
# Note that PHP 5.1 on RHEL/CentOS doesn't support the timezone functions
# used here so we just skip this action on RHEL/CentOS platforms.
if (function_exists('timezone_identifiers_list')) {
    if (in_array(config_get_global('default_timezone'), timezone_identifiers_list())) {
        // if a default timezone is set in config, set it here, else we use php.ini's value
        // having a timezone set avoids a php warning
        date_default_timezone_set(config_get_global('default_timezone'));
    }
    require_api('authentication_api.php');
    if (auth_is_user_authenticated()) {
        require_api('user_pref_api.php');
        $t_user_timezone = user_pref_get_pref(auth_get_current_user_id(), 'timezone');
        if (!is_blank($t_user_timezone)) {
            date_default_timezone_set($t_user_timezone);
        }
    }
}
if (!defined('MANTIS_MAINTENANCE_MODE')) {
    require_api('collapse_api.php');
    collapse_cache_token();
}
# Load custom functions
require_api('custom_function_api.php');
if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'custom_functions_inc.php')) {
    require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'custom_functions_inc.php';
}
# Set HTTP response headers
Example #4
0
/**
 * Returns the specified field of the currently logged in user
 *
 * @param pref_name	Name of user preference as in the preferences table
 * 				definition.
 * @return Get the value of the specified preference for current user.
 * @access public
 */
function current_user_get_pref($p_pref_name)
{
    return user_pref_get_pref(auth_get_current_user_id(), $p_pref_name);
}
Example #5
0
/**
 * Return user's default language given a user id
 * @param integer $p_user_id User id.
 * @return string language string
 */
function mci_get_user_lang($p_user_id)
{
    $t_lang = user_pref_get_pref($p_user_id, 'language');
    if ($t_lang == 'auto') {
        $t_lang = config_get('fallback_language');
    }
    return $t_lang;
}
Example #6
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;
}
Example #7
0
}

# Attempt to set the current timezone to the user's desired value
# Note that PHP 5.1 on RHEL/CentOS doesn't support the timezone functions
# used here so we just skip this action on RHEL/CentOS platforms.
if ( function_exists( 'timezone_identifiers_list' ) ) {
	if ( in_array ( config_get_global( 'default_timezone' ), timezone_identifiers_list() ) ) {
		// if a default timezone is set in config, set it here, else we use php.ini's value
		// having a timezone set avoids a php warning
		date_default_timezone_set( config_get_global( 'default_timezone' ) );
	}

	require_api( 'authentication_api.php' );
	if( auth_is_user_authenticated() ) {
		require_api( 'user_pref_api.php' );
		date_default_timezone_set( user_pref_get_pref( auth_get_current_user_id(), 'timezone' ) );
	}
}

if ( !defined( 'MANTIS_MAINTENANCE_MODE' ) ) {
	require_api( 'collapse_api.php' );
	collapse_cache_token();
}

# Load custom functions
require_api( 'custom_function_api.php' );
if ( file_exists( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'custom_functions_inc.php' ) ) {
	require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'custom_functions_inc.php' );
}

# Set HTTP response headers
Example #8
0
function string_get_bug_page($p_action, $p_user_id = null)
{
    if (null === $p_user_id) {
        if (auth_is_user_authenticated()) {
            $p_user_id = auth_get_current_user_id();
        }
    }
    $g_show_action = config_get('show_' . $p_action);
    switch ($g_show_action) {
        case BOTH:
            if (null !== $p_user_id && ON == user_pref_get_pref($p_user_id, 'advanced_' . $p_action)) {
                return 'bug_' . $p_action . '_advanced_page.php';
            } else {
                return 'bug_' . $p_action . '_page.php';
            }
        case SIMPLE_ONLY:
            return 'bug_' . $p_action . '_page.php';
        case ADVANCED_ONLY:
            return 'bug_' . $p_action . '_advanced_page.php';
    }
}
$t_lang_no_bugnotes_msg = lang_get('no_bugnotes_msg');
$t_lang_projection = lang_get('projection');
$t_lang_target_version = lang_get('target_version');
$t_lang_summary = lang_get('summary');
$t_lang_description = lang_get('description');
$t_lang_steps_to_reproduce = lang_get('steps_to_reproduce');
$t_lang_additional_information = lang_get('additional_information');
$t_lang_bug_notes_title = lang_get('bug_notes_title');
$t_lang_system_profile = lang_get('system_profile');
$t_lang_attached_files = lang_get('attached_files');
$t_lang_tags = lang_get('tags');
$t_fields = config_get('bug_view_page_fields');
$t_fields = columns_filter_disabled($t_fields);
$t_show_tags = in_array('tags', $t_fields) && access_has_global_level(config_get('tag_view_threshold'));
$t_current_user_id = auth_get_current_user_id();
$t_user_bugnote_order = user_pref_get_pref($t_current_user_id, 'bugnote_order');
for ($j = 0; $j < $t_row_count; $j++) {
    $t_bug = $t_result[$j];
    $t_id = $t_bug->id;
    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++;