Exemple #1
0
 protected function setup()
 {
     $roleAlias = Utils::get('identifier');
     $roleRepository = new RoleRepository(TRUE);
     $role = $roleRepository->getOneByAlias($roleAlias);
     MySmarty::assign('role', $role);
 }
Exemple #2
0
 protected function run()
 {
     if ($this->check == self::OK) {
         $this->attackingCards = $this->cards;
         $nextPositionPlayer = $this->findNextPlayerWithHandCards($this->game, $this->actualPlayer, $this->actualPlayer);
         if ($nextPositionPlayer['id'] != $this->actualPlayer['id']) {
             foreach ($this->players as $player) {
                 if ($player->getIsAlive()) {
                     if ($player['id'] == $this->actualPlayer['id']) {
                         $this->actualPlayer['phase'] = Player::PHASE_WAITING;
                         $this->actualPlayer->save();
                     } else {
                         if ($player['id'] == $nextPositionPlayer['id']) {
                             $player['phase'] = Player::PHASE_UNDER_ATTACK;
                         }
                         MySmarty::assign('card', $this->cards[0]);
                         $response = MySmarty::fetch($this->template);
                         $player['command_response'] = $response;
                         $player->save();
                     }
                 }
             }
             $this->game['inter_turn_reason'] = serialize(array('action' => 'poker', 'from' => $this->actualPlayer['id'], 'to' => $nextPositionPlayer['id'], 'thrownCards' => array()));
             $this->game['inter_turn'] = $nextPositionPlayer['id'];
             $this->game->save();
         } else {
             // bola by blbost hrat kartu poker ak nikto iny nema karty na ruke
         }
         GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards);
     }
 }
Exemple #3
0
 protected function setup()
 {
     $roleRepository = new RoleRepository(TRUE);
     $roleRepository->addGroupBy('type');
     $roles = $roleRepository->getAll();
     MySmarty::assign('roles', $roles);
 }
 protected function setup()
 {
     $characterRepository = new CharacterRepository(TRUE);
     $characterRepository->addOrderBy(array('name' => 'ASC'));
     $characters = $characterRepository->getAll();
     MySmarty::assign('characters', $characters);
 }
Exemple #5
0
 public function getContent()
 {
     if (LoggedUser::whoIsLogged()) {
         if (isset($_COOKIE['ref_url'])) {
             $url = $_COOKIE['ref_url'];
             $absolute = FALSE;
         } else {
             $page = PageActionMap::getPageByTypeAndLanguage('rooms');
             $url = PageActionMap::createUrl($page['alias']);
             $absolute = TRUE;
         }
         Utils::redirect($url, $absolute);
     }
     if (Utils::post('login')) {
         MySmarty::assign('username', Utils::post('username'));
         $validation = LoggedUser::userLogin();
         //var_Dump($validation);exit();
         if ($validation === TRUE) {
             Utils::redirect(Utils::getActualUrlWithoutGetParameters(), FALSE);
         } else {
             MySmarty::assign('errors', $validation);
         }
     }
     return MySmarty::fetch('login.tpl');
 }
Exemple #6
0
 /**
  * ページを表示する。
  *
  * @param	array(string => string)	$value	スキンに渡す値。bodyとtitleは必須。
  */
 function render($value)
 {
     $command = array();
     foreach (Command::getCommands() as $c) {
         $html = $c->getbody();
         if ($html != '') {
             $command[substr(get_class($c), 8)] = $html;
         }
     }
     $plugin = array();
     foreach (Plugin::getPlugins() as $c) {
         $html = $c->getbody();
         if ($html != '') {
             $plugin[substr(get_class($c), 7)] = $html;
         }
     }
     $this->smarty->assign('command', $command);
     $this->smarty->assign('plugin', $plugin);
     $this->smarty->assign('option', $this->option);
     $this->smarty->assign('headeroption', $this->headeroption);
     $this->smarty->assign('theme', $this->theme);
     $this->smarty->assign($value);
     header('Content-Type: text/html; charset=UTF-8');
     $this->smarty->assign('runningtime', sprintf('%.3f', mtime() - STARTTIME));
     $this->smarty->display(SKINFILE);
 }
