public function __construct($dbName = null, $dbConnection = null, $tableName = 'sessions', $sessionName = '__sess', $lifetime = 3600, $path = null, $domain = null, $secure = false, $httpOnly = TRUE)
 {
     $this->dbName = $dbName;
     parent::__construct($dbConnection);
     $this->tableName = $tableName;
     $this->sessionName = $sessionName;
     $this->lifetime = $lifetime;
     $this->path = $path;
     $this->domain = $domain;
     $this->secure = $secure;
     $this->httpOnly = $httpOnly;
     $this->logger = \GTFramework\App::getLogger();
     LOG < 0 ?: $this->logger->log('__construct in DBSession called with params: ' . 'dbName: ' . $dbName . ', dbConnection = ' . $dbConnection . ', tableName = ' . $tableName . ', sessionName = ' . $sessionName . ', lifetime = ' . $lifetime . ', path = ' . $path . ', domain = ' . $domain . ', secure = ' . $secure . ', httpOnly = ' . $httpOnly);
     if (rand(0, 100) === 52) {
         //            echo '<pre>' . print_r('------------------CLEAR-----CLEAR----CLEAR-------------', TRUE) . '</pre><br />';
         $this->dbClearOldSessions();
     }
     if (isset($_COOKIE[$sessionName])) {
         $this->sessionId = $_COOKIE[$sessionName];
     }
     if (strlen($this->sessionId) < 32) {
         LOG < 2 ?: $this->logger->log('__construct in DBSession check strlen of sessionId < 32 : ( ' . strlen($this->sessionId) . ' )');
         $this->startNewSession();
     } else {
         if (!$this->validateSession()) {
             LOG < 2 ?: $this->logger->log('__construct in DBSession validate session');
             $this->startNewSession();
         }
     }
 }
 /**
  * 
  * @return \Models
  */
 public static function getInstance()
 {
     if (self::$_instance == null) {
         self::$_instance = new \GTFramework\BaseModel(\GTFramework\App::getLoger());
     }
     return self::$_instance;
 }
Exemple #3
0
 public function setLogGlobal()
 {
     if ($this->loggingLevel === NULL) {
         if (isset(\GTFramework\App::getInstance()->getConfig()->app['default_logging'])) {
             $this->loggingLevel = \GTFramework\App::getInstance()->getConfig()->app['default_logging'];
         }
     }
     define('LOG', $this->loggingLevel);
 }
 public function __construct()
 {
     parent::__construct();
     $dbCfg = \GTFramework\App::getInstance()->getConfig()->db;
     $this->dbName = $dbCfg['Administration']['dbName'];
     $this->dbTable = $dbCfg['Administration']['dbTable'];
     $this->dbRoles = $dbCfg['Administration']['col']['Roles'];
     $this->userLevel = $dbCfg['Administration']['col']['UserLevel'];
 }
 public function __construct($name = null, $lifetime = 3600, $path = null, $domain = null, $secure = false, $httponly = TRUE)
 {
     if (strlen($name) < 1) {
         $name = '_sess';
     }
     $this->logger = \GTFramework\App::getLogger();
     LOG < 2 ?: $this->logger->log('__construct in NativeSession created with params: name: ' . $name . ' lifetime: ' . $lifetime . ' path: ' . $path . ' domain: ' . $domain . ' secure: ' . $secure . ' httpOnly: ' . $httponly);
     session_name($name);
     session_set_cookie_params($lifetime, $path, $domain, $secure, $httponly);
     session_start();
     $_COOKIE['__sess'] = session_id();
 }
 public function __construct()
 {
     parent::__construct();
     $dbCfg = \GTFramework\App::getInstance()->getConfig()->db;
     $this->dbName = $dbCfg['Users']['dbName'];
     $this->dbTable = $dbCfg['Users']['dbTable'];
     $this->username = $dbCfg['Users']['col']['UserName'];
     $this->email = $dbCfg['Users']['col']['Email'];
     $this->firstName = $dbCfg['Users']['col']['FirstName'];
     $this->lastName = $dbCfg['Users']['col']['LastName'];
     $this->password = $dbCfg['Users']['col']['Password'];
     $this->createdOn = $dbCfg['Users']['col']['CreatedOn'];
     $this->lastLoged = $dbCfg['Users']['col']['LastLoged'];
     $this->sessionId = $dbCfg['Users']['col']['SessionId'];
     $this->isDeleted = $dbCfg['Users']['col']['IsDeleted'];
 }
 public function __construct($connection = NULL)
 {
     if ($connection instanceof \PDO) {
         $this->db = $connection;
     } else {
         if ($connection != NULL) {
             $this->db = \GTFramework\App::getInstance()->getConnectionToDB($connection);
             $this->connection = $connection;
         } else {
             $this->db = \GTFramework\App::getInstance()->getConnectionToDB($this->connection);
         }
     }
     if (!$this->logger) {
         $this->logger = \GTFramework\App::getLogger();
     }
     LOG < 0 ?: $this->logger->log('__constructor in SimpleDB called with param: ' . print_r($connection, TRUE));
 }
