~ubuntu-branches/ubuntu/quantal/awstats/quantal

« back to all changes in this revision

Viewing changes to wwwroot/cgi-bin/plugins/geoip_region_maxmind.pm

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard, Sergey B Kirpichev, Jonas Smedegaard
  • Date: 2011-03-12 19:44:25 UTC
  • mfrom: (1.2.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20110312194425-hn7bo427pgqw2smz
Tags: 7.0~dfsg-1
* New upstream release.
  Closes: bug#613447.

[ Sergey B Kirpichev ]
* Unfuzz patches.
* Update patch 1008.
* Drop obsolete patches.
* Fix +x bit on *.js in docs/examples
* Avoid asterisks in debian/NEWS entries, to please lintian.
* Fix recode bulgarian tooltips file as utf-8.
  Closes: bug#610632.
* Forward patches 0007 and 1015 upstream.
* Allow DM (Debian Maintainer) uploads.

[ Jonas Smedegaard ]
* Update copyright file:
  + Rewrite using Subversion rev.173 of draft DEP5 format.
  + Add some previously missed authors and licenses.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
#-----------------------------------------------------------------------------
8
8
# Perl Required Modules: Geo::IP or Geo::IP::PurePerl
9
9
#-----------------------------------------------------------------------------
10
 
# $Revision: 1.16 $ - $Author: eldy $ - $Date: 2008/11/15 16:03:42 $
 
10
# $Revision: 1.21 $ - $Author: eldy $ - $Date: 2010/08/23 21:55:34 $
11
11
 
12
12
 
13
13
# <-----
38
38
# AND THE NAME OF ALL FUNCTIONS THE PLUGIN MANAGE.
39
39
my $PluginNeedAWStatsVersion="6.5";
40
40
my $PluginHooksFunctions="AddHTMLMenuLink AddHTMLGraph ShowInfoHost SectionInitHashArray SectionProcessIp SectionProcessHostname SectionReadHistory SectionWriteHistory";
 
41
my $PluginName="geoip_region_maxmind";
 
42
my $LoadedOverride=0;
 
43
my $OverrideFile=""; 
41
44
# ----->
42
45
 
43
46
# <-----
150
153
    
151
154
        # <-----
152
155
        # ENTER HERE CODE TO DO INIT PLUGIN ACTIONS
153
 
        debug(" Plugin geoip_region_maxmind: InitParams=$InitParams",1);
154
 
        my ($mode,$datafile)=split(/\s+/,$InitParams,2);
 
156
        debug(" Plugin $PluginName: InitParams=$InitParams",1);
 
157
    my ($mode,$tmpdatafile)=split(/\s+/,$InitParams,2);
 
158
    my ($datafile,$override)=split(/\+/,$tmpdatafile,2);
155
159
        if (! $datafile) { $datafile="GeoIPRegion.dat"; }
 
160
        else { $datafile =~ s/%20/ /g; }
156
161
        if ($type eq 'geoippureperl') {
157
 
                # With pureperl with always use GEOIP_STANDARD.
 
162
                # With pureperl we always use GEOIP_STANDARD.
158
163
                # GEOIP_MEMORY_CACHE seems to fail with ActiveState
159
164
                if ($mode eq '' || $mode eq 'GEOIP_MEMORY_CACHE')  { $mode=Geo::IP::PurePerl::GEOIP_STANDARD(); }
160
165
                else { $mode=Geo::IP::PurePerl::GEOIP_STANDARD(); }
162
167
                if ($mode eq '' || $mode eq 'GEOIP_MEMORY_CACHE')  { $mode=Geo::IP::GEOIP_MEMORY_CACHE(); }
163
168
                else { $mode=Geo::IP::GEOIP_STANDARD(); }
164
169
        }
 
170
        if ($override){ $override =~ s/%20/ /g; $OverrideFile=$override; }
165
171
        %TmpDomainLookup=();
166
 
        debug(" Plugin geoip_region_maxmind: GeoIP initialized type=$type mode=$mode",1);
 
172
        debug(" Plugin $PluginName: GeoIP initialized type=$type mode=$mode",1);
167
173
        if ($type eq 'geoippureperl') {
168
174
                $geoip_region_maxmind = Geo::IP::PurePerl->open($datafile, $mode);
169
175
        } else {
170
176
                $geoip_region_maxmind = Geo::IP->open($datafile, $mode);
171
177
        }
 
178
        $LoadedOverride=0;
172
179
# Fails with some geoip versions
173
180
#       debug(" Plugin geoip_region_maxmind: GeoIP initialized database_info=".$geoip_region_maxmind->database_info());
174
181
        # ----->
187
194
    my $menulink=$_[2];
188
195
    my $menutext=$_[3];
189
196
        # <-----
190
 
        if ($Debug) { debug(" Plugin geoip_region_maxmind: AddHTMLMenuLink"); }
 
197
        if ($Debug) { debug(" Plugin $PluginName: AddHTMLMenuLink"); }
191
198
    if ($categ eq 'who') {
192
 
        $menu->{'plugin_geoip_region_maxmind'}=2.1;             # Pos
193
 
        $menulink->{'plugin_geoip_region_maxmind'}=2;           # Type of link
194
 
        $menutext->{'plugin_geoip_region_maxmind'}="Regions";   # Text
 
199
        $menu->{"plugin_$PluginName"}=2.1;             # Pos
 
200
        $menulink->{"plugin_$PluginName"}=2;           # Type of link
 
201
        $menutext->{"plugin_$PluginName"}="Regions";   # Text
195
202
    }
196
203
        # ----->
197
204
        return 0;
213
220
        my $total_p; my $total_h; my $total_k;
214
221
        my $rest_p; my $rest_h; my $rest_k;
215
222
 
216
 
        if ($Debug) { debug(" Plugin geoip_region_maxmind: AddHTMLGraph"); }
 
223
        if ($Debug) { debug(" Plugin $PluginName: AddHTMLGraph"); }
217
224
        my $title='Regions';
218
225
        &tab_head("$title",19,0,'regions');
219
226
        print "<tr bgcolor=\"#$color_TableBGRowTitle\"><th>US and CA Regions : ".((scalar keys %_region_h)-($_region_h{'unknown'}?1:0))."</th>";
246
253
                        if ($TotalPages) { $p_p=int($_region_p{$key}/$TotalPages*1000)/10; }
247
254
                        if ($TotalHits)  { $p_h=int($_region_h{$key}/$TotalHits*1000)/10; }
248
255
                    print "<tr><td class=\"aws\">".$region{$countrycode}{uc($regioncode)}." ($regioncode)</td>";
249
 
                if ($ShowRegions =~ /P/i) { print "<td>".($_region_p{$key}?$_region_p{$key}:"&nbsp;")."</td>"; }
 
256
                if ($ShowRegions =~ /P/i) { print "<td>".($_region_p{$key}?Format_Number($_region_p{$key}):"&nbsp;")."</td>"; }
250
257
                if ($ShowRegions =~ /P/i) { print "<td>".($_region_p{$key}?"$p_p %":'&nbsp;')."</td>"; }
251
 
                if ($ShowRegions =~ /H/i) { print "<td>".($_region_h{$key}?$_region_h{$key}:"&nbsp;")."</td>"; }
 
258
                if ($ShowRegions =~ /H/i) { print "<td>".($_region_h{$key}?Format_Number($_region_h{$key}):"&nbsp;")."</td>"; }
252
259
                if ($ShowRegions =~ /H/i) { print "<td>".($_region_h{$key}?"$p_h %":'&nbsp;')."</td>"; }
253
260
                if ($ShowRegions =~ /B/i) { print "<td>".Format_Bytes($_region_k{$key})."</td>"; }
254
261
                if ($ShowRegions =~ /L/i) { print "<td>".($_region_p{$key}?Format_Date($_region_l{$key},1):'-')."</td>"; }
277
284
                if ($TotalPages) { $p_p=int($rest_p/$TotalPages*1000)/10; }
278
285
                if ($TotalHits)  { $p_h=int($rest_h/$TotalHits*1000)/10; }
279
286
                print "<tr><td class=\"aws\"><span style=\"color: #$color_other\">$Message[2]/$Message[0]</span></td>";
280
 
                if ($ShowRegions =~ /P/i) { print "<td>".($rest_p?$rest_p:"&nbsp;")."</td>"; }
 
287
                if ($ShowRegions =~ /P/i) { print "<td>".($rest_p?Format_Number($rest_p):"&nbsp;")."</td>"; }
281
288
                if ($ShowRegions =~ /P/i) { print "<td>".($rest_p?"$p_p %":'&nbsp;')."</td>"; }
282
 
                if ($ShowRegions =~ /H/i) { print "<td>".($rest_h?$rest_h:"&nbsp;")."</td>"; }
 
289
                if ($ShowRegions =~ /H/i) { print "<td>".($rest_h?Format_Number($rest_h):"&nbsp;")."</td>"; }
283
290
                if ($ShowRegions =~ /H/i) { print "<td>".($rest_h?"$p_h %":'&nbsp;')."</td>"; }
284
291
                if ($ShowRegions =~ /B/i) { print "<td>".Format_Bytes($rest_k)."</td>"; }
285
292
                if ($ShowRegions =~ /L/i) { print "<td>&nbsp;</td>"; }
301
308
sub GetCountryCodeByAddr_geoip_region_maxmind {
302
309
    my $param="$_[0]";
303
310
        # <-----
 
311
        if (!$LoadedOverride){&LoadOverrideFile_geoip_region_maxmind();}
304
312
        my $res=$TmpDomainLookup{$param}||'';
305
313
        if (! $res) {
306
314
        my ($res1,$res2,$countryregion)=();
307
315
        ($res1,$res2)=$geoip_region_maxmind->region_by_name($param) if $geoip_region_maxmind;
308
316
        $res=lc($res1) || 'unknown';
309
317
                $TmpDomainLookup{$param}=$res;
310
 
        if ($Debug) { debug("  Plugin geoip_region_maxmind: GetCountryCodeByAddr for $param: [$res]",5); }
 
318
        if ($Debug) { debug("  Plugin $PluginName: GetCountryCodeByAddr for $param: [$res]",5); }
311
319
        }
312
 
        elsif ($Debug) { debug("  Plugin geoip_region_maxmind: GetCountryCodeByAddr for $param: Already resolved to [$res]",5); }
 
320
        elsif ($Debug) { debug("  Plugin $PluginName: GetCountryCodeByAddr for $param: Already resolved to [$res]",5); }
313
321
        # ----->
314
322
        return $res;
315
323
}
324
332
sub GetCountryCodeByName_geoip_region_maxmind {
325
333
    my $param="$_[0]";
326
334
        # <-----
 
335
        if (!$LoadedOverride){&LoadOverrideFile_geoip_region_maxmind();}
327
336
        my $res=$TmpDomainLookup{$param}||'';
328
337
        if (! $res) {
329
338
        my ($res1,$res2,$countryregion)=();
330
339
        ($res1,$res2)=$geoip_region_maxmind->region_by_name($param) if $geoip_region_maxmind;
331
340
        $res=lc($res1) || 'unknown';
332
341
                $TmpDomainLookup{$param}=$res;
333
 
        if ($Debug) { debug("  Plugin geoip_region_maxmind: GetCountryCodeByName for $param: [$res]",5); }
 
342
        if ($Debug) { debug("  Plugin $PluginName: GetCountryCodeByName for $param: [$res]",5); }
334
343
        }
335
 
        elsif ($Debug) { debug("  Plugin geoip_region_maxmind: GetCountryCodeByName for $param: Already resolved to [$res]",5); }
 
344
        elsif ($Debug) { debug("  Plugin $PluginName: GetCountryCodeByName for $param: Already resolved to [$res]",5); }
336
345
        # ----->
337
346
        return $res;
338
347
}
367
376
        if ($NewLinkParams) { $NewLinkParams="${NewLinkParams}&"; }
368
377
 
369
378
                print "<th width=\"80\">";
370
 
        print "<a href=\"".($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks?XMLEncode("$AWScript?${NewLinkParams}output=plugin_geoip_region_maxmind"):"$PROG$StaticLinks.plugin_geoip_region_maxmind.$StaticExt")."\"$NewLinkTarget>GeoIP<br />Region</a>";
 
379
        print "<a href=\"".($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks?XMLEncode("$AWScript?${NewLinkParams}output=plugin_$PluginName"):"$StaticLinks.plugin_$PluginName.$StaticExt")."\"$NewLinkTarget>GeoIP<br />Region</a>";
371
380
        print "</th>";
372
381
        }