Exemple #7
0
 protected function run()
 {
     if ($this->check == self::OK) {
         // TODO moze sa stat ze hraju uz len dvaja apache kid a utocnik - asi staci ak skontrolujeme ci next pos player != od actual
         $this->attackingCards = $this->cards;
         $nextPositionPlayer = $this->getNextPositionPlayer($this->game, $this->actualPlayer);
         foreach ($this->players as $player) {
             if ($player->getIsAlive()) {
                 if ($player['id'] == $this->actualPlayer['id']) {
                     $this->actualPlayer['phase'] = Player::PHASE_WAITING;
                     $this->actualPlayer->save();
                 } else {
                     if ($player['id'] == $nextPositionPlayer['id']) {
                         $player['phase'] = Player::PHASE_UNDER_ATTACK;
                     }
                     MySmarty::assign('card', $this->cards[0]);
                     $response = MySmarty::fetch($this->template);
                     $player['command_response'] = $response;
                     $player->save();
                 }
             }
         }
         $this->game['inter_turn_reason'] = serialize(array('action' => 'wild_band', 'from' => $this->actualPlayer['id'], 'to' => $nextPositionPlayer['id'], 'cards' => $this->getCardIds()));
         $this->game['inter_turn'] = $nextPositionPlayer['id'];
         $this->game->save();
         GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards);
     }
 }
Exemple #8
0
 protected function setup()
 {
     $cardRepository = new CardRepository(TRUE);
     $cardRepository->setGroupBy('card_base_type');
     $cards = $cardRepository->getAll();
     MySmarty::assign('cards', $cards);
 }
Exemple #9
0
 protected function run()
 {
     if ($this->check == self::OK) {
         $nextPositionPlayer = GameUtils::getPlayerOnNextPosition($this->game, $this->actualPlayer);
         foreach ($this->players as $player) {
             if ($player->getIsAlive()) {
                 if ($player['id'] == $this->actualPlayer['id']) {
                     $this->actualPlayer['phase'] = Player::PHASE_WAITING;
                     if ($this->actualPlayer->getIsBelleStar($this->game)) {
                         $notices = $this->actualPlayer->getNoticeList();
                         $notices['character_used'] = 1;
                         $this->actualPlayer->setNoticeList($notices);
                     }
                     $this->actualPlayer->save();
                 } else {
                     if ($player['id'] == $nextPositionPlayer['id']) {
                         $player['phase'] = Player::PHASE_UNDER_ATTACK;
                     }
                     MySmarty::assign('card', $this->cards[0]);
                     $response = MySmarty::fetch($this->template);
                     $player['command_response'] = $response;
                     $player->save();
                 }
             }
         }
         $this->game['inter_turn_reason'] = serialize(array('action' => 'gatling', 'from' => $this->actualPlayer['id'], 'to' => $nextPositionPlayer['id']));
         $this->game['inter_turn'] = $nextPositionPlayer['id'];
         $this->game->save();
         GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards);
     }
 }
Exemple #10
0
 protected function setup()
 {
     $pageTypeRepository = new PageTypeRepository(TRUE);
     $pageType = $pageTypeRepository->getOneByAlias(Utils::get('action'));
     $pageRepository = new PageRepository(TRUE);
     $page = $pageRepository->getOneByPageType($pageType['id']);
     MySmarty::assign('page', $page);
 }
Exemple #11
0
 public function main()
 {
     $room = intval($_POST['room']);
     $game = intval($_POST['game']);
     $loggedUser = LoggedUser::whoIsLogged();
     $lastActivity = Room::getUserLastActivityInRoom($loggedUser['id'], $room);
     Room::updateUserLastActivity($loggedUser['id'], $room);
     MySmarty::assign('messages', Chat::getMessages($room, $loggedUser['id'], 0, $game));
     echo MySmarty::fetch('message-box.tpl');
 }
 protected function setup()
 {
     $characterAlias = Utils::get('identifier');
     $characterRepository = new CharacterRepository(TRUE);
     $character = $characterRepository->getOneByAlias($characterAlias);
     BangSeo::addTitlePart($character['name']);
     if ($character->getLocalizedDescription()) {
         BangSeo::setDescription($character->getLocalizedDescription());
     }
     MySmarty::assign('character', $character);
 }
