Skip to content

Commit

Permalink
Fixed conflicts in changelog to reflect all changes.
Browse files Browse the repository at this point in the history
Conflicts:
	user_guide_src/source/changelog.rst
  • Loading branch information
frypan-handler committed Oct 5, 2012
2 parents ddb32da + f20bca9 commit fad3896
Show file tree
Hide file tree
Showing 22 changed files with 60 additions and 100 deletions.
4 changes: 3 additions & 1 deletion application/config/mimes.php
Expand Up @@ -49,7 +49,7 @@
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => array('application/pdf', 'application/x-download'),
'pdf' => array('application/pdf', 'application/x-download', 'binary/octet-stream'),
'ai' => 'application/postscript',
'eps' => 'application/postscript',
'ps' => 'application/postscript',
Expand Down Expand Up @@ -124,6 +124,8 @@
'movie' => 'video/x-sgi-movie',
'doc' => array('application/msword', 'application/vnd.ms-office'),
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
'dot' => array('application/msword', 'application/vnd.ms-office'),
'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword'),
'word' => array('application/msword', 'application/octet-stream'),
'xl' => 'application/excel',
Expand Down
6 changes: 1 addition & 5 deletions system/core/Common.php
Expand Up @@ -488,13 +488,9 @@ function set_status_header($code = 200, $text = '')
{
header('Status: '.$code.' '.$text, TRUE);
}
elseif ($server_protocol === 'HTTP/1.0')
{
header('HTTP/1.0 '.$code.' '.$text, TRUE, $code);
}
else
{
header('HTTP/1.1 '.$code.' '.$text, TRUE, $code);
header(($server_protocol ? $server_protocol : 'HTTP/1.1').' '.$code.' '.$text, TRUE, $code);
}
}
}
Expand Down
20 changes: 12 additions & 8 deletions system/core/Input.php
Expand Up @@ -330,32 +330,36 @@ public function ip_address()

