| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | require_once IPB_PATH . 'sources/ipsclass.php'; |
|---|
| 32 | |
|---|
| 33 | class ezipsclass extends ipsclass { |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | function init_db_connection() { |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | $this->vars['sql_driver'] = ! $this->vars['sql_driver'] ? 'mysql' : strtolower($this->vars['sql_driver']); |
|---|
| 45 | |
|---|
| 46 | if ( ! class_exists( 'db_main' ) ) { |
|---|
| 47 | require_once( KERNEL_PATH.'class_db.php' ); |
|---|
| 48 | if ( $this->ezipbIni->variable( "ezipb", "USE_UNIQUE_CONNECTION" ) == "enabled" ) |
|---|
| 49 | require_once eZExtension::baseDirectory() . '/ezipb/classes/sql/ezipb_db_'.$this->vars['sql_driver'].".php"; |
|---|
| 50 | else |
|---|
| 51 | require_once( KERNEL_PATH.'class_db_'.$this->vars['sql_driver'].".php" ); |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | $classname = "db_driver_".$this->vars['sql_driver']; |
|---|
| 55 | if ( $this->ezipbIni->variable( "ezipb", "USE_UNIQUE_CONNECTION" ) == "enabled" ) |
|---|
| 56 | $classname = "ezipb_" . $classname; |
|---|
| 57 | |
|---|
| 58 | $this->DB = new $classname; |
|---|
| 59 | |
|---|
| 60 | $this->DB->obj['sql_database'] = $this->vars['sql_database']; |
|---|
| 61 | $this->DB->obj['sql_user'] = $this->vars['sql_user']; |
|---|
| 62 | $this->DB->obj['sql_pass'] = $this->vars['sql_pass']; |
|---|
| 63 | $this->DB->obj['sql_host'] = $this->vars['sql_host']; |
|---|
| 64 | $this->DB->obj['sql_tbl_prefix'] = $this->vars['sql_tbl_prefix']; |
|---|
| 65 | $this->DB->obj['force_new_connection'] = isset($this->vars['sql_force_new_connection']) ? $this->vars['sql_force_new_connection'] : 0; |
|---|
| 66 | $this->DB->obj['use_shutdown'] = USE_SHUTDOWN; |
|---|
| 67 | |
|---|
| 68 | $this->DB->obj['use_error_log'] = 0; |
|---|
| 69 | |
|---|
| 70 | $this->DB->obj['use_debug_log'] = 0; |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | if ( defined( 'IPB_LOAD_SQL' ) ) |
|---|
| 75 | $this->DB->obj['query_cache_file'] = ROOT_PATH.'sources/sql/'.$this->vars['sql_driver'].'_'. IPB_LOAD_SQL .'.php'; |
|---|
| 76 | else if ( IPB_THIS_SCRIPT == 'admin' ) |
|---|
| 77 | $this->DB->obj['query_cache_file'] = ROOT_PATH.'sources/sql/'.$this->vars['sql_driver'].'_admin_queries.php'; |
|---|
| 78 | else |
|---|
| 79 | $this->DB->obj['query_cache_file'] = ROOT_PATH.'sources/sql/'.$this->vars['sql_driver'].'_queries.php'; |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | if ( is_array( $this->DB->connect_vars ) and count( $this->DB->connect_vars ) ) { |
|---|
| 83 | foreach( $this->DB->connect_vars as $k => $v ) { |
|---|
| 84 | $this->DB->connect_vars[ $k ] = isset($this->vars[ $k ]) ? $this->vars[ $k ] : ''; |
|---|
| 85 | } |
|---|
| 86 | } |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | if ( !isset($this->DB->connect_vars['mysql_tbl_type']) OR !$this->DB->connect_vars['mysql_tbl_type'] ) |
|---|
| 90 | $this->DB->connect_vars['mysql_tbl_type'] = 'myisam'; |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | define( 'SQL_PREFIX' , $this->DB->obj['sql_tbl_prefix'] ); |
|---|
| 94 | define( 'SQL_DRIVER' , $this->vars['sql_driver'] ); |
|---|
| 95 | define( 'IPS_MAIN_DB_CLASS_LOADED', TRUE ); |
|---|
| 96 | |
|---|
| 97 | |
|---|
| 98 | $this->DB->connect(); |
|---|
| 99 | |
|---|
| 100 | |
|---|
| 101 | if ( ! defined( 'IPSCLASS_DB_LOADED' ) ) |
|---|
| 102 | define( 'IPSCLASS_DB_LOADED', 1 ); |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | unset( $classname ); |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | } |
|---|
| 109 | |
|---|
| 110 | } |
|---|
| 111 | |
|---|
| 112 | ?> |
|---|