$api->get('/donation/get_donations_for_approval/{poc_id}', function ($poc_id) { $donation = new Donation(); $donations_for_approval = $donation->getDonationsForApproval($poc_id); if ($donations_for_approval) { showSuccess(count($donations_for_approval) . " donation(s) waiting for approval", array('donations' => $donations_for_approval)); } else { $error = $donation->error; if (!$error) { $error = "Can't find any donations that need approval for this user"; } showError($error); } }); $api->get('/donation/{donation_id}/approve/{poc_id}', function ($donation_id, $poc_id) { $donation = new Donation(); $donation->approveDonation($donation_id, $poc_id); showSuccess("Donation approved", array('donation_id' => $donation_id)); }); $api->request("/user/login", function () { global $QUERY; $user = new User(); $phone = i($QUERY, 'phone'); $password = i($QUERY, 'password'); if (!$user->login($phone, $password)) { showError($user->error, array('')); exit; } $return = array('user' => $user->user); $return['user']['roles'] = $user->getRoles(); showSuccess("Login successful", $return); });