fix entity default value and add link to download blockchain
This commit is contained in:
parent
3cae54c296
commit
11d2a5538b
@ -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();
|
|||||||
|
|
||||||
$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";
|
|||||||
|
|
||||||
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%">';
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
/**
|
/**
|
||||||
* Class to manage certif authority
|
* Class to manage certif authority
|
||||||
*/
|
*/
|
||||||
class BlockedLogAuthority
|
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
|
||||||
*
|
*
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
* Class to manage Blocked Log
|
* Class to manage Blocked Log
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class BlockedLog
|
class 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
|
|||||||
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;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user