public function __construct()
 {
     $this->load = CL_Loader::get_instance();
     $this->config = CL_Config::get_instance();
     $this->out = CL_Output::get_instance();
     $this->session = CL_Session::get_instance();
 }
Example #2
0
 /**
  * @return CL_Config
  */
 public static function get_instance()
 {
     if (self::$instance === NULL) {
         self::$instance = new CL_Config();
     }
     return self::$instance;
 }
Example #3
0
 public function __construct()
 {
     require_once BASEPATH . 'application/libraries/solr/Apache/Solr/Service.php';
     $config = CL_Config::get_instance()->get_config('solr');
     $host = $config['host'];
     $port = $config['port'];
     $path = $config['path'];
     $this->solr = new Apache_Solr_Service($host, $port, $path);
 }
Example #4
0
 /**
  * @return CL_MySQLi
  */
 public static function get_instance()
 {
     if (self::$instance === null) {
         $config = CL_Config::get_instance();
         $host = $config->get_value('database', 'host');
         $user = $config->get_value('database', 'user');
         $password = $config->get_value('database', 'password');
         $database = $config->get_value('database', 'database');
         self::$instance = new CL_MySQLi($host, $user, $password, $database);
     }
     return self::$instance;
 }
Example #5
0
 private static function establish()
 {
     require_once BASEPATH . 'application/libraries/phpmailer/class.phpmailer.php';
     $config = CL_Config::get_instance();
     $mail = new PHPMailer();
     $mail->isSMTP();
     $mail->Mailer = $config->get_value('mail', 'mailer');
     $mail->Host = $config->get_value('mail', 'host');
     $mail->Port = $config->get_value('mail', 'port');
     $mail->SMTPAuth = $config->get_value('mail', 'smtpauth');
     $mail->Username = $config->get_value('mail', 'username');
     $mail->Password = $config->get_value('mail', 'password');
     return $mail;
 }
Example #6
0
 public function __construct($type)
 {
     if (!in_array($type, ['pgsql', 'mysql'])) {
         throw new Exception("Database type " . $type . " is not supported.");
     }
     $config = CL_Config::get_instance();
     // Retrieve mysql config
     $host = $config->get_value('database', "{$type}_host");
     $user = $config->get_value('database', "{$type}_user");
     $password = $config->get_value('database', "{$type}_password");
     $database = $config->get_value('database', "{$type}_database");
     $dbalConfig = new \Doctrine\DBAL\Configuration();
     $connParams = array('dbname' => $database, 'user' => $user, 'password' => $password, 'host' => $host, 'driver' => "pdo_{$type}");
     $this->conn = \Doctrine\DBAL\DriverManager::getConnection($connParams, $dbalConfig);
 }
Example #7
0
 public function __construct()
 {
     $config = CL_Config::get_instance();
     // Retrieve mysql config
     $host = $config->get_value('database', 'mysql_host');
     $user = $config->get_value('database', 'mysql_user');
     $password = $config->get_value('database', 'mysql_password');
     $database = $config->get_value('database', 'mysql_database');
     // Connect to db through mysqli
     $this->db = new mysqli($host, $user, $password, $database);
     // Hardcoded utf8 charset
     $this->db->set_charset('utf8');
     // Initialise fragment builder
     $this->qb = new CL_MySQL_QueryBuilder($this);
 }
Example #8
0
 public function __construct()
 {
     $config = CL_Config::get_instance();
     // Retrieve Mongo config
     $host = $config->get_value('database', 'mongo_server');
     $port = $config->get_value('database', 'mongo_port');
     $user = $config->get_value('database', 'mongo_user');
     $password = $config->get_value('database', 'mongo_password');
     $database = $config->get_value('database', 'mongo_database');
     // Build connection URI
     $uri = 'mongodb://';
     $uri .= $user !== NULL ? $user . ':' . $password . '@' : '';
     $uri .= $host !== NULL ? $host : 'localhost';
     $uri .= $port !== NULL ? ':' . $port : '';
     // Connect to Mongo
     try {
         $this->mongo = new MongoClient($uri);
     } catch (MongoConnectionException $e) {
         error($e->getMessage());
     }
     // Create database shortcut
     $this->db = $this->mongo->{$database};
 }
Example #9
0
/**
 * Config helpe functions
 */
function get_config_value($file, $key)
{
    return CL_Config::get_instance()->get_value($file, $key);
}
Example #10
0
 private function CL_MySQL()
 {
     $this->config = CL_Config::get_instance();
     $this->connection = NULL;
 }
 private function __construct()
 {
     $this->config = CL_Config::get_instance();
     $this->uri = CL_URI::get_instance();
 }
Example #12
0
 private function CL_URI()
 {
     $this->config = CL_Config::get_instance();
     $this->fetch_uri_string();
     $this->parse_uri_segments();
 }