本文整理汇总了PHP中Flight::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Flight::redirect方法的具体用法?PHP Flight::redirect怎么用?PHP Flight::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flight
的用法示例。
在下文中一共展示了Flight::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_pass
/**
* Save chosen password
*/
public function save_pass()
{
$pass = F::request()->data->password;
$pass2 = F::request()->data->password2;
if ($pass === $pass2) {
if (!empty($pass)) {
if (Action::savePassword($pass)) {
$_SESSION['flashbag'] = '
<div class="alert alert-success alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
Your password has successfully been set.
</div>';
$_SESSION['admin'] = 1;
F::redirect('/settings');
exit;
} else {
$_SESSION['flashbag'] = '<div class="alert alert-danger">An error occured. Please verify that the app/ and src/ folder are writable.</div>';
}
} else {
$_SESSION['flashbag'] = '<div class="alert alert-warning">No password ? Are you serious ? Put at least some letters.</div>';
}
} else {
$_SESSION['flashbag'] = '<div class="alert alert-danger">You must enter the same password twice.</div>';
}
$this->index();
}
示例2: checkLogin
/**
* Checks whether or not user is logged in. Redirects to login page if not.
*/
private static function checkLogin()
{
// session stuff
if (!isset($_SESSION['logged'])) {
Flight::redirect('./login');
}
}
示例3: init
public function init()
{
$data = $_REQUEST;
if (isset($data[Profile::GET_CHANGE_PASSWORD_BUTTON])) {
if (strlen($data[Profile::GET_CHANGE_PASSWORD]) > 0) {
if (!User::passwordIsValid($data[Profile::GET_CHANGE_PASSWORD])) {
Flight::redirect($_SERVER['REDIRECT_URL'] . '?success=0');
} else {
$user = Auth::getInstance()->getUser();
$user->password = User::getHashPassword(trim(strip_tags($data[Profile::GET_CHANGE_PASSWORD])), $user->login);
$user->save();
Flight::redirect($_SERVER['REDIRECT_URL'] . '?success=1');
return true;
}
}
if (strlen($data[Profile::GET_CHANGE_PHONE]) > 0) {
if (!User::validatePhone(trim($data[Profile::GET_CHANGE_PHONE]))) {
Flight::redirect($_SERVER['REDIRECT_URL'] . '?success=2');
} else {
$user = Auth::getInstance()->getUser();
$user->number = trim($data[Profile::GET_CHANGE_PHONE]);
$user->save();
Flight::redirect($_SERVER['REDIRECT_URL'] . '?success=1');
return true;
}
}
}
}
示例4: deleteTeam
public function deleteTeam($id)
{
Flight::auth()->check(20);
$team = Flight::teams()->getTeamWithId($id);
$team->delete();
Flight::redirect('/teams');
}
示例5: __construct
/**
* Check if the user is authorized
*/
public function __construct($install, $login = false)
{
if (!isset($_SESSION['admin']) && !$install && !$login) {
F::redirect('/login');
}
parent::__construct($install);
}
示例6: init
public function init()
{
$data = $_REQUEST;
if (isset($data[Profile::GET_CHANGE_PASSWORD_BUTTON])) {
$user = Auth::getInstance()->getUser();
if (strlen(trim($data[Profile::GET_CHANGE_MAIL])) > 0) {
if ($user->email != trim($data[Profile::GET_CHANGE_MAIL])) {
if (User::validEmail(trim(strip_tags($data[Profile::GET_CHANGE_MAIL])))) {
$user->email = trim(strip_tags($data[Profile::GET_CHANGE_MAIL]));
$user->password = User::getHashPassword($user->password, strtolower($user->email));
} else {
Flight::redirect($_SERVER['REDIRECT_URL'] . '?success=2');
}
}
}
if (strlen(trim($data[Profile::GET_CHANGE_PASSWORD])) > 0) {
if (!User::passwordIsValid($data[Profile::GET_CHANGE_PASSWORD])) {
Flight::redirect($_SERVER['REDIRECT_URL'] . '?success=0');
} else {
$user->password = User::getHashPassword(trim(strip_tags($data[Profile::GET_CHANGE_PASSWORD])), strtolower($user->email));
}
}
$user->save();
Flight::redirect($_SERVER['REDIRECT_URL'] . '?success=1');
return true;
}
}
示例7: _manage_platoon
public static function _manage_platoon($div, $plt)
{
$division = Division::findByName(strtolower($div));
$platoonId = Platoon::getIdFromNumber($plt, $division->id);
if (!is_null($platoonId)) {
$user = User::find(intval($_SESSION['userid']));
$member = Member::find(intval($_SESSION['memberid']));
if ($member->platoon_id == $platoonId || $user->role > 2 || User::isDev()) {
$tools = Tool::find_all($user->role);
$divisions = Division::find_all();
$platoon = Platoon::findById($platoonId);
$unassignedMembers = Platoon::unassignedMembers($platoonId, true);
$squads = Squad::findByPlatoonId($platoonId);
$memberCount = count((array) Platoon::members($platoonId));
$js = 'manage';
Flight::render('manage/platoon', compact('division', 'platoon', 'squads', 'unassignedMembers', 'memberCount'), 'content');
Flight::render('layouts/application', compact('js', 'user', 'member', 'tools', 'divisions'));
} else {
// insufficient access
Flight::redirect('404/', 404);
}
} else {
// nonexistent platoon
Flight::redirect('404/', 404);
}
}
示例8: _doAddPartTimeMember
public static function _doAddPartTimeMember()
{
$member = Member::find(intval($_SESSION['memberid']));
$member_params = array('member_id' => $_POST['member_id'], 'forum_name' => $_POST['name'], 'ingame_alias' => $_POST['ingame_alias'], 'game_id' => $member->game_id);
PartTime::add($member_params);
Flight::redirect('/manage/part-time');
}
示例9: deleteAbsence
public function deleteAbsence($id)
{
Flight::auth()->check();
$absence = Flight::absence()->getAbsenceWithId($id);
$absence->delete();
Flight::redirect(Flight::request()->referrer);
}
示例10: 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);
}
示例11: createPost
/**
* Create a post
*/
public static function createPost()
{
if (!Flight::has('currentUser')) {
Flight::redirect('/');
}
$post = new post(['user' => Flight::get('currentUser')->id, 'title' => Flight::request()->data->title, 'content' => Flight::request()->data->content]);
$post->store();
}
示例12: deleteEvent
public function deleteEvent($id)
{
Flight::auth()->check();
$event = Flight::events()->getEventWithId($id);
$team_id = $event->team;
$event->delete();
Flight::redirect("/team/" . $team_id);
}
示例13: logout
/**
* Logout logged user
*/
public function logout()
{
unset($_SESSION['db']);
unset($_SESSION['logged']);
unset($_SESSION);
@session_destroy();
session_regenerate_id();
Flight::redirect('./login');
}
示例14: checkInstall
/**
* check if the install process have been done
*/
private function checkInstall($install)
{
if (F::has('password')) {
if (!$install && empty(F::get('password'))) {
F::redirect('/install');
} elseif ($install && !empty(F::get('password'))) {
F::redirect('/login');
}
}
}
示例15: sendMessage
public function sendMessage()
{
$data = $_REQUEST;
if (isset($data[Help::GET_SEND])) {
$message = wordwrap(trim(strip_tags($data[Help::GET_MESSAGE])), 70, "\r\n");
$theme = trim(strip_tags($data[Help::GET_THEME]));
if ($this->send_mime_mail(Auth::getInstance()->getUser()->login, Auth::getInstance()->getUser()->login . '@no-reply', 'admin', "admin@admin.com", 'UTF-8', 'windows-1251', $theme, $message)) {
Flight::redirect('/help?success=1');
}
}
}