| | |
| | | return true; |
| | | } |
| | | |
| | | if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' && version_compare(PHP_VERSION, '5.3.0', '<')) { |
| | | $lookup = array(); |
| | | @exec("nslookup -type=MX " . escapeshellarg($domain_part) . " 2>&1", $lookup); |
| | | foreach ($lookup as $line) { |
| | | if (strpos($line, 'MX preference')) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | // find MX record(s) |
| | | if (!function_exists('getmxrr') || getmxrr($domain_part, $mx_records)) { |
| | | return true; |
| | |
| | | return (bool) preg_match('!^[a-z]:[\\\\/]!i', $path); |
| | | } |
| | | else { |
| | | return $path[0] == DIRECTORY_SEPARATOR; |
| | | return $path[0] == '/'; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Resolve relative URL |
| | | * |
| | | * @param string $url Relative URL |
| | | * |
| | | * @return string Absolute URL |
| | | */ |
| | | public static function resolve_url($url) |
| | | { |
| | | // prepend protocol://hostname:port |
| | | if (!preg_match('|^https?://|', $url)) { |
| | | $schema = 'http'; |
| | | $default_port = 80; |
| | | |
| | | if (self::https_check()) { |
| | | $schema = 'https'; |
| | | $default_port = 443; |
| | | } |
| | | |
| | | $prefix = $schema . '://' . preg_replace('/:\d+$/', '', $_SERVER['HTTP_HOST']); |
| | | if ($_SERVER['SERVER_PORT'] != $default_port) { |
| | | $prefix .= ':' . $_SERVER['SERVER_PORT']; |
| | | } |
| | | |
| | | $url = $prefix . ($url[0] == '/' ? '' : '/') . $url; |
| | | } |
| | | |
| | | return $url; |
| | | } |
| | | } |