@@ -225,10 +225,12 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | // Do the tokens exist in both the _POST and _COOKIE arrays? |
| 227 | 227 | if ( ! isset($_POST[$this->_csrf_token_name], $_COOKIE[$this->_csrf_cookie_name]) |
| 228 | - OR $_POST[$this->_csrf_token_name] !== $_COOKIE[$this->_csrf_cookie_name]) // Do the tokens match? |
|
| 228 | + OR $_POST[$this->_csrf_token_name] !== $_COOKIE[$this->_csrf_cookie_name]) { |
|
| 229 | + // Do the tokens match? |
|
| 229 | 230 | { |
| 230 | 231 | $this->csrf_show_error(); |
| 231 | 232 | } |
| 233 | + } |
|
| 232 | 234 | |
| 233 | 235 | // We kill this since we're done and we don't want to polute the _POST array |
| 234 | 236 | unset($_POST[$this->_csrf_token_name]); |
@@ -421,8 +423,7 @@ discard block |
||
| 421 | 423 | // closing tags every so often so we skip those and only |
| 422 | 424 | // do the long opening tags. |
| 423 | 425 | $str = preg_replace('/<\?(php)/i', '<?\\1', $str); |
| 424 | - } |
|
| 425 | - else |
|
| 426 | + } else |
|
| 426 | 427 | { |
| 427 | 428 | $str = str_replace(array('<?', '?'.'>'), array('<?', '?>'), $str); |
| 428 | 429 | } |
@@ -599,8 +600,7 @@ discard block |
||
| 599 | 600 | { |
| 600 | 601 | // The cast is required to avoid TypeError |
| 601 | 602 | return random_bytes((int) $length); |
| 602 | - } |
|
| 603 | - catch (Exception $e) |
|
| 603 | + } catch (Exception $e) |
|
| 604 | 604 | { |
| 605 | 605 | // If random_bytes() can't do the job, we can't either ... |
| 606 | 606 | // There's no point in using fallbacks. |
@@ -854,8 +854,7 @@ discard block |
||
| 854 | 854 | ) |
| 855 | 855 | { |
| 856 | 856 | $attributes[] = 'xss=removed'; |
| 857 | - } |
|
| 858 | - else |
|
| 857 | + } else |
|
| 859 | 858 | { |
| 860 | 859 | $attributes[] = $attribute[0][0]; |
| 861 | 860 | } |
@@ -110,8 +110,7 @@ discard block |
||
| 110 | 110 | if (is_cli()) |
| 111 | 111 | { |
| 112 | 112 | $uri = $this->_parse_argv(); |
| 113 | - } |
|
| 114 | - else |
|
| 113 | + } else |
|
| 115 | 114 | { |
| 116 | 115 | $protocol = $this->config->item('uri_protocol'); |
| 117 | 116 | empty($protocol) && $protocol = 'REQUEST_URI'; |
@@ -212,8 +211,7 @@ discard block |
||
| 212 | 211 | if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) |
| 213 | 212 | { |
| 214 | 213 | $uri = (string) substr($uri, strlen($_SERVER['SCRIPT_NAME'])); |
| 215 | - } |
|
| 216 | - elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) |
|
| 214 | + } elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) |
|
| 217 | 215 | { |
| 218 | 216 | $uri = (string) substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME']))); |
| 219 | 217 | } |
@@ -226,8 +224,7 @@ discard block |
||
| 226 | 224 | $query = explode('?', $query, 2); |
| 227 | 225 | $uri = $query[0]; |
| 228 | 226 | $_SERVER['QUERY_STRING'] = isset($query[1]) ? $query[1] : ''; |
| 229 | - } |
|
| 230 | - else |
|
| 227 | + } else |
|
| 231 | 228 | { |
| 232 | 229 | $_SERVER['QUERY_STRING'] = $query; |
| 233 | 230 | } |
@@ -259,8 +256,7 @@ discard block |
||
| 259 | 256 | if (trim($uri, '/') === '') |
| 260 | 257 | { |
| 261 | 258 | return ''; |
| 262 | - } |
|
| 263 | - elseif (strncmp($uri, '/', 1) === 0) |
|
| 259 | + } elseif (strncmp($uri, '/', 1) === 0) |
|
| 264 | 260 | { |
| 265 | 261 | $uri = explode('?', $uri, 2); |
| 266 | 262 | $_SERVER['QUERY_STRING'] = isset($uri[1]) ? $uri[1] : ''; |
@@ -456,8 +452,7 @@ discard block |
||
| 456 | 452 | if ($i % 2) |
| 457 | 453 | { |
| 458 | 454 | $retval[$lastval] = $seg; |
| 459 | - } |
|
| 460 | - else |
|
| 455 | + } else |
|
| 461 | 456 | { |
| 462 | 457 | $retval[$seg] = NULL; |
| 463 | 458 | $lastval = $seg; |
@@ -559,8 +554,7 @@ discard block |
||
| 559 | 554 | if ($where === 'trailing') |
| 560 | 555 | { |
| 561 | 556 | $leading = ''; |
| 562 | - } |
|
| 563 | - elseif ($where === 'leading') |
|
| 557 | + } elseif ($where === 'leading') |
|
| 564 | 558 | { |
| 565 | 559 | $trailing = ''; |
| 566 | 560 | } |
@@ -67,8 +67,7 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | define('UTF8_ENABLED', TRUE); |
| 69 | 69 | log_message('debug', 'UTF-8 Support Enabled'); |
| 70 | - } |
|
| 71 | - else |
|
| 70 | + } else |
|
| 72 | 71 | { |
| 73 | 72 | define('UTF8_ENABLED', FALSE); |
| 74 | 73 | log_message('debug', 'UTF-8 Support Disabled'); |
@@ -94,8 +93,7 @@ discard block |
||
| 94 | 93 | if (MB_ENABLED) |
| 95 | 94 | { |
| 96 | 95 | $str = mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
| 97 | - } |
|
| 98 | - elseif (ICONV_ENABLED) |
|
| 96 | + } elseif (ICONV_ENABLED) |
|
| 99 | 97 | { |
| 100 | 98 | $str = @iconv('UTF-8', 'UTF-8//IGNORE', $str); |
| 101 | 99 | } |
@@ -137,8 +135,7 @@ discard block |
||
| 137 | 135 | if (MB_ENABLED) |
| 138 | 136 | { |
| 139 | 137 | return mb_convert_encoding($str, 'UTF-8', $encoding); |
| 140 | - } |
|
| 141 | - elseif (ICONV_ENABLED) |
|
| 138 | + } elseif (ICONV_ENABLED) |
|
| 142 | 139 | { |
| 143 | 140 | return @iconv($encoding, 'UTF-8', $str); |
| 144 | 141 | } |
@@ -73,13 +73,11 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | trigger_error('hash_equals(): Expected known_string to be a string, '.strtolower(gettype($known_string)).' given', E_USER_WARNING); |
| 75 | 75 | return FALSE; |
| 76 | - } |
|
| 77 | - elseif ( ! is_string($user_string)) |
|
| 76 | + } elseif ( ! is_string($user_string)) |
|
| 78 | 77 | { |
| 79 | 78 | trigger_error('hash_equals(): Expected user_string to be a string, '.strtolower(gettype($user_string)).' given', E_USER_WARNING); |
| 80 | 79 | return FALSE; |
| 81 | - } |
|
| 82 | - elseif (($length = strlen($known_string)) !== strlen($user_string)) |
|
| 80 | + } elseif (($length = strlen($known_string)) !== strlen($user_string)) |
|
| 83 | 81 | { |
| 84 | 82 | return FALSE; |
| 85 | 83 | } |
@@ -135,8 +133,7 @@ discard block |
||
| 135 | 133 | if (is_string($iterations) && is_numeric($iterations)) |
| 136 | 134 | { |
| 137 | 135 | $iterations = (int) $iterations; |
| 138 | - } |
|
| 139 | - else |
|
| 136 | + } else |
|
| 140 | 137 | { |
| 141 | 138 | trigger_error('hash_pbkdf2() expects parameter 4 to be long, '.$type.' given', E_USER_WARNING); |
| 142 | 139 | return NULL; |
@@ -159,8 +156,7 @@ discard block |
||
| 159 | 156 | if (is_string($length) && is_numeric($length)) |
| 160 | 157 | { |
| 161 | 158 | $length = (int) $length; |
| 162 | - } |
|
| 163 | - else |
|
| 159 | + } else |
|
| 164 | 160 | { |
| 165 | 161 | trigger_error('hash_pbkdf2() expects parameter 5 to be long, '.$type.' given', E_USER_WARNING); |
| 166 | 162 | return NULL; |
@@ -113,18 +113,15 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | trigger_error('password_hash(): Provided salt is too short: '.$saltlen.' expecting 22', E_USER_WARNING); |
| 115 | 115 | return NULL; |
| 116 | - } |
|
| 117 | - elseif ( ! isset($options['salt'])) |
|
| 116 | + } elseif ( ! isset($options['salt'])) |
|
| 118 | 117 | { |
| 119 | 118 | if (defined('MCRYPT_DEV_URANDOM')) |
| 120 | 119 | { |
| 121 | 120 | $options['salt'] = mcrypt_create_iv(16, MCRYPT_DEV_URANDOM); |
| 122 | - } |
|
| 123 | - elseif (function_exists('openssl_random_pseudo_bytes')) |
|
| 121 | + } elseif (function_exists('openssl_random_pseudo_bytes')) |
|
| 124 | 122 | { |
| 125 | 123 | $options['salt'] = openssl_random_pseudo_bytes(16); |
| 126 | - } |
|
| 127 | - elseif (DIRECTORY_SEPARATOR === '/' && (is_readable($dev = '/dev/arandom') OR is_readable($dev = '/dev/urandom'))) |
|
| 124 | + } elseif (DIRECTORY_SEPARATOR === '/' && (is_readable($dev = '/dev/arandom') OR is_readable($dev = '/dev/urandom'))) |
|
| 128 | 125 | { |
| 129 | 126 | if (($fp = fopen($dev, 'rb')) === FALSE) |
| 130 | 127 | { |
@@ -147,16 +144,14 @@ discard block |
||
| 147 | 144 | } |
| 148 | 145 | |
| 149 | 146 | fclose($fp); |
| 150 | - } |
|
| 151 | - else |
|
| 147 | + } else |
|
| 152 | 148 | { |
| 153 | 149 | log_message('error', 'compat/password: No CSPRNG available.'); |
| 154 | 150 | return FALSE; |
| 155 | 151 | } |
| 156 | 152 | |
| 157 | 153 | $options['salt'] = str_replace('+', '.', rtrim(base64_encode($options['salt']), '=')); |
| 158 | - } |
|
| 159 | - elseif ( ! preg_match('#^[a-zA-Z0-9./]+$#D', $options['salt'])) |
|
| 154 | + } elseif ( ! preg_match('#^[a-zA-Z0-9./]+$#D', $options['salt'])) |
|
| 160 | 155 | { |
| 161 | 156 | $options['salt'] = str_replace('+', '.', rtrim(base64_encode($options['salt']), '=')); |
| 162 | 157 | } |
@@ -189,8 +184,7 @@ discard block |
||
| 189 | 184 | if ($algo !== $info['algo']) |
| 190 | 185 | { |
| 191 | 186 | return TRUE; |
| 192 | - } |
|
| 193 | - elseif ($algo === 1) |
|
| 187 | + } elseif ($algo === 1) |
|
| 194 | 188 | { |
| 195 | 189 | $options['cost'] = isset($options['cost']) ? (int) $options['cost'] : 10; |
| 196 | 190 | return ($info['options']['cost'] !== $options['cost']); |
@@ -74,12 +74,10 @@ discard block |
||
| 74 | 74 | if ($type === 'double') |
| 75 | 75 | { |
| 76 | 76 | $column_key = (int) $column_key; |
| 77 | - } |
|
| 78 | - elseif ($type === 'object' && method_exists($column_key, '__toString')) |
|
| 77 | + } elseif ($type === 'object' && method_exists($column_key, '__toString')) |
|
| 79 | 78 | { |
| 80 | 79 | $column_key = (string) $column_key; |
| 81 | - } |
|
| 82 | - else |
|
| 80 | + } else |
|
| 83 | 81 | { |
| 84 | 82 | trigger_error('array_column(): The column key should be either a string or an integer', E_USER_WARNING); |
| 85 | 83 | return FALSE; |
@@ -91,12 +89,10 @@ discard block |
||
| 91 | 89 | if ($type === 'double') |
| 92 | 90 | { |
| 93 | 91 | $index_key = (int) $index_key; |
| 94 | - } |
|
| 95 | - elseif ($type === 'object' && method_exists($index_key, '__toString')) |
|
| 92 | + } elseif ($type === 'object' && method_exists($index_key, '__toString')) |
|
| 96 | 93 | { |
| 97 | 94 | $index_key = (string) $index_key; |
| 98 | - } |
|
| 99 | - else |
|
| 95 | + } else |
|
| 100 | 96 | { |
| 101 | 97 | trigger_error('array_column(): The index key should be either a string or an integer', E_USER_WARNING); |
| 102 | 98 | return FALSE; |
@@ -109,12 +105,10 @@ discard block |
||
| 109 | 105 | if ($column_key === NULL) |
| 110 | 106 | { |
| 111 | 107 | $value = $a; |
| 112 | - } |
|
| 113 | - elseif (is_array($a) && array_key_exists($column_key, $a)) |
|
| 108 | + } elseif (is_array($a) && array_key_exists($column_key, $a)) |
|
| 114 | 109 | { |
| 115 | 110 | $value = $a[$column_key]; |
| 116 | - } |
|
| 117 | - else |
|
| 111 | + } else |
|
| 118 | 112 | { |
| 119 | 113 | continue; |
| 120 | 114 | } |
@@ -122,8 +116,7 @@ discard block |
||
| 122 | 116 | if ($index_key === NULL OR ! array_key_exists($index_key, $a)) |
| 123 | 117 | { |
| 124 | 118 | $result[] = $value; |
| 125 | - } |
|
| 126 | - else |
|
| 119 | + } else |
|
| 127 | 120 | { |
| 128 | 121 | $result[$a[$index_key]] = $value; |
| 129 | 122 | } |
@@ -158,8 +151,7 @@ discard block |
||
| 158 | 151 | if ($type === 'object' && method_exists($data, '__toString')) |
| 159 | 152 | { |
| 160 | 153 | $data = (string) $data; |
| 161 | - } |
|
| 162 | - else |
|
| 154 | + } else |
|
| 163 | 155 | { |
| 164 | 156 | trigger_error('hex2bin() expects parameter 1 to be string, '.$type.' given', E_USER_WARNING); |
| 165 | 157 | return NULL; |
@@ -170,8 +162,7 @@ discard block |
||
| 170 | 162 | { |
| 171 | 163 | trigger_error('Hexadecimal input string must have an even length', E_USER_WARNING); |
| 172 | 164 | return FALSE; |
| 173 | - } |
|
| 174 | - elseif ( ! preg_match('/^[0-9a-f]*$/i', $data)) |
|
| 165 | + } elseif ( ! preg_match('/^[0-9a-f]*$/i', $data)) |
|
| 175 | 166 | { |
| 176 | 167 | trigger_error('Input string must be hexadecimal string', E_USER_WARNING); |
| 177 | 168 | return FALSE; |
@@ -206,8 +197,7 @@ discard block |
||
| 206 | 197 | { |
| 207 | 198 | trigger_error('array_replace() expects at least 1 parameter, 0 given', E_USER_WARNING); |
| 208 | 199 | return NULL; |
| 209 | - } |
|
| 210 | - elseif ($c === 1) |
|
| 200 | + } elseif ($c === 1) |
|
| 211 | 201 | { |
| 212 | 202 | if ( ! is_array($arrays[0])) |
| 213 | 203 | { |
@@ -227,8 +217,7 @@ discard block |
||
| 227 | 217 | { |
| 228 | 218 | trigger_error('array_replace(): Argument #'.($i + 2).' is not an array', E_USER_WARNING); |
| 229 | 219 | return NULL; |
| 230 | - } |
|
| 231 | - elseif (empty($arrays[$i])) |
|
| 220 | + } elseif (empty($arrays[$i])) |
|
| 232 | 221 | { |
| 233 | 222 | continue; |
| 234 | 223 | } |
@@ -261,8 +250,7 @@ discard block |
||
| 261 | 250 | { |
| 262 | 251 | trigger_error('array_replace_recursive() expects at least 1 parameter, 0 given', E_USER_WARNING); |
| 263 | 252 | return NULL; |
| 264 | - } |
|
| 265 | - elseif ($c === 1) |
|
| 253 | + } elseif ($c === 1) |
|
| 266 | 254 | { |
| 267 | 255 | if ( ! is_array($arrays[0])) |
| 268 | 256 | { |
@@ -282,8 +270,7 @@ discard block |
||
| 282 | 270 | { |
| 283 | 271 | trigger_error('array_replace_recursive(): Argument #'.($i + 2).' is not an array', E_USER_WARNING); |
| 284 | 272 | return NULL; |
| 285 | - } |
|
| 286 | - elseif (empty($arrays[$i])) |
|
| 273 | + } elseif (empty($arrays[$i])) |
|
| 287 | 274 | { |
| 288 | 275 | continue; |
| 289 | 276 | } |
@@ -316,14 +303,12 @@ discard block |
||
| 316 | 303 | if (strlen($str) === 0) |
| 317 | 304 | { |
| 318 | 305 | return ''; |
| 319 | - } |
|
| 320 | - elseif (in_array($type = gettype($str), array('array', 'object'), TRUE)) |
|
| 306 | + } elseif (in_array($type = gettype($str), array('array', 'object'), TRUE)) |
|
| 321 | 307 | { |
| 322 | 308 | if ($type === 'object' && method_exists($str, '__toString')) |
| 323 | 309 | { |
| 324 | 310 | $str = (string) $str; |
| 325 | - } |
|
| 326 | - else |
|
| 311 | + } else |
|
| 327 | 312 | { |
| 328 | 313 | trigger_error('quoted_printable_encode() expects parameter 1 to be string, '.$type.' given', E_USER_WARNING); |
| 329 | 314 | return NULL; |
@@ -73,8 +73,7 @@ discard block |
||
| 73 | 73 | if (file_exists($file_path = $path.'config/'.ENVIRONMENT.'/database.php')) |
| 74 | 74 | { |
| 75 | 75 | include($file_path); |
| 76 | - } |
|
| 77 | - elseif (file_exists($file_path = $path.'config/database.php')) |
|
| 76 | + } elseif (file_exists($file_path = $path.'config/database.php')) |
|
| 78 | 77 | { |
| 79 | 78 | include($file_path); |
| 80 | 79 | } |
@@ -95,15 +94,13 @@ discard block |
||
| 95 | 94 | if ( ! isset($active_group)) |
| 96 | 95 | { |
| 97 | 96 | show_error('You have not specified a database connection group via $active_group in your config/database.php file.'); |
| 98 | - } |
|
| 99 | - elseif ( ! isset($db[$active_group])) |
|
| 97 | + } elseif ( ! isset($db[$active_group])) |
|
| 100 | 98 | { |
| 101 | 99 | show_error('You have specified an invalid database connection group ('.$active_group.') in your config/database.php file.'); |
| 102 | 100 | } |
| 103 | 101 | |
| 104 | 102 | $params = $db[$active_group]; |
| 105 | - } |
|
| 106 | - elseif (is_string($params)) |
|
| 103 | + } elseif (is_string($params)) |
|
| 107 | 104 | { |
| 108 | 105 | /** |
| 109 | 106 | * Parse the URL from the DSN string |
@@ -181,8 +178,7 @@ discard block |
||
| 181 | 178 | */ |
| 182 | 179 | class CI_DB extends CI_DB_query_builder { } |
| 183 | 180 | } |
| 184 | - } |
|
| 185 | - elseif ( ! class_exists('CI_DB', FALSE)) |
|
| 181 | + } elseif ( ! class_exists('CI_DB', FALSE)) |
|
| 186 | 182 | { |
| 187 | 183 | /** |
| 188 | 184 | * @ignore |
@@ -599,8 +599,7 @@ discard block |
||
| 599 | 599 | { |
| 600 | 600 | log_message('error', 'Invalid query: '.$sql); |
| 601 | 601 | return ($this->db_debug) ? $this->display_error('db_invalid_query') : FALSE; |
| 602 | - } |
|
| 603 | - elseif ( ! is_bool($return_object)) |
|
| 602 | + } elseif ( ! is_bool($return_object)) |
|
| 604 | 603 | { |
| 605 | 604 | $return_object = ! $this->is_write_type($sql); |
| 606 | 605 | } |
@@ -975,13 +974,11 @@ discard block |
||
| 975 | 974 | if (empty($binds) OR empty($this->bind_marker) OR strpos($sql, $this->bind_marker) === FALSE) |
| 976 | 975 | { |
| 977 | 976 | return $sql; |
| 978 | - } |
|
| 979 | - elseif ( ! is_array($binds)) |
|
| 977 | + } elseif ( ! is_array($binds)) |
|
| 980 | 978 | { |
| 981 | 979 | $binds = array($binds); |
| 982 | 980 | $bind_count = 1; |
| 983 | - } |
|
| 984 | - else |
|
| 981 | + } else |
|
| 985 | 982 | { |
| 986 | 983 | // Make sure we're using numeric keys |
| 987 | 984 | $binds = array_values($binds); |
@@ -1005,8 +1002,7 @@ discard block |
||
| 1005 | 1002 | { |
| 1006 | 1003 | return $sql; |
| 1007 | 1004 | } |
| 1008 | - } |
|
| 1009 | - elseif (($c = preg_match_all('/'.preg_quote($this->bind_marker, '/').'/i', $sql, $matches, PREG_OFFSET_CAPTURE)) !== $bind_count) |
|
| 1005 | + } elseif (($c = preg_match_all('/'.preg_quote($this->bind_marker, '/').'/i', $sql, $matches, PREG_OFFSET_CAPTURE)) !== $bind_count) |
|
| 1010 | 1006 | { |
| 1011 | 1007 | return $sql; |
| 1012 | 1008 | } |
@@ -1093,16 +1089,13 @@ discard block |
||
| 1093 | 1089 | { |
| 1094 | 1090 | $str = array_map(array(&$this, 'escape'), $str); |
| 1095 | 1091 | return $str; |
| 1096 | - } |
|
| 1097 | - elseif (is_string($str) OR (is_object($str) && method_exists($str, '__toString'))) |
|
| 1092 | + } elseif (is_string($str) OR (is_object($str) && method_exists($str, '__toString'))) |
|
| 1098 | 1093 | { |
| 1099 | 1094 | return "'".$this->escape_str($str)."'"; |
| 1100 | - } |
|
| 1101 | - elseif (is_bool($str)) |
|
| 1095 | + } elseif (is_bool($str)) |
|
| 1102 | 1096 | { |
| 1103 | 1097 | return ($str === FALSE) ? 0 : 1; |
| 1104 | - } |
|
| 1105 | - elseif ($str === NULL) |
|
| 1098 | + } elseif ($str === NULL) |
|
| 1106 | 1099 | { |
| 1107 | 1100 | return 'NULL'; |
| 1108 | 1101 | } |
@@ -1253,12 +1246,10 @@ discard block |
||
| 1253 | 1246 | if (isset($row['table_name'])) |
| 1254 | 1247 | { |
| 1255 | 1248 | $key = 'table_name'; |
| 1256 | - } |
|
| 1257 | - elseif (isset($row['TABLE_NAME'])) |
|
| 1249 | + } elseif (isset($row['TABLE_NAME'])) |
|
| 1258 | 1250 | { |
| 1259 | 1251 | $key = 'TABLE_NAME'; |
| 1260 | - } |
|
| 1261 | - else |
|
| 1252 | + } else |
|
| 1262 | 1253 | { |
| 1263 | 1254 | /* We have no other choice but to just get the first element's key. |
| 1264 | 1255 | * Due to array_shift() accepting its argument by reference, if |
@@ -1321,12 +1312,10 @@ discard block |
||
| 1321 | 1312 | if (isset($row['column_name'])) |
| 1322 | 1313 | { |
| 1323 | 1314 | $key = 'column_name'; |
| 1324 | - } |
|
| 1325 | - elseif (isset($row['COLUMN_NAME'])) |
|
| 1315 | + } elseif (isset($row['COLUMN_NAME'])) |
|
| 1326 | 1316 | { |
| 1327 | 1317 | $key = 'COLUMN_NAME'; |
| 1328 | - } |
|
| 1329 | - else |
|
| 1318 | + } else |
|
| 1330 | 1319 | { |
| 1331 | 1320 | // We have no other choice but to just get the first element's key. |
| 1332 | 1321 | $key = key($row); |
@@ -1382,8 +1371,7 @@ discard block |
||
| 1382 | 1371 | if ($this->_escape_char === '' OR empty($item) OR in_array($item, $this->_reserved_identifiers)) |
| 1383 | 1372 | { |
| 1384 | 1373 | return $item; |
| 1385 | - } |
|
| 1386 | - elseif (is_array($item)) |
|
| 1374 | + } elseif (is_array($item)) |
|
| 1387 | 1375 | { |
| 1388 | 1376 | foreach ($item as $key => $value) |
| 1389 | 1377 | { |
@@ -1410,8 +1398,7 @@ discard block |
||
| 1410 | 1398 | $this->_escape_char[0], |
| 1411 | 1399 | $this->_escape_char[1] |
| 1412 | 1400 | ); |
| 1413 | - } |
|
| 1414 | - else |
|
| 1401 | + } else |
|
| 1415 | 1402 | { |
| 1416 | 1403 | $preg_ec[0] = $preg_ec[1] = preg_quote($this->_escape_char, '/'); |
| 1417 | 1404 | $preg_ec[2] = $preg_ec[3] = $this->_escape_char; |
@@ -1679,8 +1666,7 @@ discard block |
||
| 1679 | 1666 | if ( ! class_exists('CI_DB_Cache', FALSE)) |
| 1680 | 1667 | { |
| 1681 | 1668 | require_once(BASEPATH.'database/DB_cache.php'); |
| 1682 | - } |
|
| 1683 | - elseif (is_object($this->CACHE)) |
|
| 1669 | + } elseif (is_object($this->CACHE)) |
|
| 1684 | 1670 | { |
| 1685 | 1671 | return TRUE; |
| 1686 | 1672 | } |
@@ -1739,8 +1725,7 @@ discard block |
||
| 1739 | 1725 | if ($native === TRUE) |
| 1740 | 1726 | { |
| 1741 | 1727 | $message = (array) $error; |
| 1742 | - } |
|
| 1743 | - else |
|
| 1728 | + } else |
|
| 1744 | 1729 | { |
| 1745 | 1730 | $message = is_array($error) ? $error : array(str_replace('%s', $swap, $LANG->line($error))); |
| 1746 | 1731 | } |
@@ -1843,15 +1828,13 @@ discard block |
||
| 1843 | 1828 | ? substr($item, $offset, 4).$this->escape_identifiers(substr($item, $offset + 4)) |
| 1844 | 1829 | : substr($item, $offset); |
| 1845 | 1830 | $item = substr($item, 0, $offset); |
| 1846 | - } |
|
| 1847 | - elseif ($offset = strrpos($item, ' ')) |
|
| 1831 | + } elseif ($offset = strrpos($item, ' ')) |
|
| 1848 | 1832 | { |
| 1849 | 1833 | $alias = ($protect_identifiers) |
| 1850 | 1834 | ? ' '.$this->escape_identifiers(substr($item, $offset + 1)) |
| 1851 | 1835 | : substr($item, $offset); |
| 1852 | 1836 | $item = substr($item, 0, $offset); |
| 1853 | - } |
|
| 1854 | - else |
|
| 1837 | + } else |
|
| 1855 | 1838 | { |
| 1856 | 1839 | $alias = ''; |
| 1857 | 1840 | } |
@@ -183,8 +183,7 @@ discard block |
||
| 183 | 183 | if ($this->_create_database === FALSE) |
| 184 | 184 | { |
| 185 | 185 | return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; |
| 186 | - } |
|
| 187 | - elseif ( ! $this->db->query(sprintf($this->_create_database, $db_name, $this->db->char_set, $this->db->dbcollat))) |
|
| 186 | + } elseif ( ! $this->db->query(sprintf($this->_create_database, $db_name, $this->db->char_set, $this->db->dbcollat))) |
|
| 188 | 187 | { |
| 189 | 188 | return ($this->db->db_debug) ? $this->db->display_error('db_unable_to_drop') : FALSE; |
| 190 | 189 | } |
@@ -210,8 +209,7 @@ discard block |
||
| 210 | 209 | if ($this->_drop_database === FALSE) |
| 211 | 210 | { |
| 212 | 211 | return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; |
| 213 | - } |
|
| 214 | - elseif ( ! $this->db->query(sprintf($this->_drop_database, $db_name))) |
|
| 212 | + } elseif ( ! $this->db->query(sprintf($this->_drop_database, $db_name))) |
|
| 215 | 213 | { |
| 216 | 214 | return ($this->db->db_debug) ? $this->db->display_error('db_unable_to_drop') : FALSE; |
| 217 | 215 | } |
@@ -258,8 +256,7 @@ discard block |
||
| 258 | 256 | if ($primary === TRUE) |
| 259 | 257 | { |
| 260 | 258 | $this->primary_keys[] = $key; |
| 261 | - } |
|
| 262 | - else |
|
| 259 | + } else |
|
| 263 | 260 | { |
| 264 | 261 | $this->keys[] = $key; |
| 265 | 262 | } |
@@ -289,8 +286,7 @@ discard block |
||
| 289 | 286 | ) |
| 290 | 287 | )); |
| 291 | 288 | $this->add_key('id', TRUE); |
| 292 | - } |
|
| 293 | - else |
|
| 289 | + } else |
|
| 294 | 290 | { |
| 295 | 291 | if (strpos($field, ' ') === FALSE) |
| 296 | 292 | { |
@@ -324,8 +320,7 @@ discard block |
||
| 324 | 320 | if ($table === '') |
| 325 | 321 | { |
| 326 | 322 | show_error('A table name is required for that operation.'); |
| 327 | - } |
|
| 328 | - else |
|
| 323 | + } else |
|
| 329 | 324 | { |
| 330 | 325 | $table = $this->db->dbprefix.$table; |
| 331 | 326 | } |
@@ -381,8 +376,7 @@ discard block |
||
| 381 | 376 | if ($this->db->table_exists($table)) |
| 382 | 377 | { |
| 383 | 378 | return TRUE; |
| 384 | - } |
|
| 385 | - else |
|
| 379 | + } else |
|
| 386 | 380 | { |
| 387 | 381 | $if_not_exists = FALSE; |
| 388 | 382 | } |
@@ -502,8 +496,7 @@ discard block |
||
| 502 | 496 | { |
| 503 | 497 | return TRUE; |
| 504 | 498 | } |
| 505 | - } |
|
| 506 | - else |
|
| 499 | + } else |
|
| 507 | 500 | { |
| 508 | 501 | $sql = sprintf($this->_drop_table_if, $this->db->escape_identifiers($table)); |
| 509 | 502 | } |
@@ -527,8 +520,7 @@ discard block |
||
| 527 | 520 | { |
| 528 | 521 | show_error('A table name is required for that operation.'); |
| 529 | 522 | return FALSE; |
| 530 | - } |
|
| 531 | - elseif ($this->_rename_table === FALSE) |
|
| 523 | + } elseif ($this->_rename_table === FALSE) |
|
| 532 | 524 | { |
| 533 | 525 | return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; |
| 534 | 526 | } |
@@ -740,8 +732,7 @@ discard block |
||
| 740 | 732 | if (isset($attributes['AFTER'])) |
| 741 | 733 | { |
| 742 | 734 | $field['after'] = $attributes['AFTER']; |
| 743 | - } |
|
| 744 | - elseif (isset($attributes['FIRST'])) |
|
| 735 | + } elseif (isset($attributes['FIRST'])) |
|
| 745 | 736 | { |
| 746 | 737 | $field['first'] = (bool) $attributes['FIRST']; |
| 747 | 738 | } |
@@ -754,13 +745,11 @@ discard block |
||
| 754 | 745 | if ($attributes['NULL'] === TRUE) |
| 755 | 746 | { |
| 756 | 747 | $field['null'] = empty($this->_null) ? '' : ' '.$this->_null; |
| 757 | - } |
|
| 758 | - else |
|
| 748 | + } else |
|
| 759 | 749 | { |
| 760 | 750 | $field['null'] = ' NOT NULL'; |
| 761 | 751 | } |
| 762 | - } |
|
| 763 | - elseif ($create_table === TRUE) |
|
| 752 | + } elseif ($create_table === TRUE) |
|
| 764 | 753 | { |
| 765 | 754 | $field['null'] = ' NOT NULL'; |
| 766 | 755 | } |
@@ -864,8 +853,7 @@ discard block |
||
| 864 | 853 | { |
| 865 | 854 | $field['unsigned'] = ' UNSIGNED'; |
| 866 | 855 | return; |
| 867 | - } |
|
| 868 | - elseif (is_string($key) && strcasecmp($attributes['TYPE'], $key) === 0) |
|
| 856 | + } elseif (is_string($key) && strcasecmp($attributes['TYPE'], $key) === 0) |
|
| 869 | 857 | { |
| 870 | 858 | $field['type'] = $key; |
| 871 | 859 | return; |
@@ -903,8 +891,7 @@ discard block |
||
| 903 | 891 | // Override the NULL attribute if that's our default |
| 904 | 892 | $attributes['NULL'] = TRUE; |
| 905 | 893 | $field['null'] = empty($this->_null) ? '' : ' '.$this->_null; |
| 906 | - } |
|
| 907 | - else |
|
| 894 | + } else |
|
| 908 | 895 | { |
| 909 | 896 | $field['default'] = $this->_default.$this->db->escape($attributes['DEFAULT']); |
| 910 | 897 | } |
@@ -998,8 +985,7 @@ discard block |
||
| 998 | 985 | continue; |
| 999 | 986 | } |
| 1000 | 987 | } |
| 1001 | - } |
|
| 1002 | - elseif ( ! isset($this->fields[$this->keys[$i]])) |
|
| 988 | + } elseif ( ! isset($this->fields[$this->keys[$i]])) |
|
| 1003 | 989 | { |
| 1004 | 990 | unset($this->keys[$i]); |
| 1005 | 991 | continue; |