/**
  * @param Organization   $organization
  * @param User           $user
  * @param SessionManager $sessionManager
  */
 function __construct(Organization $organization, User $user, SessionManager $sessionManager)
 {
     $this->organization = $organization;
     $this->user = $user;
     $this->sessionManager = $sessionManager;
     $this->orgId = $this->sessionManager->get('org_id');
 }
Example #2
0
 /**
  * Render the notifications' script tag
  *
  * @return string
  * @internal param bool $flashed Whether to get the
  *
  */
 public function render()
 {
     $notifications = $this->session->get('toastr::notifications');
     if (!$notifications) {
         $notifications = [];
     }
     $output = '<script type="text/javascript">';
     $lastConfig = [];
     foreach ($notifications as $notification) {
         $config = $this->config->get('toastr.options');
         if (count($notification['options']) > 0) {
             // Merge user supplied options with default options
             $config = array_merge($config, $notification['options']);
         }
         // Config persists between toasts
         if ($config != $lastConfig) {
             $output .= 'toastr.options = ' . json_encode($config) . ';';
             $lastConfig = $config;
         }
         // Toastr output
         $output .= 'toastr.' . $notification['type'] . "('" . str_replace("'", "\\'", str_replace(['&lt;', '&gt;'], ['<', '>'], e($notification['message']))) . "'" . (isset($notification['title']) ? ", '" . str_replace("'", "\\'", htmlentities($notification['title'])) . "'" : null) . ');';
     }
     $output .= '</script>';
     return $output;
 }
 public function preSet(FormEvent $event)
 {
     $form = $event->getForm();
     $rootName = $form->getRoot()->getName();
     if (!$form->isRoot() && ($parent = $form->getParent())) {
         $name = $this->getDottedName($form);
         $fullName = $this->getFullName($rootName, $name);
         // Add input from the previous submit
         if ($form->getName() !== '_token' && $this->session->hasOldInput($fullName)) {
             // Get old value
             $value = $this->session->getOldInput($fullName);
             // Transform back to good data
             $value = $this->transformValue($event, $value);
             // Store on the form
             $event->setData($value);
         }
         if ($this->session->has('errors')) {
             /** @var \Illuminate\Support\ViewErrorBag $errors */
             $errors = $this->session->get('errors');
             if ($errors->has($name)) {
                 $form->addError(new FormError(implode(' ', $errors->get($name))));
             }
         }
     }
 }
 public function __construct()
 {
     $this->sessionManager = app(SessionManager::class);
     if ($this->sessionManager->has('flash_messages')) {
         $this->messages = $this->sessionManager->get('flash_messages');
     }
 }
Example #5
0
 /**
  * {@inheritDoc}
  */
 public function retrieveAccessToken($service)
 {
     $name = $this->storageName($service);
     if ($token = $this->session->get($name)) {
         return unserialize($token);
     }
     throw new TokenNotFoundException('Token not found in session, are you sure you stored it?');
 }
Example #6
0
 public function getValueForSection($section, $key = null, $default = null)
 {
     $values = $this->sessionManager->get($section);
     if (!$key) {
         return $values;
     }
     return isset($values[$key]) ? $values[$key] : $default;
 }