Exemple #8
0
 /**
  * 
  * @return \GTFramework\View
  */
 public static function getInstance()
 {
     if (self::$_instance == NULL) {
         self::$_instance = new \GTFramework\View(\GTFramework\App::getLogger());
     }
     return self::$_instance;
 }
Exemple #9
0
 public function __construct()
 {
     $this->content = \GTFramework\View::getInstance()->getCDN();
     $this->logger = \GTFramework\App::getLogger();
 }
Exemple #10
0
 public function run()
 {
     self::$logger->setLogGlobal();
     LOG < 0 ?: self::$logger->log('run method in App started.');
     $this->_frontController = \GTFramework\FrontController::getInstance();
     LOG < 2 ?: self::$logger->log('getInstance in App to FrontController called');
     $this->appConfig = \GTFramework\App::getInstance()->getConfig()->app;
     LOG < 2 ?: self::$logger->log('getConfig method in App called with app param.');
     if (isset($this->appConfig['default_router']) && $this->appConfig['default_router']) {
         if (!$this->router) {
             $this->router = '\\GTFramework\\Routers\\' . $this->appConfig['default_router'];
         } else {
             $this->router = '\\GTFramework\\Routers\\' . $this->router;
         }
         $this->_frontController->setRouter(new $this->router());
         LOG < 2 ?: self::$logger->log('Router in App set to: ' . $this->router);
     } else {
         LOG < 1 ?: self::$logger->log('Created exeption in App because of missing default_router key in app config', 1);
         throw new \Exception('Default Router is not set', 500);
     }
     $_sess = $this->appConfig['session'];
     LOG < 0 ?: self::$logger->log('run in App retrieved session configuration: ' . print_r($_sess, TRUE));
     if ($_sess['autostart'] === true) {
         if ($_sess['type'] === 'native') {
             $_s = new \GTFramework\Sessions\NativeSession($_sess['name'], $_sess['lifetime'], $_sess['path'], $_sess['domain'], $_sess['secure'], $_sess['HttpOnly']);
             LOG < 0 ?: self::$logger->log('run in App created session of type: ' . $_sess['type'] . ' with: ' . print_r($_sess, TRUE));
         } else {
             if ($_sess['type'] === 'database') {
                 $_s = new \GTFramework\Sessions\DBSession($_sess['dbName'], $_sess['dbConnection'], $_sess['dbTable'], $_sess['name'], $_sess['lifetime'], $_sess['path'], $_sess['domain'], $_sess['secure'], $_sess['HttpOnly']);
                 LOG < 0 ?: self::$logger->log('run in App created session of type ' . $_sess['type'] . ' with: ' . print_r($_sess, TRUE));
             } else {
                 throw new \Exception('Received invalid session type: ' . $_sess['type'], 500);
             }
         }
         //            var_dump($_s);
         $this->setSession($_s);
     }
     LOG < 1 ?: self::$logger->log('run in App called dispatch method in FrontController');
     $this->_frontController->processReguest();
 }
 public function __construct($class)
 {
     $this->logger = \GTFramework\App::getLogger();
     $this->reflection = new \ReflectionClass($class);
 }
 /**
  * 
  * @return \GTFramework\FrontController
  */
 public static function getInstance()
 {
     if (self::$_instance == null) {
         self::$_instance = new \GTFramework\FrontController(\GTFramework\App::getLogger());
     }
     return self::$_instance;
 }
Exemple #13
0
<?php

$startTime = microtime(true);
include '../../GTFramework/App.php';
$app = \GTFramework\App::getInstance();
$app->run();
echo '<br />';
$endTime = microtime(true);
$elapsed = $endTime - $startTime;