Example #1
0
 public function __construct()
 {
     $_session = Config::getInstance()->get('session');
     if ($_session['autostart']) {
         if ($_session['type'] == 'native') {
             $_s = new NativeSession($_session['name'], $_session['lifetime'], $_session['path'], $_session['domain'], $_session['secure']);
         } else {
             if ($_session['type'] == 'database') {
                 $_s = new DBSession($_session['dbConnection'], $_session['name'], $_session['dbTable'], $_session['lifetime'], $_session['path'], $_session['domain'], $_session['secure']);
             } else {
                 throw new \Exception('No valid session', 500);
             }
         }
         $this->setSession($_s);
     }
 }
Example #2
0
 public function getDBConnection($connection = 'default')
 {
     if (!$connection) {
         throw new \Exception('No connection identifier provided', 500);
     }
     if ($this->_dbConnections[$connection]) {
         return $this->_dbConnections[$connection];
     }
     $_cnf = Config::getInstance()->get("database.{$connection}");
     if (!$_cnf) {
         throw new \Exception('No valid connection ID is provided', 500);
     }
     $dbh = new \PDO($_cnf['connection_uri'], $_cnf['username'], $_cnf['password'], $_cnf['pdo_options']);
     $this->_dbConnections[$connection] = $dbh;
     return $dbh;
 }
Example #3
0
 public static function setConfigFolder($folder)
 {
     return \SSFrame\Config::getInstance()->setConfigFolder($folder);
 }
Example #4
0
function config($param)
{
    return \SSFrame\Config::getInstance()->get($param);
}