function prepareHunterProfile($dbh, $username) { // for the hunter profile page, we need // 1) the username // 2) the email // 3) the path to the profile picture // 4) all the reports this user has ever submitted // (paid and non-paid) (all info including bountyID) $args[':username'] = $username; $template_array['user'] = getHunterFromUsername($dbh, $args); $template_array['submittedReports'] = getReportsFromUsername($dbh, $args); $template_array['user']['numReportsFiled'] = sizeof($template_array['submittedReports']['result']); $template_array['reportsApproved'] = getNumberReportsApproved($dbh, $args); $template_array['user']['numReportsApproved'] = sizeof($template_array['reportsApproved']['result']); $template_array['pastBounties'] = getBountiesFromUsername($dbh, $args); return $template_array; }
$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)); }); /* Michael Gilbert basicSearch Inputs: Query: A simple string search term Outputs: An array of up to 5 bounties whose name includes the search term Errors: 0: success 1: Statement execution failed */ $app->get('/api/basicSearch/:query', function ($query) use($dbh) { $args[':query'] = '%' . $query . '%'; }); $app->get('/api/getRSSSubscription/', function () use($dbh) {