| | |
| | | { |
| | | $uri = parse_url($_SERVER['REQUEST_URI']); |
| | | $referer = parse_url(self::request_header('Referer')); |
| | | |
| | | return $referer['host'] == self::request_header('Host') && $referer['path'] == $uri['path']; |
| | | } |
| | | |
| | |
| | | * |
| | | * @param string Input string |
| | | * @param string Encoding type: text|html|xml|js|url |
| | | * @param string Replace mode for tags: show|replace|remove |
| | | * @param string Replace mode for tags: show|remove|strict |
| | | * @param boolean Convert newlines |
| | | * |
| | | * @return string The quoted string |
| | |
| | | |
| | | $encode_arr = $html_encode_arr; |
| | | |
| | | if ($mode == 'remove') { |
| | | $str = strip_tags($str); |
| | | } |
| | | else if ($mode != 'strict') { |
| | | // don't replace quotes and html tags |
| | | if ($mode == 'show' || $mode == '') { |
| | | $ltpos = strpos($str, '<'); |
| | | if ($ltpos !== false && strpos($str, '>', $ltpos) !== false) { |
| | | unset($encode_arr['"']); |
| | |
| | | unset($encode_arr['>']); |
| | | unset($encode_arr['&']); |
| | | } |
| | | } |
| | | else if ($mode == 'remove') { |
| | | $str = strip_tags($str); |
| | | } |
| | | |
| | | $out = strtr($str, $encode_arr); |