/usr/share/php/PHP/Compat/Function/getmxrr.php is in php-compat 1.6.0a3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | <?php
/**
* Replace getmxrr()
*
* @category PHP
* @package PHP_Compat
* @license LGPL - http://www.gnu.org/licenses/lgpl.html
* @copyright 2004-2009 Aidan Lister <aidan@php.net>, Arpad Ray <arpad@php.net>, James Wade <hm2k@php.net>
* @link http://php.net/function.vsprintf
* @author James Wade <hm2k@php.net>
* @version $Revision: 1.0 $
* @since PHP 4.0
* @require PHP 4.0.3 (escapeshellarg)
*/
function php_compat_getmxrr($hostname, &$mxhosts, &$mxweight=false)
{
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
return win_getmxrr($hostname, $mxhosts, $mxweight);
}
else {
user_error('getmxrr() is not supported on your operating system.',
E_USER_WARNING);
return;
}
}
function getmxrr_win($hostname, &$mxhosts, &$mxweight=false)
{
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
user_error('getmxrr() is not supported on your operating system',
E_USER_WARNING);
return;
}
if (empty($hostname)) {
user_error('getmxrr() expects parameter 1 to be string, ' .
gettype($hostname) . ' given', E_USER_WARNING);
return false;
}
if (!is_array ($mxhosts)) {
user_error('getmxrr() expects parameter 2 to be array, ' .
gettype($mxhosts) . ' given', E_USER_WARNING);
return false;
}
$exec='nslookup -type=MX '.escapeshellarg($hostname);
@exec($exec, $output);
if (empty($output)) return;
$i=-1;
foreach ($output as $line) {
$i++;
if (preg_match("/^$hostname\tMX preference = ([0-9]+), mail exchanger = (.+)$/i", $line, $parts)) {
$mxweight[$i] = trim($parts[1]);
$mxhosts[$i] = trim($parts[2]);
}
if (preg_match('/responsible mail addr = (.+)$/i', $line, $parts)) {
$mxweight[$i] = $i;
$mxhosts[$i] = trim($parts[1]);
}
}
return ($i!=-1);
}
// Define
if (!function_exists('getmxrr')) {
function getmxrr($hostname, &$mxhosts, &$mxweight=false) {
return php_compat_getmxrr($hostname, $mxhosts, $mxweight);
}
}
|