if (!empty($ncomment)) { $res = bugs_add_comment($bug_id, $from, $comment_name, $ncomment, 'comment'); mark_related_bugs($from, $comment_name, $ncomment); } } } 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}"); } switch (txfield('bug_type', $bug, isset($_POST['in']) ? $_POST['in'] : null)) { case 'Feature/Change Request': $bug_type = 'Request'; break; case 'Documentation Problem': $bug_type = 'Doc Bug'; break; case 'Security': $bug_type = 'Sec Bug'; break; default: case 'Bug': $bug_type = 'Bug';
// 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();
/* 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; } } echo json_encode(array('result' => array('error' => 'Nothing to do')));
$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";
exit; } } 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']) && $ncomment || $previous != $current)) { if (!$errors) { if (!isset($buggie)) { mail_bug_updates($bug, $_POST['in'], $from, $ncomment, $edit, $id, $previous, $current); } localRedirect('bug.php' . "?id={$id}&thanks={$edit}"); exit; } } switch ($bug['bug_type']) { case 'Bug': $bug_type = 'Bug'; break; case 'Feature/Change Request': $bug_type = 'Request'; break; case 'Documentation Problem': $bug_type = 'Doc Bug'; break;