コード例 #1
1
ファイル: helpers.php プロジェクト: TahsinGokalp/L3-Eticaret
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);
                }
            }
        }
    }
}
コード例 #2
0
ファイル: admin.php プロジェクト: EdgeCommerce/edgecommerce
 /**
  * @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();
 }
コード例 #3
0
ファイル: AdminController.php プロジェクト: eldalo/jarvix
 public function reset($id)
 {
     if (Sentry::check()) {
         return Redirect::route('admin.dashboard');
     }
     return View::make('administrator.reset', ['title' => 'Nueva Contraseña', 'data' => $id]);
 }
コード例 #4
0
 /**
  * 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'));
 }
コード例 #5
0
 /**
  * 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.');
 }
コード例 #6
0
ファイル: login.php プロジェクト: quickpacket/noclayer
 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');
         }
     }
 }
コード例 #7
0
 /**
  * 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);
 }
コード例 #8
0
ファイル: AuthController.php プロジェクト: shampine/plumage
 /**
  * Handles GET requests from /
  *
  * @return view
  */
 public function getDefault()
 {
     if (Sentry::check()) {
         return Redirect::to('dashboard');
     }
     return View::make('layouts.default');
 }
コード例 #9
0
 public function showLogin()
 {
     if (Sentry::check()) {
         return Redirect::to('/admin');
     }
     return View::make('admin::vis-login');
 }
コード例 #10
0
 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>");
     }
 }
コード例 #11
0
ファイル: SentryController.php プロジェクト: noubodi/pretexts
 public function logout()
 {
     if (Sentry::check()) {
         Sentry::logout();
     }
     return Redirect::to('/');
 }
コード例 #12
0
 /**
  * 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);
 }
コード例 #13
0
ファイル: User.php プロジェクト: ArbindJain/basic-auth-sentry
 public function isCurrent()
 {
     if (!Sentry::check()) {
         return false;
     }
     return Sentry::getUser()->id == $this->id;
 }
コード例 #14
0
 public static function canEdit($id)
 {
     if (Sentry::check() && (Sentry::getUser()->id == $id || Sentry::getUser()->isSuperUser())) {
         return true;
     }
     return false;
 }
コード例 #15
0
ファイル: SiteController.php プロジェクト: Jv-Juven/gift
 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' => '开启消息推送'));
     }
 }
コード例 #16
0
 public function showLogin()
 {
     if (\Sentry::check()) {
         return \Redirect::to(\Config::get('jarboe::admin.uri'));
     }
     return \View::make('admin::vis-login');
 }
コード例 #17
0
 /**
  * Display the login page
  * @return View
  */
 public function getLogin()
 {
     if (Sentry::check()) {
         return Redirect::route('admin.index');
     }
     return View::make('admin.auth.login');
 }
コード例 #18
0
 public function __construct()
 {
     if (Sentry::check()) {
         // User is not logged in, or is not activated
         $this->data['admin'] = Sentry::getUser();
     }
 }
コード例 #19
0
ファイル: AuthController.php プロジェクト: minnb/vitduct
 public function getLogout()
 {
     if (Sentry::check()) {
         Sentry::logout();
         return Redirect::route('index');
     }
 }
コード例 #20
0
 public function execute($function)
 {
     if (Sentry::check() && Sentry::getUser()->isSuperUser()) {
         return $function();
     }
     return 'You have no privileges to access this page!';
 }
コード例 #21
0
 /**
  * @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');
     }
 }
コード例 #22
0
ファイル: user.php プロジェクト: EdgeCommerce/edgecommerce
 public function check_logged()
 {
     $logged = true;
     if (!(\Sentry::check() && !\Sentry::user()->is_admin())) {
         $logged = false;
     }
     return $logged;
 }
コード例 #23
0
ファイル: SitePageController.php プロジェクト: Jv-Juven/gift
 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));
 }
コード例 #24
0
 /**
  * Authenticating Login System.
  * GET /login
  *
  * @return Response
  */
 public function login()
 {
     if (Sentry::check()) {
         Session::reflash();
         return Redirect::to('dashboard');
     }
     return View::make('auth.login');
 }
コード例 #25
0
 public function login()
 {
     if (Sentry::check()) {
         // User is not logged in, or is not activated
         return Redirect::to('/');
     }
     return View::make('login', $this->data);
 }
コード例 #26
0
ファイル: AuthController.php プロジェクト: Belar/librific
 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.');
     }
 }
コード例 #27
0
ファイル: HomeController.php プロジェクト: ioangogo/gruik
 public function home()
 {
     if (Sentry::check()) {
         return Redirect::to('dashboard');
     } else {
         return View::make('front.home');
     }
 }
コード例 #28
0
 /**
  * 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');
 }
コード例 #29
0
 /**
  * Login
  */
 public function login()
 {
     if (!Sentry::check()) {
         return View::make('users.login');
     } else {
         return Redirect::route('users.index');
     }
 }
コード例 #30
0
function print_anime($series)
{
    if (Sentry::check() && Sentry::getUser()->isSuperUser()) {
        Anime::getAnimeList($series, true);
    } else {
        Anime::getAnimeList($series);
    }
}