@@ -99,12 +99,10 @@ discard block |
||
99 | 99 | if (class_exists('Memcached', FALSE)) |
100 | 100 | { |
101 | 101 | $this->_memcached = new Memcached(); |
102 | - } |
|
103 | - elseif (class_exists('Memcache', FALSE)) |
|
102 | + } elseif (class_exists('Memcache', FALSE)) |
|
104 | 103 | { |
105 | 104 | $this->_memcached = new Memcache(); |
106 | - } |
|
107 | - else |
|
105 | + } else |
|
108 | 106 | { |
109 | 107 | log_message('error', 'Cache: Failed to create Memcache(d) object; extension not loaded?'); |
110 | 108 | } |
@@ -124,8 +122,7 @@ discard block |
||
124 | 122 | TRUE, |
125 | 123 | $cache_server['weight'] |
126 | 124 | ); |
127 | - } |
|
128 | - else |
|
125 | + } else |
|
129 | 126 | { |
130 | 127 | $this->_memcached->addServer( |
131 | 128 | $cache_server['hostname'], |
@@ -172,8 +169,7 @@ discard block |
||
172 | 169 | if (get_class($this->_memcached) === 'Memcached') |
173 | 170 | { |
174 | 171 | return $this->_memcached->set($id, $data, $ttl); |
175 | - } |
|
176 | - elseif (get_class($this->_memcached) === 'Memcache') |
|
172 | + } elseif (get_class($this->_memcached) === 'Memcache') |
|
177 | 173 | { |
178 | 174 | return $this->_memcached->set($id, $data, 0, $ttl); |
179 | 175 | } |
@@ -107,8 +107,7 @@ discard block |
||
107 | 107 | if ($config['socket_type'] === 'unix') |
108 | 108 | { |
109 | 109 | $success = $this->_redis->connect($config['socket']); |
110 | - } |
|
111 | - else // tcp socket |
|
110 | + } else // tcp socket |
|
112 | 111 | { |
113 | 112 | $success = $this->_redis->connect($config['host'], $config['port'], $config['timeout']); |
114 | 113 | } |
@@ -122,8 +121,7 @@ discard block |
||
122 | 121 | { |
123 | 122 | log_message('error', 'Cache: Redis authentication failed.'); |
124 | 123 | } |
125 | - } |
|
126 | - catch (RedisException $e) |
|
124 | + } catch (RedisException $e) |
|
127 | 125 | { |
128 | 126 | log_message('error', 'Cache: Redis connection refused ('.$e->getMessage().')'); |
129 | 127 | } |
@@ -175,8 +173,7 @@ discard block |
||
175 | 173 | |
176 | 174 | isset($this->_serialized[$id]) OR $this->_serialized[$id] = TRUE; |
177 | 175 | $data = serialize($data); |
178 | - } |
|
179 | - elseif (isset($this->_serialized[$id])) |
|
176 | + } elseif (isset($this->_serialized[$id])) |
|
180 | 177 | { |
181 | 178 | $this->_serialized[$id] = NULL; |
182 | 179 | $this->_redis->sRemove('_ci_redis_serialized', $id); |
@@ -184,12 +184,10 @@ discard block |
||
184 | 184 | if (empty($year)) |
185 | 185 | { |
186 | 186 | $year = date('Y', $local_time); |
187 | - } |
|
188 | - elseif (strlen($year) === 1) |
|
187 | + } elseif (strlen($year) === 1) |
|
189 | 188 | { |
190 | 189 | $year = '200'.$year; |
191 | - } |
|
192 | - elseif (strlen($year) === 2) |
|
190 | + } elseif (strlen($year) === 2) |
|
193 | 191 | { |
194 | 192 | $year = '20'.$year; |
195 | 193 | } |
@@ -197,8 +195,7 @@ discard block |
||
197 | 195 | if (empty($month)) |
198 | 196 | { |
199 | 197 | $month = date('m', $local_time); |
200 | - } |
|
201 | - elseif (strlen($month) === 1) |
|
198 | + } elseif (strlen($month) === 1) |
|
202 | 199 | { |
203 | 200 | $month = '0'.$month; |
204 | 201 | } |
@@ -294,8 +291,7 @@ discard block |
||
294 | 291 | $temp = ($is_current_month === TRUE && $day == $cur_day) ? |
295 | 292 | $this->replacements['cal_cell_content_today'] : $this->replacements['cal_cell_content']; |
296 | 293 | $out .= str_replace(array('{content}', '{day}'), array($data[$day], $day), $temp); |
297 | - } |
|
298 | - else |
|
294 | + } else |
|
299 | 295 | { |
300 | 296 | // Cells with no content |
301 | 297 | $temp = ($is_current_month === TRUE && $day == $cur_day) ? |
@@ -304,8 +300,7 @@ discard block |
||
304 | 300 | } |
305 | 301 | |
306 | 302 | $out .= ($is_current_month === TRUE && $day == $cur_day) ? $this->replacements['cal_cell_end_today'] : $this->replacements['cal_cell_end']; |
307 | - } |
|
308 | - elseif ($this->show_other_days === TRUE) |
|
303 | + } elseif ($this->show_other_days === TRUE) |
|
309 | 304 | { |
310 | 305 | $out .= $this->replacements['cal_cell_start_other']; |
311 | 306 | |
@@ -315,16 +310,14 @@ discard block |
||
315 | 310 | $prev_month = $this->adjust_date($month - 1, $year); |
316 | 311 | $prev_month_days = $this->get_total_days($prev_month['month'], $prev_month['year']); |
317 | 312 | $out .= str_replace('{day}', $prev_month_days + $day, $this->replacements['cal_cell_other']); |
318 | - } |
|
319 | - else |
|
313 | + } else |
|
320 | 314 | { |
321 | 315 | // Day of next month |
322 | 316 | $out .= str_replace('{day}', $day - $total_days, $this->replacements['cal_cell_other']); |
323 | 317 | } |
324 | 318 | |
325 | 319 | $out .= $this->replacements['cal_cell_end_other']; |
326 | - } |
|
327 | - else |
|
320 | + } else |
|
328 | 321 | { |
329 | 322 | // Blank cells |
330 | 323 | $out .= $this->replacements['cal_cell_start'].$this->replacements['cal_cell_blank'].$this->replacements['cal_cell_end']; |
@@ -355,8 +348,7 @@ discard block |
||
355 | 348 | if ($this->month_type === 'short') |
356 | 349 | { |
357 | 350 | $month_names = array('01' => 'cal_jan', '02' => 'cal_feb', '03' => 'cal_mar', '04' => 'cal_apr', '05' => 'cal_may', '06' => 'cal_jun', '07' => 'cal_jul', '08' => 'cal_aug', '09' => 'cal_sep', '10' => 'cal_oct', '11' => 'cal_nov', '12' => 'cal_dec'); |
358 | - } |
|
359 | - else |
|
351 | + } else |
|
360 | 352 | { |
361 | 353 | $month_names = array('01' => 'cal_january', '02' => 'cal_february', '03' => 'cal_march', '04' => 'cal_april', '05' => 'cal_mayl', '06' => 'cal_june', '07' => 'cal_july', '08' => 'cal_august', '09' => 'cal_september', '10' => 'cal_october', '11' => 'cal_november', '12' => 'cal_december'); |
362 | 354 | } |
@@ -387,12 +379,10 @@ discard block |
||
387 | 379 | if ($this->day_type === 'long') |
388 | 380 | { |
389 | 381 | $day_names = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'); |
390 | - } |
|
391 | - elseif ($this->day_type === 'short') |
|
382 | + } elseif ($this->day_type === 'short') |
|
392 | 383 | { |
393 | 384 | $day_names = array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'); |
394 | - } |
|
395 | - else |
|
385 | + } else |
|
396 | 386 | { |
397 | 387 | $day_names = array('su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'); |
398 | 388 | } |
@@ -528,14 +518,12 @@ discard block |
||
528 | 518 | if (preg_match('/\{'.$val.'\}(.*?)\{\/'.$val.'\}/si', $this->template, $match)) |
529 | 519 | { |
530 | 520 | $this->replacements[$val] = $match[1]; |
531 | - } |
|
532 | - elseif (in_array($val, $today, TRUE)) |
|
521 | + } elseif (in_array($val, $today, TRUE)) |
|
533 | 522 | { |
534 | 523 | $this->replacements[$val] = $this->replacements[substr($val, 0, -6)]; |
535 | 524 | } |
536 | 525 | } |
537 | - } |
|
538 | - elseif (is_array($this->template)) |
|
526 | + } elseif (is_array($this->template)) |
|
539 | 527 | { |
540 | 528 | $this->replacements = array_merge($this->replacements, $this->template); |
541 | 529 | } |
@@ -147,8 +147,7 @@ discard block |
||
147 | 147 | { |
148 | 148 | $save_cart = TRUE; |
149 | 149 | } |
150 | - } |
|
151 | - else |
|
150 | + } else |
|
152 | 151 | { |
153 | 152 | foreach ($items as $val) |
154 | 153 | { |
@@ -248,8 +247,7 @@ discard block |
||
248 | 247 | if (isset($items['options']) && count($items['options']) > 0) |
249 | 248 | { |
250 | 249 | $rowid = md5($items['id'].serialize($items['options'])); |
251 | - } |
|
252 | - else |
|
250 | + } else |
|
253 | 251 | { |
254 | 252 | // No options were submitted so we simply MD5 the product ID. |
255 | 253 | // Technically, we don't need to MD5 the ID in this case, but it makes |
@@ -303,8 +301,7 @@ discard block |
||
303 | 301 | { |
304 | 302 | $save_cart = TRUE; |
305 | 303 | } |
306 | - } |
|
307 | - else |
|
304 | + } else |
|
308 | 305 | { |
309 | 306 | foreach ($items as $val) |
310 | 307 | { |
@@ -173,8 +173,7 @@ discard block |
||
173 | 173 | if (class_exists($child_name, FALSE)) |
174 | 174 | { |
175 | 175 | $class_name = $child_name; |
176 | - } |
|
177 | - else |
|
176 | + } else |
|
178 | 177 | { |
179 | 178 | $msg = 'Unable to load the requested driver: '.$class_name; |
180 | 179 | log_message('error', $msg); |
@@ -274,8 +273,7 @@ discard block |
||
274 | 273 | } |
275 | 274 | |
276 | 275 | self::$_reflections[$class_name] = array($this->_methods, $this->_properties); |
277 | - } |
|
278 | - else |
|
276 | + } else |
|
279 | 277 | { |
280 | 278 | list($this->_methods, $this->_properties) = self::$_reflections[$class_name]; |
281 | 279 | } |
@@ -412,8 +412,7 @@ discard block |
||
412 | 412 | if (count($config) > 0) |
413 | 413 | { |
414 | 414 | $this->initialize($config); |
415 | - } |
|
416 | - else |
|
415 | + } else |
|
417 | 416 | { |
418 | 417 | $this->_smtp_auth = ! ($this->smtp_user === '' && $this->smtp_pass === ''); |
419 | 418 | } |
@@ -458,8 +457,7 @@ discard block |
||
458 | 457 | if (method_exists($this, $method)) |
459 | 458 | { |
460 | 459 | $this->$method($val); |
461 | - } |
|
462 | - else |
|
460 | + } else |
|
463 | 461 | { |
464 | 462 | $this->$key = $val; |
465 | 463 | } |
@@ -538,8 +536,7 @@ discard block |
||
538 | 536 | { |
539 | 537 | // add slashes for non-printing characters, slashes, and double quotes, and surround it in double quotes |
540 | 538 | $name = '"'.addcslashes($name, "\0..\37\177'\"\\").'"'; |
541 | - } |
|
542 | - else |
|
539 | + } else |
|
543 | 540 | { |
544 | 541 | $name = $this->_prep_q_encoding($name); |
545 | 542 | } |
@@ -672,8 +669,7 @@ discard block |
||
672 | 669 | if ($this->_get_protocol() === 'smtp' OR ($this->bcc_batch_mode && count($bcc) > $this->bcc_batch_size)) |
673 | 670 | { |
674 | 671 | $this->_bcc_array = $bcc; |
675 | - } |
|
676 | - else |
|
672 | + } else |
|
677 | 673 | { |
678 | 674 | $this->set_header('Bcc', implode(', ', $bcc)); |
679 | 675 | } |
@@ -752,8 +748,7 @@ discard block |
||
752 | 748 | $file_content = stream_get_contents($fp); |
753 | 749 | $mime = $this->_mime_types(pathinfo($file, PATHINFO_EXTENSION)); |
754 | 750 | fclose($fp); |
755 | - } |
|
756 | - else |
|
751 | + } else |
|
757 | 752 | { |
758 | 753 | $file_content =& $file; // buffered file |
759 | 754 | } |
@@ -1013,12 +1008,10 @@ discard block |
||
1013 | 1008 | if ($this->mailtype === 'html') |
1014 | 1009 | { |
1015 | 1010 | return (count($this->_attachments) === 0) ? 'html' : 'html-attach'; |
1016 | - } |
|
1017 | - elseif ($this->mailtype === 'text' && count($this->_attachments) > 0) |
|
1011 | + } elseif ($this->mailtype === 'text' && count($this->_attachments) > 0) |
|
1018 | 1012 | { |
1019 | 1013 | return 'plain-attach'; |
1020 | - } |
|
1021 | - else |
|
1014 | + } else |
|
1022 | 1015 | { |
1023 | 1016 | return 'plain'; |
1024 | 1017 | } |
@@ -1337,8 +1330,7 @@ discard block |
||
1337 | 1330 | { |
1338 | 1331 | $this->_header_str .= $hdr; |
1339 | 1332 | $this->_finalbody = $this->_body; |
1340 | - } |
|
1341 | - else |
|
1333 | + } else |
|
1342 | 1334 | { |
1343 | 1335 | $this->_finalbody = $hdr.$this->newline.$this->newline.$this->_body; |
1344 | 1336 | } |
@@ -1351,8 +1343,7 @@ discard block |
||
1351 | 1343 | { |
1352 | 1344 | $hdr .= 'Content-Type: text/html; charset='.$this->charset.$this->newline |
1353 | 1345 | .'Content-Transfer-Encoding: quoted-printable'; |
1354 | - } |
|
1355 | - else |
|
1346 | + } else |
|
1356 | 1347 | { |
1357 | 1348 | $hdr .= 'Content-Type: multipart/alternative; boundary="'.$this->_alt_boundary.'"'; |
1358 | 1349 | |
@@ -1372,8 +1363,7 @@ discard block |
||
1372 | 1363 | if ($this->_get_protocol() === 'mail') |
1373 | 1364 | { |
1374 | 1365 | $this->_header_str .= $hdr; |
1375 | - } |
|
1376 | - else |
|
1366 | + } else |
|
1377 | 1367 | { |
1378 | 1368 | $this->_finalbody = $hdr.$this->newline.$this->newline.$this->_finalbody; |
1379 | 1369 | } |
@@ -1496,8 +1486,7 @@ discard block |
||
1496 | 1486 | if (is_php('5.3')) |
1497 | 1487 | { |
1498 | 1488 | return quoted_printable_encode($str); |
1499 | - } |
|
1500 | - elseif (function_exists('imap_8bit')) |
|
1489 | + } elseif (function_exists('imap_8bit')) |
|
1501 | 1490 | { |
1502 | 1491 | return imap_8bit($str); |
1503 | 1492 | } |
@@ -1544,8 +1533,7 @@ discard block |
||
1544 | 1533 | elseif ($ascii === 61) |
1545 | 1534 | { |
1546 | 1535 | $char = $escape.strtoupper(sprintf('%02s', dechex($ascii))); // =3D |
1547 | - } |
|
1548 | - elseif ( ! in_array($ascii, $ascii_safe_chars, TRUE)) |
|
1536 | + } elseif ( ! in_array($ascii, $ascii_safe_chars, TRUE)) |
|
1549 | 1537 | { |
1550 | 1538 | $char = $escape.strtoupper(sprintf('%02s', dechex($ascii))); |
1551 | 1539 | } |
@@ -1613,8 +1601,7 @@ discard block |
||
1613 | 1601 | } |
1614 | 1602 | |
1615 | 1603 | $chars = iconv_strlen($str, 'UTF-8'); |
1616 | - } |
|
1617 | - elseif (MB_ENABLED === TRUE) |
|
1604 | + } elseif (MB_ENABLED === TRUE) |
|
1618 | 1605 | { |
1619 | 1606 | $chars = mb_strlen($str, 'UTF-8'); |
1620 | 1607 | } |
@@ -1637,8 +1624,7 @@ discard block |
||
1637 | 1624 | $output .= '?='.$this->crlf // EOL |
1638 | 1625 | .' =?'.$this->charset.'?Q?'.$chr; // New line |
1639 | 1626 | $length = 6 + strlen($this->charset) + $l; // Reset the length for the new line |
1640 | - } |
|
1641 | - else |
|
1627 | + } else |
|
1642 | 1628 | { |
1643 | 1629 | $output .= $chr; |
1644 | 1630 | $length += $l; |
@@ -1749,8 +1735,7 @@ discard block |
||
1749 | 1735 | if ($this->protocol !== 'smtp') |
1750 | 1736 | { |
1751 | 1737 | $this->set_header('Bcc', implode(', ', $bcc)); |
1752 | - } |
|
1753 | - else |
|
1738 | + } else |
|
1754 | 1739 | { |
1755 | 1740 | $this->_bcc_array = $bcc; |
1756 | 1741 | } |
@@ -1833,8 +1818,7 @@ discard block |
||
1833 | 1818 | if ($this->_safe_mode === TRUE) |
1834 | 1819 | { |
1835 | 1820 | return mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str); |
1836 | - } |
|
1837 | - else |
|
1821 | + } else |
|
1838 | 1822 | { |
1839 | 1823 | // most documentation of sendmail using the "-f" flag lacks a space after it, however |
1840 | 1824 | // we've encountered servers that seem to require it to be in place. |
@@ -1857,10 +1841,12 @@ discard block |
||
1857 | 1841 | $this->mailpath.' -oi -f '.$this->clean_email($this->_headers['From']) |
1858 | 1842 | .' -t -r '.$this->clean_email($this->_headers['Return-Path']) |
1859 | 1843 | , 'w')) |
1860 | - ) // server probably has popen disabled, so nothing we can do to get a verbose error. |
|
1844 | + ) { |
|
1845 | + // server probably has popen disabled, so nothing we can do to get a verbose error. |
|
1861 | 1846 | { |
1862 | 1847 | return FALSE; |
1863 | 1848 | } |
1849 | + } |
|
1864 | 1850 | |
1865 | 1851 | fputs($fp, $this->_header_str); |
1866 | 1852 | fputs($fp, $this->_finalbody); |
@@ -1955,8 +1941,7 @@ discard block |
||
1955 | 1941 | if ($this->smtp_keepalive) |
1956 | 1942 | { |
1957 | 1943 | $this->_send_command('reset'); |
1958 | - } |
|
1959 | - else |
|
1944 | + } else |
|
1960 | 1945 | { |
1961 | 1946 | $this->_send_command('quit'); |
1962 | 1947 | } |
@@ -2030,8 +2015,7 @@ discard block |
||
2030 | 2015 | if ($this->_smtp_auth OR $this->_get_encoding() === '8bit') |
2031 | 2016 | { |
2032 | 2017 | $this->_send_data('EHLO '.$this->_get_hostname()); |
2033 | - } |
|
2034 | - else |
|
2018 | + } else |
|
2035 | 2019 | { |
2036 | 2020 | $this->_send_data('HELO '.$this->_get_hostname()); |
2037 | 2021 | } |
@@ -2053,8 +2037,7 @@ discard block |
||
2053 | 2037 | if ($this->dsn) |
2054 | 2038 | { |
2055 | 2039 | $this->_send_data('RCPT TO:<'.$data.'> NOTIFY=SUCCESS,DELAY,FAILURE ORCPT=rfc822;'.$data); |
2056 | - } |
|
2057 | - else |
|
2040 | + } else |
|
2058 | 2041 | { |
2059 | 2042 | $this->_send_data('RCPT TO:<'.$data.'>'); |
2060 | 2043 | } |
@@ -2120,11 +2103,12 @@ discard block |
||
2120 | 2103 | |
2121 | 2104 | $reply = $this->_get_smtp_data(); |
2122 | 2105 | |
2123 | - if (strpos($reply, '503') === 0) // Already authenticated |
|
2106 | + if (strpos($reply, '503') === 0) { |
|
2107 | + // Already authenticated |
|
2124 | 2108 | { |
2125 | 2109 | return TRUE; |
2126 | 2110 | } |
2127 | - elseif (strpos($reply, '334') !== 0) |
|
2111 | + } elseif (strpos($reply, '334') !== 0) |
|
2128 | 2112 | { |
2129 | 2113 | $this->_set_error_message('lang:email_failed_smtp_login', $reply); |
2130 | 2114 | return FALSE; |
@@ -2176,8 +2160,7 @@ discard block |
||
2176 | 2160 | if ($timestamp === 0) |
2177 | 2161 | { |
2178 | 2162 | $timestamp = time(); |
2179 | - } |
|
2180 | - elseif ($timestamp < (time() - $this->smtp_timeout)) |
|
2163 | + } elseif ($timestamp < (time() - $this->smtp_timeout)) |
|
2181 | 2164 | { |
2182 | 2165 | $result = FALSE; |
2183 | 2166 | break; |
@@ -2185,8 +2168,7 @@ discard block |
||
2185 | 2168 | |
2186 | 2169 | usleep(250000); |
2187 | 2170 | continue; |
2188 | - } |
|
2189 | - else |
|
2171 | + } else |
|
2190 | 2172 | { |
2191 | 2173 | $timestamp = 0; |
2192 | 2174 | } |
@@ -2308,8 +2290,7 @@ discard block |
||
2308 | 2290 | if (sscanf($msg, 'lang:%s', $line) !== 1 OR FALSE === ($line = $CI->lang->line($line))) |
2309 | 2291 | { |
2310 | 2292 | $this->_debug_msg[] = str_replace('%s', $val, $msg).'<br />'; |
2311 | - } |
|
2312 | - else |
|
2293 | + } else |
|
2313 | 2294 | { |
2314 | 2295 | $this->_debug_msg[] = str_replace('%s', $val, $line).'<br />'; |
2315 | 2296 | } |
@@ -191,13 +191,11 @@ discard block |
||
191 | 191 | if ($this->_drivers[$params['driver']]) |
192 | 192 | { |
193 | 193 | $this->_driver = $params['driver']; |
194 | - } |
|
195 | - else |
|
194 | + } else |
|
196 | 195 | { |
197 | 196 | log_message('error', "Encryption: Driver '".$params['driver']."' is not available."); |
198 | 197 | } |
199 | - } |
|
200 | - else |
|
198 | + } else |
|
201 | 199 | { |
202 | 200 | log_message('error', "Encryption: Unknown driver '".$params['driver']."' cannot be configured."); |
203 | 201 | } |
@@ -236,8 +234,7 @@ discard block |
||
236 | 234 | if ( ! in_array($params['cipher'], mcrypt_list_algorithms(), TRUE)) |
237 | 235 | { |
238 | 236 | log_message('error', 'Encryption: MCrypt cipher '.strtoupper($params['cipher']).' is not available.'); |
239 | - } |
|
240 | - else |
|
237 | + } else |
|
241 | 238 | { |
242 | 239 | $this->_cipher = $params['cipher']; |
243 | 240 | } |
@@ -249,8 +246,7 @@ discard block |
||
249 | 246 | if ( ! isset($this->_modes['mcrypt'][$params['mode']])) |
250 | 247 | { |
251 | 248 | log_message('error', 'Encryption: MCrypt mode '.strtoupper($params['mode']).' is not available.'); |
252 | - } |
|
253 | - else |
|
249 | + } else |
|
254 | 250 | { |
255 | 251 | $this->_mode = $this->_modes['mcrypt'][$params['mode']]; |
256 | 252 | } |
@@ -269,8 +265,7 @@ discard block |
||
269 | 265 | if ($this->_handle = mcrypt_module_open($this->_cipher, '', $this->_mode, '')) |
270 | 266 | { |
271 | 267 | log_message('info', 'Encryption: MCrypt cipher '.strtoupper($this->_cipher).' initialized in '.strtoupper($this->_mode).' mode.'); |
272 | - } |
|
273 | - else |
|
268 | + } else |
|
274 | 269 | { |
275 | 270 | log_message('error', 'Encryption: Unable to initialize MCrypt with cipher '.strtoupper($this->_cipher).' in '.strtoupper($this->_mode).' mode.'); |
276 | 271 | } |
@@ -300,8 +295,7 @@ discard block |
||
300 | 295 | if ( ! isset($this->_modes['openssl'][$params['mode']])) |
301 | 296 | { |
302 | 297 | log_message('error', 'Encryption: OpenSSL mode '.strtoupper($params['mode']).' is not available.'); |
303 | - } |
|
304 | - else |
|
298 | + } else |
|
305 | 299 | { |
306 | 300 | $this->_mode = $this->_modes['openssl'][$params['mode']]; |
307 | 301 | } |
@@ -318,8 +312,7 @@ discard block |
||
318 | 312 | { |
319 | 313 | $this->_handle = NULL; |
320 | 314 | log_message('error', 'Encryption: Unable to initialize OpenSSL with method '.strtoupper($handle).'.'); |
321 | - } |
|
322 | - else |
|
315 | + } else |
|
323 | 316 | { |
324 | 317 | $this->_handle = $handle; |
325 | 318 | log_message('info', 'Encryption: OpenSSL initialized with method '.strtoupper($handle).'.'); |
@@ -564,14 +557,12 @@ discard block |
||
564 | 557 | { |
565 | 558 | $iv = self::substr($data, 0, $iv_size); |
566 | 559 | $data = self::substr($data, $iv_size); |
567 | - } |
|
568 | - else |
|
560 | + } else |
|
569 | 561 | { |
570 | 562 | // MCrypt is dumb and this is ignored, only size matters |
571 | 563 | $iv = str_repeat("\x0", $iv_size); |
572 | 564 | } |
573 | - } |
|
574 | - else |
|
565 | + } else |
|
575 | 566 | { |
576 | 567 | $iv = NULL; |
577 | 568 | } |
@@ -617,8 +608,7 @@ discard block |
||
617 | 608 | { |
618 | 609 | $iv = self::substr($data, 0, $iv_size); |
619 | 610 | $data = self::substr($data, $iv_size); |
620 | - } |
|
621 | - else |
|
611 | + } else |
|
622 | 612 | { |
623 | 613 | $iv = NULL; |
624 | 614 | } |
@@ -657,8 +647,7 @@ discard block |
||
657 | 647 | 'hmac_key' => NULL |
658 | 648 | ) |
659 | 649 | : FALSE; |
660 | - } |
|
661 | - elseif ( ! isset($params['cipher'], $params['mode'], $params['key'])) |
|
650 | + } elseif ( ! isset($params['cipher'], $params['mode'], $params['key'])) |
|
662 | 651 | { |
663 | 652 | return FALSE; |
664 | 653 | } |
@@ -669,8 +658,7 @@ discard block |
||
669 | 658 | if ( ! isset($this->_modes[$this->_driver][$params['mode']])) |
670 | 659 | { |
671 | 660 | return FALSE; |
672 | - } |
|
673 | - else |
|
661 | + } else |
|
674 | 662 | { |
675 | 663 | $params['mode'] = $this->_modes[$this->_driver][$params['mode']]; |
676 | 664 | } |
@@ -679,22 +667,19 @@ discard block |
||
679 | 667 | if (isset($params['hmac']) && $params['hmac'] === FALSE) |
680 | 668 | { |
681 | 669 | $params['hmac_digest'] = $params['hmac_key'] = NULL; |
682 | - } |
|
683 | - else |
|
670 | + } else |
|
684 | 671 | { |
685 | 672 | if ( ! isset($params['hmac_key'])) |
686 | 673 | { |
687 | 674 | return FALSE; |
688 | - } |
|
689 | - elseif (isset($params['hmac_digest'])) |
|
675 | + } elseif (isset($params['hmac_digest'])) |
|
690 | 676 | { |
691 | 677 | $params['hmac_digest'] = strtolower($params['hmac_digest']); |
692 | 678 | if ( ! isset($this->_digests[$params['hmac_digest']])) |
693 | 679 | { |
694 | 680 | return FALSE; |
695 | 681 | } |
696 | - } |
|
697 | - else |
|
682 | + } else |
|
698 | 683 | { |
699 | 684 | $params['hmac_digest'] = 'sha512'; |
700 | 685 | } |
@@ -847,8 +832,7 @@ discard block |
||
847 | 832 | if (empty($length) OR ! is_int($length)) |
848 | 833 | { |
849 | 834 | $length = $this->_digests[$digest]; |
850 | - } |
|
851 | - elseif ($length > (255 * $this->_digests[$digest])) |
|
835 | + } elseif ($length > (255 * $this->_digests[$digest])) |
|
852 | 836 | { |
853 | 837 | return FALSE; |
854 | 838 | } |
@@ -880,8 +864,7 @@ discard block |
||
880 | 864 | if ($key === 'mode') |
881 | 865 | { |
882 | 866 | return array_search($this->_mode, $this->_modes[$this->_driver], TRUE); |
883 | - } |
|
884 | - elseif (in_array($key, array('cipher', 'driver', 'drivers', 'digests'), TRUE)) |
|
867 | + } elseif (in_array($key, array('cipher', 'driver', 'drivers', 'digests'), TRUE)) |
|
885 | 868 | { |
886 | 869 | return $this->{'_'.$key}; |
887 | 870 | } |
@@ -202,8 +202,7 @@ discard block |
||
202 | 202 | if ( ! is_string($field) OR $field === '' OR empty($rules)) |
203 | 203 | { |
204 | 204 | return $this; |
205 | - } |
|
206 | - elseif ( ! is_array($rules)) |
|
205 | + } elseif ( ! is_array($rules)) |
|
207 | 206 | { |
208 | 207 | // BC: Convert pipe-separated rules string to an array |
209 | 208 | if ( ! is_string($rules)) |
@@ -460,8 +459,7 @@ discard block |
||
460 | 459 | if ($row['is_array'] === TRUE) |
461 | 460 | { |
462 | 461 | $this->_field_data[$field]['postdata'] = $this->_reduce_array($validation_array, $row['keys']); |
463 | - } |
|
464 | - elseif (isset($validation_array[$field])) |
|
462 | + } elseif (isset($validation_array[$field])) |
|
465 | 463 | { |
466 | 464 | $this->_field_data[$field]['postdata'] = $validation_array[$field]; |
467 | 465 | } |
@@ -534,8 +532,7 @@ discard block |
||
534 | 532 | { |
535 | 533 | $_POST[$row['field']] = $row['postdata']; |
536 | 534 | } |
537 | - } |
|
538 | - else |
|
535 | + } else |
|
539 | 536 | { |
540 | 537 | // start with a reference |
541 | 538 | $post_ref =& $_POST; |
@@ -544,8 +541,7 @@ discard block |
||
544 | 541 | if (count($row['keys']) === 1) |
545 | 542 | { |
546 | 543 | $post_ref =& $post_ref[current($row['keys'])]; |
547 | - } |
|
548 | - else |
|
544 | + } else |
|
549 | 545 | { |
550 | 546 | foreach ($row['keys'] as $val) |
551 | 547 | { |
@@ -562,8 +558,7 @@ discard block |
||
562 | 558 | } |
563 | 559 | |
564 | 560 | $post_ref = $array; |
565 | - } |
|
566 | - else |
|
561 | + } else |
|
567 | 562 | { |
568 | 563 | $post_ref = $row['postdata']; |
569 | 564 | } |
@@ -611,14 +606,12 @@ discard block |
||
611 | 606 | $rules = array(1 => $rule); |
612 | 607 | break; |
613 | 608 | } |
614 | - } |
|
615 | - elseif (is_callable($rule)) |
|
609 | + } elseif (is_callable($rule)) |
|
616 | 610 | { |
617 | 611 | $callback = TRUE; |
618 | 612 | $rules = array(1 => $rule); |
619 | 613 | break; |
620 | - } |
|
621 | - elseif (is_array($rule) && isset($rule[0], $rule[1]) && is_callable($rule[1])) |
|
614 | + } elseif (is_array($rule) && isset($rule[0], $rule[1]) && is_callable($rule[1])) |
|
622 | 615 | { |
623 | 616 | $callback = TRUE; |
624 | 617 | $rules = array(array($rule[0], $rule[1])); |
@@ -644,12 +637,10 @@ discard block |
||
644 | 637 | if (isset($this->_field_data[$row['field']]['errors'][$type])) |
645 | 638 | { |
646 | 639 | $line = $this->_field_data[$row['field']]['errors'][$type]; |
647 | - } |
|
648 | - elseif (isset($this->_error_messages[$type])) |
|
640 | + } elseif (isset($this->_error_messages[$type])) |
|
649 | 641 | { |
650 | 642 | $line = $this->_error_messages[$type]; |
651 | - } |
|
652 | - elseif (FALSE === ($line = $this->CI->lang->line('form_validation_'.$type)) |
|
643 | + } elseif (FALSE === ($line = $this->CI->lang->line('form_validation_'.$type)) |
|
653 | 644 | // DEPRECATED support for non-prefixed keys |
654 | 645 | && FALSE === ($line = $this->CI->lang->line($type, FALSE))) |
655 | 646 | { |
@@ -691,8 +682,7 @@ discard block |
||
691 | 682 | |
692 | 683 | $postdata = $this->_field_data[$row['field']]['postdata'][$cycles]; |
693 | 684 | $_in_array = TRUE; |
694 | - } |
|
695 | - else |
|
685 | + } else |
|
696 | 686 | { |
697 | 687 | // If we get an array field, but it's not expected - then it is most likely |
698 | 688 | // somebody messing with the form on the client side, so we'll just consider |
@@ -711,12 +701,10 @@ discard block |
||
711 | 701 | $rule = substr($rule, 9); |
712 | 702 | $callback = TRUE; |
713 | 703 | } |
714 | - } |
|
715 | - elseif (is_callable($rule)) |
|
704 | + } elseif (is_callable($rule)) |
|
716 | 705 | { |
717 | 706 | $callable = TRUE; |
718 | - } |
|
719 | - elseif (is_array($rule) && isset($rule[0], $rule[1]) && is_callable($rule[1])) |
|
707 | + } elseif (is_array($rule) && isset($rule[0], $rule[1]) && is_callable($rule[1])) |
|
720 | 708 | { |
721 | 709 | // We have a "named" callable, so save the name |
722 | 710 | $callable = $rule[0]; |
@@ -741,14 +729,12 @@ discard block |
||
741 | 729 | { |
742 | 730 | log_message('debug', 'Unable to find callback validation rule: '.$rule); |
743 | 731 | $result = FALSE; |
744 | - } |
|
745 | - else |
|
732 | + } else |
|
746 | 733 | { |
747 | 734 | // Run the function and grab the result |
748 | 735 | $result = $this->CI->$rule($postdata, $param); |
749 | 736 | } |
750 | - } |
|
751 | - else |
|
737 | + } else |
|
752 | 738 | { |
753 | 739 | $result = is_array($rule) |
754 | 740 | ? $rule[0]->{$rule[1]}($postdata) |
@@ -765,8 +751,7 @@ discard block |
||
765 | 751 | if ($_in_array === TRUE) |
766 | 752 | { |
767 | 753 | $this->_field_data[$row['field']]['postdata'][$cycles] = is_bool($result) ? $postdata : $result; |
768 | - } |
|
769 | - else |
|
754 | + } else |
|
770 | 755 | { |
771 | 756 | $this->_field_data[$row['field']]['postdata'] = is_bool($result) ? $postdata : $result; |
772 | 757 | } |
@@ -776,8 +761,7 @@ discard block |
||
776 | 761 | { |
777 | 762 | continue; |
778 | 763 | } |
779 | - } |
|
780 | - elseif ( ! method_exists($this, $rule)) |
|
764 | + } elseif ( ! method_exists($this, $rule)) |
|
781 | 765 | { |
782 | 766 | // If our own wrapper function doesn't exist we see if a native PHP function does. |
783 | 767 | // Users can use any native PHP function call that has one param. |
@@ -789,27 +773,23 @@ discard block |
||
789 | 773 | if ($_in_array === TRUE) |
790 | 774 | { |
791 | 775 | $this->_field_data[$row['field']]['postdata'][$cycles] = is_bool($result) ? $postdata : $result; |
792 | - } |
|
793 | - else |
|
776 | + } else |
|
794 | 777 | { |
795 | 778 | $this->_field_data[$row['field']]['postdata'] = is_bool($result) ? $postdata : $result; |
796 | 779 | } |
797 | - } |
|
798 | - else |
|
780 | + } else |
|
799 | 781 | { |
800 | 782 | log_message('debug', 'Unable to find validation rule: '.$rule); |
801 | 783 | $result = FALSE; |
802 | 784 | } |
803 | - } |
|
804 | - else |
|
785 | + } else |
|
805 | 786 | { |
806 | 787 | $result = $this->$rule($postdata, $param); |
807 | 788 | |
808 | 789 | if ($_in_array === TRUE) |
809 | 790 | { |
810 | 791 | $this->_field_data[$row['field']]['postdata'][$cycles] = is_bool($result) ? $postdata : $result; |
811 | - } |
|
812 | - else |
|
792 | + } else |
|
813 | 793 | { |
814 | 794 | $this->_field_data[$row['field']]['postdata'] = is_bool($result) ? $postdata : $result; |
815 | 795 | } |
@@ -827,8 +807,7 @@ discard block |
||
827 | 807 | elseif (isset($this->_field_data[$row['field']]['errors'][$rule])) |
828 | 808 | { |
829 | 809 | $line = $this->_field_data[$row['field']]['errors'][$rule]; |
830 | - } |
|
831 | - elseif ( ! isset($this->_error_messages[$rule])) |
|
810 | + } elseif ( ! isset($this->_error_messages[$rule])) |
|
832 | 811 | { |
833 | 812 | if (FALSE === ($line = $this->CI->lang->line('form_validation_'.$rule)) |
834 | 813 | // DEPRECATED support for non-prefixed keys |
@@ -836,8 +815,7 @@ discard block |
||
836 | 815 | { |
837 | 816 | $line = $this->CI->lang->line('form_validation_error_message_not_set').'('.$rule.')'; |
838 | 817 | } |
839 | - } |
|
840 | - else |
|
818 | + } else |
|
841 | 819 | { |
842 | 820 | $line = $this->_error_messages[$rule]; |
843 | 821 | } |
@@ -984,8 +962,7 @@ discard block |
||
984 | 962 | } |
985 | 963 | |
986 | 964 | return ''; |
987 | - } |
|
988 | - elseif (($field === '' OR $value === '') OR ($field !== $value)) |
|
965 | + } elseif (($field === '' OR $value === '') OR ($field !== $value)) |
|
989 | 966 | { |
990 | 967 | return ''; |
991 | 968 | } |
@@ -1027,8 +1004,7 @@ discard block |
||
1027 | 1004 | } |
1028 | 1005 | |
1029 | 1006 | return ''; |
1030 | - } |
|
1031 | - elseif (($field === '' OR $value === '') OR ($field !== $value)) |
|
1007 | + } elseif (($field === '' OR $value === '') OR ($field !== $value)) |
|
1032 | 1008 | { |
1033 | 1009 | return ''; |
1034 | 1010 | } |
@@ -1202,14 +1178,12 @@ discard block |
||
1202 | 1178 | if (empty($str)) |
1203 | 1179 | { |
1204 | 1180 | return FALSE; |
1205 | - } |
|
1206 | - elseif (preg_match('/^(?:([^:]*)\:)?\/\/(.+)$/', $str, $matches)) |
|
1181 | + } elseif (preg_match('/^(?:([^:]*)\:)?\/\/(.+)$/', $str, $matches)) |
|
1207 | 1182 | { |
1208 | 1183 | if (empty($matches[2])) |
1209 | 1184 | { |
1210 | 1185 | return FALSE; |
1211 | - } |
|
1212 | - elseif ( ! in_array($matches[1], array('http', 'https'), TRUE)) |
|
1186 | + } elseif ( ! in_array($matches[1], array('http', 'https'), TRUE)) |
|
1213 | 1187 | { |
1214 | 1188 | return FALSE; |
1215 | 1189 | } |
@@ -588,8 +588,7 @@ |
||
588 | 588 | if (is_dir($locpath.$file) && $file[0] !== '.') |
589 | 589 | { |
590 | 590 | $this->mirror($locpath.$file.'/', $rempath.$file.'/'); |
591 | - } |
|
592 | - elseif ($file[0] !== '.') |
|
591 | + } elseif ($file[0] !== '.') |
|
593 | 592 | { |
594 | 593 | // Get the file extension so we can se the upload type |
595 | 594 | $ext = $this->_getext($file); |