Example #1
0
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->package('leeb/jsonrpc');
     \App::bind('Leeb\\Jsonrpc\\Interfaces\\RequestInterface', function ($app, $data) {
         return new \Leeb\Jsonrpc\Request($data[0]);
     });
     \App::bind('Leeb\\Jsonrpc\\JsonrpcResponse', function ($app, $data) {
         return new \Leeb\Jsonrpc\JsonrpcResponse($data[0], $data[1], $data[2]);
     });
     \App::singleton('Leeb\\Jsonrpc\\Interfaces\\JsonrpcResponseBuilderInterface', 'Leeb\\Jsonrpc\\JsonrpcResponseBuilder');
     \App::bind('Leeb\\Jsonrpc\\RoutableRequest', function ($app, $data) {
         $resolver = \App::make('Leeb\\Jsonrpc\\Interfaces\\MethodResolverInterface');
         $response_builder = \App::make('Leeb\\Jsonrpc\\Interfaces\\JsonrpcResponseBuilderInterface');
         return new \Leeb\Jsonrpc\RoutableRequest($resolver, $response_builder, $data[0]);
     });
     \App::bind('Leeb\\Jsonrpc\\JsonrpcError', function ($app, $data) {
         return new \Leeb\Jsonrpc\JsonrpcError($data[0], $data[1], $data[2], $data[3]);
     });
     \App::bind('Leeb\\Jsonrpc\\RoutableNotification', function ($app, $data) {
         $resolver = \App::make('Leeb\\Jsonrpc\\Interfaces\\MethodResolverInterface');
         return new \Leeb\Jsonrpc\RoutableNotification($resolver, $data[0]);
     });
     \App::bind('Leeb\\Jsonrpc\\RoutableBatch', function ($app, $data) {
         return new \Leeb\Jsonrpc\RoutableBatch($data[0]);
     });
     \App::singleton('Leeb\\Jsonrpc\\Interfaces\\RouterInterface', 'Leeb\\Jsonrpc\\Router');
     \App::singleton('Leeb\\Jsonrpc\\Interfaces\\MethodResolverInterface', 'Leeb\\Jsonrpc\\MethodResolver');
     \App::singleton('Leeb\\Jsonrpc\\Interfaces\\JsonrpcConfigurationInterface', 'Leeb\\Jsonrpc\\JsonrpcConfiguration');
     \App::singleton('Leeb\\Jsonrpc\\Interfaces\\RequestValidatorInterface', 'Leeb\\Jsonrpc\\RequestValidator');
     \App::singleton('Leeb\\Jsonrpc\\Interfaces\\RawRequestInterpreterInterface', 'Leeb\\Jsonrpc\\RawRequestInterpreter');
 }
 /**
  * Register the GitHub class.
  *
  * @param  App  $app
  * @return null
  */
 protected function registerGithub($app)
 {
     $app->singleton('github', function ($app) {
         $config = $app['config'];
         $factory = $app['github.factory'];
         return new Github($config, $factory);
     });
     $app->alias('github', 'Caffeinated\\Github\\Github');
 }
 public static function setupShortCodes()
 {
     App::singleton('shortCodeEngine', function () {
         $shortCodeEngine = new ShortCodeEngine();
         return $shortCodeEngine;
     });
     $shortCodeEngine = App::make('shortCodeEngine');
     $shortCodes = (require app_path('lib/shortcodes.php'));
     $shortCodeEngine->loadShortCodes($shortCodes);
 }
 /**
  * Register the binding
  *
  * @return void
  */
 public function register()
 {
     \App::singleton('Doctrine\\ORM\\EntityManager', function () {
         $isDevMode = true;
         $paths = array(__DIR__ . '/Infrastructure/Repository/Metadata');
         $config = Setup::createXMLMetadataConfiguration($paths, $isDevMode);
         $conn = array('driver' => 'pdo_mysql', 'host' => 'localhost', 'dbname' => 'laravelddd', 'user' => 'root', 'password' => 'root');
         return \Doctrine\ORM\EntityManager::create($conn, $config);
     });
 }
