dolibarr  13.0.2
pingresult.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
23 if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
24 if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
25 if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
26 if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
27 if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
28 if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
29 
30 require '../../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
32 
33 $action = GETPOST('action', 'aZ09');
34 $hash_unique_id = GETPOST('hash_unique_id', 'alpha');
35 $hash_algo = GETPOST('hash_algo', 'alpha');
36 
37 
38 // Security check
39 if (!empty($user->socid))
40  $socid = $user->socid;
41 
42 $now = dol_now();
43 
44 
45 /*
46  * View
47  */
48 
49 top_httphead();
50 
51 print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
52 
53 // If ok
54 if ($action == 'firstpingok')
55 {
56  // Note: pings are per installed instances / entity.
57  // Once this constants are set, no more ping will be tried (except if we add parameter &forceping=1 on URL). So we can say this are 'first' ping.
58  dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_DATE', dol_print_date($now, 'dayhourlog', 'gmt'));
59  dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_ID', $hash_unique_id);
60 
61  print 'First ping OK saved for entity '.$conf->entity;
62 }
63 // If ko
64 elseif ($action == 'firstpingko')
65 {
66  // Note: pings are by installation, done on entity 1.
67  dolibarr_set_const($db, 'MAIN_LAST_PING_KO_DATE', dol_print_date($now, 'dayhourlog'), 'gmt'); // erase last value
68  print 'First ping KO saved for entity '.$conf->entity;
69 } else {
70  print 'Error action='.$action.' not supported';
71 }
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_now($mode= 'auto')
Return date for now.
dolibarr_set_const($db, $name, $value, $type= 'chaine', $visible=0, $note= '', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Definition: admin.lib.php:575
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype= 'text/html', $forcenocache=0)
Show HTTP header.
Definition: main.inc.php:1214
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
Definition: index.php:89
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...