*
* 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, see .
*/
/**
* \file htdocs/admin/geoipmaxmind.php
* \ingroup geoipmaxmind
* \brief Setup page for geoipmaxmind module
* \version $Id: geoipmaxmind.php,v 1.3 2011/07/31 22:23:22 eldy Exp $
*/
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/dolgeoip.class.php");
// Security check
if (!$user->admin)
accessforbidden();
$langs->load("admin");
$langs->load("errors");
/*
* Actions
*/
if ($_POST["action"] == 'set')
{
$error=0;
if (! empty($_POST["GEOIPMAXMIND_COUNTRY_DATAFILE"]) && ! file_exists($_POST["GEOIPMAXMIND_COUNTRY_DATAFILE"]))
{
$mesg='
'.$langs->trans("ErrorFileNotFound",$_POST["GEOIPMAXMIND_COUNTRY_DATAFILE"]).'
';
$error++;
}
if (! $error)
{
dolibarr_set_const($db,"GEOIPMAXMIND_COUNTRY_DATAFILE",$_POST["GEOIPMAXMIND_COUNTRY_DATAFILE"],'chaine',0,'',$conf->entity);
}
}
/*
* View
*/
$form=new Form($db);
llxHeader();
$linkback=''.$langs->trans("BackToModuleList").'';
print_fiche_titre($langs->trans("GeoIPMaxmindSetup"),$linkback,'setup');
print '
';
if ($mesg) print $mesg;
$version='';
$geoip='';
if (! empty($conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE))
{
$geoip=new DolGeoIP('country',$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE);
}
// Mode
$var=true;
print '\n";
print '
';
print $langs->trans("NoteOnPathLocation").'
';
$url1='http://www.maxmind.com/app/perl?rId=awstats';
print $langs->trans("YouCanDownloadFreeDatFileTo",''.$url1.'');
print '
';
$url2='http://www.maxmind.com/app/perl?rId=awstats';
print $langs->trans("YouCanDownloadAdvancedDatFileTo",''.$url2.'');
if ($geoip)
{
print '
';
print '
';
$ip='24.24.24.24';
print $langs->trans("TestGeoIPResult",$ip).':
';
print $ip.' -> ';
$result=dol_print_ip($ip,1);
if ($result) print $result;
else print $langs->trans("Error");
$geoip->close();
}
llxFooter('$Date: 2011/07/31 22:23:22 $ - $Revision: 1.3 $');
?>