Example #5
0
 private function __construct($classname)
 {
     if ($lastnspos = strripos($classname, '\\')) {
         $namespace = substr($classname, 0, $lastnspos);
         $classname = substr($classname, $lastnspos + 1);
         $this->view['directory'] = $this->view['class'] = strtolower(str_replace('Controller', '', $classname));
         $namespace = explode('\\', $namespace);
         $this->view['app'] = $namespace[0];
         $this->view['module'] = $namespace[1];
     }
     $this->lean = $this->app = App::singleton();
 }
 public function testAppBindSingleton()
 {
     $app = app();
     App::singleton('tmp', function ($app) {
         $var = new stdClass();
         $var->total = 10;
         return $var;
     });
     $cart1 = App::make('tmp');
     $cart2 = App::make('tmp');
     $this->assertEquals(10, $cart1->total);
     $this->assertEquals(10, $cart2->total);
     $this->assertEquals($cart1, $cart2);
 }
 public static function logTrail($input)
 {
     try {
         $currentString = \App::make('logTrail');
     } catch (\Exception $e) {
         \App::singleton('logTrail', 'stdClass');
         $currentString = \App::make('logTrail');
         $currentString->log = [];
     }
     if (is_array($input) || is_string($input)) {
         array_push($currentString->log, $input);
     } else {
         Log::info($input);
     }
 }
Example #8
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, \Closure $next)
 {
     if ($header = $request->header('Authorization')) {
         $access_token_array = sscanf($header, 'Bearer %s');
         if ($access_token = $access_token_array[0]) {
             try {
                 $token = \Firebase\JWT\JWT::decode($access_token, env('APP_KEY', ''), array('HS512'));
             } catch (\Firebase\JWT\ExpiredException $e) {
                 return ['error' => true, 'code' => 'token_expired', 'message' => ['Token expired']];
             } catch (\Exception $e) {
                 return ['error' => true, 'code' => 'token_invalid', 'message' => ['Token invalid']];
             }
             \App::singleton('JWTToken', 'stdClass');
             $jwttoken = \App::make('JWTToken');
             $jwttoken->token = $token;
         } else {
             return ['error' => true, 'code' => 'token_absent', 'message' => ['Token is missing']];
         }
     } else {
         return ['error' => true, 'code' => 'token_absent', 'message' => ['Token is missing']];
     }
     return $next($request);
 }
