@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | class CI_DB_utility extends CI_DB_forge { |
26 | 26 | |
27 | 27 | var $db; |
28 | - var $data_cache = array(); |
|
28 | + var $data_cache = array(); |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Constructor |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | function __construct() |
37 | 37 | { |
38 | 38 | // Assign the main database object to $this->db |
39 | - $CI =& get_instance(); |
|
40 | - $this->db =& $CI->db; |
|
39 | + $CI = & get_instance(); |
|
40 | + $this->db = & $CI->db; |
|
41 | 41 | |
42 | 42 | log_message('debug', "Database Utility Class Initialized"); |
43 | 43 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | extract($params); |
261 | 261 | |
262 | 262 | // Load the xml helper |
263 | - $CI =& get_instance(); |
|
263 | + $CI = & get_instance(); |
|
264 | 264 | $CI->load->helper('xml'); |
265 | 265 | |
266 | 266 | // Generate the result |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | // Is the encoder supported? If not, we'll either issue an |
346 | 346 | // error or use plain text depending on the debug settings |
347 | 347 | if (($prefs['format'] == 'gzip' AND ! @function_exists('gzencode')) |
348 | - OR ($prefs['format'] == 'zip' AND ! @function_exists('gzcompress'))) |
|
348 | + OR ($prefs['format'] == 'zip' AND ! @function_exists('gzcompress'))) |
|
349 | 349 | { |
350 | 350 | if ($this->db->db_debug) |
351 | 351 | { |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | |
400 | 400 | // Load the Zip class and output it |
401 | 401 | |
402 | - $CI =& get_instance(); |
|
402 | + $CI = & get_instance(); |
|
403 | 403 | $CI->load->library('zip'); |
404 | 404 | $CI->zip->add_data($prefs['filename'], $this->_backup($prefs)); |
405 | 405 | return $CI->zip->get_zip(); |
@@ -40,16 +40,16 @@ discard block |
||
40 | 40 | var $dbcollat = 'utf8_general_ci'; |
41 | 41 | var $autoinit = TRUE; // Whether to automatically initialize the DB |
42 | 42 | var $swap_pre = ''; |
43 | - var $port = ''; |
|
43 | + var $port = ''; |
|
44 | 44 | var $pconnect = FALSE; |
45 | - var $conn_id = FALSE; |
|
45 | + var $conn_id = FALSE; |
|
46 | 46 | var $result_id = FALSE; |
47 | 47 | var $db_debug = FALSE; |
48 | 48 | var $benchmark = 0; |
49 | 49 | var $query_count = 0; |
50 | 50 | var $bind_marker = '?'; |
51 | - var $save_queries = TRUE; |
|
52 | - var $queries = array(); |
|
51 | + var $save_queries = TRUE; |
|
52 | + var $queries = array(); |
|
53 | 53 | var $query_times = array(); |
54 | 54 | var $data_cache = array(); |
55 | 55 | var $trans_enabled = TRUE; |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | var $CACHE; // The cache class object |
63 | 63 | |
64 | 64 | // Private variables |
65 | - var $_protect_identifiers = TRUE; |
|
66 | - var $_reserved_identifiers = array('*'); // Identifiers that should NOT be escaped |
|
65 | + var $_protect_identifiers = TRUE; |
|
66 | + var $_reserved_identifiers = array('*'); // Identifiers that should NOT be escaped |
|
67 | 67 | |
68 | 68 | // These are use with Oracle |
69 | 69 | var $stmt_id; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | } |
261 | 261 | |
262 | 262 | // Verify table prefix and replace if necessary |
263 | - if ( ($this->dbprefix != '' AND $this->swap_pre != '') AND ($this->dbprefix != $this->swap_pre) ) |
|
263 | + if (($this->dbprefix != '' AND $this->swap_pre != '') AND ($this->dbprefix != $this->swap_pre)) |
|
264 | 264 | { |
265 | 265 | $sql = preg_replace("/(\W)".$this->swap_pre."(\S+?)/", "\\1".$this->dbprefix."\\2", $sql); |
266 | 266 | } |
@@ -369,21 +369,21 @@ discard block |
||
369 | 369 | |
370 | 370 | // Load and instantiate the result driver |
371 | 371 | |
372 | - $driver = $this->load_rdriver(); |
|
373 | - $RES = new $driver(); |
|
374 | - $RES->conn_id = $this->conn_id; |
|
375 | - $RES->result_id = $this->result_id; |
|
372 | + $driver = $this->load_rdriver(); |
|
373 | + $RES = new $driver(); |
|
374 | + $RES->conn_id = $this->conn_id; |
|
375 | + $RES->result_id = $this->result_id; |
|
376 | 376 | |
377 | 377 | if ($this->dbdriver == 'oci8') |
378 | 378 | { |
379 | 379 | $RES->stmt_id = $this->stmt_id; |
380 | 380 | $RES->curs_id = NULL; |
381 | - $RES->limit_used = $this->limit_used; |
|
382 | - $this->stmt_id = FALSE; |
|
381 | + $RES->limit_used = $this->limit_used; |
|
382 | + $this->stmt_id = FALSE; |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | // oci8 vars must be set before calling this |
386 | - $RES->num_rows = $RES->num_rows(); |
|
386 | + $RES->num_rows = $RES->num_rows(); |
|
387 | 387 | |
388 | 388 | // Is query caching enabled? If so, we'll serialize the |
389 | 389 | // result object and save it to a cache file. |
@@ -396,13 +396,13 @@ discard block |
||
396 | 396 | // result object, so we'll have to compile the data |
397 | 397 | // and save it) |
398 | 398 | $CR = new CI_DB_result(); |
399 | - $CR->num_rows = $RES->num_rows(); |
|
400 | - $CR->result_object = $RES->result_object(); |
|
401 | - $CR->result_array = $RES->result_array(); |
|
399 | + $CR->num_rows = $RES->num_rows(); |
|
400 | + $CR->result_object = $RES->result_object(); |
|
401 | + $CR->result_array = $RES->result_array(); |
|
402 | 402 | |
403 | 403 | // Reset these since cached objects can not utilize resource IDs. |
404 | - $CR->conn_id = NULL; |
|
405 | - $CR->result_id = NULL; |
|
404 | + $CR->conn_id = NULL; |
|
405 | + $CR->result_id = NULL; |
|
406 | 406 | |
407 | 407 | $this->CACHE->write($sql, $CR); |
408 | 408 | } |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | // The count of bind should be 1 less then the count of segments |
594 | 594 | // If there are more bind arguments trim it down |
595 | 595 | if (count($binds) >= count($segments)) { |
596 | - $binds = array_slice($binds, 0, count($segments)-1); |
|
596 | + $binds = array_slice($binds, 0, count($segments) - 1); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | // Construct the binded query |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | */ |
1156 | 1156 | function display_error($error = '', $swap = '', $native = FALSE) |
1157 | 1157 | { |
1158 | - $LANG =& load_class('Lang', 'core'); |
|
1158 | + $LANG = & load_class('Lang', 'core'); |
|
1159 | 1159 | $LANG->load('db'); |
1160 | 1160 | |
1161 | 1161 | $heading = $LANG->line('db_error_heading'); |
@@ -1187,7 +1187,7 @@ discard block |
||
1187 | 1187 | } |
1188 | 1188 | } |
1189 | 1189 | |
1190 | - $error =& load_class('Exceptions', 'core'); |
|
1190 | + $error = & load_class('Exceptions', 'core'); |
|
1191 | 1191 | echo $error->show_error($heading, $message, 'error_db'); |
1192 | 1192 | exit; |
1193 | 1193 | } |
@@ -1282,7 +1282,7 @@ discard block |
||
1282 | 1282 | // with an alias. While we're at it, we will escape the components |
1283 | 1283 | if (strpos($item, '.') !== FALSE) |
1284 | 1284 | { |
1285 | - $parts = explode('.', $item); |
|
1285 | + $parts = explode('.', $item); |
|
1286 | 1286 | |
1287 | 1287 | // Does the first segment of the exploded item match |
1288 | 1288 | // one of the aliases previously identified? If so, |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | */ |
25 | 25 | class CI_DB_forge { |
26 | 26 | |
27 | - var $fields = array(); |
|
28 | - var $keys = array(); |
|
29 | - var $primary_keys = array(); |
|
30 | - var $db_char_set = ''; |
|
27 | + var $fields = array(); |
|
28 | + var $keys = array(); |
|
29 | + var $primary_keys = array(); |
|
30 | + var $db_char_set = ''; |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Constructor |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | function __construct() |
39 | 39 | { |
40 | 40 | // Assign the main database object to $this->db |
41 | - $CI =& get_instance(); |
|
42 | - $this->db =& $CI->db; |
|
41 | + $CI = & get_instance(); |
|
42 | + $this->db = & $CI->db; |
|
43 | 43 | log_message('debug', "Database Forge Class Initialized"); |
44 | 44 | } |
45 | 45 | |
@@ -371,9 +371,9 @@ discard block |
||
371 | 371 | */ |
372 | 372 | function _reset() |
373 | 373 | { |
374 | - $this->fields = array(); |
|
375 | - $this->keys = array(); |
|
376 | - $this->primary_keys = array(); |
|
374 | + $this->fields = array(); |
|
375 | + $this->keys = array(); |
|
376 | + $this->primary_keys = array(); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | class CI_DB_Cache { |
26 | 26 | |
27 | 27 | var $CI; |
28 | - var $db; // allows passing of db object so that multiple database connections and returned db objects can be supported |
|
28 | + var $db; // allows passing of db object so that multiple database connections and returned db objects can be supported |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Constructor |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | { |
38 | 38 | // Assign the main CI object to $this->CI |
39 | 39 | // and load the file helper since we use it a lot |
40 | - $this->CI =& get_instance(); |
|
41 | - $this->db =& $db; |
|
40 | + $this->CI = & get_instance(); |
|
41 | + $this->db = & $db; |
|
42 | 42 | $this->CI->load->helper('file'); |
43 | 43 | } |
44 | 44 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | // Add a trailing slash to the path if needed |
67 | - $path = preg_replace("/(.+?)\/*$/", "\\1/", $path); |
|
67 | + $path = preg_replace("/(.+?)\/*$/", "\\1/", $path); |
|
68 | 68 | |
69 | 69 | if ( ! is_dir($path) OR ! is_really_writable($path)) |
70 | 70 | { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | { |
163 | 163 | if ($segment_one == '') |
164 | 164 | { |
165 | - $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); |
|
165 | + $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | if ($segment_two == '') |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | */ |
29 | 29 | class CI_DB_result { |
30 | 30 | |
31 | - var $conn_id = NULL; |
|
32 | - var $result_id = NULL; |
|
33 | - var $result_array = array(); |
|
34 | - var $result_object = array(); |
|
35 | - var $custom_result_object = array(); |
|
36 | - var $current_row = 0; |
|
31 | + var $conn_id = NULL; |
|
32 | + var $result_id = NULL; |
|
33 | + var $result_array = array(); |
|
34 | + var $result_object = array(); |
|
35 | + var $custom_result_object = array(); |
|
36 | + var $current_row = 0; |
|
37 | 37 | var $num_rows = 0; |
38 | 38 | var $row_data = NULL; |
39 | 39 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | { |
332 | 332 | return $result; |
333 | 333 | } |
334 | - return $result[count($result) -1]; |
|
334 | + return $result[count($result) - 1]; |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | // -------------------------------------------------------------------- |
@@ -28,26 +28,26 @@ discard block |
||
28 | 28 | */ |
29 | 29 | class CI_DB_active_record extends CI_DB_driver { |
30 | 30 | |
31 | - var $ar_select = array(); |
|
32 | - var $ar_distinct = FALSE; |
|
31 | + var $ar_select = array(); |
|
32 | + var $ar_distinct = FALSE; |
|
33 | 33 | var $ar_from = array(); |
34 | 34 | var $ar_join = array(); |
35 | - var $ar_where = array(); |
|
35 | + var $ar_where = array(); |
|
36 | 36 | var $ar_like = array(); |
37 | - var $ar_groupby = array(); |
|
37 | + var $ar_groupby = array(); |
|
38 | 38 | var $ar_having = array(); |
39 | 39 | var $ar_keys = array(); |
40 | 40 | var $ar_limit = FALSE; |
41 | 41 | var $ar_offset = FALSE; |
42 | 42 | var $ar_order = FALSE; |
43 | 43 | var $ar_orderby = array(); |
44 | - var $ar_set = array(); |
|
44 | + var $ar_set = array(); |
|
45 | 45 | var $ar_wherein = array(); |
46 | - var $ar_aliased_tables = array(); |
|
47 | - var $ar_store_array = array(); |
|
46 | + var $ar_aliased_tables = array(); |
|
47 | + var $ar_store_array = array(); |
|
48 | 48 | |
49 | 49 | // Active Record Caching variables |
50 | - var $ar_caching = FALSE; |
|
50 | + var $ar_caching = FALSE; |
|
51 | 51 | var $ar_cache_exists = array(); |
52 | 52 | var $ar_cache_select = array(); |
53 | 53 | var $ar_cache_from = array(); |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | var $ar_cache_groupby = array(); |
58 | 58 | var $ar_cache_having = array(); |
59 | 59 | var $ar_cache_orderby = array(); |
60 | - var $ar_cache_set = array(); |
|
60 | + var $ar_cache_set = array(); |
|
61 | 61 | |
62 | - var $ar_no_escape = array(); |
|
63 | - var $ar_cache_no_escape = array(); |
|
62 | + var $ar_no_escape = array(); |
|
63 | + var $ar_cache_no_escape = array(); |
|
64 | 64 | |
65 | 65 | // -------------------------------------------------------------------- |
66 | 66 | |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | |
553 | 553 | $prefix = (count($this->ar_where) == 0) ? '' : $type; |
554 | 554 | |
555 | - $where_in = $prefix . $this->_protect_identifiers($key) . $not . " IN (" . implode(", ", $this->ar_wherein) . ") "; |
|
555 | + $where_in = $prefix.$this->_protect_identifiers($key).$not." IN (".implode(", ", $this->ar_wherein).") "; |
|
556 | 556 | |
557 | 557 | $this->ar_where[] = $where_in; |
558 | 558 | if ($this->ar_caching === TRUE) |
@@ -871,11 +871,11 @@ discard block |
||
871 | 871 | */ |
872 | 872 | public function limit($value, $offset = '') |
873 | 873 | { |
874 | - $this->ar_limit = (int) $value; |
|
874 | + $this->ar_limit = (int)$value; |
|
875 | 875 | |
876 | 876 | if ($offset != '') |
877 | 877 | { |
878 | - $this->ar_offset = (int) $offset; |
|
878 | + $this->ar_offset = (int)$offset; |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | return $this; |
@@ -979,7 +979,7 @@ discard block |
||
979 | 979 | $this->from($table); |
980 | 980 | } |
981 | 981 | |
982 | - $sql = $this->_compile_select($this->_count_string . $this->_protect_identifiers('numrows')); |
|
982 | + $sql = $this->_compile_select($this->_count_string.$this->_protect_identifiers('numrows')); |
|
983 | 983 | |
984 | 984 | $query = $this->query($sql); |
985 | 985 | $this->_reset_select(); |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | } |
991 | 991 | |
992 | 992 | $row = $query->row(); |
993 | - return (int) $row->numrows; |
|
993 | + return (int)$row->numrows; |
|
994 | 994 | } |
995 | 995 | |
996 | 996 | // -------------------------------------------------------------------- |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | |
1124 | 1124 | if ($escape === FALSE) |
1125 | 1125 | { |
1126 | - $this->ar_set[] = '('.implode(',', $row).')'; |
|
1126 | + $this->ar_set[] = '('.implode(',', $row).')'; |
|
1127 | 1127 | } |
1128 | 1128 | else |
1129 | 1129 | { |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | $clean[] = $this->escape($value); |
1135 | 1135 | } |
1136 | 1136 | |
1137 | - $this->ar_set[] = '('.implode(',', $clean).')'; |
|
1137 | + $this->ar_set[] = '('.implode(',', $clean).')'; |
|
1138 | 1138 | } |
1139 | 1139 | } |
1140 | 1140 | |
@@ -1942,8 +1942,8 @@ discard block |
||
1942 | 1942 | |
1943 | 1943 | foreach ($this->ar_cache_exists as $val) |
1944 | 1944 | { |
1945 | - $ar_variable = 'ar_'.$val; |
|
1946 | - $ar_cache_var = 'ar_cache_'.$val; |
|
1945 | + $ar_variable = 'ar_'.$val; |
|
1946 | + $ar_cache_var = 'ar_cache_'.$val; |
|
1947 | 1947 | |
1948 | 1948 | if (count($this->$ar_cache_var) == 0) |
1949 | 1949 | { |
@@ -2143,7 +2143,7 @@ discard block |
||
2143 | 2143 | */ |
2144 | 2144 | function _insert_on_duplicate_update_batch($table, $keys, $values) |
2145 | 2145 | { |
2146 | - foreach($keys as $key) |
|
2146 | + foreach ($keys as $key) |
|
2147 | 2147 | $update_fields[] = $key.'=VALUES('.$key.')'; |
2148 | 2148 | |
2149 | 2149 | return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values)." ON DUPLICATE KEY UPDATE ".implode(', ', $update_fields); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $data = ''; |
61 | 61 | if (filesize($file) > 0) |
62 | 62 | { |
63 | - $data =& fread($fp, filesize($file)); |
|
63 | + $data = & fread($fp, filesize($file)); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | flock($fp, LOCK_UN); |
@@ -438,17 +438,17 @@ discard block |
||
438 | 438 | // Owner |
439 | 439 | $symbolic .= (($perms & 0x0100) ? 'r' : '-'); |
440 | 440 | $symbolic .= (($perms & 0x0080) ? 'w' : '-'); |
441 | - $symbolic .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-')); |
|
441 | + $symbolic .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x') : (($perms & 0x0800) ? 'S' : '-')); |
|
442 | 442 | |
443 | 443 | // Group |
444 | 444 | $symbolic .= (($perms & 0x0020) ? 'r' : '-'); |
445 | 445 | $symbolic .= (($perms & 0x0010) ? 'w' : '-'); |
446 | - $symbolic .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-')); |
|
446 | + $symbolic .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x') : (($perms & 0x0400) ? 'S' : '-')); |
|
447 | 447 | |
448 | 448 | // World |
449 | 449 | $symbolic .= (($perms & 0x0004) ? 'r' : '-'); |
450 | 450 | $symbolic .= (($perms & 0x0002) ? 'w' : '-'); |
451 | - $symbolic .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-')); |
|
451 | + $symbolic .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x') : (($perms & 0x0200) ? 'T' : '-')); |
|
452 | 452 | |
453 | 453 | return $symbolic; |
454 | 454 | } |
@@ -46,19 +46,19 @@ |
||
46 | 46 | |
47 | 47 | if ($protect_all === TRUE) |
48 | 48 | { |
49 | - $str = preg_replace("/&(\w+);/", "$temp\\1;", $str); |
|
49 | + $str = preg_replace("/&(\w+);/", "$temp\\1;", $str); |
|
50 | 50 | } |
51 | 51 | |
52 | - $str = str_replace(array("&","<",">","\"", "'", "-"), |
|
52 | + $str = str_replace(array("&", "<", ">", "\"", "'", "-"), |
|
53 | 53 | array("&", "<", ">", """, "'", "-"), |
54 | 54 | $str); |
55 | 55 | |
56 | 56 | // Decode the temp markers back to entities |
57 | - $str = preg_replace("/$temp(\d+);/","&#\\1;",$str); |
|
57 | + $str = preg_replace("/$temp(\d+);/", "&#\\1;", $str); |
|
58 | 58 | |
59 | 59 | if ($protect_all === TRUE) |
60 | 60 | { |
61 | - $str = preg_replace("/$temp(\w+);/","&\\1;", $str); |
|
61 | + $str = preg_replace("/$temp(\w+);/", "&\\1;", $str); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | return $str; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | { |
39 | 39 | function nl2br_except_pre($str) |
40 | 40 | { |
41 | - $CI =& get_instance(); |
|
41 | + $CI = & get_instance(); |
|
42 | 42 | |
43 | 43 | $CI->load->library('typography'); |
44 | 44 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | function auto_typography($str, $strip_js_event_handlers = TRUE, $reduce_linebreaks = FALSE) |
64 | 64 | { |
65 | - $CI =& get_instance(); |
|
65 | + $CI = & get_instance(); |
|
66 | 66 | $CI->load->library('typography'); |
67 | 67 | return $CI->typography->auto_typography($str, $strip_js_event_handlers, $reduce_linebreaks); |
68 | 68 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | if ( ! function_exists('entity_decode')) |
84 | 84 | { |
85 | - function entity_decode($str, $charset='UTF-8') |
|
85 | + function entity_decode($str, $charset = 'UTF-8') |
|
86 | 86 | { |
87 | 87 | global $SEC; |
88 | 88 | return $SEC->entity_decode($str, $charset); |