当前位置: 首页>>代码示例>>PHP>>正文


PHP Redirect::secure方法代码示例

本文整理汇总了PHP中Redirect::secure方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::secure方法的具体用法?PHP Redirect::secure怎么用?PHP Redirect::secure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Redirect的用法示例。


在下文中一共展示了Redirect::secure方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$request->secure()) {
         return Redirect::secure($request->path());
     }
     return $next($request);
 }
开发者ID:alexandrzavalii,项目名称:larabid,代码行数:14,代码来源:ssl.php

示例2: getIndex

 public function getIndex()
 {
     if (Auth::guest() || Auth::user()->isAdmin == 0) {
         return Redirect::secure('/');
     }
     // layouts variables
     $this->layout->title = 'Админ панел | Нещо Шантаво';
     $this->layout->canonical = 'https://neshto.shantavo.com/admin/';
     $this->layout->robots = 'noindex,nofollow,noodp,noydir';
     $users = count(User::all());
     $admins = count(User::where('isAdmin', ">", 0)->get());
     $categories = count(Category::all());
     $albums = count(Album::all());
     $votes = count(DB::table('votes')->get());
     $pictures = count(Picture::all());
     $pictureSize = 0;
     foreach (Picture::all() as $p) {
         $pictureSize += $p->size;
     }
     // get disqus stats
     include app_path() . '/config/_disqus.php';
     $disqus = new DisqusAPI(getDisqusKey());
     $disqus->setSecure(false);
     $comments = $disqus->posts->list(array('forum' => 'shantavo'));
     // nesting the view into the layout
     $this->layout->nest('content', 'admin.index', array('users' => $users, 'admins' => $admins, 'votes' => $votes, 'categories' => $categories, 'albums' => $albums, 'pictures' => $pictures, 'pictureSize' => $pictureSize, 'comments' => $comments));
 }
开发者ID:straho99,项目名称:NeshtoShantavo,代码行数:27,代码来源:AdminController.php

示例3: postCreate

 public function postCreate()
 {
     if (Auth::guest()) {
         return Redirect::secure('user/login');
     }
     // do not use layout for this
     $this->layout = null;
     // add to db
     Input::get('isPrivate') == 1 ? $isPrivate = 1 : ($isPrivate = 0);
     Album::insert(array('user_id' => Input::get('userId'), 'categories_id' => Input::get('category'), 'name' => strip_tags(Purifier::clean(Input::get('name'))), 'isPrivate' => $isPrivate));
     // redirect to albums
     return Redirect::secure('user/albums');
 }
开发者ID:straho99,项目名称:NeshtoShantavo,代码行数:13,代码来源:AlbumController.php

示例4: postCreate

 public function postCreate()
 {
     if (Auth::guest()) {
         return Redirect::secure('user/login');
     }
     // do not use layout for this
     $this->layout = null;
     // check image size (must be < 10MB)
     if (Input::file('image')->getSize() > 10000000) {
         return Redirect::secure('picture/upload');
     }
     // check image type (must be (jpg, png, gif or jpeg))
     if (Input::file('image')->getClientOriginalExtension() == "jpg" || Input::file('image')->getClientOriginalExtension() == "jpeg" || Input::file('image')->getClientOriginalExtension() == "png" || Input::file('image')->getClientOriginalExtension() == "gif") {
         // add record to db
         Input::get('isPrivate') == 1 ? $isPrivate = 1 : ($isPrivate = 0);
         $id = Picture::insertGetId(array('user_id' => Input::get('userId'), 'album_id' => Input::get('albumId'), 'filename' => Input::file('image')->getClientOriginalName(), 'size' => Input::file('image')->getSize(), 'title' => strip_tags(Purifier::clean(Input::get('title'))), 'isPrivate' => $isPrivate));
         // move to albums folder
         $destinationPath = public_path() . "/files/" . Input::get('userId') . "/" . Input::get('albumId');
         Input::file('image')->move($destinationPath, Input::file('image')->getClientOriginalName());
         // redirect to uploaded picture
         return Redirect::secure('picture/' . $id);
     }
     return Redirect::secure('picture/upload');
 }
开发者ID:straho99,项目名称:NeshtoShantavo,代码行数:24,代码来源:PictureController.php

示例5: getAlbums

 public function getAlbums()
 {
     if (Auth::guest()) {
         return Redirect::secure('/');
     }
     // layouts variables
     $this->layout->title = 'Албуми | Нещо Шантаво';
     $this->layout->canonical = 'https://neshto.shantavo.com/user/albums';
     $albums = Album::where('user_id', '=', Auth::user()->id)->get();
     $categories = Category::all();
     // nesting the view into the layout
     $this->layout->nest('content', 'user.albums', array('albums' => $albums, 'categories' => $categories));
 }
开发者ID:straho99,项目名称:NeshtoShantavo,代码行数:13,代码来源:UserController.php

