From 7327499064ae165468c7440f8571c3e570b58a0b Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Mon, 5 May 2008 16:39:18 +0000 Subject: Added get_dir_file_info(), get_file_info(), and get_mime_by_extension() to the File Helper. Changed ( ! condition) into (! condition) within the code --- system/codeigniter/Common.php | 10 +- system/codeigniter/Compat.php | 2 +- system/database/DB.php | 10 +- system/database/DB_active_rec.php | 44 ++--- system/database/DB_cache.php | 10 +- system/database/DB_driver.php | 40 ++--- system/database/DB_result.php | 6 +- system/database/DB_utility.php | 10 +- system/database/drivers/mssql/mssql_driver.php | 6 +- system/database/drivers/mysql/mysql_driver.php | 6 +- system/database/drivers/mysqli/mysqli_driver.php | 6 +- system/database/drivers/oci8/oci8_driver.php | 12 +- system/database/drivers/odbc/odbc_driver.php | 6 +- system/database/drivers/postgre/postgre_driver.php | 6 +- system/database/drivers/sqlite/sqlite_driver.php | 10 +- system/database/drivers/sqlite/sqlite_forge.php | 2 +- system/database/drivers/sqlite/sqlite_utility.php | 2 +- system/helpers/array_helper.php | 4 +- system/helpers/cookie_helper.php | 2 +- system/helpers/date_helper.php | 12 +- system/helpers/download_helper.php | 2 +- system/helpers/email_helper.php | 2 +- system/helpers/file_helper.php | 181 ++++++++++++++++++++- system/helpers/form_helper.php | 26 +-- system/helpers/html_helper.php | 6 +- system/helpers/path_helper.php | 2 +- system/helpers/security_helper.php | 4 +- system/helpers/smiley_helper.php | 8 +- system/helpers/text_helper.php | 4 +- system/helpers/typography_helper.php | 24 +-- system/helpers/url_helper.php | 10 +- system/libraries/Benchmark.php | 4 +- system/libraries/Calendar.php | 4 +- system/libraries/Config.php | 12 +- system/libraries/Controller.php | 2 +- system/libraries/Email.php | 52 +++--- system/libraries/Encrypt.php | 6 +- system/libraries/Exceptions.php | 6 +- system/libraries/Ftp.php | 34 ++-- system/libraries/Hooks.php | 14 +- system/libraries/Image_lib.php | 58 +++---- system/libraries/Input.php | 22 +-- system/libraries/Language.php | 2 +- system/libraries/Loader.php | 36 ++-- system/libraries/Log.php | 8 +- system/libraries/Model.php | 2 +- system/libraries/Output.php | 18 +- system/libraries/Pagination.php | 2 +- system/libraries/Parser.php | 4 +- system/libraries/Profiler.php | 6 +- system/libraries/Router.php | 8 +- system/libraries/Session.php | 8 +- system/libraries/Table.php | 18 +- system/libraries/Trackback.php | 24 +-- system/libraries/URI.php | 12 +- system/libraries/Unit_test.php | 8 +- system/libraries/Upload.php | 42 ++--- system/libraries/User_agent.php | 8 +- system/libraries/Validation.php | 48 +++--- system/libraries/Xmlrpc.php | 18 +- system/libraries/Xmlrpcs.php | 8 +- system/libraries/Zip.php | 8 +- system/plugins/captcha_pi.php | 12 +- system/scaffolding/Scaffolding.php | 14 +- 64 files changed, 585 insertions(+), 418 deletions(-) (limited to 'system') diff --git a/system/codeigniter/Common.php b/system/codeigniter/Common.php index 4554a712b..05720a459 100644 --- a/system/codeigniter/Common.php +++ b/system/codeigniter/Common.php @@ -140,16 +140,16 @@ function &get_config() { static $main_conf; - if ( ! isset($main_conf)) + if (! isset($main_conf)) { - if ( ! file_exists(APPPATH.'config/config'.EXT)) + if (! file_exists(APPPATH.'config/config'.EXT)) { exit('The configuration file config'.EXT.' does not exist.'); } require(APPPATH.'config/config'.EXT); - if ( ! isset($config) OR ! is_array($config)) + if (! isset($config) OR ! is_array($config)) { exit('Your config file does not appear to be formatted correctly.'); } @@ -169,11 +169,11 @@ function config_item($item) { static $config_item = array(); - if ( ! isset($config_item[$item])) + if (! isset($config_item[$item])) { $config =& get_config(); - if ( ! isset($config[$item])) + if (! isset($config[$item])) { return FALSE; } diff --git a/system/codeigniter/Compat.php b/system/codeigniter/Compat.php index 56ebbf45d..8537432f5 100644 --- a/system/codeigniter/Compat.php +++ b/system/codeigniter/Compat.php @@ -36,7 +36,7 @@ * will generate errors when running under PHP 4 * */ -if ( ! defined('E_STRICT')) +if (! defined('E_STRICT')) { define('E_STRICT', 2048); } diff --git a/system/database/DB.php b/system/database/DB.php index 16ca1c888..8efe05560 100644 --- a/system/database/DB.php +++ b/system/database/DB.php @@ -29,7 +29,7 @@ function &DB($params = '', $active_record_override = FALSE) { include(APPPATH.'config/database'.EXT); - if ( ! isset($db) OR count($db) == 0) + if (! isset($db) OR count($db) == 0) { show_error('No database connection settings were found in the database config file.'); } @@ -39,7 +39,7 @@ function &DB($params = '', $active_record_override = FALSE) $active_group = $params; } - if ( ! isset($active_group) OR ! isset($db[$active_group])) + if (! isset($active_group) OR ! isset($db[$active_group])) { show_error('You have specified an invalid database connection group.'); } @@ -71,7 +71,7 @@ function &DB($params = '', $active_record_override = FALSE) } // No DB specified yet? Beat them senseless... - if ( ! isset($params['dbdriver']) OR $params['dbdriver'] == '') + if (! isset($params['dbdriver']) OR $params['dbdriver'] == '') { show_error('You have not selected a database type to connect to.'); } @@ -92,14 +92,14 @@ function &DB($params = '', $active_record_override = FALSE) { require_once(BASEPATH.'database/DB_active_rec'.EXT); - if ( ! class_exists('CI_DB')) + if (! class_exists('CI_DB')) { eval('class CI_DB extends CI_DB_active_record { }'); } } else { - if ( ! class_exists('CI_DB')) + if (! class_exists('CI_DB')) { eval('class CI_DB extends CI_DB_driver { }'); } diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 6f50c110d..1820bd202 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -315,7 +315,7 @@ class CI_DB_active_record extends CI_DB_driver { { $type = strtoupper(trim($type)); - if ( ! in_array($type, array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER'), TRUE)) + if (! in_array($type, array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER'), TRUE)) { $type = ''; } @@ -411,7 +411,7 @@ class CI_DB_active_record extends CI_DB_driver { */ function _where($key, $value = NULL, $type = 'AND ', $escape = TRUE) { - if ( ! is_array($key)) + if (! is_array($key)) { $key = array($key => $value); } @@ -420,13 +420,13 @@ class CI_DB_active_record extends CI_DB_driver { { $prefix = (count($this->ar_where) == 0) ? '' : $type; - if ( ! $this->_has_operator($k) && is_null($key[$k])) + if (! $this->_has_operator($k) && is_null($key[$k])) { // value appears not to have been set, assign the test to IS NULL $k .= ' IS NULL'; } - if ( ! is_null($v)) + if (! is_null($v)) { if ($escape === TRUE) @@ -442,7 +442,7 @@ class CI_DB_active_record extends CI_DB_driver { } } - if ( ! $this->_has_operator($k)) + if (! $this->_has_operator($k)) { $k .= ' ='; } @@ -690,7 +690,7 @@ class CI_DB_active_record extends CI_DB_driver { */ function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '') { - if ( ! is_array($field)) + if (! is_array($field)) { $field = array($field => $match); } @@ -832,7 +832,7 @@ class CI_DB_active_record extends CI_DB_driver { */ function _having($key, $value = '', $type = 'AND ', $escape = TRUE) { - if ( ! is_array($key)) + if (! is_array($key)) { $key = array($key => $value); } @@ -972,7 +972,7 @@ class CI_DB_active_record extends CI_DB_driver { { $key = $this->_object_to_array($key); - if ( ! is_array($key)) + if (! is_array($key)) { $key = array($key => $value); } @@ -1022,7 +1022,7 @@ class CI_DB_active_record extends CI_DB_driver { $this->from($table); } - if ( ! is_null($limit)) + if (! is_null($limit)) { $this->limit($limit, $offset); } @@ -1087,12 +1087,12 @@ class CI_DB_active_record extends CI_DB_driver { $this->from($table); } - if ( ! is_null($where)) + if (! is_null($where)) { $this->where($where); } - if ( ! is_null($limit)) + if (! is_null($limit)) { $this->limit($limit, $offset); } @@ -1130,7 +1130,7 @@ class CI_DB_active_record extends CI_DB_driver { */ function insert($table = '', $set = NULL) { - if ( ! is_null($set)) + if (! is_null($set)) { $this->set($set); } @@ -1146,7 +1146,7 @@ class CI_DB_active_record extends CI_DB_driver { if ($table == '') { - if ( ! isset($this->ar_from[0])) + if (! isset($this->ar_from[0])) { if ($this->db_debug) { @@ -1179,7 +1179,7 @@ class CI_DB_active_record extends CI_DB_driver { */ function update($table = '', $set = NULL, $where = NULL, $limit = NULL) { - if ( ! is_null($set)) + if (! is_null($set)) { $this->set($set); } @@ -1195,7 +1195,7 @@ class CI_DB_active_record extends CI_DB_driver { if ($table == '') { - if ( ! isset($this->ar_from[0])) + if (! isset($this->ar_from[0])) { if ($this->db_debug) { @@ -1238,7 +1238,7 @@ class CI_DB_active_record extends CI_DB_driver { { if ($table == '') { - if ( ! isset($this->ar_from[0])) + if (! isset($this->ar_from[0])) { if ($this->db_debug) { @@ -1279,7 +1279,7 @@ class CI_DB_active_record extends CI_DB_driver { { if ($table == '') { - if ( ! isset($this->ar_from[0])) + if (! isset($this->ar_from[0])) { if ($this->db_debug) { @@ -1321,7 +1321,7 @@ class CI_DB_active_record extends CI_DB_driver { { if ($table == '') { - if ( ! isset($this->ar_from[0])) + if (! isset($this->ar_from[0])) { if ($this->db_debug) { @@ -1401,7 +1401,7 @@ class CI_DB_active_record extends CI_DB_driver { function _has_operator($str) { $str = trim($str); - if ( ! preg_match("/(\s|<|>|!|=|is null|is not null)/i", $str)) + if (! preg_match("/(\s|<|>|!|=|is null|is not null)/i", $str)) { return FALSE; } @@ -1474,7 +1474,7 @@ class CI_DB_active_record extends CI_DB_driver { { $this->_merge_cache(); - $sql = ( ! $this->ar_distinct) ? 'SELECT ' : 'SELECT DISTINCT '; + $sql = (! $this->ar_distinct) ? 'SELECT ' : 'SELECT DISTINCT '; $sql .= (count($this->ar_select) == 0) ? '*' : implode(', ', $this->_filter_table_aliases($this->ar_select)); @@ -1577,7 +1577,7 @@ class CI_DB_active_record extends CI_DB_driver { */ function _object_to_array($object) { - if ( ! is_object($object)) + if (! is_object($object)) { return $object; } @@ -1586,7 +1586,7 @@ class CI_DB_active_record extends CI_DB_driver { foreach (get_object_vars($object) as $key => $val) { // There are some built in keys we need to ignore for this conversion - if ( ! is_object($val) && ! is_array($val) && $key != '_parent_name' && $key != '_ci_scaffolding' && $key != '_ci_scaff_table') + if (! is_object($val) && ! is_array($val) && $key != '_parent_name' && $key != '_ci_scaffolding' && $key != '_ci_scaff_table') { $array[$key] = $val; diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 08394da29..982725aaa 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -64,7 +64,7 @@ class CI_DB_Cache { // Add a trailing slash to the path if needed $path = preg_replace("/(.+?)\/*$/", "\\1/", $path); - if ( ! is_dir($path) OR ! is_really_writable($path)) + if (! is_dir($path) OR ! is_really_writable($path)) { // If the path is wrong we'll turn off caching return $this->CI->db->cache_off(); @@ -87,7 +87,7 @@ class CI_DB_Cache { */ function read($sql) { - if ( ! $this->check_path()) + if (! $this->check_path()) { return $this->CI->db->cache_off(); } @@ -115,7 +115,7 @@ class CI_DB_Cache { */ function write($sql, $object) { - if ( ! $this->check_path()) + if (! $this->check_path()) { return $this->CI->db->cache_off(); } @@ -127,9 +127,9 @@ class CI_DB_Cache { $filename = md5($sql); - if ( ! @is_dir($dir_path)) + if (! @is_dir($dir_path)) { - if ( ! @mkdir($dir_path, DIR_WRITE_MODE)) + if (! @mkdir($dir_path, DIR_WRITE_MODE)) { return FALSE; } diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index b1013178e..0f3a1ea0a 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -107,7 +107,7 @@ class CI_DB_driver { $this->conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect(); // No connection? Throw an error - if ( ! $this->conn_id) + if (! $this->conn_id) { log_message('error', 'Unable to connect to the database'); @@ -121,7 +121,7 @@ class CI_DB_driver { // Select the database if ($this->database != '') { - if ( ! $this->db_select()) + if (! $this->db_select()) { // Should we attempt to create the database? if ($create_db == TRUE) @@ -131,7 +131,7 @@ class CI_DB_driver { $CI->load->dbutil(); // Create the DB - if ( ! $CI->dbutil->create_database($this->database)) + if (! $CI->dbutil->create_database($this->database)) { log_message('error', 'Unable to create database: '.$this->database); @@ -401,7 +401,7 @@ class CI_DB_driver { { $driver = 'CI_DB_'.$this->dbdriver.'_result'; - if ( ! class_exists($driver)) + if (! class_exists($driver)) { include_once(BASEPATH.'database/DB_result'.EXT); include_once(BASEPATH.'database/drivers/'.$this->dbdriver.'/'.$this->dbdriver.'_result'.EXT); @@ -424,7 +424,7 @@ class CI_DB_driver { */ function simple_query($sql) { - if ( ! $this->conn_id) + if (! $this->conn_id) { $this->initialize(); } @@ -456,7 +456,7 @@ class CI_DB_driver { */ function trans_start($test_mode = FALSE) { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return FALSE; } @@ -481,7 +481,7 @@ class CI_DB_driver { */ function trans_complete() { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return FALSE; } @@ -539,7 +539,7 @@ class CI_DB_driver { return $sql; } - if ( ! is_array($binds)) + if (! is_array($binds)) { $binds = array($binds); } @@ -576,7 +576,7 @@ class CI_DB_driver { */ function is_write_type($sql) { - if ( ! preg_match('/^\s*"?(INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|LOAD DATA|COPY|ALTER|GRANT|REVOKE|LOCK|UNLOCK)\s+/i', $sql)) + if (! preg_match('/^\s*"?(INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|LOAD DATA|COPY|ALTER|GRANT|REVOKE|LOCK|UNLOCK)\s+/i', $sql)) { return FALSE; } @@ -683,7 +683,7 @@ class CI_DB_driver { { $fields = $this->list_fields($table); - if ( ! is_array($fields)) + if (! is_array($fields)) { return FALSE; } @@ -747,7 +747,7 @@ class CI_DB_driver { */ function table_exists($table_name) { - return ( ! in_array($this->prep_tablename($table_name), $this->list_tables())) ? FALSE : TRUE; + return (! in_array($this->prep_tablename($table_name), $this->list_tables())) ? FALSE : TRUE; } // -------------------------------------------------------------------- @@ -815,7 +815,7 @@ class CI_DB_driver { */ function field_exists($field_name, $table_name) { - return ( ! in_array($field_name, $this->list_fields($table_name))) ? FALSE : TRUE; + return (! in_array($field_name, $this->list_fields($table_name))) ? FALSE : TRUE; } // -------------------------------------------------------------------- @@ -899,7 +899,7 @@ class CI_DB_driver { $fields[$key] = $this->escape($val); } - if ( ! is_array($where)) + if (! is_array($where)) { $dest = array($where); } @@ -912,7 +912,7 @@ class CI_DB_driver { if ($val !== '') { - if ( ! $this->_has_operator($key)) + if (! $this->_has_operator($key)) { $key .= ' ='; } @@ -969,7 +969,7 @@ class CI_DB_driver { $function = $driver.$function; } - if ( ! function_exists($function)) + if (! function_exists($function)) { if ($this->db_debug) { @@ -1038,7 +1038,7 @@ class CI_DB_driver { */ function cache_delete($segment_one = '', $segment_two = '') { - if ( ! $this->_cache_init()) + if (! $this->_cache_init()) { return FALSE; } @@ -1055,7 +1055,7 @@ class CI_DB_driver { */ function cache_delete_all() { - if ( ! $this->_cache_init()) + if (! $this->_cache_init()) { return FALSE; } @@ -1078,7 +1078,7 @@ class CI_DB_driver { return TRUE; } - if ( ! @include(BASEPATH.'database/DB_cache'.EXT)) + if (! @include(BASEPATH.'database/DB_cache'.EXT)) { return $this->cache_off(); } @@ -1129,10 +1129,10 @@ class CI_DB_driver { } else { - $message = ( ! is_array($error)) ? array(str_replace('%s', $swap, $LANG->line($error))) : $error; + $message = (! is_array($error)) ? array(str_replace('%s', $swap, $LANG->line($error))) : $error; } - if ( ! class_exists('CI_Exceptions')) + if (! class_exists('CI_Exceptions')) { // include(BASEPATH.'core/Exceptions'.EXT); include(BASEPATH.'libraries/Exceptions'.EXT); diff --git a/system/database/DB_result.php b/system/database/DB_result.php index c2eeefb94..cfe9d2a32 100644 --- a/system/database/DB_result.php +++ b/system/database/DB_result.php @@ -125,10 +125,10 @@ class CI_DB_result { */ function row($n = 0, $type = 'object') { - if ( ! is_numeric($n)) + if (! is_numeric($n)) { // We cache the row data for subsequent uses - if ( ! is_array($this->row_data)) + if (! is_array($this->row_data)) { $this->row_data = $this->row_array(0); } @@ -156,7 +156,7 @@ class CI_DB_result { function set_row($key, $value = NULL) { // We cache the row data for subsequent uses - if ( ! is_array($this->row_data)) + if (! is_array($this->row_data)) { $this->row_data = $this->row_array(0); } diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index d9b8fed74..11f1fb4de 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -175,7 +175,7 @@ class CI_DB_utility extends CI_DB_forge { */ function csv_from_result($query, $delim = ",", $newline = "\n", $enclosure = '"') { - if ( ! is_object($query) OR ! method_exists($query, 'field_names')) + if (! is_object($query) OR ! method_exists($query, 'field_names')) { show_error('You must submit a valid result object'); } @@ -217,7 +217,7 @@ class CI_DB_utility extends CI_DB_forge { */ function xml_from_result($query, $params = array()) { - if ( ! is_object($query) OR ! method_exists($query, 'field_names')) + if (! is_object($query) OR ! method_exists($query, 'field_names')) { show_error('You must submit a valid result object'); } @@ -225,7 +225,7 @@ class CI_DB_utility extends CI_DB_forge { // Set our default values foreach (array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t") as $key => $val) { - if ( ! isset($params[$key])) + if (! isset($params[$key])) { $params[$key] = $val; } @@ -310,7 +310,7 @@ class CI_DB_utility extends CI_DB_forge { // ------------------------------------------------------ // Validate the format - if ( ! in_array($prefs['format'], array('gzip', 'zip', 'txt'), TRUE)) + if (! in_array($prefs['format'], array('gzip', 'zip', 'txt'), TRUE)) { $prefs['format'] = 'txt'; } @@ -367,7 +367,7 @@ class CI_DB_utility extends CI_DB_forge { } // Tack on the ".sql" file extension if needed - if ( ! preg_match("|.+?\.sql$|", $prefs['filename'])) + if (! preg_match("|.+?\.sql$|", $prefs['filename'])) { $prefs['filename'] .= '.sql'; } diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 1ed333de0..6e67c57c0 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -132,7 +132,7 @@ class CI_DB_mssql_driver extends CI_DB { */ function trans_begin($test_mode = FALSE) { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } @@ -162,7 +162,7 @@ class CI_DB_mssql_driver extends CI_DB { */ function trans_commit() { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } @@ -187,7 +187,7 @@ class CI_DB_mssql_driver extends CI_DB { */ function trans_rollback() { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index f435c0bc4..f15983d2b 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -161,7 +161,7 @@ class CI_DB_mysql_driver extends CI_DB { */ function trans_begin($test_mode = FALSE) { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } @@ -192,7 +192,7 @@ class CI_DB_mysql_driver extends CI_DB { */ function trans_commit() { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } @@ -218,7 +218,7 @@ class CI_DB_mysql_driver extends CI_DB { */ function trans_rollback() { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index 6ff37f7e2..a196f755a 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -164,7 +164,7 @@ class CI_DB_mysqli_driver extends CI_DB { */ function trans_begin($test_mode = FALSE) { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } @@ -195,7 +195,7 @@ class CI_DB_mysqli_driver extends CI_DB { */ function trans_commit() { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } @@ -221,7 +221,7 @@ class CI_DB_mysqli_driver extends CI_DB { */ function trans_rollback() { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 364268b98..8fc20449f 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -155,7 +155,7 @@ class CI_DB_oci8_driver extends CI_DB { */ function _set_stmt_id($sql) { - if ( ! is_resource($this->stmt_id)) + if (! is_resource($this->stmt_id)) { $this->stmt_id = ociparse($this->conn_id, $this->_prep_query($sql)); } @@ -254,7 +254,7 @@ class CI_DB_oci8_driver extends CI_DB { */ function _bind_params($params) { - if ( ! is_array($params) OR ! is_resource($this->stmt_id)) + if (! is_array($params) OR ! is_resource($this->stmt_id)) { return; } @@ -263,7 +263,7 @@ class CI_DB_oci8_driver extends CI_DB { { foreach (array('name', 'value', 'type', 'length') as $val) { - if ( ! isset($param[$val])) + if (! isset($param[$val])) { $param[$val] = ''; } @@ -283,7 +283,7 @@ class CI_DB_oci8_driver extends CI_DB { */ function trans_begin($test_mode = FALSE) { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } @@ -313,7 +313,7 @@ class CI_DB_oci8_driver extends CI_DB { */ function trans_commit() { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } @@ -339,7 +339,7 @@ class CI_DB_oci8_driver extends CI_DB { */ function trans_rollback() { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index 82fe36b5d..20e34ec7b 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -152,7 +152,7 @@ class CI_DB_odbc_driver extends CI_DB { */ function trans_begin($test_mode = FALSE) { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } @@ -181,7 +181,7 @@ class CI_DB_odbc_driver extends CI_DB { */ function trans_commit() { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } @@ -207,7 +207,7 @@ class CI_DB_odbc_driver extends CI_DB { */ function trans_rollback() { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 4eff97fcc..46ba1d009 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -150,7 +150,7 @@ class CI_DB_postgre_driver extends CI_DB { */ function trans_begin($test_mode = FALSE) { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } @@ -179,7 +179,7 @@ class CI_DB_postgre_driver extends CI_DB { */ function trans_commit() { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } @@ -203,7 +203,7 @@ class CI_DB_postgre_driver extends CI_DB { */ function trans_rollback() { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 2ad5d6120..70148f360 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -48,7 +48,7 @@ class CI_DB_sqlite_driver extends CI_DB { */ function db_connect() { - if ( ! $conn_id = @sqlite_open($this->database, FILE_WRITE_MODE, $error)) + if (! $conn_id = @sqlite_open($this->database, FILE_WRITE_MODE, $error)) { log_message('error', $error); @@ -73,7 +73,7 @@ class CI_DB_sqlite_driver extends CI_DB { */ function db_pconnect() { - if ( ! $conn_id = @sqlite_popen($this->database, FILE_WRITE_MODE, $error)) + if (! $conn_id = @sqlite_popen($this->database, FILE_WRITE_MODE, $error)) { log_message('error', $error); @@ -171,7 +171,7 @@ class CI_DB_sqlite_driver extends CI_DB { */ function trans_begin($test_mode = FALSE) { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } @@ -201,7 +201,7 @@ class CI_DB_sqlite_driver extends CI_DB { */ function trans_commit() { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } @@ -226,7 +226,7 @@ class CI_DB_sqlite_driver extends CI_DB { */ function trans_rollback() { - if ( ! $this->trans_enabled) + if (! $this->trans_enabled) { return TRUE; } diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php index 1fd2a2bd4..44950bfc7 100644 --- a/system/database/drivers/sqlite/sqlite_forge.php +++ b/system/database/drivers/sqlite/sqlite_forge.php @@ -49,7 +49,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { */ function _drop_database($name) { - if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database)) + if (! @file_exists($this->db->database) OR ! @unlink($this->db->database)) { if ($this->db->db_debug) { diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php index d1e1fe026..ab58f8fd7 100644 --- a/system/database/drivers/sqlite/sqlite_utility.php +++ b/system/database/drivers/sqlite/sqlite_utility.php @@ -124,7 +124,7 @@ class CI_DB_sqlite_utility extends CI_DB_utility { */ function _drop_database($name) { - if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database)) + if (! @file_exists($this->db->database) OR ! @unlink($this->db->database)) { if ($this->db->db_debug) { diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php index 236e3904e..8ae44826a 100644 --- a/system/helpers/array_helper.php +++ b/system/helpers/array_helper.php @@ -43,7 +43,7 @@ if (! function_exists('element')) { function element($item, $array, $default = FALSE) { - if ( ! isset($array[$item]) OR $array[$item] == "") + if (! isset($array[$item]) OR $array[$item] == "") { return $default; } @@ -65,7 +65,7 @@ if (! function_exists('random_element')) { function random_element($array) { - if ( ! is_array($array)) + if (! is_array($array)) { return $array; } diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php index 102057f8c..75c769e9c 100644 --- a/system/helpers/cookie_helper.php +++ b/system/helpers/cookie_helper.php @@ -73,7 +73,7 @@ if (! function_exists('set_cookie')) $path = $CI->config->item('cookie_path'); } - if ( ! is_numeric($expire)) + if (! is_numeric($expire)) { $expire = time() - 86500; } diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 24e0b1794..004cfb122 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -123,7 +123,7 @@ if (! function_exists('standard_date')) 'DATE_W3C' => '%Y-%m-%dT%H:%i:%s%Q' ); - if ( ! isset($formats[$fmt])) + if (! isset($formats[$fmt])) { return FALSE; } @@ -152,12 +152,12 @@ if (! function_exists('timespan')) $CI =& get_instance(); $CI->lang->load('date'); - if ( ! is_numeric($seconds)) + if (! is_numeric($seconds)) { $seconds = 1; } - if ( ! is_numeric($time)) + if (! is_numeric($time)) { $time = time(); } @@ -271,7 +271,7 @@ if (! function_exists('days_in_month')) return 0; } - if ( ! is_numeric($year) OR strlen($year) != 4) + if (! is_numeric($year) OR strlen($year) != 4) { $year = date('Y'); } @@ -442,7 +442,7 @@ if (! function_exists('human_to_unix')) $datestr = trim($datestr); $datestr = preg_replace("/\040+/", "\040", $datestr); - if ( ! ereg("^[0-9]{2,4}\-[0-9]{1,2}\-[0-9]{1,2}\040[0-9]{1,2}:[0-9]{1,2}.*$", $datestr)) + if (! ereg("^[0-9]{2,4}\-[0-9]{1,2}\-[0-9]{1,2}\040[0-9]{1,2}:[0-9]{1,2}.*$", $datestr)) { return FALSE; } @@ -592,7 +592,7 @@ if (! function_exists('timezones')) if ($tz == 'GMT') $tz = 'UTC'; - return ( ! isset($zones[$tz])) ? 0 : $zones[$tz]; + return (! isset($zones[$tz])) ? 0 : $zones[$tz]; } } diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 5e47fc5c9..284c6c96e 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -61,7 +61,7 @@ if (! function_exists('force_download')) @include(APPPATH.'config/mimes'.EXT); // Set a default mime if we can't find it - if ( ! isset($mimes[$extension])) + if (! isset($mimes[$extension])) { $mime = 'application/octet-stream'; } diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php index e677afd28..307f3b588 100644 --- a/system/helpers/email_helper.php +++ b/system/helpers/email_helper.php @@ -37,7 +37,7 @@ if (! function_exists('valid_email')) { function valid_email($address) { - return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE; + return (! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE; } } diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 04c5747bf..1eb8348e9 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -40,7 +40,7 @@ if (! function_exists('read_file')) { function read_file($file) { - if ( ! file_exists($file)) + if (! file_exists($file)) { return FALSE; } @@ -50,7 +50,7 @@ if (! function_exists('read_file')) return file_get_contents($file); } - if ( ! $fp = @fopen($file, 'rb')) + if (! $fp = @fopen($file, 'rb')) { return FALSE; } @@ -87,7 +87,7 @@ if (! function_exists('write_file')) { function write_file($path, $data, $mode = 'wb') { - if ( ! $fp = @fopen($path, $mode)) + if (! $fp = @fopen($path, $mode)) { return FALSE; } @@ -123,7 +123,7 @@ if (! function_exists('delete_files')) // Trim the trailing slash $path = preg_replace("|^(.+?)/*$|", "\\1", $path); - if ( ! $current_dir = @opendir($path)) + if (! $current_dir = @opendir($path)) return; while(FALSE !== ($filename = @readdir($current_dir))) @@ -167,7 +167,7 @@ if (! function_exists('get_filenames')) { function get_filenames($source_dir, $include_path = FALSE, $_recursion = FALSE) { - static $_filedata = array(); + $_filedata = array(); if ($fp = @opendir($source_dir)) { @@ -180,11 +180,11 @@ if (! function_exists('get_filenames')) while (FALSE !== ($file = readdir($fp))) { - if (@is_dir($source_dir.$file) && substr($file, 0, 1) != '.') + if (@is_dir($source_dir.$file) && strncmp($file, '.', 1) !== 0) { get_filenames($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE); } - elseif (substr($file, 0, 1) != ".") + elseif (strncmp($file, '.', 1) !== 0) { $_filedata[] = ($include_path == TRUE) ? $source_dir.$file : $file; @@ -201,4 +201,171 @@ if (! function_exists('get_filenames')) // -------------------------------------------------------------------- +/** + * Get Directory File Information + * + * Reads the specified directory and builds an array containing the filenames, + * filesize, dates, and permissions + * + * Any sub-folders contained within the specified path are read as well. + * + * @access public + * @param string path to source + * @param bool whether to include the path as part of the filename + * @param bool internal variable to determine recursion status - do not use in calls + * @return array + */ +if (! function_exists('get_dir_file_info')) +{ + function get_dir_file_info($source_dir, $include_path = FALSE, $_recursion = FALSE) + { + $_filedata = array(); + $relative_path = $source_dir; + + if ($fp = @opendir($source_dir)) + { + // reset the array and make sure $source_dir has a trailing slash on the initial call + if ($_recursion === FALSE) + { + $_filedata = array(); + $source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; + } + + while (FALSE !== ($file = readdir($fp))) + { + if (@is_dir($source_dir.$file) && strncmp($file, '.', 1) !== 0) + { + get_dir_file_info($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE); + } + elseif (strncmp($file, '.', 1) !== 0) + { + $_filedata[$file] = get_file_info($source_dir.$file); + $_filedata[$file]['relative_path'] = $relative_path; + } + } + return $_filedata; + } + else + { + return FALSE; + } + } +} + +// -------------------------------------------------------------------- + +/** +* Get File Info +* +* Given a file and path, returns the name, path, size, date modified +* Second parameter allows you to explicitly declare what information you want returned +* Options are: name, server_path, size, date, readable, writable, executable, fileperms +* Returns FALSE if the file cannot be found. +* +* @access public +* @param string path to file +* @param mixed array or comma separated string of information returned +* @return array +*/ +if (! function_exists('get_file_info')) +{ + function get_file_info($file, $returned_values = array('name', 'server_path', 'size', 'date')) + { + + if (! file_exists($file)) + { + return FALSE; + } + + if (is_string($returned_values)) + { + $returned_values = explode(',', $returned_values); + } + + foreach ($returned_values as $key) + { + switch ($key) + { + case 'name': + $fileinfo['name'] = substr(strrchr($file, '/'), 1); + break; + case 'server_path': + $fileinfo['server_path'] = $file; + break; + case 'size': + $fileinfo['size'] = filesize($file); + break; + case 'date': + $fileinfo['date'] = filectime($file); + break; + case 'readable': + $fileinfo['readable'] = is_readable($file); + break; + case 'writable': + // There are known problems using is_weritable on IIS. It may not be reliable - consider fileperms() + $fileinfo['writable'] = is_writable($file); + break; + case 'executable': + $fileinfo['executable'] = is_executable($file); + break; + case 'fileperms': + $fileinfo['fileperms'] = fileperms($file); + break; + } + } + + return $fileinfo; + } +} + +// -------------------------------------------------------------------- + +/** + * Get Mime by Extension + * + * Translates a file extension into a mime type based on config/mimes.php. + * Returns FALSE if it can't determine the type, or open the mime config file + * + * Note: this is NOT an accurate way of determining file mime types, and is here strictly as a convenience + * It should NOT be trusted, and should certainly NOT be used for security + * + * @access public + * @param string path to file + * @return mixed + */ +if (! function_exists('get_mime_by_extension')) +{ + function get_mime_by_extension($file) + { + $extension = substr(strrchr($file, '.'), 1); + + global $mimes; + + if (! is_array($mimes)) + { + if (! require_once(APPPATH.'config/mimes.php')) + { + return FALSE; + } + } + + if (array_key_exists($extension, $mimes)) + { + if (is_array($mimes[$extension])) + { + // Multiple mime types, just give the first one + return current($mimes[$extension]); + } + else + { + return $mimes[$extension]; + } + } + else + { + return FALSE; + } + } +} + ?> \ No newline at end of file diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index db41cb5cd..10858339e 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -48,7 +48,7 @@ if (! function_exists('form_open')) $form = '
'; } @@ -141,7 +141,7 @@ if (! function_exists('form_input')) { function form_input($data = '', $value = '', $extra = '') { - $defaults = array('type' => 'text', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value, 'maxlength' => '500', 'size' => '50'); + $defaults = array('type' => 'text', 'name' => ((! is_array($data)) ? $data : ''), 'value' => $value, 'maxlength' => '500', 'size' => '50'); return "\n"; } @@ -164,7 +164,7 @@ if (! function_exists('form_password')) { function form_password($data = '', $value = '', $extra = '') { - if ( ! is_array($data)) + if (! is_array($data)) { $data = array('name' => $data); } @@ -191,7 +191,7 @@ if (! function_exists('form_upload')) { function form_upload($data = '', $value = '', $extra = '') { - if ( ! is_array($data)) + if (! is_array($data)) { $data = array('name' => $data); } @@ -216,9 +216,9 @@ if (! function_exists('form_textarea')) { function form_textarea($data = '', $value = '', $extra = '') { - $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'cols' => '90', 'rows' => '12'); + $defaults = array('name' => ((! is_array($data)) ? $data : ''), 'cols' => '90', 'rows' => '12'); - if ( ! is_array($data) OR ! isset($data['value'])) + if (! is_array($data) OR ! isset($data['value'])) { $val = $value; } @@ -248,7 +248,7 @@ if (! function_exists('form_dropdown')) { function form_dropdown($name = '', $options = array(), $selected = array(), $extra = '') { - if ( ! is_array($selected)) + if (! is_array($selected)) { $selected = array($selected); } @@ -291,7 +291,7 @@ if (! function_exists('form_checkbox')) { function form_checkbox($data = '', $value = '', $checked = TRUE, $extra = '') { - $defaults = array('type' => 'checkbox', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); + $defaults = array('type' => 'checkbox', 'name' => ((! is_array($data)) ? $data : ''), 'value' => $value); if (is_array($data) AND array_key_exists('checked', $data)) { @@ -332,7 +332,7 @@ if (! function_exists('form_radio')) { function form_radio($data = '', $value = '', $checked = TRUE, $extra = '') { - if ( ! is_array($data)) + if (! is_array($data)) { $data = array('name' => $data); } @@ -357,7 +357,7 @@ if (! function_exists('form_submit')) { function form_submit($data = '', $value = '', $extra = '') { - $defaults = array('type' => 'submit', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); + $defaults = array('type' => 'submit', 'name' => ((! is_array($data)) ? $data : ''), 'value' => $value); return "\n"; } @@ -378,7 +378,7 @@ if (! function_exists('form_reset')) { function form_reset($data = '', $value = '', $extra = '') { - $defaults = array('type' => 'reset', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); + $defaults = array('type' => 'reset', 'name' => ((! is_array($data)) ? $data : ''), 'value' => $value); return "\n"; } @@ -399,7 +399,7 @@ if (! function_exists('form_button')) { function form_button($data = '', $content = '', $extra = '') { - $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'type' => 'submit'); + $defaults = array('name' => ((! is_array($data)) ? $data : ''), 'type' => 'submit'); if ( is_array($data) AND isset($data['content'])) { diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 3e15b4442..4e86465c1 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -105,7 +105,7 @@ if (! function_exists('_list')) function _list($type = 'ul', $list, $attributes = '', $depth = 0) { // If an array wasn't submitted there's nothing to do... - if ( ! is_array($list)) + if (! is_array($list)) { return $list; } @@ -138,7 +138,7 @@ if (! function_exists('_list')) $out .= str_repeat(" ", $depth + 2); $out .= "
  • "; - if ( ! is_array($val)) + if (! is_array($val)) { $out .= $val; } @@ -194,7 +194,7 @@ if (! function_exists('img')) { function img($src = '', $index_page = FALSE) { - if ( ! is_array($src) ) + if (! is_array($src) ) { $src = array('src' => $src); } diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index 30d26d6ee..6abff06af 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -57,7 +57,7 @@ if (! function_exists('set_realpath')) // Make sure the path exists if ($check_existance == TRUE) { - if ( ! is_dir($path)) + if (! is_dir($path)) { show_error('Not a valid path: '.$path); } diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index 7552fd89c..edb6ebb50 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -59,9 +59,9 @@ if (! function_exists('dohash')) { if ($type == 'sha1') { - if ( ! function_exists('sha1')) + if (! function_exists('sha1')) { - if ( ! function_exists('mhash')) + if (! function_exists('mhash')) { require_once(BASEPATH.'libraries/Sha1'.EXT); $SH = new CI_SHA; diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php index 25962eb54..81c6b9199 100644 --- a/system/helpers/smiley_helper.php +++ b/system/helpers/smiley_helper.php @@ -67,7 +67,7 @@ if (! function_exists('get_clickable_smileys')) { function get_clickable_smileys($image_url = '', $smileys = NULL) { - if ( ! is_array($smileys)) + if (! is_array($smileys)) { if (FALSE === ($smileys = _get_smiley_array())) { @@ -120,7 +120,7 @@ if (! function_exists('parse_smileys')) return $str; } - if ( ! is_array($smileys)) + if (! is_array($smileys)) { if (FALSE === ($smileys = _get_smiley_array())) { @@ -154,14 +154,14 @@ if (! function_exists('_get_smiley_array')) { function _get_smiley_array() { - if ( ! file_exists(APPPATH.'config/smileys'.EXT)) + if (! file_exists(APPPATH.'config/smileys'.EXT)) { return FALSE; } include(APPPATH.'config/smileys'.EXT); - if ( ! isset($smileys) OR ! is_array($smileys)) + if (! isset($smileys) OR ! is_array($smileys)) { return FALSE; } diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 21ab77830..df3c89e6f 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -226,7 +226,7 @@ if (! function_exists('word_censor')) { function word_censor($str, $censored, $replacement = '') { - if ( ! is_array($censored)) + if (! is_array($censored)) { return $str; } @@ -354,7 +354,7 @@ if (! function_exists('word_wrap')) function word_wrap($str, $charlim = '76') { // Se the character limit - if ( ! is_numeric($charlim)) + if (! is_numeric($charlim)) $charlim = 76; // Reduce multiple spaces diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php index 4d9a1bb6b..88071604d 100644 --- a/system/helpers/typography_helper.php +++ b/system/helpers/typography_helper.php @@ -330,13 +330,13 @@ class Auto_typography { $one_before = substr($str, $start+$current-1, 1); $one_after = substr($str, $start+$current+2, 1); - if ( ! in_array($one_after, $space, TRUE) && $one_after != "<") + if (! in_array($one_after, $space, TRUE) && $one_after != "<") { $str = str_replace( $one_before."\"'".$one_after, $one_before."“‘".$one_after, $str); } - elseif ( ! in_array($one_before, $space, TRUE) && (in_array($one_after, $space, TRUE) OR $one_after == '<')) + elseif (! in_array($one_before, $space, TRUE) && (in_array($one_after, $space, TRUE) OR $one_after == '<')) { $str = str_replace( $one_before."\"'".$one_after, $one_before."”’".$one_after, @@ -363,7 +363,7 @@ class Auto_typography { $one_before."‘“".$one_after, $str); } - elseif ( ! in_array($one_before, $space, TRUE) && $one_before != ">") + elseif (! in_array($one_before, $space, TRUE) && $one_before != ">") { $str = str_replace( $one_before."'\"".$one_after, $one_before."’”".$one_after, @@ -378,7 +378,7 @@ class Auto_typography { { for ($i=0, $s=sizeof($matches['0']); $i < $s; ++$i) { - if ( ! in_array($matches['1'][$i], $space, TRUE) && ! in_array($matches['3'][$i], $space, TRUE)) + if (! in_array($matches['1'][$i], $space, TRUE) && ! in_array($matches['3'][$i], $space, TRUE)) { $str = str_replace( $matches['0'][$i], $matches['1'][$i]."“".$matches['2'][$i]."”".$matches['3'][$i], @@ -391,7 +391,7 @@ class Auto_typography { { for ($i=0, $s=sizeof($matches['0']); $i < $s; ++$i) { - if ( ! in_array($matches['1'][$i], $space, TRUE) && ! in_array($matches['3'][$i], $space, TRUE)) + if (! in_array($matches['1'][$i], $space, TRUE) && ! in_array($matches['3'][$i], $space, TRUE)) { $str = str_replace( $matches['0'][$i], $matches['1'][$i]."‘".$matches['2'][$i]."’".$matches['3'][$i], @@ -412,7 +412,7 @@ class Auto_typography { $one_before = substr($str, $start+$current-1, 1); $one_after = substr($str, $start+$current+1, 1); - if ( ! in_array($one_before, $space, TRUE) && ! in_array($one_after, $space, TRUE)) + if (! in_array($one_before, $space, TRUE) && ! in_array($one_after, $space, TRUE)) { $str = str_replace( $one_before."'".$one_after, $one_before."’".$one_after, @@ -435,9 +435,9 @@ class Auto_typography { $two_before = substr($str, $start+$current-2, 1); $two_after = substr($str, $start+$current+3, 1); - if (( ! in_array($one_before, $space, TRUE) && ! in_array($one_after, $space, TRUE)) + if ((! in_array($one_before, $space, TRUE) && ! in_array($one_after, $space, TRUE)) OR - ( ! in_array($two_before, $space, TRUE) && ! in_array($two_after, $space, TRUE) && $one_before == ' ' && $one_after == ' ') + (! in_array($two_before, $space, TRUE) && ! in_array($two_after, $space, TRUE) && $one_before == ' ' && $one_after == ' ') ) { $str = str_replace( $two_before.$one_before."--".$one_after.$two_after, @@ -468,13 +468,13 @@ class Auto_typography { $one_before = substr($str, $start+$current-1, 1); $one_after = substr($str, $start+$current+1, 1); - if ( ! in_array($one_after, $space, TRUE)) + if (! in_array($one_after, $space, TRUE)) { $str = str_replace( $one_before.'"'.$one_after, $one_before."“".$one_after, $str); } - elseif( ! in_array($one_before, $space, TRUE)) + elseif(! in_array($one_before, $space, TRUE)) { $str = str_replace( $one_before."'".$one_after, $one_before."”".$one_after, @@ -495,13 +495,13 @@ class Auto_typography { $one_before = substr($str, $start+$current-1, 1); $one_after = substr($str, $start+$current+1, 1); - if ( ! in_array($one_after, $space, TRUE)) + if (! in_array($one_after, $space, TRUE)) { $str = str_replace( $one_before."'".$one_after, $one_before."‘".$one_after, $str); } - elseif( ! in_array($one_before, $space, TRUE)) + elseif(! in_array($one_before, $space, TRUE)) { $str = str_replace( $one_before."'".$one_after, $one_before."’".$one_after, diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 1ff26082c..02c7f3379 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -103,9 +103,9 @@ if (! function_exists('anchor')) { $title = (string) $title; - if ( ! is_array($uri)) + if (! is_array($uri)) { - $site_url = ( ! preg_match('!^\w+://!i', $uri)) ? site_url($uri) : $uri; + $site_url = (! preg_match('!^\w+://!i', $uri)) ? site_url($uri) : $uri; } else { @@ -150,7 +150,7 @@ if (! function_exists('anchor_popup')) { $title = (string) $title; - $site_url = ( ! preg_match('!^\w+://!i', $uri)) ? site_url($uri) : $uri; + $site_url = (! preg_match('!^\w+://!i', $uri)) ? site_url($uri) : $uri; if ($title == '') { @@ -162,14 +162,14 @@ if (! function_exists('anchor_popup')) return "".$title.""; } - if ( ! is_array($attributes)) + if (! is_array($attributes)) { $attributes = array(); } foreach (array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0', ) as $key => $val) { - $atts[$key] = ( ! isset($attributes[$key])) ? $val : $attributes[$key]; + $atts[$key] = (! isset($attributes[$key])) ? $val : $attributes[$key]; } return "".$title.""; diff --git a/system/libraries/Benchmark.php b/system/libraries/Benchmark.php index bca37822b..323d9668d 100644 --- a/system/libraries/Benchmark.php +++ b/system/libraries/Benchmark.php @@ -71,12 +71,12 @@ class CI_Benchmark { return '{elapsed_time}'; } - if ( ! isset($this->marker[$point1])) + if (! isset($this->marker[$point1])) { return ''; } - if ( ! isset($this->marker[$point2])) + if (! isset($this->marker[$point2])) { $this->marker[$point2] = microtime(); } diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php index a85c18303..e9621fec1 100644 --- a/system/libraries/Calendar.php +++ b/system/libraries/Calendar.php @@ -49,7 +49,7 @@ class CI_Calendar { { $this->CI =& get_instance(); - if ( ! in_array('calendar_lang'.EXT, $this->CI->lang->is_loaded, TRUE)) + if (! in_array('calendar_lang'.EXT, $this->CI->lang->is_loaded, TRUE)) { $this->CI->lang->load('calendar'); } @@ -125,7 +125,7 @@ class CI_Calendar { // Set the starting day of the week $start_days = array('sunday' => 0, 'monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6); - $start_day = ( ! isset($start_days[$this->start_day])) ? 0 : $start_days[$this->start_day]; + $start_day = (! isset($start_days[$this->start_day])) ? 0 : $start_days[$this->start_day]; // Set the starting day number $local_date = mktime(12, 0, 0, $month, 1, $year); diff --git a/system/libraries/Config.php b/system/libraries/Config.php index 9b8b07c5a..73f1986a0 100644 --- a/system/libraries/Config.php +++ b/system/libraries/Config.php @@ -66,7 +66,7 @@ class CI_Config { return TRUE; } - if ( ! file_exists(APPPATH.'config/'.$file.EXT)) + if (! file_exists(APPPATH.'config/'.$file.EXT)) { if ($fail_gracefully === TRUE) { @@ -77,7 +77,7 @@ class CI_Config { include(APPPATH.'config/'.$file.EXT); - if ( ! isset($config) OR ! is_array($config)) + if (! isset($config) OR ! is_array($config)) { if ($fail_gracefully === TRUE) { @@ -125,7 +125,7 @@ class CI_Config { { if ($index == '') { - if ( ! isset($this->config[$item])) + if (! isset($this->config[$item])) { return FALSE; } @@ -134,12 +134,12 @@ class CI_Config { } else { - if ( ! isset($this->config[$index])) + if (! isset($this->config[$index])) { return FALSE; } - if ( ! isset($this->config[$index][$item])) + if (! isset($this->config[$index][$item])) { return FALSE; } @@ -165,7 +165,7 @@ class CI_Config { */ function slash_item($item) { - if ( ! isset($this->config[$item])) + if (! isset($this->config[$item])) { return FALSE; } diff --git a/system/libraries/Controller.php b/system/libraries/Controller.php index ad9c66805..4957fc35e 100644 --- a/system/libraries/Controller.php +++ b/system/libraries/Controller.php @@ -111,7 +111,7 @@ class Controller extends CI_Base { show_404('Scaffolding unavailable'); } - $method = ( ! in_array($this->uri->segment(3), array('add', 'insert', 'edit', 'update', 'view', 'delete', 'do_delete'), TRUE)) ? 'view' : $this->uri->segment(3); + $method = (! in_array($this->uri->segment(3), array('add', 'insert', 'edit', 'update', 'view', 'delete', 'do_delete'), TRUE)) ? 'view' : $this->uri->segment(3); require_once(BASEPATH.'scaffolding/Scaffolding'.EXT); $scaff = new Scaffolding($this->_ci_scaff_table); diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 19121c56b..3b4dddd00 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -371,7 +371,7 @@ class CI_Email { */ function _str_to_array($email) { - if ( ! is_array($email)) + if (! is_array($email)) { if (strpos($email, ',') !== FALSE) { @@ -439,7 +439,7 @@ class CI_Email { */ function set_protocol($protocol = 'mail') { - $this->protocol = ( ! in_array($protocol, $this->_protocols, TRUE)) ? 'mail' : strtolower($protocol); + $this->protocol = (! in_array($protocol, $this->_protocols, TRUE)) ? 'mail' : strtolower($protocol); } // -------------------------------------------------------------------- @@ -453,7 +453,7 @@ class CI_Email { */ function set_priority($n = 3) { - if ( ! is_numeric($n)) + if (! is_numeric($n)) { $this->priority = 3; return; @@ -551,7 +551,7 @@ class CI_Email { function _get_protocol($return = TRUE) { $this->protocol = strtolower($this->protocol); - $this->protocol = ( ! in_array($this->protocol, $this->_protocols, TRUE)) ? 'mail' : $this->protocol; + $this->protocol = (! in_array($this->protocol, $this->_protocols, TRUE)) ? 'mail' : $this->protocol; if ($return == TRUE) return $this->protocol; @@ -568,7 +568,7 @@ class CI_Email { */ function _get_encoding($return = TRUE) { - $this->_encoding = ( ! in_array($this->_encoding, $this->_bit_depths)) ? '8bit' : $this->_encoding; + $this->_encoding = (! in_array($this->_encoding, $this->_bit_depths)) ? '8bit' : $this->_encoding; foreach ($this->_base_charsets as $charset) { @@ -648,7 +648,7 @@ class CI_Email { */ function validate_email($email) { - if ( ! is_array($email)) + if (! is_array($email)) { $this->_set_error_message('email_must_be_array'); return FALSE; @@ -656,7 +656,7 @@ class CI_Email { foreach ($email as $val) { - if ( ! $this->valid_email($val)) + if (! $this->valid_email($val)) { $this->_set_error_message('email_invalid_address', $val); return FALSE; @@ -675,7 +675,7 @@ class CI_Email { */ function valid_email($address) { - return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE; + return (! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE; } // -------------------------------------------------------------------- @@ -689,7 +689,7 @@ class CI_Email { */ function clean_email($email) { - if ( ! is_array($email)) + if (! is_array($email)) { if (preg_match('/\<(.*)\>/', $email, $match)) return $match['1']; @@ -1055,7 +1055,7 @@ class CI_Email { $basename = basename($filename); $ctype = $this->_attach_type[$i]; - if ( ! file_exists($filename)) + if (! file_exists($filename)) { $this->_set_error_message('email_attachment_missing', $filename); return FALSE; @@ -1070,7 +1070,7 @@ class CI_Email { $attachment[$z++] = $h; $file = filesize($filename) +1; - if ( ! $fp = fopen($filename, 'r')) + if (! $fp = fopen($filename, 'r')) { $this->_set_error_message('email_attachment_unreadable', $filename); return FALSE; @@ -1194,9 +1194,9 @@ class CI_Email { $this->reply_to($this->_headers['From']); } - if (( ! isset($this->_recipients) AND ! isset($this->_headers['To'])) AND - ( ! isset($this->_bcc_array) AND ! isset($this->_headers['Bcc'])) AND - ( ! isset($this->_headers['Cc']))) + if ((! isset($this->_recipients) AND ! isset($this->_headers['To'])) AND + (! isset($this->_bcc_array) AND ! isset($this->_headers['Bcc'])) AND + (! isset($this->_headers['Cc']))) { $this->_set_error_message('email_no_recipients'); return FALSE; @@ -1212,7 +1212,7 @@ class CI_Email { $this->_build_message(); - if ( ! $this->_spool_email()) + if (! $this->_spool_email()) return FALSE; else return TRUE; @@ -1311,7 +1311,7 @@ class CI_Email { { case 'mail' : - if ( ! $this->_send_with_mail()) + if (! $this->_send_with_mail()) { $this->_set_error_message('email_send_failure_phpmail'); return FALSE; @@ -1319,7 +1319,7 @@ class CI_Email { break; case 'sendmail' : - if ( ! $this->_send_with_sendmail()) + if (! $this->_send_with_sendmail()) { $this->_set_error_message('email_send_failure_sendmail'); return FALSE; @@ -1327,7 +1327,7 @@ class CI_Email { break; case 'smtp' : - if ( ! $this->_send_with_smtp()) + if (! $this->_send_with_smtp()) { $this->_set_error_message('email_send_failure_smtp'); return FALSE; @@ -1352,7 +1352,7 @@ class CI_Email { { if ($this->_safe_mode == TRUE) { - if ( ! mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str)) + if (! mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str)) return FALSE; else return TRUE; @@ -1361,7 +1361,7 @@ class CI_Email { { // most documentation of sendmail using the "-f" flag lacks a space after it, however // we've encountered servers that seem to require it to be in place. - if ( ! mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str, "-f ".$this->clean_email($this->_headers['From']))) + if (! mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str, "-f ".$this->clean_email($this->_headers['From']))) return FALSE; else return TRUE; @@ -1380,7 +1380,7 @@ class CI_Email { { $fp = @popen($this->mailpath . " -oi -f ".$this->clean_email($this->_headers['From'])." -t", 'w'); - if ( ! is_resource($fp)) + if (! is_resource($fp)) { $this->_set_error_message('email_no_socket'); return FALSE; @@ -1472,7 +1472,7 @@ class CI_Email { $errstr, $this->smtp_timeout); - if( ! is_resource($this->_smtp_connect)) + if(! is_resource($this->_smtp_connect)) { $this->_set_error_message('email_smtp_error', $errno." ".$errstr); return FALSE; @@ -1557,7 +1557,7 @@ class CI_Email { */ function _smtp_authenticate() { - if ( ! $this->_smtp_auth) + if (! $this->_smtp_auth) return TRUE; if ($this->smtp_user == "" AND $this->smtp_pass == "") @@ -1609,7 +1609,7 @@ class CI_Email { */ function _send_data($data) { - if ( ! fwrite($this->_smtp_connect, $data . $this->newline)) + if (! fwrite($this->_smtp_connect, $data . $this->newline)) { $this->_set_error_message('email_smtp_data_failure', $data); return FALSE; @@ -1684,7 +1684,7 @@ class CI_Email { $this->_IP = end($x); } - if ( ! preg_match( "/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/", $this->_IP)) + if (! preg_match( "/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/", $this->_IP)) $this->_IP = '0.0.0.0'; unset($cip); @@ -1842,7 +1842,7 @@ class CI_Email { 'eml' => 'message/rfc822' ); - return ( ! isset($mimes[strtolower($ext)])) ? "application/x-unknown-content-type" : $mimes[strtolower($ext)]; + return (! isset($mimes[strtolower($ext)])) ? "application/x-unknown-content-type" : $mimes[strtolower($ext)]; } } diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index 48f9d3e51..9a784d254 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -44,7 +44,7 @@ class CI_Encrypt { function CI_Encrypt() { $this->CI =& get_instance(); - $this->_mcrypt_exists = ( ! function_exists('mcrypt_encrypt')) ? FALSE : TRUE; + $this->_mcrypt_exists = (! function_exists('mcrypt_encrypt')) ? FALSE : TRUE; log_message('debug', "Encrypt Class Initialized"); } @@ -459,9 +459,9 @@ class CI_Encrypt { */ function sha1($str) { - if ( ! function_exists('sha1')) + if (! function_exists('sha1')) { - if ( ! function_exists('mhash')) + if (! function_exists('mhash')) { require_once(BASEPATH.'libraries/Sha1'.EXT); $SH = new CI_SHA; diff --git a/system/libraries/Exceptions.php b/system/libraries/Exceptions.php index b22ef9f7a..7c9640554 100644 --- a/system/libraries/Exceptions.php +++ b/system/libraries/Exceptions.php @@ -74,7 +74,7 @@ class CI_Exceptions { */ function log_exception($severity, $message, $filepath, $line) { - $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; + $severity = (! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE); } @@ -115,7 +115,7 @@ class CI_Exceptions { */ function show_error($heading, $message, $template = 'error_general') { - $message = '

    '.implode('

    ', ( ! is_array($message)) ? array($message) : $message).'

    '; + $message = '

    '.implode('

    ', (! is_array($message)) ? array($message) : $message).'

    '; if (ob_get_level() > $this->ob_level + 1) { @@ -142,7 +142,7 @@ class CI_Exceptions { */ function show_php_error($severity, $message, $filepath, $line) { - $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; + $severity = (! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; $filepath = str_replace("\\", "/", $filepath); diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php index ed934b548..1b5ec2fd2 100644 --- a/system/libraries/Ftp.php +++ b/system/libraries/Ftp.php @@ -98,7 +98,7 @@ class CI_FTP { return FALSE; } - if ( ! $this->_login()) + if (! $this->_login()) { if ($this->debug == TRUE) { @@ -139,7 +139,7 @@ class CI_FTP { */ function _is_conn() { - if ( ! is_resource($this->conn_id)) + if (! is_resource($this->conn_id)) { if ($this->debug == TRUE) { @@ -216,7 +216,7 @@ class CI_FTP { } // Set file permissions if needed - if ( ! is_null($permissions)) + if (! is_null($permissions)) { $this->chmod($path, (int)$permissions); } @@ -237,12 +237,12 @@ class CI_FTP { */ function upload($locpath, $rempath, $mode = 'auto', $permissions = NULL) { - if ( ! $this->_is_conn()) + if (! $this->_is_conn()) { return FALSE; } - if ( ! file_exists($locpath)) + if (! file_exists($locpath)) { $this->_error('ftp_no_source_file'); return FALSE; @@ -270,7 +270,7 @@ class CI_FTP { } // Set file permissions if needed - if ( ! is_null($permissions)) + if (! is_null($permissions)) { $this->chmod($rempath, (int)$permissions); } @@ -291,7 +291,7 @@ class CI_FTP { */ function rename($old_file, $new_file, $move = FALSE) { - if ( ! $this->_is_conn()) + if (! $this->_is_conn()) { return FALSE; } @@ -338,7 +338,7 @@ class CI_FTP { */ function delete_file($filepath) { - if ( ! $this->_is_conn()) + if (! $this->_is_conn()) { return FALSE; } @@ -369,7 +369,7 @@ class CI_FTP { */ function delete_dir($filepath) { - if ( ! $this->_is_conn()) + if (! $this->_is_conn()) { return FALSE; } @@ -385,7 +385,7 @@ class CI_FTP { { // If we can't delete the item it's probaly a folder so // we'll recursively call delete_dir() - if ( ! @ftp_delete($this->conn_id, $filepath.$item)) + if (! @ftp_delete($this->conn_id, $filepath.$item)) { $this->delete_dir($filepath.$item); } @@ -418,13 +418,13 @@ class CI_FTP { */ function chmod($path, $perm) { - if ( ! $this->_is_conn()) + if (! $this->_is_conn()) { return FALSE; } // Permissions can only be set when running PHP 5 - if ( ! function_exists('ftp_chmod')) + if (! function_exists('ftp_chmod')) { if ($this->debug == TRUE) { @@ -457,7 +457,7 @@ class CI_FTP { */ function list_files($path = '.') { - if ( ! $this->_is_conn()) + if (! $this->_is_conn()) { return FALSE; } @@ -481,7 +481,7 @@ class CI_FTP { */ function mirror($locpath, $rempath) { - if ( ! $this->_is_conn()) + if (! $this->_is_conn()) { return FALSE; } @@ -490,10 +490,10 @@ class CI_FTP { if ($fp = @opendir($locpath)) { // Attempt to open the remote file path. - if ( ! $this->changedir($rempath, TRUE)) + if (! $this->changedir($rempath, TRUE)) { // If it doesn't exist we'll attempt to create the direcotory - if ( ! $this->mkdir($rempath) OR ! $this->changedir($rempath)) + if (! $this->mkdir($rempath) OR ! $this->changedir($rempath)) { return FALSE; } @@ -586,7 +586,7 @@ class CI_FTP { */ function close() { - if ( ! $this->_is_conn()) + if (! $this->_is_conn()) { return FALSE; } diff --git a/system/libraries/Hooks.php b/system/libraries/Hooks.php index 49cb230c0..a41320c5e 100644 --- a/system/libraries/Hooks.php +++ b/system/libraries/Hooks.php @@ -68,7 +68,7 @@ class CI_Hooks { @include(APPPATH.'config/hooks'.EXT); - if ( ! isset($hook) OR ! is_array($hook)) + if (! isset($hook) OR ! is_array($hook)) { return; } @@ -90,7 +90,7 @@ class CI_Hooks { */ function _call_hook($which = '') { - if ( ! $this->enabled OR ! isset($this->hooks[$which])) + if (! $this->enabled OR ! isset($this->hooks[$which])) { return FALSE; } @@ -123,7 +123,7 @@ class CI_Hooks { */ function _run_hook($data) { - if ( ! is_array($data)) + if (! is_array($data)) { return FALSE; } @@ -144,14 +144,14 @@ class CI_Hooks { // Set file path // ----------------------------------- - if ( ! isset($data['filepath']) OR ! isset($data['filename'])) + if (! isset($data['filepath']) OR ! isset($data['filename'])) { return FALSE; } $filepath = APPPATH.$data['filepath'].'/'.$data['filename']; - if ( ! file_exists($filepath)) + if (! file_exists($filepath)) { return FALSE; } @@ -196,7 +196,7 @@ class CI_Hooks { if ($class !== FALSE) { - if ( ! class_exists($class)) + if (! class_exists($class)) { require($filepath); } @@ -206,7 +206,7 @@ class CI_Hooks { } else { - if ( ! function_exists($function)) + if (! function_exists($function)) { require($filepath); } diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 85435f6c9..c236e391e 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -158,7 +158,7 @@ class CI_Image_lib { * properties using ImageMagick and NetPBM * */ - if ( ! function_exists('getimagesize')) + if (! function_exists('getimagesize')) { $this->set_error('imglib_gd_required_for_props'); return FALSE; @@ -188,7 +188,7 @@ class CI_Image_lib { $this->source_folder = str_replace($this->source_image, '', $full_source_path); // Set the Image Properties - if ( ! $this->get_image_properties($this->source_folder.$this->source_image)) + if (! $this->get_image_properties($this->source_folder.$this->source_image)) { return FALSE; } @@ -226,7 +226,7 @@ class CI_Image_lib { } // Is there a file name? - if ( ! preg_match("#[\.jpg|\.jpeg|\.gif|\.png]$#i", $full_dest_path)) + if (! preg_match("#[\.jpg|\.jpeg|\.gif|\.png]$#i", $full_dest_path)) { $this->dest_folder = $full_dest_path.'/'; $this->dest_image = $this->source_image; @@ -478,7 +478,7 @@ class CI_Image_lib { // we'll simply make a copy of the original with the new name if (($this->orig_width == $this->width AND $this->orig_height == $this->height) AND ($this->source_image != $this->new_image)) { - if ( ! @copy($this->full_src_path, $this->full_dst_path)) + if (! @copy($this->full_src_path, $this->full_dst_path)) { $this->set_error('imglib_copy_failed'); return FALSE; @@ -494,7 +494,7 @@ class CI_Image_lib { } // Create the image handle - if ( ! ($src_img = $this->image_create_gd())) + if (! ($src_img = $this->image_create_gd())) { return FALSE; } @@ -528,7 +528,7 @@ class CI_Image_lib { else { // Or save it - if ( ! $this->image_save_gd($dst_img)) + if (! $this->image_save_gd($dst_img)) { return FALSE; } @@ -564,9 +564,9 @@ class CI_Image_lib { return FALSE; } - if ( ! eregi("convert$", $this->library_path)) + if (! eregi("convert$", $this->library_path)) { - if ( ! eregi("/$", $this->library_path)) $this->library_path .= "/"; + if (! eregi("/$", $this->library_path)) $this->library_path .= "/"; $this->library_path .= 'convert'; } @@ -712,14 +712,14 @@ class CI_Image_lib { { // Is Image Rotation Supported? // this function is only supported as of PHP 4.3 - if ( ! function_exists('imagerotate')) + if (! function_exists('imagerotate')) { $this->set_error('imglib_rotate_unsupported'); return FALSE; } // Create the image handle - if ( ! ($src_img = $this->image_create_gd())) + if (! ($src_img = $this->image_create_gd())) { return FALSE; } @@ -742,7 +742,7 @@ class CI_Image_lib { else { // Or save it - if ( ! $this->image_save_gd($dst_img)) + if (! $this->image_save_gd($dst_img)) { return FALSE; } @@ -771,7 +771,7 @@ class CI_Image_lib { */ function image_mirror_gd() { - if ( ! $src_img = $this->image_create_gd()) + if (! $src_img = $this->image_create_gd()) { return FALSE; } @@ -828,7 +828,7 @@ class CI_Image_lib { else { // Or save it - if ( ! $this->image_save_gd($src_img)) + if (! $this->image_save_gd($src_img)) { return FALSE; } @@ -877,7 +877,7 @@ class CI_Image_lib { */ function overlay_watermark() { - if ( ! function_exists('imagecolortransparent')) + if (! function_exists('imagecolortransparent')) { $this->set_error('imglib_gd_required'); return FALSE; @@ -955,7 +955,7 @@ class CI_Image_lib { } else { - if ( ! $this->image_save_gd($src_img)) + if (! $this->image_save_gd($src_img)) { return FALSE; } @@ -977,7 +977,7 @@ class CI_Image_lib { */ function text_watermark() { - if ( ! ($src_img = $this->image_create_gd())) + if (! ($src_img = $this->image_create_gd())) { return FALSE; } @@ -1131,7 +1131,7 @@ class CI_Image_lib { switch ($image_type) { case 1 : - if ( ! function_exists('imagecreatefromgif')) + if (! function_exists('imagecreatefromgif')) { $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported')); return FALSE; @@ -1140,7 +1140,7 @@ class CI_Image_lib { return imagecreatefromgif($path); break; case 2 : - if ( ! function_exists('imagecreatefromjpeg')) + if (! function_exists('imagecreatefromjpeg')) { $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported')); return FALSE; @@ -1149,7 +1149,7 @@ class CI_Image_lib { return imagecreatefromjpeg($path); break; case 3 : - if ( ! function_exists('imagecreatefrompng')) + if (! function_exists('imagecreatefrompng')) { $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported')); return FALSE; @@ -1181,7 +1181,7 @@ class CI_Image_lib { switch ($this->image_type) { case 1 : - if ( ! function_exists('imagegif')) + if (! function_exists('imagegif')) { $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported')); return FALSE; @@ -1190,7 +1190,7 @@ class CI_Image_lib { @imagegif($resource, $this->full_dst_path); break; case 2 : - if ( ! function_exists('imagejpeg')) + if (! function_exists('imagejpeg')) { $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported')); return FALSE; @@ -1204,7 +1204,7 @@ class CI_Image_lib { @imagejpeg($resource, $this->full_dst_path, $this->quality); break; case 3 : - if ( ! function_exists('imagepng')) + if (! function_exists('imagepng')) { $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported')); return FALSE; @@ -1267,10 +1267,10 @@ class CI_Image_lib { */ function image_reproportion() { - if ( ! is_numeric($this->width) OR ! is_numeric($this->height) OR $this->width == 0 OR $this->height == 0) + if (! is_numeric($this->width) OR ! is_numeric($this->height) OR $this->width == 0 OR $this->height == 0) return; - if ( ! is_numeric($this->orig_width) OR ! is_numeric($this->orig_height) OR $this->orig_width == 0 OR $this->orig_height == 0) + if (! is_numeric($this->orig_width) OR ! is_numeric($this->orig_height) OR $this->orig_width == 0 OR $this->orig_height == 0) return; $new_width = ceil($this->orig_width*$this->height/$this->orig_height); @@ -1315,7 +1315,7 @@ class CI_Image_lib { if ($path == '') $path = $this->full_src_path; - if ( ! file_exists($path)) + if (! file_exists($path)) { $this->set_error('imglib_invalid_path'); return FALSE; @@ -1369,14 +1369,14 @@ class CI_Image_lib { */ function size_calculator($vals) { - if ( ! is_array($vals)) + if (! is_array($vals)) return; $allowed = array('new_width', 'new_height', 'width', 'height'); foreach ($allowed as $item) { - if ( ! isset($vals[$item]) OR $vals[$item] == '') + if (! isset($vals[$item]) OR $vals[$item] == '') $vals[$item] = 0; } @@ -1447,9 +1447,9 @@ class CI_Image_lib { */ function gd_loaded() { - if ( ! extension_loaded('gd')) + if (! extension_loaded('gd')) { - if ( ! dl('gd.so')) + if (! dl('gd.so')) { return FALSE; } diff --git a/system/libraries/Input.php b/system/libraries/Input.php index 1c5682eb7..8a0478be2 100644 --- a/system/libraries/Input.php +++ b/system/libraries/Input.php @@ -76,9 +76,9 @@ class CI_Input { // This is effectively the same as register_globals = off foreach (array($_GET, $_POST, $_COOKIE, $_SERVER, $_FILES, $_ENV, (isset($_SESSION) && is_array($_SESSION)) ? $_SESSION : array()) as $global) { - if ( ! is_array($global)) + if (! is_array($global)) { - if ( ! in_array($global, $protected)) + if (! in_array($global, $protected)) { unset($GLOBALS[$global]); } @@ -87,7 +87,7 @@ class CI_Input { { foreach ($global as $key => $val) { - if ( ! in_array($key, $protected)) + if (! in_array($key, $protected)) { unset($GLOBALS[$key]); } @@ -96,7 +96,7 @@ class CI_Input { { foreach($val as $k => $v) { - if ( ! in_array($k, $protected)) + if (! in_array($k, $protected)) { unset($GLOBALS[$k]); } @@ -198,7 +198,7 @@ class CI_Input { */ function _clean_input_keys($str) { - if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str)) + if (! preg_match("/^[a-z0-9:_\/-]+$/i", $str)) { exit('Disallowed Key Characters.'); } @@ -218,7 +218,7 @@ class CI_Input { */ function get($index = '', $xss_clean = FALSE) { - if ( ! isset($_GET[$index])) + if (! isset($_GET[$index])) { return FALSE; } @@ -253,7 +253,7 @@ class CI_Input { */ function post($index = '', $xss_clean = FALSE) { - if ( ! isset($_POST[$index])) + if (! isset($_POST[$index])) { return FALSE; } @@ -288,7 +288,7 @@ class CI_Input { */ function cookie($index = '', $xss_clean = FALSE) { - if ( ! isset($_COOKIE[$index])) + if (! isset($_COOKIE[$index])) { return FALSE; } @@ -328,7 +328,7 @@ class CI_Input { */ function server($index = '', $xss_clean = FALSE) { - if ( ! isset($_SERVER[$index])) + if (! isset($_SERVER[$index])) { return FALSE; } @@ -385,7 +385,7 @@ class CI_Input { $this->ip_address = end($x); } - if ( ! $this->valid_ip($this->ip_address)) + if (! $this->valid_ip($this->ip_address)) { $this->ip_address = '0.0.0.0'; } @@ -447,7 +447,7 @@ class CI_Input { return $this->user_agent; } - $this->user_agent = ( ! isset($_SERVER['HTTP_USER_AGENT'])) ? FALSE : $_SERVER['HTTP_USER_AGENT']; + $this->user_agent = (! isset($_SERVER['HTTP_USER_AGENT'])) ? FALSE : $_SERVER['HTTP_USER_AGENT']; return $this->user_agent; } diff --git a/system/libraries/Language.php b/system/libraries/Language.php index 3dac1a61f..a8e6366bb 100644 --- a/system/libraries/Language.php +++ b/system/libraries/Language.php @@ -83,7 +83,7 @@ class CI_Language { } - if ( ! isset($lang)) + if (! isset($lang)) { log_message('error', 'Language file contains no data: language/'.$idiom.'/'.$langfile); return; diff --git a/system/libraries/Loader.php b/system/libraries/Loader.php index 31e7d660f..5cf1f2ae6 100644 --- a/system/libraries/Loader.php +++ b/system/libraries/Loader.php @@ -152,7 +152,7 @@ class CI_Loader { $model = strtolower($model); - if ( ! file_exists(APPPATH.'models/'.$path.$model.EXT)) + if (! file_exists(APPPATH.'models/'.$path.$model.EXT)) { show_error('Unable to locate the model you have specified: '.$model); } @@ -165,7 +165,7 @@ class CI_Loader { $CI->load->database($db_conn, FALSE, TRUE); } - if ( ! class_exists('Model')) + if (! class_exists('Model')) { load_class('Model', FALSE); } @@ -230,7 +230,7 @@ class CI_Loader { */ function dbutil() { - if ( ! class_exists('CI_DB')) + if (! class_exists('CI_DB')) { $this->database(); } @@ -260,7 +260,7 @@ class CI_Loader { */ function dbforge() { - if ( ! class_exists('CI_DB')) + if (! class_exists('CI_DB')) { $this->database(); } @@ -353,7 +353,7 @@ class CI_Loader { */ function helper($helpers = array()) { - if ( ! is_array($helpers)) + if (! is_array($helpers)) { $helpers = array($helpers); } @@ -374,7 +374,7 @@ class CI_Loader { { $base_helper = BASEPATH.'helpers/'.$helper.EXT; - if ( ! file_exists($base_helper)) + if (! file_exists($base_helper)) { show_error('Unable to load the requested file: helpers/'.$helper.EXT); } @@ -435,7 +435,7 @@ class CI_Loader { */ function plugin($plugins = array()) { - if ( ! is_array($plugins)) + if (! is_array($plugins)) { $plugins = array($plugins); } @@ -505,7 +505,7 @@ class CI_Loader { */ function script($scripts = array()) { - if ( ! is_array($scripts)) + if (! is_array($scripts)) { $scripts = array($scripts); } @@ -519,7 +519,7 @@ class CI_Loader { continue; } - if ( ! file_exists(APPPATH.'scripts/'.$script.EXT)) + if (! file_exists(APPPATH.'scripts/'.$script.EXT)) { show_error('Unable to load the requested script: scripts/'.$script.EXT); } @@ -544,7 +544,7 @@ class CI_Loader { { $CI =& get_instance(); - if ( ! is_array($file)) + if (! is_array($file)) { $file = array($file); } @@ -630,7 +630,7 @@ class CI_Loader { // Set the default data variables foreach (array('_ci_view', '_ci_vars', '_ci_path', '_ci_return') as $_ci_val) { - $$_ci_val = ( ! isset($_ci_data[$_ci_val])) ? FALSE : $_ci_data[$_ci_val]; + $$_ci_val = (! isset($_ci_data[$_ci_val])) ? FALSE : $_ci_data[$_ci_val]; } // Set the path to the requested file @@ -646,7 +646,7 @@ class CI_Loader { $_ci_file = end($_ci_x); } - if ( ! file_exists($_ci_path)) + if (! file_exists($_ci_path)) { show_error('Unable to load the requested file: '.$_ci_file); } @@ -660,7 +660,7 @@ class CI_Loader { $_ci_CI =& get_instance(); foreach (get_object_vars($_ci_CI) as $_ci_key => $_ci_var) { - if ( ! isset($this->$_ci_key)) + if (! isset($this->$_ci_key)) { $this->$_ci_key =& $_ci_CI->$_ci_key; } @@ -768,7 +768,7 @@ class CI_Loader { { $baseclass = BASEPATH.'libraries/'.ucfirst($class).EXT; - if ( ! file_exists($baseclass)) + if (! file_exists($baseclass)) { log_message('error', "Unable to load the requested class: ".$class); show_error("Unable to load the requested class: ".$class); @@ -797,7 +797,7 @@ class CI_Loader { $filepath = $path.'libraries/'.$class.EXT; // Does the file exist? No? Bummer... - if ( ! file_exists($filepath)) + if (! file_exists($filepath)) { continue; } @@ -858,7 +858,7 @@ class CI_Loader { } // Set the variable name we will assign the class to - $classvar = ( ! isset($this->_ci_varmap[$class])) ? $class : $this->_ci_varmap[$class]; + $classvar = (! isset($this->_ci_varmap[$class])) ? $class : $this->_ci_varmap[$class]; // Instantiate the class $CI =& get_instance(); @@ -888,7 +888,7 @@ class CI_Loader { { include_once(APPPATH.'config/autoload'.EXT); - if ( ! isset($autoload)) + if (! isset($autoload)) { return FALSE; } @@ -916,7 +916,7 @@ class CI_Loader { // A little tweak to remain backward compatible // The $autoload['core'] item was deprecated - if ( ! isset($autoload['libraries'])) + if (! isset($autoload['libraries'])) { $autoload['libraries'] = $autoload['core']; } diff --git a/system/libraries/Log.php b/system/libraries/Log.php index 1aa8bd0f4..247aee13c 100644 --- a/system/libraries/Log.php +++ b/system/libraries/Log.php @@ -46,7 +46,7 @@ class CI_Log { $this->log_path = ($config['log_path'] != '') ? $config['log_path'] : BASEPATH.'logs/'; - if ( ! is_dir($this->log_path) OR ! is_really_writable($this->log_path)) + if (! is_dir($this->log_path) OR ! is_really_writable($this->log_path)) { $this->_enabled = FALSE; } @@ -84,7 +84,7 @@ class CI_Log { $level = strtoupper($level); - if ( ! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold)) + if (! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold)) { return FALSE; } @@ -92,12 +92,12 @@ class CI_Log { $filepath = $this->log_path.'log-'.date('Y-m-d').EXT; $message = ''; - if ( ! file_exists($filepath)) + if (! file_exists($filepath)) { $message .= "<"."?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n"; } - if ( ! $fp = @fopen($filepath, "a")) + if (! $fp = @fopen($filepath, "a")) { return FALSE; } diff --git a/system/libraries/Model.php b/system/libraries/Model.php index 8181ead32..e87d6045c 100644 --- a/system/libraries/Model.php +++ b/system/libraries/Model.php @@ -59,7 +59,7 @@ class Model { $CI =& get_instance(); foreach (array_keys(get_object_vars($CI)) as $key) { - if ( ! isset($this->$key) AND $key != $this->_parent_name) + if (! isset($this->$key) AND $key != $this->_parent_name) { // In some cases using references can cause // problems so we'll conditionally use them diff --git a/system/libraries/Output.php b/system/libraries/Output.php index 07990eb16..d513a1279 100644 --- a/system/libraries/Output.php +++ b/system/libraries/Output.php @@ -137,7 +137,7 @@ class CI_Output { */ function cache($time) { - $this->cache_expiration = ( ! is_numeric($time)) ? 0 : $time; + $this->cache_expiration = (! is_numeric($time)) ? 0 : $time; } // -------------------------------------------------------------------- @@ -187,7 +187,7 @@ class CI_Output { $elapsed = $BM->elapsed_time('total_execution_time_start', 'total_execution_time_end'); $output = str_replace('{elapsed_time}', $elapsed, $output); - $memory = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB'; + $memory = (! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB'; $output = str_replace('{memory_usage}', $memory, $output); // -------------------------------------------------------------------- @@ -220,7 +220,7 @@ class CI_Output { // Does the get_instance() function exist? // If not we know we are dealing with a cache file so we'll // simply echo out the data and exit. - if ( ! function_exists('get_instance')) + if (! function_exists('get_instance')) { echo $output; log_message('debug', "Final output sent to browser"); @@ -285,7 +285,7 @@ class CI_Output { $cache_path = ($path == '') ? BASEPATH.'cache/' : $path; - if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path)) + if (! is_dir($cache_path) OR ! is_really_writable($cache_path)) { return; } @@ -296,7 +296,7 @@ class CI_Output { $cache_path .= md5($uri); - if ( ! $fp = @fopen($cache_path, 'wb')) + if (! $fp = @fopen($cache_path, 'wb')) { log_message('error', "Unable to write cache file: ".$cache_path); return; @@ -327,7 +327,7 @@ class CI_Output { $cache_path = ($CFG->item('cache_path') == '') ? BASEPATH.'cache/' : $CFG->item('cache_path'); - if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path)) + if (! is_dir($cache_path) OR ! is_really_writable($cache_path)) { return FALSE; } @@ -339,12 +339,12 @@ class CI_Output { $filepath = $cache_path.md5($uri); - if ( ! @file_exists($filepath)) + if (! @file_exists($filepath)) { return FALSE; } - if ( ! $fp = @fopen($filepath, 'rb')) + if (! $fp = @fopen($filepath, 'rb')) { return FALSE; } @@ -361,7 +361,7 @@ class CI_Output { fclose($fp); // Strip out the embedded timestamp - if ( ! preg_match("/(\d+TS--->)/", $cache, $match)) + if (! preg_match("/(\d+TS--->)/", $cache, $match)) { return FALSE; } diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index 28b74f1f0..e1212035a 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -132,7 +132,7 @@ class CI_Pagination { show_error('Your number of links must be a positive number.'); } - if ( ! is_numeric($this->cur_page)) + if (! is_numeric($this->cur_page)) { $this->cur_page = 0; } diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php index a0b310f00..417e04f29 100644 --- a/system/libraries/Parser.php +++ b/system/libraries/Parser.php @@ -130,7 +130,7 @@ class CI_Parser { $temp = $match['1']; foreach ($row as $key => $val) { - if ( ! is_array($val)) + if (! is_array($val)) { $temp = $this->_parse_single($key, $val, $temp); } @@ -158,7 +158,7 @@ class CI_Parser { */ function _match_pair($string, $variable) { - if ( ! preg_match("|".$this->l_delim . $variable . $this->r_delim."(.+)".$this->l_delim . '/' . $variable . $this->r_delim."|s", $string, $match)) + if (! preg_match("|".$this->l_delim . $variable . $this->r_delim."(.+)".$this->l_delim . '/' . $variable . $this->r_delim."|s", $string, $match)) { return FALSE; } diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index 8a45933e1..807c1aff6 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -106,7 +106,7 @@ class CI_Profiler { $output .= '
    '; $output .= "\n"; - if ( ! class_exists('CI_DB_driver')) + if (! class_exists('CI_DB_driver')) { $output .= '  '.$this->CI->lang->line('profiler_queries').'  '; $output .= "\n"; @@ -175,7 +175,7 @@ class CI_Profiler { foreach ($_GET as $key => $val) { - if ( ! is_numeric($key)) + if (! is_numeric($key)) { $key = "'".$key."'"; } @@ -225,7 +225,7 @@ class CI_Profiler { foreach ($_POST as $key => $val) { - if ( ! is_numeric($key)) + if (! is_numeric($key)) { $key = "'".$key."'"; } diff --git a/system/libraries/Router.php b/system/libraries/Router.php index 804e80bd2..6bb85518f 100644 --- a/system/libraries/Router.php +++ b/system/libraries/Router.php @@ -80,12 +80,12 @@ class CI_Router { // Load the routes.php file. @include(APPPATH.'config/routes'.EXT); - $this->routes = ( ! isset($route) OR ! is_array($route)) ? array() : $route; + $this->routes = (! isset($route) OR ! is_array($route)) ? array() : $route; unset($route); // Set the default controller so we can display it in the event // the URI doesn't correlated to a valid controller. - $this->default_controller = ( ! isset($this->routes['default_controller']) OR $this->routes['default_controller'] == '') ? FALSE : strtolower($this->routes['default_controller']); + $this->default_controller = (! isset($this->routes['default_controller']) OR $this->routes['default_controller'] == '') ? FALSE : strtolower($this->routes['default_controller']); // Fetch the complete URI string $this->uri->_fetch_uri_string(); @@ -202,7 +202,7 @@ class CI_Router { if (count($segments) > 0) { // Does the requested controller exist in the sub-folder? - if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT)) + if (! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT)) { show_404($this->fetch_directory().$segments[0]); } @@ -213,7 +213,7 @@ class CI_Router { $this->set_method('index'); // Does the default controller exist in the sub-folder? - if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$this->default_controller.EXT)) + if (! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$this->default_controller.EXT)) { $this->directory = ''; return array(); diff --git a/system/libraries/Session.php b/system/libraries/Session.php index afa43348e..d4fdd3ac7 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -146,7 +146,7 @@ class CI_Session { * a new one. If it does, we'll update it. * */ - if ( ! $this->sess_read()) + if (! $this->sess_read()) { $this->sess_create(); } @@ -214,7 +214,7 @@ class CI_Session { $session = @unserialize($this->strip_slashes($session)); - if ( ! is_array($session) OR ! isset($session['last_activity'])) + if (! is_array($session) OR ! isset($session['last_activity'])) { log_message('error', 'The session cookie data did not contain a valid array. This could be a possible hacking attempt.'); return FALSE; @@ -439,7 +439,7 @@ class CI_Session { */ function userdata($item) { - return ( ! isset($this->userdata[$item])) ? FALSE : $this->userdata[$item]; + return (! isset($this->userdata[$item])) ? FALSE : $this->userdata[$item]; } // -------------------------------------------------------------------- @@ -452,7 +452,7 @@ class CI_Session { */ function all_userdata() { - return ( ! isset($this->userdata)) ? FALSE : $this->userdata; + return (! isset($this->userdata)) ? FALSE : $this->userdata; } // -------------------------------------------------------------------- diff --git a/system/libraries/Table.php b/system/libraries/Table.php index 439fe2ef9..38affa579 100644 --- a/system/libraries/Table.php +++ b/system/libraries/Table.php @@ -53,7 +53,7 @@ class CI_Table { */ function set_template($template) { - if ( ! is_array($template)) + if (! is_array($template)) { return FALSE; } @@ -93,7 +93,7 @@ class CI_Table { */ function make_columns($array = array(), $col_limit = 0) { - if ( ! is_array($array) OR count($array) == 0) + if (! is_array($array) OR count($array) == 0) { return FALSE; } @@ -187,7 +187,7 @@ class CI_Table { { // The table data can optionally be passed to this function // either as a database result object or an array - if ( ! is_null($table_data)) + if (! is_null($table_data)) { if (is_object($table_data)) { @@ -246,7 +246,7 @@ class CI_Table { $i = 1; foreach($this->rows as $row) { - if ( ! is_array($row)) + if (! is_array($row)) { break; } @@ -309,7 +309,7 @@ class CI_Table { */ function _set_from_object($query) { - if ( ! is_object($query)) + if (! is_object($query)) { return FALSE; } @@ -317,7 +317,7 @@ class CI_Table { // First generate the headings from the table column names if (count($this->heading) == 0) { - if ( ! method_exists($query, 'list_fields')) + if (! method_exists($query, 'list_fields')) { return FALSE; } @@ -347,7 +347,7 @@ class CI_Table { */ function _set_from_array($data, $set_heading = TRUE) { - if ( ! is_array($data) OR count($data) == 0) + if (! is_array($data) OR count($data) == 0) { return FALSE; } @@ -355,7 +355,7 @@ class CI_Table { $i = 0; foreach ($data as $row) { - if ( ! is_array($row)) + if (! is_array($row)) { $this->rows[] = $data; break; @@ -394,7 +394,7 @@ class CI_Table { $this->temp = $this->_default_template(); foreach (array('table_open','heading_row_start', 'heading_row_end', 'heading_cell_start', 'heading_cell_end', 'row_start', 'row_end', 'cell_start', 'cell_end', 'row_alt_start', 'row_alt_end', 'cell_alt_start', 'cell_alt_end', 'table_close') as $val) { - if ( ! isset($this->template[$val])) + if (! isset($this->template[$val])) { $this->template[$val] = $this->temp[$val]; } diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 5371e9050..3e1c20210 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -56,7 +56,7 @@ class CI_Trackback { */ function send($tb_data) { - if ( ! is_array($tb_data)) + if (! is_array($tb_data)) { $this->set_error('The send() method must be passed an array'); return FALSE; @@ -65,7 +65,7 @@ class CI_Trackback { // Pre-process the Trackback Data foreach (array('url', 'title', 'excerpt', 'blog_name', 'ping_url') as $item) { - if ( ! isset($tb_data[$item])) + if (! isset($tb_data[$item])) { $this->set_error('Required item missing: '.$item); return FALSE; @@ -102,7 +102,7 @@ class CI_Trackback { } // Build the Trackback data string - $charset = ( ! isset($tb_data['charset'])) ? $this->charset : $tb_data['charset']; + $charset = (! isset($tb_data['charset'])) ? $this->charset : $tb_data['charset']; $data = "url=".rawurlencode($url)."&title=".rawurlencode($title)."&blog_name=".rawurlencode($blog_name)."&excerpt=".rawurlencode($excerpt)."&charset=".rawurlencode($charset); @@ -139,13 +139,13 @@ class CI_Trackback { { foreach (array('url', 'title', 'blog_name', 'excerpt') as $val) { - if ( ! isset($_POST[$val]) OR $_POST[$val] == '') + if (! isset($_POST[$val]) OR $_POST[$val] == '') { $this->set_error('The following required POST variable is missing: '.$val); return FALSE; } - $this->data['charset'] = ( ! isset($_POST['charset'])) ? 'auto' : strtoupper(trim($_POST['charset'])); + $this->data['charset'] = (! isset($_POST['charset'])) ? 'auto' : strtoupper(trim($_POST['charset'])); if ($val != 'url' && function_exists('mb_convert_encoding')) { @@ -212,7 +212,7 @@ class CI_Trackback { */ function data($item) { - return ( ! isset($this->data[$item])) ? '' : $this->data[$item]; + return (! isset($this->data[$item])) ? '' : $this->data[$item]; } // -------------------------------------------------------------------- @@ -233,14 +233,14 @@ class CI_Trackback { $target = parse_url($url); // Open the socket - if ( ! $fp = @fsockopen($target['host'], 80)) + if (! $fp = @fsockopen($target['host'], 80)) { $this->set_error('Invalid Connection: '.$url); return FALSE; } // Build the path - $ppath = ( ! isset($target['path'])) ? $url : $target['path']; + $ppath = (! isset($target['path'])) ? $url : $target['path']; $path = (isset($target['query']) && $target['query'] != "") ? $ppath.'?'.$target['query'] : $ppath; @@ -267,7 +267,7 @@ class CI_Trackback { } @fclose($fp); - if ( ! eregi("0", $this->response)) + if (! eregi("0", $this->response)) { $message = 'An unknown error was encountered'; @@ -360,7 +360,7 @@ class CI_Trackback { $tb_array = explode('/', $url); $tb_end = $tb_array[count($tb_array)-1]; - if ( ! is_numeric($tb_end)) + if (! is_numeric($tb_end)) { $tb_end = $tb_array[count($tb_array)-2]; } @@ -378,13 +378,13 @@ class CI_Trackback { $tb_array = explode('/', $url); $tb_id = $tb_array[count($tb_array)-1]; - if ( ! is_numeric($tb_id)) + if (! is_numeric($tb_id)) { $tb_id = $tb_array[count($tb_array)-2]; } } - if ( ! preg_match ("/^([0-9]+)$/", $tb_id)) + if (! preg_match ("/^([0-9]+)$/", $tb_id)) { return false; } diff --git a/system/libraries/URI.php b/system/libraries/URI.php index d10a5daeb..f0d02101a 100644 --- a/system/libraries/URI.php +++ b/system/libraries/URI.php @@ -133,7 +133,7 @@ class CI_URI { */ function _parse_request_uri() { - if ( ! isset($_SERVER['REQUEST_URI']) OR $_SERVER['REQUEST_URI'] == '') + if (! isset($_SERVER['REQUEST_URI']) OR $_SERVER['REQUEST_URI'] == '') { return ''; } @@ -185,7 +185,7 @@ class CI_URI { { if ($str != '' AND $this->config->item('permitted_uri_chars') != '') { - if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", $str)) + if (! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", $str)) { exit('The URI you submitted has disallowed characters.'); } @@ -278,7 +278,7 @@ class CI_URI { */ function segment($n, $no_result = FALSE) { - return ( ! isset($this->segments[$n])) ? $no_result : $this->segments[$n]; + return (! isset($this->segments[$n])) ? $no_result : $this->segments[$n]; } // -------------------------------------------------------------------- @@ -297,7 +297,7 @@ class CI_URI { */ function rsegment($n, $no_result = FALSE) { - return ( ! isset($this->rsegments[$n])) ? $no_result : $this->rsegments[$n]; + return (! isset($this->rsegments[$n])) ? $no_result : $this->rsegments[$n]; } // -------------------------------------------------------------------- @@ -360,7 +360,7 @@ class CI_URI { $segment_array = 'rsegment_array'; } - if ( ! is_numeric($n)) + if (! is_numeric($n)) { return $default; } @@ -409,7 +409,7 @@ class CI_URI { { foreach ($default as $val) { - if ( ! array_key_exists($val, $retval)) + if (! array_key_exists($val, $retval)) { $retval[$val] = FALSE; } diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index ff4d0c7ed..3cdf45f12 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -260,8 +260,8 @@ class CI_Unit_test { { $back = debug_backtrace(); - $file = ( ! isset($back['1']['file'])) ? '' : $back['1']['file']; - $line = ( ! isset($back['1']['line'])) ? '' : $back['1']['line']; + $file = (! isset($back['1']['file'])) ? '' : $back['1']['file']; + $line = (! isset($back['1']['line'])) ? '' : $back['1']['line']; return array('file' => $file, 'line' => $line); } @@ -300,7 +300,7 @@ class CI_Unit_test { */ function _parse_template() { - if ( ! is_null($this->_template_rows)) + if (! is_null($this->_template_rows)) { return; } @@ -311,7 +311,7 @@ class CI_Unit_test { return; } - if ( ! preg_match("/\{rows\}(.*?)\{\/rows\}/si", $this->_template, $match)) + if (! preg_match("/\{rows\}(.*?)\{\/rows\}/si", $this->_template, $match)) { $this->_default_template(); return; diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 760d93999..f13907000 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -135,23 +135,23 @@ class CI_Upload { function do_upload($field = 'userfile') { // Is $_FILES[$field] set? If not, no reason to continue. - if ( ! isset($_FILES[$field])) + if (! isset($_FILES[$field])) { $this->set_error('upload_no_file_selected'); return FALSE; } // Is the upload path valid? - if ( ! $this->validate_upload_path()) + if (! $this->validate_upload_path()) { $this->set_error('upload_no_filepath'); return FALSE; } // Was the file able to be uploaded? If not, determine the reason why. - if ( ! is_uploaded_file($_FILES[$field]['tmp_name'])) + if (! is_uploaded_file($_FILES[$field]['tmp_name'])) { - $error = ( ! isset($_FILES[$field]['error'])) ? 4 : $_FILES[$field]['error']; + $error = (! isset($_FILES[$field]['error'])) ? 4 : $_FILES[$field]['error']; switch($error) { @@ -198,14 +198,14 @@ class CI_Upload { } // Is the file type allowed to be uploaded? - if ( ! $this->is_allowed_filetype()) + if (! $this->is_allowed_filetype()) { $this->set_error('upload_invalid_filetype'); return FALSE; } // Is the file size within the allowed maximum? - if ( ! $this->is_allowed_filesize()) + if (! $this->is_allowed_filesize()) { $this->set_error('upload_invalid_filesize'); return FALSE; @@ -213,7 +213,7 @@ class CI_Upload { // Are the image dimensions within the allowed size? // Note: This can fail if the server has an open_basdir restriction. - if ( ! $this->is_allowed_dimensions()) + if (! $this->is_allowed_dimensions()) { $this->set_error('upload_invalid_dimensions'); return FALSE; @@ -253,9 +253,9 @@ class CI_Upload { * we'll use move_uploaded_file(). One of the two should * reliably work in most environments */ - if ( ! @copy($this->file_temp, $this->upload_path.$this->file_name)) + if (! @copy($this->file_temp, $this->upload_path.$this->file_name)) { - if ( ! @move_uploaded_file($this->file_temp, $this->upload_path.$this->file_name)) + if (! @move_uploaded_file($this->file_temp, $this->upload_path.$this->file_name)) { $this->set_error('upload_destination_error'); return FALSE; @@ -350,7 +350,7 @@ class CI_Upload { $filename = md5(uniqid(mt_rand())).$this->file_ext; } - if ( ! file_exists($path.$filename)) + if (! file_exists($path.$filename)) { return $filename; } @@ -360,7 +360,7 @@ class CI_Upload { $new_filename = ''; for ($i = 1; $i < 100; $i++) { - if ( ! file_exists($path.$filename.$i.$this->file_ext)) + if (! file_exists($path.$filename.$i.$this->file_ext)) { $new_filename = $filename.$i.$this->file_ext; break; @@ -389,7 +389,7 @@ class CI_Upload { */ function set_max_filesize($n) { - $this->max_size = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; + $this->max_size = (! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; } // -------------------------------------------------------------------- @@ -403,7 +403,7 @@ class CI_Upload { */ function set_max_width($n) { - $this->max_width = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; + $this->max_width = (! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; } // -------------------------------------------------------------------- @@ -417,7 +417,7 @@ class CI_Upload { */ function set_max_height($n) { - $this->max_height = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; + $this->max_height = (! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; } // -------------------------------------------------------------------- @@ -447,7 +447,7 @@ class CI_Upload { */ function set_image_properties($path = '') { - if ( ! $this->is_image()) + if (! $this->is_image()) { return; } @@ -460,7 +460,7 @@ class CI_Upload { $this->image_width = $D['0']; $this->image_height = $D['1']; - $this->image_type = ( ! isset($types[$D['2']])) ? 'unknown' : $types[$D['2']]; + $this->image_type = (! isset($types[$D['2']])) ? 'unknown' : $types[$D['2']]; $this->image_size_str = $D['3']; // string containing height and width } } @@ -587,7 +587,7 @@ class CI_Upload { */ function is_allowed_dimensions() { - if ( ! $this->is_image()) + if (! $this->is_image()) { return TRUE; } @@ -636,13 +636,13 @@ class CI_Upload { $this->upload_path = str_replace("\\", "/", realpath($this->upload_path)); } - if ( ! @is_dir($this->upload_path)) + if (! @is_dir($this->upload_path)) { $this->set_error('upload_no_filepath'); return FALSE; } - if ( ! is_really_writable($this->upload_path)) + if (! is_really_writable($this->upload_path)) { $this->set_error('upload_not_writable'); return FALSE; @@ -741,7 +741,7 @@ class CI_Upload { return FALSE; } - if ( ! $fp = @fopen($file, 'r+b')) + if (! $fp = @fopen($file, 'r+b')) { return FALSE; } @@ -830,7 +830,7 @@ class CI_Upload { } } - return ( ! isset($this->mimes[$mime])) ? FALSE : $this->mimes[$mime]; + return (! isset($this->mimes[$mime])) ? FALSE : $this->mimes[$mime]; } /** diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php index ff6d4a933..dd60a56a1 100644 --- a/system/libraries/User_agent.php +++ b/system/libraries/User_agent.php @@ -63,7 +63,7 @@ class CI_User_agent { $this->agent = trim($_SERVER['HTTP_USER_AGENT']); } - if ( ! is_null($this->agent)) + if (! is_null($this->agent)) { if ($this->_load_agent_file()) { @@ -84,7 +84,7 @@ class CI_User_agent { */ function _load_agent_file() { - if ( ! @include(APPPATH.'config/user_agents'.EXT)) + if (! @include(APPPATH.'config/user_agents'.EXT)) { return FALSE; } @@ -339,7 +339,7 @@ class CI_User_agent { */ function is_referral() { - return ( ! isset($_SERVER['HTTP_REFERER']) OR $_SERVER['HTTP_REFERER'] == '') ? FALSE : TRUE; + return (! isset($_SERVER['HTTP_REFERER']) OR $_SERVER['HTTP_REFERER'] == '') ? FALSE : TRUE; } // -------------------------------------------------------------------- @@ -429,7 +429,7 @@ class CI_User_agent { */ function referrer() { - return ( ! isset($_SERVER['HTTP_REFERER']) OR $_SERVER['HTTP_REFERER'] == '') ? '' : trim($_SERVER['HTTP_REFERER']); + return (! isset($_SERVER['HTTP_REFERER']) OR $_SERVER['HTTP_REFERER'] == '') ? '' : trim($_SERVER['HTTP_REFERER']); } // -------------------------------------------------------------------- diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php index 18fdba2d3..16e8cd74f 100644 --- a/system/libraries/Validation.php +++ b/system/libraries/Validation.php @@ -74,7 +74,7 @@ class CI_Validation { } else { - if ( ! is_array($data)) + if (! is_array($data)) { $data = array($data => $field); } @@ -87,10 +87,10 @@ class CI_Validation { foreach($this->_fields as $key => $val) { - $this->$key = ( ! isset($_POST[$key])) ? '' : $this->prep_for_form($_POST[$key]); + $this->$key = (! isset($_POST[$key])) ? '' : $this->prep_for_form($_POST[$key]); $error = $key.'_error'; - if ( ! isset($this->$error)) + if (! isset($this->$error)) { $this->$error = ''; } @@ -112,7 +112,7 @@ class CI_Validation { */ function set_rules($data, $rules = '') { - if ( ! is_array($data)) + if (! is_array($data)) { if ($rules == '') return; @@ -141,7 +141,7 @@ class CI_Validation { */ function set_message($lang, $val = '') { - if ( ! is_array($lang)) + if (! is_array($lang)) { $lang = array($lang => $val); } @@ -195,9 +195,9 @@ class CI_Validation { $ex = explode('|', $rules); // Is the field required? If not, if the field is blank we'll move on to the next test - if ( ! in_array('required', $ex, TRUE)) + if (! in_array('required', $ex, TRUE)) { - if ( ! isset($_POST[$field]) OR $_POST[$field] == '') + if (! isset($_POST[$field]) OR $_POST[$field] == '') { continue; } @@ -212,11 +212,11 @@ class CI_Validation { * test for it here since there's not reason to go * further */ - if ( ! isset($_POST[$field])) + if (! isset($_POST[$field])) { if (in_array('isset', $ex, TRUE) OR in_array('required', $ex)) { - if ( ! isset($this->_error_messages['isset'])) + if (! isset($this->_error_messages['isset'])) { if (FALSE === ($line = $this->CI->lang->line('isset'))) { @@ -229,7 +229,7 @@ class CI_Validation { } // Build the error message - $mfield = ( ! isset($this->_fields[$field])) ? $field : $this->_fields[$field]; + $mfield = (! isset($this->_fields[$field])) ? $field : $this->_fields[$field]; $message = sprintf($line, $mfield); // Set the error variable. Example: $this->username_error @@ -274,7 +274,7 @@ class CI_Validation { // Call the function that corresponds to the rule if ($callback === TRUE) { - if ( ! method_exists($this->CI, $rule)) + if (! method_exists($this->CI, $rule)) { continue; } @@ -282,7 +282,7 @@ class CI_Validation { $result = $this->CI->$rule($_POST[$field], $param); // If the field isn't required and we just processed a callback we'll move on... - if ( ! in_array('required', $ex, TRUE) AND $result !== FALSE) + if (! in_array('required', $ex, TRUE) AND $result !== FALSE) { continue 2; } @@ -290,7 +290,7 @@ class CI_Validation { } else { - if ( ! method_exists($this, $rule)) + if (! method_exists($this, $rule)) { /* * Run the native PHP function if called for @@ -314,7 +314,7 @@ class CI_Validation { // Did the rule test negatively? If so, grab the error. if ($result === FALSE) { - if ( ! isset($this->_error_messages[$rule])) + if (! isset($this->_error_messages[$rule])) { if (FALSE === ($line = $this->CI->lang->line($rule))) { @@ -327,8 +327,8 @@ class CI_Validation { } // Build the error message - $mfield = ( ! isset($this->_fields[$field])) ? $field : $this->_fields[$field]; - $mparam = ( ! isset($this->_fields[$param])) ? $param : $this->_fields[$param]; + $mfield = (! isset($this->_fields[$field])) ? $field : $this->_fields[$field]; + $mparam = (! isset($this->_fields[$param])) ? $param : $this->_fields[$param]; $message = sprintf($line, $mfield, $mparam); // Set the error variable. Example: $this->username_error @@ -385,13 +385,13 @@ class CI_Validation { */ function required($str) { - if ( ! is_array($str)) + if (! is_array($str)) { return (trim($str) == '') ? FALSE : TRUE; } else { - return ( ! empty($str)); + return (! empty($str)); } } @@ -406,7 +406,7 @@ class CI_Validation { */ function matches($str, $field) { - if ( ! isset($_POST[$field])) + if (! isset($_POST[$field])) { return FALSE; } @@ -482,7 +482,7 @@ class CI_Validation { */ function valid_email($str) { - return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE; + return (! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE; } // -------------------------------------------------------------------- @@ -537,7 +537,7 @@ class CI_Validation { */ function alpha($str) { - return ( ! preg_match("/^([a-z])+$/i", $str)) ? FALSE : TRUE; + return (! preg_match("/^([a-z])+$/i", $str)) ? FALSE : TRUE; } // -------------------------------------------------------------------- @@ -551,7 +551,7 @@ class CI_Validation { */ function alpha_numeric($str) { - return ( ! preg_match("/^([a-z0-9])+$/i", $str)) ? FALSE : TRUE; + return (! preg_match("/^([a-z0-9])+$/i", $str)) ? FALSE : TRUE; } // -------------------------------------------------------------------- @@ -565,7 +565,7 @@ class CI_Validation { */ function alpha_dash($str) { - return ( ! preg_match("/^([-a-z0-9_-])+$/i", $str)) ? FALSE : TRUE; + return (! preg_match("/^([-a-z0-9_-])+$/i", $str)) ? FALSE : TRUE; } // -------------------------------------------------------------------- @@ -594,7 +594,7 @@ class CI_Validation { */ function is_numeric($str) { - return ( ! is_numeric($str)) ? FALSE : TRUE; + return (! is_numeric($str)) ? FALSE : TRUE; } // -------------------------------------------------------------------- diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index f90ee56b1..f8ad01714 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -13,7 +13,7 @@ * @filesource */ -if ( ! function_exists('xml_parser_create')) +if (! function_exists('xml_parser_create')) { show_error('Your PHP installation does not support XML'); } @@ -176,7 +176,7 @@ class CI_Xmlrpc { function timeout($seconds=5) { - if ( ! is_null($this->client) && is_int($seconds)) + if (! is_null($this->client) && is_int($seconds)) { $this->client->timeout = $seconds; } @@ -199,7 +199,7 @@ class CI_Xmlrpc { function request($incoming) { - if ( ! is_array($incoming)) + if (! is_array($incoming)) { // Send Error } @@ -231,7 +231,7 @@ class CI_Xmlrpc { { if (is_array($value) && isset($value['0'])) { - if ( ! isset($value['1']) OR ! isset($this->xmlrpcTypes[strtolower($value['1'])])) + if (! isset($value['1']) OR ! isset($this->xmlrpcTypes[strtolower($value['1'])])) { if (is_array($value[0])) { @@ -275,12 +275,12 @@ class CI_Xmlrpc { $this->message = new XML_RPC_Message($this->method,$this->data); $this->message->debug = $this->debug; - if ( ! $this->result = $this->client->send($this->message)) + if (! $this->result = $this->client->send($this->message)) { $this->error = $this->result->errstr; return FALSE; } - elseif( ! is_object($this->result->val)) + elseif(! is_object($this->result->val)) { $this->error = $this->result->errstr; return FALSE; @@ -765,7 +765,7 @@ class XML_RPC_Message extends CI_Xmlrpc $r = new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'],$this->xmlrpcstr['invalid_return'].' '.$this->xh[$parser]['isf_reason']); return $r; } - elseif ( ! is_object($this->xh[$parser]['value'])) + elseif (! is_object($this->xh[$parser]['value'])) { $r = new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'],$this->xmlrpcstr['invalid_return'].' '.$this->xh[$parser]['isf_reason']); return $r; @@ -961,7 +961,7 @@ class XML_RPC_Message extends CI_Xmlrpc case 'STRUCT': case 'ARRAY': $cur_val = array_shift($this->xh[$the_parser]['valuestack']); - $this->xh[$the_parser]['value'] = ( ! isset($cur_val['values'])) ? array() : $cur_val['values']; + $this->xh[$the_parser]['value'] = (! isset($cur_val['values'])) ? array() : $cur_val['values']; $this->xh[$the_parser]['vt'] = strtolower($name); break; case 'NAME': @@ -1101,7 +1101,7 @@ class XML_RPC_Message extends CI_Xmlrpc $this->xh[$the_parser]['lv'] = 2; // Found a value } - if( ! @isset($this->xh[$the_parser]['ac'])) + if(! @isset($this->xh[$the_parser]['ac'])) { $this->xh[$the_parser]['ac'] = ''; } diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php index ac644d894..1b2ffca05 100644 --- a/system/libraries/Xmlrpcs.php +++ b/system/libraries/Xmlrpcs.php @@ -13,12 +13,12 @@ * @filesource */ -if ( ! function_exists('xml_parser_create')) +if (! function_exists('xml_parser_create')) { show_error('Your PHP installation does not support XML'); } -if ( ! class_exists('CI_Xmlrpc')) +if (! class_exists('CI_Xmlrpc')) { show_error('You must load the Xmlrpc class before loading the Xmlrpcs class in order to create a server.'); } @@ -176,7 +176,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc // PARSE + PROCESS XML DATA //------------------------------------- - if ( ! xml_parse($parser, $data, 1)) + if (! xml_parse($parser, $data, 1)) { // return XML error as a faultCode $r = new XML_RPC_Response(0, @@ -244,7 +244,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc // Valid Method //------------------------------------- - if ( ! isset($this->methods[$methName]['function'])) + if (! isset($this->methods[$methName]['function'])) { return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); } diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index fab8e7f6b..4bdc92547 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -57,7 +57,7 @@ class CI_Zip { { foreach ((array)$directory as $dir) { - if ( ! preg_match("|.+/$|", $dir)) + if (! preg_match("|.+/$|", $dir)) { $dir .= '/'; } @@ -196,7 +196,7 @@ class CI_Zip { */ function read_file($path, $preserve_filepath = FALSE) { - if ( ! file_exists($path)) + if (! file_exists($path)) { return FALSE; } @@ -301,7 +301,7 @@ class CI_Zip { */ function archive($filepath) { - if ( ! ($fp = @fopen($filepath, "wb"))) + if (! ($fp = @fopen($filepath, "wb"))) { return FALSE; } @@ -326,7 +326,7 @@ class CI_Zip { */ function download($filename = 'backup.zip') { - if ( ! preg_match("|.+?\.zip$|", $filename)) + if (! preg_match("|.+?\.zip$|", $filename)) { $filename .= '.zip'; } diff --git a/system/plugins/captcha_pi.php b/system/plugins/captcha_pi.php index 50a4eae0d..309ef7ea5 100644 --- a/system/plugins/captcha_pi.php +++ b/system/plugins/captcha_pi.php @@ -157,16 +157,16 @@ function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = foreach ($defaults as $key => $val) { - if ( ! is_array($data)) + if (! is_array($data)) { - if ( ! isset($$key) OR $$key == '') + if (! isset($$key) OR $$key == '') { $$key = $val; } } else { - $$key = ( ! isset($data[$key])) ? $val : $data[$key]; + $$key = (! isset($data[$key])) ? $val : $data[$key]; } } @@ -175,17 +175,17 @@ function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = return FALSE; } - if ( ! @is_dir($img_path)) + if (! @is_dir($img_path)) { return FALSE; } - if ( ! is_really_writable($img_path)) + if (! is_really_writable($img_path)) { return FALSE; } - if ( ! extension_loaded('gd')) + if (! extension_loaded('gd')) { return FALSE; } diff --git a/system/scaffolding/Scaffolding.php b/system/scaffolding/Scaffolding.php index a9777040f..64f62a3d6 100644 --- a/system/scaffolding/Scaffolding.php +++ b/system/scaffolding/Scaffolding.php @@ -97,7 +97,7 @@ class Scaffolding { function add() { $data = array( - 'title' => ( ! isset($this->lang['scaff_add'])) ? 'Add Data' : $this->lang['scaff_add'], + 'title' => (! isset($this->lang['scaff_add'])) ? 'Add Data' : $this->lang['scaff_add'], 'fields' => $this->CI->db->field_data($this->current_table), 'action' => $this->base_uri.'/insert' ); @@ -172,7 +172,7 @@ class Scaffolding { ); $data = array( - 'title' => ( ! isset($this->lang['scaff_view'])) ? 'View Data' : $this->lang['scaff_view'], + 'title' => (! isset($this->lang['scaff_view'])) ? 'View Data' : $this->lang['scaff_view'], 'query' => $query, 'fields' => $fields, 'primary' => $primary, @@ -207,7 +207,7 @@ class Scaffolding { $query = $this->CI->db->get_where($this->current_table, array($primary => $id)); $data = array( - 'title' => ( ! isset($this->lang['scaff_edit'])) ? 'Edit Data' : $this->lang['scaff_edit'], + 'title' => (! isset($this->lang['scaff_edit'])) ? 'Edit Data' : $this->lang['scaff_edit'], 'fields' => $query->field_data(), 'query' => $query->row(), 'action' => $this->base_uri.'/update/'.$this->CI->uri->segment(4) @@ -245,7 +245,7 @@ class Scaffolding { */ function delete() { - if ( ! isset($this->lang['scaff_del_confirm'])) + if (! isset($this->lang['scaff_del_confirm'])) { $message = 'Are you sure you want to delete the following row: '.$this->CI->uri->segment(4); } @@ -255,10 +255,10 @@ class Scaffolding { } $data = array( - 'title' => ( ! isset($this->lang['scaff_delete'])) ? 'Delete Data' : $this->lang['scaff_delete'], + 'title' => (! isset($this->lang['scaff_delete'])) ? 'Delete Data' : $this->lang['scaff_delete'], 'message' => $message, - 'no' => anchor(array($this->base_uri, 'view'), ( ! isset($this->lang['scaff_no'])) ? 'No' : $this->lang['scaff_no']), - 'yes' => anchor(array($this->base_uri, 'do_delete', $this->CI->uri->segment(4)), ( ! isset($this->lang['scaff_yes'])) ? 'Yes' : $this->lang['scaff_yes']) + 'no' => anchor(array($this->base_uri, 'view'), (! isset($this->lang['scaff_no'])) ? 'No' : $this->lang['scaff_no']), + 'yes' => anchor(array($this->base_uri, 'do_delete', $this->CI->uri->segment(4)), (! isset($this->lang['scaff_yes'])) ? 'Yes' : $this->lang['scaff_yes']) ); $this->CI->load->view('delete', $data); -- cgit v1.2.3-24-g4f1b