Exemple #13
0
 protected function createResponse()
 {
     if ($this->check == self::OK) {
         // TODO prerobit tak aby to fungovalo aj bez javascriptu, onclick treba nahradit niecim inym, pripadne doplnit tlacitko ktore skryje ten overlay
         MySmarty::assign('card', $this->cards[0]);
         $response = MySmarty::fetch($this->template);
         $this->attackedPlayer['command_response'] = $response;
         $this->attackedPlayer->save();
     }
     return '';
 }
Exemple #14
0
 protected function setup()
 {
     $loggedUser = LoggedUser::whoIsLogged();
     if ($loggedUser) {
         MySmarty::assign('loggedUser', $loggedUser);
         $logoutPage = PageActionMap::getPageByTypeAndLanguage('logout');
         MySmarty::assign('logoutPage', $logoutPage);
     } else {
         $loginPage = PageActionMap::getPageByTypeAndLanguage('login');
         MySmarty::assign('loginPage', $loginPage);
     }
     MySmarty::assign('language', Utils::get('language'));
 }
Exemple #15
0
 protected function setup()
 {
     $loggedUser = LoggedUser::whoIsLogged();
     if ($this->room !== NULL) {
         Room::addUser($loggedUser['id'], $this->room['id']);
         $messages = Chat::getMessages($this->room['id'], $loggedUser['id'], 0, $this->game['id']);
         MySmarty::assign('loggedUser', $loggedUser);
         MySmarty::assign('messages', $messages);
         MySmarty::assign('users', Room::getUsers($this->room['id']));
         MySmarty::assign('emoticonDir', EMOTICONS_DIR);
         MySmarty::assign('emoticons', Emoticons::getEmoticons());
         MySmarty::assign('room', $this->room);
     }
 }
Exemple #16
0
 protected function setup()
 {
     $cardAlias = Utils::get('identifier');
     $cardBaseTypeRepository = new CardBaseTypeRepository(TRUE);
     $cardBaseType = $cardBaseTypeRepository->getOneByAlias($cardAlias);
     if ($cardBaseType) {
         $cardRepository = new CardRepository(TRUE);
         $card = $cardRepository->getOneByCardBaseType($cardBaseType['id']);
     }
     BangSeo::addTitlePart($card->getTitle());
     if ($card->getDescription()) {
         BangSeo::setDescription($card->getDescription());
     }
     MySmarty::assign('card', $card);
 }
Exemple #17
0
 protected function setup()
 {
     $loggedUser = LoggedUser::whoIsLogged();
     if (Utils::post('change_settings')) {
         // TODO check if password and confirm password match
         $loggedUser['password'] = md5(Utils::post('password'));
         $loggedUser['name'] = Utils::post('name');
         $loggedUser['surname'] = Utils::post('surname');
         $loggedUser['color'] = intval(Utils::post('color'));
         $loggedUser->save();
     }
     MySmarty::assign('loggedUser', $loggedUser);
     $colorRepository = new ColorRepository();
     $colors = $colorRepository->getAll();
     MySmarty::assign('colors', $colors);
 }
Exemple #18
0
 protected function setup()
 {
     $loggedUser = LoggedUser::whoIsLogged();
     if (Utils::post('create_room') && $loggedUser['admin']) {
         $params = array('title' => Utils::post('title'), 'alias' => Utils::createAlias(Utils::post('title'), 'room'), 'description' => Utils::post('description'));
         $room = new Room($params);
         $room->save();
     }
     $roomRepository = new RoomRepository();
     $rooms = $roomRepository->getAll();
     $gameRepository = new GameRepository();
     $games = $gameRepository->getGamesByRooms(array_keys($rooms));
     foreach ($games as $game) {
         $rooms[$game['room']]['game'] = TRUE;
         $rooms[$game['room']]['status'] = Localize::getMessage('room_status_' . $game['status']);
     }
     MySmarty::assign('loggedUser', $loggedUser);
     MySmarty::assign('rooms', $rooms);
 }
