Updated libraries and class loading code.

This commit is contained in:
flash 2020-05-12 23:09:03 +00:00
parent 69620fe461
commit 21f254a8c0
11 changed files with 171 additions and 400 deletions

View file

@ -1,27 +1,10 @@
{
"name": "flashwave/misuzu",
"description": "Community System",
"homepage": "https://flashii.net",
"support": {
"email": "me@flash.moe",
"issues": "https://github.com/flashwave/misuzu/issues"
},
"require": {
"php": "^7.4",
"ext-curl": "*",
"ext-intl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-pdo": "*",
"ext-readline": "*",
"ext-xml": "*",
"ext-zip": "*",
"twig/twig": "^2.0",
"swiftmailer/swiftmailer": "~6.0",
"erusev/parsedown": "~1.6",
"geoip2/geoip2": "~2.0",
"twig/extensions": "^1.5",
"filp/whoops": "^2.2",
"jublonet/codebird-php": "^3.1",
"chillerlan/php-qrcode": "^3.0",
"psr/http-message": "^1.0",
@ -30,12 +13,6 @@
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"Misuzu\\": "src/"
},
"files": [
"utility.php"
]
},
"scripts": {

301
composer.lock generated
View file

@ -1,23 +1,23 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "0649c35f94ec31b6b23ad77ce1fd744f",
"content-hash": "bfa28642db2d2fcc44e6d1e872948d44",
"packages": [
{
"name": "chillerlan/php-qrcode",
"version": "3.2.0",
"version": "3.2.3",
"source": {
"type": "git",
"url": "https://github.com/chillerlan/php-qrcode.git",
"reference": "df33b38b6348ba96e2bf2207d7b0ca6ce3e506f4"
"reference": "abb7ce7831f1e1653542c68783b2d4d57c372a02"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/chillerlan/php-qrcode/zipball/df33b38b6348ba96e2bf2207d7b0ca6ce3e506f4",
"reference": "df33b38b6348ba96e2bf2207d7b0ca6ce3e506f4",
"url": "https://api.github.com/repos/chillerlan/php-qrcode/zipball/abb7ce7831f1e1653542c68783b2d4d57c372a02",
"reference": "abb7ce7831f1e1653542c68783b2d4d57c372a02",
"shasum": ""
},
"require": {
@ -28,17 +28,12 @@
"php": "^7.2"
},
"require-dev": {
"phpunit/phpunit": "^8.4"
"phpunit/phpunit": "^8.5"
},
"suggest": {
"chillerlan/php-authenticator": "Yet another Google authenticator! Also creates URIs for mobile apps."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-v2.0.x-php5": "1.0.8-dev"
}
},
"autoload": {
"psr-4": {
"chillerlan\\QRCode\\": "src/"
@ -72,7 +67,7 @@
"qrcode",
"qrcode-generator"
],
"time": "2019-12-04T21:31:05+00:00"
"time": "2020-04-12T06:59:53+00:00"
},
{
"name": "chillerlan/php-settings-container",
@ -124,16 +119,16 @@
},
{
"name": "composer/ca-bundle",
"version": "1.2.5",
"version": "1.2.7",
"source": {
"type": "git",
"url": "https://github.com/composer/ca-bundle.git",
"reference": "62e8fc2dc550e5d6d8c9360c7721662670f58149"
"reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/62e8fc2dc550e5d6d8c9360c7721662670f58149",
"reference": "62e8fc2dc550e5d6d8c9360c7721662670f58149",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/95c63ab2117a72f48f5a55da9740a3273d45b7fd",
"reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd",
"shasum": ""
},
"require": {
@ -176,32 +171,35 @@
"ssl",
"tls"
],
"time": "2019-12-11T14:44:42+00:00"
"time": "2020-04-08T08:27:21+00:00"
},
{
"name": "composer/installers",
"version": "v1.7.0",
"version": "v1.9.0",
"source": {
"type": "git",
"url": "https://github.com/composer/installers.git",
"reference": "141b272484481432cda342727a427dc1e206bfa0"
"reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/installers/zipball/141b272484481432cda342727a427dc1e206bfa0",
"reference": "141b272484481432cda342727a427dc1e206bfa0",
"url": "https://api.github.com/repos/composer/installers/zipball/b93bcf0fa1fccb0b7d176b0967d969691cd74cca",
"reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0"
"composer-plugin-api": "^1.0 || ^2.0"
},
"replace": {
"roundcube/plugin-installer": "*",
"shama/baton": "*"
},
"require-dev": {
"composer/composer": "1.0.*@dev",
"phpunit/phpunit": "^4.8.36"
"composer/composer": "1.6.* || 2.0.*@dev",
"composer/semver": "1.0.* || 2.0.*@dev",
"phpunit/phpunit": "^4.8.36",
"sebastian/comparator": "^1.2.4",
"symfony/process": "^2.3"
},
"type": "composer-plugin",
"extra": {
@ -237,6 +235,7 @@
"Kanboard",
"Lan Management System",
"MODX Evo",
"MantisBT",
"Mautic",
"Maya",
"OXID",
@ -291,6 +290,7 @@
"shopware",
"silverstripe",
"sydes",
"sylius",
"symfony",
"typo3",
"wordpress",
@ -298,7 +298,7 @@
"zend",
"zikula"
],
"time": "2019-08-12T15:00:31+00:00"
"time": "2020-04-07T06:57:05+00:00"
},
{
"name": "doctrine/lexer",
@ -364,27 +364,27 @@
},
{
"name": "egulias/email-validator",
"version": "2.1.11",
"version": "2.1.17",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
"reference": "92dd169c32f6f55ba570c309d83f5209cefb5e23"
"reference": "ade6887fd9bd74177769645ab5c474824f8a418a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/92dd169c32f6f55ba570c309d83f5209cefb5e23",
"reference": "92dd169c32f6f55ba570c309d83f5209cefb5e23",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/ade6887fd9bd74177769645ab5c474824f8a418a",
"reference": "ade6887fd9bd74177769645ab5c474824f8a418a",
"shasum": ""
},
"require": {
"doctrine/lexer": "^1.0.1",
"php": ">= 5.5"
"php": ">=5.5",
"symfony/polyfill-intl-idn": "^1.10"
},
"require-dev": {
"dominicsayers/isemail": "dev-master",
"phpunit/phpunit": "^4.8.35||^5.7||^6.0",
"satooshi/php-coveralls": "^1.0.1",
"symfony/phpunit-bridge": "^4.4@dev"
"dominicsayers/isemail": "^3.0.7",
"phpunit/phpunit": "^4.8.36|^7.5.15",
"satooshi/php-coveralls": "^1.0.1"
},
"suggest": {
"ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation"
@ -418,20 +418,20 @@
"validation",
"validator"
],
"time": "2019-08-13T17:33:27+00:00"
"time": "2020-02-13T22:36:52+00:00"
},
{
"name": "erusev/parsedown",
"version": "1.7.3",
"version": "1.7.4",
"source": {
"type": "git",
"url": "https://github.com/erusev/parsedown.git",
"reference": "6d893938171a817f4e9bc9e86f2da1e370b7bcd7"
"reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/6d893938171a817f4e9bc9e86f2da1e370b7bcd7",
"reference": "6d893938171a817f4e9bc9e86f2da1e370b7bcd7",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/cb17b6477dfff935958ba01325f2e8a2bfa6dab3",
"reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3",
"shasum": ""
},
"require": {
@ -464,68 +464,7 @@
"markdown",
"parser"
],
"time": "2019-03-17T18:48:37+00:00"
},
{
"name": "filp/whoops",
"version": "2.5.0",
"source": {
"type": "git",
"url": "https://github.com/filp/whoops.git",
"reference": "cde50e6720a39fdacb240159d3eea6865d51fd96"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filp/whoops/zipball/cde50e6720a39fdacb240159d3eea6865d51fd96",
"reference": "cde50e6720a39fdacb240159d3eea6865d51fd96",
"shasum": ""
},
"require": {
"php": "^5.5.9 || ^7.0",
"psr/log": "^1.0.1"
},
"require-dev": {
"mockery/mockery": "^0.9 || ^1.0",
"phpunit/phpunit": "^4.8.35 || ^5.7",
"symfony/var-dumper": "^2.6 || ^3.0 || ^4.0"
},
"suggest": {
"symfony/var-dumper": "Pretty print complex values better with var-dumper available",
"whoops/soap": "Formats errors as SOAP responses"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
}
},
"autoload": {
"psr-4": {
"Whoops\\": "src/Whoops/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Filipe Dobreira",
"homepage": "https://github.com/filp",
"role": "Developer"
}
],
"description": "php error handling for cool kids",
"homepage": "https://filp.github.io/whoops/",
"keywords": [
"error",
"exception",
"handling",
"library",
"throwable",
"whoops"
],
"time": "2019-08-07T09:00:00+00:00"
"time": "2019-12-30T22:54:17+00:00"
},
{
"name": "geoip2/geoip2",
@ -641,21 +580,24 @@
},
{
"name": "maxmind-db/reader",
"version": "v1.5.1",
"version": "v1.6.0",
"source": {
"type": "git",
"url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
"reference": "f096bbe4d37e3d93e62626297bfc2179472a972d"
"reference": "febd4920bf17c1da84cef58e56a8227dfb37fbe4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/f096bbe4d37e3d93e62626297bfc2179472a972d",
"reference": "f096bbe4d37e3d93e62626297bfc2179472a972d",
"url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/febd4920bf17c1da84cef58e56a8227dfb37fbe4",
"reference": "febd4920bf17c1da84cef58e56a8227dfb37fbe4",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"conflict": {
"ext-maxminddb": "<1.6.0,>=2.0.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "2.*",
"php-coveralls/php-coveralls": "^2.1",
@ -694,20 +636,20 @@
"geolocation",
"maxmind"
],
"time": "2019-12-12T18:32:55+00:00"
"time": "2019-12-19T22:59:03+00:00"
},
{
"name": "maxmind/web-service-common",
"version": "v0.6.0",
"version": "v0.7.0",
"source": {
"type": "git",
"url": "https://github.com/maxmind/web-service-common-php.git",
"reference": "40c928bb0194c45088b369a17f9baef9c3fc7460"
"reference": "74c996c218ada5c639c8c2f076756e059f5552fc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/40c928bb0194c45088b369a17f9baef9c3fc7460",
"reference": "40c928bb0194c45088b369a17f9baef9c3fc7460",
"url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/74c996c218ada5c639c8c2f076756e059f5552fc",
"reference": "74c996c218ada5c639c8c2f076756e059f5552fc",
"shasum": ""
},
"require": {
@ -740,7 +682,7 @@
],
"description": "Internal MaxMind Web Service API",
"homepage": "https://github.com/maxmind/web-service-common-php",
"time": "2019-12-12T15:56:05+00:00"
"time": "2020-05-06T14:07:26+00:00"
},
{
"name": "psr/http-message",
@ -845,53 +787,6 @@
],
"time": "2018-10-30T16:46:14+00:00"
},
{
"name": "psr/log",
"version": "1.1.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801",
"reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2019-11-01T11:05:21+00:00"
},
{
"name": "swiftmailer/swiftmailer",
"version": "v6.2.3",
@ -956,16 +851,16 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.13.1",
"version": "v1.17.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3"
"reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9",
"reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9",
"shasum": ""
},
"require": {
@ -977,7 +872,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.13-dev"
"dev-master": "1.17-dev"
}
},
"autoload": {
@ -1010,20 +905,20 @@
"polyfill",
"portable"
],
"time": "2019-11-27T13:56:44+00:00"
"time": "2020-05-12T16:14:59+00:00"
},
{
"name": "symfony/polyfill-iconv",
"version": "v1.13.1",
"version": "v1.17.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-iconv.git",
"reference": "a019efccc03f1a335af6b4f20c30f5ea8060be36"
"reference": "c4de7601eefbf25f9d47190abe07f79fe0a27424"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/a019efccc03f1a335af6b4f20c30f5ea8060be36",
"reference": "a019efccc03f1a335af6b4f20c30f5ea8060be36",
"url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/c4de7601eefbf25f9d47190abe07f79fe0a27424",
"reference": "c4de7601eefbf25f9d47190abe07f79fe0a27424",
"shasum": ""
},
"require": {
@ -1035,7 +930,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.13-dev"
"dev-master": "1.17-dev"
}
},
"autoload": {
@ -1069,26 +964,26 @@
"portable",
"shim"
],
"time": "2019-11-27T13:56:44+00:00"
"time": "2020-05-12T16:47:27+00:00"
},
{
"name": "symfony/polyfill-intl-idn",
"version": "v1.13.1",
"version": "v1.17.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
"reference": "6f9c239e61e1b0c9229a28ff89a812dc449c3d46"
"reference": "3bff59ea7047e925be6b7f2059d60af31bb46d6a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/6f9c239e61e1b0c9229a28ff89a812dc449c3d46",
"reference": "6f9c239e61e1b0c9229a28ff89a812dc449c3d46",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/3bff59ea7047e925be6b7f2059d60af31bb46d6a",
"reference": "3bff59ea7047e925be6b7f2059d60af31bb46d6a",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/polyfill-mbstring": "^1.3",
"symfony/polyfill-php72": "^1.9"
"symfony/polyfill-php72": "^1.10"
},
"suggest": {
"ext-intl": "For best performance"
@ -1096,7 +991,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.13-dev"
"dev-master": "1.17-dev"
}
},
"autoload": {
@ -1131,20 +1026,20 @@
"portable",
"shim"
],
"time": "2019-11-27T13:56:44+00:00"
"time": "2020-05-12T16:47:27+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.13.1",
"version": "v1.17.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f"
"reference": "fa79b11539418b02fc5e1897267673ba2c19419c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f",
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fa79b11539418b02fc5e1897267673ba2c19419c",
"reference": "fa79b11539418b02fc5e1897267673ba2c19419c",
"shasum": ""
},
"require": {
@ -1156,7 +1051,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.13-dev"
"dev-master": "1.17-dev"
}
},
"autoload": {
@ -1190,20 +1085,20 @@
"portable",
"shim"
],
"time": "2019-11-27T14:18:11+00:00"
"time": "2020-05-12T16:47:27+00:00"
},
{
"name": "symfony/polyfill-php72",
"version": "v1.13.1",
"version": "v1.17.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
"reference": "66fea50f6cb37a35eea048d75a7d99a45b586038"
"reference": "f048e612a3905f34931127360bdd2def19a5e582"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038",
"reference": "66fea50f6cb37a35eea048d75a7d99a45b586038",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/f048e612a3905f34931127360bdd2def19a5e582",
"reference": "f048e612a3905f34931127360bdd2def19a5e582",
"shasum": ""
},
"require": {
@ -1212,7 +1107,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.13-dev"
"dev-master": "1.17-dev"
}
},
"autoload": {
@ -1245,7 +1140,7 @@
"portable",
"shim"
],
"time": "2019-11-27T13:56:44+00:00"
"time": "2020-05-12T16:47:27+00:00"
},
{
"name": "twig/extensions",
@ -1304,16 +1199,16 @@
},
{
"name": "twig/twig",
"version": "v2.12.2",
"version": "v2.12.5",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "d761fd1f1c6b867ae09a7d8119a6d95d06dc44ed"
"reference": "18772e0190734944277ee97a02a9a6c6555fcd94"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/d761fd1f1c6b867ae09a7d8119a6d95d06dc44ed",
"reference": "d761fd1f1c6b867ae09a7d8119a6d95d06dc44ed",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/18772e0190734944277ee97a02a9a6c6555fcd94",
"reference": "18772e0190734944277ee97a02a9a6c6555fcd94",
"shasum": ""
},
"require": {
@ -1323,8 +1218,7 @@
},
"require-dev": {
"psr/container": "^1.0",
"symfony/debug": "^3.4|^4.2",
"symfony/phpunit-bridge": "^4.4@dev|^5.0"
"symfony/phpunit-bridge": "^4.4|^5.0"
},
"type": "library",
"extra": {
@ -1353,7 +1247,6 @@
},
{
"name": "Twig Team",
"homepage": "https://twig.symfony.com/contributors",
"role": "Contributors"
},
{
@ -1367,7 +1260,7 @@
"keywords": [
"templating"
],
"time": "2019-11-11T16:52:09+00:00"
"time": "2020-02-11T15:31:23+00:00"
}
],
"packages-dev": [],
@ -1376,16 +1269,6 @@
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": "^7.4",
"ext-curl": "*",
"ext-intl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-pdo": "*",
"ext-readline": "*",
"ext-xml": "*",
"ext-zip": "*"
},
"platform": [],
"platform-dev": []
}

