Welcome Guest, Not a member yet? Register   Sign In
I want to allow all URI chars... am I really insane?
#6

[eluser]TheFuzzy0ne[/eluser]
./system/application/libraries/MY_URI.php
Code:
<?php

class MY_URI extends CI_URI {

    function _filter_uri($str)
    {
        if ($str != '' && $this->config->item('permitted_uri_chars') != '' && $this->config->item('enable_query_strings') == FALSE)
        {
            if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", $str))
            {
                $this->show_disallowed_uri_page();
                exit();
            }
        }    
        
        // Convert programatic characters to entities
        $bad    = array('$',         '(',         ')',         '(',         ')');
        $good    = array('$',    '(',    ')',    '(',    ')');
        
        return str_replace($bad, $good, $str);
    }
    
    function show_disallowed_uri_page()
    {
?>
<html>
<head>
    <title>Bad URI</title>
    <link rel="stylesheet" href="/some/stylesheet.css" />
</head>    
    <body>
        The URI you submitted contains disallowed characters.
    </body>
</html>    
    
<?php
    }
}

// End of file: MY_URI.php
// Location: ./system/application/libraries/MY_URI.php
The above code is untested, but should work.


Messages In This Thread
I want to allow all URI chars... am I really insane? - by El Forum - 03-02-2009, 01:25 PM
I want to allow all URI chars... am I really insane? - by El Forum - 03-02-2009, 01:29 PM
I want to allow all URI chars... am I really insane? - by El Forum - 03-02-2009, 01:37 PM
I want to allow all URI chars... am I really insane? - by El Forum - 03-02-2009, 01:38 PM
I want to allow all URI chars... am I really insane? - by El Forum - 03-02-2009, 01:44 PM
I want to allow all URI chars... am I really insane? - by El Forum - 03-02-2009, 01:56 PM
I want to allow all URI chars... am I really insane? - by El Forum - 03-02-2009, 02:01 PM
I want to allow all URI chars... am I really insane? - by El Forum - 03-02-2009, 02:08 PM
I want to allow all URI chars... am I really insane? - by El Forum - 03-02-2009, 02:12 PM
I want to allow all URI chars... am I really insane? - by El Forum - 03-02-2009, 02:21 PM
I want to allow all URI chars... am I really insane? - by El Forum - 03-02-2009, 02:23 PM
I want to allow all URI chars... am I really insane? - by El Forum - 03-02-2009, 02:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB