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


PHP Auth::isAuth方法代码示例

本文整理汇总了PHP中Auth::isAuth方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::isAuth方法的具体用法?PHP Auth::isAuth怎么用?PHP Auth::isAuth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Auth的用法示例。


在下文中一共展示了Auth::isAuth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: authenticate

 /**
  * The authenticate action has to be triggered through an HTTP POST Request, only if the user agent
  * comes directly from the index (login form) action.
  *
  * @param string $username The username provided through the login form.
  * @param string $password The password provided through the login form.
  * @param string $ref The action where the user-agent has to be redirect if the authentication process is a success.
  */
 public function authenticate($username, $password, $ref, $openid)
 {
     if (!empty($openid)) {
         $oid = new Openid();
         $oid->try_auth($openid);
         exit;
     }
     Auth::login($username, $password);
     if (Auth::isAuth()) {
         // Authentication process succeeded.
         // We log the connection if necessary.
         // FIXME Use a real log library to log messages.
         if (LOGS_USERS) {
             $this->logConnection();
         }
         // Redirection in the portal.
         DefaultFC::redirection($ref);
         exit;
     } else {
         # log user to the anonymous account
         //$_SESSION['isError'] = true;
         //$_SESSION['message'] = __("Wrong login or password. Please try again.");
         Auth::login('anonymous', 'anonymous');
         DefaultFC::redirection('wall/index');
         DefaultFC::redirection('users/index');
         exit;
     }
 }
开发者ID:ripplecrpht,项目名称:ripplecrpht,代码行数:36,代码来源:Users.class.php

示例2: index

 /**
  * The index action is the default action of this Wall Module. It prepares the widget
  * wall of the user and render the view according to its preferences.
  *
  * If the current user is not authenticated, it will be redirected to the users/index
  * action that will allows you to acces the login form of the application.
  *
  */
 public function index($continuePurchase = false, $langage = null, $forcebrowser = false)
 {
     # Try to force users to use firefox
     //		if(isset($_SESSION['forcebrowser']) && $_SESSION['forcebrowser'] == true){
     //			$forcebrowser = true;
     //		}
     //		if(!ereg("Firefox/",$_SERVER['HTTP_USER_AGENT']) && !$forcebrowser){
     //			require(DefaultFC::getView('compatibility.tpl'));
     //			die();
     //		}else{
     //			$_SESSION['forcebrowser'] = true;
     //		}
     if (Auth::isAuth()) {
         // Determine if the 'category widget' is installed.
         if (Widgets::isInstalled('categoryList')) {
             $widgetCategory = array('id' => 'categoryList', 'name' => 'Widget Categories');
         }
         // Determine if the 'tag cloud widget' is installed.
         if (Widgets::isInstalled('tagCloud')) {
             $widgetCloud = array('id' => 'tagCloud', 'name' => 'Widget Tag Cloud');
         }
         // Determine if the view must allow the user to manage widgets.
         $widgetManagement = false;
         if (Auth::isAdmin() || Auth::isGod()) {
             $widgetManagement = true;
         }
         // Determine if the view must show the list of installed widgets or
         // a link to the PALETTE Service Browser.
         $useServiceBrowser = USE_SERVICE_BROWSER;
         $serviceBrowserURI = USE_SERVICE_BROWSER ? SERVICE_BROWSER_URI . 'index.php/Services/Widgets?num=1' : null;
         require DefaultFC::getView('index.tpl');
     } else {
         DefaultFC::redirection('users/index?ref=wall');
     }
 }
开发者ID:ripplecrpht,项目名称:ripplecrpht,代码行数:43,代码来源:Wall.class.php

示例3: index

	/**
	 * Affiche la page par défaut du site
	 * @see BaseController::index()
	 */
	public function index() {
		$this->loadView("main/vHeader",array("infoUser"=>Auth::getInfoUser()));
		$message = null;
		if (isset($_SESSION['logStatus'])){
			switch ($_SESSION['logStatus']) {
				case 'fail':
					$message=new DisplayedMessage("ERREUR : Couple identifiant/mot de passe inconnu.", "danger");
					break;
				case 'disconnected':
					$message=new DisplayedMessage("Vous avez été correctement déconnecté. <b>Au revoir...</b>", "success");
					break;
				case 'success':
					$message=new DisplayedMessage("Bienvenue ".Auth::getUser()->getLogin().".", "success");
					break;
				default:
					$message = null;
					break;
			}
			$_SESSION['logStatus'] = null;
		}

		if(Auth::isAuth()){
			$notifs = DAO::getAll("Notification", "idUser = ".Auth::getUser()->getId());
			$this->loadView("main/vDefault", array("notifs" => $notifs, "message" => $message));
		}else{
			$this->loadView("main/vLogin");
		}
		$this->loadView("main/vFooter");
	}
