Example #1
0
// Now set up sponsorships
checkerr(ff_setsponsorship($E, $sponsor1, "535801CAD"));
checkerr(ff_setsponsorship($E, $sponsor2, "1882CAD"));
checkerr(ff_setsponsorship($E, $sponsor3, "3105CAD"));
checkerr(ff_setsponsorship($E, $sponsor4, "1887EUR"));
checkerr(ff_setsponsorship($E, $sponsor5, "111EUR"));
checkerr(ff_setsponsorship($E, $sponsor6, "450USD"));
checkerr(ff_setsponsorship($E, $sponsor7, "11538USD"));
checkerr(ff_setsponsorship($E, $sponsor8, "7191USD"));
checkerr(ff_setsponsorship($E, $sponsor9, "3854USD"));
checkerr(ff_setsponsorship($E, $sponsor10, "67USD"));
// Create a subproject
list($rc, $F) = ff_createproject($sponsor1, "F-{$now}", "This project is for testing purposes only.  " . "Do not submit a solution unless you are a test script.", $E);
checkerr($rc, $F);
// Allot funds to the subproject
checkerr(ff_setallotment($sponsor1, $E, $F, 700));
// Create a submission
list($rc, $sub_F1) = ff_submitcode($developer, array(array("pathname" => realpath("./test-payout.php"), "filename" => "test-payout.php", "description" => "")), "", $F);
checkerr($rc, $sub_F1);
// Accept the submission
checkerr(ff_acceptsubmission($sponsor1, $sub_F1));
// Set the payout time to be immediately and execute the payout.
checkerr(admin_expedite_payout($F));
/*
// Set up a monthly sponsorship
checkerr(ff_setsubscription($sponsor,"1000FFC","monthly",
    array($A => "100FFC", $D => "50000FFC")));

// Receive the first monthly sponsorship payment
checkerr(ff_receivefunds( $sponsor, "950FFC", "$now-1", "50FFC",
    true, "Sponsor $now", "sponsor-$now@gignac.org", "CA", "N9H 2E5"));
Example #2
0
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/>.
*/
$parentid = scrub($_REQUEST["id"]);
//get subprojects of project
list($rc, $subprojects) = ff_getsubprojects($parentid);
if ($rc) {
    print "Internal error: {$rc} {$subprojects}";
    exit;
}
foreach ($subprojects as $subproject) {
    $allotment = round($_REQUEST["sub{$subproject['id']}"] * 10);
    if (isset($_REQUEST["sub{$subproject['id']}"]) && $allotment >= 0 && $allotment <= 1000 && (!$subproject["allotted"] || $allotment != $subproject["allotment"])) {
        ff_setallotment($username, $parentid, $subproject['id'], $allotment);
    }
    $priority = scrub($_REQUEST["pri{$subproject['id']}"]);
    if ($priority !== $subproject["priority"]) {
        ff_setpriority($username, $parentid, $subproject['id'], $priority);
    }
}
header("Location: " . projurl($parentid, "tab=subprojects"));
exit;