Example #1
0
function preparePayPage($dbh)
{
    $template_array['username'] = $_SESSION['userLogin'];
    $args[':username'] = $_SESSION['userLogin'];
    $template_array['submittedReports'] = getReportsFromMarshal($dbh, $args);
    $template_array['bounties'] = [];
    foreach ($template_array['submittedReports']['result'] as $report) {
        if (!in_array($report['bountyName'], $template_array['bounties'])) {
            array_push($template_array['bounties'], $report['bountyName']);
        }
    }
    return $template_array;
}
Example #2
0
    echo json_encode(getMessageOfDayMarshal($dbh));
});
$app->get('/api/getBountiesFromUsernameRecentReports/:username', function ($username) use($dbh) {
    $args[':username'] = $username;
    echo json_encode(getBountiesFromUsernameRecentReports($dbh, $args));
});
/*
getReportsFromMarshal
Gets all reports submitted towards bounties made by the marshal
Errors:
0: success
1: statement execution failed
*/
$app->get('/api/getReportsFromMarshal/:username', function ($username) use($dbh) {
    $args[':username'] = $username;
    echo json_encode(getReportsFromMarshal($dbh, $args));
});
/*
getBountiesFromUsername
Inputs:
Username: username to find results for
Outputs: an array of all bounties which the user has submitted reports for
Errors:
0: success
1: statements failed
*/
$app->get('/api/getBountiesFromUsername/:username', function ($username) use($dbh) {
    $args[':username'] = $username;
    echo json_encode(getBountiesFromUsername($dbh, $args));
});
/*