Пример #1
0
    $response['status'] = 'Error';
    $response['message'] = $e->getMessage();
    echo json_encode($response);
    die;
}
$json = file_get_contents('php://input');
$data = json_decode($json);
$headers = apache_request_headers();
$header = str_replace("Bearer ", "", $headers['Authorization']);
$JWT = new JWT();
try {
    $decoded_token = $JWT->decode($header, $key, array($alg));
    if ($data->location === 'insert_testimonial') {
        insertTestimonial($data, $db);
    } elseif ($data->location === 'fetch_testimonials') {
        fetchTestimonials($data, $db);
    } elseif ($data->location === 'update_testimonial') {
        updateTestimonial($data, $db);
    } elseif ($data->location === 'update_show_on_site') {
        updateShowOnSite($data, $db);
    } elseif ($data->location === 'delete_testimonial') {
        deleteTestimonial($data, $db);
    }
} catch (DomainException $e) {
    header_status(401);
    $response['status'] = 'Error';
    $response['message'] = $e->getMessage();
    echo json_encode($response);
    die;
}
function insertTestimonial($data, $db)
Пример #2
0
} catch (Exception $e) {
    header_status(500);
    $response['status'] = 'Error';
    $response['message'] = $e->getMessage();
    echo json_encode($response);
    die;
}
$json = file_get_contents('php://input');
$data = json_decode($json);
try {
    if ($data->location == 'fetch_photos') {
        fetchPhotos($data, $db, $memcache_array);
    } elseif ($data->location == 'fetch_videos') {
        fetchVideos($data, $db, $memcache_array);
    } elseif ($data->location == 'fetch_testimonials') {
        fetchTestimonials($data, $db, $memcache_array);
    } elseif ($data->location == 'send_mail') {
        sendMail($data, $gCaptchaSecretKey, $SendGrid_API_KEY);
    }
} catch (Exception $e) {
    header_status(503);
    $response['status'] = 'Error';
    $response['message'] = $e->getMessage();
    echo json_encode($response);
    die;
}
function fetchPhotos($data, $db, $memcache_array)
{
    $response = array();
    try {
        $resultArray = array();
Пример #3
0
// load type of items to display (online / offline)
$type = trim($_GET["type"]);
// make sure type is set
if ($type == "") {
    $type = "online";
}
// transform $type into $online (Y/N)
if ($type == "offline") {
    $online = "N";
} else {
    $online = "Y";
}
// get items total
$items_total = fetchSimpleTotal("testimonials", "online = '" . $online . "'");
// get items results
$items_result = fetchTestimonials($online);
// set id for css purposes
$id = 7;
// global vars for includes
$g_section = 'Testimonials';
$g_sub_section = $type;
$g_sub_sub_section = $items_total;
// include header
include 'inc/header.inc.php';
// include menu
include 'inc/menu.inc.php';
?>

<?php 
if ($_GET['result'] == 'delete_ok') {
    ?>