/** * Function to be called when a user is attempting to access a page that * he/she is not authorised to. This outputs an access denied message then * re-directs to the mainpage. */ function access_denied() { if (!auth_is_user_authenticated()) { if (basename($_SERVER['SCRIPT_NAME']) != 'login_page.php') { $t_return_page = $_SERVER['SCRIPT_NAME']; if (isset($_SERVER['QUERY_STRING'])) { $t_return_page .= '?' . $_SERVER['QUERY_STRING']; } $t_return_page = string_url(string_sanitize_url($t_return_page)); print_header_redirect('login_page.php' . '?return=' . $t_return_page); } } else { if (current_user_is_anonymous()) { if (basename($_SERVER['SCRIPT_NAME']) != 'login_page.php') { $t_return_page = $_SERVER['SCRIPT_NAME']; if (isset($_SERVER['QUERY_STRING'])) { $t_return_page .= '?' . $_SERVER['QUERY_STRING']; } $t_return_page = string_url(string_sanitize_url($t_return_page)); echo '<p class="center">' . error_string(ERROR_ACCESS_DENIED) . '</p><p class="center">'; print_bracket_link(helper_mantis_url('login_page.php') . '?return=' . $t_return_page, lang_get('click_to_login')); echo '</p><p class="center">'; print_bracket_link(helper_mantis_url('main_page.php'), lang_get('proceed')); echo '</p>'; } } else { echo '<p class="center">' . error_string(ERROR_ACCESS_DENIED) . '</p>'; echo '<p class="center">'; print_bracket_link(helper_mantis_url('main_page.php'), lang_get('proceed')); echo '</p>'; } } exit; }
/** * Cache collapse API data from the database for the current user. * If the collapse cookie has been set, grab the changes and resave * the token, or touch it otherwise. */ function collapse_cache_token() { global $g_collapse_cache_token; if (!auth_is_user_authenticated() || current_user_is_anonymous()) { $g_collapse_cache_token = array(); return; } if (isset($g_collapse_cache_token)) { return; } $t_user_id = auth_get_current_user_id(); $t_token = token_get_value(TOKEN_COLLAPSE); if (!is_null($t_token)) { $t_data = unserialize($t_token); } else { $t_data = array(); } $g_collapse_cache_token = $t_data; $t_cookie = gpc_get_cookie('MANTIS_collapse_settings', ''); if (false !== $t_cookie && !is_blank($t_cookie)) { $t_update = false; $t_data = explode('|', $t_cookie); foreach ($t_data as $t_pair) { $t_pair = explode(',', $t_pair); if (false !== $t_pair && count($t_pair) == 2) { $g_collapse_cache_token[$t_pair[0]] = true == $t_pair[1]; $t_update = true; } } if ($t_update) { $t_token = serialize($g_collapse_cache_token); token_set(TOKEN_COLLAPSE, $t_token, TOKEN_EXPIRY_COLLAPSE); } else { token_touch(TOKEN_COLLAPSE); } gpc_clear_cookie('MANTIS_collapse_settings'); } }
/** * return formatted string with all the details on the requested relationship * @param integer $p_bug_id A bug identifier. * @param BugRelationshipData $p_relationship A bug relationship object. * @param boolean $p_html Whether to return html or text output. * @param boolean $p_html_preview Whether to include style/hyperlinks - if preview is false, we prettify the output. * @param boolean $p_show_project Show Project details. * @return string */ function relationship_get_details($p_bug_id, BugRelationshipData $p_relationship, $p_html = false, $p_html_preview = false, $p_show_project = false) { $t_summary_wrap_at = utf8_strlen(config_get('email_separator2')) - 28; $t_icon_path = config_get('icon_path'); if ($p_bug_id == $p_relationship->src_bug_id) { # root bug is in the source side, related bug in the destination side $t_related_bug_id = $p_relationship->dest_bug_id; $t_related_project_name = project_get_name($p_relationship->dest_project_id); $t_relationship_descr = relationship_get_description_src_side($p_relationship->type); } else { # root bug is in the dest side, related bug in the source side $t_related_bug_id = $p_relationship->src_bug_id; $t_related_project_name = project_get_name($p_relationship->src_project_id); $t_relationship_descr = relationship_get_description_dest_side($p_relationship->type); } # related bug not existing... if (!bug_exists($t_related_bug_id)) { return ''; } # user can access to the related bug at least as a viewer if (!access_has_bug_level(VIEWER, $t_related_bug_id)) { return ''; } if ($p_html_preview == false) { $t_td = '<td>'; } else { $t_td = '<td class="print">'; } # get the information from the related bug and prepare the link $t_bug = bug_get($t_related_bug_id, false); $t_status_string = get_enum_element('status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id); $t_resolution_string = get_enum_element('resolution', $t_bug->resolution, auth_get_current_user_id(), $t_bug->project_id); $t_relationship_info_html = $t_td . string_no_break($t_relationship_descr) . ' </td>'; if ($p_html_preview == false) { $t_relationship_info_html .= '<td><a href="' . string_get_bug_view_url($t_related_bug_id) . '">' . string_display_line(bug_format_id($t_related_bug_id)) . '</a></td>'; $t_relationship_info_html .= '<td><span class="issue-status" title="' . string_attribute($t_resolution_string) . '">' . string_display_line($t_status_string) . '</span></td>'; } else { $t_relationship_info_html .= $t_td . string_display_line(bug_format_id($t_related_bug_id)) . '</td>'; $t_relationship_info_html .= $t_td . string_display_line($t_status_string) . ' </td>'; } $t_relationship_info_text = utf8_str_pad($t_relationship_descr, 20); $t_relationship_info_text .= utf8_str_pad(bug_format_id($t_related_bug_id), 8); # get the handler name of the related bug $t_relationship_info_html .= $t_td; if ($t_bug->handler_id > 0) { $t_relationship_info_html .= string_no_break(prepare_user_name($t_bug->handler_id)); } $t_relationship_info_html .= ' </td>'; # add project name if ($p_show_project) { $t_relationship_info_html .= $t_td . string_display_line($t_related_project_name) . ' </td>'; } # add summary if ($p_html == true) { $t_relationship_info_html .= $t_td . string_display_line_links($t_bug->summary); if (VS_PRIVATE == $t_bug->view_state) { $t_relationship_info_html .= sprintf(' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get('private'), lang_get('private')); } } else { if (utf8_strlen($t_bug->summary) <= $t_summary_wrap_at) { $t_relationship_info_text .= string_email_links($t_bug->summary); } else { $t_relationship_info_text .= utf8_substr(string_email_links($t_bug->summary), 0, $t_summary_wrap_at - 3) . '...'; } } # add delete link if bug not read only and user has access level if (!bug_is_readonly($p_bug_id) && !current_user_is_anonymous() && $p_html_preview == false) { if (access_has_bug_level(config_get('update_bug_threshold'), $p_bug_id)) { $t_relationship_info_html .= ' [<a class="small" href="bug_relationship_delete.php?bug_id=' . $p_bug_id . '&rel_id=' . $p_relationship->id . htmlspecialchars(form_security_param('bug_relationship_delete')) . '">' . lang_get('delete_link') . '</a>]'; } } $t_relationship_info_html .= ' </td>'; $t_relationship_info_text .= "\n"; if ($p_html_preview == false) { # choose color based on status $t_status_label = html_get_status_css_class($t_bug->status, auth_get_current_user_id(), $t_bug->project_id); $t_relationship_info_html = '<tr class="' . $t_status_label . '">' . $t_relationship_info_html . '</tr>' . "\n"; } else { $t_relationship_info_html = '<tr>' . $t_relationship_info_html . '</tr>'; } if ($p_html == true) { return $t_relationship_info_html; } else { return $t_relationship_info_text; } }
require_api('utility_api.php'); require_css('login.css'); $f_error = gpc_get_bool('error'); $f_cookie_error = gpc_get_bool('cookie_error'); $f_return = string_sanitize_url(gpc_get_string('return', '')); $f_username = gpc_get_string('username', ''); $f_perm_login = gpc_get_bool('perm_login', false); $f_secure_session = gpc_get_bool('secure_session', false); $f_secure_session_cookie = gpc_get_cookie(config_get_global('cookie_prefix') . '_secure_session', null); # Set username to blank if invalid to prevent possible XSS exploits if (!user_is_name_valid($f_username)) { $f_username = ''; } $t_session_validation = ON == config_get_global('session_validation'); # If user is already authenticated and not anonymous if (auth_is_user_authenticated() && !current_user_is_anonymous()) { # If return URL is specified redirect to it; otherwise use default page if (!is_blank($f_return)) { print_header_redirect($f_return, false, false, true); } else { print_header_redirect(config_get('default_home_page')); } } # Check for automatic logon methods where we want the logon to just be handled by login.php if (auth_automatic_logon_bypass_form()) { $t_uri = 'login.php'; if (ON == config_get('allow_anonymous_login')) { $t_uri = 'login_anon.php'; } if (!is_blank($f_return)) { $t_uri .= '?return=' . string_url($f_return);
/** * Determine if last visited feature is enabled * * @return boolean true: enabled; false: otherwise. * @access public */ function last_visited_enabled() { return !(OFF == config_get('recently_visited') || current_user_is_anonymous()); }
echo $t_bugslist ? '3' : '4'; ?> "> <?php echo lang_get('viewing_bug_advanced_details_title'); ?> <!-- Jump to Bugnotes --> <span class="small"><?php print_bracket_link("#bugnotes", lang_get('jump_to_bugnotes')); ?> </span> <!-- Send Bug Reminder --> <?php if (!current_user_is_anonymous() && !bug_is_readonly($f_bug_id) && access_has_bug_level(config_get('bug_reminder_threshold'), $f_bug_id)) { ?> <span class="small"> <?php print_bracket_link('bug_reminder_page.php?bug_id=' . $f_bug_id, lang_get('bug_reminder')); ?> </span> <?php } if (wiki_is_enabled()) { ?> <span class="small"> <?php print_bracket_link('wiki.php?id=' . $f_bug_id, lang_get('wiki')); ?> </span>
require_api('config_api.php'); require_api('constant_inc.php'); require_api('current_user_api.php'); require_api('form_api.php'); require_api('helper_api.php'); require_api('lang_api.php'); require_api('print_api.php'); require_api('sponsorship_api.php'); require_api('utility_api.php'); # # Determine whether the sponsorship section should be shown. # if (config_get('enable_sponsorship') == ON && access_has_bug_level(config_get('view_sponsorship_total_threshold'), $f_bug_id)) { $t_sponsorship_ids = sponsorship_get_all_ids($f_bug_id); $t_sponsorships_exist = count($t_sponsorship_ids) > 0; $t_can_sponsor = !bug_is_readonly($f_bug_id) && !current_user_is_anonymous(); $t_show_sponsorships = $t_sponsorships_exist || $t_can_sponsor; } else { $t_show_sponsorships = false; } # # Sponsorship Box # if ($t_show_sponsorships) { ?> <a id="sponsorships"></a> <br /> <?php collapse_open('sponsorship'); ?>
$tpl_product_version_string = string_display_line( $tpl_product_version_string ); $tpl_target_version_string = string_display_line( $tpl_target_version_string ); $tpl_fixed_in_version_string = string_display_line( $tpl_fixed_in_version_string ); $tpl_bug_id = $f_bug_id; $tpl_form_title = lang_get( 'bug_view_title' ); $tpl_wiki_link = config_get_global( 'wiki_enable' ) == ON ? 'wiki.php?id=' . $f_bug_id : ''; if ( access_has_bug_level( config_get( 'view_history_threshold' ), $f_bug_id ) ) { $tpl_history_link = "view.php?id=$f_bug_id&history=1#history"; } else { $tpl_history_link = ''; } $tpl_show_reminder_link = !current_user_is_anonymous() && !bug_is_readonly( $f_bug_id ) && access_has_bug_level( config_get( 'bug_reminder_threshold' ), $f_bug_id ); $tpl_bug_reminder_link = 'bug_reminder_page.php?bug_id=' . $f_bug_id; $tpl_print_link = 'print_bug_page.php?bug_id=' . $f_bug_id; $tpl_top_buttons_enabled = !$tpl_force_readonly && ( $t_action_button_position == POSITION_TOP || $t_action_button_position == POSITION_BOTH ); $tpl_bottom_buttons_enabled = !$tpl_force_readonly && ( $t_action_button_position == POSITION_BOTTOM || $t_action_button_position == POSITION_BOTH ); $tpl_show_project = in_array( 'project', $t_fields ); $tpl_project_name = $tpl_show_project ? string_display_line( project_get_name( $tpl_bug->project_id ) ): ''; $tpl_show_id = in_array( 'id', $t_fields ); $tpl_formatted_bug_id = $tpl_show_id ? string_display_line( bug_format_id( $f_bug_id ) ) : ''; $tpl_show_date_submitted = in_array( 'date_submitted', $t_fields ); $tpl_date_submitted = $tpl_show_date_submitted ? date( config_get( 'normal_date_format' ), $tpl_bug->date_submitted ) : '';
/** * 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>'; }
private function get_account_menu() { $t_protected = current_user_get_field('protected'); $t_current_project = helper_get_current_project(); # $t_menu_options = array(); $t_menu_options = $this->get_manage_menu(); echo ' <a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> <i class="icon-user"></i> '; echo user_get_realname(current_user_get_field('id')); echo ' <b class="caret"></b> </a> <ul class="dropdown-menu"> '; echo '<li><a href="' . helper_mantis_url('manage_overview_page.php') . '">Manage</a></li>'; echo '<li>' . implode($t_menu_options, ' </li> <li> ') . '</li>'; if ($t_menu_options) { echo '<li class="divider"></li>'; } unset($t_menu_options); # Account Page (only show accounts that are NOT protected) if (OFF == $t_protected) { $t_menu_options[] = '<a href="' . helper_mantis_url('account_page.php">') . '<i class="icon-user"></i> ' . lang_get('account_link') . '</a>'; } # Logout (no if anonymously logged in) if (!current_user_is_anonymous()) { $t_menu_options[] = '<a href="' . helper_mantis_url('logout_page.php">') . '<i class="icon-off"></i> ' . lang_get('logout_link') . '</a>'; } echo '<li>' . implode($t_menu_options, ' </li> <li> ') . '</li>'; echo '</ul>'; }
<?php $t_number_of_boxes = count($t_boxes); $t_boxes_position = config_get('my_view_boxes_fixed_position'); $t_counter = 0; while (list($t_box_title, $t_box_display) = each($t_boxes)) { # don't display bugs that are set as 0 if ($t_box_display == 0) { $t_number_of_boxes = $t_number_of_boxes - 1; } else { if ($t_box_title == 'assigned' && (current_user_is_anonymous() or user_get_assigned_open_bug_count($t_current_user_id, $t_project_id) == 0)) { $t_number_of_boxes = $t_number_of_boxes - 1; } else { if ($t_box_title == 'monitored' && (current_user_is_anonymous() or !access_has_project_level(config_get('monitor_bug_threshold'), $t_project_id, $t_current_user_id))) { $t_number_of_boxes = $t_number_of_boxes - 1; } else { if (in_array($t_box_title, array('reported', 'feedback', 'verify')) && (current_user_is_anonymous() or !access_has_project_level(config_get('report_bug_threshold'), $t_project_id, $t_current_user_id))) { $t_number_of_boxes = $t_number_of_boxes - 1; } else { $t_counter++; # check the style of displaying boxes - fixed (ie. each box in a separate table cell) or not if (ON == $t_boxes_position) { # for even box number start new row and column if (1 == $t_counter % 2) { echo '<tr><td valign="top" width="50%">'; include 'my_view_inc.php'; echo '</td>'; } else { if (0 == $t_counter % 2) { echo '<td valign="top" width="50%">'; include 'my_view_inc.php'; echo '</td></tr>';
function GetRelationshipContent($p_bug_id, $p_html = false, $p_html_preview = false, $p_summary = false, $p_icons = false) { $t_summary = ''; $t_icons = ''; $t_show_project = false; $t_summary_wrap_at = utf8_strlen(config_get('email_separator2')) - 10; $t_relationship_all = relationship_get_all($p_bug_id, $t_show_project); $t_relationship_all_count = count($t_relationship_all); if ($p_summary) { for ($i = 0; $i < $t_relationship_all_count; $i++) { $p_relationship = $t_relationship_all[$i]; if ($p_bug_id == $p_relationship->src_bug_id) { # root bug is in the src side, related bug in the dest side $t_related_bug_id = $p_relationship->dest_bug_id; $t_relationship_descr = relationship_get_description_src_side($p_relationship->type); } else { # root bug is in the dest side, related bug in the src side $t_related_bug_id = $p_relationship->src_bug_id; $t_relationship_descr = relationship_get_description_dest_side($p_relationship->type); } # get the information from the related bug and prepare the link $t_bug = bug_get($t_related_bug_id, false); $t_text = trim(utf8_str_pad($t_relationship_descr, 20)) . ' '; if ($p_html_preview == true) { $t_text .= '<a href="' . string_get_bug_view_url($t_related_bug_id) . '"'; $t_text .= ' class="rcv_tooltip"'; //$t_text .= ' title="' . utf8_str_pad (bug_format_id ($t_related_bug_id), 8) . "\n" . string_attribute ($t_bug->summary) . '"'; $t_text .= '>'; } $t_text .= string_display_line(bug_format_id($t_related_bug_id)); if ($p_html_preview == true) { $t_text .= '<span class="rcv_tooltip_box">'; $t_text .= '<span class="rcv_tooltip_title">' . bug_format_id($t_related_bug_id) . '</span>'; $t_text .= '<span class="rcv_tooltip_content">' . utf8_substr(string_email_links($t_bug->summary), 0, MAX_TOOLTIP_CONTENT_LENGTH); $t_text .= MAX_TOOLTIP_CONTENT_LENGTH < strlen($t_bug->summary) ? '...' : ''; $t_text .= '</span>'; $t_text .= '</span>'; $t_text .= '</a>'; } if (plugin_config_get('ShowRelationshipsControl') && !bug_is_readonly($p_bug_id) && !current_user_is_anonymous() && true == $p_html_preview) { // bug not read only if (access_has_bug_level(config_get('update_bug_threshold'), $p_bug_id)) { // user has access level // add a delete link $t_text .= ' ['; $t_text .= '<a class="small" href="bug_relationship_delete.php?bug_id=' . $p_bug_id; $t_text .= '&rel_id=' . $p_relationship->id; $t_text .= '&redirect_url=view_all_bug_page.php'; $t_text .= htmlspecialchars(form_security_param('bug_relationship_delete')); $t_text .= '">' . lang_get('delete_link') . '</a>'; $t_text .= ']'; } } // $t_text = relationship_get_details ($p_bug_id, $t_relationship_all[$i], true, false, $t_show_project); if (false == $p_html) { // p_html == No if ($i != 0) { if ($p_html_preview == true) { $t_summary .= ",<br/>"; } else { $t_summary .= ", "; } } $t_summary .= $t_text; } else { // p_html == Yes if ($p_html_preview == true) { $t_summary .= '<tr bgcolor="' . get_status_color($t_bug->status, auth_get_current_user_id(), $t_bug->project_id) . '">'; $t_summary .= '<td>' . $t_text . '</td>'; $t_summary .= '</tr>' . "\n"; } else { if ($i != 0) { $t_summary .= ", "; } $t_summary .= $t_text; } } } } if (plugin_config_get('ShowRelationshipIcons') && !current_user_is_anonymous() && true == $p_html_preview) { $t_text = RelationshipsUtils::GetBugSmybols($p_bug_id, !is_blank($t_summary)); if (!is_blank($t_text)) { if (false == $p_html) { // p_html == No $t_icons .= $t_text; } else { // p_html == Yes if ($p_html_preview == true) { $t_icons .= '<tr><td>' . $t_text . '</td></tr>' . "\n"; } else { $t_icons .= $t_text; } } } } if ($p_html_preview == true) { $t_icons_table = ''; $t_summary_table = ''; if (!is_blank($t_icons)) { $t_icons_table = '<table border="0" width="100%" cellpadding="0" cellspacing="1">' . $t_icons . '</table>'; } if (!is_blank($t_summary)) { $t_summary_table = '<table border="0" width="100%" cellpadding="0" cellspacing="1">' . $t_summary . '</table>'; } if (!is_blank($t_icons_table) && !is_blank($t_summary_table)) { return '<table border="0" width="100%" cellpadding="0" cellspacing="0">' . '<tr><td valign="top" style="padding:0px;">' . $t_summary_table . '</td><td valign="top" style="padding:0px;">' . $t_icons_table . '</td></tr>' . '</table>'; } else { return $t_summary_table . $t_icons_table; } } else { $t_result = $t_icons; if (!is_blank($t_icons) && !is_blank($t_summary)) { $t_result .= '<br/>'; } $t_result .= $t_summary; return $t_result; } }
define( 'MY_VIEW_INC_ALLOW', true ); while( list( $t_box_title, $t_box_display ) = each( $t_boxes ) ) { if( $t_box_display == 0 ) { # don't display bugs that are set as 0 $t_number_of_boxes = $t_number_of_boxes - 1; } else if( $t_box_title == 'assigned' && ( current_user_is_anonymous() || !access_has_project_level( config_get( 'handle_bug_threshold' ), $t_project_id, $t_current_user_id ) ) ) { # don't display "Assigned to Me" bugs to users that bugs can't be assigned to $t_number_of_boxes = $t_number_of_boxes - 1; } else if( $t_box_title == 'monitored' && ( current_user_is_anonymous() or !access_has_project_level( config_get( 'monitor_bug_threshold' ), $t_project_id, $t_current_user_id ) ) ) { # don't display "Monitored by Me" bugs to users that can't monitor bugs $t_number_of_boxes = $t_number_of_boxes - 1; } else if( in_array( $t_box_title, array( 'reported', 'feedback', 'verify' ) ) && ( current_user_is_anonymous() or !access_has_project_level( config_get( 'report_bug_threshold' ), $t_project_id, $t_current_user_id ) ) ) { # don't display "Reported by Me" bugs to users that can't report bugs $t_number_of_boxes = $t_number_of_boxes - 1; } else { # display the box $t_counter++; # check the style of displaying boxes - fixed (ie. each box in a separate table cell) or not if( ON == $t_boxes_position ) { if( 1 == $t_counter%2 ) { # for even box number start new row and column echo '<tr><td class="myview-left-col">'; include( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'my_view_inc.php' ); echo '</td></tr>'; } else if( 0 == $t_counter%2 ) { # for odd box number only start new column
function relationship_get_details($p_bug_id, $p_relationship, $p_html = false, $p_html_preview = false, $p_show_project = false) { $t_summary_wrap_at = strlen(config_get('email_separator2')) - 28; $t_icon_path = config_get('icon_path'); $p_user_id = auth_get_current_user_id(); if ($p_bug_id == $p_relationship->src_bug_id) { # root bug is in the src side, related bug in the dest side $t_related_bug_id = $p_relationship->dest_bug_id; $t_related_project_name = project_get_name($p_relationship->dest_project_id); $t_relationship_descr = relationship_get_description_src_side($p_relationship->type); } else { # root bug is in the dest side, related bug in the src side $t_related_bug_id = $p_relationship->src_bug_id; $t_related_project_name = project_get_name($p_relationship->src_project_id); $t_relationship_descr = relationship_get_description_dest_side($p_relationship->type); } # related bug not existing... if (!bug_exists($t_related_bug_id)) { return ''; } # user can access to the related bug at least as a viewer if (!access_has_bug_level(VIEWER, $t_related_bug_id)) { return ''; } if ($p_html_preview == false) { $t_td = '<td>'; } else { $t_td = '<td class="print">'; } # get the information from the related bug and prepare the link $t_bug = bug_prepare_display(bug_get($t_related_bug_id, true)); $t_status = string_attribute(get_enum_element('status', $t_bug->status)); $t_resolution = string_attribute(get_enum_element('resolution', $t_bug->resolution)); $t_relationship_info_html = $t_td . '<nobr>' . $t_relationship_descr . '</nobr> </td>'; if ($p_html_preview == false) { $t_relationship_info_html .= '<td><a href="' . string_get_bug_view_url($t_related_bug_id) . '">' . bug_format_id($t_related_bug_id) . '</a></td>'; $t_relationship_info_html .= '<td><a title="' . $t_resolution . '"><u>' . $t_status . '</u> </a></td>'; } else { $t_relationship_info_html .= $t_td . bug_format_id($t_related_bug_id) . '</td>'; $t_relationship_info_html .= $t_td . $t_status . ' </td>'; } $t_relationship_info_text = str_pad($t_relationship_descr, 20); $t_relationship_info_text .= str_pad(bug_format_id($t_related_bug_id), 8); # get the handler name of the related bug $t_relationship_info_html .= $t_td; if ($t_bug->handler_id > 0) { $t_relationship_info_html .= '<nobr>' . prepare_user_name($t_bug->handler_id) . '</nobr>'; } $t_relationship_info_html .= ' </td>'; # add project name if ($p_show_project) { $t_relationship_info_html .= $t_td . $t_related_project_name . ' </td>'; } # add summary $t_relationship_info_html .= $t_td . $t_bug->summary; if (VS_PRIVATE == $t_bug->view_state) { $t_relationship_info_html .= sprintf(' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get('private'), lang_get('private')); } if (strlen($t_bug->summary) <= $t_summary_wrap_at) { $t_relationship_info_text .= $t_bug->summary; } else { $t_relationship_info_text .= substr($t_bug->summary, 0, $t_summary_wrap_at - 3) . '...'; } # add delete link if bug not read only and user has access level if (!bug_is_readonly($p_bug_id) && !current_user_is_anonymous() && $p_html_preview == false) { if (access_has_bug_level(config_get('update_bug_threshold'), $p_bug_id)) { $t_relationship_info_html .= " [<a class=\"small\" href=\"bug_relationship_delete.php?bug_id={$p_bug_id}&rel_id={$p_relationship->id}\">" . lang_get('delete_link') . '</a>]'; } } $t_relationship_info_html .= ' </td>'; $t_relationship_info_text .= "\n"; if ($p_html_preview == false) { $t_relationship_info_html = '<tr bgcolor="' . get_status_color($t_bug->status) . '">' . $t_relationship_info_html . '</tr>' . "\n"; } else { $t_relationship_info_html = '<tr>' . $t_relationship_info_html . '</tr>'; } if ($p_html == true) { return $t_relationship_info_html; } else { return $t_relationship_info_text; } }
require_api('form_api.php'); require_api('gpc_api.php'); require_api('helper_api.php'); require_api('html_api.php'); require_api('lang_api.php'); require_api('print_api.php'); require_api('project_api.php'); require_api('sponsorship_api.php'); require_api('string_api.php'); require_api('version_api.php'); require_css('status_config.php'); if (!config_get('enable_sponsorship')) { trigger_error(ERROR_SPONSORSHIP_NOT_ENABLED, ERROR); } # anonymous users are not allowed to sponsor issues if (current_user_is_anonymous()) { access_denied(); } $t_show_all = gpc_get_bool('show_all', false); # start the page html_page_top(lang_get('my_sponsorship')); $t_project = helper_get_current_project(); ?> <br /> <table class="width100" cellspacing="1"> <tr> <td class="form-title"> <?php echo lang_get('my_sponsorship'); ?> </td>
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>'; }
/** * 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>'; }