function Check_User_Cart() { $Identifier = ''; if (!Sentry::check()) { return false; } else { $Identifier = Sentry::user()->id; if (Cookie::has('Anon_Cart_Extension')) { $AnonIdentifier = Cookie::get('Anon_Cart_Extension'); $dataAnon = Cache::get('user_cart.' . $AnonIdentifier); if (Cache::has('user_cart.' . $Identifier)) { $dataUser = Cache::get('user_cart.' . $Identifier); if ($dataAnon != null && $dataUser != null) { foreach ($dataAnon as $key => $value) { if (!isset($dataUser[$key])) { $dataUser[$key] = $value; } } Cache::forever('user_cart.' . $Identifier, $dataUser); Cache::forget('user_cart.' . $AnonIdentifier); } } else { if ($dataAnon != null) { Cache::forever('user_cart.' . $Identifier, $dataAnon); Cache::forget('user_cart.' . $AnonIdentifier); } } } } }
/** * @param none * @throws none * @returns void */ public function before() { $result = array(); // users need to be logged in to access this controller if (!\Sentry::check()) { $result = array('message' => 'You need to be logged in to access that page.', 'url' => '/admin/login'); // Don't show this message if url is just 'admin' if (\Uri::string() == 'admin/admin/index') { unset($result['message']); } \Session::set('redirect_to', \Uri::admin('current')); } else { if (!\Sentry::user()->is_admin()) { $result = array('message' => 'Access denied. You need to be a member of staff to access that page.', 'url' => '/admin/login'); \Session::set('redirect_to', \Uri::admin('current')); } } if (!empty($result)) { if (\Input::is_ajax()) { \Messages::error('You need to be logged in to complete this action.'); echo \Messages::display('left', false); exit; } else { if (isset($result['message'])) { \Messages::warning($result['message']); } \Response::redirect($result['url']); } } parent::before(); }
public function reset($id) { if (Sentry::check()) { return Redirect::route('admin.dashboard'); } return View::make('administrator.reset', ['title' => 'Nueva Contraseña', 'data' => $id]); }
/** * View a blog post. * * @param string $slug * @return Redirect */ public function postView($slug) { // The user needs to be logged in, make that check please if (!Sentry::check()) { return Redirect::to("blog/{$slug}#comments")->with('error', Lang::get('post.messages.login')); } // Get this blog post data $post = $this->post->where('slug', $slug)->first(); // get the data $new = Input::all(); $comment = new Comment(); // If validation fails, we'll exit the operation now if ($comment->validate($new)) { // Save the comment $comment->user_id = Sentry::getUser()->id; $comment->content = e(Input::get('comment')); // Was the comment saved with success? if ($post->comments()->save($comment)) { // Redirect to this blog post page return Redirect::to("blog/{$slug}#comments")->with('success', 'Your comment was successfully added.'); } } else { // failure, get errors return Redirect::to("blog/{$slug}#comments")->withInput()->withErrors($comment->errors()); } // Redirect to this blog post page return Redirect::to("blog/{$slug}#comments")->with('error', Lang::get('post.messages.generic')); }
/** * View a blog post. * * @param string $slug * @return Redirect */ public function postView($slug) { // The user needs to be logged in, make that check please if (!Sentry::check()) { return Redirect::to("blog/{$slug}#comments")->with('error', 'You need to be logged in to post comments!'); } // Get this blog post data $post = Post::where('slug', $slug)->first(); // Declare the rules for the form validation $rules = array('comment' => 'required|min:3'); // Create a new validator instance from our dynamic rules $validator = Validator::make(Input::all(), $rules); // If validation fails, we'll exit the operation now if ($validator->fails()) { // Redirect to this blog post page return Redirect::to("blog/{$slug}#comments")->withInput()->withErrors($validator); } // Save the comment $comment = new Comment(); $comment->user_id = Sentry::getUser()->id; $comment->content = e(Input::get('comment')); // Was the comment saved with success? if ($post->comments()->save($comment)) { // Redirect to this blog post page return Redirect::to("blog/{$slug}#comments")->with('success', 'Your comment was successfully added.'); } // Redirect to this blog post page return Redirect::to("blog/{$slug}#comments")->with('error', 'There was a problem adding your comment, please try again.'); }
public function before() { $this->nocversion = 'none'; $path = $this->request->route->path; if ($path != 'auth/login') { $this->check_license($path); } parent::before(); //$auth = Auth::instance(); //Auth::instance()->login('hrvoje','hajduk81'); /* if(!$this->check_license()) \Response::redirect(\Config::get('base_url').'/ajax/license'); */ $uri_string = explode('/', Uri::string()); if (count($uri_string) > 1 and $uri_string[0] == 'auth' and $uri_string[1] == 'login') { return; } if ($path != '_root_') { if (\Sentry::check()) { $this->user = Sentry::user()->get('id'); $this->username = Sentry::user()->get('username'); return; } else { $this->user = false; $this->username = ''; \Response::redirect(\Config::get('base_url') . 'auth/login'); } } }
/** * View a blog post. * * @param string $slug * @return Redirect */ public function postView($slug) { // The user needs to be logged in, make that check please. if (!Sentry::check()) { return Redirect::to($slug . '#comments')->with('error', 'You need to be logged in to post comments!'); } // Get this blog post data $post = Post::where('slug', '=', $slug)->first(); // Declare the rules for the form validation $rules = array('comment' => 'required|min:3'); // Validate the inputs $validator = Validator::make(Input::all(), $rules); // Check if the form validates with success if ($validator->passes()) { // Save the comment $comment = new Comment(); $comment->user_id = Sentry::getUser()->id; $comment->content = Input::get('comment'); // Was the comment saved with success? if ($post->comments()->save($comment)) { // Redirect to this blog post page return Redirect::to($slug . '#comments')->with('success', 'Your comment was added with success.'); } // Redirect to this blog post page return Redirect::to($slug . '#comments')->with('error', 'There was a problem adding your comment, please try again.'); } // Redirect to this blog post page return Redirect::to($slug)->withInput()->withErrors($validator); }
/** * Handles GET requests from / * * @return view */ public function getDefault() { if (Sentry::check()) { return Redirect::to('dashboard'); } return View::make('layouts.default'); }
public function showLogin() { if (Sentry::check()) { return Redirect::to('/admin'); } return View::make('admin::vis-login'); }
public function check() { if (!Sentry::check()) { $this->layout = null; return Redirect::action('HomeController@index')->with('message', "<div class='alert alert-danger'>You don't have access to this page.</div>"); } }
public function logout() { if (Sentry::check()) { Sentry::logout(); } return Redirect::to('/'); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (\Sentry::check()) { return new RedirectResponse(url('/')); } return $next($request); }
public function isCurrent() { if (!Sentry::check()) { return false; } return Sentry::getUser()->id == $this->id; }
public static function canEdit($id) { if (Sentry::check() && (Sentry::getUser()->id == $id || Sentry::getUser()->isSuperUser())) { return true; } return false; }
public function pushMessage() { if (!Sentry::check()) { return Response::json(array('errCode' => 10, 'message' => '请登录')); } Sentry::login(Sentry::findUserById(5), false); $user = Sentry::getUser(); // $user = User::find(1); $push_status = PushStatus::where('user_id', $user->id)->first(); if (count($push_status) == 0) { $push_status = new PushStatus(); $push_status->user_id = $user->id; $push_status->status = 1; if (!$push_status->save()) { return Response::json(array('errCode' => 1, 'message' => '[数据库错误]开启消息推送失败')); } return Response::json(array('errCode' => 0, 'message' => '开启消息推送')); } if ($push_status->status == 1) { $push_status->status = 0; if (!$push_status->save()) { return Response::json(array('errCode' => 2, 'message' => '[数据库错误]开启消息推送失败')); } return Response::json(array('errCode' => 0, 'message' => '开启消息推送')); } if ($push_status->status == 0) { $push_status->status = 1; if (!$push_status->save()) { return Response::json(array('errCode' => 3, 'message' => '[数据库错误]开启消息推送失败')); } return Response::json(array('errCode' => 0, 'message' => '开启消息推送')); } }
public function showLogin() { if (\Sentry::check()) { return \Redirect::to(\Config::get('jarboe::admin.uri')); } return \View::make('admin::vis-login'); }
/** * Display the login page * @return View */ public function getLogin() { if (Sentry::check()) { return Redirect::route('admin.index'); } return View::make('admin.auth.login'); }
public function __construct() { if (Sentry::check()) { // User is not logged in, or is not activated $this->data['admin'] = Sentry::getUser(); } }
public function getLogout() { if (Sentry::check()) { Sentry::logout(); return Redirect::route('index'); } }
public function execute($function) { if (Sentry::check() && Sentry::getUser()->isSuperUser()) { return $function(); } return 'You have no privileges to access this page!'; }
/** * @description if logged in will logout session and redirect to /index * @return void or redirects to login page */ public function logoutAction() { if (Sentry::check()) { Sentry::logout(); return $this->response->redirect('index'); } }
public function check_logged() { $logged = true; if (!(\Sentry::check() && !\Sentry::user()->is_admin())) { $logged = false; } return $logged; }
public function perInfo() { if (!Sentry::check()) { return Response::json(array('errCode' => 1, 'message' => '请登录')); } $user = Sentry::getUser(); return Response::json(array('errCode' => 0, 'message' => '返回用户基本信息', 'user' => $user)); }
/** * Authenticating Login System. * GET /login * * @return Response */ public function login() { if (Sentry::check()) { Session::reflash(); return Redirect::to('dashboard'); } return View::make('auth.login'); }
public function login() { if (Sentry::check()) { // User is not logged in, or is not activated return Redirect::to('/'); } return View::make('login', $this->data); }
public function login() { if (!Sentry::check()) { return View::make('auth.login', array('pageTitle' => 'Login')); } else { return Redirect::to('/')->with('global_error', 'You are already logged in.'); } }
public function home() { if (Sentry::check()) { return Redirect::to('dashboard'); } else { return View::make('front.home'); } }
/** * Display a listing of the resource. * * @return Response */ public function index() { if (Sentry::check()) { return Redirect::to('./'); } $this->layout->title = APPNAME; $this->layout->content = View::make('login.index'); }
/** * Login */ public function login() { if (!Sentry::check()) { return View::make('users.login'); } else { return Redirect::route('users.index'); } }
function print_anime($series) { if (Sentry::check() && Sentry::getUser()->isSuperUser()) { Anime::getAnimeList($series, true); } else { Anime::getAnimeList($series); } }