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> ";
 }
Esempio n. 2
0
	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...)
		}
	}
Esempio n. 3
0
	/**
	 * 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 = "******"main/vDefault", array("notifs" => $notifs, "message" => $message));
		}else{
			$this->loadView("main/vLogin");
		}
		$this->loadView("main/vFooter");
	}
Esempio n. 4
0
 protected function setValuesToObject(&$object)
 {
     parent::setValuesToObject($object);
     $object->setUser(Auth::getUser());
     $categorie = DAO::getOne("Categorie", $_POST["idCategorie"]);
     $object->setCategorie($categorie);
 }
Esempio n. 5
0
 /**
  * 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;
 }
Esempio n. 6
0
 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/");
     }
 }
Esempio n. 7
0
 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);
     }
 }
Esempio n. 8
0
 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);
 }
Esempio n. 9
0
 /**
  * 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);
 }
Esempio n. 10
0
 public static function setAbonement()
 {
     $model = UsersModel::model()->where("`id`='" . Auth::getUser()['id'] . "'")->findRow();
     $model->abonement = 1;
     $model->update();
     Auth::setFields($model);
 }
 private function getTokenAndUpdateLoginTime()
 {
     $user = Auth::getUser();
     $user->updateLastLoginTime();
     $user->fb_token = $this->facebookService->getAccessToken();
     $user->save();
 }
 private function accessRestriction()
 {
     if ($this->access_restriction && !Auth::getUser()) {
         Tools::redirect($this->context->link->getPageLink('auth'));
     }
     $this->smarty->assign('user', Auth::getUser());
 }
Esempio n. 13
0
 /**
  * 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();
         }
     });
 }
Esempio n. 14
0
 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;
     }
 }
Esempio n. 15
0
 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'));
 }
Esempio n. 16
0
 public static function getUser()
 {
     if (is_null(Session::get('auth_field')) || Session::get('auth_field') !== Config::get('auth.model')) {
         return null;
     } else {
         return parent::getUser();
     }
 }
Esempio n. 17
0
 /**
  * Loads users tickets
  */
 public function onRun()
 {
     $creator = \Auth::getUser();
     $url = Settings::get('address');
     $tickets = Ticket::where('creator_id', $creator->id)->get();
     $this->page['ticket_page'] = $url;
     $this->page['tickets'] = $tickets;
 }
Esempio n. 18
0
 public function __construct()
 {
     $this->user_id = Auth::getUser()->id;
     $role_obj = new RoleUser();
     $this->role_id = $role_obj->getRoleById($this->user_id);
     $role_policy_ojb = new RolePolicy();
     $this->policy_id = $role_policy_ojb->getPolicyByRoleId($this->role_id->role_id);
 }
Esempio n. 19
0
 /**
  * [numTrainCourse description]
  * @return [type] [description]
  */
 public static function numTrainCourse()
 {
     $userid = Auth::getUser()->id;
     $roleid = RoleUser::where('user_id', $userid)->get(array('role_id'));
     $numCourse = Training::where('target', 'LIKE', '%' . $roleid[0]->role_id . '%')->where('status', '!=', false)->count();
     // echo $numCourse;exit;
     return $numCourse;
 }
 public function getIndex()
 {
     if (!ACL::hasPermission('profile', 'edit')) {
         return redirect(route('profile'))->withErrors(['Você não tem permissão para editar seus dados.']);
     }
     $user = User::where('id', '=', \Auth::getUser()->id)->first();
     return view('admin.profile.index')->with(compact('user'));
 }
Esempio n. 21
0
 public static function logincount()
 {
     if (Auth::getUser()['id']) {
         $user = UsersModel::model()->where("`id`='" . Auth::getUser()['id'] . "'")->findRow();
         $user->login_count = $user->login_count + 1;
         $user->update();
     }
 }