Exemple #19
0
 protected function setup()
 {
     $pages = array();
     $pageTypeRepository = new PageTypeRepository(TRUE);
     $hasSelected = FALSE;
     foreach ($this->pageTypes as $pageTypeAlias) {
         $page = PageActionMap::getPageByTypeAndLanguage($pageTypeAlias);
         if ($page) {
             if ($hasSelected === FALSE) {
                 $pageType = $pageTypeRepository->getOneByAlias($pageTypeAlias);
                 if ($pageType['action'] == $this->actualAction) {
                     $page['sel'] = TRUE;
                     $hasSelected = TRUE;
                 }
             }
             $pages[] = $page;
         }
     }
     MySmarty::assign('pages', $pages);
 }
Exemple #20
0
 protected function setup()
 {
     $loggedUser = LoggedUser::whoIsLogged();
     MySmarty::assign('loggedUser', $loggedUser);
     MySmarty::assign('room', $this->room);
     if ($this->game) {
         MySmarty::assign('game', $this->game);
         MySmarty::assign('gameStartedStatus', Game::GAME_STATUS_STARTED);
         $playerRepository = new PlayerRepository();
         $actualPlayer = $playerRepository->getOneByGameAndUser($this->game['id'], $loggedUser['id']);
         // phases when we want to make autoreload
         $refreshGameBox = FALSE;
         if (in_array($actualPlayer['phase'], array(Player::PHASE_NONE, Player::PHASE_WAITING))) {
             if ($this->game['status'] == Game::GAME_STATUS_INITIALIZED && $actualPlayer['possible_choices'] != '') {
                 $refreshGameBox = FALSE;
             } else {
                 $refreshGameBox = TRUE;
             }
         }
         MySmarty::assign('refreshGameBox', $refreshGameBox);
         // zobrazime len hracovi ktory je na tahu resp. v medzitahu
         $playerOnMove = $this->game->getPlayerOnMove();
         if ($playerOnMove['id'] == $actualPlayer['id'] || $this->game['status'] == Game::GAME_STATUS_INITIALIZED) {
             MySmarty::assign('response', $actualPlayer['command_response']);
         }
         if ($this->game['status'] == Game::GAME_STATUS_CREATED) {
             if (!GameUtils::checkUserInGame($loggedUser, $this->game)) {
                 MySmarty::assign('joinGameAvailable', TRUE);
             } elseif ($loggedUser['id'] == $this->game['creator']) {
                 MySmarty::assign('startGameAvailable', Localize::getMessage('start_game'));
             }
         } elseif ($this->game['status'] == Game::GAME_STATUS_ENDED) {
             MySmarty::assign('createGameAvailable', Localize::getMessage('create_game'));
             MySmarty::assign('refreshGameBox', TRUE);
         }
     } else {
         MySmarty::assign('createGameAvailable', Localize::getMessage('create_game'));
         MySmarty::assign('refreshGameBox', TRUE);
     }
 }
Exemple #21
0
 protected function setup()
 {
     // cards
     $cardBaseTypeRepository = new CardBaseTypeRepository(TRUE);
     $validCardBaseTypes = $cardBaseTypeRepository->getByValid(1);
     $validCardBaseTypesIdList = array();
     foreach ($validCardBaseTypes as $cardBaseType) {
         $validCardBaseTypesIdList[] = $cardBaseType['id'];
     }
     $cardRepository = new CardRepository(TRUE);
     $cardRepository->setGroupBy('card_base_type');
     $cards = $cardRepository->getAll();
     $validCards = array();
     $notValidCards = array();
     foreach ($cards as $card) {
         if (in_array($card['card_base_type'], $validCardBaseTypesIdList)) {
             $validCards[] = $card;
         } else {
             $notValidCards[] = $card;
         }
     }
     MySmarty::assign('validCards', $validCards);
     MySmarty::assign('notValidCards', $notValidCards);
     // characters
     $characterRepository = new CharacterRepository(TRUE);
     $characters = $characterRepository->getAll();
     $validCharacters = array();
     $notValidCharacters = array();
     foreach ($characters as $character) {
         if ($character['valid'] == 1) {
             $validCharacters[] = $character;
         } else {
             $notValidCharacters[] = $character;
         }
     }
     MySmarty::assign('validCharacters', $validCharacters);
     MySmarty::assign('notValidCharacters', $notValidCharacters);
 }
