special_blocks is now an array of objects , and add getSpecialBlocksJSON
This commit is contained in:
@@ -1,5 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
class block
|
||||||
|
{
|
||||||
|
public $hash = null;
|
||||||
|
public $height = null;
|
||||||
|
public $name = null;
|
||||||
|
public $desc = null;
|
||||||
|
|
||||||
|
function __construct($ahash, $aheight, $aname = null, $adesc = null)
|
||||||
|
{
|
||||||
|
$this->hash = $ahash;
|
||||||
|
$this->height = $aheight;
|
||||||
|
$this->name = $aname;
|
||||||
|
$this->desc = $adesc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class blockchain
|
class blockchain
|
||||||
{
|
{
|
||||||
private static $url_info = 'https://blockchain.info/fr';
|
private static $url_info = 'https://blockchain.info/fr';
|
||||||
@@ -19,33 +35,128 @@ class blockchain
|
|||||||
* 'SEGWIT_LOCK' - Block 479808 SEGWIT est verrouillé 09 08 2017
|
* 'SEGWIT_LOCK' - Block 479808 SEGWIT est verrouillé 09 08 2017
|
||||||
* 'SEGWIT' - Block 481823 SEGWIT est activé 24 08 2017
|
* 'SEGWIT' - Block 481823 SEGWIT est activé 24 08 2017
|
||||||
*/
|
*/
|
||||||
private static $special_blocks = array (
|
private static $special_blocks = null;
|
||||||
'GENESIS' => '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f',
|
|
||||||
'THE_ANSWER' => '00000000314e90489514c787d615cea50003af2023796ccdd085b6bcc1fa28f5',
|
//
|
||||||
'LUCIFER' => '00000000fc5b3c76f27f810ee775e480ae7fd604fd196b2d8da4257fcd39f4f9',
|
// Init special blocks array ...
|
||||||
'LEET' => '000000008bf44a528a09d203203a6a97c165cf53a92ecc27aed0b49b86a19564',
|
//
|
||||||
'TOPISTO' => '000000000a73e64735a2b75c97ea674950a9018da1420d01328a918c9ff9852c',
|
public static function init()
|
||||||
'PIZZA' => '00000000006de085dadb3ec413ef074022fe781121b467e98960280dd246bb00',
|
{
|
||||||
'HALVING_1' => '000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e',
|
self::$special_blocks = array ();
|
||||||
'WHALE201311' => '0000000000000001bc7156dd1183c87859b326affa3a5cdd157e809537f0b284',
|
|
||||||
'HALVING_2' => '000000000000000002cce816c0ab2c5c269cb081896b7dcb34b8422d6b74ffa1',
|
self::$special_blocks[] = new block(
|
||||||
'BIP_91_LOCK' => '0000000000000000015411ca4b35f7b48ecab015b14de5627b647e262ba0ec40',
|
'0000000000000000000f9f2dadfb8f312572183272802cbfcc4ff95b4ee6777d',
|
||||||
'BCC' => '00000000000000000019f112ec0a9982926f1258cdcc558dd7c3b7e5dc7fa148',
|
545911,
|
||||||
'SEGWIT_LOCK' => '0000000000000000012e6060980c6475a9a8e62a1bf44b76c5d51f707d54522c',
|
'WHALE201810'
|
||||||
'SEGWIT' => '000000000000000000cbeff0b533f8e1189cf09dfbebf57a8ebe349362811b80',
|
|
||||||
'HURRICANE_1' => '0000000000000000000fe6d521a187a5523d5cef6f6c178923ff82ffe5a0f372',
|
|
||||||
'BLOCK21E800' => '00000000000000000021e800c1e8df51b22c1588e5a624bea17e9faa34b2dc4a',
|
|
||||||
'WHALE201810' => '0000000000000000000f9f2dadfb8f312572183272802cbfcc4ff95b4ee6777d'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
self::$special_blocks[] = new block(
|
||||||
|
'00000000000000000021e800c1e8df51b22c1588e5a624bea17e9faa34b2dc4a',
|
||||||
|
528249,
|
||||||
|
'BLOCK21E800'
|
||||||
|
);
|
||||||
|
|
||||||
|
self::$special_blocks[] = new block(
|
||||||
|
'0000000000000000000fe6d521a187a5523d5cef6f6c178923ff82ffe5a0f372',
|
||||||
|
506734,
|
||||||
|
'HURRICANE_1'
|
||||||
|
);
|
||||||
|
|
||||||
|
self::$special_blocks[] = new block(
|
||||||
|
'000000000000000000cbeff0b533f8e1189cf09dfbebf57a8ebe349362811b80',
|
||||||
|
481823,
|
||||||
|
'SEGWIT'
|
||||||
|
);
|
||||||
|
|
||||||
|
self::$special_blocks[] = new block(
|
||||||
|
'0000000000000000012e6060980c6475a9a8e62a1bf44b76c5d51f707d54522c',
|
||||||
|
479808,
|
||||||
|
'SEGWIT_LOCK'
|
||||||
|
);
|
||||||
|
|
||||||
|
self::$special_blocks[] = new block(
|
||||||
|
'00000000000000000019f112ec0a9982926f1258cdcc558dd7c3b7e5dc7fa148',
|
||||||
|
478559,
|
||||||
|
'BCC'
|
||||||
|
);
|
||||||
|
|
||||||
|
self::$special_blocks[] = new block(
|
||||||
|
'0000000000000000015411ca4b35f7b48ecab015b14de5627b647e262ba0ec40',
|
||||||
|
477120,
|
||||||
|
'BIP_91_LOCK'
|
||||||
|
);
|
||||||
|
|
||||||
|
self::$special_blocks[] = new block(
|
||||||
|
'000000000000000002cce816c0ab2c5c269cb081896b7dcb34b8422d6b74ffa1',
|
||||||
|
420000,
|
||||||
|
'HALVING_2'
|
||||||
|
);
|
||||||
|
|
||||||
|
self::$special_blocks[] = new block(
|
||||||
|
'0000000000000001bc7156dd1183c87859b326affa3a5cdd157e809537f0b284',
|
||||||
|
270953,
|
||||||
|
'WHALE201311'
|
||||||
|
);
|
||||||
|
|
||||||
|
self::$special_blocks[] = new block(
|
||||||
|
'000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e',
|
||||||
|
210000,
|
||||||
|
'HALVING_1'
|
||||||
|
);
|
||||||
|
|
||||||
|
self::$special_blocks[] = new block(
|
||||||
|
'00000000006de085dadb3ec413ef074022fe781121b467e98960280dd246bb00',
|
||||||
|
57035,
|
||||||
|
'PIZZA'
|
||||||
|
);
|
||||||
|
|
||||||
|
self::$special_blocks[] = new block(
|
||||||
|
'000000000a73e64735a2b75c97ea674950a9018da1420d01328a918c9ff9852c',
|
||||||
|
5637,
|
||||||
|
'TOPISTO'
|
||||||
|
);
|
||||||
|
|
||||||
|
self::$special_blocks[] = new block(
|
||||||
|
'000000008bf44a528a09d203203a6a97c165cf53a92ecc27aed0b49b86a19564',
|
||||||
|
1337,
|
||||||
|
'LEET'
|
||||||
|
);
|
||||||
|
|
||||||
|
self::$special_blocks[] = new block(
|
||||||
|
'00000000fc5b3c76f27f810ee775e480ae7fd604fd196b2d8da4257fcd39f4f9',
|
||||||
|
666,
|
||||||
|
'LUCIFER'
|
||||||
|
);
|
||||||
|
|
||||||
|
self::$special_blocks[] = new block(
|
||||||
|
'00000000314e90489514c787d615cea50003af2023796ccdd085b6bcc1fa28f5',
|
||||||
|
42,
|
||||||
|
'THE_ANSWER'
|
||||||
|
);
|
||||||
|
|
||||||
|
self::$special_blocks[] = new block(
|
||||||
|
'000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f',
|
||||||
|
0,
|
||||||
|
'GENESIS'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---
|
||||||
|
// --- Retourne le JSON du tableau des blocs speciaux
|
||||||
|
// ---
|
||||||
|
public static function getSpecialBlocksJSON()
|
||||||
|
{
|
||||||
|
return json_encode(self::$special_blocks);
|
||||||
|
}
|
||||||
|
|
||||||
// ---
|
// ---
|
||||||
// --- Retourne le nom d'un block à partie de son hash
|
// --- Retourne le nom d'un block à partie de son hash
|
||||||
// --- si ce n'est pas un block special, on renvoie le hash
|
// --- si ce n'est pas un block special, on renvoie le hash
|
||||||
// ---
|
// ---
|
||||||
public static function hash2SpecialName($block_hash)
|
public static function hash2SpecialName($block_hash)
|
||||||
{
|
{
|
||||||
foreach(self::$special_blocks as $key => $value)
|
foreach(self::$special_blocks as $value)
|
||||||
if ($block_hash == $value) return $key;
|
if ($block_hash == $value->hash) return $value->name;
|
||||||
|
|
||||||
return $block_hash;
|
return $block_hash;
|
||||||
}
|
}
|
||||||
@@ -59,7 +170,14 @@ class blockchain
|
|||||||
{
|
{
|
||||||
$block_hash = '';
|
$block_hash = '';
|
||||||
|
|
||||||
if (isset(self::$special_blocks[$nom_du_block])) $block_hash = self::$special_blocks[$nom_du_block];
|
foreach(self::$special_blocks as $value)
|
||||||
|
{
|
||||||
|
if ($nom_du_block == $value->name)
|
||||||
|
{
|
||||||
|
$block_hash = $value->hash;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (file_exists(self::$offline_block)) $block_hash = 'offline';
|
if (file_exists(self::$offline_block)) $block_hash = 'offline';
|
||||||
|
|
||||||
@@ -78,7 +196,7 @@ class blockchain
|
|||||||
if (isset($myarray[0]))
|
if (isset($myarray[0]))
|
||||||
{
|
{
|
||||||
usort( $myarray, function( $a, $b ) { return filemtime($b) - filemtime($a); } );
|
usort( $myarray, function( $a, $b ) { return filemtime($b) - filemtime($a); } );
|
||||||
return substr(basename($myarray[0],'.png'),0,strlen(self::$special_blocks['GENESIS']));
|
return substr(basename($myarray[0],'.png'),0,strlen(self::$special_blocks[0]->hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
// S'il n'y a rien dans le cache d'images
|
// S'il n'y a rien dans le cache d'images
|
||||||
@@ -443,4 +561,6 @@ class blockchain
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
blockchain::init();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
1
twitter/twitterbot/followers.json
Normal file
1
twitter/twitterbot/followers.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
["CryptoPressNews"]
|
||||||
Reference in New Issue
Block a user