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() { 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)); }
/** * @var $cnd * @return \GTFrameworkTest\config\cdn * @throws \Exception */ public function getCDN() { $this->___cdn = \GTFramework\App::getInstance()->getConfig()->cdn; if (!is_array($this->___cdn) && !count($this->___cdn['cdn']) < 4) { throw new \Exception('Problem to read CDN config file', 500); } return $this->___cdn; }
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 getDefaultMethod() { LOG < 2 ?: $this->logger->log('getDefaultMethod in FrontController started'); if ($this->bundle != NULL && $this->bundle != '*') { if (isset($this->routes[$this->bundle])) { if (isset($this->routes[$this->bundle]['default_method'])) { return strtolower(trim($this->routes[$this->bundle]['default_method'])); } else { throw new \Exception('Default method must be provided in routes for the ' . $this->bundle . ' bundle', 500); } } else { if (isset($this->routes[ucfirst($this->bundle)]['default_method'])) { return strtolower(trim($this->routes[ucfirst($this->bundle)]['default_method'])); } else { throw new \Exception('Default method must be provided in routes for the ' . $this->bundle . ' bundle', 500); } } } $method = \GTFramework\App::getInstance()->getConfig()->app['default_method']; if (trim($method)) { return strtolower($method); } return 'index'; }
<?php $startTime = microtime(true); include '../../GTFramework/App.php'; $app = \GTFramework\App::getInstance(); $app->run(); echo '<br />'; $endTime = microtime(true); $elapsed = $endTime - $startTime;