From: eldy <> Date: Sat, 6 Dec 2003 00:27:42 +0000 (+0000) Subject: The link to whois informations for a host, provided by hostinfo plugin, has been... X-Git-Tag: AWSTATS_6_0_BETA~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=894f9cea13d27f28bbde9267d72b66e6213cc96d;p=thirdparty%2FAWStats.git The link to whois informations for a host, provided by hostinfo plugin, has been replaced by an internal 'whois' showing in a popup window full whois informations whatever is the TLD of IP or host name. --- diff --git a/wwwroot/cgi-bin/plugins/hostinfo.pm b/wwwroot/cgi-bin/plugins/hostinfo.pm index a8f08a3b..30b18fab 100644 --- a/wwwroot/cgi-bin/plugins/hostinfo.pm +++ b/wwwroot/cgi-bin/plugins/hostinfo.pm @@ -23,7 +23,7 @@ use strict;no strict "refs"; # <----- # ENTER HERE THE MINIMUM AWSTATS VERSION REQUIRED BY YOUR PLUGIN # AND THE NAME OF ALL FUNCTIONS THE PLUGIN MANAGE. -my $PluginNeedAWStatsVersion="5.7"; +my $PluginNeedAWStatsVersion="6.0"; my $PluginHooksFunctions="ShowInfoHost AddHTMLBodyHeader BuildFullHTMLOutput"; # -----> @@ -62,13 +62,16 @@ sub AddHTMLBodyHeader_hostinfo { my $WIDTHINFO=640; my $HEIGHTINFO=480; + my $urlparam="pluginmode=hostinfo&config=$SiteConfig"; + $urlparam.=($DirConfig?"&configdir=$DirConfig":""); + print < function neww(a,b) { var wfeatures="directories=0,menubar=1,status=0,resizable=1,scrollbars=1,toolbar=0,width=$WIDTHINFO,height=$HEIGHTINFO,left=" + eval("(screen.width - $WIDTHINFO)/2") + ",top=" + eval("(screen.height - $HEIGHTINFO)/2"); - if (b==1) { fen=window.open('$AWScript?pluginmode=hostinfo&host='+a,'whois',wfeatures); } - if (b==2) { fen=window.open('$AWScript?pluginmode=hostinfo&host='+a,'whois',wfeatures); } + if (b==1) { fen=window.open('$AWScript?$urlparam&host='+a,'whois',wfeatures); } + if (b==2) { fen=window.open('$AWScript?$urlparam&host='+a,'whois',wfeatures); } } @@ -131,9 +134,6 @@ sub ShowInfoHost_hostinfo { #----------------------------------------------------------------------------- sub BuildFullHTMLOutput_hostinfo { # <----- -# my $regipv4=qr/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/; -# my $regipv6=qr/^[0-9A-F]*:/i; - my $Host=''; if ($QueryString =~ /host=([^&]+)/i) { $Host=lc(&DecodeEncodedString("$1")); @@ -141,6 +141,8 @@ sub BuildFullHTMLOutput_hostinfo { my $ip=''; my $HostResolved=''; +# my $regipv4=qr/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/; +# my $regipv6=qr/^[0-9A-F]*:/i; # if ($Host =~ /$regipv4/o) { $ip=4; } # elsif ($Host =~ /$regipv6/o) { $ip=6; } # if ($ip == 4) { @@ -156,27 +158,34 @@ sub BuildFullHTMLOutput_hostinfo { if (! $ip) { $HostResolved=$Host; } if ($Debug) { debug(" DirData=$DirData Host=$Host HostResolved=$HostResolved ",4); } - my $w = new Net::XWhois Verbose=>$Debug, Cache=>$DirData, NoCache=>0, Timeout=>30, Domain=>$HostResolved; + my $w = new Net::XWhois Verbose=>$Debug, Cache=>$DirData, NoCache=>0, Timeout=>10, Domain=>$HostResolved; print "
\n"; - &tab_head("Common Whois Fields",0,0,'whois'); - print "Common field infoValue\n"; - print "Name".($w->name())." "; - print "Status".($w->status())." "; - print "NameServers".($w->nameservers())." "; - print "Registrant".($w->registrant())." "; - print "Contact Admin".($w->contact_admin())." "; - print "Contact Tech".($w->contact_tech())." "; - print "Contact Billing".($w->contact_billing())." "; - print "Contact Zone".($w->contact_zone())." "; - print "Contact Emails".($w->contact_emails())." "; - print "Contact Handles".($w->contact_handles())." "; - print "Domain Handles".($w->domain_handles())." "; - &tab_end; + if ($w && $w->response()) { + &tab_head("Common Whois Fields",0,0,'whois'); + print "Common field infoValue\n"; + print "Name".($w->name())." "; + print "Status".($w->status())." "; + print "NameServers".($w->nameservers())." "; + print "Registrant".($w->registrant())." "; + print "Contact Admin".($w->contact_admin())." "; + print "Contact Tech".($w->contact_tech())." "; + print "Contact Billing".($w->contact_billing())." "; + print "Contact Zone".($w->contact_zone())." "; + print "Contact Emails".($w->contact_emails())." "; + print "Contact Handles".($w->contact_handles())." "; + print "Domain Handles".($w->domain_handles())." "; + &tab_end; + } &tab_head("Full Whois Field",0,0,'whois'); - print "
".($w->response())."
\n"; + if ($w && $w->response()) { + print "
".($w->response())."
\n"; + } + else { + print "
The Whois command failed.
Did the server running AWStats is allowed to send WhoIs queries ?

\n"; + } &tab_end; return 1;