Esempio n. 1
0
 public function getViewed($model)
 {
     $nameClass = strtolower(get_class($model));
     $nameCookie = md5($nameClass . "_viewed");
     $cookies = unserialize(Cookie::get($nameCookie));
     return $cookies;
 }
Esempio n. 2
0
 public function __construct()
 {
     if (Cookie::has('cart')) {
         $this->storage = Cookie::get('cart');
         return;
     }
     $this->storage = [];
 }
Esempio n. 3
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     if (Cookie::get('mango_current_site') != false && Cookie::get('mango_current_site') != null) {
         Session::put('site', Cookie::get('mango_current_site'));
     } else {
         Session::put('site', 1);
     }
 }
Esempio n. 4
0
 public function match($store)
 {
     $cookie = Cookie::get('store');
     if ($cookie && ($store_id = Crypt::decrypt($cookie))) {
         return $store->find($store_id);
     }
     return false;
 }
Esempio n. 5
0
 public function getCookie($name)
 {
     if (!array_key_exists($name, $this->systemCookies)) {
         return Cookie::get($name);
     } else {
         return null;
     }
 }
 /**
  * Bootstrap any application services.
  *
  * return void
  * @param Request $request
  */
 public function boot(Request $request)
 {
     view()->composer('*', function ($view) use($request) {
         $in_app_default = $request->input('in_app') !== null;
         $in_app = Cookie::get('in_app', $in_app_default);
         $view->with('in_app', $in_app);
         $view->with('site', config('site'));
     });
 }
 public static function addUserDevice()
 {
     if (Cookie::has('d_i')) {
         self::create(['user_id' => Auth::user()->id, 'uid' => Cookie::get('d_i'), 'browser' => Agent::browser(), 'platform' => Agent::platform(), 'device' => Agent::device()]);
         return true;
     } else {
         return false;
     }
 }
 public function edit()
 {
     $value = Cookie::get('uid');
     if ($value != '') {
         return Redirect::guest('page/1');
     } else {
         return Redirect::guest('/login');
     }
 }
Esempio n. 9
0
 /**
  * Get the value of the given cookie
  *
  * @static
  * @param  string  $key
  * @param  mixed   $default
  * @return mixed
  */
 public static function get($key = NULL, $default = NULL)
 {
     // First, we get the raw cookie data
     $raw = parent::get($key, $default);
     // Then we attempt to unserialize it
     $unserialized = @unserialize($raw);
     // If unserialization succeeded, we return the unserialized data
     // otherwise, we return the original raw data
     return $unserialized !== FALSE ? $unserialized : $raw;
 }
Esempio n. 10
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $cookieLang = Cookie::get('i18next');
     if ($cookieLang) {
         App::setLocale($cookieLang);
     } elseif ($request->header('Accept-Language')) {
         App::setLocale($request->header('Accept-Language'));
     }
     return $next($request);
 }
Esempio n. 11
0
 public function getPeople()
 {
     $uid = Cookie::get('uid');
     if (empty($uid)) {
         return Redirect::to('/login');
     }
     $pages = DB::table('webpage')->where('uid', $uid)->get();
     if (empty($pages)) {
         $pages = array();
     }
     return view('people')->with('pages', $pages);
 }
Esempio n. 12
0
 /**
  * Responds to requests to GET /users
  */
 public function getIndex(CookieJar $cookiejar, Request $request)
 {
     //return Auth::user()->email;
     event(new DevCheckedIn(Auth::user()));
     $response = new Response(view('signup')->with(['data' => Auth::user()]));
     if (Cookie::get('success') !== false) {
         $response->withCookie(Cookie::forget('success'));
         return $response;
     }
     return $response;
     //        return view("users");
 }
