mirror of
https://github.com/moodle/moodle.git
synced 2025-04-16 14:02:32 +02:00
Added new structure for iplookups (ie called from logs).
ipatlas is now just a plugin, and we can add other plugins to the same job better.
This commit is contained in:
parent
07875f39ee
commit
f4fb66d7d9
18
iplookup/README.txt
Normal file
18
iplookup/README.txt
Normal file
@ -0,0 +1,18 @@
|
||||
iplookup
|
||||
--------
|
||||
|
||||
These plugins will show you something about an IP address.
|
||||
|
||||
Moodle scripts call the index.php in this directory like this:
|
||||
|
||||
/iplookup/index.php?ip=222.222.222.222&user=1
|
||||
|
||||
Both parameters are optional, they default to the current user.
|
||||
|
||||
index.php loads the lib.php from a specified subdirectory
|
||||
to actually display some sort of map or description.
|
||||
|
||||
The current plugin is selected using $CFG->iplookup.
|
||||
|
||||
Cheers,
|
||||
Martin
|
22
iplookup/hostip/lib.php
Normal file
22
iplookup/hostip/lib.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php // $Id$
|
||||
// Lookup a user using HostIP
|
||||
|
||||
function iplookup_display($ip, $user=0) {
|
||||
|
||||
print_header();
|
||||
if ($user) {
|
||||
if ($user = get_record('user', 'id', $user)) {
|
||||
print_heading(fullname($user).", $user->city, $user->country", 'center', '4');
|
||||
}
|
||||
}
|
||||
|
||||
echo 'Search results: <iframe src="http://www.hostip.info/api/get.html?ip='.$ip.'" height="60" width="300"></iframe>';
|
||||
|
||||
echo '<object data="http://www.hostip.info/map/frame.html?ip='.$ip.'" '.
|
||||
'type="text/html" border="0" width="610" height="330" hspace="0" vspace="0"></object>';
|
||||
|
||||
close_window_button();
|
||||
print_footer('none');
|
||||
}
|
||||
|
||||
?>
|
19
iplookup/index.php
Normal file
19
iplookup/index.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php // $Id$
|
||||
// Do an IP lookup of a user, using selected plugin
|
||||
|
||||
require('../config.php');
|
||||
|
||||
require_login();
|
||||
|
||||
$ip = optional_param('ip', getremoteaddr());
|
||||
$user = optional_param('user', $USER->id);
|
||||
|
||||
if (empty($CFG->iplookup)) {
|
||||
set_config('iplookup', 'ipatlas');
|
||||
}
|
||||
|
||||
require("$CFG->dirroot/iplookup/$CFG->iplookup/lib.php");
|
||||
|
||||
iplookup_display($ip, $user);
|
||||
|
||||
?>
|
340
iplookup/ipatlas/COPYING
Normal file
340
iplookup/ipatlas/COPYING
Normal file
@ -0,0 +1,340 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
7
iplookup/ipatlas/MOODLECHANGES
Normal file
7
iplookup/ipatlas/MOODLECHANGES
Normal file
@ -0,0 +1,7 @@
|
||||
To make this program fit into Moodle, I:
|
||||
|
||||
- deleted the black and white earth image
|
||||
- modified plotconf.inc slightly to use Moodle configs
|
||||
- modified plot.php slightly to use Moodle's background colour
|
||||
|
||||
Martin Dougiamas, 26/8/2002
|
60
iplookup/ipatlas/README
Normal file
60
iplookup/ipatlas/README
Normal file
@ -0,0 +1,60 @@
|
||||
IP-Atlas version 1.0
|
||||
-=----=-
|
||||
|
||||
Description
|
||||
-----------
|
||||
This script uses NetGeo to plot a host on the globe.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
PHP 4 and GD (Optional).
|
||||
|
||||
The GD library is available at http://www.boutell.com/gd/ and PHP is at
|
||||
http://www.php.net/
|
||||
|
||||
Installation
|
||||
------------
|
||||
Put these files somewhere on your webserver, and point your browser to plot.php
|
||||
|
||||
Note: You can symlink "ln -s plot.php index.php" if you need to. If you
|
||||
have any problems running it, send an email to ivan@xpenguin.com
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
All options can be edited in plotconf.inc.
|
||||
|
||||
If you want to integrate IP-Atlas into your website, open up plot.php and
|
||||
ip-atlas_prefs.php and edit the parts where it starts writing the html
|
||||
(find for "<html>") and where it ends (</html>). You should replace theses
|
||||
with your site template headers/footers.
|
||||
|
||||
You can create a new language file for IP-Atlas if you follow the directions
|
||||
inside any language file in the languages/ directory.
|
||||
|
||||
If you create a new language file, please email it to ivan@xpenguin.com so
|
||||
it can be included in the next version.
|
||||
|
||||
Bugs
|
||||
----
|
||||
1. The famous windows bug (also happens in other cirumstances)
|
||||
|
||||
If nothing appears when running the script on windows, open up plotconf.inc
|
||||
and change the $trygd variable to "0".
|
||||
|
||||
Contributions
|
||||
-------------
|
||||
Thanks to Sten Kalenda (sten@ipjam.com) for adding security features and
|
||||
cleaning up the code.
|
||||
|
||||
Thanks to Armin Kunaschik (Armin.Kunaschik@varetis.de) for his proxy patch
|
||||
that enables this program to run behind a firewall.
|
||||
|
||||
Thanks to Daniel Quinlan (daniel@chaosengine.net) for a patch that fixes
|
||||
many problems on windows.
|
||||
|
||||
Also thanks to many users for reporting bugs.
|
||||
|
||||
Copyright
|
||||
---------
|
||||
IP-Atlas is Copyright (c) 2002 Ivan Kozik, and can be redistributed under
|
||||
the GPL.
|
4
iplookup/ipatlas/README.MOODLE.txt
Normal file
4
iplookup/ipatlas/README.MOODLE.txt
Normal file
@ -0,0 +1,4 @@
|
||||
The database for this is REALLY old now and this service is
|
||||
next to useless.
|
||||
|
||||
Included here for backward compatibility.
|
243
iplookup/ipatlas/countries.txt
Normal file
243
iplookup/ipatlas/countries.txt
Normal file
@ -0,0 +1,243 @@
|
||||
AD Andorra
|
||||
AE United Arab Emirates
|
||||
AF Afghanistan
|
||||
AG Antigua and Barbuda
|
||||
AI Anguilla
|
||||
AL Albania
|
||||
AM Armenia
|
||||
AN Netherlands Antilles
|
||||
AO Angola
|
||||
AQ Antarctica
|
||||
AR Argentina
|
||||
AS American Samoa
|
||||
AT Austria
|
||||
AU Australia
|
||||
AW Aruba
|
||||
AZ Azerbaijan
|
||||
BA Bosnia and Herzegovina
|
||||
BB Barbados
|
||||
BD Bangladesh
|
||||
BE Belgium
|
||||
BF Burkina Faso
|
||||
BG Bulgaria
|
||||
BH Bahrain
|
||||
BI Burundi
|
||||
BJ Benin
|
||||
BM Bermuda
|
||||
BN Brunei Darussalam
|
||||
BO Bolivia
|
||||
BR Brazil
|
||||
BS Bahamas
|
||||
BT Bhutan
|
||||
BV Bouvet Island
|
||||
BW Botswana
|
||||
BY Belarus
|
||||
BZ Belize
|
||||
CA Canada
|
||||
CC Cocos (Keeling) Islands
|
||||
CF Central African Republic
|
||||
CG Congo
|
||||
CH Switzerland
|
||||
CI Cote D'Ivoire (Ivory Coast)
|
||||
CK Cook Islands
|
||||
CL Chile
|
||||
CM Cameroon
|
||||
CN China
|
||||
CO Colombia
|
||||
CR Costa Rica
|
||||
CS Czechoslovakia (former)
|
||||
CU Cuba
|
||||
CV Cape Verde
|
||||
CX Christmas Island
|
||||
CY Cyprus
|
||||
CZ Czech Republic
|
||||
DE Germany
|
||||
DJ Djibouti
|
||||
DK Denmark
|
||||
DM Dominica
|
||||
DO Dominican Republic
|
||||
DZ Algeria
|
||||
EC Ecuador
|
||||
EE Estonia
|
||||
EG Egypt
|
||||
EH Western Sahara
|
||||
ER Eritrea
|
||||
ES Spain
|
||||
ET Ethiopia
|
||||
FI Finland
|
||||
FJ Fiji
|
||||
FK Falkland Islands (Malvinas)
|
||||
FM Micronesia
|
||||
FO Faroe Islands
|
||||
FR France
|
||||
FX France, Metropolitan
|
||||
GA Gabon
|
||||
GB Great Britain (UK)
|
||||
GD Grenada
|
||||
GE Georgia
|
||||
GF French Guiana
|
||||
GH Ghana
|
||||
GI Gibraltar
|
||||
GL Greenland
|
||||
GM Gambia
|
||||
GN Guinea
|
||||
GP Guadeloupe
|
||||
GQ Equatorial Guinea
|
||||
GR Greece
|
||||
GS S. Georgia and S. Sandwich Isls.
|
||||
GT Guatemala
|
||||
GU Guam
|
||||
GW Guinea-Bissau
|
||||
GY Guyana
|
||||
HK Hong Kong
|
||||
HM Heard and McDonald Islands
|
||||
HN Honduras
|
||||
HR Croatia (Hrvatska)
|
||||
HT Haiti
|
||||
HU Hungary
|
||||
ID Indonesia
|
||||
IE Ireland
|
||||
IL Israel
|
||||
IN India
|
||||
IO British Indian Ocean Territory
|
||||
IQ Iraq
|
||||
IR Iran
|
||||
IS Iceland
|
||||
IT Italy
|
||||
JM Jamaica
|
||||
JO Jordan
|
||||
JP Japan
|
||||
KE Kenya
|
||||
KG Kyrgyzstan
|
||||
KH Cambodia
|
||||
KI Kiribati
|
||||
KM Comoros
|
||||
KN Saint Kitts and Nevis
|
||||
KP Korea (North)
|
||||
KR Korea (South)
|
||||
KW Kuwait
|
||||
KY Cayman Islands
|
||||
KZ Kazakhstan
|
||||
LA Laos
|
||||
LB Lebanon
|
||||
LC Saint Lucia
|
||||
LI Liechtenstein
|
||||
LK Sri Lanka
|
||||
LR Liberia
|
||||
LS Lesotho
|
||||
LT Lithuania
|
||||
LU Luxembourg
|
||||
LV Latvia
|
||||
LY Libya
|
||||
MA Morocco
|
||||
MC Monaco
|
||||
MD Moldova
|
||||
MG Madagascar
|
||||
MH Marshall Islands
|
||||
MK Macedonia
|
||||
ML Mali
|
||||
MM Myanmar
|
||||
MN Mongolia
|
||||
MO Macau
|
||||
MP Northern Mariana Islands
|
||||
MQ Martinique
|
||||
MR Mauritania
|
||||
MS Montserrat
|
||||
MT Malta
|
||||
MU Mauritius
|
||||
MV Maldives
|
||||
MW Malawi
|
||||
MX Mexico
|
||||
MY Malaysia
|
||||
MZ Mozambique
|
||||
NA Namibia
|
||||
NC New Caledonia
|
||||
NE Niger
|
||||
NF Norfolk Island
|
||||
NG Nigeria
|
||||
NI Nicaragua
|
||||
NL Netherlands
|
||||
NO Norway
|
||||
NP Nepal
|
||||
NR Nauru
|
||||
NT Neutral Zone
|
||||
NU Niue
|
||||
NZ New Zealand (Aotearoa)
|
||||
OM Oman
|
||||
PA Panama
|
||||
PE Peru
|
||||
PF French Polynesia
|
||||
PG Papua New Guinea
|
||||
PH Philippines
|
||||
PK Pakistan
|
||||
PL Poland
|
||||
PM St. Pierre and Miquelon
|
||||
PN Pitcairn
|
||||
PR Puerto Rico
|
||||
PT Portugal
|
||||
PW Palau
|
||||
PY Paraguay
|
||||
QA Qatar
|
||||
RE Reunion
|
||||
RO Romania
|
||||
RU Russian Federation
|
||||
RW Rwanda
|
||||
SA Saudi Arabia
|
||||
Sb Solomon Islands
|
||||
SC Seychelles
|
||||
SD Sudan
|
||||
SE Sweden
|
||||
SG Singapore
|
||||
SH St. Helena
|
||||
SI Slovenia
|
||||
SJ Svalbard and Jan Mayen Islands
|
||||
SK Slovak Republic
|
||||
SL Sierra Leone
|
||||
SM San Marino
|
||||
SN Senegal
|
||||
SO Somalia
|
||||
SR Suriname
|
||||
ST Sao Tome and Principe
|
||||
SU USSR (former)
|
||||
SV El Salvador
|
||||
SY Syria
|
||||
SZ Swaziland
|
||||
TC Turks and Caicos Islands
|
||||
TD Chad
|
||||
TF French Southern Territories
|
||||
TG Togo
|
||||
TH Thailand
|
||||
TJ Tajikistan
|
||||
TK Tokelau
|
||||
TM Turkmenistan
|
||||
TN Tunisia
|
||||
TO Tonga
|
||||
TP East Timor
|
||||
TR Turkey
|
||||
TT Trinidad and Tobago
|
||||
TV Tuvalu
|
||||
TW Taiwan
|
||||
TZ Tanzania
|
||||
UA Ukraine
|
||||
UG Uganda
|
||||
UK United Kingdom
|
||||
UM US Minor Outlying Islands
|
||||
US United States
|
||||
UY Uruguay
|
||||
UZ Uzbekistan
|
||||
VA Vatican City State (Holy See)
|
||||
VC Saint Vincent and the Grenadines
|
||||
VE Venezuela
|
||||
VG Virgin Islands (British)
|
||||
VI Virgin Islands (U.S.)
|
||||
VN Viet Nam
|
||||
VU Vanuatu
|
||||
WF Wallis and Futuna Islands
|
||||
WS Samoa
|
||||
YE Yemen
|
||||
YT Mayotte
|
||||
YU Yugoslavia
|
||||
ZA South Africa
|
||||
ZM Zambia
|
||||
ZR Zaire
|
||||
ZW Zimbabwe
|
BIN
iplookup/ipatlas/earth_620.jpg
Normal file
BIN
iplookup/ipatlas/earth_620.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
4
iplookup/ipatlas/footer.inc
Normal file
4
iplookup/ipatlas/footer.inc
Normal file
@ -0,0 +1,4 @@
|
||||
<img src="hr.gif" width="100%" height="2" vspace="2">
|
||||
<table align="right" width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr><td align="right" width="100%"><a href="http://www.xpenguin.com/ip-atlas.php">IP-Atlas</a> <?php echo $version; ?></td></tr>
|
||||
</table>
|
BIN
iplookup/ipatlas/hr.gif
Normal file
BIN
iplookup/ipatlas/hr.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 35 B |
5
iplookup/ipatlas/ip-atlas.css
Normal file
5
iplookup/ipatlas/ip-atlas.css
Normal file
@ -0,0 +1,5 @@
|
||||
A:link { font-weight: bold; text-decoration: none; color: #005177; }
|
||||
A:visited { text-decoration: none; color: #005177; font-weight: bold; }
|
||||
A:hover { text-decoration: underline; }
|
||||
BODY { font-family: Verdana, Helvetica, Arial, sans-serif; font-size:12px; }
|
||||
TD { font-family: Verdana, Helvetica, Arial, sans-serif; color: #000000; font-size: 12px; }
|
252
iplookup/ipatlas/ip-atlas_prefs.php
Normal file
252
iplookup/ipatlas/ip-atlas_prefs.php
Normal file
@ -0,0 +1,252 @@
|
||||
<?php
|
||||
|
||||
include("plotconf.inc");
|
||||
include("plot.inc");
|
||||
|
||||
if($CFG->debug > 1) {
|
||||
error_reporting(E_ALL);
|
||||
} else {
|
||||
error_reporting(E_ERROR);
|
||||
}
|
||||
|
||||
if (isset($HTTP_GET_VARS["lastquery"])){
|
||||
$HTTP_GET_VARS["lastquery"] = clean_param($HTTP_GET_VARS["lastquery"], PARAM_HOST);
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
|
||||
if(shouldrun($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
|
||||
$drawmode = "GD";
|
||||
} else {
|
||||
$drawmode = "CSS";
|
||||
}
|
||||
|
||||
if(isset($HTTP_POST_VARS["button"])) {
|
||||
|
||||
// cleanup post data
|
||||
$HTTP_POST_VARS["shape"] = clean_param($HTTP_POST_VARS["shape"], PARAM_ALPHA);
|
||||
$HTTP_POST_VARS["color"] = clean_param($HTTP_POST_VARS["color"], PARAM_ALPHA);
|
||||
$HTTP_POST_VARS["color"] = clean_param($HTTP_POST_VARS["size"], PARAM_INT);
|
||||
$HTTP_POST_VARS["earthimage"] = clean_param($HTTP_POST_VARS["earthimage"], PARAM_FILE);
|
||||
$HTTP_POST_VARS["cssdot"] = clean_param($HTTP_POST_VARS["cssdot"], PARAM_FILE);
|
||||
$HTTP_POST_VARS["seldrawmode"] = clean_param($HTTP_POST_VARS["seldrawmode"],PARAM_ALPHA);
|
||||
// unset the earth image if we don't have it in our list
|
||||
if (!in_array($HTTP_POST_VARS["earthimage"],$earthimages)) {
|
||||
unset($HTTP_POST_VARS["earthimage"]);
|
||||
}
|
||||
|
||||
|
||||
// save data from the POST
|
||||
setcookie ("atlasprefs", "", time() - 36000000);
|
||||
setcookie ("atlasprefs", "$HTTP_POST_VARS[shape]:$HTTP_POST_VARS[color]:$HTTP_POST_VARS[size]:$HTTP_POST_VARS[earthimage]:$HTTP_POST_VARS[cssdot]:$HTTP_POST_VARS[seldrawmode]", time() + 36000000, $cookiepath);
|
||||
|
||||
$setshape = $HTTP_POST_VARS["shape"];
|
||||
$setcolor = $HTTP_POST_VARS["color"];
|
||||
$setsize = $HTTP_POST_VARS["size"];
|
||||
$setearthimage = $HTTP_POST_VARS["earthimage"];
|
||||
$setcssdot = $HTTP_POST_VARS["cssdot"];
|
||||
$setseldrawmode = $HTTP_POST_VARS["seldrawmode"];
|
||||
|
||||
|
||||
|
||||
if($setseldrawmode == "1") {
|
||||
$drawmode = "GD";
|
||||
} else {
|
||||
$drawmode = "CSS";
|
||||
}
|
||||
|
||||
} elseif(isset($HTTP_COOKIE_VARS["atlasprefs"]) && validcookie($HTTP_COOKIE_VARS["atlasprefs"])) {
|
||||
// get data from the cookie
|
||||
@list($setshape, $setcolor, $setsize, $setearthimage, $setcssdot, $setseldrawmode) = split(":", $HTTP_COOKIE_VARS["atlasprefs"]);
|
||||
} else {
|
||||
$setshape = "Diamond";
|
||||
$setsize = "3";
|
||||
$setcolor = "red";
|
||||
$setearthimage = $earthimages[$defaultimage];
|
||||
$setcssdot = "reddot.gif";
|
||||
|
||||
if(shouldrun($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
|
||||
$setseldrawmode = 1;
|
||||
} else {
|
||||
$setseldrawmode = 0;
|
||||
}
|
||||
|
||||
// override old cookie if there is post data
|
||||
|
||||
if(isset($HTTP_POST_VARS["seldrawmode"])) {
|
||||
$setsetdrawmode = $HTTP_POST_VARS["seldrawmode"];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php # START HTML
|
||||
?>
|
||||
|
||||
<html><head><title><?php echo t("IP-Atlas Preferences") ?></title>
|
||||
|
||||
<!-- your head tags here -->
|
||||
<link rel="Stylesheet" href="ip-atlas.css">
|
||||
</head><body bgcolor="#ffffff">
|
||||
|
||||
</head><body>
|
||||
|
||||
<b><?php echo t("IP-Atlas preferences"); ?></b> <?php echo t("(cookie based)"); ?><br /><br />
|
||||
|
||||
<?php
|
||||
if(isset($HTTP_POST_VARS["button"])) {
|
||||
print t("Your settings have been saved. You can now try"); ?> <a href="plot.php<?php if(isset($HTTP_GET_VARS["lastquery"])) { echo "?address=$HTTP_GET_VARS[lastquery]"; } ?>"><?php print t("plotting something.")."</a>"."<br /><br />";
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<form action="ip-atlas_prefs.php<?php if(isset($HTTP_GET_VARS["lastquery"])) { echo "?lastquery=$HTTP_GET_VARS[lastquery]"; } ?>" method="POST">
|
||||
|
||||
<?php if(istheregd()) {
|
||||
echo t("Draw mode (defaults guessed for your browser):");
|
||||
|
||||
print "<br /><select name=\"seldrawmode\">";
|
||||
|
||||
if(!isset($setseldrawmode)) {
|
||||
if(shouldrun($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
|
||||
$setseldrawmode = 1;
|
||||
} else {
|
||||
$setseldrawmode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if($setseldrawmode == "1") {
|
||||
echo "<option value=\"1\" selected>GD";
|
||||
echo "<option value=\"0\">CSS";
|
||||
} elseif($setseldrawmode == "0") {
|
||||
echo "<option value=\"1\">GD";
|
||||
echo "<option value=\"0\" selected>CSS";
|
||||
}
|
||||
|
||||
print "</select><br /><br />";
|
||||
|
||||
} else {
|
||||
|
||||
print "<input type=\"hidden\" name=\"seldrawmode\" value=\"0\">";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php echo t("Pointer Preferences (the dot that marks lat/lon):"); ?><br />
|
||||
<?php
|
||||
if($drawmode == "GD") {
|
||||
print '
|
||||
<input type="hidden" name="cssdot" value="reddot.gif">
|
||||
|
||||
<table><tr>
|
||||
|
||||
<td>'.t("Shape:").'</td><td><select name="shape">
|
||||
';
|
||||
|
||||
$shapes = array("Diamond", "Diamond Outline", "Square", "Square Outline", "Cross");
|
||||
foreach($shapes as $curshape) {
|
||||
|
||||
if($setshape == $curshape) {
|
||||
print "<option value=\"$curshape\" selected>".t($curshape);
|
||||
} else {
|
||||
print "<option value=\"$curshape\">".t($curshape);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print "</select></td></tr><tr><td>".t("Size:")."</td><td><select name=\"size\">";
|
||||
|
||||
$sizes = array("2", "3", "4", "5", "6", "7", "8");
|
||||
foreach($sizes as $cursize) {
|
||||
|
||||
if($setsize == $cursize) {
|
||||
print "<option value=\"$cursize\" selected>$cursize";
|
||||
} else {
|
||||
print "<option value=\"$cursize\">$cursize";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print "</select></td></tr><tr><td>".t("Color:")."</td><td><select name=\"color\">";
|
||||
|
||||
$colors = array("red", "white", "yellow", "magenta", "cyan", "green", "violet");
|
||||
foreach($colors as $curcolor) {
|
||||
|
||||
if($setcolor == $curcolor) {
|
||||
print "<option value=\"$curcolor\" selected>".t($curcolor);
|
||||
} else {
|
||||
print "<option value=\"$curcolor\">".t($curcolor);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print "
|
||||
</select></td></tr></table>
|
||||
";
|
||||
|
||||
} elseif($drawmode == "CSS") {
|
||||
|
||||
print t("Pointer:")." <select name=\"cssdot\">";
|
||||
|
||||
foreach($cssdots as $curdot) {
|
||||
|
||||
list($filename, $curdot, , ) = split(":", $curdot);
|
||||
|
||||
if($setcssdot == $filename) {
|
||||
print "<option value=\"$filename\" selected>$curdot";
|
||||
} else {
|
||||
print "<option value=\"$filename\">$curdot";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print "</select><br />";
|
||||
|
||||
print '
|
||||
<input type="hidden" name="shape" value="Diamond">
|
||||
<input type="hidden" name="color" value="Red">
|
||||
<input type="hidden" name="size" value="3">
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<br />
|
||||
|
||||
|
||||
|
||||
<?php echo t("Other Preferences:") ?><br />
|
||||
<?php echo t("Earth Image:") ?>
|
||||
<select name="earthimage">
|
||||
|
||||
<?php
|
||||
|
||||
foreach($earthimages as $curentry) {
|
||||
|
||||
list($curfile, $curname, , ) = split(":", $curentry);
|
||||
|
||||
if($setearthimage == $curfile) {
|
||||
print "<option value=\"$curfile\" selected>$curname";
|
||||
} else {
|
||||
print "<option value=\"$curfile\">$curname";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</select>
|
||||
<br /><br />
|
||||
<input type="Submit" name="button" value="<?php echo t("Save") ?>">
|
||||
|
||||
<div align="right">
|
||||
[ <a href="plot.php<?php if(isset($HTTP_GET_VARS["lastquery"])) { echo "?address=$HTTP_GET_VARS[lastquery]"; } ?>"><?php echo t("main") ?></a> ]<br /><br />
|
||||
</div>
|
||||
<?php include("footer.inc"); ?>
|
||||
</body></html>
|
182
iplookup/ipatlas/languages/messages.blank.inc
Normal file
182
iplookup/ipatlas/languages/messages.blank.inc
Normal file
@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|
||||
Blank Language File
|
||||
|
||||
copy this language file from messages.blank.inc to
|
||||
messages.<country code>.inc.
|
||||
|
||||
please email new language files to ivan@xpenguin.com
|
||||
copy a language file to messages.<cc>.inc and \
|
||||
edit what $p is on encountering an english phrase.
|
||||
|
||||
please notice the punctuation and capitilization.
|
||||
|
||||
change the $language variable in plotconf.inc after
|
||||
creating a language file.
|
||||
|
||||
*/
|
||||
|
||||
function lookup($phrase) {
|
||||
switch($phrase) {
|
||||
|
||||
# start translating the $p here
|
||||
|
||||
case "Plotting" :
|
||||
$p = ""; break;
|
||||
|
||||
case "preferences" :
|
||||
$p = ""; break;
|
||||
|
||||
case "locate me" :
|
||||
$p = ""; break;
|
||||
|
||||
case "IP/Hostname:" :
|
||||
$p = ""; break;
|
||||
|
||||
case "You at" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Submit" :
|
||||
$p = ""; break;
|
||||
|
||||
case "main" :
|
||||
$p = ""; break;
|
||||
|
||||
# Used in context "(host) is located in"
|
||||
case "is" :
|
||||
$p = ""; break;
|
||||
|
||||
# Used in context "You at (host) are located in"
|
||||
case "are" :
|
||||
$p = ""; break;
|
||||
|
||||
case "located in" :
|
||||
$p = ""; break;
|
||||
|
||||
case "cannot be located." :
|
||||
$p = ""; break;
|
||||
|
||||
case "cannot be resolved." :
|
||||
$p = ""; break;
|
||||
|
||||
case "is a host in the private IP address range." :
|
||||
$p = ""; break;
|
||||
|
||||
case "does not resolve." :
|
||||
$p = ""; break;
|
||||
|
||||
case "is not a valid IP address." :
|
||||
$p = ""; break;
|
||||
|
||||
case "Temporary lookup failure." :
|
||||
$p = ""; break;
|
||||
|
||||
case "IP-Atlas Preferences" :
|
||||
$p = ""; break;
|
||||
|
||||
# make the 'p' lowercase if possible in your language
|
||||
|
||||
case "IP-Atlas preferences" :
|
||||
$p = ""; break;
|
||||
|
||||
case "(cookie based)" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Draw mode (defaults guessed for your browser):" :
|
||||
$p = ""; break;
|
||||
|
||||
// next two phrases are combined
|
||||
case "Your settings have been saved. You can now try" :
|
||||
$p = ""; break;
|
||||
|
||||
case "plotting something." :
|
||||
$p = ""; break;
|
||||
|
||||
case "Pointer Preferences (the dot that marks lat/lon):" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Shape:" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Size:" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Color:" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Pointer:" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Other Preferences:" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Earth Image:" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Color" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Grayscale" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Save" :
|
||||
$p = ""; break;
|
||||
|
||||
# shape names:
|
||||
case "Diamond" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Diamond Outline" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Square" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Square Outline" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Cross" :
|
||||
$p = ""; break;
|
||||
|
||||
# colors:
|
||||
|
||||
case "red" :
|
||||
$p = ""; break;
|
||||
|
||||
case "white" :
|
||||
$p = ""; break;
|
||||
|
||||
case "yellow" :
|
||||
$p = ""; break;
|
||||
|
||||
case "magenta" :
|
||||
$p = ""; break;
|
||||
|
||||
case "cyan" :
|
||||
$p = ""; break;
|
||||
|
||||
case "green" :
|
||||
$p = ""; break;
|
||||
|
||||
case "violet" :
|
||||
$p = ""; break;
|
||||
|
||||
# stop here
|
||||
|
||||
// return in english if the phrase couldn't be found
|
||||
default:
|
||||
$p = $phrase; break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// return english if match was blank
|
||||
if($p == "") { $p = $phrase; }
|
||||
|
||||
return $p;
|
||||
|
||||
}
|
||||
|
||||
?>
|
185
iplookup/ipatlas/languages/messages.it.inc
Normal file
185
iplookup/ipatlas/languages/messages.it.inc
Normal file
@ -0,0 +1,185 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|
||||
Italian Language File
|
||||
|
||||
I forgot who started translating this file, email me so i can put your
|
||||
email here.
|
||||
|
||||
please email new language files to ivan@xpenguin.com
|
||||
copy a language file to messages.<cc>.inc and \
|
||||
edit what $p is on encountering an english phrase.
|
||||
|
||||
you can start off with messages.blank.inc
|
||||
|
||||
please notice the punctuation and capitilization.
|
||||
|
||||
change the $language variable in plotconf.inc after
|
||||
creating a language file.
|
||||
|
||||
*/
|
||||
|
||||
function lookup($phrase) {
|
||||
switch($phrase) {
|
||||
|
||||
# start translating the $p here
|
||||
|
||||
case "Plotting" :
|
||||
$p = "Mappa di"; break;
|
||||
|
||||
case "preferences" :
|
||||
$p = "preferenze"; break;
|
||||
|
||||
case "locate me" :
|
||||
$p = "localizzami"; break;
|
||||
|
||||
case "IP/Hostname:" :
|
||||
$p = "IP/Nome host:"; break;
|
||||
|
||||
case "You at" :
|
||||
$p = "Tu"; break;
|
||||
|
||||
case "Submit" :
|
||||
$p = ""; break;
|
||||
|
||||
case "main" :
|
||||
$p = ""; break;
|
||||
|
||||
# Used in context "(host) is located in"
|
||||
case "is" :
|
||||
$p = "è"; break;
|
||||
|
||||
# Used in context "You at (host) are located in"
|
||||
case "are" :
|
||||
$p = "sei"; break;
|
||||
|
||||
case "located in" :
|
||||
$p = "stato localizzato in"; break;
|
||||
|
||||
case "cannot be located." :
|
||||
$p = "non può essere localizzato."; break;
|
||||
|
||||
case "cannot be resolved." :
|
||||
$p = "non può essere risolto."; break;
|
||||
|
||||
case "is a host in the private IP address range." :
|
||||
$p = "è un host in un range di IP privati."; break;
|
||||
|
||||
case "does not resolve." :
|
||||
$p = "irrisolvibile."; break;
|
||||
|
||||
case "is not a valid IP address." :
|
||||
$p = "non è un indirizzo IP valido."; break;
|
||||
|
||||
case "Temporary lookup failure." :
|
||||
$p = "Errore temporaneo di lookup."; break;
|
||||
|
||||
case "IP-Atlas Preferences" :
|
||||
$p = "Preferenze IP-Atlas"; break;
|
||||
|
||||
# make the 'p' lowercase if possible in your language
|
||||
|
||||
case "IP-Atlas preferences" :
|
||||
$p = "Preferenze IP-Atlas"; break;
|
||||
|
||||
case "(cookie based)" :
|
||||
$p = "(basato su cookie)"; break;
|
||||
|
||||
case "Draw mode (defaults guessed for your browser):" :
|
||||
$p = ""; break;
|
||||
|
||||
// next two phrases are combined
|
||||
case "Your settings have been saved. You can now try" :
|
||||
$p = "Le tue impostazioni sono state salvate "; break;
|
||||
|
||||
case "plotting something." :
|
||||
$p = "torna indietro."; break;
|
||||
|
||||
case "Pointer Preferences (the dot that marks lat/lon):" :
|
||||
$p = "Preferenze puntatore (il simbolo che indica la lat/lon):"; break;
|
||||
|
||||
case "Shape:" :
|
||||
$p = "Forma:"; break;
|
||||
|
||||
case "Size:" :
|
||||
$p = "Dimensione:"; break;
|
||||
|
||||
case "Color:" :
|
||||
$p = "Colore:"; break;
|
||||
|
||||
case "Pointer:" :
|
||||
$p = "Puntatore:"; break;
|
||||
|
||||
# any help here?
|
||||
|
||||
case "Other Preferences:" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Earth Image:" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Color" :
|
||||
$p = "Colore"; break;
|
||||
|
||||
case "Grayscale" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Save" :
|
||||
$p = ""; break;
|
||||
|
||||
# shape names:
|
||||
case "Diamond" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Diamond Outline" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Square" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Square Outline" :
|
||||
$p = ""; break;
|
||||
|
||||
case "Cross" :
|
||||
$p = ""; break;
|
||||
|
||||
# colors:
|
||||
|
||||
case "red" :
|
||||
$p = ""; break;
|
||||
|
||||
case "white" :
|
||||
$p = ""; break;
|
||||
|
||||
case "yellow" :
|
||||
$p = ""; break;
|
||||
|
||||
case "magenta" :
|
||||
$p = ""; break;
|
||||
|
||||
case "cyan" :
|
||||
$p = ""; break;
|
||||
|
||||
case "green" :
|
||||
$p = ""; break;
|
||||
|
||||
case "violet" :
|
||||
$p = ""; break;
|
||||
|
||||
# stop here
|
||||
|
||||
// return in english if the phrase couldn't be found
|
||||
default:
|
||||
$p = $phrase; break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if($p == "") { $p = $phrase; }
|
||||
|
||||
return $p;
|
||||
|
||||
}
|
||||
|
||||
?>
|
13
iplookup/ipatlas/lib.php
Normal file
13
iplookup/ipatlas/lib.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php // $Id$
|
||||
// Lookup a user using ipatlas and NetGeo
|
||||
|
||||
// The database for this is REALLY old now and this service is
|
||||
// next to useless.
|
||||
|
||||
function iplookup_display($ip, $user=0) {
|
||||
global $CFG;
|
||||
|
||||
redirect($CFG->wwwroot.'/iplookup/ipatlas/plot.php?address='.$ip.'&user='.$user);
|
||||
}
|
||||
|
||||
?>
|
398
iplookup/ipatlas/plot.inc
Normal file
398
iplookup/ipatlas/plot.inc
Normal file
@ -0,0 +1,398 @@
|
||||
<?php
|
||||
|
||||
$version = "1.0";
|
||||
|
||||
// check for bad agents immidietly
|
||||
$blockbadagents=1;
|
||||
if($blockbadagents == 1) {
|
||||
// those metaquery assholes at t-dialin and others can't
|
||||
// get another dumber using the default user-agent, can they?
|
||||
|
||||
$agent = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
|
||||
|
||||
if(
|
||||
strstr("libwww-perl", $agent) ||
|
||||
strstr("lwp-trivial", $agent) ||
|
||||
strstr("LWP::Simple", $agent) ||
|
||||
strstr("PHP/", $agent)) {
|
||||
|
||||
// goodbye
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function s10_rfc_1918_ip($in) {
|
||||
|
||||
if (ereg('^(127\.)', $in, $part)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (ereg('^(10\.)', $in, $part)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (ereg('^(192\.168\.)', $in, $part)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (ereg('^(172\.)' . '([0-9]{1,3})', $in, $part)) {
|
||||
if(($part[2] > 15) and ($part[2] < 32)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
function stuffanalyze($stuff) {
|
||||
|
||||
$stuff2[0] = array_values(preg_grep ("/CITY:/", $stuff)) or die("Sorry, but the lookup for this IP address failed! (CITY)");
|
||||
$stuff2[1] = array_values(preg_grep ("/STATE:/", $stuff)) or die("Sorry, but the lookup for this IP address failed! (STATE)");
|
||||
$stuff2[2] = array_values(preg_grep ("/COUNTRY:/", $stuff)) or die("Sorry, but the lookup for this IP address failed! (COUNTRY)");
|
||||
$stuff2[3] = array_values(preg_grep ("/LAT:/", $stuff)) or die("Sorry, but the lookup for this IP address failed! (LAT)");
|
||||
$stuff2[4] = array_values(preg_grep ("/LONG:/", $stuff)) or die("Sorry, but the lookup for this IP address failed! (LONG)");
|
||||
|
||||
// all the stuff2 values are actually arrays, making the following code look like crap
|
||||
|
||||
// the power of $count
|
||||
|
||||
if(isset($stuff2[0][0])) {
|
||||
|
||||
for ($count = 0; $count < count($stuff2); $count++) {
|
||||
$stuff2[$count] = $stuff2[$count][0];
|
||||
$stuff2[$count] = ucwords(strtolower(trim(substr(substr($stuff2[$count], 15), 0, -5))));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// if no data was found
|
||||
$stuff2 = array("bad", "bad", "bad", "bad", "bad");
|
||||
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
|
||||
return $stuff2;
|
||||
|
||||
}
|
||||
|
||||
function getlatdata($ip) {
|
||||
|
||||
global $firewall_host;
|
||||
global $firewall_port;
|
||||
global $use_firewall;
|
||||
|
||||
|
||||
$data = array("");
|
||||
|
||||
if ($use_firewall) {
|
||||
|
||||
$fp = fsockopen ($firewall_host, $firewall_port, $errno, $errstr, 30) or die("Could not open socket to proxy");
|
||||
if (!$fp) {
|
||||
echo "$errstr ($errno)<br>\n";
|
||||
} else {
|
||||
fputs ($fp, "GET http://netgeo.caida.org/perl/netgeo.cgi?target=$ip HTTP/1.0\r\nHost: netgeo.caida.org\r\n\r\n") or die("Could not write to socket");
|
||||
while (!feof($fp)) {
|
||||
$packet = fgets ($fp,128) or die("Could not read from socket");
|
||||
array_push($data, $packet) or die("Could not push data into array");
|
||||
}
|
||||
fclose ($fp);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$fp = fsockopen ("netgeo.caida.org", 80, $errno, $errstr, 30) or die("Could not open socket to caida.org");
|
||||
if (!$fp) {
|
||||
echo "$errstr ($errno)<br>\n";
|
||||
} else {
|
||||
fputs ($fp, "GET /perl/netgeo.cgi?target=$ip HTTP/1.0\r\nHost: netgeo.caida.org\r\n\r\n") or die("Could not write to socket");
|
||||
while (!feof($fp)) {
|
||||
$packet = fgets ($fp,128) or die("Could not read from socket");
|
||||
array_push($data, $packet) or die("Could not push socket data into array");
|
||||
}
|
||||
fclose ($fp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// make it an array
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
function finddot($name, $cssdots, $defaultdot) {
|
||||
foreach($cssdots as $x) {
|
||||
list($filename, , $width, $height) = split(":", $x);
|
||||
if($filename == $name) { $found = 1; $return = array($name, $width, $height); }
|
||||
}
|
||||
if(isset($found)) {
|
||||
return $return;
|
||||
} else {
|
||||
$dott = $cssdots[$defaultdot];
|
||||
list($dott, , $width, $height) = split(":", $dott);
|
||||
return array($dott, $width, $height);
|
||||
}
|
||||
}
|
||||
|
||||
function getlocationcoords($lat, $lon, $width, $height) {
|
||||
// some cartographers weren't mathematicians, up is apparently negative to them
|
||||
$lat = ($lat * -1);
|
||||
|
||||
$lat = ($lat + 90);
|
||||
$lon = ($lon + 180);
|
||||
$x = ($lon * ($width / 360));
|
||||
$y = ($lat * ($height / 180));
|
||||
|
||||
$x = round($x);
|
||||
$y = round($y);
|
||||
return array($x, $y);
|
||||
}
|
||||
|
||||
function getimagecoords($earthimages, $image) {
|
||||
foreach($earthimages as $x) {
|
||||
list($file, , $width, $height) = split(":", $x);
|
||||
if($file == $image) {
|
||||
$coords = array("$width", "$height");
|
||||
return $coords;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function validcookie($cookie) {
|
||||
if(preg_match("/.*.:.*.:.*.:.*.:.*./", $cookie)) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
function isvalidimage($cookie, $earthimages, $defaultimage) {
|
||||
# list(, , , $setearthimage) = split(":", $cookie);
|
||||
$setearthimage = $cookie;
|
||||
if(isset($setearthimage)) {
|
||||
// check if the image is one actually defined, not a cookie edit
|
||||
foreach($earthimages as $image) {
|
||||
list($testearthimage, , , ) = split(":", $image);
|
||||
if($testearthimage == $setearthimage) {
|
||||
$found = 1;
|
||||
}
|
||||
}
|
||||
if(isset($found)) {
|
||||
return $setearthimage;
|
||||
} else {
|
||||
return $earthimages[$defaultimage];
|
||||
}
|
||||
} else {
|
||||
return $earthimages[$defaultimage];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function istheregd() {
|
||||
global $trygd;
|
||||
if($trygd == 1) {
|
||||
if (@ImageTypes() & IMG_PNG) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
function checkbrowser($agent) {
|
||||
if (strstr($agent, "Mozilla/4.7") || strstr($agent, "Opera 6") || strstr($agent, "Opera/6")) {
|
||||
return FALSE;
|
||||
} else {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
function shouldrun($agent) {
|
||||
|
||||
// could cause probs... dunno
|
||||
global $HTTP_COOKIE_VARS;
|
||||
|
||||
// check for new format of cookie with 6 parameters
|
||||
if(@preg_match("/.*.:.*.:.*.:.*.:.*.:.*./", $HTTP_COOKIE_VARS["atlasprefs"])) {
|
||||
list( , , , , , $drawmode) = split(":", $HTTP_COOKIE_VARS["atlasprefs"]);
|
||||
} else {
|
||||
$drawmode = "";
|
||||
}
|
||||
|
||||
// don't try to understand below, it figures out whether
|
||||
// to run it in css or gd based of prefs, server ability, and user agent.
|
||||
|
||||
if(istheregd() && ($drawmode == "1")) {
|
||||
return TRUE;
|
||||
} elseif($drawmode == "0") {
|
||||
return FALSE;
|
||||
} elseif(checkbrowser($agent) && istheregd()) {
|
||||
return TRUE;
|
||||
} elseif(!checkbrowser($agent)) {
|
||||
return FALSE;
|
||||
} elseif (!istheregd()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function s10_validate_ip($in) {
|
||||
if (is_string($in) && ereg('^([0-9]{1,3})\.([0-9]{1,3})\.' .
|
||||
'([0-9]{1,3})\.([0-9]{1,3})$' ,
|
||||
$in, $part)) {
|
||||
if ($part[1] <= 255 && $part[2] <= 255 &&
|
||||
$part[3] <= 255 && $part[4] <= 255)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function getstuff($address, $local) {
|
||||
|
||||
$address = trim($address);
|
||||
|
||||
# some people still think that urls are hostnames
|
||||
$address = str_replace("http://", "", $address);
|
||||
$address = preg_replace("/\/.*$/", "", $address);
|
||||
|
||||
// Security checks
|
||||
$address = escapeshellcmd($address);
|
||||
|
||||
$values = array();
|
||||
|
||||
$values["address"] = $address;
|
||||
|
||||
if(eregi("[a-z]", $address)){
|
||||
$ipaddress = gethostbyname($address);
|
||||
|
||||
if($ipaddress == $address) {
|
||||
|
||||
$values["validity"] = "no";
|
||||
|
||||
}
|
||||
|
||||
$values["hostname"] = $address;
|
||||
|
||||
$values["ishost"] = "yes";
|
||||
|
||||
} else {
|
||||
|
||||
if(s10_validate_ip($address)) {
|
||||
|
||||
$ipaddress = $address;
|
||||
$values["hostname"] = "";
|
||||
} else {
|
||||
$values["validity"] = "no";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!isset($values["validity"])) {
|
||||
if(s10_rfc_1918_ip($ipaddress)) {
|
||||
$private = "yes";
|
||||
} else {
|
||||
$private = "no";
|
||||
}
|
||||
} else {
|
||||
$private = "no";
|
||||
}
|
||||
|
||||
if(!isset($ipaddress)) { $ipaddress = ""; }
|
||||
|
||||
$values["ipaddress"] = $ipaddress;
|
||||
|
||||
if(!isset($values["validity"]) && ($private == "no")) {
|
||||
|
||||
$stuff = getlatdata($ipaddress);
|
||||
|
||||
list(
|
||||
|
||||
$values["city"],
|
||||
$values["state"],
|
||||
$values["country"],
|
||||
$values["lat"],
|
||||
$values["lon"]
|
||||
|
||||
) = stuffanalyze($stuff);
|
||||
|
||||
$desc = "";
|
||||
|
||||
// check if it is the user's ip address
|
||||
if($local == 1) { $desc .= t("You at"); }
|
||||
|
||||
// add the ip address and hostname
|
||||
$desc .= "<b>$values[hostname]</b> (<b>$values[ipaddress]</b>) ";
|
||||
|
||||
// use "are" if it is the user's ip address
|
||||
if($local == 1) { $desc .= t("are"); } else { $desc .= t("is"); }
|
||||
|
||||
$desc .= " ".t("located in")." ";
|
||||
|
||||
// add the city if it's there
|
||||
if($values["city"]) {
|
||||
$desc .= "$values[city], ";
|
||||
}
|
||||
|
||||
// add the state if its there
|
||||
if($values["state"]) {
|
||||
$desc .= "$values[state], ";
|
||||
}
|
||||
|
||||
if($values["country"]) {
|
||||
// make the country code capital so its ready for lookup
|
||||
$values["country"] = strtoupper($values["country"]);
|
||||
// convert the country code to a country name
|
||||
$countries = file("countries.txt") or die("Could not open countries file");
|
||||
$precountry = array_values(preg_grep("/$values[country] /", $countries));
|
||||
$values["country"] = trim(substr($precountry[0], 4));
|
||||
$desc .= "$values[country].";
|
||||
}
|
||||
|
||||
$desc .= " <font color=\"#aaaaaa\">($values[lat], $values[lon])</font>";
|
||||
|
||||
$state = $values["state"];
|
||||
$city = $values["city"];
|
||||
|
||||
// decide if address can't resolve, be located, or if it's fine
|
||||
if($values["lat"] == "0.00" && $values["lon"] == "0.00" && (@($state != "bad" && $city != "bad"))) {
|
||||
$values["desc"] = "<b>$values[address]</b> ".t("cannot be located.");
|
||||
$values["lat"] = "";
|
||||
$values["lon"] = "";
|
||||
} elseif($values["lat"] == "" && $values["lon"] == "") {
|
||||
$values["desc"] = "<b>$values[address]</b> ".t("cannot be located.");
|
||||
} else {
|
||||
$values["desc"] = $desc;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// check if it was a host before and decide on an error message
|
||||
|
||||
if($private == "yes") {
|
||||
$values["desc"] = "<b>$address</b> ".t("is a host in the private IP address range.");
|
||||
} elseif(@($values["state"] == "bad" && $values["city"] == "bad")) {
|
||||
$values["desc"] = t("Temporary lookup failure.");
|
||||
} elseif(isset($values["ishost"])) {
|
||||
$values["desc"] = "<b>$address</b> ".t("does not resolve.");
|
||||
} else {
|
||||
$values["desc"] = "<b>$address</b> ".t("is not a valid IP address.");
|
||||
}
|
||||
|
||||
// some blank lat/lon for the image script or it will plot us in the center
|
||||
$values["lon"] = "";
|
||||
$values["lat"] = "";
|
||||
|
||||
}
|
||||
|
||||
return($values);
|
||||
}
|
||||
|
||||
?>
|
145
iplookup/ipatlas/plot.php
Normal file
145
iplookup/ipatlas/plot.php
Normal file
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
include("plotconf.inc");
|
||||
include("plot.inc");
|
||||
|
||||
if (isset($user)) {
|
||||
$user = get_record("user", "id", $user);
|
||||
$fullname = fullname($user, true);
|
||||
$username = "<b>$fullname</b> [$user->city, $user->country] : ";
|
||||
} else {
|
||||
$username = "";
|
||||
}
|
||||
|
||||
if ($CFG->debug > 1) {
|
||||
error_reporting(E_ALL);
|
||||
} else {
|
||||
error_reporting(E_ERROR);
|
||||
}
|
||||
|
||||
// cleanup
|
||||
if (isset($HTTP_GET_VARS["lastquery"])) {
|
||||
$HTTP_GET_VARS["lastquery"] = clean_param($HTTP_GET_VARS["lastquery"], PARAM_HOST);
|
||||
}
|
||||
|
||||
// check if it is the user's ip, or another host
|
||||
|
||||
if(!isset($HTTP_GET_VARS["address"]) || ($HTTP_GET_VARS["address"] == "")) {
|
||||
$address = $HTTP_SERVER_VARS['REMOTE_ADDR'];
|
||||
$local = 1;
|
||||
} else {
|
||||
$HTTP_GET_VARS["address"] = clean_param($HTTP_GET_VARS["address"], PARAM_HOST);
|
||||
$address = $HTTP_GET_VARS["address"];
|
||||
$local = 0;
|
||||
}
|
||||
|
||||
// this is the most important function, gets lat/lon and description of location
|
||||
$values = getstuff($address, $local) or die("Error in plot.inc");
|
||||
|
||||
if(isset($logging) && is_writable("plotlog.txt")) {
|
||||
$log = @fopen("plotlog.txt", "a") or print "";
|
||||
@fputs($log, $HTTP_SERVER_VARS["REMOTE_ADDR"] ."\t". date("F j, Y, g:i a") . "\t$address\t$values[address]\t$values[lat]\t$values[lon]\n") or print "";
|
||||
@fclose($log);
|
||||
}
|
||||
|
||||
if(isset($HTTP_COOKIE_VARS["atlasprefs"]) && validcookie($HTTP_COOKIE_VARS["atlasprefs"])) {
|
||||
list( , , , $imagething) = split(":", $HTTP_COOKIE_VARS["atlasprefs"]);
|
||||
$imagething = clean_param($imagething, PARAM_FILE);
|
||||
$earthimage = isvalidimage($imagething, $earthimages, $defaultimage);
|
||||
} else {
|
||||
$earthimage = $earthimages[$defaultimage];
|
||||
}
|
||||
|
||||
if(strstr($earthimage, ":")) {
|
||||
list($earthimage, , , ) = split(":", $earthimage);
|
||||
}
|
||||
|
||||
// check if we need to run it in css mode
|
||||
if(!shouldrun($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
|
||||
|
||||
list($width, $height) = getimagecoords($earthimages, $earthimage);
|
||||
|
||||
// make sure some coords were found
|
||||
if($values["lat"] == "" || $values["lon"] == "") {
|
||||
|
||||
$display = " ";
|
||||
$extracss = "";
|
||||
|
||||
} else {
|
||||
|
||||
list($x, $y) = getlocationcoords($values["lat"], $values["lon"], $width, $height);
|
||||
|
||||
if(isset($HTTP_COOKIE_VARS["atlasprefs"])) {
|
||||
list( , , , , $dotname) = split(":", $HTTP_COOKIE_VARS["atlasprefs"]);
|
||||
$dotname = clean_param($dotname, PARAM_FILE);
|
||||
list($thedot, $dotwidth, $dotheight) = finddot($dotname, $cssdots, $defaultdot);
|
||||
} else {
|
||||
$dotname = $cssdots[$defaultdot];
|
||||
list($dotname, , , ) = split(":", $dotname);
|
||||
$dotname = clean_param($dotname, PARAM_FILE);
|
||||
list($thedot, $dotwidth, $dotheight) = finddot($dotname, $cssdots, $defaultdot);
|
||||
}
|
||||
|
||||
// magical formula for placing the css dot
|
||||
$x = ($x - floor($dotwidth / 2));
|
||||
$y = ($y - floor($dotheight / 2));
|
||||
|
||||
$extracss = "<style>
|
||||
#dotDiv { padding-left:$x; padding-top:$y; }
|
||||
</style>";
|
||||
$display = "<div id=\"dotDiv\"><img width=\"$dotwidth\" height=\"$dotheight\" src=\"$thedot\">";
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// gd mode
|
||||
|
||||
list($width, $height) = getimagecoords($earthimages, $earthimage) or die("Unable to find width/height for image $earthimage in config file");
|
||||
$extracss = "";
|
||||
$display = "<img src=\"plotimage.php?lat=$values[lat]&lon=$values[lon]\" width=\"$width\" height=\"$height\" alt=\"\" />";
|
||||
|
||||
}
|
||||
|
||||
# START HTML
|
||||
|
||||
print '
|
||||
|
||||
<html><head><title>'.t("Plotting").' '.$values["address"].'</title>
|
||||
'.$extracss.'
|
||||
|
||||
<!-- your head tags here -->
|
||||
<link rel="Stylesheet" href="ip-atlas.css">
|
||||
</head><body bgcolor="#FFFFFF">
|
||||
|
||||
|
||||
<a name="map"></a>
|
||||
|
||||
<table valign="top" cellpadding=0 cellspacing=0 border=0 background="'.$earthimage.'" width="'.$width.'" height="'.$height.'"><tr><td valign="top">'.$display.'</td></tr></table>
|
||||
|
||||
|
||||
<br />
|
||||
';
|
||||
|
||||
if(isset($address)) {
|
||||
print "$username $values[desc]";
|
||||
}
|
||||
|
||||
$PHP_SELF = 'plot.php';
|
||||
|
||||
print '
|
||||
<br /><br />
|
||||
<form method="GET" action="'.$PHP_SELF.'#map">
|
||||
<table width="100%"><tr><td nowrap align="left">
|
||||
'.t("IP/Hostname:").' <input value="'.$values["address"].'" type="text" size="30" name="address"><input type="Submit" value="'.t("Submit").'"></td><td align="right" width="100%">
|
||||
[ <a href="ip-atlas_prefs.php?lastquery='?><?php if(isset($HTTP_GET_VARS["address"])) { echo $HTTP_GET_VARS["address"]; } ?><?php echo '">'.t("preferences").'</a> ]
|
||||
[ <a href="'."$PHP_SELF".'">'.t("locate me").'</a> ]
|
||||
</td></tr></table>
|
||||
</form>
|
||||
';
|
||||
|
||||
include("footer.inc");
|
||||
|
||||
print "</body></html>";
|
||||
|
||||
?>
|
61
iplookup/ipatlas/plotconf.inc
Normal file
61
iplookup/ipatlas/plotconf.inc
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
require("../../config.php");
|
||||
|
||||
# try to find GD on the server? set this
|
||||
# to "0" if the script doesn't work or there is a broken image
|
||||
if ($CFG->gdversion == 1 or $CFG->gdversion == 2) {
|
||||
$trygd = "1";
|
||||
} else {
|
||||
$trygd = "0";
|
||||
}
|
||||
|
||||
# language (look in language/ dir for language files)
|
||||
$language = "en"; global $language;
|
||||
|
||||
include("translate.inc");
|
||||
|
||||
# display warnings? set to "0" if there are warnings
|
||||
# on the screen. report these to ivan@xpenguin.com so
|
||||
# this option will become unnessessary.
|
||||
$warnings = "1";
|
||||
|
||||
# earth images
|
||||
# url path:name:width:height
|
||||
# everything must be accurate!
|
||||
# take new image names out of the t()
|
||||
|
||||
$earthimages = array();
|
||||
$earthimages[0] = "earth_620.jpg:".t("Color").":620:310";
|
||||
|
||||
# which image out of those is the default?
|
||||
$defaultimage = 0;
|
||||
|
||||
# css dots for netscape 4 users and systems without GD
|
||||
# url path:name:width:height
|
||||
$cssdots = array();
|
||||
$cssdots[0] = "reddot.gif:Red 7x7:7:7";
|
||||
$cssdots[1] = "yellowdot.gif:Yellow 7x7:7:7";
|
||||
$defaultdot = 0;
|
||||
|
||||
# block user agents "libwww-perl" "lwp-trivial" "LWP::Simple" "PHP/"
|
||||
$blockbadagents = 1;
|
||||
|
||||
# log entries? comment the line to disable.
|
||||
$logging = "yes";
|
||||
|
||||
# path to the cookie
|
||||
$cookiepath = "/";
|
||||
|
||||
# set $use_firewall to "1" if behind a proxy
|
||||
if ($CFG->proxyhost and $CFG->proxyport) {
|
||||
$use_firewall="1";
|
||||
$firewall_host=$CFG->proxyhost;
|
||||
$firewall_port=$CFG->proxyport;
|
||||
} else {
|
||||
$use_firewall="";
|
||||
$firewall_host="localhost";
|
||||
$firewall_port=3128;
|
||||
}
|
||||
|
||||
?>
|
91
iplookup/ipatlas/plotimage.php
Normal file
91
iplookup/ipatlas/plotimage.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
include("plotconf.inc");
|
||||
include("plot.inc");
|
||||
|
||||
$form_vars = ${"HTTP_".$HTTP_SERVER_VARS["REQUEST_METHOD"]."_VARS"};
|
||||
$lat = $form_vars['lat'];
|
||||
$lon = $form_vars['lon'];
|
||||
|
||||
if(isset($HTTP_COOKIE_VARS["atlasprefs"]) && validcookie($HTTP_COOKIE_VARS["atlasprefs"])) {
|
||||
list($setshape, $setcolor, $setsize, $earthimage, , ) = split(":", $HTTP_COOKIE_VARS["atlasprefs"]);
|
||||
} else {
|
||||
$setshape = "Diamond";
|
||||
$setcolor = "red";
|
||||
$setsize = "3";
|
||||
$earthimage = $earthimages[$defaultimage];
|
||||
list($earthimage, , , ) = split(":", $earthimage);
|
||||
}
|
||||
|
||||
$earthimage = isvalidimage($earthimage, $earthimages, $defaultimage);
|
||||
|
||||
if(strstr($earthimage, ":")) {
|
||||
list($earthimage, , , ) = split(":", $earthimage);
|
||||
}
|
||||
|
||||
list($width, $height) = getimagecoords($earthimages, $earthimage);
|
||||
|
||||
if($setsize > 8 || $setsize < 2) {
|
||||
$setsize = 2;
|
||||
}
|
||||
|
||||
$im = @ImageCreate ($width, $height)
|
||||
or die ("Cannot Initialize new GD image stream");
|
||||
$background_color = ImageColorAllocate ($im, 255, 255, 255);
|
||||
|
||||
|
||||
// color table
|
||||
if($setcolor == "red") { $r = "255"; $g = "0"; $b = "0"; }
|
||||
elseif($setcolor == "white") { $r = "255"; $g = "255"; $b = "254"; }
|
||||
elseif($setcolor == "yellow") { $r = "255"; $g = "255"; $b = "0"; }
|
||||
elseif($setcolor == "magenta") { $r = "255"; $g = "0"; $b = "255"; }
|
||||
elseif($setcolor == "cyan") { $r = "0"; $g = "255"; $b = "255"; }
|
||||
elseif($setcolor == "green") { $r = "0"; $g = "225"; $b = "0"; }
|
||||
elseif($setcolor == "violet") { $r = "191"; $g = "0"; $b = "255"; }
|
||||
else { $r = "255"; $g = "0"; $b = "0"; }
|
||||
|
||||
$loc_color = ImageColorAllocate ($im, $r, $g, $b);
|
||||
|
||||
if($lat == "" && $lon == "") { } else {
|
||||
|
||||
list($x, $y) = getlocationcoords($lat, $lon, $width, $height);
|
||||
|
||||
if($setshape == "Diamond") {
|
||||
ImageLine($im, ($x - $setsize), $y, $x, ($y + $setsize), $loc_color);
|
||||
ImageLine($im, ($x - $setsize), $y, $x, ($y - $setsize), $loc_color);
|
||||
ImageLine($im, ($x + $setsize), $y, $x, ($y + $setsize), $loc_color);
|
||||
ImageLine($im, ($x + $setsize), $y, $x, ($y - $setsize), $loc_color);
|
||||
ImageFill($im, $x, $y, $loc_color);
|
||||
} elseif($setshape == "Diamond Outline") {
|
||||
ImageLine($im, ($x - $setsize), $y, $x, ($y + $setsize), $loc_color);
|
||||
ImageLine($im, ($x - $setsize), $y, $x, ($y - $setsize), $loc_color);
|
||||
ImageLine($im, ($x + $setsize), $y, $x, ($y + $setsize), $loc_color);
|
||||
ImageLine($im, ($x + $setsize), $y, $x, ($y - $setsize), $loc_color);
|
||||
} elseif($setshape == "Square") {
|
||||
ImageFilledRectangle($im, ($x - $setsize), ($y - $setsize), ($x + $setsize), ($y + $setsize), $loc_color);
|
||||
} elseif($setshape == "Square Outline") {
|
||||
ImageRectangle($im, ($x - $setsize), ($y - $setsize), ($x + $setsize), ($y + $setsize), $loc_color);
|
||||
} elseif($setshape == "Cross") {
|
||||
ImageLine($im, ($x - $setsize), $y, ($x + $setsize), $y, $loc_color);
|
||||
ImageLine($im, $x, ($y - $setsize), $x, ($y + $setsize), $loc_color);
|
||||
} else {
|
||||
// draw a diamond if error
|
||||
ImageLine($im, ($x - $setsize), $y, $x, ($y + $setsize), $loc_color);
|
||||
ImageLine($im, ($x - $setsize), $y, $x, ($y - $setsize), $loc_color);
|
||||
ImageLine($im, ($x + $setsize), $y, $x, ($y + $setsize), $loc_color);
|
||||
ImageLine($im, ($x + $setsize), $y, $x, ($y - $setsize), $loc_color);
|
||||
ImageFill($im, $x, $y, $loc_color);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
ImageColorTransparent ($im, $background_color);
|
||||
Header("Pragma: no-cache");
|
||||
Header("Expires: Thu, 26-Oct-1972 12:00:00");
|
||||
Header("Content-type: image/png");
|
||||
ImagePng ($im);
|
||||
ImageDestroy($im);
|
||||
|
||||
|
||||
?>
|
13
iplookup/ipatlas/plotlog.txt
Normal file
13
iplookup/ipatlas/plotlog.txt
Normal file
@ -0,0 +1,13 @@
|
||||
192.168.19.1 August 26, 2002, 4:45 pm 192.168.19.1 192.168.19.1
|
||||
192.168.19.1 August 26, 2002, 4:45 pm dougiamas.com dougiamas.com -31.97 115.82
|
||||
192.168.19.1 August 26, 2002, 4:46 pm dougiamas.com dougiamas.com -31.97 115.82
|
||||
192.168.19.1 August 26, 2002, 4:46 pm 192.168.19.1 192.168.19.1
|
||||
192.168.19.1 August 26, 2002, 4:48 pm hungry.com hungry.com 46.73 -116.99
|
||||
192.168.19.1 August 26, 2002, 4:50 pm yahoo.com yahoo.com 37.40 -122.00
|
||||
192.168.19.1 August 26, 2002, 4:55 pm 192.168.19.1 192.168.19.1
|
||||
192.168.19.1 August 26, 2002, 4:55 pm 192.168.19.1 192.168.19.1
|
||||
192.168.19.1 August 26, 2002, 4:56 pm hungry.com hungry.com 46.73 -116.99
|
||||
192.168.19.1 August 26, 2002, 4:56 pm hungry.com hungry.com 46.73 -116.99
|
||||
192.168.19.1 August 26, 2002, 4:56 pm washington.com washington.com
|
||||
192.168.19.1 August 26, 2002, 4:56 pm amazon.com amazon.com 47.55 -122.31
|
||||
192.168.19.1 August 26, 2002, 4:57 pm nytimes.com nytimes.com 37.40 -122.00
|
BIN
iplookup/ipatlas/reddot.gif
Normal file
BIN
iplookup/ipatlas/reddot.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 53 B |
14
iplookup/ipatlas/translate.inc
Normal file
14
iplookup/ipatlas/translate.inc
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
function t($phrase) {
|
||||
global $language;
|
||||
if($language == "en") {
|
||||
return $phrase;
|
||||
} else {
|
||||
include_once("languages/messages.$language.inc");
|
||||
$phrase = lookup($phrase, $language);
|
||||
return $phrase;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
BIN
iplookup/ipatlas/yellowdot.gif
Normal file
BIN
iplookup/ipatlas/yellowdot.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 53 B |
Loading…
x
Reference in New Issue
Block a user