first commit

This commit is contained in:
2018-09-02 09:39:01 +02:00
commit 90ff97c51a
172 changed files with 5686 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
<?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';
// ---
// --- Par défaut on cherche le dernier block
// ---
$block_hash = '*';
// ---
// --- Le cas échéant, on cherche block passé en argument
// ---
if (isset($_REQUEST['hash'])) $block_hash = $_REQUEST['hash'];
$img = null;
$myarray = glob(DATA_PATH.'/hasard/'.$block_hash.'.png');
if (isset($myarray[0]))
{
usort( $myarray, function( $a, $b ) { return filemtime($a) - filemtime($b); } );
$img = imagecreatefrompng($myarray[0]);
$seconds_to_cache = 7200;
$ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . " GMT";
header("Expires: $ts");
header("Pragma: cache");
header("Cache-Control: max-age=$seconds_to_cache");
header('Content-Type: image/png');
imagepng($img);
imagedestroy($img);
exit(0);
}
require_once('block_image.php');
?>