summaryrefslogtreecommitdiffstats
path: root/system/database/DB.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-26 12:58:12 +0200
committerAndrey Andreev <narf@bofh.bg>2012-03-26 12:58:12 +0200
commitbb2e518754e703be095df9d8fd7cb3d82a5d3bbe (patch)
treeab2ed2e5e9b9d4ef66fb30cb221c43a8ef693cdc /system/database/DB.php
parent0336dc228c84695ec75fc8dccedac354d1556de9 (diff)
parente684bdac2d6282e3b9a5c57e1006d5ed1664f647 (diff)
Merge upstream branch
Diffstat (limited to 'system/database/DB.php')
-rwxr-xr-xsystem/database/DB.php24
1 files changed, 12 insertions, 12 deletions
diff --git a/system/database/DB.php b/system/database/DB.php
index 116116bf4..96e495515 100755
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -37,11 +37,11 @@
function &DB($params = '', $active_record_override = NULL)
{
// Load the DB config file if a DSN string wasn't passed
- if (is_string($params) AND strpos($params, '://') === FALSE)
+ if (is_string($params) && strpos($params, '://') === FALSE)
{
// Is the config file in the environment folder?
if (( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/database.php'))
- AND ! file_exists($file_path = APPPATH.'config/database.php'))
+ && ! file_exists($file_path = APPPATH.'config/database.php'))
{
show_error('The configuration file database.php does not exist.');
}
@@ -74,24 +74,24 @@ function &DB($params = '', $active_record_override = NULL)
* parameter. DSNs must have this prototype:
* $dsn = 'driver://username:password@hostname/database';
*/
- if (($dns = @parse_url($params)) === FALSE)
+ if (($dsn = @parse_url($params)) === FALSE)
{
show_error('Invalid DB Connection String');
}
$params = array(
- 'dbdriver' => $dns['scheme'],
- 'hostname' => (isset($dns['host'])) ? rawurldecode($dns['host']) : '',
- 'port' => (isset($dns['port'])) ? rawurldecode($dns['port']) : '',
- 'username' => (isset($dns['user'])) ? rawurldecode($dns['user']) : '',
- 'password' => (isset($dns['pass'])) ? rawurldecode($dns['pass']) : '',
- 'database' => (isset($dns['path'])) ? rawurldecode(substr($dns['path'], 1)) : ''
+ 'dbdriver' => $dsn['scheme'],
+ 'hostname' => isset($dsn['host']) ? rawurldecode($dsn['host']) : '',
+ 'port' => isset($dsn['port']) ? rawurldecode($dsn['port']) : '',
+ 'username' => isset($dsn['user']) ? rawurldecode($dsn['user']) : '',
+ 'password' => isset($dsn['pass']) ? rawurldecode($dsn['pass']) : '',
+ 'database' => isset($dsn['path']) ? rawurldecode(substr($dsn['path'], 1)) : ''
);
// were additional config items set?
- if (isset($dns['query']))
+ if (isset($dsn['query']))
{
- parse_str($dns['query'], $extra);
+ parse_str($dsn['query'], $extra);
foreach ($extra as $key => $val)
{
// booleans please
@@ -158,4 +158,4 @@ function &DB($params = '', $active_record_override = NULL)
}
/* End of file DB.php */
-/* Location: ./system/database/DB.php */
+/* Location: ./system/database/DB.php */ \ No newline at end of file