Ejemplo n.º 1
0
 /**
  * 
  * Initializes configs for the APP to run
  */
 public static function initialize()
 {
     /**
      * Load all the configs from DB
      */
     //Change the default cache system, based on your config /config/cache.php
     Cache::$default = Core::config('cache.default');
     //is not loaded yet in Kohana::$config
     Kohana::$config->attach(new ConfigDB(), FALSE);
     //overwrite default Kohana init configs.
     Kohana::$base_url = Core::config('general.base_url');
     //enables friendly url @todo from config
     Kohana::$index_file = FALSE;
     //cookie salt for the app
     Cookie::$salt = Core::config('auth.cookie_salt');
     /* if (empty(Cookie::$salt)) {
     			// @TODO missing cookie salt : add warning message
     		} */
     // -- i18n Configuration and initialization -----------------------------------------
     I18n::initialize(Core::config('i18n.locale'), Core::config('i18n.charset'));
     //Loading the OC Routes
     // if (($init_routes = Kohana::find_file('config','routes')))
     // 	require_once $init_routes[0];//returns array of files but we need only 1 file
     //faster loading
     require_once APPPATH . 'config/routes.php';
     //getting the selected theme, and loading options
     Theme::initialize();
 }
Ejemplo n.º 2
0
 /**
  * 
  * Initializes configs for the APP to run
  */
 public static function initialize()
 {
     //enables friendly url
     Kohana::$index_file = FALSE;
     //temporary cookie salt in case of exception
     Cookie::$salt = 'cookie_oc_temp';
     //Change the default cache system, based on your config /config/cache.php
     Cache::$default = Core::config('cache.default');
     //loading configs from table config
     //is not loaded yet in Kohana::$config
     Kohana::$config->attach(new ConfigDB(), FALSE);
     //overwrite default Kohana init configs.
     Kohana::$base_url = Core::config('general.base_url');
     //cookie salt for the app
     Cookie::$salt = Core::config('auth.cookie_salt');
     // i18n Configuration and initialization
     I18n::initialize(Core::config('i18n.locale'), Core::config('i18n.charset'));
     //Loading the OC Routes
     require_once APPPATH . 'config/routes.php';
     //getting the selected theme, and loading options
     Theme::initialize();
     //run crontab
     if (core::config('general.cron') == TRUE) {
         Cron::run();
     }
 }
Ejemplo n.º 3
0
 public function doCommand()
 {
     $path = $this->param('path', '');
     $settings = $this->param('settings', NULL);
     $register = $this->param('register', NULL);
     if (is_null($settings)) {
         $settings = array();
     }
     // Since Context is an object, it will be a valid reference
     // to the context for the duration of the request. The only exception
     // would be if one (manually) switched requests without throwing an
     // interrupt.
     Theme::initialize($path, $settings, $this->context);
     if (!empty($register)) {
         foreach ($register as $klass) {
             Theme::register($klass);
         }
     }
     return TRUE;
 }
Ejemplo n.º 4
0
 /**
  *
  * Contruct that checks you are loged in before nothing else happens!
  */
 function __construct(Request $request, Response $response)
 {
     // Assign the request to the controller
     $this->request = $request;
     // Assign a response to the controller
     $this->response = $response;
     //login control, don't do it for auth controller so we dont loop
     if ($this->request->controller() != 'auth') {
         $url_bread = Route::url('oc-panel', array('controller' => 'home'));
         Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Panel'))->set_url($url_bread));
         //check if user is login
         if (!Auth::instance()->logged_in($request->controller(), $request->action(), $request->directory())) {
             Alert::set(Alert::ERROR, sprintf(__('You do not have permissions to access %s'), $request->controller() . ' ' . $request->action()));
             $url = Route::get('oc-panel')->uri(array('controller' => 'auth', 'action' => 'login'));
             $this->redirect($url);
         }
         //in case we are loading another theme since we use the allow query we force the configs of the selected theme
         if (Theme::$theme != Core::config('appearance.theme') and Core::config('appearance.allow_query_theme') == '1') {
             Theme::initialize(Core::config('appearance.theme'));
         }
     }
     //the user was loged in and with the right permissions
     parent::__construct($request, $response);
 }
 /**
  *
  * Contruct that checks you are loged in before nothing else happens!
  */
 function __construct(Request $request, Response $response)
 {
     //the user was loged in and with the right permissions
     parent::__construct($request, $response);
     // Assign the request to the controller
     $this->request = $request;
     // Assign a response to the controller
     $this->response = $response;
     //login control, don't do it for auth controller so we dont loop
     if ($this->request->controller() != 'auth') {
         $url_bread = Route::url('oc-panel', array('controller' => 'profile', 'action' => 'public'));
         Breadcrumbs::add(Breadcrumb::factory()->set_title(__('My Profile'))->set_url($url_bread));
         //check if user is login
         if (!Auth::instance()->logged_in($request->controller(), $request->action(), $request->directory())) {
             Alert::set(Alert::ERROR, __('You do not have permissions to access ' . $request->controller() . ' ' . $request->action()));
             $url = Route::url('oc-panel', array('controller' => 'auth', 'action' => 'login'));
             $this->redirect($url);
         }
         // Force configured theme in case mobile theme is selected
         if (Theme::$is_mobile) {
             Theme::initialize(Core::config('appearance.theme'));
         }
     }
 }