Example #9
0
            $admin_locale = Config::get('app.admin_default_locale');
        }
    }
}
$language = null;
$admin_language = null;
if (!App::runningInConsole()) {
    $language = \Neonbug\Common\Models\Language::getByLocale($locale);
    if ($language == null) {
        exit('Language not found');
    }
    $admin_language = $admin_locale == $locale ? $language : \Neonbug\Common\Models\Language::getByLocale($admin_locale);
    if ($admin_language == null) {
        exit('Language not found');
    }
}
App::singleton('Language', function () use($language) {
    return $language;
});
App::singleton('AdminLanguage', function () use($admin_language) {
    return $admin_language;
});
App::singleton('LanguageRepository', '\\Neonbug\\Common\\Repositories\\LanguageRepository');
//frontend
Route::group(['middleware' => ['online']], function () use($locale) {
    Route::get('/', 'HomeController@index');
    //special route without locale prefix
    Route::group(['prefix' => $locale], function () {
        Route::get('/', 'HomeController@index');
    });
});
Example #10
0
        });
    });
    post('upload/file', 'FileController@uploadFile');
    get('download/{id}', 'FileController@getDownload');
    Route::resource('project', 'ProjectController');
    Route::resource('clients', 'ClientController');
    Route::resource('role', 'RoleController');
});
App::bind('App\\Services\\Interfaces\\SendMailInterface', 'App\\Services\\SESSendMail');
/* Routes for desktop and mobile apps */
Route::group(['prefix' => 'rest'], function () {
    post('get-timeentries-by-uid', 'RestController@getTimeEntryByUid');
    post('auth', 'RestController@login');
    get('projects', 'RestController@getProjectList');
    get('tags', 'RestController@getTags');
    post('timesheet/save', 'RestController@save');
    post('timesheet/delete', 'RestController@deleteTimeEntry');
    post('timesheet/sync-timesheets', 'RestController@syncTimesheets');
});
/************************************  OAUTH  ***********************************************/
/* Routes for oauth */
post('oauth/token', 'Auth\\OAuthController@getOAuthToken');
//oauth singleton object
App::singleton('oauth2', function () {
    $storage = new OAuth2\Storage\Pdo(array('dsn' => 'mysql:dbname=' . env('DB_DATABASE') . ';host=' . env('DB_HOST'), 'username' => env('DB_USERNAME'), 'password' => env('DB_PASSWORD')));
    $server = new OAuth2\Server($storage, array('access_lifetime' => env('ACCESS_TOKEN_LIFETIME')));
    $server->addGrantType(new OAuth2\GrantType\ClientCredentials($storage));
    $server->addGrantType(new App\Http\Controllers\Auth\DesktopAppGrantType($storage));
    $server->addGrantType(new OAuth2\GrantType\RefreshToken($storage, ['always_issue_new_refresh_token' => true]));
    return $server;
});
Example #11
0
|
*/
App::down(function () {
    return Response::make("Be right back!", 503);
});
/*
|--------------------------------------------------------------------------
| 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.
|
*/
App::singleton('bugsnag', function () {
    $bugsnag = new Bugsnag_Client(Config::get('app.bugsnag_api_key'));
    $bugsnag->setReleaseStage(App::environment());
    return $bugsnag;
});
App::error(function ($exception) {
    App::make('bugsnag')->notifyException($exception, null, "error");
});
App::fatal(function ($exception) {
    App::make('bugsnag')->notifyException($exception, null, "error");
});
App::make('bugsnag')->setUser(['email' => Auth::check() ? Auth::user()->email : 'Guest user']);
App::make('bugsnag')->setBeforeNotifyFunction(function ($error) {
    $error->setMetaData(["user" => ["username" => Auth::check() ? Auth::user()->username : 'Guest user'], "metrics" => ["Metric 1" => "Some data here"]]);
});
require app_path() . '/filters.php';
Example #12
0
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
class Mailer
{
}
class RegisterUsers
{
    protected $mailer;
    public function __construct(Mailer $mailer)
    {
        $this->mailer = $mailer;
    }
    public function setMailer(Mailer $mailer)
    {
        $this->mailer = $mailer;
    }
}
App::bind('foo', function () {
    return new RegisterUsers(new Mailer());
});
App::singleton('bar', function () {
    return new RegisterUsers(new Mailer());
});
$one = app('bar');
$two = app('bar');
var_dump($one, $two);
Route::get('/', function (RegisterUsers $sth) {
    return view('welcome');
});
Example #13
0
<?php

/*
|--------------------------------------------------------------------------
| 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::singleton('customURL', function () {
        //$customURL = 'http://kalugdanresort.com/public/';
        $customURL = '/';
        return $customURL;
    });
    // If you use this line of code then it'll be available in any view
    // as $site_settings but you may also use app('site_settings') as well
    View::share('customURL', app('customURL'));
});
App::after(function ($request, $response) {
    //
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
 /**
  * Register bindings in the container.
  *
  * @return void
  */
 public function register()
 {
     \App::singleton('actingModel', function () {
         return new \App\Facades\ActingModel();
     });
 }
