本文整理汇总了PHP中Flight::auth方法的典型用法代码示例。如果您正苦于以下问题:PHP Flight::auth方法的具体用法?PHP Flight::auth怎么用?PHP Flight::auth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flight
的用法示例。
在下文中一共展示了Flight::auth方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
?>
<li><a href="<?php
Flight::link('/team/' . $team->id);
?>
"><?php
echo $team->name;
?>
</a></li>
<?php
}
?>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php
echo Flight::auth()->currentUser->forename;
?>
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="<?php
Flight::link('/editUser/');
?>
">Edit Profile</a></li>
<li role="separator" class="divider"></li>
<li><a href="<?php
Flight::link('/logout/');
?>
">Logout</a></li>
</ul>
</li>
</ul>
示例2: deleteTeam
public function deleteTeam($id)
{
Flight::auth()->check(20);
$team = Flight::teams()->getTeamWithId($id);
$team->delete();
Flight::redirect('/teams');
}
示例3: deleteAbsence
public function deleteAbsence($id)
{
Flight::auth()->check();
$absence = Flight::absence()->getAbsenceWithId($id);
$absence->delete();
Flight::redirect(Flight::request()->referrer);
}
示例4: deletePlayer
public function deletePlayer($id)
{
Flight::auth()->check(20);
$player = Flight::players()->getPlayerWithId($id);
$team_id = $player->team;
$player->delete();
Flight::redirect('/team/' . $team_id);
}
示例5: deleteEvent
public function deleteEvent($id)
{
Flight::auth()->check();
$event = Flight::events()->getEventWithId($id);
$team_id = $event->team;
$event->delete();
Flight::redirect("/team/" . $team_id);
}
示例6: register
public function register()
{
Flight::auth()->check(20);
$response = Flight::util()->validate("user", Flight::request()->data);
if (is_array($response)) {
Flight::util()->render('newUser', array('error' => $response, "teams" => Flight::teams()->getAllTeams()));
return;
}
$data = Flight::request()->data;
$user = new user($data);
$user->teams = Flight::request()->data->teams;
$user->store();
Flight::redirect("/createUser");
}
示例7: setcookie
$call['code'] = 401;
} else {
$call = Flight::auth()->deleteUser(Flight::get('userdata')['uid'], Flight::request()->data->password);
$call['message'] = Flight::get('lang')[$call['message']];
if ($call['code'] == 200) {
setcookie(Flight::config()->cookie_name, "", time() - 3600, Flight::config()->cookie_path, Flight::config()->cookie_domain, Flight::config()->cookie_secure, Flight::config()->cookie_http);
}
}
Flight::json($call, $call['code']);
});
Flight::route('GET /auth/logout', function () {
if (Flight::get('loggedin') == false) {
$call['message'] = Flight::get('lang')['authentication_required'];
$call['code'] = 401;
} else {
$call = Flight::auth()->logout(Flight::request()->cookies->{Flight::config()->cookie_name});
setcookie(Flight::config()->cookie_name, "", time() - 3600, Flight::config()->cookie_path, Flight::config()->cookie_domain, Flight::config()->cookie_secure, Flight::config()->cookie_http);
$call['message'] = Flight::get('lang')['logged_out'];
$call['code'] = 200;
}
Flight::json($call, $call['code']);
});
Flight::route('GET /auth', function () {
if (Flight::get('loggedin') == false) {
$call['loggedin'] = false;
} else {
$call['loggedin'] = true;
$call['userdata'] = Flight::get('userdata');
unset($call['userdata']['id']);
unset($call['userdata']['password']);
unset($call['userdata']['salt']);
示例8:
<div class="row">
<div class="col-sm-2">Phone Home:</div>
<div class="col-sm-8"><?php
echo $player->phone_home;
?>
</div>
</div>
<div class="row">
<div class="col-sm-2">Phone Mobile:</div>
<div class="col-sm-8"><?php
echo $player->phone_mobile;
?>
</div>
</div>
<div class="row">
<a href="<?php
Flight::link('/player/' . $player->id . '/update');
?>
"><button type="button" class="btn btn-success">Update</button></a>
<?php
if (Flight::auth()->currentUser->role == 20) {
?>
<a href="<?php
Flight::link('/player/' . $player->id . '/delete');
?>
"><button type="button" class="btn btn-danger">Delete</button></a>
<?php
}
?>
</div>
示例9: function
<?php
Flight::route('/', function () {
if (Flight::auth()->online()) {
Flight::redirect('/teams');
}
Flight::util()->render('login');
});
Flight::route("POST /editUser", ['userController', 'saveUserSettings']);
Flight::route("GET /editUser(/@id)", ['userController', 'showUserSettings']);
Flight::route("GET /createUser", ['userController', 'showNewUser']);
Flight::route("POST /createPlayer", ['playerController', 'saveNewPlayer']);
Flight::route("GET /createPlayer", ['playerController', 'showNewPlayer']);
Flight::route("POST /player/@id/update", ['playerController', 'updatePlayer']);
Flight::route("GET /player/@id/delete", ['playerController', 'deletePlayer']);
Flight::route("GET /player/@id", ['playerController', 'showPlayer']);
Flight::route("GET /player/@id/update", ['playerController', 'showUpdatePlayer']);
Flight::route("GET /players", ['playerController', 'showAllPlayers']);
Flight::route('GET /teams', ['teamController', 'showTeamList']);
Flight::route('GET /team/@id', ['teamController', 'showTeam']);
Flight::route("POST /createTeam", ['teamController', 'saveNewTeam']);
Flight::route("GET /createTeam", ['teamController', 'showNewTeam']);
Flight::route("GET /deleteTeam/@id", ['teamController', 'deleteTeam']);
Flight::route('GET /createEvent/@team', ['eventController', 'showNewEvent']);
Flight::route('POST /createEvent', ['eventController', 'saveNewEvent']);
Flight::route("GET /event/@id", ['eventController', 'showEvent']);
Flight::route("GET /deleteEvent/@id", ['eventController', 'deleteEvent']);
Flight::route('GET /createAbsence/@team(/@event)', ['absenceController', 'showNewAbsence']);
Flight::route('POST /createAbsence/@team(/@event)', ['absenceController', 'saveNewAbsence']);
Flight::route("GET /deleteAbsence/@id", ['absenceController', 'deleteAbsence']);
Flight::route("POST /login", ["auth", "login"]);
示例10:
}
?>
<div class="input-group">
<span class="input-group-addon" id="email">Email</span>
<input type="email" value="<?php
echo $user->email;
?>
" name="email" class="form-control" aria-describedby="email" required>
</div>
<?php
if (isset($error['team']['type'])) {
Flight::util()->error($error['teams']);
}
?>
<div style='<?php
echo Flight::auth()->currentUser->role != 20 || $user->id == Flight::auth()->currentUser->id ? "display:none" : "";
?>
' class="input-group">
<span class="input-group-addon" id="team">Team</span>
<select name="teams[]" multiple class="form-control" aria-describedby="teams" required>
<?php
$user_teams = $user->getTeams();
$user_team_ids = array_map(function ($team) {
return $team->id;
}, $user_teams);
foreach ($teams as $team) {
?>
<option <?php
echo in_array($team->id, $user_team_ids) ? "selected='selected'" : "";
?>
value='<?php
示例11: showNewUser
public function showNewUser()
{
Flight::auth()->check(20);
Flight::util()->render('newUser', array("teams" => Flight::teams()->getAllTeams()));
}