| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2008-2012, The Roundcube Dev Team | |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Validates IPv4 or IPv6 address |
| | | * |
| | |
| | | return @inet_pton($ip) !== false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check whether the HTTP referer matches the current request |
| | | * |
| | |
| | | $referer = parse_url(self::request_header('Referer')); |
| | | return $referer['host'] == self::request_header('Host') && $referer['path'] == $uri['path']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Replacing specials characters to a specific encoding type |
| | |
| | | return $str; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Read input value and convert it for internal use |
| | | * Performs stripslashes() and charset conversion if necessary |
| | |
| | | |
| | | return self::parse_input_value($value, $allow_html, $charset); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Parse/validate input value. See self::get_input_value() |
| | |
| | | return $value; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Convert array of request parameters (prefixed with _) |
| | | * to a regular array with non-prefixed keys. |
| | |
| | | return $out; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Convert the given string into a valid HTML identifier |
| | | * Same functionality as done in app.js with rcube_webmail.html_identifier() |
| | |
| | | return asciiwords($str, true, '_'); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Replace all css definitions with #container [def] |
| | |
| | | return $source; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Generate CSS classes from mimetype and filename extension |
| | | * |
| | |
| | | return join(" ", $classes); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Decode escaped entities used by known XSS exploits. |
| | | * See http://downloads.securityfocus.com/vulnerabilities/exploits/26800.eml for examples |
| | |
| | | return $out; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * preg_replace_callback callback for xss_entity_decode |
| | | * |
| | |
| | | { |
| | | return chr(hexdec($matches[1])); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check if we can process not exceeding memory_limit |
| | |
| | | |
| | | return $mem_limit > 0 && $memory + $need > $mem_limit ? false : true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check if working in SSL mode |
| | |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Replaces hostname variables. |
| | |
| | | return str_replace(array('%n', '%t', '%d', '%h', '%z', '%s'), array($n, $t, $d, $h, $z, $s[2]), $name); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns remote IP address and forwarded addresses if found |
| | | * |
| | |
| | | |
| | | return $address; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the real remote IP address |
| | |
| | | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Improved equivalent to strtotime() |
| | |
| | | return self::idn_convert($str, true); |
| | | } |
| | | |
| | | |
| | | /* |
| | | * Idn_to_ascii wrapper. |
| | | * Intl/Idn modules version of this function doesn't work with e-mail address |
| | |
| | | return self::idn_convert($str, false); |
| | | } |
| | | |
| | | |
| | | public static function idn_convert($input, $is_utf=false) |
| | | public static function idn_convert($input, $is_utf = false) |
| | | { |
| | | if ($at = strpos($input, '@')) { |
| | | $user = substr($input, 0, $at); |