Welcome Guest, Not a member yet? Register   Sign In
Please consider querystring support in 2.x
#31

[eluser]chefnelone[/eluser]
Wan, before going with your fix i have a question:
My site is using segments. Will this fix allow the segments work properly? I mean I need GET and segments working together.
#32

[eluser]WanWizard[/eluser]
Yes.

If you set 'enable_query_strings' to FALSE, and 'allow_get_array' to TRUE, your application will route using URI segments, and populate the $_GET array with the parameters of the query string.
#33

[eluser]chefnelone[/eluser]
Wan, I'm affraid I'll need some help with this.
(remember I need to have GET and Segments working together)

I did:

1- In ci/application/config.php I add:
Code:
$config['allow_get_array'] = 'FALSE'; // + ADDED

2- In ci/system/codeigniter/Codeigniter.php I changed this:
Code:
$CFG =& load_class('Config');
$URI =& load_class('URI');
$RTR =& load_class('Router');
$OUT =& load_class('Output');
to
Code:
$CFG =& load_class('Config');
$IN =& load_class('Input');  // + ADDED
$URI =& load_class('URI');
$RTR =& load_class('Router');
$OUT =& load_class('Output');

3- In ci/system/library/Input.php I changed this (but don't know how to assign the config value to the new variable):
Code:
class CI_Input {
    var $use_xss_clean        = FALSE;
    var $xss_hash            = '';
    var $ip_address            = FALSE;
    var $user_agent            = FALSE;
    var $allow_get_array        = FALSE;
to
Code:
class CI_Input {
    var $use_xss_clean        = FALSE;
    var $xss_hash            = '';
    var $ip_address            = FALSE;
    var $user_agent            = FALSE;
    var $allow_get_array        = FALSE;
    var $enable_query_strings    = ????????? // + ADDED.  How to assign the config value?

4- In ci/system/library/Input.php. Could you tell me the lines to add/change in the Input library constructor?
Code:
function CI_Input()
    {
        log_message('debug', "Input Class Initialized");

        $CFG =& load_class('Config');
        $this->use_xss_clean    = ($CFG->item('global_xss_filtering') === TRUE) ? TRUE : FALSE;
        $this->allow_get_array    = ($CFG->item('enable_query_strings') === TRUE) ? TRUE : FALSE;
        $this->_sanitize_globals();
    }

5- In ci/system/library/URI.php. Do I nedd to add/change something?

thanks
#34

[eluser]WanWizard[/eluser]
Just look at the patch file:

In URI.php, find:
Code:
if (is_array($_GET) && count($_GET) == 1 && trim(key($_GET), '/') != '')
and replace by
Code:
if ($this->config->item('enable_query_strings') === TRUE && is_array($_GET) && count($_GET) == 1 && trim(key($_GET), '/') != '')

In Input.php, add:
Code:
var $enable_query_strings    = FALSE;
and find:
Code:
$this->allow_get_array = ($CFG->item('enable_query_strings') === TRUE) ? TRUE : FALSE;
and replace by
Code:
$this->allow_get_array = ($CFG->item('allow_get_array') === TRUE) ? TRUE : FALSE;
$this->enable_query_strings = ($CFG->item('enable_query_strings') === TRUE) ? TRUE : FALSE;

In CodeIgniter.php, find:
Code:
$CFG =& load_class('Config');
and replace by
Code:
$CFG =& load_class('Config');
$IN =& load_class('Input');

find:
Code:
$LANG    =& load_class('Language');
and remove the line
Code:
$IN    =& load_class('Input');
just above that.

Note: if you're using CI 2.0, you could download the modified files from our repository: http://www.exitecms.org/trac8/browser/trunk/system/core
#35

[eluser]chefnelone[/eluser]
thanks wan!
#36

[eluser]skunkbad[/eluser]
[quote author="WanWizard" date="1280154812"]Just look at the patch file:

In URI.php, find:
Code:
if (is_array($_GET) && count($_GET) == 1 && trim(key($_GET), '/') != '')
and replace by
Code:
if ($this->config->item('enable_query_strings') === TRUE && is_array($_GET) && count($_GET) == 1 && trim(key($_GET), '/') != '')

In Input.php, add:
Code:
var $enable_query_strings    = FALSE;
and find:
Code:
$this->allow_get_array = ($CFG->item('enable_query_strings') === TRUE) ? TRUE : FALSE;
and replace by
Code:
$this->allow_get_array = ($CFG->item('allow_get_array') === TRUE) ? TRUE : FALSE;
$this->enable_query_strings = ($CFG->item('enable_query_strings') === TRUE) ? TRUE : FALSE;

In CodeIgniter.php, find:
Code:
$CFG =& load_class('Config');
and replace by
Code:
$CFG =& load_class('Config');
$IN =& load_class('Input');

find:
Code:
$LANG    =& load_class('Language');
and remove the line
Code:
$IN    =& load_class('Input');
just above that.

Note: if you're using CI 2.0, you could download the modified files from our repository: http://www.exitecms.org/trac8/browser/trunk/system/core[/quote]

It's a shame that this hasn't made it into 2.0.
#37

[eluser]pbreit[/eluser]
Yes, it would be terrific if CI had reasonable querystring support "out-of-the-box". This is a very standard internet technology that should be readily available to all web developers.
#38

[eluser]WanWizard[/eluser]
2.0 isn't released yet, so who knows...
#39

[eluser]kkristo[/eluser]
... and if people don't use english language ? Try use search term from russian, estonian, finish or some other language.

www.example.com/search/нам нужно больше
www.example.com/search/öömaja
www.example.com/search/möki

I hope this different language problem are out from CO 2.0 (restricted char)
#40

[eluser]WanWizard[/eluser]
'permitted_uri_chars' is a config option, described in the manual.
If the default doesn't suit you, change it. That's what it's there for.




Theme © iAndrew 2016 - Forum software by © MyBB