function show_dispute($id) { list($rc, $projinfo) = ff_getprojectinfo($id); print "<div id='disputebody'>\n"; print "<script>\n"; print "function showdispute() { document.getElementById('disputebody').innerHTML='';"; print "document.getElementById('disputebody').innerHTML='hello';"; print "}\n"; print "</script>"; list($rc, $disputes) = ff_getprojectdisputes($id); print "<table border=0 cellpadding=0 cellspacing=0 width=100%>\n"; print "<tr><td bgcolor=#e51f1f><b><font color='white'> subject</font></b></td>"; print "<td align=left bgcolor=#e51f1f><b><font color='white'>status</font></td></tr>"; foreach ($disputes as $dispute) { if ($dispute['status'] == 'plaintiff') { $status = "awaiting response from " . $dispute['plaintiff']; } elseif ($dispute['status'] == 'defendant') { $status = "awaiting response from " . $projinfo['lead']; } else { $status = $dispute['status']; } print "<tr>"; print " <td><a href='dispute.php?id=" . $dispute['disputeid'] . "'>" . htmlentities($dispute['subject'] ? $dispute['subject'] : 'No Subject') . "</a></td><td>" . ($status == 'decided' ? "<b>decided</b> " . date("M j, H:i T", $dispute["decided"]) : $status) . "</td>"; print "</tr>"; } print "</table>"; print "</div>"; }
function my_projects($username) { list($rc, $cooprojects) = ff_getleadprojects($username); if ($rc) { $cooprojects = array(); } $myprojectids = array(); // This allows an extra project to be specified in the URL if ($_REQUEST["p"]) { $myprojectids[] = $_REQUEST["p"]; } // Get the list of the projects which this user is watching. list($rc, $watches) = al_getwatches($username); if (!$rc) { foreach ($watches as $watch) { if (ereg("^(p[0-9]+)-news\$", $watch["eventid"], $pieces)) { $myprojectids[] = $pieces[1]; } } } // Get the list of the projects which this user has sponsored. global $memberdonations; list($rc, $memberdonations) = ff_memberdonations($username, false); if ($rc) { $memberdonations = array(); } $myprojectids = array_merge($myprojectids, array_keys($memberdonations)); // Get the list of projects which this user is subscribed to global $subscriptions; list($rc, $subscriptions) = ff_showsubscriptions($username); if ($rc) { $subscriptions = array(); } $myprojectids = array_merge($myprojectids, array_keys($subscriptions)); list($rc, $myprojects) = ff_getprojectinfo($myprojectids); if ($rc) { $myprojects = array(); } $myprojects = array_merge($cooprojects, $myprojects); uasort($myprojects, cmp_projects); return $myprojects; }
<?php $hostname = $_SERVER["HTTP_HOST"]; if ($hostname === "www.fossfactory.org") { $hostname = "git.fossfactory.org"; } // Figure out which code repo to use, if any $repoproject = $id; $repoprojinfo = $projinfo; while ($repoprojinfo["parent"] != 0 && !file_exists("/home/git/{$repoproject}.git")) { $repoproject = "p{$repoprojinfo['parent']}"; list($rc, $repoprojinfo) = ff_getprojectinfo($repoproject); if ($rc) { softexit(); } } if (file_exists("/home/git/{$repoproject}.git")) { $repo = "git@{$hostname}:{$repoproject}"; } else { $repo = "<none>"; } ?> <div style='float:right;white-space:nowrap;border:1px solid black;background-color:#ffffd0;padding:1em'> Project ID: <b><tt><?php echo $id; ?> </tt></b><br><br> Git repository:<br><b><tt><?php echo htmlentities($repo); ?> </tt></b><br><br>
$project = scrub($_REQUEST["project"]); $post = scrub($_REQUEST["post"]); $accept = intval($_REQUEST["accept"]); function error($rc, $err) { header("Location: " . projurl($GLOBALS["project"], "err=" . urlencode("{$rc} {$err}"))); exit; } // Get the post info list($rc, $postinfo) = ff_getpostinfo($post); if ($rc) { error($rc, $postinfo); } $subject = $postinfo["subject"]; // Get the project info list($rc, $projinfo) = ff_getprojectinfo($project); if ($rc) { error($rc, $projinfo); } 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";
continue; } $s[$key] = $submission; } $submissions = $s; if ($rc || sizeof($submissions) == 0) { ?> <br> <b>No submissions have been made for this project.</b> <br> <br> <?php button("Make a Submission", "submission.php?id={$id}"); } else { // Get the current project requirements list($rc, $projectinfo) = ff_getprojectinfo($id); if ($rc) { print "Error: {$rc} {$projectinfo}"; softexit(); } ?> <script src="folder.js"></script> <table border=0 cellspacing=0 class=submissions> <?php $foundcurrent = 0; $rownum = 0; foreach ($submissions as $key => $submission) { $rownum++; $current = 0; if (!$foundcurrent && ($submission['status'] == 'accept' || $submission['status'] == 'complete' || $submission['status'] == 'pending')) { $foundcurrent = 1;
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Fossfactory-src. If not, see <http://www.gnu.org/licenses/>. */ $p = scrub($_REQUEST["p"]); $name = "{$_REQUEST['name']}"; $reqmts = "{$_REQUEST['reqmts']}"; // Assume English numbers: 1,000,000.01 OR 1 000 000.01 -> 1000000.01 $fundgoal = str_replace(array(' ', ','), '', $_REQUEST['fundgoal']); if (!$p) { exit; } list($rc, $parent) = ff_getprojectinfo($p); if ($rc) { print "System error: {$rc} {$parent}"; softexit(); } $islead = $parent["lead"] !== '' && $parent["lead"] === $GLOBALS["username"]; if (trim($name) && trim($reqmts)) { if ($_REQUEST["stopspam"] !== 'yes') { exit; } $tempdir = "{$GLOBALS['DATADIR']}/tempattachments/{$sid}"; $attachments = array(); foreach ($_REQUEST as $key => $filename) { if (!ereg("^attachment_filename_([a-zA-Z0-9]+)\$", $key, $parts)) { continue; }
list($rc, $A_info) = ff_getprojectinfo($A); checkerr($rc, $A_info); if (get_FFC($A_info["bounty"]) != 23320) { checkerr(1, "Bounty on A: {$A_info['bounty']}"); } list($rc, $B_info) = ff_getprojectinfo($B); checkerr($rc, $B_info); if (get_FFC($B_info["bounty"]) != 0) { checkerr(1, "Bounty on B: {$B_info['bounty']}"); } list($rc, $C_info) = ff_getprojectinfo($C); checkerr($rc, $C_info); if (get_FFC($C_info["bounty"]) != 20801) { checkerr(1, "Bounty on C: {$C_info['bounty']}"); } list($rc, $D_info) = ff_getprojectinfo($D); checkerr($rc, $D_info); if (get_FFC($D_info["bounty"]) != 0) { checkerr(1, "Bounty on D: {$D_info['bounty']}"); } // Make sure the developer received his payment list($rc, $dev_info) = ff_getmemberinfo($developer); checkerr($rc, $dev_info); if (get_FFC($dev_info["reserve"]) !== 48849) { checkerr(1, "Developer's reserve: {$dev_info['reserve']}"); } // Make sure the charity received the proper donation list($rc, $charities) = ff_getcharities(); checkerr($rc, $charities); $difference = get_FFC($charities[$prefcharity]["current"]) - get_FFC($olddonation); if ($difference != 2147) {
<h1>Active Disputes</h1> <table border=1 cellspacing=0 cellpadding=3><tr> <th>Assigned To</th> <th>Project</th> <th>Lead</th> <th>Plaintiff</th> <th>Subject</th> <th>Dispute Began</th> <th>Debate Ended</th> </tr> <?php foreach ($disputes as $dispute) { // Get some info about the project list($rc, $projectinfo) = ff_getprojectinfo($dispute["projectid"]); if ($rc) { print "Problem fetching project info: {$rc} " . htmlentities($projectinfo) . "\n"; softexit(); } $assignee = ""; if (substr($dispute["assignedto"], 0, 8) === 'arbiter:') { $assignee = substr($dispute["assignedto"], 8); } ?> <tr> <?php if ($assignee === "") { ?> <td>unassigned <nobr><a href="arbitration.php?id=<?php echo $dispute["disputeid"];
it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Fossfactory-src is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Fossfactory-src. If not, see <http://www.gnu.org/licenses/>. */ include_once 'formattext.php'; $parentid = $id; // Get the project info list($rc, $projinfo) = ff_getprojectinfo($parentid); if ($rc == 2) { print "No such project: {$parentid}"; softexit(); } //get subprojects of project list($rc, $subprojects) = ff_getsubprojects($parentid); $totsubprojallot = 0; foreach ($subprojects as $subproject) { $totsubprojallot += $subproject['allotment']; } function pri_cmp($a, $b) { if ($GLOBALS["priorities"][$a["priority"]] < $GLOBALS["priorities"][$b["priority"]]) { return 1; }
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Fossfactory-src. If not, see <http://www.gnu.org/licenses/>. */ $userid = "{$_REQUEST['u']}"; $password = "******"; $origin = "{$_REQUEST['c']}"; $use_dir = intval($_REQUEST["e"]); $hostname = $_SERVER["HTTP_HOST"]; if ($hostname === "www.fossfactory.org") { $hostname = "git.fossfactory.org"; } list($rc, $projectinfo) = ff_getprojectinfo("{$_REQUEST['id']}"); if ($rc) { print $rc == 2 ? "No such project: {$_REQUEST['id']}\n" : "System Error.\n"; exit; } if (is_dir("/home/git/{$projectinfo['id']}.git")) { print "Repository git@{$hostname}:{$projectinfo['id']} already exists.\n"; exit; } // Do some basic validation list($rc, $memberinfo) = ff_getmemberinfo($userid); if ($rc) { print $rc == 2 ? "Login Incorrect.\n" : "System Error.\n"; exit; } list($rc, $err) = ff_checkpassword($memberinfo["encpwd"], $password);
$password = $_REQUEST["p"]; // Verify the user's credentials list($rc, $err) = ff_checkpassword($username, $password); if ($rc == 5 || $rc == 2) { print "Incorrect username or password\n"; exit; } else { if ($rc) { print "Internal system error: {$rc} {$err}\n"; exit; } } include_once "getduties.php"; list($rc, $duties) = getduties($username); if ($rc) { print "Internal system error: {$rc} {$duties}\n"; exit; } print "You have " . (sizeof($duties) == 1 ? "1 duty." : sizeof($duties) . " duties") . "\n"; foreach ($duties as $duty) { print "--\n"; print "Project: {$duty['projectid']}"; list($rc, $projectinfo) = ff_getprojectinfo($duty["projectid"]); if (!$rc) { print " \"{$projectinfo['name']}\""; } print "\n"; print "Subject: {$duty['subject']}\n"; print "Deadline: " . ($duty["deadline"] ? date("D F j, H:i:s T", $duty["deadline"]) : "unassigned") . "\n"; print "URL: {$GLOBALS['SITE_URL']}{$duty['link']}\n"; }
foreach ($duties as $d) { $item = new FeedItem(); $item->title = $d['subject']; $item->link = $d['link']; $item->guid = $d['guid']; $item->date = $d['deadline']; $item->description = formatText($d['body']); $rss->addItem($item); } } } else { if ($_GET['src'] == 'projectevents') { include_once "formattext.php"; $pid = scrub($_GET['p']); $pname = 'Unknown'; list($rc, $prjinf) = ff_getprojectinfo($pid); if ($rc == 0) { $pname = $prjinf['name']; $watches = array(array("eventid" => "{$pid}-news")); list($rc, $events) = al_getrecentevents('watch:' . $pid . '-news'); if ($rc == 0) { foreach ($events as $e) { $item = new FeedItem(); $item->title = $e['subject']; $item->link = $GLOBALS['SITE_URL'] . $e['url']; $item->date = (int) $e['time']; $item->description = formatText($e['body']); $rss->addItem($item); } } }
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"; } }
function getduties($username) { $username = scrub($username); list($rc, $duties) = ff_getduties($username); if ($rc) { return array($rc, $duties); } $result = array(); foreach ($duties as $key => $duty) { list($rc, $projectinfo) = ff_getprojectinfo($duty["projectid"]); if ($rc) { return array($rc, $projectinfo); } $deadline = $duty["deadline"]; $tag = $deadline ? "newduty2" : "newduty"; if ($duty["type"] == 'dispute-plaintiff') { list($rc, $disputeinfo) = ff_getdisputeinfo($duty["id"]); if ($rc) { return array($rc, $disputeinfo); } $link = "dispute.php?id={$duty['id']}&requser={$username}"; $macros = array("subject" => $disputeinfo["subject"], "projectname" => $projectinfo["name"]); $textid = "plaintiff"; } else { if ($duty["type"] == 'dispute-defendant') { list($rc, $disputeinfo) = ff_getdisputeinfo($duty["id"]); if ($rc) { return array($rc, $disputeinfo); } $link = "dispute.php?id={$duty['id']}&requser={$username}"; $macros = array("subject" => $disputeinfo["subject"], "username" => $disputeinfo["plaintiff"], "projectname" => $projectinfo["name"], "deadline" => date("D F j, H:i:s T", $deadline)); if (sizeof($disputeinfo["arguments"] == 1)) { $textid = "{$tag}-newdispute"; } else { $textid = "{$tag}-dispute"; } } else { if ($duty["type"] == 'new-subproject') { list($rc, $pinfo) = ff_getprojectinfo($duty["id"]); if ($rc) { return array($rc, $pinfo); } $link = projurl($duty["projectid"], "tab=subprojects&requser={$username}"); $macros = array("projectname" => $pinfo["name"], "parentname" => $projectinfo["name"], "deadline" => date("D F j, H:i:s T", $deadline)); $textid = "{$tag}-newsubproject"; } else { if ($duty["type"] == 'code submission') { // Hide code submission duties on accepted projects if ($projectinfo["status"] == 'accept') { continue; } list($rc, $sinfo) = ff_getsubmissioninfo($duty["id"]); if ($rc) { return array($rc, $sinfo); } $link = projurl($duty["projectid"], "tab=submissions&requser={$username}#submission{$duty['id']}"); $macros = array("projectname" => $projectinfo["name"], "submitter" => $sinfo["username"], "deadline" => date("D F j, H:i:s T", $deadline)); $textid = "{$tag}-submission"; } else { if ($duty["type"] == 'change proposal') { list($rc, $postinfo) = ff_getpostinfo($duty["id"]); if ($rc) { return array($rc, $postinfo); } $link = projurl($duty["projectid"], "requser={$username}&post={$duty['id']}"); $macros = array("projectname" => $projectinfo["name"], "submitter" => $postinfo["owner"], "deadline" => date("D F j, H:i:s T", $deadline)); $textid = "{$tag}-changeproposal"; } } } } } list($rc, $subject) = ff_gettext("{$textid}-subject", $macros); if ($rc) { return array($rc, $subject); } list($rc, $body) = ff_gettext("{$textid}-body", $macros); if ($rc) { return array($rc, $body); } $duty["link"] = $link; $duty["subject"] = $subject; $duty["body"] = $body; $result[$key] = $duty; } return array(0, $result); }