Exemple #22
0
** ------------------------------------------------------------------
**
** This code is part of http://picurls.com - buzziest pics website.
** Read how it was designed at:
** http://catonmat.net/blog/making-of-picurls-popurls-for-pictures-part-one/
**
*/
error_reporting(E_ALL);
if (!$included_from_index) {
    header("Location: {$SITE_URL}");
    exit;
}
require_once 'mysmarty.php';
require_once 'system/db.sqlite.php';
$smarty = new MySmarty();
$smarty->assign('tpl_content', 'content-login-register.tpl.html');
$smarty->assign('page_style', 'style-login.css');
if ($_SERVER['REQUEST_METHOD'] != "POST") {
    $smarty->assign('page_title', 'login into picurls!');
    $smarty->assign('page_description', 'Login into picurls, buzziest pics on the net website!');
    $smarty->display('index.tpl.html');
    exit;
}
$error = false;
if (!isset($_POST['username'])) {
    $error = "No username was specified!";
} else {
    if (!isset($_POST['password'])) {
        $error = "No password was specified!";
    } else {
        if (empty($_POST['username'])) {
<?php

require_once '../includes/config.inc';
require_once '../includes/access.inc';
$requestedUrl = isset($_REQUEST['ref']) ? base64_decode(htmlentities($_REQUEST['ref'])) : $BASE_URL . '/dashboard.php';
$submitted = isset($_REQUEST['submitted']);
$username = isset($_REQUEST['username']) ? htmlentities($_REQUEST['username']) : false;
$password = isset($_REQUEST['password']) ? htmlentities($_REQUEST['password']) : false;
$smarty = new MySmarty($SMARTY_CONFIG);
if ($submitted) {
    try {
        $access = new Access();
        if ($access->authenticate($username, $password)) {
            header("Location: " . $requestedUrl);
            exit;
        } else {
            $smarty->assign('errorMessage', 'Username or Password is incorrect. Please try logging in again.');
        }
    } catch (AccessDeniedException $e) {
        header('HTTP/1.1 401 Access Denied');
        echo "AccessDeniedException: " . $e->getMessage();
    } catch (Exception $e) {
        header('HTTP/1.1 500 Internal Server Error');
        echo "Exception: " . $e->getMessage();
    }
}
$smarty->assign('login', 'login');
$smarty->display('login.tpl');
Exemple #24
0
** 
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program.  If not, see <http://www.gnu.org/licenses/>.
**
** ------------------------------------------------------------------
**
** This code is part of http://picurls.com - buzziest pics website.
** Read how it was designed at:
** http://catonmat.net/blog/making-of-picurls-popurls-for-pictures-part-one/
**
*/
error_reporting(E_ALL);
if (!$included_from_index) {
    header("Location: {$SITE_URL}");
    exit;
}
require_once 'mysmarty.php';
$smarty = new MySmarty();
$smarty->assign('tpl_content', 'content-error.tpl.html');
$smarty->assign('error', $error);
$smarty->display('index.tpl.html');
<?php

error_reporting(E_ERROR | E_PARSE);
//Easy Code No warings/notices errors
require_once __DIR__ . '/include/globals.php';
require_once SERVER_CLASS;
//Paste to unlock
require_once DB1_CLASS;
require_once MYSMARTY_CLASS;
session_start();
if (!isset($_SESSION['carinfo']) || !isset($_GET['cartype']) || !isset($_GET['maker']) || !isset($_GET['model']) || !isset($_GET['year'])) {
    header('Location: ' . WEB_JACPHP . 'select_cartype.php');
}
$cartype = filter_input(INPUT_GET, 'cartype');
$maker = filter_input(INPUT_GET, 'maker');
$model = filter_input(INPUT_GET, 'model');
$year = filter_input(INPUT_GET, 'year');
$smarty = new MySmarty();
$smarty->assign('header', '_no-sidebar.tpl');
$smarty->assign('question', '5. Select a transmisson');
$smarty->assign('next_question', 'tyler.php');
$smarty->assign('param', '?cartype=' . $cartype . '&maker=' . $maker . '&model=' . $model . '&year=' . $year . '&transmission=');
$smarty->assign('answers', $_SESSION['carinfo'][$cartype][$maker][$model][$year]);
$smarty->display('question.tpl');
Exemple #26
0
 protected function createResponse()
 {
     if ($this->check == self::OK) {
         if ($this->params['playCardName'] == 'jail') {
         } elseif ($this->params['playCardName'] == 'dynamite') {
         } elseif ($this->params['playCardName'] == 'barrel') {
         } else {
             if ($this->actualPlayer['possible_choices']) {
                 $possibleChoices = unserialize($this->actualPlayer['possible_choices']);
                 $cardRepository = new CardRepository();
                 $possibleCards = array();
                 foreach ($possibleChoices['drawn_cards'] as $cardId) {
                     $possibleCards[] = $cardRepository->getOneById($cardId);
                 }
                 MySmarty::assign('possiblePickCount', $possibleChoices['possible_pick_count']);
                 MySmarty::assign('possibleCards', $possibleCards);
                 MySmarty::assign('possibleCardsCount', count($possibleCards));
                 MySmarty::assign('game', $this->game);
                 $response = MySmarty::fetch($this->template);
                 $this->actualPlayer['command_response'] = $response;
                 $this->actualPlayer->save();
                 return $response;
             }
         }
     }
 }
                $activity->setUser($user);
                $activity->setImportNumber(-1);
                $activity->setImportTime(new Date());
                $activity->setName($data['name']);
                $activity->setTransactionDate(new Date($_POST['data']['transdate']));
                $activity->setAmount($data['amount']);
                if ($data['category'] != null && trim($data['category']) && $data['category'] != 'null') {
                    $activity->setCategory(Factory::getView(new CategoryKey(trim($data['category']))));
                }
                $transaction->commit();
                break;
        }
        echo json_encode(array('success' => 'true'));
    } else {
        $smarty = new MySmarty($SMARTY_CONFIG);
        $smarty->assign('res', $user->getActivities());
        $userCategories = Category::getOptions(array("USER_ID" => $user->getId(), "ACTIVE" => 1));
        $allCategories = Category::getOptions(array("ACTIVE" => 1));
        $categories = '';
        foreach ($userCategories as $index => $value) {
            $categories .= "{\"value\": \"{$index}\", \"label\": \"{$value}\"},";
        }
        $smarty->assign('allCategories', $categories);
        $smarty->assign('user', $user);
        $smarty->assign('left_menu', true);
        //$smarty->assign('BASE_URL', $BASE_URL);
        $smarty->display('transactions.tpl');
    }
} catch (AccessDeniedException $e) {
    header('HTTP/1.1 401 Access Denied');
    echo "AccessDeniedException: " . $e->getMessage();
Exemple #28
0
 protected function run()
 {
     if ($this->check == self::OK) {
         $place = $this->params['place'];
         if (!$place) {
             $place = 'hand';
         }
         // aj Vera Custer moze hrat za Garyho Lootera
         $garyLooters = array();
         foreach ($this->getPlayers() as $player) {
             // pozrieme sa na vsetkych hracov ktori este nie su mrtvi a ani nie su aktualny hrac
             if ($player['actual_lifes'] > 0 && $this->actualPlayer['id'] != $player['id']) {
                 if ($player->getIsGaryLooter($this->game)) {
                     $garyLooters[] = $player;
                 }
             }
         }
         if ($place == 'hand' && $garyLooters) {
             // vymysliet ako davat Garymu a Vere karty na striedacku - zatial spravene len pre nahodne vybraneho Garyho
             $garyLooter = $garyLooters[array_rand($garyLooters)];
             GameUtils::moveCards($this->game, $this->cards, $this->actualPlayer, 'hand', $garyLooter, 'hand');
         } else {
             GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards, $place);
         }
         if ($place == 'table') {
             // kedze je mozne ze rusime nejaku modru kartu ktora ovplyvnuje vzdialenost, preratame maticu
             // ak to bude velmi pomale, budeme to robit len ak je medzi vyhodenymi kartami fakt takato karta
             $matrix = GameUtils::countMatrix($this->game);
             $this->game['distance_matrix'] = serialize($matrix);
             $this->game->save();
         }
         if (in_array($this->interTurnReason['action'], array('wild_band'))) {
             $this->runMollyStarkAction();
             $this->changeInterturn();
         }
     } elseif ($this->check == self::OK_JOSE_DELGADO) {
         $place = 'hand';
         GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards, $place);
         $drawnCards = GameUtils::drawCards($this->game, 2);
         $handCards = unserialize($this->actualPlayer['hand_cards']);
         $handCards = array_merge($handCards, $drawnCards);
         $this->actualPlayer['hand_cards'] = serialize($handCards);
         $notices = $this->actualPlayer->getNoticeList();
         if (isset($notices['character_used'])) {
             $notices['character_used'] = $notices['character_used'] + 1;
         } else {
             $notices['character_used'] = 1;
         }
         $this->actualPlayer->setNoticeList($notices);
         // zistit ci sa tu nahodou nestane to ze hracovi ostanu karty v ruke a este mu pribudnu dalsie
         $this->actualPlayer->save();
     } elseif ($this->check == self::OK_DOC_HOLYDAY) {
         GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards);
         MySmarty::assign('card', $this->cards[0]);
         // TODO mozno sem poslat nejake veci ze zautocil doc holyday svojim charakterom
         $response = MySmarty::fetch($this->template);
         $this->attackedPlayer['command_response'] = $response;
         $this->attackedPlayer['phase'] = Player::PHASE_UNDER_ATTACK;
         $this->attackedPlayer->save();
         $notices = $this->actualPlayer->getNoticeList();
         $notices['character_used'] = 1;
         $this->actualPlayer->setNoticeList($notices);
         $this->actualPlayer['phase'] = Player::PHASE_WAITING;
         $this->actualPlayer->save();
         $this->game['inter_turn'] = $this->attackedPlayer['id'];
         $this->game['inter_turn_reason'] = serialize(array('action' => 'doc_holyday', 'from' => $this->actualPlayer['id'], 'to' => $this->attackedPlayer['id']));
         $this->game->save();
     } elseif ($this->check == self::OK_SID_KETCHUM) {
         $additionalLifes = 1;
         $newLifes = min($this->actualPlayer['actual_lifes'] + $additionalLifes, $this->actualPlayer['max_lifes']);
         $this->actualPlayer['actual_lifes'] = $newLifes;
         $this->actualPlayer->save();
         GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards);
     } elseif ($this->check == self::OK_POKER) {
         // odlozime karty
         $handCards = unserialize($this->actualPlayer['hand_cards']);
         $newHandCards = array();
         $selectedCard = $this->cards[0];
         foreach ($handCards as $handCard) {
             if ($handCard != $selectedCard['id']) {
                 $newHandCards[] = $handCard;
             }
         }
         $this->actualPlayer['hand_cards'] = serialize($newHandCards);
         $this->actualPlayer->save();
         $this->interTurnReason['thrownCards'][] = $selectedCard['id'];
         $this->changeInterturn();
     }
 }