示例6:

| Application & Route Filters
|--------------------------------------------------------------------------
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    if (Auth::check()) {
        $count = Session::get(SESSION_COUNTER, 0);
        Session::put(SESSION_COUNTER, ++$count);
    }
    if (App::environment() == ENV_PRODUCTION) {
        if (!Request::secure()) {
            return Redirect::secure(Request::getRequestUri());
        }
    }
    if (Input::has('lang')) {
        $locale = Input::get('lang');
        App::setLocale($locale);
        Session::set(SESSION_LOCALE, $locale);
        if (Auth::check()) {
            if ($language = Language::whereLocale($locale)->first()) {
                $account = Auth::user()->account;
                $account->language_id = $language->id;
                $account->save();
            }
        }
    } else {
        if (Auth::check()) {
开发者ID:Vrian7ipx,项目名称:cascadadev,代码行数:31,代码来源:filters.php

示例7: function

| Language
|--------------------------------------------------------------------------
|
| Detect the browser language.
|
*/
Route::filter('detectLang', function ($route, $request, $lang = 'auto') {
    if ($lang != "auto" && in_array($lang, Config::get('app.available_language'))) {
        Config::set('app.locale', $lang);
    } else {
        $browser_lang = !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ',') : '';
        $browser_lang = substr($browser_lang, 0, 2);
        $userLang = in_array($browser_lang, Config::get('app.available_language')) ? $browser_lang : Config::get('app.locale');
        Config::set('app.locale', $userLang);
        App::setLocale($userLang);
    }
});
/** 
 * Enforce https.
 */
App::before(function ($request) {
    $settings = Config::get('app');
    if ($settings['app_environment'] == 'production') {
        if (!Request::secure()) {
            return Redirect::secure(Request::path());
        }
    }
});
App::error(function (\Illuminate\Session\TokenMismatchException $exception) {
    return Redirect::route('login')->with('message', 'Your session has expired. Please try logging in again.');
});
开发者ID:XDocker,项目名称:app,代码行数:31,代码来源:filters.php

示例8: signOut

 /**
  * Sign User out
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function signOut()
 {
     Session::flush();
     return Redirect::secure('/');
 }
开发者ID:ronnie,项目名称:Gist-List,代码行数:10,代码来源:UserController.php

示例9: getAbout

 public function getAbout()
 {
     return Redirect::secure('/');
 }
开发者ID:straho99,项目名称:NeshtoShantavo,代码行数:4,代码来源:HomeController.php

示例10: explode

            $request = App::make('guzzle')->get('https://www.cloudflare.com/ips-v4');
            return explode("\n", $request->getBody());
        }));
    } catch (Exception $e) {
        Cache::forget('cloudflare.ips');
        Log::error($e);
    }
    // If request is not secured and force secured connection is enabled
    // then we need to redirect the user to a secure link.
    if (!Request::secure() && Config::get('bfacp.site.ssl') && $_SERVER['REMOTE_ADDR'] != '127.0.0.1' && filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) {
        $path = Request::path();
        if (strlen(Request::server('QUERY_STRING')) > 0) {
            $path .= '?' . Request::server('QUERY_STRING');
        }
        $status = in_array(Request::getMethod(), ['POST', 'PUT', 'DELETE']) ? 307 : 302;
        return Redirect::secure($path, $status);
    }
    // Check if only authorized users are allowed to access the site.
    if (Config::get('bfacp.site.auth') && Auth::guest()) {
        $path = explode('/', Request::path());
        if (count($path) > 1) {
            $route = $path[0] . '/' . $path[1];
        } else {
            $route = $path[0];
        }
        if (!in_array($route, ['login', 'register', 'user/confirm'])) {
            return Redirect::route('user.login');
        }
    }
});
App::after(function ($request, $response) {
开发者ID:BP4U,项目名称:BFAdminCP,代码行数:31,代码来源:filters.php

示例11:

*/
App::error(function (Exception $exception, $code) {
    Log::error($exception);
    return Response::view('error', ['error' => 'A website error has occurred.
        The website administrator has been notified of the issue.
        Sorry for the temporary inconvenience.'], 500);
});
App::error(function (NoSessionToken $exception) {
    // Log::error($exception);
    return Redirect::secure('/');
});
App::error(function (\GuzzleHttp\Exception\ClientException $exception) {
    Log::error($exception);
    if ($exception->getCode() === 401) {
        Session::flush();
        return Redirect::secure('/');
    }
    return Response::view('error', ['error' => 'A website error has occurred.
        The website administrator has been notified of the issue.
        Sorry for the temporary inconvenience.'], 500);
});
App::missing(function ($exception) {
    return Response::view('error', ['error' => '404 Not Found'], 404);
});
/*
|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
开发者ID:ronnie,项目名称:Gist-List,代码行数:31,代码来源:global.php


注:本文中的Redirect::secure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。