开发者ID:aleboisselier,项目名称:helpdesk,代码行数:33,代码来源:Indexx.php

示例4: index

 function index()
 {
     if (Auth::isAuth() == false) {
         View::make('auth/login.php');
     } else {
         View::make('auth/logout.php');
     }
 }
开发者ID:vitodtagliente,项目名称:webseed,代码行数:8,代码来源:auth.php

示例5: index

 /**
  * Affiche la page par défaut du site
  * @see BaseController::index()
  */
 public function index()
 {
     if (Auth::isAuth()) {
         $this->loadView("main/vHeader", array("infoUser" => Auth::getInfoUser()));
         $this->loadView("main/vFooter");
         $this->loadView("main/vDefault");
         Jquery::getOn("click", ".btAjax", "sample/ajaxSample", "#response");
         echo Jquery::compile();
     } else {
         $this->loadView("main/vHeader", array("infoUser" => Auth::getInfoUser()));
         $this->loadView("main/frm_log");
         $this->loadView("main/vFooter");
         Jquery::getOn("click", ".btAjax", "sample/ajaxSample", "#response");
         echo Jquery::compile();
     }
 }
开发者ID:jibladakpo,项目名称:helpdesk,代码行数:20,代码来源:DefaultC.php

示例6: subscribe

 public function subscribe()
 {
     $keys = array_keys($_GET);
     $widgetId = $keys[0];
     if (!isset($widgetId)) {
         throw new BadArgumentException(MwwException::CONTROLLER, 'You must provide a widget identifier to subscribe to a widget.');
     }
     if (!Auth::isAuth()) {
         // forward to the login script.
         DefaultFC::redirection('users/index?ref=subscribe');
         exit;
     }
     // No failure for authentication and parameters. We just carry on !
     UserInterface::subscribe(Auth::getUserId(), $widgetId);
     DefaultFC::redirection('wall/index');
 }
开发者ID:ripplecrpht,项目名称:ripplecrpht,代码行数:16,代码来源:Inscription.class.php