373
382
        elsif ($param) {
 
383
                # try loading our override file if we haven't yet
 
384
                if (!$LoadedOverride){&LoadOverrideFile_geoip_region_maxmind();}
374
385
        my $ip=0;
375
386
                my $key;
376
387
                if ($param =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) { # IPv4 address
384
395
                print "<td>";
385
396
                if ($key && $ip==4) {
386
397
                my ($res1,$res2,$countryregion)=();
387
 
                ($res1,$res2)=$geoip_region_maxmind->region_by_name($param) if $geoip_region_maxmind;
388
 
                if ($Debug) { debug("  Plugin geoip_region_maxmind: GetRegionByIp for $param: [${res1}_${res2}]",5); }
 
398
                my @res = TmpLookup_geoip_region_maxmind($param);
 
399
                if (@res){
 
400
                        $res1 = $res[0];
 
401
                        $res2 = $res[1];
 
402
                }else{
 
403
                        ($res1,$res2)=$geoip_region_maxmind->region_by_name($param) if $geoip_region_maxmind;
 
404
                }
 
405
                if ($Debug) { debug("  Plugin $PluginName: GetRegionByIp for $param: [${res1}_${res2}]",5); }
389
406
            if (! $PluginsLoaded{'init'}{'geoip'}) {
390
407
                # Show country
391
408
                if ($res1 =~ /\w\w/) { print $DomainsHashIDLib{lc($res1)}||uc($res1); }
410
427
        }
411
428
                if (! $key) {
412
429
                my ($res1,$res2,$countryregion)=();
413
 
                ($res1,$res2)=$geoip_region_maxmind->region_by_name($param) if $geoip_region_maxmind;
414
 
                if ($Debug) { debug("  Plugin geoip_region_maxmind: GetRegionByName for $param: [${res1}_${res2}]",5); }
 
430
                my @res = TmpLookup_geoip_region_maxmind($param);
 
431
                if (@res){
 
432
                        $res1 = $res[0];
 
433
                        $res2 = $res[1];
 
434
                }else{
 
435
                        ($res1,$res2)=$geoip_region_maxmind->region_by_name($param) if $geoip_region_maxmind;
 
436
                }
 
437
                if ($Debug) { debug("  Plugin $PluginName: GetRegionByName for $param: [${res1}_${res2}]",5); }
415
438
            if (! $PluginsLoaded{'init'}{'geoip'}) {
416
439
                # Show country
417
440
                if ($res1 =~ /\w\w/) { print $DomainsHashIDLib{lc($res1)}||uc($res1); }
448
471
sub SectionInitHashArray_geoip_region_maxmind {
449
472
#    my $param="$_[0]";
450
473
        # <-----
451
 
        if ($Debug) { debug(" Plugin geoip_region_maxmind: Init_HashArray"); }
 
474
        if ($Debug) { debug(" Plugin $PluginName: Init_HashArray"); }
452
475
        %_region_p = %_region_h = %_region_k = %_region_l =();
453
476
        # ----->
454
477
        return 0;
463
486
    my $param="$_[0]";      # Param must be an IP
464
487
        # <-----
465
488
        my ($res1,$res2,$countryregion)=();
466
 
        ($res1,$res2)=$geoip_region_maxmind->region_by_name($param) if $geoip_region_maxmind;
467
 
        if ($Debug) { debug("  Plugin geoip_region_maxmind: GetRegionByIp for $param: [${res1}_${res2}]",5); }
 
489
        my @res = TmpLookup_geoip_region_maxmind($param);
 
490
    if (@res){
 
491
        $res1 = $res[0];
 
492
        $res2 = $res[1];
 
493
    }else{
 
494
                ($res1,$res2)=$geoip_region_maxmind->region_by_name($param) if $geoip_region_maxmind;
 
495
    }
 
496
        if ($Debug) { debug("  Plugin $PluginName: GetRegionByIp for $param: [${res1}_${res2}]",5); }
468
497
    if ($res2 =~ /\w\w/) { $countryregion=lc("${res1}_${res2}"); }
469
498
    else { $countryregion='unknown'; }
470
499
#       if ($PageBool) { $_region_p{$countryregion}++; }
482
511
    my $param="$_[0]";      # Param must be a hostname
483
512
        # <-----
484
513
        my ($res1,$res2,$countryregion)=();
485
 
        ($res1,$res2)=$geoip_region_maxmind->region_by_name($param) if $geoip_region_maxmind;
486
 
        if ($Debug) { debug("  Plugin geoip_region_maxmind: GetRegionByName for $param: [${res1}_${res2}]",5); }
 
514
        my @res = TmpLookup_geoip_region_maxmind($param);
 
515
    if (@res){
 
516
        $res1 = $res[0];
 
517
        $res2 = $res[1];
 
518
    }else{
 
519
                ($res1,$res2)=$geoip_region_maxmind->region_by_name($param) if $geoip_region_maxmind;
 
520
    }
 
521
        if ($Debug) { debug("  Plugin $PluginName: GetRegionByName for $param: [${res1}_${res2}]",5); }
487
522
    if ($res2 =~ /\w\w/) { $countryregion=lc("${res1}_${res2}"); }
488
523
    else { $countryregion='unknown'; }
489
524
#       if ($PageBool) { $_region_p{$countryregion}++; }
504
539
    my $xmleb=shift;
505
540
        my $countlines=shift;
506
541
        # <-----
507
 
        if ($Debug) { debug(" Plugin geoip_region_maxmind: Begin of PLUGIN_geoip_region_maxmind section"); }
 
542
        if ($Debug) { debug(" Plugin $PluginName: Begin of PLUGIN_$PluginName"); }
508
543
        my @field=();
509
544
        my $count=0;my $countloaded=0;
510
545
        do {
520
555
                @field=split(/\s+/,($xmlold?XMLDecodeFromHisto($_):$_));
521
556
                $countlines++;
522
557
        }
523
 
        until ($field[0] eq 'END_PLUGIN_geoip_region_maxmind' || $field[0] eq "${xmleb}END_PLUGIN_geoip_region_maxmind" || ! $_);
524
 
        if ($field[0] ne 'END_PLUGIN_geoip_region_maxmind' && $field[0] ne "${xmleb}END_PLUGIN_geoip_region_maxmind") { error("History file is corrupted (End of section PLUGIN not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); }
525
 
        if ($Debug) { debug(" Plugin geoip_region_maxmind: End of PLUGIN_geoip_region_maxmind section ($count entries, $countloaded loaded)"); }
 
558
        until ($field[0] eq "END_PLUGIN_$PluginName" || $field[0] eq "${xmleb}END_PLUGIN_$PluginName" || ! $_);
 
559
        if ($field[0] ne "END_PLUGIN_$PluginName" && $field[0] ne "${xmleb}END_PLUGIN_$PluginName") { error("History file is corrupted (End of section PLUGIN not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); }
 
560
        if ($Debug) { debug(" Plugin $PluginName: End of PLUGIN_$PluginName section ($count entries, $countloaded loaded)"); }
526
561
        # ----->
527
562
        return 0;
528
563
}
533
568
#-----------------------------------------------------------------------------
534
569
sub SectionWriteHistory_geoip_region_maxmind {
535
570
    my ($xml,$xmlbb,$xmlbs,$xmlbe,$xmlrb,$xmlrs,$xmlre,$xmleb,$xmlee)=(shift,shift,shift,shift,shift,shift,shift,shift,shift);
536
 
    if ($Debug) { debug(" Plugin geoip_region_maxmind: SectionWriteHistory_geoip_region_maxmind start - ".(scalar keys %_region_h)); }
 
571
    if ($Debug) { debug(" Plugin $PluginName: SectionWriteHistory_$PluginName start - ".(scalar keys %_region_h)); }
537
572
        # <-----
538
573
        print HISTORYTMP "\n";
539
 
        if ($xml) { print HISTORYTMP "<section id='plugin_geoip_region_maxmind'><sortfor>$MAXNBOFSECTIONGIR</sortfor><comment>\n"; }
 
574
        if ($xml) { print HISTORYTMP "<section id='plugin_$PluginName'><sortfor>$MAXNBOFSECTIONGIR</sortfor><comment>\n"; }
540
575
        print HISTORYTMP "# Plugin key - Pages - Hits - Bandwidth - Last access\n";
541
576
        #print HISTORYTMP "# The $MaxNbOfExtra[$extranum] first number of hits are first\n";
542
 
        $ValueInFile{'plugin_geoip_region_maxmind'}=tell HISTORYTMP;
543
 
        print HISTORYTMP "${xmlbb}BEGIN_PLUGIN_geoip_region_maxmind${xmlbs}".(scalar keys %_region_h)."${xmlbe}\n";
 
577
        $ValueInFile{"plugin_$PluginName"}=tell HISTORYTMP;
 
578
        print HISTORYTMP "${xmlbb}BEGIN_PLUGIN_$PluginName${xmlbs}".(scalar keys %_region_h)."${xmlbe}\n";
544
579
        &BuildKeyList($MAXNBOFSECTIONGIR,1,\%_region_h,\%_region_h);
545
580
        my %keysinkeylist=();
546
581
        foreach (@keylist) {
557
592
                #my $lastaccess=$_region_l{$_}||'';
558
593
                print HISTORYTMP "${xmlrb}$_${xmlrs}0${xmlrs}", $_region_h{$_}, "${xmlrs}0${xmlrs}0${xmlre}\n"; next;
559
594
        }
560
 
        print HISTORYTMP "${xmleb}END_PLUGIN_geoip_region_maxmind${xmlee}\n";
 
595
        print HISTORYTMP "${xmleb}END_PLUGIN_$PluginName${xmlee}\n";
561
596
        # ----->
562
597
        return 0;
563
598
}
564
599
 
 
600
#-----------------------------------------------------------------------------
 
601
# PLUGIN FUNCTION: LoadOverrideFile
 
602
# Attempts to load a comma delimited file that will override the GeoIP database
 
603
# Useful for Intranet records
 
604
# CSV format: IP,2-char Country code, region
 
605
#-----------------------------------------------------------------------------
 
606
sub LoadOverrideFile_geoip_region_maxmind{
 
607
        my $filetoload="";
 
608
        if ($OverrideFile){
 
609
                if (!open(GEOIPFILE, $OverrideFile)){
 
610
                        debug("Plugin $PluginName: Unable to open override file: $OverrideFile");
 
611
                        $LoadedOverride = 1;
 
612
                        return;
 
613
                }
 
614
        }else{
 
615
                my $conf = (exists(&Get_Config_Name) ? Get_Config_Name() : $SiteConfig);
 
616
                if ($conf && open(GEOIPFILE,"$DirData/$PluginName.$conf.txt"))  { $filetoload="$DirData/$PluginName.$conf.txt"; }
 
617
                elsif (open(GEOIPFILE,"$DirData/$PluginName.txt"))      { $filetoload="$DirData/$PluginName.txt"; }
 
618
                else { debug("No override file \"$DirData/$PluginName.txt\": $!"); }
 
619
        }
 
620
        if ($filetoload)
 
621
        {
 
622
                # This is the fastest way to load with regexp that I know
 
623
                while (<GEOIPFILE>){
 
624
                        chomp $_;
 
625
                        s/\r//;
 
626
                        my @record = split(",", $_);
 
627
                        # replace quotes if they were used in the file
 
628
                        foreach (@record){ $_ =~ s/"//g; }
 
629
                        # now we need to copy our file values in the order to mimic the lookup values
 
630
                        my @res = ();
 
631
                        $res[0] = $record[1];   # country code
 
632
                        $res[1] = $record[2];   # region code
 
633
                        # store in hash
 
634
                        $TmpDomainLookup{$record[0]} = [@res];
 
635
                }
 
636
                close GEOIPFILE;
 
637
        debug(" Plugin $PluginName: Overload file loaded: ".(scalar keys %TmpDomainLookup)." entries found.");
 
638
        }
 
639
        $LoadedOverride = 1;
 
640
        return;
 
641
}
565
642
 
 
643
#-----------------------------------------------------------------------------
 
644
# PLUGIN FUNCTION: TmpLookup
 
645
# Searches the temporary hash for the parameter value and returns the corresponding
 
646
# GEOIP entry
 
647
#-----------------------------------------------------------------------------
 
648
sub TmpLookup_geoip_region_maxmind(){
 
649
        $param = shift;
 
650
        if (!$LoadedOverride){&LoadOverrideFile_geoip_region_maxmind();}
 
651
        #my @val = ();
 
652
        #if ($geoip_region_maxmind &&
 
653
        #(($type eq 'geoip' && $geoip_region_maxmind->VERSION >= 1.30) || 
 
654
        #  $type eq 'geoippureperl' && $geoip_region_maxmind->VERSION >= 1.17)){
 
655
        #       @val = @{$TmpDomainLookup{$geoip_region_maxmind->get_ip_address($param)}};
 
656
        #}
 
657
    #else {@val = @{$TmpDomainLookup{$param};}}
 
658
    #return @val;
 
659
    if ($TmpDomainLookup{$param}) { return @{$TmpDomainLookup{$param};} }  
 
660
    else { return; }
 
661
}
566
662
 
567
663
1;      # Do not remove this line