diff --git a/README.md b/README.md index a7787bb2..95a26d3f 100644 --- a/README.md +++ b/README.md @@ -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" diff --git a/public/include/classes/block.class.php b/public/include/classes/block.class.php index 711ed0b5..8ce985d1 100644 --- a/public/include/classes/block.class.php +++ b/public/include/classes/block.class.php @@ -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; diff --git a/public/include/classes/tools.class.php b/public/include/classes/tools.class.php index b160711d..dcfa1959 100644 --- a/public/include/classes/tools.class.php +++ b/public/include/classes/tools.class.php @@ -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']); diff --git a/public/include/classes/transaction.class.php b/public/include/classes/transaction.class.php index 30867cc6..2cbe4312 100644 --- a/public/include/classes/transaction.class.php +++ b/public/include/classes/transaction.class.php @@ -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, diff --git a/public/include/config/global.inc.dist.php b/public/include/config/global.inc.dist.php index 0634101d..359f74da 100644 --- a/public/include/config/global.inc.dist.php +++ b/public/include/config/global.inc.dist.php @@ -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'; diff --git a/public/templates/mmcFE/account/transactions/default.tpl b/public/templates/mmcFE/account/transactions/default.tpl index 4bbe7b4b..a7337bd6 100644 --- a/public/templates/mmcFE/account/transactions/default.tpl +++ b/public/templates/mmcFE/account/transactions/default.tpl @@ -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}