if (config_item('proxy_ips') != '' && $this->server('HTTP_X_FORWARDED_FOR') && $this->server('REMOTE_ADDR'))
{
$has_ranges = strpos($proxies, '/') !== false;
$has_ranges = strpos($proxies, '/') !== FALSE;
$proxies = preg_split('/[\s,]/', config_item('proxy_ips'), -1, PREG_SPLIT_NO_EMPTY);
$proxies = is_array($proxies) ? $proxies : array($proxies);

if ($has_ranges)
{
$long_ip = ip2long($_SERVER['REMOTE_ADDR']);
$bit_32 = 1 << 32;

// Go through each of the IP Addresses to check for and
// test against range notation
foreach($proxies as $ip)
foreach ($proxies as $ip)
{
list($address, $mask_length) = explode('/', $ip);
list($address, $mask_length) = explode('/', $ip, 2);

// Generate the bitmask for a 32 bit IP Address
$bitmask = $bit_32 - (1 << (32 - (int)$mask_length));
if (($long_ip & $bitmask) == $address)
$bitmask = $bit_32 - (1 << (32 - (int) $mask_length));
if (($long_ip & $bitmask) === $address)
{
$this->ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
break;
}
}

} else {
$this->ip_address = in_array($_SERVER['REMOTE_ADDR'], $proxies) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
}
else
{
$this->ip_address = in_array($_SERVER['REMOTE_ADDR'], $proxies)
? $_SERVER['HTTP_X_FORWARDED_FOR']
: $_SERVER['REMOTE_ADDR'];
}
}
elseif ( ! $this->server('HTTP_CLIENT_IP') && $this->server('REMOTE_ADDR'))
Expand Down
4 changes: 4 additions & 0 deletions system/database/DB_driver.php
Expand Up @@ -79,6 +79,10 @@ abstract class CI_DB_driver {
protected $_protect_identifiers = TRUE;
protected $_reserved_identifiers = array('*'); // Identifiers that should NOT be escaped

// clause and character used for LIKE escape sequences
protected $_like_escape_str = " ESCAPE '%s' ";
protected $_like_escape_chr = '!';

/**
* The syntax to count rows is slightly different across different
* database engines, so this string appears in each driver and is
Expand Down
6 changes: 2 additions & 4 deletions system/database/drivers/cubrid/cubrid_driver.php
Expand Up @@ -45,10 +45,6 @@ class CI_DB_cubrid_driver extends CI_DB {
// The character used for escaping - no need in CUBRID
protected $_escape_char = '`';

// clause and character used for LIKE escape sequences - not used in CUBRID
protected $_like_escape_str = '';
protected $_like_escape_chr = '';

protected $_random_keyword = ' RAND()'; // database specific random keyword

// CUBRID-specific properties
Expand All @@ -72,6 +68,8 @@ public function __construct($params)
}
}

// --------------------------------------------------------------------

/**
* Non-persistent database connection
*
Expand Down
4 changes: 0 additions & 4 deletions system/database/drivers/ibase/ibase_driver.php
Expand Up @@ -45,10 +45,6 @@ class CI_DB_ibase_driver extends CI_DB {
// The character used to escape with
protected $_escape_char = '"';

// clause and character used for LIKE escape sequences
protected $_like_escape_str = " ESCAPE '%s' ";
protected $_like_escape_chr = '!';

protected $_random_keyword = ' Random()'; // database specific random keyword

// Keeps track of the resource for the current transaction
Expand Down
4 changes: 0 additions & 4 deletions system/database/drivers/mssql/mssql_driver.php
Expand Up @@ -45,10 +45,6 @@ class CI_DB_mssql_driver extends CI_DB {
// The character used for escaping
protected $_escape_char = '"';

// clause and character used for LIKE escape sequences
protected $_like_escape_str = " ESCAPE '%s' ";
protected $_like_escape_chr = '!';

protected $_random_keyword = ' NEWID()';

// MSSQL-specific properties
Expand Down
4 changes: 0 additions & 4 deletions system/database/drivers/mysql/mysql_driver.php
Expand Up @@ -45,10 +45,6 @@ class CI_DB_mysql_driver extends CI_DB {
// The character used for escaping
protected $_escape_char = '`';

// clause and character used for LIKE escape sequences - not used in MySQL
protected $_like_escape_str = '';
protected $_like_escape_chr = '\\';

protected $_random_keyword = ' RAND()'; // database specific random keyword

/**
Expand Down
4 changes: 0 additions & 4 deletions system/database/drivers/mysqli/mysqli_driver.php
Expand Up @@ -45,10 +45,6 @@ class CI_DB_mysqli_driver extends CI_DB {
// The character used for escaping
protected $_escape_char = '`';

// clause and character used for LIKE escape sequences - not used in MySQL
protected $_like_escape_str = '';
protected $_like_escape_chr = '\\';

protected $_random_keyword = ' RAND()'; // database specific random keyword

/**
Expand Down
4 changes: 0 additions & 4 deletions system/database/drivers/oci8/oci8_driver.php
Expand Up @@ -54,10 +54,6 @@ class CI_DB_oci8_driver extends CI_DB {
// The character used for excaping
protected $_escape_char = '"';

// clause and character used for LIKE escape sequences
protected $_like_escape_str = " ESCAPE '%s' ";
protected $_like_escape_chr = '!';

/**
* The syntax to count rows is slightly different across different
* database engines, so this string appears in each driver and is
Expand Down
2 changes: 0 additions & 2 deletions system/database/drivers/odbc/odbc_driver.php
Expand Up @@ -45,9 +45,7 @@ class CI_DB_odbc_driver extends CI_DB {
// the character used to excape - not necessary for ODBC
protected $_escape_char = '';

// clause and character used for LIKE escape sequences
protected $_like_escape_str = " {escape '%s'} ";
protected $_like_escape_chr = '!';

protected $_random_keyword;

Expand Down
4 changes: 0 additions & 4 deletions system/database/drivers/pdo/pdo_driver.php
Expand Up @@ -45,10 +45,6 @@ class CI_DB_pdo_driver extends CI_DB {
// The character used to escaping
protected $_escape_char = '"';

// clause and character used for LIKE escape sequences
protected $_like_escape_str = " ESCAPE '%s' ";
protected $_like_escape_chr = '!';

protected $_random_keyword;

public $trans_enabled = FALSE;
Expand Down
4 changes: 0 additions & 4 deletions system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php
Expand Up @@ -44,10 +44,6 @@ class CI_DB_pdo_cubrid_driver extends CI_DB_pdo_driver {

protected $_escape_char = '`';

// clause and character used for LIKE escape sequences - not used in CUBRID
protected $_like_escape_str = '';
protected $_like_escape_chr = '\\';

protected $_random_keyword = ' RAND()';

/**
Expand Down
4 changes: 0 additions & 4 deletions system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
Expand Up @@ -44,10 +44,6 @@ class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver {

protected $_escape_char = '`';

// clause and character used for LIKE escape sequences - not used in MySQL
protected $_like_escape_str = '';
protected $_like_escape_chr = '\\';

protected $_random_keyword = ' RAND()';

/**
Expand Down
1 change: 0 additions & 1 deletion system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php
Expand Up @@ -46,7 +46,6 @@ class CI_DB_pdo_odbc_driver extends CI_DB_pdo_driver {
protected $_escape_char = '';

// clause and character used for LIKE escape sequences
protected $_like_escape_chr = '!';
protected $_like_escape_str = " {escape '%s'} ";

protected $_random_keyword = ' RAND()';
Expand Down
4 changes: 0 additions & 4 deletions system/database/drivers/postgre/postgre_driver.php
Expand Up @@ -44,10 +44,6 @@ class CI_DB_postgre_driver extends CI_DB {

protected $_escape_char = '"';

// clause and character used for LIKE escape sequences
protected $_like_escape_str = " ESCAPE '%s' ";
protected $_like_escape_chr = '!';

protected $_random_keyword = ' RANDOM()'; // database specific random keyword

/**
Expand Down
4 changes: 0 additions & 4 deletions system/database/drivers/sqlite/sqlite_driver.php
Expand Up @@ -45,10 +45,6 @@ class CI_DB_sqlite_driver extends CI_DB {
// The character used to escape with - not needed for SQLite
protected $_escape_char = '"';

// clause and character used for LIKE escape sequences
protected $_like_escape_str = " ESCAPE '%s' ";
protected $_like_escape_chr = '!';

protected $_random_keyword = ' Random()'; // database specific random keyword

/**
Expand Down
4 changes: 0 additions & 4 deletions system/database/drivers/sqlite3/sqlite3_driver.php
Expand Up @@ -46,10 +46,6 @@ class CI_DB_sqlite3_driver extends CI_DB {
// The character used for escaping
protected $_escape_char = '"';

// clause and character used for LIKE escape sequences
protected $_like_escape_str = ' ESCAPE \'%s\' ';
protected $_like_escape_chr = '!';

protected $_random_keyword = ' RANDOM()';

/**
Expand Down
4 changes: 0 additions & 4 deletions system/database/drivers/sqlsrv/sqlsrv_driver.php
Expand Up @@ -45,10 +45,6 @@ class CI_DB_sqlsrv_driver extends CI_DB {
// The character used for escaping
protected $_escape_char = '"';

// clause and character used for LIKE escape sequences
protected $_like_escape_str = " ESCAPE '%s' ";
protected $_like_escape_chr = '!';

protected $_random_keyword = ' NEWID()';

// SQLSRV-specific properties
Expand Down
4 changes: 2 additions & 2 deletions system/libraries/Encrypt.php
Expand Up @@ -484,7 +484,7 @@ protected function _get_mode()
*/
public function set_hash($type = 'sha1')
{
$this->_hash_type = ($type !== 'sha1' && $type !== 'md5') ? 'sha1' : $type;
$this->_hash_type = in_array($type, hash_algos()) ? $type : 'sha1';
}

// --------------------------------------------------------------------
Expand All @@ -497,7 +497,7 @@ public function set_hash($type = 'sha1')
*/
public function hash($str)
{
return ($this->_hash_type === 'sha1') ? sha1($str) : md5($str);
return hash($this->_hash_type, $str);
}

}
Expand Down
4 changes: 2 additions & 2 deletions tests/codeigniter/database/query_builder/escape_test.php
Expand Up @@ -27,7 +27,7 @@ public function test_escape_like_percent_sign()

if (strpos(DB_DRIVER, 'mysql') !== FALSE)
{
$sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%' ESCAPE '';";
$sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%' ESCAPE '!';";
}
else
{
Expand All @@ -52,7 +52,7 @@ public function test_escape_like_backslash_sign()

if (strpos(DB_DRIVER, 'mysql') !== FALSE)
{
$sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%' ESCAPE '';";
$sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%' ESCAPE '!';";
}
else
{
Expand Down

0 comments on commit fad3896

Please sign in to comment.