Example #15
0
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
App::singleton('oauth2', function () {
    $storage = new OAuth2\Storage\Pdo(array('dsn' => 'mysql:dbname=insantani;host=localhost', 'username' => 'root', 'password' => ''));
    $server = new OAuth2\Server($storage);
    $server->addGrantType(new OAuth2\GrantType\ClientCredentials($storage));
    $server->addGrantType(new OAuth2\GrantType\UserCredentials($storage));
    $server->addGrantType(new OAuth2\GrantType\RefreshToken($storage));
    $server->setScopeUtil(new OAuth2\Scope(array('supported_scopes' => array('read', 'write'))));
    return $server;
});
Route::get('/', function () {
    return view('welcome');
});
Route::get('api/products', ['uses' => 'ProductController@products', 'middleware' => 'products']);
Route::get('api/products/{id}', array('uses' => 'ProductController@productDetail', 'middleware' => 'products'))->where('id', '[0-9]+');
Route::get('api/products/{id}/picture', array('uses' => 'ProductController@showPicture', 'middleware' => 'products'))->where('id', '[0-9]+');
Route::get('api/feed', ['uses' => 'ArticleController@articles', 'middleware' => 'articles']);
Route::get('api/search/product/{query}', array('uses' => 'SearchController@searchProduct', 'middleware' => 'products'))->where('query', '.+');
Route::get('api/search/tag/{query}', array('uses' => 'SearchController@searchTags', 'middleware' => 'articles'))->where('query', '.+');
Route::get('api/feed/article/{id}', array('uses' => 'ArticleController@articleDetail', 'middleware' => 'articles'))->where('id', '[0-9]+');
Route::get('api/feed/article/{id}/picture', array('uses' => 'ArticleController@showPicture', 'middleware' => 'articles'))->where('id', '[0-9]+');
Example #16
0
 /**
  * 单例模式实例化一个Model对象
  */
 public static function model($table_name)
 {
     if (!$table_name) {
         return false;
     }
     $model_name = ucfirst(strtolower($table_name)) . 'Model';
     return App::singleton($model_name);
 }
Example #17
0
<?php

// Put this in a service provider
App::singleton('Pusher', function ($app) {
    $keys = $app['config']->get('services.pusher');
    return new Pusher($keys['public'], $keys['secret'], $keys['app_id']);
});
/**
 * The home page
 */
Route::get('/', function () {
    return View::make('home');
});
/**
 * This test route will trigger the server event.
 */
Route::any('test', function () {
    App::make('Pusher')->trigger('demo', 'PostWasPublished', ['title' => 'My Great New Post']);
    // Do Whataver
    return 'Done';
});
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     \App::singleton('\\Hoteru\\Core', function ($app) {
         return new \Hoteru\Core();
     });
 }
Example #19
0
 /**
  * Overloading __tostring()
  * @return string
  */
 public function __toString()
 {
     return App::singleton()->__toString();
 }
