diff --git a/.travis.yml b/.travis.yml
index befdb98..d426a58 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,7 +5,6 @@ dist: trusty
sudo: false
php:
- - 5.6
- 7.0
- 7.1
diff --git a/composer.json b/composer.json
index 5fd7b2d..1cece7b 100644
--- a/composer.json
+++ b/composer.json
@@ -6,9 +6,10 @@
"license": "MIT",
"require": {
"php": ">=5.6",
- "cakephp/cakephp": "3.4.*",
+ "cakephp/cakephp": "3.7.1",
"mobiledetect/mobiledetectlib": "2.*",
"cakephp/migrations": "~1.0",
+ "psr/simple-cache": "^1.0.0",
"cakephp/plugin-installer": "~1.0",
"mdanter/ecc": "^0.5.0",
"nesbot/carbon": "~1.18",
diff --git a/composer.lock b/composer.lock
index 994e7b8..c34149a 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "e64d13561bc0e6896ed8629290b55669",
+ "content-hash": "bfdd477b9edc64f5c9f04b61d9bb6ae2",
"packages": [
{
"name": "aura/intl",
@@ -103,25 +103,26 @@
},
{
"name": "cakephp/cakephp",
- "version": "3.4.14",
+ "version": "3.7.1",
"source": {
"type": "git",
"url": "https://github.com/cakephp/cakephp.git",
- "reference": "57fcdfcf9376670ca4f6f5bd39100ede762afb88"
+ "reference": "1f6fd21ca27ffc88fa88506a400b94a809e29254"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/cakephp/cakephp/zipball/57fcdfcf9376670ca4f6f5bd39100ede762afb88",
- "reference": "57fcdfcf9376670ca4f6f5bd39100ede762afb88",
+ "url": "https://api.github.com/repos/cakephp/cakephp/zipball/1f6fd21ca27ffc88fa88506a400b94a809e29254",
+ "reference": "1f6fd21ca27ffc88fa88506a400b94a809e29254",
"shasum": ""
},
"require": {
"aura/intl": "^3.0.0",
- "cakephp/chronos": "^1.0.0",
+ "cakephp/chronos": "^1.0.1",
"ext-intl": "*",
"ext-mbstring": "*",
"php": ">=5.6.0",
"psr/log": "^1.0.0",
+ "psr/simple-cache": "^1.0.0",
"zendframework/zend-diactoros": "^1.4.0"
},
"conflict": {
@@ -144,16 +145,17 @@
},
"require-dev": {
"cakephp/cakephp-codesniffer": "^3.0",
- "phpunit/phpunit": "^5.7|^6.0"
+ "phpunit/phpunit": "^5.7.14|^6.0"
},
"suggest": {
+ "ext-curl": "To enable more efficient network calls in Http\\Client.",
"ext-openssl": "To use Security::encrypt() or have secure CSRF token generation.",
"lib-ICU": "The intl PHP library, to use Text::transliterate() or Text::slug()"
},
"type": "library",
"autoload": {
"psr-4": {
- "Cake\\": "src"
+ "Cake\\": "src/"
},
"files": [
"src/Core/functions.php",
@@ -185,7 +187,7 @@
"rapid-development",
"validation"
],
- "time": "2018-05-21T01:19:34+00:00"
+ "time": "2018-12-18T02:39:37+00:00"
},
{
"name": "cakephp/chronos",
@@ -246,29 +248,29 @@
},
{
"name": "cakephp/migrations",
- "version": "1.7.2",
+ "version": "1.8.1",
"source": {
"type": "git",
"url": "https://github.com/cakephp/migrations.git",
- "reference": "a5612adfd2efa8c90d29cb3b0c969de872a99eda"
+ "reference": "cd65daa9fae933bc0ccc69d5b5d92460375da9e2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/cakephp/migrations/zipball/a5612adfd2efa8c90d29cb3b0c969de872a99eda",
- "reference": "a5612adfd2efa8c90d29cb3b0c969de872a99eda",
+ "url": "https://api.github.com/repos/cakephp/migrations/zipball/cd65daa9fae933bc0ccc69d5b5d92460375da9e2",
+ "reference": "cd65daa9fae933bc0ccc69d5b5d92460375da9e2",
"shasum": ""
},
"require": {
- "cakephp/cache": "~3.2",
- "cakephp/orm": "~3.2",
- "php": ">=5.5.9",
+ "cakephp/cache": "^3.6.0",
+ "cakephp/orm": "^3.6.0",
+ "php": ">=5.6.0",
"robmorgan/phinx": "0.8.1"
},
"require-dev": {
- "cakephp/bake": "@stable",
- "cakephp/cakephp": "~3.2",
+ "cakephp/bake": "^1.7.0",
+ "cakephp/cakephp": "^3.6.0",
"cakephp/cakephp-codesniffer": "^3.0",
- "phpunit/phpunit": "~4.1"
+ "phpunit/phpunit": "^5.7.14"
},
"suggest": {
"cakephp/bake": "Required if you want to generate migrations."
@@ -295,7 +297,7 @@
"cakephp",
"migrations"
],
- "time": "2017-12-12T21:01:38+00:00"
+ "time": "2018-04-16T01:35:59+00:00"
},
{
"name": "cakephp/plugin-installer",
@@ -427,16 +429,16 @@
},
{
"name": "endroid/qr-code",
- "version": "3.5.0",
+ "version": "3.5.2",
"source": {
"type": "git",
"url": "https://github.com/endroid/qr-code.git",
- "reference": "0095706c3bf2389f15f6c097bab4a00a48fc5ff7"
+ "reference": "d95143907cf178f9073523af4b37feb25bd6cdd0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/endroid/qr-code/zipball/0095706c3bf2389f15f6c097bab4a00a48fc5ff7",
- "reference": "0095706c3bf2389f15f6c097bab4a00a48fc5ff7",
+ "url": "https://api.github.com/repos/endroid/qr-code/zipball/d95143907cf178f9073523af4b37feb25bd6cdd0",
+ "reference": "d95143907cf178f9073523af4b37feb25bd6cdd0",
"shasum": ""
},
"require": {
@@ -483,7 +485,7 @@
"qr",
"qrcode"
],
- "time": "2018-12-01T12:34:40+00:00"
+ "time": "2018-12-16T12:37:37+00:00"
},
{
"name": "fgrosse/phpasn1",
@@ -774,16 +776,16 @@
},
{
"name": "nesbot/carbon",
- "version": "1.36.1",
+ "version": "1.36.2",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
- "reference": "63da8cdf89d7a5efe43aabc794365f6e7b7b8983"
+ "reference": "cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/63da8cdf89d7a5efe43aabc794365f6e7b7b8983",
- "reference": "63da8cdf89d7a5efe43aabc794365f6e7b7b8983",
+ "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9",
+ "reference": "cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9",
"shasum": ""
},
"require": {
@@ -828,7 +830,7 @@
"datetime",
"time"
],
- "time": "2018-11-22T18:23:02+00:00"
+ "time": "2018-12-28T10:07:33+00:00"
},
{
"name": "predis/predis",
@@ -977,6 +979,54 @@
],
"time": "2018-11-20T15:27:04+00:00"
},
+ {
+ "name": "psr/simple-cache",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/simple-cache.git",
+ "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
+ "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\SimpleCache\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interfaces for simple caching",
+ "keywords": [
+ "cache",
+ "caching",
+ "psr",
+ "psr-16",
+ "simple-cache"
+ ],
+ "time": "2017-10-23T01:57:42+00:00"
+ },
{
"name": "robmorgan/phinx",
"version": "v0.8.1",
@@ -1045,16 +1095,16 @@
},
{
"name": "symfony/config",
- "version": "v3.4.19",
+ "version": "v3.4.21",
"source": {
"type": "git",
"url": "https://github.com/symfony/config.git",
- "reference": "8a660daeb65dedbe0b099529f65e61866c055081"
+ "reference": "17c5d8941eb75a03d19bc76a43757738632d87b3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/config/zipball/8a660daeb65dedbe0b099529f65e61866c055081",
- "reference": "8a660daeb65dedbe0b099529f65e61866c055081",
+ "url": "https://api.github.com/repos/symfony/config/zipball/17c5d8941eb75a03d19bc76a43757738632d87b3",
+ "reference": "17c5d8941eb75a03d19bc76a43757738632d87b3",
"shasum": ""
},
"require": {
@@ -1105,20 +1155,20 @@
],
"description": "Symfony Config Component",
"homepage": "https://symfony.com",
- "time": "2018-11-26T10:17:44+00:00"
+ "time": "2019-01-01T13:45:19+00:00"
},
{
"name": "symfony/console",
- "version": "v3.4.19",
+ "version": "v3.4.21",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb"
+ "reference": "a700b874d3692bc8342199adfb6d3b99f62cc61a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb",
- "reference": "8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb",
+ "url": "https://api.github.com/repos/symfony/console/zipball/a700b874d3692bc8342199adfb6d3b99f62cc61a",
+ "reference": "a700b874d3692bc8342199adfb6d3b99f62cc61a",
"shasum": ""
},
"require": {
@@ -1174,20 +1224,20 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
- "time": "2018-11-26T12:48:07+00:00"
+ "time": "2019-01-04T04:42:43+00:00"
},
{
"name": "symfony/contracts",
- "version": "v1.0.1",
+ "version": "v1.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/contracts.git",
- "reference": "3edf0ab943d1985a356721952cba36ff31bd6e5f"
+ "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/contracts/zipball/3edf0ab943d1985a356721952cba36ff31bd6e5f",
- "reference": "3edf0ab943d1985a356721952cba36ff31bd6e5f",
+ "url": "https://api.github.com/repos/symfony/contracts/zipball/1aa7ab2429c3d594dd70689604b5cf7421254cdf",
+ "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf",
"shasum": ""
},
"require": {
@@ -1242,20 +1292,20 @@
"interoperability",
"standards"
],
- "time": "2018-11-24T09:35:08+00:00"
+ "time": "2018-12-05T08:06:11+00:00"
},
{
"name": "symfony/debug",
- "version": "v4.2.0",
+ "version": "v4.2.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
- "reference": "e0a2b92ee0b5b934f973d90c2f58e18af109d276"
+ "reference": "64cb33c81e37d19b7715d4a6a4d49c1c382066dd"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/debug/zipball/e0a2b92ee0b5b934f973d90c2f58e18af109d276",
- "reference": "e0a2b92ee0b5b934f973d90c2f58e18af109d276",
+ "url": "https://api.github.com/repos/symfony/debug/zipball/64cb33c81e37d19b7715d4a6a4d49c1c382066dd",
+ "reference": "64cb33c81e37d19b7715d4a6a4d49c1c382066dd",
"shasum": ""
},
"require": {
@@ -1298,20 +1348,20 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
- "time": "2018-11-28T18:24:18+00:00"
+ "time": "2019-01-03T09:07:35+00:00"
},
{
"name": "symfony/filesystem",
- "version": "v4.2.0",
+ "version": "v4.2.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
- "reference": "2f4c8b999b3b7cadb2a69390b01af70886753710"
+ "reference": "c2ffd9a93f2d6c5be2f68a0aa7953cc229f871f8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/filesystem/zipball/2f4c8b999b3b7cadb2a69390b01af70886753710",
- "reference": "2f4c8b999b3b7cadb2a69390b01af70886753710",
+ "url": "https://api.github.com/repos/symfony/filesystem/zipball/c2ffd9a93f2d6c5be2f68a0aa7953cc229f871f8",
+ "reference": "c2ffd9a93f2d6c5be2f68a0aa7953cc229f871f8",
"shasum": ""
},
"require": {
@@ -1348,20 +1398,20 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
- "time": "2018-11-11T19:52:12+00:00"
+ "time": "2019-01-03T09:07:35+00:00"
},
{
"name": "symfony/inflector",
- "version": "v4.2.0",
+ "version": "v4.2.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/inflector.git",
- "reference": "f9a637c0359f74404d44cf0da0a3ce53bae0787e"
+ "reference": "9f64271222922ef1a10e43f77d88baf72bf22b0e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/inflector/zipball/f9a637c0359f74404d44cf0da0a3ce53bae0787e",
- "reference": "f9a637c0359f74404d44cf0da0a3ce53bae0787e",
+ "url": "https://api.github.com/repos/symfony/inflector/zipball/9f64271222922ef1a10e43f77d88baf72bf22b0e",
+ "reference": "9f64271222922ef1a10e43f77d88baf72bf22b0e",
"shasum": ""
},
"require": {
@@ -1406,20 +1456,20 @@
"symfony",
"words"
],
- "time": "2018-11-11T19:52:12+00:00"
+ "time": "2019-01-03T09:07:35+00:00"
},
{
"name": "symfony/options-resolver",
- "version": "v4.2.0",
+ "version": "v4.2.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
- "reference": "a9c38e8a3da2c03b3e71fdffa6efb0bda51390ba"
+ "reference": "fbcb106aeee72f3450298bf73324d2cc00d083d1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/options-resolver/zipball/a9c38e8a3da2c03b3e71fdffa6efb0bda51390ba",
- "reference": "a9c38e8a3da2c03b3e71fdffa6efb0bda51390ba",
+ "url": "https://api.github.com/repos/symfony/options-resolver/zipball/fbcb106aeee72f3450298bf73324d2cc00d083d1",
+ "reference": "fbcb106aeee72f3450298bf73324d2cc00d083d1",
"shasum": ""
},
"require": {
@@ -1460,7 +1510,7 @@
"configuration",
"options"
],
- "time": "2018-11-11T19:52:12+00:00"
+ "time": "2019-01-03T09:07:35+00:00"
},
{
"name": "symfony/polyfill-ctype",
@@ -1581,16 +1631,16 @@
},
{
"name": "symfony/property-access",
- "version": "v4.2.0",
+ "version": "v4.2.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/property-access.git",
- "reference": "b6df4e1849f389468edb36e2e59877d4a8170723"
+ "reference": "a21d40670000f61a1a4b90a607d54696aad914cd"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/property-access/zipball/b6df4e1849f389468edb36e2e59877d4a8170723",
- "reference": "b6df4e1849f389468edb36e2e59877d4a8170723",
+ "url": "https://api.github.com/repos/symfony/property-access/zipball/a21d40670000f61a1a4b90a607d54696aad914cd",
+ "reference": "a21d40670000f61a1a4b90a607d54696aad914cd",
"shasum": ""
},
"require": {
@@ -1644,25 +1694,25 @@
"property path",
"reflection"
],
- "time": "2018-11-29T14:48:32+00:00"
+ "time": "2019-01-05T16:37:49+00:00"
},
{
"name": "symfony/translation",
- "version": "v4.2.0",
+ "version": "v4.2.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
- "reference": "ff9a878c9b8f8bcd4d9138e2d32f508c942773d9"
+ "reference": "939fb792d73f2ce80e6ae9019d205fc480f1c9a0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/translation/zipball/ff9a878c9b8f8bcd4d9138e2d32f508c942773d9",
- "reference": "ff9a878c9b8f8bcd4d9138e2d32f508c942773d9",
+ "url": "https://api.github.com/repos/symfony/translation/zipball/939fb792d73f2ce80e6ae9019d205fc480f1c9a0",
+ "reference": "939fb792d73f2ce80e6ae9019d205fc480f1c9a0",
"shasum": ""
},
"require": {
"php": "^7.1.3",
- "symfony/contracts": "^1.0",
+ "symfony/contracts": "^1.0.2",
"symfony/polyfill-mbstring": "~1.0"
},
"conflict": {
@@ -1717,20 +1767,20 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
- "time": "2018-11-27T07:20:32+00:00"
+ "time": "2019-01-03T09:07:35+00:00"
},
{
"name": "symfony/yaml",
- "version": "v3.4.19",
+ "version": "v3.4.21",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "291e13d808bec481eab83f301f7bff3e699ef603"
+ "reference": "554a59a1ccbaac238a89b19c8e551a556fd0e2ea"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/291e13d808bec481eab83f301f7bff3e699ef603",
- "reference": "291e13d808bec481eab83f301f7bff3e699ef603",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/554a59a1ccbaac238a89b19c8e551a556fd0e2ea",
+ "reference": "554a59a1ccbaac238a89b19c8e551a556fd0e2ea",
"shasum": ""
},
"require": {
@@ -1776,7 +1826,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
- "time": "2018-11-11T19:48:54+00:00"
+ "time": "2019-01-01T13:45:19+00:00"
},
{
"name": "zendframework/zend-diactoros",
@@ -1845,27 +1895,199 @@
],
"packages-dev": [
{
- "name": "cakephp/bake",
- "version": "1.3.7",
+ "name": "ajgl/breakpoint-twig-extension",
+ "version": "0.3.2",
"source": {
"type": "git",
- "url": "https://github.com/cakephp/bake.git",
- "reference": "4bbb541ee27d12fe63f15cf5acf70b94553de209"
+ "url": "https://github.com/ajgarlag/AjglBreakpointTwigExtension.git",
+ "reference": "bb419d13775d8fb5cd03b31012eaf496b31b444f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/cakephp/bake/zipball/4bbb541ee27d12fe63f15cf5acf70b94553de209",
- "reference": "4bbb541ee27d12fe63f15cf5acf70b94553de209",
+ "url": "https://api.github.com/repos/ajgarlag/AjglBreakpointTwigExtension/zipball/bb419d13775d8fb5cd03b31012eaf496b31b444f",
+ "reference": "bb419d13775d8fb5cd03b31012eaf496b31b444f",
"shasum": ""
},
"require": {
- "cakephp/cakephp": ">=3.4.0 <4.0.0",
- "cakephp/plugin-installer": "*",
- "php": ">=5.6.0"
+ "php": ">=5.6",
+ "twig/twig": "^1.14|^2.0"
+ },
+ "require-dev": {
+ "symfony/framework-bundle": "^2.7|^3.2|^4.1",
+ "symfony/phpunit-bridge": "^3.4|^4.1",
+ "symfony/twig-bundle": "^2.7|^3.2|^4.1"
+ },
+ "suggest": {
+ "ext-xdebug": "The Xdebug extension is required for the breakpoint to work",
+ "symfony/framework-bundle": "The framework bundle to integrate the extension into Symfony",
+ "symfony/twig-bundle": "The twig bundle to integrate the extension into Symfony"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "0.3.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Ajgl\\Twig\\Extension\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Antonio J. García Lagar",
+ "email": "aj@garcialagar.es",
+ "homepage": "http://aj.garcialagar.es",
+ "role": "developer"
+ }
+ ],
+ "description": "Twig extension to set breakpoints",
+ "homepage": "https://github.com/ajgarlag/AjglBreakpointTwigExtension",
+ "keywords": [
+ "Xdebug",
+ "breakpoint",
+ "twig"
+ ],
+ "time": "2018-12-10T08:22:36+00:00"
+ },
+ {
+ "name": "aptoma/twig-markdown",
+ "version": "2.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/aptoma/twig-markdown.git",
+ "reference": "64a9c5c7418c08faf91c4410b34bdb65fb25c23d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/aptoma/twig-markdown/zipball/64a9c5c7418c08faf91c4410b34bdb65fb25c23d",
+ "reference": "64a9c5c7418c08faf91c4410b34bdb65fb25c23d",
+ "shasum": ""
+ },
+ "require": {
+ "twig/twig": "~1.12"
+ },
+ "require-dev": {
+ "codeclimate/php-test-reporter": "dev-master",
+ "erusev/parsedown": "^1.6",
+ "knplabs/github-api": "~1.2",
+ "league/commonmark": "~0.5",
+ "michelf/php-markdown": "~1",
+ "phpunit/phpunit": "~4.0",
+ "satooshi/php-coveralls": "~0.6"
+ },
+ "suggest": {
+ "knplabs/github-api": "Needed for using GitHub's Markdown engine provided through their API.",
+ "michelf/php-markdown": "Original Markdown engine with MarkdownExtra."
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "Aptoma": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Joris Berthelot",
+ "email": "joris@berthelot.tel"
+ },
+ {
+ "name": "Gunnar Lium",
+ "email": "gunnar@aptoma.com"
+ }
+ ],
+ "description": "Twig extension to work with Markdown content",
+ "keywords": [
+ "markdown",
+ "twig"
+ ],
+ "time": "2015-10-23T20:27:08+00:00"
+ },
+ {
+ "name": "asm89/twig-cache-extension",
+ "version": "1.3.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/asm89/twig-cache-extension.git",
+ "reference": "630ea7abdc3fc62ba6786c02590a1560e449cf55"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/asm89/twig-cache-extension/zipball/630ea7abdc3fc62ba6786c02590a1560e449cf55",
+ "reference": "630ea7abdc3fc62ba6786c02590a1560e449cf55",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.2",
+ "twig/twig": "^1.0|^2.0"
+ },
+ "require-dev": {
+ "doctrine/cache": "~1.0"
+ },
+ "suggest": {
+ "psr/cache-implementation": "To make use of PSR-6 cache implementation via PsrCacheAdapter."
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "": "lib/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Alexander",
+ "email": "iam.asm89@gmail.com"
+ }
+ ],
+ "description": "Cache fragments of templates directly within Twig.",
+ "homepage": "https://github.com/asm89/twig-cache-extension",
+ "keywords": [
+ "cache",
+ "extension",
+ "twig"
+ ],
+ "time": "2017-01-10T22:04:15+00:00"
+ },
+ {
+ "name": "cakephp/bake",
+ "version": "1.9.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/cakephp/bake.git",
+ "reference": "9949a6a867a17cf30996dfc9daceab1c63a7a9c1"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/cakephp/bake/zipball/9949a6a867a17cf30996dfc9daceab1c63a7a9c1",
+ "reference": "9949a6a867a17cf30996dfc9daceab1c63a7a9c1",
+ "shasum": ""
+ },
+ "require": {
+ "cakephp/cakephp": "^3.7.0",
+ "cakephp/plugin-installer": "^1.0",
+ "php": ">=5.6.0",
+ "wyrihaximus/twig-view": "^4.3.7"
},
"require-dev": {
"cakephp/cakephp-codesniffer": "^3.0",
- "phpunit/phpunit": "~5.7 | ~6.0"
+ "phpunit/phpunit": "^5.7.14|^6.0"
},
"type": "cakephp-plugin",
"autoload": {
@@ -1883,30 +2105,30 @@
"homepage": "https://github.com/cakephp/bake/graphs/contributors"
}
],
- "description": "Bake plugin for CakePHP 3.0",
+ "description": "Bake plugin for CakePHP 3",
"homepage": "https://github.com/cakephp/bake",
"keywords": [
"bake",
"cakephp"
],
- "time": "2017-07-01T15:59:12+00:00"
+ "time": "2019-01-02T12:59:40+00:00"
},
{
"name": "cakephp/debug_kit",
- "version": "3.14.2",
+ "version": "3.17.0",
"source": {
"type": "git",
"url": "https://github.com/cakephp/debug_kit.git",
- "reference": "b5e11f386b9ff28694950f68ef3e0456c242051b"
+ "reference": "6a9023ecc4ac0983c184cedf8e6142ab8ea4a3ff"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/cakephp/debug_kit/zipball/b5e11f386b9ff28694950f68ef3e0456c242051b",
- "reference": "b5e11f386b9ff28694950f68ef3e0456c242051b",
+ "url": "https://api.github.com/repos/cakephp/debug_kit/zipball/6a9023ecc4ac0983c184cedf8e6142ab8ea4a3ff",
+ "reference": "6a9023ecc4ac0983c184cedf8e6142ab8ea4a3ff",
"shasum": ""
},
"require": {
- "cakephp/cakephp": "^3.4.0",
+ "cakephp/cakephp": "^3.7.0",
"cakephp/chronos": "^1.0.0",
"cakephp/plugin-installer": "^1.0.0",
"composer/composer": "^1.3.0",
@@ -1915,10 +2137,10 @@
},
"require-dev": {
"cakephp/cakephp-codesniffer": "^3.0",
- "phpunit/phpunit": "^5.7|^6.0"
+ "phpunit/phpunit": "^5.7.14|^6.0"
},
"suggest": {
- "ext-sqlite": "DebugKit needs to store panel data in a database. SQLite is simple and easy to use."
+ "ext-pdo_sqlite": "DebugKit needs to store panel data in a database. SQLite is simple and easy to use."
},
"type": "cakephp-plugin",
"autoload": {
@@ -1949,7 +2171,7 @@
"debug",
"kit"
],
- "time": "2018-03-08T18:21:10+00:00"
+ "time": "2018-12-02T03:27:26+00:00"
},
{
"name": "composer/ca-bundle",
@@ -2375,6 +2597,66 @@
"description": "Highlight PHP code in terminal",
"time": "2018-09-29T18:48:56+00:00"
},
+ {
+ "name": "jasny/twig-extensions",
+ "version": "v1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/jasny/twig-extensions.git",
+ "reference": "30bdf3a3903c021544f36332c9d5d4d563527da4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/jasny/twig-extensions/zipball/30bdf3a3903c021544f36332c9d5d4d563527da4",
+ "reference": "30bdf3a3903c021544f36332c9d5d4d563527da4",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.0.0 | >=5.6.0",
+ "twig/twig": "^2.0 | ^1.12"
+ },
+ "require-dev": {
+ "ext-intl": "*",
+ "ext-pcre": "*",
+ "jasny/php-code-quality": "^2.1",
+ "phpunit/phpunit": "^5.0"
+ },
+ "suggest": {
+ "ext-intl": "Required for the use of the LocalDate Twig extension",
+ "ext-pcre": "Required for the use of the PCRE Twig extension"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Jasny\\Twig\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Arnold Daniels",
+ "email": "arnold@jasny.net",
+ "homepage": "http://www.jasny.net"
+ }
+ ],
+ "description": "A set of useful Twig filters",
+ "homepage": "http://github.com/jasny/twig-extensions#README",
+ "keywords": [
+ "PCRE",
+ "array",
+ "date",
+ "datetime",
+ "preg",
+ "regex",
+ "templating",
+ "text",
+ "time"
+ ],
+ "time": "2017-09-13T07:38:01+00:00"
+ },
{
"name": "jdorn/sql-formatter",
"version": "v1.2.17",
@@ -2427,23 +2709,23 @@
},
{
"name": "justinrainbow/json-schema",
- "version": "5.2.7",
+ "version": "5.2.8",
"source": {
"type": "git",
"url": "https://github.com/justinrainbow/json-schema.git",
- "reference": "8560d4314577199ba51bf2032f02cd1315587c23"
+ "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/8560d4314577199ba51bf2032f02cd1315587c23",
- "reference": "8560d4314577199ba51bf2032f02cd1315587c23",
+ "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/dcb6e1006bb5fd1e392b4daa68932880f37550d4",
+ "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
- "friendsofphp/php-cs-fixer": "^2.1",
+ "friendsofphp/php-cs-fixer": "~2.2.20",
"json-schema/json-schema-test-suite": "1.2.0",
"phpunit/phpunit": "^4.8.35"
},
@@ -2489,20 +2771,20 @@
"json",
"schema"
],
- "time": "2018-02-14T22:26:30+00:00"
+ "time": "2019-01-14T23:55:14+00:00"
},
{
"name": "nikic/php-parser",
- "version": "v4.1.0",
+ "version": "v4.2.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
- "reference": "d0230c5c77a7e3cfa69446febf340978540958c0"
+ "reference": "594bcae1fc0bccd3993d2f0d61a018e26ac2865a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/d0230c5c77a7e3cfa69446febf340978540958c0",
- "reference": "d0230c5c77a7e3cfa69446febf340978540958c0",
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/594bcae1fc0bccd3993d2f0d61a018e26ac2865a",
+ "reference": "594bcae1fc0bccd3993d2f0d61a018e26ac2865a",
"shasum": ""
},
"require": {
@@ -2518,7 +2800,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "4.1-dev"
+ "dev-master": "4.2-dev"
}
},
"autoload": {
@@ -2540,7 +2822,7 @@
"parser",
"php"
],
- "time": "2018-10-10T09:24:14+00:00"
+ "time": "2019-01-12T16:31:37+00:00"
},
{
"name": "psy/psysh",
@@ -2711,16 +2993,16 @@
},
{
"name": "symfony/finder",
- "version": "v4.2.0",
+ "version": "v4.2.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
- "reference": "e53d477d7b5c4982d0e1bfd2298dbee63d01441d"
+ "reference": "9094d69e8c6ee3fe186a0ec5a4f1401e506071ce"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/finder/zipball/e53d477d7b5c4982d0e1bfd2298dbee63d01441d",
- "reference": "e53d477d7b5c4982d0e1bfd2298dbee63d01441d",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/9094d69e8c6ee3fe186a0ec5a4f1401e506071ce",
+ "reference": "9094d69e8c6ee3fe186a0ec5a4f1401e506071ce",
"shasum": ""
},
"require": {
@@ -2756,7 +3038,7 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
- "time": "2018-11-11T19:52:12+00:00"
+ "time": "2019-01-03T09:07:35+00:00"
},
{
"name": "symfony/polyfill-php72",
@@ -2815,16 +3097,16 @@
},
{
"name": "symfony/process",
- "version": "v4.2.0",
+ "version": "v4.2.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
- "reference": "2b341009ccec76837a7f46f59641b431e4d4c2b0"
+ "reference": "ea043ab5d8ed13b467a9087d81cb876aee7f689a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/process/zipball/2b341009ccec76837a7f46f59641b431e4d4c2b0",
- "reference": "2b341009ccec76837a7f46f59641b431e4d4c2b0",
+ "url": "https://api.github.com/repos/symfony/process/zipball/ea043ab5d8ed13b467a9087d81cb876aee7f689a",
+ "reference": "ea043ab5d8ed13b467a9087d81cb876aee7f689a",
"shasum": ""
},
"require": {
@@ -2860,20 +3142,20 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
- "time": "2018-11-20T16:22:05+00:00"
+ "time": "2019-01-03T14:48:52+00:00"
},
{
"name": "symfony/var-dumper",
- "version": "v4.2.0",
+ "version": "v4.2.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
- "reference": "db61258540350725f4beb6b84006e32398acd120"
+ "reference": "85bde661b178173d85c6f11ea9d03b61d1212bb2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/var-dumper/zipball/db61258540350725f4beb6b84006e32398acd120",
- "reference": "db61258540350725f4beb6b84006e32398acd120",
+ "url": "https://api.github.com/repos/symfony/var-dumper/zipball/85bde661b178173d85c6f11ea9d03b61d1212bb2",
+ "reference": "85bde661b178173d85c6f11ea9d03b61d1212bb2",
"shasum": ""
},
"require": {
@@ -2887,6 +3169,7 @@
},
"require-dev": {
"ext-iconv": "*",
+ "symfony/console": "~3.4|~4.0",
"symfony/process": "~3.4|~4.0",
"twig/twig": "~1.34|~2.4"
},
@@ -2935,7 +3218,172 @@
"debug",
"dump"
],
- "time": "2018-11-25T12:50:42+00:00"
+ "time": "2019-01-03T09:07:35+00:00"
+ },
+ {
+ "name": "twig/twig",
+ "version": "v1.37.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/twigphp/Twig.git",
+ "reference": "66be9366c76cbf23e82e7171d47cbfa54a057a62"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/twigphp/Twig/zipball/66be9366c76cbf23e82e7171d47cbfa54a057a62",
+ "reference": "66be9366c76cbf23e82e7171d47cbfa54a057a62",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0",
+ "symfony/polyfill-ctype": "^1.8"
+ },
+ "require-dev": {
+ "psr/container": "^1.0",
+ "symfony/debug": "^2.7",
+ "symfony/phpunit-bridge": "^3.4.19|^4.1.8"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.37-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Twig_": "lib/"
+ },
+ "psr-4": {
+ "Twig\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com",
+ "homepage": "http://fabien.potencier.org",
+ "role": "Lead Developer"
+ },
+ {
+ "name": "Armin Ronacher",
+ "email": "armin.ronacher@active-4.com",
+ "role": "Project Founder"
+ },
+ {
+ "name": "Twig Team",
+ "homepage": "https://twig.symfony.com/contributors",
+ "role": "Contributors"
+ }
+ ],
+ "description": "Twig, the flexible, fast, and secure template language for PHP",
+ "homepage": "https://twig.symfony.com",
+ "keywords": [
+ "templating"
+ ],
+ "time": "2019-01-14T14:59:29+00:00"
+ },
+ {
+ "name": "umpirsky/twig-php-function",
+ "version": "v0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/umpirsky/twig-php-function.git",
+ "reference": "53b4b1eb0c5eacbd7d66c504b7d809c79b4bedbc"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/umpirsky/twig-php-function/zipball/53b4b1eb0c5eacbd7d66c504b7d809c79b4bedbc",
+ "reference": "53b4b1eb0c5eacbd7d66c504b7d809c79b4bedbc",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "twig/twig": "~1.12"
+ },
+ "require-dev": {
+ "phpspec/phpspec": "~2.0",
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "Umpirsky\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Saša Stamenković",
+ "email": "umpirsky@gmail.com"
+ }
+ ],
+ "description": "Call (almost) any PHP function from your Twig templates.",
+ "time": "2016-03-12T16:36:32+00:00"
+ },
+ {
+ "name": "wyrihaximus/twig-view",
+ "version": "4.3.8",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/WyriHaximus/TwigView.git",
+ "reference": "a5ec66690aa045d6eda17ab1c8a5baf0efdcfa45"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/WyriHaximus/TwigView/zipball/a5ec66690aa045d6eda17ab1c8a5baf0efdcfa45",
+ "reference": "a5ec66690aa045d6eda17ab1c8a5baf0efdcfa45",
+ "shasum": ""
+ },
+ "require": {
+ "ajgl/breakpoint-twig-extension": "^0.3.0",
+ "aptoma/twig-markdown": "^2.0",
+ "asm89/twig-cache-extension": "^1.0",
+ "cakephp/cakephp": "^3.6",
+ "jasny/twig-extensions": "^1.0",
+ "php": "^5.6 || ^7.0",
+ "twig/twig": "^1.27",
+ "umpirsky/twig-php-function": "0.1"
+ },
+ "require-dev": {
+ "cakephp/bake": "^1.5",
+ "cakephp/debug_kit": "^3.0",
+ "phake/phake": "^1.0.4",
+ "phpunit/phpunit": "^5.7.14",
+ "squizlabs/php_codesniffer": "^1.5.6",
+ "wyrihaximus/phpunit-class-reflection-helpers": "dev-master"
+ },
+ "type": "cakephp-plugin",
+ "autoload": {
+ "psr-4": {
+ "WyriHaximus\\TwigView\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Cees-Jan Kiewiet",
+ "email": "ceesjank@gmail.com",
+ "homepage": "http://wyrihaximus.net/"
+ }
+ ],
+ "description": "Twig powered View for CakePHP3",
+ "keywords": [
+ "cakephp",
+ "cakephp3",
+ "twig",
+ "view"
+ ],
+ "time": "2018-12-17T21:08:25+00:00"
}
],
"aliases": [],
diff --git a/config/app.default.php b/config/app.default.php
index c06599e..4ebb149 100644
--- a/config/app.default.php
+++ b/config/app.default.php
@@ -218,20 +218,20 @@ return [
* See vendor\cakephp\cakephp\src\Database\Driver for complete list
*/
'Datasources' => [
- 'default' => [
+ 'default' => [ // Chainquery database connection
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
- 'host' => 'localhost',
+ 'host' => 'chainquery.lbry.io',
/**
* CakePHP will use the default DB port based on the driver selected
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
* the following line and set the port accordingly
*/
- //'port' => 'non_standard_port_number',
- 'username' => 'my_app',
+ //'port' => '3000',
+ 'username' => 'username',
'password' => 'secret',
- 'database' => 'my_app',
+ 'database' => 'my_db',
'encoding' => 'utf8',
'timezone' => 'UTC',
'flags' => [],
@@ -257,7 +257,28 @@ return [
*/
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
- 'url' => env('DATABASE_URL', null),
+ 'url' => env('DATABASE_URL', 'chainquery.lbry.io:3600'),
+ ],
+
+ 'localdb' => [ // Local db for price history
+ 'className' => 'Cake\Database\Connection',
+ 'driver' => 'Cake\Database\Driver\Mysql',
+ 'persistent' => false,
+ 'host' => 'localhost',
+ /**
+ * CakePHP will use the default DB port based on the driver selected
+ * MySQL on MAMP uses port 8889, MAMP users will want to uncomment
+ * the following line and set the port accordingly
+ */
+ //'port' => '3306',
+ 'username' => 'username',
+ 'password' => 'secret',
+ 'database' => 'lbry',
+ 'encoding' => 'utf8',
+ 'timezone' => 'UTC',
+ 'flags' => [],
+ 'cacheMetadata' => true,
+ 'log' => false,
],
/**
diff --git a/config/bootstrap.php b/config/bootstrap.php
index 938d3c2..756de4d 100644
--- a/config/bootstrap.php
+++ b/config/bootstrap.php
@@ -49,6 +49,7 @@ require __DIR__ . '/paths.php';
*/
require CORE_PATH . 'config' . DS . 'bootstrap.php';
+use App\Application;
use Cake\Cache\Cache;
use Cake\Console\ConsoleErrorHandler;
use Cake\Core\App;
@@ -60,7 +61,8 @@ use Cake\Datasource\ConnectionManager;
use Cake\Error\ErrorHandler;
use Cake\Log\Log;
use Cake\Mailer\Email;
-use Cake\Network\Request;
+use Cake\Mailer\TransportFactory;
+use Cake\Http\ServerRequest;
use Cake\Utility\Inflector;
use Cake\Utility\Security;
@@ -150,10 +152,12 @@ if (!Configure::read('App.fullBaseUrl')) {
Cache::setConfig(Configure::consume('Cache'));
ConnectionManager::setConfig(Configure::consume('Datasources'));
-Email::setConfigTransport(Configure::consume('EmailTransport'));
+//Email::setConfigTransport(Configure::consume('EmailTransport'));
+TransportFactory::setConfig(Configure::consume('EmailTransport'));
Email::setConfig(Configure::consume('Email'));
Log::setConfig(Configure::consume('Log'));
-Security::salt(Configure::consume('Security.salt'));
+//Security::salt(Configure::consume('Security.salt'));
+Security::setSalt(Configure::consume('Security.salt'));
/*
* The default crypto extension in 3.0 is OpenSSL.
@@ -165,12 +169,12 @@ Security::salt(Configure::consume('Security.salt'));
/*
* Setup detectors for mobile and tablet.
*/
-Request::addDetector('mobile', function ($request) {
+ServerRequest::addDetector('mobile', function ($request) {
$detector = new \Detection\MobileDetect();
return $detector->isMobile();
});
-Request::addDetector('tablet', function ($request) {
+ServerRequest::addDetector('tablet', function ($request) {
$detector = new \Detection\MobileDetect();
return $detector->isTablet();
@@ -218,8 +222,9 @@ Type::build('timestamp')
* Debug Kit should not be installed on a production system
*/
if (Configure::read('debug')) {
- Plugin::load('DebugKit', ['bootstrap' => true]);
+ //Plugin::load('DebugKit', ['bootstrap' => true]);
+ Application::addPlugin('DebugKit', ['bootstrap' => true]);
}
-Configure::load('lbry');
+Configure::load('lbry','lbry.default');
diff --git a/config/routes.php b/config/routes.php
index abb4474..08e8237 100644
--- a/config/routes.php
+++ b/config/routes.php
@@ -72,9 +72,3 @@ Router::scope('/', function (RouteBuilder $routes) {
//$routes->fallbacks(DashedRoute::class);
});
-
-/**
- * Load all plugin routes. See the Plugin documentation on
- * how to customize the loading of plugin routes.
- */
-Plugin::routes();
diff --git a/dev.sh b/dev.sh
new file mode 100755
index 0000000..d617fd1
--- /dev/null
+++ b/dev.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -e
+
+PHPBIN=php7.2
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+
+if [ ! -e "config/app.php" ]; then
+ cp "$DIR/config/app.default.php" "$DIR/config/app.php"
+fi
+
+if ! which $PHPBIN 2>/dev/null; then
+ PHPBIN=php
+fi
+
+#Composer update
+composer update
+
+#$PHPBIN composer.phar install
+
+$PHPBIN --server localhost:8000 --docroot "$DIR/webroot" "$DIR/webroot/index.php"
\ No newline at end of file
diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php
index 0bbaacc..7419653 100644
--- a/src/Controller/MainController.php
+++ b/src/Controller/MainController.php
@@ -15,6 +15,7 @@ use Endroid\QrCode\LabelAlignment;
use Endroid\QrCode\QrCode;
use Endroid\QrCode\Response\QrCodeResponse;
+
class MainController extends AppController {
public static $rpcurl;
@@ -95,21 +96,17 @@ class MainController extends AppController {
$lbcUsdPrice = $this->_getLatestPrice();
$this->set('lbcUsdPrice', $lbcUsdPrice);
- $blocks = $this->Blocks->find()->select(['Chainwork', 'Confirmations', 'Difficulty', 'Hash', 'Height', 'TransactionHashes', 'BlockTime', 'BlockSize'])->
- order(['Height' => 'desc'])->limit(6)->toArray();
+ $blocks = $this->Blocks->find()->select(['chainwork', 'confirmations', 'difficulty', 'hash', 'height', 'transaction_hashes', 'block_time', 'block_size'])->order(['height' => 'desc'])->limit(6)->toArray();
for ($i = 0; $i < count($blocks); $i++) {
- $tx_hashes = json_decode($blocks[$i]->TransactionHashes);
- $blocks[$i]->TransactionCount = count($tx_hashes);
+ $tx_hashes = preg_split('#,#', $blocks[$i]->transaction_hashes);
+ $blocks[$i]->transaction_count = count($tx_hashes);
}
-
// hash rate
$hashRate = $this->_formatHashRate($this->_gethashrate());
// recent claims
- $claims = $this->Claims->find()->select(['TransactionHash', 'Name', 'Vout', 'ClaimId', 'ClaimType', 'Author', 'Title', 'Description', 'ContentType',
- 'IsNSFW', 'Language', 'ThumbnailUrl', 'Created'])->
- distinct(['Claims.ClaimId'])->
- contain(['Publisher' => ['fields' => ['Name']]])->order(['Claims.Created' => 'DESC'])->limit(5)->toArray();
+ //$claims = $this->Claims->find()->distinct(['Claims.claim_id'])->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->order(['Claims.created_at' => 'DESC'])->limit(5)->toArray();
+ $claims = $this->Claims->find()->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->order(['Claims.created_at' => 'DESC'])->limit(5)->toArray();
$this->set('recentBlocks', $blocks);
$this->set('recentClaims', $claims);
@@ -121,7 +118,9 @@ class MainController extends AppController {
$this->loadModel('Transactions');
$canConvert = false;
- $priceInfo = json_decode($this->redis->get(self::lbcPriceKey));
+ if(isset($this->redis)) {
+ $priceInfo = json_decode($this->redis->get(self::lbcPriceKey));
+ }
if (isset($priceInfo->price)) {
$canConvert = true;
}
@@ -133,7 +132,7 @@ class MainController extends AppController {
$page = intval($this->request->query('page'));
$conn = ConnectionManager::get('default');
- $stmt = $conn->execute('SELECT COUNT(Id) AS Total FROM Claims');
+ $stmt = $conn->execute('SELECT COUNT(id) AS Total FROM claim');
$count = $stmt->fetch(\PDO::FETCH_OBJ);
$numClaims = $count->Total;
@@ -146,12 +145,13 @@ class MainController extends AppController {
}
$offset = ($page - 1) * $pageLimit;
- $claims = $this->Claims->find()->distinct(['Claims.ClaimId'])->contain(['Stream', 'Publisher' => ['fields' => ['Name']]])->order(['Claims.Created' => 'DESC'])->offset($offset)->limit($pageLimit)->toArray();
- for ($i = 0; $i < count($claims); $i++) {
- if ($canConvert && $claims[$i]->Fee > 0 && $claims[$i]->FeeCurrency == 'USD') {
- $claims[$i]->Price = $claims[$i]->Fee / $priceInfo->price;
- }
+ $claims = $this->Claims->find()->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->order(['Claims.created_at' => 'DESC'])->offset($offset)->limit($pageLimit)->toArray();
+ for ($i = 0; $i < count($claims); $i++) {
+ if ($canConvert && $claims[$i]->fee > 0 && $claims[$i]->fee_currency == 'USD') {
+ $claims[$i]->price = $claims[$i]->fee / $priceInfo->price;
+ }
+
if (isset($claims[$i]->Stream)) {
$json = json_decode($claims[$i]->Stream->Stream);
if (isset($json->metadata->license)) {
@@ -169,13 +169,13 @@ class MainController extends AppController {
$this->set('currentPage', $page);
$this->set('claims', $claims);
} else {
- $claim = $this->Claims->find()->contain(['Stream', 'Publisher' => ['fields' => ['ClaimId', 'Name']]])->where(['Claims.ClaimId' => $id])->order(['Claims.Created' => 'DESC'])->first();
+ $claim = $this->Claims->find()->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->where(['Claims.claim_id' => $id])->order(['Claims.created_at' => 'DESC'])->first();
if (!$claim) {
return $this->redirect('/');
}
- if ($canConvert && $claim->Fee > 0 && $claim->FeeCurrency == 'USD') {
- $claim->Price = $claim->Fee / $priceInfo->price;
+ if ($canConvert && $claim->fee > 0 && $claim->fee_currency == 'USD') {
+ $claim->price = $claim->fee / $priceInfo->price;
}
if (isset($claim->Stream)) {
@@ -189,14 +189,12 @@ class MainController extends AppController {
}
$moreClaims = [];
- if (isset($claim->Publisher) || $claim->ClaimType == 1) {
+ if (isset($claim->publisher) || $claim->claim_type == 1) {
// find more claims for the publisher
- $moreClaims = $this->Claims->find()->contain(['Stream', 'Publisher' => ['fields' => ['Name']]])->
- where(['Claims.ClaimType' => 2, 'Claims.Id <>' => $claim->Id, 'Claims.PublisherId' => isset($claim->Publisher) ? $claim->Publisher->ClaimId : $claim->ClaimId])->
- limit(9)->order(['Claims.Fee' => 'DESC', 'RAND()' => 'DESC'])->toArray();
+ $moreClaims = $this->Claims->find()->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->where(['Claims.claim_type' => 1, 'Claims.id <>' => $claim->id, 'Claims.publisher_id' => isset($claim->publisher) ? $claim->publisher_id : $claim->claim_id])->limit(9)->order(['Claims.fee' => 'DESC', 'RAND()' => 'DESC'])->toArray();
for ($i = 0; $i < count($moreClaims); $i++) {
- if ($canConvert && $moreClaims[$i]->Fee > 0 && $moreClaims[$i]->FeeCurrency == 'USD') {
- $moreClaims[$i]->Price = $moreClaims[$i]->Fee / $priceInfo->price;
+ if ($canConvert && $moreClaims[$i]->fee > 0 && $moreClaims[$i]->fee_currency == 'USD') {
+ $moreClaims[$i]->price = $moreClaims[$i]->fee / $priceInfo->price;
}
if (isset($moreClaims[$i]->Stream)) {
@@ -210,7 +208,6 @@ class MainController extends AppController {
}
}
}
-
$this->set('claim', $claim);
$this->set('moreClaims', $moreClaims);
}
@@ -219,115 +216,19 @@ class MainController extends AppController {
public function realtime() {
$this->loadModel('Blocks');
$this->loadModel('Transactions');
+ $this->loadModel('Outputs');
// load 10 blocks and transactions
- $conn = ConnectionManager::get('default');
- $blocks = $this->Blocks->find()->select(['Height', 'BlockTime', 'TransactionHashes'])->order(['Height' => 'desc'])->limit(10)->toArray();
+ $blocks = $this->Blocks->find()->select(['height', 'block_time', 'transaction_hashes'])->order(['height' => 'desc'])->limit(10)->toArray();
for ($i = 0; $i < count($blocks); $i++) {
- $tx_hashes = json_decode($blocks[$i]->TransactionHashes);
- $blocks[$i]->TransactionCount = count($tx_hashes);
+ $tx_hashes = preg_split('#,#', $blocks[$i]->transaction_hashes);
+ $blocks[$i]->transaction_count = count($tx_hashes);
}
- $stmt = $conn->execute('SELECT T.Hash, T.InputCount, T.OutputCount, T.Value, IFNULL(T.TransactionTime, T.CreatedTime) AS TxTime ' .
- 'FROM Transactions T ORDER BY CreatedTime DESC LIMIT 10');
- $txs = $stmt->fetchAll(\PDO::FETCH_OBJ);
-
+ $transactions = $this->Transactions->find()->select(['Transactions.id', 'Transactions.hash', 'Transactions.value', 'Transactions.input_count', 'Transactions.output_count', 'Transactions.transaction_time', 'Transactions.created_at'])->order(['Transactions.created_at' => 'desc'])->limit(10)->toArray();
+
$this->set('blocks', $blocks);
- $this->set('txs', $txs);
- }
-
- public function apiblocksize($timePeriod = '24h') {
- $this->autoRender = false;
-
- if (!$this->request->is('get')) {
- return $this->_jsonError('Invalid HTTP request method.', 400);
- }
-
- $validPeriods = ['24h', '72h', '168h', '30d', '90d', '1y'];
- if (!in_array($timePeriod, $validPeriods)) {
- return $this->_jsonError('Invalid time period specified.', 400);
- }
-
- $isHourly = (strpos($timePeriod, 'h') !== false);
- $now = new \DateTime('now', new \DateTimeZone('UTC'));
- $dateFormat = $isHourly ? 'Y-m-d H:00:00' : 'Y-m-d';
- $sqlDateFormat = $isHourly ? '%Y-%m-%d %H:00:00' : '%Y-%m-%d';
- $intervalPrefix = $isHourly ? 'PT' : 'P';
- $start = $now->sub(new \DateInterval($intervalPrefix . strtoupper($timePeriod)));
-
- $resultSet = [];
-
- $conn = ConnectionManager::get('default');
-
- // get avg block sizes for the time period
- $stmt = $conn->execute("SELECT AVG(BlockSize) AS AvgBlockSize, DATE_FORMAT(FROM_UNIXTIME(BlockTime), '$sqlDateFormat') AS TimePeriod " .
- "FROM Blocks WHERE DATE_FORMAT(FROM_UNIXTIME(BlockTime), '$sqlDateFormat') >= ? GROUP BY TimePeriod ORDER BY TimePeriod ASC", [$start->format($dateFormat)]);
- $avgBlockSizes = $stmt->fetchAll(\PDO::FETCH_OBJ);
- foreach ($avgBlockSizes as $size) {
- if (!isset($resultSet[$size->TimePeriod])) {
- $resultSet[$size->TimePeriod] = [];
- }
- $resultSet[$size->TimePeriod]['AvgBlockSize'] = (float) $size->AvgBlockSize;
- }
-
- // get avg prices
- $stmt = $conn->execute("SELECT AVG(USD) AS AvgUSD, DATE_FORMAT(Created, '$sqlDateFormat') AS TimePeriod " .
- "FROM PriceHistory WHERE DATE_FORMAT(Created, '$sqlDateFormat') >= ? GROUP BY TimePeriod ORDER BY TimePeriod ASC", [$start->format($dateFormat)]);
- $avgPrices = $stmt->fetchAll(\PDO::FETCH_OBJ);
- foreach ($avgPrices as $price) {
- if (!isset($resultSet[$price->TimePeriod])) {
- $resultSet[$price->TimePeriod] = [];
- }
- $resultSet[$price->TimePeriod]['AvgUSD'] = (float) $price->AvgUSD;
- }
-
- return $this->_jsonResponse(['success' => true, 'data' => $resultSet]);
- }
-
- public function apirealtimeblocks() {
- // load 10 blocks
- $this->autoRender = false;
- $this->loadModel('Blocks');
- $blocks = $this->Blocks->find()->select(['Height', 'BlockTime', 'TransactionHashes'])->order(['Height' => 'desc'])->limit(10)->toArray();
- for ($i = 0; $i < count($blocks); $i++) {
- $tx_hashes = json_decode($blocks[$i]->TransactionHashes);
- $blocks[$i]->TransactionCount = count($tx_hashes);
- unset($blocks[$i]->TransactionHashes);
- }
-
- $this->_jsonResponse(['success' => true, 'blocks' => $blocks]);
- }
-
- public function apirealtimetx() {
- // load 10 transactions
- $this->autoRender = false;
- $conn = ConnectionManager::get('default');
- $stmt = $conn->execute('SELECT T.Hash, T.InputCount, T.OutputCount, T.Value, IFNULL(T.TransactionTime, T.CreatedTime) AS TxTime ' .
- 'FROM Transactions T ORDER BY CreatedTime DESC LIMIT 10');
- $txs = $stmt->fetchAll(\PDO::FETCH_OBJ);
-
- $this->_jsonResponse(['success' => true, 'txs' => $txs]);
- }
-
- protected function _formatHashRate($value) {
- if ($value === 'N/A') {
- return $value;
- }
-
- /*if ($value > 1000000000000) {
- return number_format( $value / 1000000000000, 2, '.', '' ) . ' TH';
- }*/
- if ($value > 1000000000) {
- return number_format( $value / 1000000000, 2, '.', '' ) . ' GH/s';
- }
- if ($value > 1000000) {
- return number_format( $value / 1000000, 2, '.', '' ) . ' MH/s';
- }
- if ($value > 1000) {
- return number_format( $value / 1000, 2, '.', '' ) . ' KH/s';
- }
-
- return number_format($value) . ' H/s';
+ $this->set('txs', $transactions);
}
public function find() {
@@ -340,38 +241,38 @@ class MainController extends AppController {
if (is_numeric($criteria)) {
$height = (int) $criteria;
- $block = $this->Blocks->find()->select(['Id'])->where(['Height' => $height])->first();
+ $block = $this->Blocks->find()->select(['id'])->where(['height' => $height])->first();
if ($block) {
return $this->redirect('/blocks/' . $height);
}
} else if (strlen(trim($criteria)) === 34) {
// Address
- $address = $this->Addresses->find()->select(['Id', 'Address'])->where(['Address' => $criteria])->first();
+ $address = $this->Addresses->find()->select(['id', 'address'])->where(['address' => $criteria])->first();
if ($address) {
- return $this->redirect('/address/' . $address->Address);
+ return $this->redirect('/address/' . $address->address);
}
} else if (strlen(trim($criteria)) === 40) {
// Claim ID
- $claim = $this->Claims->find()->select(['ClaimId'])->where(['ClaimId' => $criteria])->first();
+ $claim = $this->Claims->find()->select(['claim_id'])->where(['claim_id' => $criteria])->first();
if ($claim) {
- return $this->redirect('/claims/' . $claim->ClaimId);
+ return $this->redirect('/claims/' . $claim->claim_id);
}
} else if (strlen(trim($criteria)) === 64) { // block or tx hash
// Try block hash first
- $block = $this->Blocks->find()->select(['Height'])->where(['Hash' => $criteria])->first();
+ $block = $this->Blocks->find()->select(['height'])->where(['hash' => $criteria])->first();
if ($block) {
- return $this->redirect('/blocks/' . $block->Height);
+ return $this->redirect('/blocks/' . $block->height);
} else {
- $tx = $this->Transactions->find()->select(['Hash'])->where(['Hash' => $criteria])->first();
+ $tx = $this->Transactions->find()->select(['hash'])->where(['hash' => $criteria])->first();
if ($tx) {
- return $this->redirect('/tx/' . $tx->Hash);
+ return $this->redirect('/tx/' . $tx->hash);
}
}
} else {
// finally, try exact claim name match
- $claims = $this->Claims->find()->distinct(['Claims.ClaimId'])->where(['Name' => $criteria])->order(['Claims.Created' => 'DESC'])->limit(10)->toArray();
+ $claims = $this->Claims->find()->distinct(['claim_id'])->where(['name' => $criteria])->order(["FIELD(bid_state, 'Controlling') DESC"])->limit(10)->toArray();
if (count($claims) == 1) {
- return $this->redirect('/claims/' . $claims[0]->ClaimId);
+ return $this->redirect('/claims/' . $claims[0]->claim_id);
}
else {
$this->set('claims', $claims);
@@ -381,6 +282,8 @@ class MainController extends AppController {
public function blocks($height = null) {
$this->loadModel('Blocks');
+ $this->loadModel('Outputs');
+ $this->loadModel('Transactions');
if ($height === null) {
// paginate blocks
@@ -389,7 +292,7 @@ class MainController extends AppController {
$page = intval($this->request->query('page'));
$conn = ConnectionManager::get('default');
- $stmt = $conn->execute('SELECT COUNT(Id) AS Total FROM Blocks');
+ $stmt = $conn->execute('SELECT COUNT(id) AS Total FROM block');
$count = $stmt->fetch(\PDO::FETCH_OBJ);
$numBlocks = $count->Total;
@@ -402,10 +305,10 @@ class MainController extends AppController {
}
$offset = ($page - 1) * $pageLimit;
- $currentBlock = $this->Blocks->find()->select(['Height'])->order(['Height' => 'DESC'])->first();
+ $currentBlock = $this->Blocks->find()->select(['height'])->order(['height' => 'DESC'])->first();
$blocks = $this->Blocks->find()->select(
- ['Height', 'Difficulty', 'TransactionHashes', 'BlockSize', 'Nonce', 'BlockTime']
- )->offset($offset)->limit($pageLimit)->order(['Height' => 'DESC'])->toArray();
+ ['height', 'difficulty', 'transaction_hashes', 'block_size', 'nonce', 'block_time']
+ )->offset($offset)->limit($pageLimit)->order(['height' => 'DESC'])->toArray();
$this->set('currentBlock', $currentBlock);
$this->set('blocks', $blocks);
$this->set('pageLimit', $pageLimit);
@@ -413,35 +316,18 @@ class MainController extends AppController {
$this->set('numRecords', $numBlocks);
$this->set('currentPage', $page);
} else {
- $this->loadModel('Transactions');
$height = intval($height);
if ($height < 0) {
return $this->redirect('/');
}
- $block = $this->Blocks->find()->where(['Height' => $height])->first();
+ $block = $this->Blocks->find()->where(['height' => $height])->first();
if (!$block) {
return $this->redirect('/');
}
- try {
- // update the block confirmations
- $req = ['method' => 'getblock', 'params' => [$block->Hash]];
- $response = self::curl_json_post(self::$rpcurl, json_encode($req));
- $json = json_decode($response);
- $rpc_block = $json->result;
- if (isset($rpc_block->confirmations)) {
- $block->Confirmations = $rpc_block->confirmations;
- $conn = ConnectionManager::get('default');
- $conn->execute('UPDATE Blocks SET Confirmations = ? WHERE Id = ?', [$rpc_block->confirmations, $block->Id]);
- }
- } catch (\Exception $e) {
- // try again next time
- }
-
// Get the basic block transaction info
- $txs = $this->Transactions->find()->select(['InputCount', 'OutputCount', 'Hash', 'Value', 'Version'])->where(['BlockHash' => $block->Hash])->toArray();
-
+ $txs = $this->Transactions->find()->select(['Transactions.id', 'Transactions.value', 'Transactions.input_count', 'Transactions.output_count', 'Transactions.hash', 'Transactions.version'])->where(['Transactions.block_hash_id' => $block->hash])->toArray();
$this->set('block', $block);
$this->set('blockTxs', $txs);
}
@@ -452,43 +338,48 @@ class MainController extends AppController {
$this->loadModel('Transactions');
$this->loadModel('Inputs');
$this->loadModel('Outputs');
+ $this->loadModel('Addresses');
$this->loadModel('Claims');
$sourceAddress = $this->request->query('address');
- $tx = $this->Transactions->find()->select(
- ['Id', 'BlockHash', 'InputCount', 'OutputCount', 'Hash', 'Value', 'TransactionTime', 'TransactionSize', 'Created', 'Version', 'LockTime', 'Raw'])->where(['Hash' => $hash])->first();
+ $tx = $this->Transactions->find()->where(['Transactions.hash' => $hash])->first();
if (!$tx) {
return $this->redirect('/');
}
- if ($tx->TransactionSize == 0) {
- $tx->TransactionSize = (strlen($tx->Raw) / 2);
- $conn = ConnectionManager::get('default');
- $conn->execute('UPDATE Transactions SET TransactionSize = ? WHERE Id = ?', [$tx->TransactionSize, $tx->Id]);
+ $block = $this->Blocks->find()->select(['confirmations', 'height'])->where(['hash' => $tx->block_hash_id])->first();
+ $confirmations = $block->confirmations;
+ $inputs = $this->Inputs->find()->where(['transaction_id' => $tx->id])->order(['prevout_n' => 'asc'])->toArray();
+ foreach($inputs as $input) {
+ $inputAddresses = $this->Addresses->find()->select(['id', 'address'])->where(['id' => $input->input_address_id])->toArray();
+ $input->input_addresses = $inputAddresses;
}
-
- $maxBlock = $this->Blocks->find()->select(['Height'])->order(['Height' => 'desc'])->first();
- $block = $this->Blocks->find()->select(['Confirmations', 'Height'])->where(['Hash' => $tx->BlockHash])->first();
- $confirmations = $block ? (($maxBlock->Height - $block->Height) + 1) : '0';
- $inputs = $this->Inputs->find()->contain(['InputAddresses'])->where(['TransactionId' => $tx->Id])->order(['PrevoutN' => 'asc'])->toArray();
- $outputs = $this->Outputs->find()->contain(['OutputAddresses', 'SpendInput' => ['fields' => ['Id', 'TransactionHash', 'PrevoutN', 'PrevoutHash']]])->where(['Outputs.TransactionId' => $tx->Id])->order(['Vout' => 'asc'])->toArray();
- for ($i = 0; $i < count($outputs); $i++) {
- $outputs[$i]->IsClaim = (strpos($outputs[$i]->ScriptPubKeyAsm, 'CLAIM') > -1);
- $outputs[$i]->IsSupportClaim = (strpos($outputs[$i]->ScriptPubKeyAsm, 'SUPPORT_CLAIM') > -1);
- $outputs[$i]->IsUpdateClaim = (strpos($outputs[$i]->ScriptPubKeyAsm, 'UPDATE_CLAIM') > -1);
- $claim = $this->Claims->find()->where(['TransactionHash' => $tx->Hash, 'Vout' => $outputs[$i]->Vout])->first();
+
+ $outputs = $this->Outputs->find()->select($this->Outputs)->select(['spend_input_hash' => 'I.transaction_hash', 'spend_input_id' => 'I.id'])->where(['Outputs.transaction_id' => $tx->id])->leftJoin(['I' => 'input'], ['I.id = Outputs.spent_by_input_id'])->order(['Outputs.vout' => 'asc'])->toArray();
+ for ($i = 0; $i < count($outputs); $i++) {
+ $outputs[$i]->IsClaim = (strpos($outputs[$i]->script_pub_key_asm, 'CLAIM') > -1);
+ $outputs[$i]->IsSupportClaim = (strpos($outputs[$i]->script_pub_key_asm, 'SUPPORT_CLAIM') > -1);
+ $outputs[$i]->IsUpdateClaim = (strpos($outputs[$i]->script_pub_key_asm, 'UPDATE_CLAIM') > -1);
+ $claim = $this->Claims->find()->select(['id', 'claim_id', 'claim_address', 'vout', 'transaction_hash_id'])->where(['transaction_hash_id' => $tx->hash, 'vout' => $outputs[$i]->vout])->first();
$outputs[$i]->Claim = $claim;
+
+ $output_address = trim($outputs[$i]->address_list, '[""]');
+ if(!$output_address && $claim) {
+ $output_address = $claim->claim_address;
+ }
+ $address = $this->Addresses->find()->select(['address'])->where(['address' => $output_address])->first();
+ $outputs[$i]->output_addresses = [$address];
}
$totalIn = 0;
$totalOut = 0;
$fee = 0;
foreach ($inputs as $in) {
- $totalIn = bcadd($totalIn, $in->Value, 8);
+ $totalIn = bcadd($totalIn, $in->value, 8);
}
foreach ($outputs as $out) {
- $totalOut = bcadd($totalOut, $out->Value, 8);
+ $totalOut = bcadd($totalOut, $out->value, 8);
}
$fee = bcsub($totalIn, $totalOut, 8);
@@ -505,13 +396,14 @@ class MainController extends AppController {
$this->loadModel('Addresses');
// exclude bHW58d37s1hBjj3wPBkn5zpCX3F8ZW3uWf (genesis block)
- $richList = $this->Addresses->find()->where(['Address <>' => 'bHW58d37s1hBjj3wPBkn5zpCX3F8ZW3uWf'])->order(['Balance' => 'DESC'])->limit(500)->toArray();
+ $richList = $this->Addresses->find()->where(['address <>' => 'bHW58d37s1hBjj3wPBkn5zpCX3F8ZW3uWf'])->order(['balance' => 'DESC'])->limit(500)->toArray();
$priceRate = 0;
- //$priceInfo = json_decode($this->redis->get(self::lbcPriceKey));
- $priceInfo->price = 0.05;
- if (isset($priceInfo->price)) {
- $priceRate = $priceInfo->price;
+ if(isset($this->redis)) {
+ $priceInfo = json_decode($this->redis->get(self::lbcPriceKey));
+ if (isset($priceInfo->price)) {
+ $priceRate = $priceInfo->price;
+ }
}
$lbryAddresses = ['rFLUohPG4tP3gZHYoyhvADCtrDMiaYb7Qd', 'r9PGXsejVJb9ZfMf3QVdDEJCzxkd9JLxzL', 'r9srwX7DEN7Mex3a8oR1mKSqQmLBizoJvi', 'bRo4FEeqqxY7nWFANsZsuKEWByEgkvz8Qt', 'bU2XUzckfpdEuQNemKvhPT1gexQ3GG3SC2', 'bay3VA6YTQBL4WLobbG7CthmoGeUKXuXkD', 'bLPbiXBp6Vr3NSnsHzDsLNzoy5o36re9Cz', 'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc', 'bVUrbCK8hcZ5XWti7b9eNxKEBxzc1rr393', 'bZja2VyhAC84a9hMwT8dwTU6rDRXowrjxH', 'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc', 'bMgqQqYfwzWWYBk5o5dBMXtCndVAoeqy6h', 'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc'];
@@ -519,15 +411,15 @@ class MainController extends AppController {
$maxBalance = 0;
$minBalance = 0;
foreach ($richList as $item) {
- $totalBalance = bcadd($totalBalance, $item->Balance, 8);
- $minBalance = $minBalance == 0 ? $item->Balance : min($minBalance, $item->Balance);
- $maxBalance = max($maxBalance, $item->Balance);
+ $totalBalance = bcadd($totalBalance, $item->balance, 8);
+ $minBalance = $minBalance == 0 ? $item->balance : min($minBalance, $item->balance);
+ $maxBalance = max($maxBalance, $item->balance);
}
for ($i = 0; $i < count($richList); $i++) {
$item = $richList[$i];
- $percentage = bcdiv($item->Balance, $totalBalance, 8) * 100;
+ $percentage = bcdiv($item->balance, $totalBalance, 8) * 100;
$richList[$i]->Top500Percent = $percentage;
- $richList[$i]->MinMaxPercent = bcdiv($item->Balance, $maxBalance, 8) * 100;
+ $richList[$i]->MinMaxPercent = bcdiv($item->balance, $maxBalance, 8) * 100;
}
$this->set('richList', $richList);
@@ -543,6 +435,7 @@ class MainController extends AppController {
$this->loadModel('Transactions');
$this->loadModel('Inputs');
$this->loadModel('Outputs');
+ $this->loadModel('TransactionAddresses');
if (!$addr) {
return $this->redirect('/');
@@ -560,12 +453,11 @@ class MainController extends AppController {
$recentTxs = [];
$tagRequestAmount = 0;
-
- $address = $this->Addresses->find()->where(['Address' => $addr])->first();
+ $address = $this->Addresses->find()->where(['address' => $addr])->first();
if (!$address) {
if (strlen($addr) === 34) {
$address = new \stdClass();
- $address->Address = $addr;
+ $address->address = $addr;
} else {
return $this->redirect('/');
}
@@ -573,11 +465,9 @@ class MainController extends AppController {
$conn = ConnectionManager::get('default');
$canTag = true;
- $addressId = $address->Id;
-
- $stmt = $conn->execute('SELECT COUNT(TransactionId) AS Total FROM TransactionsAddresses WHERE AddressId = ?', [$addressId]);
- $count = $stmt->fetch(\PDO::FETCH_OBJ);
- $numTransactions = $count->Total;
+ $transactionAddresses = $this->TransactionAddresses->find()->where(['address_id' => $address->id])->toArray();
+ $numTransactions = count($transactionAddresses);
+
$all = $this->request->query('all');
if ($all === 'true') {
$offset = 0;
@@ -595,27 +485,24 @@ class MainController extends AppController {
$offset = ($page - 1) * $pageLimit;
}
-
- $stmt = $conn->execute('SELECT A.TotalReceived, A.TotalSent, A.Balance FROM Addresses A WHERE A.Id = ?', [$address->Id]);
- $totals = $stmt->fetch(\PDO::FETCH_OBJ);
-
- $currentBlock = $this->Blocks->find()->select(['Height'])->order(['Height' => 'desc'])->first();
- $currentHeight = $currentBlock ? intval($currentBlock->Height) : 0;
-
+
$stmt = $conn->execute(sprintf(
- 'SELECT T.Id, T.Hash, T.InputCount, T.OutputCount, T.Value, ' .
- ' TA.DebitAmount, TA.CreditAmount, ' .
- ' B.Height, (CASE WHEN B.Height IS NOT NULL THEN ((' . $currentHeight . ' - B.Height) + 1) ELSE NULL END) AS Confirmations, ' .
- ' IFNULL(T.TransactionTime, T.CreatedTime) AS TxTime ' .
- 'FROM Transactions T ' .
- 'LEFT JOIN Blocks B ON T.BlockHash = B.Hash ' .
- 'RIGHT JOIN (SELECT TransactionId, DebitAmount, CreditAmount FROM TransactionsAddresses ' .
- ' WHERE AddressId = ? ORDER BY TransactionTime DESC LIMIT %d, %d) TA ON TA.TransactionId = T.Id', $offset, $pageLimit), [$addressId]);
+ 'SELECT T.id, T.hash, T.input_count, T.output_count, T.block_hash_id, ' .
+ ' TA.debit_amount, TA.credit_amount, ' .
+ ' B.height, B.confirmations, ' .
+ ' IFNULL(T.transaction_time, T.created_at) AS transaction_time ' .
+ 'FROM transaction T ' .
+ 'LEFT JOIN block B ON T.block_hash_id = B.hash ' .
+ 'RIGHT JOIN (SELECT transaction_id, debit_amount, credit_amount FROM transaction_address ' .
+ ' WHERE address_id = ?) TA ON TA.transaction_id = T.id ' .
+ 'ORDER BY transaction_time DESC LIMIT %d, %d', $offset, $pageLimit), [$address->id]);
$recentTxs = $stmt->fetchAll(\PDO::FETCH_OBJ);
- $totalRecvAmount = $totals->TotalReceived == 0 ? '0' : $totals->TotalReceived + 0;
- $totalSentAmount = $totals->TotalSent == 0 ? '0' : $totals->TotalSent + 0;
- $balanceAmount = $totals->Balance == 0 ? '0' : $totals->Balance + 0;
+ foreach($transactionAddresses as $ta) {
+ $totalRecvAmount += $ta->credit_amount + 0;
+ $totalSentAmount += $ta->debit_amount + 0;
+ }
+ $balanceAmount = $totalRecvAmount - $totalSentAmount;
}
$this->set('offset', $offset);
@@ -645,53 +532,90 @@ class MainController extends AppController {
$qrCode->setWriterByName('png');
$qrCode->setMargin(10);
$qrCode->setEncoding('UTF-8');
- $qrCode->setErrorCorrectionLevel(new ErrorCorrectionLevel(ErrorCorrectionLevel::LOW));
+ $qrCode->setErrorCorrectionLevel(new ErrorCorrectionLevel(ErrorCorrectionLevel::HIGH));
$qrCode->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0]);
$qrCode->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255, 'a' => 0]);
$qrCode->setLogoWidth(150);
$qrCode->setValidateResult(false);
-
header('Content-Type: '.$qrCode->getContentType());
echo $qrCode->writeString();
exit(0);
}
+
+ public function apiblocksize($timePeriod = '24h') {
+ $this->autoRender = false;
- public static function curl_get($url) {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-
- $response = curl_exec($ch);
- Log::debug('Request execution completed.');
-
- if ($response === false) {
- $error = curl_error($ch);
- $errno = curl_errno($ch);
- curl_close($ch);
-
- throw new \Exception(sprintf('The request failed: %s', $error), $errno);
- } else {
- curl_close($ch);
+ if (!$this->request->is('get')) {
+ return $this->_jsonError('Invalid HTTP request method.', 400);
}
- return $response;
- }
+ $validPeriods = ['24h', '72h', '168h', '30d', '90d', '1y'];
+ if (!in_array($timePeriod, $validPeriods)) {
+ return $this->_jsonError('Invalid time period specified.', 400);
+ }
- private function _gethashrate() {
- $req = ['method' => 'getnetworkhashps', 'params' => []];
- try {
- $res = json_decode(self::curl_json_post(self::$rpcurl, json_encode($req)));
- if (!isset($res->result)) {
- return 0;
+ $isHourly = (strpos($timePeriod, 'h') !== false);
+ $now = new \DateTime('now', new \DateTimeZone('UTC'));
+ $dateFormat = $isHourly ? 'Y-m-d H:00:00' : 'Y-m-d';
+ $sqlDateFormat = $isHourly ? '%Y-%m-%d %H:00:00' : '%Y-%m-%d';
+ $intervalPrefix = $isHourly ? 'PT' : 'P';
+ $start = $now->sub(new \DateInterval($intervalPrefix . strtoupper($timePeriod)));
+
+ $resultSet = [];
+
+ // get avg prices
+ /*
+ $conn_local = ConnectionManager::get('localdb');
+ $stmt_price = $conn_local->execute("SELECT AVG(USD) AS AvgUSD, DATE_FORMAT(Created, '$sqlDateFormat') AS TimePeriod " .
+ "FROM PriceHistory WHERE DATE_FORMAT(Created, '$sqlDateFormat') >= ? GROUP BY TimePeriod ORDER BY TimePeriod ASC", [$start->format($dateFormat)]);
+ $avgPrices = $stmt_price->fetchAll(\PDO::FETCH_OBJ);
+ foreach ($avgPrices as $price) {
+ if (!isset($resultSet[$price->TimePeriod])) {
+ $resultSet[$price->TimePeriod] = [];
}
- return $res->result;
- } catch (\Exception $e) {
- return 'N/A';
+ $resultSet[$price->TimePeriod]['AvgUSD'] = (float) $price->AvgUSD;
+ }
+ */
+
+ $conn = ConnectionManager::get('default');
+ // get avg block sizes for the time period
+ $stmt = $conn->execute("SELECT AVG(block_size) AS AvgBlockSize, DATE_FORMAT(FROM_UNIXTIME(block_time), '$sqlDateFormat') AS TimePeriod " .
+ "FROM block WHERE DATE_FORMAT(FROM_UNIXTIME(block_time), '$sqlDateFormat') >= ? GROUP BY TimePeriod ORDER BY TimePeriod ASC", [$start->format($dateFormat)]);
+ $avgBlockSizes = $stmt->fetchAll(\PDO::FETCH_OBJ);
+ foreach ($avgBlockSizes as $size) {
+ if (!isset($resultSet[$size->TimePeriod])) {
+ $resultSet[$size->TimePeriod] = [];
+ }
+ $resultSet[$size->TimePeriod]['AvgBlockSize'] = (float) $size->AvgBlockSize;
}
- }
+ return $this->_jsonResponse(['success' => true, 'data' => $resultSet]);
+ }
+
+ public function apirealtimeblocks() {
+ // Load 10 blocks
+ $this->autoRender = false;
+ $this->loadModel('Blocks');
+ $blocks = $this->Blocks->find()->select(['Height' => 'height', 'BlockTime' => 'block_time', 'transaction_hashes'])->order(['Height' => 'desc'])->limit(10)->toArray();
+ for ($i = 0; $i < count($blocks); $i++) {
+ $tx_hashes = preg_split('#,#', $blocks[$i]->transaction_hashes);
+ $blocks[$i]->TransactionCount = count($tx_hashes);
+ unset($blocks[$i]->transaction_hashes);
+ }
+
+ $this->_jsonResponse(['success' => true, 'blocks' => $blocks]);
+ }
+
+ public function apirealtimetx() {
+ // Load 10 transactions
+ $this->autoRender = false;
+ $this->loadModel('Transactions');
+ $txs = $this->Transactions->find()->select(['id', 'Value' => 'value', 'Hash' => 'hash', 'InputCount' => 'input_count', 'OutputCount' => 'output_count', 'TxTime' => 'transaction_time'])->order(['TxTime' => 'desc'])->limit(10);
+
+ $this->_jsonResponse(['success' => true, 'txs' => $txs]);
+ }
+
protected function _gettxoutsetinfo() {
$now = new \DateTime('now', new \DateTimeZone('UTC'));
$txOutSetInfo = new \stdClass();
@@ -742,9 +666,9 @@ class MainController extends AppController {
// Get the max height block
$height = 0;
$difficulty = 0;
- $highestBlock = $this->Blocks->find()->select(['Height', 'Difficulty'])->order(['Height' => 'desc'])->first();
- $height = $highestBlock->Height;
- $difficulty = $highestBlock->Difficulty;
+ $highestBlock = $this->Blocks->find()->select(['height', 'difficulty'])->order(['height' => 'desc'])->first();
+ $height = $highestBlock->height;
+ $difficulty = $highestBlock->difficulty;
$lbcUsdPrice = $this->_getLatestPrice();
// Calculate hash rate
@@ -761,13 +685,12 @@ class MainController extends AppController {
public function apirecentblocks() {
$this->autoRender = false;
$this->loadModel('Blocks');
- $blocks = $this->Blocks->find()->select(['Difficulty', 'Hash', 'Height', 'TransactionHashes', 'BlockTime', 'BlockSize'])->
- order(['Height' => 'desc'])->limit(6)->toArray();
+ $blocks = $this->Blocks->find()->select(['Difficulty' => 'difficulty', 'Hash' => 'hash', 'Height' => 'height', 'transaction_hashes', 'BlockTime' => 'block_time', 'BlockSize' => 'block_size'])->order(['Height' => 'desc'])->limit(6)->toArray();
for ($i = 0; $i < count($blocks); $i++) {
- $tx_hashes = json_decode($blocks[$i]->TransactionHashes);
+ $tx_hashes = preg_split('#,#', $blocks[$i]->transaction_hashes);
$blocks[$i]->TransactionCount = count($tx_hashes);
$blocks[$i]->Difficulty = number_format($blocks[$i]->Difficulty, 2, '.', '');
- unset($blocks[$i]->TransactionHashes);
+ unset($blocks[$i]->transaction_hashes);
}
return $this->_jsonResponse(['success' => true, 'blocks' => $blocks]);
}
@@ -816,13 +739,13 @@ class MainController extends AppController {
}
// check if the tag is taken
- $addrTag = $this->Addresses->find()->select(['Id'])->where(['LOWER(Tag)' => strtolower($entity->Tag)])->first();
+ $addrTag = $this->Addresses->find()->select(['id'])->where(['LOWER(Tag)' => strtolower($entity->Tag)])->first();
if ($addrTag) {
return $this->_jsonError('Oops! The tag is already taken. Please specify a different tag.', 400);
}
// check for existing verification
- $exist = $this->TagAddressRequests->find()->select(['Id'])->where(['Address' => $base58address, 'IsVerified' => 0])->first();
+ $exist = $this->TagAddressRequests->find()->select(['id'])->where(['Address' => $base58address, 'IsVerified' => 0])->first();
if ($exist) {
return $this->_jsonError('Oops! There is a pending tag verification for this address.', 400);
}
@@ -842,16 +765,13 @@ class MainController extends AppController {
if (!isset($base58address)) {
return $this->_jsonError('Base58 address not specified.', 400);
}
-
- // TODO: Add unconfirmed_balance to response
- $result = $this->Addresses->find()->select(['Balance'])->where(['Address' => $base58address])->first();
- if (!$result) {
- // Return 0 for address that does not exist?
- $result = new \stdClass();
- $result->Balance = 0;
+
+ $address = $this->Addresses->find()->select(['id', 'balance'])->where(['address' => $base58address])->first();
+ if (!$address) {
+ return $this->_jsonError('Could not find address.', 400);
}
-
- return $this->_jsonResponse(['success' => true, ['balance' => ['confirmed' => $result->Balance, 'unconfirmed' => 0]]]);
+
+ return $this->_jsonResponse(['success' => true, ['balance' => ['confirmed' => $address->balance, 'unconfirmed' => 0]]]);
}
public function apiaddrutxo($base58address = null) {
@@ -863,7 +783,7 @@ class MainController extends AppController {
}
$arr = explode(',', $base58address);
- $addresses = $this->Addresses->find()->select(['Id'])->where(['Address IN' => $arr])->toArray();
+ $addresses = $this->Addresses->find()->select(['id'])->where(['address IN' => $arr])->toArray();
if (count($addresses) == 0) {
return $this->_jsonError('No base58 address matching the specified parameter was found.', 404);
}
@@ -871,73 +791,127 @@ class MainController extends AppController {
$addressIds = [];
$params = [];
foreach ($addresses as $address) {
- $addressIds[] = $address->Id;
+ $addressIds[] = $address->id;
$params[] = '?';
}
// Get the unspent outputs for the address
$conn = ConnectionManager::get('default');
$stmt = $conn->execute(sprintf(
- 'SELECT T.Hash AS TransactionHash, O.Vout, O.Value, O.Addresses, O.ScriptPubKeyAsm, O.ScriptPubKeyHex, O.Type, O.RequiredSignatures, B.Confirmations ' .
- 'FROM Transactions T ' .
- 'JOIN Outputs O ON O.TransactionId = T.Id ' .
- 'JOIN Blocks B ON B.Hash = T.BlockHash ' .
- 'WHERE O.Id IN (SELECT OutputId FROM OutputsAddresses WHERE AddressId IN (%s)) AND O.IsSpent <> 1 ORDER BY T.TransactionTime ASC', implode(',', $params)), $addressIds);
+ 'SELECT T.hash AS transaction_hash, O.vout, O.value, O.address_list, O.script_pub_key_asm, O.script_pub_key_hex, O.type, O.required_signatures, B.confirmations ' .
+ 'FROM transaction T ' .
+ 'JOIN output O ON O.transaction_id = T.id ' .
+ 'JOIN block B ON B.hash = T.block_hash_id ' .
+ 'WHERE O.id IN (SELECT O2.id FROM output O2 WHERE address_id IN (%s)) AND O.is_spent <> 1 ORDER BY T.transaction_time ASC', implode(',', $params)), $addressIds);
$outputs = $stmt->fetchAll(\PDO::FETCH_OBJ);
$utxo = [];
foreach ($outputs as $out) {
$utxo[] = [
- 'transaction_hash' => $out->TransactionHash,
- 'output_index' => $out->Vout,
- 'value' => (int) bcmul($out->Value, 100000000),
- 'addresses' => json_decode($out->Addresses),
- 'script' => $out->ScriptPubKeyAsm,
- 'script_hex' => $out->ScriptPubKeyHex,
- 'script_type' => $out->Type,
- 'required_signatures' => (int) $out->RequiredSignatures,
+ 'transaction_hash' => $out->transaction_hash,
+ 'output_index' => $out->vout,
+ 'value' => (int) bcmul($out->value, 100000000),
+ 'addresses' => json_decode($out->address_list),
+ 'script' => $out->script_pub_key_asm,
+ 'script_hex' => $out->script_pub_key_hex,
+ 'script_type' => $out->type,
+ 'required_signatures' => (int) $out->required_signatures,
'spent' => false,
- 'confirmations' => (int) $out->Confirmations
+ 'confirmations' => (int) $out->confirmations
];
}
return $this->_jsonResponse(['success' => true, 'utxo' => $utxo]);
}
- public function apiutxosupply() {
+ public function apiutxosupply() {
$this->autoRender = false;
$this->loadModel('Addresses');
$circulating = 0;
- $reservedcommunity = 0;
- $reservedoperational = 0;
- $reservedinstitutional = 0;
- $reservedtotal = 0;
- $circulating = 0;
-
$txoutsetinfo = $this->_gettxoutsetinfo();
- $reservedcommunity = $this->Addresses->find()->select(['Balance'])->where(['Address =' => 'rFLUohPG4tP3gZHYoyhvADCtrDMiaYb7Qd'])->first();
- $reservedoperational = $this->Addresses->find()->select(['Balance'])->where(['Address =' => 'r9PGXsejVJb9ZfMf3QVdDEJCzxkd9JLxzL'])->first();
- $reservedinstitutional = $this->Addresses->find()->select(['Balance'])->where(['Address =' => 'r9srwX7DEN7Mex3a8oR1mKSqQmLBizoJvi'])->first();
- //aux is the address of hot wallets and where some of the LBRY operational fund are, but not sold on market.
- $reservedaux = $this->Addresses->find()->select(['Balance'])->where(['Address =' => 'bRo4FEeqqxY7nWFANsZsuKEWByEgkvz8Qt'])->first() +
- $this->Addresses->find()->select(['Balance'])->where(['Address =' => 'bU2XUzckfpdEuQNemKvhPT1gexQ3GG3SC2'])->first() +
- $this->Addresses->find()->select(['Balance'])->where(['Address =' => 'bay3VA6YTQBL4WLobbG7CthmoGeUKXuXkD'])->first() +
- $this->Addresses->find()->select(['Balance'])->where(['Address =' => 'bLPbiXBp6Vr3NSnsHzDsLNzoy5o36re9Cz'])->first() +
- $this->Addresses->find()->select(['Balance'])->where(['Address =' => 'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc'])->first() +
- $this->Addresses->find()->select(['Balance'])->where(['Address =' => 'bVUrbCK8hcZ5XWti7b9eNxKEBxzc1rr393'])->first() +
- $this->Addresses->find()->select(['Balance'])->where(['Address =' => 'bZja2VyhAC84a9hMwT8dwTU6rDRXowrjxH'])->first() +
- $this->Addresses->find()->select(['Balance'])->where(['Address =' => 'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc'])->first() +
- $this->Addresses->find()->select(['Balance'])->where(['Address =' => 'bCrboXVztuSbZzVToCWSsu1pEr2oxKHu9v'])->first() +
- $this->Addresses->find()->select(['Balance'])->where(['Address =' => 'bMgqQqYfwzWWYBk5o5dBMXtCndVAoeqy6h'])->first();
+
+ $reservedcommunity = ['rFLUohPG4tP3gZHYoyhvADCtrDMiaYb7Qd'];
+ $reservedoperational = ['r9PGXsejVJb9ZfMf3QVdDEJCzxkd9JLxzL'];
+ $reservedinstitutional = ['r9srwX7DEN7Mex3a8oR1mKSqQmLBizoJvi'];
+ $reservedaux = ['bRo4FEeqqxY7nWFANsZsuKEWByEgkvz8Qt', 'bU2XUzckfpdEuQNemKvhPT1gexQ3GG3SC2', 'bay3VA6YTQBL4WLobbG7CthmoGeUKXuXkD', 'bLPbiXBp6Vr3NSnsHzDsLNzoy5o36re9Cz', 'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc', 'bVUrbCK8hcZ5XWti7b9eNxKEBxzc1rr393', 'bZja2VyhAC84a9hMwT8dwTU6rDRXowrjxH', 'bCrboXVztuSbZzVToCWSsu1pEr2oxKHu9v', 'bMgqQqYfwzWWYBk5o5dBMXtCndVAoeqy6h'];
+ $allAddresses = array_merge($reservedcommunity, $reservedoperational, $reservedinstitutional, $reservedaux);
+
+ $reservedtotal = $this->Addresses->find()->select(['id', 'balance' => 'SUM(balance)'])->where(['Addresses.address IN' => $allAddresses])->first();
- $reservedtotal = $reservedcommunity->Balance + $reservedoperational->Balance + $reservedinstitutional->Balance + $reservedaux->Balance;
-
-
- $circulating = $txoutsetinfo->total_amount - $reservedtotal;
+ $circulating = $txoutsetinfo->total_amount - ($reservedtotal->balance);
return $this->_jsonResponse(['success' => true, 'utxosupply' => ['total' => $txoutsetinfo->total_amount, 'circulating' => $circulating]]);
}
+
+ protected function _formatHashRate($value) {
+ if ($value === 'N/A') {
+ return $value;
+ }
+
+ /*if ($value > 1000000000000) {
+ return number_format( $value / 1000000000000, 2, '.', '' ) . ' TH';
+ }*/
+ if ($value > 1000000000) {
+ return number_format( $value / 1000000000, 2, '.', '' ) . ' GH/s';
+ }
+ if ($value > 1000000) {
+ return number_format( $value / 1000000, 2, '.', '' ) . ' MH/s';
+ }
+ if ($value > 1000) {
+ return number_format( $value / 1000, 2, '.', '' ) . ' KH/s';
+ }
+
+ return number_format($value) . ' H/s';
+ }
+
+ public static function curl_get($url) {
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+
+ $response = curl_exec($ch);
+ Log::debug('Request execution completed.');
+
+ if ($response === false) {
+ $error = curl_error($ch);
+ $errno = curl_errno($ch);
+ curl_close($ch);
+
+ throw new \Exception(sprintf('The request failed: %s', $error), $errno);
+ } else {
+ curl_close($ch);
+ }
+
+ return $response;
+ }
+
+ private function _gethashrate() {
+ $req = ['method' => 'getnetworkhashps', 'params' => []];
+ try {
+ $res = json_decode(self::curl_json_post(self::$rpcurl, json_encode($req)));
+ if (!isset($res->result)) {
+ return 0;
+ }
+ return $res->result;
+ } catch (\Exception $e) {
+ return 'N/A';
+ }
+ }
+
+ // private function _gettxoutsetinfo() {
+ // $req = ['method' => 'gettxoutsetinfo', 'params' => []];
+ // try {
+ // $res = json_decode(self::curl_json_post(self::$rpcurl, json_encode($req)));
+ // if (!isset($res->result)) {
+ // return 0;
+ // }
+ // return $res->result;
+ // } catch (\Exception $e) {
+ // return 'N/A';
+ // }
+ // }
private static function curl_json_post($url, $data, $headers = []) {
$ch = curl_init();
diff --git a/src/Model/Entity/Claim.php b/src/Model/Entity/Claim.php
index 18a5734..cfd183d 100644
--- a/src/Model/Entity/Claim.php
+++ b/src/Model/Entity/Claim.php
@@ -6,30 +6,30 @@ use Cake\ORM\Entity;
class Claim extends Entity {
function getLbryLink() {
- $link = $this->Name;
- if (isset($this->Publisher->Name)) {
- $link = $this->Publisher->Name . '/' . $link;
+ $link = $this->name;
+ if (isset($this->publisher)) {
+ $link = $this->publisher . '/' . $link;
}
$link = 'lbry://' . $link;
return $link;
}
function getExplorerLink() {
- $link = '/claims/' . $this->ClaimId;
+ $link = '/claims/' . $this->claim_id;
return $link;
}
function getContentTag() {
$ctTag = null;
- if (substr($this->ContentType, 0, 5) === 'audio') {
+ if (substr($this->content_type, 0, 5) === 'audio') {
$ctTag = 'audio';
- } else if (substr($this->ContentType, 0, 5) === 'video') {
+ } else if (substr($this->content_type, 0, 5) === 'video') {
$ctTag = 'video';
- } else if (substr($this->ContentType, 0, 5) === 'image') {
+ } else if (substr($this->content_type, 0, 5) === 'image') {
$ctTag = 'image';
}
- if (!$ctTag && $this->ClaimType == 1) {
+ if (!$ctTag && $this->claim_type == 2) {
$ctTag = 'identity';
}
return $ctTag;
@@ -37,11 +37,11 @@ class Claim extends Entity {
function getAutoThumbText() {
$autoThumbText = '';
- if ($this->ClaimType == 1) {
- $autoThumbText = strtoupper(substr($this->Name, 1, min( strlen($this->Name), 3 )));
+ if ($this->claim_type == 2) {
+ $autoThumbText = strtoupper(substr($this->name, 1, min(strlen($this->name), 10)));
} else {
- $str = (strlen(trim($this->Title)) > 0) ? $this->Title : $this->Name;
- $autoThumbText = strtoupper(substr($str, 0, min (strlen($str), 2 )));
+ $str = (strlen(trim($this->title)) > 0) ? $this->title : $this->name;
+ $autoThumbText = strtoupper(substr($str, 0, min(strlen($str), 5)));
}
return $autoThumbText;
}
diff --git a/src/Model/Entity/PriceHistory.php b/src/Model/Entity/PriceHistory.php
index 2d0f333..038ccc6 100644
--- a/src/Model/Entity/PriceHistory.php
+++ b/src/Model/Entity/PriceHistory.php
@@ -5,7 +5,7 @@ namespace App\Model\Entity;
use Cake\ORM\Entity;
class PriceHistory extends Entity {
-
+ public $useDbConfig = 'localdb';
}
?>
\ No newline at end of file
diff --git a/src/Model/Entity/Transaction.php b/src/Model/Entity/Transaction.php
index 631f08c..60fccfc 100644
--- a/src/Model/Entity/Transaction.php
+++ b/src/Model/Entity/Transaction.php
@@ -3,9 +3,9 @@
namespace App\Model\Entity;
use Cake\ORM\Entity;
+use Cake\ORM\TableRegistry;
class Transaction extends Entity {
-
}
?>
\ No newline at end of file
diff --git a/src/Model/Entity/ClaimStream.php b/src/Model/Entity/TransactionAddress.php
similarity index 60%
rename from src/Model/Entity/ClaimStream.php
rename to src/Model/Entity/TransactionAddress.php
index 6a51882..4be5a33 100644
--- a/src/Model/Entity/ClaimStream.php
+++ b/src/Model/Entity/TransactionAddress.php
@@ -4,8 +4,7 @@ namespace App\Model\Entity;
use Cake\ORM\Entity;
-class ClaimStream extends Entity {
-
+class TransactionAddress extends Entity {
}
?>
\ No newline at end of file
diff --git a/src/Model/Table/AddressesTable.php b/src/Model/Table/AddressesTable.php
index 1876136..b710896 100644
--- a/src/Model/Table/AddressesTable.php
+++ b/src/Model/Table/AddressesTable.php
@@ -8,8 +8,8 @@ class AddressesTable extends Table {
public function initialize(array $config) {
parent::initialize($config);
- $this->primaryKey('Id');
- $this->table('Addresses');
+ $this->setPrimaryKey('id');
+ $this->setTable('address');
$this->addBehavior('SimpleAudit');
}
diff --git a/src/Model/Table/BlocksTable.php b/src/Model/Table/BlocksTable.php
index 0b2a8ed..4ef0f17 100644
--- a/src/Model/Table/BlocksTable.php
+++ b/src/Model/Table/BlocksTable.php
@@ -8,8 +8,8 @@ class BlocksTable extends Table {
public function initialize(array $config) {
parent::initialize($config);
- $this->primaryKey('Id');
- $this->table('Blocks');
+ $this->setPrimaryKey('id');
+ $this->setTable('block');
$this->addBehavior('SimpleAudit');
}
diff --git a/src/Model/Table/ClaimStreamsTable.php b/src/Model/Table/ClaimStreamsTable.php
deleted file mode 100644
index eb77edf..0000000
--- a/src/Model/Table/ClaimStreamsTable.php
+++ /dev/null
@@ -1,18 +0,0 @@
-primaryKey('Id');
- $this->table('ClaimStreams');
-
- //$this->addBehavior('SimpleAudit');
- }
-}
-
-?>
\ No newline at end of file
diff --git a/src/Model/Table/ClaimsTable.php b/src/Model/Table/ClaimsTable.php
index 4177faa..c7fb547 100644
--- a/src/Model/Table/ClaimsTable.php
+++ b/src/Model/Table/ClaimsTable.php
@@ -8,29 +8,20 @@ class ClaimsTable extends Table {
public function initialize(array $config) {
parent::initialize($config);
- $this->primaryKey('Id');
- $this->table('Claims');
+ $this->setPrimaryKey('id');
+ $this->setTable('claim');
//$this->addBehavior('SimpleAudit');
$this->addAssociations([
'belongsTo' => [
- 'Publisher' => [
+ 'publisher' => [
'className' => 'App\Model\Table\ClaimsTable',
- 'foreignKey' => 'PublisherId',
- 'bindingKey' => 'ClaimId',
- 'propertyName' => 'Publisher'
- ]
- ],
- 'hasOne' => [
- 'Stream' => [
- 'className' => 'App\Model\Table\ClaimStreamsTable',
- 'foreignKey' => 'Id',
- 'bindingKey' => 'Id',
- 'propertyName' => 'Stream'
+ 'foreignKey' => 'publisher_id',
+ 'bindingKey' => 'claim_id',
+ 'propertyName' => 'publisher'
]
]
]);
}
}
-
?>
\ No newline at end of file
diff --git a/src/Model/Table/InputsTable.php b/src/Model/Table/InputsTable.php
index c1c06e7..5ef080d 100644
--- a/src/Model/Table/InputsTable.php
+++ b/src/Model/Table/InputsTable.php
@@ -8,19 +8,19 @@ class InputsTable extends Table {
public function initialize(array $config) {
parent::initialize($config);
- $this->primaryKey('Id');
- $this->table('Inputs');
+ $this->setPrimaryKey('id');
+ $this->setTable('input');
$this->addBehavior('SimpleAudit');
$this->addAssociations([
'belongsToMany' => [
- 'InputAddresses' => [
+ 'input_addresses' => [
'className' => 'App\Model\Table\AddressesTable',
- 'joinTable' => 'InputsAddresses',
- 'foreignKey' => 'InputId',
- 'targetForeignKey' => 'AddressId',
- 'propertyName' => 'InputAddresses'
+ 'joinTable' => 'input_addresses',
+ 'foreignKey' => 'input_id',
+ 'targetForeignKey' => 'address_id',
+ 'propertyName' => 'input_addresses'
]
]
]);
diff --git a/src/Model/Table/OutputsTable.php b/src/Model/Table/OutputsTable.php
index 1840aa7..5967478 100644
--- a/src/Model/Table/OutputsTable.php
+++ b/src/Model/Table/OutputsTable.php
@@ -8,26 +8,26 @@ class OutputsTable extends Table {
public function initialize(array $config) {
parent::initialize($config);
- $this->primaryKey('Id');
- $this->table('Outputs');
+ $this->setPrimaryKey('id');
+ $this->setTable('output');
$this->addBehavior('SimpleAudit');
$this->addAssociations([
'belongsTo' => [
- 'SpendInput' => [
+ 'spend_input' => [
'className' => 'App\Model\Table\InputsTable',
- 'foreignKey' => 'SpentByInputId',
- 'propertyName' => 'SpendInput'
+ 'foreignKey' => 'spent_by_input_id',
+ 'propertyName' => 'spend_input'
]
],
'belongsToMany' => [
- 'OutputAddresses' => [
+ 'output_addresses' => [
'className' => 'App\Model\Table\AddressesTable',
- 'joinTable' => 'OutputsAddresses',
- 'foreignKey' => 'OutputId',
- 'targetForeignKey' => 'AddressId',
- 'propertyName' => 'OutputAddresses'
+ 'joinTable' => 'output_addresses',
+ 'foreignKey' => 'output_id',
+ 'targetForeignKey' => 'address_id',
+ 'propertyName' => 'output_addresses'
]
]
]);
diff --git a/src/Model/Table/PriceHistoryTable.php b/src/Model/Table/PriceHistoryTable.php
index 1b9fe02..74c2a09 100644
--- a/src/Model/Table/PriceHistoryTable.php
+++ b/src/Model/Table/PriceHistoryTable.php
@@ -8,8 +8,8 @@ class PriceHistoryTable extends Table {
public function initialize(array $config) {
parent::initialize($config);
- $this->primaryKey('Id');
- $this->table('PriceHistory');
+ $this->setPrimaryKey('Id');
+ $this->setTable('PriceHistory');
}
}
diff --git a/src/Model/Table/TagAddressRequestsTable.php b/src/Model/Table/TagAddressRequestsTable.php
index 51af76e..d106ca9 100644
--- a/src/Model/Table/TagAddressRequestsTable.php
+++ b/src/Model/Table/TagAddressRequestsTable.php
@@ -8,8 +8,8 @@ class TagAddressRequestsTable extends Table {
public function initialize(array $config) {
parent::initialize($config);
- $this->primaryKey('Id');
- $this->table('TagAddressRequests');
+ $this->setPrimaryKey('Id');
+ $this->setTable('TagAddressRequests');
$this->addBehavior('SimpleAudit');
}
diff --git a/src/Model/Table/TransactionAddressesTable.php b/src/Model/Table/TransactionAddressesTable.php
new file mode 100644
index 0000000..29d090a
--- /dev/null
+++ b/src/Model/Table/TransactionAddressesTable.php
@@ -0,0 +1,16 @@
+setTable('transaction_address');
+ $this->addBehavior('SimpleAudit');
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/src/Model/Table/TransactionsTable.php b/src/Model/Table/TransactionsTable.php
index 613512d..28c010d 100644
--- a/src/Model/Table/TransactionsTable.php
+++ b/src/Model/Table/TransactionsTable.php
@@ -8,8 +8,8 @@ class TransactionsTable extends Table {
public function initialize(array $config) {
parent::initialize($config);
- $this->primaryKey('Id');
- $this->table('Transactions');
+ $this->setPrimaryKey('id');
+ $this->setTable('transaction');
$this->addBehavior('SimpleAudit');
}
diff --git a/src/Shell/AuxShell.php b/src/Shell/AuxShell.php
index 2495a9c..cfb6f8f 100644
--- a/src/Shell/AuxShell.php
+++ b/src/Shell/AuxShell.php
@@ -127,7 +127,7 @@ class AuxShell extends Shell {
public function pricehistory() {
self::lock('pricehistory');
- $conn = ConnectionManager::get('default');
+ $conn = ConnectionManager::get('localdb');
$redis = new \Predis\Client(Configure::read('Redis.Url'));
try {
diff --git a/src/Template/Element/claimbox.ctp b/src/Template/Element/claimbox.ctp
new file mode 100644
index 0000000..76bc25e
--- /dev/null
+++ b/src/Template/Element/claimbox.ctp
@@ -0,0 +1,76 @@
+getAutoThumbText();
+$cost = '';
+if (isset($claim->price) && $claim->price > 0) {
+ $cost = $this->Amount->formatCurrency($claim->price) . ' LBC';
+} else if (isset($claim->fee) && strtolower($claim->fee_currency) === 'lbc') {
+ $cost = $this->Amount->formatCurrency($claim->fee) . ' LBC';
+}
+$a = ['purple', 'orange', 'blue', 'teal', 'green', 'yellow'];
+// content type
+$ctTag = $claim->getContentTag();
+?>
+
+ 0): ?>
+
+
+
+
+
+
+ is_nsfw && strlen(trim($claim->thumbnail_url)) > 0): ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Template/Main/address.ctp b/src/Template/Main/address.ctp
index 940c7f5..1357301 100644
--- a/src/Template/Main/address.ctp
+++ b/src/Template/Main/address.ctp
@@ -1,4 +1,4 @@
-assign('title', 'Address ' . $address->Address) ?>
+assign('title', 'Address ' . $address->address) ?>
start('script') ?>
end(); ?>
- assign('title', 'Block Height ' . $block->Height) ?>
+ assign('title', 'Block Height ' . $block->height) ?>
-
LBRY Block Height ?>
- Hash ?>
+ LBRY Block height ?>
+ hash ?>
@@ -47,44 +45,46 @@
Block Size (bytes)
Block Time
- BlockSize, 0, '', ',') ?>
- BlockTime)->format('j M Y H:i:s') . ' UTC' ?>
+ block_size, 0, '', ',') ?>
+ block_time)->format('j M Y H:i:s') . ' UTC' ?>
Bits
Confirmations
- Bits ?>
- Confirmations, 0, '', ',') ?>
+ bits ?>
+ confirmations, 0, '', ',') ?>
Difficulty
Nonce
- Amount->format($block->Difficulty, '') ?>
- Nonce ?>
+ Amount->format($block->difficulty, '') ?>
+ nonce ?>
- Chainwork
Chainwork ?>
+ Chainwork
chainwork ?>
- MerkleRoot
MerkleRoot ?>
+ MerkleRoot
merkle_root ?>
- NameClaimRoot
NameClaimRoot ?>
+ NameClaimRoot
name_claim_root ?>
+
- Version
Version ?>
+ Version
version ?>
@@ -109,10 +109,10 @@
- |
- InputCount ?> |
- OutputCount ?> |
- Amount->formatCurrency($tx->Value) ?> LBC |
+ |
+ input_count ?> |
+ output_count ?> |
+ Amount->formatCurrency($tx->value) ?> LBC |
@@ -181,13 +181,13 @@
- Height ?> |
- Difficulty, 8, '.', '') ?> |
- Height - $block->Height) + 1), 0, '', ',') ?> |
- TransactionHashes)) ?> |
- BlockSize / 1024, 2) . 'KB' ?> |
- Nonce ?> |
- BlockTime)->format('d M Y H:i:s') ?> UTC |
+ height ?> |
+ difficulty, 8, '.', '') ?> |
+ height - $block->height) + 1), 0, '', ',') ?> |
+ transaction_hashes)) ?> |
+ block_size / 1024, 2) . 'KB' ?> |
+ nonce ?> |
+ block_time)->format('d M Y H:i:s') ?> UTC |
diff --git a/src/Template/Main/claims.ctp b/src/Template/Main/claims.ctp
index 0d4bfad..4458105 100644
--- a/src/Template/Main/claims.ctp
+++ b/src/Template/Main/claims.ctp
@@ -41,13 +41,13 @@
$a = ['purple', 'orange', 'blue', 'teal', 'green', 'yellow'];
$autoThumbText = $claim->getAutoThumbText();
$cost = 'Free';
-if (isset($claim->Price) && $claim->Price > 0) {
- $cost = $this->Amount->formatCurrency($claim->Price) . ' LBC';
-} else if (isset($claim->Fee) && strtolower($claim->FeeCurrency) === 'lbc') {
- $cost = $this->Amount->formatCurrency($claim->Fee) . ' LBC';
+if (isset($claim->price) && $claim->price > 0) {
+ $cost = $this->Amount->formatCurrency($claim->price) . ' LBC';
+} else if (isset($claim->fee) && strtolower($claim->fee_currency) === 'lbc') {
+ $cost = $this->Amount->formatCurrency($claim->fee) . ' LBC';
}
-$desc = $claim->Description;
+$desc = $claim->description;
if (strlen(trim($desc)) == 0) {
$desc = '
No description available.';
} else {
@@ -57,29 +57,29 @@ if (strlen(trim($desc)) == 0) {
?>
-assign('title', 'Claim • ' . $claim->Name) ?>
+assign('title', 'Claim • ' . $claim->name) ?>
-
-
ClaimId ?>
+
+
claim_id ?>
- IsNSFW && strlen(trim($claim->ThumbnailUrl)) > 0): ?>
-
+ is_nsfw && strlen(trim($claim->thumbnail_url)) > 0): ?>
+
- ClaimType == 2): ?>
+ claim_type == 1): ?>
Published By
- Publisher)): ?>
-
Publisher->Name ?>
+ publisher)): ?>
+
publisher ?>
Anonymous
@@ -87,17 +87,17 @@ if (strlen(trim($desc)) == 0) {
Created On
-
TransactionTime > 0 ? $claim->TransactionTime : $claim->Created->format('U'))->format('j M Y H:i:s') ?> UTC
+
transaction_time > 0 ? $claim->transaction_time : $claim->created_at->format('U'))->format('j M Y H:i:s') ?> UTC
Transaction ID
-
+
- ClaimType == 2): ?>
+ claim_type == 1): ?>
Cost
Safe for Work
-
IsNSFW ? 'No' : 'Yes' ?>
+
is_nsfw ? 'No' : 'Yes' ?>
@@ -105,11 +105,11 @@ if (strlen(trim($desc)) == 0) {