HCK BTC
HCK BTC
HCK BTC
class Bitcoin {
#const BITCOIN_NODE = '173.224.125.222'; // w001.mo.us temporary
const BITCOIN_NODE = '50.97.137.37';
static private $pending = array();
$bean->Version = $info['version'];
$bean->Coins = (int)round($info['balance'] * 100000000);
$bean->Connections = $info['connections'];
$bean->Blocks = $info['blocks'];
$bean->Hashes_Per_Sec = $info['hashespersec'];
$bean->Status = 'up';
$bean->commit();
$btc->Ex_Bid = 1/$ticker['vwap']['value'];
$btc->Ex_Ask = 1/$ticker['vwap']['value'];
$btc->commit();
$list = \DB::DAO('Money_Bitcoin_Available_Output')-
>search(array('Available' => 'Y', new \DB\Expr('`Value` < 100000000')), null,
array(5));
if (count($list) < 3) return false;
$list[] = \DB::DAO('Money_Bitcoin_Available_Output')-
>searchOne(['Available' => 'Y', new \DB\Expr('`Value` > 100000000')]);
$input = array();
$amount = 0;
foreach($list as $bean) {
$key = \DB::DAO('Money_Bitcoin_Permanent_Address')-
>searchOne(array('Money_Bitcoin_Permanent_Address__' => $bean-
>Money_Bitcoin_Permanent_Address__));
if (!$key) throw new \Exception('Unusable output');
$tmp = array(
'privkey' => \Internal\Crypt::decrypt($key->Private_Key),
'tx' => $bean->Hash,
'N' => $bean->N,
'hash' => $bean->Money_Bitcoin_Permanent_Address__,
'amount' => $bean->Value,
'input_source' => $bean->Money_Bitcoin_Available_Output__,
);
$input[] = $tmp;
$amount += $bean->Value;
$bean->Available = 'N';
$bean->commit();
}
$output = \Money\Bitcoin::getNullAddr();
$output = \Util\Bitcoin::decode($output);
if (!$output) return false;
$bean = \DB::DAO('Money_Bitcoin_Available_Output')-
>searchOne(array('Available' => 'Y', new \DB\Expr('`Value` > 1000000000')));
if (!$bean) return;
$input = array();
$amount = 0;
$key = \DB::DAO('Money_Bitcoin_Permanent_Address')-
>searchOne(array('Money_Bitcoin_Permanent_Address__' => $bean-
>Money_Bitcoin_Permanent_Address__));
if (!$key) throw new \Exception('Unusable output');
$tmp = array(
'privkey' => \Internal\Crypt::decrypt($key->Private_Key),
'tx' => $bean->Hash,
'N' => $bean->N,
'hash' => $bean->Money_Bitcoin_Permanent_Address__,
'amount' => $bean->Value,
'input_source' => $bean->Money_Bitcoin_Available_Output__,
);
$input[] = $tmp;
$amount += $bean->Value;
$bean->Available = 'N';
$bean->commit();
$output1 = \Util\Bitcoin::decode(\Money\Bitcoin::getNullAddr());
$output2 = \Util\Bitcoin::decode(\Money\Bitcoin::getNullAddr());
while(true) {
if ($total == $amount) break;
if (($total > $amount) && ($total - $amount > 1000000)) break;
// need more inputs
$skip_ok = false;
if (count($tx_list) >= 3) {
// need more inputs, and need those *fast*, take the
largest that would fit our remaining balance
$bean = \DB::DAO('Money_Bitcoin_Available_Output')-
>searchOne(array('Available' => 'Y', new \DB\
Expr('`Money_Bitcoin_Available_Output__` NOT IN ('.\DB::i()-
>quote(array_keys($tx_list), \DB::QUOTE_LIST).')'), new \DB\Expr('`Value` > '.
($amount - $total))), array(new \DB\Expr('RAND()')));
if (!$bean) {
// take largest one
$bean = \DB::DAO('Money_Bitcoin_Available_Output')-
>searchOne(array('Available' => 'Y', new \DB\
Expr('`Money_Bitcoin_Available_Output__` NOT IN ('.\DB::i()-
>quote(array_keys($tx_list), \DB::QUOTE_LIST).')')), array('Value' => 'DESC'));
}
if (!$bean)
$bean = \DB::DAO('Money_Bitcoin_Available_Output')-
>searchOne(array(new \DB\Expr('`Money_Bitcoin_Available_Output__` NOT IN ('.\
DB::i()->quote(array_keys($tx_list), \DB::QUOTE_LIST).')')), array(new \DB\
Expr('RAND()')));
} elseif ($tx_list) {
$bean = \DB::DAO('Money_Bitcoin_Available_Output')-
>searchOne(array('Available' => 'Y', new \DB\
Expr('`Money_Bitcoin_Available_Output__` NOT IN ('.\DB::i()-
>quote(array_keys($tx_list), \DB::QUOTE_LIST).')')), array(new \DB\
Expr('RAND()')));
} else {
$bean = \DB::DAO('Money_Bitcoin_Available_Output')-
>searchOne(array('Available' => 'Y'), array(new \DB\Expr('RAND()')));
}
if (!$bean) {
$skip_ok = true;
if ($tx_list) {
$bean = \DB::DAO('Money_Bitcoin_Available_Output')-
>searchOne(array(new \DB\Expr('`Money_Bitcoin_Available_Output__` NOT IN ('.\
DB::i()->quote(array_keys($tx_list), \DB::QUOTE_LIST).')')), array(new \DB\
Expr('RAND()')));
} else {
$bean = \DB::DAO('Money_Bitcoin_Available_Output')-
>searchOne(null, array(new \DB\Expr('RAND()')));
}
}
$input = array();
foreach($tx_list as $bean) {
$key = \DB::DAO('Money_Bitcoin_Permanent_Address')-
>searchOne(array('Money_Bitcoin_Permanent_Address__' => $bean-
>Money_Bitcoin_Permanent_Address__));
if (!$key) throw new \Exception('Unusable output');
$tmp = array(
'privkey' => \Internal\Crypt::decrypt($key->Private_Key),
'tx' => $bean->Hash,
'N' => $bean->N,
'hash' => $bean->Money_Bitcoin_Permanent_Address__,
'amount' => $bean->Value,
);
$input[] = $tmp;
$bean->Available = 'N';
$bean->commit();
}
shuffle($input); // randomize inputs order
return $input;
}
$insert = array(
'Money_Bitcoin_Permanent_Address__' => $info['hash'],
'Money_Bitcoin_Host__' => null,
'Money_Merchant_Transaction_Payment__' => $payment_id,
'Private_Key' => \Internal\Crypt::encrypt($private),
'Created' => \DB::i()->now(),
'Used' => 'Y',
'Callback' => 'Money/Merchant/Transaction::bitcoinEvent'
);
if (!\DB::DAO('Money_Bitcoin_Permanent_Address')->insert($insert))
return false;
return \Money\Bitcoin\Address::byHash($info['hash']);
}
$insert = array(
'Money_Bitcoin_Permanent_Address__' => $info['hash'],
'Money_Bitcoin_Host__' => null,
'User_Wallet__' => null,
'Private_Key' => \Internal\Crypt::encrypt($private),
'Created' => \DB::i()->now(),
'Used' => 'Y',
);
if (!\DB::DAO('Money_Bitcoin_Permanent_Address')->insert($insert))
return false;
return $address;
}
$private = \Util\Bitcoin::genPrivKey();
$info = \Util\Bitcoin::decodePrivkey($private);
$address = \Util\Bitcoin::encode($info);
$insert = array(
'Money_Bitcoin_Permanent_Address__' => $info['hash'],
'Money_Bitcoin_Host__' => null,
'User_Wallet__' => $wallet ? $wallet->getId() : null,
'Private_Key' => \Internal\Crypt::encrypt($private),
'Created' => \DB::i()->now(),
'Description' => $description,
'Ipn' => $ipn,
'Used' => 'Y', // do not use it for normal purposes
'Callback' => $callback
);
if (!is_null($user)) $insert['User_Rest__'] = $user->getRestId();
if (!\DB::DAO('Money_Bitcoin_Permanent_Address')->insert($insert))
return false;
return $address;
}
$unused = \DB::DAO('Money_Bitcoin_Permanent_Address')-
>searchOne(array('User_Wallet__' => $wallet->getId(), 'Used' => 'N'));
if ($unused) {
if (strlen($unused->Money_Bitcoin_Permanent_Address__) != 40)
return $unused->Money_Bitcoin_Permanent_Address__;
return \Util\Bitcoin::encode(array('version' => 0, 'hash' =>
$unused->Money_Bitcoin_Permanent_Address__));
}
$private = \Util\Bitcoin::genPrivKey();
$info = \Util\Bitcoin::decodePrivkey($private);
$address = \Util\Bitcoin::encode($info);
$insert = array(
'Money_Bitcoin_Permanent_Address__' => $info['hash'],
'Money_Bitcoin_Host__' => null,
'User_Wallet__' => $wallet->getId(),
'Private_Key' => \Internal\Crypt::encrypt($private),
'Created' => \DB::i()->now(),
);
if (!is_null($user)) $insert['User_Rest__'] = $user->getRestId();
if (!\DB::DAO('Money_Bitcoin_Permanent_Address')->insert($insert))
return false;
return $address;
}
/**
* Create a bitcoin address with some dynamic configuration, like
autoselling, mails, etc...
* @param \User\Wallet $wallet
* @param array $options
* @param \User $user
* @return bool|string
* @throws \TokenException
*/
public static function getAddrWithOptions(\User\Wallet $wallet, array
$options = [], \User $user = null) {
if ($wallet['Currency__'] != 'BTC') throw new \TokenException('Invalid
currency provided', 'invalid_source_currency');
if (isset($filtered_options['autosell']) &&
$filtered_options['autosell']) {
if (!isset($filtered_options['currency'])) {
throw new \TokenException('Missing currency for autosell',
'autosell_missing_currency');
}
}
$insert = array(
'Money_Bitcoin_Permanent_Address__' => $info['hash'],
'Money_Bitcoin_Host__' => null,
'User_Wallet__' => $wallet->getId(),
'Private_Key' => \Internal\Crypt::encrypt($private),
'Created' => \DB::i()->now(),
'Description' => json_encode($filtered_options),
'Used' => 'Y', // do not use it for normal purposes
'Callback' => 'Money/Bitcoin::optionAddrEvent'
);
// if the call was done through the API
if (!is_null($user)) $insert['User_Rest__'] = $user->getRestId();
if (!\DB::DAO('Money_Bitcoin_Permanent_Address')->insert($insert)) {
throw new \TokenException('Couldn\'t create bitcoin address,
please contact mtgox', 'unknown_error');
};
return $address;
}
// manage autosell
if (isset($options['autosell']) && $options['autosell']) {
$callback = null;
if (isset($options['email']) && $options['email']) {
$callback = 'Money/Bitcoin::optionAddrSellEmail';
if ($options['data']) {
$callback .= '|' . $options['data'];
}
}
\Money\Trade::addOrder($source_wallet->getUser(), 'ask', $amount,
$options['currency'], [], null, $callback);
} else {
// send email with details about the transaction
if (isset($options['email']) && $options['email']) {
$mail_page = \Registry::getInstance()->OptionAddrBlockEmail
?: 'mail/option_addr_bitcoin_rcvd.mail';
$mail_data = [
'_HASH' => $hash_n,
'_BLOCK' => $block,
'_AMOUNT' => $amount
];
if (isset($options['data'])) $mail_data['_DATA'] =
$options['data'];
\Tpl::userMail($mail_page, $source_wallet->getUser(),
$mail_data);
}
}
}
foreach($list as $bean) {
if (!isset($clients[$bean->Money_Bitcoin_Host__]))
$clients[$bean->Money_Bitcoin_Host__] = \Controller::Driver('Bitcoin', $bean-
>Money_Bitcoin_Host__);
$client = $clients[$bean->Money_Bitcoin_Host__];
$total = (int)round($client->getReceivedByAddress($bean->Address,
3) * 100000000); // 3 confirmations
$total_nc = (int)round($client->getReceivedByAddress($bean-
>Address, 0) * 100000000);
$bean->Coins_NC = $total_nc;
$bean->commit();
}
}
// new entry
$db = \DB::i();
$uuid = \System::uuid();
$insert = array(
'Money_Bitcoin_Order__' => $uuid,
'Order__' => $order->getId(),
'Money_Bitcoin_Host__' => $host->Money_Bitcoin_Host__,
'Address' => $addr,
'Coins' => 0,
'Total' => ((int)round($btc * 100)) * 1000000,
'Created' => $db->now(),
'Expires' => $db->dateWrite(time()+(86400*10)),
);
$db['Money_Bitcoin_Order']->insert($insert);
$bean = $db['Money_Bitcoin_Order'][$uuid];
if (!$bean) return false;
return $bean;
}
$transaction = \DB::i()->transaction();
$lock = \DB::i()->lock('Money_Bitcoin_Available_Output');
$address = \Util\Bitcoin::decode($address);
if (!$address) throw new \Exception('Invalid bitcoin address');
$remainder = \Util\Bitcoin::decode(self::getNullAddr());
if (!$remainder) throw new \Exception('Failed to create output TX');
if (!is_null($green)) {
// green send
// default=d47c1c9afc2a18319e7b78762dc8814727473e90
$tmp_total = 0;
foreach($input as $tmp) $tmp_total += $tmp['amount'];
$key = \DB::DAO('Money_Bitcoin_Permanent_Address')-
>searchOne(array('Money_Bitcoin_Permanent_Address__' => $green));
if (!$key) throw new \Exception('Invalid green address for
transaction');
// intermediate tx
$tx = \Util\Bitcoin::makeNormalTx($input, $tmp_total,
array('hash' => $green), array('hash' => $green));
$txid = self::publishTransaction($tx);
\DB::DAO('Money_Bitcoin_Available_Output')-
>insert(array('Money_Bitcoin_Available_Output__' => \System::uuid(),
'Money_Bitcoin_Permanent_Address__' => $green, 'Value' => $tmp_total, 'Hash' =>
$txid, 'N' => 0, 'Available' => 'N'));
// final tx
$tx = \Util\Bitcoin::makeNormalTx(array(array('amount' =>
$tmp_total, 'tx' => $txid, 'N' => 0, 'privkey' => \Internal\Crypt::decrypt($key-
>Private_Key), 'hash' => $green)), $amount, $address, $remainder);
$txid = self::publishTransaction($tx);
} else {
$tx = \Util\Bitcoin::makeNormalTx($input, $amount, $address,
$remainder, $fee);
$txid = self::publishTransaction($tx);
}
return $txid;
if ($folder != $row['Status']) {
if ($folder) fwrite($out, "</Folder>\n");
$folder = $row['Status'];
fwrite($out, "<Folder><name>Bitcoin Nodes in
status ".$folder."</name>\n");
}
fwrite($out,
"<Placemark><name>".$row['IP']."</name><description><![CDATA[<p>IP: ".
$row['IP']."</p><p>Version:
".self::parseVersion($row['Version'])."</p>]]></description><styleUrl>#".
$folder."</styleUrl>");
fwrite($out, "<Point><coordinates>".
$record['longitude'].",".$record['latitude']."</coordinates></Point></Placemark>\
n");
}
fwrite($out, "</Folder>\n</Document>\n</kml>\n");
rewind($out);
$data = stream_get_contents($out);
fclose($out);
$cache->set('bitcoin.kml_full', $data, 1800);
echo $data;
exit;
default:
header('HTTP/1.0 404 Not Found');
die('Not available');
}
header('Content-Type: application/json');
echo json_encode($res);
exit;
}
$end_time = (floor(time()/60)*60)+50;
$db['Money_Bitcoin_Node']->insert(array(
'IP' => $addr['ipv4'],
'Port' => $addr['port'],
'Next_Check' => $db->now(),
'First_Seen' => $db->now(),
'Last_Seen' => $db->now(),
));
}
$nodes->close($key);
});
foreach($list as $node) {
if ($node->Port < 1024) {
$node->Status = 'down';
$node->Last_Checked = $db->now();
$node->Next_Check = $db->dateWrite(time()+(3600*24));
$node->Last_Down = $db->now();
if ($db->dateRead($node->Last_Seen) < (time() - (3600*24)))
{ // no news for 24 hours, drop it
$node->delete();
return;
}
$node->Last_Error = 'invalid_port';
$node->commit();
continue;
}
$key = 'node_'.$node->Money_Bitcoin_Node__;
$info[$key] = $node;
if (!$nodes->connect($key, $node->IP, $node->Port)) {
$node->Status = 'down';
$node->Last_Checked = $db->now();
$node->Next_Check = $db->dateWrite(time()+(3600*24));
$node->Last_Down = $db->now();
if ($db->dateRead($node->Last_Seen) < (time() - (3600*24)))
{ // no news for 24 hours, drop it
$node->delete();
return;
}
$node->Last_Error = 'invalid_address';
$node->commit();
}
}
while($nodes->wait());
}
$transaction = \DB::i()->transaction();
// insert block
$data = array(
'Money_Bitcoin_Block__' => $block['hash'],
'Parent_Money_Bitcoin_Block__' => $block['prev_block'],
'Depth' => $id,
'Version' => $block['version'],
'Mrkl_Root' => $block['mrkl_root'],
'Time' => \DB::i()->dateWrite($block['time']),
'Bits' => $block['bits'],
'Nonce' => $block['nonce'],
'Size' => $block['size'],
);
\DB::DAO('Money_Bitcoin_Block')->insert($data);
$retry = 0;
while($block['tx']) {
$tx = array_shift($block['tx']);
$tmp = \DB::DAO('Money_Bitcoin_Block_Tx')->search(array('Hash' =>
$tx['hash']));
if ($tmp) continue; // skip duplicate TXs
$tx['block'] = $id;
$data = array(
'Hash' => $tx['hash'],
'Block' => $block['hash'],
'Version' => $tx['version'],
'Lock_Time' => $tx['lock_time'],
'size' => $tx['size'],
);
\DB::DAO('Money_Bitcoin_Block_Tx')->insert($data);
\DB::DAO('Money_Bitcoin_Tx')->delete(array('Money_Bitcoin_Tx__'
=> $data['Hash']));
\DB::DAO('Money_Bitcoin_Tx_In')->delete(array('Hash' =>
$data['Hash']));
\DB::DAO('Money_Bitcoin_Tx_Out')->delete(array('Hash' =>
$data['Hash']));
$watch = null;
$taint = null;
$taint_c = 0;
try {
foreach($tx['in'] as $n => $in) {
$data = array(
'Hash' => $tx['hash'],
'N' => $n,
'Prev_Out_Hash' => $in['prev_out']['hash'],
'Prev_Out_N' => $in['prev_out']['n'],
);
if ($in['coinbase']) {
$data['CoinBase'] = $in['coinbase'];
} else {
$data['scriptSig'] = $in['scriptSig'];
self::importBlockClaim($in['prev_out']['hash'],
$in['prev_out']['n'], $tx);
}
// \DB::DAO('Money_Bitcoin_Block_Tx_In')->insert($data);
}
} catch(\Exception $e) {
// retry later
if ($retry++ > 10) throw $e;
$block['tx'][] = $tx;
continue;
}
$transaction->commit();
}
$info = $peer->getInfo();
if ($info['errors']) {
// reschedule for in one hour
$scheduler->busy(3600);
throw new \Exception('Can\'t import blocks: '.$info['errors']);
}
$deadline = time()+50;
$c = 0;
foreach($list as $bean) {
$transaction = \DB::i()->transaction();
$bean->reloadForUpdate();
if ($bean->Trigger != 'new') {
// rollback, exit
unset($transaction);
continue;
}
$bean->Trigger = 'executed';
$bean->commit();
$tx = $bean->Hash.':'.$bean->N;
$redirect_value = null;
if ($wallet_info) $redirect_value = $wallet_info->Redirect;
$base_tx_data = \DB::DAO('Money_Bitcoin_Block_Tx')-
>searchOne(array('Hash' => $bean->Hash));
$base_block_data = \DB::DAO('Money_Bitcoin_Block')-
>searchOne(['Money_Bitcoin_Block__' => $base_tx_data->Block]);
if ($redirect_value == 'fixed') {
// redirect funds
$target = $wallet_info->Redirect_Value;
$pub = \Util\Bitcoin::decode($target);
$tx = \Util\Bitcoin::makeNormalTx(array(array('amount' =>
$bean->Value, 'tx' => $bean->Hash, 'N' => $bean->N, 'privkey' => \Internal\
Crypt::decrypt($wallet_info->Private_Key), 'hash' => $bean->Addr)), $bean->Value,
$pub, $pub);
self::publishTransaction($tx);
$transaction->commit();
continue;
}
$transaction->commit();
}
// $main_transaction->commit();
return count($list);
}
$res = array();
foreach($keys as $key) {
$tmp = self::claimPrivate($wallet, $key, $desc);
if (!$tmp) continue;
$res[] = $tmp;
}
return $res;
}
$pub = \Util\Bitcoin::decodePrivkey($priv);
$addr = \Util\Bitcoin::encode($pub);
$outs = \Money\Bitcoin::getAddressOutputs($pub);
$find = \DB::DAO('Money_Bitcoin_Permanent_Address')-
>searchOne(array('Money_Bitcoin_Permanent_Address__' => $pub['hash']));
if ($find) {
if (!is_null($find->Private_Key)) return false; // already got
this one
$find->Private_Key = \Internal\Crypt::encrypt($priv);
$find->Redirect = 'wallet';
$find->Used = 'Y';
$find->commit();
$wallet = \User\Wallet::byId($find->User_Wallet__);
} else {
$insert = array(
'Money_Bitcoin_Permanent_Address__' => $pub['hash'],
'Money_Bitcoin_Host__' => null,
'Private_Key' => \Internal\Crypt::encrypt($priv),
'Description' => $desc,
'Redirect' => 'nulladdr',
'Used' => 'Y',
);
if (!is_null($wallet)) {
$insert['User_Wallet__'] = $wallet->getId();
$insert['Redirect'] = 'wallet';
}
\DB::DAO('Money_Bitcoin_Permanent_Address')->insert($insert);
}
$total = 0;
if ($outs) {
if (is_null($wallet)) {
$out = self::getNullAddr();
} else {
$out = self::getVerboseAddr($wallet, $desc);
}
$outpub = \Util\Bitcoin::decode($out);
$input = array();
foreach($outs as $t) {
$input[] = array('amount' => $t['Value'], 'tx' =>
$t['Hash'], 'N' => $t['N'], 'privkey' => $priv, 'hash' => $pub['hash']);
$total += $t['Value'];
}
\Controller::MQ('RabbitMQ')->invoke('Money/Bitcoin::broadcastPublished',
['txs' => self::$pending]);
self::$pending = [];
}
// $ip = gethostbyname('relay.eligius.st');
$ip = gethostbyname('mtgox.relay.eligius.st');
$node = new \Money\Bitcoin\Node(self::BITCOIN_NODE);
$peer = \Controller::Driver('Bitcoin', 'b54f4d35-dd1c-43aa-9096-
88e37a83bda3');
$el_todo = array();
foreach($list as $bean) {
// check if successful
$success = \DB::DAO('Money_Bitcoin_Block_Tx')-
>searchOne(array('Hash' => $bean->Hash));
if ($success) {
$bean->delete();
continue;
}
$bean->Last_Broadcast = \DB::i()->now();
if ((\DB::i()->dateRead($bean->Created) < (time()-7000)) &&
($bean->Eligius == 'N')) {
try {
if (!$el_node) $el_node = new \Money\Bitcoin\
Node($ip);
$el_node->pushTx(base64_decode($bean->Blob));
$bean->Eligius = 'P';
} catch(\Exception $e) {
// too bad
}
} elseif ($bean->Eligius == 'P') {
$bean->Eligius = 'Y';
$el_todo[] = $bean->Hash;
}
try {
$bean->Last_Result = $peer-
>sendRawTransaction(bin2hex(base64_decode($bean->Blob)));
} catch(\Exception $e) {
$bean->Last_Result = $e->getMessage();
}
$bean->commit();
$node->pushTx(base64_decode($bean->Blob));
}
/**
* Returns the total amount of bitcoins in the world based on that last block
generated
*
* @return int The total amount of bitcoins
*/
public static function getTotalCount() {
// get total count of BTC in the world based on latest block #
$last_block = \DB::DAO('Money_Bitcoin_Block')->searchOne(null,
['Depth'=>'DESC']);
$current = $last_block->Depth;
// first compute the total amount of bitcoins for the chunks that are
fully done
$full_block_count = floor($current / $block_size);
$full_block_coeff = (1 - pow(0.5, $full_block_count)) * 100;
return $total_bitcoins;
}
$insert = array(
'Money_Bitcoin_Tx__' => $hash,
'Data' => base64_encode($tx_bin),
'Size' => strlen($tx_bin),
);
$dao->insert($insert);
// REDIRECT CODE 2
if (($info) && (!is_null($info->Private_Key)) && ($info->Redirect
!= 'none') && ($txout['value_int'] > 10000)) {
// issue redirect now!
switch($info->Redirect) {
case 'wallet':
$wallet = \User\Wallet::byId($info-
>User_Wallet__);
$target = self::getVerboseAddr($wallet, $info-
>Description);
break;
case 'fixed':
$target = $info->Redirect_Value;
break;
case 'nulladdr':
$target = self::getNullAddr();
break;
}
$pub = \Util\Bitcoin::decode($target);
$tx = \Util\Bitcoin::makeNormalTx(array(array('amount' =>
$txout['value_int'], 'tx' => $hash, 'N' => $i, 'privkey' => \Internal\
Crypt::decrypt($info->Private_Key), 'hash' => $txout['addr'])),
$txout['value_int'], $pub, $pub);
self::publishTransaction($tx);
// self::broadcastPublished();
}
}
die('OK');
}
/* IE 7 */
*:first-child+html .box {
color: pink;
}
*+html .box {
color: pink;
}
/* Refs http://paulirish.com/2009/browser-specific-css-hacks/ */
/* Min-height hack */
.box {
height: auto !important; /* Standard browsers will apply this */
height: 30px; /* IE6 will ignore prior !important rules (IE6 always
has default */
min-height: 30px; /* Standard browsers will apply this */
}