Example #1
0
 public function connect()
 {
     $dsn = 'sqlsrv:Server=' . $this->_server;
     if (!empty($this->_port)) {
         $dsn .= ', ' . $this->_port;
     }
     $dsn .= '; Database=' . $this->_database;
     parent::__construct($dsn, $this->_username, $this->_password, $this->_driver_options);
     $this->_connected = true;
 }
Example #2
0
 public function connect()
 {
     $dsn = 'mysql:dbname=' . $this->_database . ';host=' . $this->_server;
     if (!empty($this->_port)) {
         $dsn .= ';port=' . $this->_port;
     }
     $this->_connected = true;
     $dbh = parent::__construct($dsn, $this->_username, $this->_password, $this->_driver_options);
     if ($this->_has_native_fk === false) {
         $this->setupForeignKeys();
     }
     return $dbh;
 }
Example #3
0
 public static function initialize()
 {
     if (strlen(DB_SERVER) < 1) {
         osc_redirect(OSCOM::getLink('Setup'));
     }
     Registry::set('MessageStack', new MessageStack());
     Registry::set('Cache', new Cache());
     Registry::set('Database', Database::initialize());
     Registry::set('PDO', DatabasePDO::initialize());
     $Qcfg = Registry::get('Database')->query('select configuration_key as cfgKey, configuration_value as cfgValue from :table_configuration');
     $Qcfg->setCache('configuration');
     $Qcfg->execute();
     while ($Qcfg->next()) {
         define($Qcfg->value('cfgKey'), $Qcfg->value('cfgValue'));
     }
     $Qcfg->freeResult();
     Registry::set('Service', new Service());
     Registry::get('Service')->start();
     Registry::set('Template', new Template());
     $application = 'osCommerce\\OM\\Core\\Site\\Shop\\Application\\' . OSCOM::getSiteApplication() . '\\Controller';
     Registry::set('Application', new $application());
     Registry::get('Template')->setApplication(Registry::get('Application'));
 }
Example #4
0
 public static function initialize()
 {
     if (strlen(DB_SERVER) < 1) {
         osc_redirect(OSCOM::getLink('Setup'));
     }
     Registry::set('MessageStack', new MessageStack());
     Registry::set('Cache', new Cache());
     Registry::set('Database', Database::initialize());
     Registry::set('PDO', DatabasePDO::initialize());
     foreach (OSCOM::callDB('Admin\\GetConfiguration', null, 'Site') as $param) {
         define($param['cfgKey'], $param['cfgValue']);
     }
     Registry::set('Session', Session::load('adminSid'));
     Registry::get('Session')->start();
     Registry::get('MessageStack')->loadFromSession();
     Registry::set('Language', new Language());
     if (!self::hasAccess(OSCOM::getSiteApplication())) {
         Registry::get('MessageStack')->add('header', 'No access.', 'error');
         osc_redirect_admin(OSCOM::getLink(null, OSCOM::getDefaultSiteApplication()));
     }
     $application = 'osCommerce\\OM\\Core\\Site\\Admin\\Application\\' . OSCOM::getSiteApplication() . '\\Controller';
     Registry::set('Application', new $application());
     Registry::set('Template', new Template());
     Registry::get('Template')->setApplication(Registry::get('Application'));
     // HPDL move following checks elsewhere
     // check if a default currency is set
     if (!defined('DEFAULT_CURRENCY')) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_error_no_default_currency'), 'error');
     }
     // check if a default language is set
     if (!defined('DEFAULT_LANGUAGE')) {
         Registry::get('MessageStack')->add('header', ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
     }
     if (function_exists('ini_get') && (bool) ini_get('file_uploads') == false) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_warning_uploads_disabled'), 'warning');
     }
 }
Example #5
0
 public static function connect()
 {
     self::$_dbh = DatabasePDO::initialize(OSCOM::BASE_DIRECTORY . 'Work/Database/errors.sqlite3', null, null, null, null, 'SQLite3');
     self::$_dbh->exec('create table if not exists error_log ( timestamp int, message text );');
 }
Example #6
0
 public function connect()
 {
     $dsn = 'sqlite:' . $this->_server;
     $this->_connected = true;
     return parent::__construct($dsn, $this->_username, $this->_password, $this->_driver_options);
 }