Example #7
0
 /**
  * Check if string matches captcha
  * @param $string
  * @param $formId
  * @return bool
  */
 public function check($string, $formId = null)
 {
     if (empty($formId)) {
         //$formId = $this->fromCurrentUrl();
         $formId = $this->fromAppKey();
     }
     $hash = $this->session->get("{$this->storeKey}.{$formId}");
     return $this->hash($this->config->get('captcha.case_sensitive') ? $string : strtolower($string)) == $hash;
 }
 /**
  * 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');
     });
 }
Example #9
0
 /**
  * Get session.
  *
  * @param string|null $key
  * @param mixed       $default
  *
  * @return \Illuminate\Session\SessionManager|mixed
  */
 public function session($key = null, $default = null)
 {
     if (!isset($this->session)) {
         $this->session = app('session');
     }
     if (is_null($key)) {
         return $this->session;
     }
     return $this->session->get($key, $default);
 }
 /**
  * @param Activity              $activity
  * @param IatiIdentifierManager $iatiIdentifierManager
  * @param Identifier            $identifier
  * @param OrganizationManager   $organizationManager
  * @param SessionManager        $sessionManager
  * @param ActivityManager       $activityManager
  */
 function __construct(Activity $activity, IatiIdentifierManager $iatiIdentifierManager, Identifier $identifier, OrganizationManager $organizationManager, SessionManager $sessionManager, ActivityManager $activityManager)
 {
     $this->middleware('auth');
     $this->activity = $activity;
     $this->iatiIdentifierManager = $iatiIdentifierManager;
     $this->identifier = $identifier;
     $this->organizationManager = $organizationManager;
     $this->sessionManager = $sessionManager;
     $this->organization_id = $this->sessionManager->get('org_id');
     $this->activityManager = $activityManager;
 }
 /**
  * @param OrganizationManager   $organizationManager
  * @param SessionManager        $sessionManager
  * @param ActivityManager       $activityManager
  * @param UploadActivityManager $uploadActivityManager
  * @param UploadActivity        $uploadActivity
  * @param SettingsManager       $settingsManager
  */
 function __construct(OrganizationManager $organizationManager, SessionManager $sessionManager, ActivityManager $activityManager, UploadActivityManager $uploadActivityManager, UploadActivity $uploadActivity, SettingsManager $settingsManager)
 {
     $this->middleware('auth');
     $this->activityManager = $activityManager;
     $this->uploadActivity = $uploadActivity;
     $this->uploadActivityManager = $uploadActivityManager;
     $this->sessionManager = $sessionManager;
     $this->organizationId = $this->sessionManager->get('org_id');
     $this->organizationManager = $organizationManager;
     $this->settingsManager = $settingsManager;
 }
Example #12
0
 /**
  * Sets the location property to the drivers returned location object.
  *
  * @param string $ip
  */
 private function setLocation($ip = '')
 {
     // The location session key.
     $key = 'location';
     // Removes location from the session if config option is set
     if ($this->localHostForgetLocation()) {
         $this->session->forget($key);
     }
     // Check if the location has already been set in the current session
     if ($this->session->has($key)) {
         // Set the current driver to the current session location
         $this->location = $this->session->get($key);
     } else {
         $this->setIp($ip);
         $this->location = $this->driver->get($this->ip);
         // The locations object property 'error' will be true if an
         // exception has occurred trying to grab the location
         // from the driver. Let's try retrieving the
         // location from one of our fall-backs
         if ($this->location->error) {
             $this->location = $this->getLocationFromFallback();
         }
         $this->session->set($key, $this->location);
     }
 }
Example #13
0
 function getuserfolder()
 {
     $session = new Session('demo');
     if ($session->has('userfolder')) {
         $value = $session->get('userfolder');
     }
     return $value;
 }
Example #14
0
 public function __construct(SessionManager $session, $messages = array())
 {
     $this->session = $session;
     if ($session->has($this->session_key)) {
         $messages = array_merge_recursive($session->get($this->session_key), $messages);
     }
     parent::__construct($messages);
 }
 /**
  * {@inheritdoc}
  *
  * @see BaseFacebook::getPersistentData()
  */
 protected function getPersistentData($key, $default = false)
 {
     if (!in_array($key, self::$kSupportedKeys)) {
         self::errorLog('Unsupported key passed to getPersistentData.');
         return $default;
     }
     $session_var_name = $this->constructSessionVariableName($key);
     return $this->laravelSession->get($session_var_name, $default);
 }
 /**
  * The GET method that runs when a user needs to download a file
  *
  * @return JSON
  */
 public function fileDownload()
 {
     if ($response = $this->session->get('administrator_download_response')) {
         $this->session->forget('administrator_download_response');
         $filename = substr($response['headers']['content-disposition'][0], 22, -1);
         return response()->download($response['file'], $filename, $response['headers']);
     } else {
         return redirect()->back();
     }
 }
