function mark_related_bugs($from, $comment_name, $ncomment) { global $bug_id; $related = get_ticket_links($ncomment); /** * Adds a new comment on the related bug pointing to the current report */ foreach ($related as $bug) { bugs_add_comment($bug, $from, $comment_name, 'Related To: Bug #' . $bug_id, 'related'); } }
// Standard items $in = array('status' => $status, 'bug_type' => $bug['bug_type'], 'php_version' => $bug['php_version'], 'php_os' => $bug['php_os'], 'assign' => $bug['assign']); // Assign automatically when closed if ($status == 'Closed' && $in['assign'] == '') { $in['assign'] = $auth_user->handle; } // Update bug $dbh->prepare("\n\tUPDATE bugdb\n\tSET\n\t\tstatus = ?,\n\t\tassign = ?,\n\t\tts2 = NOW()\n\tWHERE id = ?\n")->execute(array($status, $in['assign'], $bug_id)); // Add changelog entry if (!PEAR::isError($res)) { $changed = bug_diff($bug, $in); if (!empty($changed)) { $log_comment = bug_diff_render_html($changed); if (!empty($log_comment)) { $res = bugs_add_comment($bug_id, $auth_user->email, $auth_user->name, $log_comment, 'log'); } } } // Add possible comment if (!PEAR::isError($res) && !empty($ncomment)) { $res = bugs_add_comment($bug_id, $auth_user->email, $auth_user->name, $ncomment, 'comment'); } // Send emails if (!PEAR::isError($res)) { mail_bug_updates($bug, $in, $auth_user->email, $ncomment); redirect("bug.php?id={$bug_id}&thanks=1"); } // If we end up here, something went wrong. response_header('Resolve Bug: Problem'); display_bug_error($res); response_footer();
/* svn log comment */ $res = bugs_add_comment($bug_id, $from, $user, $ncomment, 'svn'); if ($res) { /* Close the bug report as requested if it is not already closed */ if (!empty($_POST['status']) && $bug['status'] !== 'Closed' && $_POST['status'] === 'Closed') { /* Change the bug status to Closed */ bugs_status_change($bug_id, 'Closed'); $in = $bug; /* Just change the bug status */ $in['status'] = $_POST['status']; $changed = bug_diff($bug, $in); if (!empty($changed)) { $log_comment = bug_diff_render_html($changed); if (!empty($log_comment)) { /* Add a log of status change */ $res = bugs_add_comment($bug_id, $from, '', $log_comment, 'log'); } } /* Send a mail notification when automatically closing a bug */ mail_bug_updates($bug, $in, $from, $ncomment, 1, $bug_id); } echo json_encode(array('result' => array('status' => $bug))); exit; } else { echo json_encode(array('result' => array('error' => MDB2::errorMessage($res)))); exit; } } else { if (!empty($_POST['getbug'])) { echo json_encode(array('result' => array('status' => $bug))); exit;
$email = $auth_user->email; } PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $e = $patchinfo->attach($bug_id, 'patch', $patch_name, $auth_user->email, $_POST['obsoleted']); PEAR::popErrorHandling(); if (PEAR::isError($e)) { $patches = $patchinfo->listPatches($bug_id); $errors = array($e->getMessage(), 'Could not attach patch "' . htmlspecialchars($patch_name) . '" to Bug #' . $bug_id); include "{$ROOT_DIR}/templates/addpatch.php"; exit; } // Add a comment to the bug report. $patch_url = "{$site_method}://{$site_url}{$basedir}/patch-display.php?bug={$bug_id}&patch={$patch_name_url}&revision={$e}"; $text = <<<TXT The following patch has been added/updated: Patch Name: {$patch_name} Revision: {$e} URL: {$patch_url} TXT; $res = bugs_add_comment($bug_id, $auth_user->email, $auth_user->name, $text, 'patch'); // Send emails mail_bug_updates($buginfo, $buginfo, $auth_user->email, $text, 4, $bug_id); $patches = $patchinfo->listPatches($bug_id); $errors = array(); include "{$ROOT_DIR}/templates/patchadded.php"; exit; } $email = isset($_GET['email']) ? $_GET['email'] : ''; $patches = $patchinfo->listPatches($bug_id); include "{$ROOT_DIR}/templates/addpatch.php";
// Assign automatically when closed if ($status == 'Closed' && $_POST['in']['assign'] == '') { $_POST['in']['assign'] = $auth_user->handle; } $dbh->prepare($query . "\n\t\t\t\tsdesc = ?, \n\t\t\t\tstatus = ?, \n\t\t\t\tpackage_name = ?,\n\t\t\t\tbug_type = ?,\n\t\t\t\tassign = ?,\n\t\t\t\tphp_version = ?,\n\t\t\t\tphp_os = ?,\n\t\t\t\tblock_user_comment = ?,\n\t\t\t\tcve_id = ?,\n\t\t\t\tprivate = ?,\n\t\t\t\tts2 = NOW()\n\t\t\tWHERE id = {$bug_id}\n\t\t")->execute(array($_POST['in']['sdesc'], $status, $_POST['in']['package_name'], $_POST['in']['bug_type'], $_POST['in']['assign'], $_POST['in']['php_version'], $_POST['in']['php_os'], $block_user, $_POST['in']['cve_id'], $is_private)); // Add changelog entry $changed = bug_diff($bug, $_POST['in']); if (!empty($changed)) { $log_comment = bug_diff_render_html($changed); if (!empty($log_comment)) { $res = bugs_add_comment($bug_id, $from, $comment_name, $log_comment, 'log'); } } // Add normal comment if (!empty($ncomment)) { $res = bugs_add_comment($bug_id, $from, $comment_name, $ncomment, 'comment'); } } } elseif (isset($_POST['in']) && isset($_POST['preview']) && $edit == 1) { $ncomment = trim($_POST['ncomment']); $from = $auth_user->email; } elseif (isset($_POST['in'])) { $errors[] = 'Invalid edit mode.'; $ncomment = ''; } else { $ncomment = ''; } if (isset($_POST['in']) && !isset($_POST['preview']) && !$errors) { mail_bug_updates($bug, $_POST['in'], $from, $ncomment, $edit, $bug_id); redirect("bug.php?id={$bug_id}&thanks={$edit}"); exit;