当前位置: 首页>>代码示例>>PHP>>正文


PHP Flight::auth方法代码示例

本文整理汇总了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>
开发者ID:happyoniens,项目名称:Club,代码行数:31,代码来源:layout.php

示例2: deleteTeam

 public function deleteTeam($id)
 {
     Flight::auth()->check(20);
     $team = Flight::teams()->getTeamWithId($id);
     $team->delete();
     Flight::redirect('/teams');
 }
开发者ID:happyoniens,项目名称:Club,代码行数:7,代码来源:teamController.php

示例3: deleteAbsence

 public function deleteAbsence($id)
 {
     Flight::auth()->check();
     $absence = Flight::absence()->getAbsenceWithId($id);
     $absence->delete();
     Flight::redirect(Flight::request()->referrer);
 }
开发者ID:happyoniens,项目名称:Club,代码行数:7,代码来源:absenceController.php

示例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);
 }
开发者ID:happyoniens,项目名称:Club,代码行数:8,代码来源:playerController.php

示例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);
 }
开发者ID:happyoniens,项目名称:Club,代码行数:8,代码来源:eventController.php

示例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");
 }
开发者ID:happyoniens,项目名称:Club,代码行数:14,代码来源:auth.php

示例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']);
开发者ID:humfricz,项目名称:AuthPortal,代码行数:31,代码来源:index.php

示例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>
开发者ID:happyoniens,项目名称:Club,代码行数:30,代码来源:player.php

示例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"]);
开发者ID:happyoniens,项目名称:Club,代码行数:31,代码来源:routes.php

示例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 
开发者ID:happyoniens,项目名称:Club,代码行数:31,代码来源:editUser.php

示例11: showNewUser

 public function showNewUser()
 {
     Flight::auth()->check(20);
     Flight::util()->render('newUser', array("teams" => Flight::teams()->getAllTeams()));
 }
开发者ID:happyoniens,项目名称:Club,代码行数:5,代码来源:userController.php


注:本文中的Flight::auth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。