Example #17
0
 public function message()
 {
     $messages = $this->session->get('toastr::messages');
     if (!$messages) {
         $messages = [];
     }
     $script = '<script type="text/javascript">';
     foreach ($messages as $message) {
         $config = (array) $this->config->get('toastr.options');
         if (count($message['options'])) {
             $config = array_merge($config, $message['options']);
         }
         if ($config) {
             $script .= 'toastr.options = ' . json_encode($config) . ';';
         }
         $title = $message['title'] ?: null;
         $script .= 'toastr.' . $message['type'] . '(\'' . $message['message'] . "','{$title}" . '\');';
     }
     $script .= '</script>';
     return $script;
 }
Example #18
0
 public function render()
 {
     $notifications = $this->session->get('toastr:notifications');
     if (!$notifications) {
         return '';
     }
     foreach ($notifications as $notification) {
         $config = $this->config->get('toastr.options');
         $javascript = '';
         $options = [];
         if ($config) {
             $options = array_merge($config, $notification['options']);
         }
         if ($options) {
             $javascript = 'toastr.options = ' . json_encode($options) . ';';
         }
         $message = str_replace("'", "\\'", $notification['message']);
         $title = $notification['title'] ? str_replace("'", "\\'", $notification['title']) : null;
         $javascript .= " toastr.{$notification['type']}('{$message}','{$title}');";
     }
     return view('Toastr::toastr', compact('javascript'));
 }
Example #19
0
 /**
  * Get all alert from session flash
  * @return void
  */
 public function getExisting()
 {
     // Create message bag
     if (!$this->bag) {
         $this->bag = new MessageBag();
     }
     // Get messges from flash
     $flash = $this->session->get(self::SESSION_KEY);
     // Add Laravel errors
     if ($errors = $this->session->get('errors')) {
         foreach ($errors->all() as $error) {
             $this->bag->add('error', $error);
         }
     }
     if ($flash) {
         foreach ($flash as $type => $alerts) {
             if (is_array($alerts) and count($alerts)) {
                 foreach ($alerts as $alert) {
                     $this->bag->add($type, $alert);
                 }
             }
         }
     }
     foreach (array('success', 'error', 'warning') as $key) {
         if ($message = $this->session->get($key)) {
             // Get type
             $type = $key;
             if (!$type) {
                 $type = 'info';
             }
             // Add the message
             $this->bag->add($type, $message);
             // And remove from flash
             $this->session->forget($key);
         }
     }
 }
Example #20
0
 /**
  * Updates the specified item in storage.
  *
  * @param string $model Model to use.
  * @param int $id Item ID.
  * @return \Illuminate\Http\Response
  */
 public function update($model, $id)
 {
     $this->setModel($model);
     $this->checkAction('edit');
     $item = $this->staticModelFind($id);
     if (!$item) {
         abort(404);
     }
     $form = $this->staticModelGetForm();
     if (!$form->isValid()) {
         $this->session->reflash();
         return back()->withErrors($form->getErrors())->withInput()->with('msg', trans('lavanda::common.error_update'))->with('msg-type', 'danger');
     }
     $item->saveWithRelations($this->request->all());
     $redirectUrl = $this->session->get('back_url') ? $this->session->get('back_url') : $this->getRoute('index');
     return redirect()->to($redirectUrl)->with('msg', trans('lavanda::common.success_update'));
 }
 /**
  * @param SettingsManager              $settingsManager
  * @param SessionManager               $sessionManager
  * @param OrganizationManager          $organizationManager
  * @param Identifier                   $identifierForm
  * @param ActivityManager              $activityManager
  * @param ResultManager                $resultManager
  * @param TransactionManager           $transactionManager
  * @param DocumentLinkManager          $documentLinkManager
  * @param ChangeActivityDefault        $changeActivityDefaultForm
  * @param ChangeActivityDefaultManager $changeActivityDefaultManager
  * @param User                         $user
  * @param Settings                     $settings
  * @param LoggerInterface              $loggerInterface
  * @param TwitterAPI                   $twitterAPI
  */
 function __construct(SettingsManager $settingsManager, SessionManager $sessionManager, OrganizationManager $organizationManager, Identifier $identifierForm, ActivityManager $activityManager, ResultManager $resultManager, TransactionManager $transactionManager, DocumentLinkManager $documentLinkManager, ChangeActivityDefault $changeActivityDefaultForm, ChangeActivityDefaultManager $changeActivityDefaultManager, User $user, Settings $settings, LoggerInterface $loggerInterface, TwitterAPI $twitterAPI)
 {
     $this->middleware('auth');
     $this->settingsManager = $settingsManager;
     $this->sessionManager = $sessionManager;
     $this->organizationManager = $organizationManager;
     $this->identifierForm = $identifierForm;
     $this->activityManager = $activityManager;
     $this->organization_id = $this->sessionManager->get('org_id');
     $this->resultManager = $resultManager;
     $this->transactionManager = $transactionManager;
     $this->changeActivityDefaultForm = $changeActivityDefaultForm;
     $this->changeActivityDefaultManager = $changeActivityDefaultManager;
     $this->settings = $settings;
     $this->user = $user;
     $this->loggerInterface = $loggerInterface;
     $this->twitter = $twitterAPI;
     $this->documentLinkManager = $documentLinkManager;
 }