Esempio n. 13
0
 protected function getExperimentVariant($experiment)
 {
     $generatedVariant = array_get(static::$generatedVariants, $experiment, null);
     if ($generatedVariant !== null) {
         return $generatedVariant;
     }
     $cookieVariant = Cookie::get($this->getCookieName($experiment));
     if ($cookieVariant !== null) {
         return $cookieVariant;
     }
     return $this->generateExperimentVariant($experiment);
 }
 /**
  * if a user is deactivated by admin
  * can not access any route that is under auth middleware
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Cookie::get('blocked') && Cookie::get('blocked') === Crypt::decrypt(Cookie::get('blocked'))) {
         return redirect('home')->with(['error' => 'messages.error.not_active']);
     }
     $user = Auth::user();
     if ($user->active === '1') {
         return $next($request);
     }
     Auth::logout();
     return redirect('home')->with(['error' => 'messages.error.not_active'])->withCookie(Cookie::make('blocked', Crypt::encrypt('blocked'), '12000'));
 }
Esempio n. 15
0
 /**
  * @param $callMode
  * @return mixed|string
  * @throws CookieExpiredException
  * @throws CookieInvalidException
  */
 public function tryParseCookie($callMode)
 {
     $parsedCookie = Cookie::get($this->info[CookieManager::COOKIE_NAME]);
     if (isset($parsedCookie)) {
         $parsedCookie = json_decode($parsedCookie, true);
         $this->validateCookie($parsedCookie);
     } else {
         if ($callMode !== ProxyAux::MODE_LOGIN) {
             throw new CookieExpiredException();
         }
     }
     return $parsedCookie;
 }
 public function index()
 {
     $indicadorCDI = new IndicadorBusiness(IndicadorBusiness::$CDI);
     $cdi = $indicadorCDI->getUltimoIndiceXML()->getValue();
     $indicadorPoupanca = new IndicadorBusiness(IndicadorBusiness::$POUPANCA);
     $poupanca = $indicadorPoupanca->getUltimoIndiceXML()->getValue();
     $indicadorSELIC = new IndicadorBusiness(IndicadorBusiness::$SELIC);
     $selic = $indicadorSELIC->getUltimoIndiceXML()->getValue();
     $amount = Cookie::get(PreferencesVO::PREFERENCES_AMOUNT, PreferencesVO::DEFAULT_AMOUNT);
     $period = Cookie::get(PreferencesVO::PREFERENCES_PERIOD, PreferencesVO::DEFAULT_PERIOD);
     $taxcdb = Cookie::get(PreferencesVO::PREFERENCES_TAXCDB, PreferencesVO::DEFAULT_TAXCDB);
     $taxlci = Cookie::get(PreferencesVO::DEFAULT_TAXLCI, PreferencesVO::DEFAULT_TAXLCI);
     return view('welcome', compact('cdi', 'poupanca', 'selic', 'amount', 'period', 'taxcdb', 'taxlci'));
 }
 public function send(array $data)
 {
     $notificationInfo = ['title' => $data['title'], 'text' => $data['text'], 'url' => $data['url'], 'sound' => true, 'serviceType' => 'Reviewer', 'users' => $data['users']];
     $notificationInfo = json_encode($notificationInfo);
     $cookie = Cookie::get('x-access-token');
     $options = [CURLOPT_COOKIE => 'x-access-token=' . $cookie, CURLOPT_POSTFIELDS => $notificationInfo, CURLOPT_HEADER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => ['Content-type: application/json', 'Content-Length: ' . strlen($notificationInfo)]];
     try {
         $result = $this->dataGrabber->getRaw(url(env('NOTIFICATIONS')), $options);
     } catch (RemoteServerException $e) {
         $info = 'Notification request fails.' . PHP_EOL . $e->getMessage() . 'Curl options: ' . var_export($options, true);
         Log::error($info);
     }
     if (empty($result)) {
         Log::error('Notification request does not receive any response.' . PHP_EOL . 'Curl options: ' . var_export($options, true));
     }
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Cookie::has('dataFromSever')) {
         $dataFromSever = Cookie::get('dataFromSever');
         if ($dataFromSever['data']['role']['partner'] == 1) {
             return $next($request);
         } elseif ($dataFromSever['data']['role']['admin'] == 1) {
             return redirect()->back();
         } else {
             $cookie = Cookie::forget('dataFromSever');
             session_start();
             session_destroy();
             return redirect()->route('get.auth.auth.login')->withCookie($cookie)->with('message_error', 'Bạn không có quyền truy cập vào dành cho người quản lý');
         }
     }
     return redirect()->route('get.auth.auth.login')->with('message_error', 'Phiên làm việc của bạn đã bị hết. Vui lòng đăng nhập lại');
 }
 /**
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 protected function confirmAccount()
 {
     $page = "Verifieer E-mail";
     if (Session::has('user') && Cookie::get('user') === null) {
         $user = Session::get('user');
         $cookie = Cookie::forever('user', $user);
         return response()->view('dividers.verification', compact('page', 'user'))->withCookie($cookie);
     }
     if (Cookie::get('user') !== null) {
         $user = Cookie::get('user');
         $userIs = User::where('email', $user->email)->first();
         if ($userIs !== null && $userIs->verified) {
             return Redirect::to('login')->withCookie(Cookie::forget('user'));
         }
         return view('dividers.verification', compact('page', 'user'));
     }
 }
Esempio n. 20
0
 public function send($data)
 {
     $notificationInfo = ['title' => $data['title'], 'text' => $data['text'], 'url' => $data['url'], 'sound' => true, 'serviceType' => 'QA platform', 'users' => $data['users']];
     $notificationInfo = json_encode($notificationInfo);
     $cookie = Cookie::get('x-access-token');
     $ch = curl_init();
     $options = [CURLOPT_URL => url(env('NOTIFICATIONS')), CURLOPT_POSTFIELDS => $notificationInfo, CURLOPT_HEADER => true, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_COOKIE => "x-access-token=" . $cookie, CURLOPT_HTTPHEADER => ['Content-type: application/json', 'Content-Length: ' . strlen($notificationInfo)]];
     curl_setopt_array($ch, $options);
     $result = curl_exec($ch);
     $http_status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     curl_close($ch);
     if (empty($result)) {
         Log::error("Notification request does not receive any responce. \n" . 'Curl options: ' . $options);
     } elseif ($http_status_code != 200) {
         $info = 'Notification ' . $notificationInfo . ' took a responce with code ' . $http_status_code . ".\n Result: " . $result;
         Log::error($info);
     }
 }
Esempio n. 21
0
 public function getGlobalCartOrder($createIfNone = false)
 {
     if (Cookie::has('goprop_order_id') && !isset($this->_currentOrder)) {
         $order = Order::where('id', Cookie::get('goprop_order_id'))->where('status', Order::STATUS_CART)->whereNull('property_id')->first();
         $this->_currentOrder = $order;
     }
     if (empty($this->_currentOrder)) {
         if ($createIfNone) {
             $order = new Order();
             $order->status = Order::STATUS_CART;
             $order->save();
             $this->_currentOrder = $order;
             $cookie = Cookie::make('goprop_order_id', $order->id, 25200);
             Cookie::queue($cookie);
         }
     }
     return $this->_currentOrder;
 }
Esempio n. 22
0
 /**
  *
  **/
 function __construct()
 {
     //	$form = Request::all(); print_pre($form,0,0);
     if (false == self::$enabled) {
         return redirect(URL::to('/'), 302)->send();
     }
     parent::__construct();
     //  Add css and js
     if (false == Request::ajax()) {
         Controller::addCss('Insurance/stylesheet.css');
         Controller::addJsFooter('lib/jquery.validate.js');
         Controller::addJsFooter('Insurance/SearchBox.js');
     }
     //  get search zones from Gulliver
     $availableGeoZones = Gulliver::getInsurancesFilters();
     //  Common search form
     view()->share(['InsuranceSearch' => Cookie::get(self::$config['cookieName']), 'InsuranceZones' => false == empty($availableGeoZones['availableGeoZones']) ? $availableGeoZones['availableGeoZones'] : [], 'InsuranceConfig' => self::$config]);
     unset($availableGeoZones);
 }
 public function create()
 {
     $peminjaman = new PeminjamanPerangkatLunak();
     //Cookie::forget('pl_id');
     $pl_id = Cookie::get('pl_id');
     $bidangs = \App\Bidang::lists('nama_bidang', 'id');
     $seksis = \App\Seksi::lists('nama_seksi', 'id');
     //$seksis = \App\Seksi::lists('nama_seksi','id');
     //if($pl_id != NULL) {
     //$pl_data =
     //print_r($pl_data->id);exit;
     return view('peminjaman_pl.create', ['peminjaman' => $peminjaman, 'pl_data' => $pl_id == NULL ? $pl_id : PerangkatLunak::find($pl_id), 'seksis' => $seksis, 'bidangs' => $bidangs]);
     //}
     //else {
     //    echo 'Cookie kosong';
     //}
     //else {
     //    $this->pilihdulu();
     //}
 }
