Ejemplo n.º 1
0
 public function view($id = '')
 {
     $games = new Games($this->db);
     $this->f3->set('games', array());
     foreach ($this->f3->get('gamecat') as $index => $cat) {
         $this->f3->set('games[' . $index . ']', $games->getByCat($index));
     }
     $this->f3->set('content', 'app/views/games.htm');
     echo Template::instance()->render('app/templates/default.htm');
 }
Ejemplo n.º 2
0
 public static function searchForGames($query, $limit = 10)
 {
     self::validateApiKey();
     //Change these if we need to include more stuff.
     $fieldArr = ['id', 'name', 'original_release_date', 'image', 'api_detail_url', 'deck', 'image', 'platforms'];
     //sanitise query
     $query = trim(preg_replace('/ +/', ' ', preg_replace('/[^A-Za-z0-9 ]/', ' ', urldecode(html_entity_decode(strip_tags($query))))));
     //generate url
     $url = self::$gb . 'games?api_key=' . self::$apikey . '&format=json' . self::formatFieldList($fieldArr) . '&limit=' . $limit . '&filter=platforms:17|94|152,name:' . $query;
     //Limit to Mac, PC, Linux respectively.
     try {
         $json = self::makeApiCall($url);
     } catch (Exception $e) {
         throw new GBApiException('Error contacting Giantbomb. Please try again later.');
     }
     //QueryDb and try to find the object using the giantbomb unique id
     if ($json->results == null || count($json->results) < 1) {
         throw new GBApiException('No results found. Please try another search.');
     }
     $games = [];
     //initialise as empty array
     foreach ($json->results as $result) {
         $game = GamesQuery::create()->findOneByGbId($result->id);
         if ($game == null) {
             if (!isset($result->original_release_date) || $result->original_release_date == null) {
                 continue;
             }
             //skip if not out yet.
             $game = new Games();
             $game->setGbId($result->id);
             $game->setName(Games::generateUniqueName($result->name, $result->original_release_date));
             $game->setGbUrl($result->api_detail_url);
             $game->setTitle($result->name);
             $game->setDescription($result->deck);
             //We don't care if they don't have thumbs. Catch the exceptions and move on
             try {
                 $game->setGbThumb($result->image->screen_url);
             } catch (Exception $e) {
             }
             try {
                 $game->setGbImage($result->image->medium_url);
             } catch (Exception $e) {
             }
             $game->save();
         }
         //append result to list.
         array_push($games, $game);
     }
     return $games;
 }
Ejemplo n.º 3
0
 public function showUpdateGame()
 {
     $game = new Games();
     $game->name = 'Assassins Creed';
     $game->description = 'Assassins VS tamplars.';
     $game->save();
     $game = new Games();
     $game->name = 'Assassins Creed 2';
     $game->description = 'Assassins VS tamplars.';
     $game->save();
     $game = new Games();
     $game->name = 'Assassins Creed 3';
     $game->description = 'Assassins VS tamplars.';
     $game->save();
 }
Ejemplo n.º 4
0
 public function run()
 {
     //определяем название контроллера и метода (action)
     $controller = Yii::app()->controller->id;
     $action = Yii::app()->controller->action->id;
     //проверяем нужно ли показывать виджет
     if (!in_array($controller . '/' . $action, $this->showOn)) {
         return;
     }
     //проверяем, нужно ли выводить игры только данного жанра
     if (isset($_GET['type_id'])) {
         $id = $_GET['type_id'];
         $params = array('limit' => $this->count, 'order' => 'g_rate DESC', 'condition' => 't_id=:id', 'params' => array(':id' => $id));
         //ищем игры
         $games = Games::model()->getTopGames($params)->published()->with('ygs_types')->findAll();
     } else {
         $params = array('limit' => $this->count, 'order' => 'g_rate DESC');
         //ищем игры
         $games = Games::model()->getTopGames($params)->published()->findAll();
     }
     //заполняем массивы с жанрами игр для каждой найденной игры
     //для этого раскодируем поле g_type
     foreach ($games as $key => $game) {
         $games[$key]->g_types = Yii::app()->controller->_decodeTypes($game->g_type);
     }
     //показываем виджет
     $this->render('topGames', array('title' => $this->title, 'games' => $games));
 }
Ejemplo n.º 5
0
 public function actionIndex()
 {
     $games = Games::model()->findByAttributes(array('id' => 1));
     $gamesServerId = unserialize($games->server_id);
     $gamesAlias = $games->alias;
     $this->render('index', array('gamesServerId' => $gamesServerId, 'gamesAlias' => $gamesAlias));
 }
