Compare commits

...

285 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
1b217711a4
Revert "add 'start' parameter to getusertransactions api page" 2018-03-03 16:27:10 +01:00
Sebastian Grewe
64c5c99cfe
Merge pull request #2681 from desaerun/patch-3
add 'start' parameter to getusertransactions api page
2018-03-03 16:27:04 +01:00
desaerun
653729e6dc
add 'start' parameter to getusertransactions api page
sets db start row
2018-02-27 23:12:45 -07: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
Sebastian Grewe
02581f1ea3
Merge pull request #2632 from MPOS/development
UPDATE : Development to Master
2017-11-02 09:49:15 +00:00
Sebastian Grewe
eedbaba316
[VERSION] 1.0.8 release 2017-11-02 10:38:51 +01:00
Sebastian Grewe
810bd4dc0b
Merge pull request #2629 from sunk818/patch-2
Update default.tpl
2017-11-02 09:22:54 +00:00
Sebastian Grewe
8d8ba4fcbf
Merge pull request #2630 from blondak/development
Development
2017-10-30 07:09:52 +00:00
sunk818
3f52e01c9b
Update default.tpl
Formatting fixes. Linked github URL for mpos.
2017-10-27 14:20:41 -07:00
Sebastian Grewe
043bde2a4d Merge pull request #2624 from Caberhagen/master
Address change
2017-10-17 15:04:36 +00:00
Caberhagen
e42fc1859f Address change 2017-10-07 10:06:41 +02:00
Sebastian Grewe
cca0179d83 Merge pull request #2605 from shtse8/master
Update findblock.php
2017-09-29 07:02:04 +02:00
Kyle Tse
94d67b3013 Update findblock.php
Try-Catch any exception thrown from `getblockhash` for safety.
2017-09-29 05:50:48 +08:00
Kyle Tse
15c7c02268 Update findblock.php
Fixed Invalid Blockhash for listsinceblock.
2017-09-29 05:01:20 +08:00
Sebastian Grewe
79c09bd62a Merge pull request #2603 from shtse8/master
Correct SERVER_NAME to HTTP_HOST to get a valid host url
2017-09-28 21:16:59 +02:00
shtse8
6c1aa15879 Correct SERVER_NAME to HTTP_HOST to get a valid host url 2017-09-28 11:44:33 +00:00
Blonďák
7dd8c690bc Merge https://github.com/MPOS/php-mpos into development 2017-09-13 21:25:24 +02:00
Blonďák
6875749f15 TYPO - remove unused variable 2017-09-13 18:28:48 +02:00
Blonďák
4670e553b2 FIX - check for data in SQL result 2017-09-13 18:27:48 +02:00
Blonďák
b144d21cb3 FIX - Only variables should be passed by reference in usersettings.class.php on line 34 2017-09-06 21:03:37 +02:00
Blonďák
d687cab6c1 FIXED - notifications without email notifications 2017-09-05 20:08:35 +02:00
Blonďák
f6bfc10b90 update - notifymyandroid.com - title from configuration 2017-09-04 20:19:03 +02:00
Blonďák
70ea8f1609 fixed - Undefined index: count_all 2017-09-04 20:05:13 +02:00
Blonďák
0307e1e62d fixed - Only variables should be passed by reference 2017-09-04 15:26:27 +02:00
Sebastian Grewe
7b6aa482ad Merge pull request #2590 from RaJiska/master
Pin attempts not reset upon success fix
2017-08-29 21:18:05 +02:00
RaJiska
615d6c433d Pin attempts not reset upon success fix 2017-08-29 17:14:16 +02:00
Sebastian Grewe
e2a3536d7e Merge pull request #2575 from MPOS/development
UPDATE : Development to Master
2017-07-18 15:27:48 +02:00
Sebastian Grewe
86ad3027fb [VERSION] 1.0.7 2017-07-18 15:22:19 +02:00
Sebastian Grewe
6e65a48914 [FIX] Default to bootstrap theme if none added to DB 2017-07-18 15:19:29 +02:00
Sebastian Grewe
f7f0437174 Merge pull request #2517 from MPOS/development
UPDATE : Development to Master
2017-07-18 09:40:31 +02:00
Sebastian Grewe
0387451e28 Merge pull request #2574 from MPOS/issue-2565-uptimerobot
Issue #2565 uptimerobot
2017-07-18 09:31:08 +02:00
Sebastian Grewe
586ca79601 [FIX #2565] New Uptime Robot HTTPS URL 2017-07-18 09:15:22 +02:00
Sebastian Grewe
2549e40c07 [UPDATE] Re-confirmed BTC address 2017-07-17 15:49:43 +02:00
Sebastian Grewe
1fcf97d35b [UPDATE] Re-confirmed BTC address 2017-07-17 15:49:25 +02:00
Sebastian Grewe
312dd4b71e [UPDATE] Out of release commit, removed donation addresses 2017-07-12 16:10:54 +02:00
Sebastian Grewe
6af727587f [UPDATE] Removed old donation addresses 2017-07-12 16:10:18 +02:00
Sebastian Grewe
6640f1f889 Merge pull request #2540 from blondak/development
#2539 - Feature request: Pushover.net notifications
2017-02-28 15:41:31 +01:00
Blonďák
bcfd7cfb30 Updated push notifications format 2017-02-06 09:53:17 +01:00
Blonďák
dad43012e9 #2539 - FIXED user login push notification 2017-01-17 07:00:37 +01:00
Blonďák
96fb92d237 FIX - change log to public,... 2017-01-17 06:39:54 +01:00
Blonďák
41bd5e4e50 #2539 - fixed doubled push notifications 2017-01-12 22:11:50 +01:00
Blonďák
c9930d3d52 #2539 - PushNotification templates 2017-01-12 22:05:33 +01:00
Blonďák
5e564a4f81 #2539 - fixed typo 2017-01-12 21:32:55 +01:00
Blonďák
9f32f0119d #2539 - Fixed upgrading DB version 2017-01-12 21:30:29 +01:00
Blonďák
893d920327 #2539 - More generic class UserSettings 2017-01-12 21:22:27 +01:00
Zdeněk Jurka
556db98835 #2539 - Feature request: Pushover.net notifications 2017-01-12 16:32:30 +01:00
Sebastian Grewe
a1cb113902 Merge pull request #2518 from MPOS/catch-missing-theme
[UPDATE] Catch missing theme folder from website_theme setting
2016-07-07 11:35:59 +02:00
Sebastian Grewe
073ff59b1a [UPDATE] Catch missing theme folder from website_theme setting 2016-07-07 11:30:02 +02:00
Sebastian Grewe
4a67b5ca02 [VERSION] MPOS 1.0.6 2016-07-07 11:13:09 +02:00
Sebastian Grewe
90866ad03b Merge pull request #2516 from MPOS/cron-maintenance
[ADDED] Temporarily disable all crons on pool maintenance
2016-07-07 10:55:59 +02:00
Sebastian Grewe
c35b232152 [ADDED] Temporarily disable all crons on pool maintenance 2016-07-07 10:50:30 +02:00
iAmShorty
62e01bd9b1 settings to hide help page and pool stats from users that are not logged in 2016-07-04 13:26:46 +02:00
iAmShorty
9e970f16a0 setting defaults to prevent error messages in apache logfiles 2016-07-04 12:43:35 +02:00
iAmShorty
edafc579a8 Merge pull request #2511 from MPOS/library-update
Library update
2016-07-04 11:12:43 +02:00
iAmShorty
00bdcdf0b1 corrected class file 2016-07-01 11:37:42 +02:00
iAmShorty
970bec62dd added neoscrypt dummy class for reporting correct algo 2016-06-30 16:05:19 +02:00
iAmShorty
2420160bc5 Revert "added neoscrypt class"
This reverts commit e6583ff311.
2016-06-30 15:58:48 +02:00
iAmShorty
e6583ff311 added neoscrypt class 2016-06-30 15:51:20 +02:00
Raphael
1df2ad9e73 metisMenu update to version 2.5.2 2016-06-30 14:34:04 +02:00
Raphael
8075fa937b font awesome update to version 4.6.3 2016-06-30 14:27:07 +02:00
Raphael
3114030907 plugin updates 2016-06-30 14:25:50 +02:00
Raphael
7b41f1325d updated jquery to version 2.2.4 2016-06-30 14:17:35 +02:00
Raphael
623435a53b updated datatables to version 1.10.12 2016-06-30 14:11:31 +02:00
iAmShorty
46d6c1178f updated bootstrap to version 3.3.6 2016-06-30 14:05:38 +02:00
Sebastian Grewe
9e8caa57ca Merge pull request #2510 from iAmShorty/block-notification
Disable Sound in Dashboard
2016-06-30 12:39:37 +02:00
iAmShorty
6013afd331 Update .travis.yml 2016-06-30 12:36:51 +02:00
iAmShorty
5fee244617 fixed button states 2016-06-30 11:53:37 +02:00
iAmShorty
cf00271802 Disable Sound in Dashboard
- Admin Settings to disable Button and Notification on Dashboard
- Save Buttonstate even if you open another page and come back to Dashboard
2016-06-30 11:19:01 +02:00
Sebastian Grewe
f72d3f4a76 [ADDED] x15 coin class for testing 2016-06-15 08:49:04 +02:00
Sebastian Grewe
d8c6d88521 [ADDED] x13 coin class for testing 2016-06-15 08:48:38 +02:00
Sebastian Grewe
37768dc67c Merge pull request #2501 from Gitju/master
minerd manual says it must be "-a scrypt" not "-a --scrypt"
2016-05-10 20:58:02 +02:00
Jürgen Scholz
89d762fb63 minerd manual says it must be -a scrypt not -a --scrypt 2016-05-10 20:16:52 +02:00
Sebastian Grewe
f6bd81fadb Merge pull request #2499 from machinecoin-project/master
Cryptsy seems to be history
2016-05-03 11:19:39 +02:00
Cryptoanarchist
26f01f16cb Cryptsy seems to be history 2016-05-03 10:15:48 +02:00
Gitju
b284dfadbc Merge pull request #1 from MPOS/master
Update from original
2016-05-03 10:09:33 +02:00
Sebastian Grewe
b7b45eb580 Merge pull request #2458 from MPOS/development
UPDATE : Development to Master
2016-03-11 18:52:56 +01:00
Sebastian Grewe
21dbe36850 Update to Version 1.0.5 for MPOS core 2016-03-11 18:52:23 +01:00
Sebastian Grewe
8cb5548f94 Fix #2490 2016-03-11 18:47:58 +01:00
Sebastian Grewe
71b525812f Merge branch 'master' into development 2016-02-25 10:49:53 +01:00
Sebastian Grewe
53533e4682 Merge pull request #2487 from jonnybravo0311/master
Added new hash rate modifiers
2016-02-23 05:36:16 +01:00
Jonny Bravo
7f7a1894c6 added PH and EH 2016-02-22 13:41:34 -05:00
Jonny Bravo
bc88b04ae9 added PH and EH 2016-02-22 13:41:16 -05:00
Sebastian Grewe
400a05bc59 Merge pull request #2478 from Kasvain/development
Add C-CEX API support
2016-02-22 08:47:08 +01:00
Sebastian Grewe
56acee5ea5 Merge pull request #2486 from jonnybravo0311/master
Changed structure of statistics_shares table
2016-02-22 08:46:46 +01:00
Jonny Bravo
d6d68cb8b0 Changed shares to BIGINT data type to account for BTC having far more shares than can be handled by standard INT datatype 2016-02-21 13:41:10 -05:00
Sebastian Grewe
1cd2f635cd Merge pull request #2481 from reappergrimd/patch-1
Added cryptopia Api Call
2016-01-27 21:54:22 +01:00
reappergrimd
e15695e1ff Added cryptopia Api Call
Change Allows Site admin to pull last price from this exchange.
Configuration example

$config['price']['enabled'] = true;
$config['price']['url'] = 'https://www.cryptopia.co.nz/';;
$config['price']['target'] = 'api/GetMarket/2274'; // API call to get market via market id of coin (api/GetMarket/{coin market id}
$config['price']['currency'] = 'BTC'; //
2016-01-27 22:13:52 +02:00
Kasvain
61e6ed21c1 Add C-CEX API support
Allows fetching price information from C-CEX
2015-12-14 15:02:43 +02:00
Sebastian Grewe
3ab9f6ac1e Merge pull request #2474 from MPOS/revert-2473-xisi-bleutrade-ticker
Revert "Update tools.class.php - add bleutrade api support"
2015-12-04 19:53:15 +01:00
Sebastian Grewe
2395500836 Revert "Update tools.class.php - add bleutrade api support" 2015-12-04 19:52:40 +01:00
Sebastian Grewe
2b6bc7e0f5 Merge pull request #2473 from MPOS/xisi-bleutrade-ticker
Update tools.class.php - add bleutrade api support
2015-12-04 18:20:38 +01:00
Joey
c24f7bb397 Update tools.class.php 2015-12-04 12:12:38 -05:00
Joey
5d6215a0e3 Update tools.class.php - add bleutrade api support
Adds support for bleutrade api for the ticker
2015-12-04 12:09:19 -05:00
Sebastian Grewe
a5b51dfaec [FIX] Keep sidebar open when selecting Admin -> System -> Setup 2015-10-14 16:40:50 +02:00
Sebastian Grewe
4031422839 Merge branch 'development' of github.com:MPOS/php-mpos into development 2015-10-14 16:32:09 +02:00
Sebastian Grewe
d795055232 Fix #2462 - Spelling error
Spelling error. Thanks @turnkit for mentioning it.
2015-09-29 09:18:51 +02:00
Sebastian Grewe
4376df232b [CHANGELOG] Updated for future release 2015-08-04 09:26:34 +02:00
Sebastian Grewe
4ab0b8faa2 [#2454] Fixed worker name box not scaling 2015-08-04 09:20:21 +02:00
Sebastian Grewe
6650e3fe44 Merge pull request #2452 from pokari1986/development
I have repaired 'User Information' table in 'Admin Panel > Users > user Info'
2015-07-21 20:55:03 +02:00
Sebastian Grewe
04a9286e31 [ADDED] Check peer state for admin wallet info; [CLEANUP] Removed unused vars 2015-07-19 14:44:25 +02:00
Sebastian Grewe
a7401d30a0 [ADDED] Check download status in admin setup check 2015-07-19 12:37:06 +02:00
Sebastian Grewe
f26f43a725 [UPDATE] Minor change to admin checks template 2015-07-19 12:35:25 +02:00
Sebastian Grewe
b4ae900137 [UDPDATE] Put chain download into wrapper class 2015-07-19 12:26:45 +02:00
Sebastian Grewe
2c3052be24 [ADDED] Show Blockchain download status 2015-07-19 11:48:49 +02:00
Sebastian Grewe
5ed89f94a2 [UPDATE] Remove config disable check popup from admins 2015-07-15 16:04:57 +02:00
Sebastian Grewe
b9ab718d71 Revert "[FIX][#2454][#2377] MPOS stylesheet improvements"
This reverts commit f5234ea74e.

Broke the login form, Username and Password hints were not readable.
2015-07-15 15:59:52 +02:00
Sebastian Grewe
f5234ea74e [FIX][#2454][#2377] MPOS stylesheet improvements 2015-07-15 14:50:07 +02:00
Sebastian Grewe
deb3b115d0 [FIX] Avoid empty Auto-Payout threshold value for accounts page 2015-07-15 14:44:26 +02:00
murai-y
2985bab2ed repair 'User Information' table in 'Admin Panel > Users > user Info' in calse payout_system=pps 2015-07-11 12:12:52 +00:00
Sebastian Grewe
486869a1a2 [UPDATE] Development to Master 2015-06-22 17:22:48 +02:00
Sebastian Grewe
4e7eb890f4 Merge pull request #2441 from xisi/dev-adminchecks-move
Move admin_checks to admin panel/system/setup
2015-06-20 07:53:06 +02:00
Joey
8dba76c722 add bit about daemon not being fully synced 2015-06-19 10:36:12 -04:00
xisi
cdc3bbb68d Use glob, updated changelog 2015-06-19 09:59:06 -04:00
xisi
0b91d743ca Updated issue #2427 2015-06-19 09:52:43 -04:00
xisi
02067ace54 See issue #2427 2015-06-19 09:52:43 -04:00
Sebastian Grewe
433c8f766a Merge pull request #2431 from owlhooter/master
Add Anonymous check for blockfinder email
2015-06-19 09:52:43 -04:00
Sebastian Grewe
f76ee0c66b Merge pull request #2426 from xisi/master
added admin check to throw a notice in admin_checks for issue #2424
2015-06-19 09:52:43 -04:00
owlhooter
b528cc2998 Add anonymous check for users on block finder email notification 2015-06-19 09:52:43 -04:00
Sebastian Grewe
c50ff562a3 Merge pull request #2415 from MPOS/development
[VERSION] MPOS 1.0.3
2015-06-19 09:52:43 -04:00
xisi
9d42991b14 added admin check to throw a notice in admin_checks for issue #2424 2015-06-19 09:52:43 -04:00
owlhooter
40d0ecd769 Add anonymous check for users on block finder email notification 2015-06-19 09:52:43 -04:00
Sebastian Grewe
d4a161ae00 [UPDATE] CHANGELOG for 1.0.4 2015-06-08 11:47:06 +02:00
Sebastian Grewe
b62b6b7611 [VERSION] MPOS 1.0.4
Version increment for future release.
2015-06-08 11:41:23 +02:00
Sebastian Grewe
ecf2c1cc41 Merge pull request #2431 from owlhooter/master
Add Anonymous check for blockfinder email
2015-05-29 18:50:55 +02:00
owlhooter
d1d392a448 Add anonymous check for users on block finder email notification 2015-05-27 09:04:41 -05:00
owlhooter
b033a9888b Add anonymous check for users on block finder email notification 2015-05-27 09:02:50 -05:00
Sebastian Grewe
933660806b Merge pull request #2426 from xisi/master
added admin check to throw a notice in admin_checks for issue #2424
2015-05-25 14:31:02 +02:00
xisi
80be081358 added admin check to throw a notice in admin_checks for issue #2424 2015-05-24 21:11:22 -04:00
Sebastian Grewe
18a6f588ed Merge pull request #2415 from MPOS/development
[VERSION] MPOS 1.0.3
2015-04-29 22:31:00 +02:00
Sebastian Grewe
ff908be3a7 [VERSION] MPOS 1.0.3 2015-04-29 22:30:21 +02:00
Sebastian Grewe
e511ba2ece Merge pull request #2414 from MPOS/development
UPDATE : Development to Master
2015-04-29 22:29:45 +02:00
Sebastian Grewe
d1e6783075 [UPDATE] Changelog updated 2015-04-29 22:29:05 +02:00
Sebastian Grewe
38e9654cea [HOTFIX] Broken DB upgrade for latest release 2015-04-29 22:27:40 +02:00
Sebastian Grewe
50af83680c Merge pull request #2402 from MPOS/development
UPDATE : Development to Master
2015-04-28 19:56:31 +02:00
Sebastian Grewe
dfa34bc6d8 [UPDATE] Changelog for release 2015-04-28 19:56:06 +02:00
Sebastian Grewe
993972a3ec Merge pull request #2408 from MPOS/shared-db-update
[UPDATE] Shared DB Behavior
2015-04-28 17:47:57 +02:00
Sebastian Grewe
da8b3cc0e8 Merge pull request #2411 from e3betht/closing_tags_dev
Closing tags on development branch
2015-04-27 06:44:19 +02:00
e3betht
010a89449e removing more closing PHP tags 2015-04-26 20:19:50 -05:00
e3betht
3a4ca87e9a Adding the Code Climate badge 2015-04-26 20:06:51 -05:00
e3betht
6179d79c3b Removing closing PHP tags 2015-04-26 20:06:29 -05:00
Sebastian Grewe
9437746602 [UPDATE] CHANGELOG.md with modifications 2015-04-24 09:28:06 +02:00
Sebastian Grewe
b7b3103c49 [UPDATE] Shared DB Behavior
* Default to standard DB if nothing is set
* Separate Accounts and Pool Workers shared DB
* Added shared News DB
* New config options added
 * `$config['db']['shared']['accounts']`
 * `$config['db']['shared']['workers']`
 * `$config['db']['shared']['news']`
2015-04-24 09:25:14 +02:00
Sebastian Grewe
4c01584f4d [UPDATE] Changelog 2015-04-19 00:59:53 +02:00
Sebastian Grewe
091aa6475c [FIX] Manual Payout warning when account balance too low 2015-04-19 00:59:07 +02:00
Sebastian Grewe
bb3fa99530 [UPDATE] Config Version 1.0.1 2015-04-19 00:33:22 +02:00
Sebastian Grewe
a7fc7146f1 [ADDED] SSO across MPOS pools with single database host 2015-04-19 00:31:56 +02:00
Sebastian Grewe
4adc1134d9 [UPDATE] CHANGELOG with latest fix 2015-04-18 21:43:39 +02:00
Sebastian Grewe
ccea37e4a1 Merge branch 'development' of github.com:MPOS/php-mpos into development 2015-04-18 21:42:58 +02:00
Sebastian Grewe
3e6b417279 [FIX] Play Block Nofitifcation audio as MP3 for Safari/Mobile 2015-04-18 21:42:47 +02:00
Sebastian Grewe
81105c7073 [UPDATE] CHANGELOG with latest merge 2015-04-16 15:41:00 +02:00
Sebastian Grewe
76a285319e Merge pull request #2404 from MPOS/coin-ap-threshold
[UPDATE] Store coin auto payout in coin_addresses table per coin
2015-04-16 15:37:15 +02:00
Sebastian Grewe
ffea9cdb92 [FIX] Missed new DB version in base structure 2015-04-16 12:47:11 +02:00
Sebastian Grewe
8219193ab4 [FIX] Copy and paste error 2015-04-16 12:32:33 +02:00
Sebastian Grewe
36abe1e8c8 [FIX] Missed a ap_threshold in transaction class 2015-04-16 12:22:48 +02:00
Sebastian Grewe
8154daa26b [FIX] Missed a ap_threshold in transaction class 2015-04-16 12:22:07 +02:00
Sebastian Grewe
1613355c04 [UPDATE] Store coin auto payout in coin_addresses table per coin 2015-04-16 12:16:45 +02:00
Sebastian Grewe
8826d0301c [UPDATE] Remove / in Peer Identity 2015-04-16 10:51:02 +02:00
Sebastian Grewe
45fb43950a [UPDATE] Link to Transaction ID if tx url is enabled 2015-04-16 10:38:32 +02:00
Sebastian Grewe
08e425ac81 Merge branch 'development' of github.com:MPOS/php-mpos into development 2015-04-16 10:21:42 +02:00
Sebastian Grewe
5b8e7a4dc2 [ADDED] Admin Wallet Info, last N transactions 2015-04-16 10:21:31 +02:00
Sebastian Grewe
5ef89d759e [ADDED] List last N transactions in Admin Wallet Info
* N default is 25
* Can be set via Admin System Settings -> Wallet
2015-04-16 10:19:56 +02:00
Sebastian Grewe
f428ca1d2e [FIX] Potential empty variable warning 2015-04-15 17:18:28 +02:00
Sebastian Grewe
5240e37ccf [SQL] Removed coin_address from accounts table, not used anymore 2015-04-15 15:19:24 +02:00
Sebastian Grewe
0edf25798e [REMOVED] Unused Dynatree JS 2015-04-15 15:10:43 +02:00
Sebastian Grewe
b83163a058 [REMOVED] Font Awesome source files 2015-04-15 15:06:42 +02:00
Sebastian Grewe
c4011cde8d [REMOVED] Not minified CSS 2015-04-15 15:01:55 +02:00
Sebastian Grewe
4d96e3e74d [UPDATE] CLEditor to 1.4.5 2015-04-15 14:55:15 +02:00
Sebastian Grewe
b4d5b9a196 [UPDATE] Bootstrap-Switch JS to 3.3.2 2015-04-15 14:51:52 +02:00
Sebastian Grewe
f8de40b0f1 [UPDATE] Changelog for 1.0.2 2015-04-15 14:45:55 +02:00
Sebastian Grewe
a1e876ca9c [UPDATE] MorrisJS 0.5.1 2015-04-15 14:45:01 +02:00
Sebastian Grewe
181c3825c5 [UPDATE] RaphaelJS 2.1.2 2015-04-15 14:41:02 +02:00
Sebastian Grewe
4e87004e08 [REMOVED] Unused JS 2015-04-15 14:35:38 +02:00
Sebastian Grewe
7f1d8e46ec [REMOVED] Unused JS 2015-04-15 14:33:29 +02:00
Sebastian Grewe
0a6f4abd6e [UPDATE] Bootstrap 3.3.4 2015-04-15 14:31:19 +02:00
Sebastian Grewe
b13e7681ea [VERSION] Changelog for 1.0.2 2015-04-15 14:14:10 +02:00
Sebastian Grewe
0603d5d6ea [CLEANUP] Wallet Info templates 2015-04-15 14:08:11 +02:00
Sebastian Grewe
c12728a87b [UPDATE] More verbose wallet information 2015-04-15 13:57:34 +02:00
Sebastian Grewe
39d41514f9 [UPDATE] Renamed column from Errors to Status in Admin -> Wallet 2015-04-15 13:44:20 +02:00
Sebastian Grewe
aff3f9e57f [ADDED] Peer information in Admin -> Wallet 2015-04-15 13:41:34 +02:00
Sebastian Grewe
1a26c89bc6 [ADDED] Font Awesome 4.3.0 2015-04-15 13:23:51 +02:00
Sebastian Grewe
308ddc88d3 Merge pull request #2401 from MPOS/development
[UPDATE] jQuery, SoundJS, MPOS 1.0.1
2015-04-15 12:04:01 +02:00
Sebastian Grewe
f996118d17 Merge pull request #2388 from MPOS/development
UPDATE : Development to Master
2015-02-07 19:18:57 +01:00
Sebastian Grewe
54d667335c Merge pull request #2371 from MPOS/development
UPDATE : Development to Master
2014-12-16 09:05:14 +01:00
Sebastian Grewe
b10c328f09 Merge pull request #2338 from MPOS/development
UPDATE : Development to Master
2014-10-14 14:36:12 +02:00
Sebastian Grewe
86df6d1e3e Merge pull request #2274 from MPOS/development
UPDATE : Development to Master
2014-08-18 09:04:50 +02:00
Sebastian Grewe
670b3b39fd Merge branch 'development' 2014-06-26 11:40:46 +02:00
Sebastian Grewe
bbe2ff7006 Merge pull request #2219 from MPOS/development
UPDATE : Development to Master
2014-06-26 11:26:02 +02:00
Sebastian Grewe
27391e65f7 Merge pull request #2117 from MPOS/development
UPDATE : Development to Master
2014-05-23 09:41:18 +02:00
Sebastian Grewe
3f615a6048 Merge pull request #2116 from MPOS/development
[SECURITY] Fixed 2FA on the account edit page
2014-04-16 19:34:23 +02:00
Sebastian Grewe
d77b6791ea Merge pull request #2115 from MPOS/development
[SECURITY] - Development to Master - SQL Template Removal
2014-04-16 19:06:30 +02:00
Sebastian Grewe
1462205a03 Merge pull request #2103 from MPOS/development
UPDATE : Development to Master - RC2
2014-04-14 15:21:53 +02:00
Sebastian Grewe
d895e9a8bf Merge pull request #2075 from MPOS/development
UPDATE : Development to Master - RC1
2014-04-08 16:31:47 +02:00
298 changed files with 7292 additions and 34136 deletions

6
.gitignore vendored
View File

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

View File

@ -18,7 +18,7 @@ branches:
install:
- wget http://selenium-release.storage.googleapis.com/2.42/selenium-server-standalone-2.42.2.jar
- composer global require "fxp/composer-asset-plugin:1.0.0-beta2"
- composer global require "fxp/composer-asset-plugin:~1.1.1"
- composer install
@ -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,3 +1,60 @@
1.0.5 (XXX XXth XXXX)
---------------------
* Fixed worker name scaling issues on mobile devices (Thanks @nrpatten)
* Fixed user information table formatting (Thanks @pokari1986)
* Fixed empty auto-payout threshold value for accounts page
* Removed config disable check popup for admins on all pages
* Added blockchain download status for admin feedback (admin setup check)
* Added peer state to wallet info state if no peers are connected
1.0.4 (Jun 19th 2015)
---------------------
* Honor anonymous attribute when sending block finder mails
* Display admin warning if no transfer fees are set
* Moved admin_checks.php into the admin panel/system/setup
* Checks are now loaded individually from pages/admin/checks
1.0.3 (Apr 29th 2015)
---------------------
* HOTFIX: Database upgrade from `1.0.0` to `1.0.1` did not work as
intended
1.0.2 (Apr 28th 2015)
---------------------
* Allow SSO accross MPOS pools
* Added a new config options
* `$config['db']['shared']['acounts']`, defaults to `$config['db']['name']`
* `$config['db']['shared']['workers']`, defaults to `$config['db']['name']`
* `$config['db']['shared']['news']`, defaults to `$config['db']['name']`
* Will access `accounts`, `pool_workers` and `news` on shared table
* Does not allow splitting `accounts` and `pool_woker` across database hosts
* Required `$config['cookie']['domain']` to be set
* You need to use the top domain shared between hosts as the setting
* e.g. `ltc.thepool.com` and `btc.thepool.com` it has to be `.thepool.com` (NOTE the leading .)
* Increased information on `Admin -> Wallet Info`
* Added block count to Wallet Status
* Added number of accounts to Wallet Status
* Added Peer information
* Added last 25 transactions
* Can be changed via Admin System Settings -> Wallet
* Always show all accounts
* Updated Auto Payout Threshold to be stored in `coin_address` table
* Existing thresholds will be migrated when upgrading
* Update to `1.0.1` for the database using the upgrade script supplied in MPOS
* Updated Bootstrap to 3.3.4
* Updated MorrisJS to 0.5.1
* Updated RaphaelJS to 2.1.2
* Updated Bootstrap Switch to 3.3.2
* Updated CLEditor to 1.4.5
* Removed unneeded JS files
* Removed unneeded CSS files
* Fixed ding for block notifications not playing on Safari
* Fixed manual payout warning to show when account balance is too low
1.0.1 (Apr 15th 2015)
---------------------

View File

@ -1,48 +1,24 @@
[![Build Status](https://travis-ci.org/MPOS/php-mpos.png?branch=master)](https://travis-ci.org/MPOS/php-mpos) [![Code Coverage](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) master<br />
[![Build Status](https://travis-ci.org/MPOS/php-mpos.png?branch=master)](https://travis-ci.org/MPOS/php-mpos) [![Code Climate](https://codeclimate.com/github/MPOS/php-mpos/badges/gpa.svg)](https://codeclimate.com/github/MPOS/php-mpos) [![Code Coverage](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) master<br />
[![Build Status](https://travis-ci.org/MPOS/php-mpos.png?branch=development)](https://travis-ci.org/MPOS/php-mpos) [![Code Coverage](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/coverage.png?b=development)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=development) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/quality-score.png?b=development)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=development) development
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
=========
Donations to this project are going directly to [TheSerapher](https://github.com/TheSerapher), the original author of this project:
* LTC address: `Lge95QR2frp9y1wJufjUPCycVsg5gLJPW8`
* BTC address: `1HuYK6WPU8o3yWCrAaADDZPRpL5QiXitfv`
* DOGE address: `DANk8bnc3vHEf7Jthaxq1Xgn1BSiArNdjG`
* 42Coin address: `4VxA6Ht59Mj6ikhA4gDXLiHuAaDCJEvYTZ`
* FST address: `fiRqMgZyhjTN1GSEB3ZxV35JXsE5bjEaQ2`
* FRK address: `FDcgGZjX2B29qevSuiuQVwXhkNhtQT4cEW`
* Cryptsy Trade Key: `6ff7292142463b7b80cbbbdfc52334ba89727b11`
* LTC address: `Lge95QR2frp9y1wJufjUPCycVsg5gLJPW8`
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 (http://litecoin-pool.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
==================
@ -145,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

@ -80,4 +80,3 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
}
require_once('cron_end.inc.php');
?>

View File

@ -22,4 +22,3 @@ limitations under the License.
$monitoring->endCronjob($cron_name, 'OK', 0, false, false);
$monitoring->setStatus($cron_name . "_runtime", "time", microtime(true) - $cron_start[$cron_name]);
$monitoring->setStatus($cron_name . "_endtime", "date", time());
?>

View File

@ -28,7 +28,13 @@ require_once('shared.inc.php');
// Fetch our last block found from the DB as a starting point
$aLastBlock = @$block->getLastValid();
$strLastBlockHash = $aLastBlock['blockhash'];
if (!$strLastBlockHash) $strLastBlockHash = '';
if (!$strLastBlockHash) {
try {
$strLastBlockHash = $bitcoin->getblockhash(1);
} catch (Exception $e) {
$strLastBlockHash = "";
}
}
// Fetch all transactions since our last block
if ( $bitcoin->can_connect() === true ){
@ -157,8 +163,12 @@ if (empty($aAllBlocks)) {
// Notify users
$aAccounts = $notification->getNotificationAccountIdByType('new_block');
if (is_array($aAccounts)) {
if ($user->getUserNameAnon($iAccountId) == 1) {
$finder = "Anonymous";
} else {
$finder = $user->getUserName($iAccountId);
}
$finder = $user->getUserName($iAccountId);
foreach ($aAccounts as $aData) {
$aMailData['height'] = $aBlock['height'];
$aMailData['subject'] = 'New Block';
@ -178,4 +188,3 @@ if (empty($aAllBlocks)) {
}
require_once('cron_end.inc.php');
?>

View File

@ -75,4 +75,3 @@ if ($setting->getValue('notifications_disable_idle_worker') != 1) {
}
require_once('cron_end.inc.php');
?>

View File

@ -289,4 +289,3 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
}
require_once('cron_end.inc.php');
?>

View File

@ -200,4 +200,3 @@ if ($aAllBlocks = $block->getAllUnaccounted('ASC')) {
$log->logInfo("Completed PPS Payout");
require_once('cron_end.inc.php');
?>

View File

@ -169,4 +169,3 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
}
require_once('cron_end.inc.php');
?>

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,24 +51,50 @@ $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
$cron_start[$cron_name] = microtime(true);
// Skip all crons if admin enabled pool maintenance
if ($setting->getValue('maintenance')) {
$log->logInfo('Cronjobs disabled due to pool maintenance');
$monitoring->endCronjob($cron_name, 'E0083', 2, true, false);
}
// Check if our cron is activated
if ($monitoring->isDisabled($cron_name)) {
$log->logFatal('Cronjob is currently disabled due to errors, use -f option to force running cron.');
@ -87,5 +113,3 @@ if ($setting->getValue('DB_VERSION') != DB_VERSION || $config['version'] != CONF
$log->logFatal('Cronjob is currently disabled due to required upgrades. Import any outstanding SQL files and check your configuration file.');
$monitoring->endCronjob($cron_name, 'E0075', 0, true, false);
}
?>

View File

@ -55,4 +55,3 @@ $statistics->getCurrentHashrate() ? $status = 'OK' : $status = 'ERROR';
$log->logInfo(sprintf($strLogMask, 'getTopContributors(shares)', number_format(microtime(true) - $start, 3), $status));
require_once('cron_end.inc.php');
?>

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 = '';
@ -89,4 +89,3 @@ $log->logInfo(sprintf($strLogMask, 'purgeUserStats', $affected, number_format(mi
// Cron cleanup and monitoring
require_once('cron_end.inc.php');
?>

View File

@ -76,4 +76,3 @@ if ($api_keys = $setting->getValue('monitoring_uptimerobot_api_keys')) {
$log->logInfo(sprintf($strLogMask, 'Uptime Robot', 'n/a', number_format(microtime(true) - $start, 3), $status, $message));
require_once('cron_end.inc.php');
?>

View File

@ -1,152 +0,0 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
if (@$_SESSION['USERDATA']['is_admin'] && $user->isAdmin(@$_SESSION['USERDATA']['id'])) {
if (!include_once(INCLUDE_DIR . '/lib/jsonRPCClient.php')) die('Unable to load libs');
$notice = array();
$enotice = array();
$error = array();
// setup some basic stuff for checking - getuid/getpwuid not available on mac/windows
$apache_user = 'unknown';
if (substr_count(strtolower(PHP_OS), 'nix') > 0 || substr_count(strtolower(PHP_OS), 'linux') > 0) {
$apache_user = (function_exists('posix_getuid')) ? posix_getuid() : 'unknown';
$apache_user = (function_exists('posix_getpwuid')) ? posix_getpwuid($apache_user) : $apache_user;
}
// setup checks
// logging
if ($config['logging']['enabled']) {
if (!is_writable($config['logging']['path'])) {
$error[] = "Logging is enabled but we can't write in the logfile path";
}
}
// check if memcache isn't available but enabled in config -> error
if (!class_exists('Memcached') && $config['memcache']['enabled']) {
$error[] = "You have memcached enabled in your config and it's not available as a PHP module. Install the package on your system.";
}
// if it's not enabled, test it if it exists, if it works -> error tell them to enable, -> otherwise notice it's disabled
if (!$config['memcache']['enabled']) {
if (PHP_OS == 'WINNT') {
require_once(CLASS_DIR . 'memcached.class.php');
}
if (class_exists('Memcached')) {
$memcache_test = @new Memcached();
if ($config['memcache']['sasl'] === true) {
$memcache_test->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
$memcache_test->setSaslAuthData($config['memcache']['sasl']['username'], $config['memcache']['sasl']['password']);
}
$memcache_test_add = @$memcache_test->addServer($config['memcache']['host'], $config['memcache']['port']);
$randmctv = rand(5,10);
$memcache_test_set = @$memcache_test->set('test_mpos_setval', $randmctv);
$memcache_test_get = @$memcache_test->get('test_mpos_setval');
}
if (class_exists('Memcached') && $memcache_test_get == $randmctv) {
$error[] = "You have memcache disabled in the config but it's available and works! Enable it for best performance.";
} else {
$notice[] = "Memcache is disabled; Almost every linux distro has packages for it, you should be using it if you can.";
}
}
// check if htaccess exists
if (!file_exists(BASEPATH.".htaccess")) {
$htaccess_link = "<a href='https://github.com/MPOS/php-mpos/blob/next/public/.htaccess'>.htaccess</a>";
$notice[] = "You don't seem to have a .htaccess in your public folder, if you're using Apache set it up: $htaccess_link";
}
// check if we can write templates/cache and templates/compile -> error
if (!is_writable(TEMPLATE_DIR . '/cache')) {
$error[] = "templates/cache folder is not writable for uid {$apache_user['name']}";
}
if (!is_writable(TEMPLATE_DIR . '/compile')) {
$error[] = "templates/compile folder is not writable for uid {$apache_user['name']}";
}
// check if we can write the config files, we should NOT be able to -> error
if (is_writable(INCLUDE_DIR.'/config/global.inc.php') || is_writable(INCLUDE_DIR.'/config/global.inc.dist.php') ||
is_writable(INCLUDE_DIR.'/config/security.inc.php') || is_writable(INCLUDE_DIR.'/config/security.inc.dist.php')) {
$error[] = "Your config files <b>SHOULD NOT be writable to this user</b>!";
}
// check if daemon can connect -> error
try {
if ($bitcoin->can_connect() !== true) {
$error[] = "Unable to connect to coin daemon using provided credentials";
}
else {
// validate that the wallet service is not in test mode
if ($bitcoin->is_testnet() == true) {
$error[] = "The coin daemon service is running as a testnet. Check the TESTNET setting in your coin daemon config and make sure the correct port is set in the MPOS config.";
}
// if coldwallet is not empty, check if the address is valid -> error
if (!empty($config['coldwallet']['address'])) {
if (!$bitcoin->validateaddress($config['coldwallet']['address']))
$error[] = "Your cold wallet address is <u>SET and INVALID</u>";
}
// check if there is more than one account set on wallet
$accounts = $bitcoin->listaccounts();
if (count($accounts) > 1 && $accounts[''] <= 0) {
$error[] = "There are " . count($accounts) . " Accounts set in local Wallet and Default Account has no liquid funds to pay your miners!";
}
}
} catch (Exception $e) {
}
// check anti DOS protection, we need memcache for that
if ($config['mc_antidos'] && !$config['memcache']['enabled']) {
$error[] = "mc_antidos is enabled and memcache is not, <u>memcache is required</u> to use this";
}
// poke stratum using gettingstarted details -> enotice
if (function_exists('socket_create')) {
$host = @gethostbyname($config['gettingstarted']['stratumurl']);
$port = $config['gettingstarted']['stratumport'];
if (isset($host) and
isset($port) and
($socket=socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) and
(socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => 3, 'usec' => 0))) and
(@socket_connect($socket, $host, $port)))
{
socket_close($socket);
} else {
$enotice[] = 'We tried to poke your Stratum server using your $config[\'gettingstarted\'] settings but it didn\'t respond - ' . socket_strerror(socket_last_error());
}
} else {
// Connect via fsockopen as fallback
if (! $fp = @fsockopen($config['gettingstarted']['stratumurl'], $config['gettingstarted']['stratumport'], $errCode, $errStr, 1)) {
$enotice[] = 'We tried to poke your Stratum server using your $config[\'gettingstarted\'] settings but it didn\'t respond';
}
@fclose($fp);
}
// security checks
// salts too short -> notice, salts default -> error
if ((strlen($config['SALT']) < 24) || (strlen($config['SALTY']) < 24) || $config['SALT'] == 'PLEASEMAKEMESOMETHINGRANDOM' || $config['SALTY'] == 'THISSHOULDALSOBERRAANNDDOOM') {
if ($config['SALT'] == 'PLEASEMAKEMESOMETHINGRANDOM' || $config['SALTY'] == 'THISSHOULDALSOBERRAANNDDOOM') {
$error[] = "You absolutely <u>SHOULD NOT leave your SALT or SALTY default</u> changing them will require registering again";
} else {
$notice[] = "SALT or SALTY is too short, they should be more than 24 characters and changing them will require registering again";
}
}
// display the errors
foreach ($enotice as $en) {
$_SESSION['POPUP'][] = array('CONTENT' => $en, 'TYPE' => 'alert alert-info');
}
if (!count($notice) && !count($error)) {
$_SESSION['POPUP'][] = array('CONTENT' => 'The config options we checked seem OK', 'TYPE' => 'alert alert-success');
} else {
foreach ($notice as $n) {
$_SESSION['POPUP'][] = array('CONTENT' => $n, 'TYPE' => 'alert alert-warning');
}
foreach ($error as $e) {
$_SESSION['POPUP'][] = array('CONTENT' => $e, 'TYPE' => 'alert alert-danger');
}
}
}
?>

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');
@ -78,7 +85,8 @@ require_once(CLASS_DIR . '/transaction.class.php');
require_once(CLASS_DIR . '/roundstats.class.php');
require_once(CLASS_DIR . '/news.class.php');
require_once(CLASS_DIR . '/api.class.php');
require_once(CLASS_DIR . '/usersettings.class.php');
require_once(CLASS_DIR . '/ipushnotification.interface.php');
require_once(CLASS_DIR . '/pushnotification.class.php');
require_once(INCLUDE_DIR . '/lib/Michelf/Markdown.php');
require_once(INCLUDE_DIR . '/lib/scrypt.php');
?>

View File

@ -14,6 +14,16 @@ $quickstartlink = "<a href='https://github.com/MPOS/php-mpos/wiki/Quick-Start-Gu
if (!include_once(INCLUDE_DIR . '/config/global.inc.dist.php')) die('Unable to load base global config from ['.INCLUDE_DIR. '/config/global.inc.dist.php' . '] - '.$quickstartlink);
if (!@include_once(INCLUDE_DIR . '/config/global.inc.php')) die('Unable to load your global config from ['.INCLUDE_DIR. '/config/global.inc.php' . '] - '.$quickstartlink);
// Check for a shared account database and set to default DB if unset
if (!isset($config['db']['shared']['accounts']))
$config['db']['shared']['accounts'] = $config['db']['name'];
// Check for a shared worker database and set to default DB if unset
if (!isset($config['db']['shared']['workers']))
$config['db']['shared']['workers'] = $config['db']['name'];
// Check for a shared news database and set to default DB if unset
if (!isset($config['db']['shared']['news']))
$config['db']['shared']['news'] = $config['db']['name'];
// load our security configs
if (!include_once(INCLUDE_DIR . '/config/security.inc.dist.php')) die('Unable to load base security config from ['.INCLUDE_DIR. '/config/security.inc.dist.php' . '] - '.$quickstartlink);
if (@file_exists(INCLUDE_DIR . '/config/security.inc.php')) include_once(INCLUDE_DIR . '/config/security.inc.php');
@ -22,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();
@ -43,5 +52,3 @@ $master_template = 'master.tpl';
// Load Classes, they name defines the $ variable used
// We include all needed files here, even though our templates could load them themself
require_once(INCLUDE_DIR . '/autoloader.inc.php');
?>

View File

@ -16,6 +16,8 @@ class Base {
public function getTableName() {
return $this->table;
}
protected $debug;
public function setDebug($debug) {
$this->debug = $debug;
}
@ -25,9 +27,13 @@ class Base {
public function setCoinAddress($coin_address) {
$this->coin_address = $coin_address;
}
public $log;
public function setLog($log) {
$this->log = $log;
}
protected $mysqli;
public function setMysql($mysqli) {
$this->mysqli = $mysqli;
}
@ -40,6 +46,10 @@ class Base {
public function setSalty($salt) {
$this->salty = $salt;
}
/**
* @var Smarty
*/
var $smarty;
public function setSmarty($smarty) {
$this->smarty = $smarty;
}
@ -52,6 +62,8 @@ class Base {
public function setConfig($config) {
$this->config = $config;
}
protected $aErrorCodes;
public function setErrorCodes(&$aErrorCodes) {
$this->aErrorCodes =& $aErrorCodes;
}
@ -241,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;
}
@ -284,4 +297,3 @@ class Base {
return $array;
}
}
?>

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();
}

31
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;
@ -66,6 +82,19 @@ class BitcoinWrapper extends BitcoinClient {
$dDifficulty = $this->getdifficulty();
return $this->memcache->setCache(__FUNCTION__, $dDifficulty * pow(2,32) / $iCurrentPoolHashrate, 30);
}
public function getblockchaindownload() {
$aPeerInfo = $this->getpeerinfo();
$aInfo = $this->getinfo();
$iStartingHeight = 0;
foreach ($aPeerInfo as $aPeerData) {
if ($iStartingHeight < $aPeerData['startingheight']) $iStartingHeight = $aPeerData['startingheight'];
}
if ($iStartingHeight > $aInfo['blocks']) {
return number_format(round($aInfo['blocks'] / $iStartingHeight * 100, 2), 2);
} else {
return false;
}
}
public function getnetworkhashps() {
$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

@ -3,7 +3,17 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
class CoinAddress extends Base {
protected $table = 'coin_addresses';
private $cache = array();
/**
* We allow changing the database for shared accounts across pools
* Load the config on construct so we can assign the DB name
* @param config array MPOS configuration
* @return none
**/
public function __construct($config) {
$this->setConfig($config);
$this->table = $this->config['db']['shared']['accounts'] . '.' . $this->table;
}
/**
* Fetch users coin address for a currency
@ -27,6 +37,29 @@ class CoinAddress extends Base {
return $this->sqlError();
}
/**
* Fetch users Auto Payout Threshold for a currency
* @param UserID int UserID
* @return mixed Float value for threshold, false on error
**/
public function getAPThreshold($userID, $currency=NULL) {
if ($currency === NULL) $currency = $this->config['currency'];
$this->debug->append("STA " . __METHOD__, 4);
$stmt = $this->mysqli->prepare("
SELECT ap_threshold
FROM " . $this->getTableName() . "
WHERE account_id = ? AND currency = ?
");
if ( $this->checkStmt($stmt) && $stmt->bind_param('is', $userID, $currency) && $stmt->execute() && $result = $stmt->get_result()) {
if ($result->num_rows == 1) {
return $result->fetch_object()->ap_threshold;
}
}
$this->debug->append("Unable to fetch users auto payout threshold for " . $currency);
return $this->sqlError();
}
/**
* Check if a coin address is already set
* @param address string Coin Address to check for
@ -76,23 +109,24 @@ class CoinAddress extends Base {
* Update a coin address record for a user and a currency
* @param userID int Account ID
* @param address string Coin Address
* @param ap_threshold float Threshold for auto payouts for this currency
* @param currency string Currency short handle, defaults to config option
* @return bool true or false
**/
public function update($userID, $address, $currency=NULL) {
public function update($userID, $address, $ap_threshold, $currency=NULL) {
if ($currency === NULL) $currency = $this->config['currency'];
if ($address != $this->getCoinAddress($userID) && $this->existsCoinAddress($address)) {
$this->setErrorMessage('Unable to update coin address, address already exists');
return false;
}
if ($this->getCoinAddress($userID) != NULL) {
$stmt = $this->mysqli->prepare("UPDATE " . $this->getTableName() . " SET coin_address = ? WHERE account_id = ? AND currency = ?");
if ( $this->checkStmt($stmt) && $stmt->bind_param('sis', $address, $userID, $currency) && $stmt->execute()) {
$stmt = $this->mysqli->prepare("UPDATE " . $this->getTableName() . " SET coin_address = ?, ap_threshold = ? WHERE account_id = ? AND currency = ?");
if ( $this->checkStmt($stmt) && $stmt->bind_param('sdis', $address, $ap_threshold, $userID, $currency) && $stmt->execute()) {
return true;
}
} else {
$stmt = $this->mysqli->prepare("INSERT INTO " . $this->getTableName() . " (coin_address, account_id, currency) VALUES (?, ?, ?)");
if ( $this->checkStmt($stmt) && $stmt->bind_param('sis', $address, $userID, $currency) && $stmt->execute()) {
$stmt = $this->mysqli->prepare("INSERT INTO " . $this->getTableName() . " (coin_address, ap_threshold, account_id, currency) VALUES (?, ?, ?, ?)");
if ( $this->checkStmt($stmt) && $stmt->bind_param('sdis', $address, $ap_threshold, $userID, $currency) && $stmt->execute()) {
return true;
}
}
@ -100,8 +134,7 @@ class CoinAddress extends Base {
}
}
$coin_address = new CoinAddress();
$coin_address = new CoinAddress($config);
$coin_address->setDebug($debug);
$coin_address->setConfig($config);
$coin_address->setMysql($mysqli);
$coin_address->setErrorCodes($aErrorCodes);

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);
}
/**
@ -85,5 +85,3 @@ class CoinBase extends Base {
}
}
}
?>

View File

@ -0,0 +1,11 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
/**
* We extend our CoinBase class
* No need to change anything, base class supports
* scrypt and sha256d
**/
class Coin extends CoinBase {
protected $target_bits = 16;
}

View File

@ -9,5 +9,3 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
class Coin extends CoinBase {
protected $target_bits = 16;
}
?>

View File

@ -12,5 +12,3 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
class Coin extends CoinBase {
protected $target_bits = 16;
}
?>

View File

@ -10,5 +10,3 @@ class Coin extends CoinBase {
protected $target_bits = 32;
protected $coin_value_precision = 20;
}
?>

View File

@ -10,5 +10,3 @@ class Coin extends CoinBase {
protected $target_bits = 24;
protected $share_difficulty_precision = 4;
}
?>

View File

@ -0,0 +1,11 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
/**
* We extend our CoinBase class
* No need to change anything, base class supports
* scrypt and sha256d
**/
class Coin extends CoinBase {
protected $target_bits = 24;
protected $share_difficulty_precision = 4;
}

View File

@ -0,0 +1,11 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
/**
* We extend our CoinBase class
* No need to change anything, base class supports
* scrypt and sha256d
**/
class Coin extends CoinBase {
protected $target_bits = 24;
protected $share_difficulty_precision = 4;
}

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;
}
/**
@ -104,4 +107,3 @@ $csrftoken->setUser($user);
$csrftoken->setToken($oToken);
$csrftoken->setConfig($config);
$csrftoken->setErrorCodes($aErrorCodes);
?>

View File

@ -111,4 +111,3 @@ class Debug {
// Instantiate this class
$debug = new Debug($log, $config['DEBUG']);
?>

View File

@ -139,4 +139,3 @@ $invitation->setUser($user);
$invitation->setToken($oToken);
$invitation->setConfig($config);
$invitation->setErrorCodes($aErrorCodes);
?>

View File

@ -0,0 +1,6 @@
<?php
interface IPushNotification {
public static function getName();
public static function getParameters();
public function notify($message, $severity, $event);
}

View File

@ -57,4 +57,3 @@ class Logger {
}
}
$log = new Logger($config);
?>

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;
@ -117,4 +109,3 @@ $mail->setSmarty($smarty);
$mail->setConfig($config);
$mail->setSetting($setting);
$mail->setErrorCodes($aErrorCodes);
?>

View File

@ -81,5 +81,3 @@ class MemcacheAntiDos
return $new;
}
}
?>

View File

@ -12,7 +12,7 @@ class Monitoring extends Base {
public function storeUptimeRobotStatus() {
if ($api_keys = $this->setting->getValue('monitoring_uptimerobot_api_keys')) {
$aJSONData = array();
$url = 'http://api.uptimerobot.com';
$url = 'https://api.uptimerobot.com';
$aMonitors = explode(',', $api_keys);
foreach ($aMonitors as $aData) {
$temp = explode('|', $aData);
@ -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
@ -131,7 +141,7 @@ class Monitoring extends Base {
$this->setErrorMessage('Failed to send mail notification');
}
if ($fatal) {
if ($exitCode != 0) $this->setStatus($cron_name . "_disabled", "yesno", 1);
if ($exitCode == 1) $this->setStatus($cron_name . "_disabled", "yesno", 1);
exit($exitCode);
}
}

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

@ -4,6 +4,17 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
class News extends Base {
protected $table = 'news';
/**
* We allow changing the database for shared accounts across pools
* Load the config on construct so we can assign the DB name
* @param config array MPOS configuration
* @return none
**/
public function __construct($config) {
$this->setConfig($config);
$this->table = $this->config['db']['shared']['news'] . '.' . $this->table;
}
/**
* Get activation status of post
* @param id int News ID
@ -96,9 +107,8 @@ class News extends Base {
}
}
$news = new News();
$news = new News($config);
$news->setDebug($debug);
$news->setMysql($mysqli);
$news->setUser($user);
$news->setErrorCodes($aErrorCodes);
?>

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');
}
@ -105,8 +107,9 @@ class Notification extends Mail {
**/
public function getNotificationAccountIdByType($strType) {
$this->debug->append("STA " . __METHOD__, 4);
$stmt = $this->mysqli->prepare("SELECT account_id FROM $this->tableSettings WHERE type = ? AND active = 1");
if ($stmt && $stmt->bind_param('s', $strType) && $stmt->execute() && $result = $stmt->get_result()) {
$stmt = $this->mysqli->prepare("SELECT account_id FROM $this->tableSettings WHERE type IN (?, ?) AND active = 1 GROUP BY account_id");
$notStrType = substr('push_'.$strType, 0, 15);
if ($stmt && $stmt->bind_param('ss', $strType, $notStrType) && $stmt->execute() && $result = $stmt->get_result()) {
return $result->fetch_all(MYSQLI_ASSOC);
}
return $this->sqlError('E0046');
@ -149,14 +152,28 @@ class Notification extends Mail {
return false;
}
// Check if this user wants strType notifications
$stmt = $this->mysqli->prepare("SELECT account_id FROM $this->tableSettings WHERE type = ? AND active = 1 AND account_id = ?");
if ($stmt && $stmt->bind_param('si', $strType, $account_id) && $stmt->execute() && $stmt->bind_result($id) && $stmt->fetch()) {
if ($stmt->close() && $this->sendMail('notifications/' . $strType, $aMailData) && $this->addNotification($account_id, $strType, $aMailData)) {
return true;
} else {
$this->setErrorMessage('SendMail call failed: ' . $this->getError());
return false;
}
$stmt = $this->mysqli->prepare("SELECT type FROM $this->tableSettings WHERE type IN (?, ?) AND active = 1 AND account_id = ?");
$notStrType = substr('push_'.$strType, 0, 15);
if ($stmt && $stmt->bind_param('ssi', $strType, $notStrType, $account_id) && $stmt->execute() && $result = $stmt->get_result()) {
$types = array_map(function($a){ return reset($a);}, $result->fetch_all(MYSQLI_ASSOC));
$stmt->close();
$result = true;
foreach ($types as $type){
if (strpos($type, 'push_') === 0){
if (PushNotification::Instance() instanceof PushNotification){
$result &= PushNotification::Instance()->sendNotification($account_id, $strType, $aMailData);
}
} else {
$result &= $this->sendMail('notifications/' . $strType, $aMailData);
}
}
if ($result){
$this->addNotification($account_id, $strType, $aMailData);
return true;
} else {
$this->setErrorMessage('SendMail call failed: ' . $this->getError());
return false;
}
} else {
$this->setErrorMessage('User disabled ' . $strType . ' notifications');
return true;
@ -173,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 {
@ -195,4 +212,3 @@ $notification->setSmarty($smarty);
$notification->setConfig($config);
$notification->setSetting($setting);
$notification->setErrorCodes($aErrorCodes);
?>

View File

@ -67,5 +67,3 @@ $oPayout->setMysql($mysqli);
$oPayout->setConfig($config);
$oPayout->setToken($oToken);
$oPayout->setErrorCodes($aErrorCodes);
?>

View File

@ -0,0 +1,42 @@
<?php
class Notifications_NotifyMyAndroid implements IPushNotification {
private $apiKey;
public function __construct($apikey){
$this->apiKey = $apikey;
}
static $priorities = array(
0 => 'info',
2 => 'error',
);
public static function getName(){
return "notifymyandroid.com";
}
public static function getParameters(){
return array(
'apikey' => 'API key',
);
}
public function notify($message, $severity = 'info', $event = null){
global $setting;
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://www.notifymyandroid.com/publicapi/notify",
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => http_build_query($data = array(
"apikey" => $this->apiKey,
"application" => $setting->getValue('website_title')?:"PHP-MPOS",
"description" => $message,
"content-type" => "text/html",
"event" => $event,
"priority" => array_search($severity, self::$priorities),
)),
));
curl_exec($ch);
curl_close($ch);
}
}

View File

@ -0,0 +1,46 @@
<?php
class Notifications_Pushover implements IPushNotification {
private $token;
private $user;
public function __construct($token, $user){
$this->token = $token;
$this->user = $user;
}
static $priorities = array(
0 => 'info',
1 => 'warning',
2 => 'error',
);
public static function getName(){
return "pushover.net";
}
public static function getParameters(){
return array(
'token' => 'API Token/Key',
'user' => 'Your User Key',
);
}
public function notify($message, $severity = 'info', $event = null){
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushover.net/1/messages.json",
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => http_build_query($data = array(
"token" => $this->token,
"user" => $this->user,
"message" => $code = strip_tags(preg_replace('/<([\/]?)span[^>]*>/i', '<\1b>', $message), "<b><i><u><a><font><p><br>"),
"title" => strip_tags($event),
"priority" => (int)array_search($severity, self::$priorities),
"timestamp" => time(),
"html" => preg_match('/<[^>]+>/', $code),
)),
));
curl_exec($ch);
curl_close($ch);
}
}

View File

@ -0,0 +1,171 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
class PushNotification extends Base {
var $tableSettings = 'push_notification_settings';
private static function getClassesInFile($file){
$classes = array();
$tokens = token_get_all(file_get_contents($file));
$count = count($tokens);
for ($i = 2; $i < $count; $i++) {
if ($tokens[$i - 2][0] == T_CLASS && $tokens[$i - 1][0] == T_WHITESPACE && $tokens[$i][0] == T_STRING) {
$class_name = $tokens[$i][1];
$classes[] = $class_name;
}
}
return $classes;
}
private static $classes = null;
public function getClasses(){
if (self::$classes === null){
$directory = new DirectoryIterator(__DIR__.'/push_notification');
foreach ($directory as $fileInfo) {
if (($fileInfo->getExtension() != 'php') || $fileInfo->isDot()) {
continue;
}
foreach (self::getClassesInFile($fileInfo->getRealPath()) as $class){
if (!class_exists($class)){
include $fileInfo->getRealPath();
}
$cr = new ReflectionClass($class);
if ($cr->isSubclassOf('IPushNotification')){
self::$classes[$class] = array($fileInfo->getFilename(), $cr->getMethod('getName')->invoke(null), $cr->getMethod('getParameters')->invoke(null));
}
}
}
}
return self::$classes;
}
public function getClassesForSmarty(){
$c = $this->getClasses();
return array_map(function($a, $b){
return array(
'class' => $b,
'file' => $a[0],
'name' => $a[1],
'parameters' => $a[2],
);
}, $c, array_keys($c));
}
/**
* @param string|array $notificator
* @param array $data
* @return IPushNotification|bool
*/
public function getNotificatorInstance($notificator, $data){
$class = null;
$file = null;
if (is_array($notificator)){
if (count($notificator) == 2){
list($class, $file) = $notificator;
} else {
$class = reset($notificator);
}
} else {
$class = $notificator;
}
if (!class_exists($class)){
if ($file === null){
foreach (self::getClasses() as $_class => $_info){
if ($_class == $class){
$file = $_info[0];
break;
}
}
} else {
include __DIR__.'/push_notification/'.$file;
}
if (!class_exists($class)){
return false;
}
}
$cr = new ReflectionClass($class);
$constructor = $cr->getConstructor();
$constructorParameters = array();
foreach (array_map(function($a){ return $a->getName();}, $constructor->getParameters()) as $param){
$constructorParameters[] = array_key_exists($param, $data)?$data[$param]:null;
}
$instance = $cr->newInstanceArgs($constructorParameters);
return $instance;
}
/**
* Update accounts push notification settings
* @param account_id int Account ID
* @param data array Data array
* @return bool
**/
public function updateSettings($account_id, $data) {
UserSettings::construct($account_id)->PushNotifications = $data;
return true;
}
/**
* Fetch notification settings for user account
* @param id int Account ID
* @return array Notification settings
**/
public function getNotificationSettings($account_id) {
if ($settings = UserSettings::construct($account_id)->PushNotifications){
return $settings;
}
return array(
'class' => false,
'params' => null,
'file' => null,
);
}
private static $instance = null;
/**
* @param PushNotification $instance
*/
public static function Instance($instance = null){
if (func_num_args() == 0){
return self::$instance;
}
return self::$instance = $instance;
}
public function sendNotification($account_id, $template, $aData){
$settings = $this->getNotificationSettings($account_id);
if ($settings['class']){
$instance = $this->getNotificatorInstance(array($settings['class'], $settings['file']), $settings['params']);
if ($instance){
$this->smarty->assign('WEBSITENAME', $this->setting->getValue('website_name'));
$this->smarty->assign('SUBJECT', $aData['subject']);
$this->smarty->assign('DATA', $aData);
$message = false;
foreach (array('/mail/push_notifications/', '/mail/notifications/') as $dir){
$this->smarty->clearCache($templateFile = TEMPLATE_DIR.$dir.$template.'.tpl');
try {
$message = $this->smarty->fetch($templateFile);
break;
} catch (SmartyException $e){
}
}
if ($message){
$instance->notify($message, 'info', $aData['subject']);
}
}
}
return true;
}
}
$pushnotification = PushNotification::Instance(new PushNotification());
$pushnotification->setDebug($debug);
$pushnotification->setLog($log);
$pushnotification->setMysql($mysqli);
$pushnotification->setSmarty($smarty);
$pushnotification->setConfig($config);
$pushnotification->setSetting($setting);
$pushnotification->setErrorCodes($aErrorCodes);

View File

@ -2,11 +2,6 @@
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
class RoundStats extends Base {
private $tableTrans = 'transactions';
private $tableStats = 'statistics_shares';
private $tableBlocks = 'blocks';
private $tableUsers = 'accounts';
/**
* Get next block for round stats
**/
@ -79,7 +74,7 @@ class RoundStats extends Base {
b.id, height, blockhash, amount, confirmations, difficulty, FROM_UNIXTIME(time) as time, shares,
IF(a.is_anonymous, 'anonymous', a.username) AS finder,
ROUND(difficulty * POW(2, 32 - " . $this->coin->getTargetBits() . "), 0) AS estshares,
(time - (SELECT time FROM $this->tableBlocks WHERE height < ? ORDER BY height DESC LIMIT 1)) AS round_time
(time - (SELECT time FROM " . $this->block->getTableName() . " WHERE height < ? ORDER BY height DESC LIMIT 1)) AS round_time
FROM " . $this->block->getTableName() . " as b
LEFT JOIN " . $this->user->getTableName() . " AS a ON b.account_id = a.id
WHERE b.height = ? LIMIT 1");

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
@ -927,4 +927,3 @@ $statistics->setConfig($config);
$statistics->setBitcoin($bitcoin);
$statistics->setErrorCodes($aErrorCodes);
$statistics->setCoin($coin);
?>

View File

@ -35,5 +35,3 @@ class mysqli_strict extends mysqli {
}
}
}
?>

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,17 +76,31 @@ 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)) {
return 'cryptorush';
} else if (preg_match('/mintpal.com/', $url)) {
return 'mintpal';
} else if (preg_match('/c-cex.com/', $url)) {
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;
@ -93,34 +111,58 @@ 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'];
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'];
break;
case 'bittrex':
case 'c-cex':
return @$aData['ticker']['lastprice'];
break;
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

@ -355,7 +355,7 @@ class Transaction extends Base {
SELECT
a.id,
a.username,
a.ap_threshold,
ca.ap_threshold,
ca.coin_address,
IFNULL(
(
@ -371,9 +371,9 @@ class Transaction extends Base {
ON t.account_id = a.id
LEFT JOIN " . $this->coin_address->getTableName() . " AS ca
ON ca.account_id = a.id
WHERE t.archived = 0 AND a.ap_threshold > 0 AND ca.coin_address IS NOT NULL AND ca.coin_address != '' AND ca.currency = ?
WHERE t.archived = 0 AND ca.ap_threshold > 0 AND ca.coin_address IS NOT NULL AND ca.coin_address != '' AND ca.currency = ?
GROUP BY t.account_id
HAVING confirmed > a.ap_threshold AND confirmed > " . $this->config['txfee_auto'] . "
HAVING confirmed > ca.ap_threshold AND confirmed > " . $this->config['txfee_auto'] . "
LIMIT ?");
if ($this->checkStmt($stmt) && $stmt->bind_param('si', $this->config['currency'], $limit) && $stmt->execute() && $result = $stmt->get_result())
return $result->fetch_all(MYSQLI_ASSOC);
@ -430,6 +430,7 @@ class Transaction extends Base {
$aMailData['email'] = $this->user->getUserEmailById($account_id);
$aMailData['subject'] = $type . ' Completed';
$aMailData['amount'] = $amount;
$aMailData['currency'] = $this->config['currency'];
if (!$this->notification->sendNotification($account_id, 'payout', $aMailData)) {
$this->setErrorMessage('Failed to send notification email to users address: ' . $aMailData['email'] . 'ERROR: ' . $this->notification->getCronError());
}
@ -446,7 +447,7 @@ class Transaction extends Base {
SELECT
a.id,
a.username,
a.ap_threshold,
ca.ap_threshold,
ca.coin_address,
p.id AS payout_id,
IFNULL(
@ -488,4 +489,3 @@ $transaction->setBlock($block);
$transaction->setUser($user);
$transaction->setPayout($oPayout);
$transaction->setErrorCodes($aErrorCodes);
?>

View File

@ -6,6 +6,17 @@ class User extends Base {
private $userID = false;
private $user = array();
/**
* We allow changing the database for shared accounts across pools
* Load the config on construct so we can assign the DB name
* @param config array MPOS configuration
* @return none
**/
public function __construct($config) {
$this->setConfig($config);
$this->table = $this->config['db']['shared']['accounts'] . '.' . $this->table;
}
// get and set methods
private function getHash($string, $version=0, $pepper='') {
switch($version) {
@ -20,6 +31,9 @@ class User extends Base {
public function getUserName($id) {
return $this->getSingle($id, 'username', 'id');
}
public function getUserNameAnon($id) {
return $this->getSingle($id, 'is_anonymous', 'id');
}
public function getUserNameByEmail($email) {
return $this->getSingle($email, 'username', 'email', 's');
}
@ -230,7 +244,7 @@ class User extends Base {
$notifs->setSetting($this->setting);
$notifs->setErrorCodes($this->aErrorCodes);
$ndata = $notifs->getNotificationSettings($uid);
if (@$ndata['success_login'] == 1) {
if ((array_key_exists('push_success_lo', $ndata) && $ndata['push_success_lo']) || (array_key_exists('success_login', $ndata) && $ndata['success_login'])){
// seems to be active, let's send it
$aDataN['username'] = $username;
$aDataN['email'] = $this->getUserEmail($username);
@ -278,6 +292,7 @@ class User extends Base {
count($aPin) == 1 ? $pin_hash = $this->getHash($pin, 0) : $pin_hash = $this->getHash($pin, $aPin[1], $aPin[2]);
$stmt = $this->mysqli->prepare("SELECT pin FROM $this->table WHERE id = ? AND pin = ? LIMIT 1");
if ($stmt->bind_param('is', $userId, $pin_hash) && $stmt->execute() && $stmt->bind_result($row_pin) && $stmt->fetch()) {
$stmt->close();
$this->setUserPinFailed($userId, 0);
return ($pin_hash === $row_pin);
}
@ -340,11 +355,11 @@ class User extends Base {
$this->debug->append("STA " . __METHOD__, 4);
$stmt = $this->mysqli->prepare("
SELECT
a.id, a.username, ca.coin_address AS coin_address, a.ap_threshold
a.id, a.username, ca.coin_address AS coin_address, ca.ap_threshold
FROM " . $this->getTableName() . " AS a
LEFT JOIN " . $this->coin_address->getTableName() . " AS ca
ON a.id = ca.account_id
WHERE ap_threshold > 0 AND ca.currency = ?
WHERE ca.ap_threshold > 0 AND ca.currency = ?
AND ca.coin_address IS NOT NULL
");
if ( $this->checkStmt($stmt) && $stmt->bind_param('s', $this->config['currency']) && $stmt->execute() && $result = $stmt->get_result()) {
@ -544,12 +559,12 @@ class User extends Base {
if ($email == 'hidden' || $email == NULL)
$email = $this->getUserEmailById($userID);
// We passed all validation checks so update the account
$stmt = $this->mysqli->prepare("UPDATE $this->table SET ap_threshold = ?, donate_percent = ?, email = ?, timezone = ?, is_anonymous = ? WHERE id = ?");
if ($this->checkStmt($stmt) && $stmt->bind_param('ddssii', $threshold, $donate, $email, $timezone, $is_anonymous, $userID) && $stmt->execute()) {
$stmt = $this->mysqli->prepare("UPDATE $this->table SET donate_percent = ?, email = ?, timezone = ?, is_anonymous = ? WHERE id = ?");
if ($this->checkStmt($stmt) && $stmt->bind_param('dssii', $donate, $email, $timezone, $is_anonymous, $userID) && $stmt->execute()) {
$this->log->log("info", $this->getUserName($userID)." updated their account details");
// Update coin address too
// Update coin address and ap_threshold if coin_address is set
if ($address) {
if ($this->coin_address->update($userID, $address)) {
if ($this->coin_address->update($userID, $address, $threshold)) {
return true;
}
} else {
@ -560,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;
}
@ -652,7 +667,7 @@ class User extends Base {
// Enforce a page reload and point towards login with referrer included, if supplied
$port = ($_SERVER["SERVER_PORT"] == "80" || $_SERVER["SERVER_PORT"] == "443") ? "" : (":".$_SERVER["SERVER_PORT"]);
$pushto = $_SERVER['SCRIPT_NAME'].'?page=login';
$location = (@$_SERVER['HTTPS'] == 'on') ? 'https://' . $_SERVER['SERVER_NAME'] . $port . $pushto : 'http://' . $_SERVER['SERVER_NAME'] . $port . $pushto;
$location = (@$_SERVER['HTTPS'] == 'on') ? 'https://' . $_SERVER['HTTP_HOST'] . $port . $pushto : 'http://' . $_SERVER['HTTP_HOST'] . $port . $pushto;
if (!headers_sent()) header('Location: ' . $location);
exit('<meta http-equiv="refresh" content="0; url=' . $location . '"/>');
}
@ -698,12 +713,14 @@ class User extends Base {
$stmt = $this->mysqli->prepare("
SELECT
id AS id, username, pin, api_key, is_admin, is_anonymous, email, timezone, no_fees,
IFNULL(donate_percent, '0') as donate_percent, ap_threshold
IFNULL(donate_percent, '0') as donate_percent
FROM " . $this->getTableName() . "
WHERE id = ? LIMIT 0,1");
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $userID) && $stmt->execute() && $result = $stmt->get_result()) {
$aData = $result->fetch_assoc();
$aData['coin_address'] = $this->coin_address->getCoinAddress($userID);
if (! $aData['ap_threshold'] = $this->coin_address->getAPThreshold($userID))
$aData['ap_threshold'] = 0;
$stmt->close();
return $aData;
}
@ -815,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)) {
@ -838,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;
}
@ -878,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;
}
@ -983,13 +1000,12 @@ public function isAuthenticated($logout=true) {
}
// Make our class available automatically
$user = new User();
$user = new User($config);
$user->setDebug($debug);
$user->setLog($log);
$user->setMysql($mysqli);
$user->setSalt($config['SALT']);
$user->setSmarty($smarty);
$user->setConfig($config);
$user->setMail($mail);
$user->setToken($oToken);
$user->setBitcoin($bitcoin);

View File

@ -0,0 +1,101 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
class UserSettings extends Base {
protected $table = 'user_settings';
private $__cache = array();
protected $account_id = null;
private $__lazyWrite;
public function __construct($account_id, $lazy_write = true){
$this->account_id = $account_id;
$this->__lazyWrite = $lazy_write;
if (is_callable(self::$__setup_callbacks)){
call_user_func(self::$__setup_callbacks, $this);
}
}
private static $__GetSTMT = null;
private static $__SetSTMT = null;
public function __destruct(){
if ($this->__lazyWrite){
foreach ($this->__cache as $name=>$value){
$this->_storeValue($name, $value);
}
}
}
private function _storeValue($name, $value){
if (empty(self::$__SetSTMT)){
self::$__SetSTMT = $this->mysqli->prepare('REPLACE INTO '.$this->table.' (`account_id`, `name`, `value`) VALUES (?, ?, ?)');
}
$val = serialize($value);
if (!(self::$__SetSTMT && self::$__SetSTMT->bind_param('iss', $this->account_id, $name, $val) && self::$__SetSTMT->execute())) {
$this->setErrorMessage($this->getErrorMsg('E0084', $this->table));
return $this->sqlError();
}
return true;
}
private function _getValue($name, $default = null){
if (empty(self::$__GetSTMT)){
self::$__GetSTMT = $this->mysqli->prepare('SELECT `value` FROM '.$this->table.' WHERE `account_id` = ? AND `name` = ? LIMIT 1');
}
if (self::$__GetSTMT && self::$__GetSTMT->bind_param('is', $this->account_id, $name) && self::$__GetSTMT->execute() && $result = self::$__GetSTMT->get_result()) {
if ($result->num_rows > 0) {
return unserialize($result->fetch_object()->value);
} else {
return $default;
}
}
$this->sqlError();
return $default;
}
public function __get($name){
if (!$this->__lazyWrite){
return $this->_getValue($name);
}
if (!array_key_exists($name, $this->__cache)){
$this->__cache[$name] = $this->_getValue($name);
}
return $this->__cache[$name];
}
public function __set($name, $value){
if (!$this->__lazyWrite){
$this->_storeValue($name, $value);
} else {
$this->__cache[$name] = $value;
}
}
private static $__setup_callbacks = null;
public static function setup($callback = null){
self::$__setup_callbacks = $callback;
}
private static $__lastInstanceId;
private static $__lastInstance;
/**
* @param int $account_id
* @param string $lazy_write
* @return UserSettings
*/
public static function construct($account_id, $lazy_write = true){
if ((self::$__lastInstanceId == $account_id) && (self::$__lastInstance instanceof UserSettings)){
return self::$__lastInstance;
}
self::$__lastInstanceId = $account_id;
return self::$__lastInstance = new self($account_id, $lazy_write);
}
}
UserSettings::setup(function($instance)use($debug, $log, $mysqli, $aErrorCodes){
$instance->setDebug($debug);
$instance->setLog($log);
$instance->setMysql($mysqli);
$instance->setErrorCodes($aErrorCodes);
});

View File

@ -4,6 +4,17 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
class Worker extends Base {
protected $table = 'pool_worker';
/**
* We allow changing the database for shared accounts across pools
* Load the config on construct so we can assign the DB name
* @param config array MPOS configuration
* @return none
**/
public function __construct($config) {
$this->setConfig($config);
$this->table = $this->config['db']['shared']['workers'] . '.' . $this->table;
}
/**
* Update worker list for a user
* @param account_id int User ID
@ -113,8 +124,7 @@ class Worker extends Base {
) AS shares
FROM $this->table AS w
WHERE id = ?");
if ($this->checkStmt($stmt) && $stmt->bind_param('iiiii', $interval, $interval, $interval, $interval, $id) && $stmt->execute() && $result = $stmt->get_result()) {
$row = $result->fetch_assoc();
if ($this->checkStmt($stmt) && $stmt->bind_param('iiiii', $interval, $interval, $interval, $interval, $id) && $stmt->execute() && ($result = $stmt->get_result()) && ($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);
@ -164,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;
}
@ -294,13 +304,11 @@ class Worker extends Base {
}
}
$worker = new Worker();
$worker = new Worker($config);
$worker->setDebug($debug);
$worker->setMysql($mysqli);
$worker->setMemcache($memcache);
$worker->setShare($share);
$worker->setConfig($config);
$worker->setUser($user);
$worker->setErrorCodes($aErrorCodes);
$worker->setCoin($coin);
?>

View File

@ -97,6 +97,13 @@ $aSettings['website'][] = array(
'name' => 'website_notification_autohide', 'value' => $setting->getValue('website_notification_autohide'),
'tooltip' => 'Hides Notifications after 5 seconds.'
);
$aSettings['website'][] = array(
'display' => 'Disable Block Notification Sound', 'type' => 'select',
'options' => array( 0 => 'Do not notify', 1 => 'Notify when Block is found' ),
'default' => 0,
'name' => 'website_blockfinder_notification', 'value' => $setting->getValue('website_blockfinder_notification'),
'tooltip' => 'Enable/Disable Blockfinder Sound.'
);
$aSettings['blockchain'][] = array(
'display' => 'Disable Blockexplorer', 'type' => 'select',
'options' => array( 0 => 'No', 1 => 'Yes' ),
@ -146,6 +153,13 @@ $aSettings['wallet'][] = array(
'name' => 'wallet_cold_coins', 'value' => $setting->getValue('wallet_cold_coins'),
'tooltip' => 'Amount of coins held in a pools cold wallet.'
);
$aSettings['wallet'][] = array(
'display' => 'Transaction Limit', 'type' => 'text',
'size' => 6,
'default' => 25,
'name' => 'wallet_transaction_limit', 'value' => $setting->getValue('wallet_transaction_limit'),
'tooltip' => 'Maximum amount of transactions to list in Admin Wallet Info.'
);
$aSettings['statistics'][] = array(
'display' => 'Ajax Refresh Interval', 'type' => 'select',
'options' => array('5' => '5', '10' => '10', '15' => '15', '30' => '30', '60' => '60' ),
@ -190,21 +204,21 @@ $aSettings['statistics'][] = array(
);
$aSettings['statistics'][] = array(
'display' => 'Pool Hashrate Modifier', 'type' => 'select',
'options' => array( '1' => 'KH/s', '0.001' => 'MH/s', '0.000001' => 'GH/s', '0.000000001' => 'TH/s' ),
'options' => array( '1' => 'KH/s', '0.001' => 'MH/s', '0.000001' => 'GH/s', '0.000000001' => 'TH/s', '0.000000000001' => 'PH/s', '0.000000000000001' => 'EH/s' ),
'default' => '1',
'name' => 'statistics_pool_hashrate_modifier', 'value' => $setting->getValue('statistics_pool_hashrate_modifier'),
'tooltip' => 'Auto-adjust displayed pool hashrates to a certain limit.'
);
$aSettings['statistics'][] = array(
'display' => 'Network Hashrate Modifier', 'type' => 'select',
'options' => array( '1' => 'KH/s', '0.001' => 'MH/s', '0.000001' => 'GH/s', '0.000000001' => 'TH/s' ),
'options' => array( '1' => 'KH/s', '0.001' => 'MH/s', '0.000001' => 'GH/s', '0.000000001' => 'TH/s', '0.000000000001' => 'PH/s', '0.000000000000001' => 'EH/s' ),
'default' => '1',
'name' => 'statistics_network_hashrate_modifier', 'value' => $setting->getValue('statistics_network_hashrate_modifier'),
'tooltip' => 'Auto-adjust displayed network hashrates to a certain limit.'
);
$aSettings['statistics'][] = array(
'display' => 'Personal Hashrate Modifier', 'type' => 'select',
'options' => array( '1' => 'KH/s', '0.001' => 'MH/s', '0.000001' => 'GH/s', '0.000000001' => 'TH/s' ),
'options' => array( '1' => 'KH/s', '0.001' => 'MH/s', '0.000001' => 'GH/s', '0.000000001' => 'TH/s', '0.000000000001' => 'PH/s', '0.000000000000001' => 'EH/s' ),
'default' => '1',
'name' => 'statistics_personal_hashrate_modifier', 'value' => $setting->getValue('statistics_personal_hashrate_modifier'),
'tooltip' => 'Auto-adjust displayed personal hashrates to a certain limit.'
@ -224,6 +238,20 @@ $aSettings['statistics'][] = array(
'name' => 'statistics_analytics_code', 'value' => $setting->getValue('statistics_analytics_code'),
'tooltip' => '.'
);
$aSettings['acl'][] = array(
'display' => 'Show Stats for logged in users only', 'type' => 'select',
'options' => array( 0 => 'No', 1 => 'Yes' ),
'default' => 0,
'name' => 'acl_show_stats_loggedin', 'value' => $setting->getValue('acl_show_stats_loggedin'),
'tooltip' => 'Should statistics be visible for logged in users only.'
);
$aSettings['acl'][] = array(
'display' => 'Show Help for logged in users only', 'type' => 'select',
'options' => array( 0 => 'No', 1 => 'Yes' ),
'default' => 0,
'name' => 'acl_show_help_loggedin', 'value' => $setting->getValue('acl_show_help_loggedin'),
'tooltip' => 'Should Help Page be visible for logged in users only.'
);
$aSettings['acl'][] = array(
'display' => 'Hide news post author', 'type' => 'select',
'options' => array( 0 => 'No', 1 => 'Yes' ),

View File

@ -78,4 +78,6 @@ $aErrorCodes['E0079'] = 'Wallet does not cover payouts total amount';
$aErrorCodes['E0080'] = 'No new unaccounted shares since last run';
$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.0';
$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,18 +47,35 @@ $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';
$config['db']['pass'] = 'somepass';
$config['db']['port'] = 3306;
$config['db']['name'] = 'mpos';
// Disabled by default and set in bootstrap if unset, but left in here so
// people know it exists
// $config['db']['shared']['accounts'] = $config['db']['name'];
// $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';
@ -68,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';
@ -83,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';
@ -93,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;
@ -111,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;
@ -161,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;
@ -171,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;
@ -192,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;
@ -200,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;
@ -209,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';
@ -227,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;
@ -242,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;
@ -250,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';
@ -259,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';
@ -275,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'] = '';
@ -286,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;
@ -294,8 +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

@ -4,4 +4,3 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
define('STATISTICS_ALL_USER_SHARES', 'STATISTICS_ALL_USER_SHARES');
define('STATISTICS_ALL_USER_HASHRATES', 'STATISTICS_ALL_USER_HASHRATES');
define('STATISTICS_ROUND_SHARES', 'STATISTICS_ROUND_SHARES');
?>

View File

@ -11,5 +11,3 @@ switch ($config['payout_system']) {
}
$aMonitorCrons = array('statistics','tickerupdate','notifications','tables_cleanup','findblock',$sPayoutSystem,'blockupdate','payouts');
?>

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,9 +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');
}
@ -17,5 +18,3 @@ if ($mysqli->query('/* MYSQLND_MS_MASTER_SWITCH */SELECT @@global.read_only AS r
if (mysqli_connect_errno()) {
die("Failed to connect to database");
}
?>

View File

@ -3091,4 +3091,3 @@ class _MarkdownExtra_TmpImpl extends \Michelf\Markdown {
}
}
?>

View File

@ -35,6 +35,3 @@ class MarkdownExtra extends \Michelf\_MarkdownExtra_TmpImpl {
# See note above.
}
?>

View File

@ -1,277 +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

@ -532,5 +532,3 @@ function word_reverse($str) {
}
return $ret;
}
?>

View File

@ -31,4 +31,3 @@ function check_acl_access($params, $smarty)
break;
}
}
?>

View File

@ -687,7 +687,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
protected function getRandomId()
{
$idLeft = md5(getmypid() . '.' . time() . '.' . uniqid(mt_rand(), true));
$idRight = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'swift.generated';
$idRight = !empty($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'swift.generated';
$id = $idLeft . '@' . $idRight;
try {

View File

@ -477,10 +477,10 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
/** Try to determine the hostname of the server this is run on */
private function _lookupHostname()
{
if (!empty($_SERVER['SERVER_NAME'])
&& $this->_isFqdn($_SERVER['SERVER_NAME']))
if (!empty($_SERVER['HTTP_HOST'])
&& $this->_isFqdn($_SERVER['HTTP_HOST']))
{
$this->_domain = $_SERVER['SERVER_NAME'];
$this->_domain = $_SERVER['HTTP_HOST'];
} elseif (!empty($_SERVER['SERVER_ADDR'])) {
$this->_domain = sprintf('[%s]', $_SERVER['SERVER_ADDR']);
}

View File

@ -3,4 +3,3 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
// Tempalte specifics
$smarty->assign("CONTENT", "default.tpl");
?>

View File

@ -3,4 +3,3 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
// Tempalte specifics
$smarty->assign("CONTENT", "default.tpl");
?>

View File

@ -5,4 +5,3 @@ if ($user->isAuthenticated()) {
// Tempalte specifics
$smarty->assign("CONTENT", "default.tpl");
}
?>

View File

@ -19,5 +19,3 @@ if ($user->isAuthenticated() AND !$setting->getValue('disable_transactionsummary
} else {
$smarty->assign('CONTENT', 'disabled.tpl');
}
?>

View File

@ -103,7 +103,7 @@ if ($user->isAuthenticated()) {
} else if ($config['twofactor']['enabled'] && $config['twofactor']['options']['withdraw'] && !$wf_editable) {
$_SESSION['POPUP'][] = array('CONTENT' => 'You have not yet unlocked account withdrawls.', 'TYPE' => 'alert alert-danger');
} else if ($aBalance['confirmed'] < $config['mp_threshold']) {
$_SESSION['POPUP'][] = array('CONTENT' => 'Payout must be greater or equal than ' . $config['mp_threshold'] . '.', 'TYPE' => 'info');
$_SESSION['POPUP'][] = array('CONTENT' => 'Account balance must be >= ' . $config['mp_threshold'] . ' to do a Manual Payout.', 'TYPE' => 'alert alert-warning');
} else if (!$coin_address->getCoinAddress($_SESSION['USERDATA']['id'])) {
$_SESSION['POPUP'][] = array('CONTENT' => 'You have no payout address set.', 'TYPE' => 'alert alert-danger');
} else {
@ -206,4 +206,3 @@ $smarty->assign("DONATE_THRESHOLD", $config['donate_threshold']);
// Tempalte specifics
$smarty->assign("CONTENT", "default.tpl");
?>

View File

@ -24,4 +24,3 @@ if ($user->isAuthenticated()) {
}
}
$smarty->assign('CONTENT', 'default.tpl');
?>

View File

@ -8,7 +8,25 @@ if ($user->isAuthenticated()) {
} else {
if (@$_REQUEST['do'] == 'save') {
if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
if ($notification->updateSettings($_SESSION['USERDATA']['id'], $_REQUEST['data'])) {
$pushSettings = array(
'class' => $_REQUEST['pushnotification-class'],
'params' => null,
'file' => null,
);
if ($pushSettings['class'] && array_key_exists($pushSettings['class'], $_REQUEST['pushnotification'])){
$pushSettings['params'] = $_REQUEST['pushnotification'][$pushSettings['class']];
}
if ($pushSettings['class']){
$c = $pushnotification->getClasses();
if (array_key_exists($pushSettings['class'], $c)){
$pushSettings['file'] = $c[$pushSettings['class']][0];
}
}
if (!$pushnotification->updateSettings($_SESSION['USERDATA']['id'], $pushSettings)){
$_SESSION['POPUP'][] = array('CONTENT' => $pushnotification->getError(), 'TYPE' => 'alert alert-danger');
}elseif ($notification->updateSettings($_SESSION['USERDATA']['id'], $_REQUEST['data'])) {
$_SESSION['POPUP'][] = array('CONTENT' => 'Updated notification settings', 'TYPE' => 'alert alert-success');
} else {
$_SESSION['POPUP'][] = array('CONTENT' => $notification->getError(), 'TYPE' => 'alert alert-danger');
@ -29,11 +47,13 @@ if ($user->isAuthenticated()) {
// Fetch user notification settings
$aSettings = $notification->getNotificationSettings($_SESSION['USERDATA']['id']);
$aPushSettings = $pushnotification->getNotificationSettings($_SESSION['USERDATA']['id']);
$aSmartyClasses = $pushnotification->getClassesForSmarty();
$smarty->assign('NOTIFICATIONS', $aNotifications);
$smarty->assign('PUSHNOTIFICATIONS', $aSmartyClasses);
$smarty->assign('PUSHSETTINGS', $aPushSettings);
$smarty->assign('SETTINGS', $aSettings);
$smarty->assign('CONTENT', 'default.tpl');
}
}
?>

View File

@ -12,4 +12,3 @@ case '1':
$smarty->assign("CONTENT", "");
break;
}
?>

View File

@ -6,9 +6,8 @@ if ($user->isAuthenticated()) {
$user->setUserFailed($_SESSION['USERDATA']['id'], 0);
$port = ($_SERVER["SERVER_PORT"] == "80" || $_SERVER["SERVER_PORT"] == "443") ? "" : (":".$_SERVER["SERVER_PORT"]);
$pushto = $_SERVER['SCRIPT_NAME'].'?page=dashboard';
$location = (@$_SERVER['HTTPS'] == 'on') ? 'https://' . $_SERVER['SERVER_NAME'] . $port . $pushto : 'http://' . $_SERVER['SERVER_NAME'] . $port . $pushto;
$location = (@$_SERVER['HTTPS'] == 'on') ? 'https://' . $_SERVER['HTTP_HOST'] . $port . $pushto : 'http://' . $_SERVER['HTTP_HOST'] . $port . $pushto;
header("Location: " . $location);
}
// Somehow we still need to load this empty template
$smarty->assign("CONTENT", "empty");
?>

View File

@ -15,4 +15,3 @@ if ($user->isAuthenticated()) {
$smarty->assign('DISABLE_TRANSACTIONSUMMARY', $setting->getValue('disable_transactionsummary'));
}
$smarty->assign('CONTENT', 'default.tpl');
?>

View File

@ -15,5 +15,3 @@ if (!isset($_GET['token']) || empty($_GET['token'])) {
}
}
$smarty->assign('CONTENT', 'default.tpl');
?>

View File

@ -55,6 +55,3 @@ if ($user->isAuthenticated()) {
$smarty->assign('CONTENT', 'default.tpl');
}
}
?>

View File

@ -9,4 +9,3 @@ if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
// Tempalte specifics
$smarty->assign("CONTENT", "");
?>

View File

@ -0,0 +1,55 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
// check if daemon can connect -> error
try {
if ($bitcoin->can_connect() !== true) {
$newerror = array();
$newerror['name'] = "Coin daemon";
$newerror['level'] = 3;
$newerror['description'] = "Unable to connect to coin daemon using provided credentials.";
$newerror['configvalue'] = "wallet.*";
$newerror['extdesc'] = "We weren't able to connect to your coin daemon using the host/username/password/port given in the config. Check that your coin daemon is running and mpos is configured with the data from your coin daemon config. Your coin daemon may also not yet be fully synced.";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc";
$error[] = $newerror;
$newerror = null;
} else {
// validate that the wallet service is not in test mode
if ($bitcoin->is_testnet() == true) {
$newerror = array();
$newerror['name'] = "Coin daemon";
$newerror['level'] = 3;
$newerror['extdesc'] = "You may have accidentally mistyped the port, or are running the coin daemon in testnet mode. Check your coin daemon config and MPOS config.";
$newerror['description'] = "The coin daemon service is running as a testnet. Check the TESTNET setting in your coin daemon config and make sure the correct port is set in the MPOS config.";
$newerror['configvalue'] = "wallet.host";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc";
$error[] = $newerror;
$newerror = null;
}
// Check if chain is currently downloading
if ($dDownloadPercentage = $bitcoin->getblockchaindownload()) {
$newerror = array();
$newerror['name'] = "Coin daemon";
$newerror['level'] = 1;
$newerror['extdesc'] = "Your coin daemon is currently downloading the blockchain. Your miners won't be able to connect until this is completed.";
$newerror['description'] = "Blockchain download progress is at an estimated $dDownloadPercentage%. It may take a while to complete.";
$newerror['configvalue'] = "wallet.host";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc";
$error[] = $newerror;
$newerror = null;
}
// check if there is more than one account set on wallet
$accounts = $bitcoin->listaccounts();
if (count($accounts) > 1 && $accounts[''] <= 0) {
$newerror = array();
$newerror['name'] = "Coin daemon";
$newerror['level'] = 3;
$newerror['extdesc'] = "You need at least one account to be able to pay miners! Your coin daemon may not yet be fully synced, see the above link for more details.";
$newerror['description'] = "There are " . count($accounts) . " Accounts set in local Wallet and Default Account has no liquid funds to pay your miners!";
$newerror['configvalue'] = "wallet.host";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc";
$error[] = $newerror;
$newerror = null;
}
}
} catch (Exception $e) {}

View File

@ -0,0 +1,15 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
// check if fees are 0 and ap/mp tx fees are also set to 0 -> issue #2424
if ($config['fees'] == 0 && ($config['txfee_auto'] == 0 || $config['txfee_manual'] == 0)) {
$newerror = array();
$newerror['name'] = "Fees and TX Fees 0";
$newerror['level'] = 2;
$newerror['extdesc'] = "This is an issue that can only occur with both your fees set to 0 and auto or manual tx fees set to 0 as well. It's best to avoid it if possible though, as it can prevent payouts; set the txfee to a small amount to avoid this.";
$newerror['description'] = "Having your pool fees set to 0 and tx fees also set to 0 can cause a problem where the wallet cannot payout, consider setting the txfee to a very low amount, ie. 0.0001 to avoid this.";
$newerror['configvalue'] = "fees";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/issues/2424";
$error[] = $newerror;
$newerror = null;
}

View File

@ -0,0 +1,67 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
// check if memcache isn't available but enabled in config -> error
if (!class_exists('Memcached') && $config['memcache']['enabled']) {
$newerror = array();
$newerror['name'] = "Memcache Config";
$newerror['level'] = 3;
$newerror['extdesc'] = "Memcache is a service that you run that lets us cache commonly used data and access it quickly. It's highly recommended you <a href='https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#requirements-1'>install the service and php packages</a> for your distro.";
$newerror['description'] = "You have memcached enabled in your config and it's not available as a PHP module. Install the package on your system.";
$newerror['configvalue'] = "memcache.enabled";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-memcache";
$error[] = $newerror;
$newerror = null;
}
// if it's not enabled, test it if it exists, if it works -> error tell them to enable, -> otherwise notice it's disabled
if (!$config['memcache']['enabled']) {
if (PHP_OS == 'WINNT') {
require_once(CLASS_DIR . 'memcached.class.php');
}
if (class_exists('Memcached')) {
$memcache_test = @new Memcached();
if ($config['memcache']['sasl'] === true) {
$memcache_test->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
$memcache_test->setSaslAuthData($config['memcache']['sasl']['username'], $config['memcache']['sasl']['password']);
}
$memcache_test_add = @$memcache_test->addServer($config['memcache']['host'], $config['memcache']['port']);
$randmctv = rand(5,10);
$memcache_test_set = @$memcache_test->set('test_mpos_setval', $randmctv);
$memcache_test_get = @$memcache_test->get('test_mpos_setval');
}
if (class_exists('Memcached') && $memcache_test_get == $randmctv) {
$newerror = array();
$newerror['name'] = "Memcache Config";
$newerror['level'] = 2;
$newerror['extdesc'] = "Memcache is a service that you run that lets us cache commonly used data and access it quickly. It's highly recommended you <a href='https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#requirements-1'>install the service and php packages</a> for your distro.";
$newerror['description'] = "You have memcache disabled in the config but it's available and works! Enable it for best performance.";
$newerror['configvalue'] = "memcache.enabled";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-memcache";
$error[] = $newerror;
$newerror = null;
} else {
$newerror = array();
$newerror['name'] = "Memcache Config";
$newerror['level'] = 2;
$newerror['extdesc'] = "Memcache is a service that you run that lets us cache commonly used data and access it quickly. It's highly recommended you <a href='https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#requirements-1'>install the service and php packages</a> for your distro.";
$newerror['description'] = "Memcache is disabled; Almost every linux distro has packages for it, you should be using it if you can.";
$newerror['configvalue'] = "memcache.enabled";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-memcache";
$error[] = $newerror;
$newerror = null;
}
}
// check anti DOS protection, we need memcache for that
if ($config['mc_antidos'] && !$config['memcache']['enabled']) {
$newerror = array();
$newerror['name'] = "Memcache Config";
$newerror['level'] = 3;
$newerror['extdesc'] = "Memcache is a service that you run that lets us cache commonly used data and access it quickly. It's highly recommended you <a href='https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#requirements-1'>install the service and php packages</a> for your distro.";
$newerror['description'] = "mc_antidos is enabled and memcache is not, <u>memcache is required</u> to use this.";
$newerror['configvalue'] = "memcache.enabled";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#memcache-rate-limiting";
$error[] = $newerror;
$newerror = null;
}

View File

@ -0,0 +1,55 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
if ($config['logging']['enabled']) {
// checks to see that the logging path is writable
if (!is_writable($config['logging']['path'])) {
$newerror = array();
$newerror['name'] = "Log path permissions";
$newerror['level'] = 3;
$newerror['extdesc'] = "In order to log data, we need to be able to write in the logs folder. See the link above for more details.";
$newerror['description'] = "Logging is enabled but we can't write in the logfile path.";
$newerror['configvalue'] = "logging.path";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#configuration-1";
$error[] = $newerror;
$newerror = null;
}
}
// check if we can write templates/cache and templates/compile -> error
if (!is_writable(TEMPLATE_DIR . '/cache')) {
$newerror = array();
$newerror['name'] = "templates/cache permissions";
$newerror['level'] = 3;
$newerror['extdesc'] = "In order to cache template data, we need to be able to write in the templates/cache folder. See the link above for more details.";
$newerror['description'] = "templates/cache folder is not writable for uid {$apache_user['name']}";
$newerror['configvalue'] = "templates/cache folder";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#folder-permissions";
$error[] = $newerror;
$newerror = null;
}
if (!is_writable(TEMPLATE_DIR . '/compile')) {
$newerror = array();
$newerror['name'] = "templates/compile permissions";
$newerror['level'] = 3;
$newerror['extdesc'] = "In order to cache compiled template data, we need to be able to write in the templates/compile folder. See the link above for more details.";
$newerror['description'] = "templates/compile folder is not writable for uid {$apache_user['name']}";
$newerror['configvalue'] = "templates/compile folder";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#folder-permissions";
$error[] = $newerror;
$newerror = null;
}
// check if we can write the config files, we should NOT be able to -> error
if (is_writable(INCLUDE_DIR.'/config/global.inc.php') || is_writable(INCLUDE_DIR.'/config/global.inc.dist.php') ||
is_writable(INCLUDE_DIR.'/config/security.inc.php') || is_writable(INCLUDE_DIR.'/config/security.inc.dist.php')) {
$newerror = array();
$newerror['name'] = "Config permissions";
$newerror['level'] = 2;
$newerror['extdesc'] = "For security purposes, the user your webserver runs as should not be able to write to the config files, only read from them. To fix this, check the ownership and permissions of the include/config files.";
$newerror['description'] = "Your config files <b>SHOULD NOT be writable by this user</b>!";
$newerror['configvalue'] = "global.inc.php and security.inc.php";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#configuration-1";
$error[] = $newerror;
$newerror = null;
}

View File

@ -0,0 +1,33 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
// check if password salts are sane
if (strlen($config['SALT']) < 24 || strlen($config['SALTY']) < 24 || $config['SALT'] == 'PLEASEMAKEMESOMETHINGRANDOM' || $config['SALTY'] == 'THISSHOULDALSOBERRAANNDDOOM') {
$newerror = array();
$newerror['name'] = "Password Salts";
$newerror['level'] = 2;
$newerror['extdesc'] = "Salts are important because they add a random element and 'padding' to passwords and other hashed strings. They should be changed from the default and should not be too short for increased security.";
if ($config['SALT'] == 'PLEASEMAKEMESOMETHINGRANDOM' || $config['SALTY'] == 'THISSHOULDALSOBERRAANNDDOOM') {
$newerror['description'] = "You absolutely <u>SHOULD NOT leave your SALT or SALTY default</u> changing them will require registering again.";
} else {
$newerror['description'] = "SALT or SALTY is too short, they should be more than 24 characters and changing them will require registering again.</p>";
}
$newerror['configvalue'] = "SALT";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-defines--salts";
$error[] = $newerror;
$newerror = null;
}
// check if htaccess exists
if (!file_exists(BASEPATH.".htaccess")) {
$newerror = array();
$newerror['name'] = ".htaccess";
$newerror['level'] = 2;
$newerror['extdesc'] = ".htaccess files let you control who/how files are accessed for Apache. If you're using Apache for MPOS, you should be using .htaccess.";
$htaccess_link = "<a href='https://github.com/MPOS/php-mpos/blob/next/public/.htaccess'>.htaccess</a>";
$newerror['description'] = "You don't seem to have a .htaccess in your public folder, if you're using Apache set it up: $htaccess_link";
$newerror['configvalue'] = ".htaccess";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki";
$error[] = $newerror;
$newerror = null;
}

View File

@ -0,0 +1,40 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
// poke stratum using gettingstarted details -> enotice
if (function_exists('socket_create')) {
$host = @gethostbyname($config['gettingstarted']['stratumurl']);
$port = $config['gettingstarted']['stratumport'];
if (isset($host) and
isset($port) and
($socket=socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) and
(socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => 3, 'usec' => 0))) and
(@socket_connect($socket, $host, $port)))
{
socket_close($socket);
} else {
$newerror = array();
$newerror['name'] = "Stratum information";
$newerror['level'] = 1;
$newerror['extdesc'] = "We tried to connect the stratum server that you set in your gettingstarted config, but an error occured somewhere along the way. Your stratum server may not be running currently, your firewall could be blocking the connection, or your coin daemon may not yet be fully synced, etc.";
$newerror['description'] = "We tried to poke your Stratum server using your \$config['gettingstarted'] settings but it didn't respond - " . socket_strerror(socket_last_error()) . ".";
$newerror['configvalue'] = "gettingstarted";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-getting-started";
$error[] = $newerror;
$newerror = null;
}
} else {
// Connect via fsockopen as fallback
if (! $fp = @fsockopen($config['gettingstarted']['stratumurl'], $config['gettingstarted']['stratumport'], $errCode, $errStr, 1)) {
$newerror = array();
$newerror['name'] = "Stratum information";
$newerror['level'] = 1;
$newerror['extdesc'] = "We tried to connect the stratum server that you set in your gettingstarted config, but an error occured somewhere along the way. Your stratum server may not be running currently, your firewall could be blocking the connection, or your coin daemon may not yet be fully synced, etc.";
$newerror['description'] = "We tried to poke your Stratum server using your \$config['gettingstarted'] settings but it didn't respond.";
$newerror['configvalue'] = "gettingstarted";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-getting-started";
$error[] = $newerror;
$newerror = null;
}
@fclose($fp);
}

View File

@ -18,4 +18,3 @@ if ($user->isAuthenticated()) {
}
$smarty->assign('CONTENT', 'default.tpl');
?>

View File

@ -21,4 +21,3 @@ if (!$setting->getValue('disable_invitations')) {
// Tempalte specifics
$smarty->assign("CONTENT", "default.tpl");
?>

View File

@ -26,4 +26,3 @@ $smarty->assign("CRONSTATUS", $aCronStatus);
// Tempalte specifics
$smarty->assign("CONTENT", "default.tpl");
?>

View File

@ -46,4 +46,3 @@ foreach ($aNews as $key => $aData) {
}
$smarty->assign("NEWS", $aNews);
$smarty->assign("CONTENT", "default.tpl");
?>

View File

@ -24,4 +24,3 @@ if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->val
$aNews = $news->getEntry($_REQUEST['id']);
$smarty->assign("NEWS", $aNews);
$smarty->assign("CONTENT", "default.tpl");
?>

View File

@ -38,4 +38,3 @@ if ($setting->getValue('notifications_disable_pool_newsletter', 0) == 1) {
}
$smarty->assign("CONTENT", "default.tpl");
}
?>

Some files were not shown because too many files have changed in this diff Show More