} // Authenticate bugs_authenticate($user, $pw, $logged_in, $user_flags); $is_trusted_developer = $user_flags & BUGS_TRUSTED_DEV; $canpatch = $logged_in == 'developer'; $revision = isset($_GET['revision']) ? $_GET['revision'] : null; $patch_name = isset($_GET['patch']) ? $_GET['patch'] : null; if ($patch_name) { $patch_name_url = urlencode($patch_name); } $bug_id = !empty($_GET['bug']) ? (int) $_GET['bug'] : 0; if (empty($bug_id)) { $bug_id = (int) $_GET['bug_id']; } require "{$ROOT_DIR}/include/classes/bug_patchtracker.php"; $patchinfo = new Bug_Patchtracker(); if (!($buginfo = bugs_get_bug($bug_id))) { response_header('Error :: invalid bug selected'); display_bug_error("Invalid bug #{$bug_id} selected"); response_footer(); exit; } if (!bugs_has_access($bug_id, $buginfo, $pw, $user_flags)) { response_header('Error :: No access to bug selected'); display_bug_error("You have no access to bug #{$bug_id}"); response_footer(); exit; } $pseudo_pkgs = get_pseudo_packages(false); if (isset($patch_name) && isset($revision)) { if ($revision == 'latest') {
// Display original report if ($bug['ldesc']) { if (!$show_bug_info) { echo 'This bug report is marked as private.'; } 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; }
status, ts1, private, visitor_ip ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, "Open", NOW(), ?, INET_ATON(?)) ')->execute(array($package_name, $_POST['in']['bug_type'], $_POST['in']['email'], $_POST['in']['sdesc'], $fdesc, $_POST['in']['php_version'], $_POST['in']['php_os'], bugs_get_hash($_POST['in']['passwd']), $_POST['in']['reporter_name'], $_POST['in']['private'], $_SERVER['REMOTE_ADDR'])); if (PEAR::isError($res)) { echo "<pre>"; var_dump($_POST['in'], $fdesc, $package_name); die($res->getMessage()); } $cid = $dbh->lastInsertId(); $redirectToPatchAdd = false; if (!empty($_POST['in']['patchname']) && $_POST['in']['patchname']) { require_once "{$ROOT_DIR}/include/classes/bug_patchtracker.php"; $tracker = new Bug_Patchtracker(); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $patchrevision = $tracker->attach($cid, 'patchfile', $_POST['in']['patchname'], $_POST['in']['handle'], array()); PEAR::staticPopErrorHandling(); if (PEAR::isError($patchrevision)) { $redirectToPatchAdd = true; } } if (empty($_POST['in']['handle'])) { $mailfrom = spam_protect($_POST['in']['email'], 'text'); } else { $mailfrom = $_POST['in']['handle']; } $report = <<<REPORT From: {$mailfrom} Operating system: {$_POST['in']['php_os']}
bugs_authenticate($user, $pw, $logged_in, $user_flags); $is_trusted_developer = $user_flags & BUGS_TRUSTED_DEV; // captcha is not necessary if the user is logged in if (!$logged_in) { require_once 'Text/CAPTCHA/Numeral.php'; $numeralCaptcha = new Text_CAPTCHA_Numeral(); } $show_bug_info = bugs_has_access($bug_id, $buginfo, $pw, $user_flags); if (!$show_bug_info) { response_header('Private report'); display_bug_error("The bug #{$bug_id} is not available to public"); response_footer(); exit; } require_once "{$ROOT_DIR}/include/classes/bug_patchtracker.php"; $patchinfo = new Bug_Patchtracker(); $patch_name = !empty($_GET['patchname']) && is_string($_GET['patchname']) ? $_GET['patchname'] : ''; $patch_name = !empty($_POST['name']) && is_string($_POST['name']) ? $_POST['name'] : $patch_name; $patch_name_url = urlencode($patch_name); if (isset($_POST['addpatch'])) { if (!isset($_POST['obsoleted'])) { $_POST['obsoleted'] = array(); } // Check that patch name is given (required always) if (empty($patch_name)) { $patches = $patchinfo->listPatches($bug_id); $errors[] = 'No patch name entered'; include "{$ROOT_DIR}/templates/addpatch.php"; exit; } if (!$logged_in) {