1 | <?php |
||
2 | /* Copyright (C) 2017 Laurent Destailleur <[email protected]> |
||
3 | * Copyright (C) 2017 ATM Consulting <[email protected]> |
||
4 | * |
||
5 | * This program is free software; you can redistribute it and/or modify |
||
6 | * it under the terms of the GNU General Public License as published by |
||
7 | * the Free Software Foundation; either version 3 of the License, or |
||
8 | * (at your option) any later version. |
||
9 | * |
||
10 | * This program is distributed in the hope that it will be useful, |
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
13 | * GNU General Public License for more details. |
||
14 | * |
||
15 | * You should have received a copy of the GNU General Public License |
||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
17 | */ |
||
18 | |||
19 | /** |
||
20 | * \file htdocs/blockedlog/ajax/block-info.php |
||
21 | * \ingroup blockedlog |
||
22 | * \brief block-info |
||
23 | */ |
||
24 | |||
25 | |||
26 | // This script is called with a POST method. |
||
27 | // Directory to scan (full path) is inside POST['dir']. |
||
28 | |||
29 | if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal |
||
30 | if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); |
||
31 | if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); |
||
32 | |||
33 | |||
34 | |||
35 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
||
36 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
||
37 | require DOL_BASE_PATH . '/main.inc.php'; |
||
38 | |||
39 | if(empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) exit('BLOCKEDLOG_AUTHORITY_URL not set'); |
||
40 | |||
41 | require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; |
||
42 | require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php'; |
||
43 | |||
44 | $auth=new BlockedLogAuthority($db); |
||
45 | $auth->syncSignatureWithAuthority(); |
||
46 | |||
47 | $block_static = new BlockedLog($db); |
||
48 | |||
49 | $blocks = $block_static->getLog('just_certified', 0, 0, 'rowid', 'ASC'); |
||
50 | |||
51 | $auth->signature = $block_static->getSignature(); |
||
52 | |||
53 | foreach($blocks as &$b) { |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
54 | $auth->blockchain.=$b->signature; |
||
55 | } |
||
56 | |||
57 | $hash = $auth->getBlockchainHash(); |
||
58 | |||
59 | $url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$auth->signature.'&h='.$hash; |
||
60 | |||
61 | $res = file_get_contents($url); |
||
62 | //echo $url; |
||
63 | echo $res; |