<?php require dirname(__FILE__) . '/../../ui/lib/pageheader.php'; $renter = getrenterparam(getparam('address')); if (!$renter) { return; } $this->pageTitle = "{$renter->address} | yiimp"; echo "<div class='main-left-box'>"; echo "<div class='main-left-title'>Transactions from {$renter->address}</div>"; echo "<div class='main-left-inner'>"; echo "<table class='dataGrid2'>"; echo "<thead class=''>"; echo "<tr>"; echo "<th>Time</th>"; echo "<th>Amount</th>"; echo "<th>Confirmations</th>"; echo "<th>Tx</th>"; echo "</tr>"; echo "</thead><tbody>"; $btc = getdbosql('db_coins', "symbol='BTC'"); if (!$btc) { return; } $remote = new Bitcoin($btc->rpcuser, $btc->rpcpasswd, $btc->rpchost, $btc->rpcport); $ts = $remote->listtransactions(yaamp_renter_account($renter), 10); $res_array = array(); foreach ($ts as $val) { $t = $val['time']; if ($t < $renter->created) { continue;
public function actionWithdraw() { $fees = 0.0001; $deposit = user()->getState('yaamp-deposit'); if (!$deposit) { $this->render('login'); return; } $renter = getrenterparam($deposit); if (!$renter) { $this->render('login'); return; } $amount = getparam('withdraw_amount'); $address = getparam('withdraw_address'); $amount = floatval(bitcoinvaluetoa(min($amount, $renter->balance - $fees))); if ($amount < 0.001) { user()->setFlash('error', 'Minimum withdraw is 0.001'); $this->redirect("/renting"); return; } $coin = getdbosql('db_coins', "symbol='BTC'"); if (!$coin) { return; } $remote = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport); $res = $remote->validateaddress($address); if (!$res || !isset($res['isvalid']) || !$res['isvalid']) { user()->setFlash('error', 'Invalid address'); $this->redirect("/renting"); return; } $rentertx = new db_rentertxs(); $rentertx->renterid = $renter->id; $rentertx->time = time(); $rentertx->amount = $amount; $rentertx->type = 'withdraw'; $rentertx->address = $address; $rentertx->tx = 'scheduled'; $rentertx->save(); debuglog("withdraw scheduled {$renter->id} {$renter->address}, {$amount} to {$address}"); user()->setFlash('message', "withdraw scheduled"); $this->redirect("/renting"); }
<?php $algo = user()->getState('yaamp-algo'); JavascriptFile("/extensions/jqplot/jquery.jqplot.js"); JavascriptFile("/extensions/jqplot/plugins/jqplot.dateAxisRenderer.js"); JavascriptFile("/extensions/jqplot/plugins/jqplot.barRenderer.js"); JavascriptFile("/extensions/jqplot/plugins/jqplot.highlighter.js"); JavascriptFile("/extensions/jqplot/plugins/jqplot.cursor.js"); JavascriptFile('/yaamp/ui/js/auto_refresh.js'); $this->widget('UniForm'); $renter = getrenterparam(user()->getState('yaamp-deposit')); if (!$renter) { return; } echo <<<end <style> .yaamp-login-container { \tpadding: 20px; \tborder: 1px solid #ddd; \tborder-radius: 8px; \t-moz-border-radius: 8px; \t-webkit-border-radius: 8px; } </style> <table cellspacing=20 width=100%> <tr><td valign=top width=50%> <div class="yaamp-login-container"> <form action='/renting?address={$renter->address}' method='post'>