|
|
<?php
|
|
|
|
|
|
// ---
|
|
|
// --- La config globale
|
|
|
// ---
|
|
|
chdir('/opt/TOPISTO/apps');
|
|
|
require_once '/opt/TOPISTO/apps/global/inc/config.php';
|
|
|
|
|
|
// ---
|
|
|
// --- External dependances
|
|
|
// ---
|
|
|
require TOPISTO_PATH.'/ressources/vendor/autoload.php';
|
|
|
|
|
|
// ---
|
|
|
// --- Internal dependances
|
|
|
// ---
|
|
|
require_once APP_PATH.'/blockchain/inc/block.php';
|
|
|
|
|
|
function cmp_emptyblocks($a, $b)
|
|
|
{
|
|
|
if ($a[1] == $b[1]) {
|
|
|
return 0;
|
|
|
}
|
|
|
return ($a[1] < $b[1]) ? 1 : -1;
|
|
|
}
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
|
$emptyblocks_list = [];
|
|
|
$filename=DATA_PATH."/emptybot/list.txt";
|
|
|
if (file_exists($filename))
|
|
|
{
|
|
|
$file = fopen(DATA_PATH."/emptybot/list.txt","r");
|
|
|
while(!feof($file))
|
|
|
{
|
|
|
$ligne=fgets($file);
|
|
|
$tableau=explode(' ', $ligne);
|
|
|
if ($tableau[1] != null)
|
|
|
$emptyblocks_list[] = [ $tableau[1], $tableau[2] ];
|
|
|
}
|
|
|
fclose($file);
|
|
|
}
|
|
|
|
|
|
usort($emptyblocks_list, "cmp_emptyblocks");
|
|
|
|
|
|
die(json_encode($emptyblocks_list));
|
|
|
|
|
|
?>
|