Compare commits

..

94 Commits

Author SHA1 Message Date
Sebastian Grewe
236cccd5d3
Merge pull request #2738 from MPOS/development
UPDATE : Development to Master
2018-05-24 14:12:01 +02:00
Sebastian Grewe
e5b1ec5d04
Merge pull request #2739 from r4sas/development
fix documentation links
2018-05-24 10:07:21 +02:00
R4SAS
20a9c59111 fix documentation links 2018-05-24 00:51:18 +03:00
Sebastian Grewe
085dfa05f2 [VERSION] 1.1.0 2018-05-23 23:03:23 +02:00
Sebastian Grewe
3f4efc983a [ADDED] DEBUG log if RPC > 0.16 getinfo wrapper fails 2018-05-23 19:56:44 +02:00
Sebastian Grewe
96ab98a6fa [UPDATE] Better getinfo detection 2018-05-18 12:58:36 +02:00
Sebastian Grewe
b9dc229d20
Merge pull request #2729 from r4sas/lowdiff-shares
fix sharerate precision and reduce graphics page size
2018-05-12 23:44:28 +02:00
r4sas
30668ed502 fix sharerate precision and reduce graphics page size 2018-05-12 21:37:13 +00:00
Sebastian Grewe
e79b558163
[UPDATE] Also detect testnet on RPC > 0.16 2018-05-12 23:20:50 +02:00
Sebastian Grewe
d1d4a07609
Merge pull request #2728 from r4sas/lowdiff-shares
Lowdiff shares (2nd update #2718)
2018-05-12 21:46:21 +02:00
Sebastian Grewe
01c75f49ff
[UPDATE][#2713] Adding transaction filter
API now supports filters just as the GUI version, closing #2713 :)
2018-05-12 21:36:43 +02:00
r4sas
e09db5c1e0 update block statistics 2018-05-12 19:36:00 +00:00
Sebastian Grewe
61670a1c44
[UPDATE] Print error if vendor libs are missing 2018-05-12 21:21:44 +02:00
r4sas
15de9e1d4a change to unsigned float 2018-05-12 19:21:21 +00:00
Sebastian Grewe
1f8a33247f
Updated author/project in composer file 2018-05-12 20:53:53 +02:00
r4sas
ce78e8b59d revert changes for mysql ifnull functions 2018-05-12 13:25:13 +00:00
r4sas
b183ff19bd lowdiff updates 2018-05-11 21:41:38 +00:00
Sebastian Grewe
363e2bee21
Merge pull request #2727 from r4sas/lowdiff-shares
implement low-diff shares counting (#2718 #2726)
2018-05-11 14:34:26 +02:00
R4SAS
8cfc43eaca implement low-diff shares counting (#2718 #2726) 2018-05-11 12:25:04 +00:00
Sebastian Grewe
3ddf6cb059
Merge pull request #2717 from r4sas/statistics-patch
don't hardcode wallet name
2018-04-25 13:44:01 +02:00
Sebastian Grewe
8f3dafd5ad
Merge pull request #2720 from r4sas/sql-sharestats
fix "field doesn't have a default values" error
2018-04-25 13:40:45 +02:00
R4SAS
832d67f824 bump DB version, update db upgrade script 2018-04-25 10:10:17 +00:00
R4SAS
b007bfa9a9 add database upgrade script, update version in initial database 2018-04-25 08:07:55 +00:00
R4SAS
cdba6ce722
fix "field doesn't have a default values" error
Otherwise cron will return error: `Failed to update share statistics for %username%: SQL Query failed: 1364`
2018-04-25 05:55:47 +03:00
R4SAS
181a66b709
don't hardcode wallet name 2018-04-21 00:32:35 +03:00
Sebastian Grewe
3b232951be
Merge pull request #2714 from lubuzzo/master
Added support to BTC >= 0.16
2018-04-18 11:44:48 +02:00
Lucas Buzzo
26d291583b First attempt to add support to BTC >= 0.16 2018-04-16 21:16:47 -03:00
Sebastian Grewe
8fa8d6c8de
Merge pull request #2683 from MPOS/development
UPDATE : Development to Master
2018-04-05 10:40:22 +02:00
Sebastian Grewe
92ef32aeab
[UPDATE][#2695] Remove unset class variable 2018-03-18 20:45:25 +01:00
Sebastian Grewe
79c131dad3
[UPDATE] Long needed README updates 2018-03-18 20:43:25 +01:00
Sebastian Grewe
97050ef142
[VERSION] 1.0.9, release prep 2018-03-18 20:37:02 +01:00
Sebastian Grewe
a0f06e71b0
Merge pull request #2700 from bziemek/ticker-apis
More tickers
2018-03-18 20:30:59 +01:00
Sebastian Grewe
27388bed76
Merge pull request #2702 from bziemek/development
Hotfix: missing > in About page link
2018-03-18 20:30:02 +01:00
Brian Ziemek
e0dc0cbc1b
Fix Mercatox ticker API 2018-03-18 14:26:30 -04:00
Brian Ziemek
8a87239adb
Handle redundant slashes in ticker config
I.e. `https://api.example.com//ticker/target` becomes `https://api.example.com/ticker/target`
2018-03-18 13:36:18 -04:00
Brian Ziemek
f2a5716d1b
Hotfix: missing > in About page link 2018-03-18 13:07:03 -04:00
Brian Ziemek
6ff468a152
Add TradeOgre ticker API 2018-03-18 03:40:49 -04:00
Brian Ziemek
77687d9713
Add Mercatox ticker API 2018-03-18 02:50:23 -04:00
Brian Ziemek
6cc9cba0f5
Add SouthXChange ticker API 2018-03-18 02:49:59 -04:00
Brian Ziemek
79d9d0871a
Add Binance ticker API 2018-03-18 02:49:27 -04:00
Brian Ziemek
8c683b756a
Add Yobit ticker API 2018-03-18 02:49:01 -04:00
Brian Ziemek
0dbb4d8bc9
Add Crypto-Bridge ticker API 2018-03-18 02:48:18 -04:00
Brian Ziemek
8f33ceb3a4
Correct "coinchoose" spelling in ticker code 2018-03-18 02:47:37 -04:00
Brian Ziemek
028889584c
Remove Cryptsy ticker support
The '90s are dead
2018-03-18 02:46:48 -04:00
Brian Ziemek
53c311563b
Update BTC-e ticker URL 2018-03-18 02:45:24 -04:00
Brian Ziemek
c2f3171d1a
Update BTC-e API domain
btc-e.com was seized by the US DOJ; use btc-e.nz instead
2018-03-18 02:44:54 -04:00
Brian Ziemek
de6fbf88db
Refactor getPrice() in tools.class.php
$this->config['currency'] as $strBase
$this->config['price']['currency'] as $strQuote
2018-03-18 02:41:56 -04:00
Sebastian Grewe
97b3cc3b50
Merge pull request #2692 from AmazingDreams/development
Cleaner recaptcha v2
2018-03-07 12:58:34 +01:00
Dennis Ruhe
4180bf178b Deleted composer.lock 2018-03-07 12:48:56 +01:00
Dennis Ruhe
467f8e5335 Merge branch 'development' of https://github.com/MPOS/php-mpos into development 2018-03-07 12:44:08 +01:00
Dennis Ruhe
64924ec102 Added composer.phar 2018-03-07 12:42:10 +01:00
Dennis Ruhe
31965de2b2 Implemented recaptcha v2 2018-03-07 12:41:40 +01:00
Sebastian Grewe
145304bb11
[UPDATE] Wrong param 2018-03-06 08:25:18 +01:00
Sebastian Grewe
e9c9c08787
[UPDATE] Trying to fix Travis failures 2018-03-06 08:21:43 +01:00
Sebastian Grewe
3ff7ee98b3
Merge pull request #2689 from TopoX84/patch-5
Update peers.tpl
2018-03-05 15:29:34 +01:00
TopoX84
1448b93e1e
Update peers.tpl
by adding ```<div class="table-responsive">``` and some ```</div>``` at the end fixes a display issue on the mobile version while looking at the pees
2018-03-05 08:25:42 -06:00
Sebastian Grewe
daf709147d
Merge pull request #2688 from TopoX84/patch-4
Update status.tpl
2018-03-05 15:21:03 +01:00
TopoX84
2566b674d8
Update status.tpl
by adding <div class="table-responsive"> it will fix a display issue on the mobile version while looking at wallet status
2018-03-05 08:17:39 -06:00
Sebastian Grewe
40ba37490e
Merge pull request #2687 from desaerun/patch-4
add start to getusertransactions api page
2018-03-05 11:29:02 +01:00
desaerun
fbdcd9c4e7
add "start" to getusertransactions api 2018-03-05 03:24:28 -07:00
Sebastian Grewe
cfcd1d1081
Merge pull request #2674 from smiba/patch-1
Minor changes to the block overview template
2018-03-03 16:31:14 +01:00
Sebastian Grewe
c336ef7cae
Merge pull request #2682 from MPOS/revert-2681-patch-3
Revert "add 'start' parameter to getusertransactions api page"
2018-03-03 16:27:25 +01:00
Sebastian Grewe
6c0d9a1e9e
Merge pull request #2676 from smiba/development-patch-1
Expend CSRF token expiry & Est. Diff for constantly changing coins
2018-02-21 20:38:58 +01:00
smiba
f0f4e005a0 Minor spelling correction 2018-02-21 14:32:06 +01:00
smiba
85ef9d521c Expend CSRF token expiry time
Change it to 15 minutes, 2 minutes is not enough.
2018-02-21 14:31:58 +01:00
smiba
1c53b2efb7 For coins with constant difficulty change
Do not show in x amount of blocks, if the coin’s difficulty changes on
every block
2018-02-21 14:27:49 +01:00
Bart S
ef8f66468c
Add orange colour to blocks found
Together with #83efd60
2018-02-21 13:32:47 +01:00
Bart S
83efd6026c
Minor changes to the block overview template
Often my pool is at 101% because thats just luck, however bright red makes users often think something is wrong

I'd say up to 115% make it orange, its less worrying.
2018-02-21 13:22:25 +01:00
Sebastian Grewe
ae337b418c
Merge pull request #2673 from smiba/patch-1
Fix: Calculate the efficiency correctly in API
2018-02-21 10:27:18 +01:00
Bart S
a598e6ecd6
Don't divide by zero
Small change I overlooked
2018-02-21 10:08:21 +01:00
Bart S
963a8f7d27
Fix: Calculate the efficiency correctly in API 2018-02-20 22:57:16 +01:00
Sebastian Grewe
9e6f02b648
Merge pull request #2669 from mecab/ignore-old-cronjob-option
Add -t option to ignore too old cronjob active flag
2018-02-05 11:26:40 +01:00
mecab
495f48d4e5 Add -t option for cronjobs to ignore too old active jobs. 2018-02-04 10:20:05 -06:00
Sebastian Grewe
3cb167a70e
Merge pull request #2666 from mecab/fix-contact-form
Fix errors while sending mail is not displayed in contact form.
2018-02-01 09:51:38 +01:00
Sebastian Grewe
1d32e1e6af
Merge pull request #2667 from mecab/remove-validation
Remove unnessesary validation in sending contact form
2018-02-01 09:51:14 +01:00
Sebastian Grewe
6dab6be177
Merge pull request #2665 from mecab/fix-sql
Fix SQL in cleaning up old notifications
2018-02-01 09:50:17 +01:00
mecab
1b871e16ce Remove unnessesary validation in sending contact form
Non-alphanumeric character causes some problems if used in the mail header (i.e., sender name or subject), but the filled info is just used in the mail body so removing the validation is safe at this time.
2018-01-31 11:36:45 -06:00
mecab
2fec35cf70 Fix errors while sending mail is not displayed in contact form. 2018-01-31 11:33:59 -06:00
mecab
be1b57a838 Fix SQL in cleaning up old notifications
Subtracting numbers from datetime causes wrong value, or raises error depending on MySQL version/configurations
2018-01-31 11:32:58 -06:00
Sebastian Grewe
2dfe1751f3
Merge pull request #2649 from tperalta82/master
Fix INSERTS with Selects inside
2017-12-29 07:45:49 +01:00
Tiago Peralta
0e3cbe2876 Fix INSERTS with Selects inside 2017-12-29 03:45:42 +00:00
Sebastian Grewe
9628c34e82
Merge pull request #2646 from tperalta82/master
Possibly fixed all the MySQL errors from my previous pull request
2017-12-13 14:56:51 +01:00
Tiago Peralta
d259610ac5 Properly fixed possible MySQL Errors, will test in prod for 1 day
Had to rewrite all the mysqli->error/errno to mysqli->lastused because of the read/write splitting, shoud be working now
Reverted notifications code back to previous version
Added  the lastused property to mysqlms, so that when calling the error/errno we know what was the lsat connection used, same for insert_id
2017-12-11 03:30:56 +00:00
Tiago Peralta
12cee6e25a There was a bug here, whereas the query is perfectly fine, but instead of returning false it was returning the this->sqlError.... which by then was returning the return false, the problem was the log in the cron that was misleading, took 2 days figuring this one out 2017-12-11 02:05:26 +00:00
Tiago Peralta
c27db96f05 removed trash 2017-12-10 20:48:14 +00:00
Tiago Peralta
c5ca7a83b2 Modified slave validation
.gitignore composer.lock, and remove composer.lock from repo
2017-12-10 20:46:30 +00:00
Tiago Peralta
142261d4e0 Same as previous... damn hangover 2017-12-10 20:34:53 +00:00
Tiago Peralta
7929ac79ab Same as previous 2017-12-10 20:34:15 +00:00
Tiago Peralta
f290aeee63 Small bugfix to not validate the Slave when it's not enabled 2017-12-10 20:22:58 +00:00
Sebastian Grewe
777f167a62
Merge pull request #2642 from tperalta82/master
Implement Read/Write Split directly on PHP / Fixed statistics->graphs page
2017-12-10 11:32:35 +01:00
Tiago Peralta
4233563573 Removed var_dump from debugging.... 2017-12-08 23:11:19 +00:00
Tiago Peralta
52c3e2ff93 Implemented Read/Write Mysql Split (Master for writes, Slave for reads) 2017-12-08 22:53:15 +00:00
Tiago Peralta
064ab5ac83 No need for composer.lock to be versioned 2017-12-08 15:53:56 +00:00
Tiago Peralta
b5cfd0e90b Fixed statistics graphs 2017-12-03 03:10:35 +00:00
70 changed files with 620 additions and 1951 deletions

5
.gitignore vendored
View File

@ -40,4 +40,7 @@
tests/_output/*
# NetBeans Project Directory
/nbproject/*
/nbproject/*
# No need for composer.lock
/composer.lock

View File

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

View File

@ -1,11 +1,10 @@
[![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
Description
===========
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!
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!
Donations
=========
@ -20,24 +19,6 @@ 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.
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
==================
@ -140,39 +121,27 @@ 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.
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
============
You can contribute to this project in different ways:
* Report outstanding issues and bugs by creating an [Issue][1]
* 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!
* Fork the project, create a branch and file a pull request **against development** to improve the code itself
Contact
=======
You can find the team on Freenode.net, #MPOS.
This product is not actively developed anymore. For setup and installation support, please find help in other channels.
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
============
Author and Project Owner: [TheSerapher](https://github.com/TheSerapher) aka Sebastian Grewe
Developers:
Past developers that helped on MPOS in the early days:
* [nrpatten](https://github.com/nrpatten)
* [Aim](https://github.com/fspijkerman)

View File

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

1358
composer.lock generated

File diff suppressed because it is too large Load Diff

BIN
composer.phar Executable file

Binary file not shown.

View File

@ -47,16 +47,25 @@ fi
ME=$( basename $0 )
# Overwrite some settings via command line arguments
while getopts "hfvp:d:" opt; do
while getopts "hfvt:p:d:" opt; do
case "$opt" in
h|\?)
echo "Usage: $0 [-v] [-p PHP_BINARY] [-d SUBFOLDER]";
echo "Usage: $0 [-v] [-f] [-t TIME_IN_SEC] [-p PHP_BINARY] [-d SUBFOLDER]";
exit 0
;;
v) VERBOSE=1 ;;
f) PHP_OPTS="$PHP_OPTS -f";;
p) PHP_BIN=$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
exit 1
@ -102,6 +111,16 @@ fi
# Our PID of this shell
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
echo "Cron seems to be running already"
RUNPID=$( cat $PIDFILE )

View File

@ -46,17 +46,25 @@ fi
# My own name
ME=$( basename $0 )
# Overwrite some settings via command line arguments
while getopts "hfvp:d:" opt; do
while getopts "hfvt:p:d:" opt; do
case "$opt" in
h|\?)
echo "Usage: $0 [-v] [-p PHP_BINARY] [-d SUBFOLDER]";
echo "Usage: $0 [-v] [-f] [-t TIME_IN_SEC] [-p PHP_BINARY] [-d SUBFOLDER]";
exit 0
;;
v) VERBOSE=1 ;;
f) PHP_OPTS="$PHP_OPTS -f";;
p) PHP_BIN=$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
exit 1
@ -102,6 +110,16 @@ fi
# Our PID of this shell
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
echo "Cron seems to be running already"
RUNPID=$( cat $PIDFILE )

View File

@ -47,16 +47,25 @@ fi
ME=$( basename $0 )
# Overwrite some settings via command line arguments
while getopts "hfvp:d:" opt; do
while getopts "hfvt:p:d:" opt; do
case "$opt" in
h|\?)
echo "Usage: $0 [-v] [-p PHP_BINARY] [-d SUBFOLDER]";
echo "Usage: $0 [-v] [-f] [-t TIME_IN_SEC] [-p PHP_BINARY] [-d SUBFOLDER]";
exit 0
;;
v) VERBOSE=1 ;;
f) PHP_OPTS="$PHP_OPTS -f";;
p) PHP_BIN=$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
exit 1
@ -102,6 +111,16 @@ fi
# Our PID of this shell
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
echo "Cron seems to be running already"
RUNPID=$( cat $PIDFILE )

View File

@ -51,19 +51,39 @@ $cron_name = basename($_SERVER['PHP_SELF'], '.php');
require_once(BASEPATH . '../include/bootstrap.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
array_shift($argv);
foreach ($argv as $option) {
foreach ($argv as $index => $option) {
switch ($option) {
case '-f':
$monitoring->setStatus($cron_name . "_disabled", "yesno", 0);
$monitoring->setStatus($cron_name . "_active", "yesno", 0);
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);
// 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));
// Clenaup shares archive
// Cleanup shares archive
$start = microtime(true);
$status = 'OK';
$message = '';
@ -73,7 +73,7 @@ if ($affected === false) {
}
$log->logInfo(sprintf($strLogMask, 'purgeArchive', $affected, number_format(microtime(true) - $start, 3), $status, $message));
// Clenaup shares archive
// Cleanup shares archive
$start = microtime(true);
$status = 'OK';
$message = '';

View File

@ -2,6 +2,12 @@
(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;
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
require_once(INCLUDE_DIR . '/lib/KLogger.php');
require_once(CLASS_DIR . '/logger.class.php');
@ -9,6 +15,7 @@ require_once(CLASS_DIR . '/debug.class.php');
if ($config['mysql_filter']) {
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 . '/config/memcache_keys.inc.php');
require_once(INCLUDE_DIR . '/config/error_codes.inc.php');

View File

@ -32,7 +32,6 @@ 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_start = @session_start();
if (!$session_start) {
$log->log("info", "Forcing session id regeneration, session failed to start [hijack attempt?]");
session_destroy();
session_regenerate_id(true);
session_start();

View File

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

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

@ -284,13 +284,15 @@ class BitcoinClient extends jsonRPCClient {
* The check is done by calling the server's getinfo() method and checking
* 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
* @access public
* @throws none
*/
public function can_connect() {
try {
$r = $this->getinfo();
$r = $this->getmininginfo();
} catch (Exception $e) {
return $e->getMessage();
}

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

@ -24,13 +24,29 @@ class BitcoinWrapper extends BitcoinClient {
public function getinfo() {
$this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
return $this->memcache->setCache(__FUNCTION__, parent::getinfo(), 30);
try {
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() {
$this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
return $this->memcache->setCache(__FUNCTION__, parent::getmininginfo(), 30);
}
public function getblockcount() {
$this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data;

View File

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

View File

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

View File

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

View File

@ -14,18 +14,10 @@ class Mail extends Base {
**/
public function contactform($senderName, $senderEmail, $senderSubject, $senderMessage) {
$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)) {
$this->setErrorMessage($this->getErrorMsg('E0023'));
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)) {
$this->setErrorMessage($this->getErrorMsg('E0024'));
return false;

View File

@ -60,6 +60,16 @@ class Monitoring extends Base {
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
* @param name string Setting name

View File

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

View File

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

View File

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

View File

@ -44,9 +44,13 @@ class Tools extends Base {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
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_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_SSL_VERIFYPEER, FALSE);
@ -72,11 +76,9 @@ class Tools extends Base {
**/
private function getApiType($url) {
if (preg_match('/coinchoose.com/', $url)) {
return 'coinchose';
} else if (preg_match('/btc-e.com/', $url)) {
return 'coinchoose';
} else if (preg_match('/btc-e.nz/', $url)) {
return 'btce';
} else if (preg_match('/cryptsy.com/', $url)) {
return 'cryptsy';
} else if (preg_match('/cryptopia.co.nz/', $url)) {
return 'cryptopia';
} else if (preg_match('/cryptorush.in/', $url)) {
@ -87,6 +89,18 @@ class Tools extends Base {
return 'c-cex';
} else if (preg_match('/bittrex.com/', $url)) {
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");
return false;
@ -97,30 +111,28 @@ class Tools extends Base {
**/
public function getPrice() {
$aData = $this->getApi($this->config['price']['url'], $this->config['price']['target']);
$strCurrency = $this->config['currency'];
$strBase = $this->config['currency'];
$strQuote = $this->config['price']['currency'];
// Check the API type for configured URL
if (!$strApiType = $this->getApiType($this->config['price']['url']))
return false;
// if api data is valid, extract price depending on API type
if (is_array($aData)) {
switch ($strApiType) {
case 'coinchose':
case 'coinchoose':
foreach ($aData as $aItem) {
if($strCurrency == $aItem[0])
if($strBase == $aItem[0])
return $aItem['price'];
}
break;
case 'btce':
return $aData['ticker']['last'];
break;
case 'cryptsy':
return @$aData['return']['markets'][$strCurrency]['lasttradeprice'];
break;
case 'cryptopia':
return @$aData['Data']['LastPrice'];
break;
case 'cryptorush':
return @$aData["$strCurrency/" . $this->config['price']['currency']]['last_trade'];
return @$aData["{$strBase}/{$strQuote}"]['last_trade'];
break;
case 'mintpal':
return @$aData['0']['last_price'];
@ -131,6 +143,26 @@ class Tools extends Base {
case 'bittrex':
return @$aData['result']['Last'];
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 {
$this->setErrorMessage("Got an invalid response from ticker API");

View File

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

View File

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

View File

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

View File

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

View File

@ -3,13 +3,14 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
// Instantiate class, we are using mysqlng
if ($config['mysql_filter']) {
$mysqli = new mysqli_strict($config['db']['host'], $config['db']['user'], $config['db']['pass'], $config['db']['name'], $config['db']['port']);
$mysqli = new mysqlims($config['db'],$config['db-ro'], true);
} else {
$mysqli = new mysqli($config['db']['host'], $config['db']['user'], $config['db']['pass'], $config['db']['name'], $config['db']['port']);
$mysqli = new mysqlims($config['db'],$config['db-ro'], false);
}
// 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) {
// Check if read-only and quit if it is on, disregard if slave is enabled
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');
}

View File

@ -1,274 +0,0 @@
<?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
$aShares = $statistics->getRoundShares();
$aShares['valid'] > 0 ? $dEfficiency = round((100 - (100 / $aShares['valid'] * $aShares['invalid'])), 2) : $dEfficiency = 0;
$aShares['invalid'] > 0 ? $dEfficiency = round((1 - ($aShares['invalid'] / ($aShares['valid'] + $aShares['invalid']))) * 100, 2) : $dEfficiency = 100;
// Fetch RPC data
if ($bitcoin->can_connect() === true){

View File

@ -8,13 +8,25 @@ $api->isActive();
$user_id = $api->checkAccess($user->checkApiKey($_REQUEST['api_key']), @$_REQUEST['id']);
// Fetch transactions
if (isset($_REQUEST['start'])) {
$start = $_REQUEST['start'];
} else {
// start at the beginning
$start = 0;
}
if (isset($_REQUEST['limit']) && $_REQUEST['limit'] <= 100) {
$limit = $_REQUEST['limit'];
} else {
// Force limit
$limit = 100;
}
$data['transactions'] = $transaction->getTransactions(0, NULL, $limit, $user_id);
if (isset($_REQUEST['filter']) && is_array($_REQUEST['filter'])) {
$filter = $_REQUEST['filter'];
} else {
$filter = NULL;
}
$data['transactions'] = $transaction->getTransactions($start, $filter, $limit, $user_id);
// Fetch summary if enabled
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'])) {
$_SESSION['POPUP'][] = array('CONTENT' => 'Thanks for sending your message! We will get back to you shortly');
} else {
$_SESSION['POPUP'][] = array('CONTENT' => 'There was a problem sending your message. Please try again. ' . $user->getError(), 'TYPE' => 'alert alert-danger');
$_SESSION['POPUP'][] = array('CONTENT' => 'There was a problem sending your message. Check following error and please try again: ' . $mail->getError(), 'TYPE' => 'alert alert-danger');
}
}
}

View File

@ -1,20 +1,25 @@
<?php
$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
if ($setting->getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_logins')) {
require_once(INCLUDE_DIR . '/lib/recaptchalib.php');
if ($recaptcha_enabled) {
if (!empty($_POST['username']) && !empty($_POST['password'])) {
// Load re-captcha specific data
$rsp = recaptcha_check_answer (
$setting->getValue('recaptcha_private_key'),
$_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));
$recaptcha_response = (isset($_POST["g-recaptcha-response"]) ? $_POST["g-recaptcha-response"] : null);
$rsp = $recaptcha->verify($recaptcha_response, $_SERVER["REMOTE_ADDRESS"]);
}
}
@ -23,7 +28,7 @@ if (!empty($_POST['username']) && !empty($_POST['password'])) {
$_SESSION['POPUP'][] = array('CONTENT' => 'You are not allowed to login during maintenace.', 'TYPE' => 'alert alert-info');
} else {
// Check if recaptcha is enabled, process form data if valid
if (!$setting->getValue('recaptcha_enabled') || !$setting->getValue('recaptcha_enabled_logins') || ($setting->getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_logins') && $rsp->is_valid)) {
if (($recaptcha_enabled && $rsp->isSuccess()) || !$recaptcha_enabled) {
if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
// check if login is correct
if ($user->checkLogin(@$_POST['username'], @$_POST['password']) ) {

View File

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

View File

@ -1,19 +1,24 @@
<?php
$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
if ($setting->getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_registrations')) {
require_once(INCLUDE_DIR . '/lib/recaptchalib.php');
if ($recaptcha_enabled) {
$recaptcha_secret = $setting->getValue('recaptcha_private_key');
$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
$rsp = recaptcha_check_answer (
$setting->getValue('recaptcha_private_key'),
$_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));
if (!$rsp->is_valid) $_SESSION['POPUP'][] = array('CONTENT' => 'Invalid Captcha, please try again.', 'TYPE' => 'alert alert-danger');
$recaptcha = ($rsp->is_valid) ? 1 : 0;
$recaptcha_response = (isset($_POST["g-recaptcha-response"]) ? $_POST["g-recaptcha-response"] : null);
$rsp = $recaptcha->verify($recaptcha_response, $_SERVER["REMOTE_ADDRESS"]);
if (!$rsp->isSuccess()) $_SESSION['POPUP'][] = array('CONTENT' => 'Invalid Captcha, please try again.', 'TYPE' => 'alert alert-danger');
}
if ($setting->getValue('disable_invitations') && $setting->getValue('lock_registration')) {
@ -23,10 +28,10 @@ if ($setting->getValue('disable_invitations') && $setting->getValue('lock_regist
} else {
// Check if csrf is enabled and fail if token is invalid
if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
if ($setting->getValue('recaptcha_enabled') != 1 || $setting->getValue('recaptcha_enabled_registrations') != 1 || $rsp->is_valid) {
if (($recaptcha_enabled && $rsp->isSuccess()) || !$recaptcha_enabled) {
// Check if recaptcha is enabled, process form data if valid or disabled
isset($_POST['token']) ? $token = $_POST['token'] : $token = '';
isset($_POST['coinaddress']) ? $validcoinaddress = $_POST['coinaddress'] : $validcoinaddress = NULL;
isset($_POST['coinaddress']) ? $validcoinaddress = $_POST['coinaddress'] : $validcoinaddress = NULL;
if ($config['check_valid_coinaddress'] AND empty($validcoinaddress)) {
$_SESSION['POPUP'][] = array('CONTENT' => 'Please enter a valid Wallet Address', 'TYPE' => 'alert alert-danger');
} else {

View File

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

View File

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

View File

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

View File

@ -48,7 +48,7 @@
</ul>
</div>
<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>

View File

@ -1,31 +1,35 @@
<div class="row">
<div class="col-lg-12">
<div class="panel panel-info">
<div class="panel-heading">
<i class="fa fa-connectdevelop fa-fw"></i> Peer Information
</div>
<div class="panel-body no-padding">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Host</th>
<th>Protocol</th>
<th>Identity</th>
<th>Connected</th>
<th>Traffic</th>
</tr>
</thead>
<tbody>
{foreach key=KEY item=ARRAY from=$PEERINFO}
<tr>
<td>{$ARRAY['addr']}</td>
<td>{$ARRAY['version']}</td>
<td>{$ARRAY['subver']|replace:'/':''}</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>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-info">
<div class="panel-heading">
<i class="fa fa-connectdevelop fa-fw"></i> Peer Information
</div>
<div class="panel-body no-padding">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Host</th>
<th>Protocol</th>
<th>Identity</th>
<th>Connected</th>
<th>Traffic</th>
</tr>
</thead>
<tbody>
{foreach key=KEY item=ARRAY from=$PEERINFO}
<tr>
<td>{$ARRAY['addr']}</td>
<td>{$ARRAY['version']}</td>
<td>{$ARRAY['subver']|replace:'/':''}</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>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,32 +1,35 @@
<div class="col-lg-8">
<div class="panel panel-info">
<div class="panel-heading">
<i class="fa fa-info fa-fw"></i> Wallet Status
</div>
<div class="panel-body no-padding">
<table class="table table-striped table-bordered table-hover">
<thead>
<th>Version</th>
<th>Protocol Version</th>
<th>Wallet Version</th>
<th>Peers</th>
<th>Status</th>
<th>Blocks</th>
<th>Accounts</th>
</thead>
<tbody>
<tr>
<td>{$COININFO.version|default:""}</td>
<td>{$COININFO.protocolversion|default:""}</td>
<td>{$COININFO.walletversion|default:""}</td>
<td>{$COININFO.connections|default:""}</td>
<td><font color="{if $COININFO.errors}red{else}green{/if}">{$COININFO.errors|default:"OK"}</font></td>
<td>{$COININFO.blocks|default:"0"}</td>
<td>{$ADDRESSCOUNT}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-lg-8">
<div class="panel panel-info">
<div class="panel-heading">
<i class="fa fa-info fa-fw"></i> Wallet Status
</div>
<div class="panel-body no-padding">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Version</th>
<th>Protocol Version</th>
<th>Wallet Version</th>
<th>Peers</th>
<th>Status</th>
<th>Blocks</th>
<th>Accounts</th>
</tr>
</thead>
<tbody>
<tr>
<td>{$COININFO.version|default:""}</td>
<td>{$COININFO.protocolversion|default:""}</td>
<td>{$COININFO.walletversion|default:""}</td>
<td>{$COININFO.connections|default:""}</td>
<td><font color="{if $COININFO.errors}red{else}green{/if}">{$COININFO.errors|default:"OK"}</font></td>
<td>{$COININFO.blocks|default:"0"}</td>
<td>{$ADDRESSCOUNT}</td>
</tr>
</tbody>
</table>
</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].difficulty|number_format:"4"}</td>
<td class="text-right">{$BLOCKSFOUND[block].amount|number_format:"2"}</td>
<td class="text-right">{$BLOCKSFOUND[block].estshares|number_format}</td>
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format}</td>
<td class="text-right">{$BLOCKSFOUND[block].estshares|number_format:$GLOBAL.config.sharediffprecision}</td>
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format:$GLOBAL.config.sharediffprecision}</td>
<td class="text-right">
{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>
@ -46,4 +46,4 @@
{/if}
</div>
</div>
{/if}
{/if}

View File

@ -43,7 +43,7 @@ $(document).ready(function(){
// 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 storedPersonalSharerate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.userdata.sharerate|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 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 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.push(parseFloat(data.getdashboarddata.data.personal.hashrate).toFixed(2))
storedPersonalSharerate.shift();
storedPersonalSharerate.push(parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed(2))
storedPersonalSharerate.push(parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed({/literal}{$GLOBAL.config.sharediffprecision}{literal}))
storedPoolHashrate.shift();
storedPoolHashrate.push(parseFloat(data.getdashboarddata.data.pool.hashrate).toFixed(2))
storedNetHashrate.shift();
@ -122,7 +122,7 @@ $(document).ready(function(){
} else {
$('#b-nethashrate').html('n/a');
}
$('#b-sharerate').html((parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed(2)));
$('#b-sharerate').html((parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed({/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}));
if ( data.getdashboarddata.data.personal.shares.valid > 0 ) {

View File

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

View File

@ -43,7 +43,7 @@
<div class="circle-tile-description text-faded">
<p class="h5 up-more">My Sharerate</p>
<div class="circle-tile-number text-faded up">
<span class="overview" id="b-sharerate">{$GLOBAL.userdata.sharerate|number_format:"2"}</span>
<span class="overview" id="b-sharerate">{$GLOBAL.userdata.sharerate|number_format:$GLOBAL.config.sharediffprecision}</span>
<span class="overview-mhs"> S/s</span>
<br>
<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>
</div>
<div class="circle-tile-number text-faded">
<p class="h6">Est Next Difficulty{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}</p>
<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>
</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>
</div>
<div class="circle-tile-number text-faded">
<p class="h6">Est Next Difficulty{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}</p>
<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>
</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>
</div>
<div class="circle-tile-number text-faded">
<p class="h6">Est Next Difficulty{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}</p>
<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>
</div>
</div>
</div>

View File

@ -17,7 +17,14 @@
</div>
</div>
</div>
<center>{nocache}{$RECAPTCHA|default:"" nofilter}{/nocache}</center>
<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">
<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>

View File

@ -52,7 +52,7 @@
<font size="1">Four digit number. <b>Remember this pin!</b></font>
<div class="input-group input-group-sm">
<span class="input-group-addon"><i class="fa fa-shield fa-fw"></i></span>
<input type="password" class="form-control" name="pin" placeholder="PIN" value="" size="4" maxlength="4" required>
<input type="password" class="form-control" name="pin" placeholder="PIN" value="" size="4" maxlength="4" required>
</div>
<div class="input-group input-group-sm">
<label>
@ -60,7 +60,14 @@
</label>
</div>
</div>
<center>{nocache}{$RECAPTCHA|default:"" nofilter}{/nocache}</center>
<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 class="panel-footer">
<input type="submit" value="Register" class="btn btn-success btn-sm">

View File

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

View File

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

View File

@ -24,7 +24,7 @@
{/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>{$BLOCKSFOUND[block].time|date_format:$GLOBAL.config.date}</td>
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format}</td>
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format:$GLOBAL.config.sharediffprecision}</td>
</tr>
{/section}
</tbody>

View File

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

View File

@ -35,7 +35,7 @@
{/section}
{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}
{if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|lower}{assign var=listed value=1}<tr class="success">{else}<tr>{/if}
{if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|default:""|lower}{assign var=listed value=1}<tr class="success">{else}<tr>{/if}
<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>{$GLOBAL.userdata.username|escape}</td>

View File

@ -21,15 +21,15 @@
<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].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}</td>
<td class="text-right">{$CONTRIBSHARES[shares].shares|number_format:$GLOBAL.config.sharediffprecision}</td>
</tr>
{/section}
{if $listed != 1 && $GLOBAL.userdata.username|default:"" && $GLOBAL.userdata.shares.valid|default:"0" > 0}
{if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|lower}{assign var=listed value=1}<tr class="success">{else}<tr>{/if}
{if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|default:""|lower}{assign var=listed value=1}<tr class="success">{else}<tr>{/if}
<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>{$GLOBAL.userdata.username|escape}</td>
<td class="text-right">{$GLOBAL.userdata.shares.valid|number_format}</td>
<td class="text-right">{$GLOBAL.userdata.shares.valid|number_format:$GLOBAL.config.sharediffprecision}</td>
</tr>
{/if}
</tbody>

View File

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

View File

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

View File

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

View File

@ -30,9 +30,9 @@
<td>{$BLOCKDETAILS.height|number_format:"0"|default:"0"}</td>
{/if}
<td>PPLNS Shares</td>
<td>{$PPLNSSHARES|number_format:"0"|default:"0"}</td>
<td>{$PPLNSSHARES|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td>
<td>Estimated Shares</td>
<td>{$BLOCKDETAILS.estshares|number_format|default:"0"}</td>
<td>{$BLOCKDETAILS.estshares|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td>
</tr>
<tr class="odd">
<td>Amount</td>
@ -61,7 +61,7 @@
</tr>
<tr class="odd">
<td>Shares</td>
<td>{$BLOCKDETAILS.shares|number_format:"0"|default:"0"}</td>
<td>{$BLOCKDETAILS.shares|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td>
<td>Finder</td>
<td>{$BLOCKDETAILS.finder|default:"unknown"}</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}>
<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>{$PPLNSROUNDSHARES[contrib].pplns_valid|number_format}</td>
<td>{$PPLNSROUNDSHARES[contrib].pplns_invalid|number_format}</td>
<td>{$PPLNSROUNDSHARES[contrib].pplns_valid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td>
<td>{$PPLNSROUNDSHARES[contrib].pplns_invalid|number_format:$GLOBAL.config.sharediffprecision|default:0}</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>
{/section}

View File

@ -23,9 +23,9 @@
{section txs $ROUNDTRANSACTIONS}
<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>{$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format|default:0}</td>
<td>{$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|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>{$PPLNSROUNDSHARES[txs].pplns_valid|number_format|default:"0"}</td>
<td>{$PPLNSROUNDSHARES[txs].pplns_valid|number_format:$GLOBAL.config.sharediffprecision|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 $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>

View File

@ -26,12 +26,12 @@
{section txs $ROUNDTRANSACTIONS}
<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>{$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid|number_format}</td>
<td>{$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid|number_format}</td>
<td>{$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid|number_format:$GLOBAL.config.sharediffprecision}</td>
<td>{$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid|number_format:$GLOBAL.config.sharediffprecision}</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>{$PPLNSROUNDSHARES[txs].pplns_valid|number_format}</td>
<td>{$PPLNSROUNDSHARES[txs].pplns_invalid|number_format}</td>
<td>{$PPLNSROUNDSHARES[txs].pplns_valid|number_format:$GLOBAL.config.sharediffprecision}</td>
<td>{$PPLNSROUNDSHARES[txs].pplns_invalid|number_format:$GLOBAL.config.sharediffprecision}</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>{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}>
<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>{$data.valid|number_format}</td>
<td>{$data.invalid|number_format}</td>
<td>{$data.valid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td>
<td>{$data.invalid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td>
<td>{if $data.invalid > 0 }{($data.invalid / $data.valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if}</td>
</tr>
{/foreach}

View File

@ -20,7 +20,7 @@
<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>{$ROUNDTRANSACTIONS[txs].type|default:""}</td>
<td>{$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format}</td>
<td>{$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|default:0}</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>
</tr>

View File

@ -0,0 +1,33 @@
<?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);
}
}
}
}
?>