Skip to content
Snippets Groups Projects
Commit 11d2a553 authored by Alexis Algoud's avatar Alexis Algoud
Browse files

fix entity default value and add link to download blockchain

parent 3cae54c2
Branches
Tags
No related merge requests found
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$langs->load("admin"); $langs->load("admin");
...@@ -34,6 +35,21 @@ if (! $user->admin) accessforbidden(); ...@@ -34,6 +35,21 @@ if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
if($action === 'downloadblockchain') {
$auth = new BlockedLogAuthority($db);
$bc = $auth->getLocalBlockChain();
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"" .$auth->signature. ".certif\"");
echo $bc;
exit;
}
/* /*
* View * View
...@@ -58,7 +74,7 @@ print $langs->trans("FingerprintsDesc")."<br>\n"; ...@@ -58,7 +74,7 @@ print $langs->trans("FingerprintsDesc")."<br>\n";
print '<br>'; print '<br>';
echo '<div align="right"><a href="?all=1">'.$langs->trans('ShowAllFingerPrintsMightBeTooLong').'</a></div>'; echo '<div align="right"><a href="?all=1">'.$langs->trans('ShowAllFingerPrintsMightBeTooLong').'</a> <a href="?action=downloadblockchain">'.$langs->trans('DownloadBlockChain').'</a></div>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
......
...@@ -56,6 +56,29 @@ class BlockedLogAuthority ...@@ -56,6 +56,29 @@ class BlockedLogAuthority
} }
/**
* Get the blockchain
*
* @return string blockchain
*/
public function getLocalBlockChain() {
$block_static = new BlockedLog($this->db);
$this->signature = $block_static->getSignature();
$blocks = $block_static->getLog('all', 0, 0, 1) ;
$this->blockchain = '';
foreach($blocks as &$b) {
$this->blockchain.=$b->signature;
}
return $this->blockchain;
}
/** /**
* Get hash of the block chain to check * Get hash of the block chain to check
* *
......
...@@ -409,7 +409,7 @@ CREATE TABLE llx_blockedlog ...@@ -409,7 +409,7 @@ CREATE TABLE llx_blockedlog
date_object datetime, date_object datetime,
object_data text, object_data text,
fk_user integer, fk_user integer,
entity integer, entity integer DEFAULT 1,
certified integer certified integer
) ENGINE=innodb; ) ENGINE=innodb;
......
...@@ -13,7 +13,7 @@ CREATE TABLE llx_blockedlog ...@@ -13,7 +13,7 @@ CREATE TABLE llx_blockedlog
date_object datetime, date_object datetime,
object_data text, object_data text,
fk_user integer, fk_user integer,
entity integer, entity integer DEFAULT 1,
certified integer certified integer
) ENGINE=innodb; ) ENGINE=innodb;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment