if ($accept) { // Get the old requirements $before = $projinfo["reqmts"]; $oldseq = $projinfo["reqmts_seq"]; // Get the diff $body = $postinfo["body"]; if (!ereg("\n/-/-/-/-/-begin-diff-/-/-/-/-/\n(.*)\$", $body, $args)) { return array(4, "The given post doesn't contain a diff: {$post}"); } $diff = $args[1]; // Apply the diff include_once "diff.php"; list($rc, $after) = patchText($before, $diff); if ($rc) { error($rc, $after); } //we make the file names linkable if (sizeof($attachments) > 0) { list($rc, $after) = ff_attachtobody($project, $after); } list($rc, $err) = ff_setprojectreqmts($username, $project, $oldseq, $after, $subject, $post, $postinfo['attachments']); if ($rc) { error($rc, $err); } } else { list($rc, $err) = ff_rejectreqmtschange($username, $project, $subject, $post); if ($rc) { error($rc, $err); } } header("Location: " . projurl($GLOBALS["project"]));
function show_body($topicid, $post, $openids = false) { $body = $post["body"]; $diff = ''; if (ereg("^(.*)\n/-/-/-/-/-begin-diff-/-/-/-/-/\n(.*)\$", $body, $args)) { $body = $args[1]; $diff = $args[2]; } $body = linkify(str_replace("\n", "<br />\n", trim(htmlentities($body)))); //check if post has attachments if (sizeof($post['attachments']) > 0) { list($rc, $body) = ff_attachtobody($post['id'], $body); } print $body; if ($diff) { include_once "diff.php"; print "<hr>\n"; print formatDiff($diff); } if (sizeof($post['attachments']) > 0) { print "<br>\n"; print "<b>attachments:</b><br>\n"; list($rc, $err) = ff_listattachments($post['id']); } $subject = $post["subject"]; $subject = ereg_replace("^[rR][eE]:? *", "", $subject); $subject = "Re: {$subject}"; print "<br>\n"; print "<div class=postfooter>"; print "[ <a href=\"javascript:inlinepost('{$topicid}','{$post['id']}','{$topicid}_field{$post['id']}','" . htmlentities(jsencode("Re: " . ereg_replace("^[rR][eE]:? *", "", $post["subject"]))) . "','{$GLOBALS['username']}')\">Reply to This</a> ]"; // If the post status is pending and the lead is viewing, // offer the Accept / Reject options. if ($post['status'] == 'pending') { $projectid = substr($post['topicid'], 6); list($rc, $projinfo) = ff_getprojectinfo($projectid); if ($GLOBALS['username'] == $projinfo['lead'] && $GLOBALS['username'] !== "") { // If a requirements change dispute is deliberating then // the lead can't accept this proposal. list($rc, $disputes) = ff_getprojectdisputes($projectid); if ($rc) { $disputes = array(); } $canaccept = 1; foreach ($disputes as $dispute) { if ($dispute["type"] == 'badchange' && $dispute["status"] == 'deliberating') { $canaccept = 0; break; } } print "[ <a href=\"handlechange.php?project={$projectid}&accept=1&post={$post['id']}\"" . ($canaccept ? "" : " onClick=\"alert('You can\\'t accept requirements changes while a\\nchange dispute is in deliberation. Please try again later.');return false\"") . "> Accept </a> ]"; print "[ <a href=\"handlechange.php?project={$projectid}&accept=0&post={$post['id']}\"> Reject </a> ]"; } } print "</div>"; print "<div id={$topicid}_field{$post['id']}></div>"; print "<div id={$topicid}_attachment{$post['id']} align='right'></div>"; if (sizeof($post["children"])) { print "<div class=postindent>"; show_thread($topicid, $post["children"], 0, $openids); print "</div>\n"; } }