예제 #1
0
include "include/providers/class_gamequestion.php";
include "include/providers/class_gamecommand.php";
include "include/providers/class_gamechat.php";
// This is ajax
//header("Content-Type: application/json");
// Get info (post only)
$action = isset($_POST['action']) ? $_POST['action'] : NULL;
// Must be logged in to use tasks below this section
if (!$user->user_exists) {
    echo json_encode(array('result' => FALSE, 'err' => 1));
    exit;
}
$game_model = new se_game();
$question_model = new se_gamequestion();
$command_model = new se_gamecommand();
$gamechat_model = new se_gamechat();
if ($action == 'add_message') {
    $game_id = isset($_POST['game_id']) ? $_POST['game_id'] : NULL;
    $command_id = isset($_POST['command_id']) ? $_POST['command_id'] : NULL;
    $chat_id = isset($_POST['chat_id']) ? $_POST['chat_id'] : NULL;
    $message = isset($_POST['message']) ? $_POST['message'] : NULL;
    if ($chat_id == 0 || $chat_id == NULL) {
        $provider = 0;
        // Доделать эту строку!!!!!
        $chat_id = $gamechat_model->add_chat($game_id, $command_id, $provider_id);
    }
    $chat = $gamechat_model->get_chat_by_id($chat_id);
    $user_id = $user->user_info['user_id'];
    $name = $user->user_info['user_fname'];
    $time = $gamechat_model->add_message($chat_id, $user_id, $name, $message);
    if ($time == false) {
예제 #2
0
/* $Id: cities.php 8 2011-01-11 Alex $ */
$page = "providers/game";
include "header.php";
include 'include/providers/class_gameprovider.php';
include 'include/providers/class_game.php';
include 'include/providers/class_gamequestion.php';
include 'include/providers/class_gamecommand.php';
include 'include/providers/class_gamepin.php';
include 'include/providers/class_gamechat.php';
$provider_id = (int) $_GET['provider_id'];
// Модели
$gameprovider_model = new se_gameprovider();
$game_model = new se_game();
$question_model = new se_gamequestion();
$command_model = new se_gamecommand();
$gamechat_model = new se_gamechat();
// Проверяем, мобильное ли уустройство
/*$url = 'http://phd.yandex.net/detect';

$query = http_build_query(
   array(
       'user-agent'  => $_SERVER['HTTP_USER_AGENT']
       //'wap-profile' => "http://www-ccpp-mpd.alcatel.com/files/ALCATEL-CTH3_MMS10_1.0.rdf",
   )
);

$mobile = file_get_contents($url . '?' . $query);

if(strcmp($mobile, "<yandex-mobile-info-error>Unknown user agent and wap profile</yandex-mobile-info-error>") != 0)
{
    // Не мобильное устройство