public function init() { // check if logged in session is valid, if not redir to main page if (!isset($_SESSION['loginHash'])) { Framework::Redir("site/index"); die; } $activeSession = R::findOne('session', ' hash = ? AND ip = ? AND expires > ?', array($_SESSION['loginHash'], $_SERVER['REMOTE_ADDR'], time())); if (!$activeSession) { unset($_SESSION['loginHash']); Framework::Redir("site/index/main/session_expired"); die; } $activeSession->expires = time() + SESSION_MAX_AGE * 2; R::store($activeSession); $this->session = $activeSession; $this->user = R::load('user', $this->session->user->getId()); Framework::TPL()->assign('user_premium', $this->user->hasPremium()); // check needed rights if any foreach ($this->_rights as $r) { if (!$this->user->hasRight($r)) { Framework::Redir("game/index"); die; } } }
public function show_Main() { $charImg = array(); for ($i = 1; $i <= HIGHEST_CHAR_IMG; $i++) { $charImg[] = array("id" => $i, "name" => $i < 10 ? "0" . $i : $i); } Framework::TPL()->assign('charImg', $charImg); }
public function show_Error() { Framework::TPL()->assign('status', 'error'); if (is_numeric($this->get(1))) { $id = $this->get(1); } else { $id = -1; } Framework::TPL()->assign('error', $id); }
public function __destruct() { $this->_use_scripts[] = "game"; $this->_use_scripts = Framework::bundleJavaScripts($this->_use_scripts); $this->regenerateSecureHash(); Framework::TPL()->assign("fSecureHash", $this->_secureHash); Framework::TPL()->assign("User", $this->user); Framework::TPL()->assign("js_scripts", $this->_use_scripts); Framework::TPL()->assign("template", $this->_use_tpl); Framework::TPL()->display("game.html"); }
public function show_Main() { if (!ALLOW_REGISTER) { Framework::TPL()->assign('no_register', true); return; } $refed_by = $this->get(1); if (is_numeric($refed_by)) { Framework::TPL()->assign('by', $refed_by); } else { Framework::TPL()->assign('by', -1); } }
public function show_Main() { $poker_player = R::relatedOne($this->user, 'poker_player'); if ($poker_player == null) { $poker_player = R::dispense('poker_player'); $poker_player->status = 'view'; $poker_player->cards = ''; $poker_player->bid = 0; $poker_player->all_in = false; $poker_player->all_in_amount = 0; R::store($poker_player); R::associate($poker_player, $this->user); } if ($poker_player->status == 'view') { Framework::TPL()->assign('can_join', true); } }
public function show_Main() { $usersPerPage = 20; $totalUsers = R::getCell('SELECT count(id) FROM user'); $pages = ceil($totalUsers / $usersPerPage); $currentPage = is_numeric($this->get(1)) && $this->get(1) > 0 && $this->get(1) <= $pages ? $this->get(1) : 1; $players = array(); $dbP = R::find('user', ' 1=1 ORDER BY xp DESC LIMIT ?,?', array(($currentPage - 1) * $usersPerPage, $usersPerPage)); $i = $usersPerPage * ($currentPage - 1) + 1; foreach ($dbP as $p) { $players[] = array("rank" => $i, "username" => $p->username, "level" => $p->level, "xp" => formatCash($p->xp), "premium" => $p->hasPremium()); $i++; } Framework::TPL()->assign('players', $players); Framework::TPL()->assign('currentPage', $currentPage); Framework::TPL()->assign('pages', $pages); }
public function show_Buy() { $this->_use_tpl = 'game/game_premium_buy.html'; $prices = Config::getConfig('premium_price'); $rows = array(); foreach ($prices as $points => $cost) { $row = array('points' => $points, 'cost' => number_format($cost, 2, ',', '.'), 'ebank' => self::PaymentWindowUrl($cost * 100, 'ebank2pay', $points, $this->user->id)); if ($cost < 15) { $row['call'] = self::PaymentWindowUrl($cost * 100, 'call2pay', $points, $this->user->id); } else { $row['call'] = ''; } if ($cost < 5) { $row['handy'] = self::PaymentWindowUrl($cost * 100, 'handypay', $points, $this->user->id); } else { $row['handy'] = ''; } $rows[] = $row; } Framework::TPL()->assign('pRows', $rows); }
public function show_Main() { if ($this->get(1) == "login") { Framework::TPL()->assign('first_login', true); } else { Framework::TPL()->assign('first_login', false); } $session_expired = false; if ($this->get(1) == "session_expired") { $session_expired = true; } Framework::TPL()->assign('session_expired', $session_expired); $count = R::getCell('select count(id) from user'); Framework::TPL()->assign("playercount", $count); // assign news $news = array(); $dbNews = R::find('homepage_posts', ' 1=1 ORDER BY id DESC LIMIT 3'); foreach ($dbNews as $n) { $author = R::relatedOne($n, 'user'); $news[] = array('id' => $n->id, 'title' => $n->title, 'author' => $author->username, 'time' => $n->time); } Framework::TPL()->assign("news", $news); }
public function __destruct() { Framework::TPL()->assign("js_scripts", $this->_use_scripts); Framework::TPL()->assign("template", $this->_use_tpl); Framework::TPL()->display("site.html", $this->cacheID); }
public function show_Forgot() { Framework::TPL()->assign('acc_type', 'forgot'); $this->_use_tpl = 'site/site_account_forgot.html'; $this->_use_scripts[] = 'site/site_account_forgot'; }
public function show_Main() { $link = APP_WEBSITE . APP_DIR . "site/register/main/" . $this->user->getID(); Framework::TPL()->assign('ref_link', $link); Framework::TPL()->assign('refed_players', R::getAll('SELECT username, referee_awarded FROM user WHERE referee_id = ?', array($this->user->getID()))); }
private function switchTable() { if (isset($_POST['switchTable'])) { $_SESSION['currentTable'] = $_POST['switchTable']; Framework::Redir("game/db_admin"); } if (!isset($_SESSION['currentTable']) || !in_array($_SESSION['currentTable'], array_keys($this->dbTables))) { $_SESSION['currentTable'] = 'map_object'; } $this->currentTable = $_SESSION['currentTable']; Framework::TPL()->assign('currentTable', $this->currentTable); Framework::TPL()->assign('dbTables', $this->dbTables); }