예제 #1
0
<?php

require_once 'header.php';
$controller = new ControllerStore();
$controllerPhoto = new ControllerPhoto();
$controllerRating = new ControllerRating();
$stores = $controller->getStores();
if (!empty($_SERVER['QUERY_STRING'])) {
    $extras = new Extras();
    $store_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
    $store_id_featured = $extras->decryptQuery2(KEY_SALT, $_SERVER['QUERY_STRING']);
    if ($store_id != null) {
        $controller->deleteStore($store_id, 1);
        echo "<script type='text/javascript'>location.href='stores.php';</script>";
    }
    if ($store_id_featured != null) {
        $itm = new Store();
        $itm->store_id = $store_id_featured[0];
        $itm->featured = $store_id_featured[1] == "yes" ? 0 : 1;
        $res = $controller->updateStoreFeatured($itm);
        echo "<script type='text/javascript'>location.href='stores.php';</script>";
    }
    // if($store_id_featured == null && $store_id == null) {
    //   echo "<script type='text/javascript'>location.href='403.php';</script>";
    // }
}
$begin = 0;
$page = 1;
$count = count($stores);
$pages = intval($count / Constants::NO_OF_ITEMS_PER_PAGE);
$search_criteria = "";
예제 #2
0
<?php

require '../header_rest.php';
$controllerRest = new ControllerRest();
$controllerUser = new ControllerUser();
$controllerRating = new ControllerRating();
$user_id = 0;
if (!empty($_POST['user_id'])) {
    $user_id = $_POST['user_id'];
}
$store_id = 0;
if (!empty($_POST['store_id'])) {
    $store_id = $_POST['store_id'];
}
$login_hash = 0;
if (!empty($_POST['login_hash'])) {
    $login_hash = $_POST['login_hash'];
}
if (!empty($user_id) && !empty($store_id) && !empty($login_hash)) {
    if (!$controllerUser->isUserIdExistAndHash($user_id, $login_hash)) {
        $json = "{ \"status\" : { \"status_code\" : \"3\", \"status_text\" : \"Invalid Access\" } }";
        echo $json;
    } else {
        $itm = $controllerRating->checkUserCanRate($store_id, $user_id);
        $canRate = $itm != null ? -1 : 1;
        // header ("content-type: text/json");
        header("Content-Type: application/text; charset=ISO-8859-1");
        echo "{";
        echo "\"store_rating\" : { \"store_id\" : \"{$store_id}\", \"can_rate\" : \"{$canRate}\" }, \"status\" : { \"status_code\" : \"-1\", \"status_text\" : \"Success.\" }";
        echo "}";
    }
예제 #3
0
<?php

require '../header_rest.php';
$controllerRest = new ControllerRest();
$controllerUser = new ControllerUser();
$controllerRating = new ControllerRating();
$user_id = 0;
if (!empty($_POST['user_id'])) {
    $user_id = $_POST['user_id'];
}
$store_id = 0;
if (!empty($_POST['store_id'])) {
    $store_id = $_POST['store_id'];
}
$login_hash = 0;
if (!empty($_POST['login_hash'])) {
    $login_hash = $_POST['login_hash'];
}
$rating = 0;
if (!empty($_POST['rating'])) {
    $rating = $_POST['rating'];
}
if (!empty($user_id) && !empty($store_id) && !empty($login_hash) && !empty($rating)) {
    if (!$controllerUser->isUserIdExistAndHash($user_id, $login_hash)) {
        $json = "{ \"status\" : { \"status_code\" : \"3\", \"status_text\" : \"Invalid Access\" } }";
        echo $json;
    } else {
        $itm = new Rating();
        $itm->rating = $rating;
        $itm->store_id = $store_id;
        $itm->user_id = $user_id;