| | |
| | | return $value; |
| | | } |
| | | |
| | | // strip single quotes if magic_quotes_sybase is enabled |
| | | if (ini_get('magic_quotes_sybase')) { |
| | | $value = str_replace("''", "'", $value); |
| | | } |
| | | // strip slashes if magic_quotes enabled |
| | | else if (get_magic_quotes_gpc() || get_magic_quotes_runtime()) { |
| | | if (get_magic_quotes_gpc() || get_magic_quotes_runtime()) { |
| | | $value = stripslashes($value); |
| | | } |
| | | |
| | |
| | | */ |
| | | public static function file2class($mimetype, $filename) |
| | | { |
| | | $mimetype = strtolower($mimetype); |
| | | $filename = strtolower($filename); |
| | | |
| | | list($primary, $secondary) = explode('/', $mimetype); |
| | | |
| | | $classes = array($primary ? $primary : 'unknown'); |
| | | |
| | | if ($secondary) { |
| | | $classes[] = $secondary; |
| | | } |
| | | if (preg_match('/\.([a-z0-9]+)$/i', $filename, $m)) { |
| | | $classes[] = $m[1]; |
| | | |
| | | if (preg_match('/\.([a-z0-9]+)$/', $filename, $m)) { |
| | | if (!in_array($m[1], $classes)) { |
| | | $classes[] = $m[1]; |
| | | } |
| | | } |
| | | |
| | | return strtolower(join(" ", $classes)); |
| | | return join(" ", $classes); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Returns the real remote IP address |
| | | * |
| | | * @return string Remote IP address |
| | | */ |
| | | public static function remote_addr() |
| | | { |
| | | foreach (array('HTTP_X_FORWARDED_FOR','HTTP_X_REAL_IP','REMOTE_ADDR') as $prop) { |
| | | if (!empty($_SERVER[$prop])) |
| | | return $_SERVER[$prop]; |
| | | } |
| | | |
| | | return ''; |
| | | } |
| | | |
| | | /** |
| | | * Read a specific HTTP request header. |
| | | * |
| | | * @param string $name Header name |
| | |
| | | return mktime(0,0,0, intval($matches[2]), intval($matches[3]), intval($matches[1])); |
| | | } |
| | | else if (is_numeric($date)) { |
| | | return $date; |
| | | return (int) $date; |
| | | } |
| | | |
| | | // Clean malformed data |
| | |
| | | $date = implode(' ', $d); |
| | | } |
| | | |
| | | return $ts; |
| | | return (int) $ts; |
| | | } |
| | | |
| | | |