PHP App::after Examples

PHP App::after - 30 examples found. These are the top rated real world PHP examples of App::after extracted from open source projects. You can rate examples to help us improve the quality of examples.
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    $data = json_encode(Input::all());
    $file = fopen(storage_path() . "/logs/route_logs.txt", 'a');
    fwrite($file, Request::path() . "\n\n");
    fwrite($file, $data);
    if ($data != "") {
        $t = date("Y-m-d G:i:s", time());
        $data = "\nFound matches at at " . $t . "\n----------------------------------\n\n";
    }
    fwrite($file, $data);
});
App::after(function ($request, $response) {
    return $response;
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (Auth::guest()) {
        if (Request::ajax()) {
            return Response::make('Unauthorized', 401);
| 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) {
    $authzToken = new Airavata\Model\Security\AuthzToken();
    $authzToken->accessToken = "emptyToken";
    $apiVersion = Airavata::getAPIVersion($authzToken);
    if (empty($apiVersion)) {
        return View::make("server-down");
    } else {
        Session::put('authz-token', $authzToken);
    }
});
App::after(function ($request, $response) {
    //
    // Test commit.
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (Auth::guest()) {
        if (Request::ajax()) {
            return Response::make('Unauthorized', 401);
Example #3
0
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    try {
        $user = DB::table('users')->first();
        unset($user);
    } catch (\PDOException $e) {
        if (!in_array($request->path(), array('install', 'install/db', 'install/api', 'install/user', 'install/complete'))) {
            return Redirect::to('/install', 302);
        }
    }
});
App::after(function ($request, $response) {
    if (get_class($response) != 'Symfony\\Component\\HttpFoundation\\BinaryFileResponse') {
        $response->header('Cache-Control', 'no-cache, must-revalidate');
        $response->header('P3P', 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
    }
});
App::missing(function ($exception) {
    Log::error('URL : ' . URL::current());
    $error = new Andriynto\Ebri\Controllers\Error();
    return $error->_404();
});
/*
|--------------------------------------------------------------------------
| Auth Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify user logged in.
|
*/
Example #4
0
| 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 () {
    if (!Request::is('api/*')) {
        session_start();
        if (in_array(BaseController::cookieGet('lang'), ['en', 'ru', 'by'])) {
            App::setLocale(BaseController::cookieGet('lang'));
        }
        if (!BaseController::sessionGet('token')) {
            BaseController::sessionSet('token', BaseController::randString(6));
        }
    }
});
App::after(function () {
});
/*
 *  Registration captcha check
 */
Route::filter('signup', function () {
    if (!BaseController::checkCaptcha()) {
        return View::make('verif.signup');
    }
});
/*
 *  Retrieving URL captcha check
 */
Route::filter('retrieve', function () {
    if (!BaseController::checkCaptcha()) {
        return View::make('verif.retrieve');
    }
Example #5
0
|--------------------------------------------------------------------------
| 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) {
    //
});
App::after(function ($request, $response) {
    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') || strpos($_SERVER['HTTP_USER_AGENT'], 'Safari')) {
        $response->header('P3P', 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
        //		header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
        //		header('P3P: CP="CAO PSA OUR"');
        //
    }
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (Auth::guest()) {
Example #6
0
    Cache::macro('want', function ($key, $minutes = 0, $callback) {
        if (!($data = Cache::get($key))) {
            $data = call_user_func($callback);
            if ($minutes == 0) {
                Cache::forever($key, $data);
            } else {
                Cache::put($key, $data, $minutes);
            }
        }
        return $data;
    });
});
App::after(function ($request, $response) {
    $sqlLogs = DB::getQueryLog();
    foreach ($sqlLogs as $sql) {
        Log::debug($sql['query'], ['time' => $sql['time']]);
    }
    Log::info("\n");
});
App::error(function (ModelNotFoundException $e) {
    return Response::make('记录不存在', 404);
});
App::error(function (NotFoundHttpException $e) {
    return Response::make('页面不存在', 404);
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
Example #7
0
<?php

use RainLab\Translate\Models\Message;
use RainLab\Translate\Classes\Translator;
/*
 * Adds a custom route to check for the locale prefix.
 */
App::before(function ($request) {
    $translator = Translator::instance();
    if (!$translator->isConfigured()) {
        return;
    }
    $locale = Request::segment(1);
    if ($translator->setLocale($locale)) {
        Route::group(['prefix' => $locale], function () use($locale) {
            Route::any('{slug}', 'Cms\\Classes\\Controller@run')->where('slug', '(.*)?');
        });
        Route::any($locale, 'Cms\\Classes\\Controller@run');
    }
});
/*
 * Save any used messages to the contextual cache.
 */
App::after(function ($request) {
    Message::saveToCache();
});
Example #8
0
|--------------------------------------------------------------------------
| 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) {
    //
});
App::after(function ($request, $response) {
    // Mencegah Kembali Login Setelah Logout dengan Menekan Tombol Back pada Browser
    $response->headers->set("Cache-Control", "no-cache,no-store, must-revalidate");
    $response->headers->set("Pragma", "no-cache");
    //HTTP 1.0
    $response->headers->set("Expires", " Sat, 26 Jul 1997 05:00:00 GMT");
    // Date in the past
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter("auth", function () {
    if (Auth::guest()) {
Example #9
0
<?php

App::before(function () {
    Event::fire('clockwork.controller.start');
});
App::after(function () {
    Event::fire('clockwork.controller.end');
});
Backend\Classes\BackendController::extend(function ($controller) {
    $controller->middleware('Clockwork\\Support\\Laravel\\ClockworkMiddleware');
});
Cms\Classes\CmsController::extend(function ($controller) {
    $controller->middleware('Clockwork\\Support\\Laravel\\ClockworkMiddleware');
});
| 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 ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
        $statusCode = 204;
        $headers = ['Access-Control-Allow-Origin' => '*', 'Allow' => 'GET, POST, PUT, OPTIONS', 'Access-Control-Allow-Headers' => 'Origin, Content-Type, Accept, Authorization, X-Requested-With', 'Access-Control-Allow-Credentials' => 'true'];
        return Response::make(null, $statusCode, $headers);
    }
});
App::after(function ($request, $response) {
    // para permitir los request desde sitios externos
    $response->headers->set('Access-Control-Allow-Origin', '*');
    $response->headers->set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
    $response->headers->set('Access-Control-Allow-Headers', 'Origin, Content-Type, Accept, Authorization, X-Requested-With');
    $response->headers->set('Access-Control-Allow-Credentials', 'true');
    return $response;
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    // ...get database user
Example #11
0
    Route::controller('datasets', 'Tdt\\Core\\Ui\\DatasetController');
    Route::controller('users', 'Tdt\\Core\\Ui\\UserController');
    Route::controller('groups', 'Tdt\\Core\\Ui\\GroupController');
    Route::any('{all}', 'Tdt\\Core\\Ui\\UiController@handleRequest')->where('all', '.*');
});
/*
 * IMPORTANT!
 * The catch-all route to catch all other request is added last to allow packages to still have their own routes
 */
App::before(function () {
    // The (in)famous catch-all
    Route::any('{all}', 'Tdt\\Core\\BaseController@handleRequest')->where('all', '.*');
});
App::after(function ($request, $response) {
    // Remove cookie(s)
    $response->headers->removeCookie('tdt_auth');
    $response->headers->removeCookie('laravel_session');
});
/*
 * Proper error handling
 */
App::error(function ($exception, $code) {
    // Log error
    Log::error($exception);
    // Check Accept-header
    $accept_header = \Request::header('Accept');
    $mimes = explode(',', $accept_header);
    if (in_array('text/html', $mimes) || in_array('application/xhtml+xml', $mimes)) {
        // Create HTML response, seperate templates for status codes
        switch ($code) {
            case 403:
Example #12
0
    }
    $cors = ServiceLocator::getInstance()->getService('CORSMiddleware');
    if ($response = $cors->verifyRequest($request)) {
        return $response;
    }
});
App::after(function ($request, $response) {
    // https://www.owasp.org/index.php/List_of_useful_HTTP_headers
    $response->headers->set('X-content-type-options', 'nosniff');
    $response->headers->set('X-xss-protection', '1; mode=block');
    // http://tools.ietf.org/html/rfc6797
    /**
     * The HSTS header field below stipulates that the HSTS Policy is to
     * remain in effect for one year (there are approximately 31536000
     * seconds in a year)
     * applies to the domain of the issuing HSTS Host and all of its
     * subdomains:
     */
    $response->headers->set('Strict-Transport-Security', 'max-age=31536000; includeSubDomains');
    //cache
    $response->headers->set('pragma', 'no-cache');
    $response->headers->set('Expires', '-1');
    $response->headers->set('cache-control', 'no-store, must-revalidate, no-cache');
    $cors = ServiceLocator::getInstance()->getService('CORSMiddleware');
    $cors->modifyResponse($request, $response);
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
Example #13
0

/*
|--------------------------------------------------------------------------
| 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) {
    //
});
App::after(function ($request, $response) {
    $response->headers->set('Cache-Control', 'nocache, no-store, max-age=0, must-revalidate');
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (Auth::guest()) {
        if (Request::ajax()) {
            return Response::make('Unauthorized', 401);
Example #14
0
/*
|--------------------------------------------------------------------------
| 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::after(function ($request, $response) {
    if ($request->isMethod('OPTIONS')) {
        $headers = App::make('api')->getConfig('headers');
        if (!empty($headers)) {
            foreach ($headers as $key => $value) {
                $response->header($key, $value);
            }
        }
        unset($headers);
    }
});
/*
|--------------------------------------------------------------------------
| OAuth Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify OAuth token.
|
*/
Route::filter('api.oauth', function () {
    $argList = array();
Example #15
0
| 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) {
    //
});
App::after(function ($request, $response) {
    // Minification de l'HTML en sortie :
    if (App::Environment() != 'local') {
        if ($response instanceof Illuminate\Http\Response) {
            // récupération de la sortie :
            $output = $response->getOriginalContent();
            // Nettoyage des commentaires :
            $output = preg_replace('/<!--([^\\[|(<!)].*)/', '', $output);
            $output = preg_replace('/(?<!\\S)\\/\\/\\s*[^\\r\\n]*/', '', $output);
            // Suppression des espaces vides :
            $output = preg_replace('/\\s{2,}/', '', $output);
            $output = preg_replace('/(\\r?\\n)/', '', $output);
            // retour de la sortie minifier :
            $response->setContent($output);
        }
    }
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
Example #16
0
/*
|--------------------------------------------------------------------------
| 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) {
    //
    Event::fire('clockwork.controller.start');
});
App::after(function ($request, $response) {
    //
    Event::fire('clockwork.controller.end');
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (Auth::guest()) {
        if (Request::ajax()) {
            return Response::make('Unauthorized', 401);
Example #17
0
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    // Record the starting time for logging the application performance
    Session::put('start.time', microtime(true));
    // Get the Throttle Provider
    $throttleProvider = Sentry::getThrottleProvider();
    // Enable the Throttling Feature
    $throttleProvider->enable();
    // Custom additions go below here
});
App::after(function ($request, $response) {
    // Custom additions go below here
    // Write performance related statistics into the log file
    if (Config::get('larapress.settings.log')) {
        Helpers::logPerformance();
    }
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (Auth::guest()) {
Example #18
0
| CSRF Protection Filter
|--------------------------------------------------------------------------
|
| The CSRF filter is responsible for protecting your application against
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function () {
    if (Session::token() != Input::get('_token')) {
        throw new Illuminate\Session\TokenMismatchException();
    }
});
/*
sources :
    https://gist.github.com/garagesocial/6059962
    http://stackoverflow.com/questions/5312349/minifying-final-html-output-using-regular-expressions-with-codeigniter
*/
App::after(function ($request, $response) {
    // HTML Minification
    if (App::Environment() != 'local') {
        if ($response instanceof Illuminate\Http\Response) {
            $output = $response->getOriginalContent();
            $filters = array('/(?<!\\S)\\/\\/\\s*[^\\r\\n]*/' => '', '#(?ix)(?>[^\\S ]\\s*|\\s{2,})(?=(?:(?:[^<]++|<(?!/?(?:textarea|pre)\\b))*+)(?:<(?>textarea|pre)\\b|\\z))#' => '');
            $output = preg_replace(array_keys($filters), array_values($filters), $output);
            if ($output !== NULL) {
                $response->setContent($output);
            }
        }
    }
});
Example #19
0
/*
|--------------------------------------------------------------------------
| Application & Route Filters
|--------------------------------------------------------------------------
*/
App::before(function ($request) {
    // enforce no www
    if (preg_match('/^http:\\/\\/www./', $request->url())) {
        $newUrl = preg_replace('/^http:\\/\\/www./', 'http://', $request->url());
        return Redirect::to($newUrl);
    }
});
App::after(function ($request, $response) {
    if (Auth::guest()) {
        if (!stristr($request->path(), 'login') && !stristr($request->path(), 'signup')) {
            Session::put('auth.intended_redirect_url', $request->url());
        }
    }
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (Auth::guest()) {
Example #20
0
/* Check if a user session has access */
Route::filter('hasAccessSession', function ($route) {
    $check = Sentry::check();
    if (!$check) {
        return Response::make('Unauthorized', 401);
    }
    if ($check) {
        $user = Sentry::getUser();
        $permission = $route->getParameter('permission');
        if (!$user->hasAccess($permission)) {
            return Response::make('Unauthorized', 403);
        }
    }
});
Route::filter('xhr', function () {
    if (!Request::ajax()) {
        return Response::make('Not Found', 404);
    }
});
Route::filter('xsrf', function () {
    if (!isset($_COOKIE['XSRF-TOKEN']) || is_null(Request::header('X-XSRF-TOKEN')) || $_COOKIE['XSRF-TOKEN'] !== Request::header('X-XSRF-TOKEN')) {
        return Response::make('Not Found', 404);
    }
});
//To protect against json injection
App::after(function ($request, $response) {
    if ($response instanceof \Illuminate\Http\JsonResponse) {
        $json = ")]}',\n" . $response->getContent();
        return $response->setContent($json);
    }
});

/*
|--------------------------------------------------------------------------
| 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) {
    //
});
App::after(function ($request, $response) {
    $response->headers->set('Access-Control-Allow-Origin', 'http://todo.dev');
    return $response;
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (Auth::guest()) {
        if (Request::ajax()) {
            return Response::make('Unauthorized', 401);
Example #22
0
| to the user if maintenace mode is in effect for this application.
|
*/
App::down(function () {
    return Response::make("Be right back!", 503);
});
/*
*   An improvised Gist from
*   https://gist.github.com/zmsaunders/5619519  
*   https://gist.github.com/garagesocial/6059962
*/
App::after(function ($request, $response) {
    if (App::Environment() != 'local') {
        if ($response instanceof Illuminate\Http\Response) {
            $output = $response->getOriginalContent();
            $filters = array('/<!--(?!\\s*(?:\\[if [^\\]]+]|<!|>))(?:(?!-->).)*-->/s' => '', '/(?<!\\S)\\/\\/\\s*[^\\r\\n]*/' => '', '/\\s{2,}/' => '', '/(\\r?\\n)/' => '');
            $output = preg_replace(array_keys($filters), array_values($filters), $output);
            $response->setContent($output);
        }
    }
});
/*
|--------------------------------------------------------------------------
| Require The Filters File
|--------------------------------------------------------------------------
|
| Next we will load the filters file for the application. This gives us
| a nice separate location to store our route and application filter
| definitions instead of putting them all in the main routes file.
|
*/
require __DIR__ . '/../filters.php';
Example #23
0
|--------------------------------------------------------------------------
| 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 () {
    $throttleProvider = Sentry::getThrottleProvider();
    $throttleProvider->enable();
});
App::after(function () {
    if (Config::get('larapress.settings.log')) {
        Helpers::logPerformance();
    }
});
/*
|--------------------------------------------------------------------------
| Special larapress Filters
|--------------------------------------------------------------------------
|
| The following filters are developed for larapress but may be also useful
| for your website. You can apply them to any route you'd like.
|
*/
Route::filter('force.human', 'Larapress\\Filters\\Special\\ForceHumanFilter');
/*
|--------------------------------------------------------------------------
| Filters for the larapress backend
Example #24
0
/*
|--------------------------------------------------------------------------
| 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 (true) {
    }
});
App::after(function ($request, $response) {
    if (true) {
    }
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (Auth::guest()) {
        return Redirect::guest('auth/login');
    }
Example #25
0
<?php

App::before(function () {
    //echo "<br>start<br>";
});
App::after(function () {
    //echo "<br>end<br>";
});
Route::filter('auth', function () {
    if (Auth::guest()) {
        Url::redirect("@login");
        return false;
    } else {
        return true;
    }
});
Route::filter('guest', function () {
    if (Auth::guest()) {
        Url::redirect('/');
    }
});
Route::filter('csrf', function () {
    if (Session::token() != Res::post('_token')) {
        return false;
    } else {
        return true;
    }
});
Example #26
0
        App::setLocale($cookie_lang);
    } else {
        if (!empty($browser_lang) and in_array($browser_lang, Config::get('app.languages'))) {
            if ($browser_lang != $cookie_lang) {
                Cookie::forever('language', $browser_lang);
                Session::put('language', $browser_lang);
            }
            App::setLocale($browser_lang);
        } else {
            App::setLocale(Config::get('app.locale'));
        }
    }
});
App::after(function ($request, $response) {
    $lang = Session::get('language');
    if (!empty($lang)) {
        $response->withCookie(Cookie::forever('language', $lang));
    }
});
Route::filter('auth', function () {
    if (!Sentry::check()) {
        return Redirect::guest('/');
    }
});
Route::filter('api.patient', function () {
    if (!Cache::has('_token_')) {
        return Api\V1\Helpers::Mgs("Api No Acesss. Api. Token");
    }
});
Route::filter('api.cache', function () {
    if (!Cache::has('_token_')) {
        Sentry::logout();
Example #27
0
<?php

App::after(function ($request, $response) {
    $response->headers->set('Cache-Control', 'nocache, no-store, max-age=0, must-revalidate');
    $response->headers->set('Pragma', 'no-cache');
    $response->headers->set('Expires', 'Fri, 01 Jan 1990 00:00:00 GMT');
});
/*App::missing(function($exception)
{
    return Redirect::to('/');
}); */
//Login Screens - No need any Authentication, Accessible by All
Route::get('/', 'HomeController@home');
Route::get('/login', 'HomeController@home');
Route::post('/login', 'LoginController@Login');
Route::get('/forgot', 'LoginController@ForgotPassword');
Route::post('forgotpasswordprocess', 'LoginController@ForgotPasswordProcess');
Route::post('ForgotPasswordProcessforadmin', 'LoginController@ForgotPasswordProcessforadmin');
Route::get('/facebook_login', 'LoginController@loginWithFacebook');
Route::get('/twitter_login', 'LoginController@loginWithTwitter');
Route::get('/google_login', 'LoginController@loginWithGoogle');
/// Admin Login ///
Route::get('admin', 'LoginController@admin');
Route::post('adminlogin', 'LoginController@adminLogin');
Route::get('forgotadmin', 'LoginController@forgotadmin');
//Create User - For Temporary, It was Accessible without Authentication
Route::get('/createuser', 'LoginController@CreateUserLayout');
Route::post('/createuserprocess', 'LoginController@CreateUserProcess');
Route::get('/userregister', function () {
    //return View::make('user/register/userregister');
});
Example #28
0

/*
|--------------------------------------------------------------------------
| 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) {
    //
});
App::after(function ($request, $response) {
    // $response->headers->set('Access-Control-Allow-Origin', '*');
    // return $response;
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (!Request::header('Authorization')) {
        return Response::json(array('message' => Request::header()), 401);
    }
Example #29
0

/*
|--------------------------------------------------------------------------
| 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) {
    //
});
App::after(function ($request, $response) {
    //
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (Auth::guest()) {
        if (Request::ajax()) {
            return Response::make('Unauthorized', 401);
Example #30
0
App::after(function ($request, $response) {
    //
    if (App::Environment() != 'local') {
        if ($response instanceof Illuminate\Http\Response) {
            $output = $response->getOriginalContent();
            $re = '%# Collapse whitespace everywhere but in blacklisted elements.
			(?>             # Match all whitespans other than single space.
			[^\\S ]\\s*     # Either one [\\t\\r\\n\\f\\v] and zero or more ws,
			| \\s{2,}        # or two or more consecutive-any-whitespace.
			) # Note: The remaining regex consumes no text at all...
			(?=             # Ensure we are not in a blacklist tag.
			[^<]*+        # Either zero or more non-"<" {normal*}
			(?:           # Begin {(special normal*)*} construct
			<           # or a < starting a non-blacklist tag.
			(?!/?(?:textarea|pre|script)\\b)
			[^<]*+      # more non-"<" {normal*}
			)*+           # Finish "unrolling-the-loop"
			(?:           # Begin alternation group.
			<           # Either a blacklist start tag.
			(?>textarea|pre|script)\\b
			| \\z          # or end of file.
			)             # End alternation group.
			)  # If we made it here, we are not in a blacklist tag.
			%Six';
            $output = preg_replace($re, " ", $output);
            if ($output === null) {
                exit("PCRE Error! File too big.\n");
            }
            $response->setContent($output);
        }
    }
});