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; }
echo json_encode($result); }); /* Andre Gras getHunterFromUsername Get the basics of a Hunter from username Error Codes: 0 = user returned all good 1 = username doesnt exists Returns username userType */ $app->get('/api/getHunterFromUsername/:username', function ($username) use($dbh) { $args[':username'] = $username; $result = getHunterFromUsername($dbh, $args); echo json_encode($result); }); /* Andre Gras getMarshalFromUsername Get the basics of a Marshal from username Error Codes: 0 = user returned all good 1 = username doesnt exists Returns username userType */ $app->get('/api/getMarshalFromUsername/:username', function ($username) use($dbh) { $args[':username'] = $username;