header('Content-type: application/octet-stream'); header('Content-disposition: attachment; filename="' . $patch_name . '.patch.txt"'); header('Content-length: ' . filesize($path)); readfile($path); exit; } $patchcontents = $patchinfo->getPatch($buginfo['id'], $patch_name, $revision); if (PEAR::isError($patchcontents)) { response_header('Error :: Cannot retrieve patch'); display_bug_error('Internal error: Invalid patch/revision specified (is in database, but not in filesystem)'); response_footer(); exit; } $package_name = $buginfo['package_name']; $handle = $patchinfo->getDeveloper($bug_id, $patch_name, $revision); $obsoletedby = $patchinfo->getObsoletingPatches($bug_id, $patch_name, $revision); $obsoletes = $patchinfo->getObsoletePatches($bug_id, $patch_name, $revision); $patches = $patchinfo->listPatches($bug_id); $revisions = $patchinfo->listRevisions($bug_id, $patch_name); response_header("Bug #{$bug_id} :: Patches"); include "{$ROOT_DIR}/templates/listpatches.php"; if (isset($_GET['diff']) && $_GET['diff'] && isset($_GET['old']) && is_numeric($_GET['old'])) { $old = $patchinfo->getPatchFullpath($bug_id, $patch_name, $_GET['old']); $new = $path; if (!realpath($old) || !realpath($new)) { response_header('Error :: Cannot retrieve patch'); display_bug_error('Internal error: Invalid patch revision specified for diff'); response_footer(); exit; } require_once "{$ROOT_DIR}/include/classes/bug_diff_renderer.php";
} else { if ($bug['status'] !== 'Spam') { output_note(0, $bug['submitted'], $bug['email'], $bug['ldesc'], 'comment', $bug['reporter_name'], false); } else { echo 'The original report has been hidden, due to the SPAM status.'; } } } // Display patches if ($show_bug_info && $bug_id != 'PREVIEW' && $bug['status'] !== 'Spam') { require_once "{$ROOT_DIR}/include/classes/bug_patchtracker.php"; $patches = new Bug_Patchtracker(); $p = $patches->listPatches($bug_id); echo "<h2>Patches</h2>\n"; foreach ($p as $name => $revisions) { $obsolete = $patches->getObsoletingPatches($bug_id, $name, $revisions[0][0]); $style = !empty($obsolete) ? ' style="background-color: yellow; text-decoration: line-through;" ' : ''; $url_name = urlencode($name); $clean_name = clean($name); $formatted_date = format_date($revisions[0][0]); $submitter = spam_protect($revisions[0][1]); echo <<<OUTPUT <a href="patch-display.php?bug_id={$bug_id}&patch={$url_name}&revision=latest" {$style}>{$clean_name}</a> (last revision {$formatted_date}) by {$submitter}) <br> OUTPUT; } echo "<p><a href='patch-add.php?bug_id={$bug_id}'>Add a Patch</a></p>"; require_once "{$ROOT_DIR}/include/classes/bug_ghpulltracker.php"; $pulltracker = new Bug_Pulltracker(); $pulls = $pulltracker->listPulls($bug_id);