Esempio n. 24
0
 public static function giriskontrol()
 {
     // TODO: giriş paneli ve anasayfa geçişkenliğine dair özelleştirmeye ihtiyaç duyulmaktadır.
     $SessionValue = Session::get('email');
     $CookieValue = Cookie::get('user');
     if (Session::has('email')) {
         return "<script>window.location.href = 'admin/anasayfa';</script>";
     } else {
         if (Cookie::get('user')) {
             session()->regenerate();
             Session::put('id', $CookieValue["id"]);
             Session::put('email', $CookieValue["email"]);
             Session::put('password', $CookieValue["password"]);
             $gelen = DB::select('select * from admin where id=?', array(Session::get('id')));
             $bilgi = $gelen[0];
             Session::put('adi', $bilgi->adi);
             Session::put('soyadi', $bilgi->soyadi);
             return "<script>window.location.href = 'admin/anasayfa';</script>";
         } else {
         }
     }
 }
 /**
  * @param LoginRequest $request
  * @param $user
  * @param $page
  * @return $this|\Illuminate\Http\RedirectResponse
  */
 private function signIn(LoginRequest $request, $user, $page)
 {
     if ($user !== null) {
         try {
             // verify user
             $user->isVerified();
             // validate
             $user->validate($this->getCredentials($request));
             // sign in user
             Auth::login($user);
             // Flash success message
             alert()->success('Welkom ' . $user->firstname . ' ' . $user->lastname . '!')->autoclose(2500);
             // Log login statistics
             $user->updateLastLogin();
             // Redirect where the user intended to go
             return redirect()->intended('/dashboard');
             if ($user->is('admin')) {
                 return redirect()->intended('/dashboard');
             }
             if ($user->is('user')) {
                 return redirect()->intended('/dashboard');
             }
         } catch (UserNotVerified $e) {
             // check to redirect with dashboard with or without cookie
             if (Cookie::get('user') !== null) {
                 return redirect()->to('register/confirm')->with('user', $user);
             } else {
                 return response()->view('dividers.verification', compact('page', 'user'))->withCookie(Cookie::forever('user', $user));
             }
         } catch (ValidationFailed $e) {
             // flash failure
             alert()->error('Verkeerd wachtwoord of E-mail!')->autoclose(2500);
             // redirect back
             return redirect()->back();
         }
     }
     return redirect()->back()->withErrors($request);
     // Redirect back with errors
 }
