Exemplo n.º 1
0
function handle_put($conversation)
{
    // Note: You can only "consume" the entity once, so if we want it
    // as text, and want to refer to it more than once, we should keep
    // a reference to that text.
    $text = $conversation->entity->getText();
    $note = json_decode($text, true);
    $connection = get_connection();
    try {
        add_note($note, $connection);
        update_board_timestamp($note, $connection);
    } catch (Exception $x) {
        $connection->close();
        throw $x;
    }
    $connection->close();
    return handle_get($conversation);
}
Exemplo n.º 2
0
    $reset_code = "1234";
    $password1 = "anshul";
    $password2 = "anshul";
    $message = "debug";
}
// Handle Methods
try {
    switch ($method) {
        case 'PUT':
            handle_put($query, $member_id, $email, $official_dob, $first_name, $last_name);
            break;
        case 'POST':
            handle_post($query, $team_name, $team_admin_id, $email, $password, $official_dob, $first_name, $last_name, $team_id, $member_id, $fund, $birthday_of_member_id, $cake_amount, $other_expense, $celebration_date, $attendees_member_id, $reset_code, $password1, $password2, $message);
            break;
        case 'GET':
            handle_get($query, $val, $subquery);
            break;
        case "DELETE":
            handle_delete($query, $val, $subquery);
            break;
        default:
            //handle_error($query,$val,$subquery);
            break;
    }
} catch (Exception $e) {
    echo "here";
}
// Handle Get Requests
function handle_get($query, $val, $subquery)
{
    switch ($query) {
Exemplo n.º 3
0
    $result = file_get_contents($domain_details_url);
    if (is_equal(false, $result)) {
        return array('template' => 'error', 'error_msg' => 'Could not fetch domain details. Go back and try again.');
    }
    $result = json_decode($result, true);
    $exp_date = $result['endtime'];
    $invoice_option = $req['form']['invoice_option'];
    $years = $req['form']['years'];
    $request = "https://test.httpapi.com/api/domains/renew.json?{$auth_params}&order-id={$orderid}&years={$years}&exp-date={$exp_date}&invoice-option={$invoice_option}";
    $result = file_get_contents($request);
    if (is_equal(false, $result)) {
        return array('template' => 'error', 'error_msg' => 'Could not perform action. Go back and try again.');
    }
    return array('result' => 'Action performed successfully.');
}
handle_get('/apps/gappsconf', 'auth_filter', afunc_returning(array('template' => 'gappsconf_form')));
handle_post(array('/apps/gappsconf', 'action' => 'configure_dns'), 'gappsconf');
function gappsconf($req)
{
    /* The following DNS recrods are added:
    			MX      10 ASPMX.L.GOOGLE.COM
    			MX      20 ALT1.ASPMX.L.GOOGLE.COM
    			MX      20 ALT2.ASPMX.L.GOOGLE.COM
    			MX      30 ASPMX2.GOOGLEMAIL.COM
    			MX      30 ASPMX3.GOOGLEMAIL.COM
    			MX      30 ASPMX4.GOOGLEMAIL.COM
    			MX      30 ASPMX5.GOOGLEMAIL.COM
    			calendar        CNAME   ghs.google.com
    			docs    CNAME   ghs.google.com
    			mail    CNAME   ghs.google.com
    			sites   CNAME   ghs.google.com
Exemplo n.º 4
0
        $filePath = generatePath(strtolower($_GET["userid"]), $userName);
        if (file_exists($filePath)) {
            echo generateSuccess(readRawJSON($filePath), "");
        } else {
            echo generateError("Student not Found");
        }
    }
}
function handle_post()
{
    if ($_GET["name"] && $_GET["userid"]) {
        $userName = strtolower(str_replace(' ', '_', $_GET["name"]));
        $filePath = generatePath(strtolower($_GET["userid"]), $userName);
        $json = file_get_contents('php://input');
        writeJson($filePath, $json);
    } else {
        echo generateError("Error while generating / saving");
    }
}
$method = $_SERVER['REQUEST_METHOD'];
$request = explode("/", substr(@$_SERVER['PATH_INFO'], 1));
switch ($method) {
    case 'POST':
        handle_post();
        break;
    case 'GET':
        handle_get();
        break;
}
//echo var_dump($_GET)."/n";
//echo var_dump($_POST);