Example #20
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) {
    $access = Config::get('paperwork.access');
    $requestServerName = Request::server("SERVER_NAME");
    $zones = array('external', 'internal');
    App::singleton('paperworkSession', function () {
        $app = new stdClass();
        $app->currentZone = null;
        return $app;
    });
    $paperworkSession = App::make('paperworkSession');
    foreach ($zones as $zone) {
        if (array_key_exists($zone, $access) && is_array($access[$zone]) && array_key_exists('dns', $access[$zone]) && $access[$zone]['dns'] == $requestServerName) {
            if (array_key_exists('ports', $access[$zone]) && is_array($access[$zone]['ports']) && array_key_exists('forceHttps', $access[$zone]['ports'])) {
                if ($access[$zone]['ports']['forceHttps'] === true && !Request::secure()) {
                    return Redirect::secure(Request::path());
                }
            }
            $paperworkSession->currentZone = $zone;
        }
    }
    View::share('paperworkSession', $paperworkSession);
});
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
App::singleton('oauth2', function () {
    $storage = new OAuth2\Storage\Pdo(array('dsn' => 'mysql:dbname=oauth2;host=localhost', 'username' => 'root', 'password' => 'root'));
    $server = new OAuth2\Server($storage);
    $server->addGrantType(new OAuth2\GrantType\ClientCredentials($storage));
    $server->addGrantType(new OAuth2\GrantType\UserCredentials($storage));
    return $server;
});
Route::get('/', function () {
    return View::make('hello');
});
Route::post('oauth/token', function () {
    $bridgedRequest = OAuth2\HttpFoundationBridge\Request::createFromRequest(Request::instance());
    $bridgedResponse = new OAuth2\HttpFoundationBridge\Response();
    $bridgedResponse = App::make('oauth2')->handleTokenRequest($bridgedRequest, $bridgedResponse);
    return $bridgedResponse;
});
Route::get('private', function () {
    $bridgedRequest = OAuth2\HttpFoundationBridge\Request::createFromRequest(Request::instance());
    $bridgedResponse = new OAuth2\HttpFoundationBridge\Response();
<?php

use JsLocalization\CachingService;
use JsLocalization\Helper;
App::singleton('JsLocalizationHelper', function () {
    return new Helper();
});
App::singleton('JsLocalizationCachingService', function () {
    return new CachingService();
});
Example #23
0
| 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);
        } else {
            return Redirect::guest('login');
        }
    }
    $user = Auth::user();
    View::share('user', $user);
    App::singleton('user', function ($app) use($user) {
        return $user;
    });
});
Route::filter('auth.basic', function () {
    return Auth::basic();
});
/*
|--------------------------------------------------------------------------
| Guest Filter
|--------------------------------------------------------------------------
|
| The "guest" filter is the counterpart of the authentication filters as
| it simply checks that the current user is not logged in. A redirect
| response will be issued if they are, which you may freely change.
|
*/
Example #24
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
App::singleton('oauth2', function () {
    $storage = new OAuth2\Storage\Mongo(App::make('db')->getMongoDB());
    $server = new OAuth2\Server($storage);
    $server->addGrantType(new OAuth2\GrantType\ClientCredentials($storage));
    return $server;
});
Route::get('/', function () {
    if (Auth::check()) {
        $site = \Site::first();
        $admin_dashboard = new \app\locker\data\dashboards\AdminDashboard();
        //if super admin, show site dashboard, otherwise show list of LRSs can access
        if (Auth::user()->role == 'super') {
            $list = Lrs::all();
            return View::make('partials.site.dashboard', array('site' => $site, 'list' => $list, 'stats' => $admin_dashboard->getFullStats(), 'graph_data' => $admin_dashboard->getGraphData(), 'dash_nav' => true));
        } else {
            $lrs = Lrs::where('users._id', \Auth::user()->_id)->get();
            return View::make('partials.lrs.list', array('lrs' => $lrs, 'list' => $lrs, 'site' => $site));
        }
    } else {
Example #25
0
    $_SERVER['REMOTE_ADDR'] = isset($_SERVER['HTTP_CF_CONNECTING_IP']) ? $_SERVER['HTTP_CF_CONNECTING_IP'] : $_SERVER['REMOTE_ADDR'];
} else {
    $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
}
App::singleton('bfadmincp', function () {
    $app = new stdClass();
    $app->isLoggedIn = Auth::check();
    $app->user = null;
    if ($app->isLoggedIn) {
        $app->user = Auth::user();
        App::setLocale($app->user->setting->lang);
    }
    return $app;
});
App::singleton('geo', function () {
    return App::make('BFACP\\Repositories\\GeoRepository');
});
App::singleton('guzzle', function () {
    return App::make('GuzzleHttp\\Client');
});
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
Example #26
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::singleton('organization', function () {
        $organization = Organization::where('name', 'Arquinova')->get()->first();
        $organization->auxName = str_replace(" ", '-', $organization->name);
        foreach ($organization->projects as $project) {
            $project->auxName = str_replace(" ", '-', $project->name);
            $project->auxName = stripAccents($project->auxName);
        }
        return $organization;
    });
    App::bind('foo', function ($app) {
        return new FooBar();
    });
    View::share('organization', app('organization'));
});
/**
 * Replace accents 
 **/
