Merge branch 'next' of github.com:TheSerapher/php-mmcfe-ng into next

This commit is contained in:
Sebastian Grewe 2013-07-22 10:41:56 +02:00
commit 00f7f3fadf
7 changed files with 20 additions and 8 deletions

View File

@ -69,6 +69,7 @@ Features
The following feature have been implemented so far:
* Fully re-written GUI with [Smarty][2] templates
* Mobile WebUI
* Reward Systems
* Propotional
@ -142,3 +143,4 @@ limitations under the License.
[1]: https://github.com/TheSerapher/php-mmcfe-ng/issues "Issue"
[2]: http://www.smarty.net/docs/en/ "Smarty"

View File

@ -108,8 +108,8 @@ class Block {
* @param limit int Maximum blocks to check
* @return data float Float value of average shares
**/
public function getAvgBlockShares($limit=10) {
$stmt = $this->mysqli->prepare("SELECT AVG(shares) AS average FROM $this->table LIMIT ?");
public function getAvgBlockShares($limit=1) {
$stmt = $this->mysqli->prepare("SELECT AVG(x.shares) AS average FROM (SELECT shares FROM $this->table ORDER BY height DESC LIMIT ?) AS x");
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $limit) && $stmt->execute() && $result = $stmt->get_result())
return (float)$result->fetch_object()->average;
return false;

View File

@ -48,6 +48,8 @@ class Tools extends Base {
return 'coinchose';
} else if (preg_match('/btc-e.com/', $url)) {
return 'btce';
} else if (preg_match('/cryptsy.com/', $url)) {
return 'cryptsy';
}
$this->setErrorMessage("API URL unknown");
return false;
@ -73,6 +75,9 @@ class Tools extends Base {
case 'btce':
return $aData['ticker']['last'];
break;
case 'cryptsy':
return $aData['return']['markets'][$strCurrency]['lasttradeprice'];
break;
}
// Catchall, we have no data extractor for this API url
$this->setErrorMessage("Undefined API to getPrice() on URL " . $this->config['price']['url']);

View File

@ -235,7 +235,7 @@ class Transaction {
FROM $this->table AS t
LEFT JOIN " . $this->block->getTableName() . " AS b ON t.block_id = b.id
WHERE
t.type IN ('Credit','Bonus') AND b.confirmations < ?
t.type IN ('Credit','Bonus') AND b.confirmations < ? AND b.confirmations >= 0
AND t.account_id = ?
) AS t4,
(
@ -244,7 +244,7 @@ class Transaction {
LEFT JOIN " . $this->block->getTableName() . " AS b ON t.block_id = b.id
WHERE
(
t.type IN ('Donation','Fee') AND b.confirmations < ?
t.type IN ('Donation','Fee') AND b.confirmations < ? AND b.confirmations >= 0
)
AND t.account_id = ?
) AS t5,

View File

@ -73,6 +73,11 @@ $config['wallet']['password'] = 'testnet';
* url = `http://www.coinchoose.com`
* target = `/api.php`
* currency = `BTC`
*
* Optional (cryptsy.com):
* url = `https://www.cryptsy.com`
* target = `/api.php?method=marketdata`
* currency = `BTC`
**/
$config['price']['url'] = 'https://btc-e.com';
$config['price']['target'] = '/api/2/ltc_usd/ticker';

View File

@ -62,7 +62,7 @@
{assign var=has_unconfirmed value=false}
{section transaction $TRANSACTIONS}
{if
(($TRANSACTIONS[transaction].type == 'Credit' or $TRANSACTIONS[transaction].type == 'Bonus' or $TRANSACTIONS[transaction].type == 'Donation' or $TRANSACTIONS[transaction].type == 'Fee') and $TRANSACTIONS[transaction].confirmations < $GLOBAL.confirmations)
(($TRANSACTIONS[transaction].type == 'Credit' or $TRANSACTIONS[transaction].type == 'Bonus' or $TRANSACTIONS[transaction].type == 'Donation' or $TRANSACTIONS[transaction].type == 'Fee') and $TRANSACTIONS[transaction].confirmations < $GLOBAL.confirmations and $TRANSACTIONS[transaction].confirmations >= 0)
}
{assign var=has_unconfirmed value=true}
<tr class="{cycle values="odd,even"}">
@ -116,7 +116,7 @@
<td>{$TRANSACTIONS[transaction].type}</td>
<td>{$TRANSACTIONS[transaction].coin_address}</td>
<td>{if $TRANSACTIONS[transaction].height == 0}n/a{else}{$TRANSACTIONS[transaction].height}{/if}</td>
<td><font color="{if $TRANSACTIONS[transaction].type == 'Orphan_Credit' or $TRANSACTIONS[transaction].type == 'Orphan_Bonus'}green{else}red{/if}">{$TRANSACTIONS[transaction].amount|number_format:"8"}</td>
<td><font color="{if $TRANSACTIONS[transaction].type == 'Credit' or $TRANSACTIONS[transaction].type == 'Bonus'}green{else}red{/if}">{$TRANSACTIONS[transaction].amount|number_format:"8"}</td>
</tr>
{if $TRANSACTIONS[transaction].type == 'Credit' or $TRANSACTIONS[transaction].type == 'Bonus'}
{assign var="orphan_credits" value="`$orphan_credits|default:"0"+$TRANSACTIONS[transaction].amount`"}

View File

@ -68,7 +68,7 @@
<tbody style="font-size:12px;">
{assign var=unconfirmed value=0}
{section transaction $TRANSACTIONS}
{if ($TRANSACTIONS[transaction].type == 'Credit' or $TRANSACTIONS[transaction].type == 'Bonus' or $TRANSACTIONS[transaction].type == 'Donation' or $TRANSACTIONS[transaction].type == 'Fee') and $TRANSACTIONS[transaction].confirmations < $GLOBAL.confirmations}
{if ($TRANSACTIONS[transaction].type == 'Credit' or $TRANSACTIONS[transaction].type == 'Bonus' or $TRANSACTIONS[transaction].type == 'Donation' or $TRANSACTIONS[transaction].type == 'Fee') and $TRANSACTIONS[transaction].confirmations < $GLOBAL.confirmations and $TRANSACTIONS[transaction].confirmations >= 0}
{assign var=unconfirmed value=1}
<tr class="{cycle values="odd,even"}">
<td>{$TRANSACTIONS[transaction].id}</td>
@ -117,7 +117,7 @@
<td>{$TRANSACTIONS[transaction].type}</td>
<td>{$TRANSACTIONS[transaction].coin_address}</td>
<td>{if $TRANSACTIONS[transaction].height == 0}n/a{else}{$TRANSACTIONS[transaction].height}{/if}</td>
<td><font color="{if $TRANSACTIONS[transaction].type == 'Orphan_Credit' or $TRANSACTIONS[transaction].type == 'Orphan_Bonus'}green{else}red{/if}">{$TRANSACTIONS[transaction].amount|number_format:"8"}</td>
<td><font color="{if $TRANSACTIONS[transaction].type == 'Credit' or $TRANSACTIONS[transaction].type == 'Bonus'}green{else}red{/if}">{$TRANSACTIONS[transaction].amount|number_format:"8"}</td>
</tr>
{/if}
{/section}