Example #1
0
function get_test_data()
{
    $note2 = new_note();
    $note2['id'] = '150';
    $note2['content'] = time();
    $note3 = new_note();
    $note3['id'] = '146';
    $note3['content'] = time() + 1;
    $notes = array($note2, $note3);
    $data['action'] = "save_notes";
    $data['notes'] = $notes;
    return json_encode($data);
}
Example #2
0
<?php

if (!is_auth()) {
    redirect("user/signin");
}
switch ($action) {
    case "all":
        get_all();
        break;
    case "new":
        new_note();
        break;
    case "update":
        update_note();
        break;
    case "delete":
        delete_note();
        break;
    case "send":
        send_note();
        break;
    default:
        invalid_request_error();
}
function get_all()
{
    $result = get_notes();
    echo json_encode($result);
}
function new_note()
{