Example #1
0
 public function __construct($view, $seringue)
 {
     $this->view = $view;
     $this->seringue = $seringue;
     $this->page = $this->seringue->page;
     $this->log = $this->seringue->log_nano;
     $this->dispatcher = Dispatcher::get_instance();
     $this->request = Request::get_instance();
     $this->response = Response::get_instance();
     $this->route = Route::get_instance();
     $this->flash = Utilities\Flash::get_instance();
     $this->security = Security::get_instance();
     $this->_init();
 }
Example #2
0
 public function __construct()
 {
     // Required because some times Doctrine and more generally spl_autoload_register()
     // doesn't work when used with an opcode cache (APC)
     register_shutdown_function("session_write_close");
     session_start();
     $this->container = Seringue::get_instance();
     $this->container->page = new Utilities\Page($GLOBALS['env']['environment'] == "production" ? false : true);
     $this->route = Route::get_instance();
     $this->request = Request::get_instance();
     $this->response = Response::get_instance();
     $this->log = $this->container->log_nano;
     $this->i18n = Utilities\I18N::get_instance();
     $this->set_view_engine($this->container->configuration['view']['engine']);
     $this->cache = new Cache\Cache(new Cache\File(DIR_CACHE));
     $this->get_cache_config();
     $this->security = Security::get_instance();
 }
Example #3
0
 public function __construct()
 {
     if ($uri = get_query_var('yare_uri')) {
         $args = get_query_var('yare_args');
         pc($args, 'yare_args');
         $pattern = array_get($args, 'pattern');
         $route = array_get($args, 'route');
         if (preg_match("#^{$pattern}#i", $uri, $params)) {
             array_shift($params);
         }
         $request = Request::get_instance();
         $request->setRoutes($params);
         $map = array();
         foreach ($params as $key => $value) {
             if (is_string($key)) {
                 $map["{{$key}}"] = $this->camel_case($value);
             }
         }
         $search = array_keys($map);
         $replace = array_values($map);
         $this->model = str_replace($search, $replace, array_get($args, 'model'));
         $this->mapKeys = array($uri, $route, $this->model);
     } else {
         foreach ($this->conditional as $conditional) {
             if (!function_exists($conditional)) {
                 continue;
             }
             if (call_user_func($conditional) and method_exists($this, $conditional)) {
                 if ($this->model = $this->{$conditional}()) {
                     break;
                 }
             }
         }
     }
     if (!$this->model) {
         $this->model = 'Index';
         array_push($this->mapKeys, 'Index');
     }
 }
Example #4
0
$session = Session::get_instance();
/****************************
** Site 
****************************/
$site = Site::get_instance($session);
/****************************
** Base de données géré par l'ORM Doctrine
****************************/
require_once 'lib/Doctrine/Doctrine.php';
spl_autoload_register(array('Doctrine_Core', 'autoload'));
$dsn = 'mysql://' . DB_USER . ':' . DB_PASS . '@' . DB_HOST . '/' . BASE;
$db = Doctrine_Manager::connection($dsn);
/****************************
** Wrapper Request
****************************/
$request = Request::get_instance();
/****************************
** Wrapper de config  
****************************/
$config = array('db' => $db, 'tpl' => $tpl, 'session' => $session, 'req' => $request, 'site' => $site);
/****************************
** Chargement du frontController et du module 
****************************/
$moteur = new FrontController($config);
$moteur->load_content($tpl);
/****************************
** Chargement des blocs statiques sur la page
****************************/
$dir = opendir(BLOCS);
$blocs = array();
while (false !== ($entry = readdir($dir))) {