OK
'.PHP_EOL;
else echo ' KO
'.PHP_EOL;
//
// "strict" est un flag qui indique que l'on veut précisément
// ce que les paramètres demandent
//
if (($img==null)&&(!isset($_REQUEST['strict'])))
{
//
// On n'a pas passé de HASH
//
if (($img==null)&&(!isset($_REQUEST['hash'])))
{
//
// On prend le dernier connu pour la méthode et le mode
//
$myarray = glob(DATA_PATH.'/'.$methode.'/*-'.$mode.'.png');
if (isset($myarray[0]))
{
usort( $myarray, function( $a, $b ) { return filemtime($a) - filemtime($b); } );
echo $myarray[0].' OK
'.PHP_EOL;
$img=true;
}
//
// On prend le dernier connu pour la méthode tout mode confondu
//
if ($img==null)
{
$myarray = glob(DATA_PATH.'/'.$methode.'/*.png');
if (isset($myarray[0]))
{
usort( $myarray, function( $a, $b ) { return filemtime($a) - filemtime($b); } );
echo $myarray[0].' OK
'.PHP_EOL;
$img=true;
}
}
}
//
// On a passé un HASH
//
if (($img==null)&&(isset($_REQUEST['hash'])))
{
//
// On cherche le bon HASH et la bonne méthode
//
$imagefilename = DATA_PATH.'/'.$methode.'/'.$block_hash.'.png';
if (($img==null)&&(file_exists($imagefilename)))
{
echo $imagefilename.' OK
'.PHP_EOL;
$img=true;
}
//
// En fait on s'en fiche de la méthode tant qu'on a le bon HASH
//
$imagefilename = DATA_PATH.'/hasard/'.$block_hash.'.png';
if (($img==null)&&(file_exists($imagefilename)))
{
echo $imagefilename.' OK
'.PHP_EOL;
$img=true;
}
}
}
//
// On n'a rien trouvé, donc on dessine ce qui est demandé
//
if ($img==null) echo 'KO
';
?>