Ejemplo n.º 6
0
 public function actionAjax()
 {
     $model = new Games();
     if ($_POST['gid']) {
         $gameServerId = $model->getGamesServerId($_POST['gid']);
         if ($gameServerId) {
             //$returnValue='<select>';
             $i = 1;
             foreach ($gameServerId as $row) {
                 $returnValue .= '<option value="' . $row . '">918双线' . $i . '区</option>';
                 $i++;
             }
             echo $returnValue;
         }
     }
 }
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $this->_operate($model, 'update');
     $listGames = Games::model()->findAll();
     $listService = Service::model()->findAll();
     $this->render('update', array('model' => $model, 'listGames' => $listGames, 'listService' => $listService));
 }
Ejemplo n.º 8
0
 public function actionIndex()
 {
     $this->active_link = 'dashboard';
     //count users
     $users = User::model()->count('status != ' . User::STATUS_DELETED);
     $games = Games::model()->count();
     $zakaz = Zakaz::model()->active()->count();
     $this->render('dashboard', array('users' => $users, 'games' => $games, 'zakaz' => $zakaz));
 }
Ejemplo n.º 9
0
 /**
  * Статический метод, который задает параметры игры
  * @return array Вернет массив содержащий данные игры
  */
 public static function loadGame()
 {
     //обнуляем клики для формирования правильного dataBox
     $_SESSION['clicksBox'] = [];
     $claimAmountBefore = !empty($_SESSION['claimAmount']) ? $_SESSION['claimAmount'] : 0;
     $bonusMinutesBefore = !empty($_SESSION['bonusMinutes']) ? $_SESSION['bonusMinutes'] : 0;
     $boxes = Games::getBox();
     $dataBox = Games::getDataBox('bag-opened', 'bag');
     $dataGame = ['boxes' => $boxes, 'dataBox' => $dataBox, 'clicksBox' => [], 'claimAmountBefore' => $claimAmountBefore, 'bonusMinutesBefore' => $bonusMinutesBefore, 'claimAmount' => $claimAmountBefore, 'bonusMinutes' => $bonusMinutesBefore, 'numChance' => Config::NUM_CHANCE];
     return $dataGame;
 }
Ejemplo n.º 10
0
 public function insertPointsAction($id_user, $points)
 {
     $this->view->disable();
     header("Content-type: application/json; charset=utf-8");
     $game = new Games();
     $game->id_user = $id_user;
     $game->points = $points;
     echo json_encode($game->create());
     /*
             $date = getdate();
             $date = ($date['mday']) . '/' . ($date['mon']) . '/' . ($date['year']);
             $phql = "INSERT INTO Games (id_user, points, created_at) VALUES (:userid:, :points:, :date:)";
             $this->modelsManager->executeQuery($phql, array(
        'userid' => $id_user,
        'points' => $points,
        'date' => $date
            )
             )
     * 
     */
 }
Ejemplo n.º 11
0
 public function actionIndex()
 {
     $serverId = $_GET['serverid'];
     $gamesName = $_GET['gametype'];
     if ($serverId && $gamesName && $_GET['gid']) {
         /*
          * 魔神战纪的接口
          */
         if ($gamesName == 'mszj') {
             $gamesServerId = Games::model()->findByAttributes(array('id' => $_GET['gid']));
             $gamesApi = GamesApi::model()->findByAttributes(array('gid' => $_GET['gid']));
             $gamesServerId = unserialize($gamesServerId->server_id);
             $mid = Yii::app()->user->id;
             if ($gamesServerId) {
                 $this->memberGames($mid, $_GET['gid'], $gamesServerId[--$serverId]);
                 header("Location:http://res1.mszj.wowan365.com/bin/WebLaucher.html?userid=" . $gamesApi->userid . "&username="******"&time=" . time() . "&flag=8920bf1232e4f0d50fae4a494a2f8dab&cm=1&server_id=" . $gamesServerId[--$serverId] . "&country=%E5%8C%97%E4%BA%AC%E5%B8%82");
             }
         }
     }
 }
 public function start()
 {
     if (ACL::checkUserPermission('roulette.start') == false) {
         return Redirect::action('dashboard');
     }
     if (Auth::user()->isOperator()) {
         $game = Games::where('game_name', 'Roulette')->take(1)->get()->first();
         $table = Gametables::where('operator_id', $this->operator_id)->take(1)->get()->first();
         $players = Playeroperators::with('playerdetails', 'credits')->where('operator_id', $this->operator_id)->get();
         if (!empty($table)) {
             $create_channel = array('channel_id' => Utils::generateRandomString(), 'table_id' => $table->id);
             $channel_id = '';
             $channel = Gamechannel::openchannel()->where('table_id', $table->id)->take(1)->get()->first();
             if (!empty($channel)) {
                 $channel_id = $channel->id;
             } else {
                 $channel_create = Gamechannel::create($create_channel);
                 $channel_id = $channel_create->id;
             }
             $gamedetails = Gamechannel::with('tabledetails.gamedetails', 'tabledetails.operator', 'bets', 'bets.playerdetails')->find($channel_id);
             $totalbets = 0;
             $totalplayers = 0;
             if ($gamedetails->bets != null) {
                 foreach ($gamedetails->bets as $gamebets) {
                     $totalbets += $gamebets->bet_amount;
                     $totalplayers++;
                 }
             }
             $title = Lang::get('Start Game');
             $data = array('title' => $title, 'totalbets' => $totalbets, 'totalplayers' => $totalplayers, 'gamedetails' => $gamedetails, 'players' => $players);
             return View::make('operator/create', $data);
         } else {
             return App::abort(401, 'No Roulette table has been assigned to your account.');
         }
     } else {
         return App::abort(401, 'You are not a operator.');
     }
 }