Exemple #29
0
 protected function createResponse()
 {
     if ($this->check == self::OK) {
         $actualPlayerResponse = '';
         foreach ($this->game->getAdditionalField('players') as $player) {
             $possibleChoices = unserialize($player['possible_choices']);
             $characterRepository = new CharacterRepository();
             $possibleCharacters = $characterRepository->getById($possibleChoices['possible_characters']);
             MySmarty::assign('possibleCharacters', $possibleCharacters);
             MySmarty::assign('player', $player);
             $response = MySmarty::fetch($this->template);
             $player['command_response'] = $response;
             $player->save();
             if ($player['id'] == $this->actualPlayer['id']) {
                 $actualPlayerResponse = $response;
             }
         }
         return $actualPlayerResponse;
     } else {
         return '';
     }
 }
<?php

require_once '../includes/config.inc';
require_once 'access.inc';
require_once 'accessdeniedexception.inc';
$smarty = new MySmarty($SMARTY_CONFIG);
try {
    $access = new Access();
    $access->authenticate(null, null, false);
    $user = $access->getUser();
    $smarty->assign('user', $user);
} catch (AccessDeniedException $e) {
    // Don't need to do anything, This just means user is not logged in.
}
$smarty->assign('left_menu', true);
$smarty->assign('about', 'about');
$smarty->display('about.tpl');