Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions system/core/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
* @author EllisLab Dev Team
* @link https://codeigniter.com/userguide3/libraries/config.html
*/
#[AllowDynamicProperties]
class CI_Model {

/**
Expand Down
7 changes: 7 additions & 0 deletions system/database/DB_query_builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,10 @@ public function from($from)
*/
public function join($table, $cond, $type = '', $escape = NULL)
{
$type = (string) $type;
$cond = (string) $cond;
$table = (string) $table;

if ($type !== '')
{
$type = strtoupper(trim($type));
Expand Down Expand Up @@ -1208,6 +1212,9 @@ public function or_having($key, $value = NULL, $escape = NULL)
*/
public function order_by($orderby, $direction = '', $escape = NULL)
{
$orderby = (string) $orderby;
$direction = (string) $direction;

$direction = strtoupper(trim($direction));

if ($direction === 'RANDOM')
Expand Down
60 changes: 33 additions & 27 deletions system/database/drivers/mysqli/mysqli_result.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,33 +137,39 @@ public function field_data()
private static function _get_field_type($type)
{
static $map;
isset($map) OR $map = array(
MYSQLI_TYPE_DECIMAL => 'decimal',
MYSQLI_TYPE_BIT => 'bit',
MYSQLI_TYPE_TINY => 'tinyint',
MYSQLI_TYPE_SHORT => 'smallint',
MYSQLI_TYPE_INT24 => 'mediumint',
MYSQLI_TYPE_LONG => 'int',
MYSQLI_TYPE_LONGLONG => 'bigint',
MYSQLI_TYPE_FLOAT => 'float',
MYSQLI_TYPE_DOUBLE => 'double',
MYSQLI_TYPE_TIMESTAMP => 'timestamp',
MYSQLI_TYPE_DATE => 'date',
MYSQLI_TYPE_TIME => 'time',
MYSQLI_TYPE_DATETIME => 'datetime',
MYSQLI_TYPE_YEAR => 'year',
MYSQLI_TYPE_NEWDATE => 'date',
MYSQLI_TYPE_INTERVAL => 'interval',
MYSQLI_TYPE_ENUM => 'enum',
MYSQLI_TYPE_SET => 'set',
MYSQLI_TYPE_TINY_BLOB => 'tinyblob',
MYSQLI_TYPE_MEDIUM_BLOB => 'mediumblob',
MYSQLI_TYPE_BLOB => 'blob',
MYSQLI_TYPE_LONG_BLOB => 'longblob',
MYSQLI_TYPE_STRING => 'char',
MYSQLI_TYPE_VAR_STRING => 'varchar',
MYSQLI_TYPE_GEOMETRY => 'geometry'
);

if (!isset($map)) {
$map = array(
MYSQLI_TYPE_DECIMAL => 'decimal',
MYSQLI_TYPE_BIT => 'bit',
MYSQLI_TYPE_TINY => 'tinyint',
MYSQLI_TYPE_SHORT => 'smallint',
MYSQLI_TYPE_INT24 => 'mediumint',
MYSQLI_TYPE_LONG => 'int',
MYSQLI_TYPE_LONGLONG => 'bigint',
MYSQLI_TYPE_FLOAT => 'float',
MYSQLI_TYPE_DOUBLE => 'double',
MYSQLI_TYPE_TIMESTAMP => 'timestamp',
MYSQLI_TYPE_DATE => 'date',
MYSQLI_TYPE_TIME => 'time',
MYSQLI_TYPE_DATETIME => 'datetime',
MYSQLI_TYPE_YEAR => 'year',
MYSQLI_TYPE_NEWDATE => 'date',
MYSQLI_TYPE_ENUM => 'enum',
MYSQLI_TYPE_SET => 'set',
MYSQLI_TYPE_TINY_BLOB => 'tinyblob',
MYSQLI_TYPE_MEDIUM_BLOB => 'mediumblob',
MYSQLI_TYPE_BLOB => 'blob',
MYSQLI_TYPE_LONG_BLOB => 'longblob',
MYSQLI_TYPE_STRING => 'char',
MYSQLI_TYPE_VAR_STRING => 'varchar',
MYSQLI_TYPE_GEOMETRY => 'geometry'
);

if (defined('MYSQLI_TYPE_INTERVAL')) {
$map[constant('MYSQLI_TYPE_INTERVAL')] = 'interval';
}
}

return isset($map[$type]) ? $map[$type] : $type;
}
Expand Down
25 changes: 16 additions & 9 deletions system/libraries/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,8 @@ protected function _openssl_encrypt($data, $params)
return FALSE;
}

$data = (string) $data;

$iv = ($iv_size = openssl_cipher_iv_length($params['handle']))
? $this->create_key($iv_size)
: '';
Expand Down Expand Up @@ -626,6 +628,13 @@ protected function _mcrypt_decrypt($data, $params)
*/
protected function _openssl_decrypt($data, $params)
{
if (empty($params['handle']))
{
return FALSE;
}

$data = (string) $data;

if ($iv_size = openssl_cipher_iv_length($params['handle']))
{
$iv = self::substr($data, 0, $iv_size);
Expand All @@ -636,15 +645,13 @@ protected function _openssl_decrypt($data, $params)
$iv = '';
}

return empty($params['handle'])
? FALSE
: openssl_decrypt(
$data,
$params['handle'],
$params['key'],
1, // DO NOT TOUCH!
$iv
);
return openssl_decrypt(
$data,
$params['handle'],
$params['key'],
1, // DO NOT TOUCH!
$iv
);
}

// --------------------------------------------------------------------
Expand Down
Loading