本文整理汇总了PHP中Auth::Obj方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::Obj方法的具体用法?PHP Auth::Obj怎么用?PHP Auth::Obj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Auth
的用法示例。
在下文中一共展示了Auth::Obj方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Reconcile
public function Reconcile()
{
DB::zdb()->update(Invite::$TABLE,
array("redeemed_by" => Auth::Obj()->User()->ID(),
"available" => 0), "code = '{$this->code}'");
Log::Activity("reconciled invitation code " . $this->code);
}
示例2: Create
public static function Create()
{
try
{
DB::zdb()->beginTransaction();
// Create empty cube.
DB::zdb()->insert(
Cube::$TABLE,
array(
"name" => "New Cube",
"revision" => 1,
"owner" => Auth::Obj()->User()->ID()
)
);
// Insert CDP for free.
require_once "Records/entry.php";
DB::zdb()->insert(
Entry::$TABLE,
array(
"card" => 1,
"cube" => DB::zdb()->lastInsertId()
)
);
DB::zdb()->commit();
}
catch ( Exception $e )
{
DB::zdb()->rollBack();
Log::Failure(print_r($e, true));
}
}
示例3: Activity
public static function Activity($action, $user=1)
{
if ( $user == 1 && Auth::Obj()->Authenticated() )
$user = Auth::Obj()->User()->ID();
DB::zdb()->insert("activity",
array("action" => $action, "user" => $user, "date" => date("Y-m-d H:i:s")));
}
示例4: Obj
public static function Obj()
{
static $obj;
if ( !$obj )
{
$local = "en";
if ( Auth::Obj()->Authenticated() )
{
$local = Auth::Obj()->User()->Local();
}
$obj = new View($local);
}
return $obj;
}
示例5: Create
public static function Create($post=NULL)
{
$invite = new Invite($post["code"]);
if ( !$invite->Available() )
{
throw new Exception("Invite has already been redeemed.");
}
if ( App::Obj()->UseFacebook() )
{
require_once "Tools/Facebook/facebook.php";
$fb = new Facebook( App::Obj()->FacebookSettings() );
$user = $fb->getUser();
if ( $user )
{
$data = $fb->api("/me");
$fbId = $data["id"];
if ( ! $fbId )
throw new Exception("FB ID invalid");
$in = array("facebook" => $fbId);
DB::zdb()->insert("users", $in);
Auth::Obj()->LogIn();
}
}
else
{
unset($post["pass2"]);
unset($post["code"]);
$pass = $post["pass"];
$post["pass"] = md5($post["pass"]);
$n = DB::zdb()->insert("users", $post);
Auth::Obj()->LogIn($post["user"], $pass);
}
if ( Auth::Obj()->Authenticated() )
{
$invite->Reconcile();
Log::Activity("created their user account");
}
}
示例6: function
<?php
if ( !Auth::Obj()->CanAccess(2) )
return;
ob_start();
include "Requests/set_list.php";
$out = ob_get_contents();
ob_end_clean();
?>
<script type="text/javascript">
var aSet = 0;
function reload_set_list()
{
log("reload");
$.ajax({
url: "request.php?a=set_list",
success: function(data, textStatus, jqXHR)
{
$("#set_list")[0].innerHTML = data;
}
});
}
function add_set()
{
$.ajax({
url: "request.php?a=new_set",
success: function(data, textStatus, jqXHR)
{
示例7: require_once
<?php
// Grab Cuber Tools
require_once("Tools/cuber.php");
require_once("Tools/Facebook/facebook.php");
// Production Environment
if ( App::Obj()->UseFacebook() )
{
if ( Auth::Obj()->Authenticated() )
{
header("Location: home.php");
}
else
{
Auth::Obj()->LogIn();
if ( isset($_GET["code"]) )
{
View::Obj()->Title("Cuber - Cube Management Software by Ryan Knuesel");
View::Obj()->MainView("invitation");
}
else
{
$fb = new Facebook(App::Obj()->FacebookSettings());
$loginurl = $fb->getLoginUrl();
header("Location: $loginurl");
}
}
}
// Dev environment
else
示例8: require_once
<?php
// Grab Cuber Tools
require_once("Tools/cuber.php");
if ( Auth::Obj()->Authenticated() )
{
View::Obj()->Title("Cuber - Cube Management Software by Ryan Knuesel");
View::Obj()->MainView("home");
}
else
{
header("Location: /");
}
?>
示例9:
<?php
// ****
// ****
// Legacy Notice
// This file is conforms to a very bad design. The new one is much better,
// but this file is part of a component that is going to be scrapped anyway.
// For a better example, look at the Views/Components/cube/ folder.
// ****
// ****
require_once "Records/invite.php";
echo Invite::Create(Auth::Obj()->User())->Code();
?>
示例10:
<?php
$user = Auth::Obj()->User();
$data = $user->Data();
if ( $data ) :
?>
<section id="top">
<span id="top_tab">Cuber</span>
</section>
<?php else: ?>
<section id="top">
<span id="top_tab" style="border-color:red;">Cuber<span style="color:red">:dev</span></span>
</section>
<?php endif; ?>
示例11: array
<?php
if ( !Auth::Obj()->CanAccess(2) )
return;
// need to use the Invite model
$s = DB::zdb()->select()
->from("invites")
->where("owner = ?", Auth::Obj()->User()->ID())
->where("available = 1");
$invites = DB::zdb()->fetchAll($s);
$out = array();
foreach( $invites as $invite )
$out[] = $invite["code"];
$codes = @implode("<br />", $out);
$ct = count($out);
?>
<script type="text/javascript">
function new_invite()
{
$.ajax({
url: "request.php?a=new_invite",
success: function(data, textStatus, jqXHR)
{
$("#invites")[0].innerHTML += ( "<br />" + data );
}
});
}
</script>
<section id="invites">
Invites: <?php echo $ct; ?>
示例12: require_once
<?php
// Grab Cuber Tools
require_once("Tools/cuber.php");
if ( Auth::Obj()->Authenticated() && Auth::Obj()->CanAccess(2) )
{
View::Obj()->Title("Cuber Admin - Cube Management Software by Ryan Knuesel");
View::Obj()->MainView("admin");
}
else
{
header("Location: /");
}
?>
示例13: foreach
<?php
// **
// * Cube Select
// * Component
// * #viewportA
// *
// * Author: Ryan Knuesel
// **
foreach ( Cube::CubesForUser(Auth::Obj()->User()) as $cube )
$cube->DrawCubeCell();
Cube::DrawAddCubeCell();
?>