From 1463302bdd9d3122a11e3ef8980b67951540babf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Aug 2019 16:23:31 +0200 Subject: [PATCH] Add option to disable the anonymous ping --- htdocs/core/ajax/pingresult.php | 6 +- htdocs/install/inc.php | 4 +- htdocs/install/step2.php | 19 ++++++ htdocs/install/step4.php | 2 +- htdocs/langs/en_US/admin.lang | 3 +- htdocs/main.inc.php | 103 ++++++++++++++++---------------- 6 files changed, 78 insertions(+), 59 deletions(-) diff --git a/htdocs/core/ajax/pingresult.php b/htdocs/core/ajax/pingresult.php index 3055942f89a..67608c24162 100644 --- a/htdocs/core/ajax/pingresult.php +++ b/htdocs/core/ajax/pingresult.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; $action=GETPOST('action', 'alpha'); $hash_unique_id=GETPOST('hash_unique_id', 'alpha'); -$hash_algo=GETPOST('hash', 'alpha'); +$hash_algo=GETPOST('hash_algo', 'alpha'); // Security check @@ -53,7 +53,7 @@ print ''; +$out .= ''; + +print $out; + pFooter($ok?0:1, $setuplang); if (isset($db) && is_object($db)) $db->close(); diff --git a/htdocs/install/step4.php b/htdocs/install/step4.php index 734d63fade9..342ec82d0fd 100644 --- a/htdocs/install/step4.php +++ b/htdocs/install/step4.php @@ -80,7 +80,7 @@ $db=getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf-> if ($db->ok) { print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index da28ec88538..1b4badc39b5 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1935,4 +1935,5 @@ AtLeastOneDefaultBankAccountMandatory=At least 1 default bank account must be de RESTRICT_API_ON_IP=Allow available APIs to some host IP only (wildcard not allowed, use space between values). Empty means every hosts can use the available APIs. RESTRICT_ON_IP=Allow access to some host IP only (wildcard not allowed, use space between values). Empty means every hosts can access. BaseOnSabeDavVersion=Based on the library SabreDAV version -NotAPublicIp=Not a public IP \ No newline at end of file +NotAPublicIp=Not a public IP +MakeAnonymousPing=Make an anonymous Ping '+1' to the Dolibarr foundation server (done 1 time only after installation) to allow the foundation to count the number of Dolibarr installation. \ No newline at end of file diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 375c7e4ea23..620a4b4e7f6 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2205,7 +2205,7 @@ if (! function_exists("llxFooter")) */ function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) { - global $conf, $langs, $user, $object; + global $conf, $db, $langs, $user, $object; global $delayedhtmlcontent; global $contextpage, $page, $limit; @@ -2334,65 +2334,62 @@ if (! function_exists("llxFooter")) // Add code for the asynchronous anonymous first ping (for telemetry) if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || GETPOST('forceping', 'alpha')) { + //print ''; if (empty($conf->global->MAIN_FIRST_PING_OK_DATE) - || (! empty($conf->file->instance_unique_id) && (md5($conf->file->instance_unique_id) != $conf->global->MAIN_FIRST_PING_OK_ID)) + || (! empty($conf->file->instance_unique_id) && (md5($conf->file->instance_unique_id) != $conf->global->MAIN_FIRST_PING_OK_ID) && ($conf->global->MAIN_FIRST_PING_OK_ID != 'disabled')) || GETPOST('forceping', 'alpha')) { - print "\n".''."\n"; - print "\n\n"; - ?> - - file->instance_unique_id)])) + { + print "\n".''."\n"; + print "\n\n"; + $hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id); + ?> + + \n"; + include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; + dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_DATE', dol_print_date($now, 'dayhourlog', 'gmt')); + dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_ID', 'disabled'); + } } } print "\n"; print "\n"; - - ?> - - -