function get_section_begin($p_section_name) { $t_access_levels = explode_enum_string(config_get('access_levels_enum_string')); $t_output = '<table class="width100">'; $t_output .= '<tr><td class="form-title" colspan="' . (count($t_access_levels) + 1) . '">' . strtoupper($p_section_name) . '</td></tr>' . "\n"; $t_output .= '<tr><td class="form-title" width="40%">' . lang_get('perm_rpt_capability') . '</td>'; foreach ($t_access_levels as $t_access_level) { $t_entry_array = explode_enum_arr($t_access_level); $t_output .= '<td class="form-title" style="text-align:center"> ' . get_enum_to_string(lang_get('access_levels_enum_string'), $t_entry_array[0]) . ' </td>'; } $t_output .= '</tr>' . "\n"; return $t_output; }
protected function _get_rsrc_attr($attr_name) { if ($attr_name == 'password') { return '********'; } elseif ($attr_name == 'enabled' || $attr_name == 'protected') { return !!$this->mantis_data[$attr_name]; } elseif ($attr_name == 'access_level') { return get_enum_to_string(config_get('access_levels_enum_string'), $this->mantis_data['access_level']); } elseif ($attr_name == 'date_created' || $attr_name == 'last_visit') { return date_to_iso_date($this->mantis_data[$attr_name]); } elseif (in_array($attr_name, array('login_count', 'lost_password_request_count', 'failed_login_count'))) { return (int) $this->{$attr_name}; } else { return $this->mantis_data[$attr_name]; } }
function enum_get_element($p_enum_name, $p_val) { $config_var = config_get($p_enum_name . '_enum_string'); $string_var = lang_get($p_enum_name . '_enum_string'); # use the global enum string to search $t_arr = enum_explode_string($config_var); $t_arr_count = count($t_arr); for ($i = 0; $i < $t_arr_count; $i++) { $elem_arr = enum_explode_array($t_arr[$i]); if ($elem_arr[0] == $p_val) { # now get the appropriate translation return get_enum_to_string($string_var, $p_val); } } return '@null@'; }
protected function _get_rsrc_attr($attr_name) { if ($attr_name == 'reporter') { return User::get_url_from_mantis_id($this->mantis_data['reporter_id']); } elseif ($attr_name == 'handler') { return $this->mantis_data['handler_id'] ? User::get_url_from_mantis_id($this->mantis_data['handler_id']) : ""; } elseif ($attr_name == 'duplicate') { return $this->mantis_data['duplicate_id'] ? Bug::get_url_from_mantis_id($this->mantis_data['duplicate_id']) : ""; } elseif (in_array($attr_name, array('priority', 'severity', 'reproducibility', 'status', 'resolution', 'projection', 'eta'))) { return get_enum_to_string(config_get($attr_name . "_enum_string"), $this->mantis_data[$attr_name]); } elseif ($attr_name == 'date_submitted' || $attr_name == 'last_updated') { return timestamp_to_iso_date($this->mantis_data[$attr_name]); } elseif ($attr_name == 'private') { return $this->mantis_data['view_state'] == VS_PRIVATE; } elseif ($attr_name == 'project_id' or $attr_name == 'profile_id') { return (int) $this->mantis_data[$attr_name]; } elseif (in_array($attr_name, Bug::$rsrc_attrs)) { return $this->mantis_data[$attr_name]; } }
function access_row() { global $t_access, $t_can_change_flags, $t_colour_project, $t_colour_global; $t_enum_status = get_enum_to_array(config_get('status_enum_string')); $t_file_new = config_get_global('report_bug_threshold'); $t_global_new = config_get('report_bug_threshold', null, null, ALL_PROJECTS); $t_project_new = config_get('report_bug_threshold'); $t_file_set = config_get_global('set_status_threshold'); foreach ($t_enum_status as $t_status => $t_status_label) { if (!isset($t_file_set[$t_status])) { $t_file_set[$t_status] = config_get_global('update_bug_status_threshold'); } } $t_global_set = config_get('set_status_threshold', null, null, ALL_PROJECTS); foreach ($t_enum_status as $t_status => $t_status_label) { if (!isset($t_file_set[$t_status])) { $t_file_set[$t_status] = config_get('update_bug_status_threshold', null, null, ALL_PROJECTS); } } $t_project_set = config_get('set_status_threshold'); foreach ($t_enum_status as $t_status => $t_status_label) { if (!isset($t_file_set[$t_status])) { $t_file_set[$t_status] = config_get('update_bug_status_threshold'); } } foreach ($t_enum_status as $t_status => $t_status_label) { echo '<tr ' . helper_alternate_class() . '><td width="30%">' . string_no_break(get_enum_to_string(lang_get('status_enum_string'), $t_status)) . '</td>'; if (NEW_ == $t_status) { $t_level = $t_project_new; $t_can_change = $t_access >= config_get_access('report_bug_threshold'); $t_colour = ''; if ($t_global_new != $t_file_new) { $t_colour = ' bgcolor="' . $t_colour_global . '" '; # all projects override if ($t_can_change) { set_overrides('report_bug_threshold'); } } if ($t_project_new != $t_global_new) { $t_colour = ' bgcolor="' . $t_colour_project . '" '; # project overrides if ($t_can_change) { set_overrides('report_bug_threshold'); } } } else { $t_level = isset($t_project_set[$t_status]) ? $t_project_set[$t_status] : false; $t_level_global = isset($t_global_set[$t_status]) ? $t_global_set[$t_status] : false; $t_level_file = isset($t_file_set[$t_status]) ? $t_file_set[$t_status] : false; $t_can_change = $t_access >= config_get_access('set_status_threshold'); $t_colour = ''; if ($t_level_global != $t_level_file) { $t_colour = ' bgcolor="' . $t_colour_global . '" '; # all projects override if ($t_can_change) { set_overrides('set_status_threshold'); } } if ($t_level != $t_level_global) { $t_colour = ' bgcolor="' . $t_colour_project . '" '; # project overrides if ($t_can_change) { set_overrides('set_status_threshold'); } } } if ($t_can_change) { echo '<td' . $t_colour . '><select name="access_change_' . $t_status . '">'; print_enum_string_option_list('access_levels', $t_level); echo '</select> </td>'; $t_can_change_flags = true; } else { echo '<td class="center"' . $t_colour . '>' . get_enum_to_string(config_get('access_levels_enum_string'), $t_level) . '</td>'; } echo '</tr>' . "\n"; } }
function enum_bug_group($p_enum_string, $p_enum) { $t_bug_table = config_get('mantis_bug_table'); $t_project_id = helper_get_current_project(); $t_bug_table = config_get('mantis_bug_table'); $t_user_id = auth_get_current_user_id(); $t_res_val = config_get('bug_resolved_status_threshold'); $t_clo_val = CLOSED; $specific_where = " AND " . helper_project_specific_where($t_project_id, $t_user_id); $t_arr = explode_enum_string($p_enum_string); $enum_count = count($t_arr); for ($i = 0; $i < $enum_count; $i++) { $t_s = explode(':', $t_arr[$i]); $t_key = get_enum_to_string($p_enum_string, $t_s[0]); # Calculates the number of bugs opened and puts the results in a table $query = "SELECT COUNT(*)\n\t\t\t\t\tFROM {$t_bug_table}\n\t\t\t\t\tWHERE {$p_enum}='{$t_s['0']}' AND\n\t\t\t\t\t\tstatus<'{$t_res_val}' {$specific_where}"; $result2 = db_query($query); $t_metrics['open'][$t_key] = db_result($result2, 0, 0); # Calculates the number of bugs closed and puts the results in a table $query = "SELECT COUNT(*)\n\t\t\t\t\tFROM {$t_bug_table}\n\t\t\t\t\tWHERE {$p_enum}='{$t_s['0']}' AND\n\t\t\t\t\t\tstatus='{$t_clo_val}' {$specific_where}"; $result2 = db_query($query); $t_metrics['closed'][$t_key] = db_result($result2, 0, 0); # Calculates the number of bugs resolved and puts the results in a table $query = "SELECT COUNT(*)\n\t\t\t\t\tFROM {$t_bug_table}\n\t\t\t\t\tWHERE {$p_enum}='{$t_s['0']}' AND\n\t\t\t\t\t\tstatus>='{$t_res_val}' AND\n\t\t\t\t\t\tstatus<'{$t_clo_val}' {$specific_where}"; $result2 = db_query($query); $t_metrics['resolved'][$t_key] = db_result($result2, 0, 0); } ### end for return $t_metrics; }
function get_capability_enum($p_caption, $p_threshold, $p_enum, $p_all_projects_only = false) { global $t_user, $t_project_id, $t_show_submit, $t_access_levels, $t_colour_project, $t_colour_global; $t_file = config_get_global($p_threshold); $t_global = config_get($p_threshold, null, null, ALL_PROJECTS); $t_project = config_get($p_threshold); $t_can_change = access_has_project_level(config_get_access($p_threshold), $t_project_id, $t_user) && (ALL_PROJECTS == $t_project_id || !$p_all_projects_only); $t_colour = ''; if ($t_global != $t_file) { $t_colour = ' bgcolor="' . $t_colour_global . '" '; # all projects override if ($t_can_change) { set_overrides($p_threshold); } } if ($t_project != $t_global) { $t_colour = ' bgcolor="' . $t_colour_project . '" '; # project overrides if ($t_can_change) { set_overrides($p_threshold); } } echo '<tr ' . helper_alternate_class() . '><td>' . string_display($p_caption) . '</td>'; if ($t_can_change) { echo '<td class="left" colspan="3"' . $t_colour . '><select name="flag_' . $p_threshold . '">'; print_enum_string_option_list($p_enum, config_get($p_threshold)); echo '</select></td><td colspan="' . (count($t_access_levels) - 3) . '"></td>'; $t_show_submit = true; } else { $t_value = get_enum_to_string(lang_get($p_enum . '_enum_string'), config_get($p_threshold)) . ' '; echo '<td class="left" colspan="3"' . $t_colour . '>' . $t_value . '</td><td colspan="' . (count($t_access_levels) - 3) . '"></td>'; } if ($t_can_change) { echo '<td><select name="access_' . $p_threshold . '">'; print_enum_string_option_list('access_levels', config_get_access($p_threshold)); echo '</select> </td>'; } else { echo '<td>' . get_enum_to_string(lang_get('access_levels_enum_string'), config_get_access($p_threshold)) . ' </td>'; } echo '</tr>' . "\n"; }
function get_section_begin_for_email($p_section_name) { global $t_project; $t_access_levels = explode_enum_string(config_get('access_levels_enum_string')); echo '<table class="width100">'; echo '<tr><td class="form-title" colspan="' . (count($t_access_levels) + 7) . '">' . strtoupper($p_section_name) . '</td></tr>' . "\n"; echo '<tr><td class="form-title" width="30%" rowspan="2">' . lang_get('message') . '</td>'; echo '<td class="form-title" style="text-align:center" rowspan="2"> ' . lang_get('issue_reporter') . ' </td>'; echo '<td class="form-title" style="text-align:center" rowspan="2"> ' . lang_get('issue_handler') . ' </td>'; echo '<td class="form-title" style="text-align:center" rowspan="2"> ' . lang_get('users_monitoring_bug') . ' </td>'; echo '<td class="form-title" style="text-align:center" rowspan="2"> ' . lang_get('users_added_bugnote') . ' </td>'; echo '<td class="form-title" style="text-align:center" colspan="' . count($t_access_levels) . '"> ' . lang_get('access_levels') . ' </td></tr><tr>'; foreach ($t_access_levels as $t_access_level) { $t_entry_array = explode_enum_arr($t_access_level); echo '<td class="form-title" style="text-align:center"> ' . get_enum_to_string(lang_get('access_levels_enum_string'), $t_entry_array[0]) . ' </td>'; } echo '</tr>' . "\n"; }
function get_enum_element($p_enum_name, $p_val) { $g_var = "g_" . $p_enum_name . "_enum_string"; $s_var = "s_" . $p_enum_name . "_enum_string"; global ${$g_var}, ${$s_var}; # use the global enum string to search $t_arr = explode_enum_string(${$g_var}); $t_arr_count = count($t_arr); for ($i = 0; $i < $t_arr_count; $i++) { $elem_arr = explode_enum_arr($t_arr[$i]); if ($elem_arr[0] == $p_val) { # now get the appropriate translation return get_enum_to_string(${$s_var}, $p_val); } } return "@null@"; }
function bug_update($p_bug_id, $p_bug_data, $p_update_extended = false, $p_bypass_mail = false) { $c_bug_id = db_prepare_int($p_bug_id); $c_bug_data = bug_prepare_db($p_bug_data); # Summary cannot be blank if (is_blank($c_bug_data->summary)) { error_parameters(lang_get('summary')); trigger_error(ERROR_EMPTY_FIELD, ERROR); } if ($p_update_extended) { # Description field cannot be empty if (is_blank($c_bug_data->description)) { error_parameters(lang_get('description')); trigger_error(ERROR_EMPTY_FIELD, ERROR); } } if (!is_blank($p_bug_data->duplicate_id) && $p_bug_data->duplicate_id != 0 && $p_bug_id == $p_bug_data->duplicate_id) { trigger_error(ERROR_BUG_DUPLICATE_SELF, ERROR); # never returns } $t_old_data = bug_get($p_bug_id, true); $t_bug_table = config_get('mantis_bug_table'); # Update all fields # Ignore date_submitted and last_updated since they are pulled out # as unix timestamps which could confuse the history log and they # shouldn't get updated like this anyway. If you really need to change # them use bug_set_field() $query = "UPDATE {$t_bug_table}\n\t\t\t\tSET project_id='{$c_bug_data->project_id}',\n\t\t\t\t\treporter_id='{$c_bug_data->reporter_id}',\n\t\t\t\t\thandler_id='{$c_bug_data->handler_id}',\n\t\t\t\t\tduplicate_id='{$c_bug_data->duplicate_id}',\n\t\t\t\t\tpriority='{$c_bug_data->priority}',\n\t\t\t\t\tseverity='{$c_bug_data->severity}',\n\t\t\t\t\treproducibility='{$c_bug_data->reproducibility}',\n\t\t\t\t\tstatus='{$c_bug_data->status}',\n\t\t\t\t\tresolution='{$c_bug_data->resolution}',\n\t\t\t\t\tprojection='{$c_bug_data->projection}',\n\t\t\t\t\tcategory='{$c_bug_data->category}',\n\t\t\t\t\teta='{$c_bug_data->eta}',\n\t\t\t\t\tos='{$c_bug_data->os}',\n\t\t\t\t\tos_build='{$c_bug_data->os_build}',\n\t\t\t\t\tplatform='{$c_bug_data->platform}',\n\t\t\t\t\tversion='{$c_bug_data->version}',\n\t\t\t\t\tbuild='{$c_bug_data->build}',\n\t\t\t\t\tfixed_in_version='{$c_bug_data->fixed_in_version}',"; $t_roadmap_updated = false; if (access_has_project_level(config_get('roadmap_update_threshold'))) { $query .= "\n\t\t\t\t\ttarget_version='{$c_bug_data->target_version}',"; $t_roadmap_updated = true; } $query .= "\n\t\t\t\t\tview_state='{$c_bug_data->view_state}',\n\t\t\t\t\tsummary='{$c_bug_data->summary}',\n\t\t\t\t\tsponsorship_total='{$c_bug_data->sponsorship_total}',\n\t\t\t\t\tsticky='{$c_bug_data->sticky}'\n\t\t\t\tWHERE id='{$c_bug_id}'"; db_query($query); bug_clear_cache($p_bug_id); # log changes history_log_event_direct($p_bug_id, 'project_id', $t_old_data->project_id, $p_bug_data->project_id); history_log_event_direct($p_bug_id, 'reporter_id', $t_old_data->reporter_id, $p_bug_data->reporter_id); history_log_event_direct($p_bug_id, 'handler_id', $t_old_data->handler_id, $p_bug_data->handler_id); history_log_event_direct($p_bug_id, 'duplicate_id', $t_old_data->duplicate_id, $p_bug_data->duplicate_id); history_log_event_direct($p_bug_id, 'priority', $t_old_data->priority, $p_bug_data->priority); history_log_event_direct($p_bug_id, 'severity', $t_old_data->severity, $p_bug_data->severity); history_log_event_direct($p_bug_id, 'reproducibility', $t_old_data->reproducibility, $p_bug_data->reproducibility); history_log_event_direct($p_bug_id, 'status', $t_old_data->status, $p_bug_data->status); history_log_event_direct($p_bug_id, 'resolution', $t_old_data->resolution, $p_bug_data->resolution); history_log_event_direct($p_bug_id, 'projection', $t_old_data->projection, $p_bug_data->projection); history_log_event_direct($p_bug_id, 'category', $t_old_data->category, $p_bug_data->category); history_log_event_direct($p_bug_id, 'eta', $t_old_data->eta, $p_bug_data->eta); history_log_event_direct($p_bug_id, 'os', $t_old_data->os, $p_bug_data->os); history_log_event_direct($p_bug_id, 'os_build', $t_old_data->os_build, $p_bug_data->os_build); history_log_event_direct($p_bug_id, 'platform', $t_old_data->platform, $p_bug_data->platform); history_log_event_direct($p_bug_id, 'version', $t_old_data->version, $p_bug_data->version); history_log_event_direct($p_bug_id, 'build', $t_old_data->build, $p_bug_data->build); history_log_event_direct($p_bug_id, 'fixed_in_version', $t_old_data->fixed_in_version, $p_bug_data->fixed_in_version); if ($t_roadmap_updated) { history_log_event_direct($p_bug_id, 'target_version', $t_old_data->target_version, $p_bug_data->target_version); } history_log_event_direct($p_bug_id, 'view_state', $t_old_data->view_state, $p_bug_data->view_state); history_log_event_direct($p_bug_id, 'summary', $t_old_data->summary, $p_bug_data->summary); history_log_event_direct($p_bug_id, 'sponsorship_total', $t_old_data->sponsorship_total, $p_bug_data->sponsorship_total); history_log_event_direct($p_bug_id, 'sticky', $t_old_data->sticky, $p_bug_data->sticky); # Update extended info if requested if ($p_update_extended) { $t_bug_text_table = config_get('mantis_bug_text_table'); $t_bug_text_id = bug_get_field($p_bug_id, 'bug_text_id'); $query = "UPDATE {$t_bug_text_table}\n\t\t\t\t\t\tSET description='{$c_bug_data->description}',\n\t\t\t\t\t\t\tsteps_to_reproduce='{$c_bug_data->steps_to_reproduce}',\n\t\t\t\t\t\t\tadditional_information='{$c_bug_data->additional_information}'\n\t\t\t\t\t\tWHERE id='{$t_bug_text_id}'"; db_query($query); bug_text_clear_cache($p_bug_id); if ($t_old_data->description != $p_bug_data->description) { history_log_event_special($p_bug_id, DESCRIPTION_UPDATED); } if ($t_old_data->steps_to_reproduce != $p_bug_data->steps_to_reproduce) { history_log_event_special($p_bug_id, STEP_TO_REPRODUCE_UPDATED); } if ($t_old_data->additional_information != $p_bug_data->additional_information) { history_log_event_special($p_bug_id, ADDITIONAL_INFO_UPDATED); } } # Update the last update date bug_update_date($p_bug_id); if (false == $p_bypass_mail) { # allow bypass if user is sending mail separately $t_action_prefix = 'email_notification_title_for_action_bug_'; $t_status_prefix = 'email_notification_title_for_status_bug_'; # status changed if ($t_old_data->status != $p_bug_data->status) { $t_status = get_enum_to_string(config_get('status_enum_string'), $p_bug_data->status); $t_status = str_replace(' ', '_', $t_status); email_generic($p_bug_id, $t_status, $t_status_prefix . $t_status); return true; } # bug assigned if ($t_old_data->handler_id != $p_bug_data->handler_id) { email_generic($p_bug_id, 'owner', $t_action_prefix . 'assigned'); return true; } # @@@ handle priority change if it requires special handling # generic update notification email_generic($p_bug_id, 'updated', $t_action_prefix . 'updated'); } return true; }
if (!access_has_bug_level(config_get('assign_sponsored_bugs_threshold'), $f_bug_id)) { trigger_error(ERROR_SPONSORSHIP_ASSIGNER_ACCESS_LEVEL_TOO_LOW, ERROR); } } if ($f_handler_id != NO_USER) { if (!access_has_bug_level(config_get('handle_bug_threshold'), $f_bug_id, $f_handler_id)) { trigger_error(ERROR_HANDLER_ACCESS_TOO_LOW, ERROR); } if ($t_bug_sponsored) { if (!access_has_bug_level(config_get('handle_sponsored_bugs_threshold'), $f_bug_id, $f_handler_id)) { trigger_error(ERROR_SPONSORSHIP_HANDLER_ACCESS_LEVEL_TOO_LOW, ERROR); } } } } $t_status_label = str_replace(" ", "_", get_enum_to_string(config_get('status_enum_string'), $f_new_status)); $t_resolved = config_get('bug_resolved_status_threshold'); $t_bug = bug_get($f_bug_id); html_page_top1(bug_format_summary($f_bug_id, SUMMARY_CAPTION)); html_page_top2(); print_recently_visited(); ?> <br /> <div align="center"> <form method="post" action="bug_update.php"> <?php echo form_security_field('bug_update'); ?> <table class="width75" cellspacing="1">
function print_status_option_list($p_select_label, $p_current_value = 0, $p_allow_close = false, $p_project_id = null) { $t_current_auth = access_get_project_level($p_project_id); $t_enum_list = get_status_option_list($t_current_auth, $p_current_value, true, $p_allow_close); if (count($t_enum_list) > 0) { # resort the list into ascending order ksort($t_enum_list); reset($t_enum_list); echo '<select ', helper_get_tab_index(), ' name="' . $p_select_label . '">'; foreach ($t_enum_list as $key => $val) { echo "<option value=\"{$key}\""; check_selected($key, $p_current_value); echo ">{$val}</option>"; } echo '</select>'; } else { echo get_enum_to_string('status_enum_string', $p_current_value); } }