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; } } }
function prepareMarshallRSSAdd($dbh, $username) { // for marshall profile we need // 1) email // 2) company name // 3) username // 4) all bounties currently active for user // 5) all bounties that have expired if ($username === $_SESSION['userLogin'] && $_SESSION['userType'] === 'marshal') { $template_array['username'] = $username; $template_array['userType'] = $_SESSION['userType']; $template_array['email'] = $_SESSION['email']; $template_array["error"] = 0; //for time being $args[":username"] = $username; $dummy = rssExists($dbh, $args); $template_array['rssExists'] = $dummy['exists']; return $template_array; } else { $template_array['username'] = $username; $template_array['userLogin'] = $_SESSION['userLogin']; $template_array['userType'] = $_SESSION['userType']; $template_array['wtf'] = "hey"; return $template_array; } }
$args['creationDate'] = date("Y/m/d"); $args['ttl'] = "340"; echo json_encode(createRSS($dbh, $args), JSON_UNESCAPED_SLASHES); // echo json_encode(print_r($args)); }); $app->post('/api/addRSS', function () use($dbh) { $args['user'] = $_SESSION['userLogin']; $args['title'] = $_POST['title']; $args['category'] = $_POST['category']; $args['description'] = $_POST['description']; $args['pubDate'] = date('Y-m-d'); $args['link'] = "_rss/_profiles/_" . $args['user'] . "/rss_" . $args['user'] . ".xml"; echo json_encode(addRSS($dbh, $args)); }); $app->get('/api/rssExists', function () use($dbh) { echo json_encode(rssExists($dbh), JSON_UNESCAPED_SLASHES); }); $app->post('/api/addSubscription', function () use($dbh) { $args[":userID"] = $_SESSION['userID']; $args2[':marshalUsername'] = $_POST['marshalUsername']; echo json_encode(addSubscription($dbh, $args, $args2), JSON_UNESCAPED_SLASHES); }); /* Michael Gilbert updateUserDetailsHunter Updates a user's account info Change code specifies which info is being changed Codes: 0: username 1: email 2: password