<?php

class BaseController extends Controller {

    public function __construct() {

        /*if (App::environment() == 'staging') {
            $a = base64_decode(substr($_SERVER["REMOTE_USER"], 6));
            if ((strlen($a) == 0) || ( strcasecmp($a, ":") == 0 )) {
                header('WWW-Authenticate: Basic realm="EDP Live Bands Staging"');
                header('HTTP/1.0 401 Unauthorized');
                echo 'Unauthorized';
                exit;
            } else {
                list($name, $password) = explode(':', $a);
                if ($name !== 'edplb_staging' || $password !== 'IZ-KOD-2ZKj2') {
                    header('WWW-Authenticate: Basic realm="EDP Live Bands Staging"');
                    header('HTTP/1.0 401 Unauthorized');
                    echo 'Wrong username or password';
                    exit;
                }
            }
        }
        */



        $this->beforeFilter('@prepare');
    }

    public function prepare() {
        Asset::enqueue('main.css');
        Asset::enqueue('main.js');

        $body_class[] = Route::currentRouteName();
        View::share('body_class', implode(' ', $body_class));

        View::share('environment', App::environment());
    }

}
