示例#1
0
}
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;
        $itm->created_at = time();
        $itm->updated_at = time();
        $controllerRating->insertRating($itm);
        $tmp_from = 0;
        $tmp_to = time();
        $resultRatings = $controllerRest->getResultStoresRating($store_id);
        // header ("content-type: text/json");
        header("Content-Type: application/text; charset=ISO-8859-1");
        echo "{";
        // REVIEWS
        echo "\"store\" : ";
        $no_of_rows = $resultRatings->rowCount();
        $ind = 0;
        $count = $resultRatings->columnCount();
        foreach ($resultRatings as $row) {
            echo "{";
            $inner_ind = 0;
            foreach ($row as $columnName => $field) {
                $val = trim(strip_tags($field));
                if ($columnName == "store_desc") {
                    $val1 = preg_replace('~[\\r\\n]+~', '', $val);