Esempio n. 26
0
| and give it the controller to call when that URI is requested.
|
*/
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::group(['middleware' => ['web']], function () {
    Route::get('/test', function () {
        return \Illuminate\Support\Facades\Cookie::get('cookie_test');
    });
    // public routes
    Route::get('sign_up', 'PublicFormsController@getSignUp');
    Route::post('sign_up', 'PublicFormsController@postSignUp');
    // client routes
    Route::get('client/dashboard', 'ClientController@index');
    Route::get('client/edit_user', 'ClientController@getEditUser');
    Route::post('client/edit_user', 'ClientController@postEditUser');
    // Authentication routes...
    Route::get('auth/login', 'Auth\\AuthController@getLogin');
    Route::post('auth/login', 'Auth\\AuthController@postLogin');
    Route::get('auth/logout', 'Auth\\AuthController@getLogout');
    // Registration routes...
    Route::get('auth/register', 'Auth\\AuthController@getRegister');
    Route::post('auth/register', 'Auth\\AuthController@postRegister');
 /**
  * Constructor.
  */
 public function __construct()
 {
     $this->data = Cookie::get($this->cookieName, []);
 }
 /**
  * Update the donner dashboard
  * fetch new requests from db
  * responds to post request on /update-donner-dashboard route
  */
 public function updateDashboard(Request $request)
 {
     $count = 0;
     $mainCount = 0;
     //first check if the cookie is set or not
     //this code will run when the count cookie is set
     if (Cookie::get('count')) {
         //fetch only difference records(new records)
         $count = Problem::count();
         //check if new rows have been added to the table then send the new reply
         //else no need to send data
         if (Cookie::get('count') != $count) {
             //if user entered a new form
             if ($count > Cookie::get('count')) {
                 $mainCount = $count - Cookie::get('count');
                 $problems = Problem::orderBy('id', 'desc')->take($mainCount)->get();
                 $response = new Response($problems);
                 $response->withCookie(cookie()->forever('count', $count));
                 return $response;
             }
             if ($count < Cookie::get('count')) {
                 $response = new Response("No New Problems");
                 return $response;
             }
             //$mainCount = max($count , Cookie::get('count')) - min($count , Cookie::get('count'));
             //setcookie("mainCount", $mainCount);
             //setcookie("1", "cookie was set but counts were not equal");
         } else {
             $response = new Response("No New Problems");
             return $response;
         }
     } else {
         //fetch all records
         //this code will run first time when count cookie is not set
         $problems = Problem::orderBy('id', 'desc')->get();
         $count = $problems->count();
         //this cookie will expire in next 5 years
         $response = new Response($problems);
         $response->withCookie(cookie()->forever('count', $count));
         return $response;
     }
 }
Esempio n. 29
0
 public function getAccessToken()
 {
     if (is_null($this->accessToken)) {
         $this->accessToken = Cookie::get('ebriat');
     }
     if (is_null($this->refreshToken)) {
         $this->refreshToken = Cookie::get('ebrirt');
     }
     if (is_null($this->accessToken) and is_null($this->refreshToken)) {
         $this->requestAccessToken();
     }
     if (!is_null($this->refreshToken)) {
         $this->requestRefreshToken();
     }
     return $this->accessToken;
 }
Esempio n. 30
0
 protected function verified()
 {
     // Valid Code || Submitted Proof?
     $payload = Cookie::get('twilio::phone');
     // Valid Request
     if ($payload['code'] == Input::get('code') || $payload['valid'] === true) {
         // Validate.
         $payload['valid'] = true;
         // Update Model
         $this->phone = $payload;
         // Fire "Phone Added" Event
         \Event::fire('user.phoneVerified', $payload);
         // Respond w/ Object for a 5 Minute TTL
         return $this->respond($payload, 200)->withCookie(Cookie::make('twilio::phone', $payload, 5));
     } else {
         return false;
     }
 }