From b5cfd0e90bedf5d2a049d16d39bcc78cafac3251 Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Sun, 3 Dec 2017 03:10:35 +0000 Subject: [PATCH 01/69] Fixed statistics graphs --- templates/bootstrap/statistics/graphs/default.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/bootstrap/statistics/graphs/default.tpl b/templates/bootstrap/statistics/graphs/default.tpl index b2007f715..95261fccb 100644 --- a/templates/bootstrap/statistics/graphs/default.tpl +++ b/templates/bootstrap/statistics/graphs/default.tpl @@ -2,7 +2,7 @@ $(function () { var hashChart = Morris.Line({ element: 'hashrate-area-chart', - data: {$YOURMININGSTATS}, + data: {$YOURMININGSTATS nofilter}, xkey: 'time', ykeys: ['hashrate'], labels: ['Hashrate'], @@ -17,7 +17,7 @@ $(function () { var workersChart = Morris.Line({ element: 'workers-area-chart', - data: {$YOURMININGSTATS}, + data: {$YOURMININGSTATS nofilter}, xkey: 'time', ykeys: ['workers'], labels: ['Workers'], @@ -32,7 +32,7 @@ $(function () { var shareCharts= Morris.Line({ element: 'sharerate-area-chart', - data: {$YOURMININGSTATS}, + data: {$YOURMININGSTATS nofilter}, xkey: 'time', ykeys: ['sharerate'], labels: ['Sharerate'], From 064ab5ac836a1e6b87009a57df0d13ee99439146 Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Fri, 8 Dec 2017 15:53:56 +0000 Subject: [PATCH 02/69] No need for composer.lock to be versioned --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f7530209a..5986fa6fe 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,7 @@ tests/_output/* # NetBeans Project Directory -/nbproject/* \ No newline at end of file +/nbproject/* + +# No need for composer.lock +composer.lock \ No newline at end of file From 52c3e2ff930e453d7a90c25c41bdfff2b9681345 Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Fri, 8 Dec 2017 22:53:15 +0000 Subject: [PATCH 03/69] Implemented Read/Write Mysql Split (Master for writes, Slave for reads) --- include/autoloader.inc.php | 1 + include/classes/mysqlims.class.php | 85 ++++++++++++++++++++++++++++++ include/config/global.inc.dist.php | 12 +++++ include/database.inc.php | 9 ++-- 4 files changed, 103 insertions(+), 4 deletions(-) create mode 100644 include/classes/mysqlims.class.php diff --git a/include/autoloader.inc.php b/include/autoloader.inc.php index 2cc2c64a0..e7a260bb6 100644 --- a/include/autoloader.inc.php +++ b/include/autoloader.inc.php @@ -9,6 +9,7 @@ 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'); diff --git a/include/classes/mysqlims.class.php b/include/classes/mysqlims.class.php new file mode 100644 index 000000000..e78fb534b --- /dev/null +++ b/include/classes/mysqlims.class.php @@ -0,0 +1,85 @@ +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']); + } + } 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']); + } + } + + if ($this->mysqliW->connect_errno) { + throw new Exception("Failed to connect to MySQL: (".$this->mysqliW->connect_errno.") ".$this->mysqliW->connect_error); + } + + if ($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 && $this->mysqliR !== null) { + return $this->mysqliR->prepare($query); + } else { + 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 && $this->mysqliR !== null) {/* Use readonly server */ + return $this->mysqliR->query($query, $resultmode); + } else { + return $this->mysqliW->query($query, $resultmode); + } + } +} \ No newline at end of file diff --git a/include/config/global.inc.dist.php b/include/config/global.inc.dist.php index af61b1f33..89ef4f7e1 100644 --- a/include/config/global.inc.dist.php +++ b/include/config/global.inc.dist.php @@ -60,6 +60,18 @@ // $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 diff --git a/include/database.inc.php b/include/database.inc.php index c8db0cca6..fcb3bdc39 100644 --- a/include/database.inc.php +++ b/include/database.inc.php @@ -3,13 +3,14 @@ // 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'); } From 42335635734b954d071c7adae8fee4a4e797f90a Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Fri, 8 Dec 2017 23:11:19 +0000 Subject: [PATCH 04/69] Removed var_dump from debugging.... --- include/classes/mysqlims.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/classes/mysqlims.class.php b/include/classes/mysqlims.class.php index e78fb534b..b4537610e 100644 --- a/include/classes/mysqlims.class.php +++ b/include/classes/mysqlims.class.php @@ -18,8 +18,6 @@ class mysqlims extends mysqli */ public function __construct($main, $slave = false, $strict = false) { - var_dump($main); - var_dump($slave); if ($strict) { $this->mysqliW = new mysqli_strict($main['host'], $main['user'], $main['pass'], From f290aeee63eb27310b71533ca497e74a08401f31 Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Sun, 10 Dec 2017 20:22:58 +0000 Subject: [PATCH 05/69] Small bugfix to not validate the Slave when it's not enabled --- include/classes/mysqlims.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/classes/mysqlims.class.php b/include/classes/mysqlims.class.php index b4537610e..26d02e579 100644 --- a/include/classes/mysqlims.class.php +++ b/include/classes/mysqlims.class.php @@ -6,6 +6,7 @@ class mysqlims extends mysqli { private $mysqliW; private $mysqliR = null; + private $slave = false; /* * Pass main and slave connection arrays to the constructor, and strict as true/false @@ -27,6 +28,7 @@ public function __construct($main, $slave = false, $strict = false) $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'], @@ -37,6 +39,7 @@ public function __construct($main, $slave = false, $strict = false) $this->mysqliR = new mysqli($slave['host'], $slave['user'], $slave['pass'], $slave['name'], $slave['port']); + $this->slave = true; } } @@ -44,7 +47,7 @@ public function __construct($main, $slave = false, $strict = false) throw new Exception("Failed to connect to MySQL: (".$this->mysqliW->connect_errno.") ".$this->mysqliW->connect_error); } - if ($this->mysqliR->connect_errno) { + if ($this->mysqliR->connect_errno && $this->slave === true) { throw new Exception("Failed to connect to MySQL: (".$this->mysqliR->connect_errno.") ".$this->mysqliR->connect_error); } } From 7929ac79abbd650f6165e1361b844cad9ac9c705 Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Sun, 10 Dec 2017 20:34:15 +0000 Subject: [PATCH 06/69] Same as previous --- include/classes/mysqlims.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/classes/mysqlims.class.php b/include/classes/mysqlims.class.php index 26d02e579..85042774f 100644 --- a/include/classes/mysqlims.class.php +++ b/include/classes/mysqlims.class.php @@ -60,7 +60,7 @@ public function __construct($main, $slave = false, $strict = false) */ public function prepare($query) { - if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->mysqliR !== null) { + if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->slave !== false) { return $this->mysqliR->prepare($query); } else { return $this->mysqliW->prepare($query); From 142261d4e0eee9545e97235ad74ed9b6a5a27a4e Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Sun, 10 Dec 2017 20:34:53 +0000 Subject: [PATCH 07/69] Same as previous... damn hangover --- include/classes/mysqlims.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/classes/mysqlims.class.php b/include/classes/mysqlims.class.php index 85042774f..3c5d9ba7b 100644 --- a/include/classes/mysqlims.class.php +++ b/include/classes/mysqlims.class.php @@ -77,7 +77,7 @@ public function prepare($query) */ public function query($query, $resultmode = MYSQLI_STORE_RESULT) { - if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->mysqliR !== null) {/* Use readonly server */ + if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->slave !== false) {/* Use readonly server */ return $this->mysqliR->query($query, $resultmode); } else { return $this->mysqliW->query($query, $resultmode); From c5ca7a83b2152cc35e9dce86b8f796dc5d24e1fc Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Sun, 10 Dec 2017 20:46:30 +0000 Subject: [PATCH 08/69] Modified slave validation .gitignore composer.lock, and remove composer.lock from repo --- .gitignore | 2 +- composer.lock | 1358 ---------------------------- include/classes/mysqlims.class.php | 3 +- 3 files changed, 3 insertions(+), 1360 deletions(-) delete mode 100644 composer.lock diff --git a/.gitignore b/.gitignore index 5986fa6fe..0770ff41f 100644 --- a/.gitignore +++ b/.gitignore @@ -43,4 +43,4 @@ tests/_output/* /nbproject/* # No need for composer.lock -composer.lock \ No newline at end of file +/composer.lock \ No newline at end of file diff --git a/composer.lock b/composer.lock deleted file mode 100644 index a66396f00..000000000 --- a/composer.lock +++ /dev/null @@ -1,1358 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "hash": "f4064453293d9402e55a6a6ec40b58cb", - "packages": [], - "packages-dev": [ - { - "name": "codeception/codeception", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/Codeception/Codeception.git", - "reference": "07511243c22ab1229047cda593bc6b29fb4511a4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Codeception/Codeception/zipball/07511243c22ab1229047cda593bc6b29fb4511a4", - "reference": "07511243c22ab1229047cda593bc6b29fb4511a4", - "shasum": "" - }, - "require": { - "facebook/webdriver": "~0.4", - "guzzlehttp/guzzle": "4.*", - "php": ">=5.4.0", - "phpunit/phpunit": "~4.0", - "symfony/browser-kit": "~2.4", - "symfony/console": "~2.4", - "symfony/css-selector": "~2.4", - "symfony/dom-crawler": "~2.4,!=2.4.5", - "symfony/event-dispatcher": "~2.4", - "symfony/finder": "~2.4", - "symfony/yaml": "~2.4" - }, - "require-dev": { - "facebook/php-sdk": "3.*", - "monolog/monolog": "*", - "videlalvaro/php-amqplib": "*" - }, - "suggest": { - "codeception/phpbuiltinserver": "Extension to start and stop PHP built-in web server for your tests", - "codeception/specify": "BDD-style code blocks", - "codeception/verify": "BDD-style assertions", - "monolog/monolog": "Log test steps" - }, - "bin": [ - "codecept" - ], - "type": "library", - "autoload": { - "psr-0": { - "Codeception": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Bodnarchuk", - "email": "davert@mail.ua", - "homepage": "http://codegyre.com" - } - ], - "description": "BDD-style testing framework", - "homepage": "http://codeception.com/", - "keywords": [ - "BDD", - "TDD", - "acceptance testing", - "functional testing", - "unit testing" - ], - "time": "2014-06-21 01:03:08" - }, - { - "name": "doctrine/instantiator", - "version": "1.0.4", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119", - "shasum": "" - }, - "require": { - "php": ">=5.3,<8.0-DEV" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "2.0.*@ALPHA" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\Instantiator\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2014-10-13 12:58:55" - }, - { - "name": "facebook/webdriver", - "version": "v0.5.1", - "source": { - "type": "git", - "url": "https://github.com/facebook/php-webdriver.git", - "reference": "bbcb697efb394d17bd9ec3d467e7da847cde4509" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/bbcb697efb394d17bd9ec3d467e7da847cde4509", - "reference": "bbcb697efb394d17bd9ec3d467e7da847cde4509", - "shasum": "" - }, - "require": { - "php": ">=5.3.19" - }, - "require-dev": { - "phpdocumentor/phpdocumentor": "2.*", - "phpunit/phpunit": "3.7.*" - }, - "type": "library", - "autoload": { - "classmap": [ - "lib/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "A php client for WebDriver", - "homepage": "https://github.com/facebook/php-webdriver", - "keywords": [ - "facebook", - "php", - "selenium", - "webdriver" - ], - "time": "2014-11-05 20:53:09" - }, - { - "name": "guzzlehttp/guzzle", - "version": "4.2.3", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "66fd916e9f9130bc22c51450476823391cb2f67c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/66fd916e9f9130bc22c51450476823391cb2f67c", - "reference": "66fd916e9f9130bc22c51450476823391cb2f67c", - "shasum": "" - }, - "require": { - "ext-json": "*", - "guzzlehttp/streams": "~2.1", - "php": ">=5.4.0" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "~4.0", - "psr/log": "~1.0" - }, - "suggest": { - "ext-curl": "Guzzle will use specific adapters if cURL is present" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.2-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - }, - "files": [ - "src/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "time": "2014-10-05 19:29:14" - }, - { - "name": "guzzlehttp/streams", - "version": "2.1.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/streams.git", - "reference": "f91b721d73f0e561410903b3b3c90a5d0e40b534" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/streams/zipball/f91b721d73f0e561410903b3b3c90a5d0e40b534", - "reference": "f91b721d73f0e561410903b3b3c90a5d0e40b534", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Stream\\": "src/" - }, - "files": [ - "src/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Provides a simple abstraction over streams of data (Guzzle 4+)", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "Guzzle", - "stream" - ], - "time": "2014-08-17 21:15:53" - }, - { - "name": "phpunit/php-code-coverage", - "version": "2.0.13", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5", - "reference": "0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "~1.0", - "sebastian/version": "~1.0" - }, - "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4.1" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2014-12-03 06:41:44" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.3.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "File/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2013-10-10 15:34:57" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "Text/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2014-01-30 17:20:04" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "PHP/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2013-08-02 07:42:54" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.3.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "f8d5d08c56de5cfd592b3340424a81733259a876" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/f8d5d08c56de5cfd592b3340424a81733259a876", - "reference": "f8d5d08c56de5cfd592b3340424a81733259a876", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2014-08-31 06:12:13" - }, - { - "name": "phpunit/phpunit", - "version": "4.4.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "bbe7bcb83b6ec1a9eaabbe1b70d4795027c53ee0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bbe7bcb83b6ec1a9eaabbe1b70d4795027c53ee0", - "reference": "bbe7bcb83b6ec1a9eaabbe1b70d4795027c53ee0", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpunit/php-code-coverage": "~2.0", - "phpunit/php-file-iterator": "~1.3.2", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "~1.0.2", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.0", - "sebastian/diff": "~1.1", - "sebastian/environment": "~1.1", - "sebastian/exporter": "~1.0", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.0" - }, - "suggest": { - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2014-12-05 06:49:03" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "2.3.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "c63d2367247365f688544f0d500af90a11a44c65" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/c63d2367247365f688544f0d500af90a11a44c65", - "reference": "c63d2367247365f688544f0d500af90a11a44c65", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "~1.0,>=1.0.1", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.3" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2014-10-03 05:12:11" - }, - { - "name": "sebastian/comparator", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "c484a80f97573ab934e37826dba0135a3301b26a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/c484a80f97573ab934e37826dba0135a3301b26a", - "reference": "c484a80f97573ab934e37826dba0135a3301b26a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.1", - "sebastian/exporter": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2014-11-16 21:32:38" - }, - { - "name": "sebastian/diff", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "5843509fed39dee4b356a306401e9dd1a931fec7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/5843509fed39dee4b356a306401e9dd1a931fec7", - "reference": "5843509fed39dee4b356a306401e9dd1a931fec7", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "http://www.github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2014-08-15 10:29:00" - }, - { - "name": "sebastian/environment", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e6c71d918088c251b181ba8b3088af4ac336dd7", - "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2014-10-25 08:00:45" - }, - { - "name": "sebastian/exporter", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c7d59948d6e82818e1bdff7cadb6c34710eb7dc0", - "reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2014-09-10 00:51:36" - }, - { - "name": "sebastian/global-state", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2014-10-06 09:23:50" - }, - { - "name": "sebastian/version", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43", - "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43", - "shasum": "" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2014-03-07 15:35:33" - }, - { - "name": "symfony/browser-kit", - "version": "v2.6.1", - "target-dir": "Symfony/Component/BrowserKit", - "source": { - "type": "git", - "url": "https://github.com/symfony/BrowserKit.git", - "reference": "421feda1413fbd09f15d9e7ce39790239d7e01e7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/421feda1413fbd09f15d9e7ce39790239d7e01e7", - "reference": "421feda1413fbd09f15d9e7ce39790239d7e01e7", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "symfony/dom-crawler": "~2.0" - }, - "require-dev": { - "symfony/css-selector": "~2.0", - "symfony/process": "~2.0" - }, - "suggest": { - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\BrowserKit\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony BrowserKit Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" - }, - { - "name": "symfony/console", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Console", - "source": { - "type": "git", - "url": "https://github.com/symfony/Console.git", - "reference": "ef825fd9f809d275926547c9e57cbf14968793e8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/ef825fd9f809d275926547c9e57cbf14968793e8", - "reference": "ef825fd9f809d275926547c9e57cbf14968793e8", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1", - "symfony/process": "~2.1" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Console\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Console Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" - }, - { - "name": "symfony/css-selector", - "version": "v2.6.1", - "target-dir": "Symfony/Component/CssSelector", - "source": { - "type": "git", - "url": "https://github.com/symfony/CssSelector.git", - "reference": "93eb315b545b60a908271762fb4bfa1f9954b851" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/CssSelector/zipball/93eb315b545b60a908271762fb4bfa1f9954b851", - "reference": "93eb315b545b60a908271762fb4bfa1f9954b851", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\CssSelector\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony CssSelector Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" - }, - { - "name": "symfony/dom-crawler", - "version": "v2.6.1", - "target-dir": "Symfony/Component/DomCrawler", - "source": { - "type": "git", - "url": "https://github.com/symfony/DomCrawler.git", - "reference": "300d449f79d74ac62b06edd05214e8dd2e635840" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/300d449f79d74ac62b06edd05214e8dd2e635840", - "reference": "300d449f79d74ac62b06edd05214e8dd2e635840", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "symfony/css-selector": "~2.0" - }, - "suggest": { - "symfony/css-selector": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\DomCrawler\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony DomCrawler Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" - }, - { - "name": "symfony/event-dispatcher", - "version": "v2.6.1", - "target-dir": "Symfony/Component/EventDispatcher", - "source": { - "type": "git", - "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "720fe9bca893df7ad1b4546649473b5afddf0216" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/720fe9bca893df7ad1b4546649473b5afddf0216", - "reference": "720fe9bca893df7ad1b4546649473b5afddf0216", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.0", - "symfony/dependency-injection": "~2.6", - "symfony/expression-language": "~2.6", - "symfony/stopwatch": "~2.2" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\EventDispatcher\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" - }, - { - "name": "symfony/finder", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Finder", - "source": { - "type": "git", - "url": "https://github.com/symfony/Finder.git", - "reference": "0d3ef7f6ec55a7af5eca7914eaa0dacc04ccc721" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/0d3ef7f6ec55a7af5eca7914eaa0dacc04ccc721", - "reference": "0d3ef7f6ec55a7af5eca7914eaa0dacc04ccc721", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Finder\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Finder Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" - }, - { - "name": "symfony/yaml", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Yaml", - "source": { - "type": "git", - "url": "https://github.com/symfony/Yaml.git", - "reference": "3346fc090a3eb6b53d408db2903b241af51dcb20" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/3346fc090a3eb6b53d408db2903b241af51dcb20", - "reference": "3346fc090a3eb6b53d408db2903b241af51dcb20", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Yaml\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Yaml Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [] -} diff --git a/include/classes/mysqlims.class.php b/include/classes/mysqlims.class.php index 3c5d9ba7b..f59ad42b2 100644 --- a/include/classes/mysqlims.class.php +++ b/include/classes/mysqlims.class.php @@ -47,7 +47,7 @@ public function __construct($main, $slave = false, $strict = false) throw new Exception("Failed to connect to MySQL: (".$this->mysqliW->connect_errno.") ".$this->mysqliW->connect_error); } - if ($this->mysqliR->connect_errno && $this->slave === true) { + if ($this->slave === true && $this->mysqliR->connect_errno) { throw new Exception("Failed to connect to MySQL: (".$this->mysqliR->connect_errno.") ".$this->mysqliR->connect_error); } } @@ -60,6 +60,7 @@ public function __construct($main, $slave = false, $strict = false) */ public function prepare($query) { + mysqli::prepare($query); if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->slave !== false) { return $this->mysqliR->prepare($query); } else { From c27db96f05c1185872a57f625b0788f519052e0a Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Sun, 10 Dec 2017 20:48:14 +0000 Subject: [PATCH 09/69] removed trash --- include/classes/mysqlims.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/include/classes/mysqlims.class.php b/include/classes/mysqlims.class.php index f59ad42b2..9a1927f7f 100644 --- a/include/classes/mysqlims.class.php +++ b/include/classes/mysqlims.class.php @@ -60,7 +60,6 @@ public function __construct($main, $slave = false, $strict = false) */ public function prepare($query) { - mysqli::prepare($query); if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->slave !== false) { return $this->mysqliR->prepare($query); } else { From 12cee6e25a3113fc3582201fba4b95d0f37ebaf1 Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Mon, 11 Dec 2017 02:05:26 +0000 Subject: [PATCH 10/69] 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 --- include/classes/notification.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/classes/notification.class.php b/include/classes/notification.class.php index c1807dd94..396072c66 100644 --- a/include/classes/notification.class.php +++ b/include/classes/notification.class.php @@ -23,8 +23,16 @@ public function isNotified($aData) { $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; - return $this->sqlError('E0041'); + { + return true; + } + + if( $stmt->errno ) + { + return $this->sqlError(); + } + + return false; } /** From d259610ac57669174733777b64c3529f603bb809 Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Mon, 11 Dec 2017 03:30:56 +0000 Subject: [PATCH 11/69] 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 --- include/classes/base.class.php | 5 +++-- include/classes/mysqlims.class.php | 7 ++++++- include/classes/notification.class.php | 10 ++-------- include/classes/template.class.php | 6 +++--- include/classes/user.class.php | 10 +++++----- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/classes/base.class.php b/include/classes/base.class.php index c29534b2a..30d0753c8 100644 --- a/include/classes/base.class.php +++ b/include/classes/base.class.php @@ -253,8 +253,9 @@ protected function sqlError($error_code='E0020') { $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; } diff --git a/include/classes/mysqlims.class.php b/include/classes/mysqlims.class.php index 9a1927f7f..98ec503e6 100644 --- a/include/classes/mysqlims.class.php +++ b/include/classes/mysqlims.class.php @@ -7,7 +7,8 @@ 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 * @@ -61,8 +62,10 @@ public function __construct($main, $slave = false, $strict = false) public function prepare($query) { if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->slave !== false) { + $this->lastused = $this->mysqliR; return $this->mysqliR->prepare($query); } else { + $this->lastused = $this->mysqliW; return $this->mysqliW->prepare($query); } } @@ -78,8 +81,10 @@ public function prepare($query) public function query($query, $resultmode = MYSQLI_STORE_RESULT) { if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === 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); } } diff --git a/include/classes/notification.class.php b/include/classes/notification.class.php index 396072c66..48c64e37c 100644 --- a/include/classes/notification.class.php +++ b/include/classes/notification.class.php @@ -22,17 +22,11 @@ public function isNotified($aData) { $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) - { + if ($stmt && $stmt->bind_param('s', $data) && $stmt->execute() && $stmt->store_result() && $stmt->num_rows == 1) { return true; } - - if( $stmt->errno ) - { - return $this->sqlError(); - } - return false; + return $this->sqlError('E0041'); } /** diff --git a/include/classes/template.class.php b/include/classes/template.class.php index dac32fdde..295243f5a 100644 --- a/include/classes/template.class.php +++ b/include/classes/template.class.php @@ -79,7 +79,7 @@ public function getActiveTemplates() { } $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 @@ public function getEntry($template, $columns = "*") { 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 @@ public function updateEntry($template, $content, $active=0) { 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; } } diff --git a/include/classes/user.class.php b/include/classes/user.class.php index 8af175d3c..77a5507e0 100644 --- a/include/classes/user.class.php +++ b/include/classes/user.class.php @@ -575,7 +575,7 @@ public function updateAccount($userID, $address, $threshold, $donate, $email, $t } // Catchall $this->setErrorMessage('Failed to update your account'); - $this->debug->append('Account update failed: ' . $this->mysqli->error); + $this->debug->append('Account update failed: ' . $this->mysqli->lastused->error); return false; } @@ -832,7 +832,7 @@ public function register($username, $coinaddress, $password1, $password2, $pin, $signup_time = time(); if ($this->checkStmt($stmt) && $stmt->bind_param('sssissi', $username_clean, $password_hash, $email1, $signup_time, $pin_hash, $apikey_hash, $is_locked) && $stmt->execute()) { - $new_account_id = $this->mysqli->insert_id; + $new_account_id = $this->mysqli->lastused->insert_id; if (!is_null($coinaddress)) $this->coin_address->add($new_account_id, $coinaddress); if (! $this->setting->getValue('accounts_confirm_email_disabled') && $is_admin != 1) { if ($token = $this->token->createToken('confirm_email', $stmt->insert_id)) { @@ -855,8 +855,8 @@ public function register($username, $coinaddress, $password1, $password2, $pin, } } else { $this->setErrorMessage( 'Unable to register' ); - $this->debug->append('Failed to insert user into DB: ' . $this->mysqli->error); - echo $this->mysqli->error; + $this->debug->append('Failed to insert user into DB: ' . $this->mysqli->lastused->error); + echo $this->mysqli->lastused->error; if ($stmt->sqlstate == '23000') $this->setErrorMessage( 'Username or email already registered' ); return false; } @@ -895,7 +895,7 @@ public function resetPassword($token, $new1, $new2) { } 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; } From 0e3cbe2876d94ee77a63a0615b54030c3e8cb836 Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Fri, 29 Dec 2017 03:45:42 +0000 Subject: [PATCH 12/69] Fix INSERTS with Selects inside --- include/classes/mysqlims.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/classes/mysqlims.class.php b/include/classes/mysqlims.class.php index 98ec503e6..32ec2c612 100644 --- a/include/classes/mysqlims.class.php +++ b/include/classes/mysqlims.class.php @@ -61,7 +61,7 @@ public function __construct($main, $slave = false, $strict = false) */ public function prepare($query) { - if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->slave !== false) { + 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 { @@ -80,7 +80,7 @@ public function prepare($query) */ public function query($query, $resultmode = MYSQLI_STORE_RESULT) { - if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->slave !== false) {/* Use readonly server */ + 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 { @@ -88,4 +88,4 @@ public function query($query, $resultmode = MYSQLI_STORE_RESULT) return $this->mysqliW->query($query, $resultmode); } } -} \ No newline at end of file +} From be1b57a8380c6fb47668a1583523722242125026 Mon Sep 17 00:00:00 2001 From: mecab Date: Wed, 31 Jan 2018 09:40:29 -0600 Subject: [PATCH 13/69] Fix SQL in cleaning up old notifications Subtracting numbers from datetime causes wrong value, or raises error depending on MySQL version/configurations --- include/classes/notification.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/classes/notification.class.php b/include/classes/notification.class.php index 48c64e37c..f8d0151d6 100644 --- a/include/classes/notification.class.php +++ b/include/classes/notification.class.php @@ -190,7 +190,7 @@ public function sendNotification($account_id, $strType, $aMailData) { 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 { From 2fec35cf708112b9727d6da15899d2acd9880b53 Mon Sep 17 00:00:00 2001 From: mecab Date: Wed, 31 Jan 2018 11:18:55 -0600 Subject: [PATCH 14/69] Fix errors while sending mail is not displayed in contact form. --- include/pages/contactform/contactform.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pages/contactform/contactform.inc.php b/include/pages/contactform/contactform.inc.php index 0f352c7b8..5e2f4a716 100644 --- a/include/pages/contactform/contactform.inc.php +++ b/include/pages/contactform/contactform.inc.php @@ -25,7 +25,7 @@ if ($mail->contactform($_POST['senderName'], $_POST['senderEmail'], $_POST['senderSubject'], $_POST['senderMessage'])) { $_SESSION['POPUP'][] = array('CONTENT' => 'Thanks for sending your message! We will get back to you shortly'); } else { - $_SESSION['POPUP'][] = array('CONTENT' => 'There was a problem sending your message. Please try again. ' . $user->getError(), 'TYPE' => 'alert alert-danger'); + $_SESSION['POPUP'][] = array('CONTENT' => 'There was a problem sending your message. Check following error and please try again: ' . $mail->getError(), 'TYPE' => 'alert alert-danger'); } } } From 1b871e16ce011d4d342be362a10f4739a1cc7785 Mon Sep 17 00:00:00 2001 From: mecab Date: Wed, 31 Jan 2018 11:30:41 -0600 Subject: [PATCH 15/69] 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. --- include/classes/mail.class.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/include/classes/mail.class.php b/include/classes/mail.class.php index 4d5e5c6cb..b937b1c8b 100644 --- a/include/classes/mail.class.php +++ b/include/classes/mail.class.php @@ -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; From 495f48d4e5de78ff0ac4cad12b15d270d0937c10 Mon Sep 17 00:00:00 2001 From: mecab Date: Sun, 4 Feb 2018 03:09:53 -0600 Subject: [PATCH 16/69] Add -t option for cronjobs to ignore too old active jobs. --- cronjobs/run-maintenance.sh | 23 +++++++++++++++++++++-- cronjobs/run-payout.sh | 24 +++++++++++++++++++++--- cronjobs/run-statistics.sh | 23 +++++++++++++++++++++-- cronjobs/shared.inc.php | 26 +++++++++++++++++++++++--- include/classes/monitoring.class.php | 10 ++++++++++ include/config/error_codes.inc.php | 1 + 6 files changed, 97 insertions(+), 10 deletions(-) diff --git a/cronjobs/run-maintenance.sh b/cronjobs/run-maintenance.sh index 54799323b..3651958a2 100755 --- a/cronjobs/run-maintenance.sh +++ b/cronjobs/run-maintenance.sh @@ -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 ) diff --git a/cronjobs/run-payout.sh b/cronjobs/run-payout.sh index 5534122f2..0ec8b1878 100755 --- a/cronjobs/run-payout.sh +++ b/cronjobs/run-payout.sh @@ -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 ) diff --git a/cronjobs/run-statistics.sh b/cronjobs/run-statistics.sh index 9aa297376..edcba37f5 100755 --- a/cronjobs/run-statistics.sh +++ b/cronjobs/run-statistics.sh @@ -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 ) diff --git a/cronjobs/shared.inc.php b/cronjobs/shared.inc.php index b16e0c3e8..ce14408ad 100644 --- a/cronjobs/shared.inc.php +++ b/cronjobs/shared.inc.php @@ -51,19 +51,39 @@ function cfip() { return (@defined('SECURITY')) ? 1 : 0; } 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 diff --git a/include/classes/monitoring.class.php b/include/classes/monitoring.class.php index 7dd04df6a..b5caae02c 100644 --- a/include/classes/monitoring.class.php +++ b/include/classes/monitoring.class.php @@ -60,6 +60,16 @@ public function isDisabled($name) { 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 diff --git a/include/config/error_codes.inc.php b/include/config/error_codes.inc.php index a4b33471a..f01f5588c 100644 --- a/include/config/error_codes.inc.php +++ b/include/config/error_codes.inc.php @@ -80,3 +80,4 @@ $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'; From 963a8f7d27f3aa7653ede59a858c98c0351c0c7f Mon Sep 17 00:00:00 2001 From: Bart S Date: Tue, 20 Feb 2018 22:57:16 +0100 Subject: [PATCH 17/69] Fix: Calculate the efficiency correctly in API --- include/pages/api/getpoolstatus.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pages/api/getpoolstatus.inc.php b/include/pages/api/getpoolstatus.inc.php index 915132e02..6312e92e9 100644 --- a/include/pages/api/getpoolstatus.inc.php +++ b/include/pages/api/getpoolstatus.inc.php @@ -12,7 +12,7 @@ // Efficiency $aShares = $statistics->getRoundShares(); -$aShares['valid'] > 0 ? $dEfficiency = round((100 - (100 / $aShares['valid'] * $aShares['invalid'])), 2) : $dEfficiency = 0; +$aShares['valid'] > 0 ? $dEfficiency = round((1 - ($aShares['invalid'] / ($aShares['valid'] + $aShares['invalid']))) * 100, 2) : $dEfficiency = 0; // Fetch RPC data if ($bitcoin->can_connect() === true){ From a598e6ecd6704b98b7ebc6396cb31324fdee8fcc Mon Sep 17 00:00:00 2001 From: Bart S Date: Wed, 21 Feb 2018 10:08:21 +0100 Subject: [PATCH 18/69] Don't divide by zero Small change I overlooked --- include/pages/api/getpoolstatus.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pages/api/getpoolstatus.inc.php b/include/pages/api/getpoolstatus.inc.php index 6312e92e9..dd48358f2 100644 --- a/include/pages/api/getpoolstatus.inc.php +++ b/include/pages/api/getpoolstatus.inc.php @@ -12,7 +12,7 @@ // Efficiency $aShares = $statistics->getRoundShares(); -$aShares['valid'] > 0 ? $dEfficiency = round((1 - ($aShares['invalid'] / ($aShares['valid'] + $aShares['invalid']))) * 100, 2) : $dEfficiency = 0; +$aShares['invalid'] > 0 ? $dEfficiency = round((1 - ($aShares['invalid'] / ($aShares['valid'] + $aShares['invalid']))) * 100, 2) : $dEfficiency = 100; // Fetch RPC data if ($bitcoin->can_connect() === true){ From 83efd6026c829073565fcd139552dea22626ce77 Mon Sep 17 00:00:00 2001 From: Bart S Date: Wed, 21 Feb 2018 13:22:25 +0100 Subject: [PATCH 19/69] 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. --- .../statistics/blocks/block_overview_time.tpl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/bootstrap/statistics/blocks/block_overview_time.tpl b/templates/bootstrap/statistics/blocks/block_overview_time.tpl index 61bae4923..7fb9941bc 100644 --- a/templates/bootstrap/statistics/blocks/block_overview_time.tpl +++ b/templates/bootstrap/statistics/blocks/block_overview_time.tpl @@ -42,7 +42,7 @@ {$LASTBLOCKSBYTIME.TotalShares|number_format} {if $LASTBLOCKSBYTIME.TotalEstimatedShares > 0} - {($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} @@ -68,7 +68,7 @@ {$LASTBLOCKSBYTIME.1HourShares|number_format} {if $LASTBLOCKSBYTIME.1HourEstimatedShares > 0} - {($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} @@ -94,7 +94,7 @@ {$LASTBLOCKSBYTIME.24HourShares|number_format} {if $LASTBLOCKSBYTIME.24HourEstimatedShares > 0} - {($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} @@ -120,7 +120,7 @@ {$LASTBLOCKSBYTIME.7DaysShares|number_format} {if $LASTBLOCKSBYTIME.7DaysEstimatedShares > 0} - {($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} @@ -146,7 +146,7 @@ {$LASTBLOCKSBYTIME.4WeeksShares|number_format} {if $LASTBLOCKSBYTIME.4WeeksEstimatedShares > 0} - {($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} @@ -172,7 +172,7 @@ {$LASTBLOCKSBYTIME.12MonthShares|number_format} {if $LASTBLOCKSBYTIME.12MonthEstimatedShares > 0} - {($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} From ef8f66468cbd5a589bbf1d0c89aeb0763061e1d7 Mon Sep 17 00:00:00 2001 From: Bart S Date: Wed, 21 Feb 2018 13:32:47 +0100 Subject: [PATCH 20/69] Add orange colour to blocks found Together with #83efd60 --- .../bootstrap/statistics/blocks/blocks_found_details.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/bootstrap/statistics/blocks/blocks_found_details.tpl b/templates/bootstrap/statistics/blocks/blocks_found_details.tpl index 834c0fe23..1f054a864 100644 --- a/templates/bootstrap/statistics/blocks/blocks_found_details.tpl +++ b/templates/bootstrap/statistics/blocks/blocks_found_details.tpl @@ -59,7 +59,7 @@ {$BLOCKSFOUND[block].shares|number_format} {math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares|default:"0" estshares=$BLOCKSFOUND[block].estshares} - {$percentage|number_format:"2"} + {$percentage|number_format:"2"} {/section} @@ -70,7 +70,7 @@ {$pplnsshares|number_format} {/if} {$totalshares|number_format} - {if $count > 0}{($totalshares / $totalexpectedshares * 100)|number_format:"2"}{else}0{/if} + {if $count > 0}{($totalshares / $totalexpectedshares * 100)|number_format:"2"}{else}0{/if} From 1c53b2efb7b21c48cdcf1de8a7d765161543f281 Mon Sep 17 00:00:00 2001 From: smiba Date: Wed, 21 Feb 2018 14:27:49 +0100 Subject: [PATCH 21/69] For coins with constant difficulty change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not show in x amount of blocks, if the coin’s difficulty changes on every block --- templates/bootstrap/dashboard/round_statistics/pplns/round.tpl | 2 +- templates/bootstrap/dashboard/round_statistics/pps/round.tpl | 2 +- templates/bootstrap/dashboard/round_statistics/prop/round.tpl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/bootstrap/dashboard/round_statistics/pplns/round.tpl b/templates/bootstrap/dashboard/round_statistics/pplns/round.tpl index 234e31cec..dfa260403 100644 --- a/templates/bootstrap/dashboard/round_statistics/pplns/round.tpl +++ b/templates/bootstrap/dashboard/round_statistics/pplns/round.tpl @@ -70,7 +70,7 @@

{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}

-

Est Next Difficulty{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}

+

Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}

diff --git a/templates/bootstrap/dashboard/round_statistics/pps/round.tpl b/templates/bootstrap/dashboard/round_statistics/pps/round.tpl index 7fc95e6c5..7ed86472f 100644 --- a/templates/bootstrap/dashboard/round_statistics/pps/round.tpl +++ b/templates/bootstrap/dashboard/round_statistics/pps/round.tpl @@ -130,7 +130,7 @@

{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}

-

Est Next Difficulty{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}

+

Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}

diff --git a/templates/bootstrap/dashboard/round_statistics/prop/round.tpl b/templates/bootstrap/dashboard/round_statistics/prop/round.tpl index 1fe67f59c..8ea54a2e9 100644 --- a/templates/bootstrap/dashboard/round_statistics/prop/round.tpl +++ b/templates/bootstrap/dashboard/round_statistics/prop/round.tpl @@ -70,7 +70,7 @@

{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}

-

Est Next Difficulty{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}

+

Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}

From 85ef9d521caf53cae64bff13c8e3afd2c3313040 Mon Sep 17 00:00:00 2001 From: smiba Date: Wed, 21 Feb 2018 14:31:58 +0100 Subject: [PATCH 22/69] Expend CSRF token expiry time Change it to 15 minutes, 2 minutes is not enough. --- include/classes/csrftoken.class.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/include/classes/csrftoken.class.php b/include/classes/csrftoken.class.php index 373a1210a..130b42807 100644 --- a/include/classes/csrftoken.class.php +++ b/include/classes/csrftoken.class.php @@ -16,19 +16,22 @@ public function getBasic($user, $type) { } /** - * 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; } /** From f0f4e005a0d7563c009f931f65447c1e4dc77a15 Mon Sep 17 00:00:00 2001 From: smiba Date: Wed, 21 Feb 2018 14:32:06 +0100 Subject: [PATCH 23/69] Minor spelling correction --- cronjobs/tables_cleanup.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cronjobs/tables_cleanup.php b/cronjobs/tables_cleanup.php index b47918ae2..c2f42780e 100755 --- a/cronjobs/tables_cleanup.php +++ b/cronjobs/tables_cleanup.php @@ -59,7 +59,7 @@ } $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 @@ } $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 = ''; From 653729e6dc154363d88abe3c794f2ecdb2fc1c11 Mon Sep 17 00:00:00 2001 From: desaerun <34751248+desaerun@users.noreply.github.com> Date: Tue, 27 Feb 2018 23:12:45 -0700 Subject: [PATCH 24/69] add 'start' parameter to getusertransactions api page sets db start row --- include/pages/api/getusertransactions.inc.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/pages/api/getusertransactions.inc.php b/include/pages/api/getusertransactions.inc.php index 62f60e19f..956ca6684 100644 --- a/include/pages/api/getusertransactions.inc.php +++ b/include/pages/api/getusertransactions.inc.php @@ -8,13 +8,20 @@ $user_id = $api->checkAccess($user->checkApiKey($_REQUEST['api_key']), @$_REQUEST['id']); // Fetch transactions +if (isset($_REQUEST['start'])) { + $start = $_REQUEST['start']; +} else { + // start at the beginning + $start = 0; +} if (isset($_REQUEST['limit']) && $_REQUEST['limit'] <= 100) { $limit = $_REQUEST['limit']; } else { // Force limit $limit = 100; } -$data['transactions'] = $transaction->getTransactions(0, NULL, $limit, $user_id); + +$data['transactions'] = $transaction->getTransactions($start, NULL, $limit, $user_id); // Fetch summary if enabled if (!$setting->getValue('disable_transactionsummary')) { From 1b217711a45f9c8123ef0e31531a11eec8e6e9fb Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sat, 3 Mar 2018 16:27:10 +0100 Subject: [PATCH 25/69] Revert "add 'start' parameter to getusertransactions api page" --- include/pages/api/getusertransactions.inc.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/include/pages/api/getusertransactions.inc.php b/include/pages/api/getusertransactions.inc.php index 956ca6684..62f60e19f 100644 --- a/include/pages/api/getusertransactions.inc.php +++ b/include/pages/api/getusertransactions.inc.php @@ -8,20 +8,13 @@ $user_id = $api->checkAccess($user->checkApiKey($_REQUEST['api_key']), @$_REQUEST['id']); // Fetch transactions -if (isset($_REQUEST['start'])) { - $start = $_REQUEST['start']; -} else { - // start at the beginning - $start = 0; -} if (isset($_REQUEST['limit']) && $_REQUEST['limit'] <= 100) { $limit = $_REQUEST['limit']; } else { // Force limit $limit = 100; } - -$data['transactions'] = $transaction->getTransactions($start, NULL, $limit, $user_id); +$data['transactions'] = $transaction->getTransactions(0, NULL, $limit, $user_id); // Fetch summary if enabled if (!$setting->getValue('disable_transactionsummary')) { From fbdcd9c4e7a4f80ff26f372f06b22a4b031caea0 Mon Sep 17 00:00:00 2001 From: desaerun <34751248+desaerun@users.noreply.github.com> Date: Mon, 5 Mar 2018 03:24:28 -0700 Subject: [PATCH 26/69] add "start" to getusertransactions api --- include/pages/api/getusertransactions.inc.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/pages/api/getusertransactions.inc.php b/include/pages/api/getusertransactions.inc.php index 62f60e19f..956ca6684 100644 --- a/include/pages/api/getusertransactions.inc.php +++ b/include/pages/api/getusertransactions.inc.php @@ -8,13 +8,20 @@ $user_id = $api->checkAccess($user->checkApiKey($_REQUEST['api_key']), @$_REQUEST['id']); // Fetch transactions +if (isset($_REQUEST['start'])) { + $start = $_REQUEST['start']; +} else { + // start at the beginning + $start = 0; +} if (isset($_REQUEST['limit']) && $_REQUEST['limit'] <= 100) { $limit = $_REQUEST['limit']; } else { // Force limit $limit = 100; } -$data['transactions'] = $transaction->getTransactions(0, NULL, $limit, $user_id); + +$data['transactions'] = $transaction->getTransactions($start, NULL, $limit, $user_id); // Fetch summary if enabled if (!$setting->getValue('disable_transactionsummary')) { From 2566b674d893b4000db683a12b459ddae475ef36 Mon Sep 17 00:00:00 2001 From: TopoX84 Date: Mon, 5 Mar 2018 08:17:39 -0600 Subject: [PATCH 27/69] Update status.tpl by adding
it will fix a display issue on the mobile version while looking at wallet status --- templates/bootstrap/admin/wallet/status.tpl | 67 +++++++++++---------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/templates/bootstrap/admin/wallet/status.tpl b/templates/bootstrap/admin/wallet/status.tpl index 87566e13d..c1d2f4773 100644 --- a/templates/bootstrap/admin/wallet/status.tpl +++ b/templates/bootstrap/admin/wallet/status.tpl @@ -1,32 +1,35 @@ -
-
-
- Wallet Status -
-
- - - - - - - - - - - - - - - - - - - - - -
VersionProtocol VersionWallet VersionPeersStatusBlocksAccounts
{$COININFO.version|default:""}{$COININFO.protocolversion|default:""}{$COININFO.walletversion|default:""}{$COININFO.connections|default:""}{$COININFO.errors|default:"OK"}{$COININFO.blocks|default:"0"}{$ADDRESSCOUNT}
-
-
-
-
+
+
+
+ Wallet Status +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
VersionProtocol VersionWallet VersionPeersStatusBlocksAccounts
{$COININFO.version|default:""}{$COININFO.protocolversion|default:""}{$COININFO.walletversion|default:""}{$COININFO.connections|default:""}{$COININFO.errors|default:"OK"}{$COININFO.blocks|default:"0"}{$ADDRESSCOUNT}
+
+
+
+
From 1448b93e1e279414cb5cfd8f05f95d42338c8466 Mon Sep 17 00:00:00 2001 From: TopoX84 Date: Mon, 5 Mar 2018 08:25:42 -0600 Subject: [PATCH 28/69] Update peers.tpl by adding ```
``` and some ```
``` at the end fixes a display issue on the mobile version while looking at the pees --- templates/bootstrap/admin/wallet/peers.tpl | 66 ++++++++++++---------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/templates/bootstrap/admin/wallet/peers.tpl b/templates/bootstrap/admin/wallet/peers.tpl index 50770d3f8..bccd331c2 100644 --- a/templates/bootstrap/admin/wallet/peers.tpl +++ b/templates/bootstrap/admin/wallet/peers.tpl @@ -1,31 +1,35 @@ -
-
-
-
- Peer Information -
-
- - - - - - - - - - - -{foreach key=KEY item=ARRAY from=$PEERINFO} - - - - - - - -{/foreach} - -
HostProtocolIdentityConnectedTraffic
{$ARRAY['addr']}{$ARRAY['version']}{$ARRAY['subver']|replace:'/':''}{$ARRAY['conntime']|date_format:$GLOBAL.config.date}{(($ARRAY['bytessent']|default:"0" + $ARRAY['bytesrecv']|default:"0") / 1024 / 1024)|number_format:"3"} MB
-
-
+
+
+
+
+ Peer Information +
+
+
+ + + + + + + + + + + + {foreach key=KEY item=ARRAY from=$PEERINFO} + + + + + + + + {/foreach} + +
HostProtocolIdentityConnectedTraffic
{$ARRAY['addr']}{$ARRAY['version']}{$ARRAY['subver']|replace:'/':''}{$ARRAY['conntime']|date_format:$GLOBAL.config.date}{(($ARRAY['bytessent']|default:"0" + $ARRAY['bytesrecv']|default:"0") / 1024 / 1024)|number_format:"3"} MB
+
+
+
+
+
From e9c9c0878790bfab60db5a9d6cb45da17c695896 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 6 Mar 2018 08:21:43 +0100 Subject: [PATCH 29/69] [UPDATE] Trying to fix Travis failures --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 274298efe..a00c12878 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,6 +34,7 @@ before_script: - nohup php -S bone:8000 public/index.php & script: + - php vendor/bin/codecept build --env travis - php vendor/bin/codecept run unit --coverage --coverage-html --coverage-xml --env travis after_script: From 145304bb115d42799d8514bb8d0c2acdf321f83a Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 6 Mar 2018 08:25:18 +0100 Subject: [PATCH 30/69] [UPDATE] Wrong param --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a00c12878..8747dad6f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ before_script: - nohup php -S bone:8000 public/index.php & script: - - php vendor/bin/codecept build --env travis + - php vendor/bin/codecept build - php vendor/bin/codecept run unit --coverage --coverage-html --coverage-xml --env travis after_script: From 31965de2b28906220102f48edaa38b61007eb06b Mon Sep 17 00:00:00 2001 From: Dennis Ruhe Date: Wed, 7 Mar 2018 12:36:16 +0100 Subject: [PATCH 31/69] Implemented recaptcha v2 --- composer.json | 4 +- composer.lock | 1907 ++++++++++++++++++++++ include/autoloader.inc.php | 2 + include/lib/recaptchalib.php | 274 ---- include/pages/login.inc.php | 29 +- include/pages/register.inc.php | 10 +- include/pages/register/register.inc.php | 31 +- templates/bootstrap/login/default.tpl | 9 +- templates/bootstrap/register/default.tpl | 11 +- 9 files changed, 1971 insertions(+), 306 deletions(-) create mode 100644 composer.lock delete mode 100644 include/lib/recaptchalib.php diff --git a/composer.json b/composer.json index eb52da9ad..7aafc3c4e 100644 --- a/composer.json +++ b/composer.json @@ -10,5 +10,7 @@ "email": "delboy1978uk@gmail.com" } ], - "require": {} + "require": { + "google/recaptcha": "~1.1" + } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 000000000..a507127a2 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1907 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "0cc4b5e8c068f02036de37bcafd979fe", + "packages": [ + { + "name": "google/recaptcha", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/google/recaptcha.git", + "reference": "5a56d15ca10a7b75158178752b2ad8f755eb4f78" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/recaptcha/zipball/5a56d15ca10a7b75158178752b2ad8f755eb4f78", + "reference": "5a56d15ca10a7b75158178752b2ad8f755eb4f78", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "ReCaptcha\\": "src/ReCaptcha" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Client library for reCAPTCHA, a free service that protect websites from spam and abuse.", + "homepage": "http://www.google.com/recaptcha/", + "keywords": [ + "Abuse", + "captcha", + "recaptcha", + "spam" + ], + "time": "2017-03-09T18:44:34+00:00" + } + ], + "packages-dev": [ + { + "name": "codeception/codeception", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/Codeception/Codeception.git", + "reference": "07511243c22ab1229047cda593bc6b29fb4511a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Codeception/Codeception/zipball/07511243c22ab1229047cda593bc6b29fb4511a4", + "reference": "07511243c22ab1229047cda593bc6b29fb4511a4", + "shasum": "" + }, + "require": { + "facebook/webdriver": "~0.4", + "guzzlehttp/guzzle": "4.*", + "php": ">=5.4.0", + "phpunit/phpunit": "~4.0", + "symfony/browser-kit": "~2.4", + "symfony/console": "~2.4", + "symfony/css-selector": "~2.4", + "symfony/dom-crawler": "~2.4,!=2.4.5", + "symfony/event-dispatcher": "~2.4", + "symfony/finder": "~2.4", + "symfony/yaml": "~2.4" + }, + "require-dev": { + "facebook/php-sdk": "3.*", + "monolog/monolog": "*", + "videlalvaro/php-amqplib": "*" + }, + "suggest": { + "codeception/phpbuiltinserver": "Extension to start and stop PHP built-in web server for your tests", + "codeception/specify": "BDD-style code blocks", + "codeception/verify": "BDD-style assertions", + "monolog/monolog": "Log test steps" + }, + "bin": [ + "codecept" + ], + "type": "library", + "autoload": { + "psr-0": { + "Codeception": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Bodnarchuk", + "email": "davert@mail.ua", + "homepage": "http://codegyre.com" + } + ], + "description": "BDD-style testing framework", + "homepage": "http://codeception.com/", + "keywords": [ + "BDD", + "TDD", + "acceptance testing", + "functional testing", + "unit testing" + ], + "time": "2014-06-21T01:03:08+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2017-07-22T11:58:36+00:00" + }, + { + "name": "facebook/webdriver", + "version": "v0.6.0", + "source": { + "type": "git", + "url": "https://github.com/facebook/php-webdriver.git", + "reference": "2c5b305ea91b00ebbc433ad1663b7f16c1b31ec5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/2c5b305ea91b00ebbc433ad1663b7f16c1b31ec5", + "reference": "2c5b305ea91b00ebbc433ad1663b7f16c1b31ec5", + "shasum": "" + }, + "require": { + "php": ">=5.3.19" + }, + "require-dev": { + "phpdocumentor/phpdocumentor": "2.*", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "A php client for WebDriver", + "homepage": "https://github.com/facebook/php-webdriver", + "keywords": [ + "facebook", + "php", + "selenium", + "webdriver" + ], + "time": "2015-02-09T19:39:34+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "4.2.4", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "13a8e5acff26b0a87d353042170b48976da004a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/13a8e5acff26b0a87d353042170b48976da004a1", + "reference": "13a8e5acff26b0a87d353042170b48976da004a1", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/streams": "~2.1", + "php": ">=5.4.0" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "~4.0", + "psr/log": "~1.0" + }, + "suggest": { + "ext-curl": "Guzzle will use specific adapters if cURL is present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2016-07-15T17:44:18+00:00" + }, + { + "name": "guzzlehttp/streams", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/streams.git", + "reference": "f91b721d73f0e561410903b3b3c90a5d0e40b534" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/streams/zipball/f91b721d73f0e561410903b3b3c90a5d0e40b534", + "reference": "f91b721d73f0e561410903b3b3c90a5d0e40b534", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Stream\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Provides a simple abstraction over streams of data (Guzzle 4+)", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "Guzzle", + "stream" + ], + "time": "2014-08-17T21:15:53+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2017-09-11T18:02:19+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "4.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "shasum": "" + }, + "require": { + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2017-11-30T07:14:17+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2017-07-14T14:27:02+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.7.5", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/dfd6be44111a7c41c2e884a336cc4f461b3b2401", + "reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2018-02-19T10:16:54+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "2.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "^1.3.2", + "sebastian/version": "~1.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2015-10-06T15:47:00+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2017-11-27T13:52:08+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2017-02-26T11:10:40+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.12", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2017-12-04T08:55:13+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "4.8.36", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpspec/prophecy": "^1.3.1", + "phpunit/php-code-coverage": "~2.1", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.2.2", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.3", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", + "sebastian/version": "~1.0", + "symfony/yaml": "~2.1|~3.0" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.8.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2017-06-21T08:07:12+00:00" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "2.3.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": ">=5.3.3", + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2015-10-02T06:51:40+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, + { + "name": "sebastian/comparator", + "version": "1.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2 || ~2.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2017-01-29T09:50:25+00:00" + }, + { + "name": "sebastian/diff", + "version": "1.4.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2017-05-22T07:24:03+00:00" + }, + { + "name": "sebastian/environment", + "version": "1.3.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8 || ^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2016-08-18T05:49:44+00:00" + }, + { + "name": "sebastian/exporter", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2016-06-17T09:04:28+00:00" + }, + { + "name": "sebastian/global-state", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2015-10-12T03:26:01+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2016-10-03T07:41:43+00:00" + }, + { + "name": "sebastian/version", + "version": "1.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2015-06-21T13:59:46+00:00" + }, + { + "name": "symfony/browser-kit", + "version": "v2.8.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/browser-kit.git", + "reference": "e49a78bcf09ba2e6d03e63e80211f889c037add5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/e49a78bcf09ba2e6d03e63e80211f889c037add5", + "reference": "e49a78bcf09ba2e6d03e63e80211f889c037add5", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/dom-crawler": "~2.1|~3.0.0" + }, + "require-dev": { + "symfony/css-selector": "^2.0.5|~3.0.0", + "symfony/process": "~2.3.34|^2.7.6|~3.0.0" + }, + "suggest": { + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\BrowserKit\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony BrowserKit Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:36:31+00:00" + }, + { + "name": "symfony/console", + "version": "v2.8.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "a6ff8b2ffa4eb43046828b303af2e3fedadacc27" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/a6ff8b2ffa4eb43046828b303af2e3fedadacc27", + "reference": "a6ff8b2ffa4eb43046828b303af2e3fedadacc27", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/debug": "^2.7.2|~3.0.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.1|~3.0.0", + "symfony/process": "~2.1|~3.0.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2018-02-26T15:33:21+00:00" + }, + { + "name": "symfony/css-selector", + "version": "v2.8.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "99a4b2c2f1757d62d081b5f9f14128f23504897d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/99a4b2c2f1757d62d081b5f9f14128f23504897d", + "reference": "99a4b2c2f1757d62d081b5f9f14128f23504897d", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "https://symfony.com", + "time": "2018-02-03T14:55:47+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/697c527acd9ea1b2d3efac34d9806bf255278b0a", + "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/class-loader": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2016-07-30T07:22:48+00:00" + }, + { + "name": "symfony/dom-crawler", + "version": "v2.8.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/dom-crawler.git", + "reference": "91d247d43b511673af426131119175bdfc585781" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/91d247d43b511673af426131119175bdfc585781", + "reference": "91d247d43b511673af426131119175bdfc585781", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "symfony/css-selector": "~2.8|~3.0.0" + }, + "suggest": { + "symfony/css-selector": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\DomCrawler\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony DomCrawler Component", + "homepage": "https://symfony.com", + "time": "2018-02-19T16:23:47+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v2.8.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "f5d2d7dcc33b89e20c2696ea9afcbddf6540081c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/f5d2d7dcc33b89e20c2696ea9afcbddf6540081c", + "reference": "f5d2d7dcc33b89e20c2696ea9afcbddf6540081c", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "^2.0.5|~3.0.0", + "symfony/dependency-injection": "~2.6|~3.0.0", + "symfony/expression-language": "~2.6|~3.0.0", + "symfony/stopwatch": "~2.3|~3.0.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2018-02-11T16:53:59+00:00" + }, + { + "name": "symfony/finder", + "version": "v2.8.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "c5c751ccd50230b4517393344080a0eaf968bf2d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/c5c751ccd50230b4517393344080a0eaf968bf2d", + "reference": "c5c751ccd50230b4517393344080a0eaf968bf2d", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2018-03-05T18:27:59+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.7.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/78be803ce01e55d3491c1397cf1c64beb9c1b63b", + "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2018-01-30T19:27:44+00:00" + }, + { + "name": "symfony/yaml", + "version": "v2.8.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "be720fcfae4614df204190d57795351059946a77" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/be720fcfae4614df204190d57795351059946a77", + "reference": "be720fcfae4614df204190d57795351059946a77", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:36:31+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2018-01-29T19:49:41+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/include/autoloader.inc.php b/include/autoloader.inc.php index e7a260bb6..7417731cf 100644 --- a/include/autoloader.inc.php +++ b/include/autoloader.inc.php @@ -2,6 +2,8 @@ (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; +require_once(INCLUDE_DIR . '/../vendor/autoload.php'); + // Default classes require_once(INCLUDE_DIR . '/lib/KLogger.php'); require_once(CLASS_DIR . '/logger.class.php'); diff --git a/include/lib/recaptchalib.php b/include/lib/recaptchalib.php deleted file mode 100644 index 6d7619e41..000000000 --- a/include/lib/recaptchalib.php +++ /dev/null @@ -1,274 +0,0 @@ - $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 https://www.google.com/recaptcha/admin/create"); - } - - if ($use_ssl) { - $server = RECAPTCHA_API_SECURE_SERVER; - } else { - $server = RECAPTCHA_API_SERVER; - } - - $errorpart = ""; - if ($error) { - $errorpart = "&error=" . $error; - } - return ' - - '; -} - - - - -/** - * 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 https://www.google.com/recaptcha/admin/create"); - } - - 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 http://www.google.com/recaptcha/mailhide/apikey"); - } - - - $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]) . "...@" . htmlentities ($emailparts [1]); - -} diff --git a/include/pages/login.inc.php b/include/pages/login.inc.php index 3b1530abe..650ea5ce7 100644 --- a/include/pages/login.inc.php +++ b/include/pages/login.inc.php @@ -1,20 +1,25 @@ getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_logins')); + +if ($recaptcha_enabled) { + $recaptcha_secret = $setting->getValue('recaptcha_private_key'); + $recaptcha_public_key = $setting->getValue('recaptcha_public_key'); + + $recaptcha = new \ReCaptcha\ReCaptcha($recaptcha_secret); + $smarty->assign("recaptcha_public_key", $recaptcha_public_key); +} + +$smarty->assign("recaptcha_enabled", $recaptcha_enabled); + // ReCaptcha handling if enabled -if ($setting->getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_logins')) { - require_once(INCLUDE_DIR . '/lib/recaptchalib.php'); +if ($recaptcha_enabled) { if (!empty($_POST['username']) && !empty($_POST['password'])) { // Load re-captcha specific data - $rsp = recaptcha_check_answer ( - $setting->getValue('recaptcha_private_key'), - $_SERVER["REMOTE_ADDR"], - ( (isset($_POST["recaptcha_challenge_field"])) ? $_POST["recaptcha_challenge_field"] : null ), - ( (isset($_POST["recaptcha_response_field"])) ? $_POST["recaptcha_response_field"] : null ) - ); - $smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key'), $rsp->error, true)); - } else { - $smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key'), null, true)); + + $recaptcha_response = (isset($_POST["g-recaptcha-response"]) ? $_POST["g-recaptcha-response"] : null); + $rsp = $recaptcha->verify($recaptcha_response, $_SERVER["REMOTE_ADDRESS"]); } } @@ -23,7 +28,7 @@ $_SESSION['POPUP'][] = array('CONTENT' => 'You are not allowed to login during maintenace.', 'TYPE' => 'alert alert-info'); } else { // Check if recaptcha is enabled, process form data if valid - if (!$setting->getValue('recaptcha_enabled') || !$setting->getValue('recaptcha_enabled_logins') || ($setting->getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_logins') && $rsp->is_valid)) { + if (($recaptcha_enabled && $rsp->isSuccess()) || !$recaptcha_enabled) { if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) { // check if login is correct if ($user->checkLogin(@$_POST['username'], @$_POST['password']) ) { diff --git a/include/pages/register.inc.php b/include/pages/register.inc.php index 4fa81e766..d6b24832f 100644 --- a/include/pages/register.inc.php +++ b/include/pages/register.inc.php @@ -8,10 +8,14 @@ $_SESSION['POPUP'][] = array('CONTENT' => 'Only invited users are allowed to register.', 'TYPE' => 'alert alert-danger'); $smarty->assign("CONTENT", "disabled.tpl"); } else { - if ($setting->getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_registrations')) { - require_once(INCLUDE_DIR . '/lib/recaptchalib.php'); - $smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key'), null, true)); + $recaptcha_enabled = ($setting->getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_registrations')); + $smarty->assign("recaptcha_enabled", $recaptcha_enabled); + + if ($recaptcha_enabled) { + $recaptcha_public_key = $setting->getValue('recaptcha_public_key'); + $smarty->assign("recaptcha_public_key", $recaptcha_public_key); } + // Load news entries for Desktop site and unauthenticated users $smarty->assign("CONTENT", "default.tpl"); } diff --git a/include/pages/register/register.inc.php b/include/pages/register/register.inc.php index ef294cb9e..87e0e9465 100644 --- a/include/pages/register/register.inc.php +++ b/include/pages/register/register.inc.php @@ -1,19 +1,24 @@ getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_registrations')); + +$smarty->assign("recaptcha_enabled", $recaptcha_enabled); + // ReCaptcha handling if enabled -if ($setting->getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_registrations')) { - require_once(INCLUDE_DIR . '/lib/recaptchalib.php'); +if ($recaptcha_enabled) { + $recaptcha_secret = $setting->getValue('recaptcha_private_key'); + $recaptcha_public_key = $setting->getValue('recaptcha_public_key'); + + $smarty->assign("recaptcha_public_key", $recaptcha_public_key); + + $recaptcha = new \ReCaptcha\ReCaptcha($recaptcha_secret); + // Load re-captcha specific data - $rsp = recaptcha_check_answer ( - $setting->getValue('recaptcha_private_key'), - $_SERVER["REMOTE_ADDR"], - ( (isset($_POST["recaptcha_challenge_field"])) ? $_POST["recaptcha_challenge_field"] : null ), - ( (isset($_POST["recaptcha_response_field"])) ? $_POST["recaptcha_response_field"] : null ) - ); - $smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key'), $rsp->error, true)); - if (!$rsp->is_valid) $_SESSION['POPUP'][] = array('CONTENT' => 'Invalid Captcha, please try again.', 'TYPE' => 'alert alert-danger'); - $recaptcha = ($rsp->is_valid) ? 1 : 0; + $recaptcha_response = (isset($_POST["g-recaptcha-response"]) ? $_POST["g-recaptcha-response"] : null); + $rsp = $recaptcha->verify($recaptcha_response, $_SERVER["REMOTE_ADDRESS"]); + + if (!$rsp->isSuccess()) $_SESSION['POPUP'][] = array('CONTENT' => 'Invalid Captcha, please try again.', 'TYPE' => 'alert alert-danger'); } if ($setting->getValue('disable_invitations') && $setting->getValue('lock_registration')) { @@ -23,10 +28,10 @@ } else { // Check if csrf is enabled and fail if token is invalid if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) { - if ($setting->getValue('recaptcha_enabled') != 1 || $setting->getValue('recaptcha_enabled_registrations') != 1 || $rsp->is_valid) { + if (($recaptcha_enabled && $rsp->isSuccess()) || !$recaptcha_enabled) { // Check if recaptcha is enabled, process form data if valid or disabled isset($_POST['token']) ? $token = $_POST['token'] : $token = ''; - isset($_POST['coinaddress']) ? $validcoinaddress = $_POST['coinaddress'] : $validcoinaddress = NULL; + isset($_POST['coinaddress']) ? $validcoinaddress = $_POST['coinaddress'] : $validcoinaddress = NULL; if ($config['check_valid_coinaddress'] AND empty($validcoinaddress)) { $_SESSION['POPUP'][] = array('CONTENT' => 'Please enter a valid Wallet Address', 'TYPE' => 'alert alert-danger'); } else { diff --git a/templates/bootstrap/login/default.tpl b/templates/bootstrap/login/default.tpl index 30ef9ed2a..31039dcee 100644 --- a/templates/bootstrap/login/default.tpl +++ b/templates/bootstrap/login/default.tpl @@ -17,7 +17,14 @@
-
{nocache}{$RECAPTCHA|default:"" nofilter}{/nocache}
+
+ {nocache} + {if $recaptcha_enabled} +
+ + {/if} + {/nocache} +
-
{nocache}{$RECAPTCHA|default:"" nofilter}{/nocache}
+
+ {nocache} + {if $recaptcha_enabled} +
+ + {/if} + {/nocache} +
From 8a87239adbba9c018fa9a5239f1444de260b6f24 Mon Sep 17 00:00:00 2001 From: Brian Ziemek Date: Sun, 18 Mar 2018 13:36:18 -0400 Subject: [PATCH 46/69] Handle redundant slashes in ticker config I.e. `https://api.example.com//ticker/target` becomes `https://api.example.com/ticker/target` --- include/classes/tools.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/classes/tools.class.php b/include/classes/tools.class.php index f0eb8694a..029b8cb4e 100644 --- a/include/classes/tools.class.php +++ b/include/classes/tools.class.php @@ -44,9 +44,13 @@ public function getApi($url, $target, $auth=NULL) { 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); From e0dc0cbc1bb135981b113eebd5d2833efe138e13 Mon Sep 17 00:00:00 2001 From: Brian Ziemek Date: Sun, 18 Mar 2018 14:26:30 -0400 Subject: [PATCH 47/69] Fix Mercatox ticker API --- include/classes/tools.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/classes/tools.class.php b/include/classes/tools.class.php index 029b8cb4e..34c549fb2 100644 --- a/include/classes/tools.class.php +++ b/include/classes/tools.class.php @@ -158,7 +158,7 @@ public function getPrice() { return @$aData['Last']; break; case 'mercatox': - return @$aData["{$strBase}_{$strQuote}"]['last']; + return @$aData['pairs']["{$strBase}_{$strQuote}"]['last']; break; case 'tradeogre': return @$aData['price']; From 97050ef142abbf97645980c3b133451419491e69 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sun, 18 Mar 2018 20:37:02 +0100 Subject: [PATCH 48/69] [VERSION] 1.0.9, release prep --- include/version.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/version.inc.php b/include/version.inc.php index fbc27a4a8..b0cc6d0ed 100644 --- a/include/version.inc.php +++ b/include/version.inc.php @@ -1,7 +1,7 @@ Date: Sun, 18 Mar 2018 20:43:25 +0100 Subject: [PATCH 49/69] [UPDATE] Long needed README updates --- README.md | 43 ++++++------------------------------------- 1 file changed, 6 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 1849015a4..eaac6d5bf 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,10 @@ [![Build Status](https://travis-ci.org/MPOS/php-mpos.png?branch=master)](https://travis-ci.org/MPOS/php-mpos) [![Code Climate](https://codeclimate.com/github/MPOS/php-mpos/badges/gpa.svg)](https://codeclimate.com/github/MPOS/php-mpos) [![Code Coverage](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) master
[![Build Status](https://travis-ci.org/MPOS/php-mpos.png?branch=development)](https://travis-ci.org/MPOS/php-mpos) [![Code Coverage](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/coverage.png?b=development)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=development) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/quality-score.png?b=development)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=development) development - Description =========== -MPOS is a web based Mining Portal for various crypto currencies. It was created by [TheSerapher](https://github.com/TheSerapher) and has hence grown quite large. Recently it was migrated into a Github Organization to make development easier. It's a community driven open source project. Support can be requested on IRC at https://webchat.freenode.net/?channels=#mpos - Be **PATIENT** ... People listed in this channel may currently be inactive but most users there have offline logging of messages. They **will** see your questions and answer if they can. Don't join, ask the question and leave. Sit around if you want answers to your questions! +MPOS is a web based Mining Portal for various crypto currencies. It was originally created by [TheSerapher](https://github.com/TheSerapher) and has hence grown quite large. It's now used by many pools out there and is a good starting point to learn more about mining and running pools in general. There is no active development done on the project by the orignal developers but we still merge PRs! Donations ========= @@ -20,24 +19,6 @@ Website Footer When you decide to use `MPOS` please be so kind and leave the footer intact. You are not the author of the software and should honor those that have worked on it. Keeping the footer intact helps spreading the word. Leaving the donation address untouched allows miners to donate to the author. -Donors -====== - -These people have supported this project with a donation: - -* [obigal](https://github.com/obigal) -* [vias](https://github.com/vias79) -* [WKNiGHT](https://github.com/WKNiGHT-) -* [ZC](https://github.com/zccopwrx) -* Nutnut -* Caberhagen (https://coin-mining.ch) -* Mining4All (https://www.mining4all.eu/) -* [xisi](https://github.com/xisi) -* [PCFiL](https://github.com/PCFiL) -* [rog1121](https://github.com/rog1121)(https://rapidhash.net) -* [Wow, Much Pool](http://www.wowmuchpool.com/) -* webxassDE (https://www.suchcoins.com/) - Pools running MPOS ================== @@ -140,39 +121,27 @@ on non-existing features in `MPOS`. For the vast majority, adjusting themes shou In all that, I humbly ask to keep the `MPOS` author reference and Github URL intact. -Related Software -================ - -There are a few other projects out there that take advantage of MPOS and it's included API. Here a quick list that you can check out for yourself: - -* [MPOS IRC Bot](https://github.com/WKNiGHT-/mpos-bot) written in Python, standalone bot, using the MPOS API -* [MPOS Eggdrop Module](https://github.com/iAmShorty/mpos-eggdrop-tcl) written in TCL, adding MPOS commands to this bot, using the MPOS API -* [Windows Phone Pool App](http://www.windowsphone.com/en-us/store/app/meeneminermonitor/7ec6eac7-a642-409b-96c8-57b5cfdf45cf) -* [iPhone iMPOS App](https://itunes.apple.com/us/app/impos/id742179239?mt=8) -* [Other Windows Phone App](http://www.windowsphone.com/en-us/store/app/mining-info/952f1137-eb62-4613-8057-34576d3c9c44) - Contributing ============ You can contribute to this project in different ways: * Report outstanding issues and bugs by creating an [Issue][1] -* Suggest feature enhancements also via [Issues][1] -* Fork the project, create a branch and file a pull request to improve the code itself - -If you wish to participate contact the team on IRC: https://webchat.freenode.net/?channels=#mpos - we will point you to the proper channels! +* Fork the project, create a branch and file a pull request **against development** to improve the code itself Contact ======= -You can find the team on Freenode.net, #MPOS. +This product is not actively developed anymore. For setup and installation support, please find help in other channels. +This projects issue tracker is used for bugs and issues with the core code, not for general help in setting up and running +pool. Team Members ============ Author and Project Owner: [TheSerapher](https://github.com/TheSerapher) aka Sebastian Grewe -Developers: +Past developers that helped on MPOS in the early days: * [nrpatten](https://github.com/nrpatten) * [Aim](https://github.com/fspijkerman) From 92ef32aeabd09b7e9e7afbf7e4a6525ce682bfa1 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sun, 18 Mar 2018 20:45:25 +0100 Subject: [PATCH 50/69] [UPDATE][#2695] Remove unset class variable --- include/bootstrap.php | 1 - 1 file changed, 1 deletion(-) diff --git a/include/bootstrap.php b/include/bootstrap.php index 81a361d19..16aea44b8 100644 --- a/include/bootstrap.php +++ b/include/bootstrap.php @@ -32,7 +32,6 @@ 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(); From 26d291583b04ce13e0a1aa5d87283f0617f0afd7 Mon Sep 17 00:00:00 2001 From: Lucas Buzzo Date: Mon, 16 Apr 2018 21:16:08 -0300 Subject: [PATCH 51/69] First attempt to add support to BTC >= 0.16 --- include/classes/bitcoin.class.php | 4 +++- include/classes/bitcoinwrapper.class.php | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) mode change 100644 => 100755 include/classes/bitcoin.class.php mode change 100644 => 100755 include/classes/bitcoinwrapper.class.php diff --git a/include/classes/bitcoin.class.php b/include/classes/bitcoin.class.php old mode 100644 new mode 100755 index 03e63e6f5..7d4582ef2 --- a/include/classes/bitcoin.class.php +++ b/include/classes/bitcoin.class.php @@ -284,13 +284,15 @@ public function __construct($scheme, $username, $password, $address = "localhost * 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(); } diff --git a/include/classes/bitcoinwrapper.class.php b/include/classes/bitcoinwrapper.class.php old mode 100644 new mode 100755 index 16232e4db..637290027 --- a/include/classes/bitcoinwrapper.class.php +++ b/include/classes/bitcoinwrapper.class.php @@ -24,13 +24,18 @@ public function __construct($type, $username, $password, $host, $debug_level, $d 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); + if (!(parent::getwalletinfo()['walletname'])) + return $this->memcache->setCache(__FUNCTION__, parent::getinfo(), 30); + else + return $this->memcache->setCache(__FUNCTION__, parent::getnetworkinfo()+parent::getmininginfo()+parent::getwalletinfo(), 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; From 181a66b7090f006446b9860e0d47549ed8a09459 Mon Sep 17 00:00:00 2001 From: R4SAS Date: Sat, 21 Apr 2018 00:32:35 +0300 Subject: [PATCH 52/69] don't hardcode wallet name --- include/pages/statistics.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pages/statistics.inc.php b/include/pages/statistics.inc.php index ef55bcc55..c72c65b30 100644 --- a/include/pages/statistics.inc.php +++ b/include/pages/statistics.inc.php @@ -9,7 +9,7 @@ } else { $dDifficulty = 1; $iBlock = 0; - $_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to litecoind RPC service: ' . $bitcoin->can_connect(), 'TYPE' => 'alert alert-danger'); + $_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to RPC service: ' . $bitcoin->can_connect(), 'TYPE' => 'alert alert-danger'); } $smarty->assign("CURRENTBLOCK", $iBlock); $smarty->assign("DIFFICULTY", $dDifficulty); From cdba6ce722510ee03899de8f5b2f8d7027c9e695 Mon Sep 17 00:00:00 2001 From: R4SAS Date: Wed, 25 Apr 2018 05:55:47 +0300 Subject: [PATCH 53/69] 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` --- sql/000_base_structure.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/000_base_structure.sql b/sql/000_base_structure.sql index 9ab29f712..35a47631f 100644 --- a/sql/000_base_structure.sql +++ b/sql/000_base_structure.sql @@ -182,9 +182,9 @@ CREATE TABLE IF NOT EXISTS `statistics_shares` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `account_id` int(10) unsigned NOT NULL, `block_id` int(10) unsigned NOT NULL, - `valid` bigint(20) NOT NULL, + `valid` bigint(20) NOT NULL DEFAULT '0', `invalid` bigint(20) NOT NULL DEFAULT '0', - `pplns_valid` bigint(20) NOT NULL, + `pplns_valid` bigint(20) NOT NULL DEFAULT '0', `pplns_invalid` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `account_id` (`account_id`), From b007bfa9a90238763f7bc634fb93cbecdbf44e4c Mon Sep 17 00:00:00 2001 From: R4SAS Date: Wed, 25 Apr 2018 08:07:55 +0000 Subject: [PATCH 54/69] add database upgrade script, update version in initial database --- sql/000_base_structure.sql | 2 +- upgrade/definitions/1.0.2_to_1.0.3.inc.php | 36 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 upgrade/definitions/1.0.2_to_1.0.3.inc.php diff --git a/sql/000_base_structure.sql b/sql/000_base_structure.sql index 35a47631f..88101fce2 100644 --- a/sql/000_base_structure.sql +++ b/sql/000_base_structure.sql @@ -142,7 +142,7 @@ CREATE TABLE IF NOT EXISTS `settings` ( UNIQUE KEY `setting` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '1.0.2'); +INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '1.0.3'); CREATE TABLE IF NOT EXISTS `shares` ( `id` bigint(30) NOT NULL AUTO_INCREMENT, diff --git a/upgrade/definitions/1.0.2_to_1.0.3.inc.php b/upgrade/definitions/1.0.2_to_1.0.3.inc.php new file mode 100644 index 000000000..0a9cd750b --- /dev/null +++ b/upgrade/definitions/1.0.2_to_1.0.3.inc.php @@ -0,0 +1,36 @@ +getValue('DB_VERSION'); // Our actual version installed + + // Upgrade specific variables + $aSql[] = " + ALTER TABLE `statistics_shares` + CHANGE `valid` `valid` BIGINT(20) NOT NULL DEFAULT '0', + CHANGE `invalid` `invalid` BIGINT(20) NOT NULL DEFAULT '0', + CHANGE `pplns_valid` `pplns_valid` BIGINT(20) NOT NULL DEFAULT '0', + CHANGE `pplns_invalid` `pplns_invalid` BIGINT(20) NOT NULL DEFAULT '0'; + "; + $aSql[] = "UPDATE " . $setting->getTableName() . " SET value = '" . $db_version_new . "' WHERE name = 'DB_VERSION';"; + + if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) { + // Run the upgrade + echo '- Starting database migration to version ' . $db_version_new . PHP_EOL; + foreach ($aSql as $sql) { + echo '- Preparing: ' . $sql . PHP_EOL; + $stmt = $mysqli->prepare($sql); + if ($stmt && $stmt->execute()) { + echo '- success' . PHP_EOL; + } else { + echo '- failed: ' . $mysqli->error . PHP_EOL; + exit(1); + } + } + } +} +?> From 832d67f824a3e330fdc9d617d5e02ee3bcefdd8f Mon Sep 17 00:00:00 2001 From: R4SAS Date: Wed, 25 Apr 2018 10:10:17 +0000 Subject: [PATCH 55/69] bump DB version, update db upgrade script --- include/version.inc.php | 2 +- upgrade/definitions/1.0.2_to_1.0.3.inc.php | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/version.inc.php b/include/version.inc.php index b0cc6d0ed..d95474b42 100644 --- a/include/version.inc.php +++ b/include/version.inc.php @@ -2,7 +2,7 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1; define('MPOS_VERSION', '1.0.9'); -define('DB_VERSION', '1.0.2'); +define('DB_VERSION', '1.0.3'); define('CONFIG_VERSION', '1.0.1'); define('HASH_VERSION', 1); diff --git a/upgrade/definitions/1.0.2_to_1.0.3.inc.php b/upgrade/definitions/1.0.2_to_1.0.3.inc.php index 0a9cd750b..fddd7a35a 100644 --- a/upgrade/definitions/1.0.2_to_1.0.3.inc.php +++ b/upgrade/definitions/1.0.2_to_1.0.3.inc.php @@ -9,13 +9,9 @@ function run_103() { $db_version_now = $setting->getValue('DB_VERSION'); // Our actual version installed // Upgrade specific variables - $aSql[] = " - ALTER TABLE `statistics_shares` - CHANGE `valid` `valid` BIGINT(20) NOT NULL DEFAULT '0', - CHANGE `invalid` `invalid` BIGINT(20) NOT NULL DEFAULT '0', - CHANGE `pplns_valid` `pplns_valid` BIGINT(20) NOT NULL DEFAULT '0', - CHANGE `pplns_invalid` `pplns_invalid` BIGINT(20) NOT NULL DEFAULT '0'; - "; + $aSql[] = "UPDATE `statistics_shares` SET `valid` = '0' WHERE `valid` IS NULL;"; + $aSql[] = "UPDATE `statistics_shares` SET `pplns_valid` = '0' WHERE `pplns_valid` IS NULL;"; + $aSql[] = "ALTER TABLE `statistics_shares` CHANGE `valid` `valid` BIGINT(20) NOT NULL DEFAULT '0', CHANGE `pplns_valid` `pplns_valid` BIGINT(20) NOT NULL DEFAULT '0';"; $aSql[] = "UPDATE " . $setting->getTableName() . " SET value = '" . $db_version_new . "' WHERE name = 'DB_VERSION';"; if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) { From 8cfc43eacad3fe93c6873096cb9e61a57648d6da Mon Sep 17 00:00:00 2001 From: R4SAS Date: Fri, 11 May 2018 12:17:33 +0000 Subject: [PATCH 56/69] implement low-diff shares counting (#2718 #2726) --- include/classes/statistics.class.php | 4 ++-- sql/000_base_structure.sql | 8 ++++---- .../bootstrap/statistics/round/pplns_transactions.tpl | 4 ++-- .../bootstrap/statistics/round/round_transactions.tpl | 2 +- upgrade/definitions/1.0.2_to_1.0.3.inc.php | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/classes/statistics.class.php b/include/classes/statistics.class.php index 777fe3200..05c2c2ac8 100644 --- a/include/classes/statistics.class.php +++ b/include/classes/statistics.class.php @@ -203,7 +203,7 @@ public function getBlocksSolvedbyWorker($account_id, $limit=25) { 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 @@ public function updateShareStatistics($aStats, $iBlockId) { 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(); } diff --git a/sql/000_base_structure.sql b/sql/000_base_structure.sql index 88101fce2..a5c55b10d 100644 --- a/sql/000_base_structure.sql +++ b/sql/000_base_structure.sql @@ -182,10 +182,10 @@ CREATE TABLE IF NOT EXISTS `statistics_shares` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `account_id` int(10) unsigned NOT NULL, `block_id` int(10) unsigned NOT NULL, - `valid` bigint(20) NOT NULL DEFAULT '0', - `invalid` bigint(20) NOT NULL DEFAULT '0', - `pplns_valid` bigint(20) NOT NULL DEFAULT '0', - `pplns_invalid` bigint(20) NOT NULL DEFAULT '0', + `valid` float NOT NULL DEFAULT '0', + `invalid` float NOT NULL DEFAULT '0', + `pplns_valid` float NOT NULL DEFAULT '0', + `pplns_invalid` float NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `account_id` (`account_id`), KEY `block_id` (`block_id`) diff --git a/templates/bootstrap/statistics/round/pplns_transactions.tpl b/templates/bootstrap/statistics/round/pplns_transactions.tpl index 4d71e7039..7ab591325 100644 --- a/templates/bootstrap/statistics/round/pplns_transactions.tpl +++ b/templates/bootstrap/statistics/round/pplns_transactions.tpl @@ -23,9 +23,9 @@ {section txs $ROUNDTRANSACTIONS} {if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if} - {$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format|default:0} + {$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|default:"0"} {if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|default:"0" > 0 }{(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|number_format:"2"}{else}0.00{/if} - {$PPLNSROUNDSHARES[txs].pplns_valid|number_format|default:"0"} + {$PPLNSROUNDSHARES[txs].pplns_valid|number_format:$GLOBAL.config.sharediffprecision|default:"0"} {if $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" > 0 }{(( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)|number_format:"2"|default:"0"}{else}0{/if} {if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|default:"0" > 0 && $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" > 0}{math assign="percentage1" equation=(100 / ((( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid) / (( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)))}{else if $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" == 0}{assign var=percentage1 value=0}{else}{assign var=percentage1 value=100}{/if} {$percentage1|number_format:"2"}
diff --git a/templates/bootstrap/statistics/round/round_transactions.tpl b/templates/bootstrap/statistics/round/round_transactions.tpl index 5ea4de288..2d0b24a23 100644 --- a/templates/bootstrap/statistics/round/round_transactions.tpl +++ b/templates/bootstrap/statistics/round/round_transactions.tpl @@ -20,7 +20,7 @@ {if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if} {$ROUNDTRANSACTIONS[txs].type|default:""} - {$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format} + {$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|default:"0"} {(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|default:"0"|number_format:"2"} {$ROUNDTRANSACTIONS[txs].amount|default:"0"|number_format:"8"} diff --git a/upgrade/definitions/1.0.2_to_1.0.3.inc.php b/upgrade/definitions/1.0.2_to_1.0.3.inc.php index fddd7a35a..3a90b33f2 100644 --- a/upgrade/definitions/1.0.2_to_1.0.3.inc.php +++ b/upgrade/definitions/1.0.2_to_1.0.3.inc.php @@ -11,7 +11,7 @@ function run_103() { // Upgrade specific variables $aSql[] = "UPDATE `statistics_shares` SET `valid` = '0' WHERE `valid` IS NULL;"; $aSql[] = "UPDATE `statistics_shares` SET `pplns_valid` = '0' WHERE `pplns_valid` IS NULL;"; - $aSql[] = "ALTER TABLE `statistics_shares` CHANGE `valid` `valid` BIGINT(20) NOT NULL DEFAULT '0', CHANGE `pplns_valid` `pplns_valid` BIGINT(20) NOT NULL DEFAULT '0';"; + $aSql[] = "ALTER TABLE `statistics_shares` CHANGE `valid` `valid` FLOAT NOT NULL DEFAULT '0', CHANGE `invalid` `invalid` FLOAT NOT NULL DEFAULT '0', CHANGE `pplns_valid` `pplns_valid` FLOAT NOT NULL DEFAULT '0', CHANGE `pplns_invalid` `pplns_invalid` FLOAT NOT NULL DEFAULT '0';"; $aSql[] = "UPDATE " . $setting->getTableName() . " SET value = '" . $db_version_new . "' WHERE name = 'DB_VERSION';"; if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) { From b183ff19bdd82b2aa63c25946b2367d3f960881a Mon Sep 17 00:00:00 2001 From: r4sas Date: Fri, 11 May 2018 21:41:38 +0000 Subject: [PATCH 57/69] lowdiff updates --- include/classes/block.class.php | 2 +- include/classes/coins/coin_base.class.php | 2 +- include/classes/statistics.class.php | 12 +++++----- include/classes/worker.class.php | 2 +- sql/000_base_structure.sql | 2 +- .../bootstrap/dashboard/blocks/default.tpl | 6 ++--- templates/bootstrap/dashboard/js/api.tpl | 6 ++--- .../dashboard/overview/_with_price_graph.tpl | 2 +- .../overview/_without_price_graph.tpl | 2 +- .../dashboard/round_statistics/prop/round.tpl | 2 +- .../statistics/blocks/block_overview_time.tpl | 24 +++++++++---------- .../blocks/blocks_found_details.tpl | 6 ++--- .../statistics/blocks/small_table.tpl | 2 +- .../statistics/pool/contributors_hashrate.tpl | 2 +- .../statistics/pool/contributors_shares.tpl | 6 ++--- .../statistics/pool/general_stats.tpl | 2 +- .../statistics/round/block_stats.tpl | 2 +- .../statistics/round/pplns_block_stats.tpl | 6 ++--- .../round/pplns_block_stats_small.tpl | 6 ++--- .../statistics/round/pplns_round_shares.tpl | 4 ++-- .../statistics/round/pplns_transactions.tpl | 4 ++-- .../round/pplns_transactions_small.tpl | 8 +++---- .../statistics/round/round_shares.tpl | 4 ++-- .../statistics/round/round_transactions.tpl | 2 +- upgrade/definitions/1.0.2_to_1.0.3.inc.php | 1 + 25 files changed, 59 insertions(+), 58 deletions(-) diff --git a/include/classes/block.class.php b/include/classes/block.class.php index cf0ea7eeb..c32bab24a 100644 --- a/include/classes/block.class.php +++ b/include/classes/block.class.php @@ -237,7 +237,7 @@ public function setShareId($block_id, $share_id) { * @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); } diff --git a/include/classes/coins/coin_base.class.php b/include/classes/coins/coin_base.class.php index 035939d1e..efa1d5e89 100644 --- a/include/classes/coins/coin_base.class.php +++ b/include/classes/coins/coin_base.class.php @@ -60,7 +60,7 @@ public function calcHashrate($shares, $interval) { * 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); } /** diff --git a/include/classes/statistics.class.php b/include/classes/statistics.class.php index 05c2c2ac8..1e258c3f8 100644 --- a/include/classes/statistics.class.php +++ b/include/classes/statistics.class.php @@ -111,7 +111,7 @@ public function getBlocksFound($limit=10) { 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 @@ -261,12 +261,12 @@ public function getCurrentShareRate($interval=180) { 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' @@ -575,9 +575,9 @@ public function getUserMiningStats($username, $account_id=NULL, $interval=180) { if ($this->getGetCache() && $data = $this->memcache->get(__FUNCTION__ . $account_id)) return $data; $stmt = $this->mysqli->prepare(" SELECT - IFNULL(SUM(difficulty) / ?, 0) AS sharerate, - IFNULL(SUM(difficulty), 0) AS shares, - IFNULL(AVG(difficulty), 0) AS avgsharediff + IFNULL(SUM(difficulty) / ?, " . $this->coin->getShareDifficultyPrecision() . ") AS sharerate, + IFNULL(SUM(difficulty), " . $this->coin->getShareDifficultyPrecision() . ") AS shares, + IFNULL(AVG(difficulty), " . $this->coin->getShareDifficultyPrecision() . ") AS avgsharediff FROM ( SELECT id, our_result, IF(difficulty = 0, POW(2, (" . $this->config['difficulty'] . " - 16)), difficulty) AS difficulty diff --git a/include/classes/worker.class.php b/include/classes/worker.class.php index f2236b04e..bcb3c5818 100644 --- a/include/classes/worker.class.php +++ b/include/classes/worker.class.php @@ -174,7 +174,7 @@ public function getWorkers($account_id, $interval=600) { 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; } diff --git a/sql/000_base_structure.sql b/sql/000_base_structure.sql index a5c55b10d..d0a3fd481 100644 --- a/sql/000_base_structure.sql +++ b/sql/000_base_structure.sql @@ -43,7 +43,7 @@ CREATE TABLE IF NOT EXISTS `blocks` ( `accounted` tinyint(1) NOT NULL DEFAULT '0', `account_id` int(255) unsigned DEFAULT NULL, `worker_name` varchar(50) DEFAULT 'unknown', - `shares` bigint(30) unsigned DEFAULT NULL, + `shares` double unsigned DEFAULT NULL, `share_id` bigint(30) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `height` (`height`,`blockhash`), diff --git a/templates/bootstrap/dashboard/blocks/default.tpl b/templates/bootstrap/dashboard/blocks/default.tpl index d947f5378..5db6b5028 100644 --- a/templates/bootstrap/dashboard/blocks/default.tpl +++ b/templates/bootstrap/dashboard/blocks/default.tpl @@ -26,8 +26,8 @@ {$BLOCKSFOUND[block].time|date_format:$GLOBAL.config.date} {$BLOCKSFOUND[block].difficulty|number_format:"4"} {$BLOCKSFOUND[block].amount|number_format:"2"} - {$BLOCKSFOUND[block].estshares|number_format} - {$BLOCKSFOUND[block].shares|number_format} + {$BLOCKSFOUND[block].estshares|number_format:$GLOBAL.config.sharediffprecision} + {$BLOCKSFOUND[block].shares|number_format:$GLOBAL.config.sharediffprecision} {math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares|default:"0" estshares=$BLOCKSFOUND[block].estshares} {$percentage|number_format:"2"} @@ -46,4 +46,4 @@ {/if} -{/if} \ No newline at end of file +{/if} diff --git a/templates/bootstrap/dashboard/js/api.tpl b/templates/bootstrap/dashboard/js/api.tpl index 972869add..79db539b9 100644 --- a/templates/bootstrap/dashboard/js/api.tpl +++ b/templates/bootstrap/dashboard/js/api.tpl @@ -43,7 +43,7 @@ $(document).ready(function(){ // Load initial sparkline values var storedPersonalHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.userdata.hashrate|round:"2"}{literal} ]; - var storedPersonalSharerate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.userdata.sharerate|round:"2"}{literal} ]; + var storedPersonalSharerate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.userdata.sharerate|round:$GLOBAL.config.sharediffprecision}{literal} ]; var storedPoolHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.hashrate|round:"2"}{literal} ]; var storedNetHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.nethashrate|round:"2"}{literal} ]; var storedPoolWorkers = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.workers}{literal} ]; @@ -89,7 +89,7 @@ $(document).ready(function(){ storedPersonalHashrate.shift(); storedPersonalHashrate.push(parseFloat(data.getdashboarddata.data.personal.hashrate).toFixed(2)) storedPersonalSharerate.shift(); - storedPersonalSharerate.push(parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed(2)) + storedPersonalSharerate.push(parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed({/literal}{$GLOBAL.config.sharediffprecision}{literal})) storedPoolHashrate.shift(); storedPoolHashrate.push(parseFloat(data.getdashboarddata.data.pool.hashrate).toFixed(2)) storedNetHashrate.shift(); @@ -122,7 +122,7 @@ $(document).ready(function(){ } else { $('#b-nethashrate').html('n/a'); } - $('#b-sharerate').html((parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed(2))); + $('#b-sharerate').html((parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed({/literal}{$GLOBAL.config.sharediffprecision}{literal}))); $('#b-yvalid').html(number_format(data.getdashboarddata.data.personal.shares.valid, {/literal}{$GLOBAL.config.sharediffprecision}{literal})); $('#b-yivalid').html(number_format(data.getdashboarddata.data.personal.shares.invalid, {/literal}{$GLOBAL.config.sharediffprecision}{literal})); if ( data.getdashboarddata.data.personal.shares.valid > 0 ) { diff --git a/templates/bootstrap/dashboard/overview/_with_price_graph.tpl b/templates/bootstrap/dashboard/overview/_with_price_graph.tpl index 7f2a6e44e..6546b681c 100644 --- a/templates/bootstrap/dashboard/overview/_with_price_graph.tpl +++ b/templates/bootstrap/dashboard/overview/_with_price_graph.tpl @@ -43,7 +43,7 @@

My Sharerate

- {$GLOBAL.userdata.sharerate|number_format:"2"} + {$GLOBAL.userdata.sharerate|number_format:$GLOBAL.config.sharediffprecision} S/s
diff --git a/templates/bootstrap/dashboard/overview/_without_price_graph.tpl b/templates/bootstrap/dashboard/overview/_without_price_graph.tpl index 5ccbe0f54..31e58ebe1 100644 --- a/templates/bootstrap/dashboard/overview/_without_price_graph.tpl +++ b/templates/bootstrap/dashboard/overview/_without_price_graph.tpl @@ -43,7 +43,7 @@

My Sharerate

- {$GLOBAL.userdata.sharerate|number_format:"2"} + {$GLOBAL.userdata.sharerate|number_format:$GLOBAL.config.sharediffprecision} S/s
diff --git a/templates/bootstrap/dashboard/round_statistics/prop/round.tpl b/templates/bootstrap/dashboard/round_statistics/prop/round.tpl index 8ea54a2e9..7338471f0 100644 --- a/templates/bootstrap/dashboard/round_statistics/prop/round.tpl +++ b/templates/bootstrap/dashboard/round_statistics/prop/round.tpl @@ -70,7 +70,7 @@

{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}

-

Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}

+

Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget|default:2016 > 1}{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}

diff --git a/templates/bootstrap/statistics/blocks/block_overview_time.tpl b/templates/bootstrap/statistics/blocks/block_overview_time.tpl index 7fb9941bc..38823285a 100644 --- a/templates/bootstrap/statistics/blocks/block_overview_time.tpl +++ b/templates/bootstrap/statistics/blocks/block_overview_time.tpl @@ -38,8 +38,8 @@ 0 {/if} - {$LASTBLOCKSBYTIME.TotalEstimatedShares|number_format} - {$LASTBLOCKSBYTIME.TotalShares|number_format} + {$LASTBLOCKSBYTIME.TotalEstimatedShares|number_format:$GLOBAL.config.sharediffprecision} + {$LASTBLOCKSBYTIME.TotalShares|number_format:$GLOBAL.config.sharediffprecision} {if $LASTBLOCKSBYTIME.TotalEstimatedShares > 0} {($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100)|number_format:"2"}%
@@ -64,8 +64,8 @@ 0 {/if} - {$LASTBLOCKSBYTIME.1HourEstimatedShares|number_format} - {$LASTBLOCKSBYTIME.1HourShares|number_format} + {$LASTBLOCKSBYTIME.1HourEstimatedShares|number_format:$GLOBAL.config.sharediffprecision} + {$LASTBLOCKSBYTIME.1HourShares|number_format:$GLOBAL.config.sharediffprecision} {if $LASTBLOCKSBYTIME.1HourEstimatedShares > 0} {($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100)|number_format:"2"}% @@ -90,8 +90,8 @@ 0 {/if} - {$LASTBLOCKSBYTIME.24HourEstimatedShares|number_format} - {$LASTBLOCKSBYTIME.24HourShares|number_format} + {$LASTBLOCKSBYTIME.24HourEstimatedShares|number_format:$GLOBAL.config.sharediffprecision} + {$LASTBLOCKSBYTIME.24HourShares|number_format:$GLOBAL.config.sharediffprecision} {if $LASTBLOCKSBYTIME.24HourEstimatedShares > 0} {($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100)|number_format:"2"}% @@ -116,8 +116,8 @@ 0 {/if} - {$LASTBLOCKSBYTIME.7DaysEstimatedShares|number_format} - {$LASTBLOCKSBYTIME.7DaysShares|number_format} + {$LASTBLOCKSBYTIME.7DaysEstimatedShares|number_format:$GLOBAL.config.sharediffprecision} + {$LASTBLOCKSBYTIME.7DaysShares|number_format:$GLOBAL.config.sharediffprecision} {if $LASTBLOCKSBYTIME.7DaysEstimatedShares > 0} {($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100)|number_format:"2"}% @@ -142,8 +142,8 @@ 0 {/if} - {$LASTBLOCKSBYTIME.4WeeksEstimatedShares|number_format} - {$LASTBLOCKSBYTIME.4WeeksShares|number_format} + {$LASTBLOCKSBYTIME.4WeeksEstimatedShares|number_format:$GLOBAL.config.sharediffprecision} + {$LASTBLOCKSBYTIME.4WeeksShares|number_format:$GLOBAL.config.sharediffprecision} {if $LASTBLOCKSBYTIME.4WeeksEstimatedShares > 0} {($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100)|number_format:"2"}% @@ -168,8 +168,8 @@ 0 {/if} - {$LASTBLOCKSBYTIME.12MonthEstimatedShares|number_format} - {$LASTBLOCKSBYTIME.12MonthShares|number_format} + {$LASTBLOCKSBYTIME.12MonthEstimatedShares|number_format:$GLOBAL.config.sharediffprecision} + {$LASTBLOCKSBYTIME.12MonthShares|number_format:$GLOBAL.config.sharediffprecision} {if $LASTBLOCKSBYTIME.12MonthEstimatedShares > 0} {($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100)|number_format:"2"}% diff --git a/templates/bootstrap/statistics/blocks/blocks_found_details.tpl b/templates/bootstrap/statistics/blocks/blocks_found_details.tpl index 1f054a864..240f20b95 100644 --- a/templates/bootstrap/statistics/blocks/blocks_found_details.tpl +++ b/templates/bootstrap/statistics/blocks/blocks_found_details.tpl @@ -51,12 +51,12 @@ {$BLOCKSFOUND[block].amount|number_format:"2"} {assign var="totalexpectedshares" value=$totalexpectedshares+$BLOCKSFOUND[block].estshares} - {$BLOCKSFOUND[block].estshares|number_format} + {$BLOCKSFOUND[block].estshares|number_format:$GLOBAL.config.sharediffprecision} {if $GLOBAL.config.payout_system == 'pplns'} - {$BLOCKSFOUND[block].pplns_shares|number_format} + {$BLOCKSFOUND[block].pplns_shares|number_format:$GLOBAL.config.sharediffprecision} {/if} - {$BLOCKSFOUND[block].shares|number_format} + {$BLOCKSFOUND[block].shares|number_format:$GLOBAL.config.sharediffprecision} {math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares|default:"0" estshares=$BLOCKSFOUND[block].estshares} {$percentage|number_format:"2"} diff --git a/templates/bootstrap/statistics/blocks/small_table.tpl b/templates/bootstrap/statistics/blocks/small_table.tpl index 544ffd22a..f48524124 100644 --- a/templates/bootstrap/statistics/blocks/small_table.tpl +++ b/templates/bootstrap/statistics/blocks/small_table.tpl @@ -24,7 +24,7 @@ {/if} {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} {$BLOCKSFOUND[block].time|date_format:$GLOBAL.config.date} - {$BLOCKSFOUND[block].shares|number_format} + {$BLOCKSFOUND[block].shares|number_format:$GLOBAL.config.sharediffprecision} {/section} diff --git a/templates/bootstrap/statistics/pool/contributors_hashrate.tpl b/templates/bootstrap/statistics/pool/contributors_hashrate.tpl index 3b7fa0dd1..d77aeaa07 100644 --- a/templates/bootstrap/statistics/pool/contributors_hashrate.tpl +++ b/templates/bootstrap/statistics/pool/contributors_hashrate.tpl @@ -35,7 +35,7 @@ {/section} {if $listed != 1 && $GLOBAL.userdata.username|default:"" && $GLOBAL.userdata.rawhashrate|default:"0" > 0} {math assign="myestday" equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$GLOBAL.userdata.rawhashrate} - {if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|lower}{assign var=listed value=1}{else}{/if} + {if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|default:""|lower}{assign var=listed value=1}{else}{/if} n/a {if $GLOBAL.userdata.donate_percent|default:"0" >= 2}{elseif $GLOBAL.userdata.donate_percent|default:"0" < 2 AND $GLOBAL.userdata.donate_percent|default:"0" > 0}{else}{/if} {$GLOBAL.userdata.username|escape} diff --git a/templates/bootstrap/statistics/pool/contributors_shares.tpl b/templates/bootstrap/statistics/pool/contributors_shares.tpl index f0d4018ac..f9f392e49 100644 --- a/templates/bootstrap/statistics/pool/contributors_shares.tpl +++ b/templates/bootstrap/statistics/pool/contributors_shares.tpl @@ -21,15 +21,15 @@ {$rank++} {if $CONTRIBSHARES[shares].donate_percent|default:"0" >= 2}{else if $CONTRIBSHARES[shares].donate_percent|default:"0" < 2 AND $CONTRIBSHARES[shares].donate_percent|default:"0" > 0}{else}{/if} {if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if} - {$CONTRIBSHARES[shares].shares|number_format} + {$CONTRIBSHARES[shares].shares|number_format:$GLOBAL.config.sharediffprecision} {/section} {if $listed != 1 && $GLOBAL.userdata.username|default:"" && $GLOBAL.userdata.shares.valid|default:"0" > 0} - {if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|lower}{assign var=listed value=1}{else}{/if} + {if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|default:""|lower}{assign var=listed value=1}{else}{/if} n/a {if $GLOBAL.userdata.donate_percent|default:"0" >= 2}{elseif $GLOBAL.userdata.donate_percent|default:"0" < 2 AND $GLOBAL.userdata.donate_percent|default:"0" > 0}{else}{/if} {$GLOBAL.userdata.username|escape} - {$GLOBAL.userdata.shares.valid|number_format} + {$GLOBAL.userdata.shares.valid|number_format:$GLOBAL.config.sharediffprecision} {/if} diff --git a/templates/bootstrap/statistics/pool/general_stats.tpl b/templates/bootstrap/statistics/pool/general_stats.tpl index 9e78bcb8d..1d971be9e 100644 --- a/templates/bootstrap/statistics/pool/general_stats.tpl +++ b/templates/bootstrap/statistics/pool/general_stats.tpl @@ -44,7 +44,7 @@ Est. Shares this Round - {$ESTIMATES.shares|number_format} (done: {$ESTIMATES.percent}%) + {$ESTIMATES.shares|number_format:$GLOBAL.config.sharediffprecision} (done: {$ESTIMATES.percent}%) {if ! $GLOBAL.website.blockexplorer.disabled} diff --git a/templates/bootstrap/statistics/round/block_stats.tpl b/templates/bootstrap/statistics/round/block_stats.tpl index c09499ffd..60c58738a 100644 --- a/templates/bootstrap/statistics/round/block_stats.tpl +++ b/templates/bootstrap/statistics/round/block_stats.tpl @@ -38,7 +38,7 @@ Time {$BLOCKDETAILS.time|default:"0"} Shares - {$BLOCKDETAILS.shares|number_format:"0"|default:"0"} + {$BLOCKDETAILS.shares|number_format:$GLOBAL.config.sharediffprecision|default:"0"} Finder {$BLOCKDETAILS.finder|default:"unknown"} diff --git a/templates/bootstrap/statistics/round/pplns_block_stats.tpl b/templates/bootstrap/statistics/round/pplns_block_stats.tpl index 0874715cc..67f37fbd7 100644 --- a/templates/bootstrap/statistics/round/pplns_block_stats.tpl +++ b/templates/bootstrap/statistics/round/pplns_block_stats.tpl @@ -18,7 +18,7 @@ ID {$BLOCKDETAILS.id|number_format:"0"|default:"0"} PPLNS Shares - {$PPLNSSHARES|number_format:"0"|default:"0"} + {$PPLNSSHARES|number_format:$GLOBAL.config.sharediffprecision|default:"0"} Height @@ -28,7 +28,7 @@ {$BLOCKDETAILS.height|number_format:"0"|default:"0"} {/if} Estimated Shares - {$BLOCKDETAILS.estshares|number_format|default:"0"} + {$BLOCKDETAILS.estshares|number_format:$GLOBAL.config.sharediffprecision|default:"0"} Amount @@ -64,7 +64,7 @@ Shares - {$BLOCKDETAILS.shares|number_format:"0"|default:"0"} + {$BLOCKDETAILS.shares|number_format:$GLOBAL.config.sharediffprecision|default:"0"} Seconds This Round {$BLOCKDETAILS.round_time|number_format:"0"|default:"0"} diff --git a/templates/bootstrap/statistics/round/pplns_block_stats_small.tpl b/templates/bootstrap/statistics/round/pplns_block_stats_small.tpl index 7a0e27a5c..6f8958243 100644 --- a/templates/bootstrap/statistics/round/pplns_block_stats_small.tpl +++ b/templates/bootstrap/statistics/round/pplns_block_stats_small.tpl @@ -30,9 +30,9 @@ {$BLOCKDETAILS.height|number_format:"0"|default:"0"} {/if} PPLNS Shares - {$PPLNSSHARES|number_format:"0"|default:"0"} + {$PPLNSSHARES|number_format:$GLOBAL.config.sharediffprecision|default:"0"} Estimated Shares - {$BLOCKDETAILS.estshares|number_format|default:"0"} + {$BLOCKDETAILS.estshares|number_format:$GLOBAL.config.sharediffprecision|default:"0"} Amount @@ -61,7 +61,7 @@ Shares - {$BLOCKDETAILS.shares|number_format:"0"|default:"0"} + {$BLOCKDETAILS.shares|number_format:$GLOBAL.config.sharediffprecision|default:"0"} Finder {$BLOCKDETAILS.finder|default:"unknown"} Seconds This Round diff --git a/templates/bootstrap/statistics/round/pplns_round_shares.tpl b/templates/bootstrap/statistics/round/pplns_round_shares.tpl index a0645240c..0159c5b38 100644 --- a/templates/bootstrap/statistics/round/pplns_round_shares.tpl +++ b/templates/bootstrap/statistics/round/pplns_round_shares.tpl @@ -21,8 +21,8 @@ {$rank++} {if $PPLNSROUNDSHARES[contrib].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$PPLNSROUNDSHARES[contrib].username|default:"unknown"|escape}{/if} - {$PPLNSROUNDSHARES[contrib].pplns_valid|number_format} - {$PPLNSROUNDSHARES[contrib].pplns_invalid|number_format} + {$PPLNSROUNDSHARES[contrib].pplns_valid|number_format:$GLOBAL.config.sharediffprecision|default:0} + {$PPLNSROUNDSHARES[contrib].pplns_invalid|number_format:$GLOBAL.config.sharediffprecision|default:0} {if $PPLNSROUNDSHARES[contrib].pplns_invalid > 0 && $PPLNSROUNDSHARES[contrib].pplns_valid > 0}{($PPLNSROUNDSHARES[contrib].pplns_invalid / $PPLNSROUNDSHARES[contrib].pplns_valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if} {/section} diff --git a/templates/bootstrap/statistics/round/pplns_transactions.tpl b/templates/bootstrap/statistics/round/pplns_transactions.tpl index 7ab591325..7798ae40a 100644 --- a/templates/bootstrap/statistics/round/pplns_transactions.tpl +++ b/templates/bootstrap/statistics/round/pplns_transactions.tpl @@ -23,9 +23,9 @@ {section txs $ROUNDTRANSACTIONS} {if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if} - {$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|default:"0"} + {$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|default:0} {if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|default:"0" > 0 }{(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|number_format:"2"}{else}0.00{/if} - {$PPLNSROUNDSHARES[txs].pplns_valid|number_format:$GLOBAL.config.sharediffprecision|default:"0"} + {$PPLNSROUNDSHARES[txs].pplns_valid|number_format:$GLOBAL.config.sharediffprecision|default:0} {if $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" > 0 }{(( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)|number_format:"2"|default:"0"}{else}0{/if} {if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|default:"0" > 0 && $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" > 0}{math assign="percentage1" equation=(100 / ((( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid) / (( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)))}{else if $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" == 0}{assign var=percentage1 value=0}{else}{assign var=percentage1 value=100}{/if} {$percentage1|number_format:"2"} diff --git a/templates/bootstrap/statistics/round/pplns_transactions_small.tpl b/templates/bootstrap/statistics/round/pplns_transactions_small.tpl index 7217c522b..b95845fae 100644 --- a/templates/bootstrap/statistics/round/pplns_transactions_small.tpl +++ b/templates/bootstrap/statistics/round/pplns_transactions_small.tpl @@ -26,12 +26,12 @@ {section txs $ROUNDTRANSACTIONS} {if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if} - {$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid|number_format} - {$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid|number_format} + {$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid|number_format:$GLOBAL.config.sharediffprecision} + {$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid|number_format:$GLOBAL.config.sharediffprecision} {if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid > 0 }{($SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid / $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if} {if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid > 0 }{(( 100 / $BLOCKDETAILS.shares) * $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid)|number_format:"2"}{else}0.00{/if} - {$PPLNSROUNDSHARES[txs].pplns_valid|number_format} - {$PPLNSROUNDSHARES[txs].pplns_invalid|number_format} + {$PPLNSROUNDSHARES[txs].pplns_valid|number_format:$GLOBAL.config.sharediffprecision} + {$PPLNSROUNDSHARES[txs].pplns_invalid|number_format:$GLOBAL.config.sharediffprecision} {if $PPLNSROUNDSHARES[txs].pplns_invalid > 0 }{($PPLNSROUNDSHARES[txs].pplns_invalid / $PPLNSROUNDSHARES[txs].pplns_valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if} {(( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)|number_format:"2"} {if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid > 0 }{math assign="percentage1" equation=(100 / ((( 100 / $BLOCKDETAILS.shares) * $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid) / (( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)))}{else if $PPLNSROUNDSHARES[txs].pplns_valid == 0}{assign var=percentage1 value=0}{else}{assign var=percentage1 value=100}{/if} diff --git a/templates/bootstrap/statistics/round/round_shares.tpl b/templates/bootstrap/statistics/round/round_shares.tpl index 7cc8bb97f..96c23383d 100644 --- a/templates/bootstrap/statistics/round/round_shares.tpl +++ b/templates/bootstrap/statistics/round/round_shares.tpl @@ -22,8 +22,8 @@ {$rank++} {if $data.is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$data.username|default:"unknown"|escape}{/if} - {$data.valid|number_format} - {$data.invalid|number_format} + {$data.valid|number_format:$GLOBAL.config.sharediffprecision|default:0} + {$data.invalid|number_format:$GLOBAL.config.sharediffprecision|default:0} {if $data.invalid > 0 }{($data.invalid / $data.valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if} {/foreach} diff --git a/templates/bootstrap/statistics/round/round_transactions.tpl b/templates/bootstrap/statistics/round/round_transactions.tpl index 2d0b24a23..c102c9ccf 100644 --- a/templates/bootstrap/statistics/round/round_transactions.tpl +++ b/templates/bootstrap/statistics/round/round_transactions.tpl @@ -20,7 +20,7 @@ {if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if} {$ROUNDTRANSACTIONS[txs].type|default:""} - {$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|default:"0"} + {$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|default:0} {(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|default:"0"|number_format:"2"} {$ROUNDTRANSACTIONS[txs].amount|default:"0"|number_format:"8"} diff --git a/upgrade/definitions/1.0.2_to_1.0.3.inc.php b/upgrade/definitions/1.0.2_to_1.0.3.inc.php index 3a90b33f2..4c4a84c14 100644 --- a/upgrade/definitions/1.0.2_to_1.0.3.inc.php +++ b/upgrade/definitions/1.0.2_to_1.0.3.inc.php @@ -9,6 +9,7 @@ function run_103() { $db_version_now = $setting->getValue('DB_VERSION'); // Our actual version installed // Upgrade specific variables + $aSql[] = "ALTER TABLE `blocks` CHANGE `shares` `shares` DOUBLE UNSIGNED DEFAULT NULL;"; $aSql[] = "UPDATE `statistics_shares` SET `valid` = '0' WHERE `valid` IS NULL;"; $aSql[] = "UPDATE `statistics_shares` SET `pplns_valid` = '0' WHERE `pplns_valid` IS NULL;"; $aSql[] = "ALTER TABLE `statistics_shares` CHANGE `valid` `valid` FLOAT NOT NULL DEFAULT '0', CHANGE `invalid` `invalid` FLOAT NOT NULL DEFAULT '0', CHANGE `pplns_valid` `pplns_valid` FLOAT NOT NULL DEFAULT '0', CHANGE `pplns_invalid` `pplns_invalid` FLOAT NOT NULL DEFAULT '0';"; From ce78e8b59d315ba109e1d236383d5b8fdd336a06 Mon Sep 17 00:00:00 2001 From: r4sas Date: Sat, 12 May 2018 13:25:13 +0000 Subject: [PATCH 58/69] revert changes for mysql ifnull functions --- include/classes/statistics.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/classes/statistics.class.php b/include/classes/statistics.class.php index 1e258c3f8..bd7984541 100644 --- a/include/classes/statistics.class.php +++ b/include/classes/statistics.class.php @@ -575,9 +575,9 @@ public function getUserMiningStats($username, $account_id=NULL, $interval=180) { if ($this->getGetCache() && $data = $this->memcache->get(__FUNCTION__ . $account_id)) return $data; $stmt = $this->mysqli->prepare(" SELECT - IFNULL(SUM(difficulty) / ?, " . $this->coin->getShareDifficultyPrecision() . ") AS sharerate, - IFNULL(SUM(difficulty), " . $this->coin->getShareDifficultyPrecision() . ") AS shares, - IFNULL(AVG(difficulty), " . $this->coin->getShareDifficultyPrecision() . ") AS avgsharediff + IFNULL(SUM(difficulty) / ?, 0) AS sharerate, + IFNULL(SUM(difficulty), 0) AS shares, + IFNULL(AVG(difficulty), 0) AS avgsharediff FROM ( SELECT id, our_result, IF(difficulty = 0, POW(2, (" . $this->config['difficulty'] . " - 16)), difficulty) AS difficulty From 1f8a33247f661221ed33bb0754696098dd7e22d8 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sat, 12 May 2018 20:53:53 +0200 Subject: [PATCH 59/69] Updated author/project in composer file --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 7aafc3c4e..58f837e7f 100644 --- a/composer.json +++ b/composer.json @@ -1,13 +1,13 @@ { - "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": { From 15de9e1d4ac97e63e89df7e13a3063c35e27505c Mon Sep 17 00:00:00 2001 From: r4sas Date: Sat, 12 May 2018 19:21:21 +0000 Subject: [PATCH 60/69] change to unsigned float --- sql/000_base_structure.sql | 8 ++++---- upgrade/definitions/1.0.2_to_1.0.3.inc.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sql/000_base_structure.sql b/sql/000_base_structure.sql index d0a3fd481..5f7a33433 100644 --- a/sql/000_base_structure.sql +++ b/sql/000_base_structure.sql @@ -182,10 +182,10 @@ CREATE TABLE IF NOT EXISTS `statistics_shares` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `account_id` int(10) unsigned NOT NULL, `block_id` int(10) unsigned NOT NULL, - `valid` float NOT NULL DEFAULT '0', - `invalid` float NOT NULL DEFAULT '0', - `pplns_valid` float NOT NULL DEFAULT '0', - `pplns_invalid` float NOT NULL DEFAULT '0', + `valid` float unsigned NOT NULL DEFAULT '0', + `invalid` float unsigned NOT NULL DEFAULT '0', + `pplns_valid` float unsigned NOT NULL DEFAULT '0', + `pplns_invalid` float unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `account_id` (`account_id`), KEY `block_id` (`block_id`) diff --git a/upgrade/definitions/1.0.2_to_1.0.3.inc.php b/upgrade/definitions/1.0.2_to_1.0.3.inc.php index 4c4a84c14..28f2578dd 100644 --- a/upgrade/definitions/1.0.2_to_1.0.3.inc.php +++ b/upgrade/definitions/1.0.2_to_1.0.3.inc.php @@ -12,7 +12,7 @@ function run_103() { $aSql[] = "ALTER TABLE `blocks` CHANGE `shares` `shares` DOUBLE UNSIGNED DEFAULT NULL;"; $aSql[] = "UPDATE `statistics_shares` SET `valid` = '0' WHERE `valid` IS NULL;"; $aSql[] = "UPDATE `statistics_shares` SET `pplns_valid` = '0' WHERE `pplns_valid` IS NULL;"; - $aSql[] = "ALTER TABLE `statistics_shares` CHANGE `valid` `valid` FLOAT NOT NULL DEFAULT '0', CHANGE `invalid` `invalid` FLOAT NOT NULL DEFAULT '0', CHANGE `pplns_valid` `pplns_valid` FLOAT NOT NULL DEFAULT '0', CHANGE `pplns_invalid` `pplns_invalid` FLOAT NOT NULL DEFAULT '0';"; + $aSql[] = "ALTER TABLE `statistics_shares` CHANGE `valid` `valid` FLOAT UNSIGNED NOT NULL DEFAULT '0', CHANGE `invalid` `invalid` FLOAT UNSIGNED NOT NULL DEFAULT '0', CHANGE `pplns_valid` `pplns_valid` FLOAT UNSIGNED NOT NULL DEFAULT '0', CHANGE `pplns_invalid` `pplns_invalid` FLOAT UNSIGNED NOT NULL DEFAULT '0';"; $aSql[] = "UPDATE " . $setting->getTableName() . " SET value = '" . $db_version_new . "' WHERE name = 'DB_VERSION';"; if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) { From 61670a1c446b3b02dce00f73862b24018ff4502c Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sat, 12 May 2018 21:21:44 +0200 Subject: [PATCH 61/69] [UPDATE] Print error if vendor libs are missing --- include/autoloader.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/autoloader.inc.php b/include/autoloader.inc.php index 7417731cf..5bafd473f 100644 --- a/include/autoloader.inc.php +++ b/include/autoloader.inc.php @@ -2,7 +2,11 @@ (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; -require_once(INCLUDE_DIR . '/../vendor/autoload.php'); +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'); From e09db5c1e0c4ddaa298d32530554ae0e7b12d76e Mon Sep 17 00:00:00 2001 From: r4sas Date: Sat, 12 May 2018 19:36:00 +0000 Subject: [PATCH 62/69] update block statistics --- .../bootstrap/statistics/blocks/blocks_found_details.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/bootstrap/statistics/blocks/blocks_found_details.tpl b/templates/bootstrap/statistics/blocks/blocks_found_details.tpl index 240f20b95..ff0aad4a7 100644 --- a/templates/bootstrap/statistics/blocks/blocks_found_details.tpl +++ b/templates/bootstrap/statistics/blocks/blocks_found_details.tpl @@ -65,11 +65,11 @@ {/section} Totals - {$totalexpectedshares|number_format} + {$totalexpectedshares|number_format:$GLOBAL.config.sharediffprecision} {if $GLOBAL.config.payout_system == 'pplns'} - {$pplnsshares|number_format} + {$pplnsshares|number_format:$GLOBAL.config.sharediffprecision} {/if} - {$totalshares|number_format} + {$totalshares|number_format:$GLOBAL.config.sharediffprecision} {if $count > 0}{($totalshares / $totalexpectedshares * 100)|number_format:"2"}{else}0{/if} From 01c75f49ff7249e158393246f0ed10e12a45bf53 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sat, 12 May 2018 21:36:43 +0200 Subject: [PATCH 63/69] [UPDATE][#2713] Adding transaction filter API now supports filters just as the GUI version, closing #2713 :) --- include/pages/api/getusertransactions.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/pages/api/getusertransactions.inc.php b/include/pages/api/getusertransactions.inc.php index 956ca6684..c59c7e5d1 100644 --- a/include/pages/api/getusertransactions.inc.php +++ b/include/pages/api/getusertransactions.inc.php @@ -20,8 +20,13 @@ // Force limit $limit = 100; } +if (isset($_REQUEST['filter']) && is_array($_REQUEST['filter'])) { + $filter = $_REQUEST['filter']; +} else { + $filter = NULL; +} -$data['transactions'] = $transaction->getTransactions($start, NULL, $limit, $user_id); +$data['transactions'] = $transaction->getTransactions($start, $filter, $limit, $user_id); // Fetch summary if enabled if (!$setting->getValue('disable_transactionsummary')) { From e79b558163ba8eafe1964f5199f09cde74a5ebc2 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sat, 12 May 2018 23:20:50 +0200 Subject: [PATCH 64/69] [UPDATE] Also detect testnet on RPC > 0.16 --- include/classes/bitcoinwrapper.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/classes/bitcoinwrapper.class.php b/include/classes/bitcoinwrapper.class.php index 637290027..1f6f9a5ec 100755 --- a/include/classes/bitcoinwrapper.class.php +++ b/include/classes/bitcoinwrapper.class.php @@ -30,6 +30,15 @@ public function getinfo() { return $this->memcache->setCache(__FUNCTION__, parent::getnetworkinfo()+parent::getmininginfo()+parent::getwalletinfo(), 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; From 30668ed502c3fe948c9a951313e0c101daa532ef Mon Sep 17 00:00:00 2001 From: r4sas Date: Sat, 12 May 2018 21:37:13 +0000 Subject: [PATCH 65/69] fix sharerate precision and reduce graphics page size --- include/classes/statistics.class.php | 2 +- templates/bootstrap/statistics/graphs/default.tpl | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/classes/statistics.class.php b/include/classes/statistics.class.php index bd7984541..54628668f 100644 --- a/include/classes/statistics.class.php +++ b/include/classes/statistics.class.php @@ -470,7 +470,7 @@ public function fetchAllUserMiningStats($interval=180) { 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 diff --git a/templates/bootstrap/statistics/graphs/default.tpl b/templates/bootstrap/statistics/graphs/default.tpl index 95261fccb..8ab987100 100644 --- a/templates/bootstrap/statistics/graphs/default.tpl +++ b/templates/bootstrap/statistics/graphs/default.tpl @@ -1,8 +1,9 @@