|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* m'Manager | Invoices Management System |
|
4
|
|
|
* |
|
5
|
|
|
* This content is released under the Proprietary License (Proprietary) |
|
6
|
|
|
* |
|
7
|
|
|
* Copyright (c) 2017, Eric Claver AKAFFOU - All Rights Reserved |
|
8
|
|
|
* Unauthorized copying of this file, via any medium is strictly prohibited |
|
9
|
|
|
* Proprietary and confidential |
|
10
|
|
|
* |
|
11
|
|
|
* @package m'Manager |
|
12
|
|
|
* @author Eric Claver AKAFFOU |
|
13
|
|
|
* @copyright Copyright (c) 2017, on'Eric Computing, Inc. (https://www.onericcomputing.com/) |
|
14
|
|
|
* @license https://www.mmanager.fr Proprietary License |
|
15
|
|
|
* @link https://codecanyon.net/item/mmanager-invoices-management-system/19866435?s_rank=1 |
|
16
|
|
|
* @since Version 1.0.0 |
|
17
|
|
|
* @filesource |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
namespace Mmanager\Extensions\Database; |
|
21
|
|
|
use Mmanager\Extensions\Database\ezSQL_mysqli; |
|
22
|
|
|
|
|
23
|
|
|
class Builder { |
|
24
|
|
|
protected $cms; |
|
25
|
|
|
protected $db; |
|
26
|
|
|
public function __construct($cms = null) { |
|
27
|
|
|
$this->cms = isset($cms) ? $cms : 'app'; |
|
28
|
|
|
$this->db = $this->__connect(); |
|
29
|
|
|
} |
|
30
|
|
|
public function getConfig() { |
|
31
|
|
|
return include dirname(dirname(__DIR__)).'/Config/'.$this->cms.'.config.php'; |
|
32
|
|
|
} |
|
33
|
|
|
private function __connect() { |
|
34
|
|
|
$config = $this->getConfig(); |
|
35
|
|
|
if ( ! $config) { |
|
36
|
|
|
return false; |
|
37
|
|
|
} else { |
|
38
|
|
|
$username = $config['db']['username']; |
|
39
|
|
|
$dbpassword = $config['db']['password']; |
|
40
|
|
|
$dbname = $config['db']['database']; |
|
41
|
|
|
$host = $config['db']['host']; |
|
42
|
|
|
$charset = $config['db']['charset']; |
|
43
|
|
|
|
|
44
|
|
|
return new ezSQL_mysqli($username, $dbpassword, $dbname, $host, $charset); |
|
45
|
|
|
} |
|
46
|
|
|
} |
|
47
|
|
|
public function getDB() { |
|
48
|
|
|
return $this->db; |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
|