Skip to content
Snippets Groups Projects
Select Git revision
  • 38e4e1ea49c7fda44b988982d0693af70a1662fb
  • main default protected
2 results

manual-git.install

Blame
  • class.AddressDB.php 908 B
    <?php
    
    class AddressDB {
      private static $instance;
      private $PDB;
      private $database = 'NyAdresser';
     
      private function __construct() {
        global $gCms;
        if (!isset($gCms)) exit;
        $config =& $gCms->GetConfig();
        $this->PDB = ADONewConnection($config['dbms'],
                                      'pear:date:extend:transaction');
        $result = $this->PDB->Connect($config['db_hostname'],
                                      $config['db_username'],
                                      $config['db_password'],
                                      $this->database);
        if ($result) {
          $result = $this->PDB->Execute("SET NAMES 'utf8'");
        } else {
          echo "Database error!<br>" . $this->PDB->ErrorMsg();
          exit;
        }
      }
    
      public static function getDB() {
        if (!isset(self::$instance)) {
          $c = __CLASS__;
          self::$instance = new $c;
        }
        return self::$instance->PDB;
      }
    }