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


PHP Auth::getUser方法代码示例

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


在下文中一共展示了Auth::getUser方法的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() . "&nbsp;-&nbsp;<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> ";
 }
开发者ID:BackupTheBerlios,项目名称:repair-svn,代码行数:30,代码来源:Header.class.php

示例2: __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...)
		}
	}
开发者ID:BackupTheBerlios,项目名称:repair-svn,代码行数:50,代码来源:Menu.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: setValuesToObject

 protected function setValuesToObject(&$object)
 {
     parent::setValuesToObject($object);
     $object->setUser(Auth::getUser());
     $categorie = DAO::getOne("Categorie", $_POST["idCategorie"]);
     $object->setCategorie($categorie);
 }
开发者ID:nicoBrossault,项目名称:helpdesk,代码行数:7,代码来源:Faqs.php

示例5: handleUpload

 /**
  * Handles uploads to the system.
  * @param int $max The maximum amount of uploads to handle.
  * @return Attachment[]
  * @throws Exceptions
  */
 public static function handleUpload($max = -1)
 {
     // Make sure the user isn't a guest
     if (Auth::getUser()->isGuest()) {
         throw new Exception('Guests cannot upload attachments.');
     }
     // Create the array to return
     $attachments = array();
     if (is_array($_FILES['uploaded_attachments']['tmp_name'])) {
         // If we're handling multiple images in one post
         for ($i = 0; $i < count($_FILES['uploaded_attachments']['tmp_name']); $i++) {
             if ($max > -1 && i >= $max) {
                 break;
             }
             $error = $_FILES['uploaded_attachments']['error'][$i];
             if ($error == UPLOAD_ERR_OK) {
                 $tmp_name = $_FILES['uploaded_attachments']['tmp_name'][$i];
                 $name = $_FILES['uploaded_attachments']['name'];
                 $attachments[] = self::create(Auth::getUser(), $tmp_name, $name);
             }
         }
     } else {
         // Handle only a single upload
         $error = $_FILES['uploaded_attachments']['error'];
         if ($error == UPLOAD_ERR_OK) {
             $tmp_name = $_FILES['uploaded_attachments']['tmp_name'];
             $name = $_FILES['uploaded_attachments']['name'];
             $attachments[] = self::create(Auth::getUser(), $tmp_name, $name);
         }
     }
     // Return the array that was built
     return $attachments;
 }
开发者ID:brandonfrancis,项目名称:scsapi,代码行数:39,代码来源:attachment.php

示例6: actionShowLesson

 public function actionShowLesson()
 {
     $auth = Auth::checkAuth();
     $view = new View();
     $view->auth = $auth;
     if (!isset($_GET['id'])) {
         header("Location: /learns/");
     }
     if ($auth) {
         $user = Auth::getUser();
         $id = $_GET['id'];
         $lesson = Lessons::getLesson($id);
         $course = Courses::getCourse($lesson->course_id);
         $lesson_prew = Lessons::getLessonByNumber($lesson->lesson_number - 1, $lesson->course_id);
         $lesson_next = Lessons::getLessonByNumber($lesson->lesson_number + 1, $lesson->course_id);
         $view->user_login = $user->user_login;
         $view->user_group = $user->user_group;
         $view->lesson = $lesson;
         $view->course = $course;
         $view->lesson_prew = $lesson_prew;
         $view->lesson_next = $lesson_next;
         $view->display('header.php');
         $view->display('lessons/lesson_view.php');
         $view->display('footer.php');
     } else {
         header("Location: /learns/");
     }
 }
开发者ID:AK-VoronM,项目名称:learns,代码行数:28,代码来源:LessonsController.php

示例7: indexAction

 public function indexAction()
 {
     if (Input::get('redirect', $redirect, 'url')) {
         Session::set('redirect', $redirect);
     }
     if ($user = Auth::getUser()) {
         //已经登录
         if (!$redirect) {
             //读取seesion中记录的地址
             $redirect = Session::get('redirect');
             Session::del('redirect');
         }
         if ($redirect) {
             //需要重定向
             $this->redirect($redirect);
             exit;
         } else {
             //显示成功页面
             Yaf_Dispatcher::getInstance()->autoRender(false);
             $this->_view->display('choice.phtml');
         }
     } elseif (Session::get('reg')) {
         //正在注册
         $this->_view->assign('msg', '还差一步,请设置密码')->assign('reg', 1);
     }
 }
开发者ID:derek-chow,项目名称:YunYinService,代码行数:26,代码来源:Api.php

示例8: actionBuy

 public function actionBuy()
 {
     if (!Auth::isLogged()) {
         $this->redirect("/");
     }
     $abonems = AbonemModel::model()->findAll();
     if (isset($_POST['abonem'])) {
         $abonem = AbonemModel::model()->where("`id`=" . (int) $_POST['abonem'])->findRow();
         $userAbon = UserAbonemModel::model()->where("`user_id`='" . Auth::getUser()['id'] . "'")->findRow();
         if (!$userAbon) {
             $userAbon = new UserAbonemModel();
             $userAbon->user_id = Auth::getUser()['id'];
             $userAbon->end_date = date('Y-m-d', strtotime('+' . $abonem->months . ' month', strtotime('today')));
             $userAbon->insert();
         } else {
             if (strtotime($userAbon->end_date) > strtotime('today')) {
                 $userAbon->end_date = date('Y-m-d', strtotime('+' . $abonem->months . ' month', strtotime($userAbon->end_date)));
             } else {
                 $userAbon->end_date = date('Y-m-d', strtotime('+' . $abonem->months . ' month', strtotime('today')));
             }
             $userAbon->update();
         }
         Abonement::setAbonement();
         $this->view("success", array("message" => Lang::get("abonement_success")), false);
     }
     $this->view("abonem/buy", array("abonems" => $abonems), false);
 }
