Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once(DIR_LIB . "ChaveHash/Cipher.php");
- /**
- * DatabaseManager Class
- *
- * Manage and exports the db attributes
- *
- * @author Hugo Carvalho
- * @category Database
- * @since 21-09-2015
- */
- 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){
- if(self::$instance === null){
- self::$instance = new self($hostname,$username,$database);
- }
- return self::$instance;
- }
- public function &exportConfigCI(){
- $config = get_object_vars($this);
- $config_ci = array();
- foreach($config as $i=>$c){
- $config_ci[$this->getActiveGroup()][$i] = $c;
- }
- unset($config_ci[$this->getActiveGroup()]['active_record']);
- unset($config_ci[$this->getActiveGroup()]['active_group']);
- return $config_ci;
- }
- /**
- * Gets and sets for all attributes
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement