From d09c51afac9df77a52380dc2ac6581a104faa2ff Mon Sep 17 00:00:00 2001 From: "anaxamaxan@blackdog.local" Date: Wed, 2 Feb 2011 23:00:16 -0800 Subject: Made config->base_url() accept parameters. config->base_url($uri). Updated base_url() in url_helper accordingly. --- system/core/Config.php | 58 ++++++++++++++++++++++++++++++++++--------- system/helpers/url_helper.php | 11 +++++--- 2 files changed, 53 insertions(+), 16 deletions(-) (limited to 'system') diff --git a/system/core/Config.php b/system/core/Config.php index da22222dc..554b7360a 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -194,10 +194,7 @@ class CI_Config { // -------------------------------------------------------------------- /** - * Fetch a config file item - adds slash after item - * - * The second parameter allows a slash to be added to the end of - * the item, in the case of a path. + * Fetch a config file item - adds slash after item (if item is not empty) * * @access public * @param string the config item name @@ -210,6 +207,10 @@ class CI_Config { { return FALSE; } + if( trim($this->config[$item]) == '') + { + return ''; + } return rtrim($this->config[$item], '/').'/'; } @@ -218,6 +219,7 @@ class CI_Config { /** * Site URL + * Returns base_url . index_page [. uri_string] * * @access public * @param string the URI string @@ -230,16 +232,50 @@ class CI_Config { return $this->slash_item('base_url').$this->item('index_page'); } + if ($this->item('enable_query_strings') == FALSE) + { + $suffix = ($this->item('url_suffix') == FALSE) ? '' : $this->item('url_suffix'); + return $this->slash_item('base_url').$this->slash_item('index_page').$this->_uri_string($uri).$suffix; + } + else + { + return $this->slash_item('base_url').$this->item('index_page').'?'.$this->_uri_string($uri); + } + } + + // ------------------------------------------------------------- + + /** + * Base URL + * Returns base_url [. uri_string] + * + * @access public + * @param string $uri + * @return string + */ + function base_url($uri = '') + { + return $this->slash_item('base_url').ltrim($this->_uri_string($uri),'/'); + } + + // ------------------------------------------------------------- + + /** + * Build URI string for use in Config::site_url() and Config::base_url() + * + * @access protected + * @param $uri + * @return string + */ + protected function _uri_string($uri) + { if ($this->item('enable_query_strings') == FALSE) { if (is_array($uri)) { $uri = implode('/', $uri); } - - $index = $this->item('index_page') == '' ? '' : $this->slash_item('index_page'); - $suffix = ($this->item('url_suffix') == FALSE) ? '' : $this->item('url_suffix'); - return $this->slash_item('base_url').$index.trim($uri, '/').$suffix; + $uri = trim($uri, '/'); } else { @@ -253,16 +289,14 @@ class CI_Config { $str .= $prefix.$key.'='.$val; $i++; } - $uri = $str; } - - return $this->slash_item('base_url').$this->item('index_page').'?'.$uri; } + return $uri; } // -------------------------------------------------------------------- - + /** * System URL * diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index d0516cee6..9f4b85248 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -50,18 +50,21 @@ if ( ! function_exists('site_url')) /** * Base URL - * - * Returns the "base_url" item from your config file + * + * Create a local URL based on your basepath. + * Segments can be passed in as a string or an array, same as site_url + * or a URL to a file can be passed in, e.g. to an image file. * * @access public + * @param string * @return string */ if ( ! function_exists('base_url')) { - function base_url() + function base_url($uri = '') { $CI =& get_instance(); - return $CI->config->slash_item('base_url'); + return $CI->config->base_url($uri); } } -- cgit v1.2.3-24-g4f1b From 84445d08e31c4d538d5a25023b8e5861804a8f14 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Thu, 10 Mar 2011 16:43:39 +0000 Subject: Added sqlsrv folder, added necessary files, started altering queries in sqlsrv_driver.php --- system/database/drivers/sqlsrv/index.html | 10 + system/database/drivers/sqlsrv/sqlsrv_driver.php | 664 ++++++++++++++++++++++ system/database/drivers/sqlsrv/sqlsrv_forge.php | 248 ++++++++ system/database/drivers/sqlsrv/sqlsrv_result.php | 169 ++++++ system/database/drivers/sqlsrv/sqlsrv_utility.php | 88 +++ 5 files changed, 1179 insertions(+) create mode 100644 system/database/drivers/sqlsrv/index.html create mode 100644 system/database/drivers/sqlsrv/sqlsrv_driver.php create mode 100644 system/database/drivers/sqlsrv/sqlsrv_forge.php create mode 100644 system/database/drivers/sqlsrv/sqlsrv_result.php create mode 100644 system/database/drivers/sqlsrv/sqlsrv_utility.php (limited to 'system') diff --git a/system/database/drivers/sqlsrv/index.html b/system/database/drivers/sqlsrv/index.html new file mode 100644 index 000000000..c942a79ce --- /dev/null +++ b/system/database/drivers/sqlsrv/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php new file mode 100644 index 000000000..d64e98108 --- /dev/null +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -0,0 +1,664 @@ +port != '') + { + $this->hostname .= ','.$this->port; + } + + return @sqlsrv_connect($this->hostname, array('UID' => $this->username, 'PWD' => $this->password, 'Database' => $this->database, 'ConnectionPooling' => 0)); + } + + // -------------------------------------------------------------------- + + /** + * Persistent database connection + * + * @access private called by the base class + * @return resource + */ + function db_pconnect() + { + if ($this->port != '') + { + $this->hostname .= ','.$this->port; + } + + return @sqlsrv_connect($this->hostname, array('UID' => $this->username, 'PWD' => $this->password, 'Database' => $this->database, 'ConnectionPooling' => 1)); + } + + // -------------------------------------------------------------------- + + /** + * Reconnect + * + * Keep / reestablish the db connection if no queries have been + * sent for a length of time exceeding the server's idle timeout + * + * @access public + * @return void + */ + function reconnect() + { + // not implemented in MSSQL + } + + // -------------------------------------------------------------------- + + /** + * Select the database + * + * @access private called by the base class + * @return resource + */ + function db_select() + { + // Note: The brackets are required in the event that the DB name + // contains reserved characters + return @mssql_select_db('['.$this->database.']', $this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Set client character set + * + * @access public + * @param string + * @param string + * @return resource + */ + function db_set_charset($charset, $collation) + { + // @todo - add support if needed + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Execute the query + * + * @access private called by the base class + * @param string an SQL query + * @return resource + */ + function _execute($sql) + { + $sql = $this->_prep_query($sql); + return @sqlsrv_query($this->conn_id, $sql); + } + + // -------------------------------------------------------------------- + + /** + * Prep the query + * + * If needed, each database adapter can prep the query string + * + * @access private called by execute() + * @param string an SQL query + * @return string + */ + function _prep_query($sql) + { + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @access public + * @return bool + */ + function trans_begin($test_mode = FALSE) + { + if ( ! $this->trans_enabled) + { + return TRUE; + } + + // When transactions are nested we only begin/commit/rollback the outermost ones + if ($this->_trans_depth > 0) + { + return TRUE; + } + + // Reset the transaction failure flag. + // If the $test_mode flag is set to TRUE transactions will be rolled back + // even if the queries produce a successful result. + $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; + + $this->simple_query('BEGIN TRAN'); + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @access public + * @return bool + */ + function trans_commit() + { + if ( ! $this->trans_enabled) + { + return TRUE; + } + + // When transactions are nested we only begin/commit/rollback the outermost ones + if ($this->_trans_depth > 0) + { + return TRUE; + } + + $this->simple_query('COMMIT TRAN'); + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @access public + * @return bool + */ + function trans_rollback() + { + if ( ! $this->trans_enabled) + { + return TRUE; + } + + // When transactions are nested we only begin/commit/rollback the outermost ones + if ($this->_trans_depth > 0) + { + return TRUE; + } + + $this->simple_query('ROLLBACK TRAN'); + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Escape String + * + * @access public + * @param string + * @param bool whether or not the string will be used in a LIKE condition + * @return string + */ + function escape_str($str, $like = FALSE) + { + if (is_array($str)) + { + foreach ($str as $key => $val) + { + $str[$key] = $this->escape_str($val, $like); + } + + return $str; + } + + // Escape single quotes + $str = str_replace("'", "''", remove_invisible_characters($str)); + + // escape LIKE condition wildcards + if ($like === TRUE) + { + $str = str_replace( array('%', '_', $this->_like_escape_chr), + array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), + $str); + } + + return $str; + } + + // -------------------------------------------------------------------- + + /** + * Affected Rows + * + * @access public + * @return integer + */ + function affected_rows() + { + return @mssql_rows_affected($this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * Returns the last id created in the Identity column. + * + * @access public + * @return integer + */ + function insert_id() + { + $ver = self::_parse_major_version($this->version()); + $sql = ($ver >= 8 ? "SELECT SCOPE_IDENTITY() AS last_id" : "SELECT @@IDENTITY AS last_id"); + $query = $this->query($sql); + $row = $query->row(); + return $row->last_id; + } + + // -------------------------------------------------------------------- + + /** + * Parse major version + * + * Grabs the major version number from the + * database server version string passed in. + * + * @access private + * @param string $version + * @return int16 major version number + */ + function _parse_major_version($version) + { + preg_match('/([0-9]+)\.([0-9]+)\.([0-9]+)/', $version, $ver_info); + return $ver_info[1]; // return the major version b/c that's all we're interested in. + } + + // -------------------------------------------------------------------- + + /** + * Version number query string + * + * @access public + * @return string + */ + function _version() + { + return "SELECT @@VERSION AS ver"; + } + + // -------------------------------------------------------------------- + + /** + * "Count All" query + * + * Generates a platform-specific query string that counts all records in + * the specified database + * + * @access public + * @param string + * @return string + */ + function count_all($table = '') + { + if ($table == '') + { + return 0; + } + + $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); + + if ($query->num_rows() == 0) + { + return 0; + } + + $row = $query->row(); + return (int) $row->numrows; + } + + // -------------------------------------------------------------------- + + /** + * List table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @access private + * @param boolean + * @return string + */ + function _list_tables($prefix_limit = FALSE) + { + $sql = "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name"; + + // for future compatibility + if ($prefix_limit !== FALSE AND $this->dbprefix != '') + { + //$sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr); + return FALSE; // not currently supported + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * List column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @access private + * @param string the table name + * @return string + */ + function _list_columns($table = '') + { + return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$table."'"; + } + + // -------------------------------------------------------------------- + + /** + * Field data query + * + * Generates a platform-specific query so that the column data can be retrieved + * + * @access public + * @param string the table name + * @return object + */ + function _field_data($table) + { + return "SELECT TOP 1 * FROM ".$table; + } + + // -------------------------------------------------------------------- + + /** + * The error message string + * + * @access private + * @return string + */ + function _error_message() + { + return sqlsrv_errors(); + } + + // -------------------------------------------------------------------- + + /** + * The error message number + * + * @access private + * @return integer + */ + function _error_number() + { + // Are error numbers supported? + return ''; + } + + // -------------------------------------------------------------------- + + /** + * Escape the SQL Identifiers + * + * This function escapes column and table names + * + * @access private + * @param string + * @return string + */ + function _escape_identifiers($item) + { + if ($this->_escape_char == '') + { + return $item; + } + + foreach ($this->_reserved_identifiers as $id) + { + if (strpos($item, '.'.$id) !== FALSE) + { + $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); + + // remove duplicates if the user already included the escape + return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); + } + } + + if (strpos($item, '.') !== FALSE) + { + $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; + } + else + { + $str = $this->_escape_char.$item.$this->_escape_char; + } + + // remove duplicates if the user already included the escape + return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); + } + + // -------------------------------------------------------------------- + + /** + * From Tables + * + * This function implicitly groups FROM tables so there is no confusion + * about operator precedence in harmony with SQL standards + * + * @access public + * @param type + * @return type + */ + function _from_tables($tables) + { + if ( ! is_array($tables)) + { + $tables = array($tables); + } + + return implode(', ', $tables); + } + + // -------------------------------------------------------------------- + + /** + * Insert statement + * + * Generates a platform-specific insert string from the supplied data + * + * @access public + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string + */ + function _insert($table, $keys, $values) + { + return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; + } + + // -------------------------------------------------------------------- + + /** + * Update statement + * + * Generates a platform-specific update string from the supplied data + * + * @access public + * @param string the table name + * @param array the update data + * @param array the where clause + * @param array the orderby clause + * @param array the limit clause + * @return string + */ + function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + { + foreach ($values as $key => $val) + { + $valstr[] = $key." = ".$val; + } + + $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; + + $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; + + $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); + + $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; + + $sql .= $orderby.$limit; + + return $sql; + } + + + // -------------------------------------------------------------------- + + /** + * Truncate statement + * + * Generates a platform-specific truncate string from the supplied data + * If the database does not support the truncate() command + * This function maps to "DELETE FROM table" + * + * @access public + * @param string the table name + * @return string + */ + function _truncate($table) + { + return "TRUNCATE ".$table; + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @access public + * @param string the table name + * @param array the where clause + * @param string the limit clause + * @return string + */ + function _delete($table, $where = array(), $like = array(), $limit = FALSE) + { + $conditions = ''; + + if (count($where) > 0 OR count($like) > 0) + { + $conditions = "\nWHERE "; + $conditions .= implode("\n", $this->ar_where); + + if (count($where) > 0 && count($like) > 0) + { + $conditions .= " AND "; + } + $conditions .= implode("\n", $like); + } + + $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; + + return "DELETE FROM ".$table.$conditions.$limit; + } + + // -------------------------------------------------------------------- + + /** + * Limit string + * + * Generates a platform-specific LIMIT clause + * + * @access public + * @param string the sql query string + * @param integer the number of rows to limit the query to + * @param integer the offset value + * @return string + */ + function _limit($sql, $limit, $offset) + { + $i = $limit + $offset; + + return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.$i.' ', $sql); + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @access public + * @param resource + * @return void + */ + function _close($conn_id) + { + @sqlsrv_close($conn_id); + } + +} + + + +/* End of file mssql_driver.php */ +/* Location: ./system/database/drivers/mssql/mssql_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php new file mode 100644 index 000000000..70b20ecf8 --- /dev/null +++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php @@ -0,0 +1,248 @@ +db->_escape_identifiers($table); + } + + // -------------------------------------------------------------------- + + /** + * Create Table + * + * @access private + * @param string the table name + * @param array the fields + * @param mixed primary key(s) + * @param mixed key(s) + * @param boolean should 'IF NOT EXISTS' be added to the SQL + * @return bool + */ + function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + { + $sql = 'CREATE TABLE '; + + if ($if_not_exists === TRUE) + { + $sql .= 'IF NOT EXISTS '; + } + + $sql .= $this->db->_escape_identifiers($table)." ("; + $current_field_count = 0; + + foreach ($fields as $field=>$attributes) + { + // Numeric field names aren't allowed in databases, so if the key is + // numeric, we know it was assigned by PHP and the developer manually + // entered the field information, so we'll simply add it to the list + if (is_numeric($field)) + { + $sql .= "\n\t$attributes"; + } + else + { + $attributes = array_change_key_case($attributes, CASE_UPPER); + + $sql .= "\n\t".$this->db->_protect_identifiers($field); + + $sql .= ' '.$attributes['TYPE']; + + if (array_key_exists('CONSTRAINT', $attributes)) + { + $sql .= '('.$attributes['CONSTRAINT'].')'; + } + + if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE) + { + $sql .= ' UNSIGNED'; + } + + if (array_key_exists('DEFAULT', $attributes)) + { + $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\''; + } + + if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE) + { + $sql .= ' NULL'; + } + else + { + $sql .= ' NOT NULL'; + } + + if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE) + { + $sql .= ' AUTO_INCREMENT'; + } + } + + // don't add a comma on the end of the last field + if (++$current_field_count < count($fields)) + { + $sql .= ','; + } + } + + if (count($primary_keys) > 0) + { + $primary_keys = $this->db->_protect_identifiers($primary_keys); + $sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")"; + } + + if (is_array($keys) && count($keys) > 0) + { + foreach ($keys as $key) + { + if (is_array($key)) + { + $key = $this->db->_protect_identifiers($key); + } + else + { + $key = array($this->db->_protect_identifiers($key)); + } + + $sql .= ",\n\tFOREIGN KEY (" . implode(', ', $key) . ")"; + } + } + + $sql .= "\n)"; + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Alter table query + * + * Generates a platform-specific query so that a table can be altered + * Called by add_column(), drop_column(), and column_alter(), + * + * @access private + * @param string the ALTER type (ADD, DROP, CHANGE) + * @param string the column name + * @param string the table name + * @param string the column definition + * @param string the default value + * @param boolean should 'NOT NULL' be added + * @param string the field after which we should add the new field + * @return object + */ + function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + { + $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table)." $alter_type ".$this->db->_protect_identifiers($column_name); + + // DROP has everything it needs now. + if ($alter_type == 'DROP') + { + return $sql; + } + + $sql .= " $column_definition"; + + if ($default_value != '') + { + $sql .= " DEFAULT \"$default_value\""; + } + + if ($null === NULL) + { + $sql .= ' NULL'; + } + else + { + $sql .= ' NOT NULL'; + } + + if ($after_field != '') + { + $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); + } + + return $sql; + + } + + // -------------------------------------------------------------------- + + /** + * Rename a table + * + * Generates a platform-specific query so that a table can be renamed + * + * @access private + * @param string the old table name + * @param string the new table name + * @return string + */ + function _rename_table($table_name, $new_table_name) + { + // I think this syntax will work, but can find little documentation on renaming tables in MSSQL + $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table_name)." RENAME TO ".$this->db->_protect_identifiers($new_table_name); + return $sql; + } + +} + +/* End of file mssql_forge.php */ +/* Location: ./system/database/drivers/mssql/mssql_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlsrv/sqlsrv_result.php b/system/database/drivers/sqlsrv/sqlsrv_result.php new file mode 100644 index 000000000..2897ca5a5 --- /dev/null +++ b/system/database/drivers/sqlsrv/sqlsrv_result.php @@ -0,0 +1,169 @@ +result_id); + } + + // -------------------------------------------------------------------- + + /** + * Number of fields in the result set + * + * @access public + * @return integer + */ + function num_fields() + { + return @mssql_num_fields($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * Generates an array of column names + * + * @access public + * @return array + */ + function list_fields() + { + $field_names = array(); + while ($field = mssql_fetch_field($this->result_id)) + { + $field_names[] = $field->name; + } + + return $field_names; + } + + // -------------------------------------------------------------------- + + /** + * Field data + * + * Generates an array of objects containing field meta-data + * + * @access public + * @return array + */ + function field_data() + { + $retval = array(); + while ($field = mssql_fetch_field($this->result_id)) + { + $F = new stdClass(); + $F->name = $field->name; + $F->type = $field->type; + $F->max_length = $field->max_length; + $F->primary_key = 0; + $F->default = ''; + + $retval[] = $F; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Free the result + * + * @return null + */ + function free_result() + { + if (is_resource($this->result_id)) + { + mssql_free_result($this->result_id); + $this->result_id = FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Data Seek + * + * Moves the internal pointer to the desired offset. We call + * this internally before fetching results to make sure the + * result set starts at zero + * + * @access private + * @return array + */ + function _data_seek($n = 0) + { + return mssql_data_seek($this->result_id, $n); + } + + // -------------------------------------------------------------------- + + /** + * Result - associative array + * + * Returns the result set as an array + * + * @access private + * @return array + */ + function _fetch_assoc() + { + return mssql_fetch_assoc($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Result - object + * + * Returns the result set as an object + * + * @access private + * @return object + */ + function _fetch_object() + { + return mssql_fetch_object($this->result_id); + } + +} + + +/* End of file mssql_result.php */ +/* Location: ./system/database/drivers/mssql/mssql_result.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlsrv/sqlsrv_utility.php b/system/database/drivers/sqlsrv/sqlsrv_utility.php new file mode 100644 index 000000000..48ecbc72a --- /dev/null +++ b/system/database/drivers/sqlsrv/sqlsrv_utility.php @@ -0,0 +1,88 @@ +db->display_error('db_unsuported_feature'); + } + +} + +/* End of file mssql_utility.php */ +/* Location: ./system/database/drivers/mssql/mssql_utility.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 079069c2fa70b142fb4313f12f1fdf3f11713ff5 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Thu, 10 Mar 2011 19:36:58 +0000 Subject: Think I've finished converting mssql commands to sqlsrv where appropriate --- system/database/drivers/sqlsrv/sqlsrv_driver.php | 4 +--- system/database/drivers/sqlsrv/sqlsrv_result.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'system') diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index d64e98108..53d974837 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -107,9 +107,7 @@ class CI_DB_mssql_driver extends CI_DB { */ function db_select() { - // Note: The brackets are required in the event that the DB name - // contains reserved characters - return @mssql_select_db('['.$this->database.']', $this->conn_id); + // not implemented in sqlsrv } // -------------------------------------------------------------------- diff --git a/system/database/drivers/sqlsrv/sqlsrv_result.php b/system/database/drivers/sqlsrv/sqlsrv_result.php index 2897ca5a5..058c6f478 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_result.php +++ b/system/database/drivers/sqlsrv/sqlsrv_result.php @@ -34,7 +34,7 @@ class CI_DB_mssql_result extends CI_DB_result { */ function num_rows() { - return @mssql_num_rows($this->result_id); + return @sqlsrv_num_rows($this->result_id); } // -------------------------------------------------------------------- @@ -47,7 +47,7 @@ class CI_DB_mssql_result extends CI_DB_result { */ function num_fields() { - return @mssql_num_fields($this->result_id); + return @sqlsrv_num_fields($this->result_id); } // -------------------------------------------------------------------- @@ -63,7 +63,7 @@ class CI_DB_mssql_result extends CI_DB_result { function list_fields() { $field_names = array(); - while ($field = mssql_fetch_field($this->result_id)) + while ($field = sqlsrv_get_field($this->result_id)) { $field_names[] = $field->name; } @@ -84,7 +84,7 @@ class CI_DB_mssql_result extends CI_DB_result { function field_data() { $retval = array(); - while ($field = mssql_fetch_field($this->result_id)) + while ($field = sqlsrv_get_field($this->result_id)) { $F = new stdClass(); $F->name = $field->name; @@ -110,7 +110,7 @@ class CI_DB_mssql_result extends CI_DB_result { { if (is_resource($this->result_id)) { - mssql_free_result($this->result_id); + sqlsrv_free_stmt($this->result_id); $this->result_id = FALSE; } } @@ -129,7 +129,7 @@ class CI_DB_mssql_result extends CI_DB_result { */ function _data_seek($n = 0) { - return mssql_data_seek($this->result_id, $n); + // Not implemented } // -------------------------------------------------------------------- @@ -144,7 +144,7 @@ class CI_DB_mssql_result extends CI_DB_result { */ function _fetch_assoc() { - return mssql_fetch_assoc($this->result_id); + return sqlsrv_fetch_array($this->result_id, SQLSRV_FETCH_ASSOC); } // -------------------------------------------------------------------- @@ -159,7 +159,7 @@ class CI_DB_mssql_result extends CI_DB_result { */ function _fetch_object() { - return mssql_fetch_object($this->result_id); + return sqlsrv_fetch_object($this->result_id); } } -- cgit v1.2.3-24-g4f1b From 5336ee283c764a8f3ef9baa746324d7f6a26499f Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 12 Mar 2011 23:35:29 +0000 Subject: Added flag to return dates as strings instead of PHP date objects. Updated db_select --- system/database/drivers/sqlsrv/sqlsrv_driver.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system') diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index 53d974837..25cc628df 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -60,7 +60,7 @@ class CI_DB_mssql_driver extends CI_DB { $this->hostname .= ','.$this->port; } - return @sqlsrv_connect($this->hostname, array('UID' => $this->username, 'PWD' => $this->password, 'Database' => $this->database, 'ConnectionPooling' => 0)); + return @sqlsrv_connect($this->hostname, array('UID' => $this->username, 'PWD' => $this->password, 'Database' => $this->database, 'ConnectionPooling' => 0, 'ReturnDatesAsStrings' => 1)); } // -------------------------------------------------------------------- @@ -78,7 +78,7 @@ class CI_DB_mssql_driver extends CI_DB { $this->hostname .= ','.$this->port; } - return @sqlsrv_connect($this->hostname, array('UID' => $this->username, 'PWD' => $this->password, 'Database' => $this->database, 'ConnectionPooling' => 1)); + return @sqlsrv_connect($this->hostname, array('UID' => $this->username, 'PWD' => $this->password, 'Database' => $this->database, 'ConnectionPooling' => 1, 'ReturnDatesAsStrings' => 1)); } // -------------------------------------------------------------------- @@ -107,7 +107,7 @@ class CI_DB_mssql_driver extends CI_DB { */ function db_select() { - // not implemented in sqlsrv + return $this->_execute('USE ' . $this->database); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 56e204079b8b3951abca5165ca815b75d37bf03d Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 12 Mar 2011 23:43:54 +0000 Subject: Updated affected_rows --- system/database/drivers/sqlsrv/sqlsrv_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index 25cc628df..e9c391786 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -283,7 +283,7 @@ class CI_DB_mssql_driver extends CI_DB { */ function affected_rows() { - return @mssql_rows_affected($this->conn_id); + return @sqlrv_rows_affected($this->conn_id); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 01ab00469c80a26c22c61f896f0514dfcedccb67 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Fri, 18 Mar 2011 19:24:30 +0000 Subject: Renamed some classes in the driver --- system/database/drivers/sqlsrv/sqlsrv_driver.php | 4 ++-- system/database/drivers/sqlsrv/sqlsrv_forge.php | 4 ++-- system/database/drivers/sqlsrv/sqlsrv_result.php | 4 ++-- system/database/drivers/sqlsrv/sqlsrv_utility.php | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'system') diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index e9c391786..116907123 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -16,7 +16,7 @@ // ------------------------------------------------------------------------ /** - * MS SQL Database Adapter Class + * SQLSRV Database Adapter Class * * Note: _DB is an extender class that the app controller * creates dynamically based on whether the active record @@ -28,7 +28,7 @@ * @author ExpressionEngine Dev Team * @link http://codeigniter.com/user_guide/database/ */ -class CI_DB_mssql_driver extends CI_DB { +class CI_DB_sqlsrv_driver extends CI_DB { var $dbdriver = 'sqlsrv'; diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php index 70b20ecf8..cc88ec5ca 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_forge.php +++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php @@ -16,13 +16,13 @@ // ------------------------------------------------------------------------ /** - * MS SQL Forge Class + * SQLSRV Forge Class * * @category Database * @author ExpressionEngine Dev Team * @link http://codeigniter.com/user_guide/database/ */ -class CI_DB_mssql_forge extends CI_DB_forge { +class CI_DB_sqlsrv_forge extends CI_DB_forge { /** * Create database diff --git a/system/database/drivers/sqlsrv/sqlsrv_result.php b/system/database/drivers/sqlsrv/sqlsrv_result.php index 058c6f478..458200383 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_result.php +++ b/system/database/drivers/sqlsrv/sqlsrv_result.php @@ -16,7 +16,7 @@ // ------------------------------------------------------------------------ /** - * MS SQL Result Class + * SQLSRV Result Class * * This class extends the parent result class: CI_DB_result * @@ -24,7 +24,7 @@ * @author ExpressionEngine Dev Team * @link http://codeigniter.com/user_guide/database/ */ -class CI_DB_mssql_result extends CI_DB_result { +class CI_DB_sqlsrv_result extends CI_DB_result { /** * Number of rows in the result set diff --git a/system/database/drivers/sqlsrv/sqlsrv_utility.php b/system/database/drivers/sqlsrv/sqlsrv_utility.php index 48ecbc72a..13a1850c4 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_utility.php +++ b/system/database/drivers/sqlsrv/sqlsrv_utility.php @@ -16,13 +16,13 @@ // ------------------------------------------------------------------------ /** - * MS SQL Utility Class + * SQLSRV Utility Class * * @category Database * @author ExpressionEngine Dev Team * @link http://codeigniter.com/user_guide/database/ */ -class CI_DB_mssql_utility extends CI_DB_utility { +class CI_DB_sqlsrv_utility extends CI_DB_utility { /** * List databases -- cgit v1.2.3-24-g4f1b From 3a43c7adae7737d68a0eeca663cc2dd3fc5b0cf3 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Fri, 18 Mar 2011 19:48:04 +0000 Subject: Updates --- system/database/drivers/sqlsrv/sqlsrv_driver.php | 206 ++++++++--------------- system/database/drivers/sqlsrv/sqlsrv_result.php | 20 +-- 2 files changed, 81 insertions(+), 145 deletions(-) (limited to 'system') diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index 116907123..1d32792ce 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -53,14 +53,27 @@ class CI_DB_sqlsrv_driver extends CI_DB { * @access private called by the base class * @return resource */ - function db_connect() + function db_connect($pooling = false) { - if ($this->port != '') - { - $this->hostname .= ','.$this->port; + // Check for a UTF-8 charset being passed as CI's default 'utf8'. + $character_set = (0 === strcasecmp('utf8', $this->char_set)) ? 'UTF-8' : $this->char_set; + + $connection = array( + 'UID' => empty($this->username) ? '' : $this->username, + 'PWD' => empty($this->password) ? '' : $this->password, + 'Database' => $this->database, + 'ConnectionPooling' => $pooling ? 1 : 0, + 'CharacterSet' => $character_set, + 'ReturnDatesAsStrings' => 1 + ); + + // If the username and password are both empty, assume this is a + // 'Windows Authentication Mode' connection. + if(empty($connection['UID']) && empty($connection['PWD'])) { + unset($connection['UID'], $connection['PWD']); } - return @sqlsrv_connect($this->hostname, array('UID' => $this->username, 'PWD' => $this->password, 'Database' => $this->database, 'ConnectionPooling' => 0, 'ReturnDatesAsStrings' => 1)); + return sqlsrv_connect($this->hostname, $connection); } // -------------------------------------------------------------------- @@ -73,12 +86,7 @@ class CI_DB_sqlsrv_driver extends CI_DB { */ function db_pconnect() { - if ($this->port != '') - { - $this->hostname .= ','.$this->port; - } - - return @sqlsrv_connect($this->hostname, array('UID' => $this->username, 'PWD' => $this->password, 'Database' => $this->database, 'ConnectionPooling' => 1, 'ReturnDatesAsStrings' => 1)); + $this->db_connect(TRUE); } // -------------------------------------------------------------------- @@ -138,7 +146,10 @@ class CI_DB_sqlsrv_driver extends CI_DB { function _execute($sql) { $sql = $this->_prep_query($sql); - return @sqlsrv_query($this->conn_id, $sql); + return sqlsrv_query($this->conn_id, $sql, null, array( + 'Scrollable' => SQLSRV_CURSOR_STATIC, + 'SendStreamParamsAtExec' => true + )); } // -------------------------------------------------------------------- @@ -183,8 +194,7 @@ class CI_DB_sqlsrv_driver extends CI_DB { // even if the queries produce a successful result. $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; - $this->simple_query('BEGIN TRAN'); - return TRUE; + return sqlsrv_begin_transaction($this->conn_id); } // -------------------------------------------------------------------- @@ -208,8 +218,7 @@ class CI_DB_sqlsrv_driver extends CI_DB { return TRUE; } - $this->simple_query('COMMIT TRAN'); - return TRUE; + return sqlsrv_commit($this->conn_id); } // -------------------------------------------------------------------- @@ -233,8 +242,7 @@ class CI_DB_sqlsrv_driver extends CI_DB { return TRUE; } - $this->simple_query('ROLLBACK TRAN'); - return TRUE; + return sqlsrv_rollback($this->conn_id); } // -------------------------------------------------------------------- @@ -249,28 +257,8 @@ class CI_DB_sqlsrv_driver extends CI_DB { */ function escape_str($str, $like = FALSE) { - if (is_array($str)) - { - foreach ($str as $key => $val) - { - $str[$key] = $this->escape_str($val, $like); - } - - return $str; - } - // Escape single quotes - $str = str_replace("'", "''", remove_invisible_characters($str)); - - // escape LIKE condition wildcards - if ($like === TRUE) - { - $str = str_replace( array('%', '_', $this->_like_escape_chr), - array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), - $str); - } - - return $str; + return str_replace("'", "''", $str); } // -------------------------------------------------------------------- @@ -298,11 +286,7 @@ class CI_DB_sqlsrv_driver extends CI_DB { */ function insert_id() { - $ver = self::_parse_major_version($this->version()); - $sql = ($ver >= 8 ? "SELECT SCOPE_IDENTITY() AS last_id" : "SELECT @@IDENTITY AS last_id"); - $query = $this->query($sql); - $row = $query->row(); - return $row->last_id; + return $this->query('select @@IDENTITY as insert_id')->row('insert_id'); } // -------------------------------------------------------------------- @@ -333,7 +317,8 @@ class CI_DB_sqlsrv_driver extends CI_DB { */ function _version() { - return "SELECT @@VERSION AS ver"; + $info = sqlsrv_server_info($this->conn_id); + return sprintf("select '%s' as ver", $info['SQLServerVersion']); } // -------------------------------------------------------------------- @@ -351,19 +336,15 @@ class CI_DB_sqlsrv_driver extends CI_DB { function count_all($table = '') { if ($table == '') - { - return 0; - } - - $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); - + return '0'; + + $query = $this->query("SELECT COUNT(*) AS numrows FROM " . $this->dbprefix . $table); + if ($query->num_rows() == 0) - { - return 0; - } + return '0'; $row = $query->row(); - return (int) $row->numrows; + return $row->numrows; } // -------------------------------------------------------------------- @@ -379,16 +360,7 @@ class CI_DB_sqlsrv_driver extends CI_DB { */ function _list_tables($prefix_limit = FALSE) { - $sql = "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name"; - - // for future compatibility - if ($prefix_limit !== FALSE AND $this->dbprefix != '') - { - //$sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr); - return FALSE; // not currently supported - } - - return $sql; + return "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name"; } // -------------------------------------------------------------------- @@ -404,7 +376,7 @@ class CI_DB_sqlsrv_driver extends CI_DB { */ function _list_columns($table = '') { - return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$table."'"; + return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$this->_escape_table($table)."'"; } // -------------------------------------------------------------------- @@ -420,7 +392,7 @@ class CI_DB_sqlsrv_driver extends CI_DB { */ function _field_data($table) { - return "SELECT TOP 1 * FROM ".$table; + return "SELECT TOP 1 * FROM " . $this->_escape_table($table); } // -------------------------------------------------------------------- @@ -433,7 +405,8 @@ class CI_DB_sqlsrv_driver extends CI_DB { */ function _error_message() { - return sqlsrv_errors(); + $error = array_shift(sqlsrv_errors()); + return !empty($error['message']) ? $error['message'] : null; } // -------------------------------------------------------------------- @@ -446,12 +419,28 @@ class CI_DB_sqlsrv_driver extends CI_DB { */ function _error_number() { - // Are error numbers supported? - return ''; + $error = array_shift(sqlsrv_errors()); + return isset($error['SQLSTATE']) ? $error['SQLSTATE'] : null; } // -------------------------------------------------------------------- + /** + * Escape Table Name + * + * This function adds backticks if the table name has a period + * in it. Some DBs will get cranky unless periods are escaped + * + * @access private + * @param string the table name + * @return string + */ + function _escape_table($table) + { + return $table; + } + + /** * Escape the SQL Identifiers * @@ -463,33 +452,7 @@ class CI_DB_sqlsrv_driver extends CI_DB { */ function _escape_identifiers($item) { - if ($this->_escape_char == '') - { - return $item; - } - - foreach ($this->_reserved_identifiers as $id) - { - if (strpos($item, '.'.$id) !== FALSE) - { - $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); - - // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); - } - } - - if (strpos($item, '.') !== FALSE) - { - $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; - } - else - { - $str = $this->_escape_char.$item.$this->_escape_char; - } - - // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); + return $item; } // -------------------------------------------------------------------- @@ -528,8 +491,8 @@ class CI_DB_sqlsrv_driver extends CI_DB { * @return string */ function _insert($table, $keys, $values) - { - return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; + { + return "INSERT INTO ".$this->_escape_table($table)." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } // -------------------------------------------------------------------- @@ -547,27 +510,16 @@ class CI_DB_sqlsrv_driver extends CI_DB { * @param array the limit clause * @return string */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + function _update($table, $values, $where) { - foreach ($values as $key => $val) + foreach($values as $key => $val) { $valstr[] = $key." = ".$val; } - - $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - - $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; - - $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); - - $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; - - $sql .= $orderby.$limit; - - return $sql; + + return "UPDATE ".$this->_escape_table($table)." SET ".implode(', ', $valstr)." WHERE ".implode(" ", $where); } - - + // -------------------------------------------------------------------- /** @@ -599,25 +551,9 @@ class CI_DB_sqlsrv_driver extends CI_DB { * @param string the limit clause * @return string */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) + function _delete($table, $where) { - $conditions = ''; - - if (count($where) > 0 OR count($like) > 0) - { - $conditions = "\nWHERE "; - $conditions .= implode("\n", $this->ar_where); - - if (count($where) > 0 && count($like) > 0) - { - $conditions .= " AND "; - } - $conditions .= implode("\n", $like); - } - - $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - - return "DELETE FROM ".$table.$conditions.$limit; + return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where); } // -------------------------------------------------------------------- @@ -636,8 +572,8 @@ class CI_DB_sqlsrv_driver extends CI_DB { function _limit($sql, $limit, $offset) { $i = $limit + $offset; - - return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.$i.' ', $sql); + + return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.$i.' ', $sql); } // -------------------------------------------------------------------- diff --git a/system/database/drivers/sqlsrv/sqlsrv_result.php b/system/database/drivers/sqlsrv/sqlsrv_result.php index 458200383..bf0abd1c6 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_result.php +++ b/system/database/drivers/sqlsrv/sqlsrv_result.php @@ -63,11 +63,11 @@ class CI_DB_sqlsrv_result extends CI_DB_result { function list_fields() { $field_names = array(); - while ($field = sqlsrv_get_field($this->result_id)) + foreach(sqlsrv_field_metadata($this->result_id) as $offset => $field) { - $field_names[] = $field->name; + $field_names[] = $field['Name']; } - + return $field_names; } @@ -84,18 +84,18 @@ class CI_DB_sqlsrv_result extends CI_DB_result { function field_data() { $retval = array(); - while ($field = sqlsrv_get_field($this->result_id)) + foreach(sqlsrv_field_metadata($this->result_id) as $offset => $field) { - $F = new stdClass(); - $F->name = $field->name; - $F->type = $field->type; - $F->max_length = $field->max_length; + $F = new stdClass(); + $F->name = $field['Name']; + $F->type = $field['Type']; + $F->max_length = $field['Size']; $F->primary_key = 0; $F->default = ''; - + $retval[] = $F; } - + return $retval; } -- cgit v1.2.3-24-g4f1b From 1f6f0abf0d17046a99fd9c9b3c60fb459b4531b1 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Thu, 7 Apr 2011 18:24:53 -0500 Subject: Fixing a bug in the form_helper where csrf_token_name and csrf_hash were referencing class properties in the Security class that were moved. --- system/helpers/form_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 8aa788c6c..acd75c239 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -67,7 +67,7 @@ if ( ! function_exists('form_open')) // CSRF if ($CI->config->item('csrf_protection') === TRUE) { - $hidden[$CI->security->csrf_token_name] = $CI->security->csrf_hash; + $hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash(); } if (is_array($hidden) AND count($hidden) > 0) -- cgit v1.2.3-24-g4f1b From bfbcf74c94a47c643420efaa342cc525bce2ad2c Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Thu, 7 Apr 2011 18:33:29 -0500 Subject: Fix: #192 CI version constant incorrect in core/CodeIgniter --- system/core/CodeIgniter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index f3e1439ff..e022e1b46 100644 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -32,7 +32,7 @@ * Define the CodeIgniter Version * ------------------------------------------------------ */ - define('CI_VERSION', '2.0.1'); + define('CI_VERSION', '2.0.2'); /* * ------------------------------------------------------ -- cgit v1.2.3-24-g4f1b From 48bac74ea9fcb8eecdf97597647f1ed492d97b43 Mon Sep 17 00:00:00 2001 From: patwork Date: Fri, 8 Apr 2011 13:46:47 +0200 Subject: Fix: codeigniter-reactor/193 incorrect driver filepaths --- system/libraries/Driver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index d1838f2c1..b942f539f 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -45,7 +45,7 @@ class CI_Driver_Library { $child_class = $this->lib_name.'_'.$child; // Remove the CI_ prefix and lowercase - $lib_name = strtolower(preg_replace('/^CI_/', '', $this->lib_name)); + $lib_name = ucfirst(strtolower(preg_replace('/^CI_/', '', $this->lib_name))); $driver_name = strtolower(preg_replace('/^CI_/', '', $child_class)); if (in_array($driver_name, array_map('strtolower', $this->valid_drivers))) @@ -226,4 +226,4 @@ class CI_Driver { // END CI_Driver CLASS /* End of file Driver.php */ -/* Location: ./system/libraries/Driver.php */ \ No newline at end of file +/* Location: ./system/libraries/Driver.php */ -- cgit v1.2.3-24-g4f1b From b07079827b084213463bdf576894faab172213f2 Mon Sep 17 00:00:00 2001 From: patwork Date: Fri, 8 Apr 2011 15:10:05 +0200 Subject: Deals with language errors after codeigniter-reactor commit r2307:c43c6dea56fb --- system/libraries/Email.php | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'system') diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 6c21f114d..cd89f8f3d 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -722,7 +722,7 @@ class CI_Email { { if ( ! is_array($email)) { - $this->_set_error_message('email_must_be_array'); + $this->_set_error_message('lang:email_must_be_array'); return FALSE; } @@ -730,7 +730,7 @@ class CI_Email { { if ( ! $this->valid_email($val)) { - $this->_set_error_message('email_invalid_address', $val); + $this->_set_error_message('lang:email_invalid_address', $val); return FALSE; } } @@ -1131,7 +1131,7 @@ class CI_Email { if ( ! file_exists($filename)) { - $this->_set_error_message('email_attachment_missing', $filename); + $this->_set_error_message('lang:email_attachment_missing', $filename); return FALSE; } @@ -1146,7 +1146,7 @@ class CI_Email { if ( ! $fp = fopen($filename, FOPEN_READ)) { - $this->_set_error_message('email_attachment_unreadable', $filename); + $this->_set_error_message('lang:email_attachment_unreadable', $filename); return FALSE; } @@ -1353,7 +1353,7 @@ class CI_Email { ( ! isset($this->_bcc_array) AND ! isset($this->_headers['Bcc'])) AND ( ! isset($this->_headers['Cc']))) { - $this->_set_error_message('email_no_recipients'); + $this->_set_error_message('lang:email_no_recipients'); return FALSE; } @@ -1484,7 +1484,7 @@ class CI_Email { if ( ! $this->_send_with_mail()) { - $this->_set_error_message('email_send_failure_phpmail'); + $this->_set_error_message('lang:email_send_failure_phpmail'); return FALSE; } break; @@ -1492,7 +1492,7 @@ class CI_Email { if ( ! $this->_send_with_sendmail()) { - $this->_set_error_message('email_send_failure_sendmail'); + $this->_set_error_message('lang:email_send_failure_sendmail'); return FALSE; } break; @@ -1500,14 +1500,14 @@ class CI_Email { if ( ! $this->_send_with_smtp()) { - $this->_set_error_message('email_send_failure_smtp'); + $this->_set_error_message('lang:email_send_failure_smtp'); return FALSE; } break; } - $this->_set_error_message('email_sent', $this->_get_protocol()); + $this->_set_error_message('lang:email_sent', $this->_get_protocol()); return TRUE; } @@ -1578,8 +1578,8 @@ class CI_Email { if ($status != 0) { - $this->_set_error_message('email_exit_status', $status); - $this->_set_error_message('email_no_socket'); + $this->_set_error_message('lang:email_exit_status', $status); + $this->_set_error_message('lang:email_no_socket'); return FALSE; } @@ -1598,7 +1598,7 @@ class CI_Email { { if ($this->smtp_host == '') { - $this->_set_error_message('email_no_hostname'); + $this->_set_error_message('lang:email_no_hostname'); return FALSE; } @@ -1647,7 +1647,7 @@ class CI_Email { if (strncmp($reply, '250', 3) != 0) { - $this->_set_error_message('email_smtp_error', $reply); + $this->_set_error_message('lang:email_smtp_error', $reply); return FALSE; } @@ -1674,7 +1674,7 @@ class CI_Email { if ( ! is_resource($this->_smtp_connect)) { - $this->_set_error_message('email_smtp_error', $errno." ".$errstr); + $this->_set_error_message('lang:email_smtp_error', $errno." ".$errstr); return FALSE; } @@ -1737,7 +1737,7 @@ class CI_Email { if (substr($reply, 0, 3) != $resp) { - $this->_set_error_message('email_smtp_error', $reply); + $this->_set_error_message('lang:email_smtp_error', $reply); return FALSE; } @@ -1766,7 +1766,7 @@ class CI_Email { if ($this->smtp_user == "" AND $this->smtp_pass == "") { - $this->_set_error_message('email_no_smtp_unpw'); + $this->_set_error_message('lang:email_no_smtp_unpw'); return FALSE; } @@ -1776,7 +1776,7 @@ class CI_Email { if (strncmp($reply, '334', 3) != 0) { - $this->_set_error_message('email_failed_smtp_login', $reply); + $this->_set_error_message('lang:email_failed_smtp_login', $reply); return FALSE; } @@ -1786,7 +1786,7 @@ class CI_Email { if (strncmp($reply, '334', 3) != 0) { - $this->_set_error_message('email_smtp_auth_un', $reply); + $this->_set_error_message('lang:email_smtp_auth_un', $reply); return FALSE; } @@ -1796,7 +1796,7 @@ class CI_Email { if (strncmp($reply, '235', 3) != 0) { - $this->_set_error_message('email_smtp_auth_pw', $reply); + $this->_set_error_message('lang:email_smtp_auth_pw', $reply); return FALSE; } @@ -1815,7 +1815,7 @@ class CI_Email { { if ( ! fwrite($this->_smtp_connect, $data . $this->newline)) { - $this->_set_error_message('email_smtp_data_failure', $data); + $this->_set_error_message('lang:email_smtp_data_failure', $data); return FALSE; } else @@ -1942,7 +1942,7 @@ class CI_Email { $CI =& get_instance(); $CI->lang->load('email'); - if (FALSE === ($line = $CI->lang->line($msg))) + if (substr($msg, 0, 5) != 'lang:' || FALSE === ($line = $CI->lang->line(substr($msg, 5)))) { $this->_debug_msg[] = str_replace('%s', $val, $msg)."
"; } @@ -2059,4 +2059,4 @@ class CI_Email { // END CI_Email class /* End of file Email.php */ -/* Location: ./system/libraries/Email.php */ \ No newline at end of file +/* Location: ./system/libraries/Email.php */ -- cgit v1.2.3-24-g4f1b From 64e35cdcb9fd24787798c0f6ca3c0af45b0b904d Mon Sep 17 00:00:00 2001 From: patwork Date: Fri, 8 Apr 2011 15:25:31 +0200 Subject: There is absolutely no need to specify class name (it will validate anyway). --- system/helpers/form_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index acd75c239..bca0ff0c9 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -72,7 +72,7 @@ if ( ! function_exists('form_open')) if (is_array($hidden) AND count($hidden) > 0) { - $form .= sprintf("\n
%s
", form_hidden($hidden)); + $form .= sprintf("\n
%s
", form_hidden($hidden)); } return $form; @@ -1053,4 +1053,4 @@ if ( ! function_exists('_get_validation_object')) /* End of file form_helper.php */ -/* Location: ./system/helpers/form_helper.php */ \ No newline at end of file +/* Location: ./system/helpers/form_helper.php */ -- cgit v1.2.3-24-g4f1b From 02404a1f59e4f3ae8231d87d8be5b23488ea86d2 Mon Sep 17 00:00:00 2001 From: patwork Date: Fri, 8 Apr 2011 15:45:46 +0200 Subject: Fix: codeigniter-reactor/127 Form_validation rule error logging --- system/libraries/Form_validation.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'system') diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index cfc02eda9..6f79a554a 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -628,6 +628,10 @@ class CI_Form_validation { $this->_field_data[$row['field']]['postdata'] = (is_bool($result)) ? $postdata : $result; } } + else + { + log_message('debug', "Unable to find validation rule: ".$rule); + } continue; } @@ -1357,4 +1361,4 @@ class CI_Form_validation { // END Form Validation Class /* End of file Form_validation.php */ -/* Location: ./system/libraries/Form_validation.php */ \ No newline at end of file +/* Location: ./system/libraries/Form_validation.php */ -- cgit v1.2.3-24-g4f1b From ef1a55ad2875af3b2286a5b6eb9b65e997949f4d Mon Sep 17 00:00:00 2001 From: patwork Date: Sat, 9 Apr 2011 13:04:06 +0200 Subject: Fix: codeigniter-reactor/199 CSRF config in Security class is no longer ignored --- system/core/Security.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'system') diff --git a/system/core/Security.php b/system/core/Security.php index ceef9779c..73a3cfb31 100644 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -58,6 +58,15 @@ class CI_Security { */ public function __construct() { + // CSRF config + foreach(array('csrf_expire', 'csrf_token_name', 'csrf_cookie_name') as $key) + { + if (FALSE !== ($val = config_item($key))) + { + $this->{'_'.$key} = $val; + } + } + // Append application specific cookie prefix to token name $this->_csrf_cookie_name = (config_item('cookie_prefix')) ? config_item('cookie_prefix').$this->_csrf_token_name : $this->_csrf_token_name; @@ -817,4 +826,4 @@ class CI_Security { // END Security Class /* End of file Security.php */ -/* Location: ./system/libraries/Security.php */ \ No newline at end of file +/* Location: ./system/libraries/Security.php */ -- cgit v1.2.3-24-g4f1b From 571023b24f705d9c0bbaecf2e3cbbc06752390b4 Mon Sep 17 00:00:00 2001 From: patwork Date: Mon, 11 Apr 2011 11:56:41 +0200 Subject: Fix: codeigniter-reactor/32 unicorns are no longer mute --- system/core/Lang.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'system') diff --git a/system/core/Lang.php b/system/core/Lang.php index 0b926a303..cdadc7f41 100644 --- a/system/core/Lang.php +++ b/system/core/Lang.php @@ -129,19 +129,19 @@ class CI_Lang { */ function line($line = '') { - $line = ($line == '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line]; + $value = ($line == '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line]; // Because killer robots like unicorns! - if ($line === FALSE) + if ($value === FALSE) { log_message('error', 'Could not find the language line "'.$line.'"'); } - return $line; + return $value; } } // END Language Class /* End of file Lang.php */ -/* Location: ./system/core/Lang.php */ \ No newline at end of file +/* Location: ./system/core/Lang.php */ -- cgit v1.2.3-24-g4f1b From 9e2679849611ce050f5636c44b6c3279328d00f9 Mon Sep 17 00:00:00 2001 From: patwork Date: Mon, 11 Apr 2011 13:02:32 +0200 Subject: Fix: codeigniter-reactor/199 cookie name was overwritten with token name --- system/core/Security.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/core/Security.php b/system/core/Security.php index 73a3cfb31..4f91572ed 100644 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -67,8 +67,10 @@ class CI_Security { } } - // Append application specific cookie prefix to token name - $this->_csrf_cookie_name = (config_item('cookie_prefix')) ? config_item('cookie_prefix').$this->_csrf_token_name : $this->_csrf_token_name; + // Append application specific cookie prefix + if (config_item('cookie_prefix')) { + $this->_csrf_cookie_name = config_item('cookie_prefix').$this->_csrf_cookie_name; + } // Set the CSRF hash $this->_csrf_set_hash(); -- cgit v1.2.3-24-g4f1b From e70e92bab1de57a0749a31f2889b55cafb46d58e Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Mon, 25 Apr 2011 10:50:53 -0500 Subject: Fixing up a tabs vs spaces inconsistency in DB_Result --- system/database/DB_result.php | 83 +++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 39 deletions(-) (limited to 'system') diff --git a/system/database/DB_result.php b/system/database/DB_result.php index 06eec5124..e83228386 100644 --- a/system/database/DB_result.php +++ b/system/database/DB_result.php @@ -32,7 +32,7 @@ class CI_DB_result { var $result_id = NULL; var $result_array = array(); var $result_object = array(); - var $custom_result_object = array(); + var $custom_result_object = array(); var $current_row = 0; var $num_rows = 0; var $row_data = NULL; @@ -47,47 +47,52 @@ class CI_DB_result { */ function result($type = 'object') { - if ($type == 'array') return $this->result_array(); - else if ($type == 'object') return $this->result_object(); - else return $this->custom_result_object($type); + if ($type == 'array') return $this->result_array(); + else if ($type == 'object') return $this->result_object(); + else return $this->custom_result_object($type); } // -------------------------------------------------------------------- - /** - * Custom query result. - * - * @param class_name A string that represents the type of object you want back - * @return array of objects - */ - function custom_result_object($class_name) - { - if (array_key_exists($class_name, $this->custom_result_object)) - { - return $this->custom_result_object[$class_name]; - } - - if ($this->result_id === FALSE OR $this->num_rows() == 0) - { - return array(); - } - - // add the data to the object - $this->_data_seek(0); - $result_object = array(); + /** + * Custom query result. + * + * @param class_name A string that represents the type of object you want back + * @return array of objects + */ + function custom_result_object($class_name) + { + if (array_key_exists($class_name, $this->custom_result_object)) + { + return $this->custom_result_object[$class_name]; + } + + if ($this->result_id === FALSE OR $this->num_rows() == 0) + { + return array(); + } + + // add the data to the object + $this->_data_seek(0); + $result_object = array(); + while ($row = $this->_fetch_object()) - { - $object = new $class_name(); - foreach ($row as $key => $value) - { - $object->$key = $value; - } + { + $object = new $class_name(); + + foreach ($row as $key => $value) + { + $object->$key = $value; + } + $result_object[] = $object; } - // return the array - return $this->custom_result_object[$class_name] = $result_object; - } + // return the array + return $this->custom_result_object[$class_name] = $result_object; + } + + // -------------------------------------------------------------------- /** * Query result. "object" version. @@ -180,9 +185,9 @@ class CI_DB_result { $n = 0; } - if ($type == 'object') return $this->row_object($n); - else if ($type == 'array') return $this->row_array($n); - else return $this->custom_row_object($n, $type); + if ($type == 'object') return $this->row_object($n); + else if ($type == 'array') return $this->row_array($n); + else return $this->custom_row_object($n, $type); } // -------------------------------------------------------------------- @@ -219,7 +224,7 @@ class CI_DB_result { // -------------------------------------------------------------------- - /** + /** * Returns a single result row - custom object version * * @access public @@ -242,7 +247,7 @@ class CI_DB_result { return $result[$this->current_row]; } - /** + /** * Returns a single result row - object version * * @access public -- cgit v1.2.3-24-g4f1b From 26eebddda5438c3967bad74a05c3e990528e1182 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sun, 17 Apr 2011 23:45:41 -0400 Subject: Changed server check to ensure SCRIPT_NAME is defined. Fixes #57 --- system/core/URI.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'system') diff --git a/system/core/URI.php b/system/core/URI.php index 80dc62e58..d56548654 100644 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -120,7 +120,7 @@ class CI_URI { $path = (isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri); $this->_set_uri_string($path); } - + // -------------------------------------------------------------------- /** @@ -133,7 +133,7 @@ class CI_URI { { // Filter out control characters $str = remove_invisible_characters($str, FALSE); - + // If the URI contains only a slash we'll kill it $this->uri_string = ($str == '/') ? '' : $str; } @@ -151,7 +151,7 @@ class CI_URI { */ private function _detect_uri() { - if ( ! isset($_SERVER['REQUEST_URI'])) + if ( ! isset($_SERVER['REQUEST_URI']) OR ! isset($_SERVER['SCRIPT_NAME'])) { return ''; } @@ -184,12 +184,12 @@ class CI_URI { $_SERVER['QUERY_STRING'] = ''; $_GET = array(); } - + if ($uri == '/' || empty($uri)) { return '/'; } - + $uri = parse_url($uri, PHP_URL_PATH); // Do some final cleaning of the URI and return it -- cgit v1.2.3-24-g4f1b From bffb7769c6f31b7a47355d4eb66f5ac1d85c2a2e Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Mon, 18 Apr 2011 00:03:31 -0400 Subject: Changed path in footer comment of cache dummy. --- system/libraries/Cache/drivers/Cache_dummy.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'system') diff --git a/system/libraries/Cache/drivers/Cache_dummy.php b/system/libraries/Cache/drivers/Cache_dummy.php index de47acb43..f96a68e27 100644 --- a/system/libraries/Cache/drivers/Cache_dummy.php +++ b/system/libraries/Cache/drivers/Cache_dummy.php @@ -10,29 +10,29 @@ * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 2.0 - * @filesource + * @filesource */ // ------------------------------------------------------------------------ /** - * CodeIgniter Dummy Caching Class + * CodeIgniter Dummy Caching Class * * @package CodeIgniter * @subpackage Libraries * @category Core * @author ExpressionEngine Dev Team - * @link + * @link */ class CI_Cache_dummy extends CI_Driver { /** - * Get + * Get * * Since this is the dummy class, it's always going to return FALSE. * - * @param string + * @param string * @return Boolean FALSE */ public function get($id) @@ -40,8 +40,8 @@ class CI_Cache_dummy extends CI_Driver { return FALSE; } - // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ + /** * Cache Save * @@ -55,7 +55,7 @@ class CI_Cache_dummy extends CI_Driver { { return TRUE; } - + // ------------------------------------------------------------------------ /** @@ -112,7 +112,7 @@ class CI_Cache_dummy extends CI_Driver { /** * Is this caching driver supported on the system? * Of course this one is. - * + * * @return TRUE; */ public function is_supported() @@ -121,9 +121,9 @@ class CI_Cache_dummy extends CI_Driver { } // ------------------------------------------------------------------------ - + } // End Class -/* End of file Cache_apc.php */ -/* Location: ./system/libraries/Cache/drivers/Cache_apc.php */ \ No newline at end of file +/* End of file Cache_dummy.php */ +/* Location: ./system/libraries/Cache/drivers/Cache_dummy.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 826429cf40a9624788b92d2e6e4b7659e1b0d8a1 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Mon, 18 Apr 2011 09:40:19 -0500 Subject: Added an optional third parameter to heading() which allows adding html attributes to the rendered heading tag. --- system/helpers/html_helper.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index c6103ab6f..a29204391 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -40,9 +40,10 @@ */ if ( ! function_exists('heading')) { - function heading($data = '', $h = '1') + function heading($data = '', $h = '1', $attributes = '') { - return "".$data.""; + $attributes = ($attributes != '') ? ' '.$attributes : $attributes; + return "".$data.""; } } -- cgit v1.2.3-24-g4f1b From 62df13125bd9ab22ff0c7f2565a42a6de13ed7e4 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Mon, 18 Apr 2011 11:18:02 -0500 Subject: Added Session Class userdata to the output profiler. Additionally, added a show/hide toggle on HTTP Headers, Session Data and Config Variables. --- system/language/english/profiler_lang.php | 3 +++ system/libraries/Profiler.php | 45 ++++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 6 deletions(-) (limited to 'system') diff --git a/system/language/english/profiler_lang.php b/system/language/english/profiler_lang.php index b6460fb83..1111158c8 100644 --- a/system/language/english/profiler_lang.php +++ b/system/language/english/profiler_lang.php @@ -9,6 +9,7 @@ $lang['profiler_post_data'] = 'POST DATA'; $lang['profiler_uri_string'] = 'URI STRING'; $lang['profiler_memory_usage'] = 'MEMORY USAGE'; $lang['profiler_config'] = 'CONFIG VARIABLES'; +$lang['profiler_session_data'] = 'SESSION DATA'; $lang['profiler_headers'] = 'HTTP HEADERS'; $lang['profiler_no_db'] = 'Database driver is not currently loaded'; $lang['profiler_no_queries'] = 'No queries were run'; @@ -17,6 +18,8 @@ $lang['profiler_no_get'] = 'No GET data exists'; $lang['profiler_no_uri'] = 'No URI data exists'; $lang['profiler_no_memory'] = 'Memory Usage Unavailable'; $lang['profiler_no_profiles'] = 'No Profile data - all Profiler sections have been disabled.'; +$lang['profiler_section_hide'] = 'Hide'; +$lang['profiler_section_show'] = 'Show'; /* End of file profiler_lang.php */ /* Location: ./system/language/english/profiler_lang.php */ \ No newline at end of file diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index 8a1f18ced..d1828b984 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -32,7 +32,7 @@ */ class CI_Profiler { - var $CI; + private $CI; protected $_available_sections = array( 'benchmarks', @@ -43,6 +43,7 @@ class CI_Profiler { 'controller_info', 'queries', 'http_headers', + 'session_data', 'config' ); @@ -410,10 +411,10 @@ class CI_Profiler { $output = "\n\n"; $output .= '
'; $output .= "\n"; - $output .= '  '.$this->CI->lang->line('profiler_headers').'  '; + $output .= '  '.$this->CI->lang->line('profiler_headers').'  ('.$this->CI->lang->line('profiler_section_show').')'; $output .= "\n"; - $output .= "\n\n\n"; + $output .= "\n\n
\n"; foreach (array('HTTP_ACCEPT', 'HTTP_USER_AGENT', 'HTTP_CONNECTION', 'SERVER_PORT', 'SERVER_NAME', 'REMOTE_ADDR', 'SERVER_SOFTWARE', 'HTTP_ACCEPT_LANGUAGE', 'SCRIPT_NAME', 'REQUEST_METHOD',' HTTP_HOST', 'REMOTE_HOST', 'CONTENT_TYPE', 'SERVER_PROTOCOL', 'QUERY_STRING', 'HTTP_ACCEPT_ENCODING', 'HTTP_X_FORWARDED_FOR') as $header) { @@ -441,10 +442,10 @@ class CI_Profiler { $output = "\n\n"; $output .= '
'; $output .= "\n"; - $output .= '  '.$this->CI->lang->line('profiler_config').'  '; + $output .= '  '.$this->CI->lang->line('profiler_config').'  ('.$this->CI->lang->line('profiler_section_show').')'; $output .= "\n"; - $output .= "\n\n
\n"; + $output .= "\n\n
\n"; foreach ($this->CI->config->config as $config=>$val) { @@ -464,6 +465,39 @@ class CI_Profiler { // -------------------------------------------------------------------- + /** + * Compile session userdata + * + * @return string + */ + private function _compile_session_data() + { + if ( ! isset($this->CI->session)) + { + return; + } + + $output = '
'; + $output .= '  '.$this->CI->lang->line('profiler_session_data').'  ('.$this->CI->lang->line('profiler_section_show').')'; + $output .= "
"; + + foreach ($this->CI->session->all_userdata() as $key => $val) + { + if (is_array($val)) + { + $val = print_r($val, TRUE); + } + + $output .= "\n"; + } + + $output .= ''; + $output .= "
"; + return $output; + } + + // -------------------------------------------------------------------- + /** * Run the Profiler * @@ -493,7 +527,6 @@ class CI_Profiler { return $output; } - } // END CI_Profiler class -- cgit v1.2.3-24-g4f1b From 3403366d0f457c1dd449076b4177d1aff5cb176c Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Mon, 18 Apr 2011 11:18:09 -0500 Subject: changeset: 2202:06a75a1bd622 tag: tip user: Greg Aker date: Mon Apr 18 11:10:37 2011 -0500 summary: Tweak to session class all_userdata() to just return the userdata array. Also documented previously undocumented all_userdata() method. --- system/libraries/Session.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/libraries/Session.php b/system/libraries/Session.php index 182294059..32317c2e6 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -435,11 +435,11 @@ class CI_Session { * Fetch all session data * * @access public - * @return mixed + * @return array */ function all_userdata() { - return ( ! isset($this->userdata)) ? FALSE : $this->userdata; + return $this->userdata; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From e6e6e64ab078205153513af24dd4163157efb148 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Mon, 18 Apr 2011 15:54:13 -0500 Subject: changeset: 2204:37301a84c8be tag: tip user: Greg Aker date: Mon Apr 18 15:51:28 2011 -0500 summary: Adding toggle show/hide on database queries in the output profiler. Added a profiler config item to set a threshold of when to hide the queries by default. Additionally, fixed a bug I created earlier today by marking the $CI class var in CI_Profiler as private. --- system/libraries/Profiler.php | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'system') diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index d1828b984..b73ddaf0d 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -32,8 +32,6 @@ */ class CI_Profiler { - private $CI; - protected $_available_sections = array( 'benchmarks', 'get', @@ -46,12 +44,24 @@ class CI_Profiler { 'session_data', 'config' ); + + protected $_query_toggle_count = 25; + + protected $CI; + // -------------------------------------------------------------------- + public function __construct($config = array()) { $this->CI =& get_instance(); $this->CI->load->language('profiler'); + if (isset($config['query_toggle_count'])) + { + $this->_query_toggle_count = (int) $config['query_toggle_count']; + unset($config['query_toggle_count']); + } + // default all sections to display foreach ($this->_available_sections as $section) { @@ -163,7 +173,7 @@ class CI_Profiler { $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_queries').'  '; $output .= "\n"; - $output .= "\n\n\n"; + $output .= "\n\n
\n"; $output .="\n"; $output .= "
".$this->CI->lang->line('profiler_no_db')."
\n"; $output .= ""; @@ -178,14 +188,27 @@ class CI_Profiler { $highlight = array('SELECT', 'DISTINCT', 'FROM', 'WHERE', 'AND', 'LEFT JOIN', 'ORDER BY', 'GROUP BY', 'LIMIT', 'INSERT', 'INTO', 'VALUES', 'UPDATE', 'OR ', 'HAVING', 'OFFSET', 'NOT IN', 'IN', 'LIKE', 'NOT LIKE', 'COUNT', 'MAX', 'MIN', 'ON', 'AS', 'AVG', 'SUM', '(', ')'); $output = "\n\n"; - + + $count = 0; + foreach ($dbs as $db) { + $count++; + + $hide_queries = (count($db->queries) > $this->_query_toggle_count) ? ' display:none' : ''; + + $show_hide_js = '('.$this->CI->lang->line('profiler_section_hide').')'; + + if ($hide_queries != '') + { + $show_hide_js = '('.$this->CI->lang->line('profiler_section_show').')'; + } + $output .= '
'; $output .= "\n"; - $output .= '  '.$this->CI->lang->line('profiler_database').':  '.$db->database.'   '.$this->CI->lang->line('profiler_queries').': '.count($db->queries).'   '; + $output .= '  '.$this->CI->lang->line('profiler_database').':  '.$db->database.'   '.$this->CI->lang->line('profiler_queries').': '.count($db->queries).'  '.$show_hide_js.''; $output .= "\n"; - $output .= "\n\n\n"; + $output .= "\n\n
\n"; if (count($db->queries) == 0) { -- cgit v1.2.3-24-g4f1b From 3a746655e92ec59ee7e731c3535673a9aedc5d3e Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Tue, 19 Apr 2011 10:59:47 -0500 Subject: Removing internal references to the EXT constant. Additionally, marked the constant as deprecated. Use ".php" instead. Also adding upgrade notes from 2.0.2 to 2.0.3. --- system/core/CodeIgniter.php | 22 ++++++------- system/core/Common.php | 14 ++++----- system/core/Config.php | 6 ++-- system/core/Exceptions.php | 4 +-- system/core/Hooks.php | 8 ++--- system/core/Lang.php | 4 +-- system/core/Loader.php | 64 +++++++++++++++++++------------------- system/core/Output.php | 6 ++-- system/core/Router.php | 14 ++++----- system/database/DB.php | 12 +++---- system/database/DB_driver.php | 6 ++-- system/helpers/download_helper.php | 8 ++--- system/helpers/file_helper.php | 8 ++--- system/helpers/html_helper.php | 8 ++--- system/helpers/smiley_helper.php | 8 ++--- system/helpers/text_helper.php | 8 ++--- system/libraries/Calendar.php | 2 +- system/libraries/Driver.php | 2 +- system/libraries/Encrypt.php | 2 +- system/libraries/Log.php | 2 +- system/libraries/Upload.php | 8 ++--- system/libraries/User_agent.php | 8 ++--- 22 files changed, 112 insertions(+), 112 deletions(-) (limited to 'system') diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index e022e1b46..03b25ab9e 100644 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -46,20 +46,20 @@ * Load the global functions * ------------------------------------------------------ */ - require(BASEPATH.'core/Common'.EXT); + require(BASEPATH.'core/Common.php'); /* * ------------------------------------------------------ * Load the framework constants * ------------------------------------------------------ */ - if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants'.EXT)) + if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php')) { - require(APPPATH.'config/'.ENVIRONMENT.'/constants'.EXT); + require(APPPATH.'config/'.ENVIRONMENT.'/constants.php'); } else { - require(APPPATH.'config/constants'.EXT); + require(APPPATH.'config/constants.php'); } /* @@ -224,7 +224,7 @@ * */ // Load the base controller class - require BASEPATH.'core/Controller'.EXT; + require BASEPATH.'core/Controller.php'; function &get_instance() { @@ -232,20 +232,20 @@ } - if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller'.EXT)) + if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php')) { - require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller'.EXT; + require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php'; } // Load the local application controller // Note: The Router class automatically validates the controller path using the router->_validate_request(). // If this include fails it means that the default controller in the Routes.php file is not resolving to something valid. - if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT)) + if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php')) { show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.'); } - include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT); + include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php'); // Set a mark point for benchmarking $BM->mark('loading_time:_base_classes_end'); @@ -318,12 +318,12 @@ $method = (isset($x[1]) ? $x[1] : 'index'); if ( ! class_exists($class)) { - if ( ! file_exists(APPPATH.'controllers/'.$class.EXT)) + if ( ! file_exists(APPPATH.'controllers/'.$class.'.php')) { show_404("{$class}/{$method}"); } - include_once(APPPATH.'controllers/'.$class.EXT); + include_once(APPPATH.'controllers/'.$class.'.php'); unset($CI); $CI = new $class(); } diff --git a/system/core/Common.php b/system/core/Common.php index 1aca809ab..d1e8e77e9 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -128,13 +128,13 @@ // thenin the local application/libraries folder foreach (array(BASEPATH, APPPATH) as $path) { - if (file_exists($path.$directory.'/'.$class.EXT)) + if (file_exists($path.$directory.'/'.$class.'.php')) { $name = $prefix.$class; if (class_exists($name) === FALSE) { - require($path.$directory.'/'.$class.EXT); + require($path.$directory.'/'.$class.'.php'); } break; @@ -142,13 +142,13 @@ } // Is the request a class extension? If so we load it too - if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.EXT)) + if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.'.php')) { $name = config_item('subclass_prefix').$class; if (class_exists($name) === FALSE) { - require(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.EXT); + require(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.'.php'); } } @@ -157,7 +157,7 @@ { // Note: We use exit() rather then show_error() in order to avoid a // self-referencing loop with the Excptions class - exit('Unable to locate the specified class: '.$class.EXT); + exit('Unable to locate the specified class: '.$class.'.php'); } // Keep track of what we just loaded @@ -209,9 +209,9 @@ } // Is the config file in the environment folder? - if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config'.EXT)) + if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php')) { - $file_path = APPPATH.'config/config'.EXT; + $file_path = APPPATH.'config/config.php'; } // Fetch the config file diff --git a/system/core/Config.php b/system/core/Config.php index 863c5ef4b..4493ff266 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -80,7 +80,7 @@ class CI_Config { */ function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) { - $file = ($file == '') ? 'config' : str_replace(EXT, '', $file); + $file = ($file == '') ? 'config' : str_replace('.php', '', $file); $found = FALSE; $loaded = FALSE; @@ -92,7 +92,7 @@ class CI_Config { foreach ($check_locations as $location) { - $file_path = $path.'config/'.$location.EXT; + $file_path = $path.'config/'.$location.'.php'; if (in_array($file_path, $this->is_loaded, TRUE)) { @@ -152,7 +152,7 @@ class CI_Config { { return FALSE; } - show_error('The configuration file '.$file.EXT.' does not exist.'); + show_error('The configuration file '.$file.'.php'.' does not exist.'); } return TRUE; diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index f5659561c..bff86a92f 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -128,7 +128,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'errors/'.$template.EXT); + include(APPPATH.'errors/'.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); return $buffer; @@ -164,7 +164,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'errors/error_php'.EXT); + include(APPPATH.'errors/error_php.php'); $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; diff --git a/system/core/Hooks.php b/system/core/Hooks.php index 24fa1055b..fd6380f0a 100644 --- a/system/core/Hooks.php +++ b/system/core/Hooks.php @@ -65,13 +65,13 @@ class CI_Hooks { // Grab the "hooks" definition file. // If there are no hooks, we're done. - if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks'.EXT)) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php')) { - include(APPPATH.'config/'.ENVIRONMENT.'/hooks'.EXT); + include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'); } - elseif (is_file(APPPATH.'config/hooks'.EXT)) + elseif (is_file(APPPATH.'config/hooks.php')) { - include(APPPATH.'config/hooks'.EXT); + include(APPPATH.'config/hooks.php'); } diff --git a/system/core/Lang.php b/system/core/Lang.php index cdadc7f41..170e6c725 100644 --- a/system/core/Lang.php +++ b/system/core/Lang.php @@ -51,14 +51,14 @@ class CI_Lang { */ function load($langfile = '', $idiom = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '') { - $langfile = str_replace(EXT, '', $langfile); + $langfile = str_replace('.php', '', $langfile); if ($add_suffix == TRUE) { $langfile = str_replace('_lang.', '', $langfile).'_lang'; } - $langfile .= EXT; + $langfile .= '.php'; if (in_array($langfile, $this->is_loaded, TRUE)) { diff --git a/system/core/Loader.php b/system/core/Loader.php index e75805d0e..59415b72a 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -161,7 +161,7 @@ class CI_Loader { foreach ($this->_ci_model_paths as $mod_path) { - if ( ! file_exists($mod_path.'models/'.$path.$model.EXT)) + if ( ! file_exists($mod_path.'models/'.$path.$model.'.php')) { continue; } @@ -181,7 +181,7 @@ class CI_Loader { load_class('Model', 'core'); } - require_once($mod_path.'models/'.$path.$model.EXT); + require_once($mod_path.'models/'.$path.$model.'.php'); $model = ucfirst($model); @@ -217,7 +217,7 @@ class CI_Loader { return FALSE; } - require_once(BASEPATH.'database/DB'.EXT); + require_once(BASEPATH.'database/DB.php'); if ($return === TRUE) { @@ -253,8 +253,8 @@ class CI_Loader { // this use is deprecated and strongly discouraged $CI->load->dbforge(); - require_once(BASEPATH.'database/DB_utility'.EXT); - require_once(BASEPATH.'database/drivers/'.$CI->db->dbdriver.'/'.$CI->db->dbdriver.'_utility'.EXT); + require_once(BASEPATH.'database/DB_utility.php'); + require_once(BASEPATH.'database/drivers/'.$CI->db->dbdriver.'/'.$CI->db->dbdriver.'_utility.php'); $class = 'CI_DB_'.$CI->db->dbdriver.'_utility'; $CI->dbutil = new $class(); @@ -277,8 +277,8 @@ class CI_Loader { $CI =& get_instance(); - require_once(BASEPATH.'database/DB_forge'.EXT); - require_once(BASEPATH.'database/drivers/'.$CI->db->dbdriver.'/'.$CI->db->dbdriver.'_forge'.EXT); + require_once(BASEPATH.'database/DB_forge.php'); + require_once(BASEPATH.'database/drivers/'.$CI->db->dbdriver.'/'.$CI->db->dbdriver.'_forge.php'); $class = 'CI_DB_'.$CI->db->dbdriver.'_forge'; $CI->dbforge = new $class(); @@ -375,16 +375,16 @@ class CI_Loader { continue; } - $ext_helper = APPPATH.'helpers/'.config_item('subclass_prefix').$helper.EXT; + $ext_helper = APPPATH.'helpers/'.config_item('subclass_prefix').$helper.'.php'; // Is this a helper extension request? if (file_exists($ext_helper)) { - $base_helper = BASEPATH.'helpers/'.$helper.EXT; + $base_helper = BASEPATH.'helpers/'.$helper.'.php'; if ( ! file_exists($base_helper)) { - show_error('Unable to load the requested file: helpers/'.$helper.EXT); + show_error('Unable to load the requested file: helpers/'.$helper.'.php'); } include_once($ext_helper); @@ -398,9 +398,9 @@ class CI_Loader { // Try to load the helper foreach ($this->_ci_helper_paths as $path) { - if (file_exists($path.'helpers/'.$helper.EXT)) + if (file_exists($path.'helpers/'.$helper.'.php')) { - include_once($path.'helpers/'.$helper.EXT); + include_once($path.'helpers/'.$helper.'.php'); $this->_ci_helpers[$helper] = TRUE; log_message('debug', 'Helper loaded: '.$helper); @@ -411,7 +411,7 @@ class CI_Loader { // unable to load the helper if ( ! isset($this->_ci_helpers[$helper])) { - show_error('Unable to load the requested file: helpers/'.$helper.EXT); + show_error('Unable to load the requested file: helpers/'.$helper.'.php'); } } } @@ -490,7 +490,7 @@ class CI_Loader { if ( ! class_exists('CI_Driver_Library')) { // we aren't instantiating an object here, that'll be done by the Library itself - require BASEPATH.'libraries/Driver'.EXT; + require BASEPATH.'libraries/Driver.php'; } // We can save the loader some time since Drivers will *always* be in a subfolder, @@ -616,7 +616,7 @@ class CI_Loader { if ($_ci_path == '') { $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); - $_ci_file = ($_ci_ext == '') ? $_ci_view.EXT : $_ci_view; + $_ci_file = ($_ci_ext == '') ? $_ci_view.'.php' : $_ci_view; $_ci_path = $this->_ci_view_path.$_ci_file; } else @@ -732,7 +732,7 @@ class CI_Loader { // Get the class name, and while we're at it trim any slashes. // The directory path can be included as part of the class name, // but we don't want a leading slash - $class = str_replace(EXT, '', trim($class, '/')); + $class = str_replace('.php', '', trim($class, '/')); // Was the path included with the class name? // We look for a slash to determine this @@ -749,12 +749,12 @@ class CI_Loader { // We'll test for both lowercase and capitalized versions of the file name foreach (array(ucfirst($class), strtolower($class)) as $class) { - $subclass = APPPATH.'libraries/'.$subdir.config_item('subclass_prefix').$class.EXT; + $subclass = APPPATH.'libraries/'.$subdir.config_item('subclass_prefix').$class.'.php'; // Is this a class extension request? if (file_exists($subclass)) { - $baseclass = BASEPATH.'libraries/'.ucfirst($class).EXT; + $baseclass = BASEPATH.'libraries/'.ucfirst($class).'.php'; if ( ! file_exists($baseclass)) { @@ -793,7 +793,7 @@ class CI_Loader { $is_duplicate = FALSE; foreach ($this->_ci_library_paths as $path) { - $filepath = $path.'libraries/'.$subdir.$class.EXT; + $filepath = $path.'libraries/'.$subdir.$class.'.php'; // Does the file exist? No? Bummer... if ( ! file_exists($filepath)) @@ -872,24 +872,24 @@ class CI_Loader { // We test for both uppercase and lowercase, for servers that // are case-sensitive with regard to file names. Check for environment // first, global next - if (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.strtolower($class).EXT)) + if (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.strtolower($class).'.php')) { - include_once($path .'config/'.ENVIRONMENT.'/'.strtolower($class).EXT); + include_once($path .'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); break; } - elseif (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).EXT)) + elseif (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) { - include_once($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).EXT); + include_once($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); break; } - elseif (file_exists($path .'config/'.strtolower($class).EXT)) + elseif (file_exists($path .'config/'.strtolower($class).'.php')) { - include_once($path .'config/'.strtolower($class).EXT); + include_once($path .'config/'.strtolower($class).'.php'); break; } - elseif (file_exists($path .'config/'.ucfirst(strtolower($class)).EXT)) + elseif (file_exists($path .'config/'.ucfirst(strtolower($class)).'.php')) { - include_once($path .'config/'.ucfirst(strtolower($class)).EXT); + include_once($path .'config/'.ucfirst(strtolower($class)).'.php'); break; } } @@ -965,13 +965,13 @@ class CI_Loader { */ function _ci_autoloader() { - if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload'.EXT)) + if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php')) { - include_once(APPPATH.'config/'.ENVIRONMENT.'/autoload'.EXT); + include_once(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'); } else { - include_once(APPPATH.'config/autoload'.EXT); + include_once(APPPATH.'config/autoload.php'); } @@ -1084,13 +1084,13 @@ class CI_Loader { { if ( ! is_array($filename)) { - return array(strtolower(str_replace(EXT, '', str_replace($extension, '', $filename)).$extension)); + return array(strtolower(str_replace('.php', '', str_replace($extension, '', $filename)).$extension)); } else { foreach ($filename as $key => $val) { - $filename[$key] = strtolower(str_replace(EXT, '', str_replace($extension, '', $val)).$extension); + $filename[$key] = strtolower(str_replace('.php', '', str_replace($extension, '', $val)).$extension); } return $filename; diff --git a/system/core/Output.php b/system/core/Output.php index 45a82f3cb..05ace919c 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -42,13 +42,13 @@ class CI_Output { $this->_zlib_oc = @ini_get('zlib.output_compression'); // Get mime types for later - if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT)) + if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) { - include APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT; + include APPPATH.'config/'.ENVIRONMENT.'/mimes.php'; } else { - include APPPATH.'config/mimes'.EXT; + include APPPATH.'config/mimes.php'; } diff --git a/system/core/Router.php b/system/core/Router.php index d451aab68..5e92a04b1 100644 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -87,13 +87,13 @@ class CI_Router { } // Load the routes.php file. - if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/routes'.EXT)) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/routes.php')) { - include(APPPATH.'config/'.ENVIRONMENT.'/routes'.EXT); + include(APPPATH.'config/'.ENVIRONMENT.'/routes.php'); } - elseif (is_file(APPPATH.'config/routes'.EXT)) + elseif (is_file(APPPATH.'config/routes.php')) { - include(APPPATH.'config/routes'.EXT); + include(APPPATH.'config/routes.php'); } $this->routes = ( ! isset($route) OR ! is_array($route)) ? array() : $route; @@ -227,7 +227,7 @@ class CI_Router { } // Does the requested controller exist in the root folder? - if (file_exists(APPPATH.'controllers/'.$segments[0].EXT)) + if (file_exists(APPPATH.'controllers/'.$segments[0].'.php')) { return $segments; } @@ -242,7 +242,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].'.php')) { show_404($this->fetch_directory().$segments[0]); } @@ -264,7 +264,7 @@ class CI_Router { } // 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.'.php')) { $this->directory = ''; return array(); diff --git a/system/database/DB.php b/system/database/DB.php index 8bf1ba8ba..33207d885 100644 --- a/system/database/DB.php +++ b/system/database/DB.php @@ -28,11 +28,11 @@ function &DB($params = '', $active_record_override = NULL) if (is_string($params) AND strpos($params, '://') === FALSE) { // Is the config file in the environment folder? - if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/database'.EXT)) + if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/database.php')) { - if ( ! file_exists($file_path = APPPATH.'config/database'.EXT)) + if ( ! file_exists($file_path = APPPATH.'config/database.php')) { - show_error('The configuration file database'.EXT.' does not exist.'); + show_error('The configuration file database.php does not exist.'); } } @@ -116,11 +116,11 @@ function &DB($params = '', $active_record_override = NULL) $active_record = $active_record_override; } - require_once(BASEPATH.'database/DB_driver'.EXT); + require_once(BASEPATH.'database/DB_driver.php'); if ( ! isset($active_record) OR $active_record == TRUE) { - require_once(BASEPATH.'database/DB_active_rec'.EXT); + require_once(BASEPATH.'database/DB_active_rec.php'); if ( ! class_exists('CI_DB')) { @@ -135,7 +135,7 @@ function &DB($params = '', $active_record_override = NULL) } } - require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver'.EXT); + require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver.php'); // Instantiate the DB adapter $driver = 'CI_DB_'.$params['dbdriver'].'_driver'; diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index e7a9de475..10e8ed0c0 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -424,8 +424,8 @@ class CI_DB_driver { if ( ! class_exists($driver)) { - include_once(BASEPATH.'database/DB_result'.EXT); - include_once(BASEPATH.'database/drivers/'.$this->dbdriver.'/'.$this->dbdriver.'_result'.EXT); + include_once(BASEPATH.'database/DB_result.php'); + include_once(BASEPATH.'database/drivers/'.$this->dbdriver.'/'.$this->dbdriver.'_result.php'); } return $driver; @@ -1115,7 +1115,7 @@ class CI_DB_driver { if ( ! class_exists('CI_DB_Cache')) { - if ( ! @include(BASEPATH.'database/DB_cache'.EXT)) + if ( ! @include(BASEPATH.'database/DB_cache.php')) { return $this->cache_off(); } diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index f8073d238..1145688ae 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -58,13 +58,13 @@ if ( ! function_exists('force_download')) $extension = end($x); // Load the mime types - if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT)) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) { - include(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT); + include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'); } - elseif (is_file(APPPATH.'config/mimes'.EXT)) + elseif (is_file(APPPATH.'config/mimes.php')) { - include(APPPATH.'config/mimes'.EXT); + include(APPPATH.'config/mimes.php'); } // Set a default mime if we can't find it diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 44344947e..3931667fd 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -352,13 +352,13 @@ if ( ! function_exists('get_mime_by_extension')) if ( ! is_array($mimes)) { - if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT)) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) { - include(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT); + include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'); } - elseif (is_file(APPPATH.'config/mimes'.EXT)) + elseif (is_file(APPPATH.'config/mimes.php')) { - include(APPPATH.'config/mimes'.EXT); + include(APPPATH.'config/mimes.php'); } if ( ! is_array($mimes)) diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index a29204391..080f622dd 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -259,13 +259,13 @@ if ( ! function_exists('doctype')) if ( ! is_array($_doctypes)) { - if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes'.EXT)) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php')) { - include(APPPATH.'config/'.ENVIRONMENT.'/doctypes'.EXT); + include(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php'); } - elseif (is_file(APPPATH.'config/doctypes'.EXT)) + elseif (is_file(APPPATH.'config/doctypes.php')) { - include(APPPATH.'config/doctypes'.EXT); + include(APPPATH.'config/doctypes.php'); } if ( ! is_array($_doctypes)) diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php index a2d1031b3..6d8889354 100644 --- a/system/helpers/smiley_helper.php +++ b/system/helpers/smiley_helper.php @@ -229,13 +229,13 @@ if ( ! function_exists('_get_smiley_array')) { function _get_smiley_array() { - if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys'.EXT)) + if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php')) { - include(APPPATH.'config/'.ENVIRONMENT.'/smileys'.EXT); + include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'); } - elseif (file_exists(APPPATH.'config/smileys'.EXT)) + elseif (file_exists(APPPATH.'config/smileys.php')) { - include(APPPATH.'config/smileys'.EXT); + include(APPPATH.'config/smileys.php'); } if (isset($smileys) AND is_array($smileys)) diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index cca093976..33d7fa2fd 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -366,13 +366,13 @@ if ( ! function_exists('convert_accented_characters')) { function convert_accented_characters($str) { - if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars'.EXT)) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php')) { - include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars'.EXT); + include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'); } - elseif (is_file(APPPATH.'config/foreign_chars'.EXT)) + elseif (is_file(APPPATH.'config/foreign_chars.php')) { - include(APPPATH.'config/foreign_chars'.EXT); + include(APPPATH.'config/foreign_chars.php'); } if ( ! isset($foreign_characters)) diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php index 72d228e73..df0fd6eeb 100644 --- a/system/libraries/Calendar.php +++ b/system/libraries/Calendar.php @@ -47,7 +47,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.php', $this->CI->lang->is_loaded, TRUE)) { $this->CI->lang->load('calendar'); } diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index b942f539f..d1925c0ec 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -59,7 +59,7 @@ class CI_Driver_Library { // loves me some nesting! foreach (array(ucfirst($driver_name), $driver_name) as $class) { - $filepath = $path.'libraries/'.$lib_name.'/drivers/'.$class.EXT; + $filepath = $path.'libraries/'.$lib_name.'/drivers/'.$class.'.php'; if (file_exists($filepath)) { diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index e5f65878a..b30a8cf0b 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -524,7 +524,7 @@ class CI_Encrypt { { if ( ! function_exists('mhash')) { - require_once(BASEPATH.'libraries/Sha1'.EXT); + require_once(BASEPATH.'libraries/Sha1.php'); $SH = new CI_SHA; return $SH->generate($str); } diff --git a/system/libraries/Log.php b/system/libraries/Log.php index fb2c5a49b..9f1db76ba 100644 --- a/system/libraries/Log.php +++ b/system/libraries/Log.php @@ -83,7 +83,7 @@ class CI_Log { return FALSE; } - $filepath = $this->_log_path.'log-'.date('Y-m-d').EXT; + $filepath = $this->_log_path.'log-'.date('Y-m-d').'.php'; $message = ''; if ( ! file_exists($filepath)) diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index e80049fa4..3177424c4 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -945,13 +945,13 @@ class CI_Upload { if (count($this->mimes) == 0) { - if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT)) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) { - include(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT); + include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'); } - elseif (is_file(APPPATH.'config/mimes'.EXT)) + elseif (is_file(APPPATH.'config/mimes.php')) { - include(APPPATH.'config//mimes'.EXT); + include(APPPATH.'config//mimes.php'); } else { diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php index 04cda7312..016102a2a 100644 --- a/system/libraries/User_agent.php +++ b/system/libraries/User_agent.php @@ -84,13 +84,13 @@ class CI_User_agent { */ private function _load_agent_file() { - if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/user_agents'.EXT)) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php')) { - include(APPPATH.'config/'.ENVIRONMENT.'/user_agents'.EXT); + include(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php'); } - elseif (is_file(APPPATH.'config/user_agents'.EXT)) + elseif (is_file(APPPATH.'config/user_agents.php')) { - include(APPPATH.'config/user_agents'.EXT); + include(APPPATH.'config/user_agents.php'); } else { -- cgit v1.2.3-24-g4f1b From 9ce4385cfc976e309ee12c53726abfd4f066ac3f Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Tue, 19 Apr 2011 12:58:52 -0500 Subject: 1/2 reverting a previous change to the form_helper. Wrapping hidden form elements in
instead of an empty div. If a user is styling form div {} they can run into display issues, so something is needed. --- system/helpers/form_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index bca0ff0c9..a5cd97b82 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -72,7 +72,7 @@ if ( ! function_exists('form_open')) if (is_array($hidden) AND count($hidden) > 0) { - $form .= sprintf("\n
%s
", form_hidden($hidden)); + $form .= sprintf("
%s
", form_hidden($hidden)); } return $form; -- cgit v1.2.3-24-g4f1b From 6ae70cc8499499b5d77d77ec8974f95873edb861 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Tue, 19 Apr 2011 16:13:48 -0500 Subject: modified MySQL and MySQLi drivers to address a potential SQL injection attack vector when multi-byte character set connections are employed. (Does not impact Latin-1, UTF-8, etc. encodings) --- system/database/drivers/mysql/mysql_driver.php | 17 ++++++++++++++++- system/database/drivers/mysqli/mysqli_driver.php | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index 4ff9b0a11..b7d547cc0 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -132,7 +132,22 @@ class CI_DB_mysql_driver extends CI_DB { */ function db_set_charset($charset, $collation) { - return @mysql_query("SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'", $this->conn_id); + static $use_set_names; + + if ( ! isset($use_set_names)) + { + // mysql_set_charset() requires PHP >= 5.2.3 and MySQL >= 5.0.7, use SET NAMES as fallback + $use_set_names = (version_compare(PHP_VERSION, '5.2.3', '>=') && version_compare(mysql_get_server_info(), '5.0.7', '>=')) ? FALSE : TRUE; + } + + if ($use_set_names) + { + return @mysql_query("SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'", $this->conn_id); + } + else + { + return @mysql_set_charset($charset, $this->conn_id); + } } // -------------------------------------------------------------------- diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index ccdabce1a..1949acb6e 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -132,7 +132,22 @@ class CI_DB_mysqli_driver extends CI_DB { */ function _db_set_charset($charset, $collation) { - return @mysqli_query($this->conn_id, "SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'"); + static $use_set_names; + + if ( ! isset($use_set_names)) + { + // mysqli_set_charset() requires MySQL >= 5.0.7, use SET NAMES as fallback + $use_set_names = (version_compare(mysql_get_server_info(), '5.0.7', '>=')) ? FALSE : TRUE; + } + + if ($use_set_names) + { + return @mysqli_query($this->conn_id, "SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'"); + } + else + { + return @mysqli_set_charset($this->conn_id, $charset); + } } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From f5c840241084e03d49e521bfcb62d2adbe9fce7d Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Tue, 19 Apr 2011 17:13:03 -0500 Subject: Altering the loader to be able to load views from packages when adding the package path with add_package_path(). --- system/core/Controller.php | 2 +- system/core/Loader.php | 110 ++++++++++++++++++++++++--------------------- 2 files changed, 59 insertions(+), 53 deletions(-) (limited to 'system') diff --git a/system/core/Controller.php b/system/core/Controller.php index 469663f09..fd9c8b580 100644 --- a/system/core/Controller.php +++ b/system/core/Controller.php @@ -50,7 +50,7 @@ class CI_Controller { $this->load->_base_classes =& is_loaded(); - $this->load->_ci_autoloader(); + $this->load->ci_autoloader(); log_message('debug', "Controller Class Initialized"); diff --git a/system/core/Loader.php b/system/core/Loader.php index 59415b72a..8146cd563 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -30,8 +30,8 @@ class CI_Loader { // All these are set automatically. Don't mess with them. var $_ci_ob_level; - var $_ci_view_path = ''; - var $_ci_library_paths = array(); + var $_ci_view_paths = array(); + protected $_ci_library_paths = array(); var $_ci_model_paths = array(); var $_ci_helper_paths = array(); var $_base_classes = array(); // Set by the controller class @@ -47,17 +47,15 @@ class CI_Loader { * Constructor * * Sets the path to the view files and gets the initial output buffering level - * - * @access public */ - function __construct() + public function __construct() { - $this->_ci_view_path = APPPATH.'views/'; $this->_ci_ob_level = ob_get_level(); $this->_ci_library_paths = array(APPPATH, BASEPATH); $this->_ci_helper_paths = array(APPPATH, BASEPATH); $this->_ci_model_paths = array(APPPATH); - + $this->_ci_view_paths = array(APPPATH.'views/' => TRUE); + log_message('debug', "Loader Class Initialized"); } @@ -107,13 +105,12 @@ class CI_Loader { * * This function lets users load and instantiate models. * - * @access public * @param string the name of the class * @param string name for the model * @param bool database connection * @return void */ - function model($model, $name = '', $db_conn = FALSE) + public function model($model, $name = '', $db_conn = FALSE) { if (is_array($model)) { @@ -200,13 +197,12 @@ class CI_Loader { /** * Database Loader * - * @access public * @param string the DB credentials * @param bool whether to return the DB object * @param bool whether to enable active record (this allows us to override the config setting) * @return object */ - function database($params = '', $return = FALSE, $active_record = NULL) + public function database($params = '', $return = FALSE, $active_record = NULL) { // Grab the super object $CI =& get_instance(); @@ -237,10 +233,9 @@ class CI_Loader { /** * Load the Utilities Class * - * @access public * @return string */ - function dbutil() + public function dbutil() { if ( ! class_exists('CI_DB')) { @@ -265,10 +260,9 @@ class CI_Loader { /** * Load the Database Forge Class * - * @access public * @return string */ - function dbforge() + public function dbforge() { if ( ! class_exists('CI_DB')) { @@ -297,13 +291,12 @@ class CI_Loader { * some cases it's advantageous to be able to return data so that * a developer can process it in some way. * - * @access public * @param string * @param array * @param bool * @return void */ - function view($view, $vars = array(), $return = FALSE) + public function view($view, $vars = array(), $return = FALSE) { return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return)); } @@ -315,12 +308,11 @@ class CI_Loader { * * This is a generic file loader * - * @access public * @param string * @param bool * @return string */ - function file($path, $return = FALSE) + public function file($path, $return = FALSE) { return $this->_ci_load(array('_ci_path' => $path, '_ci_return' => $return)); } @@ -333,11 +325,10 @@ class CI_Loader { * Once variables are set they become available within * the controller class and its "view" files. * - * @access public * @param array * @return void */ - function vars($vars = array(), $val = '') + public function vars($vars = array(), $val = '') { if ($val != '' AND is_string($vars)) { @@ -362,11 +353,10 @@ class CI_Loader { * * This function loads the specified helper file. * - * @access public * @param mixed * @return void */ - function helper($helpers = array()) + public function helper($helpers = array()) { foreach ($this->_ci_prep_filename($helpers, '_helper') as $helper) { @@ -424,11 +414,10 @@ class CI_Loader { * This is simply an alias to the above function in case the * user has written the plural form of this function. * - * @access public * @param array * @return void */ - function helpers($helpers = array()) + public function helpers($helpers = array()) { $this->helper($helpers); } @@ -438,12 +427,11 @@ class CI_Loader { /** * Loads a language file * - * @access public * @param array * @param string * @return void */ - function language($file = array(), $lang = '') + public function language($file = array(), $lang = '') { $CI =& get_instance(); @@ -463,11 +451,10 @@ class CI_Loader { /** * Loads a config file * - * @access public * @param string * @return void */ - function config($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) + public function config($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) { $CI =& get_instance(); $CI->config->load($file, $use_sections, $fail_gracefully); @@ -485,7 +472,7 @@ class CI_Loader { * @param string an optional object name * @return void */ - function driver($library = '', $params = NULL, $object_name = NULL) + public function driver($library = '', $params = NULL, $object_name = NULL) { if ( ! class_exists('CI_Driver_Library')) { @@ -510,18 +497,20 @@ class CI_Loader { * * Prepends a parent path to the library, model, helper, and config path arrays * - * @access public * @param string + * @param boolean * @return void */ - function add_package_path($path) + public function add_package_path($path, $view_cascade=TRUE) { $path = rtrim($path, '/').'/'; - + array_unshift($this->_ci_library_paths, $path); array_unshift($this->_ci_model_paths, $path); array_unshift($this->_ci_helper_paths, $path); + $this->_ci_view_paths = array($path.'views/' => $view_cascade) + $this->_ci_view_paths; + // Add config file path $config =& $this->_ci_get_component('config'); array_unshift($config->_config_paths, $path); @@ -534,11 +523,10 @@ class CI_Loader { * * Return a list of all package paths, by default it will ignore BASEPATH. * - * @access public * @param string * @return void */ - function get_package_paths($include_base = FALSE) + public function get_package_paths($include_base = FALSE) { return $include_base === TRUE ? $this->_ci_library_paths : $this->_ci_model_paths; } @@ -551,11 +539,10 @@ class CI_Loader { * Remove a path from the library, model, and helper path arrays if it exists * If no path is provided, the most recently added path is removed. * - * @access public * @param type * @return type */ - function remove_package_path($path = '', $remove_config_path = TRUE) + public function remove_package_path($path = '', $remove_config_path = TRUE) { $config =& $this->_ci_get_component('config'); @@ -564,12 +551,12 @@ class CI_Loader { $void = array_shift($this->_ci_library_paths); $void = array_shift($this->_ci_model_paths); $void = array_shift($this->_ci_helper_paths); + $void = array_shift($this->_ci_view_paths); $void = array_shift($config->_config_paths); } else { $path = rtrim($path, '/').'/'; - foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var) { if (($key = array_search($path, $this->{$var})) !== FALSE) @@ -577,6 +564,11 @@ class CI_Loader { unset($this->{$var}[$key]); } } + + if (isset($this->_ci_view_paths[$path.'views/'])) + { + unset($this->_ci_view_paths[$path.'views/']); + } if (($key = array_search($path, $config->_config_paths)) !== FALSE) { @@ -588,6 +580,7 @@ class CI_Loader { $this->_ci_library_paths = array_unique(array_merge($this->_ci_library_paths, array(APPPATH, BASEPATH))); $this->_ci_helper_paths = array_unique(array_merge($this->_ci_helper_paths, array(APPPATH, BASEPATH))); $this->_ci_model_paths = array_unique(array_merge($this->_ci_model_paths, array(APPPATH))); + $this->_ci_view_paths = array_merge($this->_ci_view_paths, array(APPPATH.'views/' => TRUE)); $config->_config_paths = array_unique(array_merge($config->_config_paths, array(APPPATH))); } @@ -600,24 +593,39 @@ class CI_Loader { * Variables are prefixed with _ci_ to avoid symbol collision with * variables made available to view files * - * @access private * @param array * @return void */ - function _ci_load($_ci_data) + protected function _ci_load($_ci_data) { // 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]; } + + $file_exists = FALSE; // Set the path to the requested file if ($_ci_path == '') { $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); $_ci_file = ($_ci_ext == '') ? $_ci_view.'.php' : $_ci_view; - $_ci_path = $this->_ci_view_path.$_ci_file; + + foreach ($this->_ci_view_paths as $view_file => $cascade) + { + if (file_exists($view_file.$_ci_file)) + { + $_ci_path = $view_file.$_ci_file; + $file_exists = TRUE; + break; + } + + if ( ! $cascade) + { + break; + } + } } else { @@ -625,7 +633,7 @@ class CI_Loader { $_ci_file = end($_ci_x); } - if ( ! file_exists($_ci_path)) + if ( ! $file_exists && ! file_exists($_ci_path)) { show_error('Unable to load the requested file: '.$_ci_file); } @@ -721,13 +729,12 @@ class CI_Loader { * * This function loads the requested class. * - * @access private * @param string the item that is being loaded * @param mixed any additional parameters * @param string an optional object name * @return void */ - function _ci_load_class($class, $params = NULL, $object_name = NULL) + protected function _ci_load_class($class, $params = NULL, $object_name = NULL) { // Get the class name, and while we're at it trim any slashes. // The directory path can be included as part of the class name, @@ -959,11 +966,13 @@ class CI_Loader { * The config/autoload.php file contains an array that permits sub-systems, * libraries, and helpers to be loaded automatically. * - * @access private + * This function is public, as it's used in the CI_Controller class. + * However, there is no reason you should ever needs to use it. + * * @param array * @return void */ - function _ci_autoloader() + public function ci_autoloader() { if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php')) { @@ -1046,11 +1055,10 @@ class CI_Loader { * * Takes an object as input and converts the class variables to array key/vals * - * @access private * @param object * @return array */ - function _ci_object_to_array($object) + protected function _ci_object_to_array($object) { return (is_object($object)) ? get_object_vars($object) : $object; } @@ -1060,10 +1068,9 @@ class CI_Loader { /** * Get a reference to a specific library or model * - * @access private * @return bool */ - function &_ci_get_component($component) + protected function &_ci_get_component($component) { $CI =& get_instance(); return $CI->$component; @@ -1076,11 +1083,10 @@ class CI_Loader { * * This function preps the name of various items to make loading them more reliable. * - * @access private * @param mixed * @return array */ - function _ci_prep_filename($filename, $extension) + protected function _ci_prep_filename($filename, $extension) { if ( ! is_array($filename)) { -- cgit v1.2.3-24-g4f1b From b3e614d8b2293c079bcfb9cfdf071c041cbc4722 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Tue, 19 Apr 2011 20:19:17 -0500 Subject: Change in core/Security.php to match coding standards. --- system/core/Security.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system') diff --git a/system/core/Security.php b/system/core/Security.php index 4f91572ed..3617cadcc 100644 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -68,7 +68,8 @@ class CI_Security { } // Append application specific cookie prefix - if (config_item('cookie_prefix')) { + if (config_item('cookie_prefix')) + { $this->_csrf_cookie_name = config_item('cookie_prefix').$this->_csrf_cookie_name; } -- cgit v1.2.3-24-g4f1b From 0c9ee4a348a9e0c9ee6d6c0085e463e098e453f4 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Wed, 20 Apr 2011 09:40:17 -0500 Subject: Refactoring the loader to set protected class variables. Moved _ci_autoload(), which is used in CI_Controller to be a public method. Also added CI_Loader::set_base_classes() to be called in the controller so we're not setting protected vars in another class. Also refactored in the form_helper so it's not trying to access protected vars in CI_Loader. Added the is_loaded() method to the loader to take care of the checks that were being done there. --- system/core/Controller.php | 7 ++-- system/core/Loader.php | 75 +++++++++++++++++++++++++++++++----------- system/helpers/form_helper.php | 24 +++++++------- 3 files changed, 69 insertions(+), 37 deletions(-) (limited to 'system') diff --git a/system/core/Controller.php b/system/core/Controller.php index fd9c8b580..ec86b7920 100644 --- a/system/core/Controller.php +++ b/system/core/Controller.php @@ -48,12 +48,9 @@ class CI_Controller { $this->load =& load_class('Loader', 'core'); - $this->load->_base_classes =& is_loaded(); - - $this->load->ci_autoloader(); - + $this->load->set_base_classes()->ci_autoloader(); + log_message('debug', "Controller Class Initialized"); - } public static function &get_instance() diff --git a/system/core/Loader.php b/system/core/Loader.php index 8146cd563..a52ef288a 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -29,19 +29,19 @@ class CI_Loader { // All these are set automatically. Don't mess with them. - var $_ci_ob_level; - var $_ci_view_paths = array(); + protected $_ci_ob_level; + protected $_ci_view_paths = array(); protected $_ci_library_paths = array(); - var $_ci_model_paths = array(); - var $_ci_helper_paths = array(); - var $_base_classes = array(); // Set by the controller class - var $_ci_cached_vars = array(); - var $_ci_classes = array(); - var $_ci_loaded_files = array(); - var $_ci_models = array(); - var $_ci_helpers = array(); - var $_ci_varmap = array('unit_test' => 'unit', 'user_agent' => 'agent'); - + protected $_ci_model_paths = array(); + protected $_ci_helper_paths = array(); + protected $_base_classes = array(); // Set by the controller class + protected $_ci_cached_vars = array(); + protected $_ci_classes = array(); + protected $_ci_loaded_files = array(); + protected $_ci_models = array(); + protected $_ci_helpers = array(); + protected $_ci_varmap = array('unit_test' => 'unit', + 'user_agent' => 'agent'); /** * Constructor @@ -59,6 +59,47 @@ class CI_Loader { log_message('debug', "Loader Class Initialized"); } + // -------------------------------------------------------------------- + + /** + * Set _base_classes variable + * + * This method is called once in CI_Controller. + * + * @param array + * @return object + */ + public function set_base_classes() + { + $this->_base_classes =& is_loaded(); + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Is Loaded + * + * A utility function to test if a class is in the self::$_ci_classes array. + * This function returns the object name if the class tested for is loaded, + * and returns FALSE if it isn't. + * + * It is mainly used in the form_helper -> _get_validation_object() + * + * @param string class being checked for + * @return mixed class object name on the CI SuperObject or FALSE + */ + public function is_loaded($class) + { + if (isset($this->_ci_classes[$class])) + { + return $this->_ci_classes[$class]; + } + + return FALSE; + } + // -------------------------------------------------------------------- /** @@ -67,13 +108,12 @@ class CI_Loader { * This function lets users load and instantiate classes. * It is designed to be called from a user's app controllers. * - * @access public * @param string the name of the class * @param mixed the optional parameters * @param string an optional object name * @return void */ - function library($library = '', $params = NULL, $object_name = NULL) + public function library($library = '', $params = NULL, $object_name = NULL) { if (is_array($library)) { @@ -856,13 +896,12 @@ class CI_Loader { /** * Instantiates a class * - * @access private * @param string * @param string * @param string an optional object name * @return null */ - function _ci_init_class($class, $prefix = '', $config = FALSE, $object_name = NULL) + protected function _ci_init_class($class, $prefix = '', $config = FALSE, $object_name = NULL) { // Is there an associated config file for this class? Note: these should always be lowercase if ($config === NULL) @@ -1102,9 +1141,7 @@ class CI_Loader { return $filename; } } - - } /* End of file Loader.php */ -/* Location: ./system/core/Loader.php */ +/* Location: ./system/core/Loader.php */ \ No newline at end of file diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index a5cd97b82..51a9c6ca3 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -1032,22 +1032,20 @@ if ( ! function_exists('_get_validation_object')) { $CI =& get_instance(); - // We set this as a variable since we're returning by reference + // We set this as a variable since we're returning by reference. $return = FALSE; - - if ( ! isset($CI->load->_ci_classes) OR ! isset($CI->load->_ci_classes['form_validation'])) - { - return $return; - } - - $object = $CI->load->_ci_classes['form_validation']; - - if ( ! isset($CI->$object) OR ! is_object($CI->$object)) + + if ( ! ($object = $CI->load->is_loaded('form_validation'))) { - return $return; + if ( ! isset($CI->$object) OR ! is_object($CI->$object)) + { + return $return; + } + + return $CI->$object; } - - return $CI->$object; + + return $return; } } -- cgit v1.2.3-24-g4f1b From 50671cf8d67c805692fec49eda33d21227a21ec2 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Wed, 20 Apr 2011 11:36:45 -0500 Subject: Altered Session to use a longer match against the user_agent string. See upgrade notes if using database sessions.sess_match_useragent == TRUE AND trim($session['user_agent']) != trim(substr($this->CI->input->user_agent(), 0, 50))) + if ($this->sess_match_useragent == TRUE AND trim($session['user_agent']) != trim(substr($this->CI->input->user_agent(), 0, 120))) { $this->sess_destroy(); return FALSE; @@ -316,7 +316,7 @@ class CI_Session { $this->userdata = array( 'session_id' => md5(uniqid($sessid, TRUE)), 'ip_address' => $this->CI->input->ip_address(), - 'user_agent' => substr($this->CI->input->user_agent(), 0, 50), + 'user_agent' => substr($this->CI->input->user_agent(), 0, 120), 'last_activity' => $this->now ); -- cgit v1.2.3-24-g4f1b From e156c6eb4a018a91d3cfcaa2d1fd3b3e67dc2808 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Wed, 20 Apr 2011 16:03:04 -0500 Subject: Fixed a bug (Core #340) where when passing in the second parameter to $this->db->select(), column names in subsequent queries would not be properly escaped. --- system/database/DB_active_rec.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'system') diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index db8471364..9ceac0b76 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -58,6 +58,8 @@ class CI_DB_active_record extends CI_DB_driver { var $ar_cache_having = array(); var $ar_cache_orderby = array(); var $ar_cache_set = array(); + + var $ar_no_escape = array(); // -------------------------------------------------------------------- @@ -73,12 +75,6 @@ class CI_DB_active_record extends CI_DB_driver { */ function select($select = '*', $escape = NULL) { - // Set the global value if this was sepecified - if (is_bool($escape)) - { - $this->_protect_identifiers = $escape; - } - if (is_string($select)) { $select = explode(',', $select); @@ -91,6 +87,7 @@ class CI_DB_active_record extends CI_DB_driver { if ($val != '') { $this->ar_select[] = $val; + $this->ar_no_escape[] = $escape; if ($this->ar_caching === TRUE) { @@ -441,10 +438,10 @@ class CI_DB_active_record extends CI_DB_driver { $v = ' '.$this->escape($v); } - + if ( ! $this->_has_operator($k)) { - $k .= ' ='; + $k .= ' = '; } } else @@ -1718,7 +1715,7 @@ class CI_DB_active_record extends CI_DB_driver { // is because until the user calls the from() function we don't know if there are aliases foreach ($this->ar_select as $key => $val) { - $this->ar_select[$key] = $this->_protect_identifiers($val); + $this->ar_select[$key] = $this->_protect_identifiers($val, FALSE, $this->ar_no_escape[$key]); } $sql .= implode(', ', $this->ar_select); @@ -1753,9 +1750,7 @@ class CI_DB_active_record extends CI_DB_driver { if (count($this->ar_where) > 0 OR count($this->ar_like) > 0) { - $sql .= "\n"; - - $sql .= "WHERE "; + $sql .= "\nWHERE "; } $sql .= implode("\n", $this->ar_where); @@ -2032,6 +2027,7 @@ class CI_DB_active_record extends CI_DB_driver { 'ar_orderby' => array(), 'ar_wherein' => array(), 'ar_aliased_tables' => array(), + 'ar_no_escape' => array(), 'ar_distinct' => FALSE, 'ar_limit' => FALSE, 'ar_offset' => FALSE, -- cgit v1.2.3-24-g4f1b From 8807be35fe02a39624e62a412889e938b6a37691 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Thu, 21 Apr 2011 13:06:15 -0500 Subject: Flipping around contents of a conditional in _ci_load() so the small bits are on top. --- system/core/Loader.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'system') diff --git a/system/core/Loader.php b/system/core/Loader.php index a52ef288a..721c196cc 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -647,7 +647,12 @@ class CI_Loader { $file_exists = FALSE; // Set the path to the requested file - if ($_ci_path == '') + if ($_ci_path != '') + { + $_ci_x = explode('/', $_ci_path); + $_ci_file = end($_ci_x); + } + else { $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); $_ci_file = ($_ci_ext == '') ? $_ci_view.'.php' : $_ci_view; @@ -667,11 +672,6 @@ class CI_Loader { } } } - else - { - $_ci_x = explode('/', $_ci_path); - $_ci_file = end($_ci_x); - } if ( ! $file_exists && ! file_exists($_ci_path)) { -- cgit v1.2.3-24-g4f1b From d127e611c64fd1cf6a750b20c4e35b1158e06e27 Mon Sep 17 00:00:00 2001 From: katzgrau Date: Fri, 22 Apr 2011 10:59:25 -0400 Subject: Fixed re-searching for config file even though one had been loaded ($found was set to true, never reset). Also fixes getsparks issue. --- system/core/Config.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system') diff --git a/system/core/Config.php b/system/core/Config.php index 4493ff266..1096a9ea6 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -144,6 +144,7 @@ class CI_Config { $loaded = TRUE; log_message('debug', 'Config file loaded: '.$file_path); + break; } if ($loaded === FALSE) @@ -326,4 +327,4 @@ class CI_Config { // END CI_Config class /* End of file Config.php */ -/* Location: ./system/core/Config.php */ \ No newline at end of file +/* Location: ./system/core/Config.php */ -- cgit v1.2.3-24-g4f1b From c6d918ad24a8844e9de1e145f545bc9f2c7ca9a6 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Fri, 22 Apr 2011 10:17:32 -0500 Subject: Fix #233 Fixing a regression in _get_validation_object() in the form helper after some refactoring the other day. --- system/helpers/form_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 51a9c6ca3..16eb4b2c9 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -898,7 +898,7 @@ if ( ! function_exists('validation_errors')) function validation_errors($prefix = '', $suffix = '') { if (FALSE === ($OBJ =& _get_validation_object())) - { + {var_dump(_get_validation_object()); exit; return ''; } @@ -1035,7 +1035,7 @@ if ( ! function_exists('_get_validation_object')) // We set this as a variable since we're returning by reference. $return = FALSE; - if ( ! ($object = $CI->load->is_loaded('form_validation'))) + if (FALSE !== ($object = $CI->load->is_loaded('form_validation'))) { if ( ! isset($CI->$object) OR ! is_object($CI->$object)) { -- cgit v1.2.3-24-g4f1b From c0b133c02e057b6506726b794ba4582bf18ed663 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 22 Apr 2011 19:58:43 +0900 Subject: default value of $total_rows in Pagination class should be number. And fix User Guide Pagination Class's Example which uses string to number variable. --- system/libraries/Pagination.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index 1113f862f..cc62e660b 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -30,7 +30,7 @@ class CI_Pagination { var $prefix = ''; // A custom prefix added to the path. var $suffix = ''; // A custom suffix added to the path. - var $total_rows = ''; // Total number of items (database results) + var $total_rows = 0; // Total number of items (database results) var $per_page = 10; // Max number of items you want shown per page var $num_links = 2; // Number of "digit" links to show before/after the currently viewed page var $cur_page = 0; // The current page being viewed -- cgit v1.2.3-24-g4f1b From ee21a0eebfac7f3de810d9f8c4f8271944b336bf Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Fri, 22 Apr 2011 17:37:19 -0500 Subject: typo in modification to MySQLi driver. Fixes #236 --- system/database/drivers/mysqli/mysqli_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index 1949acb6e..b8586c21d 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -137,7 +137,7 @@ class CI_DB_mysqli_driver extends CI_DB { if ( ! isset($use_set_names)) { // mysqli_set_charset() requires MySQL >= 5.0.7, use SET NAMES as fallback - $use_set_names = (version_compare(mysql_get_server_info(), '5.0.7', '>=')) ? FALSE : TRUE; + $use_set_names = (version_compare(mysqli_get_server_info($this->conn_id), '5.0.7', '>=')) ? FALSE : TRUE; } if ($use_set_names) -- cgit v1.2.3-24-g4f1b From c83bea665eb3a441b6e52528f75fa4c71ca1f8c2 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Sat, 23 Apr 2011 12:12:57 -0500 Subject: Removing debug code accidentally committed. --- system/helpers/form_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 16eb4b2c9..2925d3c7c 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -898,7 +898,7 @@ if ( ! function_exists('validation_errors')) function validation_errors($prefix = '', $suffix = '') { if (FALSE === ($OBJ =& _get_validation_object())) - {var_dump(_get_validation_object()); exit; + { return ''; } -- cgit v1.2.3-24-g4f1b From c24f49b54f47229aa89781c0cc06c3d9fa947937 Mon Sep 17 00:00:00 2001 From: Razican Date: Mon, 25 Apr 2011 13:43:57 +0200 Subject: Fixed #60. --- system/libraries/Profiler.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'system') diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index b73ddaf0d..082a5ee1d 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -44,13 +44,13 @@ class CI_Profiler { 'session_data', 'config' ); - + protected $_query_toggle_count = 25; - - protected $CI; + + protected $CI; // -------------------------------------------------------------------- - + public function __construct($config = array()) { $this->CI =& get_instance(); @@ -188,22 +188,22 @@ class CI_Profiler { $highlight = array('SELECT', 'DISTINCT', 'FROM', 'WHERE', 'AND', 'LEFT JOIN', 'ORDER BY', 'GROUP BY', 'LIMIT', 'INSERT', 'INTO', 'VALUES', 'UPDATE', 'OR ', 'HAVING', 'OFFSET', 'NOT IN', 'IN', 'LIKE', 'NOT LIKE', 'COUNT', 'MAX', 'MIN', 'ON', 'AS', 'AVG', 'SUM', '(', ')'); $output = "\n\n"; - + $count = 0; - + foreach ($dbs as $db) { $count++; - + $hide_queries = (count($db->queries) > $this->_query_toggle_count) ? ' display:none' : ''; - + $show_hide_js = '('.$this->CI->lang->line('profiler_section_hide').')'; - + if ($hide_queries != '') { $show_hide_js = '('.$this->CI->lang->line('profiler_section_show').')'; } - + $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_database').':  '.$db->database.'   '.$this->CI->lang->line('profiler_queries').': '.count($db->queries).'  '.$show_hide_js.''; @@ -412,7 +412,7 @@ class CI_Profiler { } else { - $output .= "
".$this->CI->lang->line('profiler_no_memory_usage')."
"; + $output .= "
".$this->CI->lang->line('profiler_no_memory')."
"; } $output .= "
"; -- cgit v1.2.3-24-g4f1b From 114ab0988e20ac6be39ad363ff897a1a3b85e565 Mon Sep 17 00:00:00 2001 From: Razican Date: Mon, 25 Apr 2011 17:26:45 +0200 Subject: Fixed double-space typo. --- system/core/Benchmark.php | 4 +- system/core/CodeIgniter.php | 68 +++---- system/core/Common.php | 28 +-- system/core/Config.php | 18 +- system/core/Controller.php | 6 +- system/core/Exceptions.php | 6 +- system/core/Hooks.php | 4 +- system/core/Input.php | 24 +-- system/core/Lang.php | 2 +- system/core/Loader.php | 60 +++--- system/core/Model.php | 2 +- system/core/Output.php | 20 +- system/core/Router.php | 26 +-- system/core/Security.php | 104 +++++----- system/core/URI.php | 14 +- system/core/Utf8.php | 2 +- system/database/DB.php | 16 +- system/database/DB_active_rec.php | 32 +-- system/database/DB_cache.php | 6 +- system/database/DB_driver.php | 34 ++-- system/database/DB_forge.php | 2 +- system/database/DB_result.php | 106 +++++----- system/database/DB_utility.php | 6 +- system/database/drivers/mssql/mssql_driver.php | 2 +- system/database/drivers/mssql/mssql_forge.php | 4 +- system/database/drivers/mssql/mssql_result.php | 4 +- system/database/drivers/mssql/mssql_utility.php | 2 +- system/database/drivers/mysql/mysql_driver.php | 14 +- system/database/drivers/mysql/mysql_forge.php | 4 +- system/database/drivers/mysql/mysql_result.php | 4 +- system/database/drivers/mysql/mysql_utility.php | 4 +- system/database/drivers/mysqli/mysqli_driver.php | 8 +- system/database/drivers/mysqli/mysqli_forge.php | 4 +- system/database/drivers/mysqli/mysqli_result.php | 4 +- system/database/drivers/mysqli/mysqli_utility.php | 2 +- system/database/drivers/oci8/oci8_driver.php | 138 ++++++------- system/database/drivers/oci8/oci8_forge.php | 4 +- system/database/drivers/oci8/oci8_result.php | 34 ++-- system/database/drivers/oci8/oci8_utility.php | 2 +- system/database/drivers/odbc/odbc_driver.php | 2 +- system/database/drivers/odbc/odbc_forge.php | 4 +- system/database/drivers/odbc/odbc_result.php | 4 +- system/database/drivers/odbc/odbc_utility.php | 2 +- system/database/drivers/postgre/postgre_driver.php | 2 +- system/database/drivers/postgre/postgre_forge.php | 10 +- system/database/drivers/postgre/postgre_result.php | 4 +- .../database/drivers/postgre/postgre_utility.php | 2 +- system/database/drivers/sqlite/sqlite_driver.php | 2 +- system/database/drivers/sqlite/sqlite_forge.php | 6 +- system/database/drivers/sqlite/sqlite_result.php | 4 +- system/database/drivers/sqlite/sqlite_utility.php | 4 +- system/helpers/array_helper.php | 8 +- system/helpers/captcha_helper.php | 20 +- system/helpers/cookie_helper.php | 6 +- system/helpers/date_helper.php | 22 +-- system/helpers/directory_helper.php | 4 +- system/helpers/download_helper.php | 2 +- system/helpers/email_helper.php | 2 +- system/helpers/file_helper.php | 4 +- system/helpers/form_helper.php | 18 +- system/helpers/html_helper.php | 10 +- system/helpers/inflector_helper.php | 14 +- system/helpers/language_helper.php | 2 +- system/helpers/number_helper.php | 2 +- system/helpers/path_helper.php | 4 +- system/helpers/security_helper.php | 4 +- system/helpers/smiley_helper.php | 12 +- system/helpers/string_helper.php | 8 +- system/helpers/text_helper.php | 10 +- system/helpers/typography_helper.php | 2 +- system/helpers/url_helper.php | 6 +- system/helpers/xml_helper.php | 4 +- system/language/english/email_lang.php | 6 +- system/language/english/imglib_lang.php | 10 +- system/libraries/Cache/Cache.php | 30 +-- system/libraries/Cache/drivers/Cache_apc.php | 24 +-- system/libraries/Cache/drivers/Cache_file.php | 40 ++-- system/libraries/Calendar.php | 18 +- system/libraries/Cart.php | 22 +-- system/libraries/Driver.php | 2 +- system/libraries/Email.php | 46 ++--- system/libraries/Encrypt.php | 2 +- system/libraries/Form_validation.php | 32 +-- system/libraries/Ftp.php | 8 +- system/libraries/Image_lib.php | 118 +++++------ system/libraries/Javascript.php | 12 +- system/libraries/Log.php | 8 +- system/libraries/Pagination.php | 18 +- system/libraries/Parser.php | 18 +- system/libraries/Profiler.php | 26 +-- system/libraries/Session.php | 30 +-- system/libraries/Sha1.php | 8 +- system/libraries/Table.php | 12 +- system/libraries/Trackback.php | 16 +- system/libraries/Typography.php | 36 ++-- system/libraries/Unit_test.php | 2 +- system/libraries/Upload.php | 28 +-- system/libraries/User_agent.php | 2 +- system/libraries/Xmlrpc.php | 90 ++++----- system/libraries/Xmlrpcs.php | 44 ++--- system/libraries/Zip.php | 12 +- system/libraries/javascript/Jquery.php | 218 ++++++++++----------- 102 files changed, 986 insertions(+), 986 deletions(-) (limited to 'system') diff --git a/system/core/Benchmark.php b/system/core/Benchmark.php index 515550e9f..3686c2d73 100644 --- a/system/core/Benchmark.php +++ b/system/core/Benchmark.php @@ -1,4 +1,4 @@ -_call_hook('pre_system'); /* * ------------------------------------------------------ - * Instantiate the config class + * Instantiate the config class * ------------------------------------------------------ */ $CFG =& load_class('Config', 'core'); @@ -143,7 +143,7 @@ /* * ------------------------------------------------------ - * Instantiate the UTF-8 class + * Instantiate the UTF-8 class * ------------------------------------------------------ * * Note: Order here is rather important as the UTF-8 @@ -157,14 +157,14 @@ /* * ------------------------------------------------------ - * Instantiate the URI class + * Instantiate the URI class * ------------------------------------------------------ */ $URI =& load_class('URI', 'core'); /* * ------------------------------------------------------ - * Instantiate the routing class and set the routing + * Instantiate the routing class and set the routing * ------------------------------------------------------ */ $RTR =& load_class('Router', 'core'); @@ -178,14 +178,14 @@ /* * ------------------------------------------------------ - * Instantiate the output class + * Instantiate the output class * ------------------------------------------------------ */ $OUT =& load_class('Output', 'core'); /* * ------------------------------------------------------ - * Is there a valid cache file? If so, we're done... + * Is there a valid cache file? If so, we're done... * ------------------------------------------------------ */ if ($EXT->_call_hook('cache_override') === FALSE) @@ -205,21 +205,21 @@ /* * ------------------------------------------------------ - * Load the Input class and sanitize globals + * Load the Input class and sanitize globals * ------------------------------------------------------ */ $IN =& load_class('Input', 'core'); /* * ------------------------------------------------------ - * Load the Language class + * Load the Language class * ------------------------------------------------------ */ $LANG =& load_class('Lang', 'core'); /* * ------------------------------------------------------ - * Load the app controller and local controller + * Load the app controller and local controller * ------------------------------------------------------ * */ @@ -252,14 +252,14 @@ /* * ------------------------------------------------------ - * Security check + * Security check * ------------------------------------------------------ * - * None of the functions in the app controller or the - * loader class can be called via the URI, nor can - * controller functions that begin with an underscore + * None of the functions in the app controller or the + * loader class can be called via the URI, nor can + * controller functions that begin with an underscore */ - $class = $RTR->fetch_class(); + $class = $RTR->fetch_class(); $method = $RTR->fetch_method(); if ( ! class_exists($class) @@ -272,14 +272,14 @@ /* * ------------------------------------------------------ - * Is there a "pre_controller" hook? + * Is there a "pre_controller" hook? * ------------------------------------------------------ */ $EXT->_call_hook('pre_controller'); /* * ------------------------------------------------------ - * Instantiate the requested controller + * Instantiate the requested controller * ------------------------------------------------------ */ // Mark a start point so we can benchmark the controller @@ -289,14 +289,14 @@ /* * ------------------------------------------------------ - * Is there a "post_controller_constructor" hook? + * Is there a "post_controller_constructor" hook? * ------------------------------------------------------ */ $EXT->_call_hook('post_controller_constructor'); /* * ------------------------------------------------------ - * Call the requested method + * Call the requested method * ------------------------------------------------------ */ // Is there a "remap" function? If so, we call it instead @@ -345,14 +345,14 @@ /* * ------------------------------------------------------ - * Is there a "post_controller" hook? + * Is there a "post_controller" hook? * ------------------------------------------------------ */ $EXT->_call_hook('post_controller'); /* * ------------------------------------------------------ - * Send the final rendered output to the browser + * Send the final rendered output to the browser * ------------------------------------------------------ */ if ($EXT->_call_hook('display_override') === FALSE) @@ -362,14 +362,14 @@ /* * ------------------------------------------------------ - * Is there a "post_system" hook? + * Is there a "post_system" hook? * ------------------------------------------------------ */ $EXT->_call_hook('post_system'); /* * ------------------------------------------------------ - * Close the DB connection if one exists + * Close the DB connection if one exists * ------------------------------------------------------ */ if (class_exists('CI_DB') AND isset($CI->db)) diff --git a/system/core/Common.php b/system/core/Common.php index d1e8e77e9..eb9e14425 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -1,4 +1,4 @@ -show_php_error($severity, $message, $filepath, $line); } - // Should we log the error? No? We're done... + // Should we log the error? No? We're done... if (config_item('log_threshold') == 0) { return; @@ -479,16 +479,16 @@ function remove_invisible_characters($str, $url_encoded = TRUE) { $non_displayables = array(); - + // every control character except newline (dec 10) // carriage return (dec 13), and horizontal tab (dec 09) - + if ($url_encoded) { $non_displayables[] = '/%0[0-8bcef]/'; // url encoded 00-08, 11, 12, 14, 15 $non_displayables[] = '/%1[0-9a-f]/'; // url encoded 16-31 } - + $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 do diff --git a/system/core/Config.php b/system/core/Config.php index 1096a9ea6..fa71f4d3d 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -1,4 +1,4 @@ -load =& load_class('Loader', 'core'); $this->load->set_base_classes()->ci_autoloader(); - + log_message('debug', "Controller Class Initialized"); } diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index bff86a92f..2503c907f 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -1,4 +1,4 @@ -ob_level = ob_get_level(); - // Note: Do not log messages from this constructor. + // Note: Do not log messages from this constructor. } // -------------------------------------------------------------------- @@ -75,7 +75,7 @@ class CI_Exceptions { { $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; - log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE); + log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE); } // -------------------------------------------------------------------- diff --git a/system/core/Hooks.php b/system/core/Hooks.php index fd6380f0a..ffb3258d8 100644 --- a/system/core/Hooks.php +++ b/system/core/Hooks.php @@ -1,4 +1,4 @@ -_fetch_from_array($_POST, $index, $xss_clean); } @@ -201,7 +201,7 @@ class CI_Input { * @param mixed * @param string the value of the cookie * @param string the number of seconds until expiration - * @param string the cookie domain. Usually: .yourdomain.com + * @param string the cookie domain. Usually: .yourdomain.com * @param string the cookie path * @param string the cookie prefix * @param bool true makes the cookie secure @@ -402,9 +402,9 @@ class CI_Input { function _sanitize_globals() { // It would be "wrong" to unset any of these GLOBALS. - $protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST', + $protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST', '_SESSION', '_ENV', 'GLOBALS', 'HTTP_RAW_POST_DATA', - 'system_folder', 'application_folder', 'BM', 'EXT', + 'system_folder', 'application_folder', 'BM', 'EXT', 'CFG', 'URI', 'RTR', 'OUT', 'IN'); // Unset globals for securiy. @@ -523,7 +523,7 @@ class CI_Input { { $str = $this->uni->clean_string($str); } - + // Remove control characters $str = remove_invisible_characters($str); @@ -579,7 +579,7 @@ class CI_Input { /** * Request Headers * - * In Apache, you can simply call apache_request_headers(), however for + * In Apache, you can simply call apache_request_headers(), however for * people running other webservers the function is undefined. * * @return array @@ -609,10 +609,10 @@ class CI_Input { { $key = str_replace('_', ' ', strtolower($key)); $key = str_replace(' ', '-', ucwords($key)); - + $this->headers[$key] = $val; } - + return $this->headers; } @@ -633,7 +633,7 @@ class CI_Input { { $this->request_headers(); } - + if ( ! isset($this->headers[$index])) { return FALSE; @@ -644,7 +644,7 @@ class CI_Input { return $this->security->xss_clean($this->headers[$index]); } - return $this->headers[$index]; + return $this->headers[$index]; } // -------------------------------------------------------------------- diff --git a/system/core/Lang.php b/system/core/Lang.php index 170e6c725..79eb443a0 100644 --- a/system/core/Lang.php +++ b/system/core/Lang.php @@ -1,4 +1,4 @@ - 'unit', + protected $_ci_varmap = array('unit_test' => 'unit', 'user_agent' => 'agent'); /** @@ -50,29 +50,29 @@ class CI_Loader { */ public function __construct() { - $this->_ci_ob_level = ob_get_level(); + $this->_ci_ob_level = ob_get_level(); $this->_ci_library_paths = array(APPPATH, BASEPATH); $this->_ci_helper_paths = array(APPPATH, BASEPATH); $this->_ci_model_paths = array(APPPATH); $this->_ci_view_paths = array(APPPATH.'views/' => TRUE); - + log_message('debug', "Loader Class Initialized"); } // -------------------------------------------------------------------- - + /** * Set _base_classes variable * * This method is called once in CI_Controller. * - * @param array + * @param array * @return object */ public function set_base_classes() { $this->_base_classes =& is_loaded(); - + return $this; } @@ -96,7 +96,7 @@ class CI_Loader { { return $this->_ci_classes[$class]; } - + return FALSE; } @@ -260,7 +260,7 @@ class CI_Loader { return DB($params, $active_record); } - // Initialize the db variable. Needed to prevent + // Initialize the db variable. Needed to prevent // reference errors with some configurations $CI->db = ''; @@ -323,11 +323,11 @@ class CI_Loader { /** * Load View * - * This function is used to load a "view" file. It has three parameters: + * This function is used to load a "view" file. It has three parameters: * * 1. The name of the "view" file to be included. * 2. An associative array of data to be extracted for use in the view. - * 3. TRUE/FALSE - whether to return the data or load it. In + * 3. TRUE/FALSE - whether to return the data or load it. In * some cases it's advantageous to be able to return data so that * a developer can process it in some way. * @@ -538,13 +538,13 @@ class CI_Loader { * Prepends a parent path to the library, model, helper, and config path arrays * * @param string - * @param boolean + * @param boolean * @return void */ public function add_package_path($path, $view_cascade=TRUE) { $path = rtrim($path, '/').'/'; - + array_unshift($this->_ci_library_paths, $path); array_unshift($this->_ci_model_paths, $path); array_unshift($this->_ci_helper_paths, $path); @@ -604,7 +604,7 @@ class CI_Loader { unset($this->{$var}[$key]); } } - + if (isset($this->_ci_view_paths[$path.'views/'])) { unset($this->_ci_view_paths[$path.'views/']); @@ -643,7 +643,7 @@ class CI_Loader { { $$_ci_val = ( ! isset($_ci_data[$_ci_val])) ? FALSE : $_ci_data[$_ci_val]; } - + $file_exists = FALSE; // Set the path to the requested file @@ -665,11 +665,11 @@ class CI_Loader { $file_exists = TRUE; break; } - + if ( ! $cascade) { break; - } + } } } @@ -710,9 +710,9 @@ class CI_Loader { * We buffer the output for two reasons: * 1. Speed. You get a significant speed boost. * 2. So that the final rendered template can be - * post-processed by the output class. Why do we - * need post processing? For one thing, in order to - * show the elapsed page load time. Unless we + * post-processed by the output class. Why do we + * need post processing? For one thing, in order to + * show the elapsed page load time. Unless we * can intercept the content right before it's sent to * the browser and then stop the timer it won't be accurate. */ @@ -809,11 +809,11 @@ class CI_Loader { show_error("Unable to load the requested class: ".$class); } - // Safety: Was the class already loaded by a previous call? + // Safety: Was the class already loaded by a previous call? if (in_array($subclass, $this->_ci_loaded_files)) { // Before we deem this to be a duplicate request, let's see - // if a custom object name is being supplied. If so, we'll + // if a custom object name is being supplied. If so, we'll // return a new instance of the object if ( ! is_null($object_name)) { @@ -842,17 +842,17 @@ class CI_Loader { { $filepath = $path.'libraries/'.$subdir.$class.'.php'; - // Does the file exist? No? Bummer... + // Does the file exist? No? Bummer... if ( ! file_exists($filepath)) { continue; } - // Safety: Was the class already loaded by a previous call? + // Safety: Was the class already loaded by a previous call? if (in_array($filepath, $this->_ci_loaded_files)) { // Before we deem this to be a duplicate request, let's see - // if a custom object name is being supplied. If so, we'll + // if a custom object name is being supplied. If so, we'll // return a new instance of the object if ( ! is_null($object_name)) { @@ -875,7 +875,7 @@ class CI_Loader { } // END FOREACH - // One last attempt. Maybe the library is in a subdirectory, but it wasn't specified? + // One last attempt. Maybe the library is in a subdirectory, but it wasn't specified? if ($subdir == '') { $path = strtolower($class).'/'.$class; @@ -903,7 +903,7 @@ class CI_Loader { */ protected function _ci_init_class($class, $prefix = '', $config = FALSE, $object_name = NULL) { - // Is there an associated config file for this class? Note: these should always be lowercase + // Is there an associated config file for this class? Note: these should always be lowercase if ($config === NULL) { // Fetch the config paths containing any package paths @@ -970,7 +970,7 @@ class CI_Loader { } // Set the variable name we will assign the class to - // Was a custom class name supplied? If so we'll use it + // Was a custom class name supplied? If so we'll use it $class = strtolower($class); if (is_null($object_name)) @@ -1005,7 +1005,7 @@ class CI_Loader { * The config/autoload.php file contains an array that permits sub-systems, * libraries, and helpers to be loaded automatically. * - * This function is public, as it's used in the CI_Controller class. + * This function is public, as it's used in the CI_Controller class. * However, there is no reason you should ever needs to use it. * * @param array @@ -1021,7 +1021,7 @@ class CI_Loader { { include_once(APPPATH.'config/autoload.php'); } - + if ( ! isset($autoload)) { diff --git a/system/core/Model.php b/system/core/Model.php index 8566a0b66..61c71b672 100644 --- a/system/core/Model.php +++ b/system/core/Model.php @@ -1,4 +1,4 @@ -final_output * * This function sends the finalized output data to the browser along - * with any server headers and profile data. It also stops the + * with any server headers and profile data. It also stops the * benchmark timer so the page rendering speed and memory usage can be shown. * * @access public @@ -269,7 +269,7 @@ class CI_Output { */ function _display($output = '') { - // Note: We use globals because we can't use $CI =& get_instance() + // Note: We use globals because we can't use $CI =& get_instance() // since this function is sometimes called by the caching mechanism, // which happens before the CI super object is available. global $BM, $CFG; @@ -290,7 +290,7 @@ class CI_Output { // -------------------------------------------------------------------- - // Do we need to write a cache file? Only if the controller does not have its + // Do we need to write a cache file? Only if the controller does not have its // own _output() method and we are not dealing with a cache file, which we // can determine by the existence of the $CI object above if ($this->cache_expiration > 0 && isset($CI) && ! method_exists($CI, '_output')) @@ -368,7 +368,7 @@ class CI_Output { // we will remove them and add them back after we insert the profile data if (preg_match("|.*?|is", $output)) { - $output = preg_replace("|.*?|is", '', $output); + $output = preg_replace("|.*?|is", '', $output); $output .= $CI->profiler->run(); $output .= ''; } @@ -381,14 +381,14 @@ class CI_Output { // -------------------------------------------------------------------- // Does the controller contain a function named _output()? - // If so send the output there. Otherwise, echo it. + // If so send the output there. Otherwise, echo it. if (method_exists($CI, '_output')) { $CI->_output($output); } else { - echo $output; // Send it to the browser! + echo $output; // Send it to the browser! } log_message('debug', "Final output sent to browser"); @@ -458,7 +458,7 @@ class CI_Output { { $cache_path = ($CFG->item('cache_path') == '') ? APPPATH.'cache/' : $CFG->item('cache_path'); - // Build the file path. The file name is an MD5 hash of the full URI + // Build the file path. The file name is an MD5 hash of the full URI $uri = $CFG->item('base_url'). $CFG->item('index_page'). $URI->uri_string; diff --git a/system/core/Router.php b/system/core/Router.php index 5e92a04b1..a76a7bd0a 100644 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -1,4 +1,4 @@ -routes = ( ! isset($route) OR ! is_array($route)) ? array() : $route; unset($route); @@ -103,7 +103,7 @@ class CI_Router { // 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']); - // Were there any query string segments? If so, we'll validate them and bail out since we're done. + // Were there any query string segments? If so, we'll validate them and bail out since we're done. if (count($segments) > 0) { return $this->_validate_request($segments); @@ -212,7 +212,7 @@ class CI_Router { // -------------------------------------------------------------------- /** - * Validates the supplied segments. Attempts to determine the path to + * Validates the supplied segments. Attempts to determine the path to * the controller. * * @access private @@ -277,7 +277,7 @@ class CI_Router { // If we've gotten this far it means that the URI does not correlate to a valid - // controller class. We will now see if there is an override + // controller class. We will now see if there is an override if ( ! empty($this->routes['404_override'])) { $x = explode('/', $this->routes['404_override']); @@ -296,7 +296,7 @@ class CI_Router { // -------------------------------------------------------------------- /** - * Parse Routes + * Parse Routes * * This function matches any routes that may exist in * the config/routes.php file against the URI to @@ -310,7 +310,7 @@ class CI_Router { // Turn the segment array into a URI string $uri = implode('/', $this->uri->segments); - // Is there a literal match? If so we're done + // Is there a literal match? If so we're done if (isset($this->routes[$uri])) { return $this->_set_request(explode('/', $this->routes[$uri])); @@ -370,7 +370,7 @@ class CI_Router { // -------------------------------------------------------------------- /** - * Set the method name + * Set the method name * * @access public * @param string @@ -384,7 +384,7 @@ class CI_Router { // -------------------------------------------------------------------- /** - * Fetch the current method + * Fetch the current method * * @access public * @return string @@ -402,7 +402,7 @@ class CI_Router { // -------------------------------------------------------------------- /** - * Set the directory name + * Set the directory name * * @access public * @param string @@ -416,7 +416,7 @@ class CI_Router { // -------------------------------------------------------------------- /** - * Fetch the sub-directory (if any) that contains the requested controller class + * Fetch the sub-directory (if any) that contains the requested controller class * * @access public * @return string @@ -429,7 +429,7 @@ class CI_Router { // -------------------------------------------------------------------- /** - * Set the controller overrides + * Set the controller overrides * * @access public * @param array diff --git a/system/core/Security.php b/system/core/Security.php index 3617cadcc..f5bfafd9b 100644 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -1,4 +1,4 @@ - '[removed]', // IE, surprise! "Redirect\s+302" => '[removed]' ); - + /** * Constructor */ @@ -95,7 +95,7 @@ class CI_Security { } // Do the tokens exist in both the _POST and _COOKIE arrays? - if ( ! isset($_POST[$this->_csrf_token_name]) OR + if ( ! isset($_POST[$this->_csrf_token_name]) OR ! isset($_COOKIE[$this->_csrf_cookie_name])) { $this->csrf_show_error(); @@ -107,7 +107,7 @@ class CI_Security { $this->csrf_show_error(); } - // We kill this since we're done and we don't want to + // We kill this since we're done and we don't want to // polute the _POST array unset($_POST[$this->_csrf_token_name]); @@ -117,7 +117,7 @@ class CI_Security { $this->csrf_set_cookie(); log_message('debug', "CSRF token verified "); - + return $this; } @@ -146,7 +146,7 @@ class CI_Security { setcookie($this->_csrf_cookie_name, $this->_csrf_hash, $expire, config_item('cookie_path'), config_item('cookie_domain'), $secure_cookie); log_message('debug', "CRSF cookie Set"); - + return $this; } @@ -165,9 +165,9 @@ class CI_Security { // -------------------------------------------------------------------- /** - * Get CSRF Hash + * Get CSRF Hash * - * Getter Method + * Getter Method * * @return string self::_csrf_hash */ @@ -196,14 +196,14 @@ class CI_Security { * XSS Clean * * Sanitizes data so that Cross Site Scripting Hacks can be - * prevented. This function does a fair amount of work but + * prevented. This function does a fair amount of work but * it is extremely thorough, designed to prevent even the - * most obscure XSS attempts. Nothing is ever 100% foolproof, + * most obscure XSS attempts. Nothing is ever 100% foolproof, * of course, but I haven't been able to get anything passed * the filter. * * Note: This function should only be used to deal with data - * upon submission. It's not something that should + * upon submission. It's not something that should * be used for general runtime processing. * * This function was based in part on some code and ideas I @@ -263,7 +263,7 @@ class CI_Security { */ $str = preg_replace_callback("/[a-z]+=([\'\"]).*?\\1/si", array($this, '_convert_attribute'), $str); - + $str = preg_replace_callback("/<\w+.*?(?=>|<|$)/si", array($this, '_decode_entity'), $str); /* @@ -276,7 +276,7 @@ class CI_Security { * * This prevents strings like this: ja vascript * NOTE: we deal with spaces between characters later. - * NOTE: preg_replace was found to be amazingly slow here on + * NOTE: preg_replace was found to be amazingly slow here on * large blocks of data, so we use str_replace. */ @@ -304,27 +304,27 @@ class CI_Security { */ if ($is_image === TRUE) { - // Images have a tendency to have the PHP short opening and - // closing tags every so often so we skip those and only + // Images have a tendency to have the PHP short opening and + // closing tags every so often so we skip those and only // do the long opening tags. $str = preg_replace('/<\?(php)/i', "<?\\1", $str); } else { - $str = str_replace(array(''), array('<?', '?>'), $str); + $str = str_replace(array(''), array('<?', '?>'), $str); } /* * Compact any exploded words * - * This corrects words like: j a v a s c r i p t + * This corrects words like: j a v a s c r i p t * These words are compacted back to their correct state. */ $words = array( - 'javascript', 'expression', 'vbscript', 'script', + 'javascript', 'expression', 'vbscript', 'script', 'applet', 'alert', 'document', 'write', 'cookie', 'window' ); - + foreach ($words as $word) { $temp = ''; @@ -341,8 +341,8 @@ class CI_Security { /* * Remove disallowed Javascript in links or img tags - * We used to do some version comparisons and use of stripos for PHP5, - * but it is dog slow compared to these simplified non-capturing + * We used to do some version comparisons and use of stripos for PHP5, + * but it is dog slow compared to these simplified non-capturing * preg_match(), especially if the pattern exists in the string */ do @@ -388,7 +388,7 @@ class CI_Security { * * Similar to above, only instead of looking for * tags it looks for PHP and JavaScript commands - * that are disallowed. Rather than removing the + * that are disallowed. Rather than removing the * code, it simply converts the parenthesis to entities * rendering the code un-executable. * @@ -405,11 +405,11 @@ class CI_Security { /* * Images are Handled in a Special Way - * - Essentially, we want to know that after all of the character - * conversion is done whether any unwanted, likely XSS, code was found. + * - Essentially, we want to know that after all of the character + * conversion is done whether any unwanted, likely XSS, code was found. * If not, we return TRUE, as the image is clean. - * However, if the string post-conversion does not matched the - * string post-removal of XSS, then it fails, as there was unwanted XSS + * However, if the string post-conversion does not matched the + * string post-removal of XSS, then it fails, as there was unwanted XSS * code found and removed/changed during processing. */ @@ -457,7 +457,7 @@ class CI_Security { * * In some versions of PHP the native function does not work * when UTF-8 is the specified character set, so this gives us - * a work-around. More info here: + * a work-around. More info here: * http://bugs.php.net/bug.php?id=25670 * * NOTE: html_entity_decode() has a bug in some PHP versions when UTF-8 is the @@ -475,10 +475,10 @@ class CI_Security { // The reason we are not using html_entity_decode() by itself is because // while it is not technically correct to leave out the semicolon // at the end of an entity most browsers will still interpret the entity - // correctly. html_entity_decode() does not convert entities without + // correctly. html_entity_decode() does not convert entities without // semicolons, so we are left with our own little solution here. Bummer. - if (function_exists('html_entity_decode') && + if (function_exists('html_entity_decode') && (strtolower($charset) != 'utf-8')) { $str = html_entity_decode($str, ENT_COMPAT, $charset); @@ -542,7 +542,7 @@ class CI_Security { "%3b", // ; "%3d" // = ); - + if ( ! $relative_path) { $bad[] = './'; @@ -570,7 +570,7 @@ class CI_Security { } // -------------------------------------------------------------------- - + /* * Remove Evil HTML Attributes (like evenhandlers and style) * @@ -578,7 +578,7 @@ class CI_Security { * - Everything up until a space * For example, everything between the pipes: * - * - Everything inside the quotes + * - Everything inside the quotes * For example, everything between the pipes: * * @@ -594,12 +594,12 @@ class CI_Security { if ($is_image === TRUE) { /* - * Adobe Photoshop puts XML metadata into JFIF images, + * Adobe Photoshop puts XML metadata into JFIF images, * including namespacing, so we have to allow this for images. */ unset($evil_attributes[array_search('xmlns', $evil_attributes)]); } - + do { $str = preg_replace( "#<(/?[^><]+?)([^A-Za-z\-])(".implode('|', $evil_attributes).")(\s*=\s*)([\"][^>]*?[\"]|[\'][^>]*?[\']|[^>]*?)([\s><])([><]*)#i", @@ -607,10 +607,10 @@ class CI_Security { $str, -1, $count ); } while ($count); - + return $str; } - + // -------------------------------------------------------------------- /** @@ -627,7 +627,7 @@ class CI_Security { $str = '<'.$matches[1].$matches[2].$matches[3]; // encode captured opening or closing brace to prevent recursive vectors - $str .= str_replace(array('>', '<'), array('>', '<'), + $str .= str_replace(array('>', '<'), array('>', '<'), $matches[4]); return $str; @@ -649,7 +649,7 @@ class CI_Security { protected function _js_link_removal($match) { $attributes = $this->_filter_attributes(str_replace(array('<', '>'), '', $match[1])); - + return str_replace($match[1], preg_replace("#href=.*?(alert\(|alert&\#40;|javascript\:|livescript\:|mocha\:|charset\=|window\.|document\.|\.cookie|_filter_attributes(str_replace(array('<', '>'), '', $match[1])); - + return str_replace($match[1], preg_replace("#src=.*?(alert\(|alert&\#40;|javascript\:|livescript\:|mocha\:|charset\=|window\.|document\.|\.cookie|xss_hash()."\\1=\\2", $str); /* * Validate standard character entities * - * Add a semicolon if missing. We do this to enable + * Add a semicolon if missing. We do this to enable * the conversion of entities to ASCII later. * */ @@ -769,7 +769,7 @@ class CI_Security { * Un-Protect GET variables in URLs */ $str = str_replace($this->xss_hash(), '&', $str); - + return $str; } @@ -794,7 +794,7 @@ class CI_Security { { $str = preg_replace("#".$key."#i", $val, $str); } - + return $str; } @@ -809,16 +809,16 @@ class CI_Security { { if ($this->_csrf_hash == '') { - // If the cookie exists we will use it's value. + // If the cookie exists we will use it's value. // We don't necessarily want to regenerate it with - // each page load since a page could contain embedded + // each page load since a page could contain embedded // sub-pages causing this feature to fail - if (isset($_COOKIE[$this->_csrf_cookie_name]) && + if (isset($_COOKIE[$this->_csrf_cookie_name]) && $_COOKIE[$this->_csrf_cookie_name] != '') { return $this->_csrf_hash = $_COOKIE[$this->_csrf_cookie_name]; } - + return $this->_csrf_hash = md5(uniqid(rand(), TRUE)); } diff --git a/system/core/URI.php b/system/core/URI.php index d56548654..94fac59ac 100644 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -1,4 +1,4 @@ -_set_uri_string($path); @@ -251,7 +251,7 @@ class CI_URI { */ function _remove_url_suffix() { - if ($this->config->item('url_suffix') != "") + if ($this->config->item('url_suffix') != "") { $this->uri_string = preg_replace("|".preg_quote($this->config->item('url_suffix'))."$|", "", $this->uri_string); } @@ -285,7 +285,7 @@ class CI_URI { * Re-index Segments * * This function re-indexes the $this->segment array so that it - * starts at 1 rather than 0. Doing so makes it simpler to + * starts at 1 rather than 0. Doing so makes it simpler to * use functions like $this->uri->segment(n) since there is * a 1:1 relationship between the segment array and the actual segments. * @@ -323,7 +323,7 @@ class CI_URI { * Fetch a URI "routed" Segment * * This function returns the re-routed URI segment (assuming routing rules are used) - * based on the number provided. If there is no routing this function returns the + * based on the number provided. If there is no routing this function returns the * same result as $this->segment() * * @access public @@ -425,7 +425,7 @@ class CI_URI { $i = 0; $lastval = ''; - $retval = array(); + $retval = array(); foreach ($segments as $seg) { if ($i % 2) diff --git a/system/core/Utf8.php b/system/core/Utf8.php index 2a27d1f35..738d7e9d8 100644 --- a/system/core/Utf8.php +++ b/system/core/Utf8.php @@ -1,4 +1,4 @@ -_track_aliases($val); @@ -332,7 +332,7 @@ class CI_DB_active_record extends CI_DB_driver { } } - // Extract any aliases that might exist. We use this information + // Extract any aliases that might exist. We use this information // in the _protect_identifiers to know whether to add a table prefix $this->_track_aliases($table); @@ -438,7 +438,7 @@ class CI_DB_active_record extends CI_DB_driver { $v = ' '.$this->escape($v); } - + if ( ! $this->_has_operator($k)) { $k .= ' = '; @@ -926,7 +926,7 @@ class CI_DB_active_record extends CI_DB_driver { // -------------------------------------------------------------------- /** - * The "set" function. Allows key/value pairs to be set for inserting or updating + * The "set" function. Allows key/value pairs to be set for inserting or updating * * @access public * @param mixed @@ -1084,7 +1084,7 @@ class CI_DB_active_record extends CI_DB_driver { { if ($this->db_debug) { - //No valid data array. Folds in cases where keys and values did not match up + //No valid data array. Folds in cases where keys and values did not match up return $this->display_error('db_must_use_set'); } return FALSE; @@ -1124,7 +1124,7 @@ class CI_DB_active_record extends CI_DB_driver { // -------------------------------------------------------------------- /** - * The "set_insert_batch" function. Allows key/value pairs to be set for batch inserts + * The "set_insert_batch" function. Allows key/value pairs to be set for batch inserts * * @access public * @param mixed @@ -1158,7 +1158,7 @@ class CI_DB_active_record extends CI_DB_driver { if ($escape === FALSE) { - $this->ar_set[] = '('.implode(',', $row).')'; + $this->ar_set[] = '('.implode(',', $row).')'; } else { @@ -1169,7 +1169,7 @@ class CI_DB_active_record extends CI_DB_driver { $clean[] = $this->escape($value); } - $this->ar_set[] = '('.implode(',', $clean).')'; + $this->ar_set[] = '('.implode(',', $clean).')'; } } @@ -1399,7 +1399,7 @@ class CI_DB_active_record extends CI_DB_driver { // -------------------------------------------------------------------- /** - * The "set_update_batch" function. Allows key/value pairs to be set for batch updating + * The "set_update_batch" function. Allows key/value pairs to be set for batch updating * * @access public * @param array @@ -1652,7 +1652,7 @@ class CI_DB_active_record extends CI_DB_driver { return; } - // Does the string contain a comma? If so, we need to separate + // Does the string contain a comma? If so, we need to separate // the string into discreet statements if (strpos($table, ',') !== FALSE) { @@ -1682,7 +1682,7 @@ class CI_DB_active_record extends CI_DB_driver { * Compile the SELECT statement * * Generates a query string based on which functions were used. - * Should not be called directly. The get() function calls it. + * Should not be called directly. The get() function calls it. * * @access private * @return string @@ -1989,7 +1989,7 @@ class CI_DB_active_record extends CI_DB_driver { // -------------------------------------------------------------------- /** - * Resets the active record values. Called by the get() function + * Resets the active record values. Called by the get() function * * @access private * @param array An array of fields to reset @@ -2009,7 +2009,7 @@ class CI_DB_active_record extends CI_DB_driver { // -------------------------------------------------------------------- /** - * Resets the active record values. Called by the get() function + * Resets the active record values. Called by the get() function * * @access private * @return void diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 3bf065ca5..3249e9d8e 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -1,4 +1,4 @@ -CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); + $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); } if ($segment_two == '') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 10e8ed0c0..40be2f903 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -1,4 +1,4 @@ -conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect(); - // No connection resource? Throw an error + // No connection resource? Throw an error if ( ! $this->conn_id) { log_message('error', 'Unable to connect to the database'); @@ -199,7 +199,7 @@ class CI_DB_driver { // -------------------------------------------------------------------- /** - * Database Version Number. Returns a string containing the + * Database Version Number. Returns a string containing the * version of the database being used * * @access public @@ -237,7 +237,7 @@ class CI_DB_driver { * Execute the query * * Accepts an SQL string as input and returns a result object upon - * successful execution of a "read" type query. Returns boolean TRUE + * successful execution of a "read" type query. Returns boolean TRUE * upon successful execution of a "write" type query. Returns boolean * FALSE upon failure, and if the $db_debug variable is set to TRUE * will raise an error. @@ -265,7 +265,7 @@ class CI_DB_driver { $sql = preg_replace("/(\W)".$this->swap_pre."(\S+?)/", "\\1".$this->dbprefix."\\2", $sql); } - // Is query caching enabled? If the query is a "read type" + // Is query caching enabled? If the query is a "read type" // we will load the caching class and return the previously // cached query if it exists if ($this->cache_on == TRUE AND stristr($sql, 'SELECT')) @@ -286,7 +286,7 @@ class CI_DB_driver { $sql = $this->compile_binds($sql, $binds); } - // Save the query for debugging + // Save the query for debugging if ($this->save_queries == TRUE) { $this->queries[] = $sql; @@ -314,7 +314,7 @@ class CI_DB_driver { $error_msg = $this->_error_message(); // We call this function in order to roll-back queries - // if transactions are enabled. If we don't call this here + // if transactions are enabled. If we don't call this here // the error message will trigger an exit, causing the // transactions to remain in limbo. $this->trans_complete(); @@ -385,7 +385,7 @@ class CI_DB_driver { // oci8 vars must be set before calling this $RES->num_rows = $RES->num_rows(); - // Is query caching enabled? If so, we'll serialize the + // Is query caching enabled? If so, we'll serialize the // result object and save it to a cache file. if ($this->cache_on == TRUE AND $this->_cache_init()) { @@ -435,7 +435,7 @@ class CI_DB_driver { /** * Simple Query - * This is a simplified version of the query() function. Internally + * This is a simplified version of the query() function. Internally * we only use it when running transaction commands since they do * not require all the features of the main query() function. * @@ -718,7 +718,7 @@ class CI_DB_driver { /** * Primary * - * Retrieves the primary key. It assumes that the row in the first + * Retrieves the primary key. It assumes that the row in the first * position is the primary key * * @access public @@ -1216,8 +1216,8 @@ class CI_DB_driver { * This function is used extensively by the Active Record class, and by * a couple functions in this class. * It takes a column or table name (optionally with an alias) and inserts - * the table prefix onto it. Some logic is necessary in order to deal with - * column names that include the path. Consider a query like this: + * the table prefix onto it. Some logic is necessary in order to deal with + * column names that include the path. Consider a query like this: * * SELECT * FROM hostname.database.table.column AS c FROM hostname.database.table * @@ -1270,7 +1270,7 @@ class CI_DB_driver { // This is basically a bug fix for queries that use MAX, MIN, etc. // If a parenthesis is found we know that we do not need to - // escape the data or add a prefix. There's probably a more graceful + // escape the data or add a prefix. There's probably a more graceful // way to deal with this, but I'm not thinking of it -- Rick if (strpos($item, '(') !== FALSE) { @@ -1285,7 +1285,7 @@ class CI_DB_driver { $parts = explode('.', $item); // Does the first segment of the exploded item match - // one of the aliases previously identified? If so, + // one of the aliases previously identified? If so, // we have nothing more to do other than escape the item if (in_array($parts[0], $this->ar_aliased_tables)) { @@ -1304,7 +1304,7 @@ class CI_DB_driver { return $item.$alias; } - // Is there a table prefix defined in the config file? If not, no need to do anything + // Is there a table prefix defined in the config file? If not, no need to do anything if ($this->dbprefix != '') { // We now add the table prefix based on some logic. @@ -1358,7 +1358,7 @@ class CI_DB_driver { return $item.$alias; } - // Is there a table prefix? If not, no need to insert it + // Is there a table prefix? If not, no need to insert it if ($this->dbprefix != '') { // Verify table prefix and replace if necessary diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index a71fca78f..9730c7761 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -1,4 +1,4 @@ -result_array(); - else if ($type == 'object') return $this->result_object(); - else return $this->custom_result_object($type); + if ($type == 'array') return $this->result_array(); + else if ($type == 'object') return $this->result_object(); + else return $this->custom_result_object($type); } // -------------------------------------------------------------------- - /** - * Custom query result. - * - * @param class_name A string that represents the type of object you want back - * @return array of objects - */ - function custom_result_object($class_name) - { - if (array_key_exists($class_name, $this->custom_result_object)) - { - return $this->custom_result_object[$class_name]; - } - - if ($this->result_id === FALSE OR $this->num_rows() == 0) - { - return array(); - } - - // add the data to the object - $this->_data_seek(0); - $result_object = array(); + /** + * Custom query result. + * + * @param class_name A string that represents the type of object you want back + * @return array of objects + */ + function custom_result_object($class_name) + { + if (array_key_exists($class_name, $this->custom_result_object)) + { + return $this->custom_result_object[$class_name]; + } + + if ($this->result_id === FALSE OR $this->num_rows() == 0) + { + return array(); + } + + // add the data to the object + $this->_data_seek(0); + $result_object = array(); while ($row = $this->_fetch_object()) - { - $object = new $class_name(); - foreach ($row as $key => $value) - { - $object->$key = $value; - } + { + $object = new $class_name(); + foreach ($row as $key => $value) + { + $object->$key = $value; + } $result_object[] = $object; } - // return the array - return $this->custom_result_object[$class_name] = $result_object; - } + // return the array + return $this->custom_result_object[$class_name] = $result_object; + } /** - * Query result. "object" version. + * Query result. "object" version. * * @access public * @return object @@ -122,7 +122,7 @@ class CI_DB_result { // -------------------------------------------------------------------- /** - * Query result. "array" version. + * Query result. "array" version. * * @access public * @return array @@ -154,7 +154,7 @@ class CI_DB_result { // -------------------------------------------------------------------- /** - * Query result. Acts as a wrapper function for the following functions. + * Query result. Acts as a wrapper function for the following functions. * * @access public * @param string @@ -180,9 +180,9 @@ class CI_DB_result { $n = 0; } - if ($type == 'object') return $this->row_object($n); - else if ($type == 'array') return $this->row_array($n); - else return $this->custom_row_object($n, $type); + if ($type == 'object') return $this->row_object($n); + else if ($type == 'array') return $this->row_array($n); + else return $this->custom_row_object($n, $type); } // -------------------------------------------------------------------- @@ -219,7 +219,7 @@ class CI_DB_result { // -------------------------------------------------------------------- - /** + /** * Returns a single result row - custom object version * * @access public @@ -242,7 +242,7 @@ class CI_DB_result { return $result[$this->current_row]; } - /** + /** * Returns a single result row - object version * * @access public @@ -383,9 +383,9 @@ class CI_DB_result { /** * The following functions are normally overloaded by the identically named * methods in the platform-specific driver -- except when query caching - * is used. When caching is enabled we do not load the other driver. + * is used. When caching is enabled we do not load the other driver. * These functions are primarily here to prevent undefined function errors - * when a cached result object is in use. They are not otherwise fully + * when a cached result object is in use. They are not otherwise fully * operational due to the unavailability of the database resource IDs with * cached results. */ diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index a5f174f0a..a3c00a5a6 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -1,4 +1,4 @@ -db->db_debug) { diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 65397ed8f..56ecf32d1 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -1,4 +1,4 @@ -db->_protect_identifiers($field); - $sql .= ' '.$attributes['TYPE']; + $sql .= ' '.$attributes['TYPE']; if (array_key_exists('CONSTRAINT', $attributes)) { diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php index 2897ca5a5..f1f6dbb84 100644 --- a/system/database/drivers/mssql/mssql_result.php +++ b/system/database/drivers/mssql/mssql_result.php @@ -1,4 +1,4 @@ -= 5.2.3 and MySQL >= 5.0.7, use SET NAMES as fallback @@ -302,12 +302,12 @@ class CI_DB_mysql_driver extends CI_DB { if (is_array($str)) { foreach ($str as $key => $val) - { + { $str[$key] = $this->escape_str($val, $like); - } + } - return $str; - } + return $str; + } if (function_exists('mysql_real_escape_string') AND is_resource($this->conn_id)) { @@ -650,7 +650,7 @@ class CI_DB_mysql_driver extends CI_DB { { if ($field != $index) { - $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; + $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; } } } diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php index 529ec980d..5328a7b4e 100644 --- a/system/database/drivers/mysql/mysql_forge.php +++ b/system/database/drivers/mysql/mysql_forge.php @@ -1,4 +1,4 @@ -= 5.0.7, use SET NAMES as fallback @@ -568,7 +568,7 @@ class CI_DB_mysqli_driver extends CI_DB { { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values); } - + // -------------------------------------------------------------------- /** @@ -630,7 +630,7 @@ class CI_DB_mysqli_driver extends CI_DB { { if ($field != $index) { - $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; + $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; } } } diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php index d5097335e..6450968dd 100644 --- a/system/database/drivers/mysqli/mysqli_forge.php +++ b/system/database/drivers/mysqli/mysqli_forge.php @@ -1,4 +1,4 @@ - format - * value no the value of the parameter. If this is an OUT or IN OUT parameter, + * value no the value of the parameter. If this is an OUT or IN OUT parameter, * this should be a reference to a variable * type yes the type of the parameter * length yes the max size of the parameter @@ -275,8 +275,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * Bind parameters * - * @access private - * @return none + * @access private + * @return none */ function _bind_params($params) { @@ -386,10 +386,10 @@ class CI_DB_oci8_driver extends CI_DB { /** * Escape String * - * @access public - * @param string + * @access public + * @param string * @param bool whether or not the string will be used in a LIKE condition - * @return string + * @return string */ function escape_str($str, $like = FALSE) { @@ -421,8 +421,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * Affected Rows * - * @access public - * @return integer + * @access public + * @return integer */ function affected_rows() { @@ -434,8 +434,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * Insert ID * - * @access public - * @return integer + * @access public + * @return integer */ function insert_id() { @@ -451,9 +451,9 @@ class CI_DB_oci8_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public - * @param string - * @return string + * @access public + * @param string + * @return string */ function count_all($table = '') { @@ -480,9 +480,9 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private + * @access private * @param boolean - * @return string + * @return string */ function _list_tables($prefix_limit = FALSE) { @@ -503,9 +503,9 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access public - * @param string the table name - * @return string + * @access public + * @param string the table name + * @return string */ function _list_columns($table = '') { @@ -519,9 +519,9 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @access public - * @param string the table name - * @return object + * @access public + * @param string the table name + * @return object */ function _field_data($table) { @@ -533,8 +533,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * The error message string * - * @access private - * @return string + * @access private + * @return string */ function _error_message() { @@ -547,8 +547,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * The error message number * - * @access private - * @return integer + * @access private + * @return integer */ function _error_number() { @@ -627,11 +627,11 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public - * @param string the table name - * @param array the insert keys - * @param array the insert values - * @return string + * @access public + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string */ function _insert($table, $keys, $values) { @@ -732,11 +732,11 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * - * @access public - * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value - * @return string + * @access public + * @param string the sql query string + * @param integer the number of rows to limit the query to + * @param integer the offset value + * @return string */ function _limit($sql, $limit, $offset) { @@ -759,9 +759,9 @@ class CI_DB_oci8_driver extends CI_DB { /** * Close DB Connection * - * @access public - * @param resource - * @return void + * @access public + * @param resource + * @return void */ function _close($conn_id) { diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php index 3cd17585a..589e3c29d 100644 --- a/system/database/drivers/oci8/oci8_forge.php +++ b/system/database/drivers/oci8/oci8_forge.php @@ -1,4 +1,4 @@ -db->_protect_identifiers($field); - $sql .= ' '.$attributes['TYPE']; + $sql .= ' '.$attributes['TYPE']; if (array_key_exists('CONSTRAINT', $attributes)) { diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index 88531b436..60d8396ef 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -1,4 +1,4 @@ -name = ocicolumnname($this->stmt_id, $c); $F->type = ocicolumntype($this->stmt_id, $c); - $F->max_length = ocicolumnsize($this->stmt_id, $c); + $F->max_length = ocicolumnsize($this->stmt_id, $c); $retval[] = $F; } @@ -145,8 +145,8 @@ class CI_DB_oci8_result extends CI_DB_result { * * Returns the result set as an array * - * @access private - * @return array + * @access private + * @return array */ function _fetch_assoc(&$row) { @@ -162,8 +162,8 @@ class CI_DB_oci8_result extends CI_DB_result { * * Returns the result set as an object * - * @access private - * @return object + * @access private + * @return object */ function _fetch_object() { @@ -202,10 +202,10 @@ class CI_DB_oci8_result extends CI_DB_result { // -------------------------------------------------------------------- /** - * Query result. "array" version. + * Query result. "array" version. * - * @access public - * @return array + * @access public + * @return array */ function result_array() { @@ -230,7 +230,7 @@ class CI_DB_oci8_result extends CI_DB_result { /** * Data Seek * - * Moves the internal pointer to the desired offset. We call + * Moves the internal pointer to the desired offset. We call * this internally before fetching results to make sure the * result set starts at zero * diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php index 854b467e1..f1fe5dc00 100644 --- a/system/database/drivers/oci8/oci8_utility.php +++ b/system/database/drivers/oci8/oci8_utility.php @@ -1,4 +1,4 @@ -db->_protect_identifiers($field); - $sql .= ' '.$attributes['TYPE']; + $sql .= ' '.$attributes['TYPE']; if (array_key_exists('CONSTRAINT', $attributes)) { diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php index 5d64a464f..d83b2e5f0 100644 --- a/system/database/drivers/odbc/odbc_result.php +++ b/system/database/drivers/odbc/odbc_result.php @@ -1,4 +1,4 @@ -db->_protect_identifiers($field); - $sql .= ' '.$attributes['TYPE']; + $sql .= ' '.$attributes['TYPE']; if (array_key_exists('CONSTRAINT', $attributes)) { @@ -172,7 +172,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { /** * Drop Table * - * Unsupported feature in SQLite + * Unsupported feature in SQLite * * @access private * @return bool diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php index 7bd30db7c..62204946c 100644 --- a/system/database/drivers/sqlite/sqlite_result.php +++ b/system/database/drivers/sqlite/sqlite_result.php @@ -1,4 +1,4 @@ -text. To close fieldset + * Used to produce
text. To close fieldset * use form_fieldset_close() * * @access public @@ -663,7 +663,7 @@ if ( ! function_exists('form_prep')) * Form Value * * Grabs a value from the POST array for the specified field so you can - * re-populate an input field or textarea. If Form Validation + * re-populate an input field or textarea. If Form Validation * is active it retrieves the info from the validation class * * @access public @@ -858,7 +858,7 @@ if ( ! function_exists('set_radio')) /** * Form Error * - * Returns the error for a specific form field. This is a helper for the + * Returns the error for a specific form field. This is a helper for the * form validation class. * * @access public @@ -885,7 +885,7 @@ if ( ! function_exists('form_error')) /** * Validation Error String * - * Returns all the errors associated with a form submission. This is a helper + * Returns all the errors associated with a form submission. This is a helper * function for the form validation class. * * @access public @@ -1034,17 +1034,17 @@ if ( ! function_exists('_get_validation_object')) // We set this as a variable since we're returning by reference. $return = FALSE; - + if (FALSE !== ($object = $CI->load->is_loaded('form_validation'))) { if ( ! isset($CI->$object) OR ! is_object($CI->$object)) { return $return; } - + return $CI->$object; } - + return $return; } } diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 080f622dd..bd66bc2d0 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -1,4 +1,4 @@ -\n"; - // Cycle through the list elements. If an array is + // Cycle through the list elements. If an array is // encountered we will recursively call _list() static $_last_list_item = ''; @@ -244,7 +244,7 @@ if ( ! function_exists('img')) * Generates a page document type declaration * * Valid options are xhtml-11, xhtml-strict, xhtml-trans, xhtml-frame, - * html4-strict, html4-trans, and html4-frame. Values are saved in the + * html4-strict, html4-trans, and html4-frame. Values are saved in the * doctypes config file. * * @access public diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index c7c113b8a..2352b642e 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -1,4 +1,4 @@ -'), array('<?php', '<?PHP', '<?', '?>'), $str); + return str_replace(array(''), array('<?php', '<?PHP', '<?', '?>'), $str); } } diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php index 6d8889354..22ca4df77 100644 --- a/system/helpers/smiley_helper.php +++ b/system/helpers/smiley_helper.php @@ -1,4 +1,4 @@ - $val) { // Keep duplicates from being used, which can happen if the - // mapping array contains multiple identical replacements. For example: + // mapping array contains multiple identical replacements. For example: // :-) and :) might be replaced with the same image so both smileys // will be in the array. if (isset($used[$smileys[$key][0]])) @@ -204,7 +204,7 @@ if ( ! function_exists('parse_smileys')) } // Add a trailing slash to the file path if needed - $image_url = preg_replace("/(.+?)\/*$/", "\\1/", $image_url); + $image_url = preg_replace("/(.+?)\/*$/", "\\1/", $image_url); foreach ($smileys as $key => $val) { @@ -231,13 +231,13 @@ if ( ! function_exists('_get_smiley_array')) { if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php')) { - include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'); + include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'); } elseif (file_exists(APPPATH.'config/smileys.php')) { include(APPPATH.'config/smileys.php'); } - + if (isset($smileys) AND is_array($smileys)) { return $smileys; diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index 7765bba31..9f730bd10 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -1,4 +1,4 @@ - $val) { - $x[] = ' '.$key.'="'; + $x[] = ' '.$key.'="'; for ($i = 0; $i < strlen($val); $i++) { $x[] = "|".ord(substr($val, $i, 1)); @@ -363,7 +363,7 @@ if ( ! function_exists('safe_mailto')) * * Automatically links URL and Email addresses. * Note: There's a bit of extra code here to deal with - * URLs or emails that end in a period. We'll strip these + * URLs or emails that end in a period. We'll strip these * off and add them after the link. * * @access public diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php index cdd81ad70..2219d662a 100644 --- a/system/helpers/xml_helper.php +++ b/system/helpers/xml_helper.php @@ -1,4 +1,4 @@ -","\"", "'", "-"), diff --git a/system/language/english/email_lang.php b/system/language/english/email_lang.php index e3bd113cb..fe4276822 100644 --- a/system/language/english/email_lang.php +++ b/system/language/english/email_lang.php @@ -5,9 +5,9 @@ $lang['email_invalid_address'] = "Invalid email address: %s"; $lang['email_attachment_missing'] = "Unable to locate the following email attachment: %s"; $lang['email_attachment_unreadable'] = "Unable to open this attachment: %s"; $lang['email_no_recipients'] = "You must include recipients: To, Cc, or Bcc"; -$lang['email_send_failure_phpmail'] = "Unable to send email using PHP mail(). Your server might not be configured to send mail using this method."; -$lang['email_send_failure_sendmail'] = "Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method."; -$lang['email_send_failure_smtp'] = "Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method."; +$lang['email_send_failure_phpmail'] = "Unable to send email using PHP mail(). Your server might not be configured to send mail using this method."; +$lang['email_send_failure_sendmail'] = "Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method."; +$lang['email_send_failure_smtp'] = "Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method."; $lang['email_sent'] = "Your message has been successfully sent using the following protocol: %s"; $lang['email_no_socket'] = "Unable to open a socket to Sendmail. Please check settings."; $lang['email_no_hostname'] = "You did not specify a SMTP hostname."; diff --git a/system/language/english/imglib_lang.php b/system/language/english/imglib_lang.php index 66505da07..0a56fe0a5 100644 --- a/system/language/english/imglib_lang.php +++ b/system/language/english/imglib_lang.php @@ -4,20 +4,20 @@ $lang['imglib_source_image_required'] = "You must specify a source image in your $lang['imglib_gd_required'] = "The GD image library is required for this feature."; $lang['imglib_gd_required_for_props'] = "Your server must support the GD image library in order to determine the image properties."; $lang['imglib_unsupported_imagecreate'] = "Your server does not support the GD function required to process this type of image."; -$lang['imglib_gif_not_supported'] = "GIF images are often not supported due to licensing restrictions. You may have to use JPG or PNG images instead."; +$lang['imglib_gif_not_supported'] = "GIF images are often not supported due to licensing restrictions. You may have to use JPG or PNG images instead."; $lang['imglib_jpg_not_supported'] = "JPG images are not supported."; $lang['imglib_png_not_supported'] = "PNG images are not supported."; $lang['imglib_jpg_or_png_required'] = "The image resize protocol specified in your preferences only works with JPEG or PNG image types."; -$lang['imglib_copy_error'] = "An error was encountered while attempting to replace the file. Please make sure your file directory is writable."; +$lang['imglib_copy_error'] = "An error was encountered while attempting to replace the file. Please make sure your file directory is writable."; $lang['imglib_rotate_unsupported'] = "Image rotation does not appear to be supported by your server."; -$lang['imglib_libpath_invalid'] = "The path to your image library is not correct. Please set the correct path in your image preferences."; -$lang['imglib_image_process_failed'] = "Image processing failed. Please verify that your server supports the chosen protocol and that the path to your image library is correct."; +$lang['imglib_libpath_invalid'] = "The path to your image library is not correct. Please set the correct path in your image preferences."; +$lang['imglib_image_process_failed'] = "Image processing failed. Please verify that your server supports the chosen protocol and that the path to your image library is correct."; $lang['imglib_rotation_angle_required'] = "An angle of rotation is required to rotate the image."; $lang['imglib_writing_failed_gif'] = "GIF image."; $lang['imglib_invalid_path'] = "The path to the image is not correct."; $lang['imglib_copy_failed'] = "The image copy routine failed."; $lang['imglib_missing_font'] = "Unable to find a font to use."; -$lang['imglib_save_failed'] = "Unable to save the image. Please make sure the image and file directory are writable."; +$lang['imglib_save_failed'] = "Unable to save the image. Please make sure the image and file directory are writable."; /* End of file imglib_lang.php */ diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index 61e7aa761..938c80857 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -10,22 +10,22 @@ * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 2.0 - * @filesource + * @filesource */ // ------------------------------------------------------------------------ /** - * CodeIgniter Caching Class + * CodeIgniter Caching Class * * @package CodeIgniter * @subpackage Libraries * @category Core * @author ExpressionEngine Dev Team - * @link + * @link */ class CI_Cache extends CI_Driver_Library { - + protected $valid_drivers = array( 'cache_apc', 'cache_file', 'cache_memcached', 'cache_dummy' ); @@ -33,7 +33,7 @@ class CI_Cache extends CI_Driver_Library { protected $_cache_path = NULL; // Path of cache files (if file-based cache) protected $_adapter = 'dummy'; protected $_backup_driver; - + // ------------------------------------------------------------------------ /** @@ -52,16 +52,16 @@ class CI_Cache extends CI_Driver_Library { // ------------------------------------------------------------------------ /** - * Get + * Get * - * Look for a value in the cache. If it exists, return the data + * Look for a value in the cache. If it exists, return the data * if not, return FALSE * - * @param string + * @param string * @return mixed value that is stored/FALSE on failure */ public function get($id) - { + { return $this->{$this->_adapter}->get($id); } @@ -112,7 +112,7 @@ class CI_Cache extends CI_Driver_Library { * Cache Info * * @param string user/filehits - * @return mixed array on success, false on failure + * @return mixed array on success, false on failure */ public function cache_info($type = 'user') { @@ -120,7 +120,7 @@ class CI_Cache extends CI_Driver_Library { } // ------------------------------------------------------------------------ - + /** * Get Cache Metadata * @@ -131,7 +131,7 @@ class CI_Cache extends CI_Driver_Library { { return $this->{$this->_adapter}->get_metadata($id); } - + // ------------------------------------------------------------------------ /** @@ -139,11 +139,11 @@ class CI_Cache extends CI_Driver_Library { * * Initialize class properties based on the configuration array. * - * @param array + * @param array * @return void */ private function _initialize($config) - { + { $default_config = array( 'adapter', 'memcached' @@ -207,7 +207,7 @@ class CI_Cache extends CI_Driver_Library { return $obj; } - + // ------------------------------------------------------------------------ } // End Class diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php index de75719c4..ea129eded 100644 --- a/system/libraries/Cache/drivers/Cache_apc.php +++ b/system/libraries/Cache/drivers/Cache_apc.php @@ -10,30 +10,30 @@ * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 2.0 - * @filesource + * @filesource */ // ------------------------------------------------------------------------ /** - * CodeIgniter APC Caching Class + * CodeIgniter APC Caching Class * * @package CodeIgniter * @subpackage Libraries * @category Core * @author ExpressionEngine Dev Team - * @link + * @link */ class CI_Cache_apc extends CI_Driver { /** - * Get + * Get * - * Look for a value in the cache. If it exists, return the data + * Look for a value in the cache. If it exists, return the data * if not, return FALSE * - * @param string + * @param string * @return mixed value that is stored/FALSE on failure */ public function get($id) @@ -43,8 +43,8 @@ class CI_Cache_apc extends CI_Driver { return (is_array($data)) ? $data[0] : FALSE; } - // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ + /** * Cache Save * @@ -58,7 +58,7 @@ class CI_Cache_apc extends CI_Driver { { return apc_store($id, array($data, time(), $ttl), $ttl); } - + // ------------------------------------------------------------------------ /** @@ -90,7 +90,7 @@ class CI_Cache_apc extends CI_Driver { * Cache Info * * @param string user/filehits - * @return mixed array on success, false on failure + * @return mixed array on success, false on failure */ public function cache_info($type = NULL) { @@ -137,13 +137,13 @@ class CI_Cache_apc extends CI_Driver { log_message('error', 'The APC PHP extension must be loaded to use APC Cache.'); return FALSE; } - + return TRUE; } // ------------------------------------------------------------------------ - + } // End Class diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index 13e2d1af6..39dcd15c2 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -10,19 +10,19 @@ * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 2.0 - * @filesource + * @filesource */ // ------------------------------------------------------------------------ /** - * CodeIgniter Memcached Caching Class + * CodeIgniter Memcached Caching Class * * @package CodeIgniter * @subpackage Libraries * @category Core * @author ExpressionEngine Dev Team - * @link + * @link */ class CI_Cache_file extends CI_Driver { @@ -36,9 +36,9 @@ class CI_Cache_file extends CI_Driver { { $CI =& get_instance(); $CI->load->helper('file'); - + $path = $CI->config->item('cache_path'); - + $this->_cache_path = ($path == '') ? APPPATH.'cache/' : $path; } @@ -56,16 +56,16 @@ class CI_Cache_file extends CI_Driver { { return FALSE; } - + $data = read_file($this->_cache_path.$id); $data = unserialize($data); - - if (time() > $data['time'] + $data['ttl']) + + if (time() > $data['time'] + $data['ttl']) { unlink($this->_cache_path.$id); return FALSE; } - + return $data['data']; } @@ -76,22 +76,22 @@ class CI_Cache_file extends CI_Driver { * * @param string unique key * @param mixed data to store - * @param int length of time (in seconds) the cache is valid + * @param int length of time (in seconds) the cache is valid * - Default is 60 seconds * @return boolean true on success/false on failure */ public function save($id, $data, $ttl = 60) - { + { $contents = array( 'time' => time(), - 'ttl' => $ttl, + 'ttl' => $ttl, 'data' => $data ); - + if (write_file($this->_cache_path.$id, serialize($contents))) { @chmod($this->_cache_path.$id, 0777); - return TRUE; + return TRUE; } return FALSE; @@ -116,7 +116,7 @@ class CI_Cache_file extends CI_Driver { * Clean the Cache * * @return boolean false on failure/true on success - */ + */ public function clean() { return delete_files($this->_cache_path); @@ -151,10 +151,10 @@ class CI_Cache_file extends CI_Driver { { return FALSE; } - - $data = read_file($this->_cache_path.$id); + + $data = read_file($this->_cache_path.$id); $data = unserialize($data); - + if (is_array($data)) { $data = $data['data']; @@ -170,7 +170,7 @@ class CI_Cache_file extends CI_Driver { 'mtime' => $mtime ); } - + return FALSE; } @@ -180,7 +180,7 @@ class CI_Cache_file extends CI_Driver { * Is supported * * In the file driver, check to see that the cache directory is indeed writable - * + * * @return boolean */ public function is_supported() diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php index df0fd6eeb..7dcbaab47 100644 --- a/system/libraries/Calendar.php +++ b/system/libraries/Calendar.php @@ -1,4 +1,4 @@ -local_time); + $year = date("Y", $this->local_time); if ($month == '') $month = date("m", $this->local_time); @@ -128,7 +128,7 @@ class CI_Calendar { // Set the starting day number $local_date = mktime(12, 0, 0, $month, 1, $year); $date = getdate($local_date); - $day = $start_day + 1 - $date["wday"]; + $day = $start_day + 1 - $date["wday"]; while ($day > 1) { @@ -157,8 +157,8 @@ class CI_Calendar { // "previous" month link if ($this->show_next_prev == TRUE) { - // Add a trailing slash to the URL if needed - $this->next_prev_url = preg_replace("/(.+?)\/*$/", "\\1/", $this->next_prev_url); + // Add a trailing slash to the URL if needed + $this->next_prev_url = preg_replace("/(.+?)\/*$/", "\\1/", $this->next_prev_url); $adjusted_date = $this->adjust_date($month - 1, $year); $out .= str_replace('{previous_url}', $this->next_prev_url.$adjusted_date['year'].'/'.$adjusted_date['month'], $this->temp['heading_previous_cell']); @@ -233,7 +233,7 @@ class CI_Calendar { $out .= $this->temp['cal_cell_blank']; } - $out .= ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_end_today'] : $this->temp['cal_cell_end']; + $out .= ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_end_today'] : $this->temp['cal_cell_end']; $day++; } @@ -287,7 +287,7 @@ class CI_Calendar { * Get Day Names * * Returns an array of day names (Sunday, Monday, etc.) based - * on the type. Options: long, short, abrev + * on the type. Options: long, short, abrev * * @access public * @param string @@ -404,7 +404,7 @@ class CI_Calendar { */ function default_template() { - return array ( + return array ( 'table_open' => '
', 'heading_row_start' => '', 'heading_previous_cell' => '', @@ -451,7 +451,7 @@ class CI_Calendar { $today = array('cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today'); - foreach (array('table_open', 'table_close', 'heading_row_start', 'heading_previous_cell', 'heading_title_cell', 'heading_next_cell', 'heading_row_end', 'week_row_start', 'week_day_cell', 'week_row_end', 'cal_row_start', 'cal_cell_start', 'cal_cell_content', 'cal_cell_no_content', 'cal_cell_blank', 'cal_cell_end', 'cal_row_end', 'cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today') as $val) + foreach (array('table_open', 'table_close', 'heading_row_start', 'heading_previous_cell', 'heading_title_cell', 'heading_next_cell', 'heading_row_end', 'week_row_start', 'week_day_cell', 'week_row_end', 'cal_row_start', 'cal_cell_start', 'cal_cell_content', 'cal_cell_no_content', 'cal_cell_blank', 'cal_cell_end', 'cal_row_end', 'cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today') as $val) { if (preg_match("/\{".$val."\}(.*?)\{\/".$val."\}/si", $this->template, $match)) { diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index 7f65b48b9..fbccfb3d9 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -1,4 +1,4 @@ -CI =& get_instance(); - // Are any config settings being passed manually? If so, set them + // Are any config settings being passed manually? If so, set them $config = array(); if (count($params) > 0) { @@ -148,7 +148,7 @@ class CI_Cart { // -------------------------------------------------------------------- - // Does the $items array contain an id, quantity, price, and name? These are required + // Does the $items array contain an id, quantity, price, and name? These are required if ( ! isset($items['id']) OR ! isset($items['qty']) OR ! isset($items['price']) OR ! isset($items['name'])) { log_message('error', 'The cart array must contain a product ID, quantity, price, and name.'); @@ -157,7 +157,7 @@ class CI_Cart { // -------------------------------------------------------------------- - // Prep the quantity. It can only be a number. Duh... + // Prep the quantity. It can only be a number. Duh... $items['qty'] = trim(preg_replace('/([^0-9])/i', '', $items['qty'])); // Trim any leading zeros $items['qty'] = trim(preg_replace('/(^[0]+)/i', '', $items['qty'])); @@ -175,7 +175,7 @@ class CI_Cart { // Note: These can be user-specified by setting the $this->product_id_rules variable. if ( ! preg_match("/^[".$this->product_id_rules."]+$/i", $items['id'])) { - log_message('error', 'Invalid product ID. The product ID can only contain alpha-numeric characters, dashes, and underscores'); + log_message('error', 'Invalid product ID. The product ID can only contain alpha-numeric characters, dashes, and underscores'); return FALSE; } @@ -191,7 +191,7 @@ class CI_Cart { // -------------------------------------------------------------------- - // Prep the price. Remove anything that isn't a number or decimal point. + // Prep the price. Remove anything that isn't a number or decimal point. $items['price'] = trim(preg_replace('/([^0-9\.])/i', '', $items['price'])); // Trim any leading zeros $items['price'] = trim(preg_replace('/(^[0]+)/i', '', $items['price'])); @@ -210,7 +210,7 @@ class CI_Cart { // Each row in the cart array, however, must have a unique index that identifies not only // a particular product, but makes it possible to store identical products with different options. // For example, what if someone buys two identical t-shirts (same product ID), but in - // different sizes? The product ID (and other attributes, like the name) will be identical for + // different sizes? The product ID (and other attributes, like the name) will be identical for // both sizes because it's the same shirt. The only difference will be the size. // Internally, we need to treat identical submissions, but with different options, as a unique product. // Our solution is to convert the options array to a string and MD5 it along with the product ID. @@ -271,7 +271,7 @@ class CI_Cart { } // You can either update a single product using a one-dimensional array, - // or multiple products using a multi-dimensional one. The way we + // or multiple products using a multi-dimensional one. The way we // determine the array type is by looking for a required array key named "id". // If it's not found we assume it's a multi-dimensional array $save_cart = FALSE; @@ -344,7 +344,7 @@ class CI_Cart { return FALSE; } - // Is the quantity zero? If so we will remove the item from the cart. + // Is the quantity zero? If so we will remove the item from the cart. // If the quantity is greater than zero we are updating if ($items['qty'] == 0) { @@ -392,7 +392,7 @@ class CI_Cart { $this->_cart_contents['total_items'] = count($this->_cart_contents); $this->_cart_contents['cart_total'] = $total; - // Is our cart empty? If so we delete it from the session + // Is our cart empty? If so we delete it from the session if (count($this->_cart_contents) <= 2) { $this->CI->session->unset_userdata('cart_contents'); diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index d1925c0ec..b90b5aba6 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -1,4 +1,4 @@ -_attach_name[] = $filename; $this->_attach_type[] = $this->_mime_types(next(explode('.', basename($filename)))); - $this->_attach_disp[] = $disposition; // Can also be 'inline' Not sure if it matters + $this->_attach_disp[] = $disposition; // Can also be 'inline' Not sure if it matters return $this; } @@ -600,7 +600,7 @@ class CI_Email { $from = str_replace(">", "", $from); $from = str_replace("<", "", $from); - return "<".uniqid('').strstr($from, '@').">"; + return "<".uniqid('').strstr($from, '@').">"; } // -------------------------------------------------------------------- @@ -660,15 +660,15 @@ class CI_Email { */ private function _get_content_type() { - if ($this->mailtype == 'html' && count($this->_attach_name) == 0) + if ($this->mailtype == 'html' && count($this->_attach_name) == 0) { return 'html'; } - elseif ($this->mailtype == 'html' && count($this->_attach_name) > 0) + elseif ($this->mailtype == 'html' && count($this->_attach_name) > 0) { return 'html-attach'; } - elseif ($this->mailtype == 'text' && count($this->_attach_name) > 0) + elseif ($this->mailtype == 'text' && count($this->_attach_name) > 0) { return 'plain-attach'; } @@ -881,7 +881,7 @@ class CI_Email { // Use PHP's native public function to do the initial wordwrap. // We set the cut flag to FALSE so that any individual words that are - // too long get left alone. In the next step we'll deal with them. + // too long get left alone. In the next step we'll deal with them. $str = wordwrap($str, $charlim, "\n", FALSE); // Split the string into individual lines of text and cycle through them @@ -999,7 +999,7 @@ class CI_Email { */ private function _build_message() { - if ($this->wordwrap === TRUE AND $this->mailtype != 'html') + if ($this->wordwrap === TRUE AND $this->mailtype != 'html') { $this->_body = $this->word_wrap($this->_body); } @@ -1135,7 +1135,7 @@ class CI_Email { return FALSE; } - $h = "--".$this->_atc_boundary.$this->newline; + $h = "--".$this->_atc_boundary.$this->newline; $h .= "Content-type: ".$ctype."; "; $h .= "name=\"".$basename."\"".$this->newline; $h .= "Content-Disposition: ".$this->_attach_disp[$i].";".$this->newline; @@ -1237,7 +1237,7 @@ class CI_Email { // encode = signs if ($ascii == '61') { - $char = $escape.strtoupper(sprintf('%02s', dechex($ascii))); // =3D + $char = $escape.strtoupper(sprintf('%02s', dechex($ascii))); // =3D } // If we're at the character limit, add the line to the output, @@ -1267,7 +1267,7 @@ class CI_Email { /** * Prep Q Encoding * - * Performs "Q Encoding" on a string for use in email headers. It's related + * Performs "Q Encoding" on a string for use in email headers. It's related * but not identical to quoted-printable, so it has its own method * * @access public @@ -1349,7 +1349,7 @@ class CI_Email { $this->reply_to($this->_headers['From']); } - if (( ! isset($this->_recipients) AND ! isset($this->_headers['To'])) AND + if (( ! isset($this->_recipients) AND ! isset($this->_headers['To'])) AND ( ! isset($this->_bcc_array) AND ! isset($this->_headers['Bcc'])) AND ( ! isset($this->_headers['Cc']))) { @@ -1359,7 +1359,7 @@ class CI_Email { $this->_build_headers(); - if ($this->bcc_batch_mode AND count($this->_bcc_array) > 0) + if ($this->bcc_batch_mode AND count($this->_bcc_array) > 0) { if (count($this->_bcc_array) > $this->bcc_batch_size) return $this->batch_bcc_send(); @@ -1380,7 +1380,7 @@ class CI_Email { // -------------------------------------------------------------------- /** - * Batch Bcc Send. Sends groups of BCCs in batches + * Batch Bcc Send. Sends groups of BCCs in batches * * @access public * @return bool @@ -1752,7 +1752,7 @@ class CI_Email { // -------------------------------------------------------------------- /** - * SMTP Authenticate + * SMTP Authenticate * * @access private * @return bool @@ -1764,7 +1764,7 @@ class CI_Email { return TRUE; } - if ($this->smtp_user == "" AND $this->smtp_pass == "") + if ($this->smtp_user == "" AND $this->smtp_pass == "") { $this->_set_error_message('lang:email_no_smtp_unpw'); return FALSE; diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index b30a8cf0b..2f7db6623 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -1,4 +1,4 @@ -_field_data) == 0) { - // No validation rules? We're done... + // No validation rules? We're done... if (count($this->_config_rules) == 0) { return FALSE; @@ -648,7 +648,7 @@ class CI_Form_validation { } } - // Did the rule test negatively? If so, grab the error. + // Did the rule test negatively? If so, grab the error. if ($result === FALSE) { if ( ! isset($this->_error_messages[$rule])) @@ -664,7 +664,7 @@ class CI_Form_validation { } // Is the parameter we are inserting into the error message the name - // of another field? If so we need to grab its "field label" + // of another field? If so we need to grab its "field label" if (isset($this->_field_data[$param]) AND isset($this->_field_data[$param]['label'])) { $param = $this->_translate_fieldname($this->_field_data[$param]['label']); @@ -704,7 +704,7 @@ class CI_Form_validation { // Grab the variable $line = substr($fieldname, 5); - // Were we able to translate the field name? If not we use $line + // Were we able to translate the field name? If not we use $line if (FALSE === ($fieldname = $this->CI->lang->line($line))) { return $line; @@ -735,7 +735,7 @@ class CI_Form_validation { } // If the data is an array output them one at a time. - // E.g: form_input('name[]', set_value('name[]'); + // E.g: form_input('name[]', set_value('name[]'); if (is_array($this->_field_data[$field]['postdata'])) { return array_shift($this->_field_data[$field]['postdata']); @@ -914,7 +914,7 @@ class CI_Form_validation { return FALSE; } - return TRUE; + return TRUE; } // -------------------------------------------------------------------- @@ -1207,7 +1207,7 @@ class CI_Form_validation { // -------------------------------------------------------------------- /** - * Is a Natural number (0,1,2,3, etc.) + * Is a Natural number (0,1,2,3, etc.) * * @access public * @param string @@ -1221,7 +1221,7 @@ class CI_Form_validation { // -------------------------------------------------------------------- /** - * Is a Natural number, but not a zero (1,2,3, etc.) + * Is a Natural number, but not a zero (1,2,3, etc.) * * @access public * @param string @@ -1354,7 +1354,7 @@ class CI_Form_validation { */ function encode_php_tags($str) { - return str_replace(array(''), array('<?php', '<?PHP', '<?', '?>'), $str); + return str_replace(array(''), array('<?php', '<?PHP', '<?', '?>'), $str); } } diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php index d7a8b3b02..859cc9c30 100644 --- a/system/libraries/Ftp.php +++ b/system/libraries/Ftp.php @@ -1,4 +1,4 @@ -list_files($filepath); @@ -513,7 +513,7 @@ class CI_FTP { * Read a directory and recreate it remotely * * This function recursively reads a folder and everything it contains (including - * sub-folders) and creates a mirror via FTP based on it. Whatever the directory structure + * sub-folders) and creates a mirror via FTP based on it. Whatever the directory structure * of the original file path will be recreated on the server. * * @access public diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 8902f524d..099a238dd 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -1,4 +1,4 @@ -source_image == '') { $this->set_error('imglib_source_image_required'); - return FALSE; + return FALSE; } /* * Is getimagesize() Available? * * We use it to determine the image properties (width/height). - * Note: We need to figure out how to determine image + * Note: We need to figure out how to determine image * properties using ImageMagick and NetPBM * */ @@ -189,7 +189,7 @@ class CI_Image_lib { // Set the Image Properties if ( ! $this->get_image_properties($this->source_folder.$this->source_image)) { - return FALSE; + return FALSE; } /* @@ -197,7 +197,7 @@ class CI_Image_lib { * * If the user has set a "new_image" name it means * we are making a copy of the source image. If not - * it means we are altering the original. We'll + * it means we are altering the original. We'll * set the destination filename and path accordingly. * */ @@ -267,7 +267,7 @@ class CI_Image_lib { * * When creating thumbs or copies, the target width/height * might not be in correct proportion with the source - * image's width/height. We'll recalculate it here. + * image's width/height. We'll recalculate it here. * */ if ($this->maintain_ratio === TRUE && ($this->width != '' AND $this->height != '')) @@ -399,7 +399,7 @@ class CI_Image_lib { if ($this->rotation_angle == '' OR ! in_array($this->rotation_angle, $degs)) { $this->set_error('imglib_rotation_angle_required'); - return FALSE; + return FALSE; } // Reassign the width and height @@ -469,8 +469,8 @@ class CI_Image_lib { // Let's set up our values based on the action if ($action == 'crop') { - // Reassign the source width/height if cropping - $this->orig_width = $this->width; + // Reassign the source width/height if cropping + $this->orig_width = $this->width; $this->orig_height = $this->height; // GD 2.0 has a cropping bug so we'll test for it @@ -487,19 +487,19 @@ class CI_Image_lib { $this->y_axis = 0; } - // Create the image handle + // Create the image handle if ( ! ($src_img = $this->image_create_gd())) { return FALSE; } - // Create The Image + // Create The Image // - // old conditional which users report cause problems with shared GD libs who report themselves as "2.0 or greater" - // it appears that this is no longer the issue that it was in 2004, so we've removed it, retaining it in the comment - // below should that ever prove inaccurate. + // old conditional which users report cause problems with shared GD libs who report themselves as "2.0 or greater" + // it appears that this is no longer the issue that it was in 2004, so we've removed it, retaining it in the comment + // below should that ever prove inaccurate. // - // if ($this->image_library == 'gd2' AND function_exists('imagecreatetruecolor') AND $v2_override == FALSE) + // if ($this->image_library == 'gd2' AND function_exists('imagecreatetruecolor') AND $v2_override == FALSE) if ($this->image_library == 'gd2' AND function_exists('imagecreatetruecolor')) { $create = 'imagecreatetruecolor'; @@ -521,7 +521,7 @@ class CI_Image_lib { $copy($dst_img, $src_img, 0, 0, $this->x_axis, $this->y_axis, $this->width, $this->height, $this->orig_width, $this->orig_height); - // Show the image + // Show the image if ($this->dynamic_output == TRUE) { $this->image_display_gd($dst_img); @@ -535,7 +535,7 @@ class CI_Image_lib { } } - // Kill the file handles + // Kill the file handles imagedestroy($dst_img); imagedestroy($src_img); @@ -558,7 +558,7 @@ class CI_Image_lib { */ function image_process_imagemagick($action = 'resize') { - // Do we have a vaild library path? + // Do we have a vaild library path? if ($this->library_path == '') { $this->set_error('imglib_libpath_invalid'); @@ -593,7 +593,7 @@ class CI_Image_lib { $cmd .= " ".$angle." \"$this->full_src_path\" \"$this->full_dst_path\" 2>&1"; } - else // Resize + else // Resize { $cmd .= " -resize ".$this->width."x".$this->height." \"$this->full_src_path\" \"$this->full_dst_path\" 2>&1"; } @@ -634,7 +634,7 @@ class CI_Image_lib { return FALSE; } - // Build the resizing command + // Build the resizing command switch ($this->image_type) { case 1 : @@ -684,7 +684,7 @@ class CI_Image_lib { @exec($cmd, $output, $retval); - // Did it work? + // Did it work? if ($retval > 0) { $this->set_error('imglib_image_process_failed'); @@ -711,7 +711,7 @@ class CI_Image_lib { */ function image_rotate_gd() { - // Create the image handle + // Create the image handle if ( ! ($src_img = $this->image_create_gd())) { return FALSE; @@ -724,10 +724,10 @@ class CI_Image_lib { $white = imagecolorallocate($src_img, 255, 255, 255); - // Rotate it! + // Rotate it! $dst_img = imagerotate($src_img, $this->rotation_angle, $white); - // Save the Image + // Save the Image if ($this->dynamic_output == TRUE) { $this->image_display_gd($dst_img); @@ -741,7 +741,7 @@ class CI_Image_lib { } } - // Kill the file handles + // Kill the file handles imagedestroy($dst_img); imagedestroy($src_img); @@ -769,14 +769,14 @@ class CI_Image_lib { return FALSE; } - $width = $this->orig_width; + $width = $this->orig_width; $height = $this->orig_height; if ($this->rotation_angle == 'hor') { for ($i = 0; $i < $height; $i++) { - $left = 0; + $left = 0; $right = $width-1; while ($left < $right) @@ -813,7 +813,7 @@ class CI_Image_lib { } } - // Show the image + // Show the image if ($this->dynamic_output == TRUE) { $this->image_display_gd($src_img); @@ -827,7 +827,7 @@ class CI_Image_lib { } } - // Kill the file handles + // Kill the file handles imagedestroy($src_img); // Set the file to 777 @@ -876,24 +876,24 @@ class CI_Image_lib { return FALSE; } - // Fetch source image properties + // Fetch source image properties $this->get_image_properties(); - // Fetch watermark image properties + // Fetch watermark image properties $props = $this->get_image_properties($this->wm_overlay_path, TRUE); $wm_img_type = $props['image_type']; $wm_width = $props['width']; $wm_height = $props['height']; - // Create two image resources - $wm_img = $this->image_create_gd($this->wm_overlay_path, $wm_img_type); + // Create two image resources + $wm_img = $this->image_create_gd($this->wm_overlay_path, $wm_img_type); $src_img = $this->image_create_gd($this->full_src_path); // Reverse the offset if necessary // When the image is positioned at the bottom // we don't want the vertical offset to push it - // further down. We want the reverse, so we'll - // invert the offset. Same with the horizontal + // further down. We want the reverse, so we'll + // invert the offset. Same with the horizontal // offset when the image is at the right $this->wm_vrt_alignment = strtoupper(substr($this->wm_vrt_alignment, 0, 1)); @@ -905,11 +905,11 @@ class CI_Image_lib { if ($this->wm_hor_alignment == 'R') $this->wm_hor_offset = $this->wm_hor_offset * -1; - // Set the base x and y axis values + // Set the base x and y axis values $x_axis = $this->wm_hor_offset + $this->wm_padding; $y_axis = $this->wm_vrt_offset + $this->wm_padding; - // Set the vertical position + // Set the vertical position switch ($this->wm_vrt_alignment) { case 'T': @@ -920,7 +920,7 @@ class CI_Image_lib { break; } - // Set the horizontal position + // Set the horizontal position switch ($this->wm_hor_alignment) { case 'L': @@ -931,7 +931,7 @@ class CI_Image_lib { break; } - // Build the finalized image + // Build the finalized image if ($wm_img_type == 3 AND function_exists('imagealphablending')) { @imagealphablending($src_img, TRUE); @@ -954,7 +954,7 @@ class CI_Image_lib { imagecopymerge($src_img, $wm_img, $x_axis, $y_axis, 0, 0, $wm_width, $wm_height, $this->wm_opacity); } - // Output the image + // Output the image if ($this->dynamic_output == TRUE) { $this->image_display_gd($src_img); @@ -994,7 +994,7 @@ class CI_Image_lib { return FALSE; } - // Fetch source image properties + // Fetch source image properties $this->get_image_properties(); // Set RGB values for text and shadow @@ -1015,8 +1015,8 @@ class CI_Image_lib { // Reverse the vertical offset // When the image is positioned at the bottom // we don't want the vertical offset to push it - // further down. We want the reverse, so we'll - // invert the offset. Note: The horizontal + // further down. We want the reverse, so we'll + // invert the offset. Note: The horizontal // offset flips itself automatically if ($this->wm_vrt_alignment == 'B') @@ -1033,13 +1033,13 @@ class CI_Image_lib { if ($this->wm_font_size == '') $this->wm_font_size = '17'; - $fontwidth = $this->wm_font_size-($this->wm_font_size/4); + $fontwidth = $this->wm_font_size-($this->wm_font_size/4); $fontheight = $this->wm_font_size; $this->wm_vrt_offset += $this->wm_font_size; } else { - $fontwidth = imagefontwidth($this->wm_font_size); + $fontwidth = imagefontwidth($this->wm_font_size); $fontheight = imagefontheight($this->wm_font_size); } @@ -1080,11 +1080,11 @@ class CI_Image_lib { case "C": if ($this->wm_use_drop_shadow) $x_shad += floor(($this->orig_width - $fontwidth*strlen($this->wm_text))/2); - $x_axis += floor(($this->orig_width -$fontwidth*strlen($this->wm_text))/2); + $x_axis += floor(($this->orig_width -$fontwidth*strlen($this->wm_text))/2); break; } - // Add the text to the source image + // Add the text to the source image if ($this->wm_use_truetype) { if ($this->wm_use_drop_shadow) @@ -1098,7 +1098,7 @@ class CI_Image_lib { imagestring($src_img, $this->wm_font_size, $x_axis, $y_axis, $this->wm_text, $txt_color); } - // Output the final image + // Output the final image if ($this->dynamic_output == TRUE) { $this->image_display_gd($src_img); @@ -1366,7 +1366,7 @@ class CI_Image_lib { * Size calculator * * This function takes a known width x height and - * recalculates it to a new size. Only one + * recalculates it to a new size. Only one * new variable needs to be known * * $props = array( @@ -1374,7 +1374,7 @@ class CI_Image_lib { * 'height' => $height, * 'new_width' => 40, * 'new_height' => '' - * ); + * ); * * @access public * @param array @@ -1418,10 +1418,10 @@ class CI_Image_lib { * Explode source_image * * This is a helper function that extracts the extension - * from the source_image. This function lets us deal with - * source_images with multiple periods, like: my.cool.jpg + * from the source_image. This function lets us deal with + * source_images with multiple periods, like: my.cool.jpg * It returns an associative array with two elements: - * $array['ext'] = '.jpg'; + * $array['ext'] = '.jpg'; * $array['name'] = 'my.cool'; * * @access public diff --git a/system/libraries/Javascript.php b/system/libraries/Javascript.php index 34e0d7001..9e42a4385 100644 --- a/system/libraries/Javascript.php +++ b/system/libraries/Javascript.php @@ -1,4 +1,4 @@ -js =& $this->CI->$js_library_driver; - log_message('debug', "Javascript Class Initialized and loaded. Driver used: $js_library_driver"); + log_message('debug', "Javascript Class Initialized and loaded. Driver used: $js_library_driver"); } - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Event Code // -------------------------------------------------------------------- @@ -378,7 +378,7 @@ class CI_Javascript { return $this->js->_unload($element, $js); } - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Effects // -------------------------------------------------------------------- @@ -685,7 +685,7 @@ class CI_Javascript { return $str; } - + // -------------------------------------------------------------------- /** @@ -855,7 +855,7 @@ class CI_Javascript { } elseif (is_string($result) OR $is_key) { - return '"'.str_replace(array('\\', "\t", "\n", "\r", '"', '/'), array('\\\\', '\\t', '\\n', "\\r", '\"', '\/'), $result).'"'; + return '"'.str_replace(array('\\', "\t", "\n", "\r", '"', '/'), array('\\\\', '\\t', '\\n', "\\r", '\"', '\/'), $result).'"'; } elseif (is_scalar($result)) { diff --git a/system/libraries/Log.php b/system/libraries/Log.php index 9f1db76ba..2505fc678 100644 --- a/system/libraries/Log.php +++ b/system/libraries/Log.php @@ -1,4 +1,4 @@ - '1', 'DEBUG' => '2', 'INFO' => '3', 'ALL' => '4'); + protected $_levels = array('ERROR' => '1', 'DEBUG' => '2', 'INFO' => '3', 'ALL' => '4'); /** * Constructor @@ -84,11 +84,11 @@ class CI_Log { } $filepath = $this->_log_path.'log-'.date('Y-m-d').'.php'; - $message = ''; + $message = ''; if ( ! file_exists($filepath)) { - $message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n"; + $message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n"; } if ( ! $fp = @fopen($filepath, FOPEN_WRITE_CREATE)) diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index cc62e660b..d9c22d501 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -1,4 +1,4 @@ -cur_page - $this->num_links) > 0) ? $this->cur_page - ($this->num_links - 1) : 1; - $end = (($this->cur_page + $this->num_links) < $num_pages) ? $this->cur_page + $this->num_links : $num_pages; + $end = (($this->cur_page + $this->num_links) < $num_pages) ? $this->cur_page + $this->num_links : $num_pages; - // Is pagination being used over GET or POST? If get, add a per_page query + // Is pagination being used over GET or POST? If get, add a per_page query // string. If post, add a trailing slash to the base URL if needed if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE) { @@ -194,14 +194,14 @@ class CI_Pagination { $output = ''; // Render the "First" link - if ($this->first_link !== FALSE AND $this->cur_page > ($this->num_links + 1)) + if ($this->first_link !== FALSE AND $this->cur_page > ($this->num_links + 1)) { $first_url = ($this->first_url == '') ? $this->base_url : $this->first_url; $output .= $this->first_tag_open.'anchor_class.'href="'.$first_url.'">'.$this->first_link.''.$this->first_tag_close; } // Render the "previous" link - if ($this->prev_link !== FALSE AND $this->cur_page != 1) + if ($this->prev_link !== FALSE AND $this->cur_page != 1) { $i = $uri_page_number - $this->per_page; @@ -263,7 +263,7 @@ class CI_Pagination { $output .= $this->last_tag_open.'anchor_class.'href="'.$this->base_url.$this->prefix.$i.$this->suffix.'">'.$this->last_link.''.$this->last_tag_close; } - // Kill double slashes. Note: Sometimes we can end up with a double slash + // Kill double slashes. Note: Sometimes we can end up with a double slash // in the penultimate link so we'll kill all double slashes. $output = preg_replace("#([^:])//+#", "\\1/", $output); diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php index d223da020..f48f2a7e5 100644 --- a/system/libraries/Parser.php +++ b/system/libraries/Parser.php @@ -1,4 +1,4 @@ -'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_benchmarks').'  '; @@ -168,7 +168,7 @@ class CI_Profiler { if (count($dbs) == 0) { - $output = "\n\n"; + $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_queries').'  '; @@ -187,7 +187,7 @@ class CI_Profiler { // Key words we want bolded $highlight = array('SELECT', 'DISTINCT', 'FROM', 'WHERE', 'AND', 'LEFT JOIN', 'ORDER BY', 'GROUP BY', 'LIMIT', 'INSERT', 'INTO', 'VALUES', 'UPDATE', 'OR ', 'HAVING', 'OFFSET', 'NOT IN', 'IN', 'LIKE', 'NOT LIKE', 'COUNT', 'MAX', 'MIN', 'ON', 'AS', 'AVG', 'SUM', '(', ')'); - $output = "\n\n"; + $output = "\n\n"; $count = 0; @@ -249,7 +249,7 @@ class CI_Profiler { */ protected function _compile_get() { - $output = "\n\n"; + $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_get_data').'  '; @@ -298,7 +298,7 @@ class CI_Profiler { */ protected function _compile_post() { - $output = "\n\n"; + $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_post_data').'  '; @@ -347,7 +347,7 @@ class CI_Profiler { */ protected function _compile_uri_string() { - $output = "\n\n"; + $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_uri_string').'  '; @@ -376,7 +376,7 @@ class CI_Profiler { */ protected function _compile_controller_info() { - $output = "\n\n"; + $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_controller_info').'  '; @@ -400,7 +400,7 @@ class CI_Profiler { */ protected function _compile_memory_usage() { - $output = "\n\n"; + $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_memory_usage').'  '; @@ -431,7 +431,7 @@ class CI_Profiler { */ protected function _compile_http_headers() { - $output = "\n\n"; + $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_headers').'  ('.$this->CI->lang->line('profiler_section_show').')'; @@ -462,7 +462,7 @@ class CI_Profiler { */ protected function _compile_config() { - $output = "\n\n"; + $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_config').'  ('.$this->CI->lang->line('profiler_section_show').')'; diff --git a/system/libraries/Session.php b/system/libraries/Session.php index 2c8a80163..76525dbb8 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -1,4 +1,4 @@ -CI->load->library('encrypt'); } - // Are we using a database? If so, load it + // Are we using a database? If so, load it if ($this->sess_use_database === TRUE AND $this->sess_table_name != '') { $this->CI->load->database(); } - // Set the "now" time. Can either be GMT or server time, based on the - // config prefs. We use this to set the "last activity" time + // Set the "now" time. Can either be GMT or server time, based on the + // config prefs. We use this to set the "last activity" time $this->now = $this->_get_time(); // Set the session length. If the session expiration is @@ -97,12 +97,12 @@ class CI_Session { { $this->sess_expiration = (60*60*24*365*2); } - + // Set the cookie name $this->sess_cookie_name = $this->cookie_prefix.$this->sess_cookie_name; // Run the Session routine. If a session doesn't exist we'll - // create a new one. If it does, we'll update it. + // create a new one. If it does, we'll update it. if ( ! $this->sess_read()) { $this->sess_create(); @@ -137,7 +137,7 @@ class CI_Session { // Fetch the cookie $session = $this->CI->input->cookie($this->sess_cookie_name); - // No cookie? Goodbye cruel world!... + // No cookie? Goodbye cruel world!... if ($session === FALSE) { log_message('debug', 'A session cookie was not found.'); @@ -155,8 +155,8 @@ class CI_Session { $hash = substr($session, strlen($session)-32); // get last 32 chars $session = substr($session, 0, strlen($session)-32); - // Does the md5 hash match? This is to prevent manipulation of session data in userspace - if ($hash !== md5($session.$this->encryption_key)) + // Does the md5 hash match? This is to prevent manipulation of session data in userspace + if ($hash !== md5($session.$this->encryption_key)) { log_message('error', 'The session cookie data did not match what was expected. This could be a possible hacking attempt.'); $this->sess_destroy(); @@ -212,14 +212,14 @@ class CI_Session { $query = $this->CI->db->get($this->sess_table_name); - // No result? Kill it! + // No result? Kill it! if ($query->num_rows() == 0) { $this->sess_destroy(); return FALSE; } - // Is there custom data? If so, add it to the main session array + // Is there custom data? If so, add it to the main session array $row = $query->row(); if (isset($row->user_data) AND $row->user_data != '') { @@ -252,7 +252,7 @@ class CI_Session { */ function sess_write() { - // Are we saving custom data to the DB? If not, all we do is update the cookie + // Are we saving custom data to the DB? If not, all we do is update the cookie if ($this->sess_use_database === FALSE) { $this->_set_cookie(); @@ -272,7 +272,7 @@ class CI_Session { $cookie_userdata[$val] = $this->userdata[$val]; } - // Did we find any custom data? If not, we turn the empty array into a string + // Did we find any custom data? If not, we turn the empty array into a string // since there's no reason to serialize and store an empty array in the DB if (count($custom_userdata) === 0) { @@ -288,7 +288,7 @@ class CI_Session { $this->CI->db->where('session_id', $this->userdata['session_id']); $this->CI->db->update($this->sess_table_name, array('last_activity' => $this->userdata['last_activity'], 'user_data' => $custom_userdata)); - // Write the cookie. Notice that we manually pass the cookie data array to the + // Write the cookie. Notice that we manually pass the cookie data array to the // _set_cookie() function. Normally that function will store $this->userdata, but // in this case that array contains custom data, which we do not want in the cookie. $this->_set_cookie($cookie_userdata); @@ -535,7 +535,7 @@ class CI_Session { */ function keep_flashdata($key) { - // 'old' flashdata gets removed. Here we mark all + // 'old' flashdata gets removed. Here we mark all // flashdata as 'new' to preserve it from _flashdata_sweep() // Note the function will return FALSE if the $key // provided cannot be found diff --git a/system/libraries/Sha1.php b/system/libraries/Sha1.php index 1a657572b..04e07d1c1 100644 --- a/system/libraries/Sha1.php +++ b/system/libraries/Sha1.php @@ -1,4 +1,4 @@ -heading) == 0 AND count($this->rows) == 0) { return 'Undefined table data'; @@ -376,7 +376,7 @@ class CI_Table { // -------------------------------------------------------------------- /** - * Clears the table arrays. Useful if multiple tables are being generated + * Clears the table arrays. Useful if multiple tables are being generated * * @access public * @return void @@ -495,7 +495,7 @@ class CI_Table { */ function _default_template() { - return array ( + return array ( 'table_open' => '
<<
', 'thead_open' => '', diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index b0a767822..b0f8a9098 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -1,4 +1,4 @@ -","\"", "'", "-"), array("&", "<", ">", """, "'", "-"), diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php index 734cec104..3ceb0b52b 100644 --- a/system/libraries/Typography.php +++ b/system/libraries/Typography.php @@ -1,4 +1,4 @@ - tags if they exist. It's cheaper to do this separately since most content will + // match and yank
 tags if they exist. It's cheaper to do this separately since most content will
 		// not contain 
 tags, and it keeps the PCRE patterns below simpler and faster
 		if (strpos($str, 'inline_elements.")([ >])#i", "{@TAG}\\1\\2\\3", $str);
 
-		// Split the string at every tag.  This expression creates an array with this prototype:
+		// Split the string at every tag. This expression creates an array with this prototype:
 		//
 		//	[array]
 		//	{
@@ -126,7 +126,7 @@ class CI_Typography {
 		//	}
 		$chunks = preg_split('/(<(?:[^<>]+(?:"[^"]*"|\'[^\']*\')?)+>)/', $str, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
 
-		// Build our finalized string.  We cycle through the array, skipping tags, and processing the contained text
+		// Build our finalized string. We cycle through the array, skipping tags, and processing the contained text
 		$str = '';
 		$process = TRUE;
 		$paragraph = FALSE;
@@ -143,7 +143,7 @@ class CI_Typography {
 			{
 				if (preg_match("#".$this->skip_elements."#", $match[2]))
 				{
-					$process =  ($match[1] == '/') ? TRUE : FALSE;
+					$process = ($match[1] == '/') ? TRUE : FALSE;
 				}
 
 				if ($match[1] == '')
@@ -161,17 +161,17 @@ class CI_Typography {
 				continue;
 			}
 
-			//  Force a newline to make sure end tags get processed by _format_newlines()
+			// Force a newline to make sure end tags get processed by _format_newlines()
 			if ($current_chunk == $total_chunks)
 			{
 				$chunk .= "\n";
 			}
 
-			//  Convert Newlines into 

and
tags + // Convert Newlines into

and
tags $str .= $this->_format_newlines($chunk); } - // No opening block level tag? Add it if needed. + // No opening block level tag? Add it if needed. if ( ! preg_match("/^\s*<(?:".$this->block_elements.")/i", $str)) { $str = preg_replace("/^(.*?)<(".$this->block_elements.")/i", '

$1

<$2', $str); @@ -204,14 +204,14 @@ class CI_Typography { '#

<('.$this->block_elements.')#' => '<$1', // Clean up stray non-breaking spaces preceeding block elements - '#( \s*)+<('.$this->block_elements.')#' => ' <$2', + '#( \s*)+<('.$this->block_elements.')#' => ' <$2', // Replace the temporary markers we added earlier '/\{@TAG\}/' => '<', '/\{@DQ\}/' => '"', '/\{@SQ\}/' => "'", '/\{@DD\}/' => '--', - '/\{@NBS\}/' => ' ', + '/\{@NBS\}/' => ' ', // An unintended consequence of the _format_newlines function is that // some of the newlines get truncated, resulting in

tags @@ -296,7 +296,7 @@ class CI_Typography { '/(\w)\.{3}/' => '$1…', // double space after sentences - '/(\W) /' => '$1  ', + '/(\W) /' => '$1  ', // ampersands, if not a character entity '/&(?!#?[a-zA-Z0-9]{2,};)/' => '&' @@ -324,7 +324,7 @@ class CI_Typography { return $str; } - if (strpos($str, "\n") === FALSE && ! in_array($this->last_block_element, $this->inner_block_required)) + if (strpos($str, "\n") === FALSE && ! in_array($this->last_block_element, $this->inner_block_required)) { return $str; } @@ -341,7 +341,7 @@ class CI_Typography { // We trim off the right-side new line so that the closing

tag // will be positioned immediately following the string, matching // the behavior of the opening

tag - $str = '

'.rtrim($str).'

'; + $str = '

'.rtrim($str).'

'; } // Remove empty paragraphs if they are on the first line, as this @@ -367,7 +367,7 @@ class CI_Typography { */ function _protect_characters($match) { - return str_replace(array("'",'"','--',' '), array('{@SQ}', '{@DQ}', '{@DD}', '{@NBS}'), $match[0]); + return str_replace(array("'",'"','--',' '), array('{@SQ}', '{@DQ}', '{@DD}', '{@NBS}'), $match[0]); } // -------------------------------------------------------------------- diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 5bd7e801a..c9012f646 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -1,4 +1,4 @@ -set_error('upload_stopped_by_extension'); break; - default : $this->set_error('upload_no_file_selected'); + default : $this->set_error('upload_no_file_selected'); break; } @@ -290,7 +290,7 @@ class CI_Upload { /* * Run the file through the XSS hacking filter * This helps prevent malicious code from being - * embedded within a file. Scripts can easily + * embedded within a file. Scripts can easily * be disguised as images or other file types. */ if ($this->xss_clean) @@ -305,8 +305,8 @@ class CI_Upload { /* * Move the file to the final destination * To deal with different server configurations - * we'll attempt to use copy() first. If that fails - * we'll use move_uploaded_file(). One of the two should + * we'll attempt to use copy() first. If that fails + * 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)) @@ -321,7 +321,7 @@ class CI_Upload { /* * Set the finalized image dimensions * This sets the image width/height (assuming the - * file was an image). We use this information + * file was an image). We use this information * in the "data" function. */ $this->set_image_properties($this->upload_path.$this->file_name); @@ -518,7 +518,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_size_str = $D['3']; // string containing height and width + $this->image_size_str = $D['3']; // string containing height and width } } } @@ -551,7 +551,7 @@ class CI_Upload { // IE will sometimes return odd mime-types during upload, so here we just standardize all // jpegs or pngs to the same file type. - $png_mimes = array('image/x-png'); + $png_mimes = array('image/x-png'); $jpeg_mimes = array('image/jpg', 'image/jpe', 'image/jpeg', 'image/pjpeg'); if (in_array($this->file_type, $png_mimes)) @@ -642,7 +642,7 @@ class CI_Upload { */ public function is_allowed_filesize() { - if ($this->max_size != 0 AND $this->file_size > $this->max_size) + if ($this->max_size != 0 AND $this->file_size > $this->max_size) { return FALSE; } @@ -721,7 +721,7 @@ class CI_Upload { return FALSE; } - $this->upload_path = preg_replace("/(.+?)\/*$/", "\\1/", $this->upload_path); + $this->upload_path = preg_replace("/(.+?)\/*$/", "\\1/", $this->upload_path); return TRUE; } @@ -834,7 +834,7 @@ class CI_Upload { $current = ini_get('memory_limit') * 1024 * 1024; // There was a bug/behavioural change in PHP 5.2, where numbers over one million get output - // into scientific notation. number_format() ensures this number is an integer + // into scientific notation. number_format() ensures this number is an integer // http://bugs.php.net/bug.php?id=43053 $new_memory = number_format(ceil(filesize($file) + $current), 0, '.', ''); @@ -844,8 +844,8 @@ class CI_Upload { // If the file being uploaded is an image, then we should have no problem with XSS attacks (in theory), but // IE can be fooled into mime-type detecting a malformed image as an html file, thus executing an XSS attack on anyone - // using IE who looks at the image. It does this by inspecting the first 255 bytes of an image. To get around this - // CI will itself look at the first 255 bytes of an image to determine its relative safety. This can save a lot of + // using IE who looks at the image. It does this by inspecting the first 255 bytes of an image. To get around this + // CI will itself look at the first 255 bytes of an image to determine its relative safety. This can save a lot of // processor power and time if it is actually a clean image, as it will be in nearly all instances _except_ an // attempted XSS attack. @@ -933,7 +933,7 @@ class CI_Upload { /** * List of Mime Types * - * This is a list of mime types. We use it to validate + * This is a list of mime types. We use it to validate * the "allowed types" set by the developer * * @param string diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php index 016102a2a..543d1d5a3 100644 --- a/system/libraries/User_agent.php +++ b/system/libraries/User_agent.php @@ -1,4 +1,4 @@ -xmlrpcerr['unknown_method'] = '1'; $this->xmlrpcstr['unknown_method'] = 'This is not a known method for this XML-RPC Server'; $this->xmlrpcerr['invalid_return'] = '2'; - $this->xmlrpcstr['invalid_return'] = 'The XML data received was either invalid or not in the correct form for XML-RPC. Turn on debugging to examine the XML data further.'; + $this->xmlrpcstr['invalid_return'] = 'The XML data received was either invalid or not in the correct form for XML-RPC. Turn on debugging to examine the XML data further.'; $this->xmlrpcerr['incorrect_params'] = '3'; $this->xmlrpcstr['incorrect_params'] = 'Incorrect parameters were passed to method'; $this->xmlrpcerr['introspect_unknown'] = '4'; @@ -129,7 +129,7 @@ class CI_Xmlrpc { //------------------------------------- - // Initialize Prefs + // Initialize Prefs //------------------------------------- function initialize($config = array()) @@ -148,7 +148,7 @@ class CI_Xmlrpc { // END //------------------------------------- - // Take URL and parse it + // Take URL and parse it //------------------------------------- function server($url, $port=80) @@ -172,7 +172,7 @@ class CI_Xmlrpc { // END //------------------------------------- - // Set Timeout + // Set Timeout //------------------------------------- function timeout($seconds=5) @@ -185,7 +185,7 @@ class CI_Xmlrpc { // END //------------------------------------- - // Set Methods + // Set Methods //------------------------------------- function method($function) @@ -195,7 +195,7 @@ class CI_Xmlrpc { // END //------------------------------------- - // Take Array of Data and Create Objects + // Take Array of Data and Create Objects //------------------------------------- function request($incoming) @@ -216,7 +216,7 @@ class CI_Xmlrpc { //------------------------------------- - // Set Debug + // Set Debug //------------------------------------- function set_debug($flag = TRUE) @@ -225,7 +225,7 @@ class CI_Xmlrpc { } //------------------------------------- - // Values Parsing + // Values Parsing //------------------------------------- function values_parsing($value, $return = FALSE) @@ -268,7 +268,7 @@ class CI_Xmlrpc { //------------------------------------- - // Sends XML-RPC Request + // Sends XML-RPC Request //------------------------------------- function send_request() @@ -294,7 +294,7 @@ class CI_Xmlrpc { // END //------------------------------------- - // Returns Error + // Returns Error //------------------------------------- function display_error() @@ -304,7 +304,7 @@ class CI_Xmlrpc { // END //------------------------------------- - // Returns Remote Server Response + // Returns Remote Server Response //------------------------------------- function display_response() @@ -314,7 +314,7 @@ class CI_Xmlrpc { // END //------------------------------------- - // Sends an Error Message for Server Request + // Sends an Error Message for Server Request //------------------------------------- function send_error_message($number, $message) @@ -325,7 +325,7 @@ class CI_Xmlrpc { //------------------------------------- - // Send Response for Server Request + // Send Response for Server Request //------------------------------------- function send_response($response) @@ -399,7 +399,7 @@ class XML_RPC_Client extends CI_Xmlrpc } $r = "\r\n"; - $op = "POST {$this->path} HTTP/1.0$r"; + $op = "POST {$this->path} HTTP/1.0$r"; $op .= "Host: {$this->server}$r"; $op .= "Content-Type: text/xml$r"; $op .= "User-Agent: {$this->xmlrpcName}$r"; @@ -447,7 +447,7 @@ class XML_RPC_Response else if ( ! is_object($val)) { // programmer error, not an object - error_log("Invalid type '" . gettype($val) . "' (value: $val) passed to XML_RPC_Response. Defaulting to empty value."); + error_log("Invalid type '" . gettype($val) . "' (value: $val) passed to XML_RPC_Response. Defaulting to empty value."); $this->val = new XML_RPC_Values(); } else @@ -504,7 +504,7 @@ class XML_RPC_Response function decode($array=FALSE) { $CI =& get_instance(); - + if ($array !== FALSE && is_array($array)) { while (list($key) = each($array)) @@ -541,7 +541,7 @@ class XML_RPC_Response //------------------------------------- - // XML-RPC Object to PHP Types + // XML-RPC Object to PHP Types //------------------------------------- function xmlrpc_decoder($xmlrpc_val) @@ -581,7 +581,7 @@ class XML_RPC_Response //------------------------------------- - // ISO-8601 time to server or UTC time + // ISO-8601 time to server or UTC time //------------------------------------- function iso8601_decode($time, $utc=0) @@ -630,7 +630,7 @@ class XML_RPC_Message extends CI_Xmlrpc } //------------------------------------- - // Create Payload to Send + // Create Payload to Send //------------------------------------- function createPayload() @@ -650,7 +650,7 @@ class XML_RPC_Message extends CI_Xmlrpc } //------------------------------------- - // Parse External XML-RPC Server's Response + // Parse External XML-RPC Server's Response //------------------------------------- function parseResponse($fp) @@ -663,7 +663,7 @@ class XML_RPC_Message extends CI_Xmlrpc } //------------------------------------- - // DISPLAY HTTP CONTENT for DEBUGGING + // DISPLAY HTTP CONTENT for DEBUGGING //------------------------------------- if ($this->debug === TRUE) @@ -674,7 +674,7 @@ class XML_RPC_Message extends CI_Xmlrpc } //------------------------------------- - // Check for data + // Check for data //------------------------------------- if ($data == "") @@ -686,7 +686,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- - // Check for HTTP 200 Response + // Check for HTTP 200 Response //------------------------------------- if (strncmp($data, 'HTTP', 4) == 0 && ! preg_match('/^HTTP\/[0-9\.]+ 200 /', $data)) @@ -697,7 +697,7 @@ class XML_RPC_Message extends CI_Xmlrpc } //------------------------------------- - // Create and Set Up XML Parser + // Create and Set Up XML Parser //------------------------------------- $parser = xml_parser_create($this->xmlrpc_defencoding); @@ -718,7 +718,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- - // GET HEADERS + // GET HEADERS //------------------------------------- $lines = explode("\r\n", $data); @@ -734,7 +734,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- - // PARSE XML DATA + // PARSE XML DATA //------------------------------------- if ( ! xml_parse($parser, $data, count($data))) @@ -750,7 +750,7 @@ class XML_RPC_Message extends CI_Xmlrpc xml_parser_free($parser); // --------------------------------------- - // Got Ourselves Some Badness, It Seems + // Got Ourselves Some Badness, It Seems // --------------------------------------- if ($this->xh[$parser]['isf'] > 1) @@ -772,7 +772,7 @@ class XML_RPC_Message extends CI_Xmlrpc } //------------------------------------- - // DISPLAY XML CONTENT for DEBUGGING + // DISPLAY XML CONTENT for DEBUGGING //------------------------------------- if ($this->debug === TRUE) @@ -797,7 +797,7 @@ class XML_RPC_Message extends CI_Xmlrpc } //------------------------------------- - // SEND RESPONSE + // SEND RESPONSE //------------------------------------- $v = $this->xh[$parser]['value']; @@ -826,21 +826,21 @@ class XML_RPC_Message extends CI_Xmlrpc } // ------------------------------------ - // Begin Return Message Parsing section + // Begin Return Message Parsing section // ------------------------------------ // quick explanation of components: - // ac - used to accumulate values - // isf - used to indicate a fault - // lv - used to indicate "looking for a value": implements + // ac - used to accumulate values + // isf - used to indicate a fault + // lv - used to indicate "looking for a value": implements // the logic to allow values with no types to be strings - // params - used to store parameters in method calls - // method - used to store method name + // params - used to store parameters in method calls + // method - used to store method name // stack - array with parent tree of the xml element, // used to validate the nesting of elements //------------------------------------- - // Start Element Handler + // Start Element Handler //------------------------------------- function open_tag($the_parser, $name, $attrs) @@ -942,7 +942,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- - // End Element Handler + // End Element Handler //------------------------------------- function closing_tag($the_parser, $name) @@ -951,7 +951,7 @@ class XML_RPC_Message extends CI_Xmlrpc // Remove current element from stack and set variable // NOTE: If the XML validates, then we do not have to worry about - // the opening and closing of elements. Nesting is checked on the opening + // the opening and closing of elements. Nesting is checked on the opening // tag so we be safe there as well. $curr_elem = array_shift($this->xh[$the_parser]['stack']); @@ -1080,13 +1080,13 @@ class XML_RPC_Message extends CI_Xmlrpc // We're all good kids with nuthin' to do break; default: - // End of an Invalid Element. Taken care of during the opening tag though + // End of an Invalid Element. Taken care of during the opening tag though break; } } //------------------------------------- - // Parses Character Data + // Parses Character Data //------------------------------------- function character_data($the_parser, $data) @@ -1116,7 +1116,7 @@ class XML_RPC_Message extends CI_Xmlrpc function output_parameters($array=FALSE) { $CI =& get_instance(); - + if ($array !== FALSE && is_array($array)) { while (list($key) = each($array)) diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php index 9cd332147..88af60693 100644 --- a/system/libraries/Xmlrpcs.php +++ b/system/libraries/Xmlrpcs.php @@ -1,4 +1,4 @@ -parseRequest(); - $payload = 'xmlrpc_defencoding.'"?'.'>'."\n"; + $payload = 'xmlrpc_defencoding.'"?'.'>'."\n"; $payload .= $this->debug_msg; $payload .= $r->prepare_response(); @@ -156,7 +156,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc function add_to_map($methodname, $function, $sig, $doc) { $this->methods[$methodname] = array( - 'function' => $function, + 'function' => $function, 'signature' => $sig, 'docstring' => $doc ); @@ -176,7 +176,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc global $HTTP_RAW_POST_DATA; //------------------------------------- - // Get Data + // Get Data //------------------------------------- if ($data == '') @@ -185,7 +185,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc } //------------------------------------- - // Set up XML Parser + // Set up XML Parser //------------------------------------- $parser = xml_parser_create($this->xmlrpc_defencoding); @@ -207,7 +207,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- - // PARSE + PROCESS XML DATA + // PARSE + PROCESS XML DATA //------------------------------------- if ( ! xml_parse($parser, $data, 1)) @@ -235,7 +235,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc { if ($this->debug === TRUE) { - $plist .= "$i - " . print_r(get_object_vars($parser_object->xh[$parser]['params'][$i]), TRUE). ";\n"; + $plist .= "$i - " . print_r(get_object_vars($parser_object->xh[$parser]['params'][$i]), TRUE). ";\n"; } $m->addParam($parser_object->xh[$parser]['params'][$i]); @@ -252,7 +252,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc } //------------------------------------- - // SET DEBUGGING MESSAGE + // SET DEBUGGING MESSAGE //------------------------------------- if ($this->debug === TRUE) @@ -285,7 +285,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc } //------------------------------------- - // Valid Method + // Valid Method //------------------------------------- if ( ! isset($this->methods[$methName]['function'])) @@ -294,7 +294,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc } //------------------------------------- - // Check for Method (and Object) + // Check for Method (and Object) //------------------------------------- $method_parts = explode(".", $this->methods[$methName]['function']); @@ -320,7 +320,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc } //------------------------------------- - // Checking Methods Signature + // Checking Methods Signature //------------------------------------- if (isset($this->methods[$methName]['signature'])) @@ -353,7 +353,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc } //------------------------------------- - // Calls the Function + // Calls the Function //------------------------------------- if ($objectCall === TRUE) @@ -381,11 +381,11 @@ class CI_Xmlrpcs extends CI_Xmlrpc return call_user_func($this->methods[$methName]['function'], $m); } } - + // -------------------------------------------------------------------- /** - * Server Function: List Methods + * Server Function: List Methods * * @access public * @param mixed @@ -409,11 +409,11 @@ class CI_Xmlrpcs extends CI_Xmlrpc $v->addArray($output); return new XML_RPC_Response($v); } - + // -------------------------------------------------------------------- /** - * Server Function: Return Signature for Method + * Server Function: Return Signature for Method * * @access public * @param mixed @@ -458,7 +458,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc // -------------------------------------------------------------------- /** - * Server Function: Doc String for Method + * Server Function: Doc String for Method * * @access public * @param mixed @@ -480,11 +480,11 @@ class CI_Xmlrpcs extends CI_Xmlrpc return new XML_RPC_Response(0, $this->xmlrpcerr['introspect_unknown'], $this->xmlrpcstr['introspect_unknown']); } } - + // -------------------------------------------------------------------- /** - * Server Function: Multi-call + * Server Function: Multi-call * * @access public * @param mixed @@ -528,7 +528,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc // -------------------------------------------------------------------- /** - * Multi-call Function: Error Handling + * Multi-call Function: Error Handling * * @access public * @param mixed @@ -536,7 +536,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc */ function multicall_error($err) { - $str = is_string($err) ? $this->xmlrpcstr["multicall_${err}"] : $err->faultString(); + $str = is_string($err) ? $this->xmlrpcstr["multicall_${err}"] : $err->faultString(); $code = is_string($err) ? $this->xmlrpcerr["multicall_${err}"] : $err->faultCode(); $struct['faultCode'] = new XML_RPC_Values($code, 'int'); @@ -548,7 +548,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc // -------------------------------------------------------------------- /** - * Multi-call Function: Processes method + * Multi-call Function: Processes method * * @access public * @param mixed diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 666327d5c..1ae3e7f25 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -1,4 +1,4 @@ -CI =& get_instance(); + $this->CI =& get_instance(); extract($params); if ($autoload === TRUE) { - $this->script(); + $this->script(); } - + log_message('debug', "Jquery Class Initialized"); } - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // Event Code - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- /** * Blur @@ -65,9 +65,9 @@ class CI_Jquery extends CI_Javascript { { return $this->_add_event($element, $js, 'blur'); } - + // -------------------------------------------------------------------- - + /** * Change * @@ -82,9 +82,9 @@ class CI_Jquery extends CI_Javascript { { return $this->_add_event($element, $js, 'change'); } - + // -------------------------------------------------------------------- - + /** * Click * @@ -112,7 +112,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Double Click * @@ -129,7 +129,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Error * @@ -146,7 +146,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Focus * @@ -163,7 +163,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Hover * @@ -185,7 +185,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Keydown * @@ -202,7 +202,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Keyup * @@ -216,10 +216,10 @@ class CI_Jquery extends CI_Javascript { function _keyup($element = 'this', $js = '') { return $this->_add_event($element, $js, 'keyup'); - } + } // -------------------------------------------------------------------- - + /** * Load * @@ -233,10 +233,10 @@ class CI_Jquery extends CI_Javascript { function _load($element = 'this', $js = '') { return $this->_add_event($element, $js, 'load'); - } - + } + // -------------------------------------------------------------------- - + /** * Mousedown * @@ -253,7 +253,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Mouse Out * @@ -270,7 +270,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Mouse Over * @@ -321,7 +321,7 @@ class CI_Jquery extends CI_Javascript { { $array_js = array($array_js); } - + foreach ($array_js as $js) { $this->jquery_code_for_compile[] = "\t$js\n"; @@ -361,7 +361,7 @@ class CI_Jquery extends CI_Javascript { { return $this->_add_event($element, $js, 'scroll'); } - + // -------------------------------------------------------------------- /** @@ -379,10 +379,10 @@ class CI_Jquery extends CI_Javascript { return $this->_add_event($element, $js, 'unload'); } - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Effects - // -------------------------------------------------------------------- - + // -------------------------------------------------------------------- + /** * Add Class * @@ -395,7 +395,7 @@ class CI_Jquery extends CI_Javascript { function _addClass($element = 'this', $class='') { $element = $this->_prep_element($element); - $str = "$({$element}).addClass(\"$class\");"; + $str = "$({$element}).addClass(\"$class\");"; return $str; } @@ -416,9 +416,9 @@ class CI_Jquery extends CI_Javascript { { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + $animations = "\t\t\t"; - + foreach ($params as $param=>$value) { $animations .= $param.': \''.$value.'\', '; @@ -430,19 +430,19 @@ class CI_Jquery extends CI_Javascript { { $speed = ', '.$speed; } - + if ($extra != '') { $extra = ', '.$extra; } - - $str = "$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; - + + $str = "$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; + return $str; } // -------------------------------------------------------------------- - + /** * Fade In * @@ -456,21 +456,21 @@ class CI_Jquery extends CI_Javascript { */ function _fadeIn($element = 'this', $speed = '', $callback = '') { - $element = $this->_prep_element($element); + $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).fadeIn({$speed}{$callback});"; - + + $str = "$({$element}).fadeIn({$speed}{$callback});"; + return $str; } - + // -------------------------------------------------------------------- - + /** * Fade Out * @@ -486,14 +486,14 @@ class CI_Jquery extends CI_Javascript { { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).fadeOut({$speed}{$callback});"; - + + $str = "$({$element}).fadeOut({$speed}{$callback});"; + return $str; } @@ -512,19 +512,19 @@ class CI_Jquery extends CI_Javascript { */ function _hide($element = 'this', $speed = '', $callback = '') { - $element = $this->_prep_element($element); + $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).hide({$speed}{$callback});"; + + $str = "$({$element}).hide({$speed}{$callback});"; return $str; } - + // -------------------------------------------------------------------- /** @@ -539,12 +539,12 @@ class CI_Jquery extends CI_Javascript { function _removeClass($element = 'this', $class='') { $element = $this->_prep_element($element); - $str = "$({$element}).removeClass(\"$class\");"; + $str = "$({$element}).removeClass(\"$class\");"; return $str; } // -------------------------------------------------------------------- - + /** * Slide Up * @@ -558,21 +558,21 @@ class CI_Jquery extends CI_Javascript { */ function _slideUp($element = 'this', $speed = '', $callback = '') { - $element = $this->_prep_element($element); + $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).slideUp({$speed}{$callback});"; - + + $str = "$({$element}).slideUp({$speed}{$callback});"; + return $str; } - + // -------------------------------------------------------------------- - + /** * Slide Down * @@ -588,19 +588,19 @@ class CI_Jquery extends CI_Javascript { { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).slideDown({$speed}{$callback});"; - + + $str = "$({$element}).slideDown({$speed}{$callback});"; + return $str; } // -------------------------------------------------------------------- - + /** * Slide Toggle * @@ -616,19 +616,19 @@ class CI_Jquery extends CI_Javascript { { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).slideToggle({$speed}{$callback});"; - + + $str = "$({$element}).slideToggle({$speed}{$callback});"; + return $str; } - + // -------------------------------------------------------------------- - + /** * Toggle * @@ -641,12 +641,12 @@ class CI_Jquery extends CI_Javascript { function _toggle($element = 'this') { $element = $this->_prep_element($element); - $str = "$({$element}).toggle();"; + $str = "$({$element}).toggle();"; return $str; } - + // -------------------------------------------------------------------- - + /** * Toggle Class * @@ -659,12 +659,12 @@ class CI_Jquery extends CI_Javascript { function _toggleClass($element = 'this', $class='') { $element = $this->_prep_element($element); - $str = "$({$element}).toggleClass(\"$class\");"; + $str = "$({$element}).toggleClass(\"$class\");"; return $str; } - + // -------------------------------------------------------------------- - + /** * Show * @@ -678,16 +678,16 @@ class CI_Jquery extends CI_Javascript { */ function _show($element = 'this', $speed = '', $callback = '') { - $element = $this->_prep_element($element); + $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).show({$speed}{$callback});"; - + + $str = "$({$element}).show({$speed}{$callback});"; + return $str; } @@ -696,7 +696,7 @@ class CI_Jquery extends CI_Javascript { /** * Updater * - * An Ajax call that populates the designated DOM node with + * An Ajax call that populates the designated DOM node with * returned content * * @access private @@ -705,13 +705,13 @@ class CI_Jquery extends CI_Javascript { * @param string optional parameters * @return string */ - + function _updater($container = 'this', $controller, $options = '') - { + { $container = $this->_prep_element($container); - + $controller = (strpos('://', $controller) === FALSE) ? $controller : $this->CI->config->site_url($controller); - + // ajaxStart and ajaxStop are better choices here... but this is a stop gap if ($this->CI->config->item('javascript_ajax_img') == '') { @@ -721,7 +721,7 @@ class CI_Jquery extends CI_Javascript { { $loading_notifier = 'CI->config->slash_item('base_url') . $this->CI->config->item('javascript_ajax_img') . '\' alt=\'Loading\' />'; } - + $updater = "$($container).empty();\n"; // anything that was in... get it out $updater .= "\t\t$($container).prepend(\"$loading_notifier\");\n"; // to replace with an image @@ -741,7 +741,7 @@ class CI_Jquery extends CI_Javascript { // -------------------------------------------------------------------- // Pre-written handy stuff // -------------------------------------------------------------------- - + /** * Zebra tables * @@ -753,8 +753,8 @@ class CI_Jquery extends CI_Javascript { function _zebraTables($class = '', $odd = 'odd', $hover = '') { $class = ($class != '') ? '.'.$class : ''; - - $zebra = "\t\$(\"table{$class} tbody tr:nth-child(even)\").addClass(\"{$odd}\");"; + + $zebra = "\t\$(\"table{$class} tbody tr:nth-child(even)\").addClass(\"{$odd}\");"; $this->jquery_code_for_compile[] = $zebra; @@ -771,7 +771,7 @@ class CI_Jquery extends CI_Javascript { // -------------------------------------------------------------------- // Plugins // -------------------------------------------------------------------- - + /** * Corner Plugin * @@ -793,7 +793,7 @@ class CI_Jquery extends CI_Javascript { return "$(" . $this->_prep_element($element) . ").corner(".$corner_style.");"; } - + // -------------------------------------------------------------------- /** @@ -805,7 +805,7 @@ class CI_Jquery extends CI_Javascript { * @return void */ function modal($src, $relative = FALSE) - { + { $this->jquery_code_for_load[] = $this->external($src, $relative); } @@ -897,7 +897,7 @@ class CI_Jquery extends CI_Javascript { { $this->jquery_code_for_compile[] = "\t$(" . $this->_prep_element($table) . ").tablesorter($options);\n"; } - + // -------------------------------------------------------------------- // Class functions // -------------------------------------------------------------------- @@ -912,7 +912,7 @@ class CI_Jquery extends CI_Javascript { * @param string The code to execute * @param string The event to pass * @return string - */ + */ function _add_event($element, $js, $event) { if (is_array($js)) @@ -953,15 +953,15 @@ class CI_Jquery extends CI_Javascript { $script = '$(document).ready(function() {' . "\n"; $script .= implode('', $this->jquery_code_for_compile); $script .= '});'; - + $output = ($script_tags === FALSE) ? $script : $this->inline($script); $this->CI->load->vars(array($view_var => $output)); } - + // -------------------------------------------------------------------- - + /** * Clear Compile * @@ -976,7 +976,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Document Ready * @@ -992,7 +992,7 @@ class CI_Jquery extends CI_Javascript { $js = array ($js); } - + foreach ($js as $script) { $this->jquery_code_for_compile[] = $script; @@ -1016,7 +1016,7 @@ class CI_Jquery extends CI_Javascript { $this->jquery_code_for_load[] = $library_src; return $library_src; } - + // -------------------------------------------------------------------- /** @@ -1036,10 +1036,10 @@ class CI_Jquery extends CI_Javascript { { $element = '"'.$element.'"'; } - + return $element; } - + // -------------------------------------------------------------------- /** @@ -1050,7 +1050,7 @@ class CI_Jquery extends CI_Javascript { * @access private * @param string * @return string - */ + */ function _validate_speed($speed) { if (in_array($speed, array('slow', 'normal', 'fast'))) @@ -1061,7 +1061,7 @@ class CI_Jquery extends CI_Javascript { { $speed = ''; } - + return $speed; } -- cgit v1.2.3-24-g4f1b From 28bda7fd05d5261e0da1702e789cfedc6ab423b4 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Mon, 25 Apr 2011 15:00:45 -0500 Subject: swapping out preg_replace() in the driver library where str_replace() works just fine. --- system/libraries/Driver.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'system') diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index b90b5aba6..1e01fcc1f 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -43,11 +43,11 @@ class CI_Driver_Library { // The class will be prefixed with the parent lib $child_class = $this->lib_name.'_'.$child; - + // Remove the CI_ prefix and lowercase - $lib_name = ucfirst(strtolower(preg_replace('/^CI_/', '', $this->lib_name))); - $driver_name = strtolower(preg_replace('/^CI_/', '', $child_class)); - + $lib_name = ucfirst(strtolower(str_replace('CI_', '', $this->lib_name))); + $driver_name = strtolower(str_replace('CI_', '', $child_class)); + if (in_array($driver_name, array_map('strtolower', $this->valid_drivers))) { // check and see if the driver is in a separate file -- cgit v1.2.3-24-g4f1b From d97e12cb0e9c8b5e78e67780d1a9227da35e0da4 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Tue, 26 Apr 2011 09:59:29 -0400 Subject: Automatic base_url generation was missing a ending slash. --- system/core/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/core/Config.php b/system/core/Config.php index fa71f4d3d..55c623b3c 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -55,7 +55,7 @@ class CI_Config { { $base_url = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http'; $base_url .= '://'. $_SERVER['HTTP_HOST']; - $base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']); + $base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']).'/'; } else -- cgit v1.2.3-24-g4f1b From 32dbac2695490fb751fc8da645bba945bc8da718 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Tue, 26 Apr 2011 22:51:32 -0400 Subject: Reverting last change. Don't know what I was thinking. :( --- system/core/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/core/Config.php b/system/core/Config.php index 55c623b3c..fa71f4d3d 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -55,7 +55,7 @@ class CI_Config { { $base_url = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http'; $base_url .= '://'. $_SERVER['HTTP_HOST']; - $base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']).'/'; + $base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']); } else -- cgit v1.2.3-24-g4f1b From 60ef4ea72e169e174ff8dbb421609a178a3c0c48 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Wed, 27 Apr 2011 01:45:38 -0500 Subject: Added insert_batch() function to the PostgreSQL database driver. Thanks to epallerols for the patch. --- system/database/drivers/postgre/postgre_driver.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'system') diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 47ff36246..140396885 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -553,6 +553,24 @@ class CI_DB_postgre_driver extends CI_DB { // -------------------------------------------------------------------- + /** + * Insert_batch statement + * + * Generates a platform-specific insert string from the supplied data + * + * @access public + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string + */ + function _insert_batch($table, $keys, $values) + { + return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values); + } + + // -------------------------------------------------------------------- + /** * Update statement * -- cgit v1.2.3-24-g4f1b From 2e1837a3afabe7e6c71fc88d7a4f5e430fa96744 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Fri, 6 May 2011 12:17:04 -0500 Subject: Fix #275 -- regression in db::_compile_select(). Thanks @patwork for the patch --- system/database/DB_active_rec.php | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'system') diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 508f6bedf..d94d4a13c 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -60,7 +60,7 @@ class CI_DB_active_record extends CI_DB_driver { var $ar_cache_set = array(); var $ar_no_escape = array(); - + var $ar_cache_no_escape = array(); // -------------------------------------------------------------------- @@ -93,6 +93,7 @@ class CI_DB_active_record extends CI_DB_driver { { $this->ar_cache_select[] = $val; $this->ar_cache_exists[] = 'select'; + $this->ar_cache_no_escape[] = $escape; } } } @@ -1933,16 +1934,17 @@ class CI_DB_active_record extends CI_DB_driver { { $this->_reset_run( array( - 'ar_cache_select' => array(), - 'ar_cache_from' => array(), - 'ar_cache_join' => array(), - 'ar_cache_where' => array(), - 'ar_cache_like' => array(), - 'ar_cache_groupby' => array(), - 'ar_cache_having' => array(), - 'ar_cache_orderby' => array(), - 'ar_cache_set' => array(), - 'ar_cache_exists' => array() + 'ar_cache_select' => array(), + 'ar_cache_from' => array(), + 'ar_cache_join' => array(), + 'ar_cache_where' => array(), + 'ar_cache_like' => array(), + 'ar_cache_groupby' => array(), + 'ar_cache_having' => array(), + 'ar_cache_orderby' => array(), + 'ar_cache_set' => array(), + 'ar_cache_exists' => array(), + 'ar_cache_no_escape' => array() ) ); } @@ -1984,6 +1986,8 @@ class CI_DB_active_record extends CI_DB_driver { { $this->_track_aliases($this->ar_from); } + + $this->ar_no_escape = $this->ar_cache_no_escape; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 3ef65bd7491f847fecdab1acc9687f0e90eee09b Mon Sep 17 00:00:00 2001 From: Dan Horrigan Date: Sun, 8 May 2011 11:06:44 -0400 Subject: Wrapped all common functions to check if it already exists. This allows anyone to override a lot more of the core by simply defining these function prior to loading them. --- system/core/Common.php | 61 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 13 deletions(-) (limited to 'system') diff --git a/system/core/Common.php b/system/core/Common.php index eb9e14425..e50f7794a 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -39,6 +39,8 @@ * @param string * @return bool TRUE if the current version is $version or higher */ +if ( ! function_exists('is_php')) +{ function is_php($version = '5.0.0') { static $_is_php; @@ -51,6 +53,7 @@ return $_is_php[$version]; } +} // ------------------------------------------------------------------------ @@ -64,6 +67,8 @@ * @access private * @return void */ +if ( ! function_exists('is_really_writable')) +{ function is_really_writable($file) { // If we're on a Unix server with safe_mode off we call is_writable @@ -96,6 +101,7 @@ fclose($fp); return TRUE; } +} // ------------------------------------------------------------------------ @@ -112,6 +118,8 @@ * @param string the class name prefix * @return object */ +if ( ! function_exists('load_class')) +{ function &load_class($class, $directory = 'libraries', $prefix = 'CI_') { static $_classes = array(); @@ -166,6 +174,7 @@ $_classes[$class] = new $name(); return $_classes[$class]; } +} // -------------------------------------------------------------------- @@ -176,6 +185,8 @@ * @access public * @return array */ +if ( ! function_exists('is_loaded')) +{ function is_loaded($class = '') { static $_is_loaded = array(); @@ -187,6 +198,7 @@ return $_is_loaded; } +} // ------------------------------------------------------------------------ @@ -199,6 +211,8 @@ * @access private * @return array */ +if ( ! function_exists('get_config')) +{ function &get_config($replace = array()) { static $_config; @@ -242,6 +256,7 @@ return $_config[0] =& $config; } +} // ------------------------------------------------------------------------ @@ -251,6 +266,8 @@ * @access public * @return mixed */ +if ( ! function_exists('config_item')) +{ function config_item($item) { static $_config_item = array(); @@ -268,6 +285,7 @@ return $_config_item[$item]; } +} // ------------------------------------------------------------------------ @@ -283,12 +301,15 @@ * @access public * @return void */ +if ( ! function_exists('show_error')) +{ function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered') { $_error =& load_class('Exceptions', 'core'); echo $_error->show_error($heading, $message, 'error_general', $status_code); exit; } +} // ------------------------------------------------------------------------ @@ -302,12 +323,15 @@ * @access public * @return void */ +if ( ! function_exists('show_404')) +{ function show_404($page = '', $log_error = TRUE) { $_error =& load_class('Exceptions', 'core'); $_error->show_404($page, $log_error); exit; } +} // ------------------------------------------------------------------------ @@ -320,6 +344,8 @@ * @access public * @return void */ +if ( ! function_exists('log_message')) +{ function log_message($level = 'error', $message, $php_error = FALSE) { static $_log; @@ -332,6 +358,7 @@ $_log =& load_class('Log'); $_log->write_log($level, $message, $php_error); } +} // ------------------------------------------------------------------------ @@ -343,6 +370,8 @@ * @param string * @return void */ +if ( ! function_exists('set_status_header')) +{ function set_status_header($code = 200, $text = '') { $stati = array( @@ -417,6 +446,7 @@ header("HTTP/1.1 {$code} {$text}", TRUE, $code); } } +} // -------------------------------------------------------------------- @@ -434,6 +464,8 @@ * @access private * @return void */ +if ( ! function_exists('_exception_handler')) +{ function _exception_handler($severity, $message, $filepath, $line) { // We don't bother with "strict" notices since they tend to fill up @@ -463,19 +495,22 @@ $_error->log_exception($severity, $message, $filepath, $line); } +} - // -------------------------------------------------------------------- - - /** - * Remove Invisible Characters - * - * This prevents sandwiching null characters - * between ascii characters, like Java\0script. - * - * @access public - * @param string - * @return string - */ +// -------------------------------------------------------------------- + +/** + * Remove Invisible Characters + * + * This prevents sandwiching null characters + * between ascii characters, like Java\0script. + * + * @access public + * @param string + * @return string + */ +if ( ! function_exists('remove_invisible_characters')) +{ function remove_invisible_characters($str, $url_encoded = TRUE) { $non_displayables = array(); @@ -499,7 +534,7 @@ return $str; } - +} /* End of file Common.php */ /* Location: ./system/core/Common.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 4b9c62980599228f070b401c7673dce8085b0c61 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Fri, 1 Jul 2011 17:40:48 -0500 Subject: backed out 648b42a75739, which was a NON-trivial whitespace commit. It broke the Typography class's string replacements, for instance --- system/core/Benchmark.php | 4 +- system/core/CodeIgniter.php | 68 +++---- system/core/Common.php | 28 +-- system/core/Config.php | 18 +- system/core/Controller.php | 6 +- system/core/Exceptions.php | 6 +- system/core/Hooks.php | 4 +- system/core/Input.php | 24 +-- system/core/Lang.php | 2 +- system/core/Loader.php | 60 +++--- system/core/Model.php | 2 +- system/core/Output.php | 20 +- system/core/Router.php | 26 +-- system/core/Security.php | 104 +++++----- system/core/URI.php | 14 +- system/core/Utf8.php | 2 +- system/database/DB.php | 16 +- system/database/DB_active_rec.php | 32 +-- system/database/DB_cache.php | 6 +- system/database/DB_driver.php | 34 ++-- system/database/DB_forge.php | 2 +- system/database/DB_result.php | 106 +++++----- system/database/DB_utility.php | 6 +- system/database/drivers/mssql/mssql_driver.php | 2 +- system/database/drivers/mssql/mssql_forge.php | 4 +- system/database/drivers/mssql/mssql_result.php | 4 +- system/database/drivers/mssql/mssql_utility.php | 2 +- system/database/drivers/mysql/mysql_driver.php | 14 +- system/database/drivers/mysql/mysql_forge.php | 4 +- system/database/drivers/mysql/mysql_result.php | 4 +- system/database/drivers/mysql/mysql_utility.php | 4 +- system/database/drivers/mysqli/mysqli_driver.php | 8 +- system/database/drivers/mysqli/mysqli_forge.php | 4 +- system/database/drivers/mysqli/mysqli_result.php | 4 +- system/database/drivers/mysqli/mysqli_utility.php | 2 +- system/database/drivers/oci8/oci8_driver.php | 138 ++++++------- system/database/drivers/oci8/oci8_forge.php | 4 +- system/database/drivers/oci8/oci8_result.php | 34 ++-- system/database/drivers/oci8/oci8_utility.php | 2 +- system/database/drivers/odbc/odbc_driver.php | 2 +- system/database/drivers/odbc/odbc_forge.php | 4 +- system/database/drivers/odbc/odbc_result.php | 4 +- system/database/drivers/odbc/odbc_utility.php | 2 +- system/database/drivers/postgre/postgre_driver.php | 2 +- system/database/drivers/postgre/postgre_forge.php | 10 +- system/database/drivers/postgre/postgre_result.php | 4 +- .../database/drivers/postgre/postgre_utility.php | 2 +- system/database/drivers/sqlite/sqlite_driver.php | 2 +- system/database/drivers/sqlite/sqlite_forge.php | 6 +- system/database/drivers/sqlite/sqlite_result.php | 4 +- system/database/drivers/sqlite/sqlite_utility.php | 4 +- system/helpers/array_helper.php | 8 +- system/helpers/captcha_helper.php | 20 +- system/helpers/cookie_helper.php | 6 +- system/helpers/date_helper.php | 22 +-- system/helpers/directory_helper.php | 4 +- system/helpers/download_helper.php | 2 +- system/helpers/email_helper.php | 2 +- system/helpers/file_helper.php | 4 +- system/helpers/form_helper.php | 18 +- system/helpers/html_helper.php | 10 +- system/helpers/inflector_helper.php | 14 +- system/helpers/language_helper.php | 2 +- system/helpers/number_helper.php | 2 +- system/helpers/path_helper.php | 4 +- system/helpers/security_helper.php | 4 +- system/helpers/smiley_helper.php | 12 +- system/helpers/string_helper.php | 8 +- system/helpers/text_helper.php | 10 +- system/helpers/typography_helper.php | 2 +- system/helpers/url_helper.php | 6 +- system/helpers/xml_helper.php | 4 +- system/language/english/email_lang.php | 6 +- system/language/english/imglib_lang.php | 10 +- system/libraries/Cache/Cache.php | 30 +-- system/libraries/Cache/drivers/Cache_apc.php | 24 +-- system/libraries/Cache/drivers/Cache_file.php | 40 ++-- system/libraries/Calendar.php | 18 +- system/libraries/Cart.php | 22 +-- system/libraries/Driver.php | 2 +- system/libraries/Email.php | 46 ++--- system/libraries/Encrypt.php | 2 +- system/libraries/Form_validation.php | 32 +-- system/libraries/Ftp.php | 8 +- system/libraries/Image_lib.php | 118 +++++------ system/libraries/Javascript.php | 12 +- system/libraries/Log.php | 8 +- system/libraries/Pagination.php | 18 +- system/libraries/Parser.php | 18 +- system/libraries/Profiler.php | 26 +-- system/libraries/Session.php | 30 +-- system/libraries/Sha1.php | 8 +- system/libraries/Table.php | 12 +- system/libraries/Trackback.php | 16 +- system/libraries/Typography.php | 36 ++-- system/libraries/Unit_test.php | 2 +- system/libraries/Upload.php | 28 +-- system/libraries/User_agent.php | 2 +- system/libraries/Xmlrpc.php | 90 ++++----- system/libraries/Xmlrpcs.php | 44 ++--- system/libraries/Zip.php | 12 +- system/libraries/javascript/Jquery.php | 218 ++++++++++----------- 102 files changed, 986 insertions(+), 986 deletions(-) (limited to 'system') diff --git a/system/core/Benchmark.php b/system/core/Benchmark.php index 3686c2d73..515550e9f 100644 --- a/system/core/Benchmark.php +++ b/system/core/Benchmark.php @@ -1,4 +1,4 @@ -_call_hook('pre_system'); /* * ------------------------------------------------------ - * Instantiate the config class + * Instantiate the config class * ------------------------------------------------------ */ $CFG =& load_class('Config', 'core'); @@ -143,7 +143,7 @@ /* * ------------------------------------------------------ - * Instantiate the UTF-8 class + * Instantiate the UTF-8 class * ------------------------------------------------------ * * Note: Order here is rather important as the UTF-8 @@ -157,14 +157,14 @@ /* * ------------------------------------------------------ - * Instantiate the URI class + * Instantiate the URI class * ------------------------------------------------------ */ $URI =& load_class('URI', 'core'); /* * ------------------------------------------------------ - * Instantiate the routing class and set the routing + * Instantiate the routing class and set the routing * ------------------------------------------------------ */ $RTR =& load_class('Router', 'core'); @@ -178,14 +178,14 @@ /* * ------------------------------------------------------ - * Instantiate the output class + * Instantiate the output class * ------------------------------------------------------ */ $OUT =& load_class('Output', 'core'); /* * ------------------------------------------------------ - * Is there a valid cache file? If so, we're done... + * Is there a valid cache file? If so, we're done... * ------------------------------------------------------ */ if ($EXT->_call_hook('cache_override') === FALSE) @@ -205,21 +205,21 @@ /* * ------------------------------------------------------ - * Load the Input class and sanitize globals + * Load the Input class and sanitize globals * ------------------------------------------------------ */ $IN =& load_class('Input', 'core'); /* * ------------------------------------------------------ - * Load the Language class + * Load the Language class * ------------------------------------------------------ */ $LANG =& load_class('Lang', 'core'); /* * ------------------------------------------------------ - * Load the app controller and local controller + * Load the app controller and local controller * ------------------------------------------------------ * */ @@ -252,14 +252,14 @@ /* * ------------------------------------------------------ - * Security check + * Security check * ------------------------------------------------------ * - * None of the functions in the app controller or the - * loader class can be called via the URI, nor can - * controller functions that begin with an underscore + * None of the functions in the app controller or the + * loader class can be called via the URI, nor can + * controller functions that begin with an underscore */ - $class = $RTR->fetch_class(); + $class = $RTR->fetch_class(); $method = $RTR->fetch_method(); if ( ! class_exists($class) @@ -272,14 +272,14 @@ /* * ------------------------------------------------------ - * Is there a "pre_controller" hook? + * Is there a "pre_controller" hook? * ------------------------------------------------------ */ $EXT->_call_hook('pre_controller'); /* * ------------------------------------------------------ - * Instantiate the requested controller + * Instantiate the requested controller * ------------------------------------------------------ */ // Mark a start point so we can benchmark the controller @@ -289,14 +289,14 @@ /* * ------------------------------------------------------ - * Is there a "post_controller_constructor" hook? + * Is there a "post_controller_constructor" hook? * ------------------------------------------------------ */ $EXT->_call_hook('post_controller_constructor'); /* * ------------------------------------------------------ - * Call the requested method + * Call the requested method * ------------------------------------------------------ */ // Is there a "remap" function? If so, we call it instead @@ -345,14 +345,14 @@ /* * ------------------------------------------------------ - * Is there a "post_controller" hook? + * Is there a "post_controller" hook? * ------------------------------------------------------ */ $EXT->_call_hook('post_controller'); /* * ------------------------------------------------------ - * Send the final rendered output to the browser + * Send the final rendered output to the browser * ------------------------------------------------------ */ if ($EXT->_call_hook('display_override') === FALSE) @@ -362,14 +362,14 @@ /* * ------------------------------------------------------ - * Is there a "post_system" hook? + * Is there a "post_system" hook? * ------------------------------------------------------ */ $EXT->_call_hook('post_system'); /* * ------------------------------------------------------ - * Close the DB connection if one exists + * Close the DB connection if one exists * ------------------------------------------------------ */ if (class_exists('CI_DB') AND isset($CI->db)) diff --git a/system/core/Common.php b/system/core/Common.php index eb9e14425..d1e8e77e9 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -1,4 +1,4 @@ -show_php_error($severity, $message, $filepath, $line); } - // Should we log the error? No? We're done... + // Should we log the error? No? We're done... if (config_item('log_threshold') == 0) { return; @@ -479,16 +479,16 @@ function remove_invisible_characters($str, $url_encoded = TRUE) { $non_displayables = array(); - + // every control character except newline (dec 10) // carriage return (dec 13), and horizontal tab (dec 09) - + if ($url_encoded) { $non_displayables[] = '/%0[0-8bcef]/'; // url encoded 00-08, 11, 12, 14, 15 $non_displayables[] = '/%1[0-9a-f]/'; // url encoded 16-31 } - + $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 do diff --git a/system/core/Config.php b/system/core/Config.php index fa71f4d3d..1096a9ea6 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -1,4 +1,4 @@ -load =& load_class('Loader', 'core'); $this->load->set_base_classes()->ci_autoloader(); - + log_message('debug', "Controller Class Initialized"); } diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 2503c907f..bff86a92f 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -1,4 +1,4 @@ -ob_level = ob_get_level(); - // Note: Do not log messages from this constructor. + // Note: Do not log messages from this constructor. } // -------------------------------------------------------------------- @@ -75,7 +75,7 @@ class CI_Exceptions { { $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; - log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE); + log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE); } // -------------------------------------------------------------------- diff --git a/system/core/Hooks.php b/system/core/Hooks.php index ffb3258d8..fd6380f0a 100644 --- a/system/core/Hooks.php +++ b/system/core/Hooks.php @@ -1,4 +1,4 @@ -_fetch_from_array($_POST, $index, $xss_clean); } @@ -201,7 +201,7 @@ class CI_Input { * @param mixed * @param string the value of the cookie * @param string the number of seconds until expiration - * @param string the cookie domain. Usually: .yourdomain.com + * @param string the cookie domain. Usually: .yourdomain.com * @param string the cookie path * @param string the cookie prefix * @param bool true makes the cookie secure @@ -402,9 +402,9 @@ class CI_Input { function _sanitize_globals() { // It would be "wrong" to unset any of these GLOBALS. - $protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST', + $protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST', '_SESSION', '_ENV', 'GLOBALS', 'HTTP_RAW_POST_DATA', - 'system_folder', 'application_folder', 'BM', 'EXT', + 'system_folder', 'application_folder', 'BM', 'EXT', 'CFG', 'URI', 'RTR', 'OUT', 'IN'); // Unset globals for securiy. @@ -523,7 +523,7 @@ class CI_Input { { $str = $this->uni->clean_string($str); } - + // Remove control characters $str = remove_invisible_characters($str); @@ -579,7 +579,7 @@ class CI_Input { /** * Request Headers * - * In Apache, you can simply call apache_request_headers(), however for + * In Apache, you can simply call apache_request_headers(), however for * people running other webservers the function is undefined. * * @return array @@ -609,10 +609,10 @@ class CI_Input { { $key = str_replace('_', ' ', strtolower($key)); $key = str_replace(' ', '-', ucwords($key)); - + $this->headers[$key] = $val; } - + return $this->headers; } @@ -633,7 +633,7 @@ class CI_Input { { $this->request_headers(); } - + if ( ! isset($this->headers[$index])) { return FALSE; @@ -644,7 +644,7 @@ class CI_Input { return $this->security->xss_clean($this->headers[$index]); } - return $this->headers[$index]; + return $this->headers[$index]; } // -------------------------------------------------------------------- diff --git a/system/core/Lang.php b/system/core/Lang.php index 79eb443a0..170e6c725 100644 --- a/system/core/Lang.php +++ b/system/core/Lang.php @@ -1,4 +1,4 @@ - 'unit', + protected $_ci_varmap = array('unit_test' => 'unit', 'user_agent' => 'agent'); /** @@ -50,29 +50,29 @@ class CI_Loader { */ public function __construct() { - $this->_ci_ob_level = ob_get_level(); + $this->_ci_ob_level = ob_get_level(); $this->_ci_library_paths = array(APPPATH, BASEPATH); $this->_ci_helper_paths = array(APPPATH, BASEPATH); $this->_ci_model_paths = array(APPPATH); $this->_ci_view_paths = array(APPPATH.'views/' => TRUE); - + log_message('debug', "Loader Class Initialized"); } // -------------------------------------------------------------------- - + /** * Set _base_classes variable * * This method is called once in CI_Controller. * - * @param array + * @param array * @return object */ public function set_base_classes() { $this->_base_classes =& is_loaded(); - + return $this; } @@ -96,7 +96,7 @@ class CI_Loader { { return $this->_ci_classes[$class]; } - + return FALSE; } @@ -260,7 +260,7 @@ class CI_Loader { return DB($params, $active_record); } - // Initialize the db variable. Needed to prevent + // Initialize the db variable. Needed to prevent // reference errors with some configurations $CI->db = ''; @@ -323,11 +323,11 @@ class CI_Loader { /** * Load View * - * This function is used to load a "view" file. It has three parameters: + * This function is used to load a "view" file. It has three parameters: * * 1. The name of the "view" file to be included. * 2. An associative array of data to be extracted for use in the view. - * 3. TRUE/FALSE - whether to return the data or load it. In + * 3. TRUE/FALSE - whether to return the data or load it. In * some cases it's advantageous to be able to return data so that * a developer can process it in some way. * @@ -538,13 +538,13 @@ class CI_Loader { * Prepends a parent path to the library, model, helper, and config path arrays * * @param string - * @param boolean + * @param boolean * @return void */ public function add_package_path($path, $view_cascade=TRUE) { $path = rtrim($path, '/').'/'; - + array_unshift($this->_ci_library_paths, $path); array_unshift($this->_ci_model_paths, $path); array_unshift($this->_ci_helper_paths, $path); @@ -604,7 +604,7 @@ class CI_Loader { unset($this->{$var}[$key]); } } - + if (isset($this->_ci_view_paths[$path.'views/'])) { unset($this->_ci_view_paths[$path.'views/']); @@ -643,7 +643,7 @@ class CI_Loader { { $$_ci_val = ( ! isset($_ci_data[$_ci_val])) ? FALSE : $_ci_data[$_ci_val]; } - + $file_exists = FALSE; // Set the path to the requested file @@ -665,11 +665,11 @@ class CI_Loader { $file_exists = TRUE; break; } - + if ( ! $cascade) { break; - } + } } } @@ -710,9 +710,9 @@ class CI_Loader { * We buffer the output for two reasons: * 1. Speed. You get a significant speed boost. * 2. So that the final rendered template can be - * post-processed by the output class. Why do we - * need post processing? For one thing, in order to - * show the elapsed page load time. Unless we + * post-processed by the output class. Why do we + * need post processing? For one thing, in order to + * show the elapsed page load time. Unless we * can intercept the content right before it's sent to * the browser and then stop the timer it won't be accurate. */ @@ -809,11 +809,11 @@ class CI_Loader { show_error("Unable to load the requested class: ".$class); } - // Safety: Was the class already loaded by a previous call? + // Safety: Was the class already loaded by a previous call? if (in_array($subclass, $this->_ci_loaded_files)) { // Before we deem this to be a duplicate request, let's see - // if a custom object name is being supplied. If so, we'll + // if a custom object name is being supplied. If so, we'll // return a new instance of the object if ( ! is_null($object_name)) { @@ -842,17 +842,17 @@ class CI_Loader { { $filepath = $path.'libraries/'.$subdir.$class.'.php'; - // Does the file exist? No? Bummer... + // Does the file exist? No? Bummer... if ( ! file_exists($filepath)) { continue; } - // Safety: Was the class already loaded by a previous call? + // Safety: Was the class already loaded by a previous call? if (in_array($filepath, $this->_ci_loaded_files)) { // Before we deem this to be a duplicate request, let's see - // if a custom object name is being supplied. If so, we'll + // if a custom object name is being supplied. If so, we'll // return a new instance of the object if ( ! is_null($object_name)) { @@ -875,7 +875,7 @@ class CI_Loader { } // END FOREACH - // One last attempt. Maybe the library is in a subdirectory, but it wasn't specified? + // One last attempt. Maybe the library is in a subdirectory, but it wasn't specified? if ($subdir == '') { $path = strtolower($class).'/'.$class; @@ -903,7 +903,7 @@ class CI_Loader { */ protected function _ci_init_class($class, $prefix = '', $config = FALSE, $object_name = NULL) { - // Is there an associated config file for this class? Note: these should always be lowercase + // Is there an associated config file for this class? Note: these should always be lowercase if ($config === NULL) { // Fetch the config paths containing any package paths @@ -970,7 +970,7 @@ class CI_Loader { } // Set the variable name we will assign the class to - // Was a custom class name supplied? If so we'll use it + // Was a custom class name supplied? If so we'll use it $class = strtolower($class); if (is_null($object_name)) @@ -1005,7 +1005,7 @@ class CI_Loader { * The config/autoload.php file contains an array that permits sub-systems, * libraries, and helpers to be loaded automatically. * - * This function is public, as it's used in the CI_Controller class. + * This function is public, as it's used in the CI_Controller class. * However, there is no reason you should ever needs to use it. * * @param array @@ -1021,7 +1021,7 @@ class CI_Loader { { include_once(APPPATH.'config/autoload.php'); } - + if ( ! isset($autoload)) { diff --git a/system/core/Model.php b/system/core/Model.php index 61c71b672..8566a0b66 100644 --- a/system/core/Model.php +++ b/system/core/Model.php @@ -1,4 +1,4 @@ -final_output * * This function sends the finalized output data to the browser along - * with any server headers and profile data. It also stops the + * with any server headers and profile data. It also stops the * benchmark timer so the page rendering speed and memory usage can be shown. * * @access public @@ -269,7 +269,7 @@ class CI_Output { */ function _display($output = '') { - // Note: We use globals because we can't use $CI =& get_instance() + // Note: We use globals because we can't use $CI =& get_instance() // since this function is sometimes called by the caching mechanism, // which happens before the CI super object is available. global $BM, $CFG; @@ -290,7 +290,7 @@ class CI_Output { // -------------------------------------------------------------------- - // Do we need to write a cache file? Only if the controller does not have its + // Do we need to write a cache file? Only if the controller does not have its // own _output() method and we are not dealing with a cache file, which we // can determine by the existence of the $CI object above if ($this->cache_expiration > 0 && isset($CI) && ! method_exists($CI, '_output')) @@ -368,7 +368,7 @@ class CI_Output { // we will remove them and add them back after we insert the profile data if (preg_match("|.*?|is", $output)) { - $output = preg_replace("|.*?|is", '', $output); + $output = preg_replace("|.*?|is", '', $output); $output .= $CI->profiler->run(); $output .= ''; } @@ -381,14 +381,14 @@ class CI_Output { // -------------------------------------------------------------------- // Does the controller contain a function named _output()? - // If so send the output there. Otherwise, echo it. + // If so send the output there. Otherwise, echo it. if (method_exists($CI, '_output')) { $CI->_output($output); } else { - echo $output; // Send it to the browser! + echo $output; // Send it to the browser! } log_message('debug', "Final output sent to browser"); @@ -458,7 +458,7 @@ class CI_Output { { $cache_path = ($CFG->item('cache_path') == '') ? APPPATH.'cache/' : $CFG->item('cache_path'); - // Build the file path. The file name is an MD5 hash of the full URI + // Build the file path. The file name is an MD5 hash of the full URI $uri = $CFG->item('base_url'). $CFG->item('index_page'). $URI->uri_string; diff --git a/system/core/Router.php b/system/core/Router.php index a76a7bd0a..5e92a04b1 100644 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -1,4 +1,4 @@ -routes = ( ! isset($route) OR ! is_array($route)) ? array() : $route; unset($route); @@ -103,7 +103,7 @@ class CI_Router { // 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']); - // Were there any query string segments? If so, we'll validate them and bail out since we're done. + // Were there any query string segments? If so, we'll validate them and bail out since we're done. if (count($segments) > 0) { return $this->_validate_request($segments); @@ -212,7 +212,7 @@ class CI_Router { // -------------------------------------------------------------------- /** - * Validates the supplied segments. Attempts to determine the path to + * Validates the supplied segments. Attempts to determine the path to * the controller. * * @access private @@ -277,7 +277,7 @@ class CI_Router { // If we've gotten this far it means that the URI does not correlate to a valid - // controller class. We will now see if there is an override + // controller class. We will now see if there is an override if ( ! empty($this->routes['404_override'])) { $x = explode('/', $this->routes['404_override']); @@ -296,7 +296,7 @@ class CI_Router { // -------------------------------------------------------------------- /** - * Parse Routes + * Parse Routes * * This function matches any routes that may exist in * the config/routes.php file against the URI to @@ -310,7 +310,7 @@ class CI_Router { // Turn the segment array into a URI string $uri = implode('/', $this->uri->segments); - // Is there a literal match? If so we're done + // Is there a literal match? If so we're done if (isset($this->routes[$uri])) { return $this->_set_request(explode('/', $this->routes[$uri])); @@ -370,7 +370,7 @@ class CI_Router { // -------------------------------------------------------------------- /** - * Set the method name + * Set the method name * * @access public * @param string @@ -384,7 +384,7 @@ class CI_Router { // -------------------------------------------------------------------- /** - * Fetch the current method + * Fetch the current method * * @access public * @return string @@ -402,7 +402,7 @@ class CI_Router { // -------------------------------------------------------------------- /** - * Set the directory name + * Set the directory name * * @access public * @param string @@ -416,7 +416,7 @@ class CI_Router { // -------------------------------------------------------------------- /** - * Fetch the sub-directory (if any) that contains the requested controller class + * Fetch the sub-directory (if any) that contains the requested controller class * * @access public * @return string @@ -429,7 +429,7 @@ class CI_Router { // -------------------------------------------------------------------- /** - * Set the controller overrides + * Set the controller overrides * * @access public * @param array diff --git a/system/core/Security.php b/system/core/Security.php index f5bfafd9b..3617cadcc 100644 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -1,4 +1,4 @@ - '[removed]', // IE, surprise! "Redirect\s+302" => '[removed]' ); - + /** * Constructor */ @@ -95,7 +95,7 @@ class CI_Security { } // Do the tokens exist in both the _POST and _COOKIE arrays? - if ( ! isset($_POST[$this->_csrf_token_name]) OR + if ( ! isset($_POST[$this->_csrf_token_name]) OR ! isset($_COOKIE[$this->_csrf_cookie_name])) { $this->csrf_show_error(); @@ -107,7 +107,7 @@ class CI_Security { $this->csrf_show_error(); } - // We kill this since we're done and we don't want to + // We kill this since we're done and we don't want to // polute the _POST array unset($_POST[$this->_csrf_token_name]); @@ -117,7 +117,7 @@ class CI_Security { $this->csrf_set_cookie(); log_message('debug', "CSRF token verified "); - + return $this; } @@ -146,7 +146,7 @@ class CI_Security { setcookie($this->_csrf_cookie_name, $this->_csrf_hash, $expire, config_item('cookie_path'), config_item('cookie_domain'), $secure_cookie); log_message('debug', "CRSF cookie Set"); - + return $this; } @@ -165,9 +165,9 @@ class CI_Security { // -------------------------------------------------------------------- /** - * Get CSRF Hash + * Get CSRF Hash * - * Getter Method + * Getter Method * * @return string self::_csrf_hash */ @@ -196,14 +196,14 @@ class CI_Security { * XSS Clean * * Sanitizes data so that Cross Site Scripting Hacks can be - * prevented. This function does a fair amount of work but + * prevented. This function does a fair amount of work but * it is extremely thorough, designed to prevent even the - * most obscure XSS attempts. Nothing is ever 100% foolproof, + * most obscure XSS attempts. Nothing is ever 100% foolproof, * of course, but I haven't been able to get anything passed * the filter. * * Note: This function should only be used to deal with data - * upon submission. It's not something that should + * upon submission. It's not something that should * be used for general runtime processing. * * This function was based in part on some code and ideas I @@ -263,7 +263,7 @@ class CI_Security { */ $str = preg_replace_callback("/[a-z]+=([\'\"]).*?\\1/si", array($this, '_convert_attribute'), $str); - + $str = preg_replace_callback("/<\w+.*?(?=>|<|$)/si", array($this, '_decode_entity'), $str); /* @@ -276,7 +276,7 @@ class CI_Security { * * This prevents strings like this: ja vascript * NOTE: we deal with spaces between characters later. - * NOTE: preg_replace was found to be amazingly slow here on + * NOTE: preg_replace was found to be amazingly slow here on * large blocks of data, so we use str_replace. */ @@ -304,27 +304,27 @@ class CI_Security { */ if ($is_image === TRUE) { - // Images have a tendency to have the PHP short opening and - // closing tags every so often so we skip those and only + // Images have a tendency to have the PHP short opening and + // closing tags every so often so we skip those and only // do the long opening tags. $str = preg_replace('/<\?(php)/i', "<?\\1", $str); } else { - $str = str_replace(array(''), array('<?', '?>'), $str); + $str = str_replace(array(''), array('<?', '?>'), $str); } /* * Compact any exploded words * - * This corrects words like: j a v a s c r i p t + * This corrects words like: j a v a s c r i p t * These words are compacted back to their correct state. */ $words = array( - 'javascript', 'expression', 'vbscript', 'script', + 'javascript', 'expression', 'vbscript', 'script', 'applet', 'alert', 'document', 'write', 'cookie', 'window' ); - + foreach ($words as $word) { $temp = ''; @@ -341,8 +341,8 @@ class CI_Security { /* * Remove disallowed Javascript in links or img tags - * We used to do some version comparisons and use of stripos for PHP5, - * but it is dog slow compared to these simplified non-capturing + * We used to do some version comparisons and use of stripos for PHP5, + * but it is dog slow compared to these simplified non-capturing * preg_match(), especially if the pattern exists in the string */ do @@ -388,7 +388,7 @@ class CI_Security { * * Similar to above, only instead of looking for * tags it looks for PHP and JavaScript commands - * that are disallowed. Rather than removing the + * that are disallowed. Rather than removing the * code, it simply converts the parenthesis to entities * rendering the code un-executable. * @@ -405,11 +405,11 @@ class CI_Security { /* * Images are Handled in a Special Way - * - Essentially, we want to know that after all of the character - * conversion is done whether any unwanted, likely XSS, code was found. + * - Essentially, we want to know that after all of the character + * conversion is done whether any unwanted, likely XSS, code was found. * If not, we return TRUE, as the image is clean. - * However, if the string post-conversion does not matched the - * string post-removal of XSS, then it fails, as there was unwanted XSS + * However, if the string post-conversion does not matched the + * string post-removal of XSS, then it fails, as there was unwanted XSS * code found and removed/changed during processing. */ @@ -457,7 +457,7 @@ class CI_Security { * * In some versions of PHP the native function does not work * when UTF-8 is the specified character set, so this gives us - * a work-around. More info here: + * a work-around. More info here: * http://bugs.php.net/bug.php?id=25670 * * NOTE: html_entity_decode() has a bug in some PHP versions when UTF-8 is the @@ -475,10 +475,10 @@ class CI_Security { // The reason we are not using html_entity_decode() by itself is because // while it is not technically correct to leave out the semicolon // at the end of an entity most browsers will still interpret the entity - // correctly. html_entity_decode() does not convert entities without + // correctly. html_entity_decode() does not convert entities without // semicolons, so we are left with our own little solution here. Bummer. - if (function_exists('html_entity_decode') && + if (function_exists('html_entity_decode') && (strtolower($charset) != 'utf-8')) { $str = html_entity_decode($str, ENT_COMPAT, $charset); @@ -542,7 +542,7 @@ class CI_Security { "%3b", // ; "%3d" // = ); - + if ( ! $relative_path) { $bad[] = './'; @@ -570,7 +570,7 @@ class CI_Security { } // -------------------------------------------------------------------- - + /* * Remove Evil HTML Attributes (like evenhandlers and style) * @@ -578,7 +578,7 @@ class CI_Security { * - Everything up until a space * For example, everything between the pipes: * - * - Everything inside the quotes + * - Everything inside the quotes * For example, everything between the pipes: * * @@ -594,12 +594,12 @@ class CI_Security { if ($is_image === TRUE) { /* - * Adobe Photoshop puts XML metadata into JFIF images, + * Adobe Photoshop puts XML metadata into JFIF images, * including namespacing, so we have to allow this for images. */ unset($evil_attributes[array_search('xmlns', $evil_attributes)]); } - + do { $str = preg_replace( "#<(/?[^><]+?)([^A-Za-z\-])(".implode('|', $evil_attributes).")(\s*=\s*)([\"][^>]*?[\"]|[\'][^>]*?[\']|[^>]*?)([\s><])([><]*)#i", @@ -607,10 +607,10 @@ class CI_Security { $str, -1, $count ); } while ($count); - + return $str; } - + // -------------------------------------------------------------------- /** @@ -627,7 +627,7 @@ class CI_Security { $str = '<'.$matches[1].$matches[2].$matches[3]; // encode captured opening or closing brace to prevent recursive vectors - $str .= str_replace(array('>', '<'), array('>', '<'), + $str .= str_replace(array('>', '<'), array('>', '<'), $matches[4]); return $str; @@ -649,7 +649,7 @@ class CI_Security { protected function _js_link_removal($match) { $attributes = $this->_filter_attributes(str_replace(array('<', '>'), '', $match[1])); - + return str_replace($match[1], preg_replace("#href=.*?(alert\(|alert&\#40;|javascript\:|livescript\:|mocha\:|charset\=|window\.|document\.|\.cookie|_filter_attributes(str_replace(array('<', '>'), '', $match[1])); - + return str_replace($match[1], preg_replace("#src=.*?(alert\(|alert&\#40;|javascript\:|livescript\:|mocha\:|charset\=|window\.|document\.|\.cookie|xss_hash()."\\1=\\2", $str); /* * Validate standard character entities * - * Add a semicolon if missing. We do this to enable + * Add a semicolon if missing. We do this to enable * the conversion of entities to ASCII later. * */ @@ -769,7 +769,7 @@ class CI_Security { * Un-Protect GET variables in URLs */ $str = str_replace($this->xss_hash(), '&', $str); - + return $str; } @@ -794,7 +794,7 @@ class CI_Security { { $str = preg_replace("#".$key."#i", $val, $str); } - + return $str; } @@ -809,16 +809,16 @@ class CI_Security { { if ($this->_csrf_hash == '') { - // If the cookie exists we will use it's value. + // If the cookie exists we will use it's value. // We don't necessarily want to regenerate it with - // each page load since a page could contain embedded + // each page load since a page could contain embedded // sub-pages causing this feature to fail - if (isset($_COOKIE[$this->_csrf_cookie_name]) && + if (isset($_COOKIE[$this->_csrf_cookie_name]) && $_COOKIE[$this->_csrf_cookie_name] != '') { return $this->_csrf_hash = $_COOKIE[$this->_csrf_cookie_name]; } - + return $this->_csrf_hash = md5(uniqid(rand(), TRUE)); } diff --git a/system/core/URI.php b/system/core/URI.php index 94fac59ac..d56548654 100644 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -1,4 +1,4 @@ -_set_uri_string($path); @@ -251,7 +251,7 @@ class CI_URI { */ function _remove_url_suffix() { - if ($this->config->item('url_suffix') != "") + if ($this->config->item('url_suffix') != "") { $this->uri_string = preg_replace("|".preg_quote($this->config->item('url_suffix'))."$|", "", $this->uri_string); } @@ -285,7 +285,7 @@ class CI_URI { * Re-index Segments * * This function re-indexes the $this->segment array so that it - * starts at 1 rather than 0. Doing so makes it simpler to + * starts at 1 rather than 0. Doing so makes it simpler to * use functions like $this->uri->segment(n) since there is * a 1:1 relationship between the segment array and the actual segments. * @@ -323,7 +323,7 @@ class CI_URI { * Fetch a URI "routed" Segment * * This function returns the re-routed URI segment (assuming routing rules are used) - * based on the number provided. If there is no routing this function returns the + * based on the number provided. If there is no routing this function returns the * same result as $this->segment() * * @access public @@ -425,7 +425,7 @@ class CI_URI { $i = 0; $lastval = ''; - $retval = array(); + $retval = array(); foreach ($segments as $seg) { if ($i % 2) diff --git a/system/core/Utf8.php b/system/core/Utf8.php index 738d7e9d8..2a27d1f35 100644 --- a/system/core/Utf8.php +++ b/system/core/Utf8.php @@ -1,4 +1,4 @@ -_track_aliases($val); @@ -332,7 +332,7 @@ class CI_DB_active_record extends CI_DB_driver { } } - // Extract any aliases that might exist. We use this information + // Extract any aliases that might exist. We use this information // in the _protect_identifiers to know whether to add a table prefix $this->_track_aliases($table); @@ -438,7 +438,7 @@ class CI_DB_active_record extends CI_DB_driver { $v = ' '.$this->escape($v); } - + if ( ! $this->_has_operator($k)) { $k .= ' = '; @@ -926,7 +926,7 @@ class CI_DB_active_record extends CI_DB_driver { // -------------------------------------------------------------------- /** - * The "set" function. Allows key/value pairs to be set for inserting or updating + * The "set" function. Allows key/value pairs to be set for inserting or updating * * @access public * @param mixed @@ -1084,7 +1084,7 @@ class CI_DB_active_record extends CI_DB_driver { { if ($this->db_debug) { - //No valid data array. Folds in cases where keys and values did not match up + //No valid data array. Folds in cases where keys and values did not match up return $this->display_error('db_must_use_set'); } return FALSE; @@ -1124,7 +1124,7 @@ class CI_DB_active_record extends CI_DB_driver { // -------------------------------------------------------------------- /** - * The "set_insert_batch" function. Allows key/value pairs to be set for batch inserts + * The "set_insert_batch" function. Allows key/value pairs to be set for batch inserts * * @access public * @param mixed @@ -1158,7 +1158,7 @@ class CI_DB_active_record extends CI_DB_driver { if ($escape === FALSE) { - $this->ar_set[] = '('.implode(',', $row).')'; + $this->ar_set[] = '('.implode(',', $row).')'; } else { @@ -1169,7 +1169,7 @@ class CI_DB_active_record extends CI_DB_driver { $clean[] = $this->escape($value); } - $this->ar_set[] = '('.implode(',', $clean).')'; + $this->ar_set[] = '('.implode(',', $clean).')'; } } @@ -1399,7 +1399,7 @@ class CI_DB_active_record extends CI_DB_driver { // -------------------------------------------------------------------- /** - * The "set_update_batch" function. Allows key/value pairs to be set for batch updating + * The "set_update_batch" function. Allows key/value pairs to be set for batch updating * * @access public * @param array @@ -1652,7 +1652,7 @@ class CI_DB_active_record extends CI_DB_driver { return; } - // Does the string contain a comma? If so, we need to separate + // Does the string contain a comma? If so, we need to separate // the string into discreet statements if (strpos($table, ',') !== FALSE) { @@ -1682,7 +1682,7 @@ class CI_DB_active_record extends CI_DB_driver { * Compile the SELECT statement * * Generates a query string based on which functions were used. - * Should not be called directly. The get() function calls it. + * Should not be called directly. The get() function calls it. * * @access private * @return string @@ -1989,7 +1989,7 @@ class CI_DB_active_record extends CI_DB_driver { // -------------------------------------------------------------------- /** - * Resets the active record values. Called by the get() function + * Resets the active record values. Called by the get() function * * @access private * @param array An array of fields to reset @@ -2009,7 +2009,7 @@ class CI_DB_active_record extends CI_DB_driver { // -------------------------------------------------------------------- /** - * Resets the active record values. Called by the get() function + * Resets the active record values. Called by the get() function * * @access private * @return void diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 3249e9d8e..3bf065ca5 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -1,4 +1,4 @@ -CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); + $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); } if ($segment_two == '') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 40be2f903..10e8ed0c0 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -1,4 +1,4 @@ -conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect(); - // No connection resource? Throw an error + // No connection resource? Throw an error if ( ! $this->conn_id) { log_message('error', 'Unable to connect to the database'); @@ -199,7 +199,7 @@ class CI_DB_driver { // -------------------------------------------------------------------- /** - * Database Version Number. Returns a string containing the + * Database Version Number. Returns a string containing the * version of the database being used * * @access public @@ -237,7 +237,7 @@ class CI_DB_driver { * Execute the query * * Accepts an SQL string as input and returns a result object upon - * successful execution of a "read" type query. Returns boolean TRUE + * successful execution of a "read" type query. Returns boolean TRUE * upon successful execution of a "write" type query. Returns boolean * FALSE upon failure, and if the $db_debug variable is set to TRUE * will raise an error. @@ -265,7 +265,7 @@ class CI_DB_driver { $sql = preg_replace("/(\W)".$this->swap_pre."(\S+?)/", "\\1".$this->dbprefix."\\2", $sql); } - // Is query caching enabled? If the query is a "read type" + // Is query caching enabled? If the query is a "read type" // we will load the caching class and return the previously // cached query if it exists if ($this->cache_on == TRUE AND stristr($sql, 'SELECT')) @@ -286,7 +286,7 @@ class CI_DB_driver { $sql = $this->compile_binds($sql, $binds); } - // Save the query for debugging + // Save the query for debugging if ($this->save_queries == TRUE) { $this->queries[] = $sql; @@ -314,7 +314,7 @@ class CI_DB_driver { $error_msg = $this->_error_message(); // We call this function in order to roll-back queries - // if transactions are enabled. If we don't call this here + // if transactions are enabled. If we don't call this here // the error message will trigger an exit, causing the // transactions to remain in limbo. $this->trans_complete(); @@ -385,7 +385,7 @@ class CI_DB_driver { // oci8 vars must be set before calling this $RES->num_rows = $RES->num_rows(); - // Is query caching enabled? If so, we'll serialize the + // Is query caching enabled? If so, we'll serialize the // result object and save it to a cache file. if ($this->cache_on == TRUE AND $this->_cache_init()) { @@ -435,7 +435,7 @@ class CI_DB_driver { /** * Simple Query - * This is a simplified version of the query() function. Internally + * This is a simplified version of the query() function. Internally * we only use it when running transaction commands since they do * not require all the features of the main query() function. * @@ -718,7 +718,7 @@ class CI_DB_driver { /** * Primary * - * Retrieves the primary key. It assumes that the row in the first + * Retrieves the primary key. It assumes that the row in the first * position is the primary key * * @access public @@ -1216,8 +1216,8 @@ class CI_DB_driver { * This function is used extensively by the Active Record class, and by * a couple functions in this class. * It takes a column or table name (optionally with an alias) and inserts - * the table prefix onto it. Some logic is necessary in order to deal with - * column names that include the path. Consider a query like this: + * the table prefix onto it. Some logic is necessary in order to deal with + * column names that include the path. Consider a query like this: * * SELECT * FROM hostname.database.table.column AS c FROM hostname.database.table * @@ -1270,7 +1270,7 @@ class CI_DB_driver { // This is basically a bug fix for queries that use MAX, MIN, etc. // If a parenthesis is found we know that we do not need to - // escape the data or add a prefix. There's probably a more graceful + // escape the data or add a prefix. There's probably a more graceful // way to deal with this, but I'm not thinking of it -- Rick if (strpos($item, '(') !== FALSE) { @@ -1285,7 +1285,7 @@ class CI_DB_driver { $parts = explode('.', $item); // Does the first segment of the exploded item match - // one of the aliases previously identified? If so, + // one of the aliases previously identified? If so, // we have nothing more to do other than escape the item if (in_array($parts[0], $this->ar_aliased_tables)) { @@ -1304,7 +1304,7 @@ class CI_DB_driver { return $item.$alias; } - // Is there a table prefix defined in the config file? If not, no need to do anything + // Is there a table prefix defined in the config file? If not, no need to do anything if ($this->dbprefix != '') { // We now add the table prefix based on some logic. @@ -1358,7 +1358,7 @@ class CI_DB_driver { return $item.$alias; } - // Is there a table prefix? If not, no need to insert it + // Is there a table prefix? If not, no need to insert it if ($this->dbprefix != '') { // Verify table prefix and replace if necessary diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index 9730c7761..a71fca78f 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -1,4 +1,4 @@ -result_array(); - else if ($type == 'object') return $this->result_object(); - else return $this->custom_result_object($type); + if ($type == 'array') return $this->result_array(); + else if ($type == 'object') return $this->result_object(); + else return $this->custom_result_object($type); } // -------------------------------------------------------------------- - /** - * Custom query result. - * - * @param class_name A string that represents the type of object you want back - * @return array of objects - */ - function custom_result_object($class_name) - { - if (array_key_exists($class_name, $this->custom_result_object)) - { - return $this->custom_result_object[$class_name]; - } - - if ($this->result_id === FALSE OR $this->num_rows() == 0) - { - return array(); - } - - // add the data to the object - $this->_data_seek(0); - $result_object = array(); + /** + * Custom query result. + * + * @param class_name A string that represents the type of object you want back + * @return array of objects + */ + function custom_result_object($class_name) + { + if (array_key_exists($class_name, $this->custom_result_object)) + { + return $this->custom_result_object[$class_name]; + } + + if ($this->result_id === FALSE OR $this->num_rows() == 0) + { + return array(); + } + + // add the data to the object + $this->_data_seek(0); + $result_object = array(); while ($row = $this->_fetch_object()) - { - $object = new $class_name(); - foreach ($row as $key => $value) - { - $object->$key = $value; - } + { + $object = new $class_name(); + foreach ($row as $key => $value) + { + $object->$key = $value; + } $result_object[] = $object; } - // return the array - return $this->custom_result_object[$class_name] = $result_object; - } + // return the array + return $this->custom_result_object[$class_name] = $result_object; + } /** - * Query result. "object" version. + * Query result. "object" version. * * @access public * @return object @@ -122,7 +122,7 @@ class CI_DB_result { // -------------------------------------------------------------------- /** - * Query result. "array" version. + * Query result. "array" version. * * @access public * @return array @@ -154,7 +154,7 @@ class CI_DB_result { // -------------------------------------------------------------------- /** - * Query result. Acts as a wrapper function for the following functions. + * Query result. Acts as a wrapper function for the following functions. * * @access public * @param string @@ -180,9 +180,9 @@ class CI_DB_result { $n = 0; } - if ($type == 'object') return $this->row_object($n); - else if ($type == 'array') return $this->row_array($n); - else return $this->custom_row_object($n, $type); + if ($type == 'object') return $this->row_object($n); + else if ($type == 'array') return $this->row_array($n); + else return $this->custom_row_object($n, $type); } // -------------------------------------------------------------------- @@ -219,7 +219,7 @@ class CI_DB_result { // -------------------------------------------------------------------- - /** + /** * Returns a single result row - custom object version * * @access public @@ -242,7 +242,7 @@ class CI_DB_result { return $result[$this->current_row]; } - /** + /** * Returns a single result row - object version * * @access public @@ -383,9 +383,9 @@ class CI_DB_result { /** * The following functions are normally overloaded by the identically named * methods in the platform-specific driver -- except when query caching - * is used. When caching is enabled we do not load the other driver. + * is used. When caching is enabled we do not load the other driver. * These functions are primarily here to prevent undefined function errors - * when a cached result object is in use. They are not otherwise fully + * when a cached result object is in use. They are not otherwise fully * operational due to the unavailability of the database resource IDs with * cached results. */ diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index a3c00a5a6..a5f174f0a 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -1,4 +1,4 @@ -db->db_debug) { diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 56ecf32d1..65397ed8f 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -1,4 +1,4 @@ -db->_protect_identifiers($field); - $sql .= ' '.$attributes['TYPE']; + $sql .= ' '.$attributes['TYPE']; if (array_key_exists('CONSTRAINT', $attributes)) { diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php index f1f6dbb84..2897ca5a5 100644 --- a/system/database/drivers/mssql/mssql_result.php +++ b/system/database/drivers/mssql/mssql_result.php @@ -1,4 +1,4 @@ -= 5.2.3 and MySQL >= 5.0.7, use SET NAMES as fallback @@ -302,12 +302,12 @@ class CI_DB_mysql_driver extends CI_DB { if (is_array($str)) { foreach ($str as $key => $val) - { + { $str[$key] = $this->escape_str($val, $like); - } + } - return $str; - } + return $str; + } if (function_exists('mysql_real_escape_string') AND is_resource($this->conn_id)) { @@ -650,7 +650,7 @@ class CI_DB_mysql_driver extends CI_DB { { if ($field != $index) { - $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; + $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; } } } diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php index 5328a7b4e..529ec980d 100644 --- a/system/database/drivers/mysql/mysql_forge.php +++ b/system/database/drivers/mysql/mysql_forge.php @@ -1,4 +1,4 @@ -= 5.0.7, use SET NAMES as fallback @@ -568,7 +568,7 @@ class CI_DB_mysqli_driver extends CI_DB { { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values); } - + // -------------------------------------------------------------------- /** @@ -630,7 +630,7 @@ class CI_DB_mysqli_driver extends CI_DB { { if ($field != $index) { - $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; + $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; } } } diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php index 6450968dd..d5097335e 100644 --- a/system/database/drivers/mysqli/mysqli_forge.php +++ b/system/database/drivers/mysqli/mysqli_forge.php @@ -1,4 +1,4 @@ - format - * value no the value of the parameter. If this is an OUT or IN OUT parameter, + * value no the value of the parameter. If this is an OUT or IN OUT parameter, * this should be a reference to a variable * type yes the type of the parameter * length yes the max size of the parameter @@ -275,8 +275,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * Bind parameters * - * @access private - * @return none + * @access private + * @return none */ function _bind_params($params) { @@ -386,10 +386,10 @@ class CI_DB_oci8_driver extends CI_DB { /** * Escape String * - * @access public - * @param string + * @access public + * @param string * @param bool whether or not the string will be used in a LIKE condition - * @return string + * @return string */ function escape_str($str, $like = FALSE) { @@ -421,8 +421,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * Affected Rows * - * @access public - * @return integer + * @access public + * @return integer */ function affected_rows() { @@ -434,8 +434,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * Insert ID * - * @access public - * @return integer + * @access public + * @return integer */ function insert_id() { @@ -451,9 +451,9 @@ class CI_DB_oci8_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public - * @param string - * @return string + * @access public + * @param string + * @return string */ function count_all($table = '') { @@ -480,9 +480,9 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private + * @access private * @param boolean - * @return string + * @return string */ function _list_tables($prefix_limit = FALSE) { @@ -503,9 +503,9 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access public - * @param string the table name - * @return string + * @access public + * @param string the table name + * @return string */ function _list_columns($table = '') { @@ -519,9 +519,9 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @access public - * @param string the table name - * @return object + * @access public + * @param string the table name + * @return object */ function _field_data($table) { @@ -533,8 +533,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * The error message string * - * @access private - * @return string + * @access private + * @return string */ function _error_message() { @@ -547,8 +547,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * The error message number * - * @access private - * @return integer + * @access private + * @return integer */ function _error_number() { @@ -627,11 +627,11 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public - * @param string the table name - * @param array the insert keys - * @param array the insert values - * @return string + * @access public + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string */ function _insert($table, $keys, $values) { @@ -732,11 +732,11 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * - * @access public - * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value - * @return string + * @access public + * @param string the sql query string + * @param integer the number of rows to limit the query to + * @param integer the offset value + * @return string */ function _limit($sql, $limit, $offset) { @@ -759,9 +759,9 @@ class CI_DB_oci8_driver extends CI_DB { /** * Close DB Connection * - * @access public - * @param resource - * @return void + * @access public + * @param resource + * @return void */ function _close($conn_id) { diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php index 589e3c29d..3cd17585a 100644 --- a/system/database/drivers/oci8/oci8_forge.php +++ b/system/database/drivers/oci8/oci8_forge.php @@ -1,4 +1,4 @@ -db->_protect_identifiers($field); - $sql .= ' '.$attributes['TYPE']; + $sql .= ' '.$attributes['TYPE']; if (array_key_exists('CONSTRAINT', $attributes)) { diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index 60d8396ef..88531b436 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -1,4 +1,4 @@ -name = ocicolumnname($this->stmt_id, $c); $F->type = ocicolumntype($this->stmt_id, $c); - $F->max_length = ocicolumnsize($this->stmt_id, $c); + $F->max_length = ocicolumnsize($this->stmt_id, $c); $retval[] = $F; } @@ -145,8 +145,8 @@ class CI_DB_oci8_result extends CI_DB_result { * * Returns the result set as an array * - * @access private - * @return array + * @access private + * @return array */ function _fetch_assoc(&$row) { @@ -162,8 +162,8 @@ class CI_DB_oci8_result extends CI_DB_result { * * Returns the result set as an object * - * @access private - * @return object + * @access private + * @return object */ function _fetch_object() { @@ -202,10 +202,10 @@ class CI_DB_oci8_result extends CI_DB_result { // -------------------------------------------------------------------- /** - * Query result. "array" version. + * Query result. "array" version. * - * @access public - * @return array + * @access public + * @return array */ function result_array() { @@ -230,7 +230,7 @@ class CI_DB_oci8_result extends CI_DB_result { /** * Data Seek * - * Moves the internal pointer to the desired offset. We call + * Moves the internal pointer to the desired offset. We call * this internally before fetching results to make sure the * result set starts at zero * diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php index f1fe5dc00..854b467e1 100644 --- a/system/database/drivers/oci8/oci8_utility.php +++ b/system/database/drivers/oci8/oci8_utility.php @@ -1,4 +1,4 @@ -db->_protect_identifiers($field); - $sql .= ' '.$attributes['TYPE']; + $sql .= ' '.$attributes['TYPE']; if (array_key_exists('CONSTRAINT', $attributes)) { diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php index d83b2e5f0..5d64a464f 100644 --- a/system/database/drivers/odbc/odbc_result.php +++ b/system/database/drivers/odbc/odbc_result.php @@ -1,4 +1,4 @@ -db->_protect_identifiers($field); - $sql .= ' '.$attributes['TYPE']; + $sql .= ' '.$attributes['TYPE']; if (array_key_exists('CONSTRAINT', $attributes)) { @@ -172,7 +172,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { /** * Drop Table * - * Unsupported feature in SQLite + * Unsupported feature in SQLite * * @access private * @return bool diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php index 62204946c..7bd30db7c 100644 --- a/system/database/drivers/sqlite/sqlite_result.php +++ b/system/database/drivers/sqlite/sqlite_result.php @@ -1,4 +1,4 @@ -text. To close fieldset + * Used to produce
text. To close fieldset * use form_fieldset_close() * * @access public @@ -663,7 +663,7 @@ if ( ! function_exists('form_prep')) * Form Value * * Grabs a value from the POST array for the specified field so you can - * re-populate an input field or textarea. If Form Validation + * re-populate an input field or textarea. If Form Validation * is active it retrieves the info from the validation class * * @access public @@ -858,7 +858,7 @@ if ( ! function_exists('set_radio')) /** * Form Error * - * Returns the error for a specific form field. This is a helper for the + * Returns the error for a specific form field. This is a helper for the * form validation class. * * @access public @@ -885,7 +885,7 @@ if ( ! function_exists('form_error')) /** * Validation Error String * - * Returns all the errors associated with a form submission. This is a helper + * Returns all the errors associated with a form submission. This is a helper * function for the form validation class. * * @access public @@ -1034,17 +1034,17 @@ if ( ! function_exists('_get_validation_object')) // We set this as a variable since we're returning by reference. $return = FALSE; - + if (FALSE !== ($object = $CI->load->is_loaded('form_validation'))) { if ( ! isset($CI->$object) OR ! is_object($CI->$object)) { return $return; } - + return $CI->$object; } - + return $return; } } diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index bd66bc2d0..080f622dd 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -1,4 +1,4 @@ -\n"; - // Cycle through the list elements. If an array is + // Cycle through the list elements. If an array is // encountered we will recursively call _list() static $_last_list_item = ''; @@ -244,7 +244,7 @@ if ( ! function_exists('img')) * Generates a page document type declaration * * Valid options are xhtml-11, xhtml-strict, xhtml-trans, xhtml-frame, - * html4-strict, html4-trans, and html4-frame. Values are saved in the + * html4-strict, html4-trans, and html4-frame. Values are saved in the * doctypes config file. * * @access public diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 2352b642e..c7c113b8a 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -1,4 +1,4 @@ -'), array('<?php', '<?PHP', '<?', '?>'), $str); + return str_replace(array(''), array('<?php', '<?PHP', '<?', '?>'), $str); } } diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php index 22ca4df77..6d8889354 100644 --- a/system/helpers/smiley_helper.php +++ b/system/helpers/smiley_helper.php @@ -1,4 +1,4 @@ - $val) { // Keep duplicates from being used, which can happen if the - // mapping array contains multiple identical replacements. For example: + // mapping array contains multiple identical replacements. For example: // :-) and :) might be replaced with the same image so both smileys // will be in the array. if (isset($used[$smileys[$key][0]])) @@ -204,7 +204,7 @@ if ( ! function_exists('parse_smileys')) } // Add a trailing slash to the file path if needed - $image_url = preg_replace("/(.+?)\/*$/", "\\1/", $image_url); + $image_url = preg_replace("/(.+?)\/*$/", "\\1/", $image_url); foreach ($smileys as $key => $val) { @@ -231,13 +231,13 @@ if ( ! function_exists('_get_smiley_array')) { if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php')) { - include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'); + include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'); } elseif (file_exists(APPPATH.'config/smileys.php')) { include(APPPATH.'config/smileys.php'); } - + if (isset($smileys) AND is_array($smileys)) { return $smileys; diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index 9f730bd10..7765bba31 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -1,4 +1,4 @@ - $val) { - $x[] = ' '.$key.'="'; + $x[] = ' '.$key.'="'; for ($i = 0; $i < strlen($val); $i++) { $x[] = "|".ord(substr($val, $i, 1)); @@ -363,7 +363,7 @@ if ( ! function_exists('safe_mailto')) * * Automatically links URL and Email addresses. * Note: There's a bit of extra code here to deal with - * URLs or emails that end in a period. We'll strip these + * URLs or emails that end in a period. We'll strip these * off and add them after the link. * * @access public diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php index 2219d662a..cdd81ad70 100644 --- a/system/helpers/xml_helper.php +++ b/system/helpers/xml_helper.php @@ -1,4 +1,4 @@ -","\"", "'", "-"), diff --git a/system/language/english/email_lang.php b/system/language/english/email_lang.php index fe4276822..e3bd113cb 100644 --- a/system/language/english/email_lang.php +++ b/system/language/english/email_lang.php @@ -5,9 +5,9 @@ $lang['email_invalid_address'] = "Invalid email address: %s"; $lang['email_attachment_missing'] = "Unable to locate the following email attachment: %s"; $lang['email_attachment_unreadable'] = "Unable to open this attachment: %s"; $lang['email_no_recipients'] = "You must include recipients: To, Cc, or Bcc"; -$lang['email_send_failure_phpmail'] = "Unable to send email using PHP mail(). Your server might not be configured to send mail using this method."; -$lang['email_send_failure_sendmail'] = "Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method."; -$lang['email_send_failure_smtp'] = "Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method."; +$lang['email_send_failure_phpmail'] = "Unable to send email using PHP mail(). Your server might not be configured to send mail using this method."; +$lang['email_send_failure_sendmail'] = "Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method."; +$lang['email_send_failure_smtp'] = "Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method."; $lang['email_sent'] = "Your message has been successfully sent using the following protocol: %s"; $lang['email_no_socket'] = "Unable to open a socket to Sendmail. Please check settings."; $lang['email_no_hostname'] = "You did not specify a SMTP hostname."; diff --git a/system/language/english/imglib_lang.php b/system/language/english/imglib_lang.php index 0a56fe0a5..66505da07 100644 --- a/system/language/english/imglib_lang.php +++ b/system/language/english/imglib_lang.php @@ -4,20 +4,20 @@ $lang['imglib_source_image_required'] = "You must specify a source image in your $lang['imglib_gd_required'] = "The GD image library is required for this feature."; $lang['imglib_gd_required_for_props'] = "Your server must support the GD image library in order to determine the image properties."; $lang['imglib_unsupported_imagecreate'] = "Your server does not support the GD function required to process this type of image."; -$lang['imglib_gif_not_supported'] = "GIF images are often not supported due to licensing restrictions. You may have to use JPG or PNG images instead."; +$lang['imglib_gif_not_supported'] = "GIF images are often not supported due to licensing restrictions. You may have to use JPG or PNG images instead."; $lang['imglib_jpg_not_supported'] = "JPG images are not supported."; $lang['imglib_png_not_supported'] = "PNG images are not supported."; $lang['imglib_jpg_or_png_required'] = "The image resize protocol specified in your preferences only works with JPEG or PNG image types."; -$lang['imglib_copy_error'] = "An error was encountered while attempting to replace the file. Please make sure your file directory is writable."; +$lang['imglib_copy_error'] = "An error was encountered while attempting to replace the file. Please make sure your file directory is writable."; $lang['imglib_rotate_unsupported'] = "Image rotation does not appear to be supported by your server."; -$lang['imglib_libpath_invalid'] = "The path to your image library is not correct. Please set the correct path in your image preferences."; -$lang['imglib_image_process_failed'] = "Image processing failed. Please verify that your server supports the chosen protocol and that the path to your image library is correct."; +$lang['imglib_libpath_invalid'] = "The path to your image library is not correct. Please set the correct path in your image preferences."; +$lang['imglib_image_process_failed'] = "Image processing failed. Please verify that your server supports the chosen protocol and that the path to your image library is correct."; $lang['imglib_rotation_angle_required'] = "An angle of rotation is required to rotate the image."; $lang['imglib_writing_failed_gif'] = "GIF image."; $lang['imglib_invalid_path'] = "The path to the image is not correct."; $lang['imglib_copy_failed'] = "The image copy routine failed."; $lang['imglib_missing_font'] = "Unable to find a font to use."; -$lang['imglib_save_failed'] = "Unable to save the image. Please make sure the image and file directory are writable."; +$lang['imglib_save_failed'] = "Unable to save the image. Please make sure the image and file directory are writable."; /* End of file imglib_lang.php */ diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index 938c80857..61e7aa761 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -10,22 +10,22 @@ * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 2.0 - * @filesource + * @filesource */ // ------------------------------------------------------------------------ /** - * CodeIgniter Caching Class + * CodeIgniter Caching Class * * @package CodeIgniter * @subpackage Libraries * @category Core * @author ExpressionEngine Dev Team - * @link + * @link */ class CI_Cache extends CI_Driver_Library { - + protected $valid_drivers = array( 'cache_apc', 'cache_file', 'cache_memcached', 'cache_dummy' ); @@ -33,7 +33,7 @@ class CI_Cache extends CI_Driver_Library { protected $_cache_path = NULL; // Path of cache files (if file-based cache) protected $_adapter = 'dummy'; protected $_backup_driver; - + // ------------------------------------------------------------------------ /** @@ -52,16 +52,16 @@ class CI_Cache extends CI_Driver_Library { // ------------------------------------------------------------------------ /** - * Get + * Get * - * Look for a value in the cache. If it exists, return the data + * Look for a value in the cache. If it exists, return the data * if not, return FALSE * - * @param string + * @param string * @return mixed value that is stored/FALSE on failure */ public function get($id) - { + { return $this->{$this->_adapter}->get($id); } @@ -112,7 +112,7 @@ class CI_Cache extends CI_Driver_Library { * Cache Info * * @param string user/filehits - * @return mixed array on success, false on failure + * @return mixed array on success, false on failure */ public function cache_info($type = 'user') { @@ -120,7 +120,7 @@ class CI_Cache extends CI_Driver_Library { } // ------------------------------------------------------------------------ - + /** * Get Cache Metadata * @@ -131,7 +131,7 @@ class CI_Cache extends CI_Driver_Library { { return $this->{$this->_adapter}->get_metadata($id); } - + // ------------------------------------------------------------------------ /** @@ -139,11 +139,11 @@ class CI_Cache extends CI_Driver_Library { * * Initialize class properties based on the configuration array. * - * @param array + * @param array * @return void */ private function _initialize($config) - { + { $default_config = array( 'adapter', 'memcached' @@ -207,7 +207,7 @@ class CI_Cache extends CI_Driver_Library { return $obj; } - + // ------------------------------------------------------------------------ } // End Class diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php index ea129eded..de75719c4 100644 --- a/system/libraries/Cache/drivers/Cache_apc.php +++ b/system/libraries/Cache/drivers/Cache_apc.php @@ -10,30 +10,30 @@ * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 2.0 - * @filesource + * @filesource */ // ------------------------------------------------------------------------ /** - * CodeIgniter APC Caching Class + * CodeIgniter APC Caching Class * * @package CodeIgniter * @subpackage Libraries * @category Core * @author ExpressionEngine Dev Team - * @link + * @link */ class CI_Cache_apc extends CI_Driver { /** - * Get + * Get * - * Look for a value in the cache. If it exists, return the data + * Look for a value in the cache. If it exists, return the data * if not, return FALSE * - * @param string + * @param string * @return mixed value that is stored/FALSE on failure */ public function get($id) @@ -43,8 +43,8 @@ class CI_Cache_apc extends CI_Driver { return (is_array($data)) ? $data[0] : FALSE; } - // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ + /** * Cache Save * @@ -58,7 +58,7 @@ class CI_Cache_apc extends CI_Driver { { return apc_store($id, array($data, time(), $ttl), $ttl); } - + // ------------------------------------------------------------------------ /** @@ -90,7 +90,7 @@ class CI_Cache_apc extends CI_Driver { * Cache Info * * @param string user/filehits - * @return mixed array on success, false on failure + * @return mixed array on success, false on failure */ public function cache_info($type = NULL) { @@ -137,13 +137,13 @@ class CI_Cache_apc extends CI_Driver { log_message('error', 'The APC PHP extension must be loaded to use APC Cache.'); return FALSE; } - + return TRUE; } // ------------------------------------------------------------------------ - + } // End Class diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index 39dcd15c2..13e2d1af6 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -10,19 +10,19 @@ * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 2.0 - * @filesource + * @filesource */ // ------------------------------------------------------------------------ /** - * CodeIgniter Memcached Caching Class + * CodeIgniter Memcached Caching Class * * @package CodeIgniter * @subpackage Libraries * @category Core * @author ExpressionEngine Dev Team - * @link + * @link */ class CI_Cache_file extends CI_Driver { @@ -36,9 +36,9 @@ class CI_Cache_file extends CI_Driver { { $CI =& get_instance(); $CI->load->helper('file'); - + $path = $CI->config->item('cache_path'); - + $this->_cache_path = ($path == '') ? APPPATH.'cache/' : $path; } @@ -56,16 +56,16 @@ class CI_Cache_file extends CI_Driver { { return FALSE; } - + $data = read_file($this->_cache_path.$id); $data = unserialize($data); - - if (time() > $data['time'] + $data['ttl']) + + if (time() > $data['time'] + $data['ttl']) { unlink($this->_cache_path.$id); return FALSE; } - + return $data['data']; } @@ -76,22 +76,22 @@ class CI_Cache_file extends CI_Driver { * * @param string unique key * @param mixed data to store - * @param int length of time (in seconds) the cache is valid + * @param int length of time (in seconds) the cache is valid * - Default is 60 seconds * @return boolean true on success/false on failure */ public function save($id, $data, $ttl = 60) - { + { $contents = array( 'time' => time(), - 'ttl' => $ttl, + 'ttl' => $ttl, 'data' => $data ); - + if (write_file($this->_cache_path.$id, serialize($contents))) { @chmod($this->_cache_path.$id, 0777); - return TRUE; + return TRUE; } return FALSE; @@ -116,7 +116,7 @@ class CI_Cache_file extends CI_Driver { * Clean the Cache * * @return boolean false on failure/true on success - */ + */ public function clean() { return delete_files($this->_cache_path); @@ -151,10 +151,10 @@ class CI_Cache_file extends CI_Driver { { return FALSE; } - - $data = read_file($this->_cache_path.$id); + + $data = read_file($this->_cache_path.$id); $data = unserialize($data); - + if (is_array($data)) { $data = $data['data']; @@ -170,7 +170,7 @@ class CI_Cache_file extends CI_Driver { 'mtime' => $mtime ); } - + return FALSE; } @@ -180,7 +180,7 @@ class CI_Cache_file extends CI_Driver { * Is supported * * In the file driver, check to see that the cache directory is indeed writable - * + * * @return boolean */ public function is_supported() diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php index 7dcbaab47..df0fd6eeb 100644 --- a/system/libraries/Calendar.php +++ b/system/libraries/Calendar.php @@ -1,4 +1,4 @@ -local_time); + $year = date("Y", $this->local_time); if ($month == '') $month = date("m", $this->local_time); @@ -128,7 +128,7 @@ class CI_Calendar { // Set the starting day number $local_date = mktime(12, 0, 0, $month, 1, $year); $date = getdate($local_date); - $day = $start_day + 1 - $date["wday"]; + $day = $start_day + 1 - $date["wday"]; while ($day > 1) { @@ -157,8 +157,8 @@ class CI_Calendar { // "previous" month link if ($this->show_next_prev == TRUE) { - // Add a trailing slash to the URL if needed - $this->next_prev_url = preg_replace("/(.+?)\/*$/", "\\1/", $this->next_prev_url); + // Add a trailing slash to the URL if needed + $this->next_prev_url = preg_replace("/(.+?)\/*$/", "\\1/", $this->next_prev_url); $adjusted_date = $this->adjust_date($month - 1, $year); $out .= str_replace('{previous_url}', $this->next_prev_url.$adjusted_date['year'].'/'.$adjusted_date['month'], $this->temp['heading_previous_cell']); @@ -233,7 +233,7 @@ class CI_Calendar { $out .= $this->temp['cal_cell_blank']; } - $out .= ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_end_today'] : $this->temp['cal_cell_end']; + $out .= ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_end_today'] : $this->temp['cal_cell_end']; $day++; } @@ -287,7 +287,7 @@ class CI_Calendar { * Get Day Names * * Returns an array of day names (Sunday, Monday, etc.) based - * on the type. Options: long, short, abrev + * on the type. Options: long, short, abrev * * @access public * @param string @@ -404,7 +404,7 @@ class CI_Calendar { */ function default_template() { - return array ( + return array ( 'table_open' => '
', 'heading_row_start' => '', 'heading_previous_cell' => '', @@ -451,7 +451,7 @@ class CI_Calendar { $today = array('cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today'); - foreach (array('table_open', 'table_close', 'heading_row_start', 'heading_previous_cell', 'heading_title_cell', 'heading_next_cell', 'heading_row_end', 'week_row_start', 'week_day_cell', 'week_row_end', 'cal_row_start', 'cal_cell_start', 'cal_cell_content', 'cal_cell_no_content', 'cal_cell_blank', 'cal_cell_end', 'cal_row_end', 'cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today') as $val) + foreach (array('table_open', 'table_close', 'heading_row_start', 'heading_previous_cell', 'heading_title_cell', 'heading_next_cell', 'heading_row_end', 'week_row_start', 'week_day_cell', 'week_row_end', 'cal_row_start', 'cal_cell_start', 'cal_cell_content', 'cal_cell_no_content', 'cal_cell_blank', 'cal_cell_end', 'cal_row_end', 'cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today') as $val) { if (preg_match("/\{".$val."\}(.*?)\{\/".$val."\}/si", $this->template, $match)) { diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index fbccfb3d9..7f65b48b9 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -1,4 +1,4 @@ -CI =& get_instance(); - // Are any config settings being passed manually? If so, set them + // Are any config settings being passed manually? If so, set them $config = array(); if (count($params) > 0) { @@ -148,7 +148,7 @@ class CI_Cart { // -------------------------------------------------------------------- - // Does the $items array contain an id, quantity, price, and name? These are required + // Does the $items array contain an id, quantity, price, and name? These are required if ( ! isset($items['id']) OR ! isset($items['qty']) OR ! isset($items['price']) OR ! isset($items['name'])) { log_message('error', 'The cart array must contain a product ID, quantity, price, and name.'); @@ -157,7 +157,7 @@ class CI_Cart { // -------------------------------------------------------------------- - // Prep the quantity. It can only be a number. Duh... + // Prep the quantity. It can only be a number. Duh... $items['qty'] = trim(preg_replace('/([^0-9])/i', '', $items['qty'])); // Trim any leading zeros $items['qty'] = trim(preg_replace('/(^[0]+)/i', '', $items['qty'])); @@ -175,7 +175,7 @@ class CI_Cart { // Note: These can be user-specified by setting the $this->product_id_rules variable. if ( ! preg_match("/^[".$this->product_id_rules."]+$/i", $items['id'])) { - log_message('error', 'Invalid product ID. The product ID can only contain alpha-numeric characters, dashes, and underscores'); + log_message('error', 'Invalid product ID. The product ID can only contain alpha-numeric characters, dashes, and underscores'); return FALSE; } @@ -191,7 +191,7 @@ class CI_Cart { // -------------------------------------------------------------------- - // Prep the price. Remove anything that isn't a number or decimal point. + // Prep the price. Remove anything that isn't a number or decimal point. $items['price'] = trim(preg_replace('/([^0-9\.])/i', '', $items['price'])); // Trim any leading zeros $items['price'] = trim(preg_replace('/(^[0]+)/i', '', $items['price'])); @@ -210,7 +210,7 @@ class CI_Cart { // Each row in the cart array, however, must have a unique index that identifies not only // a particular product, but makes it possible to store identical products with different options. // For example, what if someone buys two identical t-shirts (same product ID), but in - // different sizes? The product ID (and other attributes, like the name) will be identical for + // different sizes? The product ID (and other attributes, like the name) will be identical for // both sizes because it's the same shirt. The only difference will be the size. // Internally, we need to treat identical submissions, but with different options, as a unique product. // Our solution is to convert the options array to a string and MD5 it along with the product ID. @@ -271,7 +271,7 @@ class CI_Cart { } // You can either update a single product using a one-dimensional array, - // or multiple products using a multi-dimensional one. The way we + // or multiple products using a multi-dimensional one. The way we // determine the array type is by looking for a required array key named "id". // If it's not found we assume it's a multi-dimensional array $save_cart = FALSE; @@ -344,7 +344,7 @@ class CI_Cart { return FALSE; } - // Is the quantity zero? If so we will remove the item from the cart. + // Is the quantity zero? If so we will remove the item from the cart. // If the quantity is greater than zero we are updating if ($items['qty'] == 0) { @@ -392,7 +392,7 @@ class CI_Cart { $this->_cart_contents['total_items'] = count($this->_cart_contents); $this->_cart_contents['cart_total'] = $total; - // Is our cart empty? If so we delete it from the session + // Is our cart empty? If so we delete it from the session if (count($this->_cart_contents) <= 2) { $this->CI->session->unset_userdata('cart_contents'); diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index b90b5aba6..d1925c0ec 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -1,4 +1,4 @@ -_attach_name[] = $filename; $this->_attach_type[] = $this->_mime_types(next(explode('.', basename($filename)))); - $this->_attach_disp[] = $disposition; // Can also be 'inline' Not sure if it matters + $this->_attach_disp[] = $disposition; // Can also be 'inline' Not sure if it matters return $this; } @@ -600,7 +600,7 @@ class CI_Email { $from = str_replace(">", "", $from); $from = str_replace("<", "", $from); - return "<".uniqid('').strstr($from, '@').">"; + return "<".uniqid('').strstr($from, '@').">"; } // -------------------------------------------------------------------- @@ -660,15 +660,15 @@ class CI_Email { */ private function _get_content_type() { - if ($this->mailtype == 'html' && count($this->_attach_name) == 0) + if ($this->mailtype == 'html' && count($this->_attach_name) == 0) { return 'html'; } - elseif ($this->mailtype == 'html' && count($this->_attach_name) > 0) + elseif ($this->mailtype == 'html' && count($this->_attach_name) > 0) { return 'html-attach'; } - elseif ($this->mailtype == 'text' && count($this->_attach_name) > 0) + elseif ($this->mailtype == 'text' && count($this->_attach_name) > 0) { return 'plain-attach'; } @@ -881,7 +881,7 @@ class CI_Email { // Use PHP's native public function to do the initial wordwrap. // We set the cut flag to FALSE so that any individual words that are - // too long get left alone. In the next step we'll deal with them. + // too long get left alone. In the next step we'll deal with them. $str = wordwrap($str, $charlim, "\n", FALSE); // Split the string into individual lines of text and cycle through them @@ -999,7 +999,7 @@ class CI_Email { */ private function _build_message() { - if ($this->wordwrap === TRUE AND $this->mailtype != 'html') + if ($this->wordwrap === TRUE AND $this->mailtype != 'html') { $this->_body = $this->word_wrap($this->_body); } @@ -1135,7 +1135,7 @@ class CI_Email { return FALSE; } - $h = "--".$this->_atc_boundary.$this->newline; + $h = "--".$this->_atc_boundary.$this->newline; $h .= "Content-type: ".$ctype."; "; $h .= "name=\"".$basename."\"".$this->newline; $h .= "Content-Disposition: ".$this->_attach_disp[$i].";".$this->newline; @@ -1237,7 +1237,7 @@ class CI_Email { // encode = signs if ($ascii == '61') { - $char = $escape.strtoupper(sprintf('%02s', dechex($ascii))); // =3D + $char = $escape.strtoupper(sprintf('%02s', dechex($ascii))); // =3D } // If we're at the character limit, add the line to the output, @@ -1267,7 +1267,7 @@ class CI_Email { /** * Prep Q Encoding * - * Performs "Q Encoding" on a string for use in email headers. It's related + * Performs "Q Encoding" on a string for use in email headers. It's related * but not identical to quoted-printable, so it has its own method * * @access public @@ -1349,7 +1349,7 @@ class CI_Email { $this->reply_to($this->_headers['From']); } - if (( ! isset($this->_recipients) AND ! isset($this->_headers['To'])) AND + if (( ! isset($this->_recipients) AND ! isset($this->_headers['To'])) AND ( ! isset($this->_bcc_array) AND ! isset($this->_headers['Bcc'])) AND ( ! isset($this->_headers['Cc']))) { @@ -1359,7 +1359,7 @@ class CI_Email { $this->_build_headers(); - if ($this->bcc_batch_mode AND count($this->_bcc_array) > 0) + if ($this->bcc_batch_mode AND count($this->_bcc_array) > 0) { if (count($this->_bcc_array) > $this->bcc_batch_size) return $this->batch_bcc_send(); @@ -1380,7 +1380,7 @@ class CI_Email { // -------------------------------------------------------------------- /** - * Batch Bcc Send. Sends groups of BCCs in batches + * Batch Bcc Send. Sends groups of BCCs in batches * * @access public * @return bool @@ -1752,7 +1752,7 @@ class CI_Email { // -------------------------------------------------------------------- /** - * SMTP Authenticate + * SMTP Authenticate * * @access private * @return bool @@ -1764,7 +1764,7 @@ class CI_Email { return TRUE; } - if ($this->smtp_user == "" AND $this->smtp_pass == "") + if ($this->smtp_user == "" AND $this->smtp_pass == "") { $this->_set_error_message('lang:email_no_smtp_unpw'); return FALSE; diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index 2f7db6623..b30a8cf0b 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -1,4 +1,4 @@ -_field_data) == 0) { - // No validation rules? We're done... + // No validation rules? We're done... if (count($this->_config_rules) == 0) { return FALSE; @@ -648,7 +648,7 @@ class CI_Form_validation { } } - // Did the rule test negatively? If so, grab the error. + // Did the rule test negatively? If so, grab the error. if ($result === FALSE) { if ( ! isset($this->_error_messages[$rule])) @@ -664,7 +664,7 @@ class CI_Form_validation { } // Is the parameter we are inserting into the error message the name - // of another field? If so we need to grab its "field label" + // of another field? If so we need to grab its "field label" if (isset($this->_field_data[$param]) AND isset($this->_field_data[$param]['label'])) { $param = $this->_translate_fieldname($this->_field_data[$param]['label']); @@ -704,7 +704,7 @@ class CI_Form_validation { // Grab the variable $line = substr($fieldname, 5); - // Were we able to translate the field name? If not we use $line + // Were we able to translate the field name? If not we use $line if (FALSE === ($fieldname = $this->CI->lang->line($line))) { return $line; @@ -735,7 +735,7 @@ class CI_Form_validation { } // If the data is an array output them one at a time. - // E.g: form_input('name[]', set_value('name[]'); + // E.g: form_input('name[]', set_value('name[]'); if (is_array($this->_field_data[$field]['postdata'])) { return array_shift($this->_field_data[$field]['postdata']); @@ -914,7 +914,7 @@ class CI_Form_validation { return FALSE; } - return TRUE; + return TRUE; } // -------------------------------------------------------------------- @@ -1207,7 +1207,7 @@ class CI_Form_validation { // -------------------------------------------------------------------- /** - * Is a Natural number (0,1,2,3, etc.) + * Is a Natural number (0,1,2,3, etc.) * * @access public * @param string @@ -1221,7 +1221,7 @@ class CI_Form_validation { // -------------------------------------------------------------------- /** - * Is a Natural number, but not a zero (1,2,3, etc.) + * Is a Natural number, but not a zero (1,2,3, etc.) * * @access public * @param string @@ -1354,7 +1354,7 @@ class CI_Form_validation { */ function encode_php_tags($str) { - return str_replace(array(''), array('<?php', '<?PHP', '<?', '?>'), $str); + return str_replace(array(''), array('<?php', '<?PHP', '<?', '?>'), $str); } } diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php index 859cc9c30..d7a8b3b02 100644 --- a/system/libraries/Ftp.php +++ b/system/libraries/Ftp.php @@ -1,4 +1,4 @@ -list_files($filepath); @@ -513,7 +513,7 @@ class CI_FTP { * Read a directory and recreate it remotely * * This function recursively reads a folder and everything it contains (including - * sub-folders) and creates a mirror via FTP based on it. Whatever the directory structure + * sub-folders) and creates a mirror via FTP based on it. Whatever the directory structure * of the original file path will be recreated on the server. * * @access public diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 099a238dd..8902f524d 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -1,4 +1,4 @@ -source_image == '') { $this->set_error('imglib_source_image_required'); - return FALSE; + return FALSE; } /* * Is getimagesize() Available? * * We use it to determine the image properties (width/height). - * Note: We need to figure out how to determine image + * Note: We need to figure out how to determine image * properties using ImageMagick and NetPBM * */ @@ -189,7 +189,7 @@ class CI_Image_lib { // Set the Image Properties if ( ! $this->get_image_properties($this->source_folder.$this->source_image)) { - return FALSE; + return FALSE; } /* @@ -197,7 +197,7 @@ class CI_Image_lib { * * If the user has set a "new_image" name it means * we are making a copy of the source image. If not - * it means we are altering the original. We'll + * it means we are altering the original. We'll * set the destination filename and path accordingly. * */ @@ -267,7 +267,7 @@ class CI_Image_lib { * * When creating thumbs or copies, the target width/height * might not be in correct proportion with the source - * image's width/height. We'll recalculate it here. + * image's width/height. We'll recalculate it here. * */ if ($this->maintain_ratio === TRUE && ($this->width != '' AND $this->height != '')) @@ -399,7 +399,7 @@ class CI_Image_lib { if ($this->rotation_angle == '' OR ! in_array($this->rotation_angle, $degs)) { $this->set_error('imglib_rotation_angle_required'); - return FALSE; + return FALSE; } // Reassign the width and height @@ -469,8 +469,8 @@ class CI_Image_lib { // Let's set up our values based on the action if ($action == 'crop') { - // Reassign the source width/height if cropping - $this->orig_width = $this->width; + // Reassign the source width/height if cropping + $this->orig_width = $this->width; $this->orig_height = $this->height; // GD 2.0 has a cropping bug so we'll test for it @@ -487,19 +487,19 @@ class CI_Image_lib { $this->y_axis = 0; } - // Create the image handle + // Create the image handle if ( ! ($src_img = $this->image_create_gd())) { return FALSE; } - // Create The Image + // Create The Image // - // old conditional which users report cause problems with shared GD libs who report themselves as "2.0 or greater" - // it appears that this is no longer the issue that it was in 2004, so we've removed it, retaining it in the comment - // below should that ever prove inaccurate. + // old conditional which users report cause problems with shared GD libs who report themselves as "2.0 or greater" + // it appears that this is no longer the issue that it was in 2004, so we've removed it, retaining it in the comment + // below should that ever prove inaccurate. // - // if ($this->image_library == 'gd2' AND function_exists('imagecreatetruecolor') AND $v2_override == FALSE) + // if ($this->image_library == 'gd2' AND function_exists('imagecreatetruecolor') AND $v2_override == FALSE) if ($this->image_library == 'gd2' AND function_exists('imagecreatetruecolor')) { $create = 'imagecreatetruecolor'; @@ -521,7 +521,7 @@ class CI_Image_lib { $copy($dst_img, $src_img, 0, 0, $this->x_axis, $this->y_axis, $this->width, $this->height, $this->orig_width, $this->orig_height); - // Show the image + // Show the image if ($this->dynamic_output == TRUE) { $this->image_display_gd($dst_img); @@ -535,7 +535,7 @@ class CI_Image_lib { } } - // Kill the file handles + // Kill the file handles imagedestroy($dst_img); imagedestroy($src_img); @@ -558,7 +558,7 @@ class CI_Image_lib { */ function image_process_imagemagick($action = 'resize') { - // Do we have a vaild library path? + // Do we have a vaild library path? if ($this->library_path == '') { $this->set_error('imglib_libpath_invalid'); @@ -593,7 +593,7 @@ class CI_Image_lib { $cmd .= " ".$angle." \"$this->full_src_path\" \"$this->full_dst_path\" 2>&1"; } - else // Resize + else // Resize { $cmd .= " -resize ".$this->width."x".$this->height." \"$this->full_src_path\" \"$this->full_dst_path\" 2>&1"; } @@ -634,7 +634,7 @@ class CI_Image_lib { return FALSE; } - // Build the resizing command + // Build the resizing command switch ($this->image_type) { case 1 : @@ -684,7 +684,7 @@ class CI_Image_lib { @exec($cmd, $output, $retval); - // Did it work? + // Did it work? if ($retval > 0) { $this->set_error('imglib_image_process_failed'); @@ -711,7 +711,7 @@ class CI_Image_lib { */ function image_rotate_gd() { - // Create the image handle + // Create the image handle if ( ! ($src_img = $this->image_create_gd())) { return FALSE; @@ -724,10 +724,10 @@ class CI_Image_lib { $white = imagecolorallocate($src_img, 255, 255, 255); - // Rotate it! + // Rotate it! $dst_img = imagerotate($src_img, $this->rotation_angle, $white); - // Save the Image + // Save the Image if ($this->dynamic_output == TRUE) { $this->image_display_gd($dst_img); @@ -741,7 +741,7 @@ class CI_Image_lib { } } - // Kill the file handles + // Kill the file handles imagedestroy($dst_img); imagedestroy($src_img); @@ -769,14 +769,14 @@ class CI_Image_lib { return FALSE; } - $width = $this->orig_width; + $width = $this->orig_width; $height = $this->orig_height; if ($this->rotation_angle == 'hor') { for ($i = 0; $i < $height; $i++) { - $left = 0; + $left = 0; $right = $width-1; while ($left < $right) @@ -813,7 +813,7 @@ class CI_Image_lib { } } - // Show the image + // Show the image if ($this->dynamic_output == TRUE) { $this->image_display_gd($src_img); @@ -827,7 +827,7 @@ class CI_Image_lib { } } - // Kill the file handles + // Kill the file handles imagedestroy($src_img); // Set the file to 777 @@ -876,24 +876,24 @@ class CI_Image_lib { return FALSE; } - // Fetch source image properties + // Fetch source image properties $this->get_image_properties(); - // Fetch watermark image properties + // Fetch watermark image properties $props = $this->get_image_properties($this->wm_overlay_path, TRUE); $wm_img_type = $props['image_type']; $wm_width = $props['width']; $wm_height = $props['height']; - // Create two image resources - $wm_img = $this->image_create_gd($this->wm_overlay_path, $wm_img_type); + // Create two image resources + $wm_img = $this->image_create_gd($this->wm_overlay_path, $wm_img_type); $src_img = $this->image_create_gd($this->full_src_path); // Reverse the offset if necessary // When the image is positioned at the bottom // we don't want the vertical offset to push it - // further down. We want the reverse, so we'll - // invert the offset. Same with the horizontal + // further down. We want the reverse, so we'll + // invert the offset. Same with the horizontal // offset when the image is at the right $this->wm_vrt_alignment = strtoupper(substr($this->wm_vrt_alignment, 0, 1)); @@ -905,11 +905,11 @@ class CI_Image_lib { if ($this->wm_hor_alignment == 'R') $this->wm_hor_offset = $this->wm_hor_offset * -1; - // Set the base x and y axis values + // Set the base x and y axis values $x_axis = $this->wm_hor_offset + $this->wm_padding; $y_axis = $this->wm_vrt_offset + $this->wm_padding; - // Set the vertical position + // Set the vertical position switch ($this->wm_vrt_alignment) { case 'T': @@ -920,7 +920,7 @@ class CI_Image_lib { break; } - // Set the horizontal position + // Set the horizontal position switch ($this->wm_hor_alignment) { case 'L': @@ -931,7 +931,7 @@ class CI_Image_lib { break; } - // Build the finalized image + // Build the finalized image if ($wm_img_type == 3 AND function_exists('imagealphablending')) { @imagealphablending($src_img, TRUE); @@ -954,7 +954,7 @@ class CI_Image_lib { imagecopymerge($src_img, $wm_img, $x_axis, $y_axis, 0, 0, $wm_width, $wm_height, $this->wm_opacity); } - // Output the image + // Output the image if ($this->dynamic_output == TRUE) { $this->image_display_gd($src_img); @@ -994,7 +994,7 @@ class CI_Image_lib { return FALSE; } - // Fetch source image properties + // Fetch source image properties $this->get_image_properties(); // Set RGB values for text and shadow @@ -1015,8 +1015,8 @@ class CI_Image_lib { // Reverse the vertical offset // When the image is positioned at the bottom // we don't want the vertical offset to push it - // further down. We want the reverse, so we'll - // invert the offset. Note: The horizontal + // further down. We want the reverse, so we'll + // invert the offset. Note: The horizontal // offset flips itself automatically if ($this->wm_vrt_alignment == 'B') @@ -1033,13 +1033,13 @@ class CI_Image_lib { if ($this->wm_font_size == '') $this->wm_font_size = '17'; - $fontwidth = $this->wm_font_size-($this->wm_font_size/4); + $fontwidth = $this->wm_font_size-($this->wm_font_size/4); $fontheight = $this->wm_font_size; $this->wm_vrt_offset += $this->wm_font_size; } else { - $fontwidth = imagefontwidth($this->wm_font_size); + $fontwidth = imagefontwidth($this->wm_font_size); $fontheight = imagefontheight($this->wm_font_size); } @@ -1080,11 +1080,11 @@ class CI_Image_lib { case "C": if ($this->wm_use_drop_shadow) $x_shad += floor(($this->orig_width - $fontwidth*strlen($this->wm_text))/2); - $x_axis += floor(($this->orig_width -$fontwidth*strlen($this->wm_text))/2); + $x_axis += floor(($this->orig_width -$fontwidth*strlen($this->wm_text))/2); break; } - // Add the text to the source image + // Add the text to the source image if ($this->wm_use_truetype) { if ($this->wm_use_drop_shadow) @@ -1098,7 +1098,7 @@ class CI_Image_lib { imagestring($src_img, $this->wm_font_size, $x_axis, $y_axis, $this->wm_text, $txt_color); } - // Output the final image + // Output the final image if ($this->dynamic_output == TRUE) { $this->image_display_gd($src_img); @@ -1366,7 +1366,7 @@ class CI_Image_lib { * Size calculator * * This function takes a known width x height and - * recalculates it to a new size. Only one + * recalculates it to a new size. Only one * new variable needs to be known * * $props = array( @@ -1374,7 +1374,7 @@ class CI_Image_lib { * 'height' => $height, * 'new_width' => 40, * 'new_height' => '' - * ); + * ); * * @access public * @param array @@ -1418,10 +1418,10 @@ class CI_Image_lib { * Explode source_image * * This is a helper function that extracts the extension - * from the source_image. This function lets us deal with - * source_images with multiple periods, like: my.cool.jpg + * from the source_image. This function lets us deal with + * source_images with multiple periods, like: my.cool.jpg * It returns an associative array with two elements: - * $array['ext'] = '.jpg'; + * $array['ext'] = '.jpg'; * $array['name'] = 'my.cool'; * * @access public diff --git a/system/libraries/Javascript.php b/system/libraries/Javascript.php index 9e42a4385..34e0d7001 100644 --- a/system/libraries/Javascript.php +++ b/system/libraries/Javascript.php @@ -1,4 +1,4 @@ -js =& $this->CI->$js_library_driver; - log_message('debug', "Javascript Class Initialized and loaded. Driver used: $js_library_driver"); + log_message('debug', "Javascript Class Initialized and loaded. Driver used: $js_library_driver"); } - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Event Code // -------------------------------------------------------------------- @@ -378,7 +378,7 @@ class CI_Javascript { return $this->js->_unload($element, $js); } - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Effects // -------------------------------------------------------------------- @@ -685,7 +685,7 @@ class CI_Javascript { return $str; } - + // -------------------------------------------------------------------- /** @@ -855,7 +855,7 @@ class CI_Javascript { } elseif (is_string($result) OR $is_key) { - return '"'.str_replace(array('\\', "\t", "\n", "\r", '"', '/'), array('\\\\', '\\t', '\\n', "\\r", '\"', '\/'), $result).'"'; + return '"'.str_replace(array('\\', "\t", "\n", "\r", '"', '/'), array('\\\\', '\\t', '\\n', "\\r", '\"', '\/'), $result).'"'; } elseif (is_scalar($result)) { diff --git a/system/libraries/Log.php b/system/libraries/Log.php index 2505fc678..9f1db76ba 100644 --- a/system/libraries/Log.php +++ b/system/libraries/Log.php @@ -1,4 +1,4 @@ - '1', 'DEBUG' => '2', 'INFO' => '3', 'ALL' => '4'); + protected $_levels = array('ERROR' => '1', 'DEBUG' => '2', 'INFO' => '3', 'ALL' => '4'); /** * Constructor @@ -84,11 +84,11 @@ class CI_Log { } $filepath = $this->_log_path.'log-'.date('Y-m-d').'.php'; - $message = ''; + $message = ''; if ( ! file_exists($filepath)) { - $message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n"; + $message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n"; } if ( ! $fp = @fopen($filepath, FOPEN_WRITE_CREATE)) diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index d9c22d501..cc62e660b 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -1,4 +1,4 @@ -cur_page - $this->num_links) > 0) ? $this->cur_page - ($this->num_links - 1) : 1; - $end = (($this->cur_page + $this->num_links) < $num_pages) ? $this->cur_page + $this->num_links : $num_pages; + $end = (($this->cur_page + $this->num_links) < $num_pages) ? $this->cur_page + $this->num_links : $num_pages; - // Is pagination being used over GET or POST? If get, add a per_page query + // Is pagination being used over GET or POST? If get, add a per_page query // string. If post, add a trailing slash to the base URL if needed if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE) { @@ -194,14 +194,14 @@ class CI_Pagination { $output = ''; // Render the "First" link - if ($this->first_link !== FALSE AND $this->cur_page > ($this->num_links + 1)) + if ($this->first_link !== FALSE AND $this->cur_page > ($this->num_links + 1)) { $first_url = ($this->first_url == '') ? $this->base_url : $this->first_url; $output .= $this->first_tag_open.'anchor_class.'href="'.$first_url.'">'.$this->first_link.''.$this->first_tag_close; } // Render the "previous" link - if ($this->prev_link !== FALSE AND $this->cur_page != 1) + if ($this->prev_link !== FALSE AND $this->cur_page != 1) { $i = $uri_page_number - $this->per_page; @@ -263,7 +263,7 @@ class CI_Pagination { $output .= $this->last_tag_open.'anchor_class.'href="'.$this->base_url.$this->prefix.$i.$this->suffix.'">'.$this->last_link.''.$this->last_tag_close; } - // Kill double slashes. Note: Sometimes we can end up with a double slash + // Kill double slashes. Note: Sometimes we can end up with a double slash // in the penultimate link so we'll kill all double slashes. $output = preg_replace("#([^:])//+#", "\\1/", $output); diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php index f48f2a7e5..d223da020 100644 --- a/system/libraries/Parser.php +++ b/system/libraries/Parser.php @@ -1,4 +1,4 @@ -'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_benchmarks').'  '; @@ -168,7 +168,7 @@ class CI_Profiler { if (count($dbs) == 0) { - $output = "\n\n"; + $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_queries').'  '; @@ -187,7 +187,7 @@ class CI_Profiler { // Key words we want bolded $highlight = array('SELECT', 'DISTINCT', 'FROM', 'WHERE', 'AND', 'LEFT JOIN', 'ORDER BY', 'GROUP BY', 'LIMIT', 'INSERT', 'INTO', 'VALUES', 'UPDATE', 'OR ', 'HAVING', 'OFFSET', 'NOT IN', 'IN', 'LIKE', 'NOT LIKE', 'COUNT', 'MAX', 'MIN', 'ON', 'AS', 'AVG', 'SUM', '(', ')'); - $output = "\n\n"; + $output = "\n\n"; $count = 0; @@ -249,7 +249,7 @@ class CI_Profiler { */ protected function _compile_get() { - $output = "\n\n"; + $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_get_data').'  '; @@ -298,7 +298,7 @@ class CI_Profiler { */ protected function _compile_post() { - $output = "\n\n"; + $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_post_data').'  '; @@ -347,7 +347,7 @@ class CI_Profiler { */ protected function _compile_uri_string() { - $output = "\n\n"; + $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_uri_string').'  '; @@ -376,7 +376,7 @@ class CI_Profiler { */ protected function _compile_controller_info() { - $output = "\n\n"; + $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_controller_info').'  '; @@ -400,7 +400,7 @@ class CI_Profiler { */ protected function _compile_memory_usage() { - $output = "\n\n"; + $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_memory_usage').'  '; @@ -431,7 +431,7 @@ class CI_Profiler { */ protected function _compile_http_headers() { - $output = "\n\n"; + $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_headers').'  ('.$this->CI->lang->line('profiler_section_show').')'; @@ -462,7 +462,7 @@ class CI_Profiler { */ protected function _compile_config() { - $output = "\n\n"; + $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_config').'  ('.$this->CI->lang->line('profiler_section_show').')'; diff --git a/system/libraries/Session.php b/system/libraries/Session.php index 76525dbb8..2c8a80163 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -1,4 +1,4 @@ -CI->load->library('encrypt'); } - // Are we using a database? If so, load it + // Are we using a database? If so, load it if ($this->sess_use_database === TRUE AND $this->sess_table_name != '') { $this->CI->load->database(); } - // Set the "now" time. Can either be GMT or server time, based on the - // config prefs. We use this to set the "last activity" time + // Set the "now" time. Can either be GMT or server time, based on the + // config prefs. We use this to set the "last activity" time $this->now = $this->_get_time(); // Set the session length. If the session expiration is @@ -97,12 +97,12 @@ class CI_Session { { $this->sess_expiration = (60*60*24*365*2); } - + // Set the cookie name $this->sess_cookie_name = $this->cookie_prefix.$this->sess_cookie_name; // Run the Session routine. If a session doesn't exist we'll - // create a new one. If it does, we'll update it. + // create a new one. If it does, we'll update it. if ( ! $this->sess_read()) { $this->sess_create(); @@ -137,7 +137,7 @@ class CI_Session { // Fetch the cookie $session = $this->CI->input->cookie($this->sess_cookie_name); - // No cookie? Goodbye cruel world!... + // No cookie? Goodbye cruel world!... if ($session === FALSE) { log_message('debug', 'A session cookie was not found.'); @@ -155,8 +155,8 @@ class CI_Session { $hash = substr($session, strlen($session)-32); // get last 32 chars $session = substr($session, 0, strlen($session)-32); - // Does the md5 hash match? This is to prevent manipulation of session data in userspace - if ($hash !== md5($session.$this->encryption_key)) + // Does the md5 hash match? This is to prevent manipulation of session data in userspace + if ($hash !== md5($session.$this->encryption_key)) { log_message('error', 'The session cookie data did not match what was expected. This could be a possible hacking attempt.'); $this->sess_destroy(); @@ -212,14 +212,14 @@ class CI_Session { $query = $this->CI->db->get($this->sess_table_name); - // No result? Kill it! + // No result? Kill it! if ($query->num_rows() == 0) { $this->sess_destroy(); return FALSE; } - // Is there custom data? If so, add it to the main session array + // Is there custom data? If so, add it to the main session array $row = $query->row(); if (isset($row->user_data) AND $row->user_data != '') { @@ -252,7 +252,7 @@ class CI_Session { */ function sess_write() { - // Are we saving custom data to the DB? If not, all we do is update the cookie + // Are we saving custom data to the DB? If not, all we do is update the cookie if ($this->sess_use_database === FALSE) { $this->_set_cookie(); @@ -272,7 +272,7 @@ class CI_Session { $cookie_userdata[$val] = $this->userdata[$val]; } - // Did we find any custom data? If not, we turn the empty array into a string + // Did we find any custom data? If not, we turn the empty array into a string // since there's no reason to serialize and store an empty array in the DB if (count($custom_userdata) === 0) { @@ -288,7 +288,7 @@ class CI_Session { $this->CI->db->where('session_id', $this->userdata['session_id']); $this->CI->db->update($this->sess_table_name, array('last_activity' => $this->userdata['last_activity'], 'user_data' => $custom_userdata)); - // Write the cookie. Notice that we manually pass the cookie data array to the + // Write the cookie. Notice that we manually pass the cookie data array to the // _set_cookie() function. Normally that function will store $this->userdata, but // in this case that array contains custom data, which we do not want in the cookie. $this->_set_cookie($cookie_userdata); @@ -535,7 +535,7 @@ class CI_Session { */ function keep_flashdata($key) { - // 'old' flashdata gets removed. Here we mark all + // 'old' flashdata gets removed. Here we mark all // flashdata as 'new' to preserve it from _flashdata_sweep() // Note the function will return FALSE if the $key // provided cannot be found diff --git a/system/libraries/Sha1.php b/system/libraries/Sha1.php index 04e07d1c1..1a657572b 100644 --- a/system/libraries/Sha1.php +++ b/system/libraries/Sha1.php @@ -1,4 +1,4 @@ -heading) == 0 AND count($this->rows) == 0) { return 'Undefined table data'; @@ -376,7 +376,7 @@ class CI_Table { // -------------------------------------------------------------------- /** - * Clears the table arrays. Useful if multiple tables are being generated + * Clears the table arrays. Useful if multiple tables are being generated * * @access public * @return void @@ -495,7 +495,7 @@ class CI_Table { */ function _default_template() { - return array ( + return array ( 'table_open' => '
<<
', 'thead_open' => '', diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index b0f8a9098..b0a767822 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -1,4 +1,4 @@ -","\"", "'", "-"), array("&", "<", ">", """, "'", "-"), diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php index 3ceb0b52b..734cec104 100644 --- a/system/libraries/Typography.php +++ b/system/libraries/Typography.php @@ -1,4 +1,4 @@ - tags if they exist. It's cheaper to do this separately since most content will + // match and yank
 tags if they exist.  It's cheaper to do this separately since most content will
 		// not contain 
 tags, and it keeps the PCRE patterns below simpler and faster
 		if (strpos($str, 'inline_elements.")([ >])#i", "{@TAG}\\1\\2\\3", $str);
 
-		// Split the string at every tag. This expression creates an array with this prototype:
+		// Split the string at every tag.  This expression creates an array with this prototype:
 		//
 		//	[array]
 		//	{
@@ -126,7 +126,7 @@ class CI_Typography {
 		//	}
 		$chunks = preg_split('/(<(?:[^<>]+(?:"[^"]*"|\'[^\']*\')?)+>)/', $str, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
 
-		// Build our finalized string. We cycle through the array, skipping tags, and processing the contained text
+		// Build our finalized string.  We cycle through the array, skipping tags, and processing the contained text
 		$str = '';
 		$process = TRUE;
 		$paragraph = FALSE;
@@ -143,7 +143,7 @@ class CI_Typography {
 			{
 				if (preg_match("#".$this->skip_elements."#", $match[2]))
 				{
-					$process = ($match[1] == '/') ? TRUE : FALSE;
+					$process =  ($match[1] == '/') ? TRUE : FALSE;
 				}
 
 				if ($match[1] == '')
@@ -161,17 +161,17 @@ class CI_Typography {
 				continue;
 			}
 
-			// Force a newline to make sure end tags get processed by _format_newlines()
+			//  Force a newline to make sure end tags get processed by _format_newlines()
 			if ($current_chunk == $total_chunks)
 			{
 				$chunk .= "\n";
 			}
 
-			// Convert Newlines into 

and
tags + // Convert Newlines into

and
tags $str .= $this->_format_newlines($chunk); } - // No opening block level tag? Add it if needed. + // No opening block level tag? Add it if needed. if ( ! preg_match("/^\s*<(?:".$this->block_elements.")/i", $str)) { $str = preg_replace("/^(.*?)<(".$this->block_elements.")/i", '

$1

<$2', $str); @@ -204,14 +204,14 @@ class CI_Typography { '#

<('.$this->block_elements.')#' => '<$1', // Clean up stray non-breaking spaces preceeding block elements - '#( \s*)+<('.$this->block_elements.')#' => ' <$2', + '#( \s*)+<('.$this->block_elements.')#' => ' <$2', // Replace the temporary markers we added earlier '/\{@TAG\}/' => '<', '/\{@DQ\}/' => '"', '/\{@SQ\}/' => "'", '/\{@DD\}/' => '--', - '/\{@NBS\}/' => ' ', + '/\{@NBS\}/' => ' ', // An unintended consequence of the _format_newlines function is that // some of the newlines get truncated, resulting in

tags @@ -296,7 +296,7 @@ class CI_Typography { '/(\w)\.{3}/' => '$1…', // double space after sentences - '/(\W) /' => '$1  ', + '/(\W) /' => '$1  ', // ampersands, if not a character entity '/&(?!#?[a-zA-Z0-9]{2,};)/' => '&' @@ -324,7 +324,7 @@ class CI_Typography { return $str; } - if (strpos($str, "\n") === FALSE && ! in_array($this->last_block_element, $this->inner_block_required)) + if (strpos($str, "\n") === FALSE && ! in_array($this->last_block_element, $this->inner_block_required)) { return $str; } @@ -341,7 +341,7 @@ class CI_Typography { // We trim off the right-side new line so that the closing

tag // will be positioned immediately following the string, matching // the behavior of the opening

tag - $str = '

'.rtrim($str).'

'; + $str = '

'.rtrim($str).'

'; } // Remove empty paragraphs if they are on the first line, as this @@ -367,7 +367,7 @@ class CI_Typography { */ function _protect_characters($match) { - return str_replace(array("'",'"','--',' '), array('{@SQ}', '{@DQ}', '{@DD}', '{@NBS}'), $match[0]); + return str_replace(array("'",'"','--',' '), array('{@SQ}', '{@DQ}', '{@DD}', '{@NBS}'), $match[0]); } // -------------------------------------------------------------------- diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index c9012f646..5bd7e801a 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -1,4 +1,4 @@ -set_error('upload_stopped_by_extension'); break; - default : $this->set_error('upload_no_file_selected'); + default : $this->set_error('upload_no_file_selected'); break; } @@ -290,7 +290,7 @@ class CI_Upload { /* * Run the file through the XSS hacking filter * This helps prevent malicious code from being - * embedded within a file. Scripts can easily + * embedded within a file. Scripts can easily * be disguised as images or other file types. */ if ($this->xss_clean) @@ -305,8 +305,8 @@ class CI_Upload { /* * Move the file to the final destination * To deal with different server configurations - * we'll attempt to use copy() first. If that fails - * we'll use move_uploaded_file(). One of the two should + * we'll attempt to use copy() first. If that fails + * 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)) @@ -321,7 +321,7 @@ class CI_Upload { /* * Set the finalized image dimensions * This sets the image width/height (assuming the - * file was an image). We use this information + * file was an image). We use this information * in the "data" function. */ $this->set_image_properties($this->upload_path.$this->file_name); @@ -518,7 +518,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_size_str = $D['3']; // string containing height and width + $this->image_size_str = $D['3']; // string containing height and width } } } @@ -551,7 +551,7 @@ class CI_Upload { // IE will sometimes return odd mime-types during upload, so here we just standardize all // jpegs or pngs to the same file type. - $png_mimes = array('image/x-png'); + $png_mimes = array('image/x-png'); $jpeg_mimes = array('image/jpg', 'image/jpe', 'image/jpeg', 'image/pjpeg'); if (in_array($this->file_type, $png_mimes)) @@ -642,7 +642,7 @@ class CI_Upload { */ public function is_allowed_filesize() { - if ($this->max_size != 0 AND $this->file_size > $this->max_size) + if ($this->max_size != 0 AND $this->file_size > $this->max_size) { return FALSE; } @@ -721,7 +721,7 @@ class CI_Upload { return FALSE; } - $this->upload_path = preg_replace("/(.+?)\/*$/", "\\1/", $this->upload_path); + $this->upload_path = preg_replace("/(.+?)\/*$/", "\\1/", $this->upload_path); return TRUE; } @@ -834,7 +834,7 @@ class CI_Upload { $current = ini_get('memory_limit') * 1024 * 1024; // There was a bug/behavioural change in PHP 5.2, where numbers over one million get output - // into scientific notation. number_format() ensures this number is an integer + // into scientific notation. number_format() ensures this number is an integer // http://bugs.php.net/bug.php?id=43053 $new_memory = number_format(ceil(filesize($file) + $current), 0, '.', ''); @@ -844,8 +844,8 @@ class CI_Upload { // If the file being uploaded is an image, then we should have no problem with XSS attacks (in theory), but // IE can be fooled into mime-type detecting a malformed image as an html file, thus executing an XSS attack on anyone - // using IE who looks at the image. It does this by inspecting the first 255 bytes of an image. To get around this - // CI will itself look at the first 255 bytes of an image to determine its relative safety. This can save a lot of + // using IE who looks at the image. It does this by inspecting the first 255 bytes of an image. To get around this + // CI will itself look at the first 255 bytes of an image to determine its relative safety. This can save a lot of // processor power and time if it is actually a clean image, as it will be in nearly all instances _except_ an // attempted XSS attack. @@ -933,7 +933,7 @@ class CI_Upload { /** * List of Mime Types * - * This is a list of mime types. We use it to validate + * This is a list of mime types. We use it to validate * the "allowed types" set by the developer * * @param string diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php index 543d1d5a3..016102a2a 100644 --- a/system/libraries/User_agent.php +++ b/system/libraries/User_agent.php @@ -1,4 +1,4 @@ -xmlrpcerr['unknown_method'] = '1'; $this->xmlrpcstr['unknown_method'] = 'This is not a known method for this XML-RPC Server'; $this->xmlrpcerr['invalid_return'] = '2'; - $this->xmlrpcstr['invalid_return'] = 'The XML data received was either invalid or not in the correct form for XML-RPC. Turn on debugging to examine the XML data further.'; + $this->xmlrpcstr['invalid_return'] = 'The XML data received was either invalid or not in the correct form for XML-RPC. Turn on debugging to examine the XML data further.'; $this->xmlrpcerr['incorrect_params'] = '3'; $this->xmlrpcstr['incorrect_params'] = 'Incorrect parameters were passed to method'; $this->xmlrpcerr['introspect_unknown'] = '4'; @@ -129,7 +129,7 @@ class CI_Xmlrpc { //------------------------------------- - // Initialize Prefs + // Initialize Prefs //------------------------------------- function initialize($config = array()) @@ -148,7 +148,7 @@ class CI_Xmlrpc { // END //------------------------------------- - // Take URL and parse it + // Take URL and parse it //------------------------------------- function server($url, $port=80) @@ -172,7 +172,7 @@ class CI_Xmlrpc { // END //------------------------------------- - // Set Timeout + // Set Timeout //------------------------------------- function timeout($seconds=5) @@ -185,7 +185,7 @@ class CI_Xmlrpc { // END //------------------------------------- - // Set Methods + // Set Methods //------------------------------------- function method($function) @@ -195,7 +195,7 @@ class CI_Xmlrpc { // END //------------------------------------- - // Take Array of Data and Create Objects + // Take Array of Data and Create Objects //------------------------------------- function request($incoming) @@ -216,7 +216,7 @@ class CI_Xmlrpc { //------------------------------------- - // Set Debug + // Set Debug //------------------------------------- function set_debug($flag = TRUE) @@ -225,7 +225,7 @@ class CI_Xmlrpc { } //------------------------------------- - // Values Parsing + // Values Parsing //------------------------------------- function values_parsing($value, $return = FALSE) @@ -268,7 +268,7 @@ class CI_Xmlrpc { //------------------------------------- - // Sends XML-RPC Request + // Sends XML-RPC Request //------------------------------------- function send_request() @@ -294,7 +294,7 @@ class CI_Xmlrpc { // END //------------------------------------- - // Returns Error + // Returns Error //------------------------------------- function display_error() @@ -304,7 +304,7 @@ class CI_Xmlrpc { // END //------------------------------------- - // Returns Remote Server Response + // Returns Remote Server Response //------------------------------------- function display_response() @@ -314,7 +314,7 @@ class CI_Xmlrpc { // END //------------------------------------- - // Sends an Error Message for Server Request + // Sends an Error Message for Server Request //------------------------------------- function send_error_message($number, $message) @@ -325,7 +325,7 @@ class CI_Xmlrpc { //------------------------------------- - // Send Response for Server Request + // Send Response for Server Request //------------------------------------- function send_response($response) @@ -399,7 +399,7 @@ class XML_RPC_Client extends CI_Xmlrpc } $r = "\r\n"; - $op = "POST {$this->path} HTTP/1.0$r"; + $op = "POST {$this->path} HTTP/1.0$r"; $op .= "Host: {$this->server}$r"; $op .= "Content-Type: text/xml$r"; $op .= "User-Agent: {$this->xmlrpcName}$r"; @@ -447,7 +447,7 @@ class XML_RPC_Response else if ( ! is_object($val)) { // programmer error, not an object - error_log("Invalid type '" . gettype($val) . "' (value: $val) passed to XML_RPC_Response. Defaulting to empty value."); + error_log("Invalid type '" . gettype($val) . "' (value: $val) passed to XML_RPC_Response. Defaulting to empty value."); $this->val = new XML_RPC_Values(); } else @@ -504,7 +504,7 @@ class XML_RPC_Response function decode($array=FALSE) { $CI =& get_instance(); - + if ($array !== FALSE && is_array($array)) { while (list($key) = each($array)) @@ -541,7 +541,7 @@ class XML_RPC_Response //------------------------------------- - // XML-RPC Object to PHP Types + // XML-RPC Object to PHP Types //------------------------------------- function xmlrpc_decoder($xmlrpc_val) @@ -581,7 +581,7 @@ class XML_RPC_Response //------------------------------------- - // ISO-8601 time to server or UTC time + // ISO-8601 time to server or UTC time //------------------------------------- function iso8601_decode($time, $utc=0) @@ -630,7 +630,7 @@ class XML_RPC_Message extends CI_Xmlrpc } //------------------------------------- - // Create Payload to Send + // Create Payload to Send //------------------------------------- function createPayload() @@ -650,7 +650,7 @@ class XML_RPC_Message extends CI_Xmlrpc } //------------------------------------- - // Parse External XML-RPC Server's Response + // Parse External XML-RPC Server's Response //------------------------------------- function parseResponse($fp) @@ -663,7 +663,7 @@ class XML_RPC_Message extends CI_Xmlrpc } //------------------------------------- - // DISPLAY HTTP CONTENT for DEBUGGING + // DISPLAY HTTP CONTENT for DEBUGGING //------------------------------------- if ($this->debug === TRUE) @@ -674,7 +674,7 @@ class XML_RPC_Message extends CI_Xmlrpc } //------------------------------------- - // Check for data + // Check for data //------------------------------------- if ($data == "") @@ -686,7 +686,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- - // Check for HTTP 200 Response + // Check for HTTP 200 Response //------------------------------------- if (strncmp($data, 'HTTP', 4) == 0 && ! preg_match('/^HTTP\/[0-9\.]+ 200 /', $data)) @@ -697,7 +697,7 @@ class XML_RPC_Message extends CI_Xmlrpc } //------------------------------------- - // Create and Set Up XML Parser + // Create and Set Up XML Parser //------------------------------------- $parser = xml_parser_create($this->xmlrpc_defencoding); @@ -718,7 +718,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- - // GET HEADERS + // GET HEADERS //------------------------------------- $lines = explode("\r\n", $data); @@ -734,7 +734,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- - // PARSE XML DATA + // PARSE XML DATA //------------------------------------- if ( ! xml_parse($parser, $data, count($data))) @@ -750,7 +750,7 @@ class XML_RPC_Message extends CI_Xmlrpc xml_parser_free($parser); // --------------------------------------- - // Got Ourselves Some Badness, It Seems + // Got Ourselves Some Badness, It Seems // --------------------------------------- if ($this->xh[$parser]['isf'] > 1) @@ -772,7 +772,7 @@ class XML_RPC_Message extends CI_Xmlrpc } //------------------------------------- - // DISPLAY XML CONTENT for DEBUGGING + // DISPLAY XML CONTENT for DEBUGGING //------------------------------------- if ($this->debug === TRUE) @@ -797,7 +797,7 @@ class XML_RPC_Message extends CI_Xmlrpc } //------------------------------------- - // SEND RESPONSE + // SEND RESPONSE //------------------------------------- $v = $this->xh[$parser]['value']; @@ -826,21 +826,21 @@ class XML_RPC_Message extends CI_Xmlrpc } // ------------------------------------ - // Begin Return Message Parsing section + // Begin Return Message Parsing section // ------------------------------------ // quick explanation of components: - // ac - used to accumulate values - // isf - used to indicate a fault - // lv - used to indicate "looking for a value": implements + // ac - used to accumulate values + // isf - used to indicate a fault + // lv - used to indicate "looking for a value": implements // the logic to allow values with no types to be strings - // params - used to store parameters in method calls - // method - used to store method name + // params - used to store parameters in method calls + // method - used to store method name // stack - array with parent tree of the xml element, // used to validate the nesting of elements //------------------------------------- - // Start Element Handler + // Start Element Handler //------------------------------------- function open_tag($the_parser, $name, $attrs) @@ -942,7 +942,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- - // End Element Handler + // End Element Handler //------------------------------------- function closing_tag($the_parser, $name) @@ -951,7 +951,7 @@ class XML_RPC_Message extends CI_Xmlrpc // Remove current element from stack and set variable // NOTE: If the XML validates, then we do not have to worry about - // the opening and closing of elements. Nesting is checked on the opening + // the opening and closing of elements. Nesting is checked on the opening // tag so we be safe there as well. $curr_elem = array_shift($this->xh[$the_parser]['stack']); @@ -1080,13 +1080,13 @@ class XML_RPC_Message extends CI_Xmlrpc // We're all good kids with nuthin' to do break; default: - // End of an Invalid Element. Taken care of during the opening tag though + // End of an Invalid Element. Taken care of during the opening tag though break; } } //------------------------------------- - // Parses Character Data + // Parses Character Data //------------------------------------- function character_data($the_parser, $data) @@ -1116,7 +1116,7 @@ class XML_RPC_Message extends CI_Xmlrpc function output_parameters($array=FALSE) { $CI =& get_instance(); - + if ($array !== FALSE && is_array($array)) { while (list($key) = each($array)) diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php index 88af60693..9cd332147 100644 --- a/system/libraries/Xmlrpcs.php +++ b/system/libraries/Xmlrpcs.php @@ -1,4 +1,4 @@ -parseRequest(); - $payload = 'xmlrpc_defencoding.'"?'.'>'."\n"; + $payload = 'xmlrpc_defencoding.'"?'.'>'."\n"; $payload .= $this->debug_msg; $payload .= $r->prepare_response(); @@ -156,7 +156,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc function add_to_map($methodname, $function, $sig, $doc) { $this->methods[$methodname] = array( - 'function' => $function, + 'function' => $function, 'signature' => $sig, 'docstring' => $doc ); @@ -176,7 +176,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc global $HTTP_RAW_POST_DATA; //------------------------------------- - // Get Data + // Get Data //------------------------------------- if ($data == '') @@ -185,7 +185,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc } //------------------------------------- - // Set up XML Parser + // Set up XML Parser //------------------------------------- $parser = xml_parser_create($this->xmlrpc_defencoding); @@ -207,7 +207,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- - // PARSE + PROCESS XML DATA + // PARSE + PROCESS XML DATA //------------------------------------- if ( ! xml_parse($parser, $data, 1)) @@ -235,7 +235,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc { if ($this->debug === TRUE) { - $plist .= "$i - " . print_r(get_object_vars($parser_object->xh[$parser]['params'][$i]), TRUE). ";\n"; + $plist .= "$i - " . print_r(get_object_vars($parser_object->xh[$parser]['params'][$i]), TRUE). ";\n"; } $m->addParam($parser_object->xh[$parser]['params'][$i]); @@ -252,7 +252,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc } //------------------------------------- - // SET DEBUGGING MESSAGE + // SET DEBUGGING MESSAGE //------------------------------------- if ($this->debug === TRUE) @@ -285,7 +285,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc } //------------------------------------- - // Valid Method + // Valid Method //------------------------------------- if ( ! isset($this->methods[$methName]['function'])) @@ -294,7 +294,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc } //------------------------------------- - // Check for Method (and Object) + // Check for Method (and Object) //------------------------------------- $method_parts = explode(".", $this->methods[$methName]['function']); @@ -320,7 +320,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc } //------------------------------------- - // Checking Methods Signature + // Checking Methods Signature //------------------------------------- if (isset($this->methods[$methName]['signature'])) @@ -353,7 +353,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc } //------------------------------------- - // Calls the Function + // Calls the Function //------------------------------------- if ($objectCall === TRUE) @@ -381,11 +381,11 @@ class CI_Xmlrpcs extends CI_Xmlrpc return call_user_func($this->methods[$methName]['function'], $m); } } - + // -------------------------------------------------------------------- /** - * Server Function: List Methods + * Server Function: List Methods * * @access public * @param mixed @@ -409,11 +409,11 @@ class CI_Xmlrpcs extends CI_Xmlrpc $v->addArray($output); return new XML_RPC_Response($v); } - + // -------------------------------------------------------------------- /** - * Server Function: Return Signature for Method + * Server Function: Return Signature for Method * * @access public * @param mixed @@ -458,7 +458,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc // -------------------------------------------------------------------- /** - * Server Function: Doc String for Method + * Server Function: Doc String for Method * * @access public * @param mixed @@ -480,11 +480,11 @@ class CI_Xmlrpcs extends CI_Xmlrpc return new XML_RPC_Response(0, $this->xmlrpcerr['introspect_unknown'], $this->xmlrpcstr['introspect_unknown']); } } - + // -------------------------------------------------------------------- /** - * Server Function: Multi-call + * Server Function: Multi-call * * @access public * @param mixed @@ -528,7 +528,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc // -------------------------------------------------------------------- /** - * Multi-call Function: Error Handling + * Multi-call Function: Error Handling * * @access public * @param mixed @@ -536,7 +536,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc */ function multicall_error($err) { - $str = is_string($err) ? $this->xmlrpcstr["multicall_${err}"] : $err->faultString(); + $str = is_string($err) ? $this->xmlrpcstr["multicall_${err}"] : $err->faultString(); $code = is_string($err) ? $this->xmlrpcerr["multicall_${err}"] : $err->faultCode(); $struct['faultCode'] = new XML_RPC_Values($code, 'int'); @@ -548,7 +548,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc // -------------------------------------------------------------------- /** - * Multi-call Function: Processes method + * Multi-call Function: Processes method * * @access public * @param mixed diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 1ae3e7f25..666327d5c 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -1,4 +1,4 @@ -CI =& get_instance(); + $this->CI =& get_instance(); extract($params); if ($autoload === TRUE) { - $this->script(); + $this->script(); } - + log_message('debug', "Jquery Class Initialized"); } - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // Event Code - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- /** * Blur @@ -65,9 +65,9 @@ class CI_Jquery extends CI_Javascript { { return $this->_add_event($element, $js, 'blur'); } - + // -------------------------------------------------------------------- - + /** * Change * @@ -82,9 +82,9 @@ class CI_Jquery extends CI_Javascript { { return $this->_add_event($element, $js, 'change'); } - + // -------------------------------------------------------------------- - + /** * Click * @@ -112,7 +112,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Double Click * @@ -129,7 +129,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Error * @@ -146,7 +146,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Focus * @@ -163,7 +163,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Hover * @@ -185,7 +185,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Keydown * @@ -202,7 +202,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Keyup * @@ -216,10 +216,10 @@ class CI_Jquery extends CI_Javascript { function _keyup($element = 'this', $js = '') { return $this->_add_event($element, $js, 'keyup'); - } + } // -------------------------------------------------------------------- - + /** * Load * @@ -233,10 +233,10 @@ class CI_Jquery extends CI_Javascript { function _load($element = 'this', $js = '') { return $this->_add_event($element, $js, 'load'); - } - + } + // -------------------------------------------------------------------- - + /** * Mousedown * @@ -253,7 +253,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Mouse Out * @@ -270,7 +270,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Mouse Over * @@ -321,7 +321,7 @@ class CI_Jquery extends CI_Javascript { { $array_js = array($array_js); } - + foreach ($array_js as $js) { $this->jquery_code_for_compile[] = "\t$js\n"; @@ -361,7 +361,7 @@ class CI_Jquery extends CI_Javascript { { return $this->_add_event($element, $js, 'scroll'); } - + // -------------------------------------------------------------------- /** @@ -379,10 +379,10 @@ class CI_Jquery extends CI_Javascript { return $this->_add_event($element, $js, 'unload'); } - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Effects - // -------------------------------------------------------------------- - + // -------------------------------------------------------------------- + /** * Add Class * @@ -395,7 +395,7 @@ class CI_Jquery extends CI_Javascript { function _addClass($element = 'this', $class='') { $element = $this->_prep_element($element); - $str = "$({$element}).addClass(\"$class\");"; + $str = "$({$element}).addClass(\"$class\");"; return $str; } @@ -416,9 +416,9 @@ class CI_Jquery extends CI_Javascript { { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + $animations = "\t\t\t"; - + foreach ($params as $param=>$value) { $animations .= $param.': \''.$value.'\', '; @@ -430,19 +430,19 @@ class CI_Jquery extends CI_Javascript { { $speed = ', '.$speed; } - + if ($extra != '') { $extra = ', '.$extra; } - - $str = "$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; - + + $str = "$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; + return $str; } // -------------------------------------------------------------------- - + /** * Fade In * @@ -456,21 +456,21 @@ class CI_Jquery extends CI_Javascript { */ function _fadeIn($element = 'this', $speed = '', $callback = '') { - $element = $this->_prep_element($element); + $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).fadeIn({$speed}{$callback});"; - + + $str = "$({$element}).fadeIn({$speed}{$callback});"; + return $str; } - + // -------------------------------------------------------------------- - + /** * Fade Out * @@ -486,14 +486,14 @@ class CI_Jquery extends CI_Javascript { { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).fadeOut({$speed}{$callback});"; - + + $str = "$({$element}).fadeOut({$speed}{$callback});"; + return $str; } @@ -512,19 +512,19 @@ class CI_Jquery extends CI_Javascript { */ function _hide($element = 'this', $speed = '', $callback = '') { - $element = $this->_prep_element($element); + $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).hide({$speed}{$callback});"; + + $str = "$({$element}).hide({$speed}{$callback});"; return $str; } - + // -------------------------------------------------------------------- /** @@ -539,12 +539,12 @@ class CI_Jquery extends CI_Javascript { function _removeClass($element = 'this', $class='') { $element = $this->_prep_element($element); - $str = "$({$element}).removeClass(\"$class\");"; + $str = "$({$element}).removeClass(\"$class\");"; return $str; } // -------------------------------------------------------------------- - + /** * Slide Up * @@ -558,21 +558,21 @@ class CI_Jquery extends CI_Javascript { */ function _slideUp($element = 'this', $speed = '', $callback = '') { - $element = $this->_prep_element($element); + $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).slideUp({$speed}{$callback});"; - + + $str = "$({$element}).slideUp({$speed}{$callback});"; + return $str; } - + // -------------------------------------------------------------------- - + /** * Slide Down * @@ -588,19 +588,19 @@ class CI_Jquery extends CI_Javascript { { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).slideDown({$speed}{$callback});"; - + + $str = "$({$element}).slideDown({$speed}{$callback});"; + return $str; } // -------------------------------------------------------------------- - + /** * Slide Toggle * @@ -616,19 +616,19 @@ class CI_Jquery extends CI_Javascript { { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).slideToggle({$speed}{$callback});"; - + + $str = "$({$element}).slideToggle({$speed}{$callback});"; + return $str; } - + // -------------------------------------------------------------------- - + /** * Toggle * @@ -641,12 +641,12 @@ class CI_Jquery extends CI_Javascript { function _toggle($element = 'this') { $element = $this->_prep_element($element); - $str = "$({$element}).toggle();"; + $str = "$({$element}).toggle();"; return $str; } - + // -------------------------------------------------------------------- - + /** * Toggle Class * @@ -659,12 +659,12 @@ class CI_Jquery extends CI_Javascript { function _toggleClass($element = 'this', $class='') { $element = $this->_prep_element($element); - $str = "$({$element}).toggleClass(\"$class\");"; + $str = "$({$element}).toggleClass(\"$class\");"; return $str; } - + // -------------------------------------------------------------------- - + /** * Show * @@ -678,16 +678,16 @@ class CI_Jquery extends CI_Javascript { */ function _show($element = 'this', $speed = '', $callback = '') { - $element = $this->_prep_element($element); + $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); - + if ($callback != '') { $callback = ", function(){\n{$callback}\n}"; } - - $str = "$({$element}).show({$speed}{$callback});"; - + + $str = "$({$element}).show({$speed}{$callback});"; + return $str; } @@ -696,7 +696,7 @@ class CI_Jquery extends CI_Javascript { /** * Updater * - * An Ajax call that populates the designated DOM node with + * An Ajax call that populates the designated DOM node with * returned content * * @access private @@ -705,13 +705,13 @@ class CI_Jquery extends CI_Javascript { * @param string optional parameters * @return string */ - + function _updater($container = 'this', $controller, $options = '') - { + { $container = $this->_prep_element($container); - + $controller = (strpos('://', $controller) === FALSE) ? $controller : $this->CI->config->site_url($controller); - + // ajaxStart and ajaxStop are better choices here... but this is a stop gap if ($this->CI->config->item('javascript_ajax_img') == '') { @@ -721,7 +721,7 @@ class CI_Jquery extends CI_Javascript { { $loading_notifier = 'CI->config->slash_item('base_url') . $this->CI->config->item('javascript_ajax_img') . '\' alt=\'Loading\' />'; } - + $updater = "$($container).empty();\n"; // anything that was in... get it out $updater .= "\t\t$($container).prepend(\"$loading_notifier\");\n"; // to replace with an image @@ -741,7 +741,7 @@ class CI_Jquery extends CI_Javascript { // -------------------------------------------------------------------- // Pre-written handy stuff // -------------------------------------------------------------------- - + /** * Zebra tables * @@ -753,8 +753,8 @@ class CI_Jquery extends CI_Javascript { function _zebraTables($class = '', $odd = 'odd', $hover = '') { $class = ($class != '') ? '.'.$class : ''; - - $zebra = "\t\$(\"table{$class} tbody tr:nth-child(even)\").addClass(\"{$odd}\");"; + + $zebra = "\t\$(\"table{$class} tbody tr:nth-child(even)\").addClass(\"{$odd}\");"; $this->jquery_code_for_compile[] = $zebra; @@ -771,7 +771,7 @@ class CI_Jquery extends CI_Javascript { // -------------------------------------------------------------------- // Plugins // -------------------------------------------------------------------- - + /** * Corner Plugin * @@ -793,7 +793,7 @@ class CI_Jquery extends CI_Javascript { return "$(" . $this->_prep_element($element) . ").corner(".$corner_style.");"; } - + // -------------------------------------------------------------------- /** @@ -805,7 +805,7 @@ class CI_Jquery extends CI_Javascript { * @return void */ function modal($src, $relative = FALSE) - { + { $this->jquery_code_for_load[] = $this->external($src, $relative); } @@ -897,7 +897,7 @@ class CI_Jquery extends CI_Javascript { { $this->jquery_code_for_compile[] = "\t$(" . $this->_prep_element($table) . ").tablesorter($options);\n"; } - + // -------------------------------------------------------------------- // Class functions // -------------------------------------------------------------------- @@ -912,7 +912,7 @@ class CI_Jquery extends CI_Javascript { * @param string The code to execute * @param string The event to pass * @return string - */ + */ function _add_event($element, $js, $event) { if (is_array($js)) @@ -953,15 +953,15 @@ class CI_Jquery extends CI_Javascript { $script = '$(document).ready(function() {' . "\n"; $script .= implode('', $this->jquery_code_for_compile); $script .= '});'; - + $output = ($script_tags === FALSE) ? $script : $this->inline($script); $this->CI->load->vars(array($view_var => $output)); } - + // -------------------------------------------------------------------- - + /** * Clear Compile * @@ -976,7 +976,7 @@ class CI_Jquery extends CI_Javascript { } // -------------------------------------------------------------------- - + /** * Document Ready * @@ -992,7 +992,7 @@ class CI_Jquery extends CI_Javascript { $js = array ($js); } - + foreach ($js as $script) { $this->jquery_code_for_compile[] = $script; @@ -1016,7 +1016,7 @@ class CI_Jquery extends CI_Javascript { $this->jquery_code_for_load[] = $library_src; return $library_src; } - + // -------------------------------------------------------------------- /** @@ -1036,10 +1036,10 @@ class CI_Jquery extends CI_Javascript { { $element = '"'.$element.'"'; } - + return $element; } - + // -------------------------------------------------------------------- /** @@ -1050,7 +1050,7 @@ class CI_Jquery extends CI_Javascript { * @access private * @param string * @return string - */ + */ function _validate_speed($speed) { if (in_array($speed, array('slow', 'normal', 'fast'))) @@ -1061,7 +1061,7 @@ class CI_Jquery extends CI_Javascript { { $speed = ''; } - + return $speed; } -- cgit v1.2.3-24-g4f1b From db726c67ef1235aecf8f996306489e2febb700ec Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Sun, 3 Jul 2011 07:20:58 -0500 Subject: reverted texb.ttf font which had been compromised in 982b43c3590a by a another massive whitespace 'cleanup' commit --- system/fonts/texb.ttf | Bin 152992 -> 143830 bytes 1 file changed, 0 insertions(+), 0 deletions(-) (limited to 'system') diff --git a/system/fonts/texb.ttf b/system/fonts/texb.ttf index 6792342a3..383c88b86 100644 Binary files a/system/fonts/texb.ttf and b/system/fonts/texb.ttf differ -- cgit v1.2.3-24-g4f1b From 26b9ae2f500da7658074619af9c6dd982b77d0b8 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Fri, 15 Jul 2011 15:14:05 -0600 Subject: Was working on this file so PHP5ified the method visibility scopes. Pointless, but was adding... --- system/database/DB_active_rec.php | 260 ++++++++++++++++---------------------- 1 file changed, 106 insertions(+), 154 deletions(-) (limited to 'system') diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 52bad260a..7ddf20d07 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -69,11 +69,10 @@ class CI_DB_active_record extends CI_DB_driver { * * Generates the SELECT portion of the query * - * @access public * @param string * @return object */ - function select($select = '*', $escape = NULL) + public function select($select = '*', $escape = NULL) { if (is_string($select)) { @@ -107,12 +106,11 @@ class CI_DB_active_record extends CI_DB_driver { * * Generates a SELECT MAX(field) portion of a query * - * @access public * @param string the field * @param string an alias * @return object */ - function select_max($select = '', $alias = '') + public function select_max($select = '', $alias = '') { return $this->_max_min_avg_sum($select, $alias, 'MAX'); } @@ -124,12 +122,11 @@ class CI_DB_active_record extends CI_DB_driver { * * Generates a SELECT MIN(field) portion of a query * - * @access public * @param string the field * @param string an alias * @return object */ - function select_min($select = '', $alias = '') + public function select_min($select = '', $alias = '') { return $this->_max_min_avg_sum($select, $alias, 'MIN'); } @@ -141,12 +138,11 @@ class CI_DB_active_record extends CI_DB_driver { * * Generates a SELECT AVG(field) portion of a query * - * @access public * @param string the field * @param string an alias * @return object */ - function select_avg($select = '', $alias = '') + public function select_avg($select = '', $alias = '') { return $this->_max_min_avg_sum($select, $alias, 'AVG'); } @@ -158,12 +154,11 @@ class CI_DB_active_record extends CI_DB_driver { * * Generates a SELECT SUM(field) portion of a query * - * @access public * @param string the field * @param string an alias * @return object */ - function select_sum($select = '', $alias = '') + public function select_sum($select = '', $alias = '') { return $this->_max_min_avg_sum($select, $alias, 'SUM'); } @@ -178,12 +173,11 @@ class CI_DB_active_record extends CI_DB_driver { * select_avg() * select_sum() * - * @access public * @param string the field * @param string an alias * @return object */ - function _max_min_avg_sum($select = '', $alias = '', $type = 'MAX') + protected function _max_min_avg_sum($select = '', $alias = '', $type = 'MAX') { if ( ! is_string($select) OR $select == '') { @@ -220,11 +214,10 @@ class CI_DB_active_record extends CI_DB_driver { /** * Determines the alias name based on the table * - * @access private * @param string * @return string */ - function _create_alias_from_table($item) + protected function _create_alias_from_table($item) { if (strpos($item, '.') !== FALSE) { @@ -241,11 +234,10 @@ class CI_DB_active_record extends CI_DB_driver { * * Sets a flag which tells the query string compiler to add DISTINCT * - * @access public * @param bool * @return object */ - function distinct($val = TRUE) + public function distinct($val = TRUE) { $this->ar_distinct = (is_bool($val)) ? $val : TRUE; return $this; @@ -258,11 +250,10 @@ class CI_DB_active_record extends CI_DB_driver { * * Generates the FROM portion of the query * - * @access public * @param mixed can be a string or array * @return object */ - function from($from) + public function from($from) { foreach ((array)$from as $val) { @@ -311,13 +302,12 @@ class CI_DB_active_record extends CI_DB_driver { * * Generates the JOIN portion of the query * - * @access public * @param string * @param string the join condition * @param string the type of join * @return object */ - function join($table, $cond, $type = '') + public function join($table, $cond, $type = '') { if ($type != '') { @@ -367,12 +357,11 @@ class CI_DB_active_record extends CI_DB_driver { * Generates the WHERE portion of the query. Separates * multiple calls with AND * - * @access public * @param mixed * @param mixed * @return object */ - function where($key, $value = NULL, $escape = TRUE) + public function where($key, $value = NULL, $escape = TRUE) { return $this->_where($key, $value, 'AND ', $escape); } @@ -385,12 +374,11 @@ class CI_DB_active_record extends CI_DB_driver { * Generates the WHERE portion of the query. Separates * multiple calls with OR * - * @access public * @param mixed * @param mixed * @return object */ - function or_where($key, $value = NULL, $escape = TRUE) + public function or_where($key, $value = NULL, $escape = TRUE) { return $this->_where($key, $value, 'OR ', $escape); } @@ -400,15 +388,14 @@ class CI_DB_active_record extends CI_DB_driver { /** * Where * - * Called by where() or orwhere() + * Called by where() or or_where() * - * @access private * @param mixed * @param mixed * @param string * @return object */ - function _where($key, $value = NULL, $type = 'AND ', $escape = NULL) + protected function _where($key, $value = NULL, $type = 'AND ', $escape = NULL) { if ( ! is_array($key)) { @@ -471,12 +458,11 @@ class CI_DB_active_record extends CI_DB_driver { * Generates a WHERE field IN ('item', 'item') SQL query joined with * AND if appropriate * - * @access public * @param string The field to search * @param array The values searched on * @return object */ - function where_in($key = NULL, $values = NULL) + public function where_in($key = NULL, $values = NULL) { return $this->_where_in($key, $values); } @@ -489,12 +475,11 @@ class CI_DB_active_record extends CI_DB_driver { * Generates a WHERE field IN ('item', 'item') SQL query joined with * OR if appropriate * - * @access public * @param string The field to search * @param array The values searched on * @return object */ - function or_where_in($key = NULL, $values = NULL) + public function or_where_in($key = NULL, $values = NULL) { return $this->_where_in($key, $values, FALSE, 'OR '); } @@ -507,12 +492,11 @@ class CI_DB_active_record extends CI_DB_driver { * Generates a WHERE field NOT IN ('item', 'item') SQL query joined * with AND if appropriate * - * @access public * @param string The field to search * @param array The values searched on * @return object */ - function where_not_in($key = NULL, $values = NULL) + public function where_not_in($key = NULL, $values = NULL) { return $this->_where_in($key, $values, TRUE); } @@ -525,12 +509,11 @@ class CI_DB_active_record extends CI_DB_driver { * Generates a WHERE field NOT IN ('item', 'item') SQL query joined * with OR if appropriate * - * @access public * @param string The field to search * @param array The values searched on * @return object */ - function or_where_not_in($key = NULL, $values = NULL) + public function or_where_not_in($key = NULL, $values = NULL) { return $this->_where_in($key, $values, TRUE, 'OR '); } @@ -542,14 +525,13 @@ class CI_DB_active_record extends CI_DB_driver { * * Called by where_in, where_in_or, where_not_in, where_not_in_or * - * @access public * @param string The field to search * @param array The values searched on * @param boolean If the statement would be IN or NOT IN * @param string * @return object */ - function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ') + protected function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ') { if ($key === NULL OR $values === NULL) { @@ -592,12 +574,11 @@ class CI_DB_active_record extends CI_DB_driver { * Generates a %LIKE% portion of the query. Separates * multiple calls with AND * - * @access public * @param mixed * @param mixed * @return object */ - function like($field, $match = '', $side = 'both') + public function like($field, $match = '', $side = 'both') { return $this->_like($field, $match, 'AND ', $side); } @@ -610,12 +591,11 @@ class CI_DB_active_record extends CI_DB_driver { * Generates a NOT LIKE portion of the query. Separates * multiple calls with AND * - * @access public * @param mixed * @param mixed * @return object */ - function not_like($field, $match = '', $side = 'both') + public function not_like($field, $match = '', $side = 'both') { return $this->_like($field, $match, 'AND ', $side, 'NOT'); } @@ -628,12 +608,11 @@ class CI_DB_active_record extends CI_DB_driver { * Generates a %LIKE% portion of the query. Separates * multiple calls with OR * - * @access public * @param mixed * @param mixed * @return object */ - function or_like($field, $match = '', $side = 'both') + public function or_like($field, $match = '', $side = 'both') { return $this->_like($field, $match, 'OR ', $side); } @@ -646,12 +625,11 @@ class CI_DB_active_record extends CI_DB_driver { * Generates a NOT LIKE portion of the query. Separates * multiple calls with OR * - * @access public * @param mixed * @param mixed * @return object */ - function or_not_like($field, $match = '', $side = 'both') + public function or_not_like($field, $match = '', $side = 'both') { return $this->_like($field, $match, 'OR ', $side, 'NOT'); } @@ -663,13 +641,12 @@ class CI_DB_active_record extends CI_DB_driver { * * Called by like() or orlike() * - * @access private * @param mixed * @param mixed * @param string * @return object */ - function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '') + protected function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '') { if ( ! is_array($field)) { @@ -719,11 +696,10 @@ class CI_DB_active_record extends CI_DB_driver { /** * GROUP BY * - * @access public * @param string * @return object */ - function group_by($by) + public function group_by($by) { if (is_string($by)) { @@ -755,12 +731,11 @@ class CI_DB_active_record extends CI_DB_driver { * * Separates multiple calls with AND * - * @access public * @param string * @param string * @return object */ - function having($key, $value = '', $escape = TRUE) + public function having($key, $value = '', $escape = TRUE) { return $this->_having($key, $value, 'AND ', $escape); } @@ -772,12 +747,11 @@ class CI_DB_active_record extends CI_DB_driver { * * Separates multiple calls with OR * - * @access public * @param string * @param string * @return object */ - function or_having($key, $value = '', $escape = TRUE) + public function or_having($key, $value = '', $escape = TRUE) { return $this->_having($key, $value, 'OR ', $escape); } @@ -789,12 +763,11 @@ class CI_DB_active_record extends CI_DB_driver { * * Called by having() or or_having() * - * @access private * @param string * @param string * @return object */ - function _having($key, $value = '', $type = 'AND ', $escape = TRUE) + protected function _having($key, $value = '', $type = 'AND ', $escape = TRUE) { if ( ! is_array($key)) { @@ -836,12 +809,11 @@ class CI_DB_active_record extends CI_DB_driver { /** * Sets the ORDER BY value * - * @access public * @param string * @param string direction: asc or desc * @return object */ - function order_by($orderby, $direction = '') + public function order_by($orderby, $direction = '') { if (strtolower($direction) == 'random') { @@ -892,12 +864,11 @@ class CI_DB_active_record extends CI_DB_driver { /** * Sets the LIMIT value * - * @access public * @param integer the limit value * @param integer the offset value * @return object */ - function limit($value, $offset = '') + public function limit($value, $offset = '') { $this->ar_limit = $value; @@ -914,11 +885,10 @@ class CI_DB_active_record extends CI_DB_driver { /** * Sets the OFFSET value * - * @access public * @param integer the offset value * @return object */ - function offset($offset) + public function offset($offset) { $this->ar_offset = $offset; return $this; @@ -929,13 +899,12 @@ class CI_DB_active_record extends CI_DB_driver { /** * The "set" function. Allows key/value pairs to be set for inserting or updating * - * @access public * @param mixed * @param string * @param boolean * @return object */ - function set($key, $value = '', $escape = TRUE) + public function set($key, $value = '', $escape = TRUE) { $key = $this->_object_to_array($key); @@ -967,13 +936,12 @@ class CI_DB_active_record extends CI_DB_driver { * Compiles the select statement based on the other functions called * and runs the query * - * @access public * @param string the table * @param string the limit clause * @param string the offset clause * @return object */ - function get($table = '', $limit = null, $offset = null) + public function get($table = '', $limit = null, $offset = null) { if ($table != '') { @@ -999,11 +967,10 @@ class CI_DB_active_record extends CI_DB_driver { * Generates a platform-specific query string that counts all records * returned by an Active Record query. * - * @access public * @param string * @return string */ - function count_all_results($table = '') + public function count_all_results($table = '') { if ($table != '') { @@ -1032,13 +999,12 @@ class CI_DB_active_record extends CI_DB_driver { * * Allows the where clause, limit and offset to be added directly * - * @access public * @param string the where clause * @param string the limit clause * @param string the offset clause * @return object */ - function get_where($table = '', $where = null, $limit = null, $offset = null) + public function get_where($table = '', $where = null, $limit = null, $offset = null) { if ($table != '') { @@ -1069,12 +1035,11 @@ class CI_DB_active_record extends CI_DB_driver { * * Compiles batch insert strings and runs the queries * - * @access public * @param string the table to retrieve the results from * @param array an associative array of insert values * @return object */ - function insert_batch($table = '', $set = NULL) + public function insert_batch($table = '', $set = NULL) { if ( ! is_null($set)) { @@ -1127,14 +1092,12 @@ class CI_DB_active_record extends CI_DB_driver { /** * The "set_insert_batch" function. Allows key/value pairs to be set for batch inserts * - * @access public * @param mixed * @param string * @param boolean * @return object */ - - function set_insert_batch($key, $value = '', $escape = TRUE) + public function set_insert_batch($key, $value = '', $escape = TRUE) { $key = $this->_object_to_array_batch($key); @@ -1189,8 +1152,7 @@ class CI_DB_active_record extends CI_DB_driver { * * Compiles an insert string and runs the query * - * @access public - * @param string the table to retrieve the results from + * @param string the table to insert data into * @param array an associative array of insert values * @return object */ @@ -1230,7 +1192,18 @@ class CI_DB_active_record extends CI_DB_driver { return $this->query($sql); } - function replace($table = '', $set = NULL) + // -------------------------------------------------------------------- + + /** + * Replace + * + * Compiles an replace into string and runs the query + * + * @param string the table to replace data into + * @param array an associative array of insert values + * @return object + */ + public function replace($table = '', $set = NULL) { if ( ! is_null($set)) { @@ -1273,13 +1246,12 @@ class CI_DB_active_record extends CI_DB_driver { * * Compiles an update string and runs the query * - * @access public * @param string the table to retrieve the results from * @param array an associative array of update values * @param mixed the where clause * @return object */ - function update($table = '', $set = NULL, $where = NULL, $limit = NULL) + public function update($table = '', $set = NULL, $where = NULL, $limit = NULL) { // Combine any cached components with the current statements $this->_merge_cache(); @@ -1336,13 +1308,12 @@ class CI_DB_active_record extends CI_DB_driver { * * Compiles an update string and runs the query * - * @access public * @param string the table to retrieve the results from * @param array an associative array of update values * @param string the where key * @return object */ - function update_batch($table = '', $set = NULL, $index = NULL) + public function update_batch($table = '', $set = NULL, $index = NULL) { // Combine any cached components with the current statements $this->_merge_cache(); @@ -1402,14 +1373,12 @@ class CI_DB_active_record extends CI_DB_driver { /** * The "set_update_batch" function. Allows key/value pairs to be set for batch updating * - * @access public * @param array * @param string * @param boolean * @return object */ - - function set_update_batch($key, $index = '', $escape = TRUE) + public function set_update_batch($key, $index = '', $escape = TRUE) { $key = $this->_object_to_array_batch($key); @@ -1462,11 +1431,10 @@ class CI_DB_active_record extends CI_DB_driver { * * Compiles a delete string and runs "DELETE FROM table" * - * @access public * @param string the table to empty * @return object */ - function empty_table($table = '') + public function empty_table($table = '') { if ($table == '') { @@ -1502,11 +1470,10 @@ class CI_DB_active_record extends CI_DB_driver { * If the database does not support the truncate() command * This function maps to "DELETE FROM table" * - * @access public * @param string the table to truncate * @return object */ - function truncate($table = '') + public function truncate($table = '') { if ($table == '') { @@ -1540,14 +1507,13 @@ class CI_DB_active_record extends CI_DB_driver { * * Compiles a delete string and runs the query * - * @access public * @param mixed the table(s) to delete from. String or array * @param mixed the where clause * @param mixed the limit clause * @param boolean * @return object */ - function delete($table = '', $where = '', $limit = NULL, $reset_data = TRUE) + public function delete($table = '', $where = '', $limit = NULL, $reset_data = TRUE) { // Combine any cached components with the current statements $this->_merge_cache(); @@ -1617,11 +1583,10 @@ class CI_DB_active_record extends CI_DB_driver { * * Prepends a database prefix if one exists in configuration * - * @access public * @param string the table * @return string */ - function dbprefix($table = '') + public function dbprefix($table = '') { if ($table == '') { @@ -1638,11 +1603,10 @@ class CI_DB_active_record extends CI_DB_driver { * * Used to track SQL statements written with aliased tables. * - * @access private * @param string The table to inspect * @return string */ - function _track_aliases($table) + protected function _track_aliases($table) { if (is_array($table)) { @@ -1685,10 +1649,9 @@ class CI_DB_active_record extends CI_DB_driver { * Generates a query string based on which functions were used. * Should not be called directly. The get() function calls it. * - * @access private * @return string */ - function _compile_select($select_override = FALSE) + protected function _compile_select($select_override = FALSE) { // Combine any cached components with the current statements $this->_merge_cache(); @@ -1826,11 +1789,10 @@ class CI_DB_active_record extends CI_DB_driver { * * Takes an object as input and converts the class variables to array key/vals * - * @access public * @param object * @return array */ - function _object_to_array($object) + public function _object_to_array($object) { if ( ! is_object($object)) { @@ -1857,11 +1819,10 @@ class CI_DB_active_record extends CI_DB_driver { * * Takes an object as input and converts the class variables to array key/vals * - * @access public * @param object * @return array */ - function _object_to_array_batch($object) + public function _object_to_array_batch($object) { if ( ! is_object($object)) { @@ -1897,10 +1858,9 @@ class CI_DB_active_record extends CI_DB_driver { * * Starts AR caching * - * @access public * @return void */ - function start_cache() + public function start_cache() { $this->ar_caching = TRUE; } @@ -1912,10 +1872,9 @@ class CI_DB_active_record extends CI_DB_driver { * * Stops AR caching * - * @access public * @return void */ - function stop_cache() + public function stop_cache() { $this->ar_caching = FALSE; } @@ -1930,23 +1889,21 @@ class CI_DB_active_record extends CI_DB_driver { * @access public * @return void */ - function flush_cache() + public function flush_cache() { - $this->_reset_run( - array( - 'ar_cache_select' => array(), - 'ar_cache_from' => array(), - 'ar_cache_join' => array(), - 'ar_cache_where' => array(), - 'ar_cache_like' => array(), - 'ar_cache_groupby' => array(), - 'ar_cache_having' => array(), - 'ar_cache_orderby' => array(), - 'ar_cache_set' => array(), - 'ar_cache_exists' => array(), - 'ar_cache_no_escape' => array() - ) - ); + $this->_reset_run(array( + 'ar_cache_select' => array(), + 'ar_cache_from' => array(), + 'ar_cache_join' => array(), + 'ar_cache_where' => array(), + 'ar_cache_like' => array(), + 'ar_cache_groupby' => array(), + 'ar_cache_having' => array(), + 'ar_cache_orderby' => array(), + 'ar_cache_set' => array(), + 'ar_cache_exists' => array(), + 'ar_cache_no_escape' => array() + )); } // -------------------------------------------------------------------- @@ -1957,10 +1914,9 @@ class CI_DB_active_record extends CI_DB_driver { * When called, this function merges any cached AR arrays with * locally called ones. * - * @access private * @return void */ - function _merge_cache() + protected function _merge_cache() { if (count($this->ar_cache_exists) == 0) { @@ -1995,11 +1951,10 @@ class CI_DB_active_record extends CI_DB_driver { /** * Resets the active record values. Called by the get() function * - * @access private * @param array An array of fields to reset * @return void */ - function _reset_run($ar_reset_items) + protected function _reset_run($ar_reset_items) { foreach ($ar_reset_items as $item => $default_value) { @@ -2015,28 +1970,27 @@ class CI_DB_active_record extends CI_DB_driver { /** * Resets the active record values. Called by the get() function * - * @access private * @return void */ - function _reset_select() + protected function _reset_select() { $ar_reset_items = array( - 'ar_select' => array(), - 'ar_from' => array(), - 'ar_join' => array(), - 'ar_where' => array(), - 'ar_like' => array(), - 'ar_groupby' => array(), - 'ar_having' => array(), - 'ar_orderby' => array(), - 'ar_wherein' => array(), - 'ar_aliased_tables' => array(), - 'ar_no_escape' => array(), - 'ar_distinct' => FALSE, - 'ar_limit' => FALSE, - 'ar_offset' => FALSE, - 'ar_order' => FALSE, - ); + 'ar_select' => array(), + 'ar_from' => array(), + 'ar_join' => array(), + 'ar_where' => array(), + 'ar_like' => array(), + 'ar_groupby' => array(), + 'ar_having' => array(), + 'ar_orderby' => array(), + 'ar_wherein' => array(), + 'ar_aliased_tables' => array(), + 'ar_no_escape' => array(), + 'ar_distinct' => FALSE, + 'ar_limit' => FALSE, + 'ar_offset' => FALSE, + 'ar_order' => FALSE, + ); $this->_reset_run($ar_reset_items); } @@ -2048,25 +2002,23 @@ class CI_DB_active_record extends CI_DB_driver { * * Called by the insert() update() insert_batch() update_batch() and delete() functions * - * @access private * @return void */ - function _reset_write() + protected function _reset_write() { $ar_reset_items = array( - 'ar_set' => array(), - 'ar_from' => array(), - 'ar_where' => array(), - 'ar_like' => array(), - 'ar_orderby' => array(), - 'ar_keys' => array(), - 'ar_limit' => FALSE, - 'ar_order' => FALSE - ); + 'ar_set' => array(), + 'ar_from' => array(), + 'ar_where' => array(), + 'ar_like' => array(), + 'ar_orderby' => array(), + 'ar_keys' => array(), + 'ar_limit' => FALSE, + 'ar_order' => FALSE + ); $this->_reset_run($ar_reset_items); } - } /* End of file DB_active_rec.php */ -- cgit v1.2.3-24-g4f1b From 5025929d76172efd6dd3a7b0f4da7611a3df9391 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Fri, 15 Jul 2011 15:25:15 -0600 Subject: Fixed conflicted changelog. --- system/database/DB_active_rec.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'system') diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 7ddf20d07..bc11ff436 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -1598,6 +1598,21 @@ class CI_DB_active_record extends CI_DB_driver { // -------------------------------------------------------------------- + /** + * Set DB Prefix + * + * Set's the DB Prefix to something new without needing to reconnect + * + * @param string the prefix + * @return string + */ + public function set_dbprefix($prefix = '') + { + return $this->dbprefix = $prefix; + } + + // -------------------------------------------------------------------- + /** * Track Aliases * -- cgit v1.2.3-24-g4f1b From 72038ba6fd2e8196623bf1bd1a38756ad41ce905 Mon Sep 17 00:00:00 2001 From: MarcosCoelho Date: Mon, 18 Jul 2011 16:12:47 -0300 Subject: sync total items count and total amount price; by sum of quantity of each item in cart --- system/libraries/Cart.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'system') diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index 7f65b48b9..b2eaa9ad7 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -374,6 +374,7 @@ class CI_Cart { // Lets add up the individual prices and set the cart sub-total $total = 0; + $items = 0; foreach ($this->_cart_contents as $key => $val) { // We make sure the array contains the proper indexes @@ -383,13 +384,14 @@ class CI_Cart { } $total += ($val['price'] * $val['qty']); + $items += $val['qty']; // Set the subtotal $this->_cart_contents[$key]['subtotal'] = ($this->_cart_contents[$key]['price'] * $this->_cart_contents[$key]['qty']); } // Set the cart total and total items. - $this->_cart_contents['total_items'] = count($this->_cart_contents); + $this->_cart_contents['total_items'] = $items; $this->_cart_contents['cart_total'] = $total; // Is our cart empty? If so we delete it from the session -- cgit v1.2.3-24-g4f1b From e0df07950b101316c07ccec882ae00f930bca0c6 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Fri, 22 Jul 2011 16:11:34 -0600 Subject: Fixed conflict in changelog. --- system/core/Loader.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'system') diff --git a/system/core/Loader.php b/system/core/Loader.php index 721c196cc..7c8b298ac 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -388,6 +388,21 @@ class CI_Loader { // -------------------------------------------------------------------- + /** + * Get Variable + * + * Check if a variable is set and retrieve it. + * + * @param array + * @return void + */ + public function get_var($key) + { + return isset($this->_ci_cached_vars[$key]) ? $this->_ci_cached_vars[$key] : NULL; + } + + // -------------------------------------------------------------------- + /** * Load Helper * -- cgit v1.2.3-24-g4f1b From b13a0dd78f0d0449e3ee9eb350ac06594beb3252 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Mon, 18 Jul 2011 00:13:07 -0400 Subject: Fixed issue #199 - Attributes passed as string does not include a space between it and the opening tag. --- system/helpers/html_helper.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'system') diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 080f622dd..b64b60650 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -124,6 +124,10 @@ if ( ! function_exists('_list')) } $attributes = $atts; } + elseif (is_string($attributes) AND strlen($attributes) > 0) + { + $attributes = ' '. $attributes; + } // Write the opening list tag $out .= "<".$type.$attributes.">\n"; -- cgit v1.2.3-24-g4f1b From 40b28e9139f3486971fe6f13594d3f615a37862c Mon Sep 17 00:00:00 2001 From: Adam Jackett Date: Sat, 23 Jul 2011 11:45:05 -0400 Subject: Fixed having method to insert quotes. --- system/database/DB_active_rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index bc11ff436..0a25b3cb5 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -790,7 +790,7 @@ class CI_DB_active_record extends CI_DB_driver { if ($v != '') { - $v = ' '.$this->escape_str($v); + $v = ' '.$this->escape($v); } $this->ar_having[] = $prefix.$k.$v; -- cgit v1.2.3-24-g4f1b From c5961e7d778d5a9361df4cfbc7da5fc4370d883f Mon Sep 17 00:00:00 2001 From: Adam Jackett Date: Sat, 23 Jul 2011 09:50:34 -0400 Subject: Fixed mysql and mysqli drivers to set NOT NULL as default for creating fields. All other drivers were correct. --- system/database/drivers/mysql/mysql_forge.php | 8 ++++++-- system/database/drivers/mysqli/mysqli_forge.php | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'system') diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php index 529ec980d..c1cae136c 100644 --- a/system/database/drivers/mysql/mysql_forge.php +++ b/system/database/drivers/mysql/mysql_forge.php @@ -119,9 +119,13 @@ class CI_DB_mysql_forge extends CI_DB_forge { $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\''; } - if (array_key_exists('NULL', $attributes)) + if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE) { - $sql .= ($attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL'; + $sql .= ' NULL'; + } + else + { + $sql .= ' NOT NULL'; } if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE) diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php index d5097335e..260549457 100644 --- a/system/database/drivers/mysqli/mysqli_forge.php +++ b/system/database/drivers/mysqli/mysqli_forge.php @@ -104,9 +104,13 @@ class CI_DB_mysqli_forge extends CI_DB_forge { $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\''; } - if (array_key_exists('NULL', $attributes)) + if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE) { - $sql .= ($attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL'; + $sql .= ' NULL'; + } + else + { + $sql .= ' NOT NULL'; } if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE) -- cgit v1.2.3-24-g4f1b From 76e621786007907192c3e84cbde3e1a12dbf83fb Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Tue, 9 Aug 2011 16:03:49 -0600 Subject: Fixed conflict in changelog. --- system/database/DB_active_rec.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system') diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 0a25b3cb5..2af3553ed 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -1694,7 +1694,8 @@ class CI_DB_active_record extends CI_DB_driver { // is because until the user calls the from() function we don't know if there are aliases foreach ($this->ar_select as $key => $val) { - $this->ar_select[$key] = $this->_protect_identifiers($val, FALSE, $this->ar_no_escape[$key]); + $no_escape = isset($this->ar_no_escape[$key]) ? $this->ar_no_escape[$key] : NULL; + $this->ar_select[$key] = $this->_protect_identifiers($val, FALSE, $no_escape); } $sql .= implode(', ', $this->ar_select); -- cgit v1.2.3-24-g4f1b From 99f6c8c4d71714e62a86cee5d2f7fbfa496a3c5a Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Sat, 13 Aug 2011 10:26:04 -0600 Subject: Improved logic for plural() and singular() as words like "tax" would become "taxs" and it was tough to code in new rules. --- system/helpers/inflector_helper.php | 115 +++++++++++++++++++++--------------- 1 file changed, 67 insertions(+), 48 deletions(-) (limited to 'system') diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index c7c113b8a..7b99bc5b4 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -41,30 +41,48 @@ if ( ! function_exists('singular')) { function singular($str) { - $str = trim($str); - $end = substr($str, -3); - - $str = preg_replace('/(.*)?([s|c]h)es/i','$1$2',$str); - - if (strtolower($end) == 'ies') + $result = strval($str); + + $singular_rules = array( + '/(matr)ices$/' => '\1ix', + '/(vert|ind)ices$/' => '\1ex', + '/^(ox)en/' => '\1', + '/(alias)es$/' => '\1', + '/([octop|vir])i$/' => '\1us', + '/(cris|ax|test)es$/' => '\1is', + '/(shoe)s$/' => '\1', + '/(o)es$/' => '\1', + '/(bus|campus)es$/' => '\1', + '/([m|l])ice$/' => '\1ouse', + '/(x|ch|ss|sh)es$/' => '\1', + '/(m)ovies$/' => '\1\2ovie', + '/(s)eries$/' => '\1\2eries', + '/([^aeiouy]|qu)ies$/' => '\1y', + '/([lr])ves$/' => '\1f', + '/(tive)s$/' => '\1', + '/(hive)s$/' => '\1', + '/([^f])ves$/' => '\1fe', + '/(^analy)ses$/' => '\1sis', + '/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/' => '\1\2sis', + '/([ti])a$/' => '\1um', + '/(p)eople$/' => '\1\2erson', + '/(m)en$/' => '\1an', + '/(s)tatuses$/' => '\1\2tatus', + '/(c)hildren$/' => '\1\2hild', + '/(n)ews$/' => '\1\2ews', + '/([^u])s$/' => '\1', + ); + + foreach ($singular_rules as $rule => $replacement) { - $str = substr($str, 0, strlen($str)-3).(preg_match('/[a-z]/',$end) ? 'y' : 'Y'); - } - elseif (strtolower($end) == 'ses') - { - $str = substr($str, 0, strlen($str)-2); - } - else - { - $end = strtolower(substr($str, -1)); - - if ($end == 's') + if (preg_match($rule, $result)) { - $str = substr($str, 0, strlen($str)-1); + $result = preg_replace($rule, $replacement, $result); + break; } } - return $str; + return $result; } } @@ -83,40 +101,41 @@ if ( ! function_exists('singular')) if ( ! function_exists('plural')) { function plural($str, $force = FALSE) - { - $str = trim($str); - $end = substr($str, -1); - - if (preg_match('/y/i',$end)) - { - // Y preceded by vowel => regular plural - $vowels = array('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'); - $str = in_array(substr($str, -2, 1), $vowels) ? $str.'s' : substr($str, 0, -1).'ies'; - } - elseif (preg_match('/h/i',$end)) - { - if(preg_match('/^[c|s]h$/i',substr($str, -2))) - { - $str .= 'es'; - } - else - { - $str .= 's'; - } - } - elseif (preg_match('/s/i',$end)) + { + $result = strval($str); + + $plural_rules = array( + '/^(ox)$/' => '\1\2en', // ox + '/([m|l])ouse$/' => '\1ice', // mouse, louse + '/(matr|vert|ind)ix|ex$/' => '\1ices', // matrix, vertex, index + '/(x|ch|ss|sh)$/' => '\1es', // search, switch, fix, box, process, address + '/([^aeiouy]|qu)y$/' => '\1ies', // query, ability, agency + '/(hive)$/' => '\1s', // archive, hive + '/(?:([^f])fe|([lr])f)$/' => '\1\2ves', // half, safe, wife + '/sis$/' => 'ses', // basis, diagnosis + '/([ti])um$/' => '\1a', // datum, medium + '/(p)erson$/' => '\1eople', // person, salesperson + '/(m)an$/' => '\1en', // man, woman, spokesman + '/(c)hild$/' => '\1hildren', // child + '/(buffal|tomat)o$/' => '\1\2oes', // buffalo, tomato + '/(bu|campu)s$/' => '\1\2ses', // bus, campus + '/(alias|status|virus)/' => '\1es', // alias + '/(octop)us$/' => '\1i', // octopus + '/(ax|cris|test)is$/' => '\1es', // axis, crisis + '/s$/' => 's', // no change (compatibility) + '/$/' => 's', + ); + + foreach ($plural_rules as $rule => $replacement) { - if ($force == TRUE) + if (preg_match($rule, $result)) { - $str .= 'es'; + $result = preg_replace($rule, $replacement, $result); + break; } } - else - { - $str .= 's'; - } - return $str; + return $result; } } -- cgit v1.2.3-24-g4f1b From fe1d45a023b08753f4c5f1d908d54ae842277558 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Sat, 13 Aug 2011 11:06:57 -0600 Subject: Fixed conflicts. --- system/core/Input.php | 2 +- system/core/URI.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/core/Input.php b/system/core/Input.php index dc7612e64..cfbef942d 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -672,7 +672,7 @@ class CI_Input { */ public function is_cli_request() { - return (bool) defined('STDIN'); + return (php_sapi_name() == 'cli') or defined('STDIN'); } } diff --git a/system/core/URI.php b/system/core/URI.php index d56548654..20f0f006b 100644 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -62,7 +62,7 @@ class CI_URI { if (strtoupper($this->config->item('uri_protocol')) == 'AUTO') { // Is the request coming from the command line? - if (defined('STDIN')) + if (php_sapi_name() == 'cli' or defined('STDIN')) { $this->_set_uri_string($this->_parse_cli_args()); return; -- cgit v1.2.3-24-g4f1b From 9d887b32a1fe998cbb0307a5e678ac3ba5076a1e Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 10 Aug 2011 08:06:37 -0600 Subject: Fixed conflicts in changelog. --- system/libraries/Email.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/libraries/Email.php b/system/libraries/Email.php index cd89f8f3d..03eccea09 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -395,7 +395,7 @@ class CI_Email { public function attach($filename, $disposition = 'attachment') { $this->_attach_name[] = $filename; - $this->_attach_type[] = $this->_mime_types(next(explode('.', basename($filename)))); + $this->_attach_type[] = $this->_mime_types(pathinfo($filename, PATHINFO_EXTENSION)); $this->_attach_disp[] = $disposition; // Can also be 'inline' Not sure if it matters return $this; } -- cgit v1.2.3-24-g4f1b From 4c76272593d82f45761c24917e69b42983f26171 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Sat, 13 Aug 2011 11:31:22 -0600 Subject: Bumped the version number. Can somebody with a working find and replace fix up the docs? --- system/core/CodeIgniter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 03b25ab9e..94fecb5c0 100644 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -32,7 +32,7 @@ * Define the CodeIgniter Version * ------------------------------------------------------ */ - define('CI_VERSION', '2.0.2'); + define('CI_VERSION', '2.0.3'); /* * ------------------------------------------------------ -- cgit v1.2.3-24-g4f1b