function stripAccents($str)
{
    return strtr(utf8_decode($str), utf8_decode('àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ'), 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY');
Example #27
0
            return Response::configurationError("Oops! The database cant be read!", "Database Connection error");
        } else {
            return Response::configurationError("Oops! The database is not configured properly!", "Database Configuration error");
        }
    }
});
App::before(function ($request) {
    //dd($request->getPathInfo() == route(Config::get('app-installer::routeName'), [], false));
    App::singleton('siteConfig', function () {
        //Loading config
        $config = array(0);
        try {
            $configRows = SiteConfig::all();
        } catch (Exception $e) {
            //Config cant be read! DB cant be accessed or Installation not completed
            //return Response::configurationError("Please complete installation and check again.", "Installation incomplete!");
            return false;
        }
        foreach ($configRows as $row) {
            $config[$row->name] = (array) json_decode($row->value, true);
        }
        return $config;
    });
    $config = app('siteConfig');
    //If config is empty, skip the rest
    if (!$config) {
        return;
    }
    Config::set('siteConfig', $config);
    $language = new Languages($config['languages']['languages'], 'en');
    //Activate Language set in DB
Example #28
0
Route::group(array('before' => 'auth'), function () {
    Route::match(array('get', 'post'), 'create', array('as' => 'createList', 'uses' => 'ListController@createEdit'));
    Route::match(array('get', 'post'), 'edit', array('as' => 'editList', 'uses' => 'ListController@createEdit'));
    Route::post('create/publish', array('as' => 'publishList', 'uses' => 'ListController@publishList'));
    Route::post('create/upload-image', array('as' => 'listUploadImage', 'uses' => 'ListController@uploadImage'));
    Route::get('preview-list', array('as' => 'previewList', 'uses' => 'ListController@previewList'));
    //My profile
    Route::get('me', array('as' => 'myProfile', 'uses' => 'UserController@myProfile'));
    Route::match(array('get', 'post'), 'me/settings', array('as' => 'myProfileSettings', 'uses' => 'UserController@myProfileSettings'));
});
Route::get('pages/{nameString}.html', array('as' => 'viewPage', 'uses' => 'PageController@viewPage'));
Route::get('category/{slug}', array('as' => 'category', 'uses' => 'ListController@category'));
$admin = Session::get('admin');
View::share('loggedInAdmin', $admin);
App::singleton('loggedInAdmin', function () use($admin) {
    return $admin;
});
Route::filter('adminAuth', function () {
    $admin = Session::get('admin');
    //Populate view with common data for admins
    AdminBaseController::populateView();
    /*if (!$admin && !Input::get('logmein'))
      {
          return Response::notFound();
      } else */
    if (!$admin) {
        if (Request::ajax()) {
            return Response::make('You have been logged out or your session has expired. Please login on another tab and try again.<br><br><a target="_blank" href="' . route('adminLogin') . '" class="btn btn-success">Login again</a></a>', 400);
        } else {
            return Redirect::route('adminLogin', ['redirect' => urlencode(Request::path())]);
        }
Example #29
0
	App::singleton('itemconfig', function($app) use ($modelName)
	{
		$configFactory = App::make('admin_config_factory');
		return $configFactory->make($modelName, true);
	});
});

//validate_settings filter
Route::filter('validate_settings', function($route, $request)
{
	$settingsName = $route->getParameter('settings');

	App::singleton('itemconfig', function($app) use ($settingsName)
	{
		$configFactory = App::make('admin_config_factory');
		return $configFactory->make($configFactory->getSettingsPrefix() . $settingsName, true);
	});
});

Route::filter('post_validate', function($route, $request)
{
	$config = App::make('itemconfig');

	//if the model doesn't exist at all, redirect to 404
	if (!$config)
	{
		App::abort(404, 'Page not found');
	}

	//check the permission
Example #30
0
<?php

/**
 * This file contains bindings for IoC container / View
 */
use Ciconia\Ciconia;
use Ciconia\Extension\Gfm;
App::singleton('Ciconia\\Ciconia', function () {
    $markdown = new Ciconia();
    $markdown->addExtension(new Gfm\FencedCodeBlockExtension());
    $markdown->addExtension(new Gfm\TaskListExtension());
    $markdown->addExtension(new Gfm\InlineStyleExtension());
    $markdown->addExtension(new Gfm\WhiteSpaceExtension());
    $markdown->addExtension(new Gfm\TableExtension());
    $markdown->addExtension(new Gfm\UrlAutoLinkExtension());
    return $markdown;
});
View::share('categories', Config::get('site.postCategories'));