if (!$revision || !$patch || !$id) { header('HTTP/1.0 400 Bad Request'); header('Content-Type: text/plain'); response_header('Error :: File does not exist'); report_error('Please specify id, patch and revision'); response_footer(); exit; } require_once 'bugs/patchtracker.php'; $pt = new Bugs_Patchtracker(); if (!$pt->isPatchValid($id, $patch, $revision)) { header('HTTP/1.0 404 Not Found'); response_header('Error :: Patch not found'); report_error('Patch or revision does not exist'); response_footer(); exit; } $path = $pt->getPatchFullpath($id, $patch, $revision); if (!file_exists($path)) { header('HTTP/1.0 404 Not Found'); response_header('Error :: File does not exist'); report_error('File does not exist on server'); response_footer(); exit; } require_once 'HTTP.php'; header('Last-modified: ' . HTTP::date(filemtime($path))); header('Content-type: application/octet-stream'); header('Content-disposition: attachment; filename="' . $patch . '.patch.txt"'); header('Content-length: ' . filesize($path)); readfile($path);
$bug = $buginfo['id']; $patches = $patchinfo->listPatches($bug); $canpatch = auth_check('pear.bug') || auth_check('pear.dev'); response_header('Bug #' . clean($bug) . ' :: Patches'); include PEARWEB_TEMPLATEDIR . '/bugs/listpatches.php'; response_footer(); exit; } if ($revision == 'latest') { //fix revision number $revisions = $patchinfo->listRevisions($buginfo['id'], $patch); if (isset($revisions[0])) { $revision = $revisions[0][0]; } } $path = $patchinfo->getPatchFullpath($bug_id, $patch, $revision); if (!file_exists($path)) { response_header('Error :: no such patch/revision'); report_error('Invalid patch/revision specified'); response_footer(); exit; } if ($patchinfo->userNotRegistered($bug_id, $patch, $revision)) { response_header('User has not confirmed identity'); report_error('The user who submitted this patch has not yet confirmed ' . 'their email address. '); echo '<p>If you submitted this patch, please check your email.</p>' . '<p><strong>If you do not have a confirmation message</strong>, <a href="resend-request-email.php?' . 'handle=' . urlencode($patchinfo->getDeveloper($bug_id, $patch, $revision)) . '">click here to re-send</a> or write a message to' . ' <a href="mailto:' . PEAR_DEV_EMAIL . '">' . PEAR_DEV_EMAIL . '</a> asking for manual approval of your account.</p>'; response_footer(); exit; } if (isset($_GET['download'])) { /**