当前位置: 首页>>代码示例>>PHP>>正文


PHP access_get_status_threshold函数代码示例

本文整理汇总了PHP中access_get_status_threshold函数的典型用法代码示例。如果您正苦于以下问题:PHP access_get_status_threshold函数的具体用法?PHP access_get_status_threshold怎么用?PHP access_get_status_threshold使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了access_get_status_threshold函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_status_option_list_plugin

function get_status_option_list_plugin($p_user_auth = 0, $p_current_value = 0, $p_show_current = true, $p_add_close = false, $p_project_id = ALL_PROJECTS)
{
    $t_config_var_value = config_get('status_enum_string', null, null, $p_project_id);
    $t_enum_workflow = config_get('status_enum_workflow', null, null, $p_project_id);
    $t_enum_values = MantisEnum::getValues($t_config_var_value);
    $t_enum_list = array();
    foreach ($t_enum_values as $t_enum_value) {
        if (($p_show_current || $p_current_value != $t_enum_value) && access_compare_level($p_user_auth, access_get_status_threshold($t_enum_value, $p_project_id))) {
            $t_enum_list[$t_enum_value] = get_enum_element('status', $t_enum_value);
        }
    }
    if ($p_show_current) {
        $t_enum_list[$p_current_value] = get_enum_element('status', $p_current_value);
    }
    if ($p_add_close && access_compare_level($p_current_value, config_get('bug_resolved_status_threshold', null, null, $p_project_id))) {
        $t_closed = config_get('bug_closed_status_threshold', null, null, $p_project_id);
        if ($p_show_current || $p_current_value != $t_closed) {
            $t_enum_list[$t_closed] = get_enum_element('status', $t_closed);
        }
    }
    return $t_enum_list;
}
开发者ID:nenes25,项目名称:mantisbt_autochangestatus,代码行数:22,代码来源:functions.php