Ejemplo n.º 13
0
<!--
#side_right input{
	width:40px;
}
#side_right select{
	width:60px;
}
-->
</style>
<div id="side_right">
<h2><strong>文章管理</strong></h2>
<h3><span class="title">管理文章</span><span class="manage"><a href="javascript:void(0)"><img src="<?php 
echo Yii::app()->request->baseUrl;
?>
/system/images/delete.jpg" /></a></span></h3>

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'user-grid', 'dataProvider' => $model->search(), 'selectableRows' => 2, 'filter' => $model, 'template' => '{items}{pager}', 'cssFile' => false, 'pager' => array('class' => 'CLinkPager', 'cssFile' => false, 'header' => ''), 'columns' => array(array('class' => 'CCheckBoxColumn', 'name' => 'id'), 'id', array('name' => 'tilte', 'type' => 'raw', 'value' => 'CHtml::link($data->tilte,array(update,id=>$data->id))'), array('name' => 'gid', 'filter' => CHtml::listData(Games::model()->findAll(), 'id', 'gname'), 'value' => '$data->gameName->gname'), array('name' => 'tid', 'filter' => CHtml::listData(ArticleType::model()->findAll(), 'id', 'typename'), 'value' => '$data->articleType->typename'), array('name' => 'create_time', 'value' => 'date("Y-m-d",$data->create_time)'), array('name' => 'up_time', 'value' => 'date("Y-m-d",$data->up_time)'), array('name' => 'display', 'filter' => Yii::app()->params['display'], 'value' => 'Article::model()->getArticleDisplay($data->display)'), array('header' => '编辑', 'class' => 'CButtonColumn', 'htmlOptions' => array()))));
?>

