Compare commits

..

No commits in common. "master" and "revert-2681-patch-3" have entirely different histories.

70 changed files with 1951 additions and 620 deletions

3
.gitignore vendored
View File

@ -41,6 +41,3 @@ tests/_output/*
# NetBeans Project Directory # NetBeans Project Directory
/nbproject/* /nbproject/*
# No need for composer.lock
/composer.lock

View File

@ -34,7 +34,6 @@ before_script:
- nohup php -S bone:8000 public/index.php & - nohup php -S bone:8000 public/index.php &
script: script:
- php vendor/bin/codecept build
- php vendor/bin/codecept run unit --coverage --coverage-html --coverage-xml --env travis - php vendor/bin/codecept run unit --coverage --coverage-html --coverage-xml --env travis
after_script: after_script:

View File

@ -1,10 +1,11 @@
[![Build Status](https://travis-ci.org/MPOS/php-mpos.png?branch=master)](https://travis-ci.org/MPOS/php-mpos) [![Code Climate](https://codeclimate.com/github/MPOS/php-mpos/badges/gpa.svg)](https://codeclimate.com/github/MPOS/php-mpos) [![Code Coverage](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) master<br /> [![Build Status](https://travis-ci.org/MPOS/php-mpos.png?branch=master)](https://travis-ci.org/MPOS/php-mpos) [![Code Climate](https://codeclimate.com/github/MPOS/php-mpos/badges/gpa.svg)](https://codeclimate.com/github/MPOS/php-mpos) [![Code Coverage](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) master<br />
[![Build Status](https://travis-ci.org/MPOS/php-mpos.png?branch=development)](https://travis-ci.org/MPOS/php-mpos) [![Code Coverage](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/coverage.png?b=development)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=development) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/quality-score.png?b=development)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=development) development [![Build Status](https://travis-ci.org/MPOS/php-mpos.png?branch=development)](https://travis-ci.org/MPOS/php-mpos) [![Code Coverage](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/coverage.png?b=development)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=development) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/quality-score.png?b=development)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=development) development
Description Description
=========== ===========
MPOS is a web based Mining Portal for various crypto currencies. It was originally created by [TheSerapher](https://github.com/TheSerapher) and has hence grown quite large. It's now used by many pools out there and is a good starting point to learn more about mining and running pools in general. There is no active development done on the project by the orignal developers but we still merge PRs! MPOS is a web based Mining Portal for various crypto currencies. It was created by [TheSerapher](https://github.com/TheSerapher) and has hence grown quite large. Recently it was migrated into a Github Organization to make development easier. It's a community driven open source project. Support can be requested on IRC at https://webchat.freenode.net/?channels=#mpos - Be **PATIENT** ... People listed in this channel may currently be inactive but most users there have offline logging of messages. They **will** see your questions and answer if they can. Don't join, ask the question and leave. Sit around if you want answers to your questions!
Donations Donations
========= =========
@ -19,6 +20,24 @@ Website Footer
When you decide to use `MPOS` please be so kind and leave the footer intact. You are not the author of the software and should honor those that have worked on it. Keeping the footer intact helps spreading the word. Leaving the donation address untouched allows miners to donate to the author. When you decide to use `MPOS` please be so kind and leave the footer intact. You are not the author of the software and should honor those that have worked on it. Keeping the footer intact helps spreading the word. Leaving the donation address untouched allows miners to donate to the author.
Donors
======
These people have supported this project with a donation:
* [obigal](https://github.com/obigal)
* [vias](https://github.com/vias79)
* [WKNiGHT](https://github.com/WKNiGHT-)
* [ZC](https://github.com/zccopwrx)
* Nutnut
* Caberhagen (https://coin-mining.ch)
* Mining4All (https://www.mining4all.eu/)
* [xisi](https://github.com/xisi)
* [PCFiL](https://github.com/PCFiL)
* [rog1121](https://github.com/rog1121)(https://rapidhash.net)
* [Wow, Much Pool](http://www.wowmuchpool.com/)
* webxassDE (https://www.suchcoins.com/)
Pools running MPOS Pools running MPOS
================== ==================
@ -121,27 +140,39 @@ on non-existing features in `MPOS`. For the vast majority, adjusting themes shou
In all that, I humbly ask to keep the `MPOS` author reference and Github URL intact. In all that, I humbly ask to keep the `MPOS` author reference and Github URL intact.
Related Software
================
There are a few other projects out there that take advantage of MPOS and it's included API. Here a quick list that you can check out for yourself:
* [MPOS IRC Bot](https://github.com/WKNiGHT-/mpos-bot) written in Python, standalone bot, using the MPOS API
* [MPOS Eggdrop Module](https://github.com/iAmShorty/mpos-eggdrop-tcl) written in TCL, adding MPOS commands to this bot, using the MPOS API
* [Windows Phone Pool App](http://www.windowsphone.com/en-us/store/app/meeneminermonitor/7ec6eac7-a642-409b-96c8-57b5cfdf45cf)
* [iPhone iMPOS App](https://itunes.apple.com/us/app/impos/id742179239?mt=8)
* [Other Windows Phone App](http://www.windowsphone.com/en-us/store/app/mining-info/952f1137-eb62-4613-8057-34576d3c9c44)
Contributing Contributing
============ ============
You can contribute to this project in different ways: You can contribute to this project in different ways:
* Report outstanding issues and bugs by creating an [Issue][1] * Report outstanding issues and bugs by creating an [Issue][1]
* Fork the project, create a branch and file a pull request **against development** to improve the code itself * Suggest feature enhancements also via [Issues][1]
* Fork the project, create a branch and file a pull request to improve the code itself
If you wish to participate contact the team on IRC: https://webchat.freenode.net/?channels=#mpos - we will point you to the proper channels!
Contact Contact
======= =======
This product is not actively developed anymore. For setup and installation support, please find help in other channels. You can find the team on Freenode.net, #MPOS.
This projects issue tracker is used for bugs and issues with the core code, not for general help in setting up and running
pool.
Team Members Team Members
============ ============
Author and Project Owner: [TheSerapher](https://github.com/TheSerapher) aka Sebastian Grewe Author and Project Owner: [TheSerapher](https://github.com/TheSerapher) aka Sebastian Grewe
Past developers that helped on MPOS in the early days: Developers:
* [nrpatten](https://github.com/nrpatten) * [nrpatten](https://github.com/nrpatten)
* [Aim](https://github.com/fspijkerman) * [Aim](https://github.com/fspijkerman)

View File

@ -1,16 +1,14 @@
{ {
"name": "MPOS/php-mpos", "name": "delboy1978uk/mpos",
"description": "MPOS stands for Mining Portal Open Source. A unified mining interface for various Scrypt and SHA256d Crypto-currencies!", "description": "MPOS stands for Mining Portal Open Source. A unified mining interface for various Scrypt and SHA256d Crypto-currencies!",
"require-dev": { "require-dev": {
"codeception/codeception": "~2.0" "codeception/codeception": "~2.0"
}, },
"authors": [ "authors": [
{ {
"name": "Sebastian Grewe", "name": "Derek Stephen McLean",
"email": "sebastian.grewe@gmail.com" "email": "delboy1978uk@gmail.com"
} }
], ],
"require": { "require": {}
"google/recaptcha": "~1.1"
}
} }

1358
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -47,25 +47,16 @@ fi
ME=$( basename $0 ) ME=$( basename $0 )
# Overwrite some settings via command line arguments # Overwrite some settings via command line arguments
while getopts "hfvt:p:d:" opt; do while getopts "hfvp:d:" opt; do
case "$opt" in case "$opt" in
h|\?) h|\?)
echo "Usage: $0 [-v] [-f] [-t TIME_IN_SEC] [-p PHP_BINARY] [-d SUBFOLDER]"; echo "Usage: $0 [-v] [-p PHP_BINARY] [-d SUBFOLDER]";
exit 0 exit 0
;; ;;
v) VERBOSE=1 ;; v) VERBOSE=1 ;;
f) PHP_OPTS="$PHP_OPTS -f";; f) PHP_OPTS="$PHP_OPTS -f";;
p) PHP_BIN=$OPTARG ;; p) PHP_BIN=$OPTARG ;;
d) SUBFOLDER=$OPTARG ;; d) SUBFOLDER=$OPTARG ;;
t)
if [[ $OPTARG =~ ^[0-9]+$ ]]; then
TIMEOUT=$OPTARG
PHP_OPTS="$PHP_OPTS -t $OPTARG"
else
echo "Option -t requires an integer" >&2
exit 1
fi
;;
:) :)
echo "Option -$OPTARG requires an argument." >&2 echo "Option -$OPTARG requires an argument." >&2
exit 1 exit 1
@ -111,16 +102,6 @@ fi
# Our PID of this shell # Our PID of this shell
PID=$$ PID=$$
# If $PIDFILE exists and older than the time specified by -t, remove it.
if [[ -e $PIDFILE ]]; then
if [[ -n $TIMEOUT ]] && \
[[ $(( $(date +%s) - $(stat -c %Y $PIDFILE) )) -gt $TIMEOUT ]]; then
echo "$PIDFILE exists but older than the time you specified in -t option ($TIMEOUT sec)."
echo "Removing PID file."
rm $PIDFILE
fi
fi
if [[ -e $PIDFILE ]]; then if [[ -e $PIDFILE ]]; then
echo "Cron seems to be running already" echo "Cron seems to be running already"
RUNPID=$( cat $PIDFILE ) RUNPID=$( cat $PIDFILE )

View File

@ -46,25 +46,17 @@ fi
# My own name # My own name
ME=$( basename $0 ) ME=$( basename $0 )
while getopts "hfvt:p:d:" opt; do # Overwrite some settings via command line arguments
while getopts "hfvp:d:" opt; do
case "$opt" in case "$opt" in
h|\?) h|\?)
echo "Usage: $0 [-v] [-f] [-t TIME_IN_SEC] [-p PHP_BINARY] [-d SUBFOLDER]"; echo "Usage: $0 [-v] [-p PHP_BINARY] [-d SUBFOLDER]";
exit 0 exit 0
;; ;;
v) VERBOSE=1 ;; v) VERBOSE=1 ;;
f) PHP_OPTS="$PHP_OPTS -f";; f) PHP_OPTS="$PHP_OPTS -f";;
p) PHP_BIN=$OPTARG ;; p) PHP_BIN=$OPTARG ;;
d) SUBFOLDER=$OPTARG ;; d) SUBFOLDER=$OPTARG ;;
t)
if [[ $OPTARG =~ ^[0-9]+$ ]]; then
TIMEOUT=$OPTARG
PHP_OPTS="$PHP_OPTS -t $OPTARG"
else
echo "Option -t requires an integer" >&2
exit 1
fi
;;
:) :)
echo "Option -$OPTARG requires an argument." >&2 echo "Option -$OPTARG requires an argument." >&2
exit 1 exit 1
@ -110,16 +102,6 @@ fi
# Our PID of this shell # Our PID of this shell
PID=$$ PID=$$
# If $PIDFILE exists and older than the time specified by -t, remove it.
if [[ -e $PIDFILE ]]; then
if [[ -n $TIMEOUT ]] && \
[[ $(( $(date +%s) - $(stat -c %Y $PIDFILE) )) -gt $TIMEOUT ]]; then
echo "$PIDFILE exists but older than the time you specified in -t option ($TIMEOUT sec)."
echo "Removing PID file."
rm $PIDFILE
fi
fi
if [[ -e $PIDFILE ]]; then if [[ -e $PIDFILE ]]; then
echo "Cron seems to be running already" echo "Cron seems to be running already"
RUNPID=$( cat $PIDFILE ) RUNPID=$( cat $PIDFILE )

View File

@ -47,25 +47,16 @@ fi
ME=$( basename $0 ) ME=$( basename $0 )
# Overwrite some settings via command line arguments # Overwrite some settings via command line arguments
while getopts "hfvt:p:d:" opt; do while getopts "hfvp:d:" opt; do
case "$opt" in case "$opt" in
h|\?) h|\?)
echo "Usage: $0 [-v] [-f] [-t TIME_IN_SEC] [-p PHP_BINARY] [-d SUBFOLDER]"; echo "Usage: $0 [-v] [-p PHP_BINARY] [-d SUBFOLDER]";
exit 0 exit 0
;; ;;
v) VERBOSE=1 ;; v) VERBOSE=1 ;;
f) PHP_OPTS="$PHP_OPTS -f";; f) PHP_OPTS="$PHP_OPTS -f";;
p) PHP_BIN=$OPTARG ;; p) PHP_BIN=$OPTARG ;;
d) SUBFOLDER=$OPTARG ;; d) SUBFOLDER=$OPTARG ;;
t)
if [[ $OPTARG =~ ^[0-9]+$ ]]; then
TIMEOUT=$OPTARG
PHP_OPTS="$PHP_OPTS -t $OPTARG"
else
echo "Option -t requires an integer" >&2
exit 1
fi
;;
:) :)
echo "Option -$OPTARG requires an argument." >&2 echo "Option -$OPTARG requires an argument." >&2
exit 1 exit 1
@ -111,16 +102,6 @@ fi
# Our PID of this shell # Our PID of this shell
PID=$$ PID=$$
# If $PIDFILE exists and older than the time specified by -t, remove it.
if [[ -e $PIDFILE ]]; then
if [[ -n $TIMEOUT ]] && \
[[ $(( $(date +%s) - $(stat -c %Y $PIDFILE) )) -gt $TIMEOUT ]]; then
echo "$PIDFILE exists but older than the time you specified in -t option ($TIMEOUT sec)."
echo "Removing PID file."
rm $PIDFILE
fi
fi
if [[ -e $PIDFILE ]]; then if [[ -e $PIDFILE ]]; then
echo "Cron seems to be running already" echo "Cron seems to be running already"
RUNPID=$( cat $PIDFILE ) RUNPID=$( cat $PIDFILE )

View File

@ -51,39 +51,19 @@ $cron_name = basename($_SERVER['PHP_SELF'], '.php');
require_once(BASEPATH . '../include/bootstrap.php'); require_once(BASEPATH . '../include/bootstrap.php');
require_once(BASEPATH . '../include/version.inc.php'); require_once(BASEPATH . '../include/version.inc.php');
// Load 3rd party logging library for running crons
$log = KLogger::instance( BASEPATH . '../logs/' . $cron_name, KLogger::INFO );
// Command line switches // Command line switches
array_shift($argv); array_shift($argv);
foreach ($argv as $index => $option) { foreach ($argv as $option) {
switch ($option) { switch ($option) {
case '-f': case '-f':
$monitoring->setStatus($cron_name . "_disabled", "yesno", 0); $monitoring->setStatus($cron_name . "_disabled", "yesno", 0);
$monitoring->setStatus($cron_name . "_active", "yesno", 0); $monitoring->setStatus($cron_name . "_active", "yesno", 0);
break; break;
case '-t':
// When `-t TIME_IN_SEC` is specified, we ignore the cron active flag
// if the time elapsed `TIME_IN_SEC` seconds after the last job started.
// Check the next argument is the value for -t option.
if (!($index + 1 < count($argv)) || // check if '-t' is not the last argument.
!(ctype_digit($argv[$index + 1]))) { // check the next argument is numeric string
$log->logFatal('Option -t requires an integer.');
$monitoring->endCronjob($cron_name, 'E0085', 3, true, false);
}
$timeout = intval($argv[$index + 1]);
$timeElapsedFromLastStart = $dStartTime - $monitoring->getLastCronStarted($cron_name);
if ($timeElapsedFromLastStart > $timeout) {
$log->logWarn("Previous cronjob `$cron_name` is started before than you specified by -t. Re-run forced.");
$monitoring->setStatus($cron_name . "_active", "yesno", 0);
}
break;
} }
} }
// Load 3rd party logging library for running crons
$log = KLogger::instance( BASEPATH . '../logs/' . $cron_name, KLogger::INFO );
$log->LogDebug('Starting ' . $cron_name); $log->LogDebug('Starting ' . $cron_name);
// Load the start time for later runtime calculations for monitoring // Load the start time for later runtime calculations for monitoring

View File

@ -59,7 +59,7 @@ if ($oToken->cleanupTokens()) {
} }
$log->logInfo(sprintf($strLogMask, 'cleanupTokens', $affected, number_format(microtime(true) - $start, 3), $status, $message)); $log->logInfo(sprintf($strLogMask, 'cleanupTokens', $affected, number_format(microtime(true) - $start, 3), $status, $message));
// Cleanup shares archive // Clenaup shares archive
$start = microtime(true); $start = microtime(true);
$status = 'OK'; $status = 'OK';
$message = ''; $message = '';
@ -73,7 +73,7 @@ if ($affected === false) {
} }
$log->logInfo(sprintf($strLogMask, 'purgeArchive', $affected, number_format(microtime(true) - $start, 3), $status, $message)); $log->logInfo(sprintf($strLogMask, 'purgeArchive', $affected, number_format(microtime(true) - $start, 3), $status, $message));
// Cleanup shares archive // Clenaup shares archive
$start = microtime(true); $start = microtime(true);
$status = 'OK'; $status = 'OK';
$message = ''; $message = '';

View File

@ -2,12 +2,6 @@
(SECURITY == "*)WT#&YHfd" && SECHASH_CHECK) ? die("public/index.php -> Set a new SECURITY value to continue") : 0; (SECURITY == "*)WT#&YHfd" && SECHASH_CHECK) ? die("public/index.php -> Set a new SECURITY value to continue") : 0;
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1; $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
if (file_exists(INCLUDE_DIR . '/../vendor/autoload.php')) {
require_once(INCLUDE_DIR . '/../vendor/autoload.php');
} else {
die("Unable to load vendor libraries, please run `php composer.phar install` in root folder.");
}
// Default classes // Default classes
require_once(INCLUDE_DIR . '/lib/KLogger.php'); require_once(INCLUDE_DIR . '/lib/KLogger.php');
require_once(CLASS_DIR . '/logger.class.php'); require_once(CLASS_DIR . '/logger.class.php');
@ -15,7 +9,6 @@ require_once(CLASS_DIR . '/debug.class.php');
if ($config['mysql_filter']) { if ($config['mysql_filter']) {
require_once(CLASS_DIR . '/strict.class.php'); require_once(CLASS_DIR . '/strict.class.php');
} }
require_once(INCLUDE_DIR . '/classes/mysqlims.class.php');
require_once(INCLUDE_DIR . '/database.inc.php'); require_once(INCLUDE_DIR . '/database.inc.php');
require_once(INCLUDE_DIR . '/config/memcache_keys.inc.php'); require_once(INCLUDE_DIR . '/config/memcache_keys.inc.php');
require_once(INCLUDE_DIR . '/config/error_codes.inc.php'); require_once(INCLUDE_DIR . '/config/error_codes.inc.php');

View File

@ -32,6 +32,7 @@ if (@file_exists(INCLUDE_DIR . '/config/security.inc.php')) include_once(INCLUDE
session_set_cookie_params(time()+$config['cookie']['duration'], $config['cookie']['path'], $config['cookie']['domain'], $config['cookie']['secure'], $config['cookie']['httponly']); session_set_cookie_params(time()+$config['cookie']['duration'], $config['cookie']['path'], $config['cookie']['domain'], $config['cookie']['secure'], $config['cookie']['httponly']);
$session_start = @session_start(); $session_start = @session_start();
if (!$session_start) { if (!$session_start) {
$log->log("info", "Forcing session id regeneration, session failed to start [hijack attempt?]");
session_destroy(); session_destroy();
session_regenerate_id(true); session_regenerate_id(true);
session_start(); session_start();

View File

@ -253,9 +253,8 @@ class Base {
$this->setErrorMessage(call_user_func_array(array($this, 'getErrorMsg'), func_get_args())); $this->setErrorMessage(call_user_func_array(array($this, 'getErrorMsg'), func_get_args()));
} }
// Default to SQL error for debug and cron errors // Default to SQL error for debug and cron errors
$this->debug->append($this->getErrorMsg('E0019', $this->mysqli->lastused->errno)); $this->debug->append($this->getErrorMsg('E0019', $this->mysqli->error));
$this->setCronMessage($this->getErrorMsg('E0019', $this->mysqli->lastused->errno)); $this->setCronMessage($this->getErrorMsg('E0019', $this->mysqli->error));
return false; return false;
} }

4
include/classes/bitcoin.class.php Executable file → Normal file
View File

@ -284,15 +284,13 @@ class BitcoinClient extends jsonRPCClient {
* The check is done by calling the server's getinfo() method and checking * The check is done by calling the server's getinfo() method and checking
* for a fault. * for a fault.
* *
* To turn code compatible with BTC >= 0.16, getmininginfo() method used instead of getinfo()
*
* @return mixed boolean TRUE if successful, or a fault string otherwise * @return mixed boolean TRUE if successful, or a fault string otherwise
* @access public * @access public
* @throws none * @throws none
*/ */
public function can_connect() { public function can_connect() {
try { try {
$r = $this->getmininginfo(); $r = $this->getinfo();
} catch (Exception $e) { } catch (Exception $e) {
return $e->getMessage(); return $e->getMessage();
} }

18
include/classes/bitcoinwrapper.class.php Executable file → Normal file
View File

@ -24,29 +24,13 @@ class BitcoinWrapper extends BitcoinClient {
public function getinfo() { public function getinfo() {
$this->oDebug->append("STA " . __METHOD__, 4); $this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data; if ($data = $this->memcache->get(__FUNCTION__)) return $data;
try { return $this->memcache->setCache(__FUNCTION__, parent::getinfo(), 30);
return $this->memcache->setCache(__FUNCTION__, parent::getnetworkinfo()+parent::getmininginfo()+parent::getwalletinfo(), 30);
} catch (Exception $e) {
$this->oDebug->append("DEPRECATED : RPC version < 0.16, fallback to `getinfo` RPC call", 2);
return $this->memcache->setCache(__FUNCTION__, parent::getinfo(), 30);
}
} }
public function is_testnet() {
$this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
if (!(parent::getblockchaininfo()))
return $this->memcache->setCache(__FUNCTION__, parent::is_testnet(), 30);
else
return $this->memcache->setCache(__FUNCTION__, parent::getblockchaininfo()['chain'] == 'test', 30);
}
public function getmininginfo() { public function getmininginfo() {
$this->oDebug->append("STA " . __METHOD__, 4); $this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data; if ($data = $this->memcache->get(__FUNCTION__)) return $data;
return $this->memcache->setCache(__FUNCTION__, parent::getmininginfo(), 30); return $this->memcache->setCache(__FUNCTION__, parent::getmininginfo(), 30);
} }
public function getblockcount() { public function getblockcount() {
$this->oDebug->append("STA " . __METHOD__, 4); $this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data; if ($data = $this->memcache->get(__FUNCTION__)) return $data;

View File

@ -237,7 +237,7 @@ class Block extends Base {
* @return bool * @return bool
**/ **/
public function setShares($block_id, $shares=NULL) { public function setShares($block_id, $shares=NULL) {
$field = array( 'name' => 'shares', 'value' => $shares, 'type' => 'd'); $field = array( 'name' => 'shares', 'value' => $shares, 'type' => 'i');
return $this->updateSingle($block_id, $field); return $this->updateSingle($block_id, $field);
} }

View File

@ -60,7 +60,7 @@ class CoinBase extends Base {
* according to our configuration difficulty * according to our configuration difficulty
**/ **/
public function calcEstaimtedShares($dDifficulty) { public function calcEstaimtedShares($dDifficulty) {
return (float)round(pow(2, (32 - $this->target_bits)) * $dDifficulty, $this->share_difficulty_precision); return (int)round(pow(2, (32 - $this->target_bits)) * $dDifficulty, 0);
} }
/** /**

View File

@ -16,22 +16,19 @@ class CSRFToken Extends Base {
} }
/** /**
* Returns +1 min up to +15 min rollovers hashes * Returns +1 min and +1 hour rollovers hashes
* @param string $user user or IP/host address * @param string $user user or IP/host address
* @param string $type page name or other unique per-page identifier * @param string $type page name or other unique per-page identifier
* @return array 1 minute ago up to 15 minute ago hashes * @return array 1min and 1hour hashes
*/ */
public function checkAdditional($user, $type) { public function checkAdditional($user, $type) {
$date = date('m/d/y/H/i'); $date = date('m/d/y/H/i');
$d = explode('/', $date); $d = explode('/', $date);
$hashes = array(); // minute may have rolled over
for ($x = 1; $x < 16; $x++){ $seed1 = $this->buildSeed($user.$type, $d[0], $d[1], $d[2], $d[3], ($d[4]-1));
for ($y = 4;$d[$y]-- == 0;$y--); // hour may have rolled over
if ($d[4] < 0) { $d[4] = 59; } $seed2 = $this->buildSeed($user.$type, $d[0], $d[1], $d[2], ($d[3]-1), 59);
$hashes[$x-1] = $this->getHash($this->buildSeed($user.$type, $d[0], $d[1], $d[2], $d[3], $d[4])); return array($this->getHash($seed1), $this->getHash($seed2));
}
return $hashes;
} }
/** /**

View File

@ -14,10 +14,18 @@ class Mail extends Base {
**/ **/
public function contactform($senderName, $senderEmail, $senderSubject, $senderMessage) { public function contactform($senderName, $senderEmail, $senderSubject, $senderMessage) {
$this->debug->append("STA " . __METHOD__, 4); $this->debug->append("STA " . __METHOD__, 4);
if (preg_match('/[^a-z_\.\!\?\-0-9\\s ]/i', $senderName)) {
$this->setErrorMessage($this->getErrorMsg('E0024'));
return false;
}
if (empty($senderEmail) || !filter_var($senderEmail, FILTER_VALIDATE_EMAIL)) { if (empty($senderEmail) || !filter_var($senderEmail, FILTER_VALIDATE_EMAIL)) {
$this->setErrorMessage($this->getErrorMsg('E0023')); $this->setErrorMessage($this->getErrorMsg('E0023'));
return false; return false;
} }
if (preg_match('/[^a-z_\.\!\?\-0-9\\s ]/i', $senderSubject)) {
$this->setErrorMessage($this->getErrorMsg('E0034'));
return false;
}
if (strlen(strip_tags($senderMessage)) < strlen($senderMessage)) { if (strlen(strip_tags($senderMessage)) < strlen($senderMessage)) {
$this->setErrorMessage($this->getErrorMsg('E0024')); $this->setErrorMessage($this->getErrorMsg('E0024'));
return false; return false;

View File

@ -60,16 +60,6 @@ class Monitoring extends Base {
return $aStatus['value']; return $aStatus['value'];
} }
/**
* Get the timestamp that last time a cronjob started
* @param name string Cronjob name
* @return int unix timestamp of last time the cronjob started
**/
public function getLastCronStarted($name) {
$aStatus = $this->getStatus($name . '_starttime');
return $aStatus['value'];
}
/** /**
* Fetch a value from our table * Fetch a value from our table
* @param name string Setting name * @param name string Setting name

View File

@ -1,91 +0,0 @@
<?php
/*
* This class will run queries on master/slave servers depending on the query itself.
*/
class mysqlims extends mysqli
{
private $mysqliW;
private $mysqliR = null;
private $slave = false;
public $lastused = null;
/*
* Pass main and slave connection arrays to the constructor, and strict as true/false
*
* @param array $main
* @param array $slave
* @param boolean $strict
*
* @return void
*/
public function __construct($main, $slave = false, $strict = false)
{
if ($strict) {
$this->mysqliW = new mysqli_strict($main['host'],
$main['user'], $main['pass'],
$main['name'], $main['port']);
if ($slave && is_array($slave) && isset($slave['enabled']) && $slave['enabled']
=== true) {
$this->mysqliR = new mysqli_strict($slave['host'],
$slave['user'], $slave['pass'],
$slave['name'], $slave['port']);
$this->slave = true;
}
} else {
$this->mysqliW = new mysqli($main['host'],
$main['user'], $main['pass'],
$main['name'], $main['port']);
if ($slave && is_array($slave) && isset($slave['enabled']) && $slave['enabled']
=== true) {
$this->mysqliR = new mysqli($slave['host'],
$slave['user'], $slave['pass'],
$slave['name'], $slave['port']);
$this->slave = true;
}
}
if ($this->mysqliW->connect_errno) {
throw new Exception("Failed to connect to MySQL: (".$this->mysqliW->connect_errno.") ".$this->mysqliW->connect_error);
}
if ($this->slave === true && $this->mysqliR->connect_errno) {
throw new Exception("Failed to connect to MySQL: (".$this->mysqliR->connect_errno.") ".$this->mysqliR->connect_error);
}
}
/*
* Override standard mysqli_prepare to select master/slave server
* @param $string query
*
* @return mysqli_stmt
*/
public function prepare($query)
{
if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && stripos($query, "INSERT") === false && $this->slave !== false) {
$this->lastused = $this->mysqliR;
return $this->mysqliR->prepare($query);
} else {
$this->lastused = $this->mysqliW;
return $this->mysqliW->prepare($query);
}
}
/*
* Override standard mysqli_query to select master/slave server
* @param string $query
* @param int $resultmode
*
* @return boolean
* @return mixed
*/
public function query($query, $resultmode = MYSQLI_STORE_RESULT)
{
if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && stripos($query, "INSERT") === false && $this->slave !== false) {/* Use readonly server */
$this->lastused = $this->mysqliR;
return $this->mysqliR->query($query, $resultmode);
} else {
$this->lastused = $this->mysqliW;
return $this->mysqliW->query($query, $resultmode);
}
}
}

View File

@ -22,10 +22,8 @@ class Notification extends Mail {
$this->debug->append("STA " . __METHOD__, 4); $this->debug->append("STA " . __METHOD__, 4);
$data = json_encode($aData); $data = json_encode($aData);
$stmt = $this->mysqli->prepare("SELECT id FROM $this->table WHERE data = ? AND active = 1 LIMIT 1"); $stmt = $this->mysqli->prepare("SELECT id FROM $this->table WHERE data = ? AND active = 1 LIMIT 1");
if ($stmt && $stmt->bind_param('s', $data) && $stmt->execute() && $stmt->store_result() && $stmt->num_rows == 1) { if ($stmt && $stmt->bind_param('s', $data) && $stmt->execute() && $stmt->store_result() && $stmt->num_rows == 1)
return true; return true;
}
return $this->sqlError('E0041'); return $this->sqlError('E0041');
} }
@ -190,7 +188,7 @@ class Notification extends Mail {
public function cleanupNotifications($days=7) { public function cleanupNotifications($days=7) {
$failed = 0; $failed = 0;
$this->deleted = 0; $this->deleted = 0;
$stmt = $this->mysqli->prepare("DELETE FROM $this->table WHERE time < (NOW() - INTERVAL ? DAY)"); $stmt = $this->mysqli->prepare("DELETE FROM $this->table WHERE time < (NOW() - ? * 24 * 60 * 60)");
if (! ($this->checkStmt($stmt) && $stmt->bind_param('i', $days) && $stmt->execute())) { if (! ($this->checkStmt($stmt) && $stmt->bind_param('i', $days) && $stmt->execute())) {
$failed++; $failed++;
} else { } else {

View File

@ -111,7 +111,7 @@ class Statistics extends Base {
b.*, b.*,
a.username AS finder, a.username AS finder,
a.is_anonymous AS is_anonymous, a.is_anonymous AS is_anonymous,
ROUND(difficulty * POW(2, 32 - " . $this->coin->getTargetBits() . "), " . $this->coin->getShareDifficultyPrecision() . ") AS estshares ROUND(difficulty * POW(2, 32 - " . $this->coin->getTargetBits() . "), 0) AS estshares
FROM " . $this->block->getTableName() . " AS b FROM " . $this->block->getTableName() . " AS b
LEFT JOIN " . $this->user->getTableName() . " AS a LEFT JOIN " . $this->user->getTableName() . " AS a
ON b.account_id = a.id ON b.account_id = a.id
@ -203,7 +203,7 @@ class Statistics extends Base {
public function updateShareStatistics($aStats, $iBlockId) { public function updateShareStatistics($aStats, $iBlockId) {
$this->debug->append("STA " . __METHOD__, 4); $this->debug->append("STA " . __METHOD__, 4);
$stmt = $this->mysqli->prepare("INSERT INTO $this->table (account_id, valid, invalid, block_id) VALUES (?, ?, ?, ?)"); $stmt = $this->mysqli->prepare("INSERT INTO $this->table (account_id, valid, invalid, block_id) VALUES (?, ?, ?, ?)");
if ($this->checkStmt($stmt) && $stmt->bind_param('iddi', $aStats['id'], $aStats['valid'], $aStats['invalid'], $iBlockId) && $stmt->execute()) return true; if ($this->checkStmt($stmt) && $stmt->bind_param('iiii', $aStats['id'], $aStats['valid'], $aStats['invalid'], $iBlockId) && $stmt->execute()) return true;
return $this->sqlError(); return $this->sqlError();
} }
@ -213,7 +213,7 @@ class Statistics extends Base {
public function insertPPLNSStatistics($aStats, $iBlockId) { public function insertPPLNSStatistics($aStats, $iBlockId) {
$this->debug->append("STA " . __METHOD__, 4); $this->debug->append("STA " . __METHOD__, 4);
$stmt = $this->mysqli->prepare("INSERT INTO $this->table (account_id, valid, invalid, pplns_valid, pplns_invalid, block_id) VALUES (?, ?, ?, ?, ?, ?)"); $stmt = $this->mysqli->prepare("INSERT INTO $this->table (account_id, valid, invalid, pplns_valid, pplns_invalid, block_id) VALUES (?, ?, ?, ?, ?, ?)");
if ($this->checkStmt($stmt) && $stmt->bind_param('iddddi', $aStats['id'], $aStats['valid'], $aStats['invalid'], $aStats['pplns_valid'], $aStats['pplns_invalid'], $iBlockId) && $stmt->execute()) return true; if ($this->checkStmt($stmt) && $stmt->bind_param('iiiiii', $aStats['id'], $aStats['valid'], $aStats['invalid'], $aStats['pplns_valid'], $aStats['pplns_invalid'], $iBlockId) && $stmt->execute()) return true;
return $this->sqlError(); return $this->sqlError();
} }
@ -261,12 +261,12 @@ class Statistics extends Base {
SELECT SELECT
( (
( (
SELECT ROUND(SUM(difficulty) / ?, " . $this->coin->getShareDifficultyPrecision() . ") AS sharerate SELECT ROUND(SUM(difficulty) / ?, 2) AS sharerate
FROM " . $this->share->getTableName() . " FROM " . $this->share->getTableName() . "
WHERE time > DATE_SUB(now(), INTERVAL ? SECOND) WHERE time > DATE_SUB(now(), INTERVAL ? SECOND)
AND our_result = 'Y' AND our_result = 'Y'
) + ( ) + (
SELECT ROUND(SUM(difficulty) / ?, " . $this->coin->getShareDifficultyPrecision() . ") AS sharerate SELECT ROUND(SUM(difficulty) / ?, 2) AS sharerate
FROM " . $this->share->getArchiveTableName() . " FROM " . $this->share->getArchiveTableName() . "
WHERE time > DATE_SUB(now(), INTERVAL ? SECOND) WHERE time > DATE_SUB(now(), INTERVAL ? SECOND)
AND our_result = 'Y' AND our_result = 'Y'
@ -470,7 +470,7 @@ class Statistics extends Base {
a.username AS account, a.username AS account,
COUNT(DISTINCT t1.username) AS workers, COUNT(DISTINCT t1.username) AS workers,
IFNULL(SUM(t1.difficulty), 0) AS shares, IFNULL(SUM(t1.difficulty), 0) AS shares,
ROUND(SUM(t1.difficulty) / ?, " . $this->coin->getShareDifficultyPrecision() . ") AS sharerate, ROUND(SUM(t1.difficulty) / ?, 2) AS sharerate,
IFNULL(AVG(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)), 0) AS avgsharediff IFNULL(AVG(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)), 0) AS avgsharediff
FROM ( FROM (
SELECT SELECT

View File

@ -79,7 +79,7 @@ class Template extends Base {
} }
$this->setErrorMessage('Failed to get active templates'); $this->setErrorMessage('Failed to get active templates');
$this->debug->append('Template::getActiveTemplates failed: ' . $this->mysqli->lastused->error); $this->debug->append('Template::getActiveTemplates failed: ' . $this->mysqli->error);
return false; return false;
} }
@ -172,7 +172,7 @@ class Template extends Base {
return $result->fetch_assoc(); return $result->fetch_assoc();
$this->setErrorMessage('Failed to get the template'); $this->setErrorMessage('Failed to get the template');
$this->debug->append('Template::getEntry failed: ' . $this->mysqli->lastused->error); $this->debug->append('Template::getEntry failed: ' . $this->mysqli->error);
return false; return false;
} }
@ -206,7 +206,7 @@ class Template extends Base {
return true; return true;
$this->setErrorMessage('Database error'); $this->setErrorMessage('Database error');
$this->debug->append('Template::updateEntry failed: ' . $this->mysqli->lastused->error); $this->debug->append('Template::updateEntry failed: ' . $this->mysqli->error);
return false; return false;
} }
} }

View File

@ -44,13 +44,9 @@ class Tools extends Base {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; PHP client; '.php_uname('s').'; PHP/'.phpversion().')'); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; PHP client; '.php_uname('s').'; PHP/'.phpversion().')');
} }
curl_setopt($ch, CURLOPT_URL, $url . $target);
$url = rtrim($url, '/');
$target = ltrim($target, '/');
curl_setopt($ch, CURLOPT_URL, $url . '/' . $target);
// curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); // curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
@ -76,9 +72,11 @@ class Tools extends Base {
**/ **/
private function getApiType($url) { private function getApiType($url) {
if (preg_match('/coinchoose.com/', $url)) { if (preg_match('/coinchoose.com/', $url)) {
return 'coinchoose'; return 'coinchose';
} else if (preg_match('/btc-e.nz/', $url)) { } else if (preg_match('/btc-e.com/', $url)) {
return 'btce'; return 'btce';
} else if (preg_match('/cryptsy.com/', $url)) {
return 'cryptsy';
} else if (preg_match('/cryptopia.co.nz/', $url)) { } else if (preg_match('/cryptopia.co.nz/', $url)) {
return 'cryptopia'; return 'cryptopia';
} else if (preg_match('/cryptorush.in/', $url)) { } else if (preg_match('/cryptorush.in/', $url)) {
@ -89,18 +87,6 @@ class Tools extends Base {
return 'c-cex'; return 'c-cex';
} else if (preg_match('/bittrex.com/', $url)) { } else if (preg_match('/bittrex.com/', $url)) {
return 'bittrex'; return 'bittrex';
} else if (preg_match('/crypto-bridge.org/', $url)) {
return 'cryptobridge';
} else if (preg_match('/yobit.net/', $url)) {
return 'yobit';
} else if (preg_match('/binance.com/', $url)) {
return 'binance';
} else if (preg_match('/southxchange.com/', $url)) {
return 'southxchange';
} else if (preg_match('/mercatox.com/', $url)) {
return 'mercatox';
} else if (preg_match('/tradeogre.com/', $url)) {
return 'tradeogre';
} }
$this->setErrorMessage("API URL unknown"); $this->setErrorMessage("API URL unknown");
return false; return false;
@ -111,28 +97,30 @@ class Tools extends Base {
**/ **/
public function getPrice() { public function getPrice() {
$aData = $this->getApi($this->config['price']['url'], $this->config['price']['target']); $aData = $this->getApi($this->config['price']['url'], $this->config['price']['target']);
$strBase = $this->config['currency']; $strCurrency = $this->config['currency'];
$strQuote = $this->config['price']['currency'];
// Check the API type for configured URL // Check the API type for configured URL
if (!$strApiType = $this->getApiType($this->config['price']['url'])) if (!$strApiType = $this->getApiType($this->config['price']['url']))
return false; return false;
// if api data is valid, extract price depending on API type // if api data is valid, extract price depending on API type
if (is_array($aData)) { if (is_array($aData)) {
switch ($strApiType) { switch ($strApiType) {
case 'coinchoose': case 'coinchose':
foreach ($aData as $aItem) { foreach ($aData as $aItem) {
if($strBase == $aItem[0]) if($strCurrency == $aItem[0])
return $aItem['price']; return $aItem['price'];
} }
break; break;
case 'btce': case 'btce':
return $aData['ticker']['last']; return $aData['ticker']['last'];
break; break;
case 'cryptsy':
return @$aData['return']['markets'][$strCurrency]['lasttradeprice'];
break;
case 'cryptopia': case 'cryptopia':
return @$aData['Data']['LastPrice']; return @$aData['Data']['LastPrice'];
break; break;
case 'cryptorush': case 'cryptorush':
return @$aData["{$strBase}/{$strQuote}"]['last_trade']; return @$aData["$strCurrency/" . $this->config['price']['currency']]['last_trade'];
break; break;
case 'mintpal': case 'mintpal':
return @$aData['0']['last_price']; return @$aData['0']['last_price'];
@ -143,26 +131,6 @@ class Tools extends Base {
case 'bittrex': case 'bittrex':
return @$aData['result']['Last']; return @$aData['result']['Last'];
break; break;
case 'cryptobridge':
foreach ($aData as $aItem) {
if("{$strBase}_{$strQuote}" == $aItem['id'])
return $aItem['last'];
}
case 'yobit':
return @$aData[strtolower($strBase) . "_" . strtolower($strQuote)]['last'];
break;
case 'binance':
return @$aData['price'];
break;
case 'southxchange':
return @$aData['Last'];
break;
case 'mercatox':
return @$aData['pairs']["{$strBase}_{$strQuote}"]['last'];
break;
case 'tradeogre':
return @$aData['price'];
break;
} }
} else { } else {
$this->setErrorMessage("Got an invalid response from ticker API"); $this->setErrorMessage("Got an invalid response from ticker API");

View File

@ -575,7 +575,7 @@ class User extends Base {
} }
// Catchall // Catchall
$this->setErrorMessage('Failed to update your account'); $this->setErrorMessage('Failed to update your account');
$this->debug->append('Account update failed: ' . $this->mysqli->lastused->error); $this->debug->append('Account update failed: ' . $this->mysqli->error);
return false; return false;
} }
@ -832,7 +832,7 @@ class User extends Base {
$signup_time = time(); $signup_time = time();
if ($this->checkStmt($stmt) && $stmt->bind_param('sssissi', $username_clean, $password_hash, $email1, $signup_time, $pin_hash, $apikey_hash, $is_locked) && $stmt->execute()) { if ($this->checkStmt($stmt) && $stmt->bind_param('sssissi', $username_clean, $password_hash, $email1, $signup_time, $pin_hash, $apikey_hash, $is_locked) && $stmt->execute()) {
$new_account_id = $this->mysqli->lastused->insert_id; $new_account_id = $this->mysqli->insert_id;
if (!is_null($coinaddress)) $this->coin_address->add($new_account_id, $coinaddress); if (!is_null($coinaddress)) $this->coin_address->add($new_account_id, $coinaddress);
if (! $this->setting->getValue('accounts_confirm_email_disabled') && $is_admin != 1) { if (! $this->setting->getValue('accounts_confirm_email_disabled') && $is_admin != 1) {
if ($token = $this->token->createToken('confirm_email', $stmt->insert_id)) { if ($token = $this->token->createToken('confirm_email', $stmt->insert_id)) {
@ -855,8 +855,8 @@ class User extends Base {
} }
} else { } else {
$this->setErrorMessage( 'Unable to register' ); $this->setErrorMessage( 'Unable to register' );
$this->debug->append('Failed to insert user into DB: ' . $this->mysqli->lastused->error); $this->debug->append('Failed to insert user into DB: ' . $this->mysqli->error);
echo $this->mysqli->lastused->error; echo $this->mysqli->error;
if ($stmt->sqlstate == '23000') $this->setErrorMessage( 'Username or email already registered' ); if ($stmt->sqlstate == '23000') $this->setErrorMessage( 'Username or email already registered' );
return false; return false;
} }
@ -895,7 +895,7 @@ class User extends Base {
} else { } else {
$this->setErrorMessage('Invalid token: ' . $this->token->getError()); $this->setErrorMessage('Invalid token: ' . $this->token->getError());
} }
$this->debug->append('Failed to update password:' . $this->mysqli->lastused->error); $this->debug->append('Failed to update password:' . $this->mysqli->error);
return false; return false;
} }

View File

@ -174,7 +174,7 @@ class Worker extends Base {
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
$row['hashrate'] = round($this->coin->calcHashrate($row['shares'], $interval), 2); $row['hashrate'] = round($this->coin->calcHashrate($row['shares'], $interval), 2);
if ($row['count_all'] > 0) { if ($row['count_all'] > 0) {
$row['difficulty'] = round($row['shares'] / $row['count_all'], $this->coin->getShareDifficultyPrecision()); $row['difficulty'] = round($row['shares'] / $row['count_all'], 2);
} else { } else {
$row['difficulty'] = 0.00; $row['difficulty'] = 0.00;
} }

View File

@ -80,4 +80,3 @@ $aErrorCodes['E0081'] = 'Failed to insert new block into database';
$aErrorCodes['E0082'] = 'Block does not supply any usable confirmation information'; $aErrorCodes['E0082'] = 'Block does not supply any usable confirmation information';
$aErrorCodes['E0083'] = 'Maintenance mode enabled, skipped'; $aErrorCodes['E0083'] = 'Maintenance mode enabled, skipped';
$aErrorCodes['E0084'] = 'Error updating %s table'; $aErrorCodes['E0084'] = 'Error updating %s table';
$aErrorCodes['E0085'] = 'Cron disabled due to invalid arguments';

View File

@ -4,14 +4,14 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
/** /**
* Do not edit this unless you have confirmed that your config has been updated! * Do not edit this unless you have confirmed that your config has been updated!
* Also the URL to check for the most recent upstream versions available * Also the URL to check for the most recent upstream versions available
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#config-version * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-config-version
**/ **/
$config['version'] = '1.0.1'; $config['version'] = '1.0.1';
$config['version_url'] = 'https://raw.githubusercontent.com/MPOS/php-mpos/master/include/version.inc.php'; $config['version_url'] = 'https://raw.githubusercontent.com/MPOS/php-mpos/master/include/version.inc.php';
/** /**
* Unless you disable this, we'll do a quick check on your config first. * Unless you disable this, we'll do a quick check on your config first.
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#config-check * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-config-check
*/ */
$config['skip_config_tests'] = false; $config['skip_config_tests'] = false;
@ -24,7 +24,7 @@ $config['check_valid_coinaddress'] = true;
/** /**
* Defines * Defines
* Debug setting and salts for hashing passwords * Debug setting and salts for hashing passwords
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#defines--salts * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-defines--salts
*/ */
$config['DEBUG'] = 0; $config['DEBUG'] = 0;
$config['SALT'] = 'PLEASEMAKEMESOMETHINGRANDOM'; $config['SALT'] = 'PLEASEMAKEMESOMETHINGRANDOM';
@ -33,7 +33,7 @@ $config['SALTY'] = 'THISSHOULDALSOBERRAANNDDOOM';
/** /**
* Coin Algorithm * Coin Algorithm
* Algorithm used by this coin, sha256d or scrypt * Algorithm used by this coin, sha256d or scrypt
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#algorithm * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-algorithm
**/ **/
$config['algorithm'] = 'scrypt'; $config['algorithm'] = 'scrypt';
@ -47,7 +47,7 @@ $config['getbalancewithunconfirmed'] = true;
/** /**
* Database configuration * Database configuration
* MySQL database configuration * MySQL database configuration
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#database-configuration * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-database-configuration
**/ **/
$config['db']['host'] = 'localhost'; $config['db']['host'] = 'localhost';
$config['db']['user'] = 'someuser'; $config['db']['user'] = 'someuser';
@ -60,22 +60,10 @@ $config['db']['name'] = 'mpos';
// $config['db']['shared']['workers'] = $config['db']['name']; // $config['db']['shared']['workers'] = $config['db']['name'];
// $config['db']['shared']['news'] = $config['db']['name']; // $config['db']['shared']['news'] = $config['db']['name'];
/**
* Setup read-only/slave database server for selects (read queries)
**/
$config['db-ro']['enabled'] = false;
$config['db-ro']['host'] = 'localhost';
$config['db-ro']['user'] = 'someuser';
$config['db-ro']['pass'] = 'somepass';
$config['db-ro']['port'] = 3306;
$config['db-ro']['name'] = 'mpos';
/** /**
* Local wallet RPC * Local wallet RPC
* RPC configuration for your daemon/wallet * RPC configuration for your daemon/wallet
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#local-wallet-rpc * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc
**/ **/
$config['wallet']['type'] = 'http'; $config['wallet']['type'] = 'http';
$config['wallet']['host'] = 'localhost:19334'; $config['wallet']['host'] = 'localhost:19334';
@ -85,7 +73,7 @@ $config['wallet']['password'] = 'testnet';
/** /**
* Swiftmailer configuration * Swiftmailer configuration
* Configure your way to send mails * Configure your way to send mails
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#swiftmailer * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-swiftmailer
**/ **/
$config['swiftmailer']['type'] = 'sendmail'; $config['swiftmailer']['type'] = 'sendmail';
$config['swiftmailer']['sendmail']['path'] = '/usr/sbin/sendmail'; $config['swiftmailer']['sendmail']['path'] = '/usr/sbin/sendmail';
@ -100,7 +88,7 @@ $config['swiftmailer']['smtp']['throttle'] = 100;
/** /**
* Getting Started Config * Getting Started Config
* Shown to users in the 'Getting Started' section * Shown to users in the 'Getting Started' section
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#getting-started * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-getting-started
**/ **/
$config['gettingstarted']['coinname'] = 'Litecoin'; $config['gettingstarted']['coinname'] = 'Litecoin';
$config['gettingstarted']['coinurl'] = 'http://www.litecoin.org'; $config['gettingstarted']['coinurl'] = 'http://www.litecoin.org';
@ -110,17 +98,17 @@ $config['gettingstarted']['stratumport'] = '3333';
/** /**
* Ticker API * Ticker API
* Fetch exchange rates via an API * Fetch exchange rates via an API
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#ticker-api * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-ticker-api
**/ **/
$config['price']['enabled'] = false; $config['price']['enabled'] = false;
$config['price']['url'] = 'https://btc-e.nz'; $config['price']['url'] = 'https://btc-e.com';
$config['price']['target'] = '/api/2/ltc_usd/ticker'; $config['price']['target'] = '/api/2/ltc_usd/ticker';
$config['price']['currency'] = 'USD'; $config['price']['currency'] = 'USD';
/** /**
* Automatic Payout Thresholds * Automatic Payout Thresholds
* Minimum and Maximum auto payout amount * Minimum and Maximum auto payout amount
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#automatic-payout-thresholds * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-automatic-payout-thresholds
**/ **/
$config['ap_threshold']['min'] = 1; $config['ap_threshold']['min'] = 1;
$config['ap_threshold']['max'] = 250; $config['ap_threshold']['max'] = 250;
@ -128,49 +116,49 @@ $config['ap_threshold']['max'] = 250;
/** /**
* Minimum manual Payout Threshold * Minimum manual Payout Threshold
* Minimum manual payout amount * Minimum manual payout amount
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#manual-payout-threshold * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-manual-payout-threshold
**/ **/
$config['mp_threshold'] = 1; $config['mp_threshold'] = 1;
/** /**
* Donation thresholds * Donation thresholds
* Minimum donation amount in percent * Minimum donation amount in percent
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#donation-thresholds * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-donation-thresholds
**/ **/
$config['donate_threshold']['min'] = 1; $config['donate_threshold']['min'] = 1;
/** /**
* Account Specific Settings * Account Specific Settings
* Settings for each user account * Settings for each user account
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#account-specific-settings * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-account-specific-settings
**/ **/
$config['accounts']['invitations']['count'] = 5; $config['accounts']['invitations']['count'] = 5;
/** /**
* Currency * Currency
* Shorthand name for the currency * Shorthand name for the currency
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#currency * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-currency
*/ */
$config['currency'] = 'LTC'; $config['currency'] = 'LTC';
/** /**
* Coin Target * Coin Target
* Target time for coins to be generated * Target time for coins to be generated
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#coin-target * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-coin-target
**/ **/
$config['cointarget'] = '150'; $config['cointarget'] = '150';
/** /**
* Coin Diff Change * Coin Diff Change
* Amount of blocks between difficulty changes * Amount of blocks between difficulty changes
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#coin-diff-change * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-coin-diff-change
**/ **/
$config['coindiffchangetarget'] = 2016; $config['coindiffchangetarget'] = 2016;
/** /**
* TX Fees * TX Fees
* Fees applied to transactions * Fees applied to transactions
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#tx-fees * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-tx-fees
**/ **/
$config['txfee_auto'] = 0.1; $config['txfee_auto'] = 0.1;
$config['txfee_manual'] = 0.1; $config['txfee_manual'] = 0.1;
@ -178,8 +166,8 @@ $config['txfee_manual'] = 0.1;
/** /**
* Block & Pool Bonus * Block & Pool Bonus
* Bonus coins for blockfinder or a pool bonus for everyone * Bonus coins for blockfinder or a pool bonus for everyone
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#block-bonus * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-block-bonus
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#pool-bonus * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-pool-bonus
*/ */
$config['block_bonus'] = 0; $config['block_bonus'] = 0;
$config['pool_bonus'] = 0; $config['pool_bonus'] = 0;
@ -188,14 +176,14 @@ $config['pool_bonus_type'] = 'payout';
/** /**
* Payout System * Payout System
* Payout system chosen * Payout system chosen
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#payout-system * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-payout-system
**/ **/
$config['payout_system'] = 'prop'; $config['payout_system'] = 'prop';
/** /**
* Sendmany Support * Sendmany Support
* Enable/Disable Sendmany RPC method * Enable/Disable Sendmany RPC method
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#sendmany-support * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-sendmany-support
**/ **/
$config['sendmany']['enabled'] = false; $config['sendmany']['enabled'] = false;
@ -209,7 +197,7 @@ $config['payout']['txlimit_auto'] = 500;
/** /**
* Round Purging * Round Purging
* Round share purging configuration * Round share purging configuration
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#round-purging * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-round-purging
**/ **/
$config['purge']['sleep'] = 1; $config['purge']['sleep'] = 1;
$config['purge']['shares'] = 25000; $config['purge']['shares'] = 25000;
@ -217,7 +205,7 @@ $config['purge']['shares'] = 25000;
/** /**
* Share Archiving * Share Archiving
* Share archiving configuration details * Share archiving configuration details
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#archiving * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-archiving
**/ **/
$config['archive']['maxrounds'] = 10; $config['archive']['maxrounds'] = 10;
$config['archive']['maxage'] = 60 * 24; $config['archive']['maxage'] = 60 * 24;
@ -226,14 +214,14 @@ $config['archive']['maxage'] = 60 * 24;
/** /**
* Pool Fees * Pool Fees
* Fees applied to users * Fees applied to users
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#pool-fees * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-pool-fees
*/ */
$config['fees'] = 0; $config['fees'] = 0;
/** /**
* PPLNS * PPLNS
* Pay Per Last N Shares * Pay Per Last N Shares
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#pplns-settings * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-pplns-settings
*/ */
$config['pplns']['shares']['default'] = 4000000; $config['pplns']['shares']['default'] = 4000000;
$config['pplns']['shares']['type'] = 'blockavg'; $config['pplns']['shares']['type'] = 'blockavg';
@ -244,14 +232,14 @@ $config['pplns']['dynamic']['percent'] = 30;
/** /**
* Difficulty * Difficulty
* Difficulty setting for stratum/pushpool * Difficulty setting for stratum/pushpool
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#pool-target-difficulty * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-pool-target-difficulty
*/ */
$config['difficulty'] = 20; $config['difficulty'] = 20;
/** /**
* Block Reward * Block Reward
* Block reward configuration details * Block reward configuration details
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#reward-settings * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-reward-settings
**/ **/
$config['reward_type'] = 'block'; $config['reward_type'] = 'block';
$config['reward'] = 50; $config['reward'] = 50;
@ -259,7 +247,7 @@ $config['reward'] = 50;
/** /**
* Confirmations * Confirmations
* Credit and Network confirmation settings * Credit and Network confirmation settings
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#confirmations * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-confirmations
*/ */
$config['confirmations'] = 120; $config['confirmations'] = 120;
$config['network_confirmations'] = 120; $config['network_confirmations'] = 120;
@ -267,7 +255,7 @@ $config['network_confirmations'] = 120;
/** /**
* PPS * PPS
* Pay Per Share configuration details * Pay Per Share configuration details
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#pps-settings * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-pps-settings
**/ **/
$config['pps']['reward']['default'] = 50; $config['pps']['reward']['default'] = 50;
$config['pps']['reward']['type'] = 'blockavg'; $config['pps']['reward']['type'] = 'blockavg';
@ -276,7 +264,7 @@ $config['pps']['blockavg']['blockcount'] = 10;
/** /**
* Memcache * Memcache
* Memcache configuration details * Memcache configuration details
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#memcache * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-memcache
**/ **/
$config['memcache']['enabled'] = true; $config['memcache']['enabled'] = true;
$config['memcache']['host'] = 'localhost'; $config['memcache']['host'] = 'localhost';
@ -292,7 +280,7 @@ $config['memcache']['sasl']['password'] = '';
/** /**
* Cookies * Cookies
* Cookie configuration details * Cookie configuration details
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#cookies * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-cookies
**/ **/
$config['cookie']['duration'] = '1440'; $config['cookie']['duration'] = '1440';
$config['cookie']['domain'] = ''; $config['cookie']['domain'] = '';
@ -303,7 +291,7 @@ $config['cookie']['secure'] = false;
/** /**
* Smarty Cache * Smarty Cache
* Enable smarty cache and cache length * Enable smarty cache and cache length
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#smarty-cache * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-smarty-cache
**/ **/
$config['smarty']['cache'] = 0; $config['smarty']['cache'] = 0;
$config['smarty']['cache_lifetime'] = 30; $config['smarty']['cache_lifetime'] = 30;
@ -311,6 +299,6 @@ $config['smarty']['cache_lifetime'] = 30;
/** /**
* System load * System load
* Disable some calls when high system load * Disable some calls when high system load
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#system-load * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-system-load
**/ **/
$config['system']['load']['max'] = 10.0; $config['system']['load']['max'] = 10.0;

View File

@ -23,7 +23,7 @@ $config['logging']['path'] = realpath(BASEPATH.'../logs');
/** /**
* Memcache Rate Limiting * Memcache Rate Limiting
* Rate limit requests using Memcache * Rate limit requests using Memcache
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#memcache-rate-limiting * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-memcache-rate-limiting
*/ */
$config['mc_antidos']['enabled'] = true; $config['mc_antidos']['enabled'] = true;
$config['mc_antidos']['protect_ajax'] = true; $config['mc_antidos']['protect_ajax'] = true;
@ -38,14 +38,14 @@ $config['mc_antidos']['error_push_page'] = array('page' => 'error', 'action' =>
/** /**
* CSRF Protection * CSRF Protection
* Enable or disable CSRF protection * Enable or disable CSRF protection
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#csrf-protection * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-csrf-protection
*/ */
$config['csrf']['enabled'] = true; $config['csrf']['enabled'] = true;
/** /**
* E-mail confirmations for user actions * E-mail confirmations for user actions
* Two-factor confirmation for user actions * Two-factor confirmation for user actions
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#e-mail-confirmations * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-e-mail-confirmations
*/ */
$config['twofactor']['enabled'] = true; $config['twofactor']['enabled'] = true;
$config['twofactor']['options']['details'] = true; $config['twofactor']['options']['details'] = true;
@ -55,7 +55,7 @@ $config['twofactor']['options']['changepw'] = true;
/** /**
* Lock account after X * Lock account after X
* Lock accounts after X invalid logins or pins * Lock accounts after X invalid logins or pins
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#lock-accounts-after-failed-logins * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-lock-accounts-after-failed-logins
**/ **/
$config['maxfailed']['login'] = 3; $config['maxfailed']['login'] = 3;
$config['maxfailed']['pin'] = 3; $config['maxfailed']['pin'] = 3;

View File

@ -3,14 +3,13 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
// Instantiate class, we are using mysqlng // Instantiate class, we are using mysqlng
if ($config['mysql_filter']) { if ($config['mysql_filter']) {
$mysqli = new mysqlims($config['db'],$config['db-ro'], true); $mysqli = new mysqli_strict($config['db']['host'], $config['db']['user'], $config['db']['pass'], $config['db']['name'], $config['db']['port']);
} else { } else {
$mysqli = new mysqlims($config['db'],$config['db-ro'], false); $mysqli = new mysqli($config['db']['host'], $config['db']['user'], $config['db']['pass'], $config['db']['name'], $config['db']['port']);
} }
// Check if read-only and quit if it is on, disregard if slave is enabled // Check if read-only and quit if it is on
if ($mysqli->query('/* MYSQLND_MS_MASTER_SWITCH */SELECT @@global.read_only AS read_only')->fetch_object()->read_only == 1) {
if ($mysqli->query('/* MYSQLND_MS_MASTER_SWITCH */SELECT @@global.read_only AS read_only')->fetch_object()->read_only == 1 && $config['db-ro']['enabled'] === false ) {
die('Database is in READ-ONLY mode'); die('Database is in READ-ONLY mode');
} }

View File

@ -0,0 +1,274 @@
<?php
/*
* This is a PHP library that handles calling reCAPTCHA.
* - Documentation and latest version
* http://recaptcha.net/plugins/php/
* - Get a reCAPTCHA API Key
* https://www.google.com/recaptcha/admin/create
* - Discussion group
* http://groups.google.com/group/recaptcha
*
* Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
* AUTHORS:
* Mike Crawford
* Ben Maurer
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* The reCAPTCHA server URL's
*/
define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
/**
* Encodes the given data into a query string format
* @param $data - array of string elements to be encoded
* @return string - encoded request
*/
function _recaptcha_qsencode ($data) {
$req = "";
foreach ( $data as $key => $value )
$req .= $key . '=' . urlencode( stripslashes($value) ) . '&';
// Cut the last '&'
$req=substr($req,0,strlen($req)-1);
return $req;
}
/**
* Submits an HTTP POST to a reCAPTCHA server
* @param string $host
* @param string $path
* @param array $data
* @param int port
* @return array response
*/
function _recaptcha_http_post($host, $path, $data, $port = 80) {
$req = _recaptcha_qsencode ($data);
$http_request = "POST $path HTTP/1.0\r\n";
$http_request .= "Host: $host\r\n";
$http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
$http_request .= "Content-Length: " . strlen($req) . "\r\n";
$http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
$http_request .= "\r\n";
$http_request .= $req;
$response = '';
if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
die ('Could not open socket');
}
fwrite($fs, $http_request);
while ( !feof($fs) )
$response .= fgets($fs, 1160); // One TCP-IP packet
fclose($fs);
$response = explode("\r\n\r\n", $response, 2);
return $response;
}
/**
* Gets the challenge HTML (javascript and non-javascript version).
* This is called from the browser, and the resulting reCAPTCHA HTML widget
* is embedded within the HTML form it was called from.
* @param string $pubkey A public key for reCAPTCHA
* @param string $error The error given by reCAPTCHA (optional, default is null)
* @param boolean $use_ssl Should the request be made over ssl? (optional, default is false)
* @return string - The HTML to be embedded in the user's form.
*/
function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
{
if ($pubkey == null || $pubkey == '') {
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
}
if ($use_ssl) {
$server = RECAPTCHA_API_SECURE_SERVER;
} else {
$server = RECAPTCHA_API_SERVER;
}
$errorpart = "";
if ($error) {
$errorpart = "&amp;error=" . $error;
}
return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
<noscript>
<iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>';
}
/**
* A ReCaptchaResponse is returned from recaptcha_check_answer()
*/
class ReCaptchaResponse {
var $is_valid;
var $error;
}
/**
* Calls an HTTP POST function to verify if the user's guess was correct
* @param string $privkey
* @param string $remoteip
* @param string $challenge
* @param string $response
* @param array $extra_params an array of extra variables to post to the server
* @return ReCaptchaResponse
*/
function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
{
if ($privkey == null || $privkey == '') {
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
}
if ($remoteip == null || $remoteip == '') {
die ("For security reasons, you must pass the remote ip to reCAPTCHA");
}
//discard spam submissions
if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
$recaptcha_response = new ReCaptchaResponse();
$recaptcha_response->is_valid = false;
$recaptcha_response->error = 'incorrect-captcha-sol';
return $recaptcha_response;
}
$response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
array (
'privatekey' => $privkey,
'remoteip' => $remoteip,
'challenge' => $challenge,
'response' => $response
) + $extra_params
);
$answers = explode ("\n", $response [1]);
$recaptcha_response = new ReCaptchaResponse();
if (trim ($answers [0]) == 'true') {
$recaptcha_response->is_valid = true;
}
else {
$recaptcha_response->is_valid = false;
$recaptcha_response->error = $answers [1];
}
return $recaptcha_response;
}
/**
* gets a URL where the user can sign up for reCAPTCHA. If your application
* has a configuration page where you enter a key, you should provide a link
* using this function.
* @param string $domain The domain where the page is hosted
* @param string $appname The name of your application
*/
function recaptcha_get_signup_url ($domain = null, $appname = null) {
return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
}
function _recaptcha_aes_pad($val) {
$block_size = 16;
$numpad = $block_size - (strlen ($val) % $block_size);
return str_pad($val, strlen ($val) + $numpad, chr($numpad));
}
/* Mailhide related code */
function _recaptcha_aes_encrypt($val,$ky) {
if (! function_exists ("mcrypt_encrypt")) {
die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
}
$mode=MCRYPT_MODE_CBC;
$enc=MCRYPT_RIJNDAEL_128;
$val=_recaptcha_aes_pad($val);
return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
}
function _recaptcha_mailhide_urlbase64 ($x) {
return strtr(base64_encode ($x), '+/', '-_');
}
/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
function recaptcha_mailhide_url($pubkey, $privkey, $email) {
if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
"you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
}
$ky = pack('H*', $privkey);
$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
}
/**
* gets the parts of the email to expose to the user.
* eg, given johndoe@example,com return ["john", "example.com"].
* the email is then displayed as john...@example.com
*/
function _recaptcha_mailhide_email_parts ($email) {
$arr = preg_split("/@/", $email );
if (strlen ($arr[0]) <= 4) {
$arr[0] = substr ($arr[0], 0, 1);
} else if (strlen ($arr[0]) <= 6) {
$arr[0] = substr ($arr[0], 0, 3);
} else {
$arr[0] = substr ($arr[0], 0, 4);
}
return $arr;
}
/**
* Gets html to display an email address given a public an private key.
* to get a key, go to:
*
* http://www.google.com/recaptcha/mailhide/apikey
*/
function recaptcha_mailhide_html($pubkey, $privkey, $email) {
$emailparts = _recaptcha_mailhide_email_parts ($email);
$url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
"' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
}

View File

@ -12,7 +12,7 @@ $aLastBlock = $block->getLast();
// Efficiency // Efficiency
$aShares = $statistics->getRoundShares(); $aShares = $statistics->getRoundShares();
$aShares['invalid'] > 0 ? $dEfficiency = round((1 - ($aShares['invalid'] / ($aShares['valid'] + $aShares['invalid']))) * 100, 2) : $dEfficiency = 100; $aShares['valid'] > 0 ? $dEfficiency = round((100 - (100 / $aShares['valid'] * $aShares['invalid'])), 2) : $dEfficiency = 0;
// Fetch RPC data // Fetch RPC data
if ($bitcoin->can_connect() === true){ if ($bitcoin->can_connect() === true){

View File

@ -8,25 +8,13 @@ $api->isActive();
$user_id = $api->checkAccess($user->checkApiKey($_REQUEST['api_key']), @$_REQUEST['id']); $user_id = $api->checkAccess($user->checkApiKey($_REQUEST['api_key']), @$_REQUEST['id']);
// Fetch transactions // Fetch transactions
if (isset($_REQUEST['start'])) {
$start = $_REQUEST['start'];
} else {
// start at the beginning
$start = 0;
}
if (isset($_REQUEST['limit']) && $_REQUEST['limit'] <= 100) { if (isset($_REQUEST['limit']) && $_REQUEST['limit'] <= 100) {
$limit = $_REQUEST['limit']; $limit = $_REQUEST['limit'];
} else { } else {
// Force limit // Force limit
$limit = 100; $limit = 100;
} }
if (isset($_REQUEST['filter']) && is_array($_REQUEST['filter'])) { $data['transactions'] = $transaction->getTransactions(0, NULL, $limit, $user_id);
$filter = $_REQUEST['filter'];
} else {
$filter = NULL;
}
$data['transactions'] = $transaction->getTransactions($start, $filter, $limit, $user_id);
// Fetch summary if enabled // Fetch summary if enabled
if (!$setting->getValue('disable_transactionsummary')) { if (!$setting->getValue('disable_transactionsummary')) {

View File

@ -25,7 +25,7 @@ if ($setting->getValue('acl_contactform') == 2) {
if ($mail->contactform($_POST['senderName'], $_POST['senderEmail'], $_POST['senderSubject'], $_POST['senderMessage'])) { if ($mail->contactform($_POST['senderName'], $_POST['senderEmail'], $_POST['senderSubject'], $_POST['senderMessage'])) {
$_SESSION['POPUP'][] = array('CONTENT' => 'Thanks for sending your message! We will get back to you shortly'); $_SESSION['POPUP'][] = array('CONTENT' => 'Thanks for sending your message! We will get back to you shortly');
} else { } else {
$_SESSION['POPUP'][] = array('CONTENT' => 'There was a problem sending your message. Check following error and please try again: ' . $mail->getError(), 'TYPE' => 'alert alert-danger'); $_SESSION['POPUP'][] = array('CONTENT' => 'There was a problem sending your message. Please try again. ' . $user->getError(), 'TYPE' => 'alert alert-danger');
} }
} }
} }

View File

@ -1,25 +1,20 @@
<?php <?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1; $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
$recaptcha_enabled = ($setting->getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_logins'));
if ($recaptcha_enabled) {
$recaptcha_secret = $setting->getValue('recaptcha_private_key');
$recaptcha_public_key = $setting->getValue('recaptcha_public_key');
$recaptcha = new \ReCaptcha\ReCaptcha($recaptcha_secret);
$smarty->assign("recaptcha_public_key", $recaptcha_public_key);
}
$smarty->assign("recaptcha_enabled", $recaptcha_enabled);
// ReCaptcha handling if enabled // ReCaptcha handling if enabled
if ($recaptcha_enabled) { if ($setting->getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_logins')) {
require_once(INCLUDE_DIR . '/lib/recaptchalib.php');
if (!empty($_POST['username']) && !empty($_POST['password'])) { if (!empty($_POST['username']) && !empty($_POST['password'])) {
// Load re-captcha specific data // Load re-captcha specific data
$rsp = recaptcha_check_answer (
$recaptcha_response = (isset($_POST["g-recaptcha-response"]) ? $_POST["g-recaptcha-response"] : null); $setting->getValue('recaptcha_private_key'),
$rsp = $recaptcha->verify($recaptcha_response, $_SERVER["REMOTE_ADDRESS"]); $_SERVER["REMOTE_ADDR"],
( (isset($_POST["recaptcha_challenge_field"])) ? $_POST["recaptcha_challenge_field"] : null ),
( (isset($_POST["recaptcha_response_field"])) ? $_POST["recaptcha_response_field"] : null )
);
$smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key'), $rsp->error, true));
} else {
$smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key'), null, true));
} }
} }
@ -28,7 +23,7 @@ if (!empty($_POST['username']) && !empty($_POST['password'])) {
$_SESSION['POPUP'][] = array('CONTENT' => 'You are not allowed to login during maintenace.', 'TYPE' => 'alert alert-info'); $_SESSION['POPUP'][] = array('CONTENT' => 'You are not allowed to login during maintenace.', 'TYPE' => 'alert alert-info');
} else { } else {
// Check if recaptcha is enabled, process form data if valid // Check if recaptcha is enabled, process form data if valid
if (($recaptcha_enabled && $rsp->isSuccess()) || !$recaptcha_enabled) { if (!$setting->getValue('recaptcha_enabled') || !$setting->getValue('recaptcha_enabled_logins') || ($setting->getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_logins') && $rsp->is_valid)) {
if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) { if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
// check if login is correct // check if login is correct
if ($user->checkLogin(@$_POST['username'], @$_POST['password']) ) { if ($user->checkLogin(@$_POST['username'], @$_POST['password']) ) {

View File

@ -8,14 +8,10 @@ if ($setting->getValue('lock_registration') && $setting->getValue('disable_invit
$_SESSION['POPUP'][] = array('CONTENT' => 'Only invited users are allowed to register.', 'TYPE' => 'alert alert-danger'); $_SESSION['POPUP'][] = array('CONTENT' => 'Only invited users are allowed to register.', 'TYPE' => 'alert alert-danger');
$smarty->assign("CONTENT", "disabled.tpl"); $smarty->assign("CONTENT", "disabled.tpl");
} else { } else {
$recaptcha_enabled = ($setting->getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_registrations')); if ($setting->getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_registrations')) {
$smarty->assign("recaptcha_enabled", $recaptcha_enabled); require_once(INCLUDE_DIR . '/lib/recaptchalib.php');
$smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key'), null, true));
if ($recaptcha_enabled) {
$recaptcha_public_key = $setting->getValue('recaptcha_public_key');
$smarty->assign("recaptcha_public_key", $recaptcha_public_key);
} }
// Load news entries for Desktop site and unauthenticated users // Load news entries for Desktop site and unauthenticated users
$smarty->assign("CONTENT", "default.tpl"); $smarty->assign("CONTENT", "default.tpl");
} }

View File

@ -1,24 +1,19 @@
<?php <?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1; $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
$recaptcha_enabled = ($setting->getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_registrations'));
$smarty->assign("recaptcha_enabled", $recaptcha_enabled);
// ReCaptcha handling if enabled // ReCaptcha handling if enabled
if ($recaptcha_enabled) { if ($setting->getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_registrations')) {
$recaptcha_secret = $setting->getValue('recaptcha_private_key'); require_once(INCLUDE_DIR . '/lib/recaptchalib.php');
$recaptcha_public_key = $setting->getValue('recaptcha_public_key');
$smarty->assign("recaptcha_public_key", $recaptcha_public_key);
$recaptcha = new \ReCaptcha\ReCaptcha($recaptcha_secret);
// Load re-captcha specific data // Load re-captcha specific data
$recaptcha_response = (isset($_POST["g-recaptcha-response"]) ? $_POST["g-recaptcha-response"] : null); $rsp = recaptcha_check_answer (
$rsp = $recaptcha->verify($recaptcha_response, $_SERVER["REMOTE_ADDRESS"]); $setting->getValue('recaptcha_private_key'),
$_SERVER["REMOTE_ADDR"],
if (!$rsp->isSuccess()) $_SESSION['POPUP'][] = array('CONTENT' => 'Invalid Captcha, please try again.', 'TYPE' => 'alert alert-danger'); ( (isset($_POST["recaptcha_challenge_field"])) ? $_POST["recaptcha_challenge_field"] : null ),
( (isset($_POST["recaptcha_response_field"])) ? $_POST["recaptcha_response_field"] : null )
);
$smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key'), $rsp->error, true));
if (!$rsp->is_valid) $_SESSION['POPUP'][] = array('CONTENT' => 'Invalid Captcha, please try again.', 'TYPE' => 'alert alert-danger');
$recaptcha = ($rsp->is_valid) ? 1 : 0;
} }
if ($setting->getValue('disable_invitations') && $setting->getValue('lock_registration')) { if ($setting->getValue('disable_invitations') && $setting->getValue('lock_registration')) {
@ -28,7 +23,7 @@ if ($setting->getValue('disable_invitations') && $setting->getValue('lock_regist
} else { } else {
// Check if csrf is enabled and fail if token is invalid // Check if csrf is enabled and fail if token is invalid
if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) { if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
if (($recaptcha_enabled && $rsp->isSuccess()) || !$recaptcha_enabled) { if ($setting->getValue('recaptcha_enabled') != 1 || $setting->getValue('recaptcha_enabled_registrations') != 1 || $rsp->is_valid) {
// Check if recaptcha is enabled, process form data if valid or disabled // Check if recaptcha is enabled, process form data if valid or disabled
isset($_POST['token']) ? $token = $_POST['token'] : $token = ''; isset($_POST['token']) ? $token = $_POST['token'] : $token = '';
isset($_POST['coinaddress']) ? $validcoinaddress = $_POST['coinaddress'] : $validcoinaddress = NULL; isset($_POST['coinaddress']) ? $validcoinaddress = $_POST['coinaddress'] : $validcoinaddress = NULL;

View File

@ -9,7 +9,7 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
} else { } else {
$dDifficulty = 1; $dDifficulty = 1;
$iBlock = 0; $iBlock = 0;
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to RPC service: ' . $bitcoin->can_connect(), 'TYPE' => 'alert alert-danger'); $_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to litecoind RPC service: ' . $bitcoin->can_connect(), 'TYPE' => 'alert alert-danger');
} }
$smarty->assign("CURRENTBLOCK", $iBlock); $smarty->assign("CURRENTBLOCK", $iBlock);
$smarty->assign("DIFFICULTY", $dDifficulty); $smarty->assign("DIFFICULTY", $dDifficulty);

View File

@ -1,8 +1,8 @@
<?php <?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1; $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
define('MPOS_VERSION', '1.1.0'); define('MPOS_VERSION', '1.0.8');
define('DB_VERSION', '1.0.3'); define('DB_VERSION', '1.0.2');
define('CONFIG_VERSION', '1.0.1'); define('CONFIG_VERSION', '1.0.1');
define('HASH_VERSION', 1); define('HASH_VERSION', 1);

View File

@ -43,7 +43,7 @@ CREATE TABLE IF NOT EXISTS `blocks` (
`accounted` tinyint(1) NOT NULL DEFAULT '0', `accounted` tinyint(1) NOT NULL DEFAULT '0',
`account_id` int(255) unsigned DEFAULT NULL, `account_id` int(255) unsigned DEFAULT NULL,
`worker_name` varchar(50) DEFAULT 'unknown', `worker_name` varchar(50) DEFAULT 'unknown',
`shares` double unsigned DEFAULT NULL, `shares` bigint(30) unsigned DEFAULT NULL,
`share_id` bigint(30) DEFAULT NULL, `share_id` bigint(30) DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `height` (`height`,`blockhash`), UNIQUE KEY `height` (`height`,`blockhash`),
@ -142,7 +142,7 @@ CREATE TABLE IF NOT EXISTS `settings` (
UNIQUE KEY `setting` (`name`) UNIQUE KEY `setting` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '1.0.3'); INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '1.0.2');
CREATE TABLE IF NOT EXISTS `shares` ( CREATE TABLE IF NOT EXISTS `shares` (
`id` bigint(30) NOT NULL AUTO_INCREMENT, `id` bigint(30) NOT NULL AUTO_INCREMENT,
@ -182,10 +182,10 @@ CREATE TABLE IF NOT EXISTS `statistics_shares` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`account_id` int(10) unsigned NOT NULL, `account_id` int(10) unsigned NOT NULL,
`block_id` int(10) unsigned NOT NULL, `block_id` int(10) unsigned NOT NULL,
`valid` float unsigned NOT NULL DEFAULT '0', `valid` bigint(20) NOT NULL,
`invalid` float unsigned NOT NULL DEFAULT '0', `invalid` bigint(20) NOT NULL DEFAULT '0',
`pplns_valid` float unsigned NOT NULL DEFAULT '0', `pplns_valid` bigint(20) NOT NULL,
`pplns_invalid` float unsigned NOT NULL DEFAULT '0', `pplns_invalid` bigint(20) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `account_id` (`account_id`), KEY `account_id` (`account_id`),
KEY `block_id` (`block_id`) KEY `block_id` (`block_id`)

View File

@ -48,7 +48,7 @@
</ul> </ul>
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
<h6>This Pool is running <a href="https://github.com/TheSerapher/php-mpos">MPOS</a> project code. This frontend was created by <a href="https://github.com/MPOS/php-mpos">TheSerapher aka Sebastian Grewe</a>. The operation of the pool is soley at the hand of your trusted pool operator.</h6> <h6>This Pool is running <a href="https://github.com/TheSerapher/php-mpos">MPOS</a> project code. This frontend was created by <a href="https://github.com/MPOS/php-mpos"TheSerapher aka Sebastian Grewe</a>. The operation of the pool is soley at the hand of your trusted pool operator.</h6>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,35 +1,31 @@
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="panel panel-info"> <div class="panel panel-info">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-connectdevelop fa-fw"></i> Peer Information <i class="fa fa-connectdevelop fa-fw"></i> Peer Information
</div> </div>
<div class="panel-body no-padding"> <div class="panel-body no-padding">
<div class="table-responsive"> <table class="table table-striped table-bordered table-hover">
<table class="table table-striped table-bordered table-hover"> <thead>
<thead> <tr>
<tr> <th>Host</th>
<th>Host</th> <th>Protocol</th>
<th>Protocol</th> <th>Identity</th>
<th>Identity</th> <th>Connected</th>
<th>Connected</th> <th>Traffic</th>
<th>Traffic</th> </tr>
</tr> </thead>
</thead> <tbody>
<tbody> {foreach key=KEY item=ARRAY from=$PEERINFO}
{foreach key=KEY item=ARRAY from=$PEERINFO} <tr>
<tr> <td>{$ARRAY['addr']}</td>
<td>{$ARRAY['addr']}</td> <td>{$ARRAY['version']}</td>
<td>{$ARRAY['version']}</td> <td>{$ARRAY['subver']|replace:'/':''}</td>
<td>{$ARRAY['subver']|replace:'/':''}</td> <td>{$ARRAY['conntime']|date_format:$GLOBAL.config.date}</td>
<td>{$ARRAY['conntime']|date_format:$GLOBAL.config.date}</td> <td>{(($ARRAY['bytessent']|default:"0" + $ARRAY['bytesrecv']|default:"0") / 1024 / 1024)|number_format:"3"} MB</td>
<td>{(($ARRAY['bytessent']|default:"0" + $ARRAY['bytesrecv']|default:"0") / 1024 / 1024)|number_format:"3"} MB</td> </tr>
</tr> {/foreach}
{/foreach} </tbody>
</tbody> </table>
</table> </div>
</div> </div>
</div>
</div>
</div>
</div>

View File

@ -1,35 +1,32 @@
<div class="col-lg-8"> <div class="col-lg-8">
<div class="panel panel-info"> <div class="panel panel-info">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-info fa-fw"></i> Wallet Status <i class="fa fa-info fa-fw"></i> Wallet Status
</div> </div>
<div class="panel-body no-padding"> <div class="panel-body no-padding">
<div class="table-responsive"> <table class="table table-striped table-bordered table-hover">
<table class="table table-striped table-bordered table-hover"> <thead>
<thead> <th>Version</th>
<tr> <th>Protocol Version</th>
<th>Version</th> <th>Wallet Version</th>
<th>Protocol Version</th> <th>Peers</th>
<th>Wallet Version</th> <th>Status</th>
<th>Peers</th> <th>Blocks</th>
<th>Status</th> <th>Accounts</th>
<th>Blocks</th> </thead>
<th>Accounts</th> <tbody>
</tr> <tr>
</thead> <td>{$COININFO.version|default:""}</td>
<tbody> <td>{$COININFO.protocolversion|default:""}</td>
<tr> <td>{$COININFO.walletversion|default:""}</td>
<td>{$COININFO.version|default:""}</td> <td>{$COININFO.connections|default:""}</td>
<td>{$COININFO.protocolversion|default:""}</td> <td><font color="{if $COININFO.errors}red{else}green{/if}">{$COININFO.errors|default:"OK"}</font></td>
<td>{$COININFO.walletversion|default:""}</td> <td>{$COININFO.blocks|default:"0"}</td>
<td>{$COININFO.connections|default:""}</td> <td>{$ADDRESSCOUNT}</td>
<td><font color="{if $COININFO.errors}red{else}green{/if}">{$COININFO.errors|default:"OK"}</font></td> </tr>
<td>{$COININFO.blocks|default:"0"}</td> </tbody>
<td>{$ADDRESSCOUNT}</td> </table>
</tr> </div>
</tbody> </div>
</table> </div>
</div> </div>
</div>
</div>
</div>

View File

@ -26,8 +26,8 @@
<td class="text-right">{$BLOCKSFOUND[block].time|date_format:$GLOBAL.config.date}</td> <td class="text-right">{$BLOCKSFOUND[block].time|date_format:$GLOBAL.config.date}</td>
<td class="text-right">{$BLOCKSFOUND[block].difficulty|number_format:"4"}</td> <td class="text-right">{$BLOCKSFOUND[block].difficulty|number_format:"4"}</td>
<td class="text-right">{$BLOCKSFOUND[block].amount|number_format:"2"}</td> <td class="text-right">{$BLOCKSFOUND[block].amount|number_format:"2"}</td>
<td class="text-right">{$BLOCKSFOUND[block].estshares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$BLOCKSFOUND[block].estshares|number_format}</td>
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$BLOCKSFOUND[block].shares|number_format}</td>
<td class="text-right"> <td class="text-right">
{math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares|default:"0" estshares=$BLOCKSFOUND[block].estshares} {math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares|default:"0" estshares=$BLOCKSFOUND[block].estshares}
<font color="{if ($percentage <= 100)}green{else}red{/if}">{$percentage|number_format:"2"}</font> <font color="{if ($percentage <= 100)}green{else}red{/if}">{$percentage|number_format:"2"}</font>

View File

@ -43,7 +43,7 @@ $(document).ready(function(){
// Load initial sparkline values // Load initial sparkline values
var storedPersonalHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.userdata.hashrate|round:"2"}{literal} ]; var storedPersonalHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.userdata.hashrate|round:"2"}{literal} ];
var storedPersonalSharerate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.userdata.sharerate|round:$GLOBAL.config.sharediffprecision}{literal} ]; var storedPersonalSharerate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.userdata.sharerate|round:"2"}{literal} ];
var storedPoolHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.hashrate|round:"2"}{literal} ]; var storedPoolHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.hashrate|round:"2"}{literal} ];
var storedNetHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.nethashrate|round:"2"}{literal} ]; var storedNetHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.nethashrate|round:"2"}{literal} ];
var storedPoolWorkers = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.workers}{literal} ]; var storedPoolWorkers = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.workers}{literal} ];
@ -89,7 +89,7 @@ $(document).ready(function(){
storedPersonalHashrate.shift(); storedPersonalHashrate.shift();
storedPersonalHashrate.push(parseFloat(data.getdashboarddata.data.personal.hashrate).toFixed(2)) storedPersonalHashrate.push(parseFloat(data.getdashboarddata.data.personal.hashrate).toFixed(2))
storedPersonalSharerate.shift(); storedPersonalSharerate.shift();
storedPersonalSharerate.push(parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed({/literal}{$GLOBAL.config.sharediffprecision}{literal})) storedPersonalSharerate.push(parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed(2))
storedPoolHashrate.shift(); storedPoolHashrate.shift();
storedPoolHashrate.push(parseFloat(data.getdashboarddata.data.pool.hashrate).toFixed(2)) storedPoolHashrate.push(parseFloat(data.getdashboarddata.data.pool.hashrate).toFixed(2))
storedNetHashrate.shift(); storedNetHashrate.shift();
@ -122,7 +122,7 @@ $(document).ready(function(){
} else { } else {
$('#b-nethashrate').html('n/a'); $('#b-nethashrate').html('n/a');
} }
$('#b-sharerate').html((parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed({/literal}{$GLOBAL.config.sharediffprecision}{literal}))); $('#b-sharerate').html((parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed(2)));
$('#b-yvalid').html(number_format(data.getdashboarddata.data.personal.shares.valid, {/literal}{$GLOBAL.config.sharediffprecision}{literal})); $('#b-yvalid').html(number_format(data.getdashboarddata.data.personal.shares.valid, {/literal}{$GLOBAL.config.sharediffprecision}{literal}));
$('#b-yivalid').html(number_format(data.getdashboarddata.data.personal.shares.invalid, {/literal}{$GLOBAL.config.sharediffprecision}{literal})); $('#b-yivalid').html(number_format(data.getdashboarddata.data.personal.shares.invalid, {/literal}{$GLOBAL.config.sharediffprecision}{literal}));
if ( data.getdashboarddata.data.personal.shares.valid > 0 ) { if ( data.getdashboarddata.data.personal.shares.valid > 0 ) {

View File

@ -43,7 +43,7 @@
<div class="circle-tile-description text-faded"> <div class="circle-tile-description text-faded">
<p class="h5 up-more">My Sharerate</p> <p class="h5 up-more">My Sharerate</p>
<div class="circle-tile-number text-faded up"> <div class="circle-tile-number text-faded up">
<span class="overview" id="b-sharerate">{$GLOBAL.userdata.sharerate|number_format:$GLOBAL.config.sharediffprecision}</span> <span class="overview" id="b-sharerate">{$GLOBAL.userdata.sharerate|number_format:"2"}</span>
<span class="overview-mhs"> S/s</span> <span class="overview-mhs"> S/s</span>
<br> <br>
<span class="personal-sharerate-bar spark-18"></span> <span class="personal-sharerate-bar spark-18"></span>

View File

@ -43,7 +43,7 @@
<div class="circle-tile-description text-faded"> <div class="circle-tile-description text-faded">
<p class="h5 up-more">My Sharerate</p> <p class="h5 up-more">My Sharerate</p>
<div class="circle-tile-number text-faded up"> <div class="circle-tile-number text-faded up">
<span class="overview" id="b-sharerate">{$GLOBAL.userdata.sharerate|number_format:$GLOBAL.config.sharediffprecision}</span> <span class="overview" id="b-sharerate">{$GLOBAL.userdata.sharerate|number_format:"2"}</span>
<span class="overview-mhs"> S/s</span> <span class="overview-mhs"> S/s</span>
<br> <br>
<span class="personal-sharerate-bar spark-18"></span> <span class="personal-sharerate-bar spark-18"></span>

View File

@ -70,7 +70,7 @@
<p class="h5" id="b-nextdiff">{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}</p> <p class="h5" id="b-nextdiff">{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}</p>
</div> </div>
<div class="circle-tile-number text-faded"> <div class="circle-tile-number text-faded">
<p class="h6">Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}</p> <p class="h6">Est Next Difficulty{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}</p>
</div> </div>
</div> </div>
</div> </div>

View File

@ -130,7 +130,7 @@
<p id="b-nextdiff" class="h5">{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}</p> <p id="b-nextdiff" class="h5">{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}</p>
</div> </div>
<div class="circle-tile-number text-faded"> <div class="circle-tile-number text-faded">
<p class="h6">Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}</p> <p class="h6">Est Next Difficulty{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}</p>
</div> </div>
</div> </div>
</div> </div>

View File

@ -70,7 +70,7 @@
<p class="h5" id="b-nextdiff">{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}</p> <p class="h5" id="b-nextdiff">{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}</p>
</div> </div>
<div class="circle-tile-number text-faded"> <div class="circle-tile-number text-faded">
<p class="h6">Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget|default:2016 > 1}{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}</p> <p class="h6">Est Next Difficulty{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}</p>
</div> </div>
</div> </div>
</div> </div>

View File

@ -17,14 +17,7 @@
</div> </div>
</div> </div>
</div> </div>
<center> <center>{nocache}{$RECAPTCHA|default:"" nofilter}{/nocache}</center>
{nocache}
{if $recaptcha_enabled}
<div class="g-recaptcha" data-sitekey="{$recaptcha_public_key}"></div>
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js"></script>
{/if}
{/nocache}
</center>
<div class="panel-footer"> <div class="panel-footer">
<input type="submit" class="btn btn-success btn-sm" value="Login" > <input type="submit" class="btn btn-success btn-sm" value="Login" >
<a href="{$smarty.server.SCRIPT_NAME}?page=password"><font size="1">Forgot your password?</font></a> <a href="{$smarty.server.SCRIPT_NAME}?page=password"><font size="1">Forgot your password?</font></a>

View File

@ -60,14 +60,7 @@
</label> </label>
</div> </div>
</div> </div>
<center> <center>{nocache}{$RECAPTCHA|default:"" nofilter}{/nocache}</center>
{nocache}
{if $recaptcha_enabled}
<div class="g-recaptcha" data-sitekey="{$recaptcha_public_key}"></div>
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js"></script>
{/if}
{/nocache}
</center>
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
<input type="submit" value="Register" class="btn btn-success btn-sm"> <input type="submit" value="Register" class="btn btn-success btn-sm">

View File

@ -38,11 +38,11 @@
0 0
{/if} {/if}
</td> </td>
<td class="text-right">{$LASTBLOCKSBYTIME.TotalEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$LASTBLOCKSBYTIME.TotalEstimatedShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.TotalShares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$LASTBLOCKSBYTIME.TotalShares|number_format}</td>
<td class="text-right"> <td class="text-right">
{if $LASTBLOCKSBYTIME.TotalEstimatedShares > 0} {if $LASTBLOCKSBYTIME.TotalEstimatedShares > 0}
<font color="{if (($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100)|number_format:"2"}%</font></b> <font color="{if (($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100) <= 100)}green{else}red{/if}">{($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100)|number_format:"2"}%</font></b>
{else} {else}
0.00% 0.00%
{/if} {/if}
@ -64,11 +64,11 @@
0 0
{/if} {/if}
</td> </td>
<td class="text-right">{$LASTBLOCKSBYTIME.1HourEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$LASTBLOCKSBYTIME.1HourEstimatedShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.1HourShares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$LASTBLOCKSBYTIME.1HourShares|number_format}</td>
<td class="text-right"> <td class="text-right">
{if $LASTBLOCKSBYTIME.1HourEstimatedShares > 0} {if $LASTBLOCKSBYTIME.1HourEstimatedShares > 0}
<font color="{if (($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100)|number_format:"2"}%</font></b> <font color="{if (($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100) <= 100)}green{else}red{/if}">{($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100)|number_format:"2"}%</font></b>
{else} {else}
0.00% 0.00%
{/if} {/if}
@ -90,11 +90,11 @@
0 0
{/if} {/if}
</td> </td>
<td class="text-right">{$LASTBLOCKSBYTIME.24HourEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$LASTBLOCKSBYTIME.24HourEstimatedShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.24HourShares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$LASTBLOCKSBYTIME.24HourShares|number_format}</td>
<td class="text-right"> <td class="text-right">
{if $LASTBLOCKSBYTIME.24HourEstimatedShares > 0} {if $LASTBLOCKSBYTIME.24HourEstimatedShares > 0}
<font color="{if (($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100)|number_format:"2"}%</font></b> <font color="{if (($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100) <= 100)}green{else}red{/if}">{($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100)|number_format:"2"}%</font></b>
{else} {else}
0.00% 0.00%
{/if} {/if}
@ -116,11 +116,11 @@
0 0
{/if} {/if}
</td> </td>
<td class="text-right">{$LASTBLOCKSBYTIME.7DaysEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$LASTBLOCKSBYTIME.7DaysEstimatedShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.7DaysShares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$LASTBLOCKSBYTIME.7DaysShares|number_format}</td>
<td class="text-right"> <td class="text-right">
{if $LASTBLOCKSBYTIME.7DaysEstimatedShares > 0} {if $LASTBLOCKSBYTIME.7DaysEstimatedShares > 0}
<font color="{if (($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100)|number_format:"2"}%</font></b> <font color="{if (($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100) <= 100)}green{else}red{/if}">{($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100)|number_format:"2"}%</font></b>
{else} {else}
0.00% 0.00%
{/if} {/if}
@ -142,11 +142,11 @@
0 0
{/if} {/if}
</td> </td>
<td class="text-right">{$LASTBLOCKSBYTIME.4WeeksEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$LASTBLOCKSBYTIME.4WeeksEstimatedShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.4WeeksShares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$LASTBLOCKSBYTIME.4WeeksShares|number_format}</td>
<td class="text-right"> <td class="text-right">
{if $LASTBLOCKSBYTIME.4WeeksEstimatedShares > 0} {if $LASTBLOCKSBYTIME.4WeeksEstimatedShares > 0}
<font color="{if (($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100)|number_format:"2"}%</font></b> <font color="{if (($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100) <= 100)}green{else}red{/if}">{($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100)|number_format:"2"}%</font></b>
{else} {else}
0.00% 0.00%
{/if} {/if}
@ -168,11 +168,11 @@
0 0
{/if} {/if}
</td> </td>
<td class="text-right">{$LASTBLOCKSBYTIME.12MonthEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$LASTBLOCKSBYTIME.12MonthEstimatedShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.12MonthShares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$LASTBLOCKSBYTIME.12MonthShares|number_format}</td>
<td class="text-right"> <td class="text-right">
{if $LASTBLOCKSBYTIME.12MonthEstimatedShares > 0} {if $LASTBLOCKSBYTIME.12MonthEstimatedShares > 0}
<font color="{if (($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100)|number_format:"2"}%</font></b> <font color="{if (($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100) <= 100)}green{else}red{/if}">{($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100)|number_format:"2"}%</font></b>
{else} {else}
0.00% 0.00%
{/if} {/if}

View File

@ -51,26 +51,26 @@
<td class="text-right">{$BLOCKSFOUND[block].amount|number_format:"2"}</td> <td class="text-right">{$BLOCKSFOUND[block].amount|number_format:"2"}</td>
<td class="text-right"> <td class="text-right">
{assign var="totalexpectedshares" value=$totalexpectedshares+$BLOCKSFOUND[block].estshares} {assign var="totalexpectedshares" value=$totalexpectedshares+$BLOCKSFOUND[block].estshares}
{$BLOCKSFOUND[block].estshares|number_format:$GLOBAL.config.sharediffprecision} {$BLOCKSFOUND[block].estshares|number_format}
</td> </td>
{if $GLOBAL.config.payout_system == 'pplns'} {if $GLOBAL.config.payout_system == 'pplns'}
<td class="text-right">{$BLOCKSFOUND[block].pplns_shares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$BLOCKSFOUND[block].pplns_shares|number_format}</td>
{/if} {/if}
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$BLOCKSFOUND[block].shares|number_format}</td>
<td class="text-right"> <td class="text-right">
{math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares|default:"0" estshares=$BLOCKSFOUND[block].estshares} {math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares|default:"0" estshares=$BLOCKSFOUND[block].estshares}
<font color="{if ($percentage <= 100)}green{elseif ($percentage <= 115)}orange{else}red{/if}">{$percentage|number_format:"2"}</font> <font color="{if ($percentage <= 100)}green{else}red{/if}">{$percentage|number_format:"2"}</font>
</td> </td>
</tr> </tr>
{/section} {/section}
<tr> <tr>
<td colspan="6"><b>Totals</b></td> <td colspan="6"><b>Totals</b></td>
<td class="text-right">{$totalexpectedshares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$totalexpectedshares|number_format}</td>
{if $GLOBAL.config.payout_system == 'pplns'} {if $GLOBAL.config.payout_system == 'pplns'}
<td class="text-right">{$pplnsshares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$pplnsshares|number_format}</td>
{/if} {/if}
<td class="text-right">{$totalshares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$totalshares|number_format}</td>
<td class="text-right">{if $count > 0}<font color="{if (($totalshares / $totalexpectedshares * 100) <= 100)}green{elseif (($totalshares / $totalexpectedshares * 100) <= 115)}orange{else}red{/if}">{($totalshares / $totalexpectedshares * 100)|number_format:"2"}</font>{else}0{/if}</td> <td class="text-right">{if $count > 0}<font color="{if (($totalshares / $totalexpectedshares * 100) <= 100)}green{else}red{/if}">{($totalshares / $totalexpectedshares * 100)|number_format:"2"}</font>{else}0{/if}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -24,7 +24,7 @@
{/if} {/if}
<td>{if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if}</td> <td>{if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if}</td>
<td>{$BLOCKSFOUND[block].time|date_format:$GLOBAL.config.date}</td> <td>{$BLOCKSFOUND[block].time|date_format:$GLOBAL.config.date}</td>
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$BLOCKSFOUND[block].shares|number_format}</td>
</tr> </tr>
{/section} {/section}
</tbody> </tbody>

View File

@ -1,9 +1,8 @@
<script> <script>
$(function () { $(function () {
var miningstats = {$YOURMININGSTATS nofilter};
var hashChart = Morris.Line({ var hashChart = Morris.Line({
element: 'hashrate-area-chart', element: 'hashrate-area-chart',
data: miningstats, data: {$YOURMININGSTATS},
xkey: 'time', xkey: 'time',
ykeys: ['hashrate'], ykeys: ['hashrate'],
labels: ['Hashrate'], labels: ['Hashrate'],
@ -18,7 +17,7 @@ $(function () {
var workersChart = Morris.Line({ var workersChart = Morris.Line({
element: 'workers-area-chart', element: 'workers-area-chart',
data: miningstats, data: {$YOURMININGSTATS},
xkey: 'time', xkey: 'time',
ykeys: ['workers'], ykeys: ['workers'],
labels: ['Workers'], labels: ['Workers'],
@ -33,7 +32,7 @@ $(function () {
var shareCharts= Morris.Line({ var shareCharts= Morris.Line({
element: 'sharerate-area-chart', element: 'sharerate-area-chart',
data: miningstats, data: {$YOURMININGSTATS},
xkey: 'time', xkey: 'time',
ykeys: ['sharerate'], ykeys: ['sharerate'],
labels: ['Sharerate'], labels: ['Sharerate'],

View File

@ -35,7 +35,7 @@
{/section} {/section}
{if $listed != 1 && $GLOBAL.userdata.username|default:"" && $GLOBAL.userdata.rawhashrate|default:"0" > 0} {if $listed != 1 && $GLOBAL.userdata.username|default:"" && $GLOBAL.userdata.rawhashrate|default:"0" > 0}
{math assign="myestday" equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$GLOBAL.userdata.rawhashrate} {math assign="myestday" equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$GLOBAL.userdata.rawhashrate}
{if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|default:""|lower}{assign var=listed value=1}<tr class="success">{else}<tr>{/if} {if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|lower}{assign var=listed value=1}<tr class="success">{else}<tr>{/if}
<td>n/a</td> <td>n/a</td>
<td>{if $GLOBAL.userdata.donate_percent|default:"0" >= 2}<i class="fa fa-trophy fa-fw"></i>{elseif $GLOBAL.userdata.donate_percent|default:"0" < 2 AND $GLOBAL.userdata.donate_percent|default:"0" > 0}<i class="fa fa-star-o fa-fw"></i>{else}<i class="fa fa-ban fa-fw"></i>{/if}</td> <td>{if $GLOBAL.userdata.donate_percent|default:"0" >= 2}<i class="fa fa-trophy fa-fw"></i>{elseif $GLOBAL.userdata.donate_percent|default:"0" < 2 AND $GLOBAL.userdata.donate_percent|default:"0" > 0}<i class="fa fa-star-o fa-fw"></i>{else}<i class="fa fa-ban fa-fw"></i>{/if}</td>
<td>{$GLOBAL.userdata.username|escape}</td> <td>{$GLOBAL.userdata.username|escape}</td>

View File

@ -21,15 +21,15 @@
<td>{$rank++}</td> <td>{$rank++}</td>
<td>{if $CONTRIBSHARES[shares].donate_percent|default:"0" >= 2}<i class="fa fa-trophy fa-fw"></i>{else if $CONTRIBSHARES[shares].donate_percent|default:"0" < 2 AND $CONTRIBSHARES[shares].donate_percent|default:"0" > 0}<i class="fa fa-star-o fa-fw"></i>{else}<i class="fa fa-ban fa-fw"></i>{/if}</td> <td>{if $CONTRIBSHARES[shares].donate_percent|default:"0" >= 2}<i class="fa fa-trophy fa-fw"></i>{else if $CONTRIBSHARES[shares].donate_percent|default:"0" < 2 AND $CONTRIBSHARES[shares].donate_percent|default:"0" > 0}<i class="fa fa-star-o fa-fw"></i>{else}<i class="fa fa-ban fa-fw"></i>{/if}</td>
<td>{if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if}</td> <td>{if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if}</td>
<td class="text-right">{$CONTRIBSHARES[shares].shares|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$CONTRIBSHARES[shares].shares|number_format}</td>
</tr> </tr>
{/section} {/section}
{if $listed != 1 && $GLOBAL.userdata.username|default:"" && $GLOBAL.userdata.shares.valid|default:"0" > 0} {if $listed != 1 && $GLOBAL.userdata.username|default:"" && $GLOBAL.userdata.shares.valid|default:"0" > 0}
{if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|default:""|lower}{assign var=listed value=1}<tr class="success">{else}<tr>{/if} {if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|lower}{assign var=listed value=1}<tr class="success">{else}<tr>{/if}
<td>n/a</td> <td>n/a</td>
<td>{if $GLOBAL.userdata.donate_percent|default:"0" >= 2}<i class="fa fa-trophy fa-fw"></i>{elseif $GLOBAL.userdata.donate_percent|default:"0" < 2 AND $GLOBAL.userdata.donate_percent|default:"0" > 0}<i class="fa fa-star-o fa-fw"></i>{else}<i class="fa fa-ban fa-fw"></i>{/if}</td> <td>{if $GLOBAL.userdata.donate_percent|default:"0" >= 2}<i class="fa fa-trophy fa-fw"></i>{elseif $GLOBAL.userdata.donate_percent|default:"0" < 2 AND $GLOBAL.userdata.donate_percent|default:"0" > 0}<i class="fa fa-star-o fa-fw"></i>{else}<i class="fa fa-ban fa-fw"></i>{/if}</td>
<td>{$GLOBAL.userdata.username|escape}</td> <td>{$GLOBAL.userdata.username|escape}</td>
<td class="text-right">{$GLOBAL.userdata.shares.valid|number_format:$GLOBAL.config.sharediffprecision}</td> <td class="text-right">{$GLOBAL.userdata.shares.valid|number_format}</td>
</tr> </tr>
{/if} {/if}
</tbody> </tbody>

View File

@ -44,7 +44,7 @@
</tr> </tr>
<tr> <tr>
<th>Est. Shares this Round</th> <th>Est. Shares this Round</th>
<td id="b-target">{$ESTIMATES.shares|number_format:$GLOBAL.config.sharediffprecision} (done: {$ESTIMATES.percent}%)</td> <td id="b-target">{$ESTIMATES.shares|number_format} (done: {$ESTIMATES.percent}%)</td>
</tr> </tr>
{if ! $GLOBAL.website.blockexplorer.disabled} {if ! $GLOBAL.website.blockexplorer.disabled}
<tr> <tr>

View File

@ -38,7 +38,7 @@
<td>Time</td> <td>Time</td>
<td>{$BLOCKDETAILS.time|default:"0"}</td> <td>{$BLOCKDETAILS.time|default:"0"}</td>
<td>Shares</td> <td>Shares</td>
<td>{$BLOCKDETAILS.shares|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td> <td>{$BLOCKDETAILS.shares|number_format:"0"|default:"0"}</td>
<td>Finder</td> <td>Finder</td>
<td>{$BLOCKDETAILS.finder|default:"unknown"}</td> <td>{$BLOCKDETAILS.finder|default:"unknown"}</td>
</tr> </tr>

View File

@ -18,7 +18,7 @@
<td>ID</td> <td>ID</td>
<td>{$BLOCKDETAILS.id|number_format:"0"|default:"0"}</td> <td>{$BLOCKDETAILS.id|number_format:"0"|default:"0"}</td>
<td>PPLNS Shares</td> <td>PPLNS Shares</td>
<td>{$PPLNSSHARES|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td> <td>{$PPLNSSHARES|number_format:"0"|default:"0"}</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td>Height</td> <td>Height</td>
@ -28,7 +28,7 @@
<td>{$BLOCKDETAILS.height|number_format:"0"|default:"0"}</td> <td>{$BLOCKDETAILS.height|number_format:"0"|default:"0"}</td>
{/if} {/if}
<td>Estimated Shares</td> <td>Estimated Shares</td>
<td>{$BLOCKDETAILS.estshares|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td> <td>{$BLOCKDETAILS.estshares|number_format|default:"0"}</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td>Amount</td> <td>Amount</td>
@ -64,7 +64,7 @@
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td>Shares</td> <td>Shares</td>
<td>{$BLOCKDETAILS.shares|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td> <td>{$BLOCKDETAILS.shares|number_format:"0"|default:"0"}</td>
<td>Seconds This Round</td> <td>Seconds This Round</td>
<td>{$BLOCKDETAILS.round_time|number_format:"0"|default:"0"}</td> <td>{$BLOCKDETAILS.round_time|number_format:"0"|default:"0"}</td>
</tr> </tr>

View File

@ -30,9 +30,9 @@
<td>{$BLOCKDETAILS.height|number_format:"0"|default:"0"}</td> <td>{$BLOCKDETAILS.height|number_format:"0"|default:"0"}</td>
{/if} {/if}
<td>PPLNS Shares</td> <td>PPLNS Shares</td>
<td>{$PPLNSSHARES|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td> <td>{$PPLNSSHARES|number_format:"0"|default:"0"}</td>
<td>Estimated Shares</td> <td>Estimated Shares</td>
<td>{$BLOCKDETAILS.estshares|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td> <td>{$BLOCKDETAILS.estshares|number_format|default:"0"}</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td>Amount</td> <td>Amount</td>
@ -61,7 +61,7 @@
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td>Shares</td> <td>Shares</td>
<td>{$BLOCKDETAILS.shares|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td> <td>{$BLOCKDETAILS.shares|number_format:"0"|default:"0"}</td>
<td>Finder</td> <td>Finder</td>
<td>{$BLOCKDETAILS.finder|default:"unknown"}</td> <td>{$BLOCKDETAILS.finder|default:"unknown"}</td>
<td>Seconds This Round</td> <td>Seconds This Round</td>

View File

@ -21,8 +21,8 @@
<tr{if $GLOBAL.userdata.username|default:"" == $PPLNSROUNDSHARES[contrib].username} style="background-color:#99EB99;"{else}{/if}> <tr{if $GLOBAL.userdata.username|default:"" == $PPLNSROUNDSHARES[contrib].username} style="background-color:#99EB99;"{else}{/if}>
<td>{$rank++}</td> <td>{$rank++}</td>
<td>{if $PPLNSROUNDSHARES[contrib].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$PPLNSROUNDSHARES[contrib].username|default:"unknown"|escape}{/if}</td> <td>{if $PPLNSROUNDSHARES[contrib].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$PPLNSROUNDSHARES[contrib].username|default:"unknown"|escape}{/if}</td>
<td>{$PPLNSROUNDSHARES[contrib].pplns_valid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td> <td>{$PPLNSROUNDSHARES[contrib].pplns_valid|number_format}</td>
<td>{$PPLNSROUNDSHARES[contrib].pplns_invalid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td> <td>{$PPLNSROUNDSHARES[contrib].pplns_invalid|number_format}</td>
<td>{if $PPLNSROUNDSHARES[contrib].pplns_invalid > 0 && $PPLNSROUNDSHARES[contrib].pplns_valid > 0}{($PPLNSROUNDSHARES[contrib].pplns_invalid / $PPLNSROUNDSHARES[contrib].pplns_valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if}</td> <td>{if $PPLNSROUNDSHARES[contrib].pplns_invalid > 0 && $PPLNSROUNDSHARES[contrib].pplns_valid > 0}{($PPLNSROUNDSHARES[contrib].pplns_invalid / $PPLNSROUNDSHARES[contrib].pplns_valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if}</td>
</tr> </tr>
{/section} {/section}

View File

@ -23,9 +23,9 @@
{section txs $ROUNDTRANSACTIONS} {section txs $ROUNDTRANSACTIONS}
<tr{if $GLOBAL.userdata.username|default:"" == $ROUNDTRANSACTIONS[txs].username}{assign var=listed value=1} style="background-color:#99EB99;"{else}{/if}> <tr{if $GLOBAL.userdata.username|default:"" == $ROUNDTRANSACTIONS[txs].username}{assign var=listed value=1} style="background-color:#99EB99;"{else}{/if}>
<td>{if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if}</td> <td>{if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if}</td>
<td>{$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td> <td>{$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format|default:0}</td>
<td>{if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|default:"0" > 0 }{(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|number_format:"2"}{else}0.00{/if}</td> <td>{if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|default:"0" > 0 }{(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|number_format:"2"}{else}0.00{/if}</td>
<td>{$PPLNSROUNDSHARES[txs].pplns_valid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td> <td>{$PPLNSROUNDSHARES[txs].pplns_valid|number_format|default:"0"}</td>
<td>{if $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" > 0 }{(( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)|number_format:"2"|default:"0"}{else}0{/if}</td> <td>{if $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" > 0 }{(( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)|number_format:"2"|default:"0"}{else}0{/if}</td>
<td>{if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|default:"0" > 0 && $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" > 0}{math assign="percentage1" equation=(100 / ((( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid) / (( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)))}{else if $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" == 0}{assign var=percentage1 value=0}{else}{assign var=percentage1 value=100}{/if} <td>{if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|default:"0" > 0 && $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" > 0}{math assign="percentage1" equation=(100 / ((( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid) / (( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)))}{else if $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" == 0}{assign var=percentage1 value=0}{else}{assign var=percentage1 value=100}{/if}
<font color="{if ($percentage1 >= 100)}green{else}red{/if}">{$percentage1|number_format:"2"}</font></b></td> <font color="{if ($percentage1 >= 100)}green{else}red{/if}">{$percentage1|number_format:"2"}</font></b></td>

View File

@ -26,12 +26,12 @@
{section txs $ROUNDTRANSACTIONS} {section txs $ROUNDTRANSACTIONS}
<tr{if $GLOBAL.userdata.username|default:"" == $ROUNDTRANSACTIONS[txs].username}{assign var=listed value=1} style="background-color:#99EB99;"{else}{/if}> <tr{if $GLOBAL.userdata.username|default:"" == $ROUNDTRANSACTIONS[txs].username}{assign var=listed value=1} style="background-color:#99EB99;"{else}{/if}>
<td>{if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if}</td> <td>{if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if}</td>
<td>{$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid|number_format:$GLOBAL.config.sharediffprecision}</td> <td>{$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid|number_format}</td>
<td>{$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid|number_format:$GLOBAL.config.sharediffprecision}</td> <td>{$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid|number_format}</td>
<td>{if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid > 0 }{($SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid / $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if}</td> <td>{if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid > 0 }{($SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid / $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if}</td>
<td>{if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid > 0 }{(( 100 / $BLOCKDETAILS.shares) * $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid)|number_format:"2"}{else}0.00{/if}</td> <td>{if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid > 0 }{(( 100 / $BLOCKDETAILS.shares) * $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid)|number_format:"2"}{else}0.00{/if}</td>
<td>{$PPLNSROUNDSHARES[txs].pplns_valid|number_format:$GLOBAL.config.sharediffprecision}</td> <td>{$PPLNSROUNDSHARES[txs].pplns_valid|number_format}</td>
<td>{$PPLNSROUNDSHARES[txs].pplns_invalid|number_format:$GLOBAL.config.sharediffprecision}</td> <td>{$PPLNSROUNDSHARES[txs].pplns_invalid|number_format}</td>
<td>{if $PPLNSROUNDSHARES[txs].pplns_invalid > 0 }{($PPLNSROUNDSHARES[txs].pplns_invalid / $PPLNSROUNDSHARES[txs].pplns_valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if}</td> <td>{if $PPLNSROUNDSHARES[txs].pplns_invalid > 0 }{($PPLNSROUNDSHARES[txs].pplns_invalid / $PPLNSROUNDSHARES[txs].pplns_valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if}</td>
<td>{(( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)|number_format:"2"}</td> <td>{(( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)|number_format:"2"}</td>
<td>{if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid > 0 }{math assign="percentage1" equation=(100 / ((( 100 / $BLOCKDETAILS.shares) * $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid) / (( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)))}{else if $PPLNSROUNDSHARES[txs].pplns_valid == 0}{assign var=percentage1 value=0}{else}{assign var=percentage1 value=100}{/if} <td>{if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid > 0 }{math assign="percentage1" equation=(100 / ((( 100 / $BLOCKDETAILS.shares) * $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid) / (( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)))}{else if $PPLNSROUNDSHARES[txs].pplns_valid == 0}{assign var=percentage1 value=0}{else}{assign var=percentage1 value=100}{/if}

View File

@ -22,8 +22,8 @@
<tr{if $GLOBAL.userdata.username|default:"" == $data.username}{assign var=listed value=1} style="background-color:#99EB99;"{else}{/if}> <tr{if $GLOBAL.userdata.username|default:"" == $data.username}{assign var=listed value=1} style="background-color:#99EB99;"{else}{/if}>
<td>{$rank++}</td> <td>{$rank++}</td>
<td>{if $data.is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$data.username|default:"unknown"|escape}{/if}</td> <td>{if $data.is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$data.username|default:"unknown"|escape}{/if}</td>
<td>{$data.valid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td> <td>{$data.valid|number_format}</td>
<td>{$data.invalid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td> <td>{$data.invalid|number_format}</td>
<td>{if $data.invalid > 0 }{($data.invalid / $data.valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if}</td> <td>{if $data.invalid > 0 }{($data.invalid / $data.valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if}</td>
</tr> </tr>
{/foreach} {/foreach}

View File

@ -20,7 +20,7 @@
<tr{if $GLOBAL.userdata.username|default:"" == $ROUNDTRANSACTIONS[txs].username} style="background-color:#99EB99;"{else}{/if}> <tr{if $GLOBAL.userdata.username|default:"" == $ROUNDTRANSACTIONS[txs].username} style="background-color:#99EB99;"{else}{/if}>
<td>{if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if}</td> <td>{if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if}</td>
<td>{$ROUNDTRANSACTIONS[txs].type|default:""}</td> <td>{$ROUNDTRANSACTIONS[txs].type|default:""}</td>
<td>{$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td> <td>{$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format}</td>
<td>{(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|default:"0"|number_format:"2"}</td> <td>{(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|default:"0"|number_format:"2"}</td>
<td>{$ROUNDTRANSACTIONS[txs].amount|default:"0"|number_format:"8"}</td> <td>{$ROUNDTRANSACTIONS[txs].amount|default:"0"|number_format:"8"}</td>
</tr> </tr>

View File

@ -1,33 +0,0 @@
<?php
function run_103() {
// Ugly but haven't found a better way
global $setting, $config, $coin_address, $user, $mysqli;
// Version information
$db_version_old = '1.0.2'; // What version do we expect
$db_version_new = '1.0.3'; // What is the new version we wish to upgrade to
$db_version_now = $setting->getValue('DB_VERSION'); // Our actual version installed
// Upgrade specific variables
$aSql[] = "ALTER TABLE `blocks` CHANGE `shares` `shares` DOUBLE UNSIGNED DEFAULT NULL;";
$aSql[] = "UPDATE `statistics_shares` SET `valid` = '0' WHERE `valid` IS NULL;";
$aSql[] = "UPDATE `statistics_shares` SET `pplns_valid` = '0' WHERE `pplns_valid` IS NULL;";
$aSql[] = "ALTER TABLE `statistics_shares` CHANGE `valid` `valid` FLOAT UNSIGNED NOT NULL DEFAULT '0', CHANGE `invalid` `invalid` FLOAT UNSIGNED NOT NULL DEFAULT '0', CHANGE `pplns_valid` `pplns_valid` FLOAT UNSIGNED NOT NULL DEFAULT '0', CHANGE `pplns_invalid` `pplns_invalid` FLOAT UNSIGNED NOT NULL DEFAULT '0';";
$aSql[] = "UPDATE " . $setting->getTableName() . " SET value = '" . $db_version_new . "' WHERE name = 'DB_VERSION';";
if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) {
// Run the upgrade
echo '- Starting database migration to version ' . $db_version_new . PHP_EOL;
foreach ($aSql as $sql) {
echo '- Preparing: ' . $sql . PHP_EOL;
$stmt = $mysqli->prepare($sql);
if ($stmt && $stmt->execute()) {
echo '- success' . PHP_EOL;
} else {
echo '- failed: ' . $mysqli->error . PHP_EOL;
exit(1);
}
}
}
}
?>