示例2: gpc_get_int

     }
     break;
 case 'UP_PRIOR':
     if (access_has_bug_level(config_get('update_bug_threshold'), $t_bug_id)) {
         $f_priority = gpc_get_int('priority');
         # @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) );
         bug_set_field($t_bug_id, 'priority', $f_priority);
         email_bug_updated($t_bug_id);
         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 'UP_STATUS':
     $f_status = gpc_get_int('status');
     if (access_has_bug_level(access_get_status_threshold($f_status, $t_bug->project_id), $t_bug_id)) {
         if (true == bug_check_workflow($t_status, $f_status)) {
             # @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) );
             bug_set_field($t_bug_id, 'status', $f_status);
             # Add bugnote if supplied
             if (!is_blank($f_bug_notetext)) {
                 bugnote_add($t_bug_id, $f_bug_notetext, null, $f_bug_noteprivate);
                 # No need to call email_generic(), bugnote_add() does it
             } else {
                 email_bug_updated($t_bug_id);
             }
             helper_call_custom_function('issue_update_notify', array($t_bug_id));
         } else {
             $t_failed_ids[$t_bug_id] = lang_get('bug_actiongroup_status');
         }
     } else {
开发者ID:gtn,项目名称:mantisbt,代码行数:31,代码来源:bug_actiongroup.php

示例3: bug_group_action_get_commands

/**
 * Get a list of bug group actions available to the current user for one or
 * more projects.
 * @param array $p_project_ids An array containing one or more project IDs.
 * @return array
 */
function bug_group_action_get_commands(array $p_project_ids = null)
{
    if ($p_project_ids === null || count($p_project_ids) == 0) {
        $p_project_ids = array(ALL_PROJECTS);
    }
    $t_commands = array();
    foreach ($p_project_ids as $t_project_id) {
        if (!isset($t_commands['MOVE']) && access_has_project_level(config_get('move_bug_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['MOVE'] = lang_get('actiongroup_menu_move');
        }
        if (!isset($t_commands['COPY']) && access_has_any_project(config_get('report_bug_threshold', null, null, $t_project_id))) {
            $t_commands['COPY'] = lang_get('actiongroup_menu_copy');
        }
        if (!isset($t_commands['ASSIGN']) && access_has_project_level(config_get('update_bug_assign_threshold', null, null, $t_project_id), $t_project_id)) {
            if (ON == config_get('auto_set_status_to_assigned', null, null, $t_project_id) && access_has_project_level(access_get_status_threshold(config_get('bug_assigned_status', null, null, $t_project_id), $t_project_id), $t_project_id)) {
                $t_commands['ASSIGN'] = lang_get('actiongroup_menu_assign');
            } else {
                $t_commands['ASSIGN'] = lang_get('actiongroup_menu_assign');
            }
        }
        if (!isset($t_commands['CLOSE']) && access_has_project_level(config_get('update_bug_status_threshold', null, null, $t_project_id), $t_project_id) && (access_has_project_level(access_get_status_threshold(config_get('bug_closed_status_threshold', null, null, $t_project_id), $t_project_id), $t_project_id) || access_has_project_level(config_get('allow_reporter_close', null, null, $t_project_id), $t_project_id))) {
            $t_commands['CLOSE'] = lang_get('actiongroup_menu_close');
        }
        if (!isset($t_commands['DELETE']) && access_has_project_level(config_get('delete_bug_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['DELETE'] = lang_get('actiongroup_menu_delete');
        }
        if (!isset($t_commands['RESOLVE']) && access_has_project_level(config_get('update_bug_status_threshold', null, null, $t_project_id), $t_project_id) && access_has_project_level(access_get_status_threshold(config_get('bug_resolved_status_threshold', null, null, $t_project_id), $t_project_id), $t_project_id)) {
            $t_commands['RESOLVE'] = lang_get('actiongroup_menu_resolve');
        }
        if (!isset($t_commands['SET_STICKY']) && access_has_project_level(config_get('set_bug_sticky_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['SET_STICKY'] = lang_get('actiongroup_menu_set_sticky');
        }
        if (!isset($t_commands['UP_PRIOR']) && access_has_project_level(config_get('update_bug_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['UP_PRIOR'] = lang_get('actiongroup_menu_update_priority');
        }
        if (!isset($t_commands['EXT_UPDATE_SEVERITY']) && access_has_project_level(config_get('update_bug_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['EXT_UPDATE_SEVERITY'] = lang_get('actiongroup_menu_update_severity');
        }
        if (!isset($t_commands['UP_STATUS']) && access_has_project_level(config_get('update_bug_status_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['UP_STATUS'] = lang_get('actiongroup_menu_update_status');
        }
        if (!isset($t_commands['UP_CATEGORY']) && access_has_project_level(config_get('update_bug_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['UP_CATEGORY'] = lang_get('actiongroup_menu_update_category');
        }
        if (!isset($t_commands['VIEW_STATUS']) && access_has_project_level(config_get('change_view_status_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['VIEW_STATUS'] = lang_get('actiongroup_menu_update_view_status');
        }
        if (!isset($t_commands['EXT_UPDATE_PRODUCT_BUILD']) && config_get('enable_product_build', null, null, $t_project_id) == ON && access_has_project_level(config_get('update_bug_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['EXT_UPDATE_PRODUCT_BUILD'] = lang_get('actiongroup_menu_update_product_build');
        }
        if (!isset($t_commands['EXT_ADD_NOTE']) && access_has_project_level(config_get('add_bugnote_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['EXT_ADD_NOTE'] = lang_get('actiongroup_menu_add_note');
        }
        if (!isset($t_commands['EXT_ATTACH_TAGS']) && access_has_project_level(config_get('tag_attach_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['EXT_ATTACH_TAGS'] = lang_get('actiongroup_menu_attach_tags');
        }
        if (!isset($t_commands['UP_FIXED_IN_VERSION']) && version_should_show_product_version($t_project_id) && access_has_project_level(config_get('update_bug_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['UP_FIXED_IN_VERSION'] = lang_get('actiongroup_menu_update_fixed_in_version');
        }
        if (!isset($t_commands['UP_TARGET_VERSION']) && version_should_show_product_version($t_project_id) && access_has_project_level(config_get('roadmap_update_threshold', null, null, $t_project_id), $t_project_id)) {
            $t_commands['UP_TARGET_VERSION'] = lang_get('actiongroup_menu_update_target_version');
        }
        $t_custom_field_ids = custom_field_get_linked_ids($t_project_id);
        foreach ($t_custom_field_ids as $t_custom_field_id) {
            if (!custom_field_has_write_access_to_project($t_custom_field_id, $t_project_id)) {
                continue;
            }
            $t_custom_field_def = custom_field_get_definition($t_custom_field_id);
            $t_command_id = 'custom_field_' . $t_custom_field_id;
            $t_command_caption = sprintf(lang_get('actiongroup_menu_update_field'), lang_get_defaulted($t_custom_field_def['name']));
            $t_commands[$t_command_id] = string_display($t_command_caption);
        }
    }
    $t_custom_group_actions = config_get('custom_group_actions');
    foreach ($t_custom_group_actions as $t_custom_group_action) {
        # use label if provided to get the localized text, otherwise fallback to action name.
        if (isset($t_custom_group_action['label'])) {
            $t_commands[$t_custom_group_action['action']] = lang_get_defaulted($t_custom_group_action['label']);
        } else {
            $t_commands[$t_custom_group_action['action']] = lang_get_defaulted($t_custom_group_action['action']);
        }
    }
    return $t_commands;
}
开发者ID:derrickweaver,项目名称:mantisbt,代码行数:90,代码来源:bug_group_action_api.php

示例4: config_get

$t_core_path = config_get('core_path');
require_once $t_core_path . 'bug_api.php';
require_once $t_core_path . 'bugnote_api.php';
require_once $t_core_path . 'custom_field_api.php';
form_security_validate('bug_update');
$f_bug_id = gpc_get_int('bug_id');
$f_update_mode = gpc_get_bool('update_mode', FALSE);
# set if called from generic update page
$f_new_status = gpc_get_int('status', bug_get_field($f_bug_id, 'status'));
$t_bug_data = bug_get($f_bug_id, true);
if ($t_bug_data->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_data->project_id;
}
if (!(access_has_bug_level(access_get_status_threshold($f_new_status, bug_get_field($f_bug_id, 'project_id')), $f_bug_id) || access_has_bug_level(config_get('update_bug_threshold'), $f_bug_id) || bug_get_field($f_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;
$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('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 = gpc_get_string('category', $t_bug_data->category);
$t_bug_data->eta = gpc_get_int('eta', $t_bug_data->eta);
开发者ID:amjadtbssm,项目名称:website,代码行数:31,代码来源:bug_update.php

示例5: trigger_error

            $t_reopen_issue = true;
        }
    }
}
# If resolving or closing, ensure that all dependant issues have been resolved.
if (($t_resolve_issue || $t_close_issue) && !relationship_can_resolve_bug($f_bug_id)) {
    trigger_error(ERROR_BUG_RESOLVE_DEPENDANTS_BLOCKING, ERROR);
}
# Validate any change to the status of the issue.
if ($t_existing_bug->status !== $t_updated_bug->status) {
    access_ensure_bug_level(config_get('update_bug_status_threshold'), $f_bug_id);
    if (!bug_check_workflow($t_existing_bug->status, $t_updated_bug->status)) {
        error_parameters(lang_get('status'));
        trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR);
    }
    if (!access_has_bug_level(access_get_status_threshold($t_updated_bug->status, $t_updated_bug->project_id), $f_bug_id)) {
        # The reporter may be allowed to close or reopen the issue regardless.
        $t_can_bypass_status_access_thresholds = false;
        if ($t_close_issue && $t_existing_bug->status >= $t_resolved_status && $t_existing_bug->reporter_id === auth_get_current_user_id() && config_get('allow_reporter_close')) {
            $t_can_bypass_status_access_thresholds = true;
        } else {
            if ($t_reopen_issue && $t_existing_bug->status < $t_closed_status && $t_existing_bug->reporter_id === auth_get_current_user_id() && config_get('allow_reporter_reopen')) {
                $t_can_bypass_status_access_thresholds = true;
            }
        }
        if (!$t_can_bypass_status_access_thresholds) {
            trigger_error(ERROR_ACCESS_DENIED, ERROR);
        }
    }
    if ($t_reopen_issue) {
        # for everyone allowed to reopen an issue, set the reopen resolution
开发者ID:Kirill,项目名称:mantisbt,代码行数:31,代码来源:bug_update.php

示例6: put

 public function put($request)
 {
     /*
      *      Replaces the bug resource using the representation provided.
      *
      *      @param $request - The HTTP request we're responding to
      */
     $this->bug_id = Bug::get_mantis_id_from_url($request->url);
     $this->populate_from_repr($request->body);
     # Access checks are from Mantis's bug_update.php
     if (!(access_has_bug_level(access_get_status_threshold($f_new_status, bug_get_field($this->bug_id, 'project_id')), $this->bug_id) || access_has_bug_level(config_get('update_bug_threshold'), $this->bug_id) || bug_get_field($this->bug_id, 'reporter_id') == auth_get_current_user_id() && (ON == config_get('allow_reporter_reopen') || ON == config_get('allow_reporter_close')))) {
         throw new HTTPException(403, "Access denied to update bug");
     }
     bug_update($this->bug_id, $this->to_bugdata(), TRUE);
     $resp = new Response();
     $resp->status = 204;
     return $resp;
 }
开发者ID:NetWielder,项目名称:mantis-rest,代码行数:18,代码来源:bug.class.php

示例7: access_can_close_bug

/**
 * Check if the current user can close the specified bug
 * @param int $p_bug_id integer representing bug id to check access against
 * @param int|null $p_user_id integer representing user id, defaults to null to use current user
 * @return bool whether user has access to close bugs
 * @access public
 */
 function access_can_close_bug( $p_bug_id, $p_user_id = null ) {
	if( null === $p_user_id ) {
		$p_user_id = auth_get_current_user_id();
	}

	# If allow_reporter_close is enabled, then reporters can always close their own bugs
	if( ON == config_get( 'allow_reporter_close' ) && bug_is_user_reporter( $p_bug_id, $p_user_id ) ) {
		return true;
	}

	$t_bug = bug_get( $p_bug_id );

	$t_closed_status_threshold = access_get_status_threshold( config_get( 'bug_closed_status_threshold' ), $t_bug->project_id );

	return access_has_bug_level( $t_closed_status_threshold, $p_bug_id, $p_user_id );
}
开发者ID:rombert,项目名称:mantisbt,代码行数:23,代码来源:access_api.php

示例8: print_version_option_list

        print_version_option_list($t_bug->fixed_in_version, $t_bug->project_id, VERSION_ALL);
        ?>
		</select>
	</td>
</tr>
<?php 
    }
}
?>

<?php 
if ($f_new_status >= $t_resolved && $t_closed > $f_new_status) {
    ?>
<!-- Close Immediately (if enabled) -->
<?php 
    if (ON == config_get('allow_close_immediately') && access_has_bug_level(access_get_status_threshold($t_closed, $t_bug->project_id), $f_bug_id)) {
        ?>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('close_immediately');
        ?>
	</td>
	<td>
		<input type="checkbox" name="close_now" />
	</td>
</tr>
<?php 
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:31,代码来源:bug_change_status_page.php

示例9: gpc_get_int

$f_bug_id = gpc_get_int('id');
$t_bug = bug_get($f_bug_id);
$tpl_file = __FILE__;
$tpl_mantis_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
$tpl_show_page_header = false;
$tpl_force_readonly = true;
$tpl_fields_config_option = 'bug_change_status_page_fields';
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;
}
$f_new_status = gpc_get_int('new_status');
$f_reopen_flag = gpc_get_int('reopen_flag', OFF);
$t_current_user_id = auth_get_current_user_id();
if (!(access_has_bug_level(access_get_status_threshold($f_new_status, bug_get_field($f_bug_id, 'project_id')), $f_bug_id) || bug_get_field($f_bug_id, 'reporter_id') == $t_current_user_id && (ON == config_get('allow_reporter_reopen') || ON == config_get('allow_reporter_close')) || ON == $f_reopen_flag && access_has_bug_level(config_get('reopen_bug_threshold'), $f_bug_id))) {
    access_denied();
}
$t_can_update_due_date = access_has_bug_level(config_get('due_date_update_threshold'), $f_bug_id);
if ($t_can_update_due_date) {
    require_js('jscalendar/calendar.js');
    require_js('jscalendar/lang/calendar-en.js');
    require_js('jscalendar/calendar-setup.js');
    require_css('calendar-blue.css');
}
# get new issue handler if set, otherwise default to original handler
$f_handler_id = gpc_get_int('handler_id', bug_get_field($f_bug_id, 'handler_id'));
if (config_get('bug_assigned_status') == $f_new_status) {
    $t_bug_sponsored = sponsorship_get_amount(sponsorship_get_all_ids($f_bug_id)) > 0;
    if ($t_bug_sponsored) {
        if (!access_has_bug_level(config_get('assign_sponsored_bugs_threshold'), $f_bug_id)) {
开发者ID:kaos,项目名称:mantisbt,代码行数:31,代码来源:bug_change_status_page.php

示例10: access_can_close_bug

function access_can_close_bug($p_bug_id, $p_user_id = null)
{
    if (null === $p_user_id) {
        $p_user_id = auth_get_current_user_id();
    }
    # If allow_reporter_close is enabled, then reporters can always close
    #  their own bugs
    if (ON == config_get('allow_reporter_close') && bug_is_user_reporter($p_bug_id, $p_user_id)) {
        return true;
    }
    return access_has_bug_level(access_get_status_threshold(CLOSED), $p_bug_id, $p_user_id);
}
开发者ID:jin255ff,项目名称:company_website,代码行数:12,代码来源:access_api.php

示例11: gpc_get_int

    $g_project_override = $t_bug->project_id;
}
$f_new_status = gpc_get_int('new_status');
$f_reopen_flag = gpc_get_int('reopen_flag', OFF);
$t_reopen = config_get('bug_reopen_status', null, null, $t_bug->project_id);
$t_resolved = config_get('bug_resolved_status_threshold', null, null, $t_bug->project_id);
$t_closed = config_get('bug_closed_status_threshold', null, null, $t_bug->project_id);
$t_current_user_id = auth_get_current_user_id();
# Ensure user has proper access level before proceeding
if ($f_new_status == $t_reopen && $f_reopen_flag) {
    access_ensure_can_reopen_bug($t_bug, $t_current_user_id);
} else {
    if ($f_new_status == $t_closed) {
        access_ensure_can_close_bug($t_bug, $t_current_user_id);
    } else {
        if (bug_is_readonly($f_bug_id) || !access_has_bug_level(access_get_status_threshold($f_new_status, $t_bug->project_id), $f_bug_id, $t_current_user_id)) {
            access_denied();
        }
    }
}
$t_can_update_due_date = access_has_bug_level(config_get('due_date_update_threshold'), $f_bug_id);
if ($t_can_update_due_date) {
    require_js('jscalendar/calendar.js');
    require_js('jscalendar/lang/calendar-en.js');
    require_js('jscalendar/calendar-setup.js');
    require_css('calendar-blue.css');
}
# get new issue handler if set, otherwise default to original handler
$f_handler_id = gpc_get_int('handler_id', $t_bug->handler_id);
if (config_get('bug_assigned_status') == $f_new_status) {
    $t_bug_sponsored = sponsorship_get_amount(sponsorship_get_all_ids($f_bug_id)) > 0;
开发者ID:derrickweaver,项目名称:mantisbt,代码行数:31,代码来源:bug_change_status_page.php

示例12: print_version_option_list

        print_version_option_list(bug_get_field($f_bug_id, 'fixed_in_version'), bug_get_field($f_bug_id, 'project_id'), VERSION_ALL);
        ?>
		</select>
	</td>
</tr>
<?php 
    }
}
?>

<?php 
if ($f_new_status >= $t_resolved && CLOSED > $f_new_status) {
    ?>
<!-- Close Immediately (if enabled) -->
<?php 
    if (ON == config_get('allow_close_immediately') && access_has_bug_level(access_get_status_threshold(CLOSED), $f_bug_id)) {
        ?>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('close_immediately');
        ?>
	</td>
	<td>
		<input type="checkbox" name="close_now" />
	</td>
</tr>
<?php 
开发者ID:amjadtbssm,项目名称:website,代码行数:31,代码来源:bug_change_status_page.php

示例13: get_status_option_list

function get_status_option_list($p_user_auth = 0, $p_current_value = 0, $p_show_current = true, $p_add_close = false)
{
    $t_config_var_value = config_get('status_enum_string');
    $t_enum_workflow = config_get('status_enum_workflow');
    if (count($t_enum_workflow) < 1) {
        # workflow not defined, use default enum
        $t_arr = explode_enum_string($t_config_var_value);
    } else {
        # workflow defined - find allowed states
        if (isset($t_enum_workflow[$p_current_value])) {
            $t_arr = explode_enum_string($t_enum_workflow[$p_current_value]);
        } else {
            # workflow was not set for this status, this shouldn't happen
            $t_arr = explode_enum_string($t_config_var_value);
        }
    }
    $t_enum_count = count($t_arr);
    $t_enum_list = array();
    for ($i = 0; $i < $t_enum_count; $i++) {
        $t_elem = explode_enum_arr($t_arr[$i]);
        if ($p_user_auth >= access_get_status_threshold($t_elem[0]) && !(false == $p_show_current && $p_current_value == $t_elem[0])) {
            $t_enum_list[$t_elem[0]] = get_enum_element('status', $t_elem[0]);
        }
    }
    # end for
    if (true == $p_show_current) {
        $t_enum_list[$p_current_value] = get_enum_element('status', $p_current_value);
    }
    if (true == $p_add_close && $p_current_value >= config_get('bug_resolved_status_threshold')) {
        $t_enum_list[CLOSED] = get_enum_element('status', CLOSED);
    }
    return $t_enum_list;
}
开发者ID:jin255ff,项目名称:company_website,代码行数:33,代码来源:print_api.php

示例14: kanban_ajax_request_bug_update_status

/**
 * 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);
        }
    }
//.........这里部分代码省略.........
开发者ID:aberad,项目名称:MantisKanban,代码行数:101,代码来源:kanban_ajax_api.php

示例15: access_can_reopen_bug

/**
 * Check if the specified bug can be reopened
 * @param BugData $p_bug Bug to check access against
 * @param int|null $p_user_id integer representing user id, defaults to null to use current user
 * @return bool whether user has access to reopen bugs
 * @access public
 */
function access_can_reopen_bug($p_bug, $p_user_id = null)
{
    if (!bug_is_resolved($p_bug->id)) {
        # Can't reopen a bug that's not resolved
        return false;
    }
    if ($p_user_id === null) {
        $p_user_id = auth_get_current_user_id();
    }
    # If allow_reporter_reopen is enabled, then reporters can always reopen
    # their own bugs as long as their access level is reporter or above
    if (ON == config_get('allow_reporter_reopen', null, null, $p_bug->project_id) && bug_is_user_reporter($p_bug->id, $p_user_id) && access_has_project_level(config_get('report_bug_threshold', null, $p_user_id, $p_bug->project_id), $p_bug->project_id, $p_user_id)) {
        return true;
    }
    # Other users's access level must allow them to reopen bugs
    $t_reopen_bug_threshold = config_get('reopen_bug_threshold', null, null, $p_bug->project_id);
    if (access_has_bug_level($t_reopen_bug_threshold, $p_bug->id, $p_user_id)) {
        $t_reopen_status = config_get('bug_reopen_status', null, null, $p_bug->project_id);
        # User must be allowed to change status to reopen status
        $t_reopen_status_threshold = access_get_status_threshold($t_reopen_status, $p_bug->project_id);
        return access_has_bug_level($t_reopen_status_threshold, $p_bug->id, $p_user_id);
    }
    return false;
}
开发者ID:N0ctrnl,项目名称:mantisbt,代码行数:31,代码来源:access_api.php


注:本文中的access_get_status_threshold函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。