[r1451]: branches / 2.6 / cgi-bin / yabb2 / Sources / IPLookup.pm Maximize Restore History

Download this file

IPLookup.pm    69 lines (59 with data), 2.7 kB

 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
###############################################################################
# IPLookup.pm #
# $Date: 02.20.14 $ #
###############################################################################
# YaBB: Yet another Bulletin Board #
# Open-Source Community Software for Webmasters #
# Version: YaBB 2.6.0 #
# Packaged: February 20, 2014 #
# Distributed by: http://www.yabbforum.com #
# =========================================================================== #
# Copyright (c) 2000-2014 YaBB (www.yabbforum.com) - All Rights Reserved. #
# Software by: The YaBB Development Team #
# with assistance from the YaBB community. #
###############################################################################
use CGI::Carp qw(fatalsToBrowser);
our $VERSION = '2.6.0';
$iplookuppmver = 'YaBB 2.6.0 $Revision: 1451 $';
if ( $action eq 'detailedversion' ) { return 1; }
if ( !$ipLookup || !$INFO{'ip'} || ( !$iamadmin && !$iamgmod && !$iamfmod ) ) {
fatal_error('not_allowed');
}
LoadCensorList();
get_micon();
get_template('Other');
sub IPLookup {
$ip = $INFO{'ip'};
my $lookuplink = q{};
fopen( IPLOOKUP, "<$vardir/iplookup.urls" )
|| fatal_error( 'cannot_open', "$vardir/iplookup.urls", 1 );
@iplookup_urls = <IPLOOKUP>;
fclose(IPLOOKUP);
chomp @iplookup_urls;
foreach my $i (@iplookup_urls) {
my ( $iplookup_name, $iplookup_url ) = split /\|/xsm, $i;
$iplookup_name = Censor($iplookup_name);
$iplookup_url =~ s/{ip}/$ip/gxsm;
$iplookup_url =~ s/^\s+//gsm;
$iplookup_url =~ s/\s+$//gsm;
$iplookup_url =~ s/\r//gxsm;
$iplookup_url =~ s/\n//gxsm;
$iplookup_url =~ s/\t//gsm;
if ( $iplookup_url !~ /&(.*amp;)/gsm ) {
$iplookup_url =~ s/&/&amp;/gxsm;
}
if ( $iplookup_url !~ /http(s|):\/\//xsm ) {
$iplookup_url = qq~http://$iplookup_url~;
}
$lookuplink .=
qq~<a href="$iplookup_url" target="_blank">$iplookup_name</a><br />~;
}
$yymain .= $my_ipdiv;
$yymain =~ s/{yabb lookuplink}/$lookuplink/gsm;
$yymain =~ s/{yabb ip}/$ip/gsm;
$yytitle = qq~$lookup_txt{'iplookup'}~;
$yynavigation = qq~&rsaquo; $lookup_txt{'iplookup'}~;
template();
return;
}
1;