示例7: over

 private static function over()
 {
     //ak niesom prihlaseny tak ma prihlas
     if (!Auth::isAuth()) {
         Viewer::addMessage("Na zobrazenie tejto stránky musíš byť prihlásený/á !", Viewer::ERROR);
         Viewer::setPage(Viewer::LOGIN);
         return False;
     }
     //zistim si cislo pozadovaneho testu
     $testid = 0;
     if (isset($_GET['testid'])) {
         $testid = intval($_GET['testid']);
     }
     //overim ci exituje taky test pre mna
     $query = DB::query('SELECT * from `ucitelia`
          LEFT JOIN `tests` ON ucitelia.ucitelid=tests.ucitel
          LEFT JOIN `predmety` ON predmety.predmetid=tests.predmetid
      WHERE `trieda`=' . Auth::$userData['trieda']['id'] . " AND `testid`=" . $testid);
     //ak nie
     if ($query->num_rows == 0) {
         //idem s5 na zoznam testov
         Viewer::addMessage("Takýto dotazník neexistuje alebo naň nemáš právo!", Viewer::ERROR);
         TestList::init();
         Viewer::setPage(Viewer::TEST_LIST);
         return False;
     }
     //ulozim si udaje o teste
     self::$testData = $query->fetch_array();
     //zistim si groupid testu
     Utils::log(print_r(self::$testData, true));
     $groupid = self::$testData['groupid'];
     //overim ci tento test neije vyplneny
     //ak grupy
     //$queryans = DB::query('SELECT * from `answered` WHERE `groupid`='.$groupid." AND `userid`=".Auth::$userData['id']['id']);
     $queryans = DB::query('SELECT * from `answered` WHERE `testid`=' . $testid . " AND `userid`=" . Auth::$userData['id']['id']);
     if ($queryans->num_rows != 0) {
         Viewer::addMessage("Tento dotazník si už vyplnil/a!", Viewer::ERROR);
         TestList::init();
         Viewer::setPage(Viewer::TEST_LIST);
         return False;
     }
     return True;
 }
开发者ID:kabell,项目名称:dotaznik,代码行数:43,代码来源:Test.php

示例8: init

 public static function init()
 {
     if (self::$initialized == True) {
         return;
     }
     self::$initialized = True;
     //ak niesom prihlaseny tak ma hod na login
     if (!Auth::isAuth()) {
         Viewer::addMessage("Na zobrazenie tejto stránky musíš byť prihlásený/á !", Viewer::ERROR);
         Viewer::setPage(Viewer::LOGIN);
         return;
     }
     //ak nie som admin (ale som prihlaseny), tak ma hod na TestList
     /*
     if(!Auth::isAdmin()) {
       Viewer::addMessage("Na zobrazenie tejto stránky musíš byť adminstrátor !", Viewer::ERROR);
       TestList::init();
       Viewer::setPage(Viewer::TEST_LIST);
       return;
     }
     */
     //vytiahnem predmety
     $query = DB::query("SELECT * FROM `predmety` ORDER BY nazov");
     while ($row = $query->fetch_array()) {
         self::$predmety[] = $row;
     }
     //vytiahnem triedy
     $query = DB::query("SELECT * FROM `triedy` WHERE blocked=0 ORDER BY id");
     while ($row = $query->fetch_array()) {
         self::$triedy[] = $row;
         self::$triedy_predmety[$row['name']] = array();
     }
     //vytiahnem ucitelov
     $query = DB::query("SELECT * FROM `ucitelia`");
     while ($row = $query->fetch_array()) {
         self::$ucitelia[] = $row;
     }
     //vytiahnem vsetky testy
     $query = DB::query("SELECT * FROM tests\n         JOIN ucitelia ON ucitelia.ucitelid=tests.ucitel\n         JOIN triedy ON triedy.id=tests.trieda\n         JOIN predmety ON predmety.predmetid=tests.predmetid\n         WHERE blocked=0 AND removed=0");
     while ($row = $query->fetch_array()) {
         self::$triedy_predmety[$row['name']][] = $row;
     }
 }
开发者ID:kabell,项目名称:dotaznik,代码行数:43,代码来源:Admin.php

示例9: edit

 /**
  * This action is triggered through a POST HTTP Request in order to modifiy
  * the name of an existing category.
  * 
  * @param integer $categoryId The numeric identifier of the category the user wants to modify the name.
  * @param string $catregoryName The new name of the category the user wants to modify the name.
  */
 public function edit($categoryId, $categoryName)
 {
     // Security check.
     if (!Auth::isAuth() && (Auth::isAdmin() || Auth::isGod())) {
         DefaultFC::redirection('users/index?ref=admin');
     }
     try {
         Categories::modify($categoryId, $categoryName);
         // Ok no exception thrown !
         $_SESSION['isError'] = false;
         $_SESSION['message'] = sprintf(__("The category '%s' has been successfuly updated."), $categoryName);
         DefaultFC::redirection('adminCategories/index');
     } catch (CategoryException $e) {
         // An error occured. Normally, the category name already exists.
         $_SESSION['isError'] = true;
         if ($e->getCode() == CategoryException::ALREADY_EXISTS) {
             $_SESSION['message'] = sprintf(__("The category '%s' already exists."), $categoryName);
         } else {
             $_SESSION['message'] = __("Please provide a category name.");
         }
         DefaultFC::redirection('adminCategories/index');
     }
 }
开发者ID:ripplecrpht,项目名称:ripplecrpht,代码行数:30,代码来源:AdminCategories.class.php

示例10: UserAuth

        "mails"=>[
            "smtp"=> "smtp.gmail.com",
            "smtpAuth" => true,
            "username"=> "gmailID@gmail.com",
            "password"=> "GmailPassword",
            "port" => 587,
            "secure"=>"tls"
        ],
        "cookies"=>[
        	"user"=>[
        		"lifetime"=>time()+60*60*24*7
        	]
        ],
        "test"=>false,
		"onStartup"=>function($action){
			if(!Auth::isAuth() && $action[0]!=="UserAuth" && @$action[1]!=="disconnect"){
				if(array_key_exists("autoConnect", $_COOKIE)){
					$_SESSION["action"]=$action;
					$ctrl=new UserAuth();
					$ctrl->initialize();
					$ctrl->signin_with_hybridauth(array($_COOKIE["autoConnect"]));
					$ctrl->finalize();
					die();
				}else if(array_key_exists("user", $_COOKIE)){
					$user = DAO::getOne("User", $_COOKIE['user']);
					$_SESSION["user"] = $user;
					$_SESSION['KCFINDER'] = array(
							'disabled' => true
					);
					$_SESSION['logStatus'] = 'success';
				}
开发者ID:aleboisselier,项目名称:helpdesk,代码行数:31,代码来源:config.php

示例11: Auth

 */
ini_set('error_reporting', E_ALL);
error_reporting(E_ALL);
if (isset($_GET['id'])) {
    $linkid = $_GET['id'];
} else {
    $linkid = 0;
}
require __DIR__ . '/../functions/auth.php';
require __DIR__ . '/../functions/Link.php';
require __DIR__ . '/ip2locationlite.class.php';
//LOAD THE CLASS
$ipLite = new ip2location_lite();
$ipLite->setKey('ae923f3e42d55c11ae0d9b6dcdba688847e96da84503d36b78f5deca0a47b0e6');
$auth = new Auth();
if ($auth->isAuth()) {
    $link = new Link();
    $iplinks = $link->getDownList($linkid);
    foreach ($iplinks as &$iplink) {
        $location = $ipLite->getCity(long2ip($iplink['ip']));
        $error = $ipLite->getError();
        $iplink['error'] = $error;
        $iplink['location'] = $location;
        $iplink['ip'] = long2ip($iplink['ip']);
        //array(11) {
        // ["statusCode"]=> string(2) "OK"
        // ["statusMessage"]=> string(0) ""
        // ["ipAddress"]=> string(14) "109.200.117.62"
        // ["countryCode"]=> string(2) "RU"
        // ["countryName"]=> string(18) "Russian Federation"
        // ["regionName"]=> string(10) "Sverdlovsk"
开发者ID:Ristee,项目名称:link,代码行数:31,代码来源:listip.php

示例12: i18n

 public function i18n($messages)
 {
     if (!Auth::isAuth()) {
         throw new ServiceException(MwwException::ACTION, 'I18N', ServiceException::SERV_AUTH);
     }
     $translations = array();
     $messages = json_decode(html_entity_decode($messages, ENT_QUOTES, 'UTF-8'));
     foreach ($messages as $msg) {
         $translations[] = array('original' => $msg, 'translated' => __($msg));
     }
     echo json_encode($translations);
 }
开发者ID:ripplecrpht,项目名称:ripplecrpht,代码行数:12,代码来源:Engine.class.php

示例13: run

 public static function run()
 {
     if (isset($_GET['mode'])) {
         $mode = $_GET['mode'];
     } else {
         $mode = "";
     }
     $request = True;
     //najskôr vyriadime požiadavku
     if ($mode == self::MODE_LOGIN && isset($_POST['password'])) {
         Auth::login($_POST['password']);
     } else {
         if ($mode == self::MODE_SUBMIT_TEST) {
             if (Auth::isAuth()) {
                 Test::submit();
             } else {
                 Viewer::addMessage("Na túto akciu nemáš prístup !", Viewer::ERROR);
             }
         } else {
             if ($mode == self::MODE_LOGOUT) {
                 if (Auth::isAuth()) {
                     Auth::logout();
                 } else {
                     Viewer::addMessage("Na túto akciu nemáš prístup !", Viewer::ERROR);
                 }
             } else {
                 if ($mode == self::MODE_DEL_PREDMET) {
                     if (Auth::isAdmin()) {
                         Admin::delPredmet();
                     } else {
                         Viewer::addMessage("Na túto akciu nemáš prístup !", Viewer::ERROR);
                     }
                 } else {
                     if ($mode == self::MODE_ADD_CLASS) {
                         if (Auth::isAdmin()) {
                             Admin::addClass();
                         } else {
                             Viewer::addMessage("Na túto akciu nemáš prístup !", Viewer::ERROR);
                         }
                     } else {
                         if ($mode == self::MODE_DEL_CLASS) {
                             if (Auth::isAdmin()) {
                                 Admin::delClass();
                             } else {
                                 Viewer::addMessage("Na túto akciu nemáš prístup !", Viewer::ERROR);
                             }
                         } else {
                             if ($mode == self::MODE_ADD_PREDMET) {
                                 if (Auth::isAuth()) {
                                     Admin::addPredmet();
                                 } else {
                                     Viewer::addMessage("Na túto akciu nemáš prístup !", Viewer::ERROR);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     //a idem spracovť stránku
     //ak som prihlásený a chcem sa znova prihlásiť tak mi to nepojde
     if (self::$page == self::LOGIN && Auth::isAuth()) {
         Viewer::setPage(self::TEST_LIST);
     }
     if (self::$page == self::TEST_LIST) {
         TestList::init();
     } else {
         if (self::$page == self::TEST) {
             Test::init();
         } else {
             if (self::$page == self::STATS) {
                 Stats::init();
             } else {
                 if (self::$page == self::ADMIN) {
                     Admin::init();
                 }
             }
         }
     }
 }
开发者ID:kabell,项目名称:dotaznik,代码行数:81,代码来源:Viewer.php

示例14: init

 public static function init()
 {
     if (self::$initialized == True) {
         return;
     }
     self::$initialized = True;
     //ak niesom prihlaseny tak ma hod na login
     if (!Auth::isAuth()) {
         Viewer::addMessage("Na zobrazenie tejto stránky musíš byť prihlásený/á !", Viewer::ERROR);
         Viewer::setPage(Viewer::LOGIN);
         return;
     }
     //nacitam z DB vsetky dotazniky ktore su pre mna
     $query = DB::query('SELECT * from `ucitelia`
          LEFT JOIN `tests` ON ucitelia.ucitelid=tests.ucitel
          LEFT JOIN `predmety` ON predmety.predmetid=tests.predmetid
      WHERE `trieda`=' . Auth::$userData['trieda']['id']);
     //ak ich je 0
     //if($query->num_rows==0)
     //    Viewer::addMessage("Prepáč, ale teraz niesu pre teba k dispozícii žiadne dotazníky !",Viewer::ERROR);
     //ulozim si ich
     while ($query->num_rows > 0 && ($row = $query->fetch_array())) {
         self::$allTests[] = $row;
     }
     //tuto treba odfiltrovat zodpovedane testy
     //nacitam ich zoznam z DB
     $query = DB::query("SELECT * from `answered` where `userid`=" . Auth::$userData['id']['id']);
     $answered = array();
     while ($query->num_rows > 0 && ($row = $query->fetch_array())) {
         $answered[] = $row;
     }
     //oznacim zodpovedane
     foreach (self::$allTests as &$test) {
         if (isset($test['answered'])) {
             continue;
         }
         $found = False;
         foreach ($answered as $answer) {
             if ($answer['testid'] == $test['testid']) {
                 $found = True;
             }
         }
         // ak je zodpovedany, zodpovedane su aj vsetky s rovnakym groupid
         if ($found) {
             foreach (self::$allTests as &$test2) {
                 //zapnutie skupin  - prepisanie testid na groupid
                 if (strcmp($test['testid'], $test2['testid']) == 0) {
                     $test2['answered'] = True;
                 }
             }
         } else {
             $test['answered'] = False;
         }
     }
     //Utils::log(print_r(self::$allTests,true));
     //skontrolujeme kolko dotaznikov este zostava
     $counter = 0;
     foreach (self::$allTests as &$test) {
         if ($test['answered'] == False) {
             $counter++;
         }
     }
     if ($counter == 0 && count(self::$allTests) > 0) {
         Viewer::addMessage("Ďakujeme za vyplnenie všetkých dotazníkov !", Viewer::OK);
     } else {
         Viewer::addMessage("Ešte ti zostáva " . $counter . " dotazníkov.", Viewer::WARNING);
     }
     //Utils::log(print_r(self::$allTests,true));
     //Utils::log(print_r(self::$allTests,true));
 }
开发者ID:kabell,项目名称:dotaznik,代码行数:70,代码来源:TestList.php

示例15: anonymousUserToRegisteredUser

 public static function anonymousUserToRegisteredUser($anonymous_username, $username, $password, $confirm_password)
 {
     $username_alreadyExist = self::getUserIdByLogin($username) !== null;
     # TODO: Check user password here to display message for end user
     if (!$username_alreadyExist && $password == $confirm_password) {
         $db = DbUtil::accessFactory();
         $anonymousId = self::getUserIdByLogin($anonymous_username);
         if ($anonymousId !== null) {
             $password = md5($password);
             if ($db->execute("UPDATE `portal`.`users` SET `username` = '{$username}', `is_anonymous` = 0, `password` = '{$password}' WHERE `users`.`id` = {$anonymousId};")) {
                 if (Auth::isAuth()) {
                     $_SESSION['username'] = $username;
                     //$_SESSION['userid'] = self::getUserIdByLogin($username); # Remove this Is the same...
                 }
                 return true;
             } else {
                 throw new DBException(MwwException::MODEL, 'Unable to create (Transform)  user');
             }
         }
     }
     return false;
 }
开发者ID:ripplecrpht,项目名称:ripplecrpht,代码行数:22,代码来源:UsersManagement.class.php


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