Exemplo n.º 1
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) {
    Commoner::observe();
    //change the hash so no malware uses it
    Config::set('cms.installation_hash', '');
    $addonsNotInstalled = $addonsInstalled = $themesNotInstalled = $themesInstalled = array();
    $addons = Addons::all();
    $themes = Themes::all();
    foreach ($addons as $addon) {
        if ($addon->installed == 1) {
            ClassLoader::addDirectories(array(public_path() . "/addons/{$addon->addon_name}/controllers", public_path() . "/addons/{$addon->addon_name}/models", public_path() . "/addons/{$addon->addon_name}/helpers"));
        }
    }
    foreach ($themes as $theme) {
        if ($theme->installed == 1) {
            $themesInstalled[] = $theme->theme_name;
            if ($theme->active == 1) {
                Config::set('cms.theme', $theme->theme_name);
                //include the functions file
                include_once public_path() . "/layouts/frontend/{$theme->theme_name}/func.php";
            }
        } else {