From 7199e94dcb20819a66117c9f76b3ca79546e5796 Mon Sep 17 00:00:00 2001 From: Marcus Date: Wed, 9 Sep 2020 09:26:43 +0200 Subject: [PATCH 01/13] Detect `char` and `mediumtext` field types formatters[1] like *_formatted or *_markdown weren't able to identify a `mediumtext` database field as type `string` and just skipped the method. [1] https://docs.getfuelcms.com/general/models#formatters --- fuel/modules/fuel/core/MY_Model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuel/modules/fuel/core/MY_Model.php b/fuel/modules/fuel/core/MY_Model.php index be3953fb5..a441d6353 100755 --- a/fuel/modules/fuel/core/MY_Model.php +++ b/fuel/modules/fuel/core/MY_Model.php @@ -2348,7 +2348,7 @@ public function field_type($field) switch($switch) { - case 'var' : case 'varchar': case 'string': case 'tinytext': case 'text': case 'longtext': + case 'var': case 'char': case 'varchar': case 'string': case 'tinytext': case 'text': case 'longtext': case 'mediumtext': return 'string'; case 'int': case 'tinyint': case 'smallint': case 'mediumint': case 'float': case 'double': case 'decimal': return 'number'; From 49a0e9d8c87f04aa73f8f911738b4756a8f2c7d3 Mon Sep 17 00:00:00 2001 From: David McReynolds Date: Wed, 9 Sep 2020 07:38:54 -0700 Subject: [PATCH 02/13] fix: MySQL 8 int validation per https://forum.getfuelcms.com/discussion/3481/mysql-8-x-and-int-values --- fuel/modules/fuel/core/MY_Model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuel/modules/fuel/core/MY_Model.php b/fuel/modules/fuel/core/MY_Model.php index a441d6353..cf6023947 100755 --- a/fuel/modules/fuel/core/MY_Model.php +++ b/fuel/modules/fuel/core/MY_Model.php @@ -2407,7 +2407,7 @@ protected function auto_validate_field($field, $value) break; case 'number': $this->validator->add_rule($field, 'is_numeric', lang('error_not_number', $field_name), $value); - if ($field_data['type'] != 'float' AND $field_data['type'] != 'double') $this->validator->add_rule($field, 'length_max', lang('error_value_exceeds_length', $field_name), array($value, $field_data['max_length'])); + if (!empty($field_data['max_length']) AND $field_data['type'] != 'float' AND $field_data['type'] != 'double') $this->validator->add_rule($field, 'length_max', lang('error_value_exceeds_length', $field_name), array($value, $field_data['max_length'])); break; case 'date': if (strncmp($value, '0000', 4) !== 0) From 249e5147a89033a6c4dc9a12cbe178759c47325f Mon Sep 17 00:00:00 2001 From: David McReynolds Date: Wed, 9 Sep 2020 13:21:51 -0700 Subject: [PATCH 03/13] fix: for issue #567 when encryption key is not set --- fuel/modules/fuel/language/english/fuel_lang.php | 1 + fuel/modules/fuel/libraries/Fuel_assets.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/fuel/modules/fuel/language/english/fuel_lang.php b/fuel/modules/fuel/language/english/fuel_lang.php index fe278e1d2..84548336a 100644 --- a/fuel/modules/fuel/language/english/fuel_lang.php +++ b/fuel/modules/fuel/language/english/fuel_lang.php @@ -358,6 +358,7 @@ $lang['assets_comment_height'] = 'Will change the height of an image to the desired amount. If "Create thumbnail" is selected, it will only effect the size of the thumbnail.'; $lang['assets_comment_master_dim'] = 'Specifies the master dimension to use for resizing. If the source image size does not allow perfect resizing to those dimensions, this setting determines which axis should be used as the hard value. "auto" sets the axis automatically based on whether the image is taller then wider, or vice versa.'; $lang['assets_comment_unzip'] = 'Unzips a zip file'; +$lang['assets_encryption_key_missing'] = 'Missing $config[\'encryption_key\'] value to your CI config file.'; /* |-------------------------------------------------------------------------- diff --git a/fuel/modules/fuel/libraries/Fuel_assets.php b/fuel/modules/fuel/libraries/Fuel_assets.php index 40df17eb5..2aaddf6da 100644 --- a/fuel/modules/fuel/libraries/Fuel_assets.php +++ b/fuel/modules/fuel/libraries/Fuel_assets.php @@ -112,6 +112,11 @@ public function upload($params = array()) $this->CI->load->library('image_lib'); $this->CI->load->library('encryption'); + if (!config_item('encryption_key')) + { + $this->_add_error(lang('assets_encryption_key_missing')); + } + $valid = array( 'upload_path' => '', 'file_name' => '', 'overwrite' => FALSE, From 943f940b5fc53af32a29c744360406bbe8da8063 Mon Sep 17 00:00:00 2001 From: Marcus Date: Thu, 10 Sep 2020 07:59:35 +0200 Subject: [PATCH 04/13] Add more detailed information about the $path param --- fuel/modules/fuel/libraries/Asset.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fuel/modules/fuel/libraries/Asset.php b/fuel/modules/fuel/libraries/Asset.php index 8f5d24541..1f0da1866 100644 --- a/fuel/modules/fuel/libraries/Asset.php +++ b/fuel/modules/fuel/libraries/Asset.php @@ -461,7 +461,7 @@ public function captcha_path($file = NULL, $module = NULL, $absolute = NULL) * @access public * @param string asset file name including extension - * @param string subfolder to asset file (e.g. images, js, css... etc) + * @param string subfolder to asset file (e.g. images, js, css... etc). Subfolder must be defined as key in `$config['assets_folders']` application/config/assets.php * @param string module folder if any * @param boolean whether to include http://... at beginning * @return string @@ -1660,4 +1660,4 @@ protected function _get_assets_config() } /* End of file Asset.php */ -/* Location: ./modules/fuel/libraries/Asset.php */ \ No newline at end of file +/* Location: ./modules/fuel/libraries/Asset.php */ From 1495b3889e969efb35332229fee2997da9ec63a9 Mon Sep 17 00:00:00 2001 From: Marcus Date: Fri, 11 Sep 2020 15:57:45 +0200 Subject: [PATCH 05/13] Add information on using select2 and inline_edit together --- fuel/modules/fuel/views/_docs/general/forms.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fuel/modules/fuel/views/_docs/general/forms.php b/fuel/modules/fuel/views/_docs/general/forms.php index 414868add..bbc108487 100644 --- a/fuel/modules/fuel/views/_docs/general/forms.php +++ b/fuel/modules/fuel/views/_docs/general/forms.php @@ -906,8 +906,8 @@ function my_custom_field($params)

inline_edit

-

This field type is used for associating a separate module's data with your own. - The following additional parameters can be passed to this field type:

+

This field type is used for associating a separate module's data with your own. It also works with the field type select2.

+

The following additional parameters can be passed to this field type:

  • module: the module to inline edit
  • module_uri: the URI path to the module if it's different then the module name (e.g. my_module/inline_create/field1:field2)
  • @@ -1194,7 +1194,7 @@ function my_custom_field($params)

    select2

    -

    This field type can be used with any select field and transforms it into a searchable list using the Select2 plugin.

    +

    This field type can be used with any select field, including the field type inline_edit, and transforms it into a searchable list using the Select2 plugin.

    • width: the width of the field. The default is 225px
    From 980a2d0290745d3f228012176c3ec02bfef264d4 Mon Sep 17 00:00:00 2001 From: Marcus Date: Fri, 11 Sep 2020 20:58:38 +0200 Subject: [PATCH 06/13] Multiple Fieldsets of Type `Tab` per Form Groups fieldset tabs as they appear in a form. Needs plain fielsets `'k' => ['type' => 'fieldset', 'label' => 'Break out tabs'],` to break out of the tabs. Made it work without updating jquery and made it future proof. ``` // https://stackoverflow.com/a/17809461/814031 if(!$.fn.addBack){ $.fn.addBack = $.fn.andSelf; } ``` Description and proposal here: https://github.com/daylightstudio/FUEL-CMS/issues/569 --- .../js/fuel/controller/BaseFuelController.js | 79 ++++++++++++------- 1 file changed, 49 insertions(+), 30 deletions(-) diff --git a/fuel/modules/fuel/assets/js/fuel/controller/BaseFuelController.js b/fuel/modules/fuel/assets/js/fuel/controller/BaseFuelController.js index c84c977da..dda2e5320 100755 --- a/fuel/modules/fuel/assets/js/fuel/controller/BaseFuelController.js +++ b/fuel/modules/fuel/assets/js/fuel/controller/BaseFuelController.js @@ -579,41 +579,60 @@ fuel.controller.BaseFuelController = jqx.lib.BaseController.extend({ var tabId = 'tabs_' + jqx.config.uriPath.replace(/[\/|:]/g, '_').substr(5); // remove fuel_ var tabCookieSettings = {group: this.uiCookie, name: tabId, params: {path: jqx.config.cookieDefaultPath}} - var tabs = '
      '; - - // prevent nested fieldsets from showing up with not() - $legends = $('fieldset.tab legend', context).not('fieldset.tab fieldset legend', context); - $legends.each(function(i){ - if ($(this).parent().attr('id') != '') { - $(this).parent().attr('id', 'fieldset' + i).attr('data-index', i); + var tabs = ''; + + // Group + $fieldsets = $('fieldset.tab', context).not('fieldset.tab fieldset', context); + + $fieldsets.each(function() { + if ( ! $(this).closest('.fieldset-grouped').length){ + // addBack is available since jquery 1.8 + if(!$.fn.addBack){ + $.fn.addBack = $.fn.andSelf; + } + $(this).nextUntil('fieldset:not([class])').addBack().wrapAll("
      "); } - var id = ($(this).parent().attr('id')); - var text = $(this).text(); - tabs += '
    • ' + text + '
    • '; }); - $legends.hide(); - tabs += '
    '; - var startIndex = parseInt($.supercookie(tabCookieSettings.group, tabCookieSettings.name)); - if (!startIndex) startIndex = 0; - tabs += ''; - $legends.filter(':first').parent().before(tabs); + $('.fieldset-grouped').each(function(idx,context){ - $('#form').trigger('fuel_form_tabs_loaded', [$('#fuel_form_tabs')] ); + tabs = '
      ' - $tabs = $('#fuel_form_tabs ul', context); - $tabs.simpleTab({cookie: tabCookieSettings}); - - var tabCallback = function(e, index, selected, content, settings){ - $('#__fuel_selected_tab__').val(index); - } - $tabs.bind('tabClicked', tabCallback); + // prevent nested fieldsets from showing up with not() + $legends = $('fieldset.tab legend', context).not('fieldset.tab fieldset legend', context); + $legends.each(function(i){ + if ($(this).parent().attr('id') != '') { + $(this).parent().attr('id', 'fieldset' + i + '_' + idx).attr('data-index', i + '_' + idx); + } + var id = ($(this).parent().attr('id')); + var text = $(this).text(); + tabs += '
    • ' + text + '
    • '; + }); + $legends.hide(); + tabs += '
    '; - // check if there are any errors and highlight them - $legends.parent().find('.error_highlight').each(function(i){ - var fieldsetIndex = $(this).closest('fieldset').data('index'); - $('#fueltab' + fieldsetIndex).addClass('taberror'); - }) + var startIndex = parseInt($.supercookie(tabCookieSettings.group, tabCookieSettings.name)); + if (!startIndex) startIndex = 0; + tabs += ''; + $legends.filter(':first').parent().before(tabs); + + $('#form').trigger('fuel_form_tabs_loaded', [$('#fuel_form_tabs_' + idx)] ); + + $tabs = $('.form_tabs ul', context); + $tabs.simpleTab({cookie: tabCookieSettings}); + + var tabCallback = function(e, index, selected, content, settings){ + $('#__fuel_selected_tab__').val(index); + } + $tabs.bind('tabClicked', tabCallback); + + // check if there are any errors and highlight them + $legends.parent().find('.error_highlight').each(function(i){ + var fieldsetIndex = $(this).closest('fieldset').data('index'); + $('#fueltab' + fieldsetIndex).addClass('taberror'); + }) + + }); } }, @@ -845,4 +864,4 @@ fuel.controller.BaseFuelController = jqx.lib.BaseController.extend({ } -}); \ No newline at end of file +}); From b0ea5cdeab3a9caf36be3654ae871e7fa389a857 Mon Sep 17 00:00:00 2001 From: Marcus Date: Fri, 11 Sep 2020 21:07:29 +0200 Subject: [PATCH 07/13] Move check for method out of the loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🙄 --- .../assets/js/fuel/controller/BaseFuelController.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fuel/modules/fuel/assets/js/fuel/controller/BaseFuelController.js b/fuel/modules/fuel/assets/js/fuel/controller/BaseFuelController.js index dda2e5320..80e55fc74 100755 --- a/fuel/modules/fuel/assets/js/fuel/controller/BaseFuelController.js +++ b/fuel/modules/fuel/assets/js/fuel/controller/BaseFuelController.js @@ -584,12 +584,14 @@ fuel.controller.BaseFuelController = jqx.lib.BaseController.extend({ // Group $fieldsets = $('fieldset.tab', context).not('fieldset.tab fieldset', context); + // addBack() is available since jquery 1.8 + if(!$.fn.addBack){ + $.fn.addBack = $.fn.andSelf; + } + $fieldsets.each(function() { if ( ! $(this).closest('.fieldset-grouped').length){ - // addBack is available since jquery 1.8 - if(!$.fn.addBack){ - $.fn.addBack = $.fn.andSelf; - } + $(this).nextUntil('fieldset:not([class])').addBack().wrapAll("
    "); } }); From 25cedcb632aebaa0efb335a8654aca3a39354c04 Mon Sep 17 00:00:00 2001 From: David McReynolds Date: Tue, 15 Sep 2020 09:39:23 -0700 Subject: [PATCH 08/13] fix: issue with block layout and no url length --- fuel/modules/fuel/assets/js/fuel/custom_fields.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fuel/modules/fuel/assets/js/fuel/custom_fields.js b/fuel/modules/fuel/assets/js/fuel/custom_fields.js index cb2701b39..5884ca06d 100644 --- a/fuel/modules/fuel/assets/js/fuel/custom_fields.js +++ b/fuel/modules/fuel/assets/js/fuel/custom_fields.js @@ -1281,11 +1281,11 @@ if (typeof(window.fuel.fields) == 'undefined'){ // context = contextArr.pop(); // } + $layout_fields = $this.next('.block_layout_fields'); + if (url.length){ url += '?context=' + context + '&name=' + name + '&t=' + new Date().getTime(); - $layout_fields = $this.next('.block_layout_fields'); - // show loader $this.parent().find('.loader').show(); $('#form').data('disabled', true); From f200f10bac0d9ccd9e002b7c6da8cbe73f2f4ff0 Mon Sep 17 00:00:00 2001 From: Marcus Date: Tue, 22 Sep 2020 20:21:31 +0200 Subject: [PATCH 09/13] Save Tab Index by Tabs Group in Cookie It's a bit of a hack to do it this way, but I can't see another way, without changing the simpleTabs.js. A better way would be to either define "groups" in the fieldset[1] or add fields to a tab. But that needs more changes in the Formbuilder Class etc. ``` 'x' => ['type' => 'fieldset', 'class' => 'tab', 'label' => 'x'], // all the fields that go into tab x 'y' => ['type' => 'fieldset', 'class' => 'tab', 'label' => 'y'], // all the fields that go into tab y // Now break out of the fieldset 'Break_out_0' => ['type' => 'fieldset', 'tag' => 'h3', 'label' => 'Break Out'], // and now continue if you want to have another set of tabs 'a' => ['type' => 'fieldset', 'class' => 'tab', 'label' => 'a'], // all the fields that go into tab a 'b' => ['type' => 'fieldset', 'class' => 'tab', 'label' => 'b'], // all the fields that go into tab b 'c' => ['type' => 'fieldset', 'class' => 'tab', 'label' => 'c'], // all the fields that go into tab c // break out again 'Break_out_1' => ['type' => 'fieldset', 'tag' => 'h3', 'label' => 'Break Out'], // more fields ``` [1] unfortunately `data => ["group" => 'tabset_1']` doesn't work, that way we could would not need the first `'Break_out_0'` --- .../js/fuel/controller/BaseFuelController.js | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/fuel/modules/fuel/assets/js/fuel/controller/BaseFuelController.js b/fuel/modules/fuel/assets/js/fuel/controller/BaseFuelController.js index 80e55fc74..8ea610fcf 100755 --- a/fuel/modules/fuel/assets/js/fuel/controller/BaseFuelController.js +++ b/fuel/modules/fuel/assets/js/fuel/controller/BaseFuelController.js @@ -574,10 +574,11 @@ fuel.controller.BaseFuelController = jqx.lib.BaseController.extend({ }, _initFormTabs : function(context){ - if (!$('#fuel_form_tabs', context).length){ + if (!$('#fuel_form_tabs', context).length) { var tabId = 'tabs_' + jqx.config.uriPath.replace(/[\/|:]/g, '_').substr(5); // remove fuel_ - var tabCookieSettings = {group: this.uiCookie, name: tabId, params: {path: jqx.config.cookieDefaultPath}} + var tabCookieSettings; + var uiCookie = this.uiCookie; var tabs = ''; @@ -588,7 +589,7 @@ fuel.controller.BaseFuelController = jqx.lib.BaseController.extend({ if(!$.fn.addBack){ $.fn.addBack = $.fn.andSelf; } - + $fieldsets.each(function() { if ( ! $(this).closest('.fieldset-grouped').length){ @@ -598,6 +599,10 @@ fuel.controller.BaseFuelController = jqx.lib.BaseController.extend({ $('.fieldset-grouped').each(function(idx,context){ + tabId += '_' + idx; + + tabCookieSettings = {group: uiCookie, name: tabId, params: {path: jqx.config.cookieDefaultPath}} + tabs = '
      ' // prevent nested fieldsets from showing up with not() @@ -614,17 +619,20 @@ fuel.controller.BaseFuelController = jqx.lib.BaseController.extend({ tabs += '
    '; var startIndex = parseInt($.supercookie(tabCookieSettings.group, tabCookieSettings.name)); + + var __fuel_selected_tab__ = "__fuel_selected_tab__"+idx; + if (!startIndex) startIndex = 0; - tabs += ''; + tabs += ''; $legends.filter(':first').parent().before(tabs); $('#form').trigger('fuel_form_tabs_loaded', [$('#fuel_form_tabs_' + idx)] ); - $tabs = $('.form_tabs ul', context); + $tabs = $('#fuel_form_tabs_' + idx + ' ul', context); $tabs.simpleTab({cookie: tabCookieSettings}); var tabCallback = function(e, index, selected, content, settings){ - $('#__fuel_selected_tab__').val(index); + $('#'+__fuel_selected_tab__).val(index); } $tabs.bind('tabClicked', tabCallback); From af63a234798d0670ad918b021ce1f51680840311 Mon Sep 17 00:00:00 2001 From: David McReynolds Date: Wed, 23 Sep 2020 08:03:29 -0700 Subject: [PATCH 10/13] fix: issue #574 --- fuel/modules/fuel/views/_blocks/nav.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuel/modules/fuel/views/_blocks/nav.php b/fuel/modules/fuel/views/_blocks/nav.php index bc863495e..206552d9b 100644 --- a/fuel/modules/fuel/views/_blocks/nav.php +++ b/fuel/modules/fuel/views/_blocks/nav.php @@ -88,7 +88,7 @@

      -
    • +
    From 25ff3ddc72577cc94324e381b71948a35eb8e22b Mon Sep 17 00:00:00 2001 From: David McReynolds Date: Wed, 23 Sep 2020 08:12:33 -0700 Subject: [PATCH 11/13] fix: issue #575 --- fuel/modules/fuel/models/Fuel_permissions_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuel/modules/fuel/models/Fuel_permissions_model.php b/fuel/modules/fuel/models/Fuel_permissions_model.php index 6a7f5898d..5c0590b1e 100644 --- a/fuel/modules/fuel/models/Fuel_permissions_model.php +++ b/fuel/modules/fuel/models/Fuel_permissions_model.php @@ -180,7 +180,7 @@ public function related_items($values = array()) if (!empty($values['name'])) { $name = current(explode('/', $values['name'])); - $this->db->where('(name LIKE "'.$name.'/%" OR name ="'.$name.'") AND name != "'.$values['name'].'"'); + $this->db->where('(name LIKE "'.$this->db->escape($name).'/%" OR name ="'.$this->db->escape($name).'") AND name != "'.$this->db->escape($values['name']).'"'); $related_items = $this->find_all_array_assoc('id'); if (!empty($related_items)) { From 338de3884c1f9b382a7bc0484353ec6d92ff3098 Mon Sep 17 00:00:00 2001 From: David McReynolds Date: Wed, 23 Sep 2020 08:26:02 -0700 Subject: [PATCH 12/13] fix: CI 3.1.11 update --- fuel/application/config/foreign_chars.php | 23 +++-- fuel/application/config/mimes.php | 2 +- fuel/application/config/user_agents.php | 1 + fuel/{ => codeigniter}/contributing.md | 18 ++-- fuel/codeigniter/core/CodeIgniter.php | 2 +- fuel/codeigniter/core/Controller.php | 7 ++ fuel/codeigniter/core/Log.php | 4 +- fuel/codeigniter/core/Security.php | 1 + fuel/codeigniter/database/DB_result.php | 2 +- .../database/drivers/mysql/mysql_driver.php | 2 +- .../database/drivers/mysqli/mysqli_driver.php | 2 +- .../database/drivers/oci8/oci8_forge.php | 7 ++ .../database/drivers/pdo/pdo_result.php | 2 +- .../pdo/subdrivers/pdo_firebird_forge.php | 2 +- .../pdo/subdrivers/pdo_mysql_driver.php | 2 +- .../drivers/pdo/subdrivers/pdo_oci_forge.php | 7 ++ .../pdo/subdrivers/pdo_pgsql_driver.php | 2 +- .../pdo/subdrivers/pdo_pgsql_forge.php | 2 +- .../drivers/postgre/postgre_forge.php | 2 +- .../libraries/Cache/drivers/Cache_redis.php | 32 +++---- .../codeigniter/libraries/Form_validation.php | 7 ++ .../libraries/Session/Session_driver.php | 21 ----- .../drivers/Session_database_driver.php | 85 +++++++++--------- .../Session/drivers/Session_files_driver.php | 6 +- .../drivers/Session_memcached_driver.php | 20 ++--- .../Session/drivers/Session_redis_driver.php | 88 ++++++++++++++----- fuel/codeigniter/license.txt | 21 +++++ fuel/codeigniter/readme.rst | 70 +++++++++++++++ 28 files changed, 297 insertions(+), 143 deletions(-) rename fuel/{ => codeigniter}/contributing.md (89%) create mode 100755 fuel/codeigniter/license.txt create mode 100755 fuel/codeigniter/readme.rst diff --git a/fuel/application/config/foreign_chars.php b/fuel/application/config/foreign_chars.php index 995f48304..0231f3592 100755 --- a/fuel/application/config/foreign_chars.php +++ b/fuel/application/config/foreign_chars.php @@ -22,10 +22,10 @@ '/б/' => 'b', '/Ç|Ć|Ĉ|Ċ|Č/' => 'C', '/ç|ć|ĉ|ċ|č/' => 'c', - '/Д/' => 'D', - '/д/' => 'd', - '/Ð|Ď|Đ|Δ/' => 'Dj', - '/ð|ď|đ|δ/' => 'dj', + '/Д|Δ/' => 'D', + '/д|δ/' => 'd', + '/Ð|Ď|Đ/' => 'Dj', + '/ð|ď|đ/' => 'dj', '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E', '/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e', '/Ф/' => 'F', @@ -38,6 +38,8 @@ '/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i', '/Ĵ/' => 'J', '/ĵ/' => 'j', + '/Θ/' => 'TH', + '/θ/' => 'th', '/Ķ|Κ|К/' => 'K', '/ķ|κ|к/' => 'k', '/Ĺ|Ļ|Ľ|Ŀ|Ł|Λ|Л/' => 'L', @@ -54,8 +56,8 @@ '/ŕ|ŗ|ř|ρ|р/' => 'r', '/Ś|Ŝ|Ş|Ș|Š|Σ|С/' => 'S', '/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's', - '/Ț|Ţ|Ť|Ŧ|τ|Т/' => 'T', - '/ț|ţ|ť|ŧ|т/' => 't', + '/Ț|Ţ|Ť|Ŧ|Τ|Т/' => 'T', + '/ț|ţ|ť|ŧ|τ|т/' => 't', '/Þ|þ/' => 'th', '/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U', '/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u', @@ -65,6 +67,10 @@ '/в/' => 'v', '/Ŵ/' => 'W', '/ŵ/' => 'w', + '/Φ/' => 'F', + '/φ/' => 'f', + '/Χ/' => 'CH', + '/χ/' => 'ch', '/Ź|Ż|Ž|Ζ|З/' => 'Z', '/ź|ż|ž|ζ|з/' => 'z', '/Æ|Ǽ/' => 'AE', @@ -73,10 +79,15 @@ '/ij/' => 'ij', '/Œ/' => 'OE', '/ƒ/' => 'f', + '/Ξ/' => 'KS', '/ξ/' => 'ks', + '/Π/' => 'P', '/π/' => 'p', + '/Β/' => 'V', '/β/' => 'v', + '/Μ/' => 'M', '/μ/' => 'm', + '/Ψ/' => 'PS', '/ψ/' => 'ps', '/Ё/' => 'Yo', '/ё/' => 'yo', diff --git a/fuel/application/config/mimes.php b/fuel/application/config/mimes.php index c450cf0ee..96192e992 100755 --- a/fuel/application/config/mimes.php +++ b/fuel/application/config/mimes.php @@ -140,7 +140,7 @@ 'f4v' => array('video/mp4', 'video/x-f4v'), 'flv' => 'video/x-flv', 'webm' => 'video/webm', - 'aac' => 'audio/x-acc', + 'aac' => array('audio/x-aac', 'audio/aac'), 'm4u' => 'application/vnd.mpegurl', 'm3u' => 'text/plain', 'xspf' => 'application/xspf+xml', diff --git a/fuel/application/config/user_agents.php b/fuel/application/config/user_agents.php index ad0b0fd20..c1581e5cd 100755 --- a/fuel/application/config/user_agents.php +++ b/fuel/application/config/user_agents.php @@ -151,6 +151,7 @@ 'wii' => 'Nintendo Wii', 'open web' => 'Open Web', 'openweb' => 'OpenWeb', + 'meizu' => 'Meizu', // Operating Systems 'android' => 'Android', diff --git a/fuel/contributing.md b/fuel/codeigniter/contributing.md similarity index 89% rename from fuel/contributing.md rename to fuel/codeigniter/contributing.md index 8edb510cf..703fe8f44 100755 --- a/fuel/contributing.md +++ b/fuel/codeigniter/contributing.md @@ -1,6 +1,5 @@ # Contributing to CodeIgniter - CodeIgniter is a community driven project and accepts contributions of code and documentation from the community. These contributions are made in the form of Issues or [Pull Requests](http://help.github.com/send-pull-requests/) on the [CodeIgniter repository](https://github.com/bcit-ci/CodeIgniter) on GitHub. Issues are a quick way to point out a bug. If you find a bug or documentation error in CodeIgniter then please check a few things first: @@ -59,7 +58,6 @@ If you are using [Tower](http://www.git-tower.com/) there is a "Sign-Off" checkb By signing your work in this manner, you certify to a "Developer's Certificate of Origin". The current version of this certificate is in the `DCO.txt` file in the root of this repository. - ## How-to Guide There are two ways to make changes, the easy way and the hard way. Either way you will need to [create a GitHub account](https://github.com/signup/free). @@ -68,15 +66,15 @@ Easy way GitHub allows in-line editing of files for making simple typo changes a Hard way The best way to contribute is to "clone" your fork of CodeIgniter to your development area. That sounds like some jargon, but "forking" on GitHub means "making a copy of that repo to your account" and "cloning" means "copying that code to your environment so you can work on it". -1. Set up Git (Windows, Mac & Linux) -2. Go to the CodeIgniter repo -3. Fork it -4. Clone your CodeIgniter repo: git@github.com:/CodeIgniter.git -5. Checkout the "develop" branch At this point you are ready to start making changes. +1. [Set up Git](https://help.github.com/en/articles/set-up-git) (Windows, Mac & Linux) +2. Go to the [CodeIgniter repo](https://github.com/bcit-ci/CodeIgniter) +3. [Fork it](https://help.github.com/en/articles/fork-a-repo) +4. [Clone](https://help.github.com/en/articles/fetching-a-remote#clone) your forked CodeIgniter repo: git@github.com:/CodeIgniter.git. +5. Checkout the "develop" branch. At this point you are ready to start making changes. 6. Fix existing bugs on the Issue tracker after taking a look to see nobody else is working on them. -7. Commit the files -8. Push your develop branch to your fork -9. Send a pull request [http://help.github.com/send-pull-requests/](http://help.github.com/send-pull-requests/) +7. [Commit](https://help.github.com/en/articles/adding-a-file-to-a-repository-using-the-command-line) the files +8. [Push](https://help.github.com/en/articles/pushing-to-a-remote) your develop branch to your fork +9. [Send a pull request](https://help.github.com/en/articles/creating-a-pull-request) The Reactor Engineers will now be alerted about the change and at least one of the team will respond. If your change fails to meet the guidelines it will be bounced, or feedback will be provided to help you improve it. diff --git a/fuel/codeigniter/core/CodeIgniter.php b/fuel/codeigniter/core/CodeIgniter.php index 56826f1a6..8aecc0a27 100755 --- a/fuel/codeigniter/core/CodeIgniter.php +++ b/fuel/codeigniter/core/CodeIgniter.php @@ -55,7 +55,7 @@ * @var string * */ - const CI_VERSION = '3.1.10'; + const CI_VERSION = '3.1.11'; /* * ------------------------------------------------------ diff --git a/fuel/codeigniter/core/Controller.php b/fuel/codeigniter/core/Controller.php index 2bb157802..e25b8472c 100755 --- a/fuel/codeigniter/core/Controller.php +++ b/fuel/codeigniter/core/Controller.php @@ -58,6 +58,13 @@ class CI_Controller { */ private static $instance; + /** + * CI_Loader + * + * @var CI_Loader + */ + public $load; + /** * Class constructor * diff --git a/fuel/codeigniter/core/Log.php b/fuel/codeigniter/core/Log.php index 4338aa939..f37726e02 100755 --- a/fuel/codeigniter/core/Log.php +++ b/fuel/codeigniter/core/Log.php @@ -247,11 +247,11 @@ public function write_log($level, $msg) * @param string $level The error level * @param string $date Formatted date string * @param string $message The log message - * @return string Formatted log line with a new line character '\n' at the end + * @return string Formatted log line with a new line character at the end */ protected function _format_line($level, $date, $message) { - return $level.' - '.$date.' --> '.$message."\n"; + return $level.' - '.$date.' --> '.$message.PHP_EOL; } // -------------------------------------------------------------------- diff --git a/fuel/codeigniter/core/Security.php b/fuel/codeigniter/core/Security.php index 883968e26..6a81faff1 100755 --- a/fuel/codeigniter/core/Security.php +++ b/fuel/codeigniter/core/Security.php @@ -228,6 +228,7 @@ public function csrf_verify() // Check CSRF token validity, but don't error on mismatch just yet - we'll want to regenerate $valid = isset($_POST[$this->_csrf_token_name], $_COOKIE[$this->_csrf_cookie_name]) + && is_string($_POST[$this->_csrf_token_name]) && is_string($_COOKIE[$this->_csrf_cookie_name]) && hash_equals($_POST[$this->_csrf_token_name], $_COOKIE[$this->_csrf_cookie_name]); // We kill this since we're done and we don't want to pollute the _POST array diff --git a/fuel/codeigniter/database/DB_result.php b/fuel/codeigniter/database/DB_result.php index 0dbac1633..ed5252d49 100755 --- a/fuel/codeigniter/database/DB_result.php +++ b/fuel/codeigniter/database/DB_result.php @@ -381,7 +381,7 @@ public function set_row($key, $value = NULL) */ public function custom_row_object($n, $type) { - isset($this->custom_result_object[$type]) OR $this->custom_result_object($type); + isset($this->custom_result_object[$type]) OR $this->custom_result_object[$type] = $this->custom_result_object($type); if (count($this->custom_result_object[$type]) === 0) { diff --git a/fuel/codeigniter/database/drivers/mysql/mysql_driver.php b/fuel/codeigniter/database/drivers/mysql/mysql_driver.php index 78e77bc18..440715ae1 100755 --- a/fuel/codeigniter/database/drivers/mysql/mysql_driver.php +++ b/fuel/codeigniter/database/drivers/mysql/mysql_driver.php @@ -383,7 +383,7 @@ public function insert_id() */ protected function _list_tables($prefix_limit = FALSE) { - $sql = 'SHOW TABLES FROM '.$this->escape_identifiers($this->database); + $sql = 'SHOW TABLES FROM '.$this->_escape_char.$this->database.$this->_escape_char; if ($prefix_limit !== FALSE && $this->dbprefix !== '') { diff --git a/fuel/codeigniter/database/drivers/mysqli/mysqli_driver.php b/fuel/codeigniter/database/drivers/mysqli/mysqli_driver.php index d374e0174..0ca0f48fc 100755 --- a/fuel/codeigniter/database/drivers/mysqli/mysqli_driver.php +++ b/fuel/codeigniter/database/drivers/mysqli/mysqli_driver.php @@ -429,7 +429,7 @@ public function insert_id() */ protected function _list_tables($prefix_limit = FALSE) { - $sql = 'SHOW TABLES FROM '.$this->escape_identifiers($this->database); + $sql = 'SHOW TABLES FROM '.$this->_escape_char.$this->database.$this->_escape_char; if ($prefix_limit !== FALSE && $this->dbprefix !== '') { diff --git a/fuel/codeigniter/database/drivers/oci8/oci8_forge.php b/fuel/codeigniter/database/drivers/oci8/oci8_forge.php index 20217f2b8..58f3c3913 100755 --- a/fuel/codeigniter/database/drivers/oci8/oci8_forge.php +++ b/fuel/codeigniter/database/drivers/oci8/oci8_forge.php @@ -81,6 +81,13 @@ class CI_DB_oci8_forge extends CI_DB_forge { */ protected $_unsigned = FALSE; + /** + * NULL value representation in CREATE/ALTER TABLE statements + * + * @var string + */ + protected $_null = 'NULL'; + // -------------------------------------------------------------------- /** diff --git a/fuel/codeigniter/database/drivers/pdo/pdo_result.php b/fuel/codeigniter/database/drivers/pdo/pdo_result.php index 03c0f9f9d..b3973da46 100755 --- a/fuel/codeigniter/database/drivers/pdo/pdo_result.php +++ b/fuel/codeigniter/database/drivers/pdo/pdo_result.php @@ -133,7 +133,7 @@ public function field_data() $retval[$i] = new stdClass(); $retval[$i]->name = $field['name']; - $retval[$i]->type = $field['native_type']; + $retval[$i]->type = isset($field['native_type']) ? $field['native_type'] : null; $retval[$i]->max_length = ($field['len'] > 0) ? $field['len'] : NULL; $retval[$i]->primary_key = (int) ( ! empty($field['flags']) && in_array('primary_key', $field['flags'], TRUE)); } diff --git a/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_firebird_forge.php b/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_firebird_forge.php index 54752f153..eceb59796 100755 --- a/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_firebird_forge.php +++ b/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_firebird_forge.php @@ -150,7 +150,7 @@ protected function _alter_table($alter_type, $table, $field) if ( ! empty($field[$i]['default'])) { $sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name']) - .' SET DEFAULT '.$field[$i]['default']; + .' SET '.$field[$i]['default']; } if (isset($field[$i]['null'])) diff --git a/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_mysql_driver.php b/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_mysql_driver.php index 26bc30e14..73b88bcfd 100755 --- a/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_mysql_driver.php +++ b/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_mysql_driver.php @@ -279,7 +279,7 @@ protected function _trans_rollback() */ protected function _list_tables($prefix_limit = FALSE) { - $sql = 'SHOW TABLES'; + $sql = 'SHOW TABLES FROM '.$this->_escape_char.$this->database.$this->_escape_char; if ($prefix_limit === TRUE && $this->dbprefix !== '') { diff --git a/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_oci_forge.php b/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_oci_forge.php index 0abda5930..b5d3eb143 100755 --- a/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_oci_forge.php +++ b/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_oci_forge.php @@ -74,6 +74,13 @@ class CI_DB_pdo_oci_forge extends CI_DB_pdo_forge { */ protected $_unsigned = FALSE; + /** + * NULL value representation in CREATE/ALTER TABLE statements + * + * @var string + */ + protected $_null = 'NULL'; + // -------------------------------------------------------------------- /** diff --git a/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php b/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php index b05d473ee..2d0c74b2e 100755 --- a/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php +++ b/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php @@ -98,7 +98,7 @@ public function __construct($params) if ( ! empty($this->username)) { - $this->dsn .= ';username='.$this->username; + $this->dsn .= ';user='.$this->username; empty($this->password) OR $this->dsn .= ';password='.$this->password; } } diff --git a/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php b/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php index ff7a11075..a4ccff407 100755 --- a/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php +++ b/fuel/codeigniter/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php @@ -130,7 +130,7 @@ protected function _alter_table($alter_type, $table, $field) if ( ! empty($field[$i]['default'])) { $sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name']) - .' SET DEFAULT '.$field[$i]['default']; + .' SET '.$field[$i]['default']; } if (isset($field[$i]['null'])) diff --git a/fuel/codeigniter/database/drivers/postgre/postgre_forge.php b/fuel/codeigniter/database/drivers/postgre/postgre_forge.php index 353ddac99..481e222b8 100755 --- a/fuel/codeigniter/database/drivers/postgre/postgre_forge.php +++ b/fuel/codeigniter/database/drivers/postgre/postgre_forge.php @@ -125,7 +125,7 @@ protected function _alter_table($alter_type, $table, $field) if ( ! empty($field[$i]['default'])) { $sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name']) - .' SET DEFAULT '.$field[$i]['default']; + .' SET '.$field[$i]['default']; } if (isset($field[$i]['null'])) diff --git a/fuel/codeigniter/libraries/Cache/drivers/Cache_redis.php b/fuel/codeigniter/libraries/Cache/drivers/Cache_redis.php index 37596189a..bff96fbfb 100755 --- a/fuel/codeigniter/libraries/Cache/drivers/Cache_redis.php +++ b/fuel/codeigniter/libraries/Cache/drivers/Cache_redis.php @@ -76,6 +76,13 @@ class CI_Cache_redis extends CI_Driver */ protected $_serialized = array(); + /** + * del()/delete() method name depending on phpRedis version + * + * @var string + */ + protected static $_delete_name; + // ------------------------------------------------------------------------ /** @@ -97,6 +104,10 @@ public function __construct() return; } + isset(static::$_delete_name) OR static::$_delete_name = version_compare(phpversion('phpredis'), '5', '>=') + ? 'del' + : 'delete'; + $CI =& get_instance(); if ($CI->config->load('redis', TRUE, TRUE)) @@ -135,10 +146,6 @@ public function __construct() { log_message('error', 'Cache: Redis connection refused ('.$e->getMessage().')'); } - - // Initialize the index of serialized values. - $serialized = $this->_redis->sMembers('_ci_redis_serialized'); - empty($serialized) OR $this->_serialized = array_flip($serialized); } // ------------------------------------------------------------------------ @@ -153,7 +160,7 @@ public function get($key) { $value = $this->_redis->get($key); - if ($value !== FALSE && isset($this->_serialized[$key])) + if ($value !== FALSE && $this->_redis->sIsMember('_ci_redis_serialized', $key)) { return unserialize($value); } @@ -184,9 +191,8 @@ public function save($id, $data, $ttl = 60, $raw = FALSE) isset($this->_serialized[$id]) OR $this->_serialized[$id] = TRUE; $data = serialize($data); } - elseif (isset($this->_serialized[$id])) + else { - $this->_serialized[$id] = NULL; $this->_redis->sRemove('_ci_redis_serialized', $id); } @@ -203,16 +209,12 @@ public function save($id, $data, $ttl = 60, $raw = FALSE) */ public function delete($key) { - if ($this->_redis->delete($key) !== 1) + if ($this->_redis->{static::$_delete_name}($key) !== 1) { return FALSE; } - if (isset($this->_serialized[$key])) - { - $this->_serialized[$key] = NULL; - $this->_redis->sRemove('_ci_redis_serialized', $key); - } + $this->_redis->sRemove('_ci_redis_serialized', $key); return TRUE; } @@ -228,7 +230,7 @@ public function delete($key) */ public function increment($id, $offset = 1) { - return $this->_redis->incr($id, $offset); + return $this->_redis->incrBy($id, $offset); } // ------------------------------------------------------------------------ @@ -242,7 +244,7 @@ public function increment($id, $offset = 1) */ public function decrement($id, $offset = 1) { - return $this->_redis->decr($id, $offset); + return $this->_redis->decrBy($id, $offset); } // ------------------------------------------------------------------------ diff --git a/fuel/codeigniter/libraries/Form_validation.php b/fuel/codeigniter/libraries/Form_validation.php index 1bd55499a..fdf202010 100755 --- a/fuel/codeigniter/libraries/Form_validation.php +++ b/fuel/codeigniter/libraries/Form_validation.php @@ -1208,6 +1208,13 @@ public function valid_url($str) $str = $matches[2]; } + // Apparently, FILTER_VALIDATE_URL doesn't reject digit-only names for some reason ... + // See https://github.com/bcit-ci/CodeIgniter/issues/5755 + if (ctype_digit($str)) + { + return FALSE; + } + // PHP 7 accepts IPv6 addresses within square brackets as hostnames, // but it appears that the PR that came in with https://bugs.php.net/bug.php?id=68039 // was never merged into a PHP 5 branch ... https://3v4l.org/8PsSN diff --git a/fuel/codeigniter/libraries/Session/Session_driver.php b/fuel/codeigniter/libraries/Session/Session_driver.php index 14ebdb09f..dbc833739 100755 --- a/fuel/codeigniter/libraries/Session/Session_driver.php +++ b/fuel/codeigniter/libraries/Session/Session_driver.php @@ -184,25 +184,4 @@ protected function _release_lock() return TRUE; } - - // ------------------------------------------------------------------------ - - /** - * Fail - * - * Drivers other than the 'files' one don't (need to) use the - * session.save_path INI setting, but that leads to confusing - * error messages emitted by PHP when open() or write() fail, - * as the message contains session.save_path ... - * To work around the problem, the drivers will call this method - * so that the INI is set just in time for the error message to - * be properly generated. - * - * @return mixed - */ - protected function _fail() - { - ini_set('session.save_path', config_item('sess_save_path')); - return $this->_failure; - } } diff --git a/fuel/codeigniter/libraries/Session/drivers/Session_database_driver.php b/fuel/codeigniter/libraries/Session/drivers/Session_database_driver.php index 734fe624f..89afe3455 100755 --- a/fuel/codeigniter/libraries/Session/drivers/Session_database_driver.php +++ b/fuel/codeigniter/libraries/Session/drivers/Session_database_driver.php @@ -130,7 +130,7 @@ public function open($save_path, $name) { if (empty($this->_db->conn_id) && ! $this->_db->db_connect()) { - return $this->_fail(); + return $this->_failure; } $this->php5_validate_id(); @@ -150,48 +150,47 @@ public function open($save_path, $name) */ public function read($session_id) { - if ($this->_get_lock($session_id) !== FALSE) + if ($this->_get_lock($session_id) === FALSE) { - // Prevent previous QB calls from messing with our queries - $this->_db->reset_query(); - - // Needed by write() to detect session_regenerate_id() calls - $this->_session_id = $session_id; + return $this->_failure; + } - $this->_db - ->select('data') - ->from($this->_config['save_path']) - ->where('id', $session_id); + // Prevent previous QB calls from messing with our queries + $this->_db->reset_query(); - if ($this->_config['match_ip']) - { - $this->_db->where('ip_address', $_SERVER['REMOTE_ADDR']); - } + // Needed by write() to detect session_regenerate_id() calls + $this->_session_id = $session_id; - if ( ! ($result = $this->_db->get()) OR ($result = $result->row()) === NULL) - { - // PHP7 will reuse the same SessionHandler object after - // ID regeneration, so we need to explicitly set this to - // FALSE instead of relying on the default ... - $this->_row_exists = FALSE; - $this->_fingerprint = md5(''); - return ''; - } + $this->_db + ->select('data') + ->from($this->_config['save_path']) + ->where('id', $session_id); - // PostgreSQL's variant of a BLOB datatype is Bytea, which is a - // PITA to work with, so we use base64-encoded data in a TEXT - // field instead. - $result = ($this->_platform === 'postgre') - ? base64_decode(rtrim($result->data)) - : $result->data; + if ($this->_config['match_ip']) + { + $this->_db->where('ip_address', $_SERVER['REMOTE_ADDR']); + } - $this->_fingerprint = md5($result); - $this->_row_exists = TRUE; - return $result; + if ( ! ($result = $this->_db->get()) OR ($result = $result->row()) === NULL) + { + // PHP7 will reuse the same SessionHandler object after + // ID regeneration, so we need to explicitly set this to + // FALSE instead of relying on the default ... + $this->_row_exists = FALSE; + $this->_fingerprint = md5(''); + return ''; } - $this->_fingerprint = md5(''); - return ''; + // PostgreSQL's variant of a BLOB datatype is Bytea, which is a + // PITA to work with, so we use base64-encoded data in a TEXT + // field instead. + $result = ($this->_platform === 'postgre') + ? base64_decode(rtrim($result->data)) + : $result->data; + + $this->_fingerprint = md5($result); + $this->_row_exists = TRUE; + return $result; } // ------------------------------------------------------------------------ @@ -215,7 +214,7 @@ public function write($session_id, $session_data) { if ( ! $this->_release_lock() OR ! $this->_get_lock($session_id)) { - return $this->_fail(); + return $this->_failure; } $this->_row_exists = FALSE; @@ -223,7 +222,7 @@ public function write($session_id, $session_data) } elseif ($this->_lock === FALSE) { - return $this->_fail(); + return $this->_failure; } if ($this->_row_exists === FALSE) @@ -242,7 +241,7 @@ public function write($session_id, $session_data) return $this->_success; } - return $this->_fail(); + return $this->_failure; } $this->_db->where('id', $session_id); @@ -265,7 +264,7 @@ public function write($session_id, $session_data) return $this->_success; } - return $this->_fail(); + return $this->_failure; } // ------------------------------------------------------------------------ @@ -280,7 +279,7 @@ public function write($session_id, $session_data) public function close() { return ($this->_lock && ! $this->_release_lock()) - ? $this->_fail() + ? $this->_failure : $this->_success; } @@ -309,7 +308,7 @@ public function destroy($session_id) if ( ! $this->_db->delete($this->_config['save_path'])) { - return $this->_fail(); + return $this->_failure; } } @@ -319,7 +318,7 @@ public function destroy($session_id) return $this->_success; } - return $this->_fail(); + return $this->_failure; } // ------------------------------------------------------------------------ @@ -339,7 +338,7 @@ public function gc($maxlifetime) return ($this->_db->delete($this->_config['save_path'], 'timestamp < '.(time() - $maxlifetime))) ? $this->_success - : $this->_fail(); + : $this->_failure; } // -------------------------------------------------------------------- diff --git a/fuel/codeigniter/libraries/Session/drivers/Session_files_driver.php b/fuel/codeigniter/libraries/Session/drivers/Session_files_driver.php index 467059434..2899b7dec 100755 --- a/fuel/codeigniter/libraries/Session/drivers/Session_files_driver.php +++ b/fuel/codeigniter/libraries/Session/drivers/Session_files_driver.php @@ -135,12 +135,14 @@ public function open($save_path, $name) { if ( ! mkdir($save_path, 0700, TRUE)) { - throw new Exception("Session: Configured save path '".$this->_config['save_path']."' is not a directory, doesn't exist or cannot be created."); + log_message('error', "Session: Configured save path '".$this->_config['save_path']."' is not a directory, doesn't exist or cannot be created."); + return $this->_failure; } } elseif ( ! is_writable($save_path)) { - throw new Exception("Session: Configured save path '".$this->_config['save_path']."' is not writable by the PHP process."); + log_message('error', "Session: Configured save path '".$this->_config['save_path']."' is not writable by the PHP process."); + return $this->_failure; } $this->_config['save_path'] = $save_path; diff --git a/fuel/codeigniter/libraries/Session/drivers/Session_memcached_driver.php b/fuel/codeigniter/libraries/Session/drivers/Session_memcached_driver.php index ab54f029f..854adf821 100755 --- a/fuel/codeigniter/libraries/Session/drivers/Session_memcached_driver.php +++ b/fuel/codeigniter/libraries/Session/drivers/Session_memcached_driver.php @@ -117,7 +117,7 @@ public function open($save_path, $name) { $this->_memcached = NULL; log_message('error', 'Session: Invalid Memcached save path format: '.$this->_config['save_path']); - return $this->_fail(); + return $this->_failure; } foreach ($matches as $match) @@ -142,7 +142,7 @@ public function open($save_path, $name) if (empty($server_list)) { log_message('error', 'Session: Memcached server pool is empty.'); - return $this->_fail(); + return $this->_failure; } $this->php5_validate_id(); @@ -172,7 +172,7 @@ public function read($session_id) return $session_data; } - return $this->_fail(); + return $this->_failure; } // ------------------------------------------------------------------------ @@ -190,14 +190,14 @@ public function write($session_id, $session_data) { if ( ! isset($this->_memcached, $this->_lock_key)) { - return $this->_fail(); + return $this->_failure; } // Was the ID regenerated? elseif ($session_id !== $this->_session_id) { if ( ! $this->_release_lock() OR ! $this->_get_lock($session_id)) { - return $this->_fail(); + return $this->_failure; } $this->_fingerprint = md5(''); @@ -215,7 +215,7 @@ public function write($session_id, $session_data) return $this->_success; } - return $this->_fail(); + return $this->_failure; } elseif ( $this->_memcached->touch($key, $this->_config['expiration']) @@ -225,7 +225,7 @@ public function write($session_id, $session_data) return $this->_success; } - return $this->_fail(); + return $this->_failure; } // ------------------------------------------------------------------------ @@ -244,14 +244,14 @@ public function close() $this->_release_lock(); if ( ! $this->_memcached->quit()) { - return $this->_fail(); + return $this->_failure; } $this->_memcached = NULL; return $this->_success; } - return $this->_fail(); + return $this->_failure; } // ------------------------------------------------------------------------ @@ -273,7 +273,7 @@ public function destroy($session_id) return $this->_success; } - return $this->_fail(); + return $this->_failure; } // ------------------------------------------------------------------------ diff --git a/fuel/codeigniter/libraries/Session/drivers/Session_redis_driver.php b/fuel/codeigniter/libraries/Session/drivers/Session_redis_driver.php index 434b11e58..df38174b4 100755 --- a/fuel/codeigniter/libraries/Session/drivers/Session_redis_driver.php +++ b/fuel/codeigniter/libraries/Session/drivers/Session_redis_driver.php @@ -76,6 +76,33 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle */ protected $_key_exists = FALSE; + /** + * Name of setTimeout() method in phpRedis + * + * Due to some deprecated methods in phpRedis, we need to call the + * specific methods depending on the version of phpRedis. + * + * @var string + */ + protected $_setTimeout_name; + + /** + * Name of delete() method in phpRedis + * + * Due to some deprecated methods in phpRedis, we need to call the + * specific methods depending on the version of phpRedis. + * + * @var string + */ + protected $_delete_name; + + /** + * Success return value of ping() method in phpRedis + * + * @var mixed + */ + protected $_ping_success; + // ------------------------------------------------------------------------ /** @@ -88,6 +115,20 @@ public function __construct(&$params) { parent::__construct($params); + // Detect the names of some methods in phpRedis instance + if (version_compare(phpversion('redis'), '5', '>=')) + { + $this->_setTimeout_name = 'expire'; + $this->_delete_name = 'del'; + $this->_ping_success = TRUE; + } + else + { + $this->_setTimeout_name = 'setTimeout'; + $this->_delete_name = 'delete'; + $this->_ping_success = '+PONG'; + } + if (empty($this->_config['save_path'])) { log_message('error', 'Session: No Redis save path configured.'); @@ -131,7 +172,7 @@ public function open($save_path, $name) { if (empty($this->_config['save_path'])) { - return $this->_fail(); + return $this->_failure; } $redis = new Redis(); @@ -150,12 +191,11 @@ public function open($save_path, $name) else { $this->_redis = $redis; + $this->php5_validate_id(); return $this->_success; } - $this->php5_validate_id(); - - return $this->_fail(); + return $this->_failure; } // ------------------------------------------------------------------------ @@ -185,7 +225,7 @@ public function read($session_id) return $session_data; } - return $this->_fail(); + return $this->_failure; } // ------------------------------------------------------------------------ @@ -203,21 +243,21 @@ public function write($session_id, $session_data) { if ( ! isset($this->_redis, $this->_lock_key)) { - return $this->_fail(); + return $this->_failure; } // Was the ID regenerated? elseif ($session_id !== $this->_session_id) { if ( ! $this->_release_lock() OR ! $this->_get_lock($session_id)) { - return $this->_fail(); + return $this->_failure; } $this->_key_exists = FALSE; $this->_session_id = $session_id; } - $this->_redis->setTimeout($this->_lock_key, 300); + $this->_redis->{$this->_setTimeout_name}($this->_lock_key, 300); if ($this->_fingerprint !== ($fingerprint = md5($session_data)) OR $this->_key_exists === FALSE) { if ($this->_redis->set($this->_key_prefix.$session_id, $session_data, $this->_config['expiration'])) @@ -227,12 +267,12 @@ public function write($session_id, $session_data) return $this->_success; } - return $this->_fail(); + return $this->_failure; } - return ($this->_redis->setTimeout($this->_key_prefix.$session_id, $this->_config['expiration'])) + return ($this->_redis->{$this->_setTimeout_name}($this->_key_prefix.$session_id, $this->_config['expiration'])) ? $this->_success - : $this->_fail(); + : $this->_failure; } // ------------------------------------------------------------------------ @@ -249,12 +289,12 @@ public function close() if (isset($this->_redis)) { try { - if ($this->_redis->ping() === '+PONG') + if ($this->_redis->ping() === $this->_ping_success) { $this->_release_lock(); if ($this->_redis->close() === FALSE) { - return $this->_fail(); + return $this->_failure; } } } @@ -284,16 +324,16 @@ public function destroy($session_id) { if (isset($this->_redis, $this->_lock_key)) { - if (($result = $this->_redis->delete($this->_key_prefix.$session_id)) !== 1) + if (($result = $this->_redis->{$this->_delete_name}($this->_key_prefix.$session_id)) !== 1) { - log_message('debug', 'Session: Redis::delete() expected to return 1, got '.var_export($result, TRUE).' instead.'); + log_message('debug', 'Session: Redis::'.$this->_delete_name.'() expected to return 1, got '.var_export($result, TRUE).' instead.'); } $this->_cookie_destroy(); return $this->_success; } - return $this->_fail(); + return $this->_failure; } // ------------------------------------------------------------------------ @@ -345,7 +385,7 @@ protected function _get_lock($session_id) // correct session ID. if ($this->_lock_key === $this->_key_prefix.$session_id.':lock') { - return $this->_redis->setTimeout($this->_lock_key, 300); + return $this->_redis->{$this->_setTimeout_name}($this->_lock_key, 300); } // 30 attempts to obtain a lock, in case another request already has it @@ -359,11 +399,13 @@ protected function _get_lock($session_id) continue; } - $result = ($ttl === -2) - ? $this->_redis->set($lock_key, time(), array('nx', 'ex' => 300)) - : $this->_redis->setex($lock_key, 300, time()); - - if ( ! $result) + if ($ttl === -2 && ! $this->_redis->set($lock_key, time(), array('nx', 'ex' => 300))) + { + // Sleep for 1s to wait for lock releases. + sleep(1); + continue; + } + elseif ( ! $this->_redis->setex($lock_key, 300, time())) { log_message('error', 'Session: Error while trying to obtain lock for '.$this->_key_prefix.$session_id); return FALSE; @@ -401,7 +443,7 @@ protected function _release_lock() { if (isset($this->_redis, $this->_lock_key) && $this->_lock) { - if ( ! $this->_redis->delete($this->_lock_key)) + if ( ! $this->_redis->{$this->_delete_name}($this->_lock_key)) { log_message('error', 'Session: Error while trying to free lock for '.$this->_lock_key); return FALSE; diff --git a/fuel/codeigniter/license.txt b/fuel/codeigniter/license.txt new file mode 100755 index 000000000..274306a1c --- /dev/null +++ b/fuel/codeigniter/license.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 - 2019, British Columbia Institute of Technology + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/fuel/codeigniter/readme.rst b/fuel/codeigniter/readme.rst new file mode 100755 index 000000000..b6520080e --- /dev/null +++ b/fuel/codeigniter/readme.rst @@ -0,0 +1,70 @@ +################### +What is CodeIgniter +################### + +CodeIgniter is an Application Development Framework - a toolkit - for people +who build web sites using PHP. Its goal is to enable you to develop projects +much faster than you could if you were writing code from scratch, by providing +a rich set of libraries for commonly needed tasks, as well as a simple +interface and logical structure to access these libraries. CodeIgniter lets +you creatively focus on your project by minimizing the amount of code needed +for a given task. + +******************* +Release Information +******************* + +This repo contains in-development code for future releases. To download the +latest stable release please visit the `CodeIgniter Downloads +`_ page. + +************************** +Changelog and New Features +************************** + +You can find a list of all changes for each release in the `user +guide change log `_. + +******************* +Server Requirements +******************* + +PHP version 5.6 or newer is recommended. + +It should work on 5.3.7 as well, but we strongly advise you NOT to run +such old versions of PHP, because of potential security and performance +issues, as well as missing features. + +************ +Installation +************ + +Please see the `installation section `_ +of the CodeIgniter User Guide. + +******* +License +******* + +Please see the `license +agreement `_. + +********* +Resources +********* + +- `User Guide `_ +- `Language File Translations `_ +- `Community Forums `_ +- `Community Wiki `_ +- `Community Slack Channel `_ + +Report security issues to our `Security Panel `_ +or via our `page on HackerOne `_, thank you. + +*************** +Acknowledgement +*************** + +The CodeIgniter team would like to thank EllisLab, all the +contributors to the CodeIgniter project and you, the CodeIgniter user. From 21aa9fc14859717e2638137744d64d205e7209ec Mon Sep 17 00:00:00 2001 From: David McReynolds Date: Wed, 23 Sep 2020 09:30:22 -0700 Subject: [PATCH 13/13] fix: patch version update to 1.4.12 --- fuel/modules/fuel/config/fuel_constants.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuel/modules/fuel/config/fuel_constants.php b/fuel/modules/fuel/config/fuel_constants.php index 219cc9887..ede2447fe 100644 --- a/fuel/modules/fuel/config/fuel_constants.php +++ b/fuel/modules/fuel/config/fuel_constants.php @@ -1,6 +1,6 @@