public function treat($parameters) { $tags = array('title' => 'KG-Rating | Error', 'bootstrap' => URL . '/common/libs/bootstrap', 'datatables' => URL . '/common/libs/dataTables', 'url' => URL, 'url_data' => URL . '/common/libs/template'); $tp = new DreawTemplateParser('error', 'public/views'); $tp->addTags($tags); $tp->parseTemplate(); }
public function treat($parameters) { $game = new DreawGame(); if (isset($parameters[2])) { if ($parameters[2] == 'add') { // add issue $tags = array('title' => 'KG-Rating | Add Issue', 'bootstrap' => URL . '/common/libs/bootstrap', 'datables' => URL . '/common/libs/dataTables', 'url' => URL, 'url_data' => URL . '/common/libs/template', 'perm' => $_SESSION['perm_logged'], 'uid_logged' => $_SESSION['uid_logged']); $tp = new DreawTemplateParser('tracker_add', 'application/views/'); $tp->addTags($tags); $tp->parseTemplate(); if (isset($_POST['tracker_add_submit'])) { $game->addIssue($_POST['message_text'], $_POST['category'], $_FILES['ufile'], 0); } } else { // dev tracker $tags = array('title' => 'KG Rating | DevTracker', 'bootstrap' => URL . '/common/libs/bootstrap', 'datables' => URL . '/common/libs/dataTables', 'url' => URL, 'url_data' => URL . '/common/libs/template', 'perm' => $_SESSION['perm_logged'], 'uid_logged' => $_SESSION['uid_logged']); $tp = new DreawTemplateParser('dev_tracker', 'application/views'); $tp->addTags($tags); $tp->addDBCycleTags(['issues' => $game->getDevTracker()]); $tp->parseTemplate(); } } else { header('Location: /app/'); exit(0); } }
public function treat($parameters) { $game = new DreawGame(); $auth = new DreawAuthorize(); /*$contest = new DreawContest(); $contest->set();*/ // output $tags = array('title' => 'KG-Rating | Homepage', 'bootstrap' => URL . '/common/libs/bootstrap', 'datatables' => URL . '/common/libs/dataTables', 'url' => URL, 'url_data' => URL . '/common/libs/template', 'uid_logged' => $_SESSION['uid_logged'], 'perm' => $_SESSION['perm_logged'], 'games_number' => count($game->lastAddedGames())); // processed? if (isset($_GET['action']) && $_GET['action'] == "processed") { $game->processedTracker($_GET['id']); } if ($_SESSION['uid_logged'] == 'JZikes' or $_SESSION['uid_logged'] == 'TBest') { //$seo = new DreawSEO('http://www.dreaw.cz'); //$seo->get(); $tp = new DreawTemplateParser('homepage_stats', 'application/views'); $tp->addTags($tags); $tp->addDBCycleTags(['last_games' => $game->lastAddedGames(), 'last_developers' => $auth->getDevelopers(5), 'issues' => $game->getAdminTracker()]); $tp->parseTemplate(); } else { $tp = new DreawTemplateParser('homepage', 'application/views/'); $tp->addTags($tags); $tp->parseTemplate(); } }
public function treat($parameters) { $game = new DreawGame(); $tags = array('title' => 'KG-Rating | Games', 'bootstrap' => URL . '/common/libs/bootstrap', 'datatables' => URL . '/common/libs/dataTables', 'url' => URL, 'url_data' => URL . '/common/libs/template'); $tp = new DreawTemplateParser('games', 'public/views/'); $tp->addTags($tags); $tp->addDBCycleTags(['games' => $game->view()]); $tp->parseTemplate(); }
public function treat($parameters) { header('Location: /login'); exit(0); $remote = new DreawRemote(); $tags = array('title' => 'KG-Rating | Homepage', 'bootstrap' => URL . '/common/libs/bootstrap', 'datatables' => URL . '/common/libs/dataTables', 'url' => URL, 'url_data' => URL . '/common/libs/template'); $tp = new DreawTemplateParser('homepage', 'public/views/'); $tp->addTags($tags); $tp->parseTemplate(); }
public function treat($parameters) { if (isset($_POST['login_submit'])) { $auth = new DreawAuthorize(); $auth->logIn($_POST['uid'], $_POST['pass'], $_POST['dreaw_token']); } $tags = array('title' => 'KG-Rating | Login', 'bootstrap' => URL . '/common/libs/bootstrap', 'datatables' => URL . '/common/libs/dataTables', 'url' => URL, 'url_data' => URL . '/common/libs/template'); $tp = new DreawTemplateParser('login', 'public/views/'); $tp->addTags($tags)->parseTemplate(); }
public function treat($parameters) { if (isset($_POST['register_submit'])) { $register = new DreawAuthorize(); $register->register($_POST['dev'], $_POST['email'], $_POST['pw'], $_POST['verify_pw'], $_POST['dreaw_token']); $developer = $_POST['dev']; $email = $_POST['email']; } else { $developer = ''; $email = ''; } $tags = array('title' => 'KG-Rating | Register', 'url_data' => URL . '/common/libs/template', 'bootstrap' => URL . '/common/libs/bootstrap', 'datatables' => URL . '/common/libs/dataTables', 'developer_value' => $developer, 'email_value' => $email); $tp = new DreawTemplateParser('register', 'public/views'); $tp->addTags($tags); $tp->parseTemplate(); }
public function treat($parameters) { $game = new DreawGame(); /* AJAX -> changelog */ if (isset($_POST['action']) && $_POST['action'] == 'changelog') { // get newest changelog and return it $data = $game->getNewestChangeLog(); die(json_encode($data)); } /* /AJAX -> changelog */ if (isset($_POST['game_submit'])) { $game->validate($_POST['game_url']); } $tags = array('title' => 'KG-Rating | AddGame', 'bootstrap' => URL . '/common/libs/bootstrap', 'datatables' => URL . '/common/libs/dataTables', 'url' => URL, 'url_data' => URL . '/common/libs/template', 'perm' => $_SESSION['perm_logged'], 'uid_logged' => $_SESSION['uid_logged']); $tp = new DreawTemplateParser('game_add', 'application/views/'); $tp->addTags($tags)->parseTemplate(); }
public function treat($parameters) { $game = new DreawGame(); $auth = new DreawAuthorize(); /* AJAX GET DEVELOPER INFO */ if (isset($_POST['action']) && $_POST['action'] == 'developer_detail') { $tp = new DreawTemplateParser('developer_detail', 'application/views/ajax/templates'); $tp->addTags(['empty' => false]); $tp->addDBCycleTags(['games' => $game->addedGames($_POST['uid'])]); $tp->parseTemplate(); die; } /* AJAX GET DEVELOPER INFO */ $tags = array('title' => 'KG-Rating | Developers', 'bootstrap' => URL . '/common/libs/bootstrap', 'datatables' => URL . '/common/libs/dataTables', 'url' => URL, 'url_data' => URL . '/common/libs/template', 'perm' => $_SESSION['perm_logged'], 'uid_logged' => $_SESSION['uid_logged']); $tp = new DreawTemplateParser('developers', 'application/views/'); $tp->addTags($tags); $tp->addDBCycleTags(['developers' => $auth->getDevelopers()]); $tp->parseTemplate(); }
public function treat($parameters) { $game = new DreawGame(); // view $tags = array('title' => 'KG-Rating | ChangeLog', 'bootstrap' => URL . '/common/libs/bootstrap', 'datatables' => URL . '/common/libs/dataTables', 'url' => URL, 'url_data' => URL . '/common/libs/template', 'perm' => $_SESSION['perm_logged'], 'uid_logged' => $_SESSION['uid_logged']); if ($_SESSION['perm_logged'] == "0") { if (isset($_POST['changelog_add_submit'])) { $game->addChangeLog($_POST['changelog_msg']); } $tp = new DreawTemplateParser('changelog_private', 'application/views'); $tp->addTags($tags); $tp->addDBCycleTags(['logs' => $game->getEveryChangeLog()]); $tp->parseTemplate(); } else { $tp = new DreawTemplateParser('changelog', 'application/views/'); $tp->addTags($tags); $tp->addDBCycleTags(['logs' => $game->getEveryChangeLog()]); $tp->parseTemplate(); } }
public function treat($parameters) { $game = new DreawGame(); if (isset($parameters[2])) { // Are you realy this developer? if ($parameters[2] == $_SESSION['uid_logged']) { // calculate games $games = $game->addedGames($_SESSION['uid_logged']); if (isset($games[0])) { $count_games = count($games); } else { $count_games = '0'; } } else { header('Location: /app/'); } } else { header('Location: /app/'); } // Set new profile image if (isset($_POST['set_profile'])) { if (isset($_FILES['image_field'])) { $game->setProfileImage($_FILES['image_field']); } } // Change profile description if (isset($_POST['action']) && $_POST['action'] == 'change_description') { if (!empty($_POST['text'])) { $game->setDevDescription($_POST['text']); } $data = $game->getDevDescription(); die(json_encode($data)); } // output $tags = array('title' => 'KG-Rating | Profile', 'bootstrap' => URL . '/common/libs/bootstrap', 'datatables' => URL . '/common/libs/dataTables', 'url' => URL, 'url_data' => URL . '/common/libs/template', 'uid_logged' => $_SESSION['uid_logged'], 'mail_logged' => $_SESSION['mail_logged'], 'perm' => $_SESSION['perm_logged'], 'games_number' => $count_games, 'description' => $game->getDevDescription()); $tp = new DreawTemplateParser('profile', 'application/views/'); $tp->addTags($tags); $tp->parseTemplate(); }
protected function numInc($source) { if (self::$_actual_number < 1) { if (strstr($source, '|valueIncrement}')) { $exploded = explode('|valueIncrement', $source); $reversed = strrev($exploded[0]); $reversed = explode('{', $reversed); $value = strrev($reversed[0]); self::$_increment_start = (int) $value; $source = str_replace('{' . $value . '|valueIncrement}', self::$_actual_number, $source); } } $source = str_replace('{' . self::$_increment_start . '|valueIncrement}', self::$_actual_number, $source); self::$_actual_number++; return $source; }
public function treat($parameters) { $game = new DreawGame(); $sess = new DreawSession(); /* AJAX REQUEST OF ALL GRAPHS */ if (isset($_POST['graph_data']) && !empty($_POST['graph_data'])) { $graph_data = htmlspecialchars($_POST['graph_data'], ENT_QUOTES); $game_history = $game->history($parameters[2]); $game_history = $game->toGraph($game_history, ['y-data' => $graph_data]); die(json_encode($game_history)); } /* /AJAX REQUEST OF ALL GRAPHS */ /* AJAX REQUEST OF RANGE GRAPHS */ if (isset($_POST['action']) && $_POST['action'] == 'range_update') { $game_history = $game->customHistory($parameters[2], $_POST['from_date'], $_POST['to_date']); $gameplays_range = $game->toGraph($game_history, ['y-data' => 'gameplays']); $daily_range = $game->toGraph($game_history, ['y-data' => 'daily']); $rating_range = $game->toGraph($game_history, ['y-data' => 'rating']); die(json_encode([[$gameplays_range], [$daily_range], [$rating_range]])); } /* /AJAX REQUEST OF RANGE GRAPHS */ /* AJAX request of get actual game stats */ if (isset($_POST['get_actual_data'])) { $name = htmlspecialchars($_POST['get_actual_data'], ENT_QUOTES); die($game->getActualStats($name)); } /* /AJAX request of get actual game stats */ /* AJAX -> changelog */ if (isset($_POST['action']) && $_POST['action'] == 'changelog') { // get newest changelog and return it $data = $game->getNewestChangeLog(); die(json_encode($data)); } /* /AJAX -> changelog */ $tags = array('title' => 'KG-Rating | Games', 'bootstrap' => URL . '/common/libs/bootstrap', 'datatables' => URL . '/common/libs/dataTables', 'url' => URL, 'url_data' => URL . '/common/libs/template', 'date_actual' => date('Y/m/d'), 'perm' => $_SESSION['perm_logged'], 'uid_logged' => $_SESSION['uid_logged']); $tags_single = array('title' => 'KG-Rating | SingleGame', 'bootstrap' => URL . '/common/libs/bootstrap', 'datatables' => URL . '/common/libs/dataTables', 'url' => URL, 'url_data' => URL . '/common/libs/template', 'date_actual' => date('d/m/Y'), 'perm' => $_SESSION['perm_logged'], 'uid_logged' => $_SESSION['uid_logged']); if (!isset($parameters[2])) { $tp = new DreawTemplateParser('games', 'application/views/'); $tp->addTags($tags); $tp->addDBCycleTags(['games' => $game->view()]); $tp->parseTemplate(); } else { if (!empty($parameters[2])) { $verify = new DreawAuthorize(); $isDeveloper = $verify->isDeveloper($parameters[2]); $developerName = $sess->getSess('uid_logged'); if (!$isDeveloper and $developerName != 'JZikes' and $developerName != 'TBest' and $developerName != 'MBezdek') { $session = new DreawSession(); $session->setSess(['error' => 'You do not have permissions to see this page!']); header('Location: ../games/'); exit(0); } $single_game = $game->viewSingleGame($parameters[2]); if ($single_game['status'] == 1) { $tp = new DreawTemplateParser('game_single', 'application/views/'); $tp->addTags($tags_single)->addDBTags($single_game['data'])->addDBCycleTags(['history' => $game->history($parameters[2])])->parseTemplate(); } else { die('Game has not any history, please wait 1 hour!'); } } else { $this->redirect('error'); } } }