Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MY_URI extends CI_URI{
- function __construct(){
- parent::__construct();
- }
- function _filter_uri($str){
- if ($str != '' && $this->config->item('permitted_uri_chars') != '' && $this->config->item('enable_query_strings') == FALSE)
- {
- // preg_quote() in PHP 5.3 escapes -, so the str_replace() and addition of - to preg_quote() is to maintain backwards
- // compatibility as many are unaware of how characters in the permitted_uri_chars will be parsed as a regex pattern
- if ( ! preg_match("|^[".str_replace(array('\-', '-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", $str))
- {
- redirect('main/cate/page');
- }
- }
- // Convert programatic characters to entities
- $bad = array('$', '(', ')', '%28', '%29');
- $good = array('$', '(', ')', '(', ')');
- return str_replace($bad, $good, $str);
- }
- }
- <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
- class OOR_Exceptions extends CI_Exceptions
- {
- public function show_error($heading, $message, $template = '', $status_code = 500)
- {
- $ci =& get_instance();
- if (!$page = $ci->uri->uri_string()) {
- $page = 'home';
- }
- switch($status_code) {
- case 403: $heading = 'Access Forbidden'; break;
- case 404: $heading = 'Page Not Found'; break;
- case 503: $heading = 'Undergoing Maintenance'; break;
- }
- log_message('error', $status_code . ' ' . $heading . ' --> '. $page);
- if ($status_code == 404)
- {
- redirect('/mypage');
- }
- return parent::show_error($heading, $message, 'error_general', $status_code);
- }
- }
Add Comment
Please, Sign In to add comment