本文整理汇总了PHP中Auth::Get方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::Get方法的具体用法?PHP Auth::Get怎么用?PHP Auth::Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Auth
的用法示例。
在下文中一共展示了Auth::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Payment
public function Payment($id = 0, $status = 0)
{
$this->Payment = new Payment();
// Try finding the payment
$this->Payment->include_related("fixture", array("owner"))->where("id", $id)->get();
// Make sure the payment exists
if (!$this->Payment->exists()) {
$this->json->error("Payment could not be found.");
}
// Make sure the payment has right status
if (!in_array(strtolower($this->Payment->status), array("active"))) {
$this->json->error("Payment has invalid status.");
}
// Make sure you are the owner of paid fixture
if ($this->Payment->fixture_owner != Auth::Get("id")) {
$this->json->error("Payment could not be found.");
}
// Make sure status is valid
if (!in_array($status, array(0, 1))) {
$this->json->error("Invalid payment status.");
}
// Set and save the status
$this->Payment->paid = $status;
$this->Payment->save();
// Send success response
$this->json->success();
}
示例2: index
public function index()
{
$this->template->setData("SelectedTab", "Dashboard");
if (Auth::Get("manager")) {
// Get Next Game
$this->NextGame = new Game_Block();
$this->NextGame->include_related("fixture", array("id"))->include_related_count("account", "players_count", array("active" => 1))->where(array("fixtures.owner" => Auth::Get("id"), "game_blocks.time > " => time()))->limit(1)->order_by("game_blocks.time", "ASC")->get();
// Get Total Owned Money
$this->TotalOwned = $this->db->query("\tSELECT COALESCE(SUM(payments.amount), 0) AS TotalOwned\n\t\t\t\t\tFROM players_managers\n\t\t\t\t\tLEFT JOIN accounts ON accounts.id = players_managers.player_id\n\t\t\t\t\tLEFT JOIN payments ON players_managers.player_id = payments.account_id AND payments.paid = 0 AND payments.status = 'active'\n\t\t\t\t\tWHERE players_managers.manager_id = " . Auth::Get('id') . "\n\t\t\t\t")->result();
// Count Connected Players
$this->ConnectedPlayers = new Player_Manager();
$this->ConnectedPlayers = $this->ConnectedPlayers->where(array("manager_id" => Auth::Get("id")))->count();
// Get Confirmed Games
$this->ConfirmedGames = new Game_Block();
$this->ConfirmedGames->include_related("fixture", array("owner"))->where(array("fixtures.owner" => Auth::Get("id"), "game_blocks.time >=" => time()))->get_iterated();
$this->load->view("dashboard/manager");
} else {
// Get Next Game Block
$this->NextGame = new Account();
$this->NextGame->where(array("accounts.id" => Auth::Get("id"), "game_blocks.time >" => time()))->include_related("game_block")->limit(1)->order_by("game_blocks.time", "ASC")->get();
// Count connected players
$this->ConnectedPlayers = $this->db->query("\n\t\t\t\t\tSELECT count(DISTINCT accounts_game_blocks.account_id) as ConnectedPlayers\n\t\t\t\t\tFROM fixtures\n\t\t\t\t\tLEFT JOIN game_blocks ON game_blocks.fixture_id = fixtures.id\n\t\t\t\t\tLEFT JOIN accounts_game_blocks ON accounts_game_blocks.game_block_id = game_blocks.id\n\t\t\t\t\tWHERE accounts_game_blocks.account_id != " . Auth::Get("id") . "\n\t\t\t\t")->result();
$this->ConnectedPlayers = $this->ConnectedPlayers[0]->ConnectedPlayers;
// Owned money to
$this->OwnedTo = $this->db->query("SELECT COALESCE(SUM(payments.amount), 0) AS TotalOwned, accounts.first_name, accounts.last_name\n\t\t\t\tFROM payments\n\t\t\t\tLEFT JOIN fixtures ON fixtures.id = payments.fixture_id\n\t\t\t\tLEFT JOIN accounts ON accounts.id = fixtures.owner\n\t\t\t\tWHERE payments.paid = 0 AND payments.status = 'active' AND payments.account_id = " . Auth::Get('id') . "\n\t\t\t\tGROUP BY accounts.id\n\t\t\t\tORDER BY TotalOwned DESC\n\t\t\t\t")->result();
// Confirmed Games
$this->ConfirmedGames = new Account(Auth::Get("id"));
if (!$this->ConfirmedGames->exists()) {
exit("Your account could not be loaded.");
}
// Get Games
$this->ConfirmedGames = $this->ConfirmedGames->game_block->where(array("time >=" => time()))->get_iterated();
$this->load->view("dashboard/player");
}
}
示例3: ShowModifications
function ShowModifications(&$p, $db_table, $db_id)
{
global $database;
$m_mod = new Modification($database);
$m_auth = new Auth($database);
$mods = $m_mod->byTableID($db_table, $db_id);
if (!false_or_null($mods)) {
$data = array();
foreach ($mods as $mod) {
$user = $m_auth->Get($mod['r_Auth']);
$what = '';
$w = json_decode($mod['What'], true);
foreach ($w as $dataset) {
foreach ($dataset as $table => $change) {
$what .= $table . ' #' . $change['I'] . '\'s ' . $change['F'] . (isset($change['E']) ? ' » ' . $change['E'] : '');
}
}
$data[] = array($user['username'], $what, $mod['Message'], human_datetime(intval($mod['Timestamp'])));
}
$table = new TableHelper(array('table' => "table wide", 'thead' => "tablehead", 'th' => "tablehead", 'td' => "tablecell", 'headings' => array('Who', 'What', ' ', 'When'), 'data' => $data));
$p->HTML('<div class="formgroup">');
$p->HTML('<h4>Recent Activity</h4>');
$p->Table($table);
$p->HTML('</div>');
}
}
示例4: RequireManager
public static function RequireManager($JSON = false)
{
if (!Auth::Get("manager") && !$JSON) {
redirect("accounts/login");
}
if (!Auth::Get("manager") && $JSON) {
$CI->json->send(array("LoginRequired" => true));
}
}
示例5: LockedTo
public function LockedTo($lock)
{
if (false_or_null($lock)) {
return FALSE;
}
global $database;
$a_model = new Auth($database);
$user = $a_model->Get($lock['r_Auth']);
if (false_or_null($user)) {
return FALSE;
}
return $user['username'];
}
示例6: Get
public function Get($id = 0)
{
// Load Fixture
$this->Fixture = new Fixture($id);
// Make sure it exists
if (!$this->Fixture->exists()) {
$this->json->error("Fixture could not be found.");
}
// Get Game Blocks
$this->GameBlocks = array();
foreach ($this->Fixture->game_block->order_by("time", "ASC")->get_iterated() as $GameBlock) {
$this->GameBlocks[] = array("id" => $GameBlock->id, "time" => $GameBlock->time == 0 ? "Unknown" : date(TIME_FORMAT, $GameBlock->time), "day" => date("l", $GameBlock->time), "future" => $GameBlock->time > time() ? true : false);
}
// Send Back Response
$this->json->send(array("success" => "OK", "location" => $this->Fixture->location, "type" => $this->Fixture->type, "pitch_cost" => $this->Fixture->pitch_cost, "player_cost" => $this->Fixture->player_cost, "payp_cost" => $this->Fixture->payp_cost, "blocks" => $this->Fixture->blocks, "address" => $this->Fixture->address, "location" => $this->Fixture->location, "directions" => $this->Fixture->directions, "postcode" => $this->Fixture->postcode, "is_manager" => $this->Fixture->owner == Auth::Get("id"), "GameBlocks" => $this->GameBlocks));
}
示例7: Get
public function Get()
{
// Require Login
Auth::RequireLogin(true);
if (Auth::Get("manager")) {
// Get Next Game
$this->NextGame = new Game_Block();
$this->NextGame->include_related("fixture", array("id"))->include_related_count("account", "players_count", array("active" => 1))->where(array("fixtures.owner" => Auth::Get("id"), "game_blocks.time > " => time()))->limit(1)->order_by("game_blocks.time", "ASC")->get();
// Count connected players
$this->ConnectedPlayers = new Player_Manager();
$this->ConnectedPlayers = $this->ConnectedPlayers->where(array("manager_id" => Auth::Get("id")))->count();
// Get Next Game
$NextGameTime = false;
if ($this->NextGame->exists() && $this->NextGame->time) {
$NextGameTime = date(TIME_FORMAT, $this->NextGame->time);
}
// Get Confirmed Games
$this->ConfirmedGames = new Game_Block();
$this->ConfirmedGames->include_related("fixture", array("owner", "id", "location"))->where(array("fixtures.owner" => Auth::Get("id"), "game_blocks.time >=" => time()))->get_iterated();
$ConfirmedGames = array();
foreach ($this->ConfirmedGames as $Game) {
$ConfirmedGames[] = array("day" => date("l", $Game->time), "date" => date(TIME_FORMAT, $Game->time), "future" => $Game->time > time() ? true : false, "game_id" => $Game->id, "location" => $Game->fixture_location);
}
$this->json->send(array("success" => "OK", "ConnectedPlayers" => $this->ConnectedPlayers, "NextGame" => $NextGameTime, "ConfirmedGames" => $ConfirmedGames));
} else {
// Get Next Game Block
$this->NextGame = new Account();
$this->NextGame->game_block->where(array("accounts.id" => Auth::Get("id"), "game_blocks.time >" => time()))->limit(1)->order_by("game_blocks.time", "ASC")->get();
// Count connected players
$this->ConnectedPlayers = $this->db->query("\n\t\t\t\t\tSELECT count(DISTINCT accounts_game_blocks.account_id) as ConnectedPlayers\n\t\t\t\t\tFROM fixtures\n\t\t\t\t\tLEFT JOIN game_blocks ON game_blocks.fixture_id = fixtures.id\n\t\t\t\t\tLEFT JOIN accounts_game_blocks ON accounts_game_blocks.game_block_id = game_blocks.id\n\t\t\t\t\tWHERE accounts_game_blocks.account_id != " . Auth::Get("id") . "\n\t\t\t\t")->result();
$this->ConnectedPlayers = $this->ConnectedPlayers[0]->ConnectedPlayers;
// Get Next Game
$NextGameTime = false;
if ($this->NextGame->exists() && $this->NextGame->time) {
$NextGameTime = date(TIME_FORMAT, $this->NextGame->time);
}
// Get Confirmed Games
$this->ConfirmedGames = new Game_Block();
$this->ConfirmedGames = $this->ConfirmedGames->where(array("time >=" => time()))->include_related("fixture", array("location", "id"))->get_iterated();
$ConfirmedGames = array();
foreach ($this->ConfirmedGames as $Game) {
$ConfirmedGames = array("day" => date("l", $Game->time), "date" => date(TIME_FORMAT, $Game->time), "game_id" => $Game->id, "location" => $Game->fixture_location);
}
$this->json->send(array("success" => "OK", "ConnectedPlayers" => $this->ConnectedPlayers, "NextGame" => $NextGameTime, "ConfirmedGames" => $ConfirmedGames));
}
}
示例8: Refresh
public function Refresh($session)
{
global $no_session_refresh;
global $session_refreshed;
if ($session_refreshed === FALSE) {
if ($no_session_refresh === TRUE) {
} else {
$this->Set($session['ID'], array("last_refreshed" => $session['refreshed'], "refreshed" => strtotime('now'), "requests" => intval($session['requests']) + 1));
global $database;
$a_model = new Auth($database);
$a = $a_model->Get($session['r_Auth']);
cook("username", $a['username'], timeout);
cook("session", $session['ID'], timeout);
}
}
$session_refreshed = TRUE;
}
示例9: url
<form action="<?php
echo url("accounts/register");
?>
" method="post" id="login_form" class="form">
<input type="hidden" name="tracking_code" value="<?php
echo set_value("tracking_code", $this->code);
?>
" />
<label for="form-name">First Name*</label>
<div class="input-prepend">
<span class="add-on"><i class="icon-user"></i></span>
<?php
echo form_input("first_name", set_value("first_name", Auth::Get("first_name")));
?>
</div>
<div class="clear_10"></div>
<label for="form-lastname">Last Name*</label>
<div class="input-prepend">
<span class="add-on"><i class="icon-user"></i></span>
<?php
echo form_input("last_name", set_value("last_name"));
?>
</div>
<div class="clear_10"></div>
示例10: getpost
$p->title = "Your Website";
$p->CSS("main.css");
$p->Jquery();
$getpost = getpost();
if (!isset($getpost['ID'])) {
Page::Redirect('dash');
}
if (isset($getpost['new'])) {
$p->JS('notifier.js');
$p->JS('Notifier.info("Editing new Item");');
}
$p->HTML('<BR>');
global $auth_database;
$profile_model = new Profile($auth_database);
$auth_model = new Auth($auth_database);
$a = $auth_model->Get($getpost['ID']);
if (false_or_null($a)) {
Page::Redirect('profiles');
}
$pro = $profile_model->Get($a['r_Profile']);
if (false_or_null($pro)) {
Page::Redirect('profiles');
}
$p->HTML('<span class="breadcrumbs">Editing Profile #' . $pro['ID'] . ' and Auth #' . $a['ID'] . '</span>');
$p->HTML('<span class="breadcrumbs-link"><a href="profiles" class="bare">← Profiles</a></span>');
$p->Bind_LoadPlugins();
$p->HTML('<div class="formboundary">');
$p->HTML('<div class="formgroup wide">');
$p->HTML('Username');
$p->BindString("Auth", $a['ID'], "username", $a['username'], "Enter username", FALSE, "texty");
$p->HTML('</div>');
示例11: array
$p->HTML('header.html', array("###MENU###" => Dropdown_menu($p)));
}
$p->title = "Your Website";
$p->CSS("main.css");
$p->Jquery();
$getpost = getpost();
$p->HTML('<BR>');
global $auth_database;
plog("Get mods!");
$m = new Modification($auth_database);
$mods = $m->All('ORDER BY Timestamp DESC');
$m_auth = new Auth($auth_database);
if (!false_or_null($mods)) {
$datatemp = array();
foreach ($mods as $mod) {
$user = $m_auth->Get($mod['r_Auth']);
if (!isset($datatemp[$user['username']])) {
$datatemp[$user['username']] = 1;
} else {
$datatemp[$user['username']] += 1;
}
}
$datapoints = array();
foreach ($datatemp as $username => $events) {
$datapoints[] = array("value" => $events, "color" => "#FFAAAA", "highlight" => "5AD3D1", "label" => $username);
}
$chart = Pie($p, 400, 400, $datapoints);
// $p->CSS('.'.$chart.' { }');
$data = array();
foreach ($mods as $mod) {
$user = $m_auth->Get($mod['r_Auth']);
示例12: SaveTeamName
public function SaveTeamName($block = 0, $team = 0)
{
// Require Manager Login
Auth::RequireManager(true);
// Get Block
$this->Block = new Game_Block($block);
if (!$this->Block->exists()) {
$this->json->error("Block could not be found.");
}
// Get Fixture
$this->Fixture = $this->Block->fixture->get();
if (!$this->Fixture->exists()) {
$this->json->error("Fixture could not be found.");
}
// Check ownership
if ($this->Fixture->owner != Auth::Get("id")) {
$this->json->error("You are not owner of this fixture.");
}
// Make sure the team is ok
if (!in_array($team, array(1, 2))) {
$this->json->error("Team could not be found.");
}
$this->Block->{"team_" . $team} = $this->input->post("name");
// Try saving
if ($this->Block->save()) {
$this->json->success();
} else {
$this->json->error(strip_tags($this->Block->error->string));
}
}
示例13: url
$("#BlockData").html("<h3>Please Wait...</h3>").load( "<?php
echo url('game_blocks/getData/');
?>
" + $(this).attr("block_id") ).attr("block_id", $(this).attr("block_id"));
});
$(".BlockJoinButton").live("click", function(e) {
e.preventDefault();
<?php
if ($this->Fixture->player_cost) {
?>
if( $("#BlockData .BlockPlayer[player=<?php
echo Auth::Get('id');
?>
]").length > 0 )
{
var Confirm = "Are you sure you want to rejoin? Your last refund will be cancelled.";
}
else
{
var Confirm = "Are you sure you want to join this game? You will be charged \u00A3<?php
echo number_format($this->Fixture->payp_cost, 2);
?>
credits.";
}
if( confirm(Confirm) )
{
示例14: leave
public function leave($block = 0)
{
$this->template->disable();
// Make sure the user is logged in
if (!$this->auth->isLogged()) {
$this->json->error("You need to be logged in.");
}
// Find the game
$this->Block = new Game_Block($block);
// Make sure the game exists
if (!$this->Block->exists()) {
$this->json->error("Block could not be found.");
}
// Make sure the game is not in the past
if ($this->Block->time != 0 && $this->Block->time < time()) {
$this->json->error("This block is already in the past.");
}
// Load your account
$this->Account = new Account(Auth::Get("id"));
// Make sure your account has been loaded
if (!$this->Account->exists()) {
$this->json->error("Your account could not be loaded.");
}
// Make sure you are playing this game
if (!$this->Block->is_related_to($this->Account)) {
$this->json->error("You are not playing this block.");
}
// Try getting the fixture
$this->Fixture = $this->Block->fixture->get();
// Make sure fixture is loaded
if (!$this->Fixture->exists()) {
$this->json->error("Fixture could not be loaded.");
}
$this->Related_Account = $this->Block->account->where("id", Auth::Get("id"))->include_join_fields()->get();
if ($this->Related_Account->exists() && !$this->Related_Account->join_active) {
$this->json->error("You already left this game.");
}
// If the fixture is not free
if ($this->Fixture->payp_cost || $this->Fixture->player_cost) {
// Mark his last payment cancelled
$this->LastPayment = new Payment();
$this->LastPayment = $this->LastPayment->where(array("account_id" => Auth::Get("id"), "game_block_id" => $this->Block->id, "type" => "game", "amount >" => 0))->order_by("id", "DESC")->limit(1)->get();
if ($this->LastPayment->exists()) {
$this->LastPayment->status = "cancelled";
$this->LastPayment->save();
}
// Return the money
$Payment = new Payment();
if ($this->Related_Account->join_type == "game") {
$Payment->amount = 0 - $this->Fixture->payp_cost;
} else {
if ($this->Related_Account->join_type == "block") {
$Payment->amount = 0 - $this->Fixture->player_cost;
}
}
$Payment->date = time();
$Payment->account_id = Auth::Get("id");
$Payment->game_block_id = $this->Block->id;
$Payment->fixture_id = $this->Fixture->id;
$Payment->type = "game";
$Payment->status = "active";
if ($this->LastPayment->exists()) {
if ($this->LastPayment->paid) {
$Payment->save();
}
} else {
$Payment->save();
}
// Return credits to your account
$this->Account->credits += $Payment->amount;
$this->Account->save();
$CreditedAccount = abs($Payment->amount);
}
// Set this account inactive
$this->Block->set_join_field($this->Account, "active", 0);
$data = array();
if (isset($CreditedAccount)) {
$data['credited'] = $CreditedAccount;
}
$this->json->success($data);
}
示例15: enter
public function enter($player = 0, $block = 0)
{
Auth::RequireManager();
$this->Block = new Game_Block($block);
if (!$this->Block->exists()) {
Session::GoBack("Game could not be found.");
}
// Try Getting Fixture
if (!$this->Block->fixture->get()->exists()) {
Session::GoBack("Fixture could not be found.");
}
if ($this->Block->fixture->owner != Auth::Get("id")) {
Session::GoBack("You cannot manage this block.");
}
$this->Account = new Account($player);
if (!$this->Account->exists()) {
Session::GoBack("Player could not be found.");
}
if (!$this->Block->is_related_to($this->Account)) {
Session::GoBack("This player is not playing in this game.");
}
// Check the limit of this block
$this->PlayersCount = $this->Block->account->include_join_fields()->where(array("active" => 1))->count();
if ($this->PlayersCount >= (int) $this->Block->fixture->type * 2) {
Session::GoBack("This game is already full!");
}
$this->Block->set_join_field($this->Account, "active", 1);
Session::GoBack("Player has joined.");
}