Esempio n. 22
0
 function currentUserId()
 {
     $user = Auth::getUser();
     if (!is_null($user)) {
         return $user->id;
     }
     return null;
 }
 public function getIndex()
 {
     if (!ACL::hasPermission('profile', 'edit')) {
         return redirect(route('profile'))->withErrors(['You don\'t have permission for edit your data.']);
     }
     $user = User::where('id', '=', \Auth::getUser()->id)->first();
     return view('admin.profile.index')->with(compact('user'));
 }
 /**
  * @return $this|\Illuminate\Support\Facades\View
  */
 public function index()
 {
     $data = \Auth::getUser();
     if ($data) {
         return $this->view('forone::' . $this->uri . "/edit", compact('data'));
     } else {
         return $this->redirectWithError('数据未找到');
     }
 }
Esempio n. 25
0
 /**
  * Gets a login ticket for an available push server.
  * @return type
  */
 public static function getTicket()
 {
     if (Auth::getUser()->isGuest()) {
         return null;
     }
     $pushServer = self::getPushServer(Auth::getUser());
     $ticket = $pushServer->getTicket(Auth::getUser());
     return array('host' => $pushServer->host, 'socket_port' => $pushServer->socket_port, 'http_host' => $pushServer->getHostUrl(), 'ticket' => $ticket);
 }
Esempio n. 26
0
 /**
  * Loads ticket selected with page slug
  */
 public function onRun()
 {
     $hash = $this->property('slug');
     $creator = \Auth::getUser();
     $ticket = Ticket::where('hash_id', $hash)->where('creator_id', $creator->id)->first();
     $ticketFiles = TicketAttachment::where('ticket_id', $ticket->id)->get();
     $this->page['ticket'] = $ticket;
     $this->page['ticket_files'] = $ticketFiles;
 }
Esempio n. 27
0
 public function actionCode($seoUrl)
 {
     $userId = Auth::getUser()['id'];
     //echo $seoUrl;
     $packets = PaymentModel::model()->findAll();
     $discount = ReferalsModel::model()->where(" code = '" . $seoUrl . "'")->findRow();
     $currencies = CurrencyModel::model()->findRow();
     $this->view("Code", array("discount" => $discount->discount, "packets" => $packets, "code" => $seoUrl, "currency" => $currencies), false);
 }
Esempio n. 28
0
	public function frm($id=NULL){
		if(Auth::isAdmin() || ($id == Auth::getUser()->getId())){
			$user=$this->getInstance($id);
			$groups = DAO::getAll("Groupe");
			$listGrp=Gui::select($groups,$user->getGroupe()->getId(),"Sélectionner un Groupe ...");
			$this->loadView("user/vAdd",array("user"=>$user, "groups"=>$listGrp));
		}else{
			$this->forward("users");
		}
	}
Esempio n. 29
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $unfinished_matches = DB::table('matches')->select('matches.id', 'team_a', 'team_b', 'matches.a_odds', 'matches.b_odds', 'matches.winner', 'matches.event', 'matches.format', 'result_category', 'time', 't1.logo as logo_a', 't2.logo as logo_b', 'odds_tracker')->where('winner', '<>', 'c')->where('closed', '0')->join('teams as t1', 'matches.team_a_id', '=', 't1.id')->join('teams as t2', 'matches.team_b_id', '=', 't2.id')->orderBy('time')->get();
     $finished_matches = DB::table('matches')->select('matches.id', 'team_a', 'team_b', 'matches.a_odds', 'matches.b_odds', 'matches.winner', 'matches.event', 'matches.format', 'result_category', 'time', 't1.logo as logo_a', 't2.logo as logo_b', 'odds_tracker')->where('winner', '<>', 'c')->where('closed', '1')->join('teams as t1', 'matches.team_a_id', '=', 't1.id')->join('teams as t2', 'matches.team_b_id', '=', 't2.id')->orderBy('time', 'desc')->limit(20)->get();
     $sheetInfo = null;
     $matches = array_merge($unfinished_matches, $finished_matches);
     if (\Auth::check()) {
         $sheetInfo = \Auth::getUser()->getPrimarySheet();
     }
     return ['sheet' => $sheetInfo, 'matches' => $matches];
 }
Esempio n. 30
0
	public function index(){
		$alert = DAO::getOne("Alert", "idUser = "******"Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche");
		
		$this->loadView("alert/vEdit", array('alert' => $alert, "days" => $days));

	}