Ejemplo n.º 1
0
function prepareBountyProPage($dbh, $bountyID)
{
    // for discover, the template array must contain
    // 	1)  the username
    // 	2)  the email of the username
    // 	3)  the top 10 bounties
    $template_array = array("username" => $_SESSION['userLogin'], "email" => $_SESSION['email'], "bountyID" => $bountyID);
    $args[":bountyID"] = $bountyID;
    $template_array['bounty'] = getBountyFromBountyID($dbh, $args);
    $template_array['bounty']['id'] = $bountyID;
    $args[':username'] = $_SESSION['userLogin'];
    $template_array['submittedReports'] = getReportsFromUsernameBountyID($dbh, $args);
    $currentDate = date("Y") . date("m") . date("d");
    $bountyDate = $template_array['bounty']['result']['dateEnding'];
    $bountyDate = substr($bountyDate, 0, 4) . substr($bountyDate, 5, 2) . substr($bountyDate, 8);
    // echo "<br>".substr($bountyDate, 5, 7)."<br>";
    // echo $bountyDate;
    $idk = $bountyDate < $currentDate;
    if ($currentDate < $bountyDate) {
        $template_array['bounty']['expired'] = 0;
    } else {
        $template_array['bounty']['expired'] = 1;
    }
    return $template_array;
}
Ejemplo n.º 2
0
    $args[':username'] = $username;
    echo json_encode(getNumberReportsApproved($dbh, $args));
});
/*
Ryan Edson
getReportsFromUsernameBountyID
returns all bounties a user has logged on a certain bounty
Error Codes:
Returns

complete
*/
$app->get('/api/getReportsFromUsernameBountyID/:username/:bountyID', function ($username, $bountyID) use($dbh) {
    $args[':username'] = $username;
    $args[':bountyID'] = $bountyID;
    echo json_encode(getReportsFromUsernameBountyID($dbh, $args));
});
/*
Michael Gilbert
getPreferredBounties
gets all the reports from the preferred reports table
Error Codes:
1: no statement executed
Returns
array of preferred bounties

complete
*/
$app->get('/api/getPreferredBounties', function () use($dbh) {
    echo json_encode(getPreferredBounties($dbh));
});