diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..4e87ad5 --- /dev/null +++ b/composer.json @@ -0,0 +1,12 @@ +{ + "name": "simple-updates/phpwhois", + "type": "library", + "description": "This package contains a Whois (RFC954) library for PHP. It allows a PHP program to create a Whois object, and obtain the output of a whois query with the Lookup function.", + "license": "GPLv2", + "require": { + "php": ">=4.3.0" + }, + "autoload": { + "files": ["whois.main.php", "whois.utils.php"] + } +} diff --git a/whois.be.php b/whois.be.php index 4d6c9ba..0fb5994 100644 --- a/whois.be.php +++ b/whois.be.php @@ -52,7 +52,7 @@ function parse($data, $query) $r['regrinfo'] = get_blocks($data['rawdata'], $items); - if ($r['regrinfo']['domain']['status'] == 'REGISTERED') + if ($r['regrinfo']['domain']['status'] != 'AVAILABLE') { $r['regrinfo']['registered'] = 'yes'; $r['regrinfo'] = get_contacts($r['regrinfo'],$trans); diff --git a/whois.gtld.name.php b/whois.gtld.name.php index c6c0101..be0a51d 100644 --- a/whois.gtld.name.php +++ b/whois.gtld.name.php @@ -41,8 +41,8 @@ function parse($data_str, $query) 'billing' => 'BILLING CONTACT INFO', 'domain.name' => 'Domain Name:', 'domain.sponsor' => 'Registrar', - 'domain.created' => 'Creation Date', - 'domain.expires' => 'Expiration Date' + 'domain.created' => 'Creation Date:', + 'domain.expires' => 'Expiration Date:' ); $extra = array( diff --git a/whois.gtld.php b/whois.gtld.php index d16cef1..6f46bc2 100755 --- a/whois.gtld.php +++ b/whois.gtld.php @@ -54,7 +54,10 @@ class gtld_handler extends WhoisClient function parse($data, $query) { $this->Query = array(); - $this->SUBVERSION = sprintf('%s-%s', $query['handler'], $this->HANDLER_VERSION); + if ( is_array( $query ) and array_key_exists( 'handler', $query ) ) + { + $this->SUBVERSION = sprintf('%s-%s', $query['handler'], $this->HANDLER_VERSION); + } $this->result = generic_parser_b($data['rawdata'], $this->REG_FIELDS, 'dmy'); unset($this->result['registered']); @@ -78,4 +81,4 @@ function parse($data, $query) return $this->result; } } -?> \ No newline at end of file +?> diff --git a/whois.parser.php b/whois.parser.php index d11243a..f4345b9 100755 --- a/whois.parser.php +++ b/whois.parser.php @@ -768,6 +768,11 @@ function format_dates (&$res,$format='mdy') function get_date($date,$format) { + +if(strtotime($date) > 0) { + return date('Y-m-d', strtotime($date)); +} + $months = array( 'jan'=>1, 'ene'=>1, 'feb'=>2, 'mar'=>3, 'apr'=>4, 'abr'=>4, 'may'=>5, 'jun'=>6, 'jul'=>7, 'aug'=>8, 'ago'=>8, 'sep'=>9, 'oct'=>10, 'nov'=>11, 'dec'=>12, 'dic'=>12 ); diff --git a/whois.pm.php b/whois.pm.php new file mode 100644 index 0000000..4d9654c --- /dev/null +++ b/whois.pm.php @@ -0,0 +1,78 @@ + 'fax', + 'e-mail' => 'email', + 'nic-hdl' => 'handle', + 'ns-list' => 'handle', + 'person' => 'name', + 'address' => 'address.', + 'descr' => 'desc', + 'anniversary' => '', + 'domain' => '', + 'last-update' => 'changed', + 'registered' => 'created', + 'country' => 'address.country', + 'registrar' => 'sponsor', + 'role' => 'organization' + ); + + $contacts = array( + 'admin-c' => 'admin', + 'tech-c' => 'tech', + 'zone-c' => 'zone', + 'holder-c' => 'owner', + 'nsl-id' => 'nserver' + ); + + $reg = generic_parser_a($data_str['rawdata'], $translate, $contacts, 'domain','dmY'); + + if (isset($reg['nserver'])) + { + $reg['domain'] = array_merge($reg['domain'],$reg['nserver']); + unset($reg['nserver']); + } + + $r['regrinfo'] = $reg; + $r['regyinfo'] = array( + 'referrer' => 'http://www.nic.fr', + 'registrar' => 'AFNIC' + ); + return $r; + } + } +?> \ No newline at end of file diff --git a/whois.re.php b/whois.re.php new file mode 100644 index 0000000..e44e957 --- /dev/null +++ b/whois.re.php @@ -0,0 +1,78 @@ + 'fax', + 'e-mail' => 'email', + 'nic-hdl' => 'handle', + 'ns-list' => 'handle', + 'person' => 'name', + 'address' => 'address.', + 'descr' => 'desc', + 'anniversary' => '', + 'domain' => '', + 'last-update' => 'changed', + 'registered' => 'created', + 'country' => 'address.country', + 'registrar' => 'sponsor', + 'role' => 'organization' + ); + + $contacts = array( + 'admin-c' => 'admin', + 'tech-c' => 'tech', + 'zone-c' => 'zone', + 'holder-c' => 'owner', + 'nsl-id' => 'nserver' + ); + + $reg = generic_parser_a($data_str['rawdata'], $translate, $contacts, 'domain','dmY'); + + if (isset($reg['nserver'])) + { + $reg['domain'] = array_merge($reg['domain'],$reg['nserver']); + unset($reg['nserver']); + } + + $r['regrinfo'] = $reg; + $r['regyinfo'] = array( + 'referrer' => 'http://www.nic.fr', + 'registrar' => 'AFNIC' + ); + return $r; + } + } +?> \ No newline at end of file diff --git a/whois.wf.php b/whois.wf.php new file mode 100644 index 0000000..5c1fa29 --- /dev/null +++ b/whois.wf.php @@ -0,0 +1,78 @@ + 'fax', + 'e-mail' => 'email', + 'nic-hdl' => 'handle', + 'ns-list' => 'handle', + 'person' => 'name', + 'address' => 'address.', + 'descr' => 'desc', + 'anniversary' => '', + 'domain' => '', + 'last-update' => 'changed', + 'registered' => 'created', + 'country' => 'address.country', + 'registrar' => 'sponsor', + 'role' => 'organization' + ); + + $contacts = array( + 'admin-c' => 'admin', + 'tech-c' => 'tech', + 'zone-c' => 'zone', + 'holder-c' => 'owner', + 'nsl-id' => 'nserver' + ); + + $reg = generic_parser_a($data_str['rawdata'], $translate, $contacts, 'domain','dmY'); + + if (isset($reg['nserver'])) + { + $reg['domain'] = array_merge($reg['domain'],$reg['nserver']); + unset($reg['nserver']); + } + + $r['regrinfo'] = $reg; + $r['regyinfo'] = array( + 'referrer' => 'http://www.nic.fr', + 'registrar' => 'AFNIC' + ); + return $r; + } + } +?> \ No newline at end of file diff --git a/whois.yt.php b/whois.yt.php new file mode 100644 index 0000000..d9b943e --- /dev/null +++ b/whois.yt.php @@ -0,0 +1,78 @@ + 'fax', + 'e-mail' => 'email', + 'nic-hdl' => 'handle', + 'ns-list' => 'handle', + 'person' => 'name', + 'address' => 'address.', + 'descr' => 'desc', + 'anniversary' => '', + 'domain' => '', + 'last-update' => 'changed', + 'registered' => 'created', + 'country' => 'address.country', + 'registrar' => 'sponsor', + 'role' => 'organization' + ); + + $contacts = array( + 'admin-c' => 'admin', + 'tech-c' => 'tech', + 'zone-c' => 'zone', + 'holder-c' => 'owner', + 'nsl-id' => 'nserver' + ); + + $reg = generic_parser_a($data_str['rawdata'], $translate, $contacts, 'domain','dmY'); + + if (isset($reg['nserver'])) + { + $reg['domain'] = array_merge($reg['domain'],$reg['nserver']); + unset($reg['nserver']); + } + + $r['regrinfo'] = $reg; + $r['regyinfo'] = array( + 'referrer' => 'http://www.nic.fr', + 'registrar' => 'AFNIC' + ); + return $r; + } + } +?> \ No newline at end of file