Welcome Guest, Not a member yet? Register   Sign In
Hook to change permitted_uri_chars
#1

[eluser]Ward[/eluser]
Hi

Is it possible to use a hook to change the parameters of $config['permitted_uri_chars'] before it blocks certain uri's due to bad characters.

I don't think this is possible without hacking the core, but if I'm wrong... I'd love to know how, and needless to say it would be very helpful in a project I'm working on.

Thanks

Ward

PS ...still CI 1.5.4
#2

[eluser]Seppo[/eluser]
I don't think you can do it with hooks, but you can extend Config class
Code:
<?php
class MY_Config extends CI_Config {
    function MY_Config()
    {
        parent::CI_Config();
        $this->config['permitted_uri_chars'] .= '¿';
    }
}
?>
#3

[eluser]Derek Allard[/eluser]
Ward. Why can't you edit the permitted_uri's in the config file?
#4

[eluser]Ward[/eluser]
I could but i'd perfer not to allow punctuation like = / & for all the pages on my site.

Instead I'd just like to permit the one page which is required to do so by a third party payment processor I have to use. Were I to hack the core I'd hach the congig file as follows:

if($_SERVER['REQUEST_URI'],'payment_confirmed'){
$config['permitted_uri_chars'] = 'a-z 0-9_-';
}
else{

}
#5

[eluser]Derek Allard[/eluser]
If that's the case, then I'd consider a page outside of CI that is for the specific purpose of handling that page, then maybe redirecting or something.
#6

[eluser]Ward[/eluser]
I'd considered that, Derek, but that confirm.php file outside the main CI directory structure just looked a little bit out of place. Probably the best solution though.

Thanks for the help.

Ward

PS Thanks Sepo, extending the config class Config class would either (1)require hacking the core with that particular extension; or (2)be too late for call to the uri filtering... in which case the alteration would be useless to me. Perhaps I've misunderstood you though
#7

[eluser]Derek Jones[/eluser]
Have you thought about using mod_rewrite for these URLs to pass them to your controllers in a way that you prefer to receive them?




Theme © iAndrew 2016 - Forum software by © MyBB