示例#1
0
 public function populateDb()
 {
     $config = (require "/../config/cms.php");
     extract($config);
     //addons
     //laracms
     $addon = new Addons();
     $addon->addon_name = 'laracms';
     $addon->addon_title = 'Core System Addon';
     $addon->icon_image = 'http://laravel.com/assets/img/logo-head.png';
     $addon->version = '1.0.1';
     $addon->author = 'bonweb';
     $addon->url = 'http://www.bonweb.gr';
     $addon->installed = 1;
     $addon->save();
     ClassLoader::addDirectories(array(public_path() . "/addons/laracms/controllers", public_path() . "/addons/laracms/models", public_path() . "/addons/laracms/helpers"));
     //add the screensaver setting
     $setting = new Settings();
     $setting->area = 'backend';
     $setting->section = 'laracms';
     $setting->setting_name = 'screensaver';
     $setting->setting_value = '60000';
     $setting->autoload = 1;
     $setting->save();
     //grid manager
     $addon = new Addons();
     $addon->addon_name = 'grid_manager';
     $addon->addon_title = 'Grid Manager';
     $addon->icon_image = 'http://laravel.com/assets/img/logo-head.png';
     $addon->version = '1.0.1';
     $addon->author = 'bonweb';
     $addon->url = 'http://www.bonweb.gr';
     $addon->installed = 1;
     $addon->save();
     ClassLoader::addDirectories(array(public_path() . "/addons/grid_manager/controllers", public_path() . "/addons/grid_manager/models", public_path() . "/addons/grid_manager/helpers"));
     require_once public_path() . "/addons/grid_manager/func.php";
     Event::fire('backend.addons.saveaddoninfo.grid_manager', array($addon));
     //themes
     $theme = new Themes();
     $theme->theme_name = 'lara';
     $theme->theme_title = 'LaraCMS Default Theme';
     $theme->icon_image = 'http://laravel.com/assets/img/logo-head.png';
     $theme->version = '1.0.1';
     $theme->author = 'bonweb';
     $theme->url = 'http://www.bonweb.gr';
     $theme->installed = 1;
     $theme->active = 1;
     $theme->save();
     //users
     $user = new User();
     $user->firstname = 'John';
     $user->lastname = 'Doe';
     $user->email = $config['admin_email'];
     $user->is_admin = '1';
     $pass = Commoner::generatePass('administrator', $config['admin_email']);
     $user->password = Hash::make($pass);
     $user->save();
     $this->info('Your Password is:' . $pass);
     //add the languages
     $lang = new Languages();
     $lang->code = 'en_US';
     $lang->title = 'English';
     $lang->image = "/uploads/flags/Englang.png";
     $lang->active = 1;
     $lang->save();
     $lang = new Languages();
     $lang->code = 'el_GR';
     $lang->title = 'Greek';
     $lang->image = "/uploads/flags/Greece.png";
     $lang->active = 1;
     $lang->save();
 }
示例#2
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) {
    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";
示例#3
0
 static function observe()
 {
     App::missing(function ($exception) {
         return View::make('common.errors.404', array(), 404);
     });
     App::error(function ($e, $code) {
         switch ($code) {
             case 403:
                 Commoner::informAdmin(array('text' => $e->getMessage()));
                 return Response::view('common.errors.403', array(), 403);
             case 404:
                 return Response::view('common.errors.404', array(), 404);
             case 500:
                 $message = explode(' ', $e->getMessage());
                 $dbCode = rtrim($message[1], ']');
                 $dbCode = trim($dbCode, '[');
                 // codes specific to MySQL
                 switch ($dbCode) {
                     case 1049:
                         //not installed or error in config
                         if (isset($_GET['hash'])) {
                             $installer = new Installer();
                             return $installer->doInstall($_GET['hash'], $message);
                         } else {
                             return View::make('installation/install');
                         }
                         break;
                     case 2002:
                         Commoner::informAdmin(array('text' => 'Database server seems to be down'));
                         return View::make('installation/dbdown')->withMessage($message);
                         break;
                     default:
                         //no specific error...
                         if (Config::get('cms.laradebug')) {
                             return;
                         }
                         Commoner::informAdmin(array('text' => $e->getMessage()));
                         return View::make('installation/unknown')->withMessage($message);
                         break;
                 }
                 break;
         }
     });
     // end of App::error
 }