Debug v23 - restore geoipmaxmind
This commit is contained in:
parent
d44361eb67
commit
e3876f3295
5 changed files with 192 additions and 47 deletions
|
|
@ -26,10 +26,6 @@
|
|||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgeoip.class.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
|
|
@ -37,6 +33,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/dolgeoip.class.php';
|
|||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgeoip.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
// Security check
|
||||
if (!$user->admin) {
|
||||
|
|
@ -48,6 +49,10 @@ $langs->loadLangs(array("admin", "errors"));
|
|||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
if (!isset($conf->global->GEOIP_VERSION)) {
|
||||
$conf->global->GEOIP_VERSION = '2';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
|
@ -56,21 +61,50 @@ $action = GETPOST('action', 'aZ09');
|
|||
if ($action == 'set') {
|
||||
$error = 0;
|
||||
|
||||
$gimcdf = GETPOST("GEOIPMAXMIND_COUNTRY_DATAFILE");
|
||||
|
||||
if ($gimcdf && !preg_match('/\.(dat|mmdb)$/', $gimcdf)) {
|
||||
setEventMessages($langs->trans("ErrorFileMustHaveFormat", '.dat|.mmdb'), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
$res1 = dolibarr_set_const($db, "GEOIP_VERSION", GETPOST('geoipversion', 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
if (!($res1 > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$res2 = dolibarr_set_const($db, "GEOIPMAXMIND_COUNTRY_DATAFILE", $gimcdf, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res2 > 0)) {
|
||||
$error++;
|
||||
if (getDolGlobalString('GEOIP_VERSION') == 'php') {
|
||||
$gimcdf = GETPOST("GEOIPMAXMIND_COUNTRY_DATAFILE");
|
||||
if ($gimcdf) {
|
||||
if (!preg_match('/\.(dat|mmdb)$/', $gimcdf)) {
|
||||
setEventMessages($langs->trans("ErrorFileMustHaveFormat", '.dat|.mmdb'), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$res2 = dolibarr_set_const($db, "GEOIPMAXMIND_COUNTRY_DATAFILE", $gimcdf, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res2 > 0)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$gimcdf = GETPOST("GEOIPMAXMIND_COUNTRY_DATAFILE_EMBEDDED");
|
||||
if ($gimcdf && !preg_match('/\.(dat|mmdb)$/', $gimcdf)) {
|
||||
setEventMessages($langs->trans("ErrorFileMustHaveFormat", '.dat|.mmdb'), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$varname = 'GEOIPMAXMIND_COUNTRY_DATAFILE_EMBEDDED';
|
||||
if (isset($_FILES[$varname]) && $_FILES[$varname]["name"]) {
|
||||
$diroffile = getMultidirOutput(null, 'geoipmaxmind');
|
||||
if ($diroffile) {
|
||||
$dirforterms = $diroffile.'/';
|
||||
$original_file = $_FILES[$varname]["name"];
|
||||
$result = dol_move_uploaded_file($_FILES[$varname]["tmp_name"], $dirforterms.$original_file, 1, 0, $_FILES[$varname]['error']);
|
||||
if ((int) $result > 0) {
|
||||
dolibarr_set_const($db, $varname, $original_file, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("Error").' '.$langs->transnoentitiesnoconv((string) $result), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
|
|
@ -80,9 +114,7 @@ if ($action == 'set') {
|
|||
}
|
||||
}
|
||||
|
||||
if (!isset($conf->global->GEOIP_VERSION)) {
|
||||
$conf->global->GEOIP_VERSION = '2';
|
||||
}
|
||||
$documenturl = getDolGlobalString('DOL_URL_ROOT_DOCUMENT_PHP', DOL_URL_ROOT.'/document.php');
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -90,6 +122,7 @@ if (!isset($conf->global->GEOIP_VERSION)) {
|
|||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-admin page-geoipmaxmind');
|
||||
|
||||
|
|
@ -100,12 +133,18 @@ print '<br>';
|
|||
|
||||
$version = '';
|
||||
$geoip = '';
|
||||
if (getDolGlobalString('GEOIPMAXMIND_COUNTRY_DATAFILE')) {
|
||||
$geoip = new DolGeoIP('country', $conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE);
|
||||
if (getDolGlobalString('GEOIP_VERSION') == 'php') {
|
||||
$datafile = getDolGlobalString('GEOIPMAXMIND_COUNTRY_DATAFILE');
|
||||
} else {
|
||||
$diroffile = getMultidirOutput(null, 'geoipmaxmind');
|
||||
$datafile = $diroffile . '/' . getDolGlobalString('GEOIPMAXMIND_COUNTRY_DATAFILE_EMBEDDED');
|
||||
}
|
||||
if ($datafile) {
|
||||
$geoip = new DolGeoIP('country', $datafile);
|
||||
}
|
||||
|
||||
// Mode
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="set">';
|
||||
|
||||
|
|
@ -113,7 +152,7 @@ print '<div class="div-table-responsive-no-min">';
|
|||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td><td></td>';
|
||||
print '<td class="right"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '<td class="right"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Lib version
|
||||
|
|
@ -133,36 +172,133 @@ print '</td>';
|
|||
print '<td>';
|
||||
print '</td></tr>';
|
||||
|
||||
$gimcdf = getDolGlobalString('GEOIPMAXMIND_COUNTRY_DATAFILE');
|
||||
|
||||
// Path to database file
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PathToGeoIPMaxmindCountryDataFile").'</td>';
|
||||
print '<td>';
|
||||
if (getDolGlobalString('GEOIP_VERSION') == 'php') {
|
||||
print 'Using geoip PHP internal functions. Value must be '.geoip_db_filename(GEOIP_COUNTRY_EDITION).' or '.geoip_db_filename(GEOIP_CITY_EDITION_REV1).' or /pathtodatafile/GeoLite2-Country.mmdb<br>';
|
||||
}
|
||||
print '<input type="text" class="minwidth200" name="GEOIPMAXMIND_COUNTRY_DATAFILE" value="'.dol_escape_htmltag(getDolGlobalString('GEOIPMAXMIND_COUNTRY_DATAFILE')).'">';
|
||||
if (!file_exists(str_replace('DOL_DATA_ROOT', DOL_DATA_ROOT, $gimcdf))) {
|
||||
print '<div class="error">'.$langs->trans("ErrorFileNotFound", $gimcdf).'</div>';
|
||||
$gimcdf = getDolGlobalString('GEOIPMAXMIND_COUNTRY_DATAFILE');
|
||||
|
||||
if (function_exists('geoip_db_filename')) {
|
||||
print 'Using geoip PHP internal functions. Value must be '.geoip_db_filename(GEOIP_COUNTRY_EDITION).' or '.geoip_db_filename(GEOIP_CITY_EDITION_REV1).' or /pathtodatafile/GeoLite2-Country.mmdb<br>';
|
||||
}
|
||||
print '<input type="text" class="minwidth200" name="GEOIPMAXMIND_COUNTRY_DATAFILE" value="'.dol_escape_htmltag(getDolGlobalString('GEOIPMAXMIND_COUNTRY_DATAFILE')).'">';
|
||||
if (!file_exists(str_replace('DOL_DATA_ROOT', DOL_DATA_ROOT, $gimcdf))) {
|
||||
print '<div class="error">'.$langs->trans("ErrorFileNotFound", $gimcdf).'</div>';
|
||||
}
|
||||
} else {
|
||||
$modulepart = 'geoipmaxmind';
|
||||
print '<div class="inline-block nobordernopadding valignmiddle "><div class="inline-block marginrightonly">';
|
||||
$maxfilesizearray = getMaxFileSizeArray();
|
||||
$maxmin = $maxfilesizearray['maxmin'];
|
||||
if ($maxmin > 0) {
|
||||
print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
|
||||
}
|
||||
print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="GEOIPMAXMIND_COUNTRY_DATAFILE_EMBEDDED" id="GEOIPMAXMIND_COUNTRY_DATAFILE_EMBEDDED">';
|
||||
|
||||
// TODO Move this into a function $out = getHelpOnUploadMax();
|
||||
$out = '';
|
||||
if (getDolGlobalString('MAIN_UPLOAD_DOC')) {
|
||||
$max = getDolGlobalString('MAIN_UPLOAD_DOC'); // In Kb
|
||||
$maxphp = @ini_get('upload_max_filesize'); // In unknown
|
||||
if (preg_match('/k$/i', $maxphp)) {
|
||||
$maxphp = preg_replace('/k$/i', '', $maxphp);
|
||||
$maxphp = (int) $maxphp * 1;
|
||||
}
|
||||
if (preg_match('/m$/i', $maxphp)) {
|
||||
$maxphp = preg_replace('/m$/i', '', $maxphp);
|
||||
$maxphp = (int) $maxphp * 1024;
|
||||
}
|
||||
if (preg_match('/g$/i', $maxphp)) {
|
||||
$maxphp = preg_replace('/g$/i', '', $maxphp);
|
||||
$maxphp = (int) $maxphp * 1024 * 1024;
|
||||
}
|
||||
if (preg_match('/t$/i', $maxphp)) {
|
||||
$maxphp = preg_replace('/t$/i', '', $maxphp);
|
||||
$maxphp = (int) $maxphp * 1024 * 1024 * 1024;
|
||||
}
|
||||
$maxphp2 = @ini_get('post_max_size'); // In unknown
|
||||
if (preg_match('/k$/i', $maxphp2)) {
|
||||
$maxphp2 = preg_replace('/k$/i', '', $maxphp2);
|
||||
$maxphp2 = (int) $maxphp2 * 1;
|
||||
}
|
||||
if (preg_match('/m$/i', $maxphp2)) {
|
||||
$maxphp2 = preg_replace('/m$/i', '', $maxphp2);
|
||||
$maxphp2 = (int) $maxphp2 * 1024;
|
||||
}
|
||||
if (preg_match('/g$/i', $maxphp2)) {
|
||||
$maxphp2 = preg_replace('/g$/i', '', $maxphp2);
|
||||
$maxphp2 = (int) $maxphp2 * 1024 * 1024;
|
||||
}
|
||||
if (preg_match('/t$/i', $maxphp2)) {
|
||||
$maxphp2 = preg_replace('/t$/i', '', $maxphp2);
|
||||
$maxphp2 = (int) $maxphp2 * 1024 * 1024 * 1024;
|
||||
}
|
||||
// Now $max and $maxphp and $maxphp2 are in Kb
|
||||
$maxmin = $max;
|
||||
$maxphptoshow = $maxphptoshowparam = '';
|
||||
if ($maxphp > 0) {
|
||||
$maxmin = min($max, $maxphp);
|
||||
$maxphptoshow = $maxphp;
|
||||
$maxphptoshowparam = 'upload_max_filesize';
|
||||
}
|
||||
if ($maxphp2 > 0) {
|
||||
$maxmin = min($max, $maxphp2);
|
||||
if ($maxphp2 < $maxphp) {
|
||||
$maxphptoshow = $maxphp2;
|
||||
$maxphptoshowparam = 'post_max_size';
|
||||
}
|
||||
}
|
||||
|
||||
$langs->load('other');
|
||||
$out .= ' ';
|
||||
$out .= info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow), 1);
|
||||
} else {
|
||||
$out .= ' ('.$langs->trans("UploadDisabled").')';
|
||||
}
|
||||
|
||||
print $out;
|
||||
|
||||
print '</div>';
|
||||
if (getDolGlobalString("GEOIPMAXMIND_COUNTRY_DATAFILE_EMBEDDED")) {
|
||||
$geoipfile = getDolGlobalString("GEOIPMAXMIND_COUNTRY_DATAFILE_EMBEDDED");
|
||||
$diroffile = getMultidirOutput(null, 'geoipmaxmind');
|
||||
if (file_exists($diroffile.'/'.$geoipfile)) {
|
||||
$file = dol_dir_list($diroffile, 'files', 0, $geoipfile);
|
||||
print ' ';
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($geoipfile).'">'.$geoipfile.'</a>'.$formfile->showPreview($file[0], $modulepart, $geoipfile, 0, '');
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removetermsofsale&modulepart='.$modulepart.'&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '</td><td>';
|
||||
print '<span class="opacitymedium">';
|
||||
print $langs->trans("Example").'<br>';
|
||||
print '/usr/local/share/GeoIP/GeoIP.dat<br>
|
||||
if (getDolGlobalString('GEOIP_VERSION') == 'php') {
|
||||
print '<span class="opacitymedium">';
|
||||
print $langs->trans("Example").'<br>';
|
||||
print '/usr/local/share/GeoIP/GeoIP.dat<br>
|
||||
/usr/share/GeoIP/GeoIP.dat<br>
|
||||
/usr/share/GeoIP/GeoLite2-Country.mmdb';
|
||||
print '</span>';
|
||||
print '</span>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Save").'">';
|
||||
print '</center>';
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<div class="hideonsmartphone">';
|
||||
print $langs->trans("NoteOnPathLocation").'<br>';
|
||||
print '<div class="hideonsmartphone info">';
|
||||
if (getDolGlobalString('GEOIP_VERSION') == 'php') {
|
||||
print $langs->trans("NoteOnPathLocation").'<br>';
|
||||
}
|
||||
|
||||
$url1 = 'http://www.maxmind.com/en/city?rId=awstats';
|
||||
$textoshow = $langs->trans("YouCanDownloadFreeDatFileTo", '{s1}');
|
||||
|
|
@ -179,7 +315,7 @@ print $textoshow;
|
|||
print '</div>';
|
||||
|
||||
if ($geoip) {
|
||||
print '<br><br><br>';
|
||||
print '<br>';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
|
@ -226,7 +362,7 @@ if ($geoip) {
|
|||
print $langs->trans("Error");
|
||||
}
|
||||
} else {
|
||||
print '<br>'.$ip.' -> ';
|
||||
print '<br>'.($isip == 2 ? $langs->trans("CurrentIP").': ' : '').$ip.' -> ';
|
||||
$result = dol_print_ip($ip, 1);
|
||||
if ($result) {
|
||||
print $result;
|
||||
|
|
|
|||
|
|
@ -235,10 +235,8 @@ print "<br>\n";
|
|||
|
||||
$maxfilesizearray = getMaxFileSizeArray();
|
||||
$tooltipconcatpdf = ($maxfilesizearray['maxmin'] > 0) ? $langs->trans('MaxSize').' : '.$maxfilesizearray['maxmin'].' '.$langs->trans('Kb') : '';
|
||||
$documenturl = DOL_URL_ROOT.'/document.php';
|
||||
if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) {
|
||||
$documenturl = getDolGlobalString('DOL_URL_ROOT_DOCUMENT_PHP');
|
||||
}
|
||||
|
||||
$documenturl = getDolGlobalString('DOL_URL_ROOT_DOCUMENT_PHP', DOL_URL_ROOT.'/document.php');
|
||||
|
||||
|
||||
print '<form enctype="multipart/form-data" method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
|
||||
|
|
@ -315,11 +313,13 @@ if (isModEnabled('propal')) {
|
|||
$modulepart = 'propal';
|
||||
print '<div class="inline-block nobordernopadding valignmiddle "><div class="inline-block marginrightonly">';
|
||||
print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="MAIN_INFO_PROPAL_TERMSOFSALE" id="MAIN_INFO_PROPAL_TERMSOFSALE" accept="application/pdf">';
|
||||
print '</div>';
|
||||
if (getDolGlobalString("MAIN_INFO_PROPAL_TERMSOFSALE")) {
|
||||
$termofsale = getDolGlobalString("MAIN_INFO_PROPAL_TERMSOFSALE");
|
||||
if (file_exists($conf->propal->dir_output.'/'.$termofsale)) {
|
||||
$file = dol_dir_list($conf->propal->dir_output, 'files', 0, $termofsale);
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($termofsale).'">'.$termofsale.'</a>'.$formfile->showPreview($file[0], $modulepart, $termofsale, 0, '');
|
||||
print ' ';
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($termofsale).'">'.$termofsale.'</a>'.$formfile->showPreview($file[0], $modulepart, $termofsale, 0, '').'</div>';
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removetermsofsale&modulepart='.$modulepart.'&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||
}
|
||||
}
|
||||
|
|
@ -392,11 +392,13 @@ if (isModEnabled('order')) {
|
|||
$modulepart = 'order';
|
||||
print '<div class="inline-block nobordernopadding valignmiddle "><div class="inline-block marginrightonly">';
|
||||
print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="MAIN_INFO_ORDER_TERMSOFSALE" id="MAIN_INFO_ORDER_TERMSOFSALE" accept="application/pdf">';
|
||||
print '</div>';
|
||||
if (getDolGlobalString("MAIN_INFO_ORDER_TERMSOFSALE")) {
|
||||
$termofsale = getDolGlobalString("MAIN_INFO_ORDER_TERMSOFSALE");
|
||||
if (file_exists($conf->order->dir_output.'/'.$termofsale)) {
|
||||
$file = dol_dir_list($conf->order->dir_output, 'files', 0, $termofsale);
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($termofsale).'">'.$termofsale.'</a>'.$formfile->showPreview($file[0], $modulepart, $termofsale, 0, '');
|
||||
print ' ';
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($termofsale).'">'.$termofsale.'</a>'.$formfile->showPreview($file[0], $modulepart, $termofsale, 0, '').'</div>';
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removetermsofsale&modulepart='.$modulepart.'&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||
}
|
||||
}
|
||||
|
|
@ -467,13 +469,15 @@ if (isModEnabled('invoice')) {
|
|||
|
||||
if (getDolGlobalString("MAIN_PDF_ADD_TERMSOFSALE_INVOICE")) {
|
||||
$modulepart = 'invoice';
|
||||
print '<div class="inline-block nobordernopadding valignmiddle "><div class="inline-block marginrightonly">';
|
||||
print '<div class="inline-block nobordernopadding valignmiddle"><div class="inline-block marginrightonly">';
|
||||
print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="MAIN_INFO_INVOICE_TERMSOFSALE" id="MAIN_INFO_INVOICE_TERMSOFSALE" accept="application/pdf">';
|
||||
print '</div>';
|
||||
if (getDolGlobalString("MAIN_INFO_INVOICE_TERMSOFSALE")) {
|
||||
$termofsale = getDolGlobalString("MAIN_INFO_INVOICE_TERMSOFSALE");
|
||||
if (file_exists($conf->invoice->dir_output.'/'.$termofsale)) {
|
||||
$file = dol_dir_list($conf->invoice->dir_output, 'files', 0, $termofsale);
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($termofsale).'">'.$termofsale.'</a>'.$formfile->showPreview($file[0], $modulepart, $termofsale, 0, '');
|
||||
print ' ';
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($termofsale).'">'.$termofsale.'</a>'.$formfile->showPreview($file[0], $modulepart, $termofsale, 0, '').'</div>';
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removetermsofsale&modulepart='.$modulepart.'&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1474,7 +1474,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
|
|||
switch ($uploaderrorcode) {
|
||||
case UPLOAD_ERR_INI_SIZE: // 1
|
||||
return 'ErrorFileSizeTooLarge';
|
||||
case UPLOAD_ERR_FORM_SIZE: // 2
|
||||
case UPLOAD_ERR_FORM_SIZE: // 2 - Exceed the MAX_FILE_SIZE specified into a field in form
|
||||
return 'ErrorFileSizeTooLarge';
|
||||
case UPLOAD_ERR_PARTIAL: // 3
|
||||
return 'ErrorPartialFile';
|
||||
|
|
|
|||
|
|
@ -5095,7 +5095,12 @@ function dolGetCountryCodeFromIp($ip)
|
|||
$countrycode = '';
|
||||
|
||||
if (isModEnabled('geoipmaxmind')) {
|
||||
$datafile = getDolGlobalString('GEOIPMAXMIND_COUNTRY_DATAFILE');
|
||||
if (getDolGlobalString('GEOIP_VERSION') == 'php') {
|
||||
$datafile = getDolGlobalString('GEOIPMAXMIND_COUNTRY_DATAFILE');
|
||||
} else {
|
||||
$diroffile = getMultidirOutput(null, 'geoipmaxmind');
|
||||
$datafile = $diroffile . '/' . getDolGlobalString('GEOIPMAXMIND_COUNTRY_DATAFILE_EMBEDDED');
|
||||
}
|
||||
//$ip='24.24.24.24';
|
||||
//$datafile='/usr/share/GeoIP/GeoIP.dat'; Note that this must be downloaded datafile (not same than datafile provided with ubuntu packages)
|
||||
if ($datafile) {
|
||||
|
|
|
|||
|
|
@ -1989,7 +1989,7 @@ function is_ip($ip)
|
|||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0; // If not valid
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue