本文整理汇总了PHP中Auth::isLoggedIn方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::isLoggedIn方法的具体用法?PHP Auth::isLoggedIn怎么用?PHP Auth::isLoggedIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Auth
的用法示例。
在下文中一共展示了Auth::isLoggedIn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($pagina, $naam)
{
$taal = new Taal();
$auth = new Auth(false);
echo "<div id='topbar'> <div id='language'><ul class='swapUnderline'>";
if (!$auth->isLoggedIn() || $auth->isLoggedIn() && !$auth->getUser()->isPersoneel()) {
if ($taal->getTaal() == "nl") {
echo "<li class='selected'> NL</li>";
echo "<li class='last-child'><a href='veranderTaal.php?vorige=" . $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'] . "'>EN</a></li>";
} else {
echo "<li><a href='veranderTaal.php?vorige=" . $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'] . "'>NL</a></li>";
echo "<li class='selected last-child'> EN</li>";
}
}
echo "</ul></div><div id='user'><ul class='swapUnderline'>";
if (!$auth->isLoggedIn()) {
echo "<li class='last-child'><a class='Logintext advanced' href='" . Auth::getLoginURL() . "'> " . $taal->msg('aanmelden') . "</a></li>";
} else {
echo "<li class='last-child member'>" . $auth->getUser()->getGebruikersnaam() . " - <a class='Logintext' href='logout.php'' title='uitloggen'' >" . $taal->msg('afmelden') . "</a></li>";
}
echo "</ul> \n\t\t\t</div> \n\t\t</div> ";
echo "<div id='header'> \n\t\t\t<div id='headerleft'> \n\t\t\t\t<h1> <a href='http://www.ugent.be/nl' title='Universiteit Gent'><img src='images/universiteit_gent.gif' alt='Universiteit Gent'/> </a> </h1> \n\t\t\t\t<h2> <a href='index.php'>Online Herstelformulier</a></h2>\n\t\t\t</div> \n\t\t\t<div id='headerright'> </div> \n\t\t</div> ";
echo "<div id='breadcrumb' class='swapUnderline'>\n\t\t\t<span>" . $taal->msg('u_bent_hier') . "</span>";
$r = "";
foreach ($pagina as $key => $value) {
$r .= " <a class='br-act' href='{$value}'>" . $taal->msg($naam[$key]) . "</a> >";
}
echo substr($r, 0, -2);
echo "</div> ";
}
示例2: download__download
public function download__download()
{
$file = Request::get('file');
$filename = Path::fromAsset($file);
$as = Request::get('as', $file);
$logged_in = filter_var(Request::get('logged_in', true), FILTER_VALIDATE_BOOLEAN);
$override = Request::get('override');
if (!$logged_in) {
// first make sure there's an override in the config
$override_config = $this->fetchConfig('override');
if (!$override_config) {
die('No override key configured');
}
// now see if there's an override param
if (!$override) {
die('No override param');
}
if ($override_config != $override) {
die("Override key & param don't match");
}
} elseif (!Auth::isLoggedIn()) {
// if the user has to be logged in, see if they are
die('Must be logged in');
}
if (!$this->download($filename, $as)) {
die('File doesn\'t exist');
}
}
示例3: __construct
function __construct()
{
parent::__construct();
//pagination area
$config['full_tag_open'] = '<ul class="pagination pagination-sm no-margin pull-right">';
$config['full_tag_close'] = '</ul>';
$config['first_link'] = '<i class="fa fa-angle-left"></i><i class="fa fa-angle-left"></i>';
$config['first_tag_open'] = '<li class="prev">';
$config['first_tag_close'] = '</li>';
$config['last_link'] = '<i class="fa fa-angle-right"></i><i class="fa fa-angle-right"></i>';
$config['last_tag_open'] = '<li class="next">';
$config['last_tag_close'] = '</li>';
$config['next_link'] = '<i class="fa fa-angle-right"></i>';
$config['next_tag_open'] = '<li class="next">';
$config['next_tag_close'] = '</li>';
$config['prev_link'] = '<i class="fa fa-angle-left"></i>';
$config['prev_tag_open'] = '<li class="prev">';
$config['prev_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="active"><a href="javascript:void()">';
$config['cur_tag_close'] = '</a></li>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$this->configpagination = $config;
unset($config);
if (!Auth::isLoggedIn()) {
redirect('login');
}
}
示例4: pageController
function pageController()
{
$errors = [];
if (!Auth::isLoggedIn()) {
header('Location: users.create.php');
exit;
}
$userObject = UserModel::find($_SESSION['user_id']);
if (!empty($_POST)) {
try {
$userObject->first_name = Input::getString('firstName');
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
try {
$userObject->last_name = Input::getString('lastName');
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
if (Input::get('password1') == Input::get('password2')) {
try {
$userObject->password = Input::getPassword('password1', $userObject->first_name, $userObject->last_name, $userObject->email);
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
}
$userObject->save();
}
return ['user' => $userObject, 'errors' => $errors];
}
示例5: __construct
public function __construct()
{
parent::__construct();
if (Auth::isLoggedIn()) {
redirect('home');
}
}
示例6: pageController
function pageController()
{
if (Auth::isLoggedIn()) {
header("Location: index.php");
exit;
}
try {
$email = Input::getString('email');
} catch (Exception $e) {
$email = '';
}
try {
$password = Input::getString('password');
} catch (Exception $e) {
$password = '';
}
$user = UserModel::findByEmail($email);
// if(empty($user))
// {
// header("Location: users.create.php");
// exit();
// }
if (Auth::attempt($user, $password)) {
Auth::setSessionVariables($user);
header("Location: index.php");
exit;
}
return array('email' => $email, 'loggedIn' => Auth::isLoggedIn());
}
示例7: pagereorder_redux__reorder
public function pagereorder_redux__reorder()
{
$response = array('linkage' => null, 'message' => 'No order data received. Please try again.', 'status' => 'error');
// Get current user, to check if we're logged in.
if (!Auth::isLoggedIn()) {
exit('Invalid Request');
}
// Get POST data from request.
$order = Request::post('order', false);
$entry_folder = Request::post('entry_folder', false);
// Make sure we've got a response.
if (!$order || !$entry_folder) {
Log::error($response['message'], 'pagereorder_redux');
echo json_encode($response);
return false;
}
// Array of page order objects.
$page_order = json_decode($order);
if (isset($page_order[0]->url) && $page_order[0]->url != '') {
$response = $this->order_set($page_order, $entry_folder);
} else {
$response['message'] = "The data submitted was invalid";
}
echo json_encode($response);
return true;
}
示例8: userIsAuthorized
public function userIsAuthorized($action)
{
// Dafür sorgen, dass eine Anfrage ggf. auf das Login weitergeleitet wird,
// wenn die Session abgelaufen ist und nach erfolgtem Login nahtlos auf
// die angeforderte Seite weitergeleitet wird
if ($this->module_name != 'login' && !Auth::isLoggedIn()) {
$_SESSION['pixelmanager_temp_login_redirect']['uri'] = $_SERVER['REQUEST_URI'];
$_SESSION['pixelmanager_temp_login_redirect']['get'] = $_GET;
$_SESSION['pixelmanager_temp_login_redirect']['post'] = $_POST;
$_SESSION['pixelmanager_temp_login_redirect']['request'] = $_REQUEST;
Helpers::redirect(Config::get()->baseUrl . 'admin/html-output/login');
} else {
if ($this->module_name != 'login') {
if (isset($_SESSION['pixelmanager_temp_login_redirect'])) {
$_GET = $_SESSION['pixelmanager_temp_login_redirect']['get'];
$_POST = $_SESSION['pixelmanager_temp_login_redirect']['post'];
$_REQUEST = $_SESSION['pixelmanager_temp_login_redirect']['request'];
unset($_SESSION['pixelmanager_temp_login_redirect']);
}
}
}
// Wenn es sich um ein Zusatzmodul handelt, ggf. auf Zugangsberechtigung prüfen
if ($this->isCustomBackendModule()) {
$can_user_access = $this->canUserAccessCustomBackendModule();
if ($can_user_access === false) {
$this->accessDenied();
}
return $can_user_access;
}
// Anfrage wurde bis jetzt nicht abgefangen, also erstmal annehmen, dass der Zugriff erlaubt ist
return true;
}
示例9: __construct
public function __construct($categorie) {
$this->huidigePagina = basename($_SERVER['REQUEST_URI']);
$this->categorie = $categorie;
try{
$a = new Auth(false);
$taal = new Taal();
echo("<div id='navigationhome'><div id='mainnav'><ul>");
echo self::generateItem("index.php", $taal->msg('Index'));
if($a->isLoggedIn()){//zijn we ingelogd?
if($a->getUser()->isPersoneel()){//zijn we personeel?
echo self::generateItem("personeelMeldingToevoegen.php", "Defect Melden");
echo self::generateItem("personeelAdmin.php", "Beheer", true, true);
if($categorie == "Beheer"){//submenu beheer
echo"<ul>";
echo(self::generateItem("personeelAdminHomes.php","Beheer Homes"));
echo(self::generateItem("personeelAdminBeheerders.php","Beheer Beheerders"));
echo(self::generateItem("personeelAdminCategorie.php","Beheer Categorieën"));
$lijst = $a->getUser()->getHomesLijst();
foreach($lijst as $home){
echo(self::generateItem("personeelAdmin.php?homeId=".$home->getId(),"Home ".$home->getKorteNaam(), false, true));
}
echo"</ul></li>";
}
echo self::generateItem("personeelStatistiek.php", "Statistieken");
echo self::generateItem("personeelOverzicht.php", "Overzicht", true);
if($categorie == "Overzicht"){//submenu beheer
echo"<ul>";
echo(self::generateItem("personeelMeldingInformatie.php","Formulier"));
echo"</ul></li>";
}
if($a->getUser()->getGebruikersnaam()=="bmesuere" || $a->getUser()->getGebruikersnaam()=="bevdeghi"){
echo self::generateItem("errorlog.php", "Errorlog");
echo self::generateItem("ldapSearch.php", "LDAP");
}
}
else{//we zijn student
echo self::generateItem("studentOverzicht.php", $taal->msg('Overzicht'));
echo self::generateItem("studentMeldingToevoegen.php", $taal->msg('defect_melden'));
}
}
else{//we zijn niet ingelogd
echo self::generateItem(Auth::getLoginURL(), $taal->msg('aanmelden'));
echo self::generateItem("studentMeldingToevoegen.php", $taal->msg('defect_melden'));
}
echo("</ul></div><div class='visualClear'></div></div>");
}
catch (Exception $e){
//doe niets, anders krijgen we een error lus (Error.php genereert ook een menu...)
}
}
示例10: userIsAuthorized
public function userIsAuthorized($action)
{
if ($this->module_name != 'login' && !Auth::isLoggedIn()) {
// Kein Benutzer eingeloggt, das Ausf�hren der angeforderten Action verhindern
$this->error(self::RESULT_ERROR_NOT_LOGGED_IN);
return false;
} else {
if (Auth::isLoggedIn()) {
// Wenn es sich um ein Zusatzmodul handelt, ggf. auf Zugangsberechtigung pr�fen
if ($this->isCustomBackendModule()) {
$can_user_access = $this->canUserAccessCustomBackendModule();
if ($can_user_access === false) {
$this->error(self::RESULT_ERROR_NOT_AUHTORIZED);
}
return $can_user_access;
}
}
}
// Anfrage wurde bis jetzt nicht abgefangen, also erstmal annehmen, dass der Zugriff erlaubt ist
return true;
}
示例11: run
public function run()
{
$authenticated = Auth::isLoggedIn();
$controller = ucfirst(strtolower(static::$request['controller'])) . 'Controller';
// some router logic / protection
if ($authenticated) {
if (isset(static::$request['params']['logout']) && Auth::logout()) {
$this->redirect('/');
}
if (isset(static::$request['params']['switchuser'])) {
$url = Auth::switchUser((int) static::$request['params']['switchuser']);
$this->redirect($url);
}
if (empty($controller) || $controller === 'FrontController' || $controller === 'JoinController' && Auth::$profile->profileSet()) {
$this->redirect('/central');
}
if ($controller !== 'JoinController' && !Auth::$profile->profileSet()) {
$this->redirect('/join');
}
if ($controller === 'AdminController' && !Auth::isAdmin()) {
$this->redirect('/errors/view/401');
}
} else {
if (!static::$request['public']) {
$this->redirect('/');
}
}
if (class_exists($controller, true)) {
$props = !empty(Auth::$profile) ? ['profile' => Auth::$profile] : [];
$invoke = new $controller();
return $invoke(static::$request, $props);
// invoke controller
} else {
$this->redirect('/errors/view/404');
}
}
示例12: e
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="<?php
echo Config::get("custom.admin_base_url");
?>
">LA1:TV CMS</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
@yield('navbarList', '')
</ul>
<a class="btn btn-info navbar-btn navbar-right" href="<?php
echo e(URL::to(Auth::isLoggedIn() ? "/admin/login/logout" : "/admin/login"));
?>
"><?php
echo !Auth::isLoggedIn() ? "Login" : "Log Out";
?>
</a>
</div>
</div>
</div>
@yield('content')
<div id="footer">
<div class="container">
<p class="text-muted footer-txt">The custom built content management system for LA1:TV.</p>
</div>
</div>
@stop
示例13: upgrade
public function upgrade($version)
{
$auth = new Auth();
if (!$auth->isLoggedIn() || !$auth->isAdmin()) {
return "Must be logged in as admin";
}
$path = $_SERVER['DOCUMENT_ROOT'] . $_SERVER['APP_ROOT'] . "library/installer/schemas/update" . $version . ".sql";
if (!file_exists($path)) {
return "Schema does not exist";
}
$settings = WposAdminSettings::getSettingsObject('general');
if (floatval($settings->version) >= floatval($version)) {
return "Db already at the latest version";
}
$sql = file_get_contents($path);
try {
$result = $this->db->_db->exec($sql);
if ($result !== false) {
switch ($version) {
case "1.0":
// set sales type & channel
$sql = "UPDATE `sales` SET `type`='sale', `channel`='pos';";
if ($this->db->_db->exec($sql) === false) {
return $this->db->_db->errorInfo()[0];
}
// set payment dt to process dt and update sales json with extra params
$sql = "SELECT * FROM `sales`;";
$sales = $this->db->select($sql, []);
foreach ($sales as $sale) {
$data = json_decode($sale['data']);
$data->id = $sale['id'];
$data->balance = 0.0;
$data->dt = $sale['dt'];
$data->status = $sale['status'];
if ($data == false) {
die("Prevented null data entry");
}
$sql = "UPDATE `sales` SET `data`=:data WHERE `id`=:saleid";
$this->db->update($sql, [":data" => json_encode($data), ":saleid" => $sale['id']]);
$sql = "UPDATE `sale_payments` SET `processdt=:processdt WHERE `saleid`=:saleid";
$this->db->update($sql, [":processdt" => $sale['processdt'], ":saleid" => $sale['id']]);
}
// update config, add google keys
WposAdminSettings::putValue('general', 'version', '1.0');
WposAdminSettings::putValue('general', 'gcontact', 0);
WposAdminSettings::putValue('general', 'gcontacttoken', '');
WposAdminSettings::putValue('pos', 'priceedit', 'blank');
// copy new templates
copy($_SERVER['DOCUMENT_ROOT'] . $_SERVER['APP_ROOT'] . 'docs-template/templates', $_SERVER['DOCUMENT_ROOT'] . $_SERVER['APP_ROOT'] . 'docs/');
break;
case "1.1":
WposAdminSettings::putValue('general', 'version', '1.1');
}
return true;
} else {
return $this->db->_db->errorInfo()[0];
}
} catch (Exception $e) {
return $e->getMessage();
}
}
示例14: Auth
<?php
require_once __DIR__ . '/../../includes/helpers.php';
require_once __DIR__ . '/../../loader.php';
Session::checkSession();
$a = new Auth();
if (!$a->isLoggedIn()) {
redirect_to('login.php');
exit;
}
$u = User::getUser();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<!--<link rel="icon" href="../../favicon.ico"> -->
<title>Photolia</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Custom styles for this template -->
<link href="../css/style.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
示例15: profile_form
public function profile_form()
{
if (!Auth::isLoggedIn()) {
// not logged in
return false;
}
$attr_string = '';
$member = Auth::getCurrentMember();
$site_root = Config::getSiteRoot();
$username = $this->fetchParam('username', $member->get('username'));
$return = $this->fetchParam('return', $site_root, null, false, false);
$attr = $this->fetchParam('attr', false);
// get old values
$old_values = $this->flash->get('update_profile_old_values', array()) + Member::getProfile($username);
array_walk_recursive($old_values, function (&$item, $key) {
$item = htmlspecialchars($item);
});
// set up any data to be parsed into content
$data = array('error' => $this->flash->get('update_profile_error', ''), 'success' => $this->flash->get('update_profile_success', ''), 'field_errors' => $this->flash->get('update_profile_field_errors', array()), 'old_values' => $old_values);
// set up attributes
if ($attr) {
$attributes_array = Helper::explodeOptions($attr, true);
foreach ($attributes_array as $key => $value) {
$attr_string .= ' ' . $key . '="' . $value . '"';
}
}
// set username in flash
$this->flash->set('update_username', $username);
// set up form HTML
$html = '<form method="post" action="' . Path::tidy($site_root . "/TRIGGER/member/update_profile") . '" ' . $attr_string . '>';
$html .= '<input type="hidden" name="return" value="' . $return . '">';
$html .= '<input type="hidden" name="token" value="' . $this->tokens->create() . '">';
// are we editing someone other than the current user?
// security note, the hook for this form will check that the current
// user has permissions to edit this user's information
if ($username !== $member->get('username')) {
$html .= '<input type="hidden" name="username" value="' . $username . '">';
}
$html .= Parse::template($this->content, $data);
$html .= '</form>';
// return that HTML
return $html;
}