pool/web/yaamp/modules/explorer/ExplorerController.php
Tanguy Pruvot bb31cec957 dos2unix all files, we are on linux
trim them, btw... its important to start on a clean base...
2015-07-12 04:40:50 +02:00

56 lines
1.1 KiB
PHP

<?php
include "util.php";
class ExplorerController extends CommonController
{
public $defaultAction='index';
/////////////////////////////////////////////////
public function actionIndex()
{
if(isset($_COOKIE['mainbtc'])) return;
if(!LimitRequest('explorer')) return;
$id = getiparam('id');
$coin = getdbo('db_coins', $id);
$height = getparam('height');
if($coin && intval($height)>0)
{
$remote = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport);
$hash = $remote->getblockhash(intval($height));
}
else
$hash = getparam('hash');
$txid = getparam('txid');
if($coin && !empty($txid) && ctype_alnum($txid))
{
$remote = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport);
$tx = $remote->getrawtransaction($txid, 1);
$hash = $tx['blockhash'];
}
if($coin && !empty($hash) && ctype_alnum($hash))
$this->render('block', array('coin'=>$coin, 'hash'=>substr($hash, 0, 64)));
else if($coin)
$this->render('coin', array('coin'=>$coin));
else
$this->render('index');
}
}