View file

@ -13,34 +13,54 @@ define('MSZ_CLI', PHP_SAPI === 'cli');
define('MSZ_DEBUG', is_file(MSZ_ROOT . '/.debug'));
define('MSZ_PHP_MIN_VER', '7.4.0');
if(version_compare(PHP_VERSION, MSZ_PHP_MIN_VER, '<')) {
die('Misuzu requires <i>at least</i> PHP <b>' . MSZ_PHP_MIN_VER . '</b> to run.');
}
if(version_compare(PHP_VERSION, MSZ_PHP_MIN_VER, '<'))
die("Misuzu requires <i>at least</i> PHP <b>" . MSZ_PHP_MIN_VER . "</b> to run.\r\n");
if(!extension_loaded('curl') || !extension_loaded('intl') || !extension_loaded('json')
|| !extension_loaded('mbstring') || !extension_loaded('pdo') || !extension_loaded('readline')
|| !extension_loaded('xml') || !extension_loaded('zip'))
die("An extension required by Misuzu hasn't been installed.\r\n");
error_reporting(MSZ_DEBUG ? -1 : 0);
ini_set('display_errors', MSZ_DEBUG ? 'On' : 'Off');
mb_internal_encoding('UTF-8');
date_default_timezone_set('UTC');
mb_internal_encoding('utf-8');
date_default_timezone_set('utc');
set_include_path(get_include_path() . PATH_SEPARATOR . MSZ_ROOT);
set_exception_handler(function(\Throwable $ex) {
http_response_code(500);
if(MSZ_CLI || MSZ_DEBUG) {
header('Content-Type: text/plain; charset=utf-8');
echo (string)$ex;
} else {
header('Content-Type: text/html; charset-utf-8');
echo file_get_contents(MSZ_ROOT . '/templates/500.html');
}
exit;
});
set_error_handler(function(int $errno, string $errstr, string $errfile, int $errline) {
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
return true;
}, -1);
require_once 'vendor/autoload.php';
spl_autoload_register(function(string $className) {
$parts = explode('\\', trim($className, '\\'), 2);
if($parts[0] !== 'Misuzu')
return;
$classPath = MSZ_ROOT . '/src/' . str_replace('\\', '/', $parts[1]) . '.php';
if(is_file($classPath))
require_once $classPath;
});
class_alias(\Misuzu\Http\HttpServerRequestMessage::class, '\Misuzu\Http\Handlers\Request');
class_alias(\Misuzu\Http\Routing\RouterResponseMessage::class, '\Misuzu\Http\Handlers\Response');
$errorHandler = new \Whoops\Run;
$errorHandler->pushHandler(
MSZ_CLI
? new \Whoops\Handler\PlainTextHandler
: (
MSZ_DEBUG
? new \Whoops\Handler\PrettyPageHandler
: ($errorReporter = new WhoopsReporter)
)
);
$errorHandler->register();
require_once 'utility.php';
require_once 'src/audit_log.php';
require_once 'src/changelog.php';
require_once 'src/comments.php';
@ -90,13 +110,6 @@ Mailer::init(Config::get('mail.method', Config::TYPE_STR), [
'sender_addr' => Config::get('mail.sender.address', Config::TYPE_STR),
]);
if(!empty($errorReporter)) {
$errorReporter->setReportInfo(
Config::get('error_report.url', Config::TYPE_STR),
Config::get('error_report.secret', Config::TYPE_STR)
);
}
// replace this with a better storage mechanism
define('MSZ_STORAGE', Config::get('storage.path', Config::TYPE_STR, MSZ_ROOT . '/store'));
mkdirs(MSZ_STORAGE, true);

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 KiB

