function prepareHome($dbh) { if ($_SESSION['userType'] === "hunter") { $template_array["username"] = $_SESSION['userLogin']; $template_array['preferredBounties'] = getPreferredBounties($dbh); $template_array['messageOfDay'] = getMessageOfDayHunter($dbh); $args[':username'] = $_SESSION['userLogin']; $template_array['trackBounties'] = getBountiesFromUsernameRecentReports($dbh, $args); $template_array['subscriptions'] = getRSSSubscription($dbh); return $template_array; } else { if ($_SESSION['userType'] === "marshal") { $template_array['username'] = $_SESSION['userLogin']; $template_array['rssExists'] = rssExists($dbh); $template_array['subscriptions'] = getRSSSubscription($dbh); $dummy = getMessageOfDayMarshal($dbh); $template_array["messageOfDay"] = getMessageOfDayMarshal($dbh); $args[':username'] = $_SESSION['userLogin']; $template_array['activeBounties'] = getActiveBounties($dbh, $args); $template_array['subscriptions'] = getRSSSubscription($dbh); return $template_array; } else { $template_array = getPreferredBounties($dbh); return $template_array; } } }
*/ $app->get('/api/getMODHunter', function () use($dbh) { $args = array(); echo json_encode(getMessageOfDayHUnter($dbh)); }); /* Michael Gilbert getMODMarshal Gets Message of Day For a Marshall Errors: 0: success 1: No statement executed */ $app->get('/api/getMODMarshal', function () use($dbh) { $args = array(); 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));