<?php 
$this->widget('CLinkPager', array('pages' => $pages, 'header' => '', 'firstPageLabel' => '首页', 'lastPageLabel' => '末页', 'prevPageLabel' => '上一页', 'nextPageLabel' => '下一页', 'cssFile' => false, 'footer' => ''));
?>
</div>
<!---------------side_right end---------------->
<?php 
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('user-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>
</div><!-- search-form -->

Ejemplo n.º 14
0
 /**
  * 
  * 结束棋局,设置棋局状态,结算分数。
  * @param Games $game
  * @param int $result  1黑胜  0.5和棋   0 白胜
  */
 public static function do_over($game, $result)
 {
     if ($game->status != '进行中') {
         return false;
     }
     $moves = strlen($game->game_record) / 2;
     switch ($result) {
         case 1:
             $game->bplayer->b_win++;
             $game->wplayer->w_lose++;
             $game->status = '黑胜';
             break;
         case 0:
             $game->bplayer->b_lose++;
             $game->wplayer->w_win++;
             $game->status = '白胜';
             break;
         case 0.5:
             $game->bplayer->draw++;
             $game->wplayer->draw++;
             $game->status = '和棋';
             break;
     }
     $game->bplayer->games++;
     $game->wplayer->games++;
     $game->movetime = date('Y-m-d H:i:s');
     $game->save();
     //对局量前50局,K值取30,然后,一般取20-15之间,等级分达到2400后K值取10 TODO
     //惩罚性规则:如果手数小于16,则变动系数K降为5,如果手数小于5,则降为1。
     $k_black = 30;
     $k_white = 30;
     if ($game->bplayer->games >= 50) {
         $k_black = 16;
     }
     if ($game->wplayer->games >= 50) {
         $k_white = 16;
     }
     if ($game->bplayer->score >= 2400) {
         $k_black = 10;
     }
     if ($game->wplayer->score >= 2400) {
         $k_white = 10;
     }
     if ($moves < 5) {
         $k_black = 1;
         $k_white = 1;
     }
     $before_black_score = $game->bplayer->score;
     $before_white_score = $game->wplayer->score;
     $we = 1 / (1 + pow(10, ($before_white_score - $before_black_score) / 400));
     $delta_black = $k_black * ($result - $we);
     /*记录积分变动log*/
     $log = new Score_log();
     $log->game_id = $game->id;
     $log->player_id = $game->black_id;
     $log->op_id = $game->white_id;
     $log->before_score = $before_black_score;
     $log->op_score = $before_white_score;
     $log->k_val = $k_black;
     $log->delta_score = $delta_black;
     $log->after_score = $before_black_score + $delta_black;
     $log->save();
     /*记录积分变动log end */
     $game->bplayer->score = $log->after_score;
     //$game->bplayer->score + $delta_black;
     $game->bplayer->save();
     $delta_white = -1 * $k_white * ($result - $we);
     /*记录积分变动log*/
     $log = new Score_log();
     $log->game_id = $game->id;
     $log->player_id = $game->white_id;
     $log->op_id = $game->black_id;
     $log->before_score = $before_white_score;
     $log->op_score = $before_black_score;
     $log->k_val = $k_white;
     $log->delta_score = $delta_white;
     $log->after_score = $before_white_score + $delta_white;
     $log->save();
     /*记录积分变动log end */
     $game->wplayer->score = $log->after_score;
     //$game->wplayer->score + $delta_white;
     $game->wplayer->save();
     //如果是比赛,调用一下比赛结束
     if ($game->tid) {
         TournamentTool::end_tournament($game->tid);
     }
 }
Ejemplo n.º 15
0
<?php

require_once "config.php";
$page = new AdminPage();
$games = new Games(['Settings' => $page->settings]);
$gen = new Genres(['Settings' => $page->settings]);
$id = 0;
// Set the current action.
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
if (isset($_REQUEST["id"])) {
    $id = $_REQUEST["id"];
    $game = $games->getGamesInfo($id);
    if (!$game) {
        $page->show404();
    }
    switch ($action) {
        case 'submit':
            $coverLoc = NN_COVERS . "games/" . $id . '.jpg';
            if ($_FILES['cover']['size'] > 0) {
                $tmpName = $_FILES['cover']['tmp_name'];
                $file_info = getimagesize($tmpName);
                if (!empty($file_info)) {
                    move_uploaded_file($_FILES['cover']['tmp_name'], $coverLoc);
                }
            }
            $_POST['cover'] = file_exists($coverLoc) ? 1 : 0;
            $_POST['releasedate'] = empty($_POST['releasedate']) || !strtotime($_POST['releasedate']) ? $game['releasedate'] : date("Y-m-d H:i:s", strtotime($_POST['releasedate']));
            $games->update($id, $_POST["title"], $_POST['asin'], $_POST['url'], $_POST["publisher"], $_POST["releasedate"], $_POST["esrb"], $_POST["cover"], $_POST['trailerurl'], $_POST["genre"]);
            header("Location:" . WWW_TOP . "/game-list.php");
            die;
            break;
Ejemplo n.º 16
0
 /**
  * 比赛结束,计算总分和名次,处理比赛状态。
  */
 public static function end_tournament($id)
 {
     $tournament = Tournament::model()->findByPk($id);
     if (!$tournament) {
         return false;
     }
     $total_game = $tournament->player_joined * ($tournament->player_joined - 1);
     if ($tournament->t_kind == 'single') {
         $total_game = $total_game / 2;
     }
     $tour_games = Games::model()->findAll("`status` in ('黑胜','白胜','和棋') and tid={$id}");
     //如果所有比赛都结束了,则处理比赛结束的逻辑。
     if ($total_game == count($tour_games)) {
         $tj = Tournament_join::model()->findAll("tid={$id}");
         $users_score = array();
         foreach ($tj as $v) {
             $users_score[$v->uid] = array('score' => 0, 'win' => 0);
         }
         //遍历game,算分和胜。
         foreach ($tour_games as $g) {
             switch ($g->status) {
                 case '黑胜':
                     $users_score[$g->black_id]['score']++;
                     $users_score[$g->black_id]['win']++;
                     break;
                 case '白胜':
                     $users_score[$g->white_id]['score']++;
                     $users_score[$g->white_id]['win']++;
                     break;
                 case '和棋':
                     $users_score[$g->black_id]['score'] += 0.5;
                     $users_score[$g->white_id]['score'] += 0.5;
                     break;
             }
         }
         foreach ($tj as $v) {
             $v->t_score = $users_score[$v->uid]['score'];
             $v->win_game = $users_score[$v->uid]['win'];
             $v->save();
         }
         //这里就直接按照积分和胜局排顺序了,不考虑直胜问题。
         $tj = Tournament_join::model()->findAll("tid={$id} order by t_score desc,win_game desc");
         foreach ($tj as $k => $v) {
             $v->rating = $k + 1;
             $v->save();
         }
         $tournament->status = 'ended';
         $tournament->save();
     }
     Yii::app()->cache->delete(self::CACHE_PREFIX . $tournament->id);
 }
Ejemplo n.º 17
0
<?php

require_once "inc/models/games.php";
require_once "inc/models/players.php";
$action = 'init-game-prepare';
$again = true;
if (isset($_POST['name']) && $_POST['name'] != '' && isset($_POST['amount']) && $_POST['amount'] != '' && isset($_POST['story']) && $_POST['story'] != '') {
    $name = $_POST['name'];
    $state = 1;
    $current_round = 1;
    $current_player = 0;
    $story_id = $_POST['story'];
    $start_time = date("Y-m-d H:i:s");
    $gameObject = new Games($name, $state, $current_round, $current_player, $story_id, $start_time);
    $gameObject->insert();
    $gameid = mysql_insert_id();
    $_POST['gameid'] = $gameid;
    // Set POST-Variable to current Game-ID
    for ($i = 0; $i < $_POST['amount']; $i++) {
        $playerObject = new Players($gameid, "{JSON Text}");
        $playerObject->insert();
    }
    $action = 'show-player';
} else {
    $msgObject = array("type" => "danger", "msg" => "Bitte alle Felder korrekt ausfüllen!");
}
Ejemplo n.º 18
0
<?php

//This script will update all records in the gamesinfo table
require_once dirname(__FILE__) . '/../../../www/config.php';
$pdo = new nzedb\db\Settings();
$game = new Games(['Echo' => true, 'Settings' => $pdo]);
$res = $pdo->query(sprintf("SELECT searchname FROM releases WHERE gamesinfo_id IS NULL AND categoryid = 4050 ORDER BY id DESC LIMIT 100"));
$total = count($res);
if ($total > 0) {
    echo $pdo->log->header("Updating game info for " . number_format($total) . " releases.");
    foreach ($res as $arr) {
        $starttime = microtime(true);
        $gameInfo = $game->parseTitle($arr['searchname']);
        if ($gameInfo !== false) {
            $gameData = $game->updateGamesInfo($gameInfo);
            if ($gameData === false) {
                echo $pdo->log->primary($gameInfo['release'] . ' not found');
            }
        }
        // amazon limits are 1 per 1 sec
        $diff = floor((microtime(true) - $starttime) * 1000000);
        if (1000000 - $diff > 0) {
            echo $pdo->log->alternate("Sleeping");
            usleep(1000000 - $diff);
        }
    }
}
Ejemplo n.º 19
0
首页</a>>><a href="../../list/<?php 
echo $model->gid;
?>
"><?php 
echo ArticleType::model()->getArticleTypeName($model->tid);
?>
-></a><b class="cl"><?php 
echo $model->tilte;
?>
</b></h1>-->
      <h1>
      	<?php 
echo CHtml::link('918首页>>', array('site/index'));
?>
      	<?php 
$getGamesName = Games::model()->getGamesName($model->gid);
echo CHtml::link($getGamesName[0] . '>>', array('article/index', 'id' => $model->gid));
?>
      	<?php 
echo CHtml::link(ArticleType::model()->getArticleTypeName($model->tid) . '>>', array('article/list', 'id' => $model->gid, 'tid' => $model->tid));
?>
      	<div style="color:#FC8D03;"><?php 
echo $model->tilte;
?>
</div>
      </h1>
      <style>
      	#meirong h1{
      		padding:0;
			margin:0;
			line-height:47px;
Ejemplo n.º 20
0
echo $form->error($model, 'imgurl');
echo $form->error($model, 'content');
echo $form->error($model, 'display');
?>
<table width="900" border="0"  class="table_b">
  <tr>
    <th>文章标题:</th>
    <td><?php 
echo $form->textField($model, 'tilte', array('class' => 'text', 'maxlength' => 255));
?>
</td>
  </tr>
    <tr>
    <th>游戏:</th>
    <td><?php 
echo $form->dropDownList($model, 'gid', Games::model()->getGamesAllShow(), array('class' => 'select'));
?>
</td>
  </tr>
  <tr>
    <th>栏目:</th>
    <td><?php 
echo $form->dropDownList($model, 'tid', ArticleType::model()->getArticleType(), array('class' => 'select'));
?>
</td>
  </tr>
  <tr>
    <th>关键字:</th>
    <td><?php 
echo $form->textField($model, 'keywords', array('size' => 50, 'maxlength' => 50, 'class' => 'text'));
?>
Ejemplo n.º 21
0
 /**
           Gets array of JSON encoded 'web backpacks', containing player information relating to items, attributes, and notes gained throughout a game. For an example of its use, see 'getBackPacksFromArray.html'.
           @param: bpReqObj- a JSON encoded object with two fields:
           gameId- An integer representing the game_id of the game information desired.
           playerArray- Either a JSON encoded array of integer player_ids of all the players whose information is desired, a single integer if only one player's information is desired, or nothing if all player information for an entire game is desired.
           @returns: On success, returns JSON encoded game object with a parameter containing an array of player objects with various parameters describing a player's information.
           If gameId is empty, returns 'Error- Empty Game' and aborts the function.
           If game with gameId does not exist, returns 'Error- Invalid Game Id' and aborts the function.
           If playerArray is anything other than the specified options, returns 'Error- Invalid Player Array' and aborts the function.
          **/
 public static function getPlayerBackpacksFromArray($bpReqObj)
 {
     $gameId = $bpReqObj['gameId'];
     $playerArray = $bpReqObj['playerArray'];
     $getItems = isset($bpReqObj['items']) ? $bpReqObj['items'] : true;
     //Default true
     $getAttributes = isset($bpReqObj['attributes']) ? $bpReqObj['attributes'] : true;
     //Default true
     $getNotes = isset($bpReqObj['notes']) ? $bpReqObj['notes'] : true;
     //Default true
     if (is_numeric($gameId)) {
         $gameId = intval($gameId);
     } else {
         return new returnData(1, "Error- Empty Game " . $gameId);
     }
     if (($game = Games::getDetailedGameInfo($gameId)) == "Invalid Game Id") {
         return new returnData(1, "Error- Empty Game " . $gameId);
     }
     if (is_null($playerArray)) {
         $game->backpacks = Players::getAllPlayerDataBP($gameId, $getItems, $getAttributes, $getNotes);
         return new returnData(0, $game);
     } else {
         if (is_array($playerArray)) {
             $game->backpacks = Players::getPlayerArrayDataBP($gameId, $playerArray, $getItems, $getAttributes, $getNotes);
             return new returnData(0, $game);
         } else {
             if (is_numeric($playerArray)) {
                 $game->backpacks = Players::getSinglePlayerDataBP($gameId, intval($playerArray), false, $getItems, $getAttributes, $getNotes);
                 return new returnData(0, $game, true);
             } else {
                 return new returnData(1, "Error- Invalid Player Array");
             }
         }
     }
 }
<?php

require_once "inc/models/games.php";
if (isset($_GET['id'])) {
    $id = $_GET['id'];
    $game = Games::selectById($id);
}
$again = false;
$view = 'game-delete';
Ejemplo n.º 23
0
     $xxx = $x->getXXXInfo($data['xxxinfo_id']);
     if (isset($xxx['trailers'])) {
         $xxx['trailers'] = $x->insertSwf($xxx['classused'], $xxx['trailers']);
     }
     if ($xxx && isset($xxx['title'])) {
         $xxx['title'] = str_replace(array('/', '\\'), '', $xxx['title']);
         $xxx['actors'] = $x->makeFieldLinks($xxx, 'actors');
         $xxx['genre'] = $x->makeFieldLinks($xxx, 'genre');
         $xxx['director'] = $x->makeFieldLinks($xxx, 'director');
     } else {
         $xxx = false;
     }
 }
 $game = '';
 if ($data['gamesinfo_id'] != '') {
     $g = new Games();
     $game = $g->getGamesInfo($data['gamesinfo_id']);
 }
 $mus = '';
 if ($data['musicinfoid'] != '') {
     $music = new Musik(['Settings' => $page->settings]);
     $mus = $music->getMusicInfo($data['musicinfoid']);
 }
 $book = '';
 if ($data['bookinfoid'] != '') {
     $b = new Book();
     $book = $b->getBookInfo($data['bookinfoid']);
 }
 $con = '';
 if ($data['consoleinfoid'] != '') {
     $c = new Console();
Ejemplo n.º 24
0
<?php

require_once "inc/models/stories.php";
require_once "inc/models/games.php";
$storyArray = Stories::selectAll();
$gameArray = Games::selectAll();
if (!isset($msgObject["msg"])) {
    $msgObject["msg"] = '';
}
$again = false;
$view = 'init-game';
Ejemplo n.º 25
0
 public function actionGameupd()
 {
     $id = intval(Yii::app()->request->getParam('id'));
     $game = Games::model()->findByPk($id);
     $this->json_return(true, $game ? $game->movetime : '');
 }
Ejemplo n.º 26
0
    ?>
/member/idcard" style="color:red;text-decoration:none;">立即认证&gt&gt&gt</a>
  <?php 
}
?>
  <form>
  </form>
  </div>
  <div class="mr_game">
  <h1>玩过的游戏</h1>
  <ul>
  <?php 
$memberGamesarr = MemberGames::model()->getMemberGames(Yii::app()->user->id);
if ($memberGamesarr) {
    foreach ($memberGamesarr as $value) {
        $value = unserialize($value);
        $memberGamesname = Games::model()->getGamesName($value['gid']);
        if ($memberGamesname) {
            $memberGamesimages = Games::model()->getGamesImage($value['gid']);
            $GetGamesServerId = Games::model()->getGamesServerValue($value['gid'], $value['serveridvalue']);
            echo "<li><a target='_blanck' href='" . Yii::app()->request->baseUrl . "/gameslogin/index?gametype=" . $memberGamesname[1] . "&serverid=" . $GetGamesServerId . "'><img alt='" . $memberGamesname[0] . "-" . $GetGamesServerId . "区' title='" . $memberGamesname[0] . "-" . $GetGamesServerId . "区' height='64px' width='64px' src='http://918s-game.stor.sinaapp.com/" . $memberGamesimages[1] . "'/><p>" . $memberGamesname[0] . "</p></a></li>";
        }
    }
} else {
    echo '暂时没有玩过任何游戏!';
}
?>

  </ul>

  </div>
Ejemplo n.º 27
0
?>
</strong>元</td><th>  成交总额</th><td><strong><?php 
if ($model['ordertotalprice']) {
    echo $model['ordertotalprice'];
} else {
    echo 0;
}
?>
</strong>元</td>
</tr>
<tr class="ever"><th>
今日
<select id="gamespay" onchange="gamepay()">

<?php 
$game = Games::model()->getGamesAllShow();
print_r($game);
foreach ($game as $key => $value) {
    if ($_GET['game'] == $key) {
        echo '<option value="' . $key . '" selected="selected">' . $value . '</option>';
    } else {
        echo '<option value="' . $key . '">' . $value . '</option>';
    }
}
?>
</select>
成交订单</th><td><strong><?php 
if ($model['dayordergame']) {
    echo $model['dayordergame'];
} else {
    echo 0;
Ejemplo n.º 28
0
<pre>
<?php 
$start = "It's good to yell at people and tell people that you're from Tennesee, so that way you'll be safe. The best way to communicate is compatible. Compatible communication is listening with open ears and an open mind, and not being fearful or judgemental about what you're hearing.\t";
require_once "res/include.php";
echo "start";
echo "<br/>";
$name = Games::generateUniqueName($start, "2010");
echo $name;
$game = new Games();
$game->setName($name);
$game->save();
echo "<br/>";
$name = Games::generateUniqueName($start, "2010");
echo $name;
echo "<br/>";
echo "end";
?>
</pre>
Ejemplo n.º 29
0
 /**
  * Импортирует игры из xml фида партнерки в базу данных
  * @return страница с результатами
  */
 public function actionImport()
 {
     //получаем список всех жанров
     $types = Types::model()->findAll();
     //ищем все сохраненные игры (их id)
     $existingIds = Games::model()->getExistingIds();
     $errors = array();
     $results = '';
     //обработка команды
     if (isset($_POST['import'])) {
         libxml_use_internal_errors(true);
         //загружаем xml фид
         $xml = simplexml_load_file(Yii::app()->user->xml);
         if (!$xml) {
             $errors = libxml_get_errors();
         } else {
             $i = 0;
             //парсинг фида
             foreach ($xml->result->ITEM as $game) {
                 //если эта игра уже сохранена...
                 if (in_array($game->ID, $existingIds)) {
                     //...переходим к следующей
                     continue;
                 }
                 //создаем новую игру
                 $newGame = new Games();
                 //заполняем атрибуты
                 $newGame->g_id = $game->ID;
                 $newGame->g_rate = $game->RATE;
                 $newGame->g_name_url = $game->NAME_URL;
                 $newGame->g_type = $game->TYPE;
                 $newGame->g_added = $game->ADDED;
                 $newGame->g_size = $game->SIZE;
                 $newGame->g_name = $game->NAME;
                 $newGame->g_medium_pic = $game->MEDIUM_PIC;
                 $newGame->g_small_pic = $game->SMALL_PIC;
                 $newGame->g_download_link = $game->DOWNLOAD_LINK;
                 $newGame->g_shortdescr = $game->SHORTDESCR;
                 $newGame->g_fulldescr = $game->FULLDESCR;
                 $newGame->g_publish_date = date('Y-m-d', time());
                 $newGame->g_state = Games::PUBLISHED;
                 //записываем массив со скриншотами
                 foreach ($game->SCREENSHOT as $sh) {
                     $newGame->g_screenshots[] = $sh;
                 }
                 //разбираем поле с жанрами
                 foreach ($types as $type) {
                     if ($newGame->g_type & $type['t_id']) {
                         $newGame->g_types[] = $type['t_id'];
                     }
                 }
                 //сохраняем игру в БД
                 //сохранение скриншотов и жанров выполняетя в Games::afterSave()
                 if (!$newGame->save()) {
                     $errors[] = 'Не могу сохранить игру id = ' . $newGame->g_id;
                 } else {
                     $i++;
                 }
             }
             $results = 'Сохранено новых игр ' . $i;
         }
     }
     //показываем форму
     $this->render('import', array('xml' => Yii::app()->user->xml, 'errors' => $errors, 'results' => $results));
 }
Ejemplo n.º 30
-7
function getOddGames()
{
    global $pdo;
    $res = $pdo->query('
				SELECT searchname, id, categoryid
				FROM releases
				WHERE nzbstatus = 1
				AND gamesinfo_id = 0
				AND categoryid BETWEEN 4010 AND 4020
				ORDER BY postdate DESC LIMIT 150');
    if ($res !== false) {
        $pdo->log->doEcho($pdo->log->header("Processing... 150 release(s)."));
        $gen = new Games(['Echo' => true, 'Settings' => $pdo]);
        //Match on 78% title
        $gen->matchPercentage = 78;
        foreach ($res as $arr) {
            $startTime = microtime(true);
            $usedgb = true;
            $gameInfo = $gen->parseTitle($arr['searchname']);
            if ($gameInfo !== false) {
                $pdo->log->doEcho($pdo->log->headerOver('Looking up: ') . $pdo->log->primary($gameInfo['title']));
                // Check for existing games entry.
                $gameCheck = $gen->getGamesInfoByName($gameInfo['title']);
                if ($gameCheck === false) {
                    $gameId = $gen->updateGamesInfo($gameInfo);
                    $usedgb = true;
                    if ($gameId === false) {
                        $gameId = -2;
                        //If result is empty then set gamesinfo_id back to 0 so we can parse it at a later time.
                        if ($gen->maxHitRequest === true) {
                            $gameId = 0;
                        }
                    }
                } else {
                    $gameId = $gameCheck['id'];
                }
                if ($gameId != -2 && $gameId != 0) {
                    $arr['categoryid'] = 4050;
                }
                $pdo->queryExec(sprintf('UPDATE releases SET gamesinfo_id = %d, categoryid = %d WHERE id = %d', $gameId, $arr['categoryid'], $arr['id']));
            } else {
                // Could not parse release title.
                $pdo->queryExec(sprintf('UPDATE releases SET gamesinfo_id = %d WHERE id = %d', -2, $arr['id']));
                echo '.';
            }
            // Sleep so not to flood giantbomb.
            $diff = floor((microtime(true) - $startTime) * 1000000);
            if ($gen->sleepTime * 1000 - $diff > 0 && $usedgb === true) {
                usleep($gen->sleepTime * 1000 - $diff);
            }
        }
    } else {
        $pdo->log->doEcho($pdo->log->header('No games in 0day/ISO to process.'));
    }
}