开发者ID:bionicle12,项目名称:testsite,代码行数:27,代码来源:AbonemController.php

示例9: onTicketCreate

 /**
  * Creates new Ticket and redirects to its page
  *
  * @return \Illuminate\Http\RedirectResponse
  * @throws \ValidationException
  */
 public function onTicketCreate()
 {
     $data = post();
     $this->helpers->validateTicket($data);
     $creator = \Auth::getUser();
     $ticketPage = Settings::get('address');
     $newStatus = TicketStatus::where('name', 'New')->first()->id;
     $content = $this->purifyTicket($data['content']);
     $ticket = new Ticket();
     $ticket->hash_id = 'temp';
     $ticket->category_id = $data['category'];
     $ticket->creator_id = $creator->id;
     $ticket->email = $creator->email;
     $ticket->website = $data['website'];
     $ticket->topic = $data['topic'];
     $ticket->content = $content;
     $ticket->status = $newStatus;
     $ticket->save();
     $hashId = $this->helpers->generateHashId($ticket->id);
     $ticket->hash_id = $hashId;
     $ticket->save();
     $this->page['hash_id'] = $hashId;
     $this->helpers->newTicketHandler($hashId);
     $mailer = new SupportMailer();
     $address = Settings::get('address');
     $vars = ['ticket_number' => $ticket->hash_id, 'ticket_link' => $address . '/' . $ticket->hash_id];
     $mailer->sendAfterTicketCreated($creator->email, $vars);
     return \Redirect::to($ticketPage . $hashId);
 }
开发者ID:keiosweb,项目名称:oc-support-plugin,代码行数:35,代码来源:TicketForm.php

示例10: setAbonement

 public static function setAbonement()
 {
     $model = UsersModel::model()->where("`id`='" . Auth::getUser()['id'] . "'")->findRow();
     $model->abonement = 1;
     $model->update();
     Auth::setFields($model);
 }
开发者ID:bionicle12,项目名称:testsite,代码行数:7,代码来源:Abonement.php

示例11: getTokenAndUpdateLoginTime

 private function getTokenAndUpdateLoginTime()
 {
     $user = Auth::getUser();
     $user->updateLastLoginTime();
     $user->fb_token = $this->facebookService->getAccessToken();
     $user->save();
 }
开发者ID:nikammarafiy,项目名称:find-my-friends,代码行数:7,代码来源:LoginController.php

示例12: accessRestriction

 private function accessRestriction()
 {
     if ($this->access_restriction && !Auth::getUser()) {
         Tools::redirect($this->context->link->getPageLink('auth'));
     }
     $this->smarty->assign('user', Auth::getUser());
 }
开发者ID:jessylenne,项目名称:sf2-technical-test,代码行数:7,代码来源:AuthenticatedController.php

示例13: boot

 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     Contact::updating(function (Contact $contact) {
         if ($new_values = $contact->getDirty()) {
             if (isset($new_values['status'])) {
                 $message = \Lang::get('contact.status_update.' . $new_values['status']);
                 if ($contact->hasAttribute('change_status_comment')) {
                     if ($comment = $contact->getAttribute('change_status_comment')) {
                         $message .= PHP_EOL . $comment;
                     }
                     unset($contact->change_status_comment);
                 }
             } else {
                 $values = [];
                 $old_values = $contact->getOriginal();
                 foreach ($new_values as $key => $value) {
                     $values[] = [$key, $old_values[$key], $value];
                 }
                 $message = 'json:' . json_encode($values);
             }
             $log = new ContactLog();
             $log->contact_id = $contact->id;
             $log->user_id = \Auth::getUser()->id;
             $log->comment = $message;
             $log->save();
         }
     });
 }
开发者ID:errogaht,项目名称:bv-table,代码行数:35,代码来源:EventServiceProvider.php

示例14: add

 public static function add($title = '', $search_query = '')
 {
     if (empty($search_query)) {
         return false;
     }
     if (!Auth::check()) {
         return false;
     }
     $user_id = Auth::getUser()->id;
     if ($query = $this->valid_query($search_query)) {
         // Check query exists in DB
         $record = self::where('query', '=', $query)->first();
         if (empty($record)) {
             $record = new self();
             $record->query = $query;
             $record->save();
         }
         // Check current user used query
         $search_id = $record->id;
         $record = SearchUser::whereRaw('user_id = ? AND search_id = ?', array($user_id, $search_id))->first();
         if (empty($record)) {
             $record = new SearchUser();
             $record->title = $title;
             $record->user_id = $user_id;
             $record->search_id = $search_id;
             $record->save();
         }
     } else {
         return false;
     }
 }
开发者ID:httvncoder,项目名称:151722441,代码行数:31,代码来源:Search.php

示例15: getTrackCards

 public function getTrackCards()
 {
     $countQuery = GiftCardQuery::create()->filterByLender(Auth::getUser()->getLender());
     $countCards = $countQuery->count();
     $countRedeemed = $countQuery->filterByClaimed(1)->count();
     $cards = GiftCardQuery::create()->filterByLender(Auth::getUser()->getLender())->orderByDate('desc')->find();
     return View::make('lender.gift-cards-track', compact('countCards', 'countRedeemed', 'cards'));
 }
开发者ID:Junyue,项目名称:zidisha2,代码行数:8,代码来源:GiftCardController.php


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