Exemplo n.º 1
0
 function __construct($ctn)
 {
     // get pebug
     $this->pebug = pebug::Instance();
     $this->pebug->log("model::__construct()");
     // container itself
     $this->ctn = $ctn;
     // database connector
     $this->db = $ctn['db'];
     // database connector
     $this->request = $ctn['request'];
     // session module
     $this->mem = $ctn['session'];
     // cache module
     $this->cache = $ctn['cache'];
     // dummy data
     $data = array();
 }
Exemplo n.º 2
0
 public function __construct($ctn)
 {
     // get pebug
     $this->pebug = pebug::Instance();
     $this->pebug->log("database::__construct()");
     // does use database at all
     $this->has = true;
     if ($ctn['config']['database']['nodatabase']) {
         $this->has = false;
     } else {
         // prepare connection
         $host = $ctn['config']['database']['host'];
         if (empty($host)) {
             $this->pebug->error("database::__construct(): No DB-Hostname set ");
         }
         $name = $ctn['config']['database']['name'];
         if (empty($host)) {
             $this->pebug->error("database::__construct(): No DB-Name set ");
         }
         $port = $ctn['config']['database']['port'];
         if (empty($host)) {
             $this->pebug->error("database::__construct(): No DB-Port set ");
         }
         $user = $ctn['config']['database']['user'];
         if (empty($host)) {
             $this->pebug->error("database::__construct(): No DB-User set ");
         }
         $pass = $ctn['config']['database']['pass'];
         if (empty($host)) {
             $this->pebug->error("database::__construct(): No DB-Pass set ");
         }
         $cfg = "mysql:host={$host};port={$port};dbname={$name}";
         $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'");
         try {
             parent::__construct($cfg, $user, $pass, $options);
             //overwrites debug?
         } catch (PDOException $e) {
             $this->pebug->error("database::__construct({$cfg}, {$user}, {$pass}): cant connect: " . $e->getMessage());
         }
     }
 }
Exemplo n.º 3
0
 function __construct($ctn)
 {
     parent::__construct();
     // smarty parents business
     // get pebug
     $this->pebug = pebug::Instance();
     $this->pebug->log("smarty_i18n::__construct()");
     // ctn itself
     $this->ctn = $ctn;
     // session module
     $this->mem = $ctn['session'];
     // smarty basic setup
     $base = $this->ctn['pathApp'];
     $temp = $this->ctn['config']['path']['temp'];
     $view = $this->ctn['config']['path']['view'];
     $this->setTemplateDir($base . $view);
     $this->setCompileDir($base . $temp . 'smarty_compiled');
     $this->setConfigDir($base . $temp . 'smarty_config');
     $this->setCacheDir($base . $temp . 'smarty_cache');
     // smarty internal settings
     $this->caching = Smarty::CACHING_OFF;
     //		$this->force_compile = false;
 }
Exemplo n.º 4
0
<?php

// get the locations right
$lib = realpath(dirname(__FILE__));
$app = realpath(dirname($_SERVER["SCRIPT_FILENAME"]) . '/..');
// autoload
define('startTime', microtime(true));
require $lib . '/app/globals.php';
require $lib . '/vendor/autoload.php';
$pebug = \Pedetes\pebug::Instance();
$pebug->init(startTime);
// create injection container
$ctn = new Pimple\Container();
// injected paths
$ctn["pathLib"] = $lib . '/';
$ctn["pathApp"] = $app . '/';
// injected helper
$ctn['session'] = $ctn->factory(function ($ctn) {
    return new Pedetes\session($ctn);
});
$ctn['db'] = $ctn->factory(function ($ctn) {
    return new Pedetes\database($ctn);
});
$ctn['request'] = $ctn->factory(function ($ctn) {
    return new Pedetes\request($ctn);
});
$ctn['cache'] = $ctn->factory(function ($ctn) {
    return new Pedetes\cache($ctn);
});
// start up the app
$app = new Pedetes\bootstrap($ctn);