public function getUser() { if ($this->user == false) { $this->user = $this->session->get("sharp_user"); } return $this->user; }
/** * Handle the event. */ public function handle() { if (!$this->config->get('app.debug') && !$this->session->get(__CLASS__ . 'warned') && $this->request->path() == 'admin/dashboard' && $this->modules->get('anomaly.module.installer')) { $this->session->set(__CLASS__ . 'warned', true); $this->messages->error('streams::message.delete_installer'); } }
/** * @return MessageBag */ private function errors() { if (!isset($this->errors)) { $this->errors = $this->sessionStore->get('errors', new MessageBag([])); } return $this->errors; }
public function getURL($name) { if ($this->sessionManager->has($name = $this->getName($name))) { return $this->sessionManager->get($name); } return false; }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if ($this->session->has($this->sessionKey)) { $this->googleTagManager->set($this->session->get($this->sessionKey)); } $response = $next($request); $this->session->flash($this->sessionKey, $this->googleTagManager->getFlashData()); return $response; }
/** * @param Store $session * @param Collection $collection * @param Repository $config */ function __construct(Store $session, Collection $collection, Repository $config) { // set configurable options $this->session_key = $config->get('augstudios.alerts.session_key', 'alerts'); // initialize properties $this->session = $session; $this->prior = $this->session->get($this->session_key, clone $collection); $this->current = clone $collection; }
/** * @param $message * @param string $level */ public function message($message, $level = 'info') { $notification = new \stdClass(); $notification->message = $message; $notification->level = $level; $notifications = $this->session->get('flash_notifications', []); array_push($notifications, $notification); $this->session->flash('flash_notifications', $notifications); }
/** * Allows you retrieve the most recent social provider * authorized with. * * @return mixed */ public function getRecentAuthData() { $providers = $this->session->get('__sp_auth.p'); if (!$providers) { return null; } return array_first($providers, function ($provider) { return $provider === $this->session->get('__sp_auth.r'); }); }
/** * Processes the date of birth submitted in the age gate form */ public function doAgegate() { $previousTooYoung = $this->session->get('laravel-avp.previous_too_young'); if ($previousTooYoung) { return $this->{$redirector}->action('FWM\\LaravelAVP\\AVPController@agegate'); } // Get the date of birth that the user submitted $dob = $this->handler->processDataOfBirth(); return $this->validation->validate($dob); }
/** * Check if the reCAPTCHA is required * * @return bool Returns true if the captcha is required */ public function isRequired() { if (!$this->config->get('larapress.settings.captcha.active')) { return false; } $timer = $this->config->get('larapress.settings.captcha.timer'); if ($this->helpers->getCurrentTimeDifference($this->session->get('captcha.passed.time', 0), 'm') >= $timer) { return true; } return false; }
/** * Create a new flash notifier instance. * * @param Store $session * @param Application $app */ function __construct(Store $session, Application $app) { $this->session = $session; $this->app = $app; $this->messages = $this->session->pull('__messages', new Collection()); if ($this->session->has('errors')) { $errors = $this->session->get('errors')->getBag('default')->getMessages(); foreach ($errors as $error) { $this->add(['message' => current($error), 'type' => 'info', 'class' => 'warning'], false); } } }
public function __construct(Store $session, Factory $view) { $this->session = $session; $view->share('flash', $this); if ($this->session->has($this->namespace)) { $flashed = $this->session->get($this->namespace); $this->message = $flashed['message']; $this->title = $flashed['title']; $this->type = $flashed['type']; $this->exists = true; } }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $containers = $this->session->get($this->key, []); if (count($containers) > 0) { foreach ($containers as $name => $messages) { /** @var \Krucas\Notification\Message $message */ foreach ($messages as $message) { $this->notification->container($name)->add($message->getType(), $message, false); } } } $this->session->forget($this->key); return $next($request); }
/** * Handle user logged in. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * * @return bool|null */ public function handle(Authenticatable $user) { $social = $this->session->get('authentication.social.oauth'); if (is_null($social)) { return; } $model = User::where('provider', '=', $social['provider'])->where('uid', '=', $social['user']->getId())->first(); if (is_null($model)) { return; } $model->setAttribute('user_id', $user->getAuthIdentifier()); $model->save(); return true; }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $containerNames = $this->session->get($this->sessionPrefix . 'containers', array()); $sessionVariables = $this->session->all(); foreach ($containerNames as $containerName) { foreach ($sessionVariables as $sessionKey => $value) { if (strpos($sessionKey, $this->sessionPrefix . $containerName) === 0 && is_string($value)) { $jsonMessage = json_decode($value); $this->notification->container($containerName)->add($jsonMessage->type, new Message($jsonMessage->type, $jsonMessage->message, false, $jsonMessage->format, $jsonMessage->alias, $jsonMessage->position), false); } } } return $next($request); }
/** * Get all stored notifications of the given type(s) or all notifications in the session if type is not provided. * * @param array\string\null $types * @return array */ protected function getAllStored($types = null) { $all = $this->session->get($this->config->storeKey(), array()); if (is_null($types)) { return $all; } $types = $this->getTypes($types); $stored = array(); foreach ($types as $type) { if (isset($all[$type])) { $stored[$type] = $all[$type]; } } return $stored; }
/** * The constructor * * @param HtmlBuilder $html * @param UrlGenerator $url * @param Session $session */ public function __construct(HtmlBuilder $html, UrlGenerator $url, Session $session) { parent::__construct($html, $url, $session->getToken()); $this->session = $session; $this->requiredFields = []; $this->errorFields = []; if ($this->session->has('formhelper-required-fields')) { $this->requiredFields = $this->session->get('formhelper-required-fields'); $this->session->forget('formhelper-required-fields'); } if ($this->session->has('formhelper-error-fields')) { $this->errorFields = $this->session->get('formhelper-error-fields'); $this->session->forget('formhelper-error-fields'); } }
/** * Get the currently authenticated user. * * @return \Illuminate\Auth\UserInterface|null */ public function user() { if ($this->loggedOut) { return; } // If we have already retrieved the user for the current request we can just // return it back immediately. We do not want to pull the user data every // request into the method becaue that would tremendously slow the app. if (!is_null($this->user)) { return $this->user; } $id = $this->session->get($this->getName()); // First we will try to load the user using the identifier in the session if // one exists. Otherwise we will check for a "remember me" cookie in this // request, and if one exists, attempt to retrieve the user using that. $user = null; if (!is_null($id)) { $user = $this->provider->retrieveByID($id); } // If the user is null, but we decrypt a "recaller" cookie we can attempt to // pull the user data on that cookie which serves as a remember cookie on // the application. Once we have a user we can return it to the caller. $recaller = $this->getRecaller(); if (is_null($user) and !is_null($recaller)) { $user = $this->getUserByRecaller($recaller); } return $this->user = $user; }
/** * Get the ID for the currently authenticated user. * * @return int|null */ public function id() { if ($this->loggedOut) { return; } return $this->session->get($this->getName()) ?: $this->getRecallerId(); }
/** * Handle the event. */ public function handle(Store $session) { /* @var MessageBag $errors */ if ($errors = $session->get($this->builder->getOption('prefix') . 'errors')) { $this->builder->setFormErrors($errors); } }
/** * @param string $service * @return string * @throws \OAuth\Common\Storage\Exception\AuthorizationStateNotFoundException */ public function retrieveAuthorizationState($service) { if ($this->hasAuthorizationState($service)) { return $this->session->get($this->stateVariableName . '.' . $service); } throw new AuthorizationStateNotFoundException('State not found in session, are you sure you stored it?'); }
/** * Get the cart. * * @return Cart */ public function getCart() { if ($this->session->has('cart')) { return $this->session->get('cart'); } return $this->cart; }
/** * Retrieve Message instance from Session, the data should be in * serialize, so we need to unserialize it first. * * @return self */ public function retrieve() { $messages = null; if (!isset($this->instance)) { $this->instance = new static(); $this->instance->setSessionStore($this->session); if ($this->session->has('message')) { $messages = @unserialize($this->session->get('message', '')); } $this->session->forget('message'); if (is_array($messages)) { $this->instance->merge($messages); } } return $this->instance; }
public function __construct($config = [], SessionStore $session) { if (is_array($config['ttwitter::config'])) { $this->tconfig = $config['ttwitter::config']; } else { if (is_array($config['ttwitter'])) { $this->tconfig = $config['ttwitter']; } else { throw new Exception('No config found'); } } $this->debug = isset($this->tconfig['debug']) && $this->tconfig['debug'] ? true : false; $this->parent_config = []; $this->parent_config['consumer_key'] = $this->tconfig['CONSUMER_KEY']; $this->parent_config['consumer_secret'] = $this->tconfig['CONSUMER_SECRET']; $this->parent_config['token'] = $this->tconfig['ACCESS_TOKEN']; $this->parent_config['secret'] = $this->tconfig['ACCESS_TOKEN_SECRET']; if ($session->has('access_token')) { $access_token = $session->get('access_token'); if (is_array($access_token) && isset($access_token['oauth_token']) && isset($access_token['oauth_token_secret']) && !empty($access_token['oauth_token']) && !empty($access_token['oauth_token_secret'])) { $this->parent_config['token'] = $access_token['oauth_token']; $this->parent_config['secret'] = $access_token['oauth_token_secret']; } } $this->parent_config['use_ssl'] = $this->tconfig['USE_SSL']; $this->parent_config['user_agent'] = 'LTTW ' . parent::VERSION; $config = array_merge($this->parent_config, $this->tconfig); parent::__construct($this->parent_config); }
/** * @param $key The name of the input containing the error. * * @return array */ public function getErrors($key) { if (isset($this->session) and !is_null($this->session->get('errors'))) { return $this->session->get('errors')->get($key); } return array(); }
/** * Find location from IP. * * @param string $ip Optional * @return array * @throws \Exception */ private function find($ip = null) { // Check Session if ($ip === null && ($position = $this->session->get('geoip-location'))) { return $position; } // If IP not set, user remote IP if ($ip === null) { $ip = $this->remote_ip; } // Check if the ip is not local or empty if ($this->checkIp($ip)) { // Check the database $record = GeoIPRecord::where('ip', '=', $ip)->first(); if ($record != null) { if (strtotime($record->updated_at) > time() - 30 * 24 * 60 * 60) { // Return cached record return $record; } else { // Record too old... destroy it $record->delete(); } } // Get service name $service = 'locate_' . $this->config->get('geoip.service'); // Check for valid service if (!method_exists($this, $service)) { throw new \Exception("GeoIP Service not supported or setup: " . $service); } return $this->{$service}($ip); } return $this->default_location; }
/** * Prepare and get the alert collection. * * Here we make sure that the alerts collection is in the session * store. If it's not, then we will go ahead an create a new one * * @return Collection */ protected function prepareAndGet() { if (!$this->session->has('chromabits.alerts')) { $this->session->set('chromabits.alerts', new Collection()); } return $this->session->get('chromabits.alerts'); }
/** * @param AccountManager $manager * @param Store $session * @return \Illuminate\Contracts\View\View * @throws \Exception */ public function index(AccountManager $manager, Store $session) { $account = $manager->account(); $contact = $account->contactInformation->first(); $success = $session->get('success'); return $this->theme->render('contact.' . $this->theme->setting('contactLayout'), ['contact' => $contact, 'success' => $success]); }
/** * Retrive parameter from current session * * @param string $key * @return string */ protected function getFromSession($key) { if (!$this->session) { return null; } return $this->session->get($key); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (config('misc.session_timeout_status')) { $isLoggedIn = $request->path() != '/logout'; if (!session('lastActivityTime')) { $this->session->put('lastActivityTime', time()); } elseif (time() - $this->session->get('lastActivityTime') > $this->timeout) { $this->session->forget('lastActivityTime'); $cookie = cookie('intend', $isLoggedIn ? url()->current() : 'admin/dashboard'); $email = $request->user()->email; access()->logout(); return redirect()->route('frontend.auth.login')->withFlashWarning(trans('strings.backend.general.timeout') . $this->timeout / 60 . trans('strings.backend.general.minutes'))->withInput(compact('email'))->withCookie($cookie); } $isLoggedIn ? $this->session->put('lastActivityTime', time()) : $this->session->forget('lastActivityTime'); } return $next($request); }