Example #22
0
 /**
  * Sets the location property to the drivers returned location object.
  *
  * @param string $ip
  */
 private function setLocation($ip = '')
 {
     /*
      * Removes location from the session if config option is set
      */
     if ($this->localHostForgetLocation()) {
         $this->session->forget('location');
     }
     /*
      * Check if the location has already been set in the current session
      */
     if ($this->session->has('location')) {
         /*
          * Set the current driver to the current session location
          */
         $this->location = $this->session->get('location');
     } else {
         /*
          * Set the IP
          */
         $this->setIp($ip);
         /*
          * Set the location
          */
         $this->location = $this->driver->get($this->ip);
         /*
          * The locations object property 'error' will be true if an exception has
          * occurred trying to grab the location from the driver. Let's
          * try retrieving the location from one of our fall-backs
          */
         if ($this->location->error) {
             $this->location = $this->getLocationFromFallback();
         }
         $this->session->set('location', $this->location);
     }
 }
Example #23
0
 /**
  * Get the carts content, if there is no cart content set yet, return a new empty Collection
  *
  * @return \Illuminate\Support\Collection
  */
 protected function getContent()
 {
     $cart = $this->session->get($this->getInstance());
     return $cart instanceof Collection ? $cart : new Collection();
 }
 public function getIndex()
 {
     return $this->View->make('decima-accounting::account-management')->with('newAccountAction', $this->Session->get('newAccountAction', false))->with('editAccountAction', $this->Session->get('editAccountAction', false))->with('deleteAccountAction', $this->Session->get('deleteAccountAction', false))->with('accounts', $this->AccountManagerService->getGroupsAccounts())->with('balanceTypes', $this->AccountManagerService->getBalanceTypes())->with('acountTypes', $this->AccountManagerService->getAccountsTypes());
 }
Example #25
0
 /**
  * Get the carts content.
  *
  * @return \Illuminate\Support\Collection
  */
 protected function getCart()
 {
     $cart = $this->session->get($this->name);
     return $cart instanceof Collection ? $cart : new Collection();
 }
Example #26
0
 /**
  * @author LAHAXE Arnaud
  *
  * @return mixed
  */
 public function check()
 {
     return $this->session->get($this->config->get('u2f.sessionU2fName'), false);
 }
Example #27
0
 /**
  * Get all key-value pairs from storage.
  *
  * @return array
  */
 public function getAll()
 {
     return $this->session->get($this->storageKey);
 }
Example #28
0
 /**
  * 인증 세션 반환
  *
  * @param ItemEntity $item board item entity
  * @return mixed
  */
 public function get(ItemEntity $item)
 {
     return $this->session->get($this->getKey($item->id));
 }
Example #29
0
 /**
  * Get the notifications from the session
  *
  * @return null|array
  */
 private function getNotifications()
 {
     $notifications = $this->session->get(self::SESSION_KEY);
     return $notifications;
 }
Example #30
0
 /**
  * Sets the time locale
  *
  * @param string $locale
  * @return void
  */
 public function setTimeLocale($locale = null)
 {
     $locale = $locale ?: $this->session->get('_locale', $this->app->getLocale());
     setlocale(LC_TIME, $this->config->get('translatable.full_locales.' . $locale, null));
     Carbon::setLocale($locale);
 }