Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $route[rawurlencode("статьи")] = "article/index";
- $config['permitted_uri_chars'] = '?A-Za-zА-Яа-я=s&0-9~%.:&_-|@';
- class MY_Router extends CI_Router {
- function _parse_routes() {
- $uri = implode('/', $this->uri->segments);
- if (isset($this->routes[$uri])) {
- return $this->_set_request(explode('/', $this->routes[$uri]));
- }
- foreach ($this->routes as $key => $val) {
- $key = rawurlencode(str_replace(':any', '.+', str_replace(':num', '[0-9]+', $key)));
- if (preg_match('#^' . $key . '$#', $uri)) {
- // Do we have a back-reference?
- if (strpos($val, '$') !== FALSE AND strpos($key, '(') !== FALSE) {
- $val = preg_replace('#^' . $key . '$#', $val, $uri);
- }
- return $this->_set_request(explode('/', $val));
- }
- }
- $this->_set_request($this->uri->segments);
- }
- }
- class MY_URI extends CI_URI
- {
- function _filter_uri($str)
- {
- if ($str != '' AND $this->config->item('permitted_uri_chars') != '')
- {
- if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", rawurlencode($str)))
- {
- exit('The URI you submitted has disallowed characters.');
- }
- }
- return $str;
- }
- }
- setlocale(LC_ALL, 'ru_RU.UTF8');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement