A few enhancements to the Input class:
* Adds new config value $config[‘allow_get_query’] that turns on the ability to use GET values with $this->input->get()
* Adds $this->input->env() (for $_ENV), mostly just for completeness
* input::xss_clean() now processes arrays recursively, so more than just the first level (or in a couple cases, only the first two levels) are cleaned.
* A few little code cleanups and optimizations
The patch is at http://gregmaclellan.com/CI_Input-get.patch, which can be applied in the libraries/ directory
Note: I removed some code from Router that grabbed the first element of the $_GET array and used it as the current path.. I’m not really sure what it was for- possibly for supporting “http://mysite.com/?controller/method” as a URL? I couldn’t find any documentation explaining that was even possible, nor can I really see why it would be necessary. If anyone is actually using this or sees benefit in keeping it, let me know and I’ll adjust the patch to continue to allow it. It will likely cause problems when allow_get_query is on, but it may be possible to work around it - but there’s no point if no one is using it ![]()
You can also add the following code to your application/config/config.php file:
/*
|--------------------------------------------------------------------------
| Enable GET Strings
|--------------------------------------------------------------------------
|
| BY default, Code Igniter does not allow using GET variables at all,
| in favour of using URL segments, or POST variables. Enabling this
| option allows you to use $this->input->get($varname) to access GET
| variables. They follow the same XSS-cleaning operations as POST
| and COOKIE values.
*/
$config['allow_get_array'] = FALSE;
Overall, except for the bit of code removed in Router, these changes provide total backwards compatibility with CI as it is now. GET remains totally disabled unless allow_get_array is on. If enable_query_strings is used (and allow_get_array is off), the $_GET array isn’t actually cleared, but $this->input->get() will still always return false.
