function displayResultsCore($query, $fields) { $result = db_query_bound($query); $nbRows = 0; while ($row = db_fetch_array($result)) { $nbRows++; $t_bug = bug_get($row['id']); print "<tr> \n"; print '<td><a href="' . string_get_bug_view_url($row['id']) . '">' . bug_format_id($row['id']) . '</a></td>'; //print "<td> ".string_get_bug_view_url( ))." </td>\n"; print "<td> " . string_display_line(get_enum_element('status', $t_bug->status)) . " </td>\n"; print "<td> " . category_get_row($t_bug->category_id)['name'] . " </td>\n"; print "<td> " . $t_bug->summary . " </td>\n"; print "<td> " . user_get_field($t_bug->reporter_id, 'username') . " </td>\n"; if ($t_bug->handler_id != null) { print "<td> " . user_get_field($t_bug->handler_id, 'username') . " </td>\n"; } if (sizeof($fields) > 0) { for ($i = 0; $i < sizeof($fields); $i++) { print "<td> " . $row[$fields[$i]] . " </td>\n"; } } print "</tr>\n"; } return $nbRows; }
/** * Print table body * @param $status_cols */ function print_tbody($status_cols) { $storyboard_db_api = new storyboard_db_api(); $project_spec_bug_ids = $storyboard_db_api->get_bugarray_by_project(helper_get_current_project()); $types = $storyboard_db_api->select_all_types(); echo '<tbody>'; foreach ($types as $type) { echo '<tr>'; echo '<td class="category">' . $type[1] . '</td>'; foreach ($status_cols as $status_col) { echo '<td class="story_baord">'; foreach ($project_spec_bug_ids as $project_spec_bug_id) { $card = $storyboard_db_api->select_story_card($project_spec_bug_id); if ($card[2] == $type[0]) { $bug_status = bug_get_field($project_spec_bug_id, 'status'); if ($bug_status == $status_col) { echo '<a href="' . string_get_bug_view_url($project_spec_bug_id) . '" class="rcv_tooltip">'; echo '<div class="story_card">'; echo string_display_line(bug_format_id($project_spec_bug_id)); echo '<span>'; print_story_card_title($project_spec_bug_id); print_story_card_info('summary', bug_get_field($project_spec_bug_id, 'summary'), false); print_story_card_info('description', bug_get_text_field($project_spec_bug_id, 'description'), false); print_story_card_info('card_risk', $card[3], true); print_story_card_info('card_story_pt', $card[4], true); print_story_card_info('card_story_pt_post', $card[5], true); print_story_card_info('card_acc_crit', $card[6], true); echo '</span>'; echo '</div>'; echo '</a><br/><br/><br/>'; } } } echo '</td>'; } echo '</tr>'; } echo '</tbody>'; }
function display_commit_message($event, $bugid) { if (!$bugid) { return; } $t_fields = config_get('bug_view_page_fields'); $t_fields = columns_filter_disabled($t_fields); $tpl_show_id = in_array('id', $t_fields); $tpl_show_description = in_array('description', $t_fields); $tpl_show_status = in_array('status', $t_fields); if ($tpl_show_id && $tpl_show_description && $tpl_show_status) { bug_ensure_exists($bugid); $bug = bug_get($bugid, true); access_ensure_bug_level(VIEWER, $bugid); $tpl_description = string_display_links($bug->summary); $tpl_status = get_enum_element('status', $bug->status); $tpl_link = config_get('path') . string_get_bug_view_url($bugid, null); $message = sprintf('%s - #JJ%d: %s<br/>%s', strtoupper($tpl_status), $bugid, $tpl_description, $tpl_link); echo '<tr ', helper_alternate_class(), '>'; echo '<td class="category">', plugin_lang_get('commit_message'), '</td>'; echo '<td colspan="5">' . $message . '</td>'; echo '</tr>'; } }
/** * return the name and GET parameters of a bug VIEW page for the given bug * account for the user preference and site override * The returned url includes the fully qualified domain, hence it is suitable to be included in emails. * @param integer $p_bug_id A bug identifier. * @param integer $p_user_id A valid user identifier. * @return string */ function string_get_bug_view_url_with_fqdn($p_bug_id, $p_user_id = null) { return config_get('path') . string_get_bug_view_url($p_bug_id, $p_user_id); }
/** * checks relationships for a bug and assign relevant symbols * * @author Rainer Dierck * @param $bugId */ public static function GetBugSmybols($bugId, $p_newline = false) { $t_text = ''; $bugStatus = bug_get_field($bugId, 'status'); $allRelationships = relationship_get_all($bugId, $t_show_project); $allRelationshipsCount = count($allRelationships); $stopFlag = false; $forbiddenFlag = false; $warningFlag = false; $bugEta = bug_get_field($bugId, 'eta'); $useEta = $bugEta != ETA_NONE && config_get('enable_eta'); $stopAltText = ""; $forbiddenAltText = ""; $warningAltText = ""; $href = string_get_bug_view_url($bugId) . '#relationships_open'; for ($index = 0; $index < $allRelationshipsCount; $index++) { $relationShip = $allRelationships[$index]; if ($bugId == $relationShip->src_bug_id) { # root bug is in the src side, related bug in the dest side $destinationBugId = $relationShip->dest_bug_id; $relationshipDescription = relationship_get_description_src_side($relationShip->type); } else { # root bug is in the dest side, related bug in the src side $destinationBugId = $relationShip->src_bug_id; $relationshipDescription = relationship_get_description_dest_side($relationShip->type); } # get the information from the related bug and prepare the link $destinationBugStatus = bug_get_field($destinationBugId, 'status'); if ($bugStatus < CLOSED && $destinationBugStatus < CLOSED && $relationShip->type != BUG_REL_NONE) { if ($relationShip->type == BUG_DEPENDANT) { if ($bugId == $relationShip->src_bug_id) { // Stop or Forbidden if ($bugStatus == $destinationBugStatus) { // Stop if ($stopAltText != "") { $stopAltText .= ", "; } if (!$stopFlag) { $stopAltText .= trim(utf8_str_pad($relationshipDescription, 20)) . ' '; } $stopAltText .= string_display_line(bug_format_id($destinationBugId)); $stopFlag = true; } if ($bugStatus > $destinationBugStatus) { // Forbidden if ($forbiddenAltText != "") { $forbiddenAltText .= ", "; } if (!$forbiddenFlag) { $forbiddenAltText .= trim(utf8_str_pad($relationshipDescription, 20)) . ' '; } $forbiddenAltText .= string_display_line(bug_format_id($destinationBugId)); $forbiddenFlag = true; } } else { // Warning if ($bugStatus < $destinationBugStatus) { // Warning if ($warningAltText != "") { $warningAltText .= ", "; } if (!$warningFlag) { $warningAltText .= trim(utf8_str_pad($relationshipDescription, 20)) . ' '; } $warningAltText .= string_display_line(bug_format_id($destinationBugId)); $warningFlag = true; } } } } } //if ( $useEta ) //{ // RELATIONSHIPS_UTILS_PLUGIN_URL // $t_text .= '<img border="0" width="16" height="16" src="' . RELATIONSHIPS_UTILS_PLUGIN_URL . 'clock.png' . '" alt="clock" />'; //} if ($forbiddenFlag) { if ($p_newline && !is_blank($t_text)) { $t_text .= '<br/>' . "\n"; } $t_text .= '<a href="' . $href . '"><img border="0" width="16" height="16" src="' . RELATIONSHIPS_UTILS_PLUGIN_URL . 'sign_forbidden.png" alt="' . $forbiddenAltText . '" title="' . $forbiddenAltText . '" /></a>'; } if ($stopFlag) { if ($p_newline && !is_blank($t_text)) { $t_text .= '<br/>' . "\n"; } $t_text .= '<a href="' . $href . '"><img border="0" width="16" height="16" src="' . RELATIONSHIPS_UTILS_PLUGIN_URL . 'sign_stop.png" alt="' . $stopAltText . '" title="' . $stopAltText . '" /></a>'; } if ($warningFlag) { if ($p_newline && !is_blank($t_text)) { $t_text .= '<br/>' . "\n"; } $t_text .= '<a href="' . $href . '"><img border="0" width="16" height="16" src="' . RELATIONSHIPS_UTILS_PLUGIN_URL . 'sign_warning.png" alt="' . $warningAltText . '" title="' . $warningAltText . '" /></a>'; } return $t_text; }
function print_successful_redirect_to_bug($p_bug_id) { $t_url = string_get_bug_view_url($p_bug_id, auth_get_current_user_id()); print_successful_redirect($t_url); }
/** * 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; } }
/** * Get a view URL for the bug id based on the user's preference and * call print_successful_redirect() with that URL * * @param integer $p_bug_id A bug identifier. * @return void */ function print_successful_redirect_to_bug($p_bug_id) { $t_url = string_get_bug_view_url($p_bug_id); print_successful_redirect($t_url); }
} if ($t_bug_data->resolution != config_get('default_bug_resolution')) { history_log_event($t_bug_id, 'resolution', config_get('default_bug_resolution')); } form_security_purge('bug_report'); html_page_top1(); if (!$f_report_stay) { html_meta_redirect('view_all_bug_page.php'); } html_page_top2(); ?> <br /> <div align="center"> <?php echo lang_get('operation_successful') . '<br />'; print_bracket_link(string_get_bug_view_url($t_bug_id), sprintf(lang_get('view_submitted_bug_link'), $t_bug_id)); print_bracket_link('view_all_bug_page.php', lang_get('view_bugs_link')); if ($f_report_stay) { ?> <p> <form method="post" action="<?php echo string_get_bug_report_url(); ?> "> <?php # CSRF protection not required here - form does not result in modifications ?> <input type="hidden" name="category_id" value="<?php echo string_attribute($t_bug_data->category_id); ?> " />
?> <td class="center" valign="top" width ="0" nowrap> <span class="small"> <?php print_bug_link($v_id); echo '<br />'; if (!bug_is_readonly($v_id) && access_has_bug_level($t_update_bug_threshold, $v_id)) { echo '<a href="' . string_get_bug_update_url($v_id) . '"><img border="0" src="' . $t_icon_path . 'update.png' . '" alt="' . lang_get('update_bug_button') . '" /></a>'; } if (ON == config_get('show_priority_text')) { print_formatted_priority_string($v_status, $v_priority); } else { print_status_icon($v_priority); } if (0 < $t_attachment_count) { echo '<a href="' . string_get_bug_view_url($v_id) . '#attachments">'; echo '<img border="0" src="' . $t_icon_path . 'attachment.png' . '"'; echo ' alt="' . lang_get('attachment_alt') . '"'; echo ' title="' . $t_attachment_count . ' ' . lang_get('attachments') . '"'; echo ' />'; echo '</a>'; } if (VS_PRIVATE == $v_view_state) { echo '<img src="' . $t_icon_path . 'protected.gif" width="8" height="15" alt="' . lang_get('private') . '" />'; } ?> </span> </td> <?php # -- Summary --
/** * * @param BugData $p_bug bug obect * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php * @return null * @access public */ function print_column_attachment_count($p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE) { global $t_icon_path; # Check for attachments $t_attachment_count = 0; if (file_can_view_bug_attachments($p_bug->id)) { $t_attachment_count = file_bug_attachment_count($p_bug->id); } echo '<td class="center column-attachments">'; if ($t_attachment_count > 0) { $t_href = string_get_bug_view_url($p_bug->id) . '#attachments'; $t_href_title = sprintf(lang_get('view_attachments_for_issue'), $t_attachment_count, $p_bug->id); if (config_get('show_attachment_indicator')) { $t_alt_text = $t_attachment_count . lang_get('word_separator') . lang_get('attachments'); echo "<a href=\"{$t_href}\" title=\"{$t_href_title}\"><img src=\"{$t_icon_path}attachment.png\" alt=\"{$t_alt_text}\" title=\"{$t_alt_text}\" /></a>"; } else { echo "<a href=\"{$t_href}\" title=\"{$t_href_title}\">{$t_attachment_count}</a>"; } } else { echo ' '; } echo "</td>\n"; }
?> <td class="center" valign="top" width ="0" nowrap="nowrap"> <span class="small"> <?php print_bug_link($t_bug->id); echo '<br />'; if (!bug_is_readonly($t_bug->id) && access_has_bug_level($t_update_bug_threshold, $t_bug->id)) { echo '<a href="' . string_get_bug_update_url($t_bug->id) . '"><img border="0" src="' . $t_icon_path . 'update.png' . '" alt="' . lang_get('update_bug_button') . '" /></a>'; } if (ON == config_get('show_priority_text')) { print_formatted_priority_string($t_bug); } else { print_status_icon($t_bug->priority); } if ($t_attachment_count > 0) { $t_href = string_get_bug_view_url($t_bug->id) . '#attachments'; $t_href_title = sprintf(lang_get('view_attachments_for_issue'), $t_attachment_count, $t_bug->id); $t_alt_text = $t_attachment_count . lang_get('word_separator') . lang_get('attachments'); echo "<a href=\"{$t_href}\" title=\"{$t_href_title}\"><img src=\"{$t_icon_path}attachment.png\" alt=\"{$t_alt_text}\" title=\"{$t_alt_text}\" /></a>"; } if (VS_PRIVATE == $t_bug->view_state) { echo '<img src="' . $t_icon_path . 'protected.gif" width="8" height="15" alt="' . lang_get('private') . '" />'; } ?> </span> </td> <?php # -- Summary -- ?> <td class="left" valign="top" width="100%">
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; } }
?> "><?php echo '<h2 style="background-color:' . $column['color'] . '">' . $title . ' (' . $t_bug_count . ')'; if ($column['wip_limit'] > 0) { echo " Limit: " . $column['wip_limit']; } echo ' </h2>'; if (!empty($rows)) { $i = 0; foreach ($rows as $row) { if ($i < 150) { $t_bug = $row; echo '<div data-userid="' . $t_current_user_id . '" data-ticketid="' . $t_bug->id . '" data-projectid="' . $t_bug->project_id . '" class="card ' . ($i % 2 == 1 ? 'cardOdd' : 'cardEven') . ' card' . category_full_name($t_bug->category_id, false) . '">'; echo icon_get_status_icon($t_bug->priority); echo ' <a href="' . string_get_bug_view_url($t_bug->id) . '" class="bugLink">' . string_display_line_links($t_bug->summary) . '</a>'; echo ' <a href="' . string_get_bug_view_url($t_bug->id) . '" class="bugLink right"> #' . $t_bug->id . '</a>'; $priority = get_enum_element('priority', $t_bug->priority); /* echo '<div class="info">'; echo '<img src="images/plus.png" alt="'.$bug_desc_title.'" title="'.$bug_desc_title.'" border="0"/>'; echo bug_get_text_field($t_bug->id, 'description'); echo string_display_line_links( $t_bug->summary ); echo project_get_name( $t_bug->project_id ); if( !bug_is_readonly( $t_bug->id ) && access_has_bug_level( $t_update_bug_threshold, $t_bug->id ) ) { echo '<a href="' . string_get_bug_update_url( $t_bug->id ) . '"><img border="0" src="plugins/MantisKanban/files/pencil.png' . '" alt="' . lang_get( 'update_bug_button' ) . '" /></a>'; echo '<br>' . kanban_ajax_button_bug_change_status( $t_bug->id, $t_bug->project_id, $t_current_user_id ); } // Check for attachments $t_attachment_count = 0; if(( file_can_view_bug_attachments( $t_bug->id ) ) ) {
} if (!file_allow_bug_upload($f_bug_id)) { access_denied(); } access_ensure_bug_level(config_get('upload_bug_file_threshold'), $f_bug_id); // Process array of files to upload for ($i = 0; $i < count($f_files); $i++) { if (!empty($f_files[$i]['name'])) { $t_file['name'] = $f_files[$i]['name']; $t_file['tmp_name'] = $f_files[$i]['tmp_name']; $t_file['type'] = $f_files[$i]['type']; $t_file['error'] = $f_files[$i]['error']; $t_file['size'] = $f_files[$i]['size']; file_add($f_bug_id, $t_file, 'bug'); } } form_security_purge('bug_file_add'); # Determine which view page to redirect back to. $t_redirect_url = string_get_bug_view_url($f_bug_id); html_page_top(null, $t_redirect_url); ?> <br /> <div align="center"> <?php echo lang_get('operation_successful') . '<br />'; print_bracket_link($t_redirect_url, lang_get('proceed')); ?> </div> <?php html_page_bottom();
if (VS_PRIVATE == $t_bug->view_state) { echo '<img src="' . $t_icon_path . 'protected.gif" width="8" height="15" alt="' . lang_get('private') . '" />'; } ?> </span> </td> <?php # -- Summary -- ?> <td class="left my-buglist-description"> <?php if (ON == config_get('show_bug_project_links') && helper_get_current_project() != $t_bug->project_id) { echo '<span class="small project">[', string_display_line(project_get_name($t_bug->project_id)), '] </span>'; } $t_bug_url = string_get_bug_view_url($t_bug->id, null); $t_bug_url_title = string_html_specialchars(sprintf(lang_get('label'), lang_get('issue_id') . $t_bug->id) . lang_get('word_separator') . $t_bug->summary); echo "<span class=\"small summary\"><a href=\"{$t_bug_url}\" title=\"{$t_bug_url_title}\">{$t_summary}</a></span><br />"; ?> <?php # type project name if viewing 'all projects' or bug is in subproject echo '<span class="small category">', string_display_line(category_full_name($t_bug->category_id, true, $t_bug->project_id)), '</span>'; echo '<span class="small last-modified"> - '; if ($t_bug->last_updated > strtotime('-' . $t_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED] . ' hours')) { echo '<strong>' . $t_last_updated . '</strong>'; } else { echo $t_last_updated; } echo '</span>'; ?> </td>
} $result = email_bug_reminder( $f_to, $f_bug_id, $f_body ); # Add reminder as bugnote if store reminders option is ON. if ( ON == config_get( 'store_reminders' ) ) { if ( count( $f_to ) > 50 ) { # too many recipients to log, truncate the list $t_to = array(); for ( $i=0; $i<50; $i++ ) { $t_to[] = $f_to[$i]; } $f_to = $t_to; } $t_attr = '|' . implode( '|', $f_to ) . '|'; bugnote_add( $f_bug_id, $f_body, 0, config_get( 'default_reminder_view_status' ) == VS_PRIVATE, REMINDER, $t_attr, NULL, FALSE ); } form_security_purge( 'bug_reminder' ); html_page_top( null, string_get_bug_view_url( $f_bug_id ) ); ?> <br /> <div> <?php echo lang_get( 'operation_successful' ).'<br />'; print_bracket_link( string_get_bug_view_url( $f_bug_id ), lang_get( 'proceed' ) ); ?> </div> <?php html_page_bottom();
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Notes: Based on the Time Tracking plugin by Elmar: 2005 by Elmar Schumacher - GAMBIT Consulting GmbH http://www.mantisbt.org/forums/viewtopic.php?f=4&t=589 */ form_security_validate('plugin_TimeTracking_delete_record'); $f_bug_id = gpc_get_int('bug_id'); $f_delete_id = gpc_get_int('delete_id'); $table = plugin_table('data', 'TimeTracking'); $query_pull_timerecords = "SELECT * FROM {$table} WHERE id = {$f_delete_id} ORDER BY timestamp DESC"; $result_pull_timerecords = db_query($query_pull_timerecords); $row = db_fetch_array($result_pull_timerecords); $t_user_id = auth_get_current_user_id(); if ($row[user] == $t_user_id) { access_ensure_bug_level(plugin_config_get('admin_own_threshold'), $f_bug_id); } else { access_ensure_bug_level(plugin_config_get('admin_threshold'), $f_bug_id); } $query_delete = "DELETE FROM {$table} WHERE id = {$f_delete_id}"; db_query($query_delete); history_log_event_direct($f_bug_id, plugin_lang_get('history') . " " . plugin_lang_get('deleted'), date(config_get("short_date_format"), strtotime($row["expenditure_date"])) . ": " . number_format($row["hours"], 2, ',', '.') . " h.", "deleted", $user); form_security_purge('plugin_TimeTracking_delete_record'); $t_url = string_get_bug_view_url($f_bug_id, auth_get_current_user_id()); print_successful_redirect($t_url . "#timerecord");
?> <table> <thead> <tr> <td class="form-title" colspan="3"> <input type="hidden" name="bug_id" value="<?php echo $t_bug_id; ?> " /> <?php echo lang_get('updating_bug_advanced_title'); ?> </td> <td class="right" colspan="3"> <?php print_bracket_link(string_get_bug_view_url($t_bug_id), lang_get('back_to_bug_link')); ?> </td> </tr> <?php # Submit Button if ($t_top_buttons_enabled) { ?> <tr> <td class="center" colspan="6"> <input ', helper_get_tab_index(), ' type="submit" class="button" value="', lang_get( 'update_information_button' ), '" /> </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; } }
require_api('event_api.php'); require_api('form_api.php'); require_api('gpc_api.php'); require_api('print_api.php'); require_api('string_api.php'); form_security_validate('bugnote_update'); $f_bugnote_id = gpc_get_int('bugnote_id'); $f_bugnote_text = gpc_get_string('bugnote_text', ''); $f_time_tracking = gpc_get_string('time_tracking', '0:00'); # Check if the current user is allowed to edit the bugnote $t_user_id = auth_get_current_user_id(); $t_reporter_id = bugnote_get_field($f_bugnote_id, 'reporter_id'); if ($t_user_id == $t_reporter_id) { access_ensure_bugnote_level(config_get('bugnote_user_edit_threshold'), $f_bugnote_id); } else { access_ensure_bugnote_level(config_get('update_bugnote_threshold'), $f_bugnote_id); } # Check if the bug is readonly $t_bug_id = bugnote_get_field($f_bugnote_id, 'bug_id'); if (bug_is_readonly($t_bug_id)) { error_parameters($t_bug_id); trigger_error(ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR); } $f_bugnote_text = trim($f_bugnote_text) . "\n\n"; bugnote_set_text($f_bugnote_id, $f_bugnote_text); bugnote_set_time_tracking($f_bugnote_id, $f_time_tracking); # Plugin integration event_signal('EVENT_BUGNOTE_EDIT', array($t_bug_id, $f_bugnote_id)); form_security_purge('bugnote_update'); print_successful_redirect(string_get_bug_view_url($t_bug_id) . '#bugnotes');
function relgraph_generate_dep_graph($p_bug_id, $p_bug = null, $p_horizontal = false) { # List of visited issues and their data. $v_bug_list = array(); # Firstly, we visit all ascendant issues and all descendant issues # and collect all the necessary data in the $v_bug_list variable. # We do not visit other descendants of our parents, neither other # ascendants of our children, to avoid displaying too much unrelated # issues. We still collect the information about those relationships, # so, if these issues happen to be visited also, relationship links # will be preserved. # The first issue in the list is the one we are parting from. if (null === $p_bug) { $p_bug = bug_get($p_bug_id, true); } $v_bug_list[$p_bug_id] = $p_bug; $v_bug_list[$p_bug_id]->is_descendant = true; $v_bug_list[$p_bug_id]->parents = array(); $v_bug_list[$p_bug_id]->children = array(); # Now we visit all ascendants of the root issue. $t_relationships = relationship_get_all_dest($p_bug_id); foreach ($t_relationships as $t_relationship) { if ($t_relationship->type != BUG_DEPENDANT) { continue; } $v_bug_list[$p_bug_id]->parents[] = $t_relationship->src_bug_id; relgraph_add_parent($v_bug_list, $t_relationship->src_bug_id); } $t_relationships = relationship_get_all_src($p_bug_id); foreach ($t_relationships as $t_relationship) { if ($t_relationship->type != BUG_DEPENDANT) { continue; } $v_bug_list[$p_bug_id]->children[] = $t_relationship->dest_bug_id; relgraph_add_child($v_bug_list, $t_relationship->dest_bug_id); } # We have already collected all the information we need to generate # the graph. Now it is the matter to create a Digraph object and # store the information there, along with graph formatting attributes. $t_id_string = relgraph_bug_format_id($p_bug_id); $t_graph_fontname = config_get('relationship_graph_fontname'); $t_graph_fontsize = config_get('relationship_graph_fontsize'); $t_graph_fontpath = get_font_path(); $t_view_on_click = config_get('relationship_graph_view_on_click'); $t_dot_tool = config_get('dot_tool'); $t_graph_attributes = array(); if (!empty($t_graph_fontpath)) { $t_graph_attributes['fontpath'] = $t_graph_fontpath; } if ($p_horizontal) { $t_graph_attributes['rankdir'] = 'LR'; $t_graph_orientation = 'horizontal'; } else { $t_graph_orientation = 'vertical'; } $t_graph = new Digraph($t_id_string, $t_graph_attributes, $t_dot_tool); $t_graph->set_default_node_attr(array('fontname' => $t_graph_fontname, 'fontsize' => $t_graph_fontsize, 'shape' => 'record', 'style' => 'filled', 'height' => '0.2', 'width' => '0.4')); $t_graph->set_default_edge_attr(array('style' => 'solid', 'color' => '#C00000', 'dir' => 'back')); # Add all issue nodes and edges to the graph. foreach ($v_bug_list as $t_related_bug_id => $t_related_bug) { $t_id_string = relgraph_bug_format_id($t_related_bug_id); if ($t_view_on_click) { $t_url = string_get_bug_view_url($t_related_bug_id); } else { $t_url = "bug_relationship_graph.php?bug_id={$t_related_bug_id}&graph=dependency&orientation={$t_graph_orientation}"; } relgraph_add_bug_to_graph($t_graph, $t_id_string, $t_related_bug, $t_url, $t_related_bug_id == $p_bug_id); # Now add all relationship edges to the graph. foreach ($v_bug_list[$t_related_bug_id]->parents as $t_parent_id) { # Do not create edges for unvisited bugs. if (!isset($v_bug_list[$t_parent_id])) { continue; } $t_parent_node = relgraph_bug_format_id($t_parent_id); $t_graph->add_edge($t_parent_node, $t_id_string); } } return $t_graph; }
function print_column_attachment($p_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE) { global $t_icon_path; $t_show_attachments = config_get('show_attachment_indicator'); # Check for attachments $t_attachment_count = 0; if (ON == $t_show_attachments && file_can_view_bug_attachments($p_row['id'])) { $t_attachment_count = file_bug_attachment_count($p_row['id']); } if (ON == $t_show_attachments) { echo "\t<td>"; if (0 < $t_attachment_count) { echo '<a href="' . string_get_bug_view_url($p_row['id']) . '#attachments">'; echo '<img border="0" src="' . $t_icon_path . 'attachment.png' . '"'; echo ' alt="' . lang_get('attachment_alt') . '"'; echo ' title="' . $t_attachment_count . ' ' . lang_get('attachments') . '"'; echo ' />'; echo '</a>'; } else { echo ' '; } echo "</td>\n"; } }
email_relationship_added($f_master_bug_id, $t_bug_id, relationship_get_complementary_type($f_rel_type)); } } email_new_bug($t_bug_id); helper_call_custom_function('issue_create_notify', array($t_bug_id)); html_page_top1(); if (!$f_report_stay) { html_meta_redirect('view_all_bug_page.php'); } html_page_top2(); ?> <br /> <div align="center"> <?php echo lang_get('operation_successful') . '<br />'; print_bracket_link(string_get_bug_view_url($t_bug_id), lang_get('view_submitted_bug_link') . " {$t_bug_id}"); print_bracket_link('view_all_bug_page.php', lang_get('view_bugs_link')); if ($f_report_stay) { ?> <p> <form method="post" action="<?php echo string_get_bug_report_url(); ?> "> <input type="hidden" name="category" value="<?php echo $t_bug_data->category; ?> " /> <input type="hidden" name="severity" value="<?php echo $t_bug_data->severity; ?>
$t_bug = bug_get($t_sponsor_row['bug']); $t_sponsor = sponsorship_get($t_sponsor_row['sponsor']); $t_buglist[] = $t_sponsor_row['bug'] . ':' . $t_sponsor_row['sponsor']; # describe bug $t_status = string_attribute(get_enum_element('status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id)); $t_resolution = string_attribute(get_enum_element('resolution', $t_bug->resolution, auth_get_current_user_id(), $t_bug->project_id)); $t_version_id = version_get_id($t_bug->fixed_in_version, $t_bug->project_id); if (false !== $t_version_id && VERSION_RELEASED == version_get_field($t_version_id, 'released')) { $t_released_label = '<a title="' . lang_get('released') . '">' . $t_bug->fixed_in_version . '</a>'; } else { $t_released_label = $t_bug->fixed_in_version; } # 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); echo '<tr class="' . $t_status_label . '">'; echo '<td><a href="' . string_get_bug_view_url($t_sponsor_row['bug']) . '">' . bug_format_id($t_sponsor_row['bug']) . '</a></td>'; echo '<td>' . string_display_line(project_get_field($t_bug->project_id, 'name')) . ' </td>'; echo '<td class="right">' . $t_released_label . ' </td>'; echo '<td><a title="' . $t_resolution . '"><span class="underline">' . $t_status . '</span> </a></td>'; # summary echo '<td>' . string_display_line($t_bug->summary); if (VS_PRIVATE == $t_bug->view_state) { printf(' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get('private'), lang_get('private')); } echo '</td>'; # describe sponsorship amount echo '<td>'; print_user($t_sponsor->user_id); echo '</td>'; echo '<td class="right">' . sponsorship_format_amount($t_sponsor->amount) . '</td>'; echo '<td><select name="sponsor_' . $t_row['bug'] . '_' . $t_sponsor->id . '">';
/** * * @param BugData $p_bug bug obect * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php * @return null * @access public */ function print_column_attachment_count( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { global $t_icon_path; # Check for attachments # TODO: factor in the allow_view_own_attachments configuration option # instead of just using a global check. $t_attachment_count = 0; if( file_can_view_bug_attachments( $p_bug->id, null ) ) { $t_attachment_count = file_bug_attachment_count( $p_bug->id ); } echo '<td class="center column-attachments">'; if ( $t_attachment_count > 0 ) { $t_href = string_get_bug_view_url( $p_bug->id ) . '#attachments'; $t_href_title = sprintf( lang_get( 'view_attachments_for_issue' ), $t_attachment_count, $p_bug->id ); if ( config_get( 'show_attachment_indicator' ) ) { $t_alt_text = $t_attachment_count . lang_get( 'word_separator' ) . lang_get( 'attachments' ); echo "<a href=\"$t_href\" title=\"$t_href_title\"><img src=\"${t_icon_path}attachment.png\" alt=\"$t_alt_text\" title=\"$t_alt_text\" /></a>"; } else { echo "<a href=\"$t_href\" title=\"$t_href_title\">$t_attachment_count</a>"; } } else { echo '   '; } echo "</td>\n"; }
/** * Print column content for column attachment count * * @param BugData $p_bug bug object * @param int $p_columns_target see COLUMNS_TARGET_* in constant_inc.php * @return null * @access public */ function print_column_attachment_count($p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE) { global $t_icon_path; # Check for attachments $t_attachment_count = 0; if (file_can_view_bug_attachments($p_bug->id, null)) { $t_attachment_count = file_bug_attachment_count($p_bug->id); } echo '<td class="column-attachments">'; if ($t_attachment_count > 0) { $t_href = string_get_bug_view_url($p_bug->id) . '#attachments'; $t_href_title = sprintf(lang_get('view_attachments_for_issue'), $t_attachment_count, $p_bug->id); echo "<a href=\"{$t_href}\" title=\"{$t_href_title}\">{$t_attachment_count}</a>"; } else { echo '   '; } echo "</td>\n"; }
/** * * @param string $p_name * @param array<string> $p_params */ function generateLog($p_name, $p_params = array()){ $bug_arr = $p_params; $bug_list = "(".implode(',', $bug_arr).")"; $mantis_bug_table = db_get_table('mantis_bug_table'); $mantis_version_table = db_get_table('mantis_project_version_table'); $query = " SELECT bt.id,bt.summary,bt.fixed_in_version as version,vt.description FROM $mantis_bug_table as bt LEFT JOIN $mantis_version_table as vt ON vt.project_id=bt.project_id AND vt.version=bt.fixed_in_version WHERE bt.id IN $bug_list ORDER BY bt.project_id,version,bt.id"; $result = db_query_bound($query); $versions = array(); while($row = db_fetch_array($result) ){ $versions[$row['version']]['version_description'] = $row['description']; $versions[$row['version']]['bugs'][] = array( "id" =>$row['id'], "summary" =>$row['summary'],); } $t_generated_log = ""; $t_tpl_version = plugin_config_get('log_template_ver'); $t_tpl_bug = plugin_config_get('log_template_bug'); foreach($versions as $verName => $verData){ $current_version = $t_tpl_version; $current_version = str_replace('{version_name}', $verName, $current_version); $current_version = str_replace('{version_description}', $verData['description'], $current_version); $bugs = ""; foreach($verData['bugs'] as $bug){ $current_bug = $t_tpl_bug; $current_bug = str_replace('{bug_id}', $bug['id'], $current_bug); $current_bug = str_replace('{bug_summary}', $bug['summary'], $current_bug); $current_bug = str_replace('{bug_url}', config_get_global( 'path' ).string_get_bug_view_url($bug['id']), $current_bug); $bugs .= $current_bug; } $current_version = str_replace('{bug_list}', $bugs, $current_version); $t_generated_log .= $current_version; } require_once 'pages/generateLog.php'; }