/**
  * 设置主题
  * @param Request $request
  */
 public function setTheme(Request $request)
 {
     $this->validate($request, ['theme' => 'required']);
     $cookie = Cookie::make('theme', $request->theme, 10 * 12 * 30 * 24 * 60);
     //10年
     return Redirect::back()->withCookie($cookie);
 }
Exemplo n.º 2
0
 /**
  * Create a cookie that lasts "forever" (five years)
  *
  * @static
  * @param  string  $name
  * @param  mixed   $value
  * @param  string  $path
  * @param  string  $domain
  * @param  bool    $secure
  * @param  bool    $httpOnly
  * @return \Symfony\Component\HttpFoundation\Cookie
  */
 public static function forever($name, $value, $path = NULL, $domain = NULL, $secure = FALSE, $httpOnly = TRUE)
 {
     // Serialize the value
     $value = @serialize($value);
     // Create the cookie
     return parent::forever($name, $value, $path, $domain, $secure, $httpOnly);
 }
Exemplo n.º 3
0
 public function getViewed($model)
 {
     $nameClass = strtolower(get_class($model));
     $nameCookie = md5($nameClass . "_viewed");
     $cookies = unserialize(Cookie::get($nameCookie));
     return $cookies;
 }
 public function store()
 {
     $preferences = Request::all();
     $response = new Response('OK');
     $response->withCookie(Cookie::forever(PreferencesVO::PREFERENCES_AMOUNT, $preferences['amount'], PreferencesVO::PREFERENCES_LIFESPAN))->withCookie(Cookie::forever(PreferencesVO::PREFERENCES_PERIOD, $preferences['period'], PreferencesVO::PREFERENCES_LIFESPAN))->withCookie(Cookie::forever(PreferencesVO::PREFERENCES_TAXCDB, $preferences['taxcdb'], PreferencesVO::PREFERENCES_LIFESPAN))->withCookie(Cookie::forever(PreferencesVO::PREFERENCES_TAXLCI, $preferences['taxlci'], PreferencesVO::PREFERENCES_LIFESPAN));
     return $response;
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!Cookie::has('d_i')) {
         Cookie::queue(Cookie::forever('d_i', str_random(60)));
     }
     return $next($request);
 }
Exemplo n.º 6
0
 public function testRememberLogin()
 {
     $person = new Person(['id' => 1, 'remember_token' => 'token']);
     $auth = $this->getMockBuilder(Auth::class)->setConstructorArgs([$this->getMockSession(), $this->getMockPersonRepository(), $this->getMockPermissionsProvider()])->setMethods(['saveRememberLoginToken'])->getMock();
     Cookie::shouldReceive('queue')->once();
     Cookie::shouldReceive('forever')->once()->with($auth->getAutoLoginCookie(), $person->getId() . '-' . $person->getRememberToken());
     $auth->rememberLogin($person);
 }
Exemplo n.º 7
0
 public function __construct()
 {
     if (Cookie::has('cart')) {
         $this->storage = Cookie::get('cart');
         return;
     }
     $this->storage = [];
 }
Exemplo n.º 8
0
 public function match($store)
 {
     $cookie = Cookie::get('store');
     if ($cookie && ($store_id = Crypt::decrypt($cookie))) {
         return $store->find($store_id);
     }
     return false;
 }
Exemplo n.º 9
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);
     }
 }
Exemplo n.º 10
0
 public function getCookie($name)
 {
     if (!array_key_exists($name, $this->systemCookies)) {
         return Cookie::get($name);
     } else {
         return null;
     }
 }
Exemplo n.º 11
0
 public function logout()
 {
     Auth::logout();
     $rememberMeCookie = Auth::getRecallerName();
     // Tell Laravel to forget this cookie
     $cookie = Cookie::forget($rememberMeCookie);
     return Redirect::to('/')->withCookie($cookie);
 }
 /**
  * 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'));
     });
 }
Exemplo n.º 13
0
 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;
     }
 }
Exemplo n.º 14
0
 public function edit()
 {
     $value = Cookie::get('uid');
     if ($value != '') {
         return Redirect::guest('page/1');
     } else {
         return Redirect::guest('/login');
     }
 }
Exemplo n.º 15
0
 private static function newCookie($user)
 {
     $cv = str_random(32);
     $cookie = Cookie::forever('laravel-remember', $cv);
     $uc = new UserCookie();
     $uc->user_id = $user->id;
     $uc->cookie = $cv;
     $uc->save();
     return $cookie;
 }
Exemplo n.º 16
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);
 }
 private function killDeadCookies($request)
 {
     if (!empty($request->cookie())) {
         foreach ($request->cookie() as $key => $cookie) {
             if (strpos($key, 'remember_') !== false) {
                 Cookie::queue($key, null, -9999);
             }
         }
     }
 }
Exemplo n.º 18
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function singUp($code_referrer = '')
 {
     if ($code_referrer == '') {
         $code_referrer = '';
         return view('login.register', compact('code_referrer'));
     } else {
         Cookie::queue('referrer', $code_referrer, 60 * 24);
         return view('login.register', compact('code_referrer'));
     }
 }
 /**
  * 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'));
 }
Exemplo n.º 20
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);
 }
Exemplo n.º 21
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);
 }
Exemplo n.º 22
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");
 }
Exemplo n.º 23
0
 /**
  * Show the application home page to the user.
  *
  * @return Response
  */
 public function index()
 {
     $prodotti = $this->prodotto->with('immagini')->orderby('id', 'asc')->get();
     if ($this->auth->check()) {
         $cookie_test = Cookie::make('cookies_check', '1');
         $carrello = $this->carrello->where('utente', '=', $this->auth->user()->id)->with('prodotti')->get();
         $cartcount = $this->carrello->getCartItemsNumber($this->auth->user()->id);
         return view('index', compact('prodotti', 'carrello', 'cartcount'))->withCookie($cookie_test);
     } else {
         return view('index', compact('prodotti'));
     }
 }
 public function save(Request $request)
 {
     Cookie::queue('pl_id', NULL);
     $peminjaman_pl = new PeminjamanPerangkatLunak();
     $peminjaman_pl->tgl_pinjam = $request->input('tgl_pinjam');
     $peminjaman_pl->tgl_targetkembali = $request->input('tgl_targetkembali');
     $peminjaman_pl->user_id = $request->input('user_id');
     $peminjaman_pl->operator_id = Auth::user()->id;
     $peminjaman_pl->keterangan = $request->input('keterangan');
     $peminjaman_pl->pl_data_id = $request->input('pl_data_id');
     $peminjaman_pl->save();
     return redirect('peminjaman_perangkatlunak/index');
 }
Exemplo n.º 25
0
 function get()
 {
     $url = '/';
     Auth::logout();
     UserCookie::where('cookie', '=', Request::cookie('laravel-remember'))->delete();
     if (Config::get('punto-cms.c2go-login') === true) {
         $url = 'https://sso.communitytogo.com.au/logout';
         if (Config::get('punto-cms.c2go-redirect-logout') !== null) {
             $url = Config::get('punto-cms.c2go-redirect-logout');
         }
     }
     return Redirect::to($url)->withCookie(Cookie::forget('remember'))->withCookie(Cookie::forget('laravel-remember'));
 }
Exemplo n.º 26
0
 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 api()
 {
     $data = $this->reportService->getQuery();
     if (Request::input('export')) {
         Cookie::queue('fileDownload', 'true', 69);
         $className = basename(str_replace('\\', '/', get_class($this)));
         $filename = str_replace('Controller', '', $className) . '-' . date(Config::get('app.dateformat'));
         Excel::create($filename, function ($excel) use($filename, $data) {
             $excel->setTitle($filename)->sheet('Sheet 1', function ($sheet) use($data) {
                 $sheet->fromArray($data['data']);
             });
         })->download(Request::input('export'));
     } else {
         return Response::json($data);
     }
 }
 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));
     }
 }
 /**
  * @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'));
     }
 }
 /**
  * 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');
 }