View file

@ -2,9 +2,9 @@
namespace Misuzu;
use InvalidArgumentException;
use Twig_Environment;
use Twig\Environment as Twig_Environment;
use Twig_Extensions_Extension_Date;
use Twig_Loader_Filesystem;
use Twig\Loader\FilesystemLoader as Twig_Loader_Filesystem;
final class Template {
private const FILE_EXT = '.twig';

View file

@ -1,102 +0,0 @@
<?php
namespace Misuzu;
use Whoops\Exception\Formatter;
use Whoops\Handler\Handler;
final class WhoopsReporter extends Handler {
private $reportUrl;
private $reportSign;
public function __construct(?string $reportUrl = null, ?string $reportSign = null) {
$this->setReportInfo($reportUrl, $reportSign);
}
public function setReportInfo(?string $reportUrl = null, ?string $reportSign = null): void {
$this->reportUrl = $reportUrl;
$this->reportSign = $reportSign;
}
public function handle() {
echo $this->html(
$this->report()
? 'Information about this error has been sent to the devs.'
: 'Report what you were trying to a developer.'
);
return Handler::QUIT;
}
public function contentType(): string {
return 'text/html';
}
public function html(string $text): string {
return <<<HTML
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Something broke!</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/css/style.css" rel="stylesheet">
</head>
<body class="main" style="justify-content: center; --site-max-width: 400px">
<div class="main__wrapper" style="flex: 0 0 auto">
<div class="container">
<div class="container__title">
<div class="container__title__background"></div>
<div class="container__title__text"><i class="fas fa-bug fa-fw"></i> Something broke!</div>
</div>
<div class="container__content">
<p>{$text}</p>
</div>
</div>
</div>
</body>
</html>
HTML;
}
private function report(): bool {
if(!mb_strlen($this->reportUrl) || !($curl = curl_init($this->reportUrl))) {
return false;
}
$json = json_encode([
'git' => [
'tag' => GitInfo::tag(),
'hash' => GitInfo::hash(true),
],
'misuzu' => [
'trace_txt' => $this->getException()->getTraceAsString(),
'directory' => MSZ_ROOT,
],
'exception' => Formatter::formatExceptionAsDataArray(
$this->getInspector(),
$this
),
]);
$headers = [
'Content-Type: application/json;charset=utf-8',
];
if(mb_strlen($this->reportSign)) {
$headers[] = 'X-Misuzu-Signature: sha256=' . hash_hmac('sha256', $json, $this->reportSign);
}
$setOpts = curl_setopt_array($curl, [
CURLOPT_TCP_NODELAY => true,
CURLOPT_POSTFIELDS => $json,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_RETURNTRANSFER => false,
]);
if(!$setOpts) {
return false;
}
return curl_exec($curl) !== false;
}
}

16
templates/500.html Normal file
View file

@ -0,0 +1,16 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Error 500</title>
<style type="text/css">
body {
font: 12px/20px Tahoma, Geneva, 'Dejavu Sans', Arial, Helvetica, sans-serif;
}
</style>
</head>
<body>
<h1>Error 500</h1>
<p>Something horrendously went wrong. Please report what you were doing to a developer.</p>
</body>
</html>

View file

@ -75,7 +75,7 @@
</time>
</a>
{% if is_pinned %}
<span class="comment__pin">{% spaceless %}
<span class="comment__pin">{% apply spaceless %}
Pinned
{% if comment.comment_pinned != comment.comment_created %}
<time title="{{ comment.comment_pinned|date('r') }}"
@ -83,7 +83,7 @@
{{ comment.comment_pinned|time_diff }}
</time>
{% endif %}
{% endspaceless %}</span>
{% endapply %}</span>
{% endif %}
</div>
<div class="comment__text">

View file

@ -1,18 +1,18 @@
{% macro input_hidden(name, value) %}
{% spaceless %}
{% apply spaceless %}
<input type="hidden" name="{{ name }}" value="{{ value }}"/>
{% endspaceless %}
{% endapply %}
{% endmacro %}
{% macro input_csrf() %}
{% from _self import input_hidden %}
{% spaceless %}
{% apply spaceless %}
{{ input_hidden('_csrf', csrf_token()) }}
{% endspaceless %}
{% endapply %}
{% endmacro %}
{% macro input_text(name, class, value, type, placeholder, required, attributes, tabindex, autofocus, raw) %}
{% spaceless %}
{% apply spaceless %}
<input type="{{ type|default('text') }}" {% if name|length > 0 %}name="{{ name }}"{% else %}readonly{% endif %}
class="{% if not raw|default(false) %}input__text{% if name|length < 1 %} input__text--readonly{% endif %}{% endif %}{{ class|length > 0 ? ' ' ~ class : '' }}"
{% if placeholder|length > 0 %}placeholder="{{ placeholder }}"{% endif %}
@ -21,11 +21,11 @@
{% for name, value in attributes|default([]) %}
{{ name }}{% if value|length > 0 %}="{{ value }}"{% endif %}
{% endfor %}/>
{% endspaceless %}
{% endapply %}
{% endmacro %}
{% macro input_checkbox_raw(name, checked, class, value, radio, attributes, disabled) %}
{% spaceless %}
{% apply spaceless %}
<input type="{{ radio ? 'radio' : 'checkbox' }}" class="{{ class|length > 0 ? class : 'input__checkbox__input' }}"
{% if name|length > 0 %}name="{{ name }}"{% endif %}
{% if checked %}checked{% endif %}
@ -34,12 +34,12 @@
{% for name, value in attributes|default([]) %}
{{ name }}{% if value|length > 0 %}="{{ value }}"{% endif %}
{% endfor %}/>
{% endspaceless %}
{% endapply %}
{% endmacro %}
{% macro input_checkbox(name, text, checked, class, value, radio, attributes, disabled) %}
{% from _self import input_checkbox_raw %}
{% spaceless %}
{% apply spaceless %}
<label class="input__checkbox{% if radio %} input__checkbox--radio{% endif %}{% if disabled %} input__checkbox--disabled{% endif %}{{ class|length > 0 ? ' ' ~ class : '' }}">
{{ input_checkbox_raw(name, checked, '', value, radio, attributes, disabled) }}
<div class="input__checkbox__display">
@ -51,23 +51,23 @@
</div>
{% endif %}
</label>
{% endspaceless %}
{% endapply %}
{% endmacro %}
{% macro input_file_raw(name, class, accepts, attributes) %}
{% spaceless %}
{% apply spaceless %}
<input type="file" {% if name|length > 0 %}name="{{ name }}"{% endif %}
class="{{ class|length > 0 ? class : 'input__upload__input' }}"
{% if accepts|length > 0 %}accept="{{ accepts|join(',') }}"{% endif %}
{% for name, value in attributes|default([]) %}
{{ name }}{% if value|length > 0 %}="{{ value }}"{% endif %}
{% endfor %}/>
{% endspaceless %}
{% endapply %}
{% endmacro %}
{% macro input_file(name, class, accepts, attributes) %}
{% from _self import input_file_raw %}
{% spaceless %}
{% apply spaceless %}
<label class="input__upload">
{{ input_file_raw(name, class, accepts, attributes) }}
<div class="input__upload__selection">
@ -80,20 +80,20 @@
input.addEventListener('change', ev => display.textContent = Array.from(ev.target.files).map(f => f.name).join(', '));
</script>
</label>
{% endspaceless %}
{% endapply %}
{% endmacro %}
{% macro input_select_option(value, key, selected) %}
{% spaceless %}
{% apply spaceless %}
<option{% if key|length > 0 %} value="{{ key }}"{% endif %}{% if selected %} selected{% endif %}>
{{ value }}
</option>
{% endspaceless %}
{% endapply %}
{% endmacro %}
{% macro input_select(name, options, selected, value_name, key_name, only_values, class, attributes) %}
{% from _self import input_select_option %}
{% spaceless %}
{% apply spaceless %}
<select class="input__select{{ class|length > 0 ? ' ' ~ class : '' }}"
{% if name|length > 0 %}name="{{ name }}"{% endif %}
{% for name, value in attributes|default([]) %}
@ -105,15 +105,15 @@
{{ input_select_option(option_value, option_key, option_key|default(option_value) == selected) }}
{% endfor %}
</select>
{% endspaceless %}
{% endapply %}
{% endmacro %}
{% macro input_colour(name, class, value) %}
{% spaceless %}
{% apply spaceless %}
<label class="input__colour{% if class %} {{ class }}{% endif %}">
<div class="input__colour__overlay"></div>
<input type="color" {% if name|length > 0 %}name="{{ name }}"{% else %}readonly onclick="return false"{% endif %}
value="{{ value }}" class="input__colour__control"/>
</label>
{% endspaceless %}
{% endapply %}
{% endmacro %}

View file

@ -1,4 +1,4 @@
{% spaceless %}
{% apply spaceless %}
{% set description = description|default(globals.site_description) %}
{% set site_twitter = site_twitter|default(globals.site_twitter) %}
@ -62,4 +62,4 @@
<link rel="alternate" type="application/{{ feed.type }}+xml" title="{{ feed.title|default(feed.type) }}" href="{{ feed.url }}">
{% endfor %}
{% endif %}
{% endspaceless %}
{% endapply %}

View file

@ -1,16 +0,0 @@
{
"compilerOptions": {
"target": "es5",
"module": "none",
"jsx": "react",
"jsxFactory": "mszCreateElement",
"removeComments": true,
"preserveConstEnums": true,
"out": "./public/js/misuzu.js",
"rootDir": "./assets/typescript/",
"sourceMap": false,
},
"files": [
"./assets/typescript/misuzu.tsx",
]
}