Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final class DatabaseManager{
- private $hostname;
- private $username;
- private $password;
- private $database;
- private $active_record = "true";
- private $active_group = "default";
- private $dbdriver = "mysqli";
- private $dbprefix = "";
- private $pconnect = false;
- private $db_debug = true;
- private $cache_on = TRUE;
- private $cachedir = "";
- private $char_set = "latin1";
- private $dbcollat = "latin1_swedish_ci";
- private $cipher;
- private static $instance;
- protected function __construct($hostname,$username,$database){
- $this->setCipher(Cipher::getInstance());
- $this->setHostname($hostname);
- $this->setUsername($username);
- $this->setDatabase($database);
- }
- public static function initDatabase($hostname = null,$username = null,$database = null,$force_load = false){
- if(self::$instance === null OR $force_load == true){
- self::$instance = new self($hostname,$username,$database);
- }
- return self::$instance;
- }
- public function &exportConfigCI(){
- //$config = get_object_vars($this); it don't return by ref
- $config_ci = array();
- //foreach($config as $i=>$c){
- // $config_ci[$this->getActiveGroup()][$i] = $c;
- //}
- $config_ci[$this->getActiveGroup()]['username'] = &$this->getUsername();
- $config_ci[$this->getActiveGroup()]['password'] = &$this->getPassword();
- //the same to all attribs
- return $config_ci;
- }
- public function &getUsername(){
- return $this->username;
- }
- public function &getPassword(){
- return $this->password;
- }
- //the same to all gets
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement