From 79998758ae62c83a57dc8776603f36a4f3029c1b Mon Sep 17 00:00:00 2001 From: visavi Date: Tue, 7 Aug 2018 18:09:20 +0300 Subject: [PATCH 001/163] =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=20=D0=BA=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/Forum/ForumController.php | 41 ++++++++++++++++------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/app/Controllers/Forum/ForumController.php b/app/Controllers/Forum/ForumController.php index fe18e2fc8..fc3712848 100644 --- a/app/Controllers/Forum/ForumController.php +++ b/app/Controllers/Forum/ForumController.php @@ -17,8 +17,10 @@ class ForumController extends BaseController { /** * Главная страница + * + * @return string */ - public function index() + public function index(): string { $forums = Forum::query() ->where('parent_id', 0) @@ -36,8 +38,11 @@ public function index() /** * Страница списка тем + * + * @param int $id + * @return string */ - public function forum($id) + public function forum($id): string { $forum = Forum::query()->with('parent', 'children.lastTopic.lastPost.user')->find($id); @@ -63,8 +68,10 @@ public function forum($id) /** * Создание новой темы + * + * @return string */ - public function create() + public function create(): string { $fid = int(Request::input('fid')); @@ -196,8 +203,10 @@ public function create() /** * Поиск + * + * @return string */ - public function search() + public function search(): ?string { $fid = check(Request::input('fid')); $find = check(Request::input('find')); @@ -234,24 +243,24 @@ public function search() $arrfind = []; foreach ($findmewords as $val) { if (utfStrlen($val) >= 3) { - $arrfind[] = (empty($type)) ? '+' . $val . '*' : $val . '*'; + $arrfind[] = empty($type) ? '+' . $val . '*' : $val . '*'; } } - $findme = implode(" ", $arrfind); + $findme = implode(' ', $arrfind); - if ($type == 2 && count($findmewords) > 1) { + if ($type === 2 && count($findmewords) > 1) { $findme = "\"$find\""; } - $wheres = (empty($where)) ? 'topics' : 'posts'; + $wheres = empty($where) ? 'topics' : 'posts'; $forumfind = ($type . $wheres . $period . $section . $find); // Поиск в темах if ($wheres === 'topics') { - if (empty($_SESSION['forumfindres']) || $forumfind != $_SESSION['forumfind']) { + if (empty($_SESSION['forumfindres']) || $forumfind !== $_SESSION['forumfind']) { $searchsec = ($section > 0) ? 'forum_id = ' . $section . ' AND' : ''; $searchper = ($period > 0) ? 'updated_at > ' . strtotime('-' . $period . ' day', SITETIME) . ' AND' : ''; @@ -291,7 +300,7 @@ public function search() // Поиск в сообщениях if ($wheres === 'posts') { - if (empty($_SESSION['forumfindres']) || $forumfind != $_SESSION['forumfind']) { + if (empty($_SESSION['forumfindres']) || $forumfind !== $_SESSION['forumfind']) { $searchsec = ($section > 0) ? 'topics.forum_id = ' . $section . ' AND' : ''; $searchper = ($period > 0) ? 'posts.created_at > ' . strtotime('-' . $period . ' day', SITETIME) . ' AND' : ''; @@ -338,8 +347,10 @@ public function search() /** * RSS всех топиков + * + * @return string */ - public function rss() + public function rss(): string { $topics = Topic::query() ->where('closed', 0) @@ -378,8 +389,10 @@ public function rssPosts($id) /** * Последние темы + * + * @return string */ - public function topTopics() + public function topTopics(): string { $total = Topic::query()->count(); @@ -402,8 +415,10 @@ public function topTopics() /** * Последние сообщения + * + * @return string */ - public function topPosts() + public function topPosts(): string { $period = int(Request::input('period')); From 50383f885125f2786a8120266caa7170e0760b8f Mon Sep 17 00:00:00 2001 From: visavi Date: Wed, 8 Aug 2018 23:24:33 +0300 Subject: [PATCH 002/163] bugfix --- public/assets/js/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/assets/js/app.js b/public/assets/js/app.js index af7714494..3e0d8ada1 100644 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -97,7 +97,7 @@ function postReply(el) var post = $(el).closest('.post'); var author = post.find('.author').data('login'); - separ = field.val().length ? '\n' : ''; + var separ = field.val().length ? '\n' : ''; field.focus().val(field.val() + separ + '@' + author + ', '); return false; @@ -117,7 +117,7 @@ function postQuote(el) var text = post.find('.message').clone(); var message = text.find("blockquote").remove().end().text(); - separ = field.val().length ? '\n' : ''; + var separ = field.val().length ? '\n' : ''; field.focus().val(field.val() + separ + '[quote=@' + author + ' ' + date + ']' + $.trim(message) + '[/quote]\n'); return false; From da72fd01605b5ac38b74029aece8b1f1bed980a8 Mon Sep 17 00:00:00 2001 From: visavi Date: Tue, 21 Aug 2018 23:45:45 +0300 Subject: [PATCH 003/163] composer update --- composer.json | 6 +- composer.lock | 383 ++++++++++++++++++++++++++++---------------------- 2 files changed, 222 insertions(+), 167 deletions(-) diff --git a/composer.json b/composer.json index 4dea57023..a7a33c117 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,8 @@ "require-dev": { "filp/whoops": "^2.1", "phpunit/phpunit": "^7.0", - "php-coveralls/php-coveralls": "^2.0" + "php-coveralls/php-coveralls": "^2.0", + "facebook/xhprof": "dev-master" }, "scripts": { "post-create-project-cmd": [ @@ -60,5 +61,6 @@ "branch-alias": { "dev-master": "7.4-dev" } - } + }, + "minimum-stability": "dev" } diff --git a/composer.lock b/composer.lock index 227b095a9..6f0a23845 100644 --- a/composer.lock +++ b/composer.lock @@ -1,10 +1,10 @@ { "_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": "d3385872182ecbbec910b6a699695376", + "content-hash": "1deedbc38ef1ddb82c7a97f1018ded07", "packages": [ { "name": "alchemy/binary-driver", @@ -161,20 +161,20 @@ "detection", "user agent" ], - "time": "2017-07-31T23:43:17+00:00" + "time": "2017-07-31 23:43:17" }, { "name": "doctrine/cache", - "version": "v1.7.1", + "version": "v1.8.0", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "b3217d58609e9c8e661cd41357a54d926c4a2a1a" + "reference": "d768d58baee9a4862ca783840eca1b9add7a7f57" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/b3217d58609e9c8e661cd41357a54d926c4a2a1a", - "reference": "b3217d58609e9c8e661cd41357a54d926c4a2a1a", + "url": "https://api.github.com/repos/doctrine/cache/zipball/d768d58baee9a4862ca783840eca1b9add7a7f57", + "reference": "d768d58baee9a4862ca783840eca1b9add7a7f57", "shasum": "" }, "require": { @@ -185,8 +185,9 @@ }, "require-dev": { "alcaeus/mongo-php-adapter": "^1.1", + "doctrine/coding-standard": "^4.0", "mongodb/mongodb": "^1.1", - "phpunit/phpunit": "^5.7", + "phpunit/phpunit": "^7.0", "predis/predis": "~1.0" }, "suggest": { @@ -195,7 +196,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { @@ -230,12 +231,12 @@ } ], "description": "Caching library offering an object-oriented API for many cache backends", - "homepage": "http://www.doctrine-project.org", + "homepage": "https://www.doctrine-project.org", "keywords": [ "cache", "caching" ], - "time": "2017-08-25T07:02:50+00:00" + "time": "2018-08-21T18:01:43+00:00" }, { "name": "doctrine/inflector", @@ -409,16 +410,16 @@ }, { "name": "egulias/email-validator", - "version": "2.1.4", + "version": "2.1.5", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "8790f594151ca6a2010c6218e09d96df67173ad3" + "reference": "54859fabea8b3beecbb1a282888d5c990036b9e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/8790f594151ca6a2010c6218e09d96df67173ad3", - "reference": "8790f594151ca6a2010c6218e09d96df67173ad3", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/54859fabea8b3beecbb1a282888d5c990036b9e3", + "reference": "54859fabea8b3beecbb1a282888d5c990036b9e3", "shasum": "" }, "require": { @@ -462,7 +463,7 @@ "validation", "validator" ], - "time": "2018-04-10T10:11:19+00:00" + "time": "2018-08-16T20:49:45+00:00" }, { "name": "evenement/evenement", @@ -514,28 +515,30 @@ }, { "name": "google/recaptcha", - "version": "1.1.3", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/google/recaptcha.git", - "reference": "5a56d15ca10a7b75158178752b2ad8f755eb4f78" + "reference": "e7add3be59211482ecdb942288f52da64a35f61a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/google/recaptcha/zipball/5a56d15ca10a7b75158178752b2ad8f755eb4f78", - "reference": "5a56d15ca10a7b75158178752b2ad8f755eb4f78", + "url": "https://api.github.com/repos/google/recaptcha/zipball/e7add3be59211482ecdb942288f52da64a35f61a", + "reference": "e7add3be59211482ecdb942288f52da64a35f61a", "shasum": "" }, "require": { "php": ">=5.5" }, "require-dev": { - "phpunit/phpunit": "^4.8" + "friendsofphp/php-cs-fixer": "^2.2.20|^2.12", + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^4.8.36|^5.7.27|^6.59|^7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -547,35 +550,35 @@ "license": [ "BSD-3-Clause" ], - "description": "Client library for reCAPTCHA, a free service that protect websites from spam and abuse.", - "homepage": "http://www.google.com/recaptcha/", + "description": "Client library for reCAPTCHA, a free service that protects websites from spam and abuse.", + "homepage": "https://www.google.com/recaptcha/", "keywords": [ "Abuse", "captcha", "recaptcha", "spam" ], - "time": "2017-03-09T18:44:34+00:00" + "time": "2018-08-05T09:31:53+00:00" }, { "name": "gregwar/captcha", - "version": "v1.1.6", + "version": "v1.1.7", "source": { "type": "git", "url": "https://github.com/Gregwar/Captcha.git", - "reference": "a96d8dffc80d6213958bd19fbdef1555e8b63ca3" + "reference": "cf953dd79748406e0292cea8c565399681e4d345" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Gregwar/Captcha/zipball/a96d8dffc80d6213958bd19fbdef1555e8b63ca3", - "reference": "a96d8dffc80d6213958bd19fbdef1555e8b63ca3", + "url": "https://api.github.com/repos/Gregwar/Captcha/zipball/cf953dd79748406e0292cea8c565399681e4d345", + "reference": "cf953dd79748406e0292cea8c565399681e4d345", "shasum": "" }, "require": { "ext-gd": "*", "ext-mbstring": "*", "php": ">=5.3.0", - "symfony/finder": "~3.0|~4.0" + "symfony/finder": "*" }, "require-dev": { "phpunit/phpunit": "^6.4" @@ -608,7 +611,7 @@ "captcha", "spam" ], - "time": "2018-04-24T09:20:08+00:00" + "time": "2018-08-17T22:57:28+00:00" }, { "name": "guzzlehttp/psr7", @@ -677,7 +680,7 @@ }, { "name": "illuminate/container", - "version": "v5.6.29", + "version": "v5.6.34", "source": { "type": "git", "url": "https://github.com/illuminate/container.git", @@ -721,16 +724,16 @@ }, { "name": "illuminate/contracts", - "version": "v5.6.29", + "version": "v5.6.34", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "3dc639feabe0f302f574157a782ede323881a944" + "reference": "2c029101285f6066f45e3ae5910b1b5f900fdcb4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/3dc639feabe0f302f574157a782ede323881a944", - "reference": "3dc639feabe0f302f574157a782ede323881a944", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/2c029101285f6066f45e3ae5910b1b5f900fdcb4", + "reference": "2c029101285f6066f45e3ae5910b1b5f900fdcb4", "shasum": "" }, "require": { @@ -761,20 +764,20 @@ ], "description": "The Illuminate Contracts package.", "homepage": "https://laravel.com", - "time": "2018-05-11T23:38:58+00:00" + "time": "2018-07-31T12:49:53+00:00" }, { "name": "illuminate/database", - "version": "v5.6.29", + "version": "v5.6.34", "source": { "type": "git", "url": "https://github.com/illuminate/database.git", - "reference": "1f1f6382bbd7ee5181bfa950257bd14f451fc187" + "reference": "741a80e84cc68739d8995bd5cf16586b485974d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/database/zipball/1f1f6382bbd7ee5181bfa950257bd14f451fc187", - "reference": "1f1f6382bbd7ee5181bfa950257bd14f451fc187", + "url": "https://api.github.com/repos/illuminate/database/zipball/741a80e84cc68739d8995bd5cf16586b485974d0", + "reference": "741a80e84cc68739d8995bd5cf16586b485974d0", "shasum": "" }, "require": { @@ -820,11 +823,11 @@ "orm", "sql" ], - "time": "2018-07-23T13:56:09+00:00" + "time": "2018-08-21T13:34:21+00:00" }, { "name": "illuminate/events", - "version": "v5.6.29", + "version": "v5.6.34", "source": { "type": "git", "url": "https://github.com/illuminate/events.git", @@ -869,16 +872,16 @@ }, { "name": "illuminate/filesystem", - "version": "v5.6.29", + "version": "v5.6.34", "source": { "type": "git", "url": "https://github.com/illuminate/filesystem.git", - "reference": "2677365f61c66fad13ff12a37cd4fa8aaeb048d2" + "reference": "569904131813e4ac7051ae00bc1834063da562a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/filesystem/zipball/2677365f61c66fad13ff12a37cd4fa8aaeb048d2", - "reference": "2677365f61c66fad13ff12a37cd4fa8aaeb048d2", + "url": "https://api.github.com/repos/illuminate/filesystem/zipball/569904131813e4ac7051ae00bc1834063da562a6", + "reference": "569904131813e4ac7051ae00bc1834063da562a6", "shasum": "" }, "require": { @@ -917,20 +920,20 @@ ], "description": "The Illuminate Filesystem package.", "homepage": "https://laravel.com", - "time": "2018-07-07T14:54:27+00:00" + "time": "2018-08-13T14:51:11+00:00" }, { "name": "illuminate/http", - "version": "v5.6.29", + "version": "v5.6.34", "source": { "type": "git", "url": "https://github.com/illuminate/http.git", - "reference": "cbe4b89ac470313fe9ddad547f0accd9f01893bc" + "reference": "2fca05297d519284f2b472e272571d987c2750b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/http/zipball/cbe4b89ac470313fe9ddad547f0accd9f01893bc", - "reference": "cbe4b89ac470313fe9ddad547f0accd9f01893bc", + "url": "https://api.github.com/repos/illuminate/http/zipball/2fca05297d519284f2b472e272571d987c2750b4", + "reference": "2fca05297d519284f2b472e272571d987c2750b4", "shasum": "" }, "require": { @@ -963,20 +966,20 @@ ], "description": "The Illuminate Http package.", "homepage": "https://laravel.com", - "time": "2018-07-19T01:29:53+00:00" + "time": "2018-08-15T13:07:48+00:00" }, { "name": "illuminate/session", - "version": "v5.6.29", + "version": "v5.6.34", "source": { "type": "git", "url": "https://github.com/illuminate/session.git", - "reference": "90bb5857fb64e269d8d331f02f820555ee471f64" + "reference": "55b140532c12b6190177eb47d86a1369f6c5bd33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/session/zipball/90bb5857fb64e269d8d331f02f820555ee471f64", - "reference": "90bb5857fb64e269d8d331f02f820555ee471f64", + "url": "https://api.github.com/repos/illuminate/session/zipball/55b140532c12b6190177eb47d86a1369f6c5bd33", + "reference": "55b140532c12b6190177eb47d86a1369f6c5bd33", "shasum": "" }, "require": { @@ -1013,20 +1016,20 @@ ], "description": "The Illuminate Session package.", "homepage": "https://laravel.com", - "time": "2018-03-06T14:29:02+00:00" + "time": "2018-07-30T13:38:17+00:00" }, { "name": "illuminate/support", - "version": "v5.6.29", + "version": "v5.6.34", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "c684cb5e77e213020f7a4ed213d94b2b384c2951" + "reference": "4eb12aa00bbf2d5e73c355ad404a9d0679879094" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/c684cb5e77e213020f7a4ed213d94b2b384c2951", - "reference": "c684cb5e77e213020f7a4ed213d94b2b384c2951", + "url": "https://api.github.com/repos/illuminate/support/zipball/4eb12aa00bbf2d5e73c355ad404a9d0679879094", + "reference": "4eb12aa00bbf2d5e73c355ad404a9d0679879094", "shasum": "" }, "require": { @@ -1071,11 +1074,11 @@ ], "description": "The Illuminate Support package.", "homepage": "https://laravel.com", - "time": "2018-07-26T15:32:11+00:00" + "time": "2018-08-15T21:02:31+00:00" }, { "name": "illuminate/translation", - "version": "v5.6.29", + "version": "v5.6.34", "source": { "type": "git", "url": "https://github.com/illuminate/translation.git", @@ -1120,7 +1123,7 @@ }, { "name": "illuminate/view", - "version": "v5.6.29", + "version": "v5.6.33", "source": { "type": "git", "url": "https://github.com/illuminate/view.git", @@ -1473,16 +1476,16 @@ }, { "name": "nesbot/carbon", - "version": "1.32.0", + "version": "1.33.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "64563e2b9f69e4db1b82a60e81efa327a30ff343" + "reference": "55667c1007a99e82030874b1bb14d24d07108413" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/64563e2b9f69e4db1b82a60e81efa327a30ff343", - "reference": "64563e2b9f69e4db1b82a60e81efa327a30ff343", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/55667c1007a99e82030874b1bb14d24d07108413", + "reference": "55667c1007a99e82030874b1bb14d24d07108413", "shasum": "" }, "require": { @@ -1524,7 +1527,7 @@ "datetime", "time" ], - "time": "2018-07-05T06:59:26+00:00" + "time": "2018-08-07T08:39:47+00:00" }, { "name": "neutron/temporary-filesystem", @@ -1568,16 +1571,16 @@ }, { "name": "php-curl-class/php-curl-class", - "version": "8.1.0", + "version": "8.3.0", "source": { "type": "git", "url": "https://github.com/php-curl-class/php-curl-class.git", - "reference": "0090c30b4348028cabf1d03427423460ca7dc4a4" + "reference": "b5d9ec2120e4b27e4b2ec72fa9a302aa4e337fdf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-curl-class/php-curl-class/zipball/0090c30b4348028cabf1d03427423460ca7dc4a4", - "reference": "0090c30b4348028cabf1d03427423460ca7dc4a4", + "url": "https://api.github.com/repos/php-curl-class/php-curl-class/zipball/b5d9ec2120e4b27e4b2ec72fa9a302aa4e337fdf", + "reference": "b5d9ec2120e4b27e4b2ec72fa9a302aa4e337fdf", "shasum": "" }, "require": { @@ -1608,22 +1611,28 @@ "description": "PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs.", "homepage": "https://github.com/php-curl-class/php-curl-class", "keywords": [ + "API-Client", "api", "class", "client", "curl", "framework", "http", - "http client", + "http-client", + "http-proxy", "json", "php", + "php-curl", + "php-curl-library", + "proxy", "requests", - "rest", "restful", - "web service", + "web-scraper", + "web-scraping ", + "web-service", "xml" ], - "time": "2018-06-06T05:01:44+00:00" + "time": "2018-08-18T18:02:12+00:00" }, { "name": "php-ffmpeg/php-ffmpeg", @@ -2035,16 +2044,16 @@ }, { "name": "symfony/config", - "version": "v4.1.2", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "e57e7b573df9d0eaa8c0152768c708ee7ea2b8e5" + "reference": "c868972ac26e4e19860ce11b300bb74145246ff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/e57e7b573df9d0eaa8c0152768c708ee7ea2b8e5", - "reference": "e57e7b573df9d0eaa8c0152768c708ee7ea2b8e5", + "url": "https://api.github.com/repos/symfony/config/zipball/c868972ac26e4e19860ce11b300bb74145246ff9", + "reference": "c868972ac26e4e19860ce11b300bb74145246ff9", "shasum": "" }, "require": { @@ -2094,20 +2103,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2018-06-20T11:15:17+00:00" + "time": "2018-07-26T11:24:31+00:00" }, { "name": "symfony/console", - "version": "v4.1.2", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "5c31f6a97c1c240707f6d786e7e59bfacdbc0219" + "reference": "ca80b8ced97cf07390078b29773dc384c39eee1f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/5c31f6a97c1c240707f6d786e7e59bfacdbc0219", - "reference": "5c31f6a97c1c240707f6d786e7e59bfacdbc0219", + "url": "https://api.github.com/repos/symfony/console/zipball/ca80b8ced97cf07390078b29773dc384c39eee1f", + "reference": "ca80b8ced97cf07390078b29773dc384c39eee1f", "shasum": "" }, "require": { @@ -2162,20 +2171,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-07-16T14:05:40+00:00" + "time": "2018-07-26T11:24:31+00:00" }, { "name": "symfony/debug", - "version": "v4.1.2", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "a1f2118cedb8731c45e945cdd2b808ca82abc4b5" + "reference": "9316545571f079c4dd183e674721d9dc783ce196" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/a1f2118cedb8731c45e945cdd2b808ca82abc4b5", - "reference": "a1f2118cedb8731c45e945cdd2b808ca82abc4b5", + "url": "https://api.github.com/repos/symfony/debug/zipball/9316545571f079c4dd183e674721d9dc783ce196", + "reference": "9316545571f079c4dd183e674721d9dc783ce196", "shasum": "" }, "require": { @@ -2218,20 +2227,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-07-06T14:52:28+00:00" + "time": "2018-07-26T11:24:31+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.1.2", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "00d64638e4f0703a00ab7fc2c8ae5f75f3b4020f" + "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/00d64638e4f0703a00ab7fc2c8ae5f75f3b4020f", - "reference": "00d64638e4f0703a00ab7fc2c8ae5f75f3b4020f", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/bfb30c2ad377615a463ebbc875eba64a99f6aa3e", + "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e", "shasum": "" }, "require": { @@ -2281,20 +2290,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2018-07-10T11:02:47+00:00" + "time": "2018-07-26T09:10:45+00:00" }, { "name": "symfony/filesystem", - "version": "v4.1.2", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "562bf7005b55fd80d26b582d28e3e10f2dd5ae9c" + "reference": "2e30335e0aafeaa86645555959572fe7cea22b43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/562bf7005b55fd80d26b582d28e3e10f2dd5ae9c", - "reference": "562bf7005b55fd80d26b582d28e3e10f2dd5ae9c", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/2e30335e0aafeaa86645555959572fe7cea22b43", + "reference": "2e30335e0aafeaa86645555959572fe7cea22b43", "shasum": "" }, "require": { @@ -2331,20 +2340,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2018-05-30T07:26:09+00:00" + "time": "2018-07-26T11:24:31+00:00" }, { "name": "symfony/finder", - "version": "v4.1.2", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "84714b8417d19e4ba02ea78a41a975b3efaafddb" + "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/84714b8417d19e4ba02ea78a41a975b3efaafddb", - "reference": "84714b8417d19e4ba02ea78a41a975b3efaafddb", + "url": "https://api.github.com/repos/symfony/finder/zipball/e162f1df3102d0b7472805a5a9d5db9fcf0a8068", + "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068", "shasum": "" }, "require": { @@ -2380,20 +2389,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-06-19T21:38:16+00:00" + "time": "2018-07-26T11:24:31+00:00" }, { "name": "symfony/http-foundation", - "version": "v4.1.2", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "8da9ea68ab2d80dfabd41e0d14b9606bb47a10c0" + "reference": "7d93e3547660ec7ee3dad1428ba42e8076a0e5f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/8da9ea68ab2d80dfabd41e0d14b9606bb47a10c0", - "reference": "8da9ea68ab2d80dfabd41e0d14b9606bb47a10c0", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/7d93e3547660ec7ee3dad1428ba42e8076a0e5f1", + "reference": "7d93e3547660ec7ee3dad1428ba42e8076a0e5f1", "shasum": "" }, "require": { @@ -2434,20 +2443,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2018-07-16T14:05:40+00:00" + "time": "2018-08-01T14:07:44+00:00" }, { "name": "symfony/http-kernel", - "version": "v4.1.2", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "ebd28f4f88a2ca0a0488882ad73c4004f3afdbe3" + "reference": "6347be5110efb27fe45ea04bf213078b67a05036" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/ebd28f4f88a2ca0a0488882ad73c4004f3afdbe3", - "reference": "ebd28f4f88a2ca0a0488882ad73c4004f3afdbe3", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/6347be5110efb27fe45ea04bf213078b67a05036", + "reference": "6347be5110efb27fe45ea04bf213078b67a05036", "shasum": "" }, "require": { @@ -2521,29 +2530,32 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2018-07-23T17:16:22+00:00" + "time": "2018-08-01T15:30:34+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae" + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "suggest": { + "ext-ctype": "For best performance" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -2576,20 +2588,20 @@ "polyfill", "portable" ], - "time": "2018-04-30T19:57:29+00:00" + "time": "2018-08-06T14:22:27+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "3296adf6a6454a050679cde90f95350ad604b171" + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", - "reference": "3296adf6a6454a050679cde90f95350ad604b171", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", "shasum": "" }, "require": { @@ -2601,7 +2613,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -2635,20 +2647,20 @@ "portable", "shim" ], - "time": "2018-04-26T10:06:28+00:00" + "time": "2018-08-06T14:22:27+00:00" }, { "name": "symfony/process", - "version": "v3.4.13", + "version": "v3.4.14", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "f741672edfcfe3a2ea77569d419006f23281d909" + "reference": "0414db29bd770ec5a4152683e655f55efd4fa60f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/f741672edfcfe3a2ea77569d419006f23281d909", - "reference": "f741672edfcfe3a2ea77569d419006f23281d909", + "url": "https://api.github.com/repos/symfony/process/zipball/0414db29bd770ec5a4152683e655f55efd4fa60f", + "reference": "0414db29bd770ec5a4152683e655f55efd4fa60f", "shasum": "" }, "require": { @@ -2684,20 +2696,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-07-09T09:01:07+00:00" + "time": "2018-07-26T11:19:56+00:00" }, { "name": "symfony/translation", - "version": "v4.1.2", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "2dd74d6b2dcbd46a93971e6ce7d245cf3123e957" + "reference": "6fcd1bd44fd6d7181e6ea57a6f4e08a09b29ef65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/2dd74d6b2dcbd46a93971e6ce7d245cf3123e957", - "reference": "2dd74d6b2dcbd46a93971e6ce7d245cf3123e957", + "url": "https://api.github.com/repos/symfony/translation/zipball/6fcd1bd44fd6d7181e6ea57a6f4e08a09b29ef65", + "reference": "6fcd1bd44fd6d7181e6ea57a6f4e08a09b29ef65", "shasum": "" }, "require": { @@ -2753,20 +2765,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2018-07-23T08:20:20+00:00" + "time": "2018-07-26T11:24:31+00:00" }, { "name": "symfony/yaml", - "version": "v4.1.2", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "80e4bfa9685fc4a09acc4a857ec16974a9cd944e" + "reference": "46bc69aa91fc4ab78a96ce67873a6b0c148fd48c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/80e4bfa9685fc4a09acc4a857ec16974a9cd944e", - "reference": "80e4bfa9685fc4a09acc4a857ec16974a9cd944e", + "url": "https://api.github.com/repos/symfony/yaml/zipball/46bc69aa91fc4ab78a96ce67873a6b0c148fd48c", + "reference": "46bc69aa91fc4ab78a96ce67873a6b0c148fd48c", "shasum": "" }, "require": { @@ -2812,7 +2824,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-05-30T07:26:09+00:00" + "time": "2018-07-26T11:24:31+00:00" }, { "name": "visavi/cleanup", @@ -3010,6 +3022,46 @@ ], "time": "2017-07-22T11:58:36+00:00" }, + { + "name": "facebook/xhprof", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/lox/xhprof.git", + "reference": "d9bfac3d543e017eff1351d2bd795240d747a079" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lox/xhprof/zipball/d9bfac3d543e017eff1351d2bd795240d747a079", + "reference": "d9bfac3d543e017eff1351d2bd795240d747a079", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "bin": [ + "bin/xhprofile" + ], + "type": "library", + "autoload": { + "files": [ + "xhprof_lib/utils/xhprof_lib.php", + "xhprof_lib/utils/xhprof_runs.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "XHProf: A Hierarchical Profiler for PHP", + "homepage": "http://pecl.php.net/package/xhprof", + "keywords": [ + "performance", + "profiling" + ], + "abandoned": "lox/xhprof", + "time": "2015-08-23T09:14:39+00:00" + }, { "name": "filp/whoops", "version": "2.2.0", @@ -3574,16 +3626,16 @@ }, { "name": "phpspec/prophecy", - "version": "1.7.6", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", "shasum": "" }, "require": { @@ -3595,12 +3647,12 @@ }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { @@ -3633,7 +3685,7 @@ "spy", "stub" ], - "time": "2018-04-18T13:57:24+00:00" + "time": "2018-08-05T17:53:17+00:00" }, { "name": "phpunit/php-code-coverage", @@ -3886,16 +3938,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.2.7", + "version": "7.3.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "8e878aff7917ef66e702e03d1359b16eee254e2c" + "reference": "f9b14c17860eccb440a0352a117a81eb754cff5a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8e878aff7917ef66e702e03d1359b16eee254e2c", - "reference": "8e878aff7917ef66e702e03d1359b16eee254e2c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f9b14c17860eccb440a0352a117a81eb754cff5a", + "reference": "f9b14c17860eccb440a0352a117a81eb754cff5a", "shasum": "" }, "require": { @@ -3940,7 +3992,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.2-dev" + "dev-master": "7.3-dev" } }, "autoload": { @@ -3966,7 +4018,7 @@ "testing", "xunit" ], - "time": "2018-07-15T05:20:50+00:00" + "time": "2018-08-07T06:44:28+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -4533,16 +4585,16 @@ }, { "name": "symfony/stopwatch", - "version": "v4.1.2", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "07463bbbbbfe119045a24c4a516f92ebd2752784" + "reference": "966c982df3cca41324253dc0c7ffe76b6076b705" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/07463bbbbbfe119045a24c4a516f92ebd2752784", - "reference": "07463bbbbbfe119045a24c4a516f92ebd2752784", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/966c982df3cca41324253dc0c7ffe76b6076b705", + "reference": "966c982df3cca41324253dc0c7ffe76b6076b705", "shasum": "" }, "require": { @@ -4578,7 +4630,7 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2018-02-19T16:51:42+00:00" + "time": "2018-07-26T11:00:49+00:00" }, { "name": "theseer/tokenizer", @@ -4672,9 +4724,10 @@ } ], "aliases": [], - "minimum-stability": "stable", + "minimum-stability": "dev", "stability-flags": { - "cbschuld/browser.php": 20 + "cbschuld/browser.php": 20, + "facebook/xhprof": 20 }, "prefer-stable": false, "prefer-lowest": false, From 98e582479c544d04441bca8c79e10dabf7e55d98 Mon Sep 17 00:00:00 2001 From: visavi Date: Wed, 22 Aug 2018 14:51:57 +0300 Subject: [PATCH 004/163] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8?= =?UTF-8?q?=D0=B7=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BB=20=D0=BE=D0=B1=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA=D1=83=D1=80?= =?UTF-8?q?=D1=81=D0=B0=20=D0=B2=D0=B0=D0=BB=D1=8E=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/BaseController.php | 5 +-- app/Controllers/BlogController.php | 28 ++++++------ app/helpers.php | 22 ++++------ composer.json | 6 +-- composer.lock | 61 +++++--------------------- resources/views/app/_courses.blade.php | 8 ++-- 6 files changed, 40 insertions(+), 90 deletions(-) diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 422c7b500..d8ce399bb 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -62,12 +62,11 @@ public function __construct() // ----------------------- Автоматическая блокировка ------------------------// if (counterString(STORAGE.'/antidos/'.getIp().'.dat') > setting('doslimit')) { - if (!empty(setting('errorlog'))){ + if (!empty(setting('errorlog'))) { $banip = Ban::query()->where('ip', getIp())->first(); if (! $banip) { - Error::query()->create([ 'code' => 666, 'request' => utfSubstr(server('REQUEST_URI'), 0, 200), @@ -80,7 +79,7 @@ public function __construct() ]); DB::insert( - "insert ignore into ban (`ip`, `created_at`) values (?, ?);", + 'insert ignore into ban (`ip`, `created_at`) values (?, ?);', [getIp(), SITETIME] ); diff --git a/app/Controllers/BlogController.php b/app/Controllers/BlogController.php index a8e615c8a..cb4092b66 100644 --- a/app/Controllers/BlogController.php +++ b/app/Controllers/BlogController.php @@ -114,7 +114,7 @@ public function view($id) $tags = ''; foreach ($tagsList as $key => $value) { - $comma = (empty($key)) ? '' : ', '; + $comma = empty($key) ? '' : ', '; $tags .= $comma . '' . $value . ''; } @@ -511,7 +511,7 @@ public function tags($tag = null) if ($tag) { $tag = urldecode($tag); - if (! isUtf($tag)){ + if (! isUtf($tag)) { $tag = winToUtf($tag); } @@ -523,7 +523,7 @@ public function tags($tag = null) if ( empty($_SESSION['findresult']) || empty($_SESSION['blogfind']) || - $tag != $_SESSION['blogfind'] + $tag !== $_SESSION['blogfind'] ) { $result = Blog::query() ->select('id') @@ -553,7 +553,7 @@ public function tags($tag = null) } - if (@filemtime(STORAGE."/temp/tagcloud.dat") < time() - 3600) { + if (@filemtime(STORAGE . '/temp/tagcloud.dat') < time() - 3600) { $allTags = Blog::query() ->select('tags') @@ -568,7 +568,7 @@ public function tags($tag = null) array_splice($allTags, 100); shuffleAssoc($allTags); - file_put_contents(STORAGE."/temp/tagcloud.dat", json_encode($allTags, JSON_UNESCAPED_UNICODE), LOCK_EX); + file_put_contents(STORAGE . '/temp/tagcloud.dat', json_encode($allTags, JSON_UNESCAPED_UNICODE), LOCK_EX); } $tags = json_decode(file_get_contents(STORAGE.'/temp/tagcloud.dat'), true); $max = max($tags); @@ -757,7 +757,7 @@ public function search() if (utfStrlen($find) >= 3 && utfStrlen($find) <= 50) { $findme = utfLower($find); - $findmewords = explode(" ", $findme); + $findmewords = explode(' ', $findme); $arrfind = []; foreach ($findmewords as $valfind) { @@ -767,8 +767,8 @@ public function search() } array_splice($arrfind, 3); - $types = (empty($type)) ? 'AND' : 'OR'; - $wheres = (empty($where)) ? 'title' : 'text'; + $types = empty($type) ? 'AND' : 'OR'; + $wheres = empty($where) ? 'title' : 'text'; $blogfind = ($types . $wheres . $find); @@ -778,10 +778,10 @@ public function search() if ($type === 2) { $arrfind[0] = $findme; } - $search1 = (isset($arrfind[1]) && $type != 2) ? $types . " `title` LIKE '%" . $arrfind[1] . "%'" : ''; - $search2 = (isset($arrfind[2]) && $type != 2) ? $types . " `title` LIKE '%" . $arrfind[2] . "%'" : ''; + $search1 = isset($arrfind[1]) && $type !== 2 ? $types . " `title` LIKE '%" . $arrfind[1] . "%'" : ''; + $search2 = isset($arrfind[2]) && $type !== 2 ? $types . " `title` LIKE '%" . $arrfind[2] . "%'" : ''; - if (empty($_SESSION['blogfindres']) || $blogfind != $_SESSION['blogfind']) { + if (empty($_SESSION['blogfindres']) || $blogfind !== $_SESSION['blogfind']) { $result = Blog::query() ->select('id') @@ -821,10 +821,10 @@ public function search() if ($type === 2) { $arrfind[0] = $findme; } - $search1 = (isset($arrfind[1]) && $type != 2) ? $types . " `text` LIKE '%" . $arrfind[1] . "%'" : ''; - $search2 = (isset($arrfind[2]) && $type != 2) ? $types . " `text` LIKE '%" . $arrfind[2] . "%'" : ''; + $search1 = isset($arrfind[1]) && $type !== 2 ? $types . " `text` LIKE '%" . $arrfind[1] . "%'" : ''; + $search2 = isset($arrfind[2]) && $type !== 2 ? $types . " `text` LIKE '%" . $arrfind[2] . "%'" : ''; - if (empty($_SESSION['blogfindres']) || $blogfind != $_SESSION['blogfind']) { + if (empty($_SESSION['blogfindres']) || $blogfind !== $_SESSION['blogfind']) { $result = Blog::query() ->select('id') diff --git a/app/helpers.php b/app/helpers.php index 5b8a03447..edfe028de 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -412,8 +412,10 @@ function showCounter() $metrika = new Metrika(); $metrika->saveStatistic(); + $count = statsCounter(); + if (setting('incount') > 0) { - return view('app/_counter', ['count' => statsCounter()]); + return view('app/_counter', compact('count')); } return null; @@ -2320,20 +2322,12 @@ function getCourses() @filemtime(STORAGE . '/temp/courses.dat') < time() - 3600 ) { $curl = new Curl(); - if ($xml = $curl->get('http://www.cbr.ru/scripts/XML_daily.asp')){ - - $courses = []; - $courses['Date'] = (string) $xml->attributes()->Date; + $curl->setConnectTimeout(3); - foreach ($xml->Valute as $item) { - $courses[(string) $item->CharCode] = [ - 'name' => (string) $item->Name, - 'value' => (string) $item->Value, - 'nominal' => (string) $item->Nominal, - ]; - } - - file_put_contents(STORAGE . '/temp/courses.dat', json_encode($courses), LOCK_EX); + if ($query = $curl->get('https://www.cbr-xml-daily.ru/daily_json.js')) { + file_put_contents(STORAGE . '/temp/courses.dat', $query, LOCK_EX); + } else { + touch(STORAGE . '/temp/courses.dat', SITETIME); } } diff --git a/composer.json b/composer.json index a7a33c117..4dea57023 100644 --- a/composer.json +++ b/composer.json @@ -38,8 +38,7 @@ "require-dev": { "filp/whoops": "^2.1", "phpunit/phpunit": "^7.0", - "php-coveralls/php-coveralls": "^2.0", - "facebook/xhprof": "dev-master" + "php-coveralls/php-coveralls": "^2.0" }, "scripts": { "post-create-project-cmd": [ @@ -61,6 +60,5 @@ "branch-alias": { "dev-master": "7.4-dev" } - }, - "minimum-stability": "dev" + } } diff --git a/composer.lock b/composer.lock index 6f0a23845..7eadaf58a 100644 --- a/composer.lock +++ b/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1deedbc38ef1ddb82c7a97f1018ded07", + "content-hash": "f940bf2df42af36f47861e38b253503b", "packages": [ { "name": "alchemy/binary-driver", @@ -161,7 +161,7 @@ "detection", "user agent" ], - "time": "2017-07-31 23:43:17" + "time": "2017-07-31T23:43:17+00:00" }, { "name": "doctrine/cache", @@ -3022,46 +3022,6 @@ ], "time": "2017-07-22T11:58:36+00:00" }, - { - "name": "facebook/xhprof", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/lox/xhprof.git", - "reference": "d9bfac3d543e017eff1351d2bd795240d747a079" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/lox/xhprof/zipball/d9bfac3d543e017eff1351d2bd795240d747a079", - "reference": "d9bfac3d543e017eff1351d2bd795240d747a079", - "shasum": "" - }, - "require": { - "php": ">=5.2.0" - }, - "bin": [ - "bin/xhprofile" - ], - "type": "library", - "autoload": { - "files": [ - "xhprof_lib/utils/xhprof_lib.php", - "xhprof_lib/utils/xhprof_runs.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "XHProf: A Hierarchical Profiler for PHP", - "homepage": "http://pecl.php.net/package/xhprof", - "keywords": [ - "performance", - "profiling" - ], - "abandoned": "lox/xhprof", - "time": "2015-08-23T09:14:39+00:00" - }, { "name": "filp/whoops", "version": "2.2.0", @@ -3938,16 +3898,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.3.1", + "version": "7.3.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f9b14c17860eccb440a0352a117a81eb754cff5a" + "reference": "34705f81bddc3f505b9599a2ef96e2b4315ba9b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f9b14c17860eccb440a0352a117a81eb754cff5a", - "reference": "f9b14c17860eccb440a0352a117a81eb754cff5a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/34705f81bddc3f505b9599a2ef96e2b4315ba9b8", + "reference": "34705f81bddc3f505b9599a2ef96e2b4315ba9b8", "shasum": "" }, "require": { @@ -4018,7 +3978,7 @@ "testing", "xunit" ], - "time": "2018-08-07T06:44:28+00:00" + "time": "2018-08-22T06:39:21+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -4724,10 +4684,9 @@ } ], "aliases": [], - "minimum-stability": "dev", + "minimum-stability": "stable", "stability-flags": { - "cbschuld/browser.php": 20, - "facebook/xhprof": 20 + "cbschuld/browser.php": 20 }, "prefer-stable": false, "prefer-lowest": false, diff --git a/resources/views/app/_courses.blade.php b/resources/views/app/_courses.blade.php index 428a4786c..6a7d54423 100644 --- a/resources/views/app/_courses.blade.php +++ b/resources/views/app/_courses.blade.php @@ -1,9 +1,9 @@ @if ($courses) - Курсы валют ({{ $courses->Date }})
- {{ $courses->USD->nominal }} {{ $courses->USD->name }} - {{ $courses->USD->value }}
- {{ $courses->EUR->nominal }} {{ $courses->EUR->name }} - {{ $courses->EUR->value }}
- {{ $courses->UAH->nominal }} {{ $courses->UAH->name }} - {{ $courses->UAH->value }}
+ Курсы валют ({{ date('d.m.Y', strtotime($courses->Date)) }})
+ {{ $courses->Valute->USD->Nominal }} {{ $courses->Valute->USD->Name }} - {{ $courses->Valute->USD->Value }}
+ {{ $courses->Valute->EUR->Nominal }} {{ $courses->Valute->EUR->Name }} - {{ $courses->Valute->EUR->Value }}
+ {{ $courses->Valute->UAH->Nominal }} {{ $courses->Valute->UAH->Name }} - {{ $courses->Valute->UAH->Value }}
@else {!! showError('Ошибка! Не удалось загрузить последние курсы валют!') !!} From a8e5164e58fe254a96ba129821cd47d0cd8ca3be Mon Sep 17 00:00:00 2001 From: visavi Date: Wed, 22 Aug 2018 15:30:07 +0300 Subject: [PATCH 005/163] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B5=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/User/UserController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Controllers/User/UserController.php b/app/Controllers/User/UserController.php index 2b7b5d182..c086ed3ce 100644 --- a/app/Controllers/User/UserController.php +++ b/app/Controllers/User/UserController.php @@ -406,8 +406,8 @@ public function setting(): string $themes = check(Request::input('themes')); $timezone = check(Request::input('timezone', 0)); $language = check(Request::input('language')); - $notify = Request::input('notify') === 1 ? 1 : 0; - $subscribe = Request::input('subscribe') === 1 ? str_random(32) : null; + $notify = Request::input('notify') ? 1 : 0; + $subscribe = Request::input('subscribe') ? str_random(32) : null; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') From 5c8343d244bff52f77ad4db1801ee3db963e9ae8 Mon Sep 17 00:00:00 2001 From: visavi Date: Thu, 23 Aug 2018 11:54:19 +0300 Subject: [PATCH 006/163] =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=20=D0=BA=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/Admin/UserController.php | 19 +++++++++++---- app/Controllers/User/UserController.php | 31 +++++++++++++++++++++++- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/app/Controllers/Admin/UserController.php b/app/Controllers/Admin/UserController.php index 823688a74..5dc128a7e 100644 --- a/app/Controllers/Admin/UserController.php +++ b/app/Controllers/Admin/UserController.php @@ -28,8 +28,10 @@ public function __construct() /** * Главная страница + * + * @return string */ - public function index() + public function index(): string { $total = User::query()->count(); $page = paginate(setting('userlist'), $total); @@ -45,8 +47,10 @@ public function index() /** * Поиск пользователей + * + * @return string */ - public function search() + public function search(): string { $q = check(Request::input('q')); @@ -67,8 +71,10 @@ public function search() /** * Редактирование пользователя + * + * @return string */ - public function edit() + public function edit(): string { $login = check(Request::input('user')); @@ -78,7 +84,7 @@ public function edit() abort(404, 'Пользователь не найден!'); } - $allThemes = array_map('basename', glob(HOME."/themes/*", GLOB_ONLYDIR)); + $allThemes = array_map('basename', glob(HOME . '/themes/*', GLOB_ONLYDIR)); $adminGroups = User::ADMIN_GROUPS; $allGroups = []; @@ -183,8 +189,11 @@ public function edit() /** * Удаление пользователя + * + * @return string + * @throws \Exception */ - public function delete() + public function delete(): string { $login = check(Request::input('user')); diff --git a/app/Controllers/User/UserController.php b/app/Controllers/User/UserController.php index c086ed3ce..eba9060f5 100644 --- a/app/Controllers/User/UserController.php +++ b/app/Controllers/User/UserController.php @@ -10,6 +10,8 @@ use App\Models\Invite; use App\Models\Online; use App\Models\User; +use ErrorException; +use Exception; use Illuminate\Database\Capsule\Manager as DB; class UserController extends BaseController @@ -81,6 +83,9 @@ public function note($login): string /** * Регистрация + * + * @return string + * @throws ErrorException */ public function register(): string { @@ -229,6 +234,9 @@ public function register(): string /** * Авторизация + * + * @return string + * @throws ErrorException */ public function login(): string { @@ -268,6 +276,8 @@ public function login(): string /** * Выход + * + * @return void */ public function logout(): void { @@ -288,6 +298,8 @@ public function logout(): void /** * Редактирование профиля + * + * @return string */ public function profile(): string { @@ -351,6 +363,8 @@ public function profile(): string /* * Подтверждение регистрации + * + * @return string */ public function key(): string { @@ -389,6 +403,8 @@ public function key(): string /* * Настройки + * + * @return string */ public function setting(): string { @@ -440,6 +456,8 @@ public function setting(): string /** * Данные пользователя + * + * @return string */ public function account(): string { @@ -509,6 +527,9 @@ public function changeMail(): void /** * Изменение email + * + * @return void + * @throws Exception */ public function editMail(): void { @@ -554,6 +575,8 @@ public function editMail(): void /** * Изменение статуса + * + * @return void */ public function editStatus(): void { @@ -597,6 +620,8 @@ public function editStatus(): void /** * Изменение пароля + * + * @return void */ public function editPassword(): void { @@ -645,6 +670,8 @@ public function editPassword(): void /** * Генерация ключа + * + * @return void */ public function apikey(): void { @@ -654,7 +681,7 @@ public function apikey(): void $token = check(Request::input('token')); - if ($token == $_SESSION['token']) { + if ($token === $_SESSION['token']) { $user->update([ 'apikey' => md5(getUser('login').str_random()), @@ -670,6 +697,8 @@ public function apikey(): void /** * Пользователи онлайн + * + * @return string */ public function who(): string { From d32b82e6817728934641552ae14b6b906106e96b Mon Sep 17 00:00:00 2001 From: visavi Date: Fri, 24 Aug 2018 23:16:37 +0300 Subject: [PATCH 007/163] code optimization --- app/Classes/Application.php | 6 +- app/Classes/BBCode.php | 4 +- app/Classes/Validator.php | 66 +++++++-------- app/Controllers/Admin/BackupController.php | 2 +- app/Controllers/Admin/BanController.php | 4 +- app/Controllers/Admin/BlacklistController.php | 2 +- app/Controllers/Admin/CacheController.php | 8 +- app/Controllers/Admin/CheckerController.php | 33 +++++--- app/Controllers/Admin/LoadController.php | 2 +- app/Controllers/Admin/SettingController.php | 2 +- app/Controllers/Admin/SpamController.php | 2 +- app/Controllers/Admin/UserController.php | 2 +- app/Controllers/Admin/VoteController.php | 2 +- app/Controllers/AjaxController.php | 8 +- app/Controllers/BaseController.php | 80 +++++++++---------- app/Controllers/BlogController.php | 12 +-- app/Controllers/Forum/ForumController.php | 8 +- app/Controllers/Forum/TopicController.php | 8 +- app/Controllers/Load/DownController.php | 10 +-- app/Controllers/Load/SearchController.php | 14 ++-- app/Controllers/OfferController.php | 2 +- app/Controllers/User/UserController.php | 2 +- app/Controllers/VoteController.php | 2 +- app/Models/BaseModel.php | 2 +- app/Models/File.php | 2 +- .../views/admin/backups/create.blade.php | 2 +- resources/views/admin/users/edit.blade.php | 2 +- resources/views/app/_calendar.blade.php | 2 +- resources/views/loads/zip.blade.php | 2 +- 29 files changed, 149 insertions(+), 144 deletions(-) diff --git a/app/Classes/Application.php b/app/Classes/Application.php index f26fccc2f..92f4e5abe 100644 --- a/app/Classes/Application.php +++ b/app/Classes/Application.php @@ -15,11 +15,11 @@ public static function run() abort(404); } - if (is_callable($router['target'])) { - $call = call_user_func_array($router['target'], $router['params']); + if (\is_callable($router['target'])) { + $call = \call_user_func_array($router['target'], $router['params']); } else { list($controller, $action) = self::getController($router); - $call = call_user_func_array([new $controller, $action], $router['params']); + $call = \call_user_func_array([new $controller, $action], $router['params']); } echo $call; diff --git a/app/Classes/BBCode.php b/app/Classes/BBCode.php index 06a3e7adf..3bc06284e 100644 --- a/app/Classes/BBCode.php +++ b/app/Classes/BBCode.php @@ -310,7 +310,7 @@ public function setParser($name, $pattern, $replace): void */ public function only($only = null) { - $only = is_array($only) ? $only : func_get_args(); + $only = \is_array($only) ? $only : \func_get_args(); $this->parsers = $this->arrayOnly($only); return $this; } @@ -323,7 +323,7 @@ public function only($only = null) */ public function except($except = null) { - $except = is_array($except) ? $except : func_get_args(); + $except = \is_array($except) ? $except : \func_get_args(); $this->parsers = $this->arrayExcept($except); return $this; } diff --git a/app/Classes/Validator.php b/app/Classes/Validator.php index 6c6206f8d..bad112136 100644 --- a/app/Classes/Validator.php +++ b/app/Classes/Validator.php @@ -27,16 +27,16 @@ class Validator * @param bool $required * @return Validator */ - public function length($input, $min, $max, $label, $required = true) + public function length($input, $min, $max, $label, $required = true): Validator { if (! $required && blank($input)) { return $this; } if (mb_strlen($input, 'utf-8') < $min) { - $this->addError($label, ' (Не менее '.$min.' симв.)'); + $this->addError($label, ' (Не менее ' . $min . ' симв.)'); } elseif (mb_strlen($input, 'utf-8') > $max) { - $this->addError($label, ' (Не более '.$max.' симв.)'); + $this->addError($label, ' (Не более ' . $max . ' симв.)'); } return $this; @@ -51,10 +51,10 @@ public function length($input, $min, $max, $label, $required = true) * @param mixed $label * @return Validator */ - public function between($input, $min, $max, $label) + public function between($input, $min, $max, $label): Validator { if ($input < $min || $input > $max) { - $this->addError($label, ' (От '.$min.' до '.$max.')'); + $this->addError($label, ' (От ' . $min . ' до ' . $max . ')'); } return $this; @@ -68,7 +68,7 @@ public function between($input, $min, $max, $label) * @param mixed $label * @return Validator */ - public function gt($input, $input2, $label) + public function gt($input, $input2, $label): Validator { if ($input <= $input2) { $this->addError($label); @@ -85,7 +85,7 @@ public function gt($input, $input2, $label) * @param mixed $label * @return Validator */ - public function gte($input, $input2, $label) + public function gte($input, $input2, $label): Validator { if ($input < $input2) { $this->addError($label); @@ -102,7 +102,7 @@ public function gte($input, $input2, $label) * @param mixed $label * @return Validator */ - public function lt($input, $input2, $label) + public function lt($input, $input2, $label): Validator { if ($input >= $input2) { $this->addError($label); @@ -119,7 +119,7 @@ public function lt($input, $input2, $label) * @param mixed $label * @return Validator */ - public function lte($input, $input2, $label) + public function lte($input, $input2, $label): Validator { if ($input > $input2) { $this->addError($label); @@ -136,7 +136,7 @@ public function lte($input, $input2, $label) * @param mixed $label * @return Validator */ - public function equal($input, $input2, $label) + public function equal($input, $input2, $label): Validator { if ($input !== $input2) { $this->addError($label); @@ -153,7 +153,7 @@ public function equal($input, $input2, $label) * @param mixed $label * @return Validator */ - public function notEqual($input, $input2, $label) + public function notEqual($input, $input2, $label): Validator { if ($input === $input2) { $this->addError($label); @@ -169,7 +169,7 @@ public function notEqual($input, $input2, $label) * @param mixed $label * @return Validator */ - public function empty($input, $label) + public function empty($input, $label): Validator { if (! empty($input)) { $this->addError($label); @@ -185,7 +185,7 @@ public function empty($input, $label) * @param mixed $label * @return Validator */ - public function notEmpty($input, $label) + public function notEmpty($input, $label): Validator { if (empty($input)) { $this->addError($label); @@ -201,7 +201,7 @@ public function notEmpty($input, $label) * @param mixed $label * @return Validator */ - public function true($input, $label) + public function true($input, $label): Validator { if (filter_var($input, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) === false) { $this->addError($label); @@ -217,7 +217,7 @@ public function true($input, $label) * @param mixed $label * @return Validator */ - public function false($input, $label) + public function false($input, $label): Validator { if (filter_var($input, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) !== false) { $this->addError($label); @@ -234,9 +234,9 @@ public function false($input, $label) * @param mixed $label * @return Validator */ - public function in($input, $haystack, $label) + public function in($input, $haystack, $label): Validator { - if (! is_array($haystack) || ! in_array($input, $haystack, true)) { + if (! \is_array($haystack) || ! \in_array($input, $haystack, true)) { $this->addError($label); } @@ -251,9 +251,9 @@ public function in($input, $haystack, $label) * @param mixed $label * @return Validator */ - public function notIn($input, $haystack, $label) + public function notIn($input, $haystack, $label): Validator { - if (! is_array($haystack) || in_array($input, $haystack, true)) { + if (! \is_array($haystack) || \in_array($input, $haystack, true)) { $this->addError($label); } @@ -269,7 +269,7 @@ public function notIn($input, $haystack, $label) * @param bool $required * @return Validator */ - public function regex($input, $pattern, $label, $required = true) + public function regex($input, $pattern, $label, $required = true): Validator { if (! $required && blank($input)) { return $this; @@ -290,13 +290,13 @@ public function regex($input, $pattern, $label, $required = true) * @param bool $required * @return Validator */ - public function float($input, $label, $required = true) + public function float($input, $label, $required = true): Validator { if (! $required && blank($input)) { return $this; } - if (! is_float($input)) { + if (! \is_float($input)) { $this->addError($label); } @@ -311,7 +311,7 @@ public function float($input, $label, $required = true) * @param bool $required * @return Validator */ - public function url($input, $label, $required = true) + public function url($input, $label, $required = true): Validator { if (! $required && blank($input)) { return $this; @@ -332,7 +332,7 @@ public function url($input, $label, $required = true) * @param bool $required * @return Validator */ - public function email($input, $label, $required = true) + public function email($input, $label, $required = true): Validator { if (! $required && blank($input)) { return $this; @@ -354,7 +354,7 @@ public function email($input, $label, $required = true) * @param bool $required * @return Validator */ - public function file($input, $rules, $label, $required = true) + public function file($input, $rules, $label, $required = true): Validator { if (! $required && blank($input)) { return $this; @@ -365,7 +365,7 @@ public function file($input, $rules, $label, $required = true) return $this; } - $key = is_array($label) ? key($label) : 0; + $key = \is_array($label) ? key($label) : 0; if (empty($rules['extensions'])) { $rules['extensions'] = ['jpg', 'jpeg', 'gif', 'png']; @@ -373,7 +373,7 @@ public function file($input, $rules, $label, $required = true) $extension = strtolower($input->getClientOriginalExtension()); - if (! in_array($extension, $rules['extensions'], true)) { + if (! \in_array($extension, $rules['extensions'], true)) { $this->addError([$key => 'Недопустимое расширение файла!']); } @@ -383,7 +383,7 @@ public function file($input, $rules, $label, $required = true) } } - if (in_array($extension, ['jpg', 'jpeg', 'gif', 'png'], true)) { + if (\in_array($extension, ['jpg', 'jpeg', 'gif', 'png'], true)) { list($width, $height) = getimagesize($input); if (isset($rules['maxweight'])) { @@ -413,11 +413,11 @@ public function file($input, $rules, $label, $required = true) * @param string $description * @return void */ - public function addError($error, $description = null) + public function addError($error, $description = null): void { $key = 0; - if (is_array($error)) { + if (\is_array($error)) { $key = key($error); $error = current($error); } @@ -434,7 +434,7 @@ public function addError($error, $description = null) * * @return array */ - public function getErrors() + public function getErrors(): array { return $this->errors; } @@ -444,7 +444,7 @@ public function getErrors() * * @return void */ - public function clearErrors() + public function clearErrors(): void { $this->errors = []; } @@ -454,7 +454,7 @@ public function clearErrors() * * @return bool */ - public function isValid() + public function isValid(): bool { return empty($this->errors); } diff --git a/app/Controllers/Admin/BackupController.php b/app/Controllers/Admin/BackupController.php index 01ed4d0c4..5a7a69d0f 100644 --- a/app/Controllers/Admin/BackupController.php +++ b/app/Controllers/Admin/BackupController.php @@ -93,7 +93,7 @@ public function create() foreach ($records as $record) { $record = str_replace('"', '"', $record); - $columns[] = $record ? (is_int($record) ? $record : '"' . $record . '"') : 'NULL'; + $columns[] = $record ? is_int($record) ? $record : '"' . $record . '"' : 'NULL'; } $this->fwrite($fp, ($key || $i ? ',' : '') . '(' . implode(',', $columns) . ')', $method); diff --git a/app/Controllers/Admin/BanController.php b/app/Controllers/Admin/BanController.php index 6c404cf04..eddad166c 100644 --- a/app/Controllers/Admin/BanController.php +++ b/app/Controllers/Admin/BanController.php @@ -39,7 +39,7 @@ public function edit() abort(404, 'Пользователь не найден!'); } - if (in_array($user->level, User::ADMIN_GROUPS)) { + if (\in_array($user->level, User::ADMIN_GROUPS, true)) { abort('default', 'Запрещено банить администрацию сайта!'); } @@ -52,7 +52,7 @@ public function edit() $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') - ->false($user->level == User::BANNED && $user->timeban > SITETIME, 'Данный аккаунт уже заблокирован!') + ->false($user->level === User::BANNED && $user->timeban > SITETIME, 'Данный аккаунт уже заблокирован!') ->gt($time, 0, ['time' => 'Вы не указали время бана!']) ->in($type, ['minutes', 'hours', 'days'], ['type', 'Не выбрано время бана!']) ->length($reason, 5, 1000, ['reason' => 'Слишком длинная или короткая причина бана!']) diff --git a/app/Controllers/Admin/BlacklistController.php b/app/Controllers/Admin/BlacklistController.php index 7ea8e3413..be663050a 100644 --- a/app/Controllers/Admin/BlacklistController.php +++ b/app/Controllers/Admin/BlacklistController.php @@ -33,7 +33,7 @@ public function __construct() $this->types = ['email', 'login', 'domain']; $this->type = Request::input('type', 'email'); - if (! in_array($this->type, $this->types)) { + if (! \in_array($this->type, $this->types)) { abort(404, 'Указанный тип не найден!'); } } diff --git a/app/Controllers/Admin/CacheController.php b/app/Controllers/Admin/CacheController.php index 3e0520073..31fa89cf6 100644 --- a/app/Controllers/Admin/CacheController.php +++ b/app/Controllers/Admin/CacheController.php @@ -32,9 +32,9 @@ public function index() $view = view('admin/caches/index', compact('files')); } else { $images = glob(UPLOADS.'/thumbnails/*.{gif,png,jpg,jpeg}', GLOB_BRACE); - $page = paginate(20, count($images)); + $page = paginate(20, \count($images)); - $images = array_slice($images, $page->offset, $page->limit); + $images = \array_slice($images, $page->offset, $page->limit); $view = view('admin/caches/images', compact('images', 'page')); } @@ -45,12 +45,12 @@ public function index() /** * Очистка кеша */ - public function clear() + public function clear(): void { $token = check(Request::input('token')); $type = check(Request::input('type', 'files')); - if ($token == $_SESSION['token']) { + if ($token === $_SESSION['token']) { if ($type === 'files') { clearCache(); diff --git a/app/Controllers/Admin/CheckerController.php b/app/Controllers/Admin/CheckerController.php index e3c1ecf1d..a0512d291 100644 --- a/app/Controllers/Admin/CheckerController.php +++ b/app/Controllers/Admin/CheckerController.php @@ -21,15 +21,17 @@ public function __construct() /** * Главная страница + * + * @return string */ - public function index() + public function index(): string { $files = $this->scanFiles('../'); $files = str_replace('..//', '', $files); $diff = []; - if (file_exists(STORAGE."/temp/checker.dat")) { - $filesScan = json_decode(file_get_contents(STORAGE."/temp/checker.dat")); + if (file_exists(STORAGE . '/temp/checker.dat')) { + $filesScan = json_decode(file_get_contents(STORAGE . '/temp/checker.dat')); $diff['left'] = array_diff($files, $filesScan); $diff['right'] = array_diff($filesScan, $files); @@ -40,17 +42,19 @@ public function index() /** * Сканирование сайта + * + * @return void */ - public function scan() + public function scan(): void { $token = check(Request::input('token')); - if ($token == $_SESSION['token']) { - if (is_writable(STORAGE."/temp")) { + if ($token === $_SESSION['token']) { + if (is_writable(STORAGE . '/temp')) { $files = $this->scanFiles('../'); $files = str_replace('..//', '', $files); - file_put_contents(STORAGE."/temp/checker.dat", json_encode($files), LOCK_EX); + file_put_contents(STORAGE . '/temp/checker.dat', json_encode($files), LOCK_EX); setFlash('success', 'Сайт успешно отсканирован!'); } else { @@ -65,23 +69,26 @@ public function scan() /** * Сканирует директорию сайта + * + * @param string $dir + * @return array */ - private function scanFiles($dir) + private function scanFiles($dir): array { static $state; $files = preg_grep('/^([^.])/', scandir($dir)); foreach ($files as $file) { - if (is_file($dir.'/'.$file)) { + if (is_file($dir . '/' . $file)) { $ext = getExtension($file); - if (! in_array($ext, explode(',', setting('nocheck')) )) { - $state[] = $dir.'/'.$file.' / '.dateFixed(filemtime($dir.'/'.$file), 'd.m.Y H:i').' / '.formatFileSize($dir.'/'.$file); + if (! \in_array($ext, explode(',', setting('nocheck')), true)) { + $state[] = $dir . '/' . $file . ' / ' . dateFixed(filemtime($dir . '/' . $file), 'd.m.Y H:i') . ' / ' . formatFileSize($dir . '/' . $file); } } else { - $state[] = $dir.'/'.$file; - $this->scanFiles($dir.'/'.$file); + $state[] = $dir . '/' . $file; + $this->scanFiles($dir . '/' . $file); } } diff --git a/app/Controllers/Admin/LoadController.php b/app/Controllers/Admin/LoadController.php index c934aeb67..643c57f9a 100644 --- a/app/Controllers/Admin/LoadController.php +++ b/app/Controllers/Admin/LoadController.php @@ -261,7 +261,7 @@ public function editDown($id) $validator->empty($duplicate, ['title' => 'Загрузка с аналогичный названием уже существует!']); $existFiles = $down->files ? $down->files->count() : 0; - $validator->lte(count($files) + $existFiles, 5, ['files' => 'Разрешено загружать не более 5 файлов']); + $validator->lte(\count($files) + $existFiles, 5, ['files' => 'Разрешено загружать не более 5 файлов']); if ($validator->isValid()) { diff --git a/app/Controllers/Admin/SettingController.php b/app/Controllers/Admin/SettingController.php index 823bd7fe4..60662d7f7 100644 --- a/app/Controllers/Admin/SettingController.php +++ b/app/Controllers/Admin/SettingController.php @@ -28,7 +28,7 @@ public function index() { $act = check(Request::input('act', 'main')); - if (! in_array($act, Setting::getActions())) { + if (! \in_array($act, Setting::getActions())) { abort(404, 'Недопустимая страница!'); } diff --git a/app/Controllers/Admin/SpamController.php b/app/Controllers/Admin/SpamController.php index a705fcc77..4bf9ec3cf 100644 --- a/app/Controllers/Admin/SpamController.php +++ b/app/Controllers/Admin/SpamController.php @@ -69,7 +69,7 @@ public function index() ->with('relate.user', 'user') ->get(); - if (in_array($type, ['inbox', 'wall'])) { + if (\in_array($type, ['inbox', 'wall'])) { $records->load('relate.author'); } diff --git a/app/Controllers/Admin/UserController.php b/app/Controllers/Admin/UserController.php index 5dc128a7e..b7d09dc20 100644 --- a/app/Controllers/Admin/UserController.php +++ b/app/Controllers/Admin/UserController.php @@ -126,7 +126,7 @@ public function edit(): string ->regex($icq, '#^[0-9]{5,10}$#', ['icq' => 'Недопустимый формат ICQ, только цифры от 5 до 10 символов!'], false) ->regex($skype, '#^[a-z]{1}[0-9a-z\_\.\-]{5,31}$#', ['skype' => 'Недопустимый формат Skype, только латинские символы от 6 до 32!'], false) ->length($status, 3, 20, ['status' => 'Слишком длинный или короткий статус!'], false) - ->true(in_array($themes, $allThemes) || $themes == 0, ['themes' => 'Данная тема не установлена на сайте!']) + ->true(\in_array($themes, $allThemes, true) || empty($themes), ['themes' => 'Данная тема не установлена на сайте!']) ->length($info, 0, 1000, ['info' => 'Слишком большая информация о себе, не более 1000 символов!']); if ($validator->isValid()) { diff --git a/app/Controllers/Admin/VoteController.php b/app/Controllers/Admin/VoteController.php index 722124a37..d760621a8 100644 --- a/app/Controllers/Admin/VoteController.php +++ b/app/Controllers/Admin/VoteController.php @@ -87,7 +87,7 @@ public function edit($id) } } - $validator->between(count($answers), 2, 10, ['answer' => 'Недостаточное количество вариантов ответов!']); + $validator->between(\count($answers), 2, 10, ['answer' => 'Недостаточное количество вариантов ответов!']); if ($validator->isValid()) { diff --git a/app/Controllers/AjaxController.php b/app/Controllers/AjaxController.php index 5d20188d1..10f36c45e 100644 --- a/app/Controllers/AjaxController.php +++ b/app/Controllers/AjaxController.php @@ -231,11 +231,11 @@ public function rating() return json_encode(['status' => 'error', 'message' => 'Invalid token']); } - if (! in_array($vote, ['+', '-'], true)) { + if (! \in_array($vote, ['+', '-'], true)) { return json_encode(['status' => 'error', 'message' => 'Invalid rating']); } - if (! in_array($type, $types, true)) { + if (! \in_array($type, $types, true)) { return json_encode(['status' => 'error', 'message' => 'Type invalid']); } @@ -302,7 +302,7 @@ public function uploadImage() $type = check(Request::input('type')); $token = check(Request::input('token')); - if (! in_array($type, $types, true)) { + if (! \in_array($type, $types, true)) { return json_encode(['status' => 'error', 'message' => 'Type invalid']); } @@ -372,7 +372,7 @@ public function deleteImage() $type = check(Request::input('type')); $token = check(Request::input('token')); - if (! in_array($type, $types, true)) { + if (! \in_array($type, $types, true)) { return json_encode(['status' => 'error', 'message' => 'Type invalid']); } diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index d8ce399bb..f8a433068 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -37,58 +37,56 @@ public function __construct() /** * Счетчик запросов */ - if (setting('doslimit')) { - if (is_writable(STORAGE.'/antidos')) { - - $dosfiles = glob(STORAGE.'/antidos/*.dat'); - foreach ($dosfiles as $filename) { - $array_filemtime = @filemtime($filename); - if ($array_filemtime < (time() - 60)) { - @unlink($filename); - } + if (setting('doslimit') && is_writable(STORAGE . '/antidos')) { + + $dosfiles = glob(STORAGE.'/antidos/*.dat'); + foreach ($dosfiles as $filename) { + $array_filemtime = @filemtime($filename); + if ($array_filemtime < (time() - 60)) { + @unlink($filename); } - // -------------------------- Проверка на время -----------------------------// - if (file_exists(STORAGE.'/antidos/'.getIp().'.dat')) { - $file_dos = file(STORAGE.'/antidos/'.getIp().'.dat'); - $file_str = explode('|', $file_dos[0]); - if ($file_str[0] < (time() - 60)) { - @unlink(STORAGE.'/antidos/'.getIp().'.dat'); - } + } + // -------------------------- Проверка на время -----------------------------// + if (file_exists(STORAGE.'/antidos/'.getIp().'.dat')) { + $file_dos = file(STORAGE.'/antidos/'.getIp().'.dat'); + $file_str = explode('|', $file_dos[0]); + if ($file_str[0] < (time() - 60)) { + @unlink(STORAGE.'/antidos/'.getIp().'.dat'); } - // ------------------------------ Запись логов -------------------------------// - $write = time().'|'.server('REQUEST_URI').'|'.server('HTTP_REFERER').'|'.getBrowser().'|'.getUser('login').'|'; - file_put_contents(STORAGE.'/antidos/'.getIp().'.dat', $write."\r\n", FILE_APPEND); + } + // ------------------------------ Запись логов -------------------------------// + $write = time().'|'.server('REQUEST_URI').'|'.server('HTTP_REFERER').'|'.getBrowser().'|'.getUser('login').'|'; + file_put_contents(STORAGE.'/antidos/'.getIp().'.dat', $write."\r\n", FILE_APPEND); - // ----------------------- Автоматическая блокировка ------------------------// - if (counterString(STORAGE.'/antidos/'.getIp().'.dat') > setting('doslimit')) { + // ----------------------- Автоматическая блокировка ------------------------// + if (counterString(STORAGE.'/antidos/'.getIp().'.dat') > setting('doslimit')) { - if (!empty(setting('errorlog'))) { + if (!empty(setting('errorlog'))) { - $banip = Ban::query()->where('ip', getIp())->first(); + $banip = Ban::query()->where('ip', getIp())->first(); - if (! $banip) { - Error::query()->create([ - 'code' => 666, - 'request' => utfSubstr(server('REQUEST_URI'), 0, 200), - 'referer' => utfSubstr(server('HTTP_REFERER'), 0, 200), - 'user_id' => getUser('id'), - 'ip' => getIp(), - 'brow' => getBrowser(), - 'created_at' => SITETIME, + if (! $banip) { + Error::query()->create([ + 'code' => 666, + 'request' => utfSubstr(server('REQUEST_URI'), 0, 200), + 'referer' => utfSubstr(server('HTTP_REFERER'), 0, 200), + 'user_id' => getUser('id'), + 'ip' => getIp(), + 'brow' => getBrowser(), + 'created_at' => SITETIME, - ]); + ]); - DB::insert( - 'insert ignore into ban (`ip`, `created_at`) values (?, ?);', - [getIp(), SITETIME] - ); + DB::insert( + 'insert ignore into ban (`ip`, `created_at`) values (?, ?);', + [getIp(), SITETIME] + ); - ipBan(true); - } + ipBan(true); } - - unlink(STORAGE.'/antidos/'.getIp().'.dat'); } + + unlink(STORAGE.'/antidos/'.getIp().'.dat'); } } diff --git a/app/Controllers/BlogController.php b/app/Controllers/BlogController.php index cb4092b66..fd9b1b249 100644 --- a/app/Controllers/BlogController.php +++ b/app/Controllers/BlogController.php @@ -82,7 +82,7 @@ public function view($id) $text = preg_split('|\[nextpage\](
)*|', $blog->text, -1, PREG_SPLIT_NO_EMPTY); - $total = count($text); + $total = \count($text); $page = paginate(1, $total); if ($page->current === 1) { @@ -536,7 +536,7 @@ public function tags($tag = null) $_SESSION['findresult'] = $result; } - $total = count($_SESSION['findresult']); + $total = \count($_SESSION['findresult']); $page = paginate(setting('blogpost'), $total); $blogs = Blog::query() @@ -794,8 +794,8 @@ public function search() $_SESSION['blogfindres'] = $result; } - $total = count($_SESSION['blogfindres']); - $page = paginate(setting('blogpost'), $total); + $total = \count($_SESSION['blogfindres']); + $page = paginate(setting('blogpost'), $total); if ($total > 0) { $blogs = Blog::query() @@ -837,8 +837,8 @@ public function search() $_SESSION['blogfindres'] = $result; } - $total = count($_SESSION['blogfindres']); - $page = paginate(setting('blogpost'), $total); + $total = \count($_SESSION['blogfindres']); + $page = paginate(setting('blogpost'), $total); if ($total > 0) { $blogs = Blog::query() diff --git a/app/Controllers/Forum/ForumController.php b/app/Controllers/Forum/ForumController.php index fc3712848..b3946cab0 100644 --- a/app/Controllers/Forum/ForumController.php +++ b/app/Controllers/Forum/ForumController.php @@ -122,7 +122,7 @@ public function create(): string } } - $validator->between(count($answers), 2, 10, ['answer' => 'Недостаточное количество вариантов ответов!']); + $validator->between(\count($answers), 2, 10, ['answer' => 'Недостаточное количество вариантов ответов!']); } /* TODO: Сделать проверку поиска похожей темы */ @@ -249,7 +249,7 @@ public function search(): ?string $findme = implode(' ', $arrfind); - if ($type === 2 && count($findmewords) > 1) { + if ($type === 2 && \count($findmewords) > 1) { $findme = "\"$find\""; } @@ -276,7 +276,7 @@ public function search(): ?string $_SESSION['forumfindres'] = $result; } - $total = count($_SESSION['forumfindres']); + $total = \count($_SESSION['forumfindres']); if ($total > 0) { $page = paginate(setting('forumtem'), $total); @@ -317,7 +317,7 @@ public function search(): ?string $_SESSION['forumfindres'] = $result; } - $total = count($_SESSION['forumfindres']); + $total = \count($_SESSION['forumfindres']); if ($total > 0) { $page = paginate(setting('forumpost'), $total); diff --git a/app/Controllers/Forum/TopicController.php b/app/Controllers/Forum/TopicController.php index 09760a7a6..a95166310 100644 --- a/app/Controllers/Forum/TopicController.php +++ b/app/Controllers/Forum/TopicController.php @@ -129,7 +129,7 @@ public function create($id) if ($files && $validator->isValid()) { $validator - ->lte(count($files), setting('maxfiles'), ['files' => 'Разрешено загружать не более ' . setting('maxfiles') . ' файлов']) + ->lte(\count($files), setting('maxfiles'), ['files' => 'Разрешено загружать не более ' . setting('maxfiles') . ' файлов']) ->gte(getUser('point'), setting('forumloadpoints'), 'У вас недостаточно актива для загрузки файлов!'); $rules = [ @@ -151,7 +151,7 @@ public function create($id) $post->created_at + 600 > SITETIME && getUser('id') === $post->user_id && (utfStrlen($msg) + utfStrlen($post->text) <= setting('forumtextlength')) && - count($files) + $post->files->count() <= setting('maxfiles') + \count($files) + $post->files->count() <= setting('maxfiles') ) { $newpost = $post->text . "\n\n" . '[i][size=1]Добавлено через ' . makeTime(SITETIME - $post->created_at) . ' сек.[/size][/i]' . "\n" . $msg; @@ -229,7 +229,7 @@ public function delete($id) abort(404, 'Данной темы не существует!'); } - $isModer = in_array(getUser('id'), explode(',', $topic->moderators)) ? true : false; + $isModer = \in_array(getUser('id'), explode(',', $topic->moderators), true) ? true : false; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -394,7 +394,7 @@ public function editPost($id) ->where('posts.id', $id) ->first(); - $isModer = in_array(getUser('id'), explode(',', $post->moderators)) ? true : false; + $isModer = \in_array(getUser('id'), explode(',', $post->moderators), true) ? true : false; if (! $post) { abort(404, 'Данного сообщения не существует!'); diff --git a/app/Controllers/Load/DownController.php b/app/Controllers/Load/DownController.php index e1a74c5d5..8cf0bc248 100644 --- a/app/Controllers/Load/DownController.php +++ b/app/Controllers/Load/DownController.php @@ -85,8 +85,8 @@ public function edit($id): string $validator->empty($duplicate, ['title' => 'Загрузка с аналогичный названием уже существует!']); $existFiles = $down->files ? $down->files->count() : 0; - $validator->notEmpty(count($files) + $existFiles, ['files' => 'Необходимо загрузить хотя бы 1 файл']); - $validator->lte(count($files) + $existFiles, setting('maxfiles'), ['files' => 'Разрешено загружать не более ' . setting('maxfiles') . ' файлов']); + $validator->notEmpty(\count($files) + $existFiles, ['files' => 'Необходимо загрузить хотя бы 1 файл']); + $validator->lte(\count($files) + $existFiles, setting('maxfiles'), ['files' => 'Разрешено загружать не более ' . setting('maxfiles') . ' файлов']); if ($validator->isValid()) { @@ -204,7 +204,7 @@ public function create(): string } $validator->notEmpty($files, ['files' => 'Необходимо загрузить хотя бы 1 файл']); - $validator->lte(count($files), setting('maxfiles'), ['files' => 'Разрешено загружать не более ' . setting('maxfiles') . ' файлов']); + $validator->lte(\count($files), setting('maxfiles'), ['files' => 'Разрешено загружать не более ' . setting('maxfiles') . ' файлов']); if ($validator->isValid()) { $rules = [ @@ -560,7 +560,7 @@ public function zip($id): string $getDocuments = array_values($archive->getAllInfo()); $viewExt = Down::getViewExt(); - $documents = array_slice($getDocuments, $page->offset, $page->limit, true); + $documents = \array_slice($getDocuments, $page->offset, $page->limit, true); return view('loads/zip', compact('down', 'file', 'documents', 'page', 'viewExt')); } @@ -609,7 +609,7 @@ public function zipView($id, $fid) $ext = getExtension($document->getName()); header('Content-type: image/' . $ext); - header('Content-Length: ' . strlen($content)); + header('Content-Length: ' . \strlen($content)); header('Content-Disposition: inline; filename="' . $document->getName() . '";'); exit($content); } diff --git a/app/Controllers/Load/SearchController.php b/app/Controllers/Load/SearchController.php index f135e1f83..69bffcea5 100644 --- a/app/Controllers/Load/SearchController.php +++ b/app/Controllers/Load/SearchController.php @@ -47,24 +47,24 @@ public function index() $arrfind = []; foreach ($findmewords as $val) { if (utfStrlen($val) >= 3) { - $arrfind[] = (empty($type)) ? '+' . $val . '*' : $val . '*'; + $arrfind[] = empty($type) ? '+' . $val . '*' : $val . '*'; } } $findme = implode(' ', $arrfind); - if ($type == 2 && count($findmewords) > 1) { + if ($type === 2 && \count($findmewords) > 1) { $findme = "\"$find\""; } - $wheres = (empty($where)) ? 'title' : 'text'; + $wheres = empty($where) ? 'title' : 'text'; $loadfind = ($type . $wheres . $section . $find); // Поиск в названии if ($wheres === 'title') { - if (empty($_SESSION['loadfindres']) || $loadfind != $_SESSION['loadfind']) { + if (empty($_SESSION['loadfindres']) || $loadfind !== $_SESSION['loadfind']) { $searchsec = ($section > 0) ? 'category_id = ' . $section . ' AND' : ''; @@ -80,7 +80,7 @@ public function index() $_SESSION['loadfindres'] = $result; } - $total = count($_SESSION['loadfindres']); + $total = \count($_SESSION['loadfindres']); if ($total > 0) { $page = paginate(setting('downlist'), $total); @@ -104,7 +104,7 @@ public function index() // Поиск в описании if ($wheres === 'text') { - if (empty($_SESSION['loadfindres']) || $loadfind != $_SESSION['loadfind']) { + if (empty($_SESSION['loadfindres']) || $loadfind !== $_SESSION['loadfind']) { $searchsec = ($section > 0) ? 'category_id = ' . $section . ' AND' : ''; @@ -120,7 +120,7 @@ public function index() $_SESSION['loadfindres'] = $result; } - $total = count($_SESSION['loadfindres']); + $total = \count($_SESSION['loadfindres']); if ($total > 0) { $page = paginate(setting('downlist'), $total); diff --git a/app/Controllers/OfferController.php b/app/Controllers/OfferController.php index 995faec5a..e54b01c62 100644 --- a/app/Controllers/OfferController.php +++ b/app/Controllers/OfferController.php @@ -143,7 +143,7 @@ public function edit($id) abort(404, 'Данного предложения или проблемы не существует!'); } - if (! in_array($offer->status, ['wait', 'process'])) { + if (! \in_array($offer->status, ['wait', 'process'])) { abort('default', 'Данное предложение или проблема уже решена или закрыта!'); } diff --git a/app/Controllers/User/UserController.php b/app/Controllers/User/UserController.php index eba9060f5..ccc9086c6 100644 --- a/app/Controllers/User/UserController.php +++ b/app/Controllers/User/UserController.php @@ -428,7 +428,7 @@ public function setting(): string $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->regex($themes, '|^[a-z0-9_\-]+$|i', ['themes' => 'Недопустимое название темы!']) - ->true(in_array($themes, $setting['themes']) || empty($themes), ['themes' => 'Данная тема не установлена на сайте!']) + ->true(\in_array($themes, $setting['themes'], true) || empty($themes), ['themes' => 'Данная тема не установлена на сайте!']) ->regex($language, '|^[a-z]+$|', ['language' => 'Недопустимое название языка!']) ->in($language, $setting['languages'], ['language' => 'Данный язык не установлен на сайте!']) ->regex($timezone, '|^[\-\+]{0,1}[0-9]{1,2}$|', ['timezone' => 'Недопустимое значение временного сдвига. (Допустимый диапазон -12 — +12 часов)!']); diff --git a/app/Controllers/VoteController.php b/app/Controllers/VoteController.php index 9a2965d51..ded21f431 100644 --- a/app/Controllers/VoteController.php +++ b/app/Controllers/VoteController.php @@ -221,7 +221,7 @@ public function create(): string } } - $validator->between(count($answers), 2, 10, ['answer' => 'Недостаточное количество вариантов ответов!']); + $validator->between(\count($answers), 2, 10, ['answer' => 'Недостаточное количество вариантов ответов!']); if ($validator->isValid()) { diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php index aab1b6f17..3ed4b4d2b 100644 --- a/app/Models/BaseModel.php +++ b/app/Models/BaseModel.php @@ -55,7 +55,7 @@ public function uploadFile(UploadedFile $file): array $fullPath = $this->uploadPath . '/' . $filename; $path = str_replace(HOME, '', $fullPath); - if (in_array($extension, ['jpg', 'jpeg', 'gif', 'png'], true)) { + if (\in_array($extension, ['jpg', 'jpeg', 'gif', 'png'], true)) { $img = Image::make($file); if ($img->getWidth() <= 100 && $img->getHeight() <= 100) { diff --git a/app/Models/File.php b/app/Models/File.php index 5d59b6e6b..728fa4266 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -43,6 +43,6 @@ public function getExtensionAttribute() */ public function isImage() { - return in_array($this->extension, ['jpg', 'jpeg', 'gif', 'png']); + return \in_array($this->extension, ['jpg', 'jpeg', 'gif', 'png']); } } diff --git a/resources/views/admin/backups/create.blade.php b/resources/views/admin/backups/create.blade.php index 2171e9dcc..2bd1b5ed9 100644 --- a/resources/views/admin/backups/create.blade.php +++ b/resources/views/admin/backups/create.blade.php @@ -29,7 +29,7 @@ @foreach ($tables as $data) - Name, $sheets) ? ' checked' : ''; ?> + Name, $sheets, true) ? ' checked' : ''; ?>
- + {!! textError('name') !!}
diff --git a/resources/views/boards/create.blade.php b/resources/views/boards/create.blade.php index 5b69c3af7..4dbcb74b2 100644 --- a/resources/views/boards/create.blade.php +++ b/resources/views/boards/create.blade.php @@ -39,7 +39,7 @@
- + {!! textError('title') !!}
diff --git a/resources/views/boards/edit.blade.php b/resources/views/boards/edit.blade.php index 2c55e4312..4c4ce51d5 100644 --- a/resources/views/boards/edit.blade.php +++ b/resources/views/boards/edit.blade.php @@ -62,7 +62,7 @@
- + {!! textError('title') !!}
From 7e22a83c5d71e171b00913d4675dfebe91fdd04b Mon Sep 17 00:00:00 2001 From: visavi Date: Tue, 4 Sep 2018 23:55:24 +0300 Subject: [PATCH 018/163] =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/ContactController.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/Controllers/ContactController.php b/app/Controllers/ContactController.php index 4bd96e14c..36f0c4685 100644 --- a/app/Controllers/ContactController.php +++ b/app/Controllers/ContactController.php @@ -23,8 +23,10 @@ public function __construct() /** * Главная страница + * + * @return string */ - public function index() + public function index(): string { if (Request::isMethod('post')) { $page = int(Request::input('page', 1)); @@ -84,8 +86,11 @@ public function index() /** * Заметка для пользователя + * + * @param int $id + * @return string */ - public function note($id) + public function note($id): string { $contact = Contact::query() ->where('user_id', getUser('id')) @@ -124,8 +129,10 @@ public function note($id) /** * Удаление контактов + * + * @return void */ - public function delete() + public function delete(): void { $page = int(Request::input('page', 1)); $token = check(Request::input('token')); From fcff34ec9ba3c6d1463b1c773f4c0edbcc23edfb Mon Sep 17 00:00:00 2001 From: visavi Date: Wed, 5 Sep 2018 23:20:23 +0300 Subject: [PATCH 019/163] =?UTF-8?q?=D1=83=D0=B1=D1=80=D0=B0=D0=BB=20=D0=BB?= =?UTF-8?q?=D0=B8=D1=88=D0=BD=D1=8E=D1=8E=20=D1=81=D0=BA=D0=BE=D0=B1=D0=BA?= =?UTF-8?q?=D1=83=20=D0=B2=20=D0=BA=D0=BE=D0=BB=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/guestbooks/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/guestbooks/index.blade.php b/resources/views/guestbooks/index.blade.php index 72ed92fcb..1c8066d1d 100644 --- a/resources/views/guestbooks/index.blade.php +++ b/resources/views/guestbooks/index.blade.php @@ -71,7 +71,7 @@ ({{ $data->brow }}, {{ $data->ip }}) @endif - @if ($data->reply)) + @if ($data->reply)
{{ trans('guestbooks.answer') }}: {!! bbCode($data->reply) !!} @endif From 013d5ef628100fe9cbeadf5f831377380fabb7e7 Mon Sep 17 00:00:00 2001 From: visavi Date: Fri, 7 Sep 2018 02:30:16 +0300 Subject: [PATCH 020/163] =?UTF-8?q?=D0=92=D1=8B=D0=B2=D0=BE=D0=B4=20=D0=BB?= =?UTF-8?q?=D0=BE=D0=B3=D0=B8=D0=BD=D0=B0=20=D0=BF=D1=80=D0=B8=20=D0=B8?= =?UTF-8?q?=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B8=20=D1=80=D0=B5?= =?UTF-8?q?=D0=BF=D1=83=D1=82=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/RatingController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Controllers/RatingController.php b/app/Controllers/RatingController.php index f128cb3fa..85874ab58 100644 --- a/app/Controllers/RatingController.php +++ b/app/Controllers/RatingController.php @@ -79,7 +79,7 @@ public function index($login) ]); if ($vote === 'plus') { - $text = 'Пользователь [b]' . getUser('login') . '[/b] поставил вам плюс! (Ваш рейтинг: ' . ($user['rating'] + 1) . ')' . PHP_EOL . 'Комментарий: ' . $text; + $text = 'Пользователь [b]' . getUser()->getProfile() . '[/b] поставил вам плюс! (Ваш рейтинг: ' . ($user['rating'] + 1) . ')' . PHP_EOL . 'Комментарий: ' . $text; $user->update([ 'rating' => DB::raw('posrating - negrating + 1'), @@ -88,7 +88,7 @@ public function index($login) } else { - $text = 'Пользователь [b]' . getUser('login') . '[/b] поставил вам минус! (Ваш рейтинг: ' . ($user['rating'] - 1) . ')' . PHP_EOL . 'Комментарий: ' . $text; + $text = 'Пользователь [b]' . getUser()->getProfile() . '[/b] поставил вам минус! (Ваш рейтинг: ' . ($user['rating'] - 1) . ')' . PHP_EOL . 'Комментарий: ' . $text; $user->update([ 'rating' => DB::raw('posrating - negrating - 1'), From 36a1ab0b9e0fb7b7c72512f3b1f768f7295cb3fe Mon Sep 17 00:00:00 2001 From: visavi Date: Fri, 7 Sep 2018 02:34:07 +0300 Subject: [PATCH 021/163] =?UTF-8?q?=D0=92=D1=8B=D0=B2=D0=BE=D0=B4=20=D0=BB?= =?UTF-8?q?=D0=BE=D0=B3=D0=B8=D0=BD=D0=B0=20=D0=BF=20=D0=BF=D1=80=D0=B8=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=B2=D0=BE=D0=B4=D0=B5=20=D0=B4=D0=B5?= =?UTF-8?q?=D0=BD=D0=B5=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/RatingController.php | 24 ++++++++++++++++++------ app/Controllers/TransferController.php | 10 +++++++--- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/app/Controllers/RatingController.php b/app/Controllers/RatingController.php index 85874ab58..b87c5e832 100644 --- a/app/Controllers/RatingController.php +++ b/app/Controllers/RatingController.php @@ -24,8 +24,11 @@ public function __construct() /** * Изменение рейтинга + * + * @param string $login + * @return string */ - public function index($login) + public function index($login): string { $vote = Request::input('vote'); $user = User::query()->where('login', $login)->first(); @@ -34,7 +37,7 @@ public function index($login) abort(404, 'Данного пользователя не существует!'); } - if (getUser('id') == $user->id) { + if (getUser('id') === $user->id) { abort('default', 'Запрещено изменять репутацию самому себе!'); } @@ -62,7 +65,7 @@ public function index($login) $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($text, 5, 250, ['text' => 'Слишком длинный или короткий комментарий!']); - if (getUser('rating') < 10 && empty($vote)) { + if (empty($vote) && getUser('rating') < 10) { $validator->addError('Уменьшать репутацию могут только пользователи с рейтингом 10 или выше!'); } @@ -111,8 +114,11 @@ public function index($login) /** * Полученные голоса + * + * @param string $login + * @return string */ - public function received($login) + public function received($login): string { $user = User::query()->where('login', $login)->first(); @@ -136,8 +142,11 @@ public function received($login) /** * Отданные голоса + * + * @param string $login + * @return string */ - public function gave($login) + public function gave($login): string { $user = User::query()->where('login', $login)->first(); @@ -161,8 +170,11 @@ public function gave($login) /** * Удаление истории + * + * @return void + * @throws \Exception */ - public function delete() + public function delete(): void { $id = int(Request::input('id')); $token = check(Request::input('token')); diff --git a/app/Controllers/TransferController.php b/app/Controllers/TransferController.php index 40fc5b91f..c54b8ed27 100644 --- a/app/Controllers/TransferController.php +++ b/app/Controllers/TransferController.php @@ -29,16 +29,20 @@ public function __construct() /** * Главная страница + * + * @return string */ - public function index() + public function index(): string { return view('transfers/index', ['user' => $this->user]); } /** * Перевод денег + * + * @return void */ - public function send() + public function send(): void { $money = int(Request::input('money')); $msg = check(Request::input('msg')); @@ -67,7 +71,7 @@ public function send() $this->user->increment('newprivat'); $comment = $msg ?? 'Не указано'; - $message = 'Пользователь [b]'.getUser('login').'[/b] перечислил вам '.plural($money, setting('moneyname')).''.PHP_EOL.'Примечание: '.$comment; + $message = 'Пользователь [b]' . getUser()->getProfile() . '[/b] перечислил вам '.plural($money, setting('moneyname')).''.PHP_EOL.'Примечание: '.$comment; // Уведомление по привату $this->user->sendMessage(getUser(), $message); From 6f31f31ea601240922a4b6586866e5afdfedfd92 Mon Sep 17 00:00:00 2001 From: visavi Date: Fri, 7 Sep 2018 21:43:11 +0300 Subject: [PATCH 022/163] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE=D0=BB=D0=BB?= =?UTF-8?q?=D0=B5=D1=80=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/CounterController.php | 7 +++---- app/Controllers/FileController.php | 5 ++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Controllers/CounterController.php b/app/Controllers/CounterController.php index 6476c5bad..5aa7bd10d 100644 --- a/app/Controllers/CounterController.php +++ b/app/Controllers/CounterController.php @@ -10,8 +10,10 @@ class CounterController extends BaseController { /** * Главная страница + * + * @return string */ - public function index() + public function index(): string { $count = statsCounter(); $online = statsOnline(); @@ -35,9 +37,6 @@ public function index() $counts31['labels'][] = date('M j', strtotime($curDate)); } - //var_dump() - - $counts24 = []; $counters = Counter24::query() ->whereRaw('period BETWEEN NOW() - INTERVAL 25 HOUR AND NOW()') diff --git a/app/Controllers/FileController.php b/app/Controllers/FileController.php index ad7e5648c..15e51a9e3 100644 --- a/app/Controllers/FileController.php +++ b/app/Controllers/FileController.php @@ -6,6 +6,10 @@ class FileController extends BaseController { /** * Главная страница + * + * @param string $action + * @param string $params + * @return string */ public function __call($action, $params) { @@ -24,6 +28,5 @@ public function __call($action, $params) } return view('files/layout', compact('action')); - } } From b3cd9624cea6283bbfc44b865de50454e0feba6f Mon Sep 17 00:00:00 2001 From: visavi Date: Sat, 8 Sep 2018 23:47:06 +0300 Subject: [PATCH 023/163] =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/GuestbookController.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/Controllers/GuestbookController.php b/app/Controllers/GuestbookController.php index ef86f89d0..36aba9a5f 100644 --- a/app/Controllers/GuestbookController.php +++ b/app/Controllers/GuestbookController.php @@ -12,8 +12,10 @@ class GuestbookController extends BaseController { /** * Главная страница + * + * @return string */ - public function index() + public function index(): string { $total = Guestbook::query()->count(); $page = paginate(setting('bookpost'), $total); @@ -30,8 +32,10 @@ public function index() /** * Добавление сообщения + * + * @return void */ - public function add() + public function add(): void { $msg = check(Request::input('msg')); $token = check(Request::input('token')); @@ -85,8 +89,11 @@ public function add() /** * Редактирование сообщения + * + * @param int $id + * @return string */ - public function edit($id) + public function edit($id): string { if (! getUser()) { abort(403); From 919c68fbc2324162c78daa541d59ad72d51bd122 Mon Sep 17 00:00:00 2001 From: visavi Date: Sun, 9 Sep 2018 22:53:37 +0300 Subject: [PATCH 024/163] =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/HomeController.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/Controllers/HomeController.php b/app/Controllers/HomeController.php index 0f32962a1..a4438e744 100644 --- a/app/Controllers/HomeController.php +++ b/app/Controllers/HomeController.php @@ -11,16 +11,20 @@ class HomeController extends BaseController { /** * Главная страница + * + * @return string */ - public function index() + public function index(): string { return view('index'); } /** * Закрытие сайта + * + * @return string */ - public function closed() + public function closed(): string { if (setting('closedsite') != 2) { redirect('/'); @@ -31,8 +35,11 @@ public function closed() /** * Бан по IP + * + * @return string + * @throws \Exception */ - public function banip() + public function banip(): string { header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden'); @@ -59,8 +66,11 @@ public function banip() /** * Защитная картинка + * + * @return void + * @throws \Exception */ - public function captcha() + public function captcha(): void { header('Content-type: image/jpeg'); $phrase = new PhraseBuilder; From 27cfc64bf4594b385c1f483767480c3b483bfbe5 Mon Sep 17 00:00:00 2001 From: visavi Date: Wed, 12 Sep 2018 22:21:51 +0300 Subject: [PATCH 025/163] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=20=D0=BA=D0=BE?= =?UTF-8?q?=D1=80=D0=BE=D0=BD=D1=8B=20=D1=80=D1=8F=D0=B4=D0=BE=D0=BC=20?= =?UTF-8?q?=D1=81=20=D0=BD=D0=B8=D0=BA=D0=BE=D0=BC=20=D0=B0=D0=B4=D0=BC?= =?UTF-8?q?=D0=B8=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/User.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Models/User.php b/app/Models/User.php index e0ea6bc06..9a62e3040 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -122,14 +122,19 @@ public function note() public function getProfile($color = null, $link = true): string { if ($this->id) { - $name = empty($this->name) ? $this->login : $this->name; + $admin = null; + $name = empty($this->name) ? $this->login : $this->name; if ($color) { $name = '' . $name . ''; } + if (\in_array($this->level, self::ADMIN_GROUPS, true)) { + $admin = ' '; + } + if ($link) { - return '' . $name . ''; + return '' . $name . '' . $admin; } return '' . $name . ''; From 5e2b93b49dc481235b544dfb36333b43e9f7838c Mon Sep 17 00:00:00 2001 From: visavi Date: Thu, 13 Sep 2018 23:21:08 +0300 Subject: [PATCH 026/163] =?UTF-8?q?=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B7=D0=B0=D0=B2=D0=B8=D1=81=D0=B8=D0=BC=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 22 +-- composer.lock | 361 +++++++++++++++++++++++++------------------------- 2 files changed, 192 insertions(+), 191 deletions(-) diff --git a/composer.json b/composer.json index 4dea57023..96bcd2349 100644 --- a/composer.json +++ b/composer.json @@ -19,16 +19,16 @@ "altorouter/altorouter": "~1.2", "cbschuld/browser.php": "dev-master", "gregwar/captcha": "^1.1", - "google/recaptcha": "~1.1", - "illuminate/http": "~5.6", - "illuminate/translation": "~5.6", - "illuminate/database": "~5.6", + "google/recaptcha": "~1.2", + "illuminate/http": "~5.7", + "illuminate/translation": "~5.7", + "illuminate/database": "~5.7", "mobiledetect/mobiledetectlib": "^2.8", - "php-ffmpeg/php-ffmpeg": "~0.11", - "swiftmailer/swiftmailer": "~6.0", - "vlucas/phpdotenv": "^2.4", + "php-ffmpeg/php-ffmpeg": "~0.12", + "swiftmailer/swiftmailer": "~6.1", + "vlucas/phpdotenv": "^2.5", "robmorgan/phinx": "^0.9", - "php-curl-class/php-curl-class": "^8.0", + "php-curl-class/php-curl-class": "^8.3", "jenssegers/blade": "^1.1", "visavi/cleanup": "^1.3", "visavi/crontask": "^1.1", @@ -36,9 +36,9 @@ "intervention/image": "^2.4" }, "require-dev": { - "filp/whoops": "^2.1", - "phpunit/phpunit": "^7.0", - "php-coveralls/php-coveralls": "^2.0" + "filp/whoops": "^2.2", + "phpunit/phpunit": "^7.3", + "php-coveralls/php-coveralls": "^2.1" }, "scripts": { "post-create-project-cmd": [ diff --git a/composer.lock b/composer.lock index 7eadaf58a..bb9a8410c 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": "f940bf2df42af36f47861e38b253503b", + "content-hash": "02cb96e61762c12bdf294b5b55cbc111", "packages": [ { "name": "alchemy/binary-driver", @@ -680,27 +680,27 @@ }, { "name": "illuminate/container", - "version": "v5.6.34", + "version": "v5.7.3", "source": { "type": "git", "url": "https://github.com/illuminate/container.git", - "reference": "1f0757cae8749400aeda730f6438a081fc3c082d" + "reference": "b2adca648536dfdfc13c2b93a2d717149794b682" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/container/zipball/1f0757cae8749400aeda730f6438a081fc3c082d", - "reference": "1f0757cae8749400aeda730f6438a081fc3c082d", + "url": "https://api.github.com/repos/illuminate/container/zipball/b2adca648536dfdfc13c2b93a2d717149794b682", + "reference": "b2adca648536dfdfc13c2b93a2d717149794b682", "shasum": "" }, "require": { - "illuminate/contracts": "5.6.*", + "illuminate/contracts": "5.7.*", "php": "^7.1.3", - "psr/container": "~1.0" + "psr/container": "^1.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.6-dev" + "dev-master": "5.7-dev" } }, "autoload": { @@ -720,31 +720,31 @@ ], "description": "The Illuminate Container package.", "homepage": "https://laravel.com", - "time": "2018-05-24T13:16:56+00:00" + "time": "2018-05-28T08:50:10+00:00" }, { "name": "illuminate/contracts", - "version": "v5.6.34", + "version": "v5.7.3", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "2c029101285f6066f45e3ae5910b1b5f900fdcb4" + "reference": "fd5d68eddfe49647f8354ac4c5f09cb88ccece7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/2c029101285f6066f45e3ae5910b1b5f900fdcb4", - "reference": "2c029101285f6066f45e3ae5910b1b5f900fdcb4", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/fd5d68eddfe49647f8354ac4c5f09cb88ccece7a", + "reference": "fd5d68eddfe49647f8354ac4c5f09cb88ccece7a", "shasum": "" }, "require": { "php": "^7.1.3", - "psr/container": "~1.0", - "psr/simple-cache": "~1.0" + "psr/container": "^1.0", + "psr/simple-cache": "^1.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.6-dev" + "dev-master": "5.7-dev" } }, "autoload": { @@ -764,40 +764,40 @@ ], "description": "The Illuminate Contracts package.", "homepage": "https://laravel.com", - "time": "2018-07-31T12:49:53+00:00" + "time": "2018-09-05T21:56:43+00:00" }, { "name": "illuminate/database", - "version": "v5.6.34", + "version": "v5.7.3", "source": { "type": "git", "url": "https://github.com/illuminate/database.git", - "reference": "741a80e84cc68739d8995bd5cf16586b485974d0" + "reference": "415c573e8c57bc6e17ecbe26a8744e9ed041af05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/database/zipball/741a80e84cc68739d8995bd5cf16586b485974d0", - "reference": "741a80e84cc68739d8995bd5cf16586b485974d0", + "url": "https://api.github.com/repos/illuminate/database/zipball/415c573e8c57bc6e17ecbe26a8744e9ed041af05", + "reference": "415c573e8c57bc6e17ecbe26a8744e9ed041af05", "shasum": "" }, "require": { - "illuminate/container": "5.6.*", - "illuminate/contracts": "5.6.*", - "illuminate/support": "5.6.*", + "illuminate/container": "5.7.*", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*", "php": "^7.1.3" }, "suggest": { - "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.6).", - "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", - "illuminate/console": "Required to use the database commands (5.6.*).", - "illuminate/events": "Required to use the observers with Eloquent (5.6.*).", - "illuminate/filesystem": "Required to use the migrations (5.6.*).", - "illuminate/pagination": "Required to paginate the result set (5.6.*)." + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", + "fzaninotto/faker": "Required to use the eloquent factory builder (^1.4).", + "illuminate/console": "Required to use the database commands (5.7.*).", + "illuminate/events": "Required to use the observers with Eloquent (5.7.*).", + "illuminate/filesystem": "Required to use the migrations (5.7.*).", + "illuminate/pagination": "Required to paginate the result set (5.7.*)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.6-dev" + "dev-master": "5.7-dev" } }, "autoload": { @@ -823,32 +823,32 @@ "orm", "sql" ], - "time": "2018-08-21T13:34:21+00:00" + "time": "2018-09-06T13:57:10+00:00" }, { "name": "illuminate/events", - "version": "v5.6.34", + "version": "v5.7.3", "source": { "type": "git", "url": "https://github.com/illuminate/events.git", - "reference": "5bdd8e84c0528970961289da088306c632eca8f7" + "reference": "ada2f80ea8d4a5933ded24f592b7940456a68be0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/events/zipball/5bdd8e84c0528970961289da088306c632eca8f7", - "reference": "5bdd8e84c0528970961289da088306c632eca8f7", + "url": "https://api.github.com/repos/illuminate/events/zipball/ada2f80ea8d4a5933ded24f592b7940456a68be0", + "reference": "ada2f80ea8d4a5933ded24f592b7940456a68be0", "shasum": "" }, "require": { - "illuminate/container": "5.6.*", - "illuminate/contracts": "5.6.*", - "illuminate/support": "5.6.*", + "illuminate/container": "5.7.*", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*", "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.6-dev" + "dev-master": "5.7-dev" } }, "autoload": { @@ -868,39 +868,39 @@ ], "description": "The Illuminate Events package.", "homepage": "https://laravel.com", - "time": "2018-07-23T01:01:28+00:00" + "time": "2018-07-26T15:27:42+00:00" }, { "name": "illuminate/filesystem", - "version": "v5.6.34", + "version": "v5.7.3", "source": { "type": "git", "url": "https://github.com/illuminate/filesystem.git", - "reference": "569904131813e4ac7051ae00bc1834063da562a6" + "reference": "2251e31e382ddcbbcb34fddc43e7cc0afa530be8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/filesystem/zipball/569904131813e4ac7051ae00bc1834063da562a6", - "reference": "569904131813e4ac7051ae00bc1834063da562a6", + "url": "https://api.github.com/repos/illuminate/filesystem/zipball/2251e31e382ddcbbcb34fddc43e7cc0afa530be8", + "reference": "2251e31e382ddcbbcb34fddc43e7cc0afa530be8", "shasum": "" }, "require": { - "illuminate/contracts": "5.6.*", - "illuminate/support": "5.6.*", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*", "php": "^7.1.3", - "symfony/finder": "~4.0" + "symfony/finder": "^4.1" }, "suggest": { - "league/flysystem": "Required to use the Flysystem local and FTP drivers (~1.0).", - "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).", - "league/flysystem-cached-adapter": "Required to use the Flysystem cache (~1.0).", - "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0).", - "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (~1.0)." + "league/flysystem": "Required to use the Flysystem local and FTP drivers (^1.0).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", + "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", + "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (^1.0).", + "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.6-dev" + "dev-master": "5.7-dev" } }, "autoload": { @@ -920,33 +920,33 @@ ], "description": "The Illuminate Filesystem package.", "homepage": "https://laravel.com", - "time": "2018-08-13T14:51:11+00:00" + "time": "2018-08-14T19:42:44+00:00" }, { "name": "illuminate/http", - "version": "v5.6.34", + "version": "v5.7.3", "source": { "type": "git", "url": "https://github.com/illuminate/http.git", - "reference": "2fca05297d519284f2b472e272571d987c2750b4" + "reference": "5bcf3e2d547a07bf98e0e71fa919fdaf513eee36" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/http/zipball/2fca05297d519284f2b472e272571d987c2750b4", - "reference": "2fca05297d519284f2b472e272571d987c2750b4", + "url": "https://api.github.com/repos/illuminate/http/zipball/5bcf3e2d547a07bf98e0e71fa919fdaf513eee36", + "reference": "5bcf3e2d547a07bf98e0e71fa919fdaf513eee36", "shasum": "" }, "require": { - "illuminate/session": "5.6.*", - "illuminate/support": "5.6.*", + "illuminate/session": "5.7.*", + "illuminate/support": "5.7.*", "php": "^7.1.3", - "symfony/http-foundation": "~4.0", - "symfony/http-kernel": "~4.0" + "symfony/http-foundation": "^4.1", + "symfony/http-kernel": "^4.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.6-dev" + "dev-master": "5.7-dev" } }, "autoload": { @@ -966,37 +966,37 @@ ], "description": "The Illuminate Http package.", "homepage": "https://laravel.com", - "time": "2018-08-15T13:07:48+00:00" + "time": "2018-08-28T08:47:30+00:00" }, { "name": "illuminate/session", - "version": "v5.6.34", + "version": "v5.7.3", "source": { "type": "git", "url": "https://github.com/illuminate/session.git", - "reference": "55b140532c12b6190177eb47d86a1369f6c5bd33" + "reference": "712f834c8b85a4f58ab40f56a359ac3e7e24c11a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/session/zipball/55b140532c12b6190177eb47d86a1369f6c5bd33", - "reference": "55b140532c12b6190177eb47d86a1369f6c5bd33", + "url": "https://api.github.com/repos/illuminate/session/zipball/712f834c8b85a4f58ab40f56a359ac3e7e24c11a", + "reference": "712f834c8b85a4f58ab40f56a359ac3e7e24c11a", "shasum": "" }, "require": { - "illuminate/contracts": "5.6.*", - "illuminate/filesystem": "5.6.*", - "illuminate/support": "5.6.*", + "illuminate/contracts": "5.7.*", + "illuminate/filesystem": "5.7.*", + "illuminate/support": "5.7.*", "php": "^7.1.3", - "symfony/finder": "~4.0", - "symfony/http-foundation": "~4.0" + "symfony/finder": "^4.1", + "symfony/http-foundation": "^4.1" }, "suggest": { - "illuminate/console": "Required to use the session:table command (5.6.*)." + "illuminate/console": "Required to use the session:table command (5.7.*)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.6-dev" + "dev-master": "5.7-dev" } }, "autoload": { @@ -1016,42 +1016,43 @@ ], "description": "The Illuminate Session package.", "homepage": "https://laravel.com", - "time": "2018-07-30T13:38:17+00:00" + "time": "2018-07-30T13:42:51+00:00" }, { "name": "illuminate/support", - "version": "v5.6.34", + "version": "v5.7.3", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "4eb12aa00bbf2d5e73c355ad404a9d0679879094" + "reference": "966c3198b5f82c00f8e5f7b6f16c35ffcb636acc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/4eb12aa00bbf2d5e73c355ad404a9d0679879094", - "reference": "4eb12aa00bbf2d5e73c355ad404a9d0679879094", + "url": "https://api.github.com/repos/illuminate/support/zipball/966c3198b5f82c00f8e5f7b6f16c35ffcb636acc", + "reference": "966c3198b5f82c00f8e5f7b6f16c35ffcb636acc", "shasum": "" }, "require": { - "doctrine/inflector": "~1.1", + "doctrine/inflector": "^1.1", "ext-mbstring": "*", - "illuminate/contracts": "5.6.*", - "nesbot/carbon": "^1.24.1", + "illuminate/contracts": "5.7.*", + "nesbot/carbon": "^1.26.3", "php": "^7.1.3" }, "conflict": { "tightenco/collect": "<5.5.33" }, "suggest": { - "illuminate/filesystem": "Required to use the composer class (5.6.*).", + "illuminate/filesystem": "Required to use the composer class (5.7.*).", + "moontoast/math": "Required to use ordered UUIDs (^1.1).", "ramsey/uuid": "Required to use Str::uuid() (^3.7).", - "symfony/process": "Required to use the composer class (~4.0).", - "symfony/var-dumper": "Required to use the dd function (~4.0)." + "symfony/process": "Required to use the composer class (^4.1).", + "symfony/var-dumper": "Required to use the dd function (^4.1)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.6-dev" + "dev-master": "5.7-dev" } }, "autoload": { @@ -1074,32 +1075,32 @@ ], "description": "The Illuminate Support package.", "homepage": "https://laravel.com", - "time": "2018-08-15T21:02:31+00:00" + "time": "2018-09-07T22:44:17+00:00" }, { "name": "illuminate/translation", - "version": "v5.6.34", + "version": "v5.7.3", "source": { "type": "git", "url": "https://github.com/illuminate/translation.git", - "reference": "add5b215599e6e02ec2568d67216aa012443b8d7" + "reference": "17baa5021eaed45cd193c47f9973092a6d3aed22" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/translation/zipball/add5b215599e6e02ec2568d67216aa012443b8d7", - "reference": "add5b215599e6e02ec2568d67216aa012443b8d7", + "url": "https://api.github.com/repos/illuminate/translation/zipball/17baa5021eaed45cd193c47f9973092a6d3aed22", + "reference": "17baa5021eaed45cd193c47f9973092a6d3aed22", "shasum": "" }, "require": { - "illuminate/contracts": "5.6.*", - "illuminate/filesystem": "5.6.*", - "illuminate/support": "5.6.*", + "illuminate/contracts": "5.7.*", + "illuminate/filesystem": "5.7.*", + "illuminate/support": "5.7.*", "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.6-dev" + "dev-master": "5.7-dev" } }, "autoload": { @@ -1119,35 +1120,35 @@ ], "description": "The Illuminate Translation package.", "homepage": "https://laravel.com", - "time": "2018-05-28T12:54:39+00:00" + "time": "2018-05-28T13:39:48+00:00" }, { "name": "illuminate/view", - "version": "v5.6.33", + "version": "v5.7.3", "source": { "type": "git", "url": "https://github.com/illuminate/view.git", - "reference": "8d4e1c4d8c133eaca33c94ee35b7c0d2ef1dc66f" + "reference": "5efdaf61535cfb53024ca1933bb8fa3cb016a4c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/view/zipball/8d4e1c4d8c133eaca33c94ee35b7c0d2ef1dc66f", - "reference": "8d4e1c4d8c133eaca33c94ee35b7c0d2ef1dc66f", + "url": "https://api.github.com/repos/illuminate/view/zipball/5efdaf61535cfb53024ca1933bb8fa3cb016a4c4", + "reference": "5efdaf61535cfb53024ca1933bb8fa3cb016a4c4", "shasum": "" }, "require": { - "illuminate/container": "5.6.*", - "illuminate/contracts": "5.6.*", - "illuminate/events": "5.6.*", - "illuminate/filesystem": "5.6.*", - "illuminate/support": "5.6.*", + "illuminate/container": "5.7.*", + "illuminate/contracts": "5.7.*", + "illuminate/events": "5.7.*", + "illuminate/filesystem": "5.7.*", + "illuminate/support": "5.7.*", "php": "^7.1.3", - "symfony/debug": "~4.0" + "symfony/debug": "^4.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.6-dev" + "dev-master": "5.7-dev" } }, "autoload": { @@ -1167,7 +1168,7 @@ ], "description": "The Illuminate View package.", "homepage": "https://laravel.com", - "time": "2018-07-19T23:06:53+00:00" + "time": "2018-09-03T09:36:57+00:00" }, { "name": "intervention/image", @@ -1289,16 +1290,16 @@ }, { "name": "mobiledetect/mobiledetectlib", - "version": "2.8.32", + "version": "2.8.33", "source": { "type": "git", "url": "https://github.com/serbanghita/Mobile-Detect.git", - "reference": "ec69a0c381b5fe44547680d3c7db6ced08e5abb3" + "reference": "cd385290f9a0d609d2eddd165a1e44ec1bf12102" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/ec69a0c381b5fe44547680d3c7db6ced08e5abb3", - "reference": "ec69a0c381b5fe44547680d3c7db6ced08e5abb3", + "url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/cd385290f9a0d609d2eddd165a1e44ec1bf12102", + "reference": "cd385290f9a0d609d2eddd165a1e44ec1bf12102", "shasum": "" }, "require": { @@ -1337,7 +1338,7 @@ "mobile detector", "php mobile detect" ], - "time": "2018-06-03T13:13:04+00:00" + "time": "2018-09-01T15:05:15+00:00" }, { "name": "monolog/monolog", @@ -1571,16 +1572,16 @@ }, { "name": "php-curl-class/php-curl-class", - "version": "8.3.0", + "version": "8.3.2", "source": { "type": "git", "url": "https://github.com/php-curl-class/php-curl-class.git", - "reference": "b5d9ec2120e4b27e4b2ec72fa9a302aa4e337fdf" + "reference": "3193b41dcd19025ad579ea26eb48774421d84708" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-curl-class/php-curl-class/zipball/b5d9ec2120e4b27e4b2ec72fa9a302aa4e337fdf", - "reference": "b5d9ec2120e4b27e4b2ec72fa9a302aa4e337fdf", + "url": "https://api.github.com/repos/php-curl-class/php-curl-class/zipball/3193b41dcd19025ad579ea26eb48774421d84708", + "reference": "3193b41dcd19025ad579ea26eb48774421d84708", "shasum": "" }, "require": { @@ -1632,7 +1633,7 @@ "web-service", "xml" ], - "time": "2018-08-18T18:02:12+00:00" + "time": "2018-09-09T07:05:39+00:00" }, { "name": "php-ffmpeg/php-ffmpeg", @@ -1985,16 +1986,16 @@ }, { "name": "swiftmailer/swiftmailer", - "version": "v6.1.2", + "version": "v6.1.3", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "7d760881d266d63c5e7a1155cbcf2ac656a31ca8" + "reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/7d760881d266d63c5e7a1155cbcf2ac656a31ca8", - "reference": "7d760881d266d63c5e7a1155cbcf2ac656a31ca8", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8ddcb66ac10c392d3beb54829eef8ac1438595f4", + "reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4", "shasum": "" }, "require": { @@ -2040,20 +2041,20 @@ "mail", "mailer" ], - "time": "2018-07-13T07:04:35+00:00" + "time": "2018-09-11T07:12:52+00:00" }, { "name": "symfony/config", - "version": "v4.1.3", + "version": "v4.1.4", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "c868972ac26e4e19860ce11b300bb74145246ff9" + "reference": "76015a3cc372b14d00040ff58e18e29f69eba717" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/c868972ac26e4e19860ce11b300bb74145246ff9", - "reference": "c868972ac26e4e19860ce11b300bb74145246ff9", + "url": "https://api.github.com/repos/symfony/config/zipball/76015a3cc372b14d00040ff58e18e29f69eba717", + "reference": "76015a3cc372b14d00040ff58e18e29f69eba717", "shasum": "" }, "require": { @@ -2103,11 +2104,11 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:24:31+00:00" + "time": "2018-08-08T06:37:38+00:00" }, { "name": "symfony/console", - "version": "v4.1.3", + "version": "v4.1.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", @@ -2175,16 +2176,16 @@ }, { "name": "symfony/debug", - "version": "v4.1.3", + "version": "v4.1.4", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "9316545571f079c4dd183e674721d9dc783ce196" + "reference": "47ead688f1f2877f3f14219670f52e4722ee7052" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/9316545571f079c4dd183e674721d9dc783ce196", - "reference": "9316545571f079c4dd183e674721d9dc783ce196", + "url": "https://api.github.com/repos/symfony/debug/zipball/47ead688f1f2877f3f14219670f52e4722ee7052", + "reference": "47ead688f1f2877f3f14219670f52e4722ee7052", "shasum": "" }, "require": { @@ -2227,11 +2228,11 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:24:31+00:00" + "time": "2018-08-03T11:13:38+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.1.3", + "version": "v4.1.4", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -2294,16 +2295,16 @@ }, { "name": "symfony/filesystem", - "version": "v4.1.3", + "version": "v4.1.4", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "2e30335e0aafeaa86645555959572fe7cea22b43" + "reference": "c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/2e30335e0aafeaa86645555959572fe7cea22b43", - "reference": "2e30335e0aafeaa86645555959572fe7cea22b43", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e", + "reference": "c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e", "shasum": "" }, "require": { @@ -2340,11 +2341,11 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:24:31+00:00" + "time": "2018-08-18T16:52:46+00:00" }, { "name": "symfony/finder", - "version": "v4.1.3", + "version": "v4.1.4", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -2393,16 +2394,16 @@ }, { "name": "symfony/http-foundation", - "version": "v4.1.3", + "version": "v4.1.4", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "7d93e3547660ec7ee3dad1428ba42e8076a0e5f1" + "reference": "3a5c91e133b220bb882b3cd773ba91bf39989345" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/7d93e3547660ec7ee3dad1428ba42e8076a0e5f1", - "reference": "7d93e3547660ec7ee3dad1428ba42e8076a0e5f1", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/3a5c91e133b220bb882b3cd773ba91bf39989345", + "reference": "3a5c91e133b220bb882b3cd773ba91bf39989345", "shasum": "" }, "require": { @@ -2443,20 +2444,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2018-08-01T14:07:44+00:00" + "time": "2018-08-27T17:47:02+00:00" }, { "name": "symfony/http-kernel", - "version": "v4.1.3", + "version": "v4.1.4", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "6347be5110efb27fe45ea04bf213078b67a05036" + "reference": "33de0a1ff2e1720096189e3ced682d7a4e8f5e35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/6347be5110efb27fe45ea04bf213078b67a05036", - "reference": "6347be5110efb27fe45ea04bf213078b67a05036", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/33de0a1ff2e1720096189e3ced682d7a4e8f5e35", + "reference": "33de0a1ff2e1720096189e3ced682d7a4e8f5e35", "shasum": "" }, "require": { @@ -2530,7 +2531,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2018-08-01T15:30:34+00:00" + "time": "2018-08-28T06:17:42+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2651,16 +2652,16 @@ }, { "name": "symfony/process", - "version": "v3.4.14", + "version": "v3.4.15", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "0414db29bd770ec5a4152683e655f55efd4fa60f" + "reference": "4d6b125d5293cbceedc2aa10f2c71617e76262e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/0414db29bd770ec5a4152683e655f55efd4fa60f", - "reference": "0414db29bd770ec5a4152683e655f55efd4fa60f", + "url": "https://api.github.com/repos/symfony/process/zipball/4d6b125d5293cbceedc2aa10f2c71617e76262e7", + "reference": "4d6b125d5293cbceedc2aa10f2c71617e76262e7", "shasum": "" }, "require": { @@ -2696,20 +2697,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:19:56+00:00" + "time": "2018-08-03T10:42:44+00:00" }, { "name": "symfony/translation", - "version": "v4.1.3", + "version": "v4.1.4", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "6fcd1bd44fd6d7181e6ea57a6f4e08a09b29ef65" + "reference": "fa2182669f7983b7aa5f1a770d053f79f0ef144f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/6fcd1bd44fd6d7181e6ea57a6f4e08a09b29ef65", - "reference": "6fcd1bd44fd6d7181e6ea57a6f4e08a09b29ef65", + "url": "https://api.github.com/repos/symfony/translation/zipball/fa2182669f7983b7aa5f1a770d053f79f0ef144f", + "reference": "fa2182669f7983b7aa5f1a770d053f79f0ef144f", "shasum": "" }, "require": { @@ -2765,20 +2766,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:24:31+00:00" + "time": "2018-08-07T12:45:11+00:00" }, { "name": "symfony/yaml", - "version": "v4.1.3", + "version": "v4.1.4", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "46bc69aa91fc4ab78a96ce67873a6b0c148fd48c" + "reference": "b832cc289608b6d305f62149df91529a2ab3c314" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/46bc69aa91fc4ab78a96ce67873a6b0c148fd48c", - "reference": "46bc69aa91fc4ab78a96ce67873a6b0c148fd48c", + "url": "https://api.github.com/repos/symfony/yaml/zipball/b832cc289608b6d305f62149df91529a2ab3c314", + "reference": "b832cc289608b6d305f62149df91529a2ab3c314", "shasum": "" }, "require": { @@ -2824,7 +2825,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:24:31+00:00" + "time": "2018-08-18T16:52:46+00:00" }, { "name": "visavi/cleanup", @@ -3024,16 +3025,16 @@ }, { "name": "filp/whoops", - "version": "2.2.0", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "181c4502d8f34db7aed7bfe88d4f87875b8e947a" + "reference": "e79cd403fb77fc8963a99ecc30e80ddd885b3311" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/181c4502d8f34db7aed7bfe88d4f87875b8e947a", - "reference": "181c4502d8f34db7aed7bfe88d4f87875b8e947a", + "url": "https://api.github.com/repos/filp/whoops/zipball/e79cd403fb77fc8963a99ecc30e80ddd885b3311", + "reference": "e79cd403fb77fc8963a99ecc30e80ddd885b3311", "shasum": "" }, "require": { @@ -3052,7 +3053,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.2-dev" } }, "autoload": { @@ -3081,7 +3082,7 @@ "throwable", "whoops" ], - "time": "2018-03-03T17:56:25+00:00" + "time": "2018-06-30T13:14:06+00:00" }, { "name": "guzzlehttp/guzzle", @@ -3898,16 +3899,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.3.2", + "version": "7.3.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "34705f81bddc3f505b9599a2ef96e2b4315ba9b8" + "reference": "7b331efabbb628c518c408fdfcaf571156775de2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/34705f81bddc3f505b9599a2ef96e2b4315ba9b8", - "reference": "34705f81bddc3f505b9599a2ef96e2b4315ba9b8", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7b331efabbb628c518c408fdfcaf571156775de2", + "reference": "7b331efabbb628c518c408fdfcaf571156775de2", "shasum": "" }, "require": { @@ -3978,7 +3979,7 @@ "testing", "xunit" ], - "time": "2018-08-22T06:39:21+00:00" + "time": "2018-09-08T15:14:29+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -4545,7 +4546,7 @@ }, { "name": "symfony/stopwatch", - "version": "v4.1.3", + "version": "v4.1.4", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", From cd8316e06bf4f1f9f6abee723981c6063d573c81 Mon Sep 17 00:00:00 2001 From: visavi Date: Sat, 15 Sep 2018 12:40:53 +0300 Subject: [PATCH 027/163] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=B7=D0=B0=D0=BA=D0=BB=D0=B0=D0=B4=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/forums/{bookmark.blade.php => bookmarks.blade.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename resources/views/forums/{bookmark.blade.php => bookmarks.blade.php} (100%) diff --git a/resources/views/forums/bookmark.blade.php b/resources/views/forums/bookmarks.blade.php similarity index 100% rename from resources/views/forums/bookmark.blade.php rename to resources/views/forums/bookmarks.blade.php From b96ffde3764a6c799d8adf5349b8557b2d017561 Mon Sep 17 00:00:00 2001 From: visavi Date: Sat, 15 Sep 2018 13:44:13 +0300 Subject: [PATCH 028/163] =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5?= =?UTF-8?q?=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=BE=D0=BD=D0=B5=D0=BD=D1=82=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/app/_upload.blade.php | 2 +- resources/views/boards/index.blade.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/app/_upload.blade.php b/resources/views/app/_upload.blade.php index 352a1c579..2999bc1d9 100644 --- a/resources/views/app/_upload.blade.php +++ b/resources/views/app/_upload.blade.php @@ -22,7 +22,7 @@
diff --git a/resources/views/boards/index.blade.php b/resources/views/boards/index.blade.php index c798ea4d8..993511e94 100644 --- a/resources/views/boards/index.blade.php +++ b/resources/views/boards/index.blade.php @@ -8,7 +8,7 @@ @if (getUser())
@endif From e2ecc25ea6426a1854b02ebc87a1823c099f83f7 Mon Sep 17 00:00:00 2001 From: visavi Date: Sun, 16 Sep 2018 13:39:36 +0300 Subject: [PATCH 029/163] =?UTF-8?q?=D0=9E=D0=BF=D0=B8=D1=81=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=B2=20=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D1=8F=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/WallController.php | 21 ++++++++++---- app/Models/Antimat.php | 8 +++++- app/Models/Ban.php | 8 ++++++ app/Models/Banhist.php | 19 ++++++++---- app/Models/BaseModel.php | 5 +++- app/Models/BlackList.php | 5 ++++ app/Models/Blog.php | 46 ++++++++++++++++++++++++------ app/Models/Board.php | 17 +++++++++-- app/Models/Bookmark.php | 12 ++++++-- app/Models/Category.php | 21 +++++++++++--- app/Models/ChangeMail.php | 5 ++++ app/Models/Chat.php | 11 ++++++- app/Models/Comment.php | 5 ++++ app/Models/Contact.php | 11 ++++++- app/Models/Counter.php | 5 ++++ app/Models/Counter24.php | 5 ++++ app/Models/Counter31.php | 5 ++++ app/Models/Down.php | 31 ++++++++++++++------ app/Models/Error.php | 5 ++++ app/Models/File.php | 15 ++++++++-- app/Models/Flood.php | 9 ++++-- app/Models/Forum.php | 20 +++++++++++-- app/Models/Guestbook.php | 11 ++++++- app/Models/Ignore.php | 11 ++++++- app/Models/Inbox.php | 11 ++++++- app/Models/Invite.php | 11 ++++++- app/Models/Item.php | 20 +++++++++---- app/Models/Load.php | 21 +++++++++++--- app/Models/Log.php | 5 ++++ app/Models/Login.php | 5 ++++ app/Models/Mailing.php | 5 ++++ app/Models/News.php | 11 +++++-- app/Models/Note.php | 11 ++++++- app/Models/Notebook.php | 5 ++++ app/Models/Notice.php | 5 ++++ app/Models/Offer.php | 39 ++++++++++++++++--------- app/Models/Online.php | 5 ++++ app/Models/Outbox.php | 11 ++++++- app/Models/Photo.php | 17 +++++++++-- app/Models/Polling.php | 5 ++++ app/Models/Post.php | 22 ++++++++++---- app/Models/Rating.php | 11 ++++++- app/Models/Reader.php | 12 ++++---- app/Models/RekUser.php | 5 ++++ app/Models/Rule.php | 5 ++++ app/Models/Setting.php | 7 ++++- app/Models/Smile.php | 5 ++++ app/Models/Social.php | 5 ++++ app/Models/Spam.php | 11 ++++++- app/Models/Status.php | 5 ++++ app/Models/Surprise.php | 5 ++++ app/Models/Topic.php | 33 ++++++++++++++++----- app/Models/Transfer.php | 11 ++++++- app/Models/User.php | 27 +++++++++++++----- app/Models/Vote.php | 19 ++++++++++-- app/Models/VoteAnswer.php | 5 ++++ app/Models/Wall.php | 11 ++++++- app/helpers.php | 7 +++-- 58 files changed, 585 insertions(+), 119 deletions(-) diff --git a/app/Controllers/WallController.php b/app/Controllers/WallController.php index 74b9a664f..c3b183fe1 100644 --- a/app/Controllers/WallController.php +++ b/app/Controllers/WallController.php @@ -14,8 +14,11 @@ class WallController extends BaseController { /** * Главная страница + * + * @param string $login + * @return string */ - public function index($login) + public function index($login): string { $user = User::query()->where('login', $login)->first(); @@ -35,7 +38,7 @@ public function index($login) ->with('user', 'author') ->get(); - if ($newWall && $user->id == getUser('id')) { + if ($newWall && $user->id === getUser('id')) { $user->update([ 'newwall' => 0, ]); @@ -46,8 +49,11 @@ public function index($login) /** * Добавление сообщения + * + * @param string $login + * @return void */ - public function create($login) + public function create($login): void { if (! getUser()) { abort(403, 'Для отправки сообщений необходимо авторизоваться!'); @@ -77,7 +83,7 @@ public function create($login) if ($validator->isValid()) { - if ($user->id != getUser('id')) { + if ($user->id !== getUser('id')) { $user->increment('newwall'); } @@ -109,8 +115,11 @@ public function create($login) /** * Удаление сообщений + * + * @param string $login + * @return void */ - public function delete($login) + public function delete($login): void { $id = int(Request::input('id')); $token = check(Request::input('token')); @@ -123,7 +132,7 @@ public function delete($login) ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($id, 'Не выбрана запись для удаление!') ->notEmpty($user, 'Пользователь не найден!') - ->true((isAdmin() || $user->id == getUser('id')), 'Записи может удалять только владелец и администрация!'); + ->true(isAdmin() || $user->id === getUser('id'), 'Записи может удалять только владелец и администрация!'); if ($validator->isValid()) { diff --git a/app/Models/Antimat.php b/app/Models/Antimat.php index b1e51209c..c7ef09111 100644 --- a/app/Models/Antimat.php +++ b/app/Models/Antimat.php @@ -4,6 +4,12 @@ use Illuminate\Database\Capsule\Manager as DB; +/** + * Class Antimat + * + * @property int id + * @property string string + */ class Antimat extends BaseModel { /** @@ -33,7 +39,7 @@ class Antimat extends BaseModel * @param string $str строка * @return string обработанная строка */ - public static function replace($str) + public static function replace($str): string { $words = self::query() ->orderBy(DB::raw('CHAR_LENGTH(string)'), 'desc') diff --git a/app/Models/Ban.php b/app/Models/Ban.php index c6637db24..8c2807da9 100644 --- a/app/Models/Ban.php +++ b/app/Models/Ban.php @@ -2,6 +2,14 @@ namespace App\Models; +/** + * Class Ban + * + * @property int id + * @property string ip + * @property int user_id + * @property int created_at + */ class Ban extends BaseModel { /** diff --git a/app/Models/Banhist.php b/app/Models/Banhist.php index a400ef519..0c66f968c 100644 --- a/app/Models/Banhist.php +++ b/app/Models/Banhist.php @@ -2,6 +2,13 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + +/** + * Class Banhist + * + * @property int id + */ class Banhist extends BaseModel { /** @@ -28,14 +35,16 @@ class Banhist extends BaseModel /** * Типы банов */ - const BAN = 'ban'; // Бан - const UNBAN = 'unban'; // Разбан - const CHANGE = 'change'; // Изменение + public const BAN = 'ban'; // Бан + public const UNBAN = 'unban'; // Разбан + public const CHANGE = 'change'; // Изменение /** * Возвращает связь пользователей + * + * @return BelongsTo */ - public function sendUser() + public function sendUser(): BelongsTo { return $this->belongsTo(User::class, 'send_user_id')->withDefault(); } @@ -45,7 +54,7 @@ public function sendUser() * * @return string тип бана */ - public function getType() + public function getType(): string { switch ($this->type) { case self::BAN: diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php index 3ed4b4d2b..1775a16be 100644 --- a/app/Models/BaseModel.php +++ b/app/Models/BaseModel.php @@ -3,6 +3,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Http\UploadedFile; use Intervention\Image\ImageManagerStatic as Image; @@ -24,8 +25,10 @@ class BaseModel extends Model /** * Возвращает связь пользователей + * + * @return BelongsTo */ - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class, 'user_id')->withDefault(); } diff --git a/app/Models/BlackList.php b/app/Models/BlackList.php index a6d27c534..e0c1904ab 100644 --- a/app/Models/BlackList.php +++ b/app/Models/BlackList.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class BlackList + * + * @property int id + */ class BlackList extends BaseModel { /** diff --git a/app/Models/Blog.php b/app/Models/Blog.php index df2903f72..3d5b0e127 100644 --- a/app/Models/Blog.php +++ b/app/Models/Blog.php @@ -2,9 +2,26 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\MorphMany; + +/** + * Class Blog + * + * @property int id + * @property int category_id + * @property int user_id + * @property string title + * @property string text + * @property string tags + * @property int rating + * @property int visits + * @property int count_comments + * @property int created_at + */ class Blog extends BaseModel { - /** * Indicates if the model should be timestamped. * @@ -26,12 +43,21 @@ class Blog extends BaseModel */ public $uploadPath = UPLOADS . '/blogs'; + /** + * The attributes that should be cast to native types. + * + * @var array + */ + protected $casts = [ + 'user_id' => 'int', + ]; + /** * Возвращает комментарии блогов * - * @return \Illuminate\Database\Eloquent\Relations\MorphMany + * @return MorphMany */ - public function comments() + public function comments(): MorphMany { return $this->morphMany(Comment::class, 'relate'); } @@ -40,9 +66,9 @@ public function comments() * Возвращает последнии комментарии к статье * * @param int $limit - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ - public function lastComments($limit = 15) + public function lastComments($limit = 15): HasMany { return $this->hasMany(Comment::class, 'relate_id') ->where('relate_type', self::class) @@ -52,17 +78,19 @@ public function lastComments($limit = 15) /** * Возвращает связь категории блога * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + * @return BelongsTo */ - public function category() + public function category(): BelongsTo { return $this->belongsTo(Category::class, 'category_id')->withDefault(); } /** * Возвращает загруженные файлы + * + * @return MorphMany */ - public function files() + public function files(): MorphMany { return $this->morphMany(File::class, 'relate'); } @@ -98,7 +126,7 @@ public static function logTagSize($count, $minCount, $maxCount, $minSize = 10, $ * @return bool|null * @throws \Exception */ - public function delete() + public function delete(): ?bool { $this->files->each(function($file) { deleteFile(HOME . $file->hash); diff --git a/app/Models/Board.php b/app/Models/Board.php index faa5ff4a2..94de025a1 100644 --- a/app/Models/Board.php +++ b/app/Models/Board.php @@ -2,9 +2,16 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; + +/** + * Class Board + * + * @property int id + */ class Board extends BaseModel { - /** * Indicates if the model should be timestamped. * @@ -28,16 +35,20 @@ class Board extends BaseModel /** * Возвращает связь родительской категории + * + * @return BelongsTo */ - public function parent() + public function parent(): BelongsTo { return $this->belongsTo(self::class, 'parent_id')->withDefault(); } /** * Возвращает связь подкатегорий + * + * @return HasMany */ - public function children() + public function children(): HasMany { return $this->hasMany(self::class, 'parent_id')->orderBy('sort'); } diff --git a/app/Models/Bookmark.php b/app/Models/Bookmark.php index 56992d495..f1ef50aa8 100644 --- a/app/Models/Bookmark.php +++ b/app/Models/Bookmark.php @@ -2,9 +2,15 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + +/** + * Class Bookmark + * + * @property int id + */ class Bookmark extends BaseModel { - /** * Indicates if the model should be timestamped. * @@ -21,8 +27,10 @@ class Bookmark extends BaseModel /** * Возвращает топик + * + * @return BelongsTo */ - public function topic() + public function topic(): BelongsTo { return $this->belongsTo(Topic::class, 'topic_id')->withDefault(); } diff --git a/app/Models/Category.php b/app/Models/Category.php index 2eae0467a..4aac280fa 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -2,6 +2,15 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\HasOne; + +/** + * Class Category + * + * @property int id + */ class Category extends BaseModel { /** @@ -20,16 +29,20 @@ class Category extends BaseModel /** * Возвращает связь родительской категории + * + * @return BelongsTo */ - public function parent() + public function parent(): BelongsTo { return $this->belongsTo(self::class, 'parent_id')->withDefault(); } /** * Возвращает связь подкатегорий + * + * @return HasMany */ - public function children() + public function children(): HasMany { return $this->hasMany(self::class, 'parent_id')->orderBy('sort'); } @@ -37,9 +50,9 @@ public function children() /** * Возвращает количество статей за последние 3 дня * - * @return mixed + * @return hasOne */ - public function new() + public function new(): hasOne { return $this->hasOne(Blog::class, 'category_id') ->selectRaw('category_id, count(*) as count_blogs') diff --git a/app/Models/ChangeMail.php b/app/Models/ChangeMail.php index e66d3c9f2..e899cdbd8 100644 --- a/app/Models/ChangeMail.php +++ b/app/Models/ChangeMail.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class ChangeMail + * + * @property int id + */ class ChangeMail extends BaseModel { /** diff --git a/app/Models/Chat.php b/app/Models/Chat.php index 514da7fc1..cc8dd5cb5 100644 --- a/app/Models/Chat.php +++ b/app/Models/Chat.php @@ -2,6 +2,13 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + +/** + * Class Chat + * + * @property int id + */ class Chat extends BaseModel { /** @@ -20,8 +27,10 @@ class Chat extends BaseModel /** * Возвращает связь пользователей + * + * @return BelongsTo */ - public function editUser() + public function editUser(): BelongsTo { return $this->belongsTo(User::class, 'edit_user_id')->withDefault(); } diff --git a/app/Models/Comment.php b/app/Models/Comment.php index 142137c85..33f11028b 100644 --- a/app/Models/Comment.php +++ b/app/Models/Comment.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Comment + * + * @property int id + */ class Comment extends BaseModel { /** diff --git a/app/Models/Contact.php b/app/Models/Contact.php index d604bd0cb..ecb87fb11 100644 --- a/app/Models/Contact.php +++ b/app/Models/Contact.php @@ -2,6 +2,13 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + +/** + * Class Contact + * + * @property int id + */ class Contact extends BaseModel { /** @@ -20,8 +27,10 @@ class Contact extends BaseModel /** * Возвращает связь пользователей + * + * @return BelongsTo */ - public function contactor() + public function contactor(): BelongsTo { return $this->belongsTo(User::class, 'contact_id')->withDefault(); } diff --git a/app/Models/Counter.php b/app/Models/Counter.php index fb824ab50..a75c7fe53 100644 --- a/app/Models/Counter.php +++ b/app/Models/Counter.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Counter + * + * @property int id + */ class Counter extends BaseModel { /** diff --git a/app/Models/Counter24.php b/app/Models/Counter24.php index aea652e78..977b707a7 100644 --- a/app/Models/Counter24.php +++ b/app/Models/Counter24.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Counter24 + * + * @property int id + */ class Counter24 extends BaseModel { /** diff --git a/app/Models/Counter31.php b/app/Models/Counter31.php index 074dc74e9..4e93ae2bd 100644 --- a/app/Models/Counter31.php +++ b/app/Models/Counter31.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Counter31 + * + * @property int id + */ class Counter31 extends BaseModel { /** diff --git a/app/Models/Down.php b/app/Models/Down.php index 936ce8341..ab8c42d22 100644 --- a/app/Models/Down.php +++ b/app/Models/Down.php @@ -6,8 +6,17 @@ use FFMpeg\FFMpeg; use FFMpeg\FFProbe; use FFMpeg\Format\Video\X264; +use Illuminate\Database\Eloquent\Collection; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Http\UploadedFile; +/** + * Class Down + * + * @property int id + */ class Down extends BaseModel { /** @@ -40,8 +49,10 @@ class Down extends BaseModel /** * Возвращает категорию загрузок + * + * @return BelongsTo */ - public function category() + public function category(): BelongsTo { return $this->belongsTo(Load::class, 'category_id')->withDefault(); } @@ -49,7 +60,7 @@ public function category() /** * Возвращает комментарии */ - public function comments() + public function comments(): MorphMany { return $this->morphMany(Comment::class, 'relate'); } @@ -58,9 +69,9 @@ public function comments() * Возвращает последнии комментарии к файлу * * @param int $limit - * @return mixed + * @return HasMany */ - public function lastComments($limit = 15) + public function lastComments($limit = 15): HasMany { return $this->hasMany(Comment::class, 'relate_id') ->where('relate_type', self::class) @@ -70,15 +81,17 @@ public function lastComments($limit = 15) /** * Возвращает загруженные файлы */ - public function files() + public function files(): MorphMany { return $this->morphMany(File::class, 'relate'); } /** * Возвращает файлы + * + * @return Collection */ - public function getFiles() + public function getFiles(): Collection { return $this->files->filter(function ($value, $key) { return ! $value->isImage(); @@ -87,8 +100,10 @@ public function getFiles() /** * Возвращает картинки + * + * @return Collection */ - public function getImages() + public function getImages(): Collection { return $this->files->filter(function ($value, $key) { return $value->isImage(); @@ -103,7 +118,7 @@ public function getImages() */ public function cutText($limit = 200): string { - if (strlen($this->text) > $limit) { + if (\strlen($this->text) > $limit) { $this->text = strip_tags(bbCode($this->text), '
'); $this->text = mb_substr($this->text, 0, mb_strrpos(mb_substr($this->text, 0, $limit), ' ')) . '...'; } diff --git a/app/Models/Error.php b/app/Models/Error.php index c64505d28..519604ea0 100644 --- a/app/Models/Error.php +++ b/app/Models/Error.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Error + * + * @property int id + */ class Error extends BaseModel { /** diff --git a/app/Models/File.php b/app/Models/File.php index 728fa4266..7077e7ada 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -2,6 +2,13 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\MorphTo; + +/** + * Class File + * + * @property int id + */ class File extends BaseModel { /** @@ -20,8 +27,10 @@ class File extends BaseModel /** * Возвращает связанные модели + * + * @return MorphTo */ - public function relate() + public function relate(): MorphTo { return $this->morphTo('relate'); } @@ -31,7 +40,7 @@ public function relate() * * @return string */ - public function getExtensionAttribute() + public function getExtensionAttribute(): string { return getExtension($this->hash); } @@ -41,7 +50,7 @@ public function getExtensionAttribute() * * @return string */ - public function isImage() + public function isImage(): string { return \in_array($this->extension, ['jpg', 'jpeg', 'gif', 'png']); } diff --git a/app/Models/Flood.php b/app/Models/Flood.php index 1a2d1caa9..09f141add 100644 --- a/app/Models/Flood.php +++ b/app/Models/Flood.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Flood + * + * @property int id + */ class Flood extends BaseModel { /** @@ -23,7 +28,7 @@ class Flood extends BaseModel * * @return int */ - public static function getPeriod() + public static function getPeriod(): int { if (isAdmin()) { return 0; @@ -52,7 +57,7 @@ public static function getPeriod() * @param int $period * @return bool */ - public static function isFlood($period = 0) + public static function isFlood($period = 0): bool { $userId = getUser('id'); $period = $period ?: self::getPeriod(); diff --git a/app/Models/Forum.php b/app/Models/Forum.php index 5f11110ab..c242e06ee 100644 --- a/app/Models/Forum.php +++ b/app/Models/Forum.php @@ -2,6 +2,14 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; + +/** + * Class Forum + * + * @property int id + */ class Forum extends BaseModel { /** @@ -20,24 +28,30 @@ class Forum extends BaseModel /** * Возвращает связь родительского форума + * + * @return BelongsTo */ - public function parent() + public function parent(): BelongsTo { return $this->belongsTo(self::class, 'parent_id')->withDefault(); } /** * Возвращает связь подкатегорий форума + * + * @return HasMany */ - public function children() + public function children(): HasMany { return $this->hasMany(self::class, 'parent_id')->orderBy('sort'); } /** * Возвращает связь последней темы + * + * @return BelongsTo */ - public function lastTopic() + public function lastTopic(): BelongsTo { return $this->belongsTo(Topic::class, 'last_topic_id')->withDefault(); } diff --git a/app/Models/Guestbook.php b/app/Models/Guestbook.php index 37ef8c698..04d57e782 100644 --- a/app/Models/Guestbook.php +++ b/app/Models/Guestbook.php @@ -2,6 +2,13 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + +/** + * Class Guestbook + * + * @property int id + */ class Guestbook extends BaseModel { /** @@ -20,8 +27,10 @@ class Guestbook extends BaseModel /** * Возвращает связь пользователей + * + * @return BelongsTo */ - public function editUser() + public function editUser(): BelongsTo { return $this->belongsTo(User::class, 'edit_user_id')->withDefault(); } diff --git a/app/Models/Ignore.php b/app/Models/Ignore.php index 3425a5cf1..80695362a 100644 --- a/app/Models/Ignore.php +++ b/app/Models/Ignore.php @@ -2,6 +2,13 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + +/** + * Class Ignore + * + * @property int id + */ class Ignore extends BaseModel { /** @@ -27,8 +34,10 @@ class Ignore extends BaseModel /** * Возвращает связь пользователей + * + * @return BelongsTo */ - public function ignoring() + public function ignoring(): BelongsTo { return $this->belongsTo(User::class, 'ignore_id')->withDefault(); } diff --git a/app/Models/Inbox.php b/app/Models/Inbox.php index a7d841cc7..897f9f49a 100644 --- a/app/Models/Inbox.php +++ b/app/Models/Inbox.php @@ -2,6 +2,13 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + +/** + * Class Inbox + * + * @property int id + */ class Inbox extends BaseModel { /** @@ -27,8 +34,10 @@ class Inbox extends BaseModel /** * Возвращает связь пользователей + * + * @return BelongsTo */ - public function author() + public function author(): BelongsTo { return $this->belongsTo(User::class, 'author_id')->withDefault(); } diff --git a/app/Models/Invite.php b/app/Models/Invite.php index 45caa0b54..306519c0f 100644 --- a/app/Models/Invite.php +++ b/app/Models/Invite.php @@ -2,6 +2,13 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + +/** + * Class Invite + * + * @property int id + */ class Invite extends BaseModel { /** @@ -27,8 +34,10 @@ class Invite extends BaseModel /** * Возвращает связь пользователей + * + * @return BelongsTo */ - public function inviteUser() + public function inviteUser(): BelongsTo { return $this->belongsTo(User::class, 'invite_user_id')->withDefault(); } diff --git a/app/Models/Item.php b/app/Models/Item.php index c5c9a5f93..3f66e2b9d 100644 --- a/app/Models/Item.php +++ b/app/Models/Item.php @@ -2,8 +2,14 @@ namespace App\Models; -use Illuminate\Http\UploadedFile; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\MorphMany; +/** + * Class Item + * + * @property int id + */ class Item extends BaseModel { @@ -30,8 +36,10 @@ class Item extends BaseModel /** * Возвращает категорию объявлений + * + * @return BelongsTo */ - public function category() + public function category(): BelongsTo { return $this->belongsTo(Board::class, 'board_id')->withDefault(); } @@ -39,7 +47,7 @@ public function category() /** * Возвращает загруженные файлы */ - public function files() + public function files(): MorphMany { return $this->morphMany(File::class, 'relate'); } @@ -63,9 +71,9 @@ public function getFirstImage() * @param int $limit * @return string */ - public function cutText($limit = 200) + public function cutText($limit = 200): string { - if (strlen($this->text) > $limit) { + if (\strlen($this->text) > $limit) { $this->text = strip_tags(bbCode($this->text), '
'); $this->text = mb_substr($this->text, 0, mb_strrpos(mb_substr($this->text, 0, $limit), ' ')) . '...'; } @@ -79,7 +87,7 @@ public function cutText($limit = 200) * @return bool|null * @throws \Exception */ - public function delete() + public function delete(): ?bool { $this->files->each(function($file) { deleteFile(HOME . $file->hash); diff --git a/app/Models/Load.php b/app/Models/Load.php index 42210ad52..dee767814 100644 --- a/app/Models/Load.php +++ b/app/Models/Load.php @@ -2,6 +2,15 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\HasOne; + +/** + * Class Load + * + * @property int id + */ class Load extends BaseModel { /** @@ -20,16 +29,20 @@ class Load extends BaseModel /** * Возвращает связь родительской категории + * + * @return BelongsTo */ - public function parent() + public function parent(): BelongsTo { return $this->belongsTo(self::class, 'parent_id')->withDefault(); } /** * Возвращает связь подкатегорий + * + * @return HasMany */ - public function children() + public function children(): HasMany { return $this->hasMany(self::class, 'parent_id')->orderBy('sort'); } @@ -37,9 +50,9 @@ public function children() /** * Возвращает количество загрузок за последние 3 дней * - * @return mixed + * @return hasOne */ - public function new() + public function new(): hasOne { return $this->hasOne(Down::class, 'category_id') ->selectRaw('category_id, count(*) as count_downs') diff --git a/app/Models/Log.php b/app/Models/Log.php index 7edd9c34a..5386f3d90 100644 --- a/app/Models/Log.php +++ b/app/Models/Log.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Log + * + * @property int id + */ class Log extends BaseModel { /** diff --git a/app/Models/Login.php b/app/Models/Login.php index 9ffbc81b6..b01c463e5 100644 --- a/app/Models/Login.php +++ b/app/Models/Login.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Login + * + * @property int id + */ class Login extends BaseModel { /** diff --git a/app/Models/Mailing.php b/app/Models/Mailing.php index 6ee9a81d8..6162bbd19 100644 --- a/app/Models/Mailing.php +++ b/app/Models/Mailing.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Mailing + * + * @property int id + */ class Mailing extends BaseModel { /** diff --git a/app/Models/News.php b/app/Models/News.php index e4b3ceaa8..9a7d2d9b7 100644 --- a/app/Models/News.php +++ b/app/Models/News.php @@ -2,6 +2,13 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\MorphMany; + +/** + * Class News + * + * @property int id + */ class News extends BaseModel { /** @@ -35,7 +42,7 @@ class News extends BaseModel /** * Возвращает комментарии новостей */ - public function comments() + public function comments(): MorphMany { return $this->morphMany(Comment::class, 'relate'); } @@ -62,7 +69,7 @@ public function getIcon(): string */ public function shortText(): string { - if (stristr($this->text, '[cut]')) { + if (stripos($this->text, '[cut]') !== false) { $this->text = current(explode('[cut]', $this->text)) . ' Читать далее »'; } diff --git a/app/Models/Note.php b/app/Models/Note.php index 7f0494902..f8a0e7026 100644 --- a/app/Models/Note.php +++ b/app/Models/Note.php @@ -2,6 +2,13 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + +/** + * Class Note + * + * @property int id + */ class Note extends BaseModel { /** @@ -20,8 +27,10 @@ class Note extends BaseModel /** * Возвращает связь пользователей + * + * @return BelongsTo */ - public function editUser() + public function editUser(): BelongsTo { return $this->belongsTo(User::class, 'edit_user_id')->withDefault(); } diff --git a/app/Models/Notebook.php b/app/Models/Notebook.php index 1c83a2a7b..c33e7a063 100644 --- a/app/Models/Notebook.php +++ b/app/Models/Notebook.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Notebook + * + * @property int id + */ class Notebook extends BaseModel { /** diff --git a/app/Models/Notice.php b/app/Models/Notice.php index 0c11a027c..8e4c8920e 100644 --- a/app/Models/Notice.php +++ b/app/Models/Notice.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Notice + * + * @property int id + */ class Notice extends BaseModel { /** diff --git a/app/Models/Offer.php b/app/Models/Offer.php index a6309a1df..db2ec7225 100644 --- a/app/Models/Offer.php +++ b/app/Models/Offer.php @@ -2,30 +2,39 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\MorphOne; + +/** + * Class Offer + * + * @property int id + */ class Offer extends BaseModel { - const DONE = 'done'; - const WAIT = 'wait'; - const CANCEL = 'cancel'; - const PROCESS = 'process'; + public const DONE = 'done'; + public const WAIT = 'wait'; + public const CANCEL = 'cancel'; + public const PROCESS = 'process'; /** * Статусы */ - const STATUSES = [ + public const STATUSES = [ self::DONE => 'Выполнено', self::WAIT => 'Под вопросом', self::CANCEL => 'Закрыто', self::PROCESS => 'В процессе', ]; - const OFFER = 'offer'; - const ISSUE = 'issue'; + public const OFFER = 'offer'; + public const ISSUE = 'issue'; /** * Типы */ - const TYPES = [ + public const TYPES = [ self::OFFER => 'Предложения', self::ISSUE => 'Проблемы', ]; @@ -47,16 +56,20 @@ class Offer extends BaseModel /** * Возвращает связь с голосованием + * + * @return morphOne */ - public function polling() + public function polling(): morphOne { return $this->morphOne(Polling::class, 'relate')->where('user_id', getUser('id')); } /** * Возвращает связь пользователей + * + * @return BelongsTo */ - public function replyUser() + public function replyUser(): BelongsTo { return $this->belongsTo(User::class, 'reply_user_id')->withDefault(); } @@ -65,9 +78,9 @@ public function replyUser() * Возвращает последнии комментарии * * @param int $limit - * @return mixed + * @return HasMany */ - public function lastComments($limit = 15) + public function lastComments($limit = 15): HasMany { return $this->hasMany(Comment::class, 'relate_id') ->where('relate_type', self::class) @@ -81,7 +94,7 @@ public function lastComments($limit = 15) * * @return string */ - public function getStatus() + public function getStatus(): string { switch ($this->status) { case 'process': diff --git a/app/Models/Online.php b/app/Models/Online.php index 51594aaf0..2f0e8b632 100644 --- a/app/Models/Online.php +++ b/app/Models/Online.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Online + * + * @property int id + */ class Online extends BaseModel { /** diff --git a/app/Models/Outbox.php b/app/Models/Outbox.php index 1dafc8bca..bdc037f7d 100644 --- a/app/Models/Outbox.php +++ b/app/Models/Outbox.php @@ -2,6 +2,13 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + +/** + * Class Outbox + * + * @property int id + */ class Outbox extends BaseModel { /** @@ -27,8 +34,10 @@ class Outbox extends BaseModel /** * Возвращает связь пользователей + * + * @return BelongsTo */ - public function recipient() + public function recipient(): BelongsTo { return $this->belongsTo(User::class, 'recipient_id')->withDefault(); } diff --git a/app/Models/Photo.php b/app/Models/Photo.php index 8730ad486..a21698373 100644 --- a/app/Models/Photo.php +++ b/app/Models/Photo.php @@ -2,6 +2,13 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\MorphMany; + +/** + * Class Photo + * + * @property int id + */ class Photo extends BaseModel { /** @@ -27,16 +34,20 @@ class Photo extends BaseModel /** * Возвращает комментарии фотографий + * + * @return MorphMany */ - public function comments() + public function comments(): MorphMany { return $this->morphMany(Comment::class, 'relate'); } /** * Возвращает загруженные файлы + * + * @return MorphMany */ - public function files() + public function files(): MorphMany { return $this->morphMany(File::class, 'relate'); } @@ -47,7 +58,7 @@ public function files() * @return bool|null * @throws \Exception */ - public function delete() + public function delete(): ?bool { $this->files->each(function($file) { deleteFile(HOME . $file->hash); diff --git a/app/Models/Polling.php b/app/Models/Polling.php index 562770dd2..4ee479978 100644 --- a/app/Models/Polling.php +++ b/app/Models/Polling.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Polling + * + * @property int id + */ class Polling extends BaseModel { /** diff --git a/app/Models/Post.php b/app/Models/Post.php index fa1011ba5..be2b2316f 100644 --- a/app/Models/Post.php +++ b/app/Models/Post.php @@ -2,8 +2,14 @@ namespace App\Models; -use Illuminate\Http\UploadedFile; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\MorphMany; +/** + * Class Post + * + * @property int id + */ class Post extends BaseModel { /** @@ -29,24 +35,30 @@ class Post extends BaseModel /** * Возвращает связь пользователей + * + * @return BelongsTo */ - public function editUser() + public function editUser(): BelongsTo { return $this->belongsTo(User::class, 'edit_user_id')->withDefault(); } /** * Возвращает топик + * + * @return BelongsTo */ - public function topic() + public function topic(): BelongsTo { return $this->belongsTo(Topic::class, 'topic_id')->withDefault(); } /** * Возвращает загруженные файлы + * + * @return MorphMany */ - public function files() + public function files(): MorphMany { return $this->morphMany(File::class, 'relate'); } @@ -57,7 +69,7 @@ public function files() * @return bool|null * @throws \Exception */ - public function delete() + public function delete(): ?bool { $this->files->each(function($file) { deleteFile(HOME . $file->hash); diff --git a/app/Models/Rating.php b/app/Models/Rating.php index e02a7a243..03ba74573 100644 --- a/app/Models/Rating.php +++ b/app/Models/Rating.php @@ -2,6 +2,13 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + +/** + * Class Rating + * + * @property int id + */ class Rating extends BaseModel { /** @@ -27,8 +34,10 @@ class Rating extends BaseModel /** * Возвращает связь пользователей + * + * @return BelongsTo */ - public function recipient() + public function recipient(): BelongsTo { return $this->belongsTo(User::class, 'recipient_id')->withDefault(); } diff --git a/app/Models/Reader.php b/app/Models/Reader.php index b8a3d6570..f27269444 100644 --- a/app/Models/Reader.php +++ b/app/Models/Reader.php @@ -2,15 +2,13 @@ namespace App\Models; +/** + * Class Reader + * + * @property int id + */ class Reader extends BaseModel { - /** - * The table associated with the model. - * - * @var string - */ - protected $table = 'readers'; - /** * Indicates if the model should be timestamped. * diff --git a/app/Models/RekUser.php b/app/Models/RekUser.php index 7f7d53a70..aaf335429 100644 --- a/app/Models/RekUser.php +++ b/app/Models/RekUser.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class RekUser + * + * @property int id + */ class RekUser extends BaseModel { /** diff --git a/app/Models/Rule.php b/app/Models/Rule.php index f639ee967..827c97816 100644 --- a/app/Models/Rule.php +++ b/app/Models/Rule.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Rule + * + * @property int id + */ class Rule extends BaseModel { /** diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 0e69293d7..18260853c 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Setting + * + * @property int id + */ class Setting extends BaseModel { /** @@ -23,7 +28,7 @@ class Setting extends BaseModel * * @return array */ - public static function getActions() + public static function getActions(): array { return [ 'main', diff --git a/app/Models/Smile.php b/app/Models/Smile.php index cca118410..abe437015 100644 --- a/app/Models/Smile.php +++ b/app/Models/Smile.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Smile + * + * @property int id + */ class Smile extends BaseModel { /** diff --git a/app/Models/Social.php b/app/Models/Social.php index 530a11dbd..bfd99a6c8 100644 --- a/app/Models/Social.php +++ b/app/Models/Social.php @@ -4,6 +4,11 @@ use stdClass; +/** + * Class Social + * + * @property int id + */ class Social extends BaseModel { /** diff --git a/app/Models/Spam.php b/app/Models/Spam.php index 6f36b2c43..99fe829c9 100644 --- a/app/Models/Spam.php +++ b/app/Models/Spam.php @@ -2,6 +2,13 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\MorphTo; + +/** + * Class Spam + * + * @property int id + */ class Spam extends BaseModel { /** @@ -27,8 +34,10 @@ class Spam extends BaseModel /** * Возвращает связанные сообщения + * + * @return MorphTo */ - public function relate() + public function relate(): MorphTo { return $this->morphTo('relate'); } diff --git a/app/Models/Status.php b/app/Models/Status.php index 2335d058a..08c6be359 100644 --- a/app/Models/Status.php +++ b/app/Models/Status.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Status + * + * @property int id + */ class Status extends BaseModel { /** diff --git a/app/Models/Surprise.php b/app/Models/Surprise.php index c999a195c..431d3ac20 100644 --- a/app/Models/Surprise.php +++ b/app/Models/Surprise.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class Surprise + * + * @property int id + */ class Surprise extends BaseModel { /** diff --git a/app/Models/Topic.php b/app/Models/Topic.php index a7eb3d9ff..a5698c6c5 100644 --- a/app/Models/Topic.php +++ b/app/Models/Topic.php @@ -2,6 +2,15 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\HasOne; + +/** + * Class Topic + * + * @property int id + */ class Topic extends BaseModel { /** @@ -20,40 +29,50 @@ class Topic extends BaseModel /** * Возвращает сообщения + * + * @return HasMany */ - public function posts() + public function posts(): HasMany { return $this->hasMany(Post::class, 'topic_id'); } /** * Возвращает закладки + * + * @return HasMany */ - public function bookmarks() + public function bookmarks(): HasMany { return $this->hasMany(Bookmark::class, 'topic_id'); } /** * Возвращает голосование + * + * @return hasOne */ - public function vote() + public function vote(): hasOne { return $this->hasOne(Vote::class, 'topic_id')->withDefault(); } /** * Возвращает последнее сообщение + * + * @return BelongsTo */ - public function lastPost() + public function lastPost(): BelongsTo { return $this->belongsTo(Post::class, 'last_post_id')->withDefault(); } /** * Возвращает раздел форума + * + * @return BelongsTo */ - public function forum() + public function forum(): BelongsTo { return $this->belongsTo(Forum::class, 'forum_id')->withDefault(); } @@ -63,7 +82,7 @@ public function forum() * * @return string иконка топика */ - public function getIcon() + public function getIcon(): string { if ($this->closed) { $icon = 'fa-lock'; @@ -82,7 +101,7 @@ public function getIcon() * @param string url $url * @return string сформированный блок */ - public function pagination($url = '/topics') + public function pagination($url = '/topics'): string { if (! $this->count_posts) { return null; diff --git a/app/Models/Transfer.php b/app/Models/Transfer.php index 1784ea52a..9ad86ee06 100644 --- a/app/Models/Transfer.php +++ b/app/Models/Transfer.php @@ -2,6 +2,13 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + +/** + * Class Transfer + * + * @property int id + */ class Transfer extends BaseModel { /** @@ -20,8 +27,10 @@ class Transfer extends BaseModel /** * Возвращает связь пользователей + * + * @return BelongsTo */ - public function recipientUser() + public function recipientUser(): BelongsTo { return $this->belongsTo(User::class, 'recipient_id')->withDefault(); } diff --git a/app/Models/User.php b/app/Models/User.php index 9a62e3040..6e5039c58 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -4,8 +4,15 @@ use Curl\Curl; use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Database\Query\JoinClause; +/** + * Class User + * + * @property int id + */ class User extends BaseModel { public const BOSS = 'boss'; // Владелец @@ -87,16 +94,20 @@ class User extends BaseModel /** * Связь с таблицей online + * + * @return BelongsTo */ - public function online() + public function online(): BelongsTo { return $this->belongsTo(Online::class, 'id', 'user_id')->withDefault(); } /** * Возвращает последний бан + * + * @return hasOne */ - public function lastBan() + public function lastBan(): hasOne { return $this->hasOne(Banhist::class, 'user_id', 'id') ->whereIn('type', ['ban', 'change']) @@ -106,8 +117,10 @@ public function lastBan() /** * Возвращает заметку пользователя + * + * @return hasOne */ - public function note() + public function note(): HasOne { return $this->hasOne(Note::class)->withDefault(); } @@ -130,7 +143,7 @@ public function getProfile($color = null, $link = true): string } if (\in_array($this->level, self::ADMIN_GROUPS, true)) { - $admin = ' '; + $admin = ' '; } if ($link) { @@ -228,7 +241,7 @@ public static function auth($login, $password, $remember = true) * @return void * @throws \ErrorException */ - public static function socialAuth($token) + public static function socialAuth($token): void { $domain = siteDomain(siteUrl()); @@ -556,10 +569,10 @@ public function deleteAlbum(): void /** * Удаляет записи пользователя из всех таблиц * - * @return bool результат удаления + * @return bool|null результат удаления * @throws \Exception */ - public function delete() + public function delete(): ?bool { deleteFile(HOME . $this->picture); deleteFile(HOME . $this->avatar); diff --git a/app/Models/Vote.php b/app/Models/Vote.php index 41aa9dd87..392060aef 100644 --- a/app/Models/Vote.php +++ b/app/Models/Vote.php @@ -2,6 +2,15 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\MorphMany; + +/** + * Class Vote + * + * @property int id + */ class Vote extends BaseModel { /** @@ -20,16 +29,20 @@ class Vote extends BaseModel /** * Возвращает топик + * + * @return BelongsTo */ - public function topic() + public function topic(): BelongsTo { return $this->belongsTo(Topic::class, 'topic_id')->withDefault(); } /** * Возвращает варианты ответов + * + * @return HasMany */ - public function answers() + public function answers(): HasMany { return $this->hasMany(VoteAnswer::class, 'vote_id')->orderBy('id'); } @@ -37,7 +50,7 @@ public function answers() /** * Возвращает связь с голосованиями */ - public function pollings() + public function pollings(): MorphMany { return $this->morphMany(Polling::class, 'relate'); } diff --git a/app/Models/VoteAnswer.php b/app/Models/VoteAnswer.php index 5300ab1cc..e9776a944 100644 --- a/app/Models/VoteAnswer.php +++ b/app/Models/VoteAnswer.php @@ -2,6 +2,11 @@ namespace App\Models; +/** + * Class VoteAnswer + * + * @property int id + */ class VoteAnswer extends BaseModel { /** diff --git a/app/Models/Wall.php b/app/Models/Wall.php index f2d1ed16f..42677bacd 100644 --- a/app/Models/Wall.php +++ b/app/Models/Wall.php @@ -2,6 +2,13 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + +/** + * Class Wall + * + * @property int id + */ class Wall extends BaseModel { /** @@ -20,8 +27,10 @@ class Wall extends BaseModel /** * Возвращает связь пользователей + * + * @return BelongsTo */ - public function author() + public function author(): BelongsTo { return $this->belongsTo(User::class, 'author_id')->withDefault(); } diff --git a/app/helpers.php b/app/helpers.php index 0c83e52f3..ed251fd28 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -1937,11 +1937,14 @@ function getUserById($id): ?User function getUser($key = null) { if (Registry::has('user')) { + + $user = Registry::get('user'); + if ($key) { - return Registry::get('user')[$key] ?? null; + return $user[$key] ?? null; } - return Registry::get('user'); + return $user; } return null; From 703962aa462103806f2ec92449c8276e0da7d92d Mon Sep 17 00:00:00 2001 From: visavi Date: Sun, 16 Sep 2018 15:08:58 +0300 Subject: [PATCH 030/163] =?UTF-8?q?=D0=BE=D0=BF=D0=B8=D1=81=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D0=BE=D0=BB=D0=B5=D0=B9=20=D0=B2=20=D0=BC?= =?UTF-8?q?=D0=BE=D0=B4=D0=B5=D0=BB=D1=8F=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Banhist.php | 7 +++++++ app/Models/BlackList.php | 4 ++++ app/Models/Board.php | 5 +++++ app/Models/Bookmark.php | 3 +++ app/Models/Category.php | 5 +++++ app/Models/ChangeMail.php | 4 ++++ app/Models/Chat.php | 7 +++++++ app/Models/Comment.php | 7 +++++++ app/Models/Contact.php | 4 ++++ app/Models/Counter.php | 7 +++++++ app/Models/Counter24.php | 3 +++ app/Models/Counter31.php | 3 +++ app/Models/Down.php | 11 ++++++++++ app/Models/Error.php | 7 +++++++ app/Models/File.php | 7 +++++++ app/Models/Flood.php | 3 +++ app/Models/Forum.php | 8 ++++++++ app/Models/Guestbook.php | 8 ++++++++ app/Models/Ignore.php | 4 ++++ app/Models/Inbox.php | 4 ++++ app/Models/Invite.php | 5 +++++ app/Models/Item.php | 9 ++++++++ app/Models/Load.php | 5 +++++ app/Models/Log.php | 6 ++++++ app/Models/Login.php | 5 +++++ app/Models/Mailing.php | 7 +++++++ app/Models/News.php | 8 ++++++++ app/Models/Note.php | 4 ++++ app/Models/Notebook.php | 3 +++ app/Models/Notice.php | 7 +++++++ app/Models/Offer.php | 12 +++++++++++ app/Models/Online.php | 4 ++++ app/Models/Outbox.php | 4 ++++ app/Models/Photo.php | 7 +++++++ app/Models/Polling.php | 5 +++++ app/Models/Post.php | 9 ++++++++ app/Models/Rating.php | 5 +++++ app/Models/Reader.php | 4 ++++ app/Models/RekUser.php | 7 +++++++ app/Models/Rule.php | 2 ++ app/Models/Setting.php | 3 ++- app/Models/Smile.php | 2 ++ app/Models/Social.php | 4 ++++ app/Models/Spam.php | 5 +++++ app/Models/Status.php | 4 ++++ app/Models/Surprise.php | 3 +++ app/Models/Topic.php | 11 ++++++++++ app/Models/Transfer.php | 5 +++++ app/Models/User.php | 43 +++++++++++++++++++++++++++++++++++++++ app/Models/Vote.php | 5 +++++ app/Models/VoteAnswer.php | 3 +++ app/Models/Wall.php | 4 ++++ 52 files changed, 320 insertions(+), 1 deletion(-) diff --git a/app/Models/Banhist.php b/app/Models/Banhist.php index 0c66f968c..9943ff4f3 100644 --- a/app/Models/Banhist.php +++ b/app/Models/Banhist.php @@ -8,6 +8,13 @@ * Class Banhist * * @property int id + * @property int user_id + * @property int send_user_id + * @property string type + * @property string reason + * @property int term + * @property int created_at + * @property int explain */ class Banhist extends BaseModel { diff --git a/app/Models/BlackList.php b/app/Models/BlackList.php index e0c1904ab..cf041d36f 100644 --- a/app/Models/BlackList.php +++ b/app/Models/BlackList.php @@ -6,6 +6,10 @@ * Class BlackList * * @property int id + * @property string type + * @property string value + * @property int user_id + * @property int created_at */ class BlackList extends BaseModel { diff --git a/app/Models/Board.php b/app/Models/Board.php index 94de025a1..3d804ee2c 100644 --- a/app/Models/Board.php +++ b/app/Models/Board.php @@ -9,6 +9,11 @@ * Class Board * * @property int id + * @property int sort + * @property int parent_id + * @property string name + * @property int count_items + * @property int closed */ class Board extends BaseModel { diff --git a/app/Models/Bookmark.php b/app/Models/Bookmark.php index f1ef50aa8..93a287f79 100644 --- a/app/Models/Bookmark.php +++ b/app/Models/Bookmark.php @@ -8,6 +8,9 @@ * Class Bookmark * * @property int id + * @property int user_id + * @property int topic_id + * @property int count_posts */ class Bookmark extends BaseModel { diff --git a/app/Models/Category.php b/app/Models/Category.php index 4aac280fa..4fc6049db 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -10,6 +10,11 @@ * Class Category * * @property int id + * @property int sort + * @property int parent_id + * @property string name + * @property int count_blogs + * @property int closed */ class Category extends BaseModel { diff --git a/app/Models/ChangeMail.php b/app/Models/ChangeMail.php index e899cdbd8..0350f4df1 100644 --- a/app/Models/ChangeMail.php +++ b/app/Models/ChangeMail.php @@ -6,6 +6,10 @@ * Class ChangeMail * * @property int id + * @property int user_id + * @property string mail + * @property string hash + * @property int created_at */ class ChangeMail extends BaseModel { diff --git a/app/Models/Chat.php b/app/Models/Chat.php index cc8dd5cb5..2ad0f2c65 100644 --- a/app/Models/Chat.php +++ b/app/Models/Chat.php @@ -8,6 +8,13 @@ * Class Chat * * @property int id + * @property int user_id + * @property string text + * @property string ip + * @property string brow + * @property int created_at + * @property int edit_user_id + * @property int updated_at */ class Chat extends BaseModel { diff --git a/app/Models/Comment.php b/app/Models/Comment.php index 33f11028b..2b0be3f87 100644 --- a/app/Models/Comment.php +++ b/app/Models/Comment.php @@ -6,6 +6,13 @@ * Class Comment * * @property int id + * @property int user_id + * @property string relate_type + * @property int relate_id + * @property string text + * @property string ip + * @property string brow + * @property int created_at */ class Comment extends BaseModel { diff --git a/app/Models/Contact.php b/app/Models/Contact.php index ecb87fb11..c584c95ea 100644 --- a/app/Models/Contact.php +++ b/app/Models/Contact.php @@ -8,6 +8,10 @@ * Class Contact * * @property int id + * @property int user_id + * @property int contact_id + * @property string text + * @property int created_at */ class Contact extends BaseModel { diff --git a/app/Models/Counter.php b/app/Models/Counter.php index a75c7fe53..4a09e7849 100644 --- a/app/Models/Counter.php +++ b/app/Models/Counter.php @@ -6,6 +6,13 @@ * Class Counter * * @property int id + * @property string period + * @property int allhosts + * @property int allhits + * @property int dayhosts + * @property int dayhits + * @property int hosts24 + * @property int hits24 */ class Counter extends BaseModel { diff --git a/app/Models/Counter24.php b/app/Models/Counter24.php index 977b707a7..7f98e432c 100644 --- a/app/Models/Counter24.php +++ b/app/Models/Counter24.php @@ -6,6 +6,9 @@ * Class Counter24 * * @property int id + * @property string period + * @property int hosts + * @property int hits */ class Counter24 extends BaseModel { diff --git a/app/Models/Counter31.php b/app/Models/Counter31.php index 4e93ae2bd..7c8f6dca1 100644 --- a/app/Models/Counter31.php +++ b/app/Models/Counter31.php @@ -6,6 +6,9 @@ * Class Counter31 * * @property int id + * @property string period + * @property int hosts + * @property int hits */ class Counter31 extends BaseModel { diff --git a/app/Models/Down.php b/app/Models/Down.php index ab8c42d22..9531f3e9e 100644 --- a/app/Models/Down.php +++ b/app/Models/Down.php @@ -16,6 +16,17 @@ * Class Down * * @property int id + * @property int category_id + * @property string title + * @property string text + * @property int user_id + * @property int created_at + * @property int count_comments + * @property int rating + * @property int rated + * @property int loads + * @property int active + * @property int updated_at */ class Down extends BaseModel { diff --git a/app/Models/Error.php b/app/Models/Error.php index 519604ea0..18ea8c370 100644 --- a/app/Models/Error.php +++ b/app/Models/Error.php @@ -6,6 +6,13 @@ * Class Error * * @property int id + * @property int code + * @property string request + * @property string referer + * @property int user_id + * @property string ip + * @property string brow + * @property int created_at */ class Error extends BaseModel { diff --git a/app/Models/File.php b/app/Models/File.php index 7077e7ada..676119e00 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -8,6 +8,13 @@ * Class File * * @property int id + * @property string relate_type + * @property int relate_id + * @property string hash + * @property string name + * @property int size + * @property int user_id + * @property int created_at */ class File extends BaseModel { diff --git a/app/Models/Flood.php b/app/Models/Flood.php index 09f141add..27450d395 100644 --- a/app/Models/Flood.php +++ b/app/Models/Flood.php @@ -6,6 +6,9 @@ * Class Flood * * @property int id + * @property int user_id + * @property string page + * @property int created_at */ class Flood extends BaseModel { diff --git a/app/Models/Forum.php b/app/Models/Forum.php index c242e06ee..cdacdd70f 100644 --- a/app/Models/Forum.php +++ b/app/Models/Forum.php @@ -9,6 +9,14 @@ * Class Forum * * @property int id + * @property int sort + * @property int parent_id + * @property string title + * @property string description + * @property int count_topics + * @property int count_posts + * @property int last_topic_id + * @property int closed */ class Forum extends BaseModel { diff --git a/app/Models/Guestbook.php b/app/Models/Guestbook.php index 04d57e782..6d5f1dcf1 100644 --- a/app/Models/Guestbook.php +++ b/app/Models/Guestbook.php @@ -8,6 +8,14 @@ * Class Guestbook * * @property int id + * @property int user_id + * @property string text + * @property string ip + * @property string brow + * @property int created_at + * @property string reply + * @property int edit_user_id + * @property int updated_at */ class Guestbook extends BaseModel { diff --git a/app/Models/Ignore.php b/app/Models/Ignore.php index 80695362a..9ccd84a4d 100644 --- a/app/Models/Ignore.php +++ b/app/Models/Ignore.php @@ -8,6 +8,10 @@ * Class Ignore * * @property int id + * @property int user_id + * @property int ignore_id + * @property string text + * @property int created_at */ class Ignore extends BaseModel { diff --git a/app/Models/Inbox.php b/app/Models/Inbox.php index 897f9f49a..20c430d29 100644 --- a/app/Models/Inbox.php +++ b/app/Models/Inbox.php @@ -8,6 +8,10 @@ * Class Inbox * * @property int id + * @property int user_id + * @property int author_id + * @property string text + * @property int created_at */ class Inbox extends BaseModel { diff --git a/app/Models/Invite.php b/app/Models/Invite.php index 306519c0f..b7f461efe 100644 --- a/app/Models/Invite.php +++ b/app/Models/Invite.php @@ -8,6 +8,11 @@ * Class Invite * * @property int id + * @property string hash + * @property int user_id + * @property int invite_user_id + * @property int used + * @property int created_at */ class Invite extends BaseModel { diff --git a/app/Models/Item.php b/app/Models/Item.php index 3f66e2b9d..7abe786db 100644 --- a/app/Models/Item.php +++ b/app/Models/Item.php @@ -9,6 +9,15 @@ * Class Item * * @property int id + * @property int board_id + * @property string title + * @property string text + * @property int user_id + * @property int price + * @property string phone + * @property int created_at + * @property int updated_at + * @property int expires_at */ class Item extends BaseModel { diff --git a/app/Models/Load.php b/app/Models/Load.php index dee767814..d67095818 100644 --- a/app/Models/Load.php +++ b/app/Models/Load.php @@ -10,6 +10,11 @@ * Class Load * * @property int id + * @property int sort + * @property int parent_id + * @property string name + * @property int count_downs + * @property int closed */ class Load extends BaseModel { diff --git a/app/Models/Log.php b/app/Models/Log.php index 5386f3d90..57b816f66 100644 --- a/app/Models/Log.php +++ b/app/Models/Log.php @@ -6,6 +6,12 @@ * Class Log * * @property int id + * @property int user_id + * @property string request + * @property string referer + * @property string ip + * @property string brow + * @property int created_at */ class Log extends BaseModel { diff --git a/app/Models/Login.php b/app/Models/Login.php index b01c463e5..6b00fb439 100644 --- a/app/Models/Login.php +++ b/app/Models/Login.php @@ -6,6 +6,11 @@ * Class Login * * @property int id + * @property int user_id + * @property string ip + * @property string brow + * @property int created_at + * @property int type */ class Login extends BaseModel { diff --git a/app/Models/Mailing.php b/app/Models/Mailing.php index 6162bbd19..69cd52415 100644 --- a/app/Models/Mailing.php +++ b/app/Models/Mailing.php @@ -6,6 +6,13 @@ * Class Mailing * * @property int id + * @property int user_id + * @property string type + * @property string subject + * @property string text + * @property int sent + * @property int created_at + * @property int sent_at */ class Mailing extends BaseModel { diff --git a/app/Models/News.php b/app/Models/News.php index 9a7d2d9b7..522cae696 100644 --- a/app/Models/News.php +++ b/app/Models/News.php @@ -8,6 +8,14 @@ * Class News * * @property int id + * @property string title + * @property string text + * @property int user_id + * @property string image + * @property int created_at + * @property int count_comments + * @property int closed + * @property int top */ class News extends BaseModel { diff --git a/app/Models/Note.php b/app/Models/Note.php index f8a0e7026..0cf01d117 100644 --- a/app/Models/Note.php +++ b/app/Models/Note.php @@ -8,6 +8,10 @@ * Class Note * * @property int id + * @property int user_id + * @property string text + * @property int edit_ser_id + * @property int updated_at */ class Note extends BaseModel { diff --git a/app/Models/Notebook.php b/app/Models/Notebook.php index c33e7a063..5bd02cb0e 100644 --- a/app/Models/Notebook.php +++ b/app/Models/Notebook.php @@ -6,6 +6,9 @@ * Class Notebook * * @property int id + * @property int user_id + * @property string text + * @property int created_at */ class Notebook extends BaseModel { diff --git a/app/Models/Notice.php b/app/Models/Notice.php index 8e4c8920e..7f8763db9 100644 --- a/app/Models/Notice.php +++ b/app/Models/Notice.php @@ -6,6 +6,13 @@ * Class Notice * * @property int id + * @property string type + * @property string name + * @property string text + * @property int user_id + * @property int created_at + * @property int updated_at + * @property int protect */ class Notice extends BaseModel { diff --git a/app/Models/Offer.php b/app/Models/Offer.php index db2ec7225..57e6cd8c1 100644 --- a/app/Models/Offer.php +++ b/app/Models/Offer.php @@ -10,6 +10,18 @@ * Class Offer * * @property int id + * @property string type + * @property string title + * @property string text + * @property int user_id + * @property int rating + * @property int created_at + * @property string status + * @property int count_comments + * @property int closed + * @property string reply + * @property int reply_user_id + * @property int updated_at */ class Offer extends BaseModel { diff --git a/app/Models/Online.php b/app/Models/Online.php index 2f0e8b632..cec5ed8b1 100644 --- a/app/Models/Online.php +++ b/app/Models/Online.php @@ -6,6 +6,10 @@ * Class Online * * @property int id + * @property string ip + * @property string brow + * @property int updated_at + * @property int user_id */ class Online extends BaseModel { diff --git a/app/Models/Outbox.php b/app/Models/Outbox.php index bdc037f7d..05213573e 100644 --- a/app/Models/Outbox.php +++ b/app/Models/Outbox.php @@ -8,6 +8,10 @@ * Class Outbox * * @property int id + * @property int user_id + * @property int recipient_id + * @property string text + * @property int created_at */ class Outbox extends BaseModel { diff --git a/app/Models/Photo.php b/app/Models/Photo.php index a21698373..e2f606a73 100644 --- a/app/Models/Photo.php +++ b/app/Models/Photo.php @@ -8,6 +8,13 @@ * Class Photo * * @property int id + * @property int user_id + * @property string title + * @property string text + * @property int created_at + * @property int rating + * @property int closed + * @property int count_comments */ class Photo extends BaseModel { diff --git a/app/Models/Polling.php b/app/Models/Polling.php index 4ee479978..eb35ee9ea 100644 --- a/app/Models/Polling.php +++ b/app/Models/Polling.php @@ -6,6 +6,11 @@ * Class Polling * * @property int id + * @property string relate_type + * @property int relate_id + * @property int user_id + * @property string vote + * @property int created_at */ class Polling extends BaseModel { diff --git a/app/Models/Post.php b/app/Models/Post.php index be2b2316f..64338aa95 100644 --- a/app/Models/Post.php +++ b/app/Models/Post.php @@ -9,6 +9,15 @@ * Class Post * * @property int id + * @property int topic_id + * @property int user_id + * @property string text + * @property int rating + * @property int created_at + * @property string ip + * @property string brow + * @property int edit_user_id + * @property int updated_at */ class Post extends BaseModel { diff --git a/app/Models/Rating.php b/app/Models/Rating.php index 03ba74573..e466b4f54 100644 --- a/app/Models/Rating.php +++ b/app/Models/Rating.php @@ -8,6 +8,11 @@ * Class Rating * * @property int id + * @property int user_id + * @property int recipient_id + * @property string text + * @property string vote + * @property int created_at */ class Rating extends BaseModel { diff --git a/app/Models/Reader.php b/app/Models/Reader.php index f27269444..1f0d8e79e 100644 --- a/app/Models/Reader.php +++ b/app/Models/Reader.php @@ -6,6 +6,10 @@ * Class Reader * * @property int id + * @property string relate_type + * @property int relate_id + * @property string ip + * @property int created_at */ class Reader extends BaseModel { diff --git a/app/Models/RekUser.php b/app/Models/RekUser.php index aaf335429..fb472ff17 100644 --- a/app/Models/RekUser.php +++ b/app/Models/RekUser.php @@ -6,6 +6,13 @@ * Class RekUser * * @property int id + * @property string site + * @property string name + * @property string color + * @property int bold + * @property int user_id + * @property int created_at + * @property int deleted_at */ class RekUser extends BaseModel { diff --git a/app/Models/Rule.php b/app/Models/Rule.php index 827c97816..99179dbc3 100644 --- a/app/Models/Rule.php +++ b/app/Models/Rule.php @@ -6,6 +6,8 @@ * Class Rule * * @property int id + * @property string text + * @property int created_at */ class Rule extends BaseModel { diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 18260853c..ba0a6e4a3 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -5,7 +5,8 @@ /** * Class Setting * - * @property int id + * @property string name + * @property string value */ class Setting extends BaseModel { diff --git a/app/Models/Smile.php b/app/Models/Smile.php index abe437015..3e1158eec 100644 --- a/app/Models/Smile.php +++ b/app/Models/Smile.php @@ -6,6 +6,8 @@ * Class Smile * * @property int id + * @property string name + * @property string code */ class Smile extends BaseModel { diff --git a/app/Models/Social.php b/app/Models/Social.php index bfd99a6c8..65ebcd1de 100644 --- a/app/Models/Social.php +++ b/app/Models/Social.php @@ -8,6 +8,10 @@ * Class Social * * @property int id + * @property int user_id + * @property string network + * @property string uid + * @property int created_at */ class Social extends BaseModel { diff --git a/app/Models/Spam.php b/app/Models/Spam.php index 99fe829c9..1a7b1bdef 100644 --- a/app/Models/Spam.php +++ b/app/Models/Spam.php @@ -8,6 +8,11 @@ * Class Spam * * @property int id + * @property string relate_type + * @property int relate_id + * @property int user_id + * @property int created_at + * @property string path */ class Spam extends BaseModel { diff --git a/app/Models/Status.php b/app/Models/Status.php index 08c6be359..7feed0d47 100644 --- a/app/Models/Status.php +++ b/app/Models/Status.php @@ -6,6 +6,10 @@ * Class Status * * @property int id + * @property int topoint + * @property int point + * @property string name + * @property string color */ class Status extends BaseModel { diff --git a/app/Models/Surprise.php b/app/Models/Surprise.php index 431d3ac20..8a0bf4801 100644 --- a/app/Models/Surprise.php +++ b/app/Models/Surprise.php @@ -6,6 +6,9 @@ * Class Surprise * * @property int id + * @property int user_id + * @property int year + * @property int created_at */ class Surprise extends BaseModel { diff --git a/app/Models/Topic.php b/app/Models/Topic.php index a5698c6c5..2de9f5222 100644 --- a/app/Models/Topic.php +++ b/app/Models/Topic.php @@ -10,6 +10,17 @@ * Class Topic * * @property int id + * @property int forum_id + * @property string title + * @property int user_id + * @property int closed + * @property int locked + * @property int count_posts + * @property int updated_at + * @property string moderators + * @property string note + * @property int last_post_id + * @property int created_at */ class Topic extends BaseModel { diff --git a/app/Models/Transfer.php b/app/Models/Transfer.php index 9ad86ee06..3bb01d6a7 100644 --- a/app/Models/Transfer.php +++ b/app/Models/Transfer.php @@ -8,6 +8,11 @@ * Class Transfer * * @property int id + * @property int user_id + * @property int recipient_id + * @property string text + * @property int total + * @property int created_at */ class Transfer extends BaseModel { diff --git a/app/Models/User.php b/app/Models/User.php index 6e5039c58..20abc2485 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -12,6 +12,49 @@ * Class User * * @property int id + * @property string login + * @property string password + * @property string email + * @property string level + * @property string name + * @property string country + * @property string city + * @property string language + * @property string info + * @property string site + * @property string phone + * @property string icq + * @property string skype + * @property string gender + * @property string birthday + * @property int visits + * @property int newprivat + * @property int newwall + * @property int allforum + * @property int allguest + * @property int allcomments + * @property string themes + * @property string timezone + * @property int point + * @property int money + * @property string status + * @property string avatar + * @property string picture + * @property int rating + * @property int posrating + * @property int negrating + * @property string keypasswd + * @property int timepasswd + * @property int sendprivatmail + * @property int timebonus + * @property string confirmregkey + * @property int newchat + * @property int notify + * @property string apikey + * @property string subscribe + * @property int timeban + * @property int updated_at + * @property int created_at */ class User extends BaseModel { diff --git a/app/Models/Vote.php b/app/Models/Vote.php index 392060aef..d2c5fffc7 100644 --- a/app/Models/Vote.php +++ b/app/Models/Vote.php @@ -10,6 +10,11 @@ * Class Vote * * @property int id + * @property string title + * @property int count + * @property int closed + * @property int created_at + * @property int topic_id */ class Vote extends BaseModel { diff --git a/app/Models/VoteAnswer.php b/app/Models/VoteAnswer.php index e9776a944..72f4dd4c4 100644 --- a/app/Models/VoteAnswer.php +++ b/app/Models/VoteAnswer.php @@ -6,6 +6,9 @@ * Class VoteAnswer * * @property int id + * @property int vote_id + * @property string answer + * @property int result */ class VoteAnswer extends BaseModel { diff --git a/app/Models/Wall.php b/app/Models/Wall.php index 42677bacd..f0ac22e36 100644 --- a/app/Models/Wall.php +++ b/app/Models/Wall.php @@ -8,6 +8,10 @@ * Class Wall * * @property int id + * @property int user_id + * @property int author_id + * @property string text + * @property int created_at */ class Wall extends BaseModel { From 2774397047b7372321ec14bdb0fcb3d9b3cbdd2d Mon Sep 17 00:00:00 2001 From: visavi Date: Sun, 16 Sep 2018 16:18:30 +0300 Subject: [PATCH 031/163] =?UTF-8?q?casts=20=D0=B4=D0=BB=D1=8F=20user=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/BaseModel.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php index 1775a16be..307688662 100644 --- a/app/Models/BaseModel.php +++ b/app/Models/BaseModel.php @@ -9,6 +9,15 @@ class BaseModel extends Model { + /** + * The attributes that should be cast to native types. + * + * @var array + */ + protected $casts = [ + 'user_id' => 'int', + ]; + /** * Путь загрузки файлов * From 61d21e76a7dabdd777f8f2fe77adedfb759dea71 Mon Sep 17 00:00:00 2001 From: visavi Date: Wed, 19 Sep 2018 22:06:35 +0300 Subject: [PATCH 032/163] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D1=83=20?= =?UTF-8?q?=D1=81=D1=81=D1=8B=D0=BB=D0=BE=D0=BA=20=D0=B2=20=D0=B3=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D0=B5=D0=B2=D0=BE=D0=B9=20=D0=BA=D0=BD=D0=B8=D0=B3?= =?UTF-8?q?=D0=B5=20=D0=B4=D0=BB=D1=8F=20=D0=B3=D0=BE=D1=81=D1=82=D0=B5?= =?UTF-8?q?=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/GuestbookController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Controllers/GuestbookController.php b/app/Controllers/GuestbookController.php index 36aba9a5f..eeb1ef95f 100644 --- a/app/Controllers/GuestbookController.php +++ b/app/Controllers/GuestbookController.php @@ -48,6 +48,7 @@ public function add(): void /* Проерка для гостей */ if (! getUser() && setting('bookadds')) { $validator->true(captchaVerify(), ['protect' => 'Не удалось пройти проверку captcha!']); + $validator->false(strpos($msg, 'http'), ['msg' => 'Текст сообщения не должен содержать ссылок!']); } else { $validator->true(getUser(), ['msg' => 'Для добавления сообщения необходимо авторизоваться']); } From 1cafac1a68a4ec72f40b389416bfdeaf33f467c8 Mon Sep 17 00:00:00 2001 From: visavi Date: Sat, 22 Sep 2018 00:58:04 +0300 Subject: [PATCH 033/163] =?UTF-8?q?=D0=BE=D0=B1=D1=8A=D0=B5=D0=B4=D0=B8?= =?UTF-8?q?=D0=BD=D0=B8=D0=BB=20=D1=80=D0=B0=D0=B7=D0=B4=D0=B5=D0=BB=20?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D1=82=D0=B8=D1=81=D1=82=D0=B8=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=B8=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=B8,=20=D0=B4=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=A7=D0=90=D0=92=D0=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/GuestbookController.php | 2 +- resources/views/index.blade.php | 3 +-- resources/views/main/index.blade.php | 12 +++++++++--- resources/views/main/stat.blade.php | 19 ------------------- resources/views/pages/faq.blade.php | 14 ++++++++++++-- 5 files changed, 23 insertions(+), 27 deletions(-) delete mode 100755 resources/views/main/stat.blade.php diff --git a/app/Controllers/GuestbookController.php b/app/Controllers/GuestbookController.php index eeb1ef95f..958ca9867 100644 --- a/app/Controllers/GuestbookController.php +++ b/app/Controllers/GuestbookController.php @@ -48,7 +48,7 @@ public function add(): void /* Проерка для гостей */ if (! getUser() && setting('bookadds')) { $validator->true(captchaVerify(), ['protect' => 'Не удалось пройти проверку captcha!']); - $validator->false(strpos($msg, 'http'), ['msg' => 'Текст сообщения не должен содержать ссылок!']); + $validator->false(stripos($msg, 'http'), ['msg' => 'Текст сообщения не должен содержать ссылок!']); } else { $validator->true(getUser(), ['msg' => 'Для добавления сообщения необходимо авторизоваться']); } diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index 27fa0e211..2c6135de3 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -45,14 +45,13 @@ Документация Rotor
Поиск по сайту
Обратная связь
Пользователи ({{ statsUsers() }})
Администрация ({{ statsAdmins() }})
- Информация
Курсы валют diff --git a/resources/views/main/index.blade.php b/resources/views/main/index.blade.php index 0116f313d..2b1c3d26f 100755 --- a/resources/views/main/index.blade.php +++ b/resources/views/main/index.blade.php @@ -1,13 +1,13 @@ @section('title') - Сервисы сайта + Полезная информация @stop -

Сервисы сайта

+

Полезная информация

@@ -15,3 +15,9 @@ Справка по тегам
Галерея смайлов
FAQ (Чаво)
+ API интерфейс
+ + Рейтинг толстосумов
+ Рейтинг репутации
+ Статусы юзеров
+ Кто онлайн
diff --git a/resources/views/main/stat.blade.php b/resources/views/main/stat.blade.php deleted file mode 100755 index f0e9036cc..000000000 --- a/resources/views/main/stat.blade.php +++ /dev/null @@ -1,19 +0,0 @@ -@section('title') - Статистика сайта -@stop - -

Статистика сайта

- - - - Рейтинг толстосумов
- Рейтинг репутации
- Статусы юзеров
- Кто онлайн
- API интерфейс
- diff --git a/resources/views/pages/faq.blade.php b/resources/views/pages/faq.blade.php index c88d108bc..c8ee73024 100644 --- a/resources/views/pages/faq.blade.php +++ b/resources/views/pages/faq.blade.php @@ -27,12 +27,20 @@ 6. Общаться по внутренней почте сайта с пользователями сайта, писать под своим аккаунтом в гостевой, комментариях, форуме
7. Участвовать в голосованиях на различные темы
8. Добавлять свои объявления, на определенный срок (Купля,продажа,вакансии,услуги,обмен и т.д.)
- 9. Изменять под себя настройки сайта, в частности количество показываемых сообщений в любых сервисах (гостевая, форум и пр.) Чем можно снизить трафик передаваемой информации
+ 9. Изменять под себя настройки сайта

При наборе определенного количества актива, пользователю открываются новые возможности:
+ + {{ plural(50, setting('scorename')) }} - добавление рекламных ссылок
+ + @if (!empty(setting('privatprotect'))) + {{ plural(setting('privatprotect'), setting('scorename')) }} - отключается captcha для некоторых действий
+ @endif + + @if (!empty(setting('addofferspoint'))) - {{ plural(setting('addofferspoint'), setting('scorename')) }} - создание тем в "Предложенияx и проблемах"
+ {{ plural(setting('addofferspoint'), setting('scorename')) }} - создание тем в "Предложениях и проблемах"
@endif @if (!empty(setting('forumloadpoints'))) @@ -55,6 +63,8 @@ {{ plural(setting('advertpoint'), setting('scorename')) }} - исчезает вся реклама на главной странице сайта
@endif + Также чем больше баллов тем меньше время антифлуда
+
Как проходит регистрация
From f3c3aa69a5c21acadeaf77b9c9f8ae040c5ba641 Mon Sep 17 00:00:00 2001 From: visavi Date: Sat, 22 Sep 2018 20:55:43 +0300 Subject: [PATCH 034/163] =?UTF-8?q?=D0=92=D1=8B=D0=BD=D0=B5=D1=81=20=D0=B2?= =?UTF-8?q?=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BB=D0=B8=D1=87=D0=B5=D1=81=D1=82=D0=B2=D0=BE=20?= =?UTF-8?q?=D0=B1=D0=B0=D0=BB=D0=BB=D0=BE=D0=B2=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B7=D0=BC=D0=B5=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D1=80=D0=B5=D0=BA=D0=BB=D0=B0=D0=BC=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/RekUserController.php | 26 +++++++++++-------- database/seeds/SettingsSeeder.php | 1 + ...922205024_add_rekuserpoint_to_settings.php | 22 ++++++++++++++++ .../views/admin/settings/_advert.blade.php | 6 +++++ resources/views/pages/faq.blade.php | 5 ++-- 5 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 database/upgrades/20180922205024_add_rekuserpoint_to_settings.php diff --git a/app/Controllers/RekUserController.php b/app/Controllers/RekUserController.php index f87409c0e..81273fd00 100644 --- a/app/Controllers/RekUserController.php +++ b/app/Controllers/RekUserController.php @@ -22,8 +22,10 @@ public function __construct() /** * Главная страница + * + * @return string */ - public function index() + public function index(): string { $total = RekUser::query()->where('deleted_at', '>', SITETIME)->count(); @@ -42,14 +44,16 @@ public function index() /** * Покупка рекламы + * + * @return string */ - public function create() + public function create(): string { if (! getUser()) { abort(403, 'Для покупки рекламы необходимо авторизоваться!'); } - if (getUser('point') < 50) { + if (getUser('point') < setting('rekuserpoint')) { abort('default', 'Для покупки рекламы вам необходимо набрать '.plural(50, setting('scorename')).'!'); } @@ -68,25 +72,25 @@ public function create() } if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $site = check(Request::input('site')); - $name = check(Request::input('name')); - $color = check(Request::input('color')); - $bold = empty(Request::input('bold')) ? 0 : 1; + $token = check(Request::input('token')); + $site = check(Request::input('site')); + $name = check(Request::input('name')); + $color = check(Request::input('color')); + $bold = empty(Request::input('bold')) ? 0 : 1; $price = setting('rekuserprice'); if ($color) { - $price = $price + setting('rekuseroptprice'); + $price += setting('rekuseroptprice'); } if ($bold) { - $price = $price + setting('rekuseroptprice'); + $price += setting('rekuseroptprice'); } $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') - ->gte(getUser('point'), 50, 'Для покупки рекламы вам необходимо набрать '.plural(50, setting('scorename')).'!') + ->gte(getUser('point'), setting('rekuserpoint'), 'Для покупки рекламы вам необходимо набрать '.plural(50, setting('scorename')).'!') ->true(captchaVerify(), ['protect' => 'Не удалось пройти проверку captcha!']) ->regex($site, '|^https?://([а-яa-z0-9_\-\.])+(\.([а-яa-z0-9\/\-?_=#])+)+$|iu', ['site' => 'Недопустимый адрес сайта!. Разрешены символы [а-яa-z0-9_-.?=#/]!']) ->length($site, 5, 100, ['site' => 'Слишком длинный или короткий адрес ссылки!']) diff --git a/database/seeds/SettingsSeeder.php b/database/seeds/SettingsSeeder.php index b819b57bf..384f2986b 100644 --- a/database/seeds/SettingsSeeder.php +++ b/database/seeds/SettingsSeeder.php @@ -107,6 +107,7 @@ public function run() ['name' => 'rekusershow', 'value' => 1], ['name' => 'rekusertime', 'value' => 12], ['name' => 'rekusertotal', 'value' => 10], + ['name' => 'rekuserpoint', 'value' => 50], ['name' => 'scorename', 'value' => 'балл,балла,баллов'], ['name' => 'screensize', 'value' => 1000], ['name' => 'sendmailpacket', 'value' => 3], diff --git a/database/upgrades/20180922205024_add_rekuserpoint_to_settings.php b/database/upgrades/20180922205024_add_rekuserpoint_to_settings.php new file mode 100644 index 000000000..656dcca5a --- /dev/null +++ b/database/upgrades/20180922205024_add_rekuserpoint_to_settings.php @@ -0,0 +1,22 @@ +execute("INSERT INTO settings (name, value) VALUES ('rekuserpoint', 50);"); + } + + /** + * Migrate Down. + */ + public function down() + { + $this->execute("DELETE FROM settings WHERE name='rekuserpoint' LIMIT 1;"); + } +} diff --git a/resources/views/admin/settings/_advert.blade.php b/resources/views/admin/settings/_advert.blade.php index 081bb829a..13226f315 100644 --- a/resources/views/admin/settings/_advert.blade.php +++ b/resources/views/admin/settings/_advert.blade.php @@ -15,6 +15,12 @@ {!! textError('sets[rekuserprice]') !!}
+
+ + + {!! textError('sets[rekuserpoint]') !!} +
+
diff --git a/resources/views/pages/faq.blade.php b/resources/views/pages/faq.blade.php index c8ee73024..e39742b90 100644 --- a/resources/views/pages/faq.blade.php +++ b/resources/views/pages/faq.blade.php @@ -31,8 +31,9 @@
При наборе определенного количества актива, пользователю открываются новые возможности:
- - {{ plural(50, setting('scorename')) }} - добавление рекламных ссылок
+ @if (!empty(setting('rekuserpoint'))) + {{ plural(setting('rekuserpoint'), setting('scorename')) }} - добавление рекламных ссылок
+ @endif @if (!empty(setting('privatprotect'))) {{ plural(setting('privatprotect'), setting('scorename')) }} - отключается captcha для некоторых действий
From f43c986f3b19ae891225f12e2dc74276ecef8c58 Mon Sep 17 00:00:00 2001 From: visavi Date: Sun, 23 Sep 2018 23:02:18 +0300 Subject: [PATCH 035/163] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=80=D0=BE=D1=83=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/routes.php | 6 +- composer.lock | 157 ++++++++++++++++++++++++++----------------------- 2 files changed, 87 insertions(+), 76 deletions(-) diff --git a/app/routes.php b/app/routes.php index aa5ff8e41..5d1adb4db 100644 --- a/app/routes.php +++ b/app/routes.php @@ -2,8 +2,10 @@ $router = new AltoRouter(); -$router->addMatchTypes(['user' => '[0-9A-Za-z-_]++']); -$router->addMatchTypes(['letter'=> '[0-9a-z]']); +$router->addMatchTypes([ + 'letter' => '[0-9a-z]', + 'user' => '[0-9A-Za-z-_]++', +]); $routes = [ ['GET', '/', 'HomeController@index', 'home'], diff --git a/composer.lock b/composer.lock index bb9a8410c..b75ab89cf 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "alchemy/binary-driver", - "version": "1.6.0", + "version": "v2.0.0", "source": { "type": "git", "url": "https://github.com/alchemy-fr/BinaryDriver.git", - "reference": "80c6633890afb71d2417ae851d0ad167d8b00b95" + "reference": "6ccde0e19e81e54da77b08da1a176d43e089f3a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/alchemy-fr/BinaryDriver/zipball/80c6633890afb71d2417ae851d0ad167d8b00b95", - "reference": "80c6633890afb71d2417ae851d0ad167d8b00b95", + "url": "https://api.github.com/repos/alchemy-fr/BinaryDriver/zipball/6ccde0e19e81e54da77b08da1a176d43e089f3a3", + "reference": "6ccde0e19e81e54da77b08da1a176d43e089f3a3", "shasum": "" }, "require": { @@ -25,7 +25,7 @@ "monolog/monolog": "^1.3", "php": ">=5.5", "psr/log": "^1.0", - "symfony/process": "^2.0|^3.0" + "symfony/process": "^2.3|^3.0|^4.0" }, "require-dev": { "phpunit/phpunit": "^4.0|^5.0" @@ -54,6 +54,12 @@ { "name": "Nicolas Le Goff", "email": "legoff.n@gmail.com" + }, + { + "name": "Jens Hausdorf", + "email": "mail@jens-hausdorf.de", + "homepage": "https://jens-hausdorf.de", + "role": "Maintainer" } ], "description": "A set of tools to build binary drivers", @@ -61,7 +67,7 @@ "binary", "driver" ], - "time": "2016-03-02T13:49:15+00:00" + "time": "2018-08-06T10:18:33+00:00" }, { "name": "altorouter/altorouter", @@ -680,16 +686,16 @@ }, { "name": "illuminate/container", - "version": "v5.7.3", + "version": "v5.7.5", "source": { "type": "git", "url": "https://github.com/illuminate/container.git", - "reference": "b2adca648536dfdfc13c2b93a2d717149794b682" + "reference": "0fc33b14ae6cf9a1e694fd43f2a274e590a824b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/container/zipball/b2adca648536dfdfc13c2b93a2d717149794b682", - "reference": "b2adca648536dfdfc13c2b93a2d717149794b682", + "url": "https://api.github.com/repos/illuminate/container/zipball/0fc33b14ae6cf9a1e694fd43f2a274e590a824b2", + "reference": "0fc33b14ae6cf9a1e694fd43f2a274e590a824b2", "shasum": "" }, "require": { @@ -724,16 +730,16 @@ }, { "name": "illuminate/contracts", - "version": "v5.7.3", + "version": "v5.7.5", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "fd5d68eddfe49647f8354ac4c5f09cb88ccece7a" + "reference": "2daf3c078610f744e2a4dc2f44fb5060cce9835b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/fd5d68eddfe49647f8354ac4c5f09cb88ccece7a", - "reference": "fd5d68eddfe49647f8354ac4c5f09cb88ccece7a", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/2daf3c078610f744e2a4dc2f44fb5060cce9835b", + "reference": "2daf3c078610f744e2a4dc2f44fb5060cce9835b", "shasum": "" }, "require": { @@ -764,20 +770,20 @@ ], "description": "The Illuminate Contracts package.", "homepage": "https://laravel.com", - "time": "2018-09-05T21:56:43+00:00" + "time": "2018-09-18T12:50:05+00:00" }, { "name": "illuminate/database", - "version": "v5.7.3", + "version": "v5.7.5", "source": { "type": "git", "url": "https://github.com/illuminate/database.git", - "reference": "415c573e8c57bc6e17ecbe26a8744e9ed041af05" + "reference": "c83247ced8194ef41a1f58e232ee00be9df634a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/database/zipball/415c573e8c57bc6e17ecbe26a8744e9ed041af05", - "reference": "415c573e8c57bc6e17ecbe26a8744e9ed041af05", + "url": "https://api.github.com/repos/illuminate/database/zipball/c83247ced8194ef41a1f58e232ee00be9df634a4", + "reference": "c83247ced8194ef41a1f58e232ee00be9df634a4", "shasum": "" }, "require": { @@ -823,20 +829,20 @@ "orm", "sql" ], - "time": "2018-09-06T13:57:10+00:00" + "time": "2018-09-19T15:13:04+00:00" }, { "name": "illuminate/events", - "version": "v5.7.3", + "version": "v5.7.5", "source": { "type": "git", "url": "https://github.com/illuminate/events.git", - "reference": "ada2f80ea8d4a5933ded24f592b7940456a68be0" + "reference": "4cf622acc05592f86d4a5c77ad1a544d38e58dee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/events/zipball/ada2f80ea8d4a5933ded24f592b7940456a68be0", - "reference": "ada2f80ea8d4a5933ded24f592b7940456a68be0", + "url": "https://api.github.com/repos/illuminate/events/zipball/4cf622acc05592f86d4a5c77ad1a544d38e58dee", + "reference": "4cf622acc05592f86d4a5c77ad1a544d38e58dee", "shasum": "" }, "require": { @@ -872,16 +878,16 @@ }, { "name": "illuminate/filesystem", - "version": "v5.7.3", + "version": "v5.7.5", "source": { "type": "git", "url": "https://github.com/illuminate/filesystem.git", - "reference": "2251e31e382ddcbbcb34fddc43e7cc0afa530be8" + "reference": "a09fae4470494dc9867609221b46fe844f2f3b70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/filesystem/zipball/2251e31e382ddcbbcb34fddc43e7cc0afa530be8", - "reference": "2251e31e382ddcbbcb34fddc43e7cc0afa530be8", + "url": "https://api.github.com/repos/illuminate/filesystem/zipball/a09fae4470494dc9867609221b46fe844f2f3b70", + "reference": "a09fae4470494dc9867609221b46fe844f2f3b70", "shasum": "" }, "require": { @@ -924,16 +930,16 @@ }, { "name": "illuminate/http", - "version": "v5.7.3", + "version": "v5.7.5", "source": { "type": "git", "url": "https://github.com/illuminate/http.git", - "reference": "5bcf3e2d547a07bf98e0e71fa919fdaf513eee36" + "reference": "1dbb5dcea82a968c7e8075676ec95ae023da1100" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/http/zipball/5bcf3e2d547a07bf98e0e71fa919fdaf513eee36", - "reference": "5bcf3e2d547a07bf98e0e71fa919fdaf513eee36", + "url": "https://api.github.com/repos/illuminate/http/zipball/1dbb5dcea82a968c7e8075676ec95ae023da1100", + "reference": "1dbb5dcea82a968c7e8075676ec95ae023da1100", "shasum": "" }, "require": { @@ -966,20 +972,20 @@ ], "description": "The Illuminate Http package.", "homepage": "https://laravel.com", - "time": "2018-08-28T08:47:30+00:00" + "time": "2018-09-17T19:03:52+00:00" }, { "name": "illuminate/session", - "version": "v5.7.3", + "version": "v5.7.5", "source": { "type": "git", "url": "https://github.com/illuminate/session.git", - "reference": "712f834c8b85a4f58ab40f56a359ac3e7e24c11a" + "reference": "2657efcbf9be18da34d354e3f66809b45c92f3da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/session/zipball/712f834c8b85a4f58ab40f56a359ac3e7e24c11a", - "reference": "712f834c8b85a4f58ab40f56a359ac3e7e24c11a", + "url": "https://api.github.com/repos/illuminate/session/zipball/2657efcbf9be18da34d354e3f66809b45c92f3da", + "reference": "2657efcbf9be18da34d354e3f66809b45c92f3da", "shasum": "" }, "require": { @@ -1020,16 +1026,16 @@ }, { "name": "illuminate/support", - "version": "v5.7.3", + "version": "v5.7.5", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "966c3198b5f82c00f8e5f7b6f16c35ffcb636acc" + "reference": "f7c68e8c8aab200cc8ad84f974d5511cda58a742" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/966c3198b5f82c00f8e5f7b6f16c35ffcb636acc", - "reference": "966c3198b5f82c00f8e5f7b6f16c35ffcb636acc", + "url": "https://api.github.com/repos/illuminate/support/zipball/f7c68e8c8aab200cc8ad84f974d5511cda58a742", + "reference": "f7c68e8c8aab200cc8ad84f974d5511cda58a742", "shasum": "" }, "require": { @@ -1075,20 +1081,20 @@ ], "description": "The Illuminate Support package.", "homepage": "https://laravel.com", - "time": "2018-09-07T22:44:17+00:00" + "time": "2018-09-19T18:36:57+00:00" }, { "name": "illuminate/translation", - "version": "v5.7.3", + "version": "v5.7.5", "source": { "type": "git", "url": "https://github.com/illuminate/translation.git", - "reference": "17baa5021eaed45cd193c47f9973092a6d3aed22" + "reference": "78ac624b04269250229066780613206c7355b71b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/translation/zipball/17baa5021eaed45cd193c47f9973092a6d3aed22", - "reference": "17baa5021eaed45cd193c47f9973092a6d3aed22", + "url": "https://api.github.com/repos/illuminate/translation/zipball/78ac624b04269250229066780613206c7355b71b", + "reference": "78ac624b04269250229066780613206c7355b71b", "shasum": "" }, "require": { @@ -1124,16 +1130,16 @@ }, { "name": "illuminate/view", - "version": "v5.7.3", + "version": "v5.7.5", "source": { "type": "git", "url": "https://github.com/illuminate/view.git", - "reference": "5efdaf61535cfb53024ca1933bb8fa3cb016a4c4" + "reference": "3ccd29550afe61eb02ad9e4bae0c2e661aadd7af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/view/zipball/5efdaf61535cfb53024ca1933bb8fa3cb016a4c4", - "reference": "5efdaf61535cfb53024ca1933bb8fa3cb016a4c4", + "url": "https://api.github.com/repos/illuminate/view/zipball/3ccd29550afe61eb02ad9e4bae0c2e661aadd7af", + "reference": "3ccd29550afe61eb02ad9e4bae0c2e661aadd7af", "shasum": "" }, "require": { @@ -1168,7 +1174,7 @@ ], "description": "The Illuminate View package.", "homepage": "https://laravel.com", - "time": "2018-09-03T09:36:57+00:00" + "time": "2018-09-18T12:50:05+00:00" }, { "name": "intervention/image", @@ -1477,16 +1483,16 @@ }, { "name": "nesbot/carbon", - "version": "1.33.0", + "version": "1.34.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "55667c1007a99e82030874b1bb14d24d07108413" + "reference": "1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/55667c1007a99e82030874b1bb14d24d07108413", - "reference": "55667c1007a99e82030874b1bb14d24d07108413", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33", + "reference": "1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33", "shasum": "" }, "require": { @@ -1528,7 +1534,7 @@ "datetime", "time" ], - "time": "2018-08-07T08:39:47+00:00" + "time": "2018-09-20T19:36:25+00:00" }, { "name": "neutron/temporary-filesystem", @@ -1637,20 +1643,20 @@ }, { "name": "php-ffmpeg/php-ffmpeg", - "version": "v0.12", + "version": "v0.13", "source": { "type": "git", "url": "https://github.com/PHP-FFMpeg/PHP-FFMpeg.git", - "reference": "0b871e59e7a809033fa27c3086588e72c662e9ab" + "reference": "c11b79ab5b0174aa1a56c54c67491169e78a4c17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-FFMpeg/PHP-FFMpeg/zipball/0b871e59e7a809033fa27c3086588e72c662e9ab", - "reference": "0b871e59e7a809033fa27c3086588e72c662e9ab", + "url": "https://api.github.com/repos/PHP-FFMpeg/PHP-FFMpeg/zipball/c11b79ab5b0174aa1a56c54c67491169e78a4c17", + "reference": "c11b79ab5b0174aa1a56c54c67491169e78a4c17", "shasum": "" }, "require": { - "alchemy/binary-driver": "^1.5", + "alchemy/binary-driver": "^1.5 || ~2.0.0", "doctrine/cache": "^1.0", "evenement/evenement": "^2.0 || ^1.0", "neutron/temporary-filesystem": "^2.1.1", @@ -1717,7 +1723,7 @@ "video", "video processing" ], - "time": "2018-07-06T16:51:09+00:00" + "time": "2018-08-06T20:02:43+00:00" }, { "name": "psr/container", @@ -2652,25 +2658,25 @@ }, { "name": "symfony/process", - "version": "v3.4.15", + "version": "v4.1.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "4d6b125d5293cbceedc2aa10f2c71617e76262e7" + "reference": "86cdb930a6a855b0ab35fb60c1504cb36184f843" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/4d6b125d5293cbceedc2aa10f2c71617e76262e7", - "reference": "4d6b125d5293cbceedc2aa10f2c71617e76262e7", + "url": "https://api.github.com/repos/symfony/process/zipball/86cdb930a6a855b0ab35fb60c1504cb36184f843", + "reference": "86cdb930a6a855b0ab35fb60c1504cb36184f843", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -2697,7 +2703,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-08-03T10:42:44+00:00" + "time": "2018-08-03T11:13:38+00:00" }, { "name": "symfony/translation", @@ -3713,21 +3719,24 @@ }, { "name": "phpunit/php-file-iterator", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c" + "reference": "050bedf145a257b1ff02746c31894800e5122946" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cecbc684605bb0cc288828eb5d65d93d5c676d3c", - "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", "shasum": "" }, "require": { "php": "^7.1" }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, "type": "library", "extra": { "branch-alias": { @@ -3756,7 +3765,7 @@ "filesystem", "iterator" ], - "time": "2018-06-11T11:44:00+00:00" + "time": "2018-09-13T20:33:42+00:00" }, { "name": "phpunit/php-text-template", From d10ae34c7f55d40001aae16b082958977a395902 Mon Sep 17 00:00:00 2001 From: visavi Date: Sun, 30 Sep 2018 23:53:37 +0300 Subject: [PATCH 036/163] =?UTF-8?q?=D0=BC=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/Admin/InvitationController.php | 3 ++- app/Controllers/TransferController.php | 3 ++- app/Controllers/User/UserController.php | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Controllers/Admin/InvitationController.php b/app/Controllers/Admin/InvitationController.php index 4d7efb26e..ffd945219 100644 --- a/app/Controllers/Admin/InvitationController.php +++ b/app/Controllers/Admin/InvitationController.php @@ -115,6 +115,7 @@ public function send(): void $login = check(Request::input('user')); $userkeys = int(Request::input('userkeys')); + /* @var User $user */ $user = getUserByLogin($login); $validator = new Validator(); @@ -187,7 +188,7 @@ public function mail(): void 'created_at' => SITETIME, ]); - $text = 'Поздравляем! Вы получили пригласительный ключ'.PHP_EOL.'Ваш ключ: '.$key.PHP_EOL.'С помощью этого ключа вы можете пригласить вашего друга на наш сайт!'; + $text = 'Поздравляем! Вы получили пригласительный ключ' . PHP_EOL . 'Ваш ключ: ' . $key . PHP_EOL.'С помощью этого ключа вы можете пригласить вашего друга на наш сайт!'; $user->sendMessage(null, $text); } diff --git a/app/Controllers/TransferController.php b/app/Controllers/TransferController.php index c54b8ed27..94c615668 100644 --- a/app/Controllers/TransferController.php +++ b/app/Controllers/TransferController.php @@ -10,6 +10,7 @@ class TransferController extends BaseController { + /* @var User user */ public $user; /** @@ -71,7 +72,7 @@ public function send(): void $this->user->increment('newprivat'); $comment = $msg ?? 'Не указано'; - $message = 'Пользователь [b]' . getUser()->getProfile() . '[/b] перечислил вам '.plural($money, setting('moneyname')).''.PHP_EOL.'Примечание: '.$comment; + $message = 'Пользователь [b]' . getUser()->getProfile() . '[/b] перечислил вам ' . plural($money, setting('moneyname')) . PHP_EOL . 'Примечание: ' . $comment; // Уведомление по привату $this->user->sendMessage(getUser(), $message); diff --git a/app/Controllers/User/UserController.php b/app/Controllers/User/UserController.php index 75f543429..bbc2686b0 100644 --- a/app/Controllers/User/UserController.php +++ b/app/Controllers/User/UserController.php @@ -181,6 +181,7 @@ public function register(): string $level = User::PENDED; } + /* @var User $user */ $user = User::query()->create([ 'login' => $login, 'password' => password_hash($password, PASSWORD_BCRYPT), @@ -472,6 +473,7 @@ public function account(): string * Инициализация изменения email * * @return void + * @throws Exception */ public function changeMail(): void { From b3b9f37e513e3d478c732cb2533373ea6a6ab6ad Mon Sep 17 00:00:00 2001 From: Alexander Grigorev Date: Mon, 1 Oct 2018 17:46:07 +0300 Subject: [PATCH 037/163] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BB=20=D0=BB?= =?UTF-8?q?=D0=B8=D1=88=D0=BD=D0=B8=D0=B9=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2?= =?UTF-8?q?=20setBody?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index ed251fd28..76e4d1d33 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -1751,8 +1751,7 @@ function sendMail($to, $subject, $body, array $params = []) ->setSubject($subject) ->setBody($body, 'text/html') ->setFrom($params['from']) - ->setReturnPath(env('SITE_EMAIL')) - ->setBody($body, 'text/html'); + ->setReturnPath(env('SITE_EMAIL')); if (env('MAIL_DRIVER') === 'smtp') { $transport = (new Swift_SmtpTransport()) From 43d6fc7b734fa8e3be888a25b338f36bcf27d34b Mon Sep 17 00:00:00 2001 From: visavi Date: Wed, 3 Oct 2018 02:01:47 +0300 Subject: [PATCH 038/163] =?UTF-8?q?=D0=BC=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Classes/Request.php | 3 ++- app/Controllers/User/UserController.php | 1 + app/helpers.php | 13 +++++++------ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/Classes/Request.php b/app/Classes/Request.php index b7044ce51..0edad2da3 100644 --- a/app/Classes/Request.php +++ b/app/Classes/Request.php @@ -26,12 +26,13 @@ * @method static string ip() * @method static string path() * @method static mixed server(string $key = null, mixed $default = null) + * @method static string header(string $key = null, mixed $default = null) */ class Request { public static function __callStatic($method, $args) { $request = HttpRequest::createFromGlobals(); - return call_user_func_array([$request, $method], $args); + return \call_user_func_array([$request, $method], $args); } } diff --git a/app/Controllers/User/UserController.php b/app/Controllers/User/UserController.php index bbc2686b0..01f8afb6f 100644 --- a/app/Controllers/User/UserController.php +++ b/app/Controllers/User/UserController.php @@ -253,6 +253,7 @@ public function login(): string $pass = trim(Request::input('pass')); $remember = Request::input('remember'); + /** @var User $user */ if ($user = User::auth($login, $pass, $remember)) { setFlash('success', 'Добро пожаловать, '.$user->login.'!'); diff --git a/app/helpers.php b/app/helpers.php index 76e4d1d33..e80eb4a9c 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -178,7 +178,7 @@ function intar($numbers) { if ($numbers) { if (is_array($numbers)) { - $numbers = array_map('intval', $numbers); + $numbers = array_map('\intval', $numbers); } else { $numbers = [(int) $numbers]; } @@ -229,11 +229,11 @@ function formatFileSize($file) function formatTime($time) { $units = [ - 'год,года,лет' => 365 * 24 * 60 * 60, - 'месяц,месяца,месяцев' => 30 * 24 * 60 * 60, - 'неделя,недели,недель' => 7 * 24 * 60 * 60, - 'день,дня,дней' => 24 * 60 * 60, - 'час,часа,часов' => 60 * 60, + 'год,года,лет' => 31536000, + 'месяц,месяца,месяцев' => 2592000, + 'неделя,недели,недель' => 604800, + 'день,дня,дней' => 86400, + 'час,часа,часов' => 3600, 'минута,минуты,минут' => 60, 'секунда,секунды,секунд' => 1, ]; @@ -875,6 +875,7 @@ function checkAuth() { if (isset($_SESSION['id'], $_SESSION['password'])) { + /** @var User $user */ $user = User::query()->find($_SESSION['id']); if ($user && $_SESSION['password'] === md5(env('APP_KEY') . $user->password)) { From 8c7f9d0c6481a4a2425163053f9282dc6bbda2ae Mon Sep 17 00:00:00 2001 From: Alexandr Sytnyk Date: Wed, 10 Oct 2018 13:50:37 +0300 Subject: [PATCH 039/163] Update ActiveController.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Исправить ошибку в постраничной навигации #108 --- app/Controllers/Load/ActiveController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Controllers/Load/ActiveController.php b/app/Controllers/Load/ActiveController.php index 064fd06f5..181e36885 100644 --- a/app/Controllers/Load/ActiveController.php +++ b/app/Controllers/Load/ActiveController.php @@ -70,7 +70,10 @@ public function files(): string public function comments(): string { $user = $this->user; - $total = Comment::query()->where('relate_type', Down::class)->count(); + $total = Comment::query() + ->where('relate_type', Down::class) + ->where('user_id', $user->id) + ->count(); if ($total > 500) { $total = 500; From 0187d70699a969fa14e637289a978842b97cd64c Mon Sep 17 00:00:00 2001 From: Alexandr Sytnyk Date: Wed, 10 Oct 2018 14:02:55 +0300 Subject: [PATCH 040/163] Update MailController.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit После восстановления пароля перекидывать на страницу авторизации --- app/Controllers/MailController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/MailController.php b/app/Controllers/MailController.php index c625d5471..c84517b04 100644 --- a/app/Controllers/MailController.php +++ b/app/Controllers/MailController.php @@ -89,7 +89,7 @@ public function recovery() sendMail($user['email'], $subject, $body); setFlash('success', 'Восстановление пароля инициализировано!'); - redirect('/recovery'); + redirect('/login'); } else { setInput(Request::all()); setFlash('danger', $validator->getErrors()); From cb2d12b334af9553d97ee882efe588add83e9342 Mon Sep 17 00:00:00 2001 From: Alexandr Sytnyk Date: Wed, 10 Oct 2018 14:08:42 +0300 Subject: [PATCH 041/163] Update helpers.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit сделать чтобы IP по CF-Connecting-IP определялся по возможности --- app/helpers.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/helpers.php b/app/helpers.php index e80eb4a9c..ee3f14de6 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -1863,6 +1863,13 @@ function bbCode($text, $parse = true) function getIp() { $ip = Request::ip(); + + if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) { + if (filter_var($_SERVER["HTTP_CF_CONNECTING_IP"], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false){ + $ip = $_SERVER["HTTP_CF_CONNECTING_IP"]; + } + } + return $ip === '::1' ? '127.0.0.1' : $ip; } From 53cdd20724e028b60ae789c84b8522084abcbdfc Mon Sep 17 00:00:00 2001 From: visavi Date: Sat, 13 Oct 2018 15:10:31 +0300 Subject: [PATCH 042/163] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D1=8B=D0=B5=20=D0=B1?= =?UTF-8?q?=D0=BE=D0=BB=D0=B5=D0=B5=20=D0=B1=D1=8B=D1=81=D1=82=D1=80=D1=8B?= =?UTF-8?q?=D0=B5=20=D1=80=D0=BE=D1=83=D1=82=D1=8B=20nikic/FastRoute,=20?= =?UTF-8?q?=D0=BA=D1=8D=D1=88=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=B8=20=D0=B3=D1=80=D1=83=D0=BF=D0=BF=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=BA=D0=B0=20=D1=80=D0=BE=D1=83=D1=82=D0=BE=D0=B2?= =?UTF-8?q?,=20=D0=B2=D0=BE=D0=B7=D0=B2=D1=80=D0=B0=D1=82=20=D0=BE=D1=88?= =?UTF-8?q?=D0=B8=D0=B1=D0=BA=D0=B8=20405?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Classes/Application.php | 53 +- app/Classes/Request.php | 2 +- app/Controllers/AjaxController.php | 13 +- app/Controllers/ApiController.php | 1 + app/Controllers/BlogController.php | 121 ++-- app/Controllers/BoardController.php | 15 +- app/Controllers/GuestbookController.php | 1 + app/Controllers/HomeController.php | 10 + app/Controllers/SitemapController.php | 3 + app/Models/BaseModel.php | 6 + app/Models/Blog.php | 21 +- app/Models/Item.php | 1 + app/helpers.php | 30 +- app/routes.php | 914 +++++++++++++----------- app/start.php | 72 +- composer.json | 5 +- composer.lock | 360 +++++----- public/index.php | 6 +- resources/views/errors/405.blade.php | 27 + 19 files changed, 910 insertions(+), 751 deletions(-) create mode 100644 resources/views/errors/405.blade.php diff --git a/app/Classes/Application.php b/app/Classes/Application.php index 92f4e5abe..b37e9ac89 100644 --- a/app/Classes/Application.php +++ b/app/Classes/Application.php @@ -2,41 +2,52 @@ namespace App\Classes; +use Illuminate\Http\Request; +use FastRoute\Dispatcher; + class Application { /** * Запускает приложение */ - public static function run() + public function run(): void { - $router = self::getRouter(); + $router = $this->getRouter(); - if (! $router['target']) { - abort(404); - } + switch ($router[0]) { + case Dispatcher::FOUND: + echo $this->getController($router); + break; - if (\is_callable($router['target'])) { - $call = \call_user_func_array($router['target'], $router['params']); - } else { - list($controller, $action) = self::getController($router); - $call = \call_user_func_array([new $controller, $action], $router['params']); + case Dispatcher::METHOD_NOT_ALLOWED: + abort(405); + break; + + default: + abort(404); + break; } - echo $call; + // $router['params']['request'] = Request::createFromGlobals(); } /** - * Подготовливает пути из роутов + * Вызывает контроллер * - * @param $router - * @return array + * @param array $router + * @return mixed */ - private static function getController($router) + private function getController($router) { - $target = explode('@', $router['target']); - $action = $router['params']['action'] ?? $target[1]; + [, $controller, $params] = $router; - return ['App\\Controllers\\'.$target[0], $action]; + if (\is_object($controller)) { + return \call_user_func_array($controller, $params); + } + + $action = $params['action'] ?? $controller[1]; + + return \call_user_func_array([new $controller[0], $action], $params); } /** @@ -44,8 +55,10 @@ private static function getController($router) * * @return array */ - private static function getRouter() + private function getRouter(): array { - return Registry::get('router')->match(); + $dispatcher = require APP . '/routes.php'; + + return $dispatcher->dispatch(server('REQUEST_METHOD'), server('PHP_SELF')); } } diff --git a/app/Classes/Request.php b/app/Classes/Request.php index 0edad2da3..0c9115f12 100644 --- a/app/Classes/Request.php +++ b/app/Classes/Request.php @@ -26,7 +26,7 @@ * @method static string ip() * @method static string path() * @method static mixed server(string $key = null, mixed $default = null) - * @method static string header(string $key = null, mixed $default = null) + * @method static mixed header(string $key = null, mixed $default = null) */ class Request { diff --git a/app/Controllers/AjaxController.php b/app/Controllers/AjaxController.php index dd139f58e..97cf94343 100644 --- a/app/Controllers/AjaxController.php +++ b/app/Controllers/AjaxController.php @@ -41,7 +41,7 @@ public function checkAjax(): string { if (! Request::ajax()) { return json_encode([ - 'status' => 'error', + 'status' => 'error', 'message' => 'This is not ajax request' ]); } @@ -54,11 +54,11 @@ public function checkAjax(): string * * @return string */ - public function checkAuthorize(): string + private function checkAuthorize(): string { if (! getUser()) { return json_encode([ - 'status' => 'error', + 'status' => 'error', 'message' => 'Not authorized' ]); } @@ -179,7 +179,7 @@ public function complaint(): string } return json_encode([ - 'status' => 'error', + 'status' => 'error', 'message' => current($validator->getErrors()) ]); } @@ -218,7 +218,7 @@ public function delComment(): string } return json_encode([ - 'status' => 'error', + 'status' => 'error', 'message' => current($validator->getErrors()) ]); } @@ -398,6 +398,7 @@ public function deleteImage(): string return json_encode(['status' => 'error', 'message' => 'Type invalid']); } + /** @var File $file */ $file = File::query() ->where('relate_type', $type) ->find($id); @@ -419,7 +420,7 @@ public function deleteImage(): string $file->delete(); return json_encode([ - 'status' => 'success', + 'status' => 'success', ]); } diff --git a/app/Controllers/ApiController.php b/app/Controllers/ApiController.php index a2eaf6e12..b0e2fe4f7 100644 --- a/app/Controllers/ApiController.php +++ b/app/Controllers/ApiController.php @@ -148,6 +148,7 @@ public function forums(): void exit(); } + /** @var Topic $topic */ $topic = Topic::query()->find($id); if (! $topic) { echo json_encode(['error' => 'no topic']); diff --git a/app/Controllers/BlogController.php b/app/Controllers/BlogController.php index bfaa6f555..132880054 100644 --- a/app/Controllers/BlogController.php +++ b/app/Controllers/BlogController.php @@ -141,6 +141,7 @@ public function edit($id): string abort(403, 'Для редактирования статьи необходимо авторизоваться'); } + /** @var Blog $blog */ $blog = Blog::query()->find($id); if (! $blog) { @@ -159,6 +160,7 @@ public function edit($id): string $text = check(Request::input('text')); $tags = check(Request::input('tags')); + /** @var Category $category */ $category = Category::query()->find($cid); $validator = new Validator(); @@ -262,6 +264,7 @@ public function create(): string $text = check(Request::input('text')); $tags = check(Request::input('tags')); + /** @var Category $category */ $category = Category::query()->find($cid); $validator = new Validator(); @@ -281,7 +284,8 @@ public function create(): string $text = antimat($text); - $article = Blog::query()->create([ + /** @var Blog $blog */ + $blog = Blog::query()->create([ 'category_id' => $cid, 'user_id' => getUser('id'), 'title' => $title, @@ -301,10 +305,10 @@ public function create(): string ->where('relate_type', Blog::class) ->where('relate_id', 0) ->where('user_id', getUser('id')) - ->update(['relate_id' => $article->id]); + ->update(['relate_id' => $blog->id]); setFlash('success', 'Статья успешно опубликована!'); - redirect('/articles/' . $article->id); + redirect('/articles/' . $blog->id); } else { setInput(Request::all()); setFlash('danger', $validator->getErrors()); @@ -328,6 +332,7 @@ public function create(): string */ public function comments($id): string { + /** @var Blog $blog */ $blog = Blog::query()->find($id); if (! $blog) { @@ -406,6 +411,8 @@ public function comments($id): string public function editComment($id, $cid): string { $page = int(Request::input('page', 1)); + + /** @var Blog $blog */ $blog = Blog::query()->find($id); if (! $blog) { @@ -489,6 +496,7 @@ public function end($id): void */ public function print($id): string { + /** @var Blog $blog */ $blog = Blog::query()->find($id); if (! $blog) { @@ -537,58 +545,12 @@ public function rssComments($id): string } /** - * Поиск по тегам + * Вывод всех тегов * - * @param string $tag * @return string */ - public function tags($tag = null): string + public function tags() { - if ($tag) { - $tag = urldecode($tag); - - if (! isUtf($tag)) { - $tag = winToUtf($tag); - } - - if (utfStrlen($tag) < 2) { - setFlash('danger', 'Ошибка! Необходимо не менее 2-х символов в запросе!'); - redirect('/blogs/tags'); - } - - if ( - empty($_SESSION['findresult']) || - empty($_SESSION['blogfind']) || - $tag !== $_SESSION['blogfind'] - ) { - $result = Blog::query() - ->select('id') - ->where('tags', 'like', '%'.$tag.'%') - ->limit(500) - ->pluck('id') - ->all(); - - $_SESSION['blogfind'] = $tag; - $_SESSION['findresult'] = $result; - } - - $total = \count($_SESSION['findresult']); - $page = paginate(setting('blogpost'), $total); - - $blogs = Blog::query() - ->select('blogs.*', 'categories.name') - ->whereIn('blogs.id', $_SESSION['findresult']) - ->join('categories', 'blogs.category_id', '=', 'categories.id') - ->orderBy('created_at', 'desc') - ->offset($page->offset) - ->limit($page->limit) - ->with('user') - ->get(); - - return view('blogs/tags_search', compact('blogs', 'tag', 'page')); - - } - if (@filemtime(STORAGE . '/temp/tagcloud.dat') < time() - 3600) { $allTags = Blog::query() @@ -606,13 +568,65 @@ public function tags($tag = null): string file_put_contents(STORAGE . '/temp/tagcloud.dat', json_encode($allTags, JSON_UNESCAPED_UNICODE), LOCK_EX); } - $tags = json_decode(file_get_contents(STORAGE.'/temp/tagcloud.dat'), true); + + $tags = json_decode(file_get_contents(STORAGE . '/temp/tagcloud.dat'), true); $max = max($tags); $min = min($tags); return view('blogs/tags', compact('tags', 'max', 'min')); } + /** + * Поиск по тегам + * + * @param string $tag + * @return string + */ + public function searchTag($tag): string + { + $tag = urldecode($tag); + + if (! isUtf($tag)) { + $tag = winToUtf($tag); + } + + if (utfStrlen($tag) < 2) { + setFlash('danger', 'Ошибка! Необходимо не менее 2-х символов в запросе!'); + redirect('/blogs/tags'); + } + + if ( + empty($_SESSION['findresult']) || + empty($_SESSION['blogfind']) || + $tag !== $_SESSION['blogfind'] + ) { + $result = Blog::query() + ->select('id') + ->where('tags', 'like', '%'.$tag.'%') + ->limit(500) + ->pluck('id') + ->all(); + + $_SESSION['blogfind'] = $tag; + $_SESSION['findresult'] = $result; + } + + $total = \count($_SESSION['findresult']); + $page = paginate(setting('blogpost'), $total); + + $blogs = Blog::query() + ->select('blogs.*', 'categories.name') + ->whereIn('blogs.id', $_SESSION['findresult']) + ->join('categories', 'blogs.category_id', '=', 'categories.id') + ->orderBy('created_at', 'desc') + ->offset($page->offset) + ->limit($page->limit) + ->with('user') + ->get(); + + return view('blogs/tags_search', compact('blogs', 'tag', 'page')); + } + /** * Новые статьи * @@ -735,6 +749,7 @@ public function userComments(): string */ public function viewComment($id, $cid): void { + /** @var Blog $blog */ $blog = Blog::query()->find($id); if (! $blog) { @@ -759,7 +774,7 @@ public function viewComment($id, $cid): void */ public function top(): string { - $sort = check(Request::get('sort', 'visits')); + $sort = check(Request::input('sort', 'visits')); switch ($sort) { case 'rated': $order = 'rating'; diff --git a/app/Controllers/BoardController.php b/app/Controllers/BoardController.php index 616c5b518..4d093b2f0 100644 --- a/app/Controllers/BoardController.php +++ b/app/Controllers/BoardController.php @@ -9,6 +9,7 @@ use App\Models\Flood; use App\Models\Item; use Exception; +use Illuminate\Database\Eloquent\Builder; class BoardController extends BaseController { @@ -18,11 +19,12 @@ class BoardController extends BaseController * @param int $id * @return string */ - public function index($id = null): string + public function index(int $id = null): string { $board = null; if ($id) { + /** @var Board $board */ $board = Board::query()->find($id); if (! $board) { @@ -31,7 +33,7 @@ public function index($id = null): string } $total = Item::query() - ->when($board, function ($query) use ($board) { + ->when($board, function (Builder $query) use ($board) { return $query->where('board_id', $board->id); }) ->where('expires_at', '>', SITETIME) @@ -40,7 +42,7 @@ public function index($id = null): string $page = paginate(10, $total); $items = Item::query() - ->when($board, function ($query) use ($board) { + ->when($board, function (Builder $query) use ($board) { return $query->where('board_id', $board->id); }) ->where('expires_at', '>', SITETIME) @@ -65,6 +67,7 @@ public function index($id = null): string */ public function view($id): string { + /** @var Item $item */ $item = Item::query() ->with('category') ->find($id); @@ -111,6 +114,7 @@ public function create(): string $price = int(Request::input('price')); $phone = preg_replace('/\D/', '', Request::input('phone')); + /** @var Board $board */ $board = Board::query()->find($bid); $validator = new Validator(); @@ -128,6 +132,7 @@ public function create(): string if ($validator->isValid()) { + /** @var Item $item */ $item = Item::query()->create([ 'board_id' => $board->id, 'title' => $title, @@ -177,6 +182,7 @@ public function edit($id): string abort(403, 'Для редактирования объявления необходимо авторизоваться'); } + /** @var Item $item */ $item = Item::query()->find($id); if (! $item) { @@ -191,6 +197,7 @@ public function edit($id): string $price = check(Request::input('price')); $phone = preg_replace('/\D/', '', Request::input('phone')); + /** @var Board $board */ $board = Board::query()->find($bid); $validator = new Validator(); @@ -252,6 +259,7 @@ public function close($id): void abort(403, 'Для редактирования объявления необходимо авторизоваться'); } + /** @var Item $item */ $item = Item::query()->find($id); if (! $item) { @@ -305,6 +313,7 @@ public function delete($id): void abort(403, 'Для редактирования объявления необходимо авторизоваться'); } + /** @var Item $item */ $item = Item::query()->find($id); if (! $item) { diff --git a/app/Controllers/GuestbookController.php b/app/Controllers/GuestbookController.php index 958ca9867..180e01722 100644 --- a/app/Controllers/GuestbookController.php +++ b/app/Controllers/GuestbookController.php @@ -100,6 +100,7 @@ public function edit($id): string abort(403); } + /** @var Guestbook $post */ $post = Guestbook::query()->where('user_id', getUser('id'))->find($id); if (! $post) { diff --git a/app/Controllers/HomeController.php b/app/Controllers/HomeController.php index a4438e744..66cbedf64 100644 --- a/app/Controllers/HomeController.php +++ b/app/Controllers/HomeController.php @@ -86,4 +86,14 @@ public function captcha(): void $_SESSION['protect'] = $builder->getPhrase(); } + + /** + * Поиск по сайту + * + * @return string + */ + public function search(): string + { + return view('search/index'); + } } diff --git a/app/Controllers/SitemapController.php b/app/Controllers/SitemapController.php index 22b294207..abd1ccc13 100644 --- a/app/Controllers/SitemapController.php +++ b/app/Controllers/SitemapController.php @@ -160,6 +160,9 @@ public function downs() /** * Если вызывается несуществуюший метод + * + * @param string $name + * @param array $arguments */ public function __call($name, $arguments) { diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php index 307688662..588f91091 100644 --- a/app/Models/BaseModel.php +++ b/app/Models/BaseModel.php @@ -7,6 +7,12 @@ use Illuminate\Http\UploadedFile; use Intervention\Image\ImageManagerStatic as Image; +/** + * Class BaseModel + * + * @property User user + * @package App\Models + */ class BaseModel extends Model { /** diff --git a/app/Models/Blog.php b/app/Models/Blog.php index 3d5b0e127..207e53f58 100644 --- a/app/Models/Blog.php +++ b/app/Models/Blog.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\MorphMany; @@ -19,6 +20,7 @@ * @property int visits * @property int count_comments * @property int created_at + * @property Collection files */ class Blog extends BaseModel { @@ -43,15 +45,6 @@ class Blog extends BaseModel */ public $uploadPath = UPLOADS . '/blogs'; - /** - * The attributes that should be cast to native types. - * - * @var array - */ - protected $casts = [ - 'user_id' => 'int', - ]; - /** * Возвращает комментарии блогов * @@ -98,11 +91,11 @@ public function files(): MorphMany /** * Возвращает размер шрифта для облака тегов * - * @param int $count - * @param int $minCount - * @param int $maxCount - * @param int $minSize - * @param int $maxSize + * @param int $count + * @param float $minCount + * @param float $maxCount + * @param int $minSize + * @param int $maxSize * @return int */ public static function logTagSize($count, $minCount, $maxCount, $minSize = 10, $maxSize = 30): int diff --git a/app/Models/Item.php b/app/Models/Item.php index 7abe786db..4d4240192 100644 --- a/app/Models/Item.php +++ b/app/Models/Item.php @@ -18,6 +18,7 @@ * @property int created_at * @property int updated_at * @property int expires_at + * @property Board category */ class Item extends BaseModel { diff --git a/app/helpers.php b/app/helpers.php index e80eb4a9c..6d65813a3 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -1587,20 +1587,27 @@ function view($view, array $params = []) */ function abort($code, $message = null) { - if ($code === 403) { - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); - } - - if ($code === 404) { - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); - } - - if (setting('errorlog') && in_array($code, [403, 404], true)) { + $protocol = server('SERVER_PROTOCOL'); + $referer = server('HTTP_REFERER') ?? null; + + switch ($code) { + case 403: + header($protocol . ' 403 Forbidden'); + break; + case 404: + header($protocol . ' 404 Not Found'); + break; + case 405: + header($protocol . ' 405 Method Not Allowed'); + break; + } + + if (setting('errorlog') && in_array($code, [403, 404, 405], true)) { Error::query()->create([ 'code' => $code, 'request' => utfSubstr(server('REQUEST_URI'), 0, 200), - 'referer' => utfSubstr(server('HTTP_REFERER'), 0, 200), + 'referer' => utfSubstr($referer, 0, 200), 'user_id' => getUser('id'), 'ip' => getIp(), 'brow' => getBrowser(), @@ -1609,7 +1616,7 @@ function abort($code, $message = null) } if (Request::ajax()) { - header($_SERVER['SERVER_PROTOCOL'] . ' 200 OK'); + header($protocol . ' 200 OK'); exit(json_encode([ 'status' => 'error', @@ -1617,7 +1624,6 @@ function abort($code, $message = null) ])); } - $referer = Request::header('referer') ?? null; exit(view('errors/' . $code, compact('message', 'referer'))); } diff --git a/app/routes.php b/app/routes.php index 5d1adb4db..01c638394 100644 --- a/app/routes.php +++ b/app/routes.php @@ -1,416 +1,504 @@ addMatchTypes([ - 'letter' => '[0-9a-z]', - 'user' => '[0-9A-Za-z-_]++', +use FastRoute\RouteCollector; + +return FastRoute\cachedDispatcher(function(RouteCollector $r) +{ + $r->get('/', [App\Controllers\HomeController::class, 'index']); + $r->get('/captcha', [App\Controllers\HomeController::class, 'captcha']); + $r->get('/closed', [App\Controllers\HomeController::class, 'closed']); + $r->get('/search',[App\Controllers\HomeController::class, 'search']); + $r->addRoute(['GET', 'POST'], '/banip', [App\Controllers\HomeController::class, 'banip']); + + /* Карта сайта */ + $r->get('/sitemap.xml', [App\Controllers\SitemapController::class, 'index']); + $r->get('/sitemap/{action:[a-z]+}.xml', [App\Controllers\SitemapController::class]); + + /* Категории объявления */ + $r->addGroup('/boards', function (RouteCollector $r) { + $r->get('[/{id:\d+}]', [App\Controllers\BoardController::class, 'index']); + $r->get('/active', [App\Controllers\BoardController::class, 'active']); + }); + + /* Объявления */ + $r->addGroup('/items', function (RouteCollector $r) { + $r->get('/{id:\d+}', [App\Controllers\BoardController::class, 'view']); + $r->get('/close/{id:\d+}', [App\Controllers\BoardController::class, 'close']); + $r->get('/delete/{id:\d+}', [App\Controllers\BoardController::class, 'delete']); + $r->addRoute(['GET', 'POST'], '/create', [App\Controllers\BoardController::class, 'create']); + $r->addRoute(['GET', 'POST'], '/edit/{id:\d+}', [App\Controllers\BoardController::class, 'edit']); + }); + + /* Гостевая книга */ + $r->addGroup('/guestbooks', function (RouteCollector $r) { + $r->get('', [App\Controllers\GuestbookController::class, 'index']); + $r->post('/add', [App\Controllers\GuestbookController::class, 'add']); + $r->addRoute(['GET', 'POST'], '/edit/{id:\d+}', [App\Controllers\GuestbookController::class, 'edit']); + }); + + /* Категория блогов */ + $r->addGroup('/blogs', function (RouteCollector $r) { + $r->get('', [App\Controllers\BlogController::class, 'index']); + $r->get('/{id:\d+}', [App\Controllers\BlogController::class, 'blog']); + $r->get('/tags', [App\Controllers\BlogController::class, 'tags']); + $r->get('/tags/{tag:.*}', [App\Controllers\BlogController::class, 'searchTag']); + $r->get('/authors', [App\Controllers\BlogController::class, 'authors']); + $r->get('/active/articles', [App\Controllers\BlogController::class, 'userArticles']); + $r->get('/active/comments', [App\Controllers\BlogController::class, 'userComments']); + $r->get('/top', [App\Controllers\BlogController::class, 'top']); + $r->get('/rss', [App\Controllers\BlogController::class, 'rss']); + $r->addRoute(['GET', 'POST'], '/create', [App\Controllers\BlogController::class, 'create']); + $r->addRoute(['GET', 'POST'], '/search', [App\Controllers\BlogController::class, 'search']); + }); + + /* Статьи блогов */ + $r->addGroup('/articles', function (RouteCollector $r) { + $r->get('', [App\Controllers\BlogController::class, 'newArticles']); + $r->get('/{id:\d+}', [App\Controllers\BlogController::class, 'view']); + $r->get('/print/{id:\d+}', [App\Controllers\BlogController::class, 'print']); + $r->get('/rss/{id:\d+}', [App\Controllers\BlogController::class, 'rssComments']); + $r->get('/comments', [App\Controllers\BlogController::class, 'newComments']); + $r->get('/end/{id:\d+}', [App\Controllers\BlogController::class, 'end']); + $r->get('/comment/{id:\d+}/{cid:\d+}', [App\Controllers\BlogController::class, 'viewComment']); + $r->addRoute(['GET', 'POST'], '/edit/{id:\d+}', [App\Controllers\BlogController::class, 'edit']); + $r->addRoute(['GET', 'POST'], '/comments/{id:\d+}', [App\Controllers\BlogController::class, 'comments']); + $r->addRoute(['GET', 'POST'], '/edit/{id:\d+}/{cid:\d+}', [App\Controllers\BlogController::class, 'editComment']); + }); + + /* Новости */ + $r->addGroup('/news', function (RouteCollector $r) { + $r->get('', [App\Controllers\NewsController::class, 'index']); + $r->get('/{id:\d+}', [App\Controllers\NewsController::class, 'view']); + $r->get('/end/{id:\d+}', [App\Controllers\NewsController::class, 'end']); + $r->get('/rss', [App\Controllers\NewsController::class, 'rss']); + $r->get('/allcomments', [App\Controllers\NewsController::class, 'allComments']); + $r->get('/comment/{id:\d+}/{cid:\d+}', [App\Controllers\NewsController::class, 'viewComment']); + $r->addRoute(['GET', 'POST'], '/comments/{id:\d+}', [App\Controllers\NewsController::class, 'comments']); + $r->addRoute(['GET', 'POST'], '/edit/{id:\d+}/{cid:\d+}', [App\Controllers\NewsController::class, 'editComment']); + }); + + /* Фотогалерея */ + $r->addGroup('/photos', function (RouteCollector $r) { + $r->get('', [App\Controllers\PhotoController::class, 'index']); + $r->get('/{id:\d+}', [App\Controllers\PhotoController::class, 'view']); + $r->get('/delete/{id:\d+}', [App\Controllers\PhotoController::class, 'delete']); + $r->get('/end/{id:\d+}', [App\Controllers\PhotoController::class, 'end']); + $r->get('/albums', [App\Controllers\PhotoController::class, 'albums']); + $r->get('/albums/{login:[\w\-]+}', [App\Controllers\PhotoController::class, 'album']); + $r->get('/comments', [App\Controllers\PhotoController::class, 'allComments']); + $r->get('/comments/{login:[\w\-]+}', [App\Controllers\PhotoController::class, 'userComments']); + $r->get('/comments/{id:\d+}/{cid:\d+}', [App\Controllers\PhotoController::class, 'viewComment']); + $r->addRoute(['GET', 'POST'], '/comments/{id:\d+}', [App\Controllers\PhotoController::class, 'comments']); + $r->addRoute(['GET', 'POST'], '/create', [App\Controllers\PhotoController::class, 'create']); + $r->addRoute(['GET', 'POST'], '/edit/{id:\d+}', [App\Controllers\PhotoController::class, 'edit']); + $r->addRoute(['GET', 'POST'], '/edit/{id:\d+}/{cid:\d+}', [App\Controllers\PhotoController::class, 'editComment']); + $r->addRoute(['GET', 'POST'], '/top', [App\Controllers\PhotoController::class, 'top']); + }); + + /* Категория форума */ + $r->addGroup('/forums', function (RouteCollector $r) { + $r->get('', [App\Controllers\Forum\ForumController::class, 'index']); + $r->get('/{id:\d+}', [App\Controllers\Forum\ForumController::class, 'forum']); + $r->get('/search', [App\Controllers\Forum\ForumController::class, 'search']); + $r->get('/active/{action:posts|topics}', [App\Controllers\Forum\ActiveController::class]); + $r->post('/active/delete', [App\Controllers\Forum\ActiveController::class, 'delete']); + $r->get('/top/post', [App\Controllers\Forum\ForumController::class, 'topPosts']); + $r->get('/top/topics', [App\Controllers\Forum\ForumController::class, 'topTopics']); + $r->get('/rss', [App\Controllers\Forum\ForumController::class, 'rss']); + $r->get('/bookmarks', [App\Controllers\BookmarkController::class, 'index']); + $r->post('/bookmarks/{action:delete|perform}', [App\Controllers\BookmarkController::class]); + $r->addRoute(['GET', 'POST'], '/create', [App\Controllers\Forum\ForumController::class, 'create']); + }); + + /* Темы форума */ + $r->addGroup('/topics', function (RouteCollector $r) { + $r->get('', [App\Controllers\Forum\NewController::class, 'topics']); + $r->get('/{id:\d+}', [App\Controllers\Forum\TopicController::class, 'index']); + $r->get('/{id:\d+}/{pid:\d+}', [App\Controllers\Forum\TopicController::class, 'viewpost']); + $r->post('/votes/{id:\d+}', [App\Controllers\Forum\TopicController::class, 'vote']); + $r->get('/end/{id:\d+}', [App\Controllers\Forum\TopicController::class, 'end']); + $r->get('/close/{id:\d+}', [App\Controllers\Forum\TopicController::class, 'close']); + $r->post('/create/{id:\d+}', [App\Controllers\Forum\TopicController::class, 'create']); + $r->post('/delete/{id:\d+}', [App\Controllers\Forum\TopicController::class, 'delete']); + $r->get('/print/{id:\d+}', [App\Controllers\Forum\TopicController::class, 'print']); + $r->get('/rss/{id:\d+}', [App\Controllers\Forum\ForumController::class, 'rssPosts']); + $r->addRoute(['GET', 'POST'], '/edit/{id:\d+}', [App\Controllers\Forum\TopicController::class, 'edit']); + }); + + /* Посты форума */ + $r->addGroup('/posts', function (RouteCollector $r) { + $r->get('', [App\Controllers\Forum\NewController::class, 'posts']); + $r->addRoute(['GET', 'POST'], '/edit/{id:\d+}', [App\Controllers\Forum\TopicController::class, 'editPost']); + }); + + /* Категории загрузок */ + $r->addGroup('/loads', function (RouteCollector $r) { + $r->get('', [App\Controllers\Load\LoadController::class, 'index']); + $r->get('/rss', [App\Controllers\Load\LoadController::class, 'rss']); + $r->get('/{id:\d+}', [App\Controllers\Load\LoadController::class, 'load']); + $r->get('/top', [App\Controllers\Load\TopController::class, 'index']); + $r->get('/search', [App\Controllers\Load\SearchController::class, 'index']); + }); + + /* Загрузки */ + $r->addGroup('/downs', function (RouteCollector $r) { + $r->get('', [App\Controllers\Load\NewController::class, 'files']); + $r->get('/{id:\d+}', [App\Controllers\Load\DownController::class, 'index']); + $r->get('/delete/{id:\d+}/{fid:\d+}', [App\Controllers\Load\DownController::class, 'deleteFile']); + $r->post('/votes/{id:\d+}', [App\Controllers\Load\DownController::class, 'vote']); + $r->get('/comment/{id:\d+}/{cid:\d+}', [App\Controllers\Load\DownController::class, 'viewComment']); + $r->get('/end/{id:\d+}', [App\Controllers\Load\DownController::class, 'end']); + $r->get('/rss/{id:\d+}', [App\Controllers\Load\DownController::class, 'rss']); + $r->get('/zip/{id:\d+}', [App\Controllers\Load\DownController::class, 'zip']); + $r->get('/zip/{id:\d+}/{fid:\d+}', [App\Controllers\Load\DownController::class, 'zipView']); + $r->get('/comments', [App\Controllers\Load\NewController::class, 'comments']); + $r->get('/active/files', [App\Controllers\Load\ActiveController::class, 'files']); + $r->get('/active/comments', [App\Controllers\Load\ActiveController::class, 'comments']); + $r->addRoute(['GET', 'POST'], '/edit/{id:\d+}', [App\Controllers\Load\DownController::class, 'edit']); + $r->addRoute(['GET', 'POST'], '/create', [App\Controllers\Load\DownController::class, 'create']); + $r->addRoute(['GET', 'POST'], '/download/{id:\d+}', [App\Controllers\Load\DownController::class, 'download']); + $r->addRoute(['GET', 'POST'], '/comments/{id:\d+}', [App\Controllers\Load\DownController::class, 'comments']); + $r->addRoute(['GET', 'POST'], '/edit/{id:\d+}/{cid:\d+}', [App\Controllers\Load\DownController::class, 'editComment']); + }); + + /* Предложения и проблемы */ + $r->addGroup('/offers', function (RouteCollector $r) { + $r->get('[/{type:offer|issue}]', [App\Controllers\OfferController::class, 'index']); + $r->get('/{id:\d+}', [App\Controllers\OfferController::class, 'view']); + $r->get('/end/{id:\d+}', [App\Controllers\OfferController::class, 'end']); + $r->get('/comment/{id:\d+}/{cid:\d+}', [App\Controllers\OfferController::class, 'viewComment']); + $r->addRoute(['GET', 'POST'], '/create', [App\Controllers\OfferController::class, 'create']); + $r->addRoute(['GET', 'POST'], '/edit/{id:\d+}', [App\Controllers\OfferController::class, 'edit']); + $r->addRoute(['GET', 'POST'], '/comments/{id:\d+}', [App\Controllers\OfferController::class, 'comments']); + $r->addRoute(['GET', 'POST'], '/edit/{id:\d+}/{cid:\d+}', [App\Controllers\OfferController::class, 'editComment']); + }); + + /* Ajax */ + $r->addGroup('/ajax', function (RouteCollector $r) { + $r->post('/bbcode', [App\Controllers\AjaxController::class, 'bbCode']); + $r->post('/delcomment', [App\Controllers\AjaxController::class, 'delComment']); + $r->post('/rating', [App\Controllers\AjaxController::class, 'rating']); + $r->post('/vote', [App\Controllers\AjaxController::class, 'vote']); + $r->post('/complaint', [App\Controllers\AjaxController::class, 'complaint']); + $r->post('/image/upload', [App\Controllers\AjaxController::class, 'uploadImage']); + $r->post('/image/delete', [App\Controllers\AjaxController::class, 'deleteImage']); + }); + + /* Голосования */ + $r->addGroup('/votes', function (RouteCollector $r) { + $r->get('', [App\Controllers\VoteController::class, 'index']); + $r->get('/voters/{id:\d+}', [App\Controllers\VoteController::class, 'voters']); + $r->get('/history', [App\Controllers\VoteController::class, 'history']); + $r->get('/history/{id:\d+}', [App\Controllers\VoteController::class, 'viewHistory']); + $r->addRoute(['GET', 'POST'], '/{id:\d+}', [App\Controllers\VoteController::class, 'view']); + $r->addRoute(['GET', 'POST'], '/create', [App\Controllers\VoteController::class, 'create']); + }); + + /* Мои данные */ + $r->addGroup('/accounts', function (RouteCollector $r) { + $r->get('', [App\Controllers\User\UserController::class, 'account']); + $r->get('/editmail', [App\Controllers\User\UserController::class, 'editMail']); + $r->post('/changemail', [App\Controllers\User\UserController::class, 'changeMail']); + $r->post('/editstatus', [App\Controllers\User\UserController::class, 'editStatus']); + $r->post('/editpassword', [App\Controllers\User\UserController::class, 'editPassword']); + $r->post('/apikey', [App\Controllers\User\UserController::class, 'apikey']); + }); + + /* Фото профиля */ + $r->addGroup('/pictures', function (RouteCollector $r) { + $r->addRoute(['GET', 'POST'], '', [App\Controllers\PictureController::class, 'index']); + $r->get('/delete', [App\Controllers\PictureController::class, 'delete']); + }); + + /* Социальные сети */ + $r->addGroup('/socials', function (RouteCollector $r) { + $r->addRoute(['GET', 'POST'], '', [App\Controllers\SocialController::class, 'index']); + $r->get('/delete/{id:\d+}', [App\Controllers\SocialController::class, 'delete']); + }); + + /* Поиск пользователя */ + $r->addGroup('/searchusers', function (RouteCollector $r) { + $r->get('', [App\Controllers\User\SearchController::class, 'index']); + $r->get('/{letter:[0-9a-z]}', [App\Controllers\User\SearchController::class, 'sort']); + $r->addRoute(['GET', 'POST'], '/search', [App\Controllers\User\SearchController::class, 'search']); + }); + + /* Стена сообщений */ + $r->addGroup('/walls', function (RouteCollector $r) { + $r->get('/{login:[\w\-]+}', [App\Controllers\WallController::class, 'index']); + $r->post('/{login:[\w\-]+}/create', [App\Controllers\WallController::class, 'create']); + $r->post('/{login:[\w\-]+}/delete', [App\Controllers\WallController::class, 'delete']); + }); + + /* Личные сообщения */ + $r->addGroup('/messages', function (RouteCollector $r) { + $r->get('[/{action:outbox|history|clear}]', [App\Controllers\MessageController::class, 'index']); + $r->post('/delete', [App\Controllers\MessageController::class, 'delete']); + $r->addRoute(['GET', 'POST'], '/send', [App\Controllers\MessageController::class, 'send']); + }); + + /* Игнор-лист */ + $r->addGroup('/ignores', function (RouteCollector $r) { + $r->post('/delete', [App\Controllers\IgnoreController::class, 'delete']); + $r->addRoute(['GET', 'POST'], '', [App\Controllers\IgnoreController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/note/{id:\d+}', [App\Controllers\IgnoreController::class, 'note']); + }); + + /* Контакт-лист */ + $r->addGroup('/contacts', function (RouteCollector $r) { + $r->post('/delete', [App\Controllers\ContactController::class, 'delete']); + $r->addRoute(['GET', 'POST'], '', [App\Controllers\ContactController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/note/{id:\d+}', [App\Controllers\ContactController::class, 'note']); + }); + + /* Перевод денег */ + $r->addGroup('/transfers', function (RouteCollector $r) { + $r->get('', [App\Controllers\TransferController::class, 'index']); + $r->post('/send', [App\Controllers\TransferController::class, 'send']); + }); + + /* Личные заметки */ + $r->addGroup('/notebooks', function (RouteCollector $r) { + $r->get('', [App\Controllers\NotebookController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/edit', [App\Controllers\NotebookController::class, 'edit']); + }); + + /* Реклама */ + $r->addGroup('/reklama', function (RouteCollector $r) { + $r->get('', [App\Controllers\RekUserController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/create', [App\Controllers\RekUserController::class, 'create']); + }); + + /* Репутация пользователя */ + $r->addGroup('/ratings', function (RouteCollector $r) { + $r->get('/{login:[\w\-]+}[/{action:received|gave}]', [App\Controllers\RatingController::class, 'received']); + $r->post('/delete', [App\Controllers\RatingController::class, 'delete']); + }); + + /* API */ + $r->addGroup('/api', function (RouteCollector $r) { + $r->get('', [App\Controllers\ApiController::class, 'index']); + $r->get('/users', [App\Controllers\ApiController::class, 'users']); + $r->get('/forums', [App\Controllers\ApiController::class, 'forums']); + $r->get('/messages', [App\Controllers\ApiController::class, 'messages']); + }); + + $r->get('/recovery/restore', [App\Controllers\MailController::class, 'restore']); + $r->addRoute(['GET', 'POST'], '/recovery', [App\Controllers\MailController::class, 'recovery']); + $r->addRoute(['GET', 'POST'], '/mails', [App\Controllers\MailController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/unsubscribe', [App\Controllers\MailController::class, 'unsubscribe']); + + $r->get('/authlogs', [App\Controllers\LoginController::class, 'index']); + + $r->get('/administrators', [App\Controllers\User\ListController::class, 'adminlist']); + $r->addRoute(['GET', 'POST'], '/authoritylists', [App\Controllers\User\ListController::class, 'authoritylist']); + $r->addRoute(['GET', 'POST'], '/ratinglists', [App\Controllers\User\ListController::class, 'ratinglist']); + $r->addRoute(['GET', 'POST'], '/ban', [App\Controllers\User\BanController::class, 'ban']); + $r->addRoute(['GET', 'POST'], '/who', [App\Controllers\User\UserController::class, 'who']); + + $r->get('/faq', [App\Controllers\PageController::class, 'faq']); + $r->get('/statusfaq', [App\Controllers\PageController::class, 'tatusfaq']); + $r->get('/surprise', [App\Controllers\PageController::class, 'surprise']); + + + $r->get('/users/{login:[\w\-]+}', [App\Controllers\User\UserController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/users', [App\Controllers\User\ListController::class, 'userlist']); + $r->addRoute(['GET', 'POST'], '/users/{login:[\w\-]+}/rating', [App\Controllers\RatingController::class, 'index']); + + $r->get('/logout', [App\Controllers\User\UserController::class, 'logout']); + $r->get('/key', [App\Controllers\User\UserController::class, 'key']); + $r->addRoute(['GET', 'POST'], '/users/{login:[\w\-]+}/note', [App\Controllers\User\UserController::class, 'note']); + $r->addRoute(['GET', 'POST'], '/login', [App\Controllers\User\UserController::class, 'login']); + $r->addRoute(['GET', 'POST'], '/register', [App\Controllers\User\UserController::class, 'register']); + $r->addRoute(['GET', 'POST'], '/profile', [App\Controllers\User\UserController::class, 'profile']); + $r->addRoute(['GET', 'POST'], '/settings', [App\Controllers\User\UserController::class, 'setting']); + + $r->get('/menu', [App\Controllers\PageController::class, 'menu']); + $r->get('/pages[/{action:[a-zA-Z0-9]+}]', [App\Controllers\PageController::class, 'index']); + $r->get('/tags', [App\Controllers\PageController::class, 'tags']); + $r->get('/rules', [App\Controllers\PageController::class, 'rules']); + $r->get('/smiles', [App\Controllers\PageController::class, 'smiles']); + $r->get('/online[/{action:all}]', [App\Controllers\OnlineController::class, 'index']); + $r->get('/counters', [App\Controllers\CounterController::class, 'index']); + + $r->get('/files[/{action:.+}]', [App\Controllers\FileController::class, 'index']); + + /* Админ-панель */ + $r->addGroup('/admin', function (RouteCollector $r) { + $r->get('/loads', [App\Controllers\Admin\LoadController::class, 'index']); + $r->post('/loads/create', [App\Controllers\Admin\LoadController::class, 'create']); + $r->addRoute(['GET', 'POST'], '/loads/edit/{id:\d+}', [App\Controllers\Admin\LoadController::class, 'edit']); + $r->get('/loads/delete/{id:\d+}', [App\Controllers\Admin\LoadController::class, 'delete']); + $r->get('/loads/restatement', [App\Controllers\Admin\LoadController::class, 'restatement']); + $r->get('/loads/{id:\d+}', [App\Controllers\Admin\LoadController::class, 'load']); + $r->addRoute(['GET', 'POST'], '/downs/edit/{id:\d+}', [App\Controllers\Admin\LoadController::class, 'editDown']); + $r->addRoute(['GET', 'POST'], '/downs/delete/{id:\d+}', [App\Controllers\Admin\LoadController::class, 'deleteDown']); + $r->get('/downs/delete/{id:\d+}/{fid:\d+}', [App\Controllers\Admin\LoadController::class, 'deleteFile']); + $r->get('/downs/new', [App\Controllers\Admin\LoadController::class, 'new']); + $r->get('/downs/publish/{id:\d+}', [App\Controllers\Admin\LoadController::class, 'publish']); + + $r->get('', [App\Controllers\Admin\AdminController::class, 'main', 'admin']); + $r->get('/spam', [App\Controllers\Admin\SpamController::class, 'index']); + $r->post('/spam/delete', [App\Controllers\Admin\SpamController::class, 'delete']); + $r->get('/errors', [App\Controllers\Admin\ErrorController::class, 'index']); + $r->get('/errors/clear', [App\Controllers\Admin\ErrorController::class, 'clear']); + $r->addRoute(['GET', 'POST'], '/antimat', [App\Controllers\Admin\AntimatController::class, 'index']); + $r->get('/antimat/{action:delete|clear}', [App\Controllers\Admin\AntimatController::class]); + $r->get('/status', [App\Controllers\Admin\StatusController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/status/{action:create|edit}', [App\Controllers\Admin\StatusController::class]); + $r->get('/status/delete', [App\Controllers\Admin\StatusController::class, 'delete']); + + $r->get('/rules', [App\Controllers\Admin\RuleController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/rules/edit', [App\Controllers\Admin\RuleController::class, 'edit']); + + $r->get('/upgrade', [App\Controllers\Admin\AdminController::class, 'upgrade']); + $r->get('/phpinfo', [App\Controllers\Admin\AdminController::class, 'phpinfo']); + + $r->addRoute(['GET', 'POST'], '/settings', [App\Controllers\Admin\SettingController::class, 'index']); + $r->get('/caches', [App\Controllers\Admin\CacheController::class, 'index']); + $r->post('/caches/clear', [App\Controllers\Admin\CacheController::class, 'clear']); + + $r->get('/backups', [App\Controllers\Admin\BackupController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/backups/create', [App\Controllers\Admin\BackupController::class, 'create']); + $r->get('/backups/delete', [App\Controllers\Admin\BackupController::class, 'delete']); + + $r->addRoute(['GET', 'POST'], '/checkers', [App\Controllers\Admin\CheckerController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/checkers/scan', [App\Controllers\Admin\CheckerController::class, 'scan']); + + $r->addRoute(['GET', 'POST'], '/delivery', [App\Controllers\Admin\DeliveryController::class, 'index']); + + $r->get('/logs', [App\Controllers\Admin\LogController::class, 'index']); + $r->get('/logs/clear', [App\Controllers\Admin\LogController::class, 'clear']); + + $r->get('/notices', [App\Controllers\Admin\NoticeController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/notices/create', [App\Controllers\Admin\NoticeController::class, 'create']); + $r->addRoute(['GET', 'POST'], '/notices/edit/{id:\d+}', [App\Controllers\Admin\NoticeController::class, 'edit']); + $r->get('/notices/delete/{id:\d+}', [App\Controllers\Admin\NoticeController::class, 'delete']); + + $r->addRoute(['GET', 'POST'], '/delusers', [App\Controllers\Admin\DelUserController::class, 'index']); + $r->post('/delusers/clear', [App\Controllers\Admin\DelUserController::class, 'clear']); + + $r->get('/files', [App\Controllers\Admin\FilesController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/files/edit', [App\Controllers\Admin\FilesController::class, 'edit']); + $r->addRoute(['GET', 'POST'], '/files/create', [App\Controllers\Admin\FilesController::class, 'create']); + $r->get('/files/delete', [App\Controllers\Admin\FilesController::class, 'delete']); + + $r->get('/smiles', [App\Controllers\Admin\SmileController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/smiles/create', [App\Controllers\Admin\SmileController::class, 'create']); + $r->addRoute(['GET', 'POST'], '/smiles/edit/{id:\d+}', [App\Controllers\Admin\SmileController::class, 'edit']); + $r->post('/smiles/delete', [App\Controllers\Admin\SmileController::class, 'delete']); + + $r->addRoute(['GET', 'POST'], '/ipbans', [App\Controllers\Admin\IpBanController::class, 'index']); + $r->post('/ipbans/delete', [App\Controllers\Admin\IpBanController::class, 'delete']); + $r->get('/ipbans/clear', [App\Controllers\Admin\IpBanController::class, 'clear']); + + $r->addRoute(['GET', 'POST'], '/blacklists', [App\Controllers\Admin\BlacklistController::class, 'index']); + $r->post('/blacklists/delete', [App\Controllers\Admin\BlacklistController::class, 'delete']); + + $r->get('/news', [App\Controllers\Admin\NewsController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/news/edit/{id:\d+}', [App\Controllers\Admin\NewsController::class, 'edit']); + $r->addRoute(['GET', 'POST'], '/news/create', [App\Controllers\Admin\NewsController::class, 'create']); + $r->get('/news/restatement', [App\Controllers\Admin\NewsController::class, 'restatement']); + $r->get('/news/delete/{id:\d+}', [App\Controllers\Admin\NewsController::class, 'delete']); + + $r->get('/guestbooks', [App\Controllers\Admin\GuestbookController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/guestbooks/edit/{id:\d+}', [App\Controllers\Admin\GuestbookController::class, 'edit']); + $r->addRoute(['GET', 'POST'], '/guestbooks/reply/{id:\d+}', [App\Controllers\Admin\GuestbookController::class, 'reply']); + $r->post('/guestbooks/delete', [App\Controllers\Admin\GuestbookController::class, 'delete']); + $r->get('/guestbooks/clear', [App\Controllers\Admin\GuestbookController::class, 'clear']); + + $r->get('/transfers', [App\Controllers\Admin\TransferController::class, 'index']); + $r->get('/transfers/view', [App\Controllers\Admin\TransferController::class, 'view']); + + $r->get('/users', [App\Controllers\Admin\UserController::class, 'index']); + $r->get('/users/search', [App\Controllers\Admin\UserController::class, 'search']); + $r->addRoute(['GET', 'POST'], '/users/edit', [App\Controllers\Admin\UserController::class, 'edit']); + $r->addRoute(['GET', 'POST'], '/users/delete', [App\Controllers\Admin\UserController::class, 'delete']); + + $r->get('/administrators', [App\Controllers\Admin\AdminlistController::class, 'index']); + + $r->get('/invitations', [App\Controllers\Admin\InvitationController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/invitations/create', [App\Controllers\Admin\InvitationController::class, 'create']); + $r->get('/invitations/keys', [App\Controllers\Admin\InvitationController::class, 'keys']); + $r->post('/invitations/send', [App\Controllers\Admin\InvitationController::class, 'send']); + $r->post('/invitations/mail', [App\Controllers\Admin\InvitationController::class, 'mail']); + $r->post('/invitations/delete', [App\Controllers\Admin\InvitationController::class, 'delete']); + + $r->addRoute(['GET', 'POST'], '/reglists', [App\Controllers\Admin\ReglistController::class, 'index']); + + $r->addRoute(['GET', 'POST'], '/chats', [App\Controllers\Admin\ChatController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/chats/edit/{id:\d+}', [App\Controllers\Admin\ChatController::class, 'edit']); + $r->get('/chats/clear', [App\Controllers\Admin\ChatController::class, 'clear']); + + $r->get('/banlists', [App\Controllers\Admin\BanlistController::class, 'index']); + + $r->get('/bans', [App\Controllers\Admin\BanController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/bans/edit', [App\Controllers\Admin\BanController::class, 'edit']); + $r->addRoute(['GET', 'POST'], '/bans/change', [App\Controllers\Admin\BanController::class, 'change']); + $r->get('/bans/unban', [App\Controllers\Admin\BanController::class, 'unban']); + + $r->get('/banhists', [App\Controllers\Admin\BanhistController::class, 'index']); + $r->get('/banhists/view', [App\Controllers\Admin\BanhistController::class, 'view']); + $r->post('/banhists/delete', [App\Controllers\Admin\BanhistController::class, 'delete']); + + $r->get('/votes', [App\Controllers\Admin\VoteController::class, 'index']); + $r->get('/votes/history', [App\Controllers\Admin\VoteController::class, 'history']); + $r->addRoute(['GET', 'POST'], '/votes/edit/{id:\d+}', [App\Controllers\Admin\VoteController::class, 'edit']); + $r->get('/votes/close/{id:\d+}', [App\Controllers\Admin\VoteController::class, 'close']); + $r->get('/votes/delete/{id:\d+}', [App\Controllers\Admin\VoteController::class, 'delete']); + $r->get('/votes/restatement', [App\Controllers\Admin\VoteController::class, 'restatement']); + + $r->get('/offers[/{type:offer|issue}]', [App\Controllers\Admin\OfferController::class, 'index']); + $r->get('/offers/{id:\d+}', [App\Controllers\Admin\OfferController::class, 'view']); + $r->addRoute(['GET', 'POST'], '/offers/edit/{id:\d+}', [App\Controllers\Admin\OfferController::class, 'edit']); + $r->addRoute(['GET', 'POST'], '/offers/reply/{id:\d+}', [App\Controllers\Admin\OfferController::class, 'reply']); + $r->get('/offers/restatement', [App\Controllers\Admin\OfferController::class, 'restatement']); + $r->addRoute(['GET', 'POST'], '/offers/delete', [App\Controllers\Admin\OfferController::class, 'delete']); + + $r->get('/photos', [App\Controllers\Admin\PhotoController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/photos/edit/{id:\d+}', [App\Controllers\Admin\PhotoController::class, 'edit']); + $r->get('/photos/restatement', [App\Controllers\Admin\PhotoController::class, 'restatement']); + $r->get('/photos/delete/{id:\d+}', [App\Controllers\Admin\PhotoController::class, 'delete']); + + $r->get('/reklama', [App\Controllers\Admin\RekUserController::class, 'index']); + $r->addRoute(['GET', 'POST'], '/reklama/edit/{id:\d+}', [App\Controllers\Admin\RekUserController::class, 'edit']); + $r->post('/reklama/delete', [App\Controllers\Admin\RekUserController::class, 'delete']); + + $r->get('/forums', [App\Controllers\Admin\ForumController::class, 'index']); + $r->post('/forums/create', [App\Controllers\Admin\ForumController::class, 'create']); + $r->addRoute(['GET', 'POST'], '/forums/edit/{id:\d+}', [App\Controllers\Admin\ForumController::class, 'edit']); + $r->get('/forums/delete/{id:\d+}', [App\Controllers\Admin\ForumController::class, 'delete']); + $r->get('/forums/restatement', [App\Controllers\Admin\ForumController::class, 'restatement']); + $r->get('/forums/{id:\d+}', [App\Controllers\Admin\ForumController::class, 'forum']); + $r->addRoute(['GET', 'POST'], '/topics/edit/{id:\d+}', [App\Controllers\Admin\ForumController::class, 'editTopic']); + $r->addRoute(['GET', 'POST'], '/topics/move/{id:\d+}', [App\Controllers\Admin\ForumController::class, 'moveTopic']); + $r->get('/topics/action/{id:\d+}', [App\Controllers\Admin\ForumController::class, 'actionTopic']); + $r->get('/topics/delete/{id:\d+}', [App\Controllers\Admin\ForumController::class, 'deleteTopic']); + $r->get('/topics/{id:\d+}', [App\Controllers\Admin\ForumController::class, 'topic']); + $r->addRoute(['GET', 'POST'], '/posts/edit/{id:\d+}', [App\Controllers\Admin\ForumController::class, 'editPost']); + $r->post('/posts/delete', [App\Controllers\Admin\ForumController::class, 'deletePosts']); + $r->get('/topics/end/{id:\d+}', [App\Controllers\Admin\ForumController::class, 'end']); + + $r->get('/blogs', [App\Controllers\Admin\BlogController::class, 'index']); + $r->post('/blogs/create', [App\Controllers\Admin\BlogController::class, 'create']); + $r->get('/blogs/restatement', [App\Controllers\Admin\BlogController::class, 'restatement']); + $r->addRoute(['GET', 'POST'], '/blogs/edit/{id:\d+}', [App\Controllers\Admin\BlogController::class, 'edit']); + $r->get('/blogs/delete/{id:\d+}', [App\Controllers\Admin\BlogController::class, 'delete']); + $r->get('/blogs/{id:\d+}', [App\Controllers\Admin\BlogController::class, 'blog']); + $r->addRoute(['GET', 'POST'], '/articles/edit/{id:\d+}', [App\Controllers\Admin\BlogController::class, 'editBlog']); + $r->addRoute(['GET', 'POST'], '/articles/move/{id:\d+}', [App\Controllers\Admin\BlogController::class, 'moveBlog']); + $r->get('/articles/delete/{id:\d+}', [App\Controllers\Admin\BlogController::class, 'deleteBlog']); + + $r->get('/boards/{id:\d+}?', [App\Controllers\Admin\BoardController::class, 'index']); + $r->get('/boards/restatement', [App\Controllers\Admin\BoardController::class, 'restatement']); + $r->addRoute(['GET', 'POST'], '/items/edit/{id:\d+}', [App\Controllers\Admin\BoardController::class, 'editItem']); + $r->get('/items/delete/{id:\d+}', [App\Controllers\Admin\BoardController::class, 'deleteItem']); + $r->get('/boards/categories', [App\Controllers\Admin\BoardController::class, 'categories']); + $r->post('/boards/create', [App\Controllers\Admin\BoardController::class, 'create']); + $r->addRoute(['GET', 'POST'], '/boards/edit/{id:\d+}', [App\Controllers\Admin\BoardController::class, 'edit']); + $r->get('/boards/delete/{id:\d+}', [App\Controllers\Admin\BoardController::class, 'delete']); + }); +}, [ + 'cacheFile' => STORAGE . '/temp/routes.dat', + 'cacheDisabled' => env('APP_DEBUG'), ]); - -$routes = [ - ['GET', '/', 'HomeController@index', 'home'], - ['GET', '/captcha', 'HomeController@captcha', 'captcha'], - ['GET', '/closed', 'HomeController@closed'], - ['GET|POST', '/banip', 'HomeController@banip'], - - ['GET', '/boards/[i:id]?', 'BoardController@index', 'board'], - ['GET', '/boards/active', 'BoardController@active'], - ['GET|POST', '/items/create', 'BoardController@create'], - ['GET', '/items/[i:id]', 'BoardController@view'], - ['GET|POST', '/items/edit/[i:id]', 'BoardController@edit'], - ['GET', '/items/close/[i:id]', 'BoardController@close'], - ['GET', '/items/delete/[i:id]', 'BoardController@delete'], - - ['GET', '/guestbooks', 'GuestbookController@index', 'book'], - ['POST', '/guestbooks/add', 'GuestbookController@add'], - ['GET|POST', '/guestbooks/edit/[i:id]', 'GuestbookController@edit'], - - ['GET', '/sitemap.xml', 'SitemapController@index'], - ['GET', '/sitemap/[a:action].xml', 'SitemapController'], - - ['GET', '/blogs', 'BlogController@index', 'blogs'], - ['GET', '/blogs/[i:id]', 'BlogController@blog'], - ['GET', '/blogs/tags/[*:tag]?', 'BlogController@tags'], - ['GET|POST', '/blogs/create', 'BlogController@create'], - ['GET', '/blogs/authors', 'BlogController@authors'], - ['GET', '/blogs/active/articles', 'BlogController@userArticles'], - ['GET', '/blogs/active/comments', 'BlogController@userComments'], - ['GET', '/blogs/top', 'BlogController@top'], - ['GET', '/blogs/rss', 'BlogController@rss'], - ['GET|POST', '/blogs/search', 'BlogController@search'], - ['GET', '/articles', 'BlogController@newArticles'], - ['GET', '/articles/[i:id]', 'BlogController@view'], - ['GET|POST', '/articles/edit/[i:id]', 'BlogController@edit'], - ['GET', '/articles/print/[i:id]', 'BlogController@print'], - ['GET', '/articles/rss/[i:id]', 'BlogController@rssComments'], - ['GET', '/articles/comments', 'BlogController@newComments'], - ['GET|POST', '/articles/comments/[i:id]', 'BlogController@comments'], - ['GET|POST', '/articles/edit/[i:id]/[i:cid]', 'BlogController@editComment'], - ['GET', '/articles/end/[i:id]', 'BlogController@end'], - ['GET', '/articles/comment/[i:id]/[i:cid]', 'BlogController@viewComment'], - - ['GET', '/news', 'NewsController@index', 'news'], - ['GET', '/news/[i:id]', 'NewsController@view'], - ['GET|POST', '/news/comments/[i:id]', 'NewsController@comments'], - ['GET', '/news/end/[i:id]', 'NewsController@end'], - ['GET', '/news/rss', 'NewsController@rss', 'news_rss'], - ['GET|POST', '/news/edit/[i:id]/[i:cid]', 'NewsController@editComment'], - ['GET', '/news/allcomments', 'NewsController@allComments'], - ['GET', '/news/comment/[i:id]/[i:cid]', 'NewsController@viewComment'], - - ['GET', '/photos', 'PhotoController@index', 'photos'], - ['GET', '/photos/[i:id]', 'PhotoController@view'], - ['GET', '/photos/delete/[i:id]', 'PhotoController@delete'], - ['GET', '/photos/end/[i:id]', 'PhotoController@end'], - ['GET|POST', '/photos/comments/[i:id]', 'PhotoController@comments'], - ['GET|POST', '/photos/create', 'PhotoController@create'], - ['GET|POST', '/photos/edit/[i:id]', 'PhotoController@edit'], - ['GET|POST', '/photos/edit/[i:id]/[i:cid]', 'PhotoController@editComment'], - ['GET', '/photos/albums', 'PhotoController@albums'], - ['GET', '/photos/albums/[user:login]', 'PhotoController@album'], - ['GET', '/photos/comments', 'PhotoController@allComments'], - ['GET', '/photos/comments/[user:login]', 'PhotoController@userComments'], - ['GET', '/photos/comment/[i:id]/[i:cid]', 'PhotoController@viewComment'], - ['GET|POST', '/photos/top', 'PhotoController@top'], - - ['GET', '/forums', 'Forum\ForumController@index', 'forum'], - ['GET', '/forums/[i:id]', 'Forum\ForumController@forum'], - ['GET|POST', '/forums/create', 'Forum\ForumController@create'], - ['GET', '/forums/search', 'Forum\ForumController@search'], - ['GET', '/forums/active/[posts|topics:action]', 'Forum\ActiveController'], - ['POST', '/forums/active/delete', 'Forum\ActiveController@delete'], - ['GET', '/forums/top/posts', 'Forum\ForumController@topPosts'], - ['GET', '/forums/top/topics', 'Forum\ForumController@topTopics'], - ['GET', '/forums/rss', 'Forum\ForumController@rss'], - ['GET', '/forums/bookmarks', 'BookmarkController@index'], - ['POST', '/forums/bookmarks/[delete|perform:action]', 'BookmarkController'], - ['GET', '/topics', 'Forum\NewController@topics'], - ['GET', '/posts', 'Forum\NewController@posts'], - ['GET', '/topics/[i:id]', 'Forum\TopicController@index'], - ['GET', '/topics/[i:id]/[i:pid]', 'Forum\TopicController@viewpost'], - ['POST', '/topics/votes/[i:id]', 'Forum\TopicController@vote'], - ['GET', '/topics/end/[i:id]', 'Forum\TopicController@end'], - ['GET', '/topics/close/[i:id]', 'Forum\TopicController@close'], - ['POST', '/topics/create/[i:id]', 'Forum\TopicController@create'], - ['POST', '/topics/delete/[i:id]', 'Forum\TopicController@delete'], - ['GET|POST', '/topics/edit/[i:id]', 'Forum\TopicController@edit'], - ['GET', '/topics/print/[i:id]', 'Forum\TopicController@print'], - ['GET', '/topics/rss/[i:id]', 'Forum\ForumController@rssPosts'], - ['GET|POST', '/posts/edit/[i:id]', 'Forum\TopicController@editPost'], - - ['GET', '/users/[user:login]', 'User\UserController@index'], - ['GET|POST', '/users/[user:login]/note', 'User\UserController@note', 'note'], - ['GET|POST', '/login', 'User\UserController@login', 'login'], - ['GET', '/logout', 'User\UserController@logout', 'logout'], - ['GET|POST', '/register', 'User\UserController@register', 'register'], - ['GET|POST', '/profile', 'User\UserController@profile'], - ['GET', '/key', 'User\UserController@key'], - ['GET|POST', '/settings', 'User\UserController@setting'], - ['GET', '/accounts', 'User\UserController@account'], - ['POST', '/accounts/changemail', 'User\UserController@changeMail'], - ['GET', '/accounts/editmail', 'User\UserController@editMail'], - ['POST', '/accounts/editstatus', 'User\UserController@editStatus'], - ['POST', '/accounts/editpassword', 'User\UserController@editPassword'], - ['POST', '/accounts/apikey', 'User\UserController@apikey'], - - ['GET|POST', '/socials', 'SocialController@index'], - ['GET', '/socials/delete/[i:id]', 'SocialController@delete'], - - ['GET', '/searchusers', 'User\SearchController@index'], - ['GET', '/searchusers/[letter:letter]', 'User\SearchController@sort'], - ['GET|POST', '/searchusers/search', 'User\SearchController@search'], - - ['GET', '/ratings/[user:login]/[received|gave:action]?', 'RatingController@received'], - ['POST', '/ratings/delete', 'RatingController@delete'], - ['GET|POST', '/users/[user:login]/rating', 'RatingController@index'], - - ['GET|POST', '/mails', 'MailController@index', 'mails'], - ['GET|POST', '/recovery', 'MailController@recovery', 'recovery'], - ['GET', '/recovery/restore', 'MailController@restore'], - ['GET|POST', '/unsubscribe', 'MailController@unsubscribe', 'unsubscribe'], - - ['GET', '/menu', 'PageController@menu'], - ['GET', '/pages/[a:action]?', 'PageController@index'], - ['GET', '/tags', 'PageController@tags', 'tags'], - ['GET', '/rules', 'PageController@rules', 'rules'], - ['GET', '/smiles', 'PageController@smiles', 'smiles'], - ['GET', '/online/[all:action]?', 'OnlineController@index', 'online'], - - ['POST', '/ajax/bbcode', 'AjaxController@bbCode'], - ['POST', '/ajax/delcomment', 'AjaxController@delComment'], - ['POST', '/ajax/rating', 'AjaxController@rating'], - ['POST', '/ajax/vote', 'AjaxController@vote'], - ['POST', '/ajax/complaint', 'AjaxController@complaint'], - ['POST', '/ajax/image/upload', 'AjaxController@uploadImage'], - ['POST', '/ajax/image/delete', 'AjaxController@deleteImage'], - - ['GET', '/walls/[user:login]', 'WallController@index', 'walls'], - ['POST', '/walls/[user:login]/create', 'WallController@create'], - ['POST', '/walls/[user:login]/delete', 'WallController@delete'], - - ['GET', '/messages/[outbox|history|clear:action]?', 'MessageController@index'], - ['POST', '/messages/delete', 'MessageController@delete'], - ['GET|POST', '/messages/send', 'MessageController@send'], - - ['GET', '/votes', 'VoteController@index'], - ['GET|POST', '/votes/[i:id]', 'VoteController@view'], - ['GET', '/votes/voters/[i:id]', 'VoteController@voters'], - ['GET', '/votes/history', 'VoteController@history'], - ['GET', '/votes/history/[i:id]', 'VoteController@viewHistory'], - ['GET|POST', '/votes/create', 'VoteController@create'], - - ['GET|POST', '/ignores', 'IgnoreController@index'], - ['GET|POST', '/ignores/note/[i:id]', 'IgnoreController@note'], - ['POST', '/ignores/delete', 'IgnoreController@delete'], - - ['GET|POST', '/contacts', 'ContactController@index'], - ['GET|POST', '/contacts/note/[i:id]', 'ContactController@note'], - ['POST', '/contacts/delete', 'ContactController@delete'], - ['GET', '/counters', 'CounterController@index'], - - ['GET', '/transfers', 'TransferController@index'], - ['POST', '/transfers/send', 'TransferController@send'], - - ['GET', '/notebooks', 'NotebookController@index'], - ['GET|POST', '/notebooks/edit', 'NotebookController@edit'], - - ['GET', '/reklama', 'RekUserController@index'], - ['GET|POST', '/reklama/create', 'RekUserController@create'], - - ['GET', '/authlogs', 'LoginController@index'], - - ['GET|POST', '/users', 'User\ListController@userlist'], - ['GET', '/administrators', 'User\ListController@adminlist'], - ['GET|POST', '/authoritylists', 'User\ListController@authoritylist'], - ['GET|POST', '/ratinglists', 'User\ListController@ratinglist'], - ['GET|POST', '/ban', 'User\BanController@ban'], - ['GET|POST', '/who', 'User\UserController@who'], - - ['GET', '/faq', 'PageController@faq'], - ['GET', '/statusfaq', 'PageController@statusfaq'], - ['GET', '/surprise', 'PageController@surprise'], - - ['GET', '/offers/[offer|issue:type]?', 'OfferController@index'], - ['GET', '/offers/[i:id]', 'OfferController@view'], - ['GET|POST', '/offers/create', 'OfferController@create'], - ['GET|POST', '/offers/edit/[i:id]', 'OfferController@edit'], - ['GET|POST', '/offers/comments/[i:id]', 'OfferController@comments'], - ['GET', '/offers/end/[i:id]', 'OfferController@end'], - ['GET|POST', '/offers/edit/[i:id]/[i:cid]', 'OfferController@editComment'], - ['GET', '/offers/comment/[i:id]/[i:cid]', 'OfferController@viewComment'], - - ['GET|POST', '/pictures', 'PictureController@index'], - ['GET', '/pictures/delete', 'PictureController@delete'], - - ['GET|POST', '/files/[*:action]?', 'FileController@index', 'files'], - - ['GET', '/loads', 'Load\LoadController@index'], - ['GET', '/loads/rss', 'Load\LoadController@rss'], - ['GET', '/loads/[i:id]', 'Load\LoadController@load'], - ['GET', '/loads/top', 'Load\TopController@index'], - ['GET', '/loads/search', 'Load\SearchController@index'], - ['GET', '/downs/[i:id]', 'Load\DownController@index'], - ['GET|POST', '/downs/edit/[i:id]', 'Load\DownController@edit'], - ['GET', '/downs/delete/[i:id]/[i:fid]', 'Load\DownController@deleteFile'], - ['GET|POST', '/downs/create', 'Load\DownController@create'], - ['POST', '/downs/votes/[i:id]', 'Load\DownController@vote'], - ['GET|POST', '/downs/download/[i:id]', 'Load\DownController@download'], - ['GET|POST', '/downs/comments/[i:id]', 'Load\DownController@comments'], - ['GET', '/downs/comment/[i:id]/[i:cid]', 'Load\DownController@viewComment'], - ['GET', '/downs/end/[i:id]', 'Load\DownController@end'], - ['GET|POST', '/downs/edit/[i:id]/[i:cid]', 'Load\DownController@editComment'], - ['GET', '/downs/rss/[i:id]', 'Load\DownController@rss'], - ['GET', '/downs/zip/[i:id]', 'Load\DownController@zip'], - ['GET', '/downs/zip/[i:id]/[i:fid]', 'Load\DownController@zipView'], - ['GET', '/downs', 'Load\NewController@files'], - ['GET', '/downs/comments', 'Load\NewController@comments'], - ['GET', '/downs/active/files', 'Load\ActiveController@files'], - ['GET', '/downs/active/comments', 'Load\ActiveController@comments'], - - ['GET', '/admin/loads', 'Admin\LoadController@index'], - ['POST', '/admin/loads/create', 'Admin\LoadController@create'], - ['GET|POST', '/admin/loads/edit/[i:id]', 'Admin\LoadController@edit'], - ['GET', '/admin/loads/delete/[i:id]', 'Admin\LoadController@delete'], - ['GET', '/admin/loads/restatement', 'Admin\LoadController@restatement'], - ['GET', '/admin/loads/[i:id]', 'Admin\LoadController@load'], - ['GET|POST', '/admin/downs/edit/[i:id]', 'Admin\LoadController@editDown'], - ['GET|POST', '/admin/downs/delete/[i:id]', 'Admin\LoadController@deleteDown'], - ['GET', '/admin/downs/delete/[i:id]/[i:fid]', 'Admin\LoadController@deleteFile'], - ['GET', '/admin/downs/new', 'Admin\LoadController@new'], - ['GET', '/admin/downs/publish/[i:id]', 'Admin\LoadController@publish'], - - ['GET', '/api', 'ApiController@index'], - ['GET', '/api/users', 'ApiController@users'], - ['GET', '/api/forums', 'ApiController@forums'], - ['GET', '/api/messages', 'ApiController@messages'], - - ['GET', '/admin', 'Admin\AdminController@main', 'admin'], - ['GET', '/admin/spam', 'Admin\SpamController@index'], - ['POST', '/admin/spam/delete', 'Admin\SpamController@delete'], - ['GET', '/admin/errors', 'Admin\ErrorController@index'], - ['GET', '/admin/errors/clear', 'Admin\ErrorController@clear'], - ['GET|POST', '/admin/antimat', 'Admin\AntimatController@index'], - ['GET', '/admin/antimat/[delete|clear:action]', 'Admin\AntimatController'], - ['GET', '/admin/status', 'Admin\StatusController@index'], - ['GET|POST', '/admin/status/[create|edit:action]', 'Admin\StatusController'], - ['GET', '/admin/status/delete', 'Admin\StatusController@delete'], - - ['GET', '/admin/rules', 'Admin\RuleController@index'], - ['GET|POST', '/admin/rules/edit', 'Admin\RuleController@edit'], - - ['GET', '/admin/upgrade', 'Admin\AdminController@upgrade'], - ['GET', '/admin/phpinfo', 'Admin\AdminController@phpinfo'], - - ['GET|POST', '/admin/settings', 'Admin\SettingController@index'], - ['GET', '/admin/caches', 'Admin\CacheController@index'], - ['POST', '/admin/caches/clear', 'Admin\CacheController@clear'], - - ['GET', '/admin/backups', 'Admin\BackupController@index'], - ['GET|POST', '/admin/backups/create', 'Admin\BackupController@create'], - ['GET', '/admin/backups/delete', 'Admin\BackupController@delete'], - - ['GET|POST', '/admin/checkers', 'Admin\CheckerController@index'], - ['GET|POST', '/admin/checkers/scan', 'Admin\CheckerController@scan'], - - ['GET|POST', '/admin/delivery', 'Admin\DeliveryController@index'], - - ['GET', '/admin/logs', 'Admin\LogController@index'], - ['GET', '/admin/logs/clear', 'Admin\LogController@clear'], - - ['GET', '/admin/notices', 'Admin\NoticeController@index'], - ['GET|POST', '/admin/notices/create', 'Admin\NoticeController@create'], - ['GET|POST', '/admin/notices/edit/[i:id]', 'Admin\NoticeController@edit'], - ['GET', '/admin/notices/delete/[i:id]', 'Admin\NoticeController@delete'], - - ['GET|POST', '/admin/delusers', 'Admin\DelUserController@index'], - ['POST', '/admin/delusers/clear', 'Admin\DelUserController@clear'], - - ['GET', '/admin/files', 'Admin\FilesController@index'], - ['GET|POST', '/admin/files/edit', 'Admin\FilesController@edit'], - ['GET|POST', '/admin/files/create', 'Admin\FilesController@create'], - ['GET', '/admin/files/delete', 'Admin\FilesController@delete'], - - ['GET', '/admin/smiles', 'Admin\SmileController@index'], - ['GET|POST', '/admin/smiles/create', 'Admin\SmileController@create'], - ['GET|POST', '/admin/smiles/edit/[i:id]', 'Admin\SmileController@edit'], - ['POST', '/admin/smiles/delete', 'Admin\SmileController@delete'], - - ['GET|POST', '/admin/ipbans', 'Admin\IpBanController@index'], - ['POST', '/admin/ipbans/delete', 'Admin\IpBanController@delete'], - ['GET', '/admin/ipbans/clear', 'Admin\IpBanController@clear'], - - ['GET|POST', '/admin/blacklists', 'Admin\BlacklistController@index'], - ['POST', '/admin/blacklists/delete', 'Admin\BlacklistController@delete'], - - ['GET', '/admin/news', 'Admin\NewsController@index'], - ['GET|POST', '/admin/news/edit/[i:id]', 'Admin\NewsController@edit'], - ['GET|POST', '/admin/news/create', 'Admin\NewsController@create'], - ['GET', '/admin/news/restatement', 'Admin\NewsController@restatement'], - ['GET', '/admin/news/delete/[i:id]', 'Admin\NewsController@delete'], - - ['GET', '/admin/guestbooks', 'Admin\GuestbookController@index'], - ['GET|POST', '/admin/guestbooks/edit/[i:id]', 'Admin\GuestbookController@edit'], - ['GET|POST', '/admin/guestbooks/reply/[i:id]', 'Admin\GuestbookController@reply'], - ['POST', '/admin/guestbooks/delete', 'Admin\GuestbookController@delete'], - ['GET', '/admin/guestbooks/clear', 'Admin\GuestbookController@clear'], - - ['GET', '/admin/transfers', 'Admin\TransferController@index'], - ['GET', '/admin/transfers/view', 'Admin\TransferController@view'], - - ['GET', '/admin/users', 'Admin\UserController@index'], - ['GET', '/admin/users/search', 'Admin\UserController@search'], - ['GET|POST', '/admin/users/edit', 'Admin\UserController@edit'], - ['GET|POST', '/admin/users/delete', 'Admin\UserController@delete'], - - ['GET', '/admin/administrators', 'Admin\AdminlistController@index'], - - ['GET', '/admin/invitations', 'Admin\InvitationController@index'], - ['GET|POST', '/admin/invitations/create', 'Admin\InvitationController@create'], - ['GET', '/admin/invitations/keys', 'Admin\InvitationController@keys'], - ['POST', '/admin/invitations/send', 'Admin\InvitationController@send'], - ['POST', '/admin/invitations/mail', 'Admin\InvitationController@mail'], - ['POST', '/admin/invitations/delete', 'Admin\InvitationController@delete'], - - ['GET|POST', '/admin/reglists', 'Admin\ReglistController@index'], - - ['GET|POST', '/admin/chats', 'Admin\ChatController@index'], - ['GET|POST', '/admin/chats/edit/[i:id]', 'Admin\ChatController@edit'], - ['GET', '/admin/chats/clear', 'Admin\ChatController@clear'], - - ['GET', '/admin/banlists', 'Admin\BanlistController@index'], - - ['GET', '/admin/bans', 'Admin\BanController@index'], - ['GET|POST', '/admin/bans/edit', 'Admin\BanController@edit'], - ['GET|POST', '/admin/bans/change', 'Admin\BanController@change'], - ['GET', '/admin/bans/unban', 'Admin\BanController@unban'], - - ['GET', '/admin/banhists', 'Admin\BanhistController@index'], - ['GET', '/admin/banhists/view', 'Admin\BanhistController@view'], - ['POST', '/admin/banhists/delete', 'Admin\BanhistController@delete'], - - ['GET', '/admin/votes', 'Admin\VoteController@index'], - ['GET', '/admin/votes/history', 'Admin\VoteController@history'], - ['GET|POST', '/admin/votes/edit/[i:id]', 'Admin\VoteController@edit'], - ['GET', '/admin/votes/close/[i:id]', 'Admin\VoteController@close'], - ['GET', '/admin/votes/delete/[i:id]', 'Admin\VoteController@delete'], - ['GET', '/admin/votes/close/[i:id]', 'Admin\VoteController@change'], - ['GET', '/admin/votes/restatement', 'Admin\VoteController@restatement'], - - ['GET', '/admin/offers/[offer|issue:type]?', 'Admin\OfferController@index'], - ['GET', '/admin/offers/[i:id]', 'Admin\OfferController@view'], - ['GET|POST', '/admin/offers/edit/[i:id]', 'Admin\OfferController@edit'], - ['GET|POST', '/admin/offers/reply/[i:id]', 'Admin\OfferController@reply'], - ['GET', '/admin/offers/restatement', 'Admin\OfferController@restatement'], - ['GET|POST', '/admin/offers/delete', 'Admin\OfferController@delete'], - - ['GET', '/admin/photos', 'Admin\PhotoController@index'], - ['GET|POST', '/admin/photos/edit/[i:id]', 'Admin\PhotoController@edit'], - ['GET', '/admin/photos/restatement', 'Admin\PhotoController@restatement'], - ['GET', '/admin/photos/delete/[i:id]', 'Admin\PhotoController@delete'], - - ['GET', '/admin/reklama', 'Admin\RekUserController@index'], - ['GET|POST', '/admin/reklama/edit/[i:id]', 'Admin\RekUserController@edit'], - ['POST', '/admin/reklama/delete', 'Admin\RekUserController@delete'], - - ['GET', '/admin/forums', 'Admin\ForumController@index'], - ['POST', '/admin/forums/create', 'Admin\ForumController@create'], - ['GET|POST', '/admin/forums/edit/[i:id]', 'Admin\ForumController@edit'], - ['GET', '/admin/forums/delete/[i:id]', 'Admin\ForumController@delete'], - ['GET', '/admin/forums/restatement', 'Admin\ForumController@restatement'], - ['GET', '/admin/forums/[i:id]', 'Admin\ForumController@forum'], - ['GET|POST', '/admin/topics/edit/[i:id]', 'Admin\ForumController@editTopic'], - ['GET|POST', '/admin/topics/move/[i:id]', 'Admin\ForumController@moveTopic'], - ['GET', '/admin/topics/action/[i:id]', 'Admin\ForumController@actionTopic'], - ['GET', '/admin/topics/delete/[i:id]', 'Admin\ForumController@deleteTopic'], - ['GET', '/admin/topics/[i:id]', 'Admin\ForumController@topic'], - ['GET|POST', '/admin/posts/edit/[i:id]', 'Admin\ForumController@editPost'], - ['POST', '/admin/posts/delete', 'Admin\ForumController@deletePosts'], - ['GET', '/admin/topics/end/[i:id]', 'Admin\ForumController@end'], - - ['GET', '/admin/blogs', 'Admin\BlogController@index'], - ['POST', '/admin/blogs/create', 'Admin\BlogController@create'], - ['GET', '/admin/blogs/restatement', 'Admin\BlogController@restatement'], - ['GET|POST', '/admin/blogs/edit/[i:id]', 'Admin\BlogController@edit'], - ['GET', '/admin/blogs/delete/[i:id]', 'Admin\BlogController@delete'], - ['GET', '/admin/blogs/[i:id]', 'Admin\BlogController@blog'], - ['GET|POST', '/admin/articles/edit/[i:id]', 'Admin\BlogController@editBlog'], - ['GET|POST', '/admin/articles/move/[i:id]', 'Admin\BlogController@moveBlog'], - ['GET', '/admin/articles/delete/[i:id]', 'Admin\BlogController@deleteBlog'], - - ['GET', '/admin/boards/[i:id]?', 'Admin\BoardController@index'], - ['GET', '/admin/boards/restatement', 'Admin\BoardController@restatement'], - ['GET|POST', '/admin/items/edit/[i:id]', 'Admin\BoardController@editItem'], - ['GET', '/admin/items/delete/[i:id]', 'Admin\BoardController@deleteItem'], - ['GET', '/admin/boards/categories', 'Admin\BoardController@categories'], - ['POST', '/admin/boards/create', 'Admin\BoardController@create'], - ['GET|POST', '/admin/boards/edit/[i:id]', 'Admin\BoardController@edit'], - ['GET', '/admin/boards/delete/[i:id]', 'Admin\BoardController@delete'], - - ['GET', '/search', function() { - return view('search/index'); - }], -]; - -$router->addRoutes($routes); - -App\Classes\Registry::set('router', $router); diff --git a/app/start.php b/app/start.php index 1d619a206..7bf8751c4 100644 --- a/app/start.php +++ b/app/start.php @@ -17,42 +17,38 @@ /** * Авторизация по кукам */ -if (empty($_SESSION['id']) && empty($_SESSION['password'])) { - if (isset($_COOKIE['login'], $_COOKIE['password'])) { +if (empty($_SESSION['id']) && isset($_COOKIE['login'], $_COOKIE['password'])) { - $cookLogin = check($_COOKIE['login']); - $cookPass = check($_COOKIE['password']); + $cookLogin = check($_COOKIE['login']); + $cookPass = check($_COOKIE['password']); - $user = User::query()->where('login', $cookLogin)->first(); + $user = User::query()->where('login', $cookLogin)->first(); - if ($user) { - if ($cookLogin === $user->login && $cookPass === md5($user->password . env('APP_KEY'))) { - session_regenerate_id(1); + if ($user && $cookLogin === $user->login && $cookPass === md5($user->password . env('APP_KEY'))) { + session_regenerate_id(1); - $_SESSION['id'] = $user->id; - $_SESSION['password'] = md5(env('APP_KEY') . $user->password); + $_SESSION['id'] = $user->id; + $_SESSION['password'] = md5(env('APP_KEY') . $user->password); - $authorization = Login::query() - ->where('user_id', $user->id) - ->where('created_at', '>', SITETIME - 30) - ->first(); + $authorization = Login::query() + ->where('user_id', $user->id) + ->where('created_at', '>', SITETIME - 30) + ->first(); - if (! $authorization) { + if (! $authorization) { - Login::query()->create([ - 'user_id' => $user->id, - 'ip' => getIp(), - 'brow' => getBrowser(), - 'created_at' => SITETIME, - ]); - } - - $user->update([ - 'visits' => DB::raw('visits + 1'), - 'updated_at' => SITETIME - ]); - } + Login::query()->create([ + 'user_id' => $user->id, + 'ip' => getIp(), + 'brow' => getBrowser(), + 'created_at' => SITETIME, + ]); } + + $user->update([ + 'visits' => DB::raw('visits + 1'), + 'updated_at' => SITETIME + ]); } } @@ -79,17 +75,13 @@ ]); // Забанен - if ($user->level == User::BANNED) { - if (! Request::is('ban', 'rules', 'logout')) { - redirect('/ban?user=' . $user->login); - } + if ($user->level === User::BANNED && ! Request::is('ban', 'rules', 'logout')) { + redirect('/ban?user=' . $user->login); } // Подтверждение регистрации - if (setting('regkeys') && $user->level == User::PENDED) { - if (! Request::is('key', 'ban', 'login', 'logout')) { - redirect('/key?user=' . $user->login); - } + if ($user->level === User::PENDED && setting('regkeys') && ! Request::is('key', 'ban', 'login', 'logout')) { + redirect('/key?user=' . $user->login); } // ---------------------- Получение ежедневного бонуса -----------------------// @@ -109,10 +101,8 @@ $browser_detect = new Mobile_Detect(); if (! getUser() || empty(setting('themes'))) { - if (! empty(setting('webthemes'))) { - if (! $browser_detect->isMobile() && ! $browser_detect->isTablet()) { - setSetting(['themes' => setting('webthemes')]); - } + if (! empty(setting('webthemes')) && ! $browser_detect->isMobile() && ! $browser_detect->isTablet()) { + setSetting(['themes' => setting('webthemes')]); } } @@ -123,3 +113,5 @@ if (empty(setting('language')) || ! file_exists(RESOURCES . '/lang/' . setting('language'))) { setSetting(['language' => 'ru']); } + +return new \App\Classes\Application(); diff --git a/composer.json b/composer.json index 96bcd2349..0c7cbac46 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,6 @@ "ext-gd": "*", "ext-json": "*", "ext-mbstring": "*", - "altorouter/altorouter": "~1.2", "cbschuld/browser.php": "dev-master", "gregwar/captcha": "^1.1", "google/recaptcha": "~1.2", @@ -33,7 +32,8 @@ "visavi/cleanup": "^1.3", "visavi/crontask": "^1.1", "nelexa/zip": "^3.1", - "intervention/image": "^2.4" + "intervention/image": "^2.4", + "nikic/fast-route": "^1.3" }, "require-dev": { "filp/whoops": "^2.2", @@ -52,7 +52,6 @@ "App\\": "app/" }, "files": [ - "app/routes.php", "app/helpers.php" ] }, diff --git a/composer.lock b/composer.lock index b75ab89cf..2679e5ba9 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": "02cb96e61762c12bdf294b5b55cbc111", + "content-hash": "cd7d867abbe2c3f97db2f7ba14b6709f", "packages": [ { "name": "alchemy/binary-driver", @@ -69,61 +69,6 @@ ], "time": "2018-08-06T10:18:33+00:00" }, - { - "name": "altorouter/altorouter", - "version": "v1.2.0", - "source": { - "type": "git", - "url": "https://github.com/dannyvankooten/AltoRouter.git", - "reference": "39c50092470128c12284d332bb57f306bb5b58e4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dannyvankooten/AltoRouter/zipball/39c50092470128c12284d332bb57f306bb5b58e4", - "reference": "39c50092470128c12284d332bb57f306bb5b58e4", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "codeclimate/php-test-reporter": "dev-master", - "phpunit/phpunit": "4.5.*" - }, - "type": "library", - "autoload": { - "classmap": [ - "AltoRouter.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Danny van Kooten", - "email": "dannyvankooten@gmail.com", - "homepage": "http://dannyvankooten.com/" - }, - { - "name": "Koen Punt", - "homepage": "https://github.com/koenpunt" - }, - { - "name": "niahoo", - "homepage": "https://github.com/niahoo" - } - ], - "description": "A lightning fast router for PHP", - "homepage": "https://github.com/dannyvankooten/AltoRouter", - "keywords": [ - "lightweight", - "router", - "routing" - ], - "time": "2015-11-30T00:47:43+00:00" - }, { "name": "cbschuld/browser.php", "version": "dev-master", @@ -416,16 +361,16 @@ }, { "name": "egulias/email-validator", - "version": "2.1.5", + "version": "2.1.6", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "54859fabea8b3beecbb1a282888d5c990036b9e3" + "reference": "0578b32b30b22de3e8664f797cf846fc9246f786" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/54859fabea8b3beecbb1a282888d5c990036b9e3", - "reference": "54859fabea8b3beecbb1a282888d5c990036b9e3", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0578b32b30b22de3e8664f797cf846fc9246f786", + "reference": "0578b32b30b22de3e8664f797cf846fc9246f786", "shasum": "" }, "require": { @@ -469,7 +414,7 @@ "validation", "validator" ], - "time": "2018-08-16T20:49:45+00:00" + "time": "2018-09-25T20:47:26+00:00" }, { "name": "evenement/evenement", @@ -686,20 +631,21 @@ }, { "name": "illuminate/container", - "version": "v5.7.5", + "version": "v5.7.9", "source": { "type": "git", "url": "https://github.com/illuminate/container.git", - "reference": "0fc33b14ae6cf9a1e694fd43f2a274e590a824b2" + "reference": "73cde7bd4985eefb1d468a745e1d50d03e276121" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/container/zipball/0fc33b14ae6cf9a1e694fd43f2a274e590a824b2", - "reference": "0fc33b14ae6cf9a1e694fd43f2a274e590a824b2", + "url": "https://api.github.com/repos/illuminate/container/zipball/73cde7bd4985eefb1d468a745e1d50d03e276121", + "reference": "73cde7bd4985eefb1d468a745e1d50d03e276121", "shasum": "" }, "require": { "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*", "php": "^7.1.3", "psr/container": "^1.0" }, @@ -726,20 +672,20 @@ ], "description": "The Illuminate Container package.", "homepage": "https://laravel.com", - "time": "2018-05-28T08:50:10+00:00" + "time": "2018-10-07T15:52:17+00:00" }, { "name": "illuminate/contracts", - "version": "v5.7.5", + "version": "v5.7.9", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "2daf3c078610f744e2a4dc2f44fb5060cce9835b" + "reference": "64df81d3382d876f1c1d3d5481d89c93b61b8279" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/2daf3c078610f744e2a4dc2f44fb5060cce9835b", - "reference": "2daf3c078610f744e2a4dc2f44fb5060cce9835b", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/64df81d3382d876f1c1d3d5481d89c93b61b8279", + "reference": "64df81d3382d876f1c1d3d5481d89c93b61b8279", "shasum": "" }, "require": { @@ -770,20 +716,20 @@ ], "description": "The Illuminate Contracts package.", "homepage": "https://laravel.com", - "time": "2018-09-18T12:50:05+00:00" + "time": "2018-10-08T13:34:14+00:00" }, { "name": "illuminate/database", - "version": "v5.7.5", + "version": "v5.7.9", "source": { "type": "git", "url": "https://github.com/illuminate/database.git", - "reference": "c83247ced8194ef41a1f58e232ee00be9df634a4" + "reference": "1f4a0881ca0012732ae7b73809cf50ef8d964547" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/database/zipball/c83247ced8194ef41a1f58e232ee00be9df634a4", - "reference": "c83247ced8194ef41a1f58e232ee00be9df634a4", + "url": "https://api.github.com/repos/illuminate/database/zipball/1f4a0881ca0012732ae7b73809cf50ef8d964547", + "reference": "1f4a0881ca0012732ae7b73809cf50ef8d964547", "shasum": "" }, "require": { @@ -829,20 +775,20 @@ "orm", "sql" ], - "time": "2018-09-19T15:13:04+00:00" + "time": "2018-10-06T18:48:42+00:00" }, { "name": "illuminate/events", - "version": "v5.7.5", + "version": "v5.7.9", "source": { "type": "git", "url": "https://github.com/illuminate/events.git", - "reference": "4cf622acc05592f86d4a5c77ad1a544d38e58dee" + "reference": "a8e5e3d601ad7f3571428176a578ddf03ce649d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/events/zipball/4cf622acc05592f86d4a5c77ad1a544d38e58dee", - "reference": "4cf622acc05592f86d4a5c77ad1a544d38e58dee", + "url": "https://api.github.com/repos/illuminate/events/zipball/a8e5e3d601ad7f3571428176a578ddf03ce649d8", + "reference": "a8e5e3d601ad7f3571428176a578ddf03ce649d8", "shasum": "" }, "require": { @@ -874,11 +820,11 @@ ], "description": "The Illuminate Events package.", "homepage": "https://laravel.com", - "time": "2018-07-26T15:27:42+00:00" + "time": "2018-10-06T18:48:42+00:00" }, { "name": "illuminate/filesystem", - "version": "v5.7.5", + "version": "v5.7.9", "source": { "type": "git", "url": "https://github.com/illuminate/filesystem.git", @@ -930,16 +876,16 @@ }, { "name": "illuminate/http", - "version": "v5.7.5", + "version": "v5.7.9", "source": { "type": "git", "url": "https://github.com/illuminate/http.git", - "reference": "1dbb5dcea82a968c7e8075676ec95ae023da1100" + "reference": "fcf1940b9bde323bdf2500d49dc2ff5580ece19c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/http/zipball/1dbb5dcea82a968c7e8075676ec95ae023da1100", - "reference": "1dbb5dcea82a968c7e8075676ec95ae023da1100", + "url": "https://api.github.com/repos/illuminate/http/zipball/fcf1940b9bde323bdf2500d49dc2ff5580ece19c", + "reference": "fcf1940b9bde323bdf2500d49dc2ff5580ece19c", "shasum": "" }, "require": { @@ -972,11 +918,11 @@ ], "description": "The Illuminate Http package.", "homepage": "https://laravel.com", - "time": "2018-09-17T19:03:52+00:00" + "time": "2018-10-05T19:25:25+00:00" }, { "name": "illuminate/session", - "version": "v5.7.5", + "version": "v5.7.9", "source": { "type": "git", "url": "https://github.com/illuminate/session.git", @@ -1026,16 +972,16 @@ }, { "name": "illuminate/support", - "version": "v5.7.5", + "version": "v5.7.9", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "f7c68e8c8aab200cc8ad84f974d5511cda58a742" + "reference": "ea95697233b06650382eb0f5798be22b4e520dea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/f7c68e8c8aab200cc8ad84f974d5511cda58a742", - "reference": "f7c68e8c8aab200cc8ad84f974d5511cda58a742", + "url": "https://api.github.com/repos/illuminate/support/zipball/ea95697233b06650382eb0f5798be22b4e520dea", + "reference": "ea95697233b06650382eb0f5798be22b4e520dea", "shasum": "" }, "require": { @@ -1081,20 +1027,20 @@ ], "description": "The Illuminate Support package.", "homepage": "https://laravel.com", - "time": "2018-09-19T18:36:57+00:00" + "time": "2018-10-07T15:51:39+00:00" }, { "name": "illuminate/translation", - "version": "v5.7.5", + "version": "v5.7.9", "source": { "type": "git", "url": "https://github.com/illuminate/translation.git", - "reference": "78ac624b04269250229066780613206c7355b71b" + "reference": "92904065217ef4ce6c365ab89c6004eea6f6f2f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/translation/zipball/78ac624b04269250229066780613206c7355b71b", - "reference": "78ac624b04269250229066780613206c7355b71b", + "url": "https://api.github.com/repos/illuminate/translation/zipball/92904065217ef4ce6c365ab89c6004eea6f6f2f5", + "reference": "92904065217ef4ce6c365ab89c6004eea6f6f2f5", "shasum": "" }, "require": { @@ -1126,20 +1072,20 @@ ], "description": "The Illuminate Translation package.", "homepage": "https://laravel.com", - "time": "2018-05-28T13:39:48+00:00" + "time": "2018-10-06T18:48:42+00:00" }, { "name": "illuminate/view", - "version": "v5.7.5", + "version": "v5.7.9", "source": { "type": "git", "url": "https://github.com/illuminate/view.git", - "reference": "3ccd29550afe61eb02ad9e4bae0c2e661aadd7af" + "reference": "040b1a85d12eeae0335cb06827de4fd2fdcb5b51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/view/zipball/3ccd29550afe61eb02ad9e4bae0c2e661aadd7af", - "reference": "3ccd29550afe61eb02ad9e4bae0c2e661aadd7af", + "url": "https://api.github.com/repos/illuminate/view/zipball/040b1a85d12eeae0335cb06827de4fd2fdcb5b51", + "reference": "040b1a85d12eeae0335cb06827de4fd2fdcb5b51", "shasum": "" }, "require": { @@ -1174,7 +1120,7 @@ ], "description": "The Illuminate View package.", "homepage": "https://laravel.com", - "time": "2018-09-18T12:50:05+00:00" + "time": "2018-10-06T18:48:42+00:00" }, { "name": "intervention/image", @@ -1426,19 +1372,20 @@ }, { "name": "nelexa/zip", - "version": "3.1.5", + "version": "3.1.6", "source": { "type": "git", "url": "https://github.com/Ne-Lexa/php-zip.git", - "reference": "251ce11bdc4754962f29cd2d31014549377ea617" + "reference": "9bb20cc15e0a61bd0fba7c09dd526e1d699f8522" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Ne-Lexa/php-zip/zipball/251ce11bdc4754962f29cd2d31014549377ea617", - "reference": "251ce11bdc4754962f29cd2d31014549377ea617", + "url": "https://api.github.com/repos/Ne-Lexa/php-zip/zipball/9bb20cc15e0a61bd0fba7c09dd526e1d699f8522", + "reference": "9bb20cc15e0a61bd0fba7c09dd526e1d699f8522", "shasum": "" }, "require": { + "ext-zlib": "*", "php": "^5.5 || ^7.0", "psr/http-message": "^1.0" }, @@ -1448,6 +1395,7 @@ }, "suggest": { "ext-bz2": "Needed to support BZIP2 compression", + "ext-fileinfo": "Needed to get mime-type file", "ext-mcrypt": "Needed to support encrypt zip entries or use ext-openssl", "ext-openssl": "Needed to support encrypt zip entries or use ext-mcrypt" }, @@ -1479,7 +1427,7 @@ "zipalign", "ziparchive" ], - "time": "2018-04-25T09:44:11+00:00" + "time": "2018-10-11T07:54:30+00:00" }, { "name": "nesbot/carbon", @@ -1576,6 +1524,52 @@ "description": "Symfony filesystem extension to handle temporary files", "time": "2018-02-07T21:11:57+00:00" }, + { + "name": "nikic/fast-route", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/FastRoute.git", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/FastRoute/zipball/181d480e08d9476e61381e04a71b34dc0432e812", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|~5.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "FastRoute\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov", + "email": "nikic@php.net" + } + ], + "description": "Fast request router for PHP", + "keywords": [ + "router", + "routing" + ], + "time": "2018-02-13T20:26:39+00:00" + }, { "name": "php-curl-class/php-curl-class", "version": "8.3.2", @@ -2051,16 +2045,16 @@ }, { "name": "symfony/config", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "76015a3cc372b14d00040ff58e18e29f69eba717" + "reference": "b3d4d7b567d7a49e6dfafb6d4760abc921177c96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/76015a3cc372b14d00040ff58e18e29f69eba717", - "reference": "76015a3cc372b14d00040ff58e18e29f69eba717", + "url": "https://api.github.com/repos/symfony/config/zipball/b3d4d7b567d7a49e6dfafb6d4760abc921177c96", + "reference": "b3d4d7b567d7a49e6dfafb6d4760abc921177c96", "shasum": "" }, "require": { @@ -2110,20 +2104,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2018-08-08T06:37:38+00:00" + "time": "2018-09-08T13:24:10+00:00" }, { "name": "symfony/console", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "ca80b8ced97cf07390078b29773dc384c39eee1f" + "reference": "dc7122fe5f6113cfaba3b3de575d31112c9aa60b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/ca80b8ced97cf07390078b29773dc384c39eee1f", - "reference": "ca80b8ced97cf07390078b29773dc384c39eee1f", + "url": "https://api.github.com/repos/symfony/console/zipball/dc7122fe5f6113cfaba3b3de575d31112c9aa60b", + "reference": "dc7122fe5f6113cfaba3b3de575d31112c9aa60b", "shasum": "" }, "require": { @@ -2178,20 +2172,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:24:31+00:00" + "time": "2018-10-03T08:15:46+00:00" }, { "name": "symfony/debug", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "47ead688f1f2877f3f14219670f52e4722ee7052" + "reference": "e3f76ce6198f81994e019bb2b4e533e9de1b9b90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/47ead688f1f2877f3f14219670f52e4722ee7052", - "reference": "47ead688f1f2877f3f14219670f52e4722ee7052", + "url": "https://api.github.com/repos/symfony/debug/zipball/e3f76ce6198f81994e019bb2b4e533e9de1b9b90", + "reference": "e3f76ce6198f81994e019bb2b4e533e9de1b9b90", "shasum": "" }, "require": { @@ -2234,11 +2228,11 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-08-03T11:13:38+00:00" + "time": "2018-10-02T16:36:10+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -2301,16 +2295,16 @@ }, { "name": "symfony/filesystem", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e" + "reference": "596d12b40624055c300c8b619755b748ca5cf0b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e", - "reference": "c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/596d12b40624055c300c8b619755b748ca5cf0b5", + "reference": "596d12b40624055c300c8b619755b748ca5cf0b5", "shasum": "" }, "require": { @@ -2347,20 +2341,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2018-08-18T16:52:46+00:00" + "time": "2018-10-02T12:40:59+00:00" }, { "name": "symfony/finder", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068" + "reference": "1f17195b44543017a9c9b2d437c670627e96ad06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/e162f1df3102d0b7472805a5a9d5db9fcf0a8068", - "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068", + "url": "https://api.github.com/repos/symfony/finder/zipball/1f17195b44543017a9c9b2d437c670627e96ad06", + "reference": "1f17195b44543017a9c9b2d437c670627e96ad06", "shasum": "" }, "require": { @@ -2396,20 +2390,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:24:31+00:00" + "time": "2018-10-03T08:47:56+00:00" }, { "name": "symfony/http-foundation", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "3a5c91e133b220bb882b3cd773ba91bf39989345" + "reference": "d528136617ff24f530e70df9605acc1b788b08d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/3a5c91e133b220bb882b3cd773ba91bf39989345", - "reference": "3a5c91e133b220bb882b3cd773ba91bf39989345", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d528136617ff24f530e70df9605acc1b788b08d4", + "reference": "d528136617ff24f530e70df9605acc1b788b08d4", "shasum": "" }, "require": { @@ -2450,20 +2444,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2018-08-27T17:47:02+00:00" + "time": "2018-10-03T08:48:45+00:00" }, { "name": "symfony/http-kernel", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "33de0a1ff2e1720096189e3ced682d7a4e8f5e35" + "reference": "f5e7c15a5d010be0e16ce798594c5960451d4220" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/33de0a1ff2e1720096189e3ced682d7a4e8f5e35", - "reference": "33de0a1ff2e1720096189e3ced682d7a4e8f5e35", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/f5e7c15a5d010be0e16ce798594c5960451d4220", + "reference": "f5e7c15a5d010be0e16ce798594c5960451d4220", "shasum": "" }, "require": { @@ -2537,7 +2531,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2018-08-28T06:17:42+00:00" + "time": "2018-10-03T12:53:38+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2658,16 +2652,16 @@ }, { "name": "symfony/process", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "86cdb930a6a855b0ab35fb60c1504cb36184f843" + "reference": "ee33c0322a8fee0855afcc11fff81e6b1011b529" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/86cdb930a6a855b0ab35fb60c1504cb36184f843", - "reference": "86cdb930a6a855b0ab35fb60c1504cb36184f843", + "url": "https://api.github.com/repos/symfony/process/zipball/ee33c0322a8fee0855afcc11fff81e6b1011b529", + "reference": "ee33c0322a8fee0855afcc11fff81e6b1011b529", "shasum": "" }, "require": { @@ -2703,20 +2697,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-08-03T11:13:38+00:00" + "time": "2018-10-02T12:40:59+00:00" }, { "name": "symfony/translation", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "fa2182669f7983b7aa5f1a770d053f79f0ef144f" + "reference": "9f0b61e339160a466ebcde167a6c5521c810e304" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/fa2182669f7983b7aa5f1a770d053f79f0ef144f", - "reference": "fa2182669f7983b7aa5f1a770d053f79f0ef144f", + "url": "https://api.github.com/repos/symfony/translation/zipball/9f0b61e339160a466ebcde167a6c5521c810e304", + "reference": "9f0b61e339160a466ebcde167a6c5521c810e304", "shasum": "" }, "require": { @@ -2772,20 +2766,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2018-08-07T12:45:11+00:00" + "time": "2018-10-02T16:36:10+00:00" }, { "name": "symfony/yaml", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "b832cc289608b6d305f62149df91529a2ab3c314" + "reference": "367e689b2fdc19965be435337b50bc8adf2746c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/b832cc289608b6d305f62149df91529a2ab3c314", - "reference": "b832cc289608b6d305f62149df91529a2ab3c314", + "url": "https://api.github.com/repos/symfony/yaml/zipball/367e689b2fdc19965be435337b50bc8adf2746c9", + "reference": "367e689b2fdc19965be435337b50bc8adf2746c9", "shasum": "" }, "require": { @@ -2831,7 +2825,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-08-18T16:52:46+00:00" + "time": "2018-10-02T16:36:10+00:00" }, { "name": "visavi/cleanup", @@ -3656,16 +3650,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "6.0.7", + "version": "6.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a" + "reference": "848f78b3309780fef7ec8c4666b7ab4e6b09b22f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/865662550c384bc1db7e51d29aeda1c2c161d69a", - "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/848f78b3309780fef7ec8c4666b7ab4e6b09b22f", + "reference": "848f78b3309780fef7ec8c4666b7ab4e6b09b22f", "shasum": "" }, "require": { @@ -3715,7 +3709,7 @@ "testing", "xunit" ], - "time": "2018-06-01T07:51:50+00:00" + "time": "2018-10-04T03:41:23+00:00" }, { "name": "phpunit/php-file-iterator", @@ -3908,16 +3902,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.3.5", + "version": "7.4.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "7b331efabbb628c518c408fdfcaf571156775de2" + "reference": "f3837fa1e07758057ae06e8ddec6d06ba183f126" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7b331efabbb628c518c408fdfcaf571156775de2", - "reference": "7b331efabbb628c518c408fdfcaf571156775de2", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3837fa1e07758057ae06e8ddec6d06ba183f126", + "reference": "f3837fa1e07758057ae06e8ddec6d06ba183f126", "shasum": "" }, "require": { @@ -3942,7 +3936,7 @@ "sebastian/exporter": "^3.1", "sebastian/global-state": "^2.0", "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^1.0", + "sebastian/resource-operations": "^2.0", "sebastian/version": "^2.0.1" }, "conflict": { @@ -3962,7 +3956,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.3-dev" + "dev-master": "7.4-dev" } }, "autoload": { @@ -3988,7 +3982,7 @@ "testing", "xunit" ], - "time": "2018-09-08T15:14:29+00:00" + "time": "2018-10-05T04:05:24+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -4470,25 +4464,25 @@ }, { "name": "sebastian/resource-operations", - "version": "1.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -4508,7 +4502,7 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "time": "2018-10-04T04:07:39+00:00" }, { "name": "sebastian/version", @@ -4555,16 +4549,16 @@ }, { "name": "symfony/stopwatch", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "966c982df3cca41324253dc0c7ffe76b6076b705" + "reference": "5bfc064125b73ff81229e19381ce1c34d3416f4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/966c982df3cca41324253dc0c7ffe76b6076b705", - "reference": "966c982df3cca41324253dc0c7ffe76b6076b705", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5bfc064125b73ff81229e19381ce1c34d3416f4b", + "reference": "5bfc064125b73ff81229e19381ce1c34d3416f4b", "shasum": "" }, "require": { @@ -4600,7 +4594,7 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:00:49+00:00" + "time": "2018-10-02T12:40:59+00:00" }, { "name": "theseer/tokenizer", diff --git a/public/index.php b/public/index.php index 89fce22bd..405eff369 100644 --- a/public/index.php +++ b/public/index.php @@ -8,6 +8,6 @@ * @copyright 2005-2018 */ -include_once __DIR__.'/../app/start.php'; - -App\Classes\Application::run(); +/** @var App\Classes\Application $app */ +$app = require __DIR__ . '/../app/start.php'; +$app->run(); diff --git a/resources/views/errors/405.blade.php b/resources/views/errors/405.blade.php new file mode 100644 index 000000000..42fbd5e38 --- /dev/null +++ b/resources/views/errors/405.blade.php @@ -0,0 +1,27 @@ +@extends('layout') + +@section('title') + Ошибка 405 +@stop + +@section('content') + + + +
+
+ error 404 +
+
+

Ошибка 405!

+ +
Переданный метод HTTP не поддерживается на данной странице!
+ + @if ($referer) + + @endif +
+
+@stop From e61d0928169d923d9ea25579336c41176cac8a75 Mon Sep 17 00:00:00 2001 From: visavi Date: Sat, 13 Oct 2018 16:51:33 +0300 Subject: [PATCH 043/163] =?UTF-8?q?=D0=9F=D0=BE=D0=BB=D1=83=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=80=D0=B5=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20ip=20cloudflare=20=D1=81=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D0=BA=D0=BE=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Classes/Application.php | 9 +--- app/Classes/CloudFlare.php | 84 +++++++++++++++++++++++++++++++++++++ app/helpers.php | 13 ++---- 3 files changed, 90 insertions(+), 16 deletions(-) create mode 100644 app/Classes/CloudFlare.php diff --git a/app/Classes/Application.php b/app/Classes/Application.php index b37e9ac89..2c78dc38c 100644 --- a/app/Classes/Application.php +++ b/app/Classes/Application.php @@ -16,7 +16,7 @@ public function run(): void switch ($router[0]) { case Dispatcher::FOUND: - echo $this->getController($router); + echo $this->call($router); break; case Dispatcher::METHOD_NOT_ALLOWED: @@ -37,14 +37,9 @@ public function run(): void * @param array $router * @return mixed */ - private function getController($router) + private function call($router) { [, $controller, $params] = $router; - - if (\is_object($controller)) { - return \call_user_func_array($controller, $params); - } - $action = $params['action'] ?? $controller[1]; return \call_user_func_array([new $controller[0], $action], $params); diff --git a/app/Classes/CloudFlare.php b/app/Classes/CloudFlare.php new file mode 100644 index 000000000..3b4f70343 --- /dev/null +++ b/app/Classes/CloudFlare.php @@ -0,0 +1,84 @@ +isTrustedRequest()) { + return $callback(); + } + } + + /** + * Determines "the real" IP address from the current request. + * + * @return string + */ + public function ip(): string + { + return $this->onTrustedRequest(function () { + return filter_var(Request::header('CF_CONNECTING_IP'), FILTER_VALIDATE_IP); + }) ?: Request::ip(); + } + + /** + * Determines country from the current request. + * + * @return string + */ + public function country(): string + { + return $this->onTrustedRequest(function () { + return Request::header('CF_IPCOUNTRY'); + }) ?: ''; + } +} diff --git a/app/helpers.php b/app/helpers.php index 7480ca3d5..4316dcffa 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -1,6 +1,6 @@ ip(); + return $ip === '::1' ? '127.0.0.1' : $ip; } From eb611e22eac96d0240d9cecbce9284bf87715fcc Mon Sep 17 00:00:00 2001 From: visavi Date: Sat, 13 Oct 2018 17:11:35 +0300 Subject: [PATCH 044/163] =?UTF-8?q?=D0=BD=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D1=88=D0=B0=D1=8F=20=D0=BE=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Classes/CloudFlare.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/app/Classes/CloudFlare.php b/app/Classes/CloudFlare.php index 3b4f70343..f2921c26e 100644 --- a/app/Classes/CloudFlare.php +++ b/app/Classes/CloudFlare.php @@ -3,13 +3,14 @@ namespace App\Classes; use Closure; +use Illuminate\Http\Request; use Symfony\Component\HttpFoundation\IpUtils; class CloudFlare { /** * List of IP's used by CloudFlare. - * @var array + * @const array */ protected const IPS = [ '103.21.244.0/22', @@ -35,6 +36,13 @@ class CloudFlare '2a06:98c0::/29' ]; + private $request; + + public function __construct() + { + $this->request = Request::createFromGlobals(); + } + /** * Checks if current request is coming from CloudFlare servers. * @@ -42,7 +50,7 @@ class CloudFlare */ public function isTrustedRequest(): bool { - return IpUtils::checkIp(Request::ip(), static::IPS); + return IpUtils::checkIp($this->request->ip(), static::IPS); } /** @@ -66,8 +74,8 @@ public function onTrustedRequest(Closure $callback) public function ip(): string { return $this->onTrustedRequest(function () { - return filter_var(Request::header('CF_CONNECTING_IP'), FILTER_VALIDATE_IP); - }) ?: Request::ip(); + return filter_var($this->request->header('CF_CONNECTING_IP'), FILTER_VALIDATE_IP); + }) ?: $this->request->ip(); } /** @@ -78,7 +86,7 @@ public function ip(): string public function country(): string { return $this->onTrustedRequest(function () { - return Request::header('CF_IPCOUNTRY'); + return $this->request->header('CF_IPCOUNTRY'); }) ?: ''; } } From f3a7358b891e5301261dccac35ecb3d60faa26ba Mon Sep 17 00:00:00 2001 From: visavi Date: Sat, 13 Oct 2018 19:04:34 +0300 Subject: [PATCH 045/163] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=80=D0=BE=D1=83=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Classes/Application.php | 5 ----- app/Classes/CloudFlare.php | 3 +++ app/routes.php | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/Classes/Application.php b/app/Classes/Application.php index 2c78dc38c..2502c912a 100644 --- a/app/Classes/Application.php +++ b/app/Classes/Application.php @@ -2,7 +2,6 @@ namespace App\Classes; -use Illuminate\Http\Request; use FastRoute\Dispatcher; class Application @@ -18,17 +17,13 @@ public function run(): void case Dispatcher::FOUND: echo $this->call($router); break; - case Dispatcher::METHOD_NOT_ALLOWED: abort(405); break; - default: abort(404); break; } - - // $router['params']['request'] = Request::createFromGlobals(); } /** diff --git a/app/Classes/CloudFlare.php b/app/Classes/CloudFlare.php index f2921c26e..98ea6c517 100644 --- a/app/Classes/CloudFlare.php +++ b/app/Classes/CloudFlare.php @@ -36,6 +36,9 @@ class CloudFlare '2a06:98c0::/29' ]; + /** + * @var Request + */ private $request; public function __construct() diff --git a/app/routes.php b/app/routes.php index 01c638394..4279b6131 100644 --- a/app/routes.php +++ b/app/routes.php @@ -489,7 +489,7 @@ $r->addRoute(['GET', 'POST'], '/articles/move/{id:\d+}', [App\Controllers\Admin\BlogController::class, 'moveBlog']); $r->get('/articles/delete/{id:\d+}', [App\Controllers\Admin\BlogController::class, 'deleteBlog']); - $r->get('/boards/{id:\d+}?', [App\Controllers\Admin\BoardController::class, 'index']); + $r->get('/boards[/{id:\d+}]', [App\Controllers\Admin\BoardController::class, 'index']); $r->get('/boards/restatement', [App\Controllers\Admin\BoardController::class, 'restatement']); $r->addRoute(['GET', 'POST'], '/items/edit/{id:\d+}', [App\Controllers\Admin\BoardController::class, 'editItem']); $r->get('/items/delete/{id:\d+}', [App\Controllers\Admin\BoardController::class, 'deleteItem']); From 0cf8bdb3814a4afc68cd0523379f22791b5de835 Mon Sep 17 00:00:00 2001 From: visavi Date: Sun, 14 Oct 2018 02:34:26 +0300 Subject: [PATCH 046/163] =?UTF-8?q?=D0=92=D0=BD=D0=B5=D0=B4=D1=80=D0=B5?= =?UTF-8?q?=D0=BD=20DI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Classes/Application.php | 16 +- app/Controllers/AjaxController.php | 136 ++++----- app/Controllers/ApiController.php | 21 +- app/Controllers/BaseController.php | 10 +- app/Controllers/BlogController.php | 123 ++++---- app/Controllers/BoardController.php | 58 ++-- app/Controllers/GuestbookController.php | 24 +- app/Models/BaseModel.php | 2 + composer.json | 3 +- composer.lock | 362 +++++++++++++++++++++++- 10 files changed, 581 insertions(+), 174 deletions(-) diff --git a/app/Classes/Application.php b/app/Classes/Application.php index 2502c912a..431d48908 100644 --- a/app/Classes/Application.php +++ b/app/Classes/Application.php @@ -2,7 +2,9 @@ namespace App\Classes; +use DI\Container; use FastRoute\Dispatcher; +use Illuminate\Http\Request; class Application { @@ -35,9 +37,19 @@ public function run(): void private function call($router) { [, $controller, $params] = $router; - $action = $params['action'] ?? $controller[1]; - return \call_user_func_array([new $controller[0], $action], $params); + if (isset($params['action'])) { + $controller[1] = $params['action']; + } + + $container = new Container(); + $container->set(Request::class, Request::createFromGlobals()); + + try { + return $container->call($controller, $params); + } catch (\Exception $e) { + return \call_user_func_array([new $controller[0], $controller[1]], $params); + } } /** diff --git a/app/Controllers/AjaxController.php b/app/Controllers/AjaxController.php index 97cf94343..3e43408ef 100644 --- a/app/Controllers/AjaxController.php +++ b/app/Controllers/AjaxController.php @@ -2,7 +2,7 @@ namespace App\Controllers; -use App\Classes\{Request, Validator}; +use App\Classes\Validator; use App\Models\{ Blog, Comment, @@ -19,61 +19,31 @@ Spam, Wall }; +use Illuminate\Http\Request; class AjaxController extends BaseController { /** * Конструктор + * + * @param Request $request */ - public function __construct() + public function __construct(Request $request) { parent::__construct(); - $this->checkAjax(); + $this->checkAjax($request); $this->checkAuthorize(); } - /** - * Возвращает является ли запрос ajax - * - * @return string - */ - public function checkAjax(): string - { - if (! Request::ajax()) { - return json_encode([ - 'status' => 'error', - 'message' => 'This is not ajax request' - ]); - } - - return true; - } - - /** - * Возвращает авторизован ли пользователь - * - * @return string - */ - private function checkAuthorize(): string - { - if (! getUser()) { - return json_encode([ - 'status' => 'error', - 'message' => 'Not authorized' - ]); - } - - return true; - } - /** * Возвращает bbCode для предпросмотра * + * @param Request $request * @return string */ - public function bbCode(): string + public function bbCode(Request $request): string { - $message = check(Request::input('data')); + $message = check($request->input('data')); return view('app/_bbcode', compact('message')); } @@ -81,16 +51,17 @@ public function bbCode(): string /** * Отправляет жалобу на сообщение * + * @param Request $request * @return string */ - public function complaint(): string + public function complaint(Request $request): string { $path = null; $data = false; - $id = int(Request::input('id')); - $type = check(Request::input('type')); - $page = check(Request::input('page')); - $token = check(Request::input('token')); + $id = int($request->input('id')); + $type = check($request->input('type')); + $page = check($request->input('page')); + $token = check($request->input('token')); switch ($type): case Guestbook::class: @@ -187,18 +158,19 @@ public function complaint(): string /** * Удаляет комментарии * + * @param Request $request * @return string */ - public function delComment(): string + public function delComment(Request $request): string { if (! isAdmin()) { return json_encode(['status' => 'error', 'message' => 'Not authorized']); } - $token = check(Request::input('token')); - $type = check(Request::input('type')); - $rid = int(Request::input('rid')); - $id = int(Request::input('id')); + $token = check($request->input('token')); + $type = check($request->input('type')); + $rid = int($request->input('rid')); + $id = int($request->input('id')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); @@ -226,10 +198,11 @@ public function delComment(): string /** * Изменяет рейтинг * + * @param Request $request * @return string * @throws \Exception */ - public function rating(): string + public function rating(Request $request): string { $types = [ Post::class, @@ -239,10 +212,10 @@ public function rating(): string Offer::class, ]; - $id = int(Request::input('id')); - $type = check(Request::input('type')); - $vote = check(Request::input('vote')); - $token = check(Request::input('token')); + $id = int($request->input('id')); + $type = check($request->input('type')); + $vote = check($request->input('vote')); + $token = check($request->input('token')); if ($token !== $_SESSION['token']) { return json_encode(['status' => 'error', 'message' => 'Invalid token']); @@ -306,9 +279,10 @@ public function rating(): string /** * Загружает изображение * + * @param Request $request * @return string */ - public function uploadImage(): string + public function uploadImage(Request $request): string { $types = [ Blog::class, @@ -316,10 +290,10 @@ public function uploadImage(): string Photo::class, ]; - $image = Request::file('image'); - $id = int(Request::input('id')); - $type = check(Request::input('type')); - $token = check(Request::input('token')); + $image = $request->file('image'); + $id = int($request->input('id')); + $type = check($request->input('type')); + $token = check($request->input('token')); if (! \in_array($type, $types, true)) { return json_encode(['status' => 'error', 'message' => 'Type invalid']); @@ -379,10 +353,11 @@ public function uploadImage(): string /** * Удаляет изображение * + * @param Request $request * @return string * @throws \Exception */ - public function deleteImage(): string + public function deleteImage(Request $request): string { $types = [ Blog::class, @@ -390,9 +365,9 @@ public function deleteImage(): string Photo::class, ]; - $id = int(Request::input('id')); - $type = check(Request::input('type')); - $token = check(Request::input('token')); + $id = int($request->input('id')); + $type = check($request->input('type')); + $token = check($request->input('token')); if (! \in_array($type, $types, true)) { return json_encode(['status' => 'error', 'message' => 'Type invalid']); @@ -429,4 +404,39 @@ public function deleteImage(): string 'message' => current($validator->getErrors()) ]); } + + /** + * Возвращает является ли запрос ajax + * + * @param Request $request + * @return string + */ + private function checkAjax(Request $request): string + { + if (! $request->ajax()) { + return json_encode([ + 'status' => 'error', + 'message' => 'This is not ajax request' + ]); + } + + return true; + } + + /** + * Возвращает авторизован ли пользователь + * + * @return string + */ + private function checkAuthorize(): string + { + if (! getUser()) { + return json_encode([ + 'status' => 'error', + 'message' => 'Not authorized' + ]); + } + + return true; + } } diff --git a/app/Controllers/ApiController.php b/app/Controllers/ApiController.php index b0e2fe4f7..94917b4ff 100644 --- a/app/Controllers/ApiController.php +++ b/app/Controllers/ApiController.php @@ -2,11 +2,11 @@ namespace App\Controllers; -use App\Classes\Request; use App\Models\Inbox; use App\Models\Post; use App\Models\Topic; use App\Models\User; +use Illuminate\Http\Request; class ApiController extends BaseController { @@ -23,14 +23,15 @@ public function index(): string /** * Api пользователей * + * @param Request $request * @return void */ - public function users(): void + public function users(Request $request): void { header('Content-type: application/json'); header('Content-Disposition: inline; filename="users.json";'); - $token = check(Request::input('token')); + $token = check($request->input('token')); if (! $token) { echo json_encode(['error' => 'no token']); @@ -72,15 +73,16 @@ public function users(): void /** * Api приватных сообщений * + * @param Request $request * @return void */ - public function messages(): void + public function messages(Request $request): void { header('Content-type: application/json'); header('Content-Disposition: inline; filename="messages.json";'); - $token = check(Request::input('token')); - $count = int(Request::input('count', 10)); + $token = check($request->input('token')); + $count = int($request->input('count', 10)); if (! $token) { echo json_encode(['error' => 'no token']); @@ -127,15 +129,16 @@ public function messages(): void /** * Api постов темы в форуме * + * @param Request $request * @return void */ - public function forums(): void + public function forums(Request $request): void { header('Content-type: application/json'); header('Content-Disposition: inline; filename="forums.json";'); - $token = check(Request::input('token')); - $id = int(Request::input('id')); + $token = check($request->input('token')); + $id = int($request->input('id')); if (! $token) { echo json_encode(['error' => 'no token']); diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index f8a433068..c4780c700 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -2,15 +2,17 @@ namespace App\Controllers; -use App\Classes\Request; use App\Models\Ban; use App\Models\Error; use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Http\Request; Class BaseController { public function __construct() { + $request = new Request(); + /** * Проверка на ip-бан */ @@ -28,7 +30,7 @@ public function __construct() } } - if ($matches === 4 && ! Request::is('banip', 'captcha')) { + if ($matches === 4 && ! $request->is('banip', 'captcha')) { redirect('/banip'); } } @@ -91,13 +93,13 @@ public function __construct() } // Сайт закрыт для гостей - if (setting('closedsite') == 1 && ! getUser() && ! Request::is('register', 'login', 'recovery', 'captcha')) { + if (setting('closedsite') == 1 && ! getUser() && ! $request->is('register', 'login', 'recovery', 'captcha')) { setFlash('danger', 'Для входа на сайт необходимо авторизоваться!'); redirect('/login'); } // Сайт закрыт для всех - if (setting('closedsite') == 2 && ! isAdmin() && ! Request::is('closed', 'login')) { + if (setting('closedsite') == 2 && ! isAdmin() && ! $request->is('closed', 'login')) { redirect('/closed'); } } diff --git a/app/Controllers/BlogController.php b/app/Controllers/BlogController.php index 132880054..3895f512b 100644 --- a/app/Controllers/BlogController.php +++ b/app/Controllers/BlogController.php @@ -2,7 +2,6 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Blog; use App\Models\Category; @@ -13,6 +12,7 @@ use App\Models\User; use Illuminate\Database\Capsule\Manager as DB; use Illuminate\Database\Query\JoinClause; +use Illuminate\Http\Request; class BlogController extends BaseController { @@ -42,7 +42,7 @@ public function index(): string * @param int $id * @return string */ - public function blog($id): string + public function blog(int $id): string { $category = Category::query()->with('parent')->find($id); @@ -71,7 +71,7 @@ public function blog($id): string * @param int $id * @return string */ - public function view($id): string + public function view(int $id): string { $blog = Blog::query() ->select('blogs.*', 'pollings.vote') @@ -132,10 +132,11 @@ public function view($id): string /** * Редактирование статьи * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit($id): string + public function edit(int $id, Request $request): string { if (! getUser()) { abort(403, 'Для редактирования статьи необходимо авторизоваться'); @@ -152,13 +153,13 @@ public function edit($id): string abort('default', 'Изменение невозможно, вы не автор данной статьи!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $cid = int(Request::input('cid')); - $title = check(Request::input('title')); - $text = check(Request::input('text')); - $tags = check(Request::input('tags')); + $token = check($request->input('token')); + $cid = int($request->input('cid')); + $title = check($request->input('title')); + $text = check($request->input('text')); + $tags = check($request->input('tags')); /** @var Category $category */ $category = Category::query()->find($cid); @@ -193,7 +194,7 @@ public function edit($id): string setFlash('success', 'Статья успешно отредактирована!'); redirect('/articles/' . $blog->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -237,11 +238,12 @@ public function authors(): string /** * Создание статьи * + * @param Request $request * @return string */ - public function create(): string + public function create(Request $request): string { - $cid = int(Request::input('cid')); + $cid = int($request->input('cid')); if (! getUser()) { abort(403, 'Для публикации новой статьи необходимо авторизоваться'); @@ -257,12 +259,12 @@ public function create(): string abort(404, 'Разделы блогов еще не созданы!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $title = check(Request::input('title')); - $text = check(Request::input('text')); - $tags = check(Request::input('tags')); + $token = check($request->input('token')); + $title = check($request->input('title')); + $text = check($request->input('text')); + $tags = check($request->input('tags')); /** @var Category $category */ $category = Category::query()->find($cid); @@ -310,7 +312,7 @@ public function create(): string setFlash('success', 'Статья успешно опубликована!'); redirect('/articles/' . $blog->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -327,10 +329,11 @@ public function create(): string /** * Комментарии * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function comments($id): string + public function comments(int $id, Request $request): string { /** @var Blog $blog */ $blog = Blog::query()->find($id); @@ -339,10 +342,10 @@ public function comments($id): string abort(404, 'Данной статьи не существует!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $msg = check(Request::input('msg')); + $token = check($request->input('token')); + $msg = check($request->input('msg')); $validator = new Validator(); $validator @@ -355,6 +358,7 @@ public function comments($id): string $msg = antimat($msg); + /** @var Comment $comment */ $comment = Comment::query()->create([ 'relate_type' => Blog::class, 'relate_id' => $blog->id, @@ -378,7 +382,7 @@ public function comments($id): string setFlash('success', 'Комментарий успешно добавлен!'); redirect('/articles/end/' . $blog->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -404,13 +408,14 @@ public function comments($id): string /** * Подготовка к редактированию комментария * - * @param int $id - * @param int $cid + * @param int $id + * @param int $cid + * @param Request $request * @return string */ - public function editComment($id, $cid): string + public function editComment(int $id, int $cid, Request $request): string { - $page = int(Request::input('page', 1)); + $page = int($request->input('page', 1)); /** @var Blog $blog */ $blog = Blog::query()->find($id); @@ -437,10 +442,10 @@ public function editComment($id, $cid): string abort('default', 'Редактирование невозможно, прошло более 10 минут!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $msg = check(Request::input('msg')); - $page = int(Request::input('page', 1)); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $msg = check($request->input('msg')); + $page = int($request->input('page', 1)); $validator = new Validator(); $validator @@ -457,7 +462,7 @@ public function editComment($id, $cid): string setFlash('success', 'Комментарий успешно отредактирован!'); redirect('/articles/comments/' . $blog->id . '?page=' . $page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -471,7 +476,7 @@ public function editComment($id, $cid): string * @param int $id * @return void */ - public function end($id): void + public function end(int $id): void { $blog = Blog::query()->find($id); @@ -494,7 +499,7 @@ public function end($id): void * @param int $id * @return string */ - public function print($id): string + public function print(int $id): string { /** @var Blog $blog */ $blog = Blog::query()->find($id); @@ -533,7 +538,7 @@ public function rss(): string * @param int $id * @return string */ - public function rssComments($id): string + public function rssComments(int $id): string { $blog = Blog::query()->where('id', $id)->with('lastComments')->first(); @@ -549,7 +554,7 @@ public function rssComments($id): string * * @return string */ - public function tags() + public function tags(): string { if (@filemtime(STORAGE . '/temp/tagcloud.dat') < time() - 3600) { @@ -559,7 +564,7 @@ public function tags() ->all(); $stingTag = implode(',', $allTags); - $dumptags = preg_split('/[\s]*[,][\s]*/s', $stingTag, -1, PREG_SPLIT_NO_EMPTY); + $dumptags = preg_split('/[\s]*[,][\s]*/', $stingTag, -1, PREG_SPLIT_NO_EMPTY); $allTags = array_count_values(array_map('utfLower', $dumptags)); arsort($allTags); @@ -582,7 +587,7 @@ public function tags() * @param string $tag * @return string */ - public function searchTag($tag): string + public function searchTag(string $tag): string { $tag = urldecode($tag); @@ -681,11 +686,12 @@ public function newComments(): string /** * Статьи пользователя * + * @param Request $request * @return string */ - public function userArticles(): string + public function userArticles(Request $request): string { - $login = check(Request::input('user', getUser('login'))); + $login = check($request->input('user', getUser('login'))); $user = User::query()->where('login', $login)->first(); @@ -708,11 +714,12 @@ public function userArticles(): string /** * Комментарии пользователя * + * @param Request $request * @return string */ - public function userComments(): string + public function userComments(Request $request): string { - $login = check(Request::input('user', getUser('login'))); + $login = check($request->input('user', getUser('login'))); $user = User::query()->where('login', $login)->first(); @@ -747,7 +754,7 @@ public function userComments(): string * @param $cid * @return void */ - public function viewComment($id, $cid): void + public function viewComment(int $id, int $cid): void { /** @var Blog $blog */ $blog = Blog::query()->find($id); @@ -770,11 +777,12 @@ public function viewComment($id, $cid): void /** * Топ статей * + * @param Request $request * @return string */ - public function top(): string + public function top(Request $request): string { - $sort = check(Request::input('sort', 'visits')); + $sort = check($request->input('sort', 'visits')); switch ($sort) { case 'rated': $order = 'rating'; @@ -802,13 +810,14 @@ public function top(): string /** * Поиск * + * @param Request $request * @return string */ - public function search(): ?string + public function search(Request $request): ?string { - $find = check(Request::input('find')); - $type = int(Request::input('type')); - $where = int(Request::input('where')); + $find = check($request->input('find')); + $type = int($request->input('type')); + $where = int($request->input('where')); if (! getUser()) { abort(403, 'Чтобы использовать поиск, необходимо авторизоваться'); @@ -822,7 +831,9 @@ public function search(): ?string $find = winToUtf($find); } - if (utfStrlen($find) >= 3 && utfStrlen($find) <= 50) { + $strlen = utfStrlen($find); + + if ($strlen >= 3 && $strlen <= 50) { $findme = utfLower($find); $findmewords = explode(' ', $findme); @@ -878,7 +889,7 @@ public function search(): ?string return view('blogs/search_title', compact('blogs', 'find', 'page')); } - setInput(Request::all()); + setInput($request->all()); setFlash('danger', 'По вашему запросу ничего не найдено!'); redirect('/blogs/search'); } @@ -921,12 +932,12 @@ public function search(): ?string return view('blogs/search_text', compact('blogs', 'find', 'page')); } - setInput(Request::all()); + setInput($request->all()); setFlash('danger', 'По вашему запросу ничего не найдено!'); redirect('/blogs/search'); } } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', ['find' => 'Запрос должен содержать от 3 до 50 символов!']); redirect('/blogs/search'); } diff --git a/app/Controllers/BoardController.php b/app/Controllers/BoardController.php index 4d093b2f0..b8e447b39 100644 --- a/app/Controllers/BoardController.php +++ b/app/Controllers/BoardController.php @@ -2,7 +2,6 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Board; use App\Models\File; @@ -10,6 +9,7 @@ use App\Models\Item; use Exception; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Http\Request; class BoardController extends BaseController { @@ -65,7 +65,7 @@ public function index(int $id = null): string * @param int $id * @return string */ - public function view($id): string + public function view(int $id): string { /** @var Item $item */ $item = Item::query() @@ -86,11 +86,12 @@ public function view($id): string /** * Создание объявления * + * @param Request $request * @return string */ - public function create(): string + public function create(Request $request): string { - $bid = int(Request::input('bid')); + $bid = int($request->input('bid')); if (! $user = getUser()) { abort(403); @@ -106,13 +107,13 @@ public function create(): string abort('default', 'Разделы объявлений еще не созданы!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $title = check(Request::input('title')); - $text = check(Request::input('text')); - $price = int(Request::input('price')); - $phone = preg_replace('/\D/', '', Request::input('phone')); + $token = check($request->input('token')); + $title = check($request->input('title')); + $text = check($request->input('text')); + $price = int($request->input('price')); + $phone = preg_replace('/\D/', '', $request->input('phone')); /** @var Board $board */ $board = Board::query()->find($bid); @@ -156,7 +157,7 @@ public function create(): string setFlash('success', 'Объявления успешно добавлено!'); redirect('/items/' . $item->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -173,10 +174,11 @@ public function create(): string /** * Редактирование объявления * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit($id): string + public function edit(int $id, Request $request): string { if (! getUser()) { abort(403, 'Для редактирования объявления необходимо авторизоваться'); @@ -189,13 +191,13 @@ public function edit($id): string abort(404, 'Данного объявления не существует!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $bid = int(Request::input('bid')); - $title = check(Request::input('title')); - $text = check(Request::input('text')); - $price = check(Request::input('price')); - $phone = preg_replace('/\D/', '', Request::input('phone')); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $bid = int($request->input('bid')); + $title = check($request->input('title')); + $text = check($request->input('text')); + $price = check($request->input('price')); + $phone = preg_replace('/\D/', '', $request->input('phone')); /** @var Board $board */ $board = Board::query()->find($bid); @@ -232,7 +234,7 @@ public function edit($id): string setFlash('success', 'Объявление успешно отредактировано!'); redirect('/items/' . $item->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -249,11 +251,12 @@ public function edit($id): string /** * Снятие / Публикация объявления * - * @param int $id + * @param int $id + * @param Request $request */ - public function close($id): void + public function close(int $id, Request $request): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); if (! getUser()) { abort(403, 'Для редактирования объявления необходимо авторизоваться'); @@ -302,12 +305,13 @@ public function close($id): void /** * Удаление объявления * - * @param int $id + * @param int $id + * @param Request $request * @throws Exception */ - public function delete($id): void + public function delete(int $id, Request $request): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); if (! getUser()) { abort(403, 'Для редактирования объявления необходимо авторизоваться'); diff --git a/app/Controllers/GuestbookController.php b/app/Controllers/GuestbookController.php index 180e01722..9d2ab7526 100644 --- a/app/Controllers/GuestbookController.php +++ b/app/Controllers/GuestbookController.php @@ -2,11 +2,11 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Flood; use App\Models\Guestbook; use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Http\Request; class GuestbookController extends BaseController { @@ -33,12 +33,13 @@ public function index(): string /** * Добавление сообщения * + * @param Request $request * @return void */ - public function add(): void + public function add(Request $request): void { - $msg = check(Request::input('msg')); - $token = check(Request::input('token')); + $msg = check($request->input('msg')); + $token = check($request->input('token')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) @@ -81,7 +82,7 @@ public function add(): void setFlash('success', 'Сообщение успешно добавлено!'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } @@ -91,10 +92,11 @@ public function add(): void /** * Редактирование сообщения * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit($id): string + public function edit($id, Request $request): string { if (! getUser()) { abort(403); @@ -111,10 +113,10 @@ public function edit($id): string abort('default', 'Редактирование невозможно, прошло более 10 минут!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $msg = check(Request::input('msg')); - $token = check(Request::input('token')); + $msg = check($request->input('msg')); + $token = check($request->input('token')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) @@ -133,7 +135,7 @@ public function edit($id): string setFlash('success', 'Сообщение успешно отредактировано!'); redirect('/guestbooks'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php index 588f91091..5d6d94836 100644 --- a/app/Models/BaseModel.php +++ b/app/Models/BaseModel.php @@ -11,6 +11,8 @@ * Class BaseModel * * @property User user + * @method increment(string $field, $amount = 1, array $extra = []) + * @method decrement(string $field, $amount = 1, array $extra = []) * @package App\Models */ class BaseModel extends Model diff --git a/composer.json b/composer.json index 0c7cbac46..c8c44fc55 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,8 @@ "visavi/crontask": "^1.1", "nelexa/zip": "^3.1", "intervention/image": "^2.4", - "nikic/fast-route": "^1.3" + "nikic/fast-route": "^1.3", + "php-di/php-di": "^6.0" }, "require-dev": { "filp/whoops": "^2.2", diff --git a/composer.lock b/composer.lock index 2679e5ba9..1c90a7532 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": "cd7d867abbe2c3f97db2f7ba14b6709f", + "content-hash": "95d9015216b400967d094708e008dff5", "packages": [ { "name": "alchemy/binary-driver", @@ -1240,6 +1240,64 @@ ], "time": "2016-08-23T11:51:53+00:00" }, + { + "name": "jeremeamia/SuperClosure", + "version": "2.4.0", + "source": { + "type": "git", + "url": "https://github.com/jeremeamia/super_closure.git", + "reference": "5707d5821b30b9a07acfb4d76949784aaa0e9ce9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jeremeamia/super_closure/zipball/5707d5821b30b9a07acfb4d76949784aaa0e9ce9", + "reference": "5707d5821b30b9a07acfb4d76949784aaa0e9ce9", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^1.2|^2.0|^3.0|^4.0", + "php": ">=5.4", + "symfony/polyfill-php56": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "psr-4": { + "SuperClosure\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia", + "role": "Developer" + } + ], + "description": "Serialize Closure objects, including their context and binding", + "homepage": "https://github.com/jeremeamia/super_closure", + "keywords": [ + "closure", + "function", + "lambda", + "parser", + "serializable", + "serialize", + "tokenizer" + ], + "time": "2018-03-21T22:21:57+00:00" + }, { "name": "mobiledetect/mobiledetectlib", "version": "2.8.33", @@ -1570,6 +1628,57 @@ ], "time": "2018-02-13T20:26:39+00:00" }, + { + "name": "nikic/php-parser", + "version": "v4.1.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "d0230c5c77a7e3cfa69446febf340978540958c0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/d0230c5c77a7e3cfa69446febf340978540958c0", + "reference": "d0230c5c77a7e3cfa69446febf340978540958c0", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.5 || ^7.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2018-10-10T09:24:14+00:00" + }, { "name": "php-curl-class/php-curl-class", "version": "8.3.2", @@ -1635,6 +1744,149 @@ ], "time": "2018-09-09T07:05:39+00:00" }, + { + "name": "php-di/invoker", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-DI/Invoker.git", + "reference": "540c27c86f663e20fe39a24cd72fa76cdb21d41a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/540c27c86f663e20fe39a24cd72fa76cdb21d41a", + "reference": "540c27c86f663e20fe39a24cd72fa76cdb21d41a", + "shasum": "" + }, + "require": { + "psr/container": "~1.0" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "phpunit/phpunit": "~4.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Invoker\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Generic and extensible callable invoker", + "homepage": "https://github.com/PHP-DI/Invoker", + "keywords": [ + "callable", + "dependency", + "dependency-injection", + "injection", + "invoke", + "invoker" + ], + "time": "2017-03-20T19:28:22+00:00" + }, + { + "name": "php-di/php-di", + "version": "6.0.5", + "source": { + "type": "git", + "url": "https://github.com/PHP-DI/PHP-DI.git", + "reference": "5e8b809960d5c3bfa096a90da9a78650e80b1f0e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/5e8b809960d5c3bfa096a90da9a78650e80b1f0e", + "reference": "5e8b809960d5c3bfa096a90da9a78650e80b1f0e", + "shasum": "" + }, + "require": { + "jeremeamia/superclosure": "^2.0", + "nikic/php-parser": "^2.0|^3.0|^4.0", + "php": ">=7.0.0", + "php-di/invoker": "^2.0", + "php-di/phpdoc-reader": "^2.0.1", + "psr/container": "^1.0" + }, + "provide": { + "psr/container-implementation": "^1.0" + }, + "require-dev": { + "doctrine/annotations": "~1.2", + "friendsofphp/php-cs-fixer": "^2.4", + "mnapoli/phpunit-easymock": "~1.0", + "ocramius/proxy-manager": "~2.0.2", + "phpstan/phpstan": "^0.9.2", + "phpunit/phpunit": "~6.4" + }, + "suggest": { + "doctrine/annotations": "Install it if you want to use annotations (version ~1.2)", + "ocramius/proxy-manager": "Install it if you want to use lazy injection (version ~2.0)" + }, + "type": "library", + "autoload": { + "psr-4": { + "DI\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "The dependency injection container for humans", + "homepage": "http://php-di.org/", + "keywords": [ + "PSR-11", + "container", + "container-interop", + "dependency injection", + "di", + "ioc", + "psr11" + ], + "time": "2018-09-17T15:34:44+00:00" + }, + { + "name": "php-di/phpdoc-reader", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-DI/PhpDocReader.git", + "reference": "7d0de60b9341933c8afd172a6255cd7557601e0e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-DI/PhpDocReader/zipball/7d0de60b9341933c8afd172a6255cd7557601e0e", + "reference": "7d0de60b9341933c8afd172a6255cd7557601e0e", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.6" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpDocReader\\": "src/PhpDocReader" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PhpDocReader parses @var and @param values in PHP docblocks (supports namespaced class names with the same resolution rules as PHP)", + "keywords": [ + "phpdoc", + "reflection" + ], + "time": "2018-02-18T17:39:01+00:00" + }, { "name": "php-ffmpeg/php-ffmpeg", "version": "v0.13", @@ -2650,6 +2902,114 @@ ], "time": "2018-08-06T14:22:27+00:00" }, + { + "name": "symfony/polyfill-php56", + "version": "v1.9.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php56.git", + "reference": "7b4fc009172cc0196535b0328bd1226284a28000" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/7b4fc009172cc0196535b0328bd1226284a28000", + "reference": "7b4fc009172cc0196535b0328bd1226284a28000", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/polyfill-util": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php56\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2018-08-06T14:22:27+00:00" + }, + { + "name": "symfony/polyfill-util", + "version": "v1.9.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-util.git", + "reference": "8e15d04ba3440984d23e7964b2ee1d25c8de1581" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/8e15d04ba3440984d23e7964b2ee1d25c8de1581", + "reference": "8e15d04ba3440984d23e7964b2ee1d25c8de1581", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Util\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony utilities for portability of PHP codes", + "homepage": "https://symfony.com", + "keywords": [ + "compat", + "compatibility", + "polyfill", + "shim" + ], + "time": "2018-08-06T14:22:27+00:00" + }, { "name": "symfony/process", "version": "v4.1.6", From 5b008cf28ebffaacb128f9e1fee0a6f13cb971ce Mon Sep 17 00:00:00 2001 From: visavi Date: Sun, 14 Oct 2018 06:09:06 +0300 Subject: [PATCH 047/163] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=20?= =?UTF-8?q?=D0=BA=D0=BB=D0=B0=D1=81=D1=81=20Request,=20=D1=80=D0=B5=D1=84?= =?UTF-8?q?=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=20DI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Classes/Request.php | 38 ---- app/Controllers/Admin/AntimatController.php | 16 +- app/Controllers/Admin/BackupController.php | 18 +- app/Controllers/Admin/BanController.php | 34 ++-- app/Controllers/Admin/BanhistController.php | 12 +- app/Controllers/Admin/BlacklistController.php | 18 +- app/Controllers/Admin/BlogController.php | 62 +++---- app/Controllers/Admin/BoardController.php | 53 +++--- app/Controllers/Admin/CacheController.php | 8 +- app/Controllers/Admin/ChatController.php | 24 +-- app/Controllers/Admin/CheckerController.php | 4 +- app/Controllers/Admin/DelUserController.php | 14 +- app/Controllers/Admin/DeliveryController.php | 12 +- app/Controllers/Admin/ErrorController.php | 6 +- app/Controllers/Admin/FilesController.php | 30 ++-- app/Controllers/Admin/ForumController.php | 103 ++++++----- app/Controllers/Admin/GuestbookController.php | 34 ++-- .../Admin/InvitationController.php | 32 ++-- app/Controllers/Admin/IpBanController.php | 18 +- app/Controllers/Admin/LoadController.php | 61 ++++--- app/Controllers/Admin/LogController.php | 4 +- app/Controllers/Admin/NewsController.php | 46 ++--- app/Controllers/Admin/NoticeController.php | 34 ++-- app/Controllers/Admin/OfferController.php | 46 ++--- app/Controllers/Admin/PhotoController.php | 26 +-- app/Controllers/Admin/ReglistController.php | 14 +- app/Controllers/Admin/RekUserController.php | 26 +-- app/Controllers/Admin/RuleController.php | 10 +- app/Controllers/Admin/SettingController.php | 16 +- app/Controllers/Admin/SmileController.php | 30 ++-- app/Controllers/Admin/SpamController.php | 10 +- app/Controllers/Admin/StatusController.php | 36 ++-- app/Controllers/Admin/TransferController.php | 4 +- app/Controllers/Admin/UserController.php | 72 ++++---- app/Controllers/Admin/VoteController.php | 24 +-- app/Controllers/AjaxController.php | 24 +-- app/Controllers/BlogController.php | 32 ++-- app/Controllers/BoardController.php | 30 ++-- app/Controllers/BookmarkController.php | 25 +-- app/Controllers/ContactController.php | 43 ++--- app/Controllers/CounterController.php | 1 - app/Controllers/Forum/ActiveController.php | 14 +- app/Controllers/Forum/ForumController.php | 67 ++++--- app/Controllers/Forum/TopicController.php | 106 ++++++----- app/Controllers/GuestbookController.php | 14 +- app/Controllers/HomeController.php | 7 +- app/Controllers/IgnoreController.php | 41 +++-- app/Controllers/Load/ActiveController.php | 10 +- app/Controllers/Load/DownController.php | 108 ++++++----- app/Controllers/Load/LoadController.php | 10 +- app/Controllers/Load/SearchController.php | 24 +-- app/Controllers/Load/TopController.php | 7 +- app/Controllers/LoginController.php | 2 +- app/Controllers/MailController.php | 49 +++-- app/Controllers/MessageController.php | 60 ++++--- app/Controllers/NewsController.php | 55 ++++-- app/Controllers/NotebookController.php | 15 +- app/Controllers/OfferController.php | 100 +++++++---- app/Controllers/PageController.php | 12 +- app/Controllers/PhotoController.php | 107 ++++++----- app/Controllers/PictureController.php | 21 ++- app/Controllers/RatingController.php | 36 ++-- app/Controllers/RekUserController.php | 19 +- app/Controllers/SocialController.php | 20 ++- app/Controllers/TransferController.php | 17 +- app/Controllers/User/BanController.php | 11 +- app/Controllers/User/ListController.php | 23 +-- app/Controllers/User/SearchController.php | 14 +- app/Controllers/User/UserController.php | 170 ++++++++++-------- app/Controllers/VoteController.php | 38 ++-- app/Controllers/WallController.php | 28 +-- app/Models/Down.php | 5 +- app/Models/File.php | 1 + app/Models/Forum.php | 1 + app/Models/Post.php | 2 + app/Models/Topic.php | 1 + app/Models/Vote.php | 3 + app/helpers.php | 26 ++- app/start.php | 6 +- public/install/index.php | 30 ++-- resources/views/app/_note.blade.php | 4 +- 81 files changed, 1310 insertions(+), 1124 deletions(-) delete mode 100644 app/Classes/Request.php diff --git a/app/Classes/Request.php b/app/Classes/Request.php deleted file mode 100644 index 0c9115f12..000000000 --- a/app/Classes/Request.php +++ /dev/null @@ -1,38 +0,0 @@ -isMethod('post')) { + $token = check($request->input('token')); + $word = check(utfLower($request->input('word'))); $validator = new Validator(); $validator @@ -50,7 +50,7 @@ public function index(): string redirect('/admin/antimat'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -68,8 +68,8 @@ public function index(): string */ public function delete(): void { - $token = check(Request::input('token')); - $id = int(Request::input('id')); + $token = check($request->input('token')); + $id = int($request->input('id')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); @@ -96,7 +96,7 @@ public function delete(): void */ public function clear(): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); $validator = new Validator(); $validator diff --git a/app/Controllers/Admin/BackupController.php b/app/Controllers/Admin/BackupController.php index bda0587bb..3583f46ac 100644 --- a/app/Controllers/Admin/BackupController.php +++ b/app/Controllers/Admin/BackupController.php @@ -2,10 +2,10 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\User; use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Http\Request; class BackupController extends AdminController { @@ -49,12 +49,12 @@ public function index(): string */ public function create(): string { - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $sheets = check(Request::input('sheets')); - $method = check(Request::input('method')); - $level = int(Request::input('level')); + $token = check($request->input('token')); + $sheets = check($request->input('sheets')); + $method = check($request->input('method')); + $level = int($request->input('level')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -114,7 +114,7 @@ public function create(): string setFlash('success', 'База данных успешно обработана и сохранена!'); redirect('/admin/backups'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -136,8 +136,8 @@ public function create(): string */ public function delete(): void { - $token = check(Request::input('token')); - $file = check(Request::input('file')); + $token = check($request->input('token')); + $file = check($request->input('file')); $validator = new Validator(); diff --git a/app/Controllers/Admin/BanController.php b/app/Controllers/Admin/BanController.php index 0d5c2b45f..c29001180 100644 --- a/app/Controllers/Admin/BanController.php +++ b/app/Controllers/Admin/BanController.php @@ -2,10 +2,10 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Banhist; use App\Models\User; +use Illuminate\Http\Request; class BanController extends AdminController { @@ -35,7 +35,7 @@ public function index(): string */ public function edit(): string { - $login = check(Request::input('user')); + $login = check($request->input('user')); $user = User::query()->where('login', $login)->with('lastBan')->first(); @@ -47,12 +47,12 @@ public function edit(): string abort('default', 'Запрещено банить администрацию сайта!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $time = int(Request::input('time')); - $type = check(Request::input('type')); - $reason = check(Request::input('reason')); - $notice = check(Request::input('notice')); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $time = int($request->input('time')); + $type = check($request->input('type')); + $reason = check($request->input('reason')); + $notice = check($request->input('notice')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -95,7 +95,7 @@ public function edit(): string setFlash('success', 'Пользователь успешно заблокирован!'); redirect('/admin/bans/edit?user=' . $user->login); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -110,7 +110,7 @@ public function edit(): string */ public function change(): string { - $login = check(Request::input('user')); + $login = check($request->input('user')); $user = User::query()->where('login', $login)->with('lastBan')->first(); @@ -122,10 +122,10 @@ public function change(): string abort('default', 'Данный пользователь не забанен!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $timeban = check(Request::input('timeban')); - $reason = check(Request::input('reason')); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $timeban = check($request->input('timeban')); + $reason = check($request->input('reason')); $timeban = strtotime($timeban); $term = $timeban - SITETIME; @@ -154,7 +154,7 @@ public function change(): string setFlash('success', 'Данные успешно изменены!'); redirect('/admin/bans/edit?user=' . $user->login); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -169,8 +169,8 @@ public function change(): string */ public function unban(): void { - $token = check(Request::input('token')); - $login = check(Request::input('user')); + $token = check($request->input('token')); + $login = check($request->input('user')); $user = User::query()->where('login', $login)->with('lastBan')->first(); diff --git a/app/Controllers/Admin/BanhistController.php b/app/Controllers/Admin/BanhistController.php index d3f0e75c1..f38e0efa9 100644 --- a/app/Controllers/Admin/BanhistController.php +++ b/app/Controllers/Admin/BanhistController.php @@ -2,10 +2,10 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Banhist; use App\Models\User; +use Illuminate\Http\Request; class BanhistController extends AdminController { @@ -45,7 +45,7 @@ public function index(): string */ public function view(): string { - $login = check(Request::input('user')); + $login = check($request->input('user')); $user = User::query()->where('login', $login)->first(); @@ -74,10 +74,10 @@ public function view(): string */ public function delete(): void { - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); - $del = intar(Request::input('del')); - $login = check(Request::input('user')); + $page = int($request->input('page', 1)); + $token = check($request->input('token')); + $del = intar($request->input('del')); + $login = check($request->input('user')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') diff --git a/app/Controllers/Admin/BlacklistController.php b/app/Controllers/Admin/BlacklistController.php index e6caf7be7..2fbcfad8c 100644 --- a/app/Controllers/Admin/BlacklistController.php +++ b/app/Controllers/Admin/BlacklistController.php @@ -2,10 +2,10 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\BlackList; use App\Models\User; +use Illuminate\Http\Request; class BlacklistController extends AdminController { @@ -31,7 +31,7 @@ public function __construct() } $this->types = ['email', 'login', 'domain']; - $this->type = Request::input('type', 'email'); + $this->type = $request->input('type', 'email'); if (! \in_array($this->type, $this->types, true)) { abort(404, 'Указанный тип не найден!'); @@ -47,9 +47,9 @@ public function index(): string { $type = $this->type; - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $value = check(utfLower(Request::input('value'))); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $value = check(utfLower($request->input('value'))); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -83,7 +83,7 @@ public function index(): string setFlash('success', 'Запись успешно добавлена в черный список!'); redirect('/admin/blacklists?type=' . $type); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -109,9 +109,9 @@ public function index(): string */ public function delete(): void { - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); - $del = intar(Request::input('del')); + $page = int($request->input('page', 1)); + $token = check($request->input('token')); + $del = intar($request->input('del')); $type = $this->type; $validator = new Validator(); diff --git a/app/Controllers/Admin/BlogController.php b/app/Controllers/Admin/BlogController.php index 465a9fc2a..8688f141e 100644 --- a/app/Controllers/Admin/BlogController.php +++ b/app/Controllers/Admin/BlogController.php @@ -2,11 +2,11 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Blog; use App\Models\Category; use App\Models\User; +use Illuminate\Http\Request; class BlogController extends AdminController { @@ -37,8 +37,8 @@ public function create(): void abort(403, 'Доступ запрещен!'); } - $token = check(Request::input('token')); - $name = check(Request::input('name')); + $token = check($request->input('token')); + $name = check($request->input('name')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -56,7 +56,7 @@ public function create(): void setFlash('success', 'Новый раздел успешно создан!'); redirect('/admin/blogs/edit/' . $category->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } @@ -69,7 +69,7 @@ public function create(): void * @param int $id * @return string */ - public function edit($id): string + public function edit(int $id): string { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -86,12 +86,12 @@ public function edit($id): string ->orderBy('sort') ->get(); - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $parent = int(Request::input('parent')); - $name = check(Request::input('name')); - $sort = check(Request::input('sort')); - $closed = empty(Request::input('closed')) ? 0 : 1; + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $parent = int($request->input('parent')); + $name = check($request->input('name')); + $sort = check($request->input('sort')); + $closed = empty($request->input('closed')) ? 0 : 1; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -114,7 +114,7 @@ public function edit($id): string setFlash('success', 'Раздел успешно отредактирован!'); redirect('/admin/blogs'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -129,7 +129,7 @@ public function edit($id): string * @return void * @throws \Exception */ - public function delete($id): void + public function delete(int $id): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -141,7 +141,7 @@ public function delete($id): void abort(404, 'Данного раздела не существует!'); } - $token = check(Request::input('token')); + $token = check($request->input('token')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -175,7 +175,7 @@ public function restatement(): void abort(403, 'Доступ запрещен!'); } - $token = check(Request::input('token')); + $token = check($request->input('token')); if ($token === $_SESSION['token']) { @@ -195,7 +195,7 @@ public function restatement(): void * @param int $id * @return string */ - public function blog($id): string + public function blog(int $id): string { $category = Category::query()->with('parent')->find($id); @@ -224,7 +224,7 @@ public function blog($id): string * @param int $id * @return string */ - public function editBlog($id): string + public function editBlog(int $id): string { $blog = Blog::query()->find($id); @@ -232,12 +232,12 @@ public function editBlog($id): string abort(404, 'Данной статьи не существует!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $title = check(Request::input('title')); - $text = check(Request::input('text')); - $tags = check(Request::input('tags')); + $token = check($request->input('token')); + $title = check($request->input('title')); + $text = check($request->input('text')); + $tags = check($request->input('tags')); $validator = new Validator(); $validator @@ -257,7 +257,7 @@ public function editBlog($id): string setFlash('success', 'Статья успешно отредактирована!'); redirect('/articles/'.$blog->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -277,7 +277,7 @@ public function editBlog($id): string * @param int $id * @return string */ - public function moveBlog($id): string + public function moveBlog(int $id): string { $blog = Blog::query()->find($id); @@ -285,10 +285,10 @@ public function moveBlog($id): string abort(404, 'Данной статьи не существует!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $cid = int(Request::input('cid')); + $token = check($request->input('token')); + $cid = int($request->input('cid')); $category = Category::query()->find($cid); @@ -315,7 +315,7 @@ public function moveBlog($id): string setFlash('success', 'Статья успешно перенесена!'); redirect('/articles/'.$blog->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -336,10 +336,10 @@ public function moveBlog($id): string * @return void * @throws \Exception */ - public function deleteBlog($id): void + public function deleteBlog(int $id): void { - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); + $page = int($request->input('page', 1)); + $token = check($request->input('token')); $blog = Blog::query()->find($id); diff --git a/app/Controllers/Admin/BoardController.php b/app/Controllers/Admin/BoardController.php index 511c34e57..009aba1dd 100644 --- a/app/Controllers/Admin/BoardController.php +++ b/app/Controllers/Admin/BoardController.php @@ -2,13 +2,12 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Board; use App\Models\Item; use App\Models\User; use Exception; -use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Http\Request; class BoardController extends AdminController { @@ -88,8 +87,8 @@ public function create(): void abort(403, 'Доступ запрещен!'); } - $token = check(Request::input('token')); - $name = check(Request::input('name')); + $token = check($request->input('token')); + $name = check($request->input('name')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], trans('validator.token')) @@ -107,7 +106,7 @@ public function create(): void setFlash('success', 'Новый раздел успешно создан!'); redirect('/admin/boards/edit/' . $board->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } @@ -120,7 +119,7 @@ public function create(): void * @param int $id * @return string */ - public function edit($id): string + public function edit(int $id): string { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -137,12 +136,12 @@ public function edit($id): string ->orderBy('sort') ->get(); - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $parent = int(Request::input('parent')); - $name = check(Request::input('name')); - $sort = check(Request::input('sort')); - $closed = empty(Request::input('closed')) ? 0 : 1; + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $parent = int($request->input('parent')); + $name = check($request->input('name')); + $sort = check($request->input('sort')); + $closed = empty($request->input('closed')) ? 0 : 1; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], trans('validator.token')) @@ -165,7 +164,7 @@ public function edit($id): string setFlash('success', 'Раздел успешно отредактирован!'); redirect('/admin/boards/categories'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -179,7 +178,7 @@ public function edit($id): string * @param int $id * @throws Exception */ - public function delete($id): void + public function delete(int $id): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -191,7 +190,7 @@ public function delete($id): void abort(404, 'Данного раздела не существует!'); } - $token = check(Request::input('token')); + $token = check($request->input('token')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], trans('validator.token')) @@ -220,7 +219,7 @@ public function delete($id): void * @param int $id * @return string */ - public function editItem($id): string + public function editItem(int $id): string { $item = Item::query()->find($id); @@ -228,13 +227,13 @@ public function editItem($id): string abort(404, 'Данного объявления не существует!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $bid = int(Request::input('bid')); - $title = check(Request::input('title')); - $text = check(Request::input('text')); - $price = check(Request::input('price')); - $phone = preg_replace('/\D/', '', Request::input('phone')); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $bid = int($request->input('bid')); + $title = check($request->input('title')); + $text = check($request->input('text')); + $price = check($request->input('price')); + $phone = preg_replace('/\D/', '', $request->input('phone')); $board = Board::query()->find($bid); @@ -269,7 +268,7 @@ public function editItem($id): string setFlash('success', 'Объявление успешно отредактировано!'); redirect('/admin/items/edit/' . $item->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -289,9 +288,9 @@ public function editItem($id): string * @param int $id * @throws Exception */ - public function deleteItem($id): void + public function deleteItem(int $id): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); $item = Item::query()->find($id); @@ -327,7 +326,7 @@ public function restatement(): void abort(403, 'Доступ запрещен!'); } - $token = check(Request::input('token')); + $token = check($request->input('token')); if ($token === $_SESSION['token']) { diff --git a/app/Controllers/Admin/CacheController.php b/app/Controllers/Admin/CacheController.php index 748d4361e..a775cb2e0 100644 --- a/app/Controllers/Admin/CacheController.php +++ b/app/Controllers/Admin/CacheController.php @@ -2,8 +2,8 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Models\User; +use Illuminate\Http\Request; class CacheController extends AdminController { @@ -26,7 +26,7 @@ public function __construct() */ public function index(): string { - $type = check(Request::input('type', 'files')); + $type = check($request->input('type', 'files')); if ($type === 'files') { $files = glob(STORAGE . '/temp/*.dat'); @@ -51,8 +51,8 @@ public function index(): string */ public function clear(): void { - $token = check(Request::input('token')); - $type = check(Request::input('type', 'files')); + $token = check($request->input('token')); + $type = check($request->input('type', 'files')); if ($token === $_SESSION['token']) { diff --git a/app/Controllers/Admin/ChatController.php b/app/Controllers/Admin/ChatController.php index 616736fa4..98eb7da0d 100644 --- a/app/Controllers/Admin/ChatController.php +++ b/app/Controllers/Admin/ChatController.php @@ -2,10 +2,10 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Chat; use App\Models\User; +use Illuminate\Http\Request; class ChatController extends AdminController { @@ -22,9 +22,9 @@ public function index(): string ]); } - if (Request::isMethod('post')) { - $msg = check(Request::input('msg')); - $token = check(Request::input('token')); + if ($request->isMethod('post')) { + $msg = check($request->input('msg')); + $token = check($request->input('token')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) @@ -60,7 +60,7 @@ public function index(): string setFlash('success', 'Сообщение успешно добавлено!'); redirect ('/admin/chats'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -84,9 +84,9 @@ public function index(): string * @param int $id * @return string */ - public function edit($id): string + public function edit(int $id): string { - $page = int(Request::input('page', 1)); + $page = int($request->input('page', 1)); if (! getUser()) { abort(403); @@ -102,10 +102,10 @@ public function edit($id): string abort('default', 'Редактирование невозможно, прошло более 10 минут!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $msg = check(Request::input('msg')); - $token = check(Request::input('token')); + $msg = check($request->input('msg')); + $token = check($request->input('token')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) @@ -122,7 +122,7 @@ public function edit($id): string setFlash('success', 'Сообщение успешно отредактировано!'); redirect('/admin/chats?page=' . $page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -137,7 +137,7 @@ public function edit($id): string */ public function clear(): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); $validator = new Validator(); $validator diff --git a/app/Controllers/Admin/CheckerController.php b/app/Controllers/Admin/CheckerController.php index b933d10b3..48d642694 100644 --- a/app/Controllers/Admin/CheckerController.php +++ b/app/Controllers/Admin/CheckerController.php @@ -2,8 +2,8 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Models\User; +use Illuminate\Http\Request; class CheckerController extends AdminController { @@ -47,7 +47,7 @@ public function index(): string */ public function scan(): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); if ($token === $_SESSION['token']) { if (is_writable(STORAGE . '/temp')) { diff --git a/app/Controllers/Admin/DelUserController.php b/app/Controllers/Admin/DelUserController.php index 1a6682aeb..a3b463afe 100644 --- a/app/Controllers/Admin/DelUserController.php +++ b/app/Controllers/Admin/DelUserController.php @@ -2,9 +2,9 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\User; +use Illuminate\Http\Request; class DelUserController extends AdminController { @@ -28,10 +28,10 @@ public function __construct() public function index(): string { $users = collect(); - $period = check(Request::input('period')); - $point = check(Request::input('point')); + $period = check($request->input('period')); + $point = check($request->input('point')); - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { if ($period < 180) { abort('default', 'Указанно недопустимое время для удаления!'); @@ -59,9 +59,9 @@ public function index(): string */ public function clear(): void { - $token = check(Request::input('token')); - $period = check(Request::input('period')); - $point = check(Request::input('point')); + $token = check($request->input('token')); + $period = check($request->input('period')); + $point = check($request->input('point')); $validator = new Validator(); $validator diff --git a/app/Controllers/Admin/DeliveryController.php b/app/Controllers/Admin/DeliveryController.php index 43e952df6..cd07e424a 100644 --- a/app/Controllers/Admin/DeliveryController.php +++ b/app/Controllers/Admin/DeliveryController.php @@ -2,9 +2,9 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\User; +use Illuminate\Http\Request; class DeliveryController extends AdminController { @@ -27,11 +27,11 @@ public function __construct() */ public function index(): string { - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $msg = check(Request::input('msg')); - $type = int(Request::input('type')); + $token = check($request->input('token')); + $msg = check($request->input('msg')); + $type = int($request->input('type')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) @@ -75,7 +75,7 @@ public function index(): string setFlash('success', 'Сообщение успешно разослано!'); redirect('/admin/delivery'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } diff --git a/app/Controllers/Admin/ErrorController.php b/app/Controllers/Admin/ErrorController.php index ece238f98..4bb7c33e7 100644 --- a/app/Controllers/Admin/ErrorController.php +++ b/app/Controllers/Admin/ErrorController.php @@ -2,10 +2,10 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Error; use App\Models\User; +use Illuminate\Http\Request; class ErrorController extends AdminController { @@ -30,7 +30,7 @@ public function __construct() abort(403, 'Доступ запрещен!'); } - $this->code = int(Request::input('code', 404)); + $this->code = int($request->input('code', 404)); $this->lists = [404 => 'Ошибки 404', 403 => 'Ошибки 403', 666 => 'Автобаны']; if (! isset($this->lists[$this->code])) { @@ -69,7 +69,7 @@ public function index(): string */ public function clear(): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); $validator = new Validator(); $validator diff --git a/app/Controllers/Admin/FilesController.php b/app/Controllers/Admin/FilesController.php index cbfa5d7fe..3c8c11ff4 100644 --- a/app/Controllers/Admin/FilesController.php +++ b/app/Controllers/Admin/FilesController.php @@ -2,9 +2,9 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\User; +use Illuminate\Http\Request; class FilesController extends AdminController { @@ -22,8 +22,8 @@ public function __construct() abort(403, 'Доступ запрещен!'); } - $this->file = ltrim(check(Request::input('file')), '/'); - $this->path = rtrim(check(Request::input('path')), '/'); + $this->file = ltrim(check($request->input('file')), '/'); + $this->path = rtrim(check($request->input('path')), '/'); if ( ! file_exists(RESOURCES . '/views/' . $this->path) || @@ -85,9 +85,9 @@ public function edit(): string abort('default', 'Файл недоступен для записи!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $msg = Request::input('msg'); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $msg = $request->input('msg'); if ($token === $_SESSION['token']) { @@ -97,7 +97,7 @@ public function edit(): string redirect ('/admin/files/edit?path=' . $this->path . '&file=' . $this->file); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', 'Неверный идентификатор сессии, повторите действие!'); } } @@ -118,10 +118,10 @@ public function create(): string abort('default', 'Директория ' . $this->path . ' недоступна для записи!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $filename = check(Request::input('filename')); - $dirname = check(Request::input('dirname')); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $filename = check($request->input('filename')); + $dirname = check($request->input('dirname')); $fileName = $this->path ? '/' . $filename : $filename; $dirName = $this->path ? '/' . $dirname : $dirname; @@ -159,7 +159,7 @@ public function create(): string } } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -178,9 +178,9 @@ public function delete(): void abort('default', 'Директория ' . $this->path . ' недоступна для записи!'); } - $token = check(Request::input('token')); - $filename = check(Request::input('filename')); - $dirname = check(Request::input('dirname')); + $token = check($request->input('token')); + $filename = check($request->input('filename')); + $dirname = check($request->input('dirname')); $fileName = $this->path ? '/' . $filename : $filename; $dirName = $this->path ? '/' . $dirname : $dirname; diff --git a/app/Controllers/Admin/ForumController.php b/app/Controllers/Admin/ForumController.php index 70d4bcca2..523da0542 100644 --- a/app/Controllers/Admin/ForumController.php +++ b/app/Controllers/Admin/ForumController.php @@ -2,7 +2,6 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\File; use App\Models\Forum; @@ -10,8 +9,8 @@ use App\Models\Topic; use App\Models\User; use App\Models\Vote; -use Illuminate\Database\Capsule\Manager as DB; use Illuminate\Database\Query\JoinClause; +use Illuminate\Http\Request; class ForumController extends AdminController { @@ -39,8 +38,8 @@ public function create(): void abort(403, 'Доступ запрещен!'); } - $token = check(Request::input('token')); - $title = check(Request::input('title')); + $token = check($request->input('token')); + $title = check($request->input('title')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -58,7 +57,7 @@ public function create(): void setFlash('success', 'Новый раздел успешно создан!'); redirect('/admin/forums/edit/' . $forum->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } @@ -71,7 +70,7 @@ public function create(): void * @param int $id * @return string */ - public function edit($id): string + public function edit(int $id): string { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -88,13 +87,13 @@ public function edit($id): string ->orderBy('sort') ->get(); - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $parent = int(Request::input('parent')); - $title = check(Request::input('title')); - $description = check(Request::input('description')); - $sort = check(Request::input('sort')); - $closed = empty(Request::input('closed')) ? 0 : 1; + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $parent = int($request->input('parent')); + $title = check($request->input('title')); + $description = check($request->input('description')); + $sort = check($request->input('sort')); + $closed = empty($request->input('closed')) ? 0 : 1; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -119,7 +118,7 @@ public function edit($id): string setFlash('success', 'Раздел успешно отредактирован!'); redirect('/admin/forum'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -134,7 +133,7 @@ public function edit($id): string * @return void * @throws \Exception */ - public function delete($id): void + public function delete(int $id): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -146,7 +145,7 @@ public function delete($id): void abort(404, 'Данного раздела не существует!'); } - $token = check(Request::input('token')); + $token = check($request->input('token')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -178,7 +177,7 @@ public function restatement(): void abort(403, 'Доступ запрещен!'); } - $token = check(Request::input('token')); + $token = check($request->input('token')); if ($token === $_SESSION['token']) { @@ -198,7 +197,7 @@ public function restatement(): void * @param int $id * @return string */ - public function forum($id): string + public function forum(int $id): string { $forum = Forum::query()->with('parent', 'children.lastTopic.lastPost.user')->find($id); @@ -228,7 +227,7 @@ public function forum($id): string * @param int $id * @return string */ - public function editTopic($id): string + public function editTopic(int $id): string { $topic = Topic::query()->find($id); @@ -236,14 +235,14 @@ public function editTopic($id): string abort(404, 'Данной темы не существует!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $title = check(Request::input('title')); - $note = check(Request::input('note')); - $moderators = check(Request::input('moderators')); - $locked = empty(Request::input('locked')) ? 0 : 1; - $closed = empty(Request::input('closed')) ? 0 : 1; + $token = check($request->input('token')); + $title = check($request->input('title')); + $note = check($request->input('note')); + $moderators = check($request->input('moderators')); + $locked = empty($request->input('locked')) ? 0 : 1; + $closed = empty($request->input('closed')) ? 0 : 1; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -265,7 +264,7 @@ public function editTopic($id): string setFlash('success', 'Тема успешно отредактирована!'); redirect('/admin/forums/' . $topic->forum_id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -279,7 +278,7 @@ public function editTopic($id): string * @param int $id * @return string */ - public function moveTopic($id): string + public function moveTopic(int $id): string { $topic = Topic::query()->find($id); @@ -287,9 +286,9 @@ public function moveTopic($id): string abort(404, 'Данной темы не существует!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $fid = int(Request::input('fid')); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $fid = int($request->input('fid')); $forum = Forum::query()->find($fid); @@ -317,7 +316,7 @@ public function moveTopic($id): string setFlash('success', 'Тема успешно перенесена!'); redirect('/admin/forums/' . $topic->forum_id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -337,11 +336,11 @@ public function moveTopic($id): string * @return void * @param $id */ - public function actionTopic($id): void + public function actionTopic(int $id): void { - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); - $type = check(Request::input('type')); + $page = int($request->input('page', 1)); + $token = check($request->input('token')); + $type = check($request->input('type')); $topic = Topic::query()->find($id); @@ -403,10 +402,10 @@ public function actionTopic($id): void * @return void * @throws \Exception */ - public function deleteTopic($id): void + public function deleteTopic(int $id): void { - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); + $page = int($request->input('page', 1)); + $token = check($request->input('token')); $topic = Topic::query()->find($id); @@ -456,7 +455,7 @@ public function deleteTopic($id): void * @param int $id * @return string */ - public function topic($id): string + public function topic(int $id): string { $topic = Topic::query()->where('id', $id)->with('forum.parent')->first(); @@ -517,9 +516,9 @@ public function topic($id): string * @param int $id * @return string */ - public function editPost($id): string + public function editPost(int $id): string { - $page = int(Request::input('page', 1)); + $page = int($request->input('page', 1)); $post = Post::query()->find($id); @@ -527,11 +526,11 @@ public function editPost($id): string abort(404, 'Данного сообщения не существует!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $msg = check(Request::input('msg')); - $delfile = intar(Request::input('delfile')); + $token = check($request->input('token')); + $msg = check($request->input('msg')); + $delfile = intar($request->input('delfile')); $validator = new Validator(); @@ -567,7 +566,7 @@ public function editPost($id): string setFlash('success', 'Сообщение успешно отредактировано!'); redirect('/admin/topics/' . $post->topic_id . '?page=' . $page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -582,10 +581,10 @@ public function editPost($id): string */ public function deletePosts(): void { - $tid = int(Request::input('tid')); - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); - $del = intar(Request::input('del')); + $tid = int($request->input('tid')); + $page = int($request->input('page', 1)); + $token = check($request->input('token')); + $del = intar($request->input('del')); $topic = Topic::query()->where('id', $tid)->first(); @@ -624,7 +623,7 @@ public function deletePosts(): void * @return void * @param $id */ - public function end($id): void + public function end(int $id): void { $topic = Topic::query()->find($id); diff --git a/app/Controllers/Admin/GuestbookController.php b/app/Controllers/Admin/GuestbookController.php index 9f1bbce65..94f7131ce 100644 --- a/app/Controllers/Admin/GuestbookController.php +++ b/app/Controllers/Admin/GuestbookController.php @@ -2,10 +2,10 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Guestbook; use App\Models\User; +use Illuminate\Http\Request; class GuestbookController extends AdminController { @@ -33,19 +33,19 @@ public function index() * @param int $id * @return string */ - public function edit($id): string + public function edit(int $id): string { - $page = int(Request::input('page')); + $page = int($request->input('page')); $post = Guestbook::with('user')->find($id); if (! $post) { abort(404, 'Сообщения для редактирования не существует!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $msg = check(Request::input('msg')); - $token = check(Request::input('token')); + $msg = check($request->input('msg')); + $token = check($request->input('token')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) @@ -64,7 +64,7 @@ public function edit($id): string setFlash('success', 'Сообщение успешно отредактировано!'); redirect('/admin/guestbooks?page=' . $page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -78,19 +78,19 @@ public function edit($id): string * @param int $id * @return string */ - public function reply($id): string + public function reply(int $id): string { - $page = int(Request::input('page')); + $page = int($request->input('page')); $post = Guestbook::with('user')->find($id); if (! $post) { abort(404, 'Сообщения для ответа не существует!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $reply = check(Request::input('reply')); - $token = check(Request::input('token')); + $reply = check($request->input('reply')); + $token = check($request->input('token')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) @@ -107,7 +107,7 @@ public function reply($id): string setFlash('success', 'Ответ успешно добавлен!'); redirect('/admin/guestbooks?page=' . $page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -122,9 +122,9 @@ public function reply($id): string */ public function delete(): void { - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); - $del = intar(Request::input('del')); + $page = int($request->input('page', 1)); + $token = check($request->input('token')); + $del = intar($request->input('del')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -148,7 +148,7 @@ public function delete(): void */ public function clear(): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); $validator = new Validator(); $validator diff --git a/app/Controllers/Admin/InvitationController.php b/app/Controllers/Admin/InvitationController.php index ffd945219..dd1b0eac5 100644 --- a/app/Controllers/Admin/InvitationController.php +++ b/app/Controllers/Admin/InvitationController.php @@ -2,10 +2,10 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Invite; use App\Models\User; +use Illuminate\Http\Request; class InvitationController extends AdminController { @@ -28,7 +28,7 @@ public function __construct() */ public function index(): string { - $used = Request::input('used') ? 1 : 0; + $used = $request->input('used') ? 1 : 0; $total = Invite::query()->where('used', $used)->count(); $page = paginate(setting('listinvite'), $total); @@ -68,9 +68,9 @@ public function keys(): string */ public function create(): string { - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $keys = int(Request::input('keys')); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $keys = int($request->input('keys')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -93,7 +93,7 @@ public function create(): string setFlash('success', 'Ключи успешно созданы!'); redirect('/admin/invitations'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -111,9 +111,9 @@ public function create(): string */ public function send(): void { - $token = check(Request::input('token')); - $login = check(Request::input('user')); - $userkeys = int(Request::input('userkeys')); + $token = check($request->input('token')); + $login = check($request->input('user')); + $userkeys = int($request->input('userkeys')); /* @var User $user */ $user = getUserByLogin($login); @@ -149,7 +149,7 @@ public function send(): void setFlash('success', 'Ключи успешно отправлены!'); redirect('/admin/invitations'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); redirect('/admin/invitations/create'); } @@ -163,7 +163,7 @@ public function send(): void */ public function mail(): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -195,7 +195,7 @@ public function mail(): void setFlash('success', 'Ключи успешно отправлены! ('. $users->count() .')'); redirect('/admin/invitations'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); redirect('/admin/invitations/create'); } @@ -208,10 +208,10 @@ public function mail(): void */ public function delete(): void { - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); - $del = intar(Request::input('del')); - $used = Request::input('used') ? 1 : 0; + $page = int($request->input('page', 1)); + $token = check($request->input('token')); + $del = intar($request->input('del')); + $used = $request->input('used') ? 1 : 0; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') diff --git a/app/Controllers/Admin/IpBanController.php b/app/Controllers/Admin/IpBanController.php index d2bb307dd..4f61600e5 100644 --- a/app/Controllers/Admin/IpBanController.php +++ b/app/Controllers/Admin/IpBanController.php @@ -2,10 +2,10 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Ban; use App\Models\User; +use Illuminate\Http\Request; class IpBanController extends AdminController { @@ -28,9 +28,9 @@ public function __construct() */ public function index(): string { - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $ip = check(Request::input('ip')); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $ip = check($request->input('ip')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -52,7 +52,7 @@ public function index(): string setFlash('success', 'IP успешно занесен в список!'); redirect('/admin/ipbans'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -77,9 +77,9 @@ public function index(): string */ public function delete(): void { - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); - $del = intar(Request::input('del')); + $page = int($request->input('page', 1)); + $token = check($request->input('token')); + $del = intar($request->input('del')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -105,7 +105,7 @@ public function delete(): void */ public function clear(): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); $validator = new Validator(); $validator diff --git a/app/Controllers/Admin/LoadController.php b/app/Controllers/Admin/LoadController.php index 7d9e974d4..9e184d20d 100644 --- a/app/Controllers/Admin/LoadController.php +++ b/app/Controllers/Admin/LoadController.php @@ -2,13 +2,12 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Down; use App\Models\File; use App\Models\Load; use App\Models\User; -use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Http\Request; class LoadController extends AdminController { @@ -51,8 +50,8 @@ public function create(): void abort(403, 'Доступ запрещен!'); } - $token = check(Request::input('token')); - $name = check(Request::input('name')); + $token = check($request->input('token')); + $name = check($request->input('name')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -70,7 +69,7 @@ public function create(): void setFlash('success', 'Новый раздел успешно создан!'); redirect('/admin/loads/edit/' . $load->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } @@ -83,7 +82,7 @@ public function create(): void * @param int $id * @return string */ - public function edit($id): string + public function edit(int $id): string { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -100,12 +99,12 @@ public function edit($id): string ->orderBy('sort') ->get(); - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $parent = int(Request::input('parent')); - $name = check(Request::input('name')); - $sort = check(Request::input('sort')); - $closed = empty(Request::input('closed')) ? 0 : 1; + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $parent = int($request->input('parent')); + $name = check($request->input('name')); + $sort = check($request->input('sort')); + $closed = empty($request->input('closed')) ? 0 : 1; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -128,7 +127,7 @@ public function edit($id): string setFlash('success', 'Раздел успешно отредактирован!'); redirect('/admin/loads'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -143,7 +142,7 @@ public function edit($id): string * @return void * @throws \Exception */ - public function delete($id): void + public function delete(int $id): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -155,7 +154,7 @@ public function delete($id): void abort(404, 'Данного раздела не существует!'); } - $token = check(Request::input('token')); + $token = check($request->input('token')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -189,7 +188,7 @@ public function restatement(): void abort(403, 'Доступ запрещен!'); } - $token = check(Request::input('token')); + $token = check($request->input('token')); if ($token === $_SESSION['token']) { @@ -209,7 +208,7 @@ public function restatement(): void * @param int $id * @return string */ - public function load($id): string + public function load(int $id): string { $category = Load::query()->with('parent')->find($id); @@ -220,7 +219,7 @@ public function load($id): string $total = Down::query()->where('category_id', $category->id)->where('active', 1)->count(); $page = paginate(setting('downlist'), $total); - $sort = check(Request::input('sort')); + $sort = check($request->input('sort')); switch ($sort) { case 'rated': @@ -253,7 +252,7 @@ public function load($id): string * @param int $id * @return string */ - public function editDown($id): string + public function editDown(int $id): string { $down = Down::query()->find($id); @@ -261,12 +260,12 @@ public function editDown($id): string abort(404, 'Данного файла не существует!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $category = check(Request::input('category')); - $title = check(Request::input('title')); - $text = check(Request::input('text')); - $files = (array) Request::file('files'); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $category = check($request->input('category')); + $title = check($request->input('title')); + $text = check($request->input('text')); + $files = (array) $request->file('files'); $category = Load::query()->find($category); @@ -322,7 +321,7 @@ public function editDown($id): string setFlash('success', 'Загрузка успешно отредактирована!'); redirect('/admin/downs/edit/' . $down->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -343,9 +342,9 @@ public function editDown($id): string * @return void * @throws \Exception */ - public function deleteDown($id): void + public function deleteDown(int $id): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); $down = Down::query()->find($id); if (! $down) { @@ -381,7 +380,7 @@ public function deleteDown($id): void * @return void * @throws \Exception */ - public function deleteFile($id, $fid): void + public function deleteFile(int $id, int $fid): void { $down = Down::query()->find($id); @@ -430,9 +429,9 @@ public function new(): string * @param int $id * @return void */ - public function publish($id): void + public function publish(int $id): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); $down = Down::query()->find($id); if (! $down) { diff --git a/app/Controllers/Admin/LogController.php b/app/Controllers/Admin/LogController.php index 7bce10681..ecec866c4 100644 --- a/app/Controllers/Admin/LogController.php +++ b/app/Controllers/Admin/LogController.php @@ -2,9 +2,9 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Models\Log; use App\Models\User; +use Illuminate\Http\Request; class LogController extends AdminController { @@ -47,7 +47,7 @@ public function index(): string */ public function clear(): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); if ($token === $_SESSION['token']) { diff --git a/app/Controllers/Admin/NewsController.php b/app/Controllers/Admin/NewsController.php index e1f08d2b5..0932161c1 100644 --- a/app/Controllers/Admin/NewsController.php +++ b/app/Controllers/Admin/NewsController.php @@ -2,11 +2,11 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\News; use App\Models\Setting; use App\Models\User; +use Illuminate\Http\Request; class NewsController extends AdminController { @@ -48,22 +48,22 @@ public function index(): string * @param int $id * @return string */ - public function edit($id): string + public function edit(int $id): string { - $page = int(Request::input('page', 1)); + $page = int($request->input('page', 1)); $news = News::query()->find($id); if (! $news) { abort(404, 'Новость не существует, возможно она была удалена!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $title = check(Request::input('title')); - $text = check(Request::input('text')); - $image = Request::file('image'); - $closed = empty(Request::input('closed')) ? 0 : 1; - $top = empty(Request::input('top')) ? 0 : 1; + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $title = check($request->input('title')); + $text = check($request->input('text')); + $image = $request->file('image'); + $closed = empty($request->input('closed')) ? 0 : 1; + $top = empty($request->input('top')) ? 0 : 1; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -96,7 +96,7 @@ public function edit($id): string setFlash('success', 'Новость успешно отредактирована!'); redirect('/admin/news/edit/' . $news->id . '?page=' . $page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -111,13 +111,13 @@ public function edit($id): string */ public function create(): string { - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $title = check(Request::input('title')); - $text = check(Request::input('text')); - $image = Request::file('image'); - $closed = empty(Request::input('closed')) ? 0 : 1; - $top = empty(Request::input('top')) ? 0 : 1; + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $title = check($request->input('title')); + $text = check($request->input('text')); + $image = $request->file('image'); + $closed = empty($request->input('closed')) ? 0 : 1; + $top = empty($request->input('top')) ? 0 : 1; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -156,7 +156,7 @@ public function create(): string setFlash('success', 'Новость успешно добавлена!'); redirect('/admin/news/edit/' . $news->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -175,7 +175,7 @@ public function restatement(): void abort(403, 'Доступ запрещен!'); } - $token = check(Request::input('token')); + $token = check($request->input('token')); if ($token === $_SESSION['token']) { @@ -196,10 +196,10 @@ public function restatement(): void * @return void * @throws \Exception */ - public function delete($id): void + public function delete(int $id): void { - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); + $page = int($request->input('page', 1)); + $token = check($request->input('token')); $news = News::query()->find($id); diff --git a/app/Controllers/Admin/NoticeController.php b/app/Controllers/Admin/NoticeController.php index 6595ccac0..2c8d8a579 100644 --- a/app/Controllers/Admin/NoticeController.php +++ b/app/Controllers/Admin/NoticeController.php @@ -2,10 +2,10 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Notice; use App\Models\User; +use Illuminate\Http\Request; class NoticeController extends AdminController { @@ -43,12 +43,12 @@ public function index(): string */ public function create(): string { - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $type = check(Request::input('type')); - $name = check(Request::input('name')); - $text = check(Request::input('text')); - $protect = empty(Request::input('protect')) ? 0 : 1; + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $type = check($request->input('type')); + $name = check($request->input('name')); + $text = check($request->input('text')); + $protect = empty($request->input('protect')) ? 0 : 1; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -76,7 +76,7 @@ public function create(): string redirect('/admin/notices/edit/' . $notice->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -90,7 +90,7 @@ public function create(): string * @param int $id * @return string */ - public function edit($id): string + public function edit(int $id): string { $notice = Notice::query()->find($id); @@ -98,11 +98,11 @@ public function edit($id): string abort(404, 'Данного шаблона не существует!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $name = check(Request::input('name')); - $text = check(Request::input('text')); - $protect = empty(Request::input('protect')) ? 0 : 1; + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $name = check($request->input('name')); + $text = check($request->input('text')); + $protect = empty($request->input('protect')) ? 0 : 1; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -123,7 +123,7 @@ public function edit($id): string redirect('/admin/notices/edit/' . $notice->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -138,9 +138,9 @@ public function edit($id): string * @return void * @throws \Exception */ - public function delete($id): void + public function delete(int $id): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); $notice = Notice::query()->find($id); diff --git a/app/Controllers/Admin/OfferController.php b/app/Controllers/Admin/OfferController.php index 522ab58b2..cccbe7ff1 100644 --- a/app/Controllers/Admin/OfferController.php +++ b/app/Controllers/Admin/OfferController.php @@ -2,12 +2,12 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Comment; use App\Models\Offer; use App\Models\Polling; use App\Models\User; +use Illuminate\Http\Request; class OfferController extends AdminController { @@ -33,7 +33,7 @@ public function index($type = Offer::OFFER): string { $otherType = $type === Offer::OFFER ? Offer::ISSUE : Offer::OFFER; - $sort = check(Request::input('sort')); + $sort = check($request->input('sort')); $total = Offer::query()->where('type', $type)->count(); $page = paginate(setting('postoffers'), $total); @@ -71,7 +71,7 @@ public function index($type = Offer::OFFER): string * @param int $id * @return string */ - public function view($id): string + public function view(int $id): string { $offer = Offer::query() ->where('offers.id', $id) @@ -90,7 +90,7 @@ public function view($id): string * @param int $id * @return string */ - public function edit($id): string + public function edit(int $id): string { $offer = Offer::query()->where('id', $id)->first(); @@ -98,13 +98,13 @@ public function edit($id): string abort(404, 'Данного предложения или проблемы не существует!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $title = check(Request::input('title')); - $text = check(Request::input('text')); - $type = check(Request::input('type')); - $closed = empty(Request::input('closed')) ? 0 : 1; + $token = check($request->input('token')); + $title = check($request->input('title')); + $text = check($request->input('text')); + $type = check($request->input('type')); + $closed = empty($request->input('closed')) ? 0 : 1; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['Неверный идентификатор сессии, повторите действие!']) @@ -128,7 +128,7 @@ public function edit($id): string setFlash('success', 'Запись успешно изменена!'); redirect('/admin/offers/' . $offer->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -142,7 +142,7 @@ public function edit($id): string * @param int $id * @return string */ - public function reply($id): string + public function reply(int $id): string { $offer = Offer::query()->where('id', $id)->first(); @@ -150,12 +150,12 @@ public function reply($id): string abort(404, 'Данного предложения или проблемы не существует!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $reply = check(Request::input('reply')); - $status = check(Request::input('status')); - $closed = empty(Request::input('closed')) ? 0 : 1; + $token = check($request->input('token')); + $reply = check($request->input('reply')); + $status = check($request->input('status')); + $closed = empty($request->input('closed')) ? 0 : 1; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['Неверный идентификатор сессии, повторите действие!']) @@ -177,7 +177,7 @@ public function reply($id): string setFlash('success', 'Ответ успешно добавлен!'); redirect('/admin/offers/' . $offer->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -198,7 +198,7 @@ public function restatement(): void abort(403, 'Доступ запрещен!'); } - $token = check(Request::input('token')); + $token = check($request->input('token')); if ($token === $_SESSION['token']) { @@ -219,10 +219,10 @@ public function restatement(): void */ public function delete(): void { - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); - $del = intar(Request::input('del')); - $type = Request::input('type') === Offer::OFFER ? Offer::OFFER : Offer::ISSUE; + $page = int($request->input('page', 1)); + $token = check($request->input('token')); + $del = intar($request->input('del')); + $type = $request->input('type') === Offer::OFFER ? Offer::OFFER : Offer::ISSUE; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') diff --git a/app/Controllers/Admin/PhotoController.php b/app/Controllers/Admin/PhotoController.php index 70750a12c..8eea51f59 100644 --- a/app/Controllers/Admin/PhotoController.php +++ b/app/Controllers/Admin/PhotoController.php @@ -2,10 +2,10 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Photo; use App\Models\User; +use Illuminate\Http\Request; class PhotoController extends AdminController { @@ -46,20 +46,20 @@ public function index(): string * @param int $id * @return string */ - public function edit($id): string + public function edit(int $id): string { - $page = int(Request::input('page', 1)); + $page = int($request->input('page', 1)); $photo = Photo::query()->find($id); if (! $photo) { abort(404, 'Данной фотографии не существует!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $title = check(Request::input('title')); - $text = check(Request::input('text')); - $closed = empty(Request::input('closed')) ? 0 : 1; + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $title = check($request->input('title')); + $text = check($request->input('text')); + $closed = empty($request->input('closed')) ? 0 : 1; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -79,7 +79,7 @@ public function edit($id): string setFlash('success', 'Фотография успешно отредактирована!'); redirect('/admin/photos?page=' . $page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -94,14 +94,14 @@ public function edit($id): string * @return void * @throws \Exception */ - public function delete($id): void + public function delete(int $id): void { if (! is_writable(UPLOADS . '/photos')){ abort('default', 'Директория c фотографиями недоступна для записи!'); } - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); + $page = int($request->input('page', 1)); + $token = check($request->input('token')); $photo = Photo::query()->find($id); @@ -132,7 +132,7 @@ public function delete($id): void */ public function restatement(): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); if (isAdmin(User::BOSS)) { if ($token === $_SESSION['token']) { diff --git a/app/Controllers/Admin/ReglistController.php b/app/Controllers/Admin/ReglistController.php index ee80a8430..9399d9b27 100644 --- a/app/Controllers/Admin/ReglistController.php +++ b/app/Controllers/Admin/ReglistController.php @@ -2,9 +2,9 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\User; +use Illuminate\Http\Request; class ReglistController extends AdminController { @@ -24,11 +24,11 @@ public function __construct() */ public function index(): string { - if (Request::isMethod('post')) { - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); - $choice = intar(Request::input('choice')); - $action = check(Request::input('action')); + if ($request->isMethod('post')) { + $page = int($request->input('page', 1)); + $token = check($request->input('token')); + $choice = intar($request->input('choice')); + $action = check($request->input('action')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -61,7 +61,7 @@ public function index(): string redirect('/admin/reglists?page=' . $page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } diff --git a/app/Controllers/Admin/RekUserController.php b/app/Controllers/Admin/RekUserController.php index 2aa45735b..5b9187dd7 100644 --- a/app/Controllers/Admin/RekUserController.php +++ b/app/Controllers/Admin/RekUserController.php @@ -2,10 +2,10 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\RekUser; use App\Models\User; +use Illuminate\Http\Request; class RekUserController extends AdminController { @@ -46,21 +46,21 @@ public function index(): string * @param int $id * @return string */ - public function edit($id): string + public function edit(int $id): string { - $page = int(Request::input('page', 1)); + $page = int($request->input('page', 1)); $link = RekUser::query()->find($id); if (! $link) { abort(404, 'Данной ссылки не существует!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $site = check(Request::input('site')); - $name = check(Request::input('name')); - $color = check(Request::input('color')); - $bold = empty(Request::input('bold')) ? 0 : 1; + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $site = check($request->input('site')); + $name = check($request->input('name')); + $color = check($request->input('color')); + $bold = empty($request->input('bold')) ? 0 : 1; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -83,7 +83,7 @@ public function edit($id): string setFlash('success', 'Рекламная ссылка успешно изменена!'); redirect('/admin/reklama?page=' . $page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -97,9 +97,9 @@ public function edit($id): string */ public function delete(): void { - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); - $del = intar(Request::input('del')); + $page = int($request->input('page', 1)); + $token = check($request->input('token')); + $del = intar($request->input('del')); $validator = new Validator(); diff --git a/app/Controllers/Admin/RuleController.php b/app/Controllers/Admin/RuleController.php index 3950066a3..3d8b7b4cc 100644 --- a/app/Controllers/Admin/RuleController.php +++ b/app/Controllers/Admin/RuleController.php @@ -2,10 +2,10 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Rule; use App\Models\User; +use Illuminate\Http\Request; class RuleController extends AdminController { @@ -50,9 +50,9 @@ public function edit(): string { $rules = Rule::query()->firstOrNew([]); - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $msg = check(Request::input('msg')); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $msg = check($request->input('msg')); $validator = new Validator(); $validator @@ -70,7 +70,7 @@ public function edit(): string redirect('/admin/rules'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } diff --git a/app/Controllers/Admin/SettingController.php b/app/Controllers/Admin/SettingController.php index f9ee80132..44aa9d907 100644 --- a/app/Controllers/Admin/SettingController.php +++ b/app/Controllers/Admin/SettingController.php @@ -2,10 +2,10 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Setting; use App\Models\User; +use Illuminate\Http\Request; class SettingController extends AdminController { @@ -28,18 +28,18 @@ public function __construct() */ public function index(): string { - $act = check(Request::input('act', 'main')); + $act = check($request->input('act', 'main')); if (! \in_array($act, Setting::getActions(), true)) { abort(404, 'Недопустимая страница!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $sets = check(Request::input('sets')); - $mods = check(Request::input('mods')); - $opt = check(Request::input('opt')); - $token = check(Request::input('token')); + $sets = check($request->input('sets')); + $mods = check($request->input('mods')); + $opt = check($request->input('opt')); + $token = check($request->input('token')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) @@ -66,7 +66,7 @@ public function index(): string setFlash('success', 'Настройки сайта успешно изменены!'); redirect('/admin/settings?act=' . $act); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } diff --git a/app/Controllers/Admin/SmileController.php b/app/Controllers/Admin/SmileController.php index ada08e3d1..e22be0711 100644 --- a/app/Controllers/Admin/SmileController.php +++ b/app/Controllers/Admin/SmileController.php @@ -2,12 +2,12 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Smile; use App\Models\User; use Illuminate\Database\Capsule\Manager as DB; use Intervention\Image\ImageManagerStatic as Image; +use Illuminate\Http\Request; class SmileController extends AdminController { @@ -54,10 +54,10 @@ public function create(): string abort('default', 'Директория со смайлами недоступна для записи!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $code = check(utfLower(Request::input('code'))); - $smile = Request::file('smile'); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $code = check(utfLower($request->input('code'))); + $smile = $request->file('smile'); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -91,7 +91,7 @@ public function create(): string setFlash('success', 'Смайл успешно загружен!'); redirect('/admin/smiles'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -105,9 +105,9 @@ public function create(): string * @param int $id * @return string */ - public function edit($id): string + public function edit(int $id): string { - $page = int(Request::input('page', 1)); + $page = int($request->input('page', 1)); $smile = Smile::query()->find($id); @@ -115,10 +115,10 @@ public function edit($id): string abort(404, 'Данного смайла не существует!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $code = check(utfLower(Request::input('code'))); + $token = check($request->input('token')); + $code = check(utfLower($request->input('code'))); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -139,7 +139,7 @@ public function edit($id): string setFlash('success', 'Смайл успешно отредактирован!'); redirect('/admin/smiles?page=' . $page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -158,9 +158,9 @@ public function delete(): void abort('default', 'Директория со смайлами недоступна для записи!'); } - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); - $del = intar(Request::input('del')); + $page = int($request->input('page', 1)); + $token = check($request->input('token')); + $del = intar($request->input('del')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') diff --git a/app/Controllers/Admin/SpamController.php b/app/Controllers/Admin/SpamController.php index f0884ad6d..56a21fc4c 100644 --- a/app/Controllers/Admin/SpamController.php +++ b/app/Controllers/Admin/SpamController.php @@ -2,7 +2,6 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Comment; use App\Models\Guestbook; @@ -11,6 +10,7 @@ use App\Models\Spam; use App\Models\User; use App\Models\Wall; +use Illuminate\Http\Request; class SpamController extends AdminController { @@ -58,7 +58,7 @@ public function __construct() */ public function index(): string { - $type = check(Request::input('type')); + $type = check($request->input('type')); $type = isset($this->types[$type]) ? $type : 'post'; $page = paginate(setting('spamlist'), $this->total[$type]); @@ -88,12 +88,12 @@ public function index(): string */ public function delete(): void { - $id = int(Request::input('id')); - $token = check(Request::input('token')); + $id = int($request->input('id')); + $token = check($request->input('token')); $validator = new Validator(); $validator - ->true(Request::ajax(), 'Это не ajax запрос!') + ->true($request->ajax(), 'Это не ajax запрос!') ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($id, 'Не выбрана запись для удаление!'); diff --git a/app/Controllers/Admin/StatusController.php b/app/Controllers/Admin/StatusController.php index 87baf06f1..b267f3f34 100644 --- a/app/Controllers/Admin/StatusController.php +++ b/app/Controllers/Admin/StatusController.php @@ -2,10 +2,10 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Status; use App\Models\User; +use Illuminate\Http\Request; class StatusController extends AdminController { @@ -40,12 +40,12 @@ public function index(): string */ public function create(): string { - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $topoint = int(Request::input('topoint')); - $point = int(Request::input('point')); - $name = check(Request::input('name')); - $color = check(Request::input('color')); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $topoint = int($request->input('topoint')); + $point = int($request->input('point')); + $name = check($request->input('name')); + $color = check($request->input('color')); $validator = new Validator(); $validator @@ -65,7 +65,7 @@ public function create(): string setFlash('success', 'Статус успешно добавлен!'); redirect('/admin/status'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -80,7 +80,7 @@ public function create(): string */ public function edit(): string { - $id = int(Request::input('id')); + $id = int($request->input('id')); $status = Status::query()->find($id); @@ -88,12 +88,12 @@ public function edit(): string abort(404, 'Выбранный вами статус не найден!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $topoint = int(Request::input('topoint')); - $point = int(Request::input('point')); - $name = check(Request::input('name')); - $color = check(Request::input('color')); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $topoint = int($request->input('topoint')); + $point = int($request->input('point')); + $name = check($request->input('name')); + $color = check($request->input('color')); $validator = new Validator(); $validator @@ -113,7 +113,7 @@ public function edit(): string setFlash('success', 'Статус успешно изменен!'); redirect('/admin/status'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -129,8 +129,8 @@ public function edit(): string */ public function delete(): void { - $token = check(Request::input('token')); - $id = int(Request::input('id')); + $token = check($request->input('token')); + $id = int($request->input('id')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); diff --git a/app/Controllers/Admin/TransferController.php b/app/Controllers/Admin/TransferController.php index 635b2cd1a..51ea4fb95 100644 --- a/app/Controllers/Admin/TransferController.php +++ b/app/Controllers/Admin/TransferController.php @@ -2,8 +2,8 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Models\Transfer; +use Illuminate\Http\Request; class TransferController extends AdminController { @@ -34,7 +34,7 @@ public function index(): string */ public function view(): string { - $login = check(Request::input('user')); + $login = check($request->input('user')); if (! $user = getUserByLogin($login)) { abort(404, 'Пользователь с данным логином не найден!'); diff --git a/app/Controllers/Admin/UserController.php b/app/Controllers/Admin/UserController.php index b7d09dc20..10e4c1929 100644 --- a/app/Controllers/Admin/UserController.php +++ b/app/Controllers/Admin/UserController.php @@ -2,7 +2,6 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Banhist; use App\Models\BlackList; @@ -11,6 +10,7 @@ use App\Models\Post; use App\Models\Topic; use App\Models\User; +use Illuminate\Http\Request; class UserController extends AdminController { @@ -52,7 +52,7 @@ public function index(): string */ public function search(): string { - $q = check(Request::input('q')); + $q = check($request->input('q')); $search = $q == 1 ? "RLIKE '^[-0-9]'" : "LIKE '$q%'"; @@ -76,7 +76,7 @@ public function search(): string */ public function edit(): string { - $login = check(Request::input('user')); + $login = check($request->input('user')); $user = User::query()->where('login', $login)->first(); @@ -92,28 +92,28 @@ public function edit(): string $allGroups[$level] = User::getLevelByKey($level); } - if (Request::isMethod('post')) { - - $token = check(Request::input('token')); - $level = check(Request::input('level')); - $password = check(Request::input('password')); - $email = check(Request::input('email')); - $name = check(Request::input('name')); - $country = check(Request::input('country')); - $city = check(Request::input('city')); - $site = check(Request::input('site')); - $birthday = check(Request::input('birthday')); - $icq = check(str_replace('-', '', Request::input('icq'))); - $skype = check(strtolower(Request::input('skype'))); - $point = int(Request::input('point')); - $money = int(Request::input('money')); - $status = check(Request::input('status')); - $posrating = int(Request::input('posrating')); - $negrating = int(Request::input('negrating')); - $themes = check(Request::input('themes')); - $gender = Request::input('gender') === 'male' ? 'male' : 'female'; - $info = check(Request::input('info')); - $created = check(Request::input('created')); + if ($request->isMethod('post')) { + + $token = check($request->input('token')); + $level = check($request->input('level')); + $password = check($request->input('password')); + $email = check($request->input('email')); + $name = check($request->input('name')); + $country = check($request->input('country')); + $city = check($request->input('city')); + $site = check($request->input('site')); + $birthday = check($request->input('birthday')); + $icq = check(str_replace('-', '', $request->input('icq'))); + $skype = check(strtolower($request->input('skype'))); + $point = int($request->input('point')); + $money = int($request->input('money')); + $status = check($request->input('status')); + $posrating = int($request->input('posrating')); + $negrating = int($request->input('negrating')); + $themes = check($request->input('themes')); + $gender = $request->input('gender') === 'male' ? 'male' : 'female'; + $info = check($request->input('info')); + $created = check($request->input('created')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -173,7 +173,7 @@ public function edit(): string redirect('/admin/users/edit?user=' . $user->login); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -195,7 +195,7 @@ public function edit(): string */ public function delete(): string { - $login = check(Request::input('user')); + $login = check($request->input('user')); $user = User::query()->where('login', $login)->first(); @@ -203,15 +203,15 @@ public function delete(): string abort(404, 'Пользователь не найден!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $loginblack = empty(Request::input('loginblack')) ? 0 : 1; - $mailblack = empty(Request::input('mailblack')) ? 0 : 1; - $deltopics = empty(Request::input('deltopics')) ? 0 : 1; - $delposts = empty(Request::input('delposts')) ? 0 : 1; - $delcomments = empty(Request::input('delcomments')) ? 0 : 1; - $delimages = empty(Request::input('delimages')) ? 0 : 1; + $token = check($request->input('token')); + $loginblack = empty($request->input('loginblack')) ? 0 : 1; + $mailblack = empty($request->input('mailblack')) ? 0 : 1; + $deltopics = empty($request->input('deltopics')) ? 0 : 1; + $delposts = empty($request->input('delposts')) ? 0 : 1; + $delcomments = empty($request->input('delcomments')) ? 0 : 1; + $delimages = empty($request->input('delimages')) ? 0 : 1; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -317,7 +317,7 @@ public function delete(): string setFlash('success', 'Пользователь успешно удален!'); redirect('/admin/users'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } diff --git a/app/Controllers/Admin/VoteController.php b/app/Controllers/Admin/VoteController.php index 2602499ce..0fa48358f 100644 --- a/app/Controllers/Admin/VoteController.php +++ b/app/Controllers/Admin/VoteController.php @@ -2,11 +2,11 @@ namespace App\Controllers\Admin; -use App\Classes\Request; use App\Classes\Validator; use App\Models\User; use App\Models\Vote; use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Http\Request; class VoteController extends AdminController { @@ -67,7 +67,7 @@ public function history(): string * @param int $id * @return string */ - public function edit($id): string + public function edit(int $id): string { $vote = Vote::query()->where('id', $id)->first(); @@ -75,11 +75,11 @@ public function edit($id): string abort(404, 'Данного голосования не существует!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $title = check(Request::input('title')); - $answers = check(Request::input('answers')); + $token = check($request->input('token')); + $title = check($request->input('title')); + $answers = check($request->input('answers')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); @@ -112,7 +112,7 @@ public function edit($id): string setFlash('success', 'Голосование успешно изменено!'); redirect('/admin/votes/edit/'.$vote->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -128,9 +128,9 @@ public function edit($id): string * @param int $id * @return void */ - public function delete($id): void + public function delete(int $id): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); $vote = Vote::query()->where('id', $id)->first(); if (! $vote) { @@ -163,9 +163,9 @@ public function delete($id): void * @param int $id * @return void */ - public function close($id): void + public function close(int $id): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); $vote = Vote::query()->where('id', $id)->first(); if (! $vote) { @@ -209,7 +209,7 @@ public function restatement(): void abort(403, 'Доступ запрещен!'); } - $token = check(Request::input('token')); + $token = check($request->input('token')); if ($token === $_SESSION['token']) { diff --git a/app/Controllers/AjaxController.php b/app/Controllers/AjaxController.php index 3e43408ef..c6e663d2e 100644 --- a/app/Controllers/AjaxController.php +++ b/app/Controllers/AjaxController.php @@ -51,10 +51,11 @@ public function bbCode(Request $request): string /** * Отправляет жалобу на сообщение * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function complaint(Request $request): string + public function complaint(Request $request, Validator $validator): string { $path = null; $data = false; @@ -131,7 +132,6 @@ public function complaint(Request $request): string $spam = Spam::query()->where(['relate_type' => $type, 'relate_id' => $id])->first(); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true($data, 'Выбранное вами сообщение для жалобы не существует!') @@ -158,10 +158,11 @@ public function complaint(Request $request): string /** * Удаляет комментарии * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function delComment(Request $request): string + public function delComment(Request $request, Validator $validator): string { if (! isAdmin()) { return json_encode(['status' => 'error', 'message' => 'Not authorized']); @@ -172,7 +173,6 @@ public function delComment(Request $request): string $rid = int($request->input('rid')); $id = int($request->input('id')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); if ($validator->isValid()) { @@ -279,10 +279,11 @@ public function rating(Request $request): string /** * Загружает изображение * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function uploadImage(Request $request): string + public function uploadImage(Request $request, Validator $validator): string { $types = [ Blog::class, @@ -318,7 +319,6 @@ public function uploadImage(Request $request): string ->where('user_id', getUser('id')) ->count(); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->lt($countFiles, setting('maxfiles'), 'Разрешено загружать не более ' . setting('maxfiles') . ' файлов!'); @@ -353,11 +353,12 @@ public function uploadImage(Request $request): string /** * Удаляет изображение * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string * @throws \Exception */ - public function deleteImage(Request $request): string + public function deleteImage(Request $request, Validator $validator): string { $types = [ Blog::class, @@ -385,7 +386,6 @@ public function deleteImage(Request $request): string ]); } - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true($file->user_id === getUser('id') || isAdmin(), 'Удаление невозможно, вы не автор данного файла!'); diff --git a/app/Controllers/BlogController.php b/app/Controllers/BlogController.php index 3895f512b..46c2e4bbb 100644 --- a/app/Controllers/BlogController.php +++ b/app/Controllers/BlogController.php @@ -132,11 +132,12 @@ public function view(int $id): string /** * Редактирование статьи * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { if (! getUser()) { abort(403, 'Для редактирования статьи необходимо авторизоваться'); @@ -164,7 +165,6 @@ public function edit(int $id, Request $request): string /** @var Category $category */ $category = Category::query()->find($cid); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($title, 5, 50, ['title' => 'Слишком длинный или короткий заголовок!']) @@ -238,10 +238,11 @@ public function authors(): string /** * Создание статьи * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function create(Request $request): string + public function create(Request $request, Validator $validator): string { $cid = int($request->input('cid')); @@ -269,7 +270,6 @@ public function create(Request $request): string /** @var Category $category */ $category = Category::query()->find($cid); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($title, 5, 50, ['title' => 'Слишком длинный или короткий заголовок!']) @@ -329,11 +329,12 @@ public function create(Request $request): string /** * Комментарии * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function comments(int $id, Request $request): string + public function comments(int $id, Request $request, Validator $validator): string { /** @var Blog $blog */ $blog = Blog::query()->find($id); @@ -347,7 +348,6 @@ public function comments(int $id, Request $request): string $token = check($request->input('token')); $msg = check($request->input('msg')); - $validator = new Validator(); $validator ->true(getUser(), 'Для добавления комментария необходимо авторизоваться!') ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -408,12 +408,13 @@ public function comments(int $id, Request $request): string /** * Подготовка к редактированию комментария * - * @param int $id - * @param int $cid - * @param Request $request + * @param int $id + * @param int $cid + * @param Request $request + * @param Validator $validator * @return string */ - public function editComment(int $id, int $cid, Request $request): string + public function editComment(int $id, int $cid, Request $request, Validator $validator): string { $page = int($request->input('page', 1)); @@ -447,7 +448,6 @@ public function editComment(int $id, int $cid, Request $request): string $msg = check($request->input('msg')); $page = int($request->input('page', 1)); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($msg, 5, 1000, ['msg' => 'Слишком длинный или короткий комментарий!']); diff --git a/app/Controllers/BoardController.php b/app/Controllers/BoardController.php index b8e447b39..1df8ed4bd 100644 --- a/app/Controllers/BoardController.php +++ b/app/Controllers/BoardController.php @@ -86,10 +86,11 @@ public function view(int $id): string /** * Создание объявления * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function create(Request $request): string + public function create(Request $request, Validator $validator): string { $bid = int($request->input('bid')); @@ -118,7 +119,6 @@ public function create(Request $request): string /** @var Board $board */ $board = Board::query()->find($bid); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], trans('validator.token')) ->length($title, 5, 50, ['title' => trans('validator.name')]) @@ -174,11 +174,12 @@ public function create(Request $request): string /** * Редактирование объявления * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { if (! getUser()) { abort(403, 'Для редактирования объявления необходимо авторизоваться'); @@ -202,7 +203,6 @@ public function edit(int $id, Request $request): string /** @var Board $board */ $board = Board::query()->find($bid); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], trans('validator.token')) ->length($title, 5, 50, ['title' => trans('validator.name')]) @@ -251,10 +251,11 @@ public function edit(int $id, Request $request): string /** * Снятие / Публикация объявления * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator */ - public function close(int $id, Request $request): void + public function close(int $id, Request $request, Validator $validator): void { $token = check($request->input('token')); @@ -269,7 +270,6 @@ public function close(int $id, Request $request): void abort(404, 'Данного объявления не существует!'); } - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->equal($item->user_id, getUser('id'), 'Изменение невозможно, вы не автор данного объявления!'); @@ -305,11 +305,12 @@ public function close(int $id, Request $request): void /** * Удаление объявления * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @throws Exception */ - public function delete(int $id, Request $request): void + public function delete(int $id, Request $request, Validator $validator): void { $token = check($request->input('token')); @@ -324,7 +325,6 @@ public function delete(int $id, Request $request): void abort(404, 'Данного объявления не существует!'); } - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->equal($item->user_id, getUser('id'), 'Удаление невозможно, вы не автор данного объявления!'); diff --git a/app/Controllers/BookmarkController.php b/app/Controllers/BookmarkController.php index 069284131..a4769dac0 100644 --- a/app/Controllers/BookmarkController.php +++ b/app/Controllers/BookmarkController.php @@ -2,10 +2,10 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Bookmark; use App\Models\Topic; +use Illuminate\Http\Request; class BookmarkController extends BaseController { @@ -47,21 +47,23 @@ public function index(): string /** * Добавление / удаление закладок * + * @param Request $request + * @param Validator $validator * @return string * @throws \Exception */ - public function perform(): string + public function perform(Request $request, Validator $validator): string { - if (! Request::ajax()) { + if (! $request->ajax()) { redirect('/'); } - $token = check(Request::input('token')); - $tid = int(Request::input('tid')); + $token = check($request->input('token')); + $tid = int($request->input('tid')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); + /** @var Topic $topic */ $topic = Topic::query()->find($tid); $validator->true($topic, 'Данной темы не существует!'); @@ -91,15 +93,16 @@ public function perform(): string /** * Удаление закладок * + * @param Request $request + * @param Validator $validator * @return void */ - public function delete(): void + public function delete(Request $request, Validator $validator): void { - $token = check(Request::input('token')); - $topicIds = intar(Request::input('del')); - $page = int(Request::input('page')); + $token = check($request->input('token')); + $topicIds = intar($request->input('del')); + $page = int($request->input('page')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($topicIds, 'Ошибка! Отсутствуют выбранные закладки!'); diff --git a/app/Controllers/ContactController.php b/app/Controllers/ContactController.php index 36f0c4685..e966414db 100644 --- a/app/Controllers/ContactController.php +++ b/app/Controllers/ContactController.php @@ -2,10 +2,10 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Contact; use App\Models\User; +use Illuminate\Http\Request; class ContactController extends BaseController { @@ -24,16 +24,17 @@ public function __construct() /** * Главная страница * + * @param Request $request + * @param Validator $validator * @return string */ - public function index(): string + public function index(Request $request, Validator $validator): string { - if (Request::isMethod('post')) { - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); - $login = check(Request::input('user')); + if ($request->isMethod('post')) { + $page = int($request->input('page', 1)); + $token = check($request->input('token')); + $login = check($request->input('user')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); $user = User::query()->where('login', $login)->first(); @@ -65,7 +66,7 @@ public function index(): string redirect('/contacts?page='.$page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -87,10 +88,12 @@ public function index(): string /** * Заметка для пользователя * - * @param int $id + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function note($id): string + public function note(int $id, Request $request, Validator $validator): string { $contact = Contact::query() ->where('user_id', getUser('id')) @@ -101,12 +104,11 @@ public function note($id): string abort(404, 'Запись не найдена'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $msg = check(Request::input('msg')); + $token = check($request->input('token')); + $msg = check($request->input('msg')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) ->length($msg, 0, 1000, ['msg' => 'Слишком большая заметка, не более 1000 символов!']); @@ -119,7 +121,7 @@ public function note($id): string setFlash('success', 'Заметка успешно отредактирована!'); redirect('/contacts'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -130,15 +132,16 @@ public function note($id): string /** * Удаление контактов * + * @param Request $request + * @param Validator $validator * @return void */ - public function delete(): void + public function delete(Request $request, Validator $validator): void { - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); - $del = intar(Request::input('del')); + $page = int($request->input('page', 1)); + $token = check($request->input('token')); + $del = intar($request->input('del')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true($del, 'Отсутствуют выбранные пользователи для удаления!'); diff --git a/app/Controllers/CounterController.php b/app/Controllers/CounterController.php index 5aa7bd10d..2083b18d2 100644 --- a/app/Controllers/CounterController.php +++ b/app/Controllers/CounterController.php @@ -2,7 +2,6 @@ namespace App\Controllers; -use App\Classes\Metrika; use App\Models\Counter24; use App\Models\Counter31; diff --git a/app/Controllers/Forum/ActiveController.php b/app/Controllers/Forum/ActiveController.php index 6df1ef023..b32dd6b26 100644 --- a/app/Controllers/Forum/ActiveController.php +++ b/app/Controllers/Forum/ActiveController.php @@ -2,12 +2,12 @@ namespace App\Controllers\Forum; -use App\Classes\Request; use App\Classes\Validator; use App\Controllers\BaseController; use App\Models\Post; use App\Models\Topic; use App\Models\User; +use Illuminate\Http\Request; class ActiveController extends BaseController { @@ -20,7 +20,8 @@ public function __construct() { parent::__construct(); - $login = check(Request::input('user', getUser('login'))); + $request = Request::createFromGlobals(); + $login = check($request->input('user', getUser('login'))); $this->user = User::query()->where('login', $login)->first(); @@ -86,12 +87,13 @@ public function posts(): string /** * Удаление сообщений * + * @param Request $request * @return string * @throws \Exception */ - public function delete(): string + public function delete(Request $request): string { - if (! Request::ajax()) { + if (! $request->ajax()) { redirect('/'); } @@ -99,8 +101,8 @@ public function delete(): string abort(403, 'Удалять сообщения могут только модераторы!'); } - $token = check(Request::input('token')); - $tid = int(Request::input('tid')); + $token = check($request->input('token')); + $tid = int($request->input('tid')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); diff --git a/app/Controllers/Forum/ForumController.php b/app/Controllers/Forum/ForumController.php index 0ef79f3bf..39d23d1be 100644 --- a/app/Controllers/Forum/ForumController.php +++ b/app/Controllers/Forum/ForumController.php @@ -2,7 +2,6 @@ namespace App\Controllers\Forum; -use App\Classes\Request; use App\Classes\Validator; use App\Controllers\BaseController; use App\Models\Flood; @@ -12,6 +11,8 @@ use App\Models\Vote; use App\Models\VoteAnswer; use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Database\Query\Builder; +use Illuminate\Http\Request; class ForumController extends BaseController { @@ -42,8 +43,9 @@ public function index(): string * @param int $id * @return string */ - public function forum($id): string + public function forum(int $id): string { + /** @var Forum $forum */ $forum = Forum::query()->with('parent', 'children.lastTopic.lastPost.user')->find($id); if (! $forum) { @@ -69,11 +71,12 @@ public function forum($id): string /** * Создание новой темы * + * @param Request $request * @return string */ - public function create(): string + public function create(Request $request): string { - $fid = int(Request::input('fid')); + $fid = int($request->input('fid')); $forums = Forum::query() ->where('parent_id', 0) @@ -89,15 +92,16 @@ public function create(): string abort(403); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $title = check(Request::input('title')); - $msg = check(Request::input('msg')); - $token = check(Request::input('token')); - $vote = empty(Request::input('vote')) ? 0 : 1; - $question = check(Request::input('question')); - $answers = check(Request::input('answer')); + $title = check($request->input('title')); + $msg = check($request->input('msg')); + $token = check($request->input('token')); + $vote = empty($request->input('vote')) ? 0 : 1; + $question = check($request->input('question')); + $answers = check($request->input('answer')); + /** @var Forum $forum */ $forum = Forum::query()->find($fid); $validator = new Validator(); @@ -138,6 +142,7 @@ public function create(): string 'money' => DB::raw('money + 5'), ]); + /** @var Topic $topic */ $topic = Topic::query()->create([ 'forum_id' => $forum->id, 'title' => $title, @@ -147,6 +152,7 @@ public function create(): string 'updated_at' => SITETIME, ]); + /** @var Post $post */ $post = Post::query()->create([ 'topic_id' => $topic->id, 'user_id' => getUser('id'), @@ -173,6 +179,7 @@ public function create(): string // Создание голосования if ($vote) { + /** @var Vote $vote */ $vote = Vote::query()->create([ 'title' => $question, 'topic_id' => $topic->id, @@ -193,7 +200,7 @@ public function create(): string setFlash('success', 'Новая тема успешно создана!'); redirect('/topics/'.$topic->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -204,16 +211,17 @@ public function create(): string /** * Поиск * + * @param Request $request * @return string */ - public function search(): ?string + public function search(Request $request): ?string { - $fid = check(Request::input('fid')); - $find = check(Request::input('find')); - $type = int(Request::input('type')); - $where = int(Request::input('where')); - $period = int(Request::input('period')); - $section = int(Request::input('section')); + $fid = check($request->input('fid')); + $find = check($request->input('find')); + $type = int($request->input('type')); + $where = int($request->input('where')); + $period = int($request->input('period')); + $section = int($request->input('section')); if (! $find) { $forums = Forum::query() @@ -236,7 +244,8 @@ public function search(): ?string $find = winToUtf($find); } - if (utfStrlen($find) >= 3 && utfStrlen($find) <= 50) { + $strlen = utfStrlen($find); + if ($strlen >= 3 && $strlen <= 50) { $findmewords = explode(' ', utfLower($find)); @@ -292,7 +301,7 @@ public function search(): ?string return view('forums/search_topics', compact('topics', 'page', 'find', 'type', 'where', 'section', 'period')); } - setInput(Request::all()); + setInput($request->all()); setFlash('danger', 'По вашему запросу ничего не найдено!'); redirect('/forums/search'); } @@ -333,13 +342,13 @@ public function search(): ?string return view('forums/search_posts', compact('posts', 'page', 'find', 'type', 'where', 'section', 'period')); } - setInput(Request::all()); + setInput($request->all()); setFlash('danger', 'По вашему запросу ничего не найдено!'); redirect('/forums/search'); } } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', ['find' => 'Запрос должен содержать от 3 до 50 символов!']); redirect('/forums/search'); } @@ -372,8 +381,9 @@ public function rss(): string * @param int $id * @return string */ - public function rssPosts($id): string + public function rssPosts(int $id): string { + /** @var Topic $topic */ $topic = Topic::query()->find($id); if (empty($topic)) { @@ -419,14 +429,15 @@ public function topTopics(): string /** * Последние сообщения * + * @param Request $request * @return string */ - public function topPosts(): string + public function topPosts(Request $request): string { - $period = int(Request::input('period')); + $period = int($request->input('period')); $total = Post::query() - ->when($period, function ($query) use ($period) { + ->when($period, function (Builder $query) use ($period) { return $query->where('created_at', '>', strtotime('-' . $period . ' day', SITETIME)); }) ->count(); @@ -438,7 +449,7 @@ public function topPosts(): string $page = paginate(setting('forumpost'), $total); $posts = Post::query() - ->when($period, function ($query) use ($period) { + ->when($period, function (Builder $query) use ($period) { return $query->where('created_at', '>', strtotime('-' . $period . ' day', SITETIME)); }) ->orderBy('rating', 'desc') diff --git a/app/Controllers/Forum/TopicController.php b/app/Controllers/Forum/TopicController.php index a448d1e97..c6c6b4c77 100644 --- a/app/Controllers/Forum/TopicController.php +++ b/app/Controllers/Forum/TopicController.php @@ -11,10 +11,11 @@ use App\Models\User; use App\Models\Vote; use App\Models\Flood; -use App\Classes\Request; use App\Classes\Validator; +use App\Models\VoteAnswer; use Illuminate\Database\Capsule\Manager as DB; use Illuminate\Database\Query\JoinClause; +use Illuminate\Http\Request; class TopicController extends BaseController { @@ -24,7 +25,7 @@ class TopicController extends BaseController * @param int $id * @return string */ - public function index($id): string + public function index(int $id): string { $topic = Topic::query() ->select('topics.*', 'bookmarks.count_posts as bookmark_posts') @@ -57,13 +58,11 @@ public function index($id): string ->orderBy('created_at') ->get(); - if (getUser()) { - if ($topic->count_posts > $topic->bookmark_posts) { - Bookmark::query() - ->where('topic_id', $topic->id) - ->where('user_id', getUser('id')) - ->update(['count_posts' => $topic->count_posts]); - } + if ($topic->count_posts > $topic->bookmark_posts && getUser()) { + Bookmark::query() + ->where('topic_id', $topic->id) + ->where('user_id', getUser('id')) + ->update(['count_posts' => $topic->count_posts]); } // Кураторы @@ -100,14 +99,15 @@ public function index($id): string /** * Создание сообщения * - * @param int $id + * @param int $id + * @param Request $request * @return void */ - public function create($id): void + public function create(int $id, Request $request): void { - $msg = check(Request::input('msg')); - $token = check(Request::input('token')); - $files = (array) Request::file('files'); + $msg = check($request->input('msg')); + $token = check($request->input('token')); + $files = (array) $request->file('files'); if (! $user = getUser()) { abort(403, 'Авторизуйтесь для добавления сообщения!'); @@ -130,8 +130,9 @@ public function create($id): void ->length($msg, 5, setting('forumtextlength'), ['msg' => 'Слишком длинное или короткое сообщение!']); // Проверка сообщения на схожесть + /** @var Post $post */ $post = Post::query()->where('topic_id', $topic->id)->orderBy('id', 'desc')->first(); - $validator->notEqual($msg, $post['text'], ['msg' => 'Ваше сообщение повторяет предыдущий пост!']); + $validator->notEqual($msg, $post->text, ['msg' => 'Ваше сообщение повторяет предыдущий пост!']); if ($files && $validator->isValid()) { $validator @@ -213,7 +214,7 @@ public function create($id): void setFlash('success', 'Сообщение успешно добавлено!'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } @@ -223,15 +224,17 @@ public function create($id): void /** * Удаление сообщений * - * @param int $id + * @param int $id + * @param Request $request * @return void */ - public function delete($id): void + public function delete(int $id, Request $request): void { - $token = check(Request::input('token')); - $del = intar(Request::input('del')); - $page = int(Request::input('page')); + $token = check($request->input('token')); + $del = intar($request->input('del')); + $page = int($request->input('page')); + /** @var Topic $topic */ $topic = Topic::query()->find($id); if (! $topic) { @@ -278,13 +281,15 @@ public function delete($id): void /** * Закрытие темы * - * @param int $id + * @param int $id + * @param Request $request * @return void */ - public function close($id): void + public function close(int $id, Request $request): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); + /** @var Topic $topic */ $topic = Topic::query()->find($id); $validator = new Validator(); @@ -319,10 +324,11 @@ public function close($id): void /** * Редактирование темы * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit($id): string + public function edit(int $id, Request $request): string { if (! getUser()) { abort(403, 'Авторизуйтесь для изменения темы!'); @@ -332,6 +338,7 @@ public function edit($id): string abort('default', 'У вас недостаточно актива для изменения темы!'); } + /** @var Topic $topic */ $topic = Topic::query()->find($id); if (! $topic) { @@ -350,11 +357,11 @@ public function edit($id): string ->orderBy('id') ->first(); - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $title = check(Request::input('title')); - $msg = check(Request::input('msg')); + $token = check($request->input('token')); + $title = check($request->input('title')); + $msg = check($request->input('msg')); $validator = new Validator(); @@ -384,7 +391,7 @@ public function edit($id): string redirect('/topics/' . $topic->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -395,12 +402,13 @@ public function edit($id): string /** * Редактирование сообщения * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function editPost($id): string + public function editPost(int $id, Request $request): string { - $page = int(Request::input('page')); + $page = int($request->input('page')); if (! getUser()) { abort(403, 'Авторизуйтесь для изменения сообщения!'); @@ -430,11 +438,11 @@ public function editPost($id): string abort('default', 'Редактирование невозможно, прошло более 10 минут!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $msg = check(Request::input('msg')); - $delfile = intar(Request::input('delfile')); + $token = check($request->input('token')); + $msg = check($request->input('msg')); + $delfile = intar($request->input('delfile')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -469,7 +477,7 @@ public function editPost($id): string setFlash('success', 'Сообщение успешно отредактировано!'); redirect('/topics/' . $post->topic_id . '?page=' . $page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -480,10 +488,11 @@ public function editPost($id): string /** * Голосование * - * @param $id + * @param int $id + * @param Request $request * @return void */ - public function vote($id): void + public function vote(int $id, Request $request): void { if (! getUser()) { abort(403, 'Авторизуйтесь для голосования!'); @@ -495,9 +504,9 @@ public function vote($id): void abort(404, 'Голосование не найдено!'); } - $token = check(Request::input('token')); - $poll = int(Request::input('poll')); - $page = int(Request::input('page')); + $token = check($request->input('token')); + $poll = int($request->input('poll')); + $page = int($request->input('page')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); @@ -514,6 +523,7 @@ public function vote($id): void $validator->addError('Вы уже проголосовали в этом опросе!'); } + /** @var VoteAnswer $voteAnswer */ $voteAnswer = $vote->answers() ->where('id', $poll) ->where('vote_id', $vote->id) @@ -550,8 +560,9 @@ public function vote($id): void * @param int $id * @return string */ - public function print($id): string + public function print(int $id): string { + /** @var Topic $topic */ $topic = Topic::query()->find($id); if (! $topic) { @@ -574,7 +585,7 @@ public function print($id): string * @param int $pid * @return void */ - public function viewpost($id, $pid): void + public function viewpost(int $id, int $pid): void { $countTopics = Post::query() ->where('id', '<=', $pid) @@ -595,8 +606,9 @@ public function viewpost($id, $pid): void * @param $id * @return void */ - public function end($id): void + public function end(int $id): void { + /** @var Topic $topic */ $topic = Topic::query()->find($id); if (! $topic) { diff --git a/app/Controllers/GuestbookController.php b/app/Controllers/GuestbookController.php index 9d2ab7526..f52b3ad06 100644 --- a/app/Controllers/GuestbookController.php +++ b/app/Controllers/GuestbookController.php @@ -33,15 +33,15 @@ public function index(): string /** * Добавление сообщения * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function add(Request $request): void + public function add(Request $request, Validator $validator): void { $msg = check($request->input('msg')); $token = check($request->input('token')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) ->length($msg, 5, setting('guesttextlength'), ['msg' => 'Слишком длинное или короткое сообщение!']) ->true(Flood::isFlood(), ['msg' => 'Антифлуд! Разрешается отправлять сообщения раз в ' . Flood::getPeriod() . ' секунд!']); @@ -92,11 +92,12 @@ public function add(Request $request): void /** * Редактирование сообщения * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit($id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { if (! getUser()) { abort(403); @@ -118,7 +119,6 @@ public function edit($id, Request $request): string $msg = check($request->input('msg')); $token = check($request->input('token')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) ->length($msg, 5, setting('guesttextlength'), ['msg' => 'Слишком длинное или короткое сообщение!']); diff --git a/app/Controllers/HomeController.php b/app/Controllers/HomeController.php index 66cbedf64..05127bbf3 100644 --- a/app/Controllers/HomeController.php +++ b/app/Controllers/HomeController.php @@ -2,10 +2,10 @@ namespace App\Controllers; -use App\Classes\Request; use App\Models\Ban; use Gregwar\Captcha\PhraseBuilder; use Gregwar\Captcha\CaptchaBuilder; +use Illuminate\Http\Request; class HomeController extends BaseController { @@ -36,10 +36,11 @@ public function closed(): string /** * Бан по IP * + * @param Request $request * @return string * @throws \Exception */ - public function banip(): string + public function banip(Request $request): string { header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden'); @@ -48,7 +49,7 @@ public function banip(): string ->whereNull('user_id') ->first(); - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { if ($ban && captchaVerify()) { diff --git a/app/Controllers/IgnoreController.php b/app/Controllers/IgnoreController.php index c3e72f1ea..b45905715 100644 --- a/app/Controllers/IgnoreController.php +++ b/app/Controllers/IgnoreController.php @@ -2,10 +2,10 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Ignore; use App\Models\User; +use Illuminate\Http\Request; class IgnoreController extends BaseController { @@ -23,13 +23,16 @@ public function __construct() /** * Главная страница + * + * @param Request $request + * @return string */ - public function index() + public function index(Request $request): string { - if (Request::isMethod('post')) { - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); - $login = check(Request::input('user')); + if ($request->isMethod('post')) { + $page = int($request->input('page', 1)); + $token = check($request->input('token')); + $login = check($request->input('user')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); @@ -63,7 +66,7 @@ public function index() setFlash('success', 'Пользователь успешно добавлен в игнор-лист!'); redirect('/ignores?page=' . $page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -84,8 +87,12 @@ public function index() /** * Заметка для пользователя + * + * @param int $id + * @param Request $request + * @return string */ - public function note($id) + public function note(int $id, Request $request): string { $ignore = Ignore::query() ->where('user_id', getUser('id')) @@ -96,10 +103,10 @@ public function note($id) abort(404, 'Запись не найдена'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $msg = check(Request::input('msg')); + $token = check($request->input('token')); + $msg = check($request->input('msg')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) @@ -114,7 +121,7 @@ public function note($id) setFlash('success', 'Заметка успешно отредактирована!'); redirect('/ignores'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -124,12 +131,14 @@ public function note($id) /** * Удаление контактов + * + * @param Request $request */ - public function delete() + public function delete(Request $request): void { - $page = int(Request::input('page', 1)); - $token = check(Request::input('token')); - $del = intar(Request::input('del')); + $page = int($request->input('page', 1)); + $token = check($request->input('token')); + $del = intar($request->input('del')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') diff --git a/app/Controllers/Load/ActiveController.php b/app/Controllers/Load/ActiveController.php index 181e36885..2426d06e5 100644 --- a/app/Controllers/Load/ActiveController.php +++ b/app/Controllers/Load/ActiveController.php @@ -2,11 +2,11 @@ namespace App\Controllers\Load; -use App\Classes\Request; use App\Controllers\BaseController; use App\Models\Comment; use App\Models\Down; use App\Models\User; +use Illuminate\Http\Request; class ActiveController extends BaseController { @@ -19,7 +19,8 @@ public function __construct() { parent::__construct(); - $login = check(Request::input('user', getUser('login'))); + $request = Request::createFromGlobals(); + $login = check($request->input('user', getUser('login'))); $this->user = User::query()->where('login', $login)->first(); @@ -31,11 +32,12 @@ public function __construct() /** * Мои файлы * + * @param Request $request * @return string */ - public function files(): string + public function files(Request $request): string { - $active = check(Request::input('active', 1)); + $active = check($request->input('active', 1)); $user = $this->user; if ($user->id !== getUser('id')) { diff --git a/app/Controllers/Load/DownController.php b/app/Controllers/Load/DownController.php index f9750124c..1dfe78795 100644 --- a/app/Controllers/Load/DownController.php +++ b/app/Controllers/Load/DownController.php @@ -6,7 +6,6 @@ use App\Models\Load; use App\Models\User; use Exception; -use App\Classes\Request; use App\Classes\Validator; use App\Controllers\BaseController; use App\Models\Comment; @@ -16,6 +15,7 @@ use App\Models\Polling; use Illuminate\Database\Capsule\Manager as DB; use Illuminate\Database\Query\JoinClause; +use Illuminate\Http\Request; use PhpZip\ZipFile; class DownController extends BaseController @@ -26,7 +26,7 @@ class DownController extends BaseController * @param int $id * @return string */ - public function index($id): string + public function index(int $id): string { $down = Down::query() ->select('downs.*', 'pollings.vote') @@ -55,11 +55,13 @@ public function index($id): string /** * Редактирование загрузки * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit($id): string + public function edit(int $id, Request $request): string { + /** @var Down $down */ $down = Down::query()->where('user_id', getUser('id'))->find($id); if (! $down) { @@ -70,11 +72,11 @@ public function edit($id): string abort('default', 'Данный файл уже проверен модератором!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $title = check(Request::input('title')); - $text = check(Request::input('text')); - $files = (array) Request::file('files'); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $title = check($request->input('title')); + $text = check($request->input('text')); + $files = (array) $request->file('files'); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -115,7 +117,7 @@ public function edit($id): string setFlash('success', 'Загрузка успешно отредактирована!'); redirect('/downs/' . $down->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -130,14 +132,16 @@ public function edit($id): string * @param int $fid * @throws Exception */ - public function deleteFile($id, $fid): void + public function deleteFile(int $id, int $fid): void { + /** @var Down $down */ $down = Down::query()->where('user_id', getUser('id'))->find($id); if (! $down) { abort(404, 'Файла не существует или вы не автор данной загрузки!'); } + /** @var File $file */ $file = File::query()->where('relate_id', $down->id)->find($fid); if (! $file) { @@ -155,11 +159,12 @@ public function deleteFile($id, $fid): void /** * Создание загрузки * + * @param Request $request * @return string */ - public function create(): string + public function create(Request $request): string { - $cid = int(Request::input('cid')); + $cid = int($request->input('cid')); if (! setting('downupload')) { abort('default', 'Загрузка файлов запрещена администрацией сайта!'); @@ -179,13 +184,14 @@ public function create(): string abort('default', 'Разделы загрузок еще не созданы!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $title = check(Request::input('title')); - $text = check(Request::input('text')); - $files = (array) Request::file('files'); + $token = check($request->input('token')); + $title = check($request->input('title')); + $text = check($request->input('text')); + $files = (array) $request->file('files'); + /** @var Load $category */ $category = Load::query()->find($cid); $validator = new Validator(); @@ -220,6 +226,7 @@ public function create(): string if ($validator->isValid()) { + /** @var Down $down */ $down = Down::query()->create([ 'category_id' => $category->id, 'title' => $title, @@ -247,7 +254,7 @@ public function create(): string setFlash('success', 'Файл успешно загружен!'); redirect('/downs/' . $down->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -258,14 +265,16 @@ public function create(): string /** * Голосование * - * @param $id + * @param int $id + * @param Request $request * @return void */ - public function vote($id): void + public function vote(int $id, Request $request): void { - $token = check(Request::input('token')); - $score = int(Request::input('score')); + $token = check($request->input('token')); + $score = int($request->input('score')); + /** @var Down $down */ $down = Down::query()->find($id); if (! $down) { @@ -326,8 +335,9 @@ public function vote($id): void * @param $id * @return void */ - public function download($id): void + public function download(int $id): void { + /** @var File $file */ $file = File::query()->where('relate_type', Down::class)->find($id); if (! $file || ! $file->relate) { @@ -371,11 +381,13 @@ public function download($id): void /** * Комментарии * - * @param $id + * @param int $id + * @param Request $request * @return string */ - public function comments($id): string + public function comments(int $id, Request $request): string { + /** @var Down $down */ $down = Down::query()->find($id); if (! $down) { @@ -386,10 +398,10 @@ public function comments($id): string abort('default', 'Данный файл еще не проверен модератором!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $msg = check(Request::input('msg')); + $token = check($request->input('token')); + $msg = check($request->input('msg')); $validator = new Validator(); $validator @@ -402,6 +414,7 @@ public function comments($id): string $msg = antimat($msg); + /** @var Comment $comment */ $comment = Comment::query()->create([ 'relate_type' => Down::class, 'relate_id' => $down->id, @@ -419,7 +432,7 @@ public function comments($id): string setFlash('success', 'Комментарий успешно добавлен!'); redirect('/downs/end/' . $down->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -446,11 +459,12 @@ public function comments($id): string /** * Подготовка к редактированию комментария * - * @param int $id - * @param int $cid + * @param int $id + * @param int $cid + * @param Request $request * @return string */ - public function editComment($id, $cid): string + public function editComment(int $id, int $cid, Request $request): string { $down = Down::query()->find($id); @@ -458,7 +472,7 @@ public function editComment($id, $cid): string abort(404, 'Данного файла не существует!'); } - $page = int(Request::input('page', 1)); + $page = int($request->input('page', 1)); if (! getUser()) { abort(403, 'Для редактирования комментариев небходимо авторизоваться!'); @@ -478,10 +492,10 @@ public function editComment($id, $cid): string abort('default', 'Редактирование невозможно, прошло более 10 минут!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $msg = check(Request::input('msg')); - $page = int(Request::input('page', 1)); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $msg = check($request->input('msg')); + $page = int($request->input('page', 1)); $validator = new Validator(); $validator @@ -498,7 +512,7 @@ public function editComment($id, $cid): string setFlash('success', 'Комментарий успешно отредактирован!'); redirect('/downs/comments/' . $id . '?page=' . $page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -512,8 +526,9 @@ public function editComment($id, $cid): string * @param int $id * @return void */ - public function end($id): void + public function end(int $id): void { + /** @var Down $down */ $down = Down::query()->find($id); if (! $down) { @@ -535,8 +550,9 @@ public function end($id): void * @param int $id * @return string */ - public function zip($id): string + public function zip(int $id): string { + /** @var File $file */ $file = File::query()->where('relate_type', Down::class)->find($id); if (! $file || ! $file->relate) { @@ -575,8 +591,9 @@ public function zip($id): string * @param int $fid * @return string */ - public function zipView($id, $fid): string + public function zipView(int $id, int $fid): string { + /** @var File $file */ $file = File::query()->where('relate_type', Down::class)->find($id); if (! $file || ! $file->relate) { @@ -597,7 +614,7 @@ public function zipView($id, $fid): string } catch (Exception $e) { abort('default', 'Не удалось открыть архив!'); } - + /** @var ZipFile $archive */ $getDocuments = array_values($archive->getAllInfo()); $document = $getDocuments[$fid] ?? null; @@ -636,7 +653,7 @@ public function zipView($id, $fid): string * @param int $id * @return string */ - public function rss($id): string + public function rss(int $id): string { $down = Down::query()->where('id', $id)->with('lastComments')->first(); @@ -654,8 +671,9 @@ public function rss($id): string * @param int $cid * @return void */ - public function viewComment($id, $cid): void + public function viewComment(int $id, int $cid): void { + /** @var Down $down */ $down = Down::query()->find($id); if (! $down) { diff --git a/app/Controllers/Load/LoadController.php b/app/Controllers/Load/LoadController.php index 4ab0b9bab..46f5f2f1b 100644 --- a/app/Controllers/Load/LoadController.php +++ b/app/Controllers/Load/LoadController.php @@ -2,10 +2,10 @@ namespace App\Controllers\Load; -use App\Classes\Request; use App\Controllers\BaseController; use App\Models\Down; use App\Models\Load; +use Illuminate\Http\Request; class LoadController extends BaseController { @@ -32,11 +32,13 @@ public function index(): string /** * Список файлов в категории * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function load($id): string + public function load(int $id, Request $request): string { + /** @var Load $category */ $category = Load::query()->with('parent')->find($id); if (! $category) { @@ -46,7 +48,7 @@ public function load($id): string $total = Down::query()->where('category_id', $category->id)->where('active', 1)->count(); $page = paginate(setting('downlist'), $total); - $sort = check(Request::input('sort')); + $sort = check($request->input('sort')); switch ($sort) { case 'rated': diff --git a/app/Controllers/Load/SearchController.php b/app/Controllers/Load/SearchController.php index 521de03e8..ab9f8b320 100644 --- a/app/Controllers/Load/SearchController.php +++ b/app/Controllers/Load/SearchController.php @@ -2,25 +2,26 @@ namespace App\Controllers\Load; -use App\Classes\Request; use App\Controllers\BaseController; use App\Models\Down; use App\Models\Load; +use Illuminate\Http\Request; class SearchController extends BaseController { /** * Поиск * + * @param Request $request * @return string */ - public function index(): ?string + public function index(Request $request): ?string { - $cid = check(Request::input('cid')); - $find = check(Request::input('find')); - $type = int(Request::input('type')); - $where = int(Request::input('where')); - $section = int(Request::input('section')); + $cid = check($request->input('cid')); + $find = check($request->input('find')); + $type = int($request->input('type')); + $where = int($request->input('where')); + $section = int($request->input('section')); if (! $find) { $categories = Load::query() @@ -42,7 +43,8 @@ public function index(): ?string $find = winToUtf($find); } - if (utfStrlen($find) >= 3 && utfStrlen($find) <= 50) { + $strlen = utfStrlen($find); + if ($strlen >= 3 && $strlen <= 50) { $findmewords = explode(' ', utfLower($find)); @@ -98,7 +100,7 @@ public function index(): ?string return view('loads/search_title', compact('downs', 'page', 'find', 'type', 'where', 'section')); } - setInput(Request::all()); + setInput($request->all()); setFlash('danger', 'По вашему запросу ничего не найдено!'); redirect('/loads/search'); } @@ -138,13 +140,13 @@ public function index(): ?string return view('loads/search_text', compact('downs', 'page', 'find', 'type', 'where', 'section')); } - setInput(Request::all()); + setInput($request->all()); setFlash('danger', 'По вашему запросу ничего не найдено!'); redirect('/loads/search'); } } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', ['find' => 'Запрос должен содержать от 3 до 50 символов!']); redirect('/loads/search'); } diff --git a/app/Controllers/Load/TopController.php b/app/Controllers/Load/TopController.php index 3a4544991..669cba7b6 100644 --- a/app/Controllers/Load/TopController.php +++ b/app/Controllers/Load/TopController.php @@ -2,18 +2,19 @@ namespace App\Controllers\Load; -use App\Classes\Request; use App\Controllers\BaseController; use App\Models\Down; +use Illuminate\Http\Request; class TopController extends BaseController { /** * Топ файлов * + * @param Request $request * @return string */ - public function index(): string + public function index(Request $request): string { $total = Down::query()->where('active', 1)->count(); @@ -23,7 +24,7 @@ public function index(): string $page = paginate(setting('downlist'), $total); - $sort = check(Request::input('sort')); + $sort = check($request->input('sort')); switch ($sort) { case 'rated': diff --git a/app/Controllers/LoginController.php b/app/Controllers/LoginController.php index 3db11b270..8016012bf 100644 --- a/app/Controllers/LoginController.php +++ b/app/Controllers/LoginController.php @@ -21,7 +21,7 @@ public function __construct() /** * Главная страница */ - public function index() + public function index(): string { $total = Login::query()->where('user_id', getUser('id'))->count(); $page = paginate(setting('loginauthlist'), $total); diff --git a/app/Controllers/MailController.php b/app/Controllers/MailController.php index c84517b04..fce6281ec 100644 --- a/app/Controllers/MailController.php +++ b/app/Controllers/MailController.php @@ -2,22 +2,25 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\User; +use Illuminate\Http\Request; class MailController extends BaseController { /** * Главная страница + * + * @param Request $request + * @return string */ - public function index() + public function index(Request $request): string { - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $message = nl2br(check(Request::input('message'))); - $name = check(Request::input('name')); - $email = check(Request::input('email')); + $message = nl2br(check($request->input('message'))); + $name = check($request->input('name')); + $email = check($request->input('email')); if (getUser()) { $name = getUser('login'); @@ -41,7 +44,7 @@ public function index() setFlash('success', 'Ваше письмо успешно отправлено!'); redirect('/'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -51,17 +54,20 @@ public function index() /** * Восстановление пароля + * + * @param Request $request + * @return string */ - public function recovery() + public function recovery(Request $request): string { if (getUser()) { abort('default', 'Вы авторизованы, восстановление пароля невозможно!'); } - $cookieLogin = (isset($_COOKIE['login'])) ? check($_COOKIE['login']) : ''; + $cookieLogin = isset($_COOKIE['login']) ? check($_COOKIE['login']) : ''; - if (Request::isMethod('post')) { - $login = check(Request::input('user')); + if ($request->isMethod('post')) { + $login = check($request->input('user')); $user = User::query()->where('login', $login)->orWhere('email', $login)->first(); if (! $user) { @@ -91,7 +97,7 @@ public function recovery() setFlash('success', 'Восстановление пароля инициализировано!'); redirect('/login'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -101,14 +107,17 @@ public function recovery() /** * Восстановление пароля + * + * @param Request $request + * @return string */ - public function restore() + public function restore(Request $request): ?string { if (getUser()) { abort(403, 'Вы авторизованы, восстановление пароля невозможно!'); } - $key = check(Request::input('key')); + $key = check($request->input('key')); $user = User::query()->where('keypasswd', $key)->first(); if (! $user) { @@ -139,18 +148,20 @@ public function restore() sendMail($user['email'], $subject, $body); return view('mails/restore', ['login' => $user['login'], 'password' => $newpass]); - } else { - setFlash('danger', current($validator->getErrors())); - redirect('/'); } + + setFlash('danger', current($validator->getErrors())); + redirect('/'); } /** * Отписка от рассылки + * + * @param Request $request */ - public function unsubscribe() + public function unsubscribe(Request $request): void { - $key = check(Request::input('key')); + $key = check($request->input('key')); if (! $key) { abort('default', 'Отсутствует ключ для отписки от рассылки'); diff --git a/app/Controllers/MessageController.php b/app/Controllers/MessageController.php index 42fc17faa..e38a8bd8a 100644 --- a/app/Controllers/MessageController.php +++ b/app/Controllers/MessageController.php @@ -2,7 +2,6 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Contact; use App\Models\Flood; @@ -11,6 +10,7 @@ use App\Models\Outbox; use App\Models\User; use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Http\Request; class MessageController extends BaseController { @@ -80,21 +80,24 @@ public function outbox() /** * Отправка сообщений + * + * @param Request $request + * @return string */ - public function send() + public function send(Request $request): string { - $login = check(Request::input('user')); + $login = check($request->input('user')); - if (! empty(Request::input('contact'))) { - $login = check(Request::input('contact')); + if (! empty($request->input('contact'))) { + $login = check($request->input('contact')); } $user = User::query()->where('login', $login)->first(); - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $msg = check(Request::input('msg')); + $token = check($request->input('token')); + $msg = check($request->input('msg')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) @@ -106,7 +109,7 @@ public function send() $validator->notEqual($user->id, getUser('id'), ['user' => 'Нельзя отправлять письмо самому себе!']); - if (getUser('point') < setting('privatprotect') && ! captchaVerify()) { + if (! captchaVerify() && getUser('point') < setting('privatprotect')) { $validator->addError(['protect' => 'Не удалось пройти проверку captcha!']); } @@ -143,13 +146,13 @@ public function send() 'created_at' => SITETIME, ]); - DB::delete("DELETE FROM `outbox` WHERE `recipient_id`=? AND `created_at` < (SELECT MIN(`created_at`) FROM (SELECT `created_at` FROM `outbox` WHERE `recipient_id`=? ORDER BY `created_at` DESC LIMIT " . setting('limitoutmail') . ") AS del);", [getUser('id'), getUser('id')]); + DB::delete('DELETE FROM `outbox` WHERE `recipient_id`=? AND `created_at` < (SELECT MIN(`created_at`) FROM (SELECT `created_at` FROM `outbox` WHERE `recipient_id`=? ORDER BY `created_at` DESC LIMIT ' . setting('limitoutmail') . ') AS del);', [getUser('id'), getUser('id')]); setFlash('success', 'Ваше письмо успешно отправлено!'); redirect('/messages'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -165,13 +168,15 @@ public function send() /** * Удаление сообщений + * + * @param Request $request */ - public function delete() + public function delete(Request $request): void { - $token = check(Request::input('token')); - $type = check(Request::input('type')); - $del = intar(Request::input('del')); - $page = int(Request::input('page', 1)); + $token = check($request->input('token')); + $type = check($request->input('type')); + $del = intar($request->input('del')); + $page = int($request->input('page', 1)); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -179,7 +184,7 @@ public function delete() if ($validator->isValid()) { - if ($type == 'outbox') { + if ($type === 'outbox') { Outbox::query() ->where('user_id', getUser('id')) ->whereIn('id', $del) @@ -202,12 +207,14 @@ public function delete() /** * Очистка сообщений + * + * @param Request $request */ - public function clear() + public function clear(Request $request): void { - $token = check(Request::input('token')); - $type = check(Request::input('type')); - $page = int(Request::input('page', 1)); + $token = check($request->input('token')); + $type = check($request->input('type')); + $page = int($request->input('page', 1)); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -215,7 +222,7 @@ public function clear() if ($validator->isValid()) { - if ($type == 'outbox') { + if ($type === 'outbox') { Outbox::query()->where('user_id', getUser('id'))->delete(); } else { Inbox::query()->where('user_id', getUser('id'))->delete(); @@ -232,16 +239,19 @@ public function clear() /** * Просмотр переписки + * + * @param Request $request + * @return string */ - public function history() + public function history(Request $request): string { - $login = check(Request::input('user')); + $login = check($request->input('user')); if (! $user = getUserByLogin($login)) { abort(404, 'Пользователя с данным логином не существует!'); } - if ($user->id == getUser('id')) { + if ($user->id === getUser('id')) { abort('default', 'Отсутствует переписка с самим собой!'); } diff --git a/app/Controllers/NewsController.php b/app/Controllers/NewsController.php index a665966ce..f1211f9a1 100644 --- a/app/Controllers/NewsController.php +++ b/app/Controllers/NewsController.php @@ -2,13 +2,13 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Comment; use App\Models\Flood; use App\Models\News; use App\Models\User; use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Http\Request; class NewsController extends BaseController { @@ -32,8 +32,11 @@ public function index() /** * Вывод новости + * + * @param int $id + * @return string */ - public function view($id) + public function view(int $id): string { $news = News::query()->find($id); @@ -58,18 +61,23 @@ public function view($id) /** * Комментарии + * + * @param int $id + * @param Request $request + * @return string */ - public function comments($id) + public function comments(int $id, Request $request): string { + /** @var News $news */ $news = News::query()->find($id); if (! $news) { abort(404, 'Новость не существует, возможно она была удалена!'); } - if (Request::isMethod('post')) { - $msg = check(Request::input('msg')); - $token = check(Request::input('token')); + if ($request->isMethod('post')) { + $msg = check($request->input('msg')); + $token = check($request->input('token')); $validator = new Validator(); $validator->true(getUser(), 'Чтобы добавить комментарий необходимо авторизоваться') @@ -81,6 +89,7 @@ public function comments($id) if ($validator->isValid()) { $msg = antimat($msg); + /** @var Comment $comment */ $comment = Comment::query()->create([ 'relate_type' => News::class, 'relate_id' => $news->id, @@ -104,14 +113,14 @@ public function comments($id) setFlash('success', 'Комментарий успешно добавлен!'); - if (Request::has('read')) { + if ($request->has('read')) { redirect('/news/' . $news->id); } redirect('/news/end/' . $news->id . ''); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -137,10 +146,17 @@ public function comments($id) /** * Редактирование комментария + * + * @param int $id + * @param int $cid + * @param Request $request + * @return string */ - public function editComment($id, $cid) + public function editComment(int $id, int $cid, Request $request): string { - $page = int(Request::input('page', 1)); + $page = int($request->input('page', 1)); + + /** @var News $news */ $news = News::query()->find($id); if (! $news) { @@ -165,9 +181,9 @@ public function editComment($id, $cid) abort('default', 'Редактирование невозможно, прошло более 10 минут!'); } - if (Request::isMethod('post')) { - $msg = check(Request::input('msg')); - $token = check(Request::input('token')); + if ($request->isMethod('post')) { + $msg = check($request->input('msg')); + $token = check($request->input('token')); $validator = new Validator(); $validator @@ -184,7 +200,7 @@ public function editComment($id, $cid) setFlash('success', 'Комментарий успешно отредактирован!'); redirect('/news/comments/' . $news->id . '?page=' . $page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -193,9 +209,12 @@ public function editComment($id, $cid) /** * Переадресация на последнюю страницу + * + * @param $id */ - public function end($id) + public function end($id): void { + /** @var News $news */ $news = News::query()->find($id); if (empty($news)) { @@ -248,9 +267,13 @@ public function allComments() /** * Переход к сообщению + * + * @param int $id + * @param int $cid */ - public function viewComment($id, $cid) + public function viewComment(int $id, int $cid): void { + /** @var News $news */ $news = News::query()->find($id); if (! $news) { diff --git a/app/Controllers/NotebookController.php b/app/Controllers/NotebookController.php index d4907f955..1c12c86d5 100644 --- a/app/Controllers/NotebookController.php +++ b/app/Controllers/NotebookController.php @@ -2,9 +2,9 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Notebook; +use Illuminate\Http\Request; class NotebookController extends BaseController { @@ -36,12 +36,15 @@ public function index() /** * Редактирование + * + * @param Request $request + * @return string */ - public function edit() + public function edit(Request $request): string { - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $msg = check(Request::input('msg')); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $msg = check($request->input('msg')); $validator = new Validator(); $validator @@ -57,7 +60,7 @@ public function edit() setFlash('success', 'Запись успешно сохранена!'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } diff --git a/app/Controllers/OfferController.php b/app/Controllers/OfferController.php index e54b01c62..db884f922 100644 --- a/app/Controllers/OfferController.php +++ b/app/Controllers/OfferController.php @@ -2,24 +2,27 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Comment; use App\Models\Flood; use App\Models\Offer; -use App\Models\Polling; use Illuminate\Database\Query\JoinClause; +use Illuminate\Http\Request; class OfferController extends BaseController { /** * Главная страница + * + * @param string $type + * @param Request $request + * @return string */ - public function index($type = 'offer') + public function index(Request $request, $type = 'offer'): string { $otherType = $type === Offer::OFFER ? Offer::ISSUE : Offer::OFFER; - $sort = check(Request::input('sort')); + $sort = check($request->input('sort')); $total = Offer::query()->where('type', $type)->count(); $page = paginate(setting('postoffers'), $total); @@ -53,8 +56,11 @@ public function index($type = 'offer') /** * Просмотр записи + * + * @param int $id + * @return string */ - public function view($id) + public function view(int $id): string { $offer = Offer::query() ->select('offers.*', 'pollings.vote') @@ -75,20 +81,23 @@ public function view($id) /** * Создание записи + * + * @param Request $request + * @return string */ - public function create() + public function create(Request $request): string { if (! $user = getUser()) { abort(403, 'Авторизуйтесь для добавления записи!'); } - $type = check(Request::input('type')); + $type = check($request->input('type')); - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $title = check(Request::input('title')); - $text = check(Request::input('text')); + $token = check($request->input('token')); + $title = check($request->input('title')); + $text = check($request->input('text')); $validator = new Validator(); @@ -104,6 +113,7 @@ public function create() $title = antimat($title); $text = antimat($text); + /** @var Offer $offer */ $offer = Offer::query()->create([ 'type' => $type, 'title' => $title, @@ -117,7 +127,7 @@ public function create() setFlash('success', 'Запись успешно добавлена!'); redirect('/offers/' . $offer->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -127,8 +137,12 @@ public function create() /** * Редактирование записи + * + * @param int $id + * @param Request $request + * @return string */ - public function edit($id) + public function edit(int $id, Request $request): string { if (! $user = getUser()) { abort(403, 'Авторизуйтесь для редактирования записи!'); @@ -147,12 +161,12 @@ public function edit($id) abort('default', 'Данное предложение или проблема уже решена или закрыта!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $title = check(Request::input('title')); - $text = check(Request::input('text')); - $type = check(Request::input('type')); + $token = check($request->input('token')); + $title = check($request->input('title')); + $text = check($request->input('text')); + $type = check($request->input('type')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['Неверный идентификатор сессии, повторите действие!']) @@ -175,7 +189,7 @@ public function edit($id) setFlash('success', 'Запись успешно изменена!'); redirect('/offers/' . $offer->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -185,19 +199,24 @@ public function edit($id) /** * Комментарии + * + * @param int $id + * @param Request $request + * @return string */ - public function comments($id) + public function comments(int $id, Request $request): string { + /** @var Offer $offer */ $offer = Offer::query()->find($id); if (! $offer) { abort(404, 'Данного предложения или проблемы не существует!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $msg = check(Request::input('msg')); + $token = check($request->input('token')); + $msg = check($request->input('msg')); $validator = new Validator(); $validator @@ -211,6 +230,7 @@ public function comments($id) $msg = antimat($msg); + /** @var Comment $comment */ $comment = Comment::query()->create([ 'relate_type' => Offer::class, 'relate_id' => $offer->id, @@ -228,7 +248,7 @@ public function comments($id) setFlash('success', 'Комментарий успешно добавлен!'); redirect('/offers/end/' . $offer->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -253,10 +273,17 @@ public function comments($id) /** * Подготовка к редактированию комментария + * + * @param int $id + * @param int $cid + * @param Request $request + * @return string */ - public function editComment($id, $cid) + public function editComment(int $id, int $cid, Request $request): string { - $page = int(Request::input('page', 1)); + $page = int($request->input('page', 1)); + + /** @var Offer $offer */ $offer = Offer::query()->find($id); if (! $offer) { @@ -281,10 +308,10 @@ public function editComment($id, $cid) abort('default', 'Редактирование невозможно, прошло более 10 минут!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $msg = check(Request::input('msg')); - $page = int(Request::input('page', 1)); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $msg = check($request->input('msg')); + $page = int($request->input('page', 1)); $validator = new Validator(); $validator @@ -301,7 +328,7 @@ public function editComment($id, $cid) setFlash('success', 'Комментарий успешно отредактирован!'); redirect('/offers/comments/' . $offer->id . '?page=' . $page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -311,9 +338,12 @@ public function editComment($id, $cid) /** * Переадресация на последнюю страницу + * + * @param int $id */ - public function end($id) + public function end(int $id): void { + /** @var Offer $offer */ $offer = Offer::query()->find($id); if (! $offer) { @@ -331,9 +361,13 @@ public function end($id) /** * Переход к сообщению + * + * @param int $id + * @param int $cid */ - public function viewComment($id, $cid) + public function viewComment(int $id, int $cid): void { + /** @var Offer $offer */ $offer = Offer::query()->find($id); if (! $offer) { diff --git a/app/Controllers/PageController.php b/app/Controllers/PageController.php index 18b2acf50..28ff2c51a 100644 --- a/app/Controllers/PageController.php +++ b/app/Controllers/PageController.php @@ -12,18 +12,22 @@ class PageController extends BaseController { /** * Главная страница + * + * @param string $action + * @param string $params + * @return string */ - public function __call($action, $params) + public function __call(string $action, string $params) { if (! preg_match('|^[a-z0-9_\-]+$|i', $action)) { abort(404); } - if (! file_exists(RESOURCES.'/views/main/'.$action.'.blade.php')){ + if (! file_exists(RESOURCES . '/views/main/' . $action . '.blade.php')){ abort(404); } - if (! getUser() && $action == 'menu'){ + if ($action === 'menu' && ! getUser()){ abort(404); } @@ -73,7 +77,7 @@ public function smiles() /** * Ежегодный сюрприз */ - public function surprise() + public function surprise(): void { $surprise['requiredPoint'] = 50; $surprise['requiredDate'] = '10.01'; diff --git a/app/Controllers/PhotoController.php b/app/Controllers/PhotoController.php index a0fdd3ba6..82075d47b 100644 --- a/app/Controllers/PhotoController.php +++ b/app/Controllers/PhotoController.php @@ -2,7 +2,6 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Comment; use App\Models\File; @@ -11,6 +10,7 @@ use App\Models\User; use Illuminate\Database\Capsule\Manager as DB; use Illuminate\Database\Query\JoinClause; +use Illuminate\Http\Request; class PhotoController extends BaseController { @@ -40,7 +40,7 @@ public function index(): string * @param int $id * @return string */ - public function view($id): string + public function view(int $id): string { $photo = Photo::query() ->select('photos.*', 'pollings.vote') @@ -63,20 +63,21 @@ public function view($id): string /** * Форма загрузки фото * + * @param Request $request * @return string */ - public function create(): string + public function create(Request $request): string { if (! getUser()) { abort(403, 'Для добавления фотографий небходимо авторизоваться!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $title = check(Request::input('title')); - $text = check(Request::input('text')); - $closed = empty(Request::input('closed')) ? 0 : 1; + $token = check($request->input('token')); + $title = check($request->input('title')); + $text = check($request->input('text')); + $closed = empty($request->input('closed')) ? 0 : 1; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -86,6 +87,7 @@ public function create(): string if ($validator->isValid()) { + /** @var Photo $photo */ $photo = Photo::query()->create([ 'user_id' => getUser('id'), 'title' => $title, @@ -103,7 +105,7 @@ public function create(): string setFlash('success', 'Фотография успешно загружена!'); redirect('/photos/' . $photo->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -120,28 +122,30 @@ public function create(): string /** * Редактирование фото * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit($id): string + public function edit(int $id, Request $request): string { - $page = int(Request::input('page', 1)); + $page = int($request->input('page', 1)); if (! getUser()) { abort(403, 'Авторизуйтесь для редактирования фотографии!'); } + /** @var Photo $photo */ $photo = Photo::query()->where('user_id', getUser('id'))->find($id); if (! $photo) { abort(404, 'Выбранное вами фото не найдено или вы не автор этой фотографии!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $title = check(Request::input('title')); - $text = check(Request::input('text')); - $closed = empty(Request::input('closed')) ? 0 : 1; + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $title = check($request->input('title')); + $text = check($request->input('text')); + $closed = empty($request->input('closed')) ? 0 : 1; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -160,7 +164,7 @@ public function edit($id): string setFlash('success', 'Фотография успешно отредактирована!'); redirect('/photos/albums/' . getUser('login') . '?page=' . $page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -173,20 +177,22 @@ public function edit($id): string /** * Список комментариев * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function comments($id): string + public function comments(int $id, Request $request): string { + /** @var Photo $photo */ $photo = Photo::query()->find($id); if (! $photo) { abort(404, 'Фотография не найдена!'); } - if (Request::isMethod('post')) { - $msg = check(Request::input('msg')); - $token = check(Request::input('token')); + if ($request->isMethod('post')) { + $msg = check($request->input('msg')); + $token = check($request->input('token')); $validator = new Validator(); $validator @@ -199,6 +205,7 @@ public function comments($id): string if ($validator->isValid()) { $msg = antimat($msg); + /** @var Comment $comment */ $comment = Comment::query()->create([ 'relate_type' => Photo::class, 'relate_id' => $photo->id, @@ -223,7 +230,7 @@ public function comments($id): string setFlash('success', 'Комментарий успешно добавлен!'); redirect('/photos/end/' . $photo->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -249,13 +256,16 @@ public function comments($id): string /** * Редактирование комментария * - * @param int $id - * @param int $cid + * @param int $id + * @param int $cid + * @param Request $request * @return string */ - public function editComment($id, $cid): string + public function editComment(int $id, int $cid, Request $request): string { - $page = int(Request::input('page', 1)); + $page = int($request->input('page', 1)); + + /** @var Photo $photo */ $photo = Photo::query()->find($id); if (! $photo) { @@ -286,9 +296,9 @@ public function editComment($id, $cid): string abort('default', 'Редактирование невозможно, прошло более 10 минут!'); } - if (Request::isMethod('post')) { - $msg = check(Request::input('msg')); - $token = check(Request::input('token')); + if ($request->isMethod('post')) { + $msg = check($request->input('msg')); + $token = check($request->input('token')); $validator = new Validator(); $validator @@ -306,7 +316,7 @@ public function editComment($id, $cid): string setFlash('success', 'Комментарий успешно отредактирован!'); redirect('/photos/comments/' . $photo->id . '?page=' . $page); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -316,18 +326,21 @@ public function editComment($id, $cid): string /** * Удаление фотографий * - * @param int $id + * @param int $id + * @param Request $request + * @throws \Exception */ - public function delete($id): void + public function delete(int $id, Request $request): void { - $page = int(Request::input('page', 1)); + $page = int($request->input('page', 1)); - $token = check(Request::input('token')); + $token = check($request->input('token')); if (! getUser()) { abort(403, 'Для удаления фотографий небходимо авторизоваться!'); } + /** @var Photo $photo */ $photo = Photo::query()->where('user_id', getUser('id'))->find($id); if (! $photo) { @@ -358,7 +371,7 @@ public function delete($id): void * * @param int $id */ - public function end($id): void + public function end(int $id): void { $photo = Photo::query()->find($id); @@ -436,18 +449,17 @@ public function album($login): string /** * Альбом пользователя * + * @param Request $request * @return string */ - public function top(): string + public function top(Request $request): string { - $sort = check(Request::input('sort', 'rating')); - - switch ($sort) { - case 'comments': - $order = 'count_comments'; - break; - default: - $order = 'rating'; + $sort = check($request->input('sort', 'rating')); + + if ($sort === 'comments') { + $order = 'count_comments'; + } else { + $order = 'rating'; } $total = Photo::query()->count(); @@ -527,8 +539,9 @@ public function UserComments($login): string * @param int $id * @param int $cid */ - public function viewComment($id, $cid): void + public function viewComment(int $id, int $cid): void { + /** @var Photo $photo */ $photo = Photo::query()->find($id); if (! $photo) { diff --git a/app/Controllers/PictureController.php b/app/Controllers/PictureController.php index 1a787c461..c947b64cd 100644 --- a/app/Controllers/PictureController.php +++ b/app/Controllers/PictureController.php @@ -2,8 +2,8 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; +use Illuminate\Http\Request; use Intervention\Image\ImageManagerStatic as Image; class PictureController extends BaseController @@ -24,13 +24,16 @@ public function __construct() /** * Главная страница + * + * @param Request $request + * @return string */ - public function index() + public function index(Request $request): string { - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $photo = Request::file('photo'); + $token = check($request->input('token')); + $photo = $request->file('photo'); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['photo' => 'Неверный идентификатор сессии, повторите действие!']); @@ -69,7 +72,7 @@ public function index() redirect('/profile'); } - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } @@ -79,10 +82,12 @@ public function index() /** * Удаление фотографии + * + * @param Request $request */ - public function delete() + public function delete(Request $request): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['photo' => 'Неверный идентификатор сессии, повторите действие!']); diff --git a/app/Controllers/RatingController.php b/app/Controllers/RatingController.php index b87c5e832..46d26665f 100644 --- a/app/Controllers/RatingController.php +++ b/app/Controllers/RatingController.php @@ -2,11 +2,11 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Rating; use App\Models\User; use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Http\Request; class RatingController extends BaseController { @@ -25,12 +25,13 @@ public function __construct() /** * Изменение рейтинга * - * @param string $login + * @param string $login + * @param Request $request * @return string */ - public function index($login): string + public function index(string $login, Request $request): string { - $vote = Request::input('vote'); + $vote = $request->input('vote'); $user = User::query()->where('login', $login)->first(); if (! $user) { @@ -56,10 +57,10 @@ public function index($login): string abort('default', 'Вы уже изменяли репутацию этому пользователю!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $text = check(Request::input('text')); + $token = check($request->input('token')); + $text = check($request->input('text')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -104,7 +105,7 @@ public function index($login): string setFlash('success', 'Репутация успешно изменена!'); redirect('/users/'.$user->login); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -118,7 +119,7 @@ public function index($login): string * @param string $login * @return string */ - public function received($login): string + public function received(string $login): string { $user = User::query()->where('login', $login)->first(); @@ -146,7 +147,7 @@ public function received($login): string * @param string $login * @return string */ - public function gave($login): string + public function gave(string $login): string { $user = User::query()->where('login', $login)->first(); @@ -171,24 +172,29 @@ public function gave($login): string /** * Удаление истории * + * @param Request $request * @return void * @throws \Exception */ - public function delete(): void + public function delete(Request $request): void { - $id = int(Request::input('id')); - $token = check(Request::input('token')); + $id = int($request->input('id')); + $token = check($request->input('token')); $validator = new Validator(); $validator - ->true(Request::ajax(), 'Это не ajax запрос!') + ->true($request->ajax(), 'Это не ajax запрос!') ->true(isAdmin(User::ADMIN), 'Удалять рейтинг могут только администраторы') ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($id, ['Не выбрана запись для удаление!']); if ($validator->isValid()) { - Rating::query()->find($id)->delete(); + $rating = Rating::query()->find($id); + + if ($rating) { + $rating->delete(); + } echo json_encode(['status' => 'success']); } else { diff --git a/app/Controllers/RekUserController.php b/app/Controllers/RekUserController.php index 81273fd00..c363d7d2f 100644 --- a/app/Controllers/RekUserController.php +++ b/app/Controllers/RekUserController.php @@ -2,9 +2,9 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\RekUser; +use Illuminate\Http\Request; class RekUserController extends BaseController { @@ -45,9 +45,10 @@ public function index(): string /** * Покупка рекламы * + * @param Request $request * @return string */ - public function create(): string + public function create(Request $request): string { if (! getUser()) { abort(403, 'Для покупки рекламы необходимо авторизоваться!'); @@ -71,12 +72,12 @@ public function create(): string abort('default', 'Вы уже разместили рекламу, запрещено добавлять несколько сайтов подряд!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $site = check(Request::input('site')); - $name = check(Request::input('name')); - $color = check(Request::input('color')); - $bold = empty(Request::input('bold')) ? 0 : 1; + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $site = check($request->input('site')); + $name = check($request->input('name')); + $color = check($request->input('color')); + $bold = empty($request->input('bold')) ? 0 : 1; $price = setting('rekuserprice'); @@ -120,7 +121,7 @@ public function create(): string setFlash('success', 'Рекламная ссылка успешно размещена'); redirect('/reklama'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } diff --git a/app/Controllers/SocialController.php b/app/Controllers/SocialController.php index a2b0a8435..a5825cb25 100644 --- a/app/Controllers/SocialController.php +++ b/app/Controllers/SocialController.php @@ -2,10 +2,10 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Social; use Curl\Curl; +use Illuminate\Http\Request; class SocialController extends BaseController { @@ -25,12 +25,16 @@ public function __construct() /** * Главная страница + * + * @param Request $request + * @return string + * @throws \ErrorException */ - public function index() + public function index(Request $request): string { - $token = check(Request::input('token')); + $token = check($request->input('token')); - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { $curl = new Curl(); $network = $curl->get('//ulogin.ru/token.php', [ @@ -74,10 +78,14 @@ public function index() /** * Удаление привязки + * + * @param int $id + * @param Request $request + * @throws \Exception */ - public function delete($id) + public function delete(int $id, Request $request): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); $social = Social::query()->where('user_id', $this->user->id)->find($id); diff --git a/app/Controllers/TransferController.php b/app/Controllers/TransferController.php index 94c615668..69b2497e5 100644 --- a/app/Controllers/TransferController.php +++ b/app/Controllers/TransferController.php @@ -2,11 +2,11 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Transfer; use App\Models\User; use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Http\Request; class TransferController extends BaseController { @@ -23,8 +23,8 @@ public function __construct() if (! getUser()) { abort(403, 'Для совершения операций необходимо авторизоваться'); } - - $login = check(Request::input('user')); + $request = Request::createFromGlobals(); + $login = check($request->input('user')); $this->user = User::query()->where('login', $login)->first(); } @@ -41,13 +41,14 @@ public function index(): string /** * Перевод денег * + * @param Request $request * @return void */ - public function send(): void + public function send(Request $request): void { - $money = int(Request::input('money')); - $msg = check(Request::input('msg')); - $token = check(Request::input('token')); + $money = int($request->input('money')); + $msg = check($request->input('msg')); + $token = check($request->input('token')); $validator = new Validator(); $validator @@ -89,7 +90,7 @@ public function send(): void setFlash('success', 'Перевод успешно завершен!'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } diff --git a/app/Controllers/User/BanController.php b/app/Controllers/User/BanController.php index 6eab27e57..36d4c6849 100644 --- a/app/Controllers/User/BanController.php +++ b/app/Controllers/User/BanController.php @@ -2,20 +2,21 @@ namespace App\Controllers\User; -use App\Classes\Request; use App\Classes\Validator; use App\Controllers\BaseController; use App\Models\Banhist; use App\Models\User; +use Illuminate\Http\Request; class BanController extends BaseController { /** * Бан пользователя * + * @param Request $request * @return string */ - public function ban(): string + public function ban(Request $request): string { if (! $user = getUser()) { abort(403, 'Вы не авторизованы!'); @@ -42,8 +43,8 @@ public function ban(): string ->orderBy('created_at', 'desc') ->first(); - if ($banhist && Request::isMethod('post')) { - $msg = check(Request::input('msg')); + if ($banhist && $request->isMethod('post')) { + $msg = check($request->input('msg')); $sendUser = getUserById($banhist->send_user_id); @@ -67,7 +68,7 @@ public function ban(): string setFlash('success', 'Объяснение успешно отправлено!'); redirect('/ban'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } diff --git a/app/Controllers/User/ListController.php b/app/Controllers/User/ListController.php index 9a4440ac4..e426705f8 100644 --- a/app/Controllers/User/ListController.php +++ b/app/Controllers/User/ListController.php @@ -2,18 +2,19 @@ namespace App\Controllers\User; -use App\Classes\Request; use App\Controllers\BaseController; use App\Models\User; +use Illuminate\Http\Request; class ListController extends BaseController { /** * Список пользователей * + * @param Request $request * @return string */ - public function userlist(): string + public function userlist(Request $request): string { $total = User::query()->count(); $page = paginate(setting('userlist'), $total); @@ -25,9 +26,9 @@ public function userlist(): string ->limit($page->limit) ->get(); - $user = check(Request::input('user', getUser('login'))); + $user = check($request->input('user', getUser('login'))); - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { $position = User::query() ->orderBy('point', 'desc') @@ -69,9 +70,10 @@ public function adminlist(): string /** * Рейтинг репутации * + * @param Request $request * @return string */ - public function authoritylist(): string + public function authoritylist(Request $request): string { $total = User::query()->count(); $page = paginate(setting('avtorlist'), $total); @@ -83,9 +85,9 @@ public function authoritylist(): string ->limit($page->limit) ->get(); - $user = check(Request::input('user', getUser('login'))); + $user = check($request->input('user', getUser('login'))); - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { $position = User::query() ->orderBy('rating', 'desc') @@ -112,9 +114,10 @@ public function authoritylist(): string /** * Рейтинг толстосумов * + * @param Request $request * @return string */ - public function ratinglist(): string + public function ratinglist(Request $request): string { $total = User::query()->count(); $page = paginate(setting('userlist'), $total); @@ -126,9 +129,9 @@ public function ratinglist(): string ->limit($page->limit) ->get(); - $user = check(Request::input('user', getUser('login'))); + $user = check($request->input('user', getUser('login'))); - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { $position = User::query() ->orderBy('money', 'desc') diff --git a/app/Controllers/User/SearchController.php b/app/Controllers/User/SearchController.php index 1beb4a634..b2e3cb420 100644 --- a/app/Controllers/User/SearchController.php +++ b/app/Controllers/User/SearchController.php @@ -2,9 +2,9 @@ namespace App\Controllers\User; -use App\Classes\Request; use App\Controllers\BaseController; use App\Models\User; +use Illuminate\Http\Request; class SearchController extends BaseController { @@ -21,14 +21,16 @@ public function index(): string /** * Поиск пользователя * + * @param Request $request * @return string */ - public function search(): string + public function search(Request $request): string { - $find = check(Request::input('find')); + $find = check($request->input('find')); + $strlen = utfStrlen($find); - if (utfStrlen($find) < 2 || utfStrlen($find) > 20) { - setInput(Request::all()); + if ($strlen < 2 || $strlen > 20) { + setInput($request->all()); setFlash('danger', ['find' => 'Слишком короткий или длинный запрос, от 2 до 20 символов!']); redirect('/searchusers'); } @@ -49,7 +51,7 @@ public function search(): string * @param string $letter * @return string */ - public function sort($letter): string + public function sort(string $letter): string { $search = is_numeric($letter) ? "RLIKE '^[-0-9]'" : "LIKE '$letter%'"; diff --git a/app/Controllers/User/UserController.php b/app/Controllers/User/UserController.php index 01f8afb6f..681decf69 100644 --- a/app/Controllers/User/UserController.php +++ b/app/Controllers/User/UserController.php @@ -2,7 +2,6 @@ namespace App\Controllers\User; -use App\Classes\Request; use App\Classes\Validator; use App\Controllers\BaseController; use App\Models\BlackList; @@ -13,6 +12,7 @@ use ErrorException; use Exception; use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Http\Request; class UserController extends BaseController { @@ -22,7 +22,7 @@ class UserController extends BaseController * @param string $login * @return string */ - public function index($login): string + public function index(string $login): string { if (! $user = getUserByLogin($login)) { abort(404, 'Пользователя с данным логином не существует!'); @@ -39,10 +39,11 @@ public function index($login): string /** * Заметка * - * @param string $login + * @param string $login + * @param Request $request * @return string */ - public function note($login): string + public function note(string $login, Request $request): string { if (! isAdmin()) { abort(403, 'Данная страница доступна только администрации!'); @@ -52,10 +53,10 @@ public function note($login): string abort(404, 'Пользователя с данным логином не существует!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $notice = check(Request::input('notice')); - $token = check(Request::input('token')); + $notice = check($request->input('notice')); + $token = check($request->input('token')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['notice' => 'Неверный идентификатор сессии, повторите действие!']) @@ -73,7 +74,7 @@ public function note($login): string redirect('/users/'.$user->login); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -84,10 +85,11 @@ public function note($login): string /** * Регистрация * + * @param Request $request * @return string * @throws ErrorException */ - public function register(): string + public function register(Request $request): string { if (getUser()) { abort('403', 'Вы уже регистрировались, запрещено создавать несколько аккаунтов!'); @@ -97,15 +99,15 @@ public function register(): string abort('default', 'Регистрация временно приостановлена, пожалуйста зайдите позже!'); } - if (Request::isMethod('post')) { - if (Request::has('login') && Request::has('password')) { - $login = check(Request::input('login')); - $password = trim(Request::input('password')); - $password2 = trim(Request::input('password2')); - $invite = setting('invite') ? check(Request::input('invite')) : ''; - $email = strtolower(check(Request::input('email'))); + if ($request->isMethod('post')) { + if ($request->has('login') && $request->has('password')) { + $login = check($request->input('login')); + $password = trim($request->input('password')); + $password2 = trim($request->input('password2')); + $invite = setting('invite') ? check($request->input('invite')) : ''; + $email = strtolower(check($request->input('email'))); $domain = utfSubstr(strrchr($email, '@'), 1); - $gender = Request::input('gender') === 'male' ? 'male' : 'female'; + $gender = $request->input('gender') === 'male' ? 'male' : 'female'; $activateKey = null; $level = User::USER; @@ -220,13 +222,13 @@ public function register(): string redirect('/'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } - if (Request::has('token')) { - User::socialAuth(Request::input('token')); + if ($request->has('token')) { + User::socialAuth($request->input('token')); } } @@ -236,22 +238,23 @@ public function register(): string /** * Авторизация * + * @param Request $request * @return string * @throws ErrorException */ - public function login(): string + public function login(Request $request): string { if (getUser()) { abort('403', 'Вы уже авторизованы!'); } $cooklog = isset($_COOKIE['login']) ? check($_COOKIE['login']): ''; - if (Request::isMethod('post')) { - if (Request::has('login') && Request::has('pass')) { - $return = Request::input('return', ''); - $login = check(utfLower(Request::input('login'))); - $pass = trim(Request::input('pass')); - $remember = Request::input('remember'); + if ($request->isMethod('post')) { + if ($request->has('login') && $request->has('pass')) { + $return = $request->input('return', ''); + $login = check(utfLower($request->input('login'))); + $pass = trim($request->input('pass')); + $remember = $request->input('remember'); /** @var User $user */ if ($user = User::auth($login, $pass, $remember)) { @@ -264,12 +267,12 @@ public function login(): string } } - setInput(Request::all()); + setInput($request->all()); setFlash('danger', 'Ошибка авторизации. Неправильный логин или пароль!'); } - if (Request::has('token')) { - User::socialAuth(Request::input('token')); + if ($request->has('token')) { + User::socialAuth($request->input('token')); } } @@ -279,11 +282,12 @@ public function login(): string /** * Выход * + * @param Request $request * @return void */ - public function logout(): void + public function logout(Request $request): void { - $token = check(Request::input('token')); + $token = check($request->input('token')); $domain = siteDomain(siteUrl()); if ($token === $_SESSION['token']) { @@ -301,27 +305,28 @@ public function logout(): void /** * Редактирование профиля * + * @param Request $request * @return string */ - public function profile(): string + public function profile(Request $request): string { if (! $user = getUser()) { abort(403, 'Авторизуйтесь для изменения данных в профиле!'); } - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $info = check(Request::input('info')); - $name = check(Request::input('name')); - $country = check(Request::input('country')); - $city = check(Request::input('city')); - $phone = preg_replace('/\D/', '', Request::input('phone')); - $icq = preg_replace('/\D/', '', Request::input('icq')); - $skype = check(strtolower(Request::input('skype'))); - $site = check(Request::input('site')); - $birthday = check(Request::input('birthday')); - $gender = Request::input('gender') === 'male' ? 'male' : 'female'; + $token = check($request->input('token')); + $info = check($request->input('info')); + $name = check($request->input('name')); + $country = check($request->input('country')); + $city = check($request->input('city')); + $phone = preg_replace('/\D/', '', $request->input('phone')); + $icq = preg_replace('/\D/', '', $request->input('icq')); + $skype = check(strtolower($request->input('skype'))); + $site = check($request->input('site')); + $birthday = check($request->input('birthday')); + $gender = $request->input('gender') === 'male' ? 'male' : 'female'; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -355,7 +360,7 @@ public function profile(): string redirect('/profile'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -363,12 +368,13 @@ public function profile(): string return view('users/profile', compact('user')); } - /* + /** * Подтверждение регистрации * + * @param Request $request * @return string */ - public function key(): string + public function key(Request $request): string { if (! $user = getUser()) { abort(403, 'Для подтверждения регистрации необходимо быть авторизованным!'); @@ -382,8 +388,8 @@ public function key(): string abort(403, 'Вашему профилю не требуется подтверждение регистрации!'); } - if (Request::has('code')) { - $code = check(trim(Request::input('code'))); + if ($request->has('code')) { + $code = check(trim($request->input('code'))); if ($code === $user->confirmregkey) { @@ -403,12 +409,13 @@ public function key(): string return view('users/key'); } - /* + /** * Настройки * + * @param Request $request * @return string */ - public function setting(): string + public function setting(Request $request): string { if (! $user = getUser()) { abort(403, 'Для изменения настроек необходимо авторизоваться!'); @@ -418,14 +425,14 @@ public function setting(): string $setting['languages'] = array_map('basename', glob(RESOURCES . '/lang/*', GLOB_ONLYDIR)); $setting['timezones'] = range(-12, 12); - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $themes = check(Request::input('themes')); - $timezone = check(Request::input('timezone', 0)); - $language = check(Request::input('language')); - $notify = Request::input('notify') ? 1 : 0; - $subscribe = Request::input('subscribe') ? str_random(32) : null; + $token = check($request->input('token')); + $themes = check($request->input('themes')); + $timezone = check($request->input('timezone', 0)); + $language = check($request->input('language')); + $notify = $request->input('notify') ? 1 : 0; + $subscribe = $request->input('subscribe') ? str_random(32) : null; $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -448,7 +455,7 @@ public function setting(): string setFlash('success', 'Настройки успешно изменены!'); redirect('/settings'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -473,18 +480,19 @@ public function account(): string /** * Инициализация изменения email * + * @param Request $request * @return void * @throws Exception */ - public function changeMail(): void + public function changeMail(Request $request): void { if (! $user = getUser()) { abort(403, 'Для изменения данных необходимо авторизоваться!'); } - $token = check(Request::input('token')); - $email = check(strtolower(Request::input('email'))); - $password = check(Request::input('password')); + $token = check($request->input('token')); + $email = check(strtolower($request->input('email'))); + $password = check($request->input('password')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -523,7 +531,7 @@ public function changeMail(): void setFlash('success', 'На новый адрес почты отправлено письмо для подтверждения!'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } @@ -533,16 +541,17 @@ public function changeMail(): void /** * Изменение email * + * @param Request $request * @return void * @throws Exception */ - public function editMail(): void + public function editMail(Request $request): void { if (! $user = getUser()) { abort(403, 'Для изменения данных необходимо авторизоваться!'); } - $key = check(Request::input('key')); + $key = check($request->input('key')); ChangeMail::query()->where('created_at', '<', SITETIME)->delete(); @@ -581,16 +590,17 @@ public function editMail(): void /** * Изменение статуса * + * @param Request $request * @return void */ - public function editStatus(): void + public function editStatus(Request $request): void { if (! $user = getUser()) { abort(403, 'Для изменения данных необходимо авторизоваться!'); } - $token = check(Request::input('token')); - $status = check(Request::input('status')); + $token = check($request->input('token')); + $status = check($request->input('status')); $cost = $status ? setting('editstatusmoney') : 0; $validator = new Validator(); @@ -616,7 +626,7 @@ public function editStatus(): void setFlash('success', 'Ваш статус успешно изменен!'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } @@ -626,18 +636,19 @@ public function editStatus(): void /** * Изменение пароля * + * @param Request $request * @return void */ - public function editPassword(): void + public function editPassword(Request $request): void { if (! $user = getUser()) { abort(403, 'Для изменения данных необходимо авторизоваться!'); } - $token = check(Request::input('token')); - $newpass = check(Request::input('newpass')); - $newpass2 = check(Request::input('newpass2')); - $oldpass = check(Request::input('oldpass')); + $token = check($request->input('token')); + $newpass = check($request->input('newpass')); + $newpass2 = check($request->input('newpass2')); + $oldpass = check($request->input('oldpass')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -667,7 +678,7 @@ public function editPassword(): void setFlash('success', 'Пароль успешно изменен!'); redirect('/login'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); redirect('/accounts'); } @@ -676,15 +687,16 @@ public function editPassword(): void /** * Генерация ключа * + * @param Request $request * @return void */ - public function apikey(): void + public function apikey(Request $request): void { if (! $user = getUser()) { abort(403, 'Для изменения данных необходимо авторизоваться!'); } - $token = check(Request::input('token')); + $token = check($request->input('token')); if ($token === $_SESSION['token']) { diff --git a/app/Controllers/VoteController.php b/app/Controllers/VoteController.php index ded21f431..94c25681f 100644 --- a/app/Controllers/VoteController.php +++ b/app/Controllers/VoteController.php @@ -2,11 +2,11 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Polling; use App\Models\Vote; use App\Models\VoteAnswer; +use Illuminate\Http\Request; class VoteController extends BaseController { @@ -34,13 +34,15 @@ public function index(): string /** * Просмотр голосования * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function view($id): string + public function view(int $id, Request $request): string { - $show = Request::input('show'); + $show = $request->input('show'); + /** @var Vote $vote */ $vote = Vote::query()->find($id); if (! $vote) { @@ -64,9 +66,9 @@ public function view($id): string ->where('user_id', getUser('id')) ->first(); - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $poll = int(Request::input('poll')); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $poll = int($request->input('poll')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -94,7 +96,7 @@ public function view($id): string setFlash('success', 'Ваш голос успешно принят!'); redirect('/votes/'.$vote->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } @@ -117,8 +119,9 @@ public function view($id): string * @param int $id * @return string */ - public function voters($id): string + public function voters(int $id): string { + /** @var Vote $vote */ $vote = Vote::query()->find($id); if (! $vote) { @@ -162,8 +165,9 @@ public function history(): string * @param int $id * @return string */ - public function viewHistory($id): string + public function viewHistory(int $id): string { + /** @var Vote $vote */ $vote = Vote::query()->find($id); if (! $vote) { @@ -198,15 +202,16 @@ public function viewHistory($id): string /** * Создание голосования * + * @param Request $request * @return string */ - public function create(): string + public function create(Request $request): string { - if (Request::isMethod('post')) { + if ($request->isMethod('post')) { - $token = check(Request::input('token')); - $question = check(Request::input('question')); - $answers = check(Request::input('answer')); + $token = check($request->input('token')); + $question = check($request->input('question')); + $answers = check($request->input('answer')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -225,6 +230,7 @@ public function create(): string if ($validator->isValid()) { + /** @var Vote $vote */ $vote = Vote::query()->create([ 'title' => $question, 'created_at' => SITETIME, @@ -243,7 +249,7 @@ public function create(): string setFlash('success', 'Голосование успешно создано!'); redirect('/votes/' . $vote->id); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } } diff --git a/app/Controllers/WallController.php b/app/Controllers/WallController.php index c3b183fe1..297e1f078 100644 --- a/app/Controllers/WallController.php +++ b/app/Controllers/WallController.php @@ -2,13 +2,13 @@ namespace App\Controllers; -use App\Classes\Request; use App\Classes\Validator; use App\Models\Flood; use App\Models\Ignore; use App\Models\User; use App\Models\Wall; use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Http\Request; class WallController extends BaseController { @@ -18,7 +18,7 @@ class WallController extends BaseController * @param string $login * @return string */ - public function index($login): string + public function index(string $login): string { $user = User::query()->where('login', $login)->first(); @@ -50,10 +50,11 @@ public function index($login): string /** * Добавление сообщения * - * @param string $login + * @param string $login + * @param Request $request * @return void */ - public function create($login): void + public function create($login, Request $request): void { if (! getUser()) { abort(403, 'Для отправки сообщений необходимо авторизоваться!'); @@ -65,9 +66,9 @@ public function create($login): void abort(404, 'Пользователь не найден!'); } - if (Request::isMethod('post')) { - $token = check(Request::input('token')); - $msg = check(Request::input('msg')); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $msg = check($request->input('msg')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -105,7 +106,7 @@ public function create($login): void setFlash('success', 'Запись успешно добавлена!'); } else { - setInput(Request::all()); + setInput($request->all()); setFlash('danger', $validator->getErrors()); } @@ -116,19 +117,20 @@ public function create($login): void /** * Удаление сообщений * - * @param string $login + * @param string $login + * @param Request $request * @return void */ - public function delete($login): void + public function delete(string $login, Request $request): void { - $id = int(Request::input('id')); - $token = check(Request::input('token')); + $id = int($request->input('id')); + $token = check($request->input('token')); $user = User::query()->where('login', $login)->first(); $validator = new Validator(); $validator - ->true(Request::ajax(), 'Это не ajax запрос!') + ->true($request->ajax(), 'Это не ajax запрос!') ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($id, 'Не выбрана запись для удаление!') ->notEmpty($user, 'Пользователь не найден!') diff --git a/app/Models/Down.php b/app/Models/Down.php index 9531f3e9e..f615ed2a0 100644 --- a/app/Models/Down.php +++ b/app/Models/Down.php @@ -27,6 +27,7 @@ * @property int loads * @property int active * @property int updated_at + * @property Collection files */ class Down extends BaseModel { @@ -104,7 +105,7 @@ public function files(): MorphMany */ public function getFiles(): Collection { - return $this->files->filter(function ($value, $key) { + return $this->files->filter(function (File $value, $key) { return ! $value->isImage(); }); } @@ -116,7 +117,7 @@ public function getFiles(): Collection */ public function getImages(): Collection { - return $this->files->filter(function ($value, $key) { + return $this->files->filter(function (File $value, $key) { return $value->isImage(); }); } diff --git a/app/Models/File.php b/app/Models/File.php index 676119e00..ba67acf32 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -15,6 +15,7 @@ * @property int size * @property int user_id * @property int created_at + * @property string extension */ class File extends BaseModel { diff --git a/app/Models/Forum.php b/app/Models/Forum.php index cdacdd70f..dd1897f56 100644 --- a/app/Models/Forum.php +++ b/app/Models/Forum.php @@ -17,6 +17,7 @@ * @property int count_posts * @property int last_topic_id * @property int closed + * @property Forum parent */ class Forum extends BaseModel { diff --git a/app/Models/Post.php b/app/Models/Post.php index 64338aa95..c51facdb5 100644 --- a/app/Models/Post.php +++ b/app/Models/Post.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\MorphMany; @@ -18,6 +19,7 @@ * @property string brow * @property int edit_user_id * @property int updated_at + * @property Collection files */ class Post extends BaseModel { diff --git a/app/Models/Topic.php b/app/Models/Topic.php index 2de9f5222..fffa26f3d 100644 --- a/app/Models/Topic.php +++ b/app/Models/Topic.php @@ -21,6 +21,7 @@ * @property string note * @property int last_post_id * @property int created_at + * @property Forum forum */ class Topic extends BaseModel { diff --git a/app/Models/Vote.php b/app/Models/Vote.php index d2c5fffc7..4d16ec20b 100644 --- a/app/Models/Vote.php +++ b/app/Models/Vote.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\MorphMany; @@ -15,6 +16,8 @@ * @property int closed * @property int created_at * @property int topic_id + * @property Topic topic + * @property Collection answers */ class Vote extends BaseModel { diff --git a/app/helpers.php b/app/helpers.php index 4316dcffa..c29422a17 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -1,6 +1,6 @@ is('/', 'login', 'register', 'recovery', 'restore', 'ban', 'closed')) { return false; } - $query = Request::has('return') ? Request::input('return') : Request::path(); + $query = $request->has('return') ? $request->input('return') : $request->path(); return '?return=' . urlencode(! $url ? $query : $url); } @@ -1587,6 +1590,7 @@ function view($view, array $params = []) */ function abort($code, $message = null) { + $request = Request::createFromGlobals(); $protocol = server('SERVER_PROTOCOL'); $referer = server('HTTP_REFERER') ?? null; @@ -1615,7 +1619,7 @@ function abort($code, $message = null) ]); } - if (Request::ajax()) { + if ($request->ajax()) { header($protocol . ' 200 OK'); exit(json_encode([ @@ -1901,7 +1905,8 @@ function getBrowser($userAgent = null) */ function server($key = null, $default = null) { - $server = Request::server($key, $default); + $request = Request::createFromGlobals(); + $server = $request->server($key, $default); if ($key === 'REQUEST_URI') { $server = urldecode($server); @@ -1931,7 +1936,7 @@ function getUserByLogin($login): ?User * @param int $id ID пользователя * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|null */ -function getUserById($id): ?User +function getUserById(int $id): ?User { return User::query()->find($id); } @@ -2053,7 +2058,8 @@ function pagination($page) */ function paginate(int $limit, int $total) { - $current = int(Request::input('page')); + $request = Request::createFromGlobals(); + $current = int($request->input('page')); if ($current < 1) { $current = 1; @@ -2296,13 +2302,15 @@ function parseVersion($version) */ function captchaVerify(): bool { + $request = Request::createFromGlobals(); + if (setting('recaptcha_public') && setting('recaptcha_private')) { $recaptcha = new ReCaptcha(setting('recaptcha_private')); - $response = $recaptcha->verify(Request::input('g-recaptcha-response'), getIp()); + $response = $recaptcha->verify($request->input('g-recaptcha-response'), getIp()); return $response->isSuccess(); } - return check(strtolower(Request::input('protect'))) === $_SESSION['protect']; + return check(strtolower($request->input('protect'))) === $_SESSION['protect']; } /** diff --git a/app/start.php b/app/start.php index 7bf8751c4..9b11b0fce 100644 --- a/app/start.php +++ b/app/start.php @@ -1,10 +1,10 @@ level === User::BANNED && ! Request::is('ban', 'rules', 'logout')) { + if ($user->level === User::BANNED && ! $request->is('ban', 'rules', 'logout')) { redirect('/ban?user=' . $user->login); } // Подтверждение регистрации - if ($user->level === User::PENDED && setting('regkeys') && ! Request::is('key', 'ban', 'login', 'logout')) { + if ($user->level === User::PENDED && setting('regkeys') && ! $request->is('key', 'ban', 'login', 'logout')) { redirect('/key?user=' . $user->login); } diff --git a/public/install/index.php b/public/install/index.php index 46c5b6651..b82b601f2 100644 --- a/public/install/index.php +++ b/public/install/index.php @@ -1,8 +1,8 @@
- + has('act')): ?>

Шаг 1 - проверка требований

@@ -262,28 +262,28 @@ function getModuleSetting($pModuleName, $pSettings) { - + input('act') === 'status'): ?>

Шаг 2 - проверка статуса (установка)

getStatus()); ?>

Выполнить миграции

- + input('act') === 'migrate'): ?>

Шаг 3 - выполнение миграций (установка)

getMigrate()); ?>

Заполнить БД

- + input('act') === 'seed'): ?>

Шаг 4 - заполнение БД (установка)

getSeed()); ?>

Создать администратора

- + input('act') === 'account'): ?>

Шаг 5 - создание администратора (установка)

@@ -292,13 +292,13 @@ function getModuleSetting($pModuleName, $pSettings) { После окончания инсталляции необходимо удалить директории install и upgrade со всем содержимым навсегда, пароль и остальные данные вы сможете поменять в своем профиле

input('login')); + $password = check($request->input('password')); + $password2 = check($request->input('password2')); + $email = strtolower(check($request->input('email'))); ?> - + isMethod('post')): ?> = 3) { @@ -376,7 +376,7 @@ function getModuleSetting($pModuleName, $pSettings) { В поле ввода адреса сайта необходимо ввести адрес в который у вас распакован движок, если это поддомен или папка, то необходимо указать ее, к примеру http://wap.visavi.net

- + input('act') === 'finish'): ?>

Установка завершена

@@ -390,16 +390,16 @@ function getModuleSetting($pModuleName, $pSettings) { - + input('act') === 'status'): ?>

Шаг 2 - проверка статуса (обновление)

getStatus()); ?> Перейти к обновлению - + input('act') === 'rollback'): ?> getRollback()); ?> - + input('act') === 'migrate'): ?>

Обновление завершено

diff --git a/resources/views/app/_note.blade.php b/resources/views/app/_note.blade.php index 29347a4bc..7cf330769 100644 --- a/resources/views/app/_note.blade.php +++ b/resources/views/app/_note.blade.php @@ -1,12 +1,12 @@ @if (getUser()) @if (getUser('newprivat')) - @if (! App\Classes\Request::is('bans', 'key', 'messages', 'rules', 'closed', 'login', 'register')) + @if (! Illuminate\Http\Request::createFromGlobals()->is('bans', 'key', 'messages', 'rules', 'closed', 'login', 'register')) Приватное сообщение! {{ getUser('newprivat') }} @endif @endif @if (getUser('newwall')) - @if (! App\Classes\Request::is('bans', 'key', 'walls', 'rules', 'closed', 'login', 'register')) + @if (! Illuminate\Http\Request::createFromGlobals()->is('bans', 'key', 'walls', 'rules', 'closed', 'login', 'register')) Запись на стене! {{ getUser('newwall') }} @endif @endif From 425f957dfce4008088c3898ddfec6fbc720e8892 Mon Sep 17 00:00:00 2001 From: visavi Date: Sun, 14 Oct 2018 14:39:51 +0300 Subject: [PATCH 048/163] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80?= =?UTF-8?q?=D0=BE=D0=BB=D0=BB=D0=B5=D1=80=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/Admin/AntimatController.php | 9 ++- app/Controllers/Admin/BackupController.php | 6 +- app/Controllers/Admin/BanController.php | 15 ++-- app/Controllers/Admin/BanhistController.php | 6 +- app/Controllers/Admin/BlacklistController.php | 17 +++-- app/Controllers/Admin/BlogController.php | 38 ++++++---- app/Controllers/Admin/BoardController.php | 38 ++++++---- app/Controllers/Admin/CacheController.php | 6 +- app/Controllers/Admin/ChatController.php | 12 ++-- app/Controllers/Admin/CheckerController.php | 3 +- app/Controllers/Admin/DelUserController.php | 6 +- app/Controllers/Admin/DeliveryController.php | 5 +- app/Controllers/Admin/ErrorController.php | 6 +- app/Controllers/Admin/FilesController.php | 10 ++- app/Controllers/Admin/ForumController.php | 69 ++++++++++++------- app/Controllers/Admin/GuestbookController.php | 16 +++-- .../Admin/InvitationController.php | 18 +++-- app/Controllers/Admin/IpBanController.php | 9 ++- app/Controllers/Admin/LoadController.php | 53 +++++++++----- app/Controllers/Admin/LogController.php | 3 +- app/Controllers/Admin/NewsController.php | 21 ++++-- app/Controllers/Admin/NoticeController.php | 20 ++++-- app/Controllers/Admin/OfferController.php | 21 +++--- app/Controllers/Admin/PhotoController.php | 19 +++-- app/Controllers/Admin/ReglistController.php | 3 +- app/Controllers/Admin/RekUserController.php | 10 ++- app/Controllers/Admin/RuleController.php | 3 +- app/Controllers/Admin/SettingController.php | 3 +- app/Controllers/Admin/SmileController.php | 15 ++-- app/Controllers/Admin/SpamController.php | 6 +- app/Controllers/Admin/StatusController.php | 9 ++- app/Controllers/Admin/TransferController.php | 3 +- app/Controllers/Admin/UserController.php | 9 ++- app/Controllers/Admin/VoteController.php | 20 +++--- app/Models/Blog.php | 1 + app/Models/Board.php | 3 + app/Models/Category.php | 2 + app/Models/Down.php | 2 + app/Models/Forum.php | 3 + app/Models/Load.php | 3 + app/Models/Topic.php | 3 + app/Tasks/RestatementBoard.php | 1 - 42 files changed, 349 insertions(+), 176 deletions(-) diff --git a/app/Controllers/Admin/AntimatController.php b/app/Controllers/Admin/AntimatController.php index 92f156646..d8c1b59fa 100644 --- a/app/Controllers/Admin/AntimatController.php +++ b/app/Controllers/Admin/AntimatController.php @@ -24,9 +24,10 @@ public function __construct() /** * Главная страница * + * @param Request $request * @return string */ - public function index(): string + public function index(Request $request): string { if ($request->isMethod('post')) { $token = check($request->input('token')); @@ -63,10 +64,11 @@ public function index(): string /** * Удаление слова из списка * + * @param Request $request * @return void * @throws \Exception */ - public function delete(): void + public function delete(Request $request): void { $token = check($request->input('token')); $id = int($request->input('id')); @@ -92,9 +94,10 @@ public function delete(): void /** * Очистка списка слов * + * @param Request $request * @return void */ - public function clear(): void + public function clear(Request $request): void { $token = check($request->input('token')); diff --git a/app/Controllers/Admin/BackupController.php b/app/Controllers/Admin/BackupController.php index 3583f46ac..9a39eea47 100644 --- a/app/Controllers/Admin/BackupController.php +++ b/app/Controllers/Admin/BackupController.php @@ -45,9 +45,10 @@ public function index(): string /** * Создание нового бэкапа * + * @param Request $request * @return string */ - public function create(): string + public function create(Request $request): string { if ($request->isMethod('post')) { @@ -132,9 +133,10 @@ public function create(): string /** * Удаляет сохраненный бэкап * + * @param Request $request * @return void */ - public function delete(): void + public function delete(Request $request): void { $token = check($request->input('token')); $file = check($request->input('file')); diff --git a/app/Controllers/Admin/BanController.php b/app/Controllers/Admin/BanController.php index c29001180..74f6610fc 100644 --- a/app/Controllers/Admin/BanController.php +++ b/app/Controllers/Admin/BanController.php @@ -31,9 +31,10 @@ public function index(): string /** * Бан пользователя * + * @param Request $request * @return string */ - public function edit(): string + public function edit(Request $request): string { $login = check($request->input('user')); @@ -65,11 +66,11 @@ public function edit(): string if ($validator->isValid()) { if ($type === 'days') { - $time = $time * 3600 * 24; + $time *= 86400; } elseif ($type === 'hours') { - $time = $time * 3600; + $time *= 3600; } else { - $time = $time * 60; + $time *= 60; } $user->update([ @@ -106,9 +107,10 @@ public function edit(): string /** * Изменение бана * + * @param Request $request * @return string */ - public function change(): string + public function change(Request $request): string { $login = check($request->input('user')); @@ -165,9 +167,10 @@ public function change(): string /** * Снятие бана * + * @param Request $request * @return void */ - public function unban(): void + public function unban(Request $request): void { $token = check($request->input('token')); $login = check($request->input('user')); diff --git a/app/Controllers/Admin/BanhistController.php b/app/Controllers/Admin/BanhistController.php index f38e0efa9..536f3d4c0 100644 --- a/app/Controllers/Admin/BanhistController.php +++ b/app/Controllers/Admin/BanhistController.php @@ -41,9 +41,10 @@ public function index(): string /** * История банов * + * @param Request $request * @return string */ - public function view(): string + public function view(Request $request): string { $login = check($request->input('user')); @@ -70,9 +71,10 @@ public function view(): string /** * Удаление банов * + * @param Request $request * @return void */ - public function delete(): void + public function delete(Request $request): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); diff --git a/app/Controllers/Admin/BlacklistController.php b/app/Controllers/Admin/BlacklistController.php index 2fbcfad8c..4d62f452c 100644 --- a/app/Controllers/Admin/BlacklistController.php +++ b/app/Controllers/Admin/BlacklistController.php @@ -9,11 +9,6 @@ class BlacklistController extends AdminController { - /** - * @var array - */ - private $types; - /** * @var string */ @@ -30,10 +25,12 @@ public function __construct() abort(403, 'Доступ запрещен!'); } - $this->types = ['email', 'login', 'domain']; + $types = ['email', 'login', 'domain']; + + $request = Request::createFromGlobals(); $this->type = $request->input('type', 'email'); - if (! \in_array($this->type, $this->types, true)) { + if (! \in_array($this->type, $types, true)) { abort(404, 'Указанный тип не найден!'); } } @@ -41,9 +38,10 @@ public function __construct() /** * Главная страница * + * @param Request $request * @return string */ - public function index(): string + public function index(Request $request): string { $type = $this->type; @@ -105,9 +103,10 @@ public function index(): string /** * Удаление записей * + * @param Request $request * @return void */ - public function delete(): void + public function delete(Request $request): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); diff --git a/app/Controllers/Admin/BlogController.php b/app/Controllers/Admin/BlogController.php index 8688f141e..cfca8a0de 100644 --- a/app/Controllers/Admin/BlogController.php +++ b/app/Controllers/Admin/BlogController.php @@ -29,9 +29,10 @@ public function index(): string /** * Создание раздела * + * @param Request $request * @return void */ - public function create(): void + public function create(Request $request): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -48,6 +49,7 @@ public function create(): void $max = Category::query()->max('sort') + 1; + /** @var Category $category */ $category = Category::query()->create([ 'name' => $name, 'sort' => $max, @@ -66,15 +68,17 @@ public function create(): void /** * Редактирование раздела * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit(int $id): string + public function edit(int $id, Request $request): string { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); } + /** @var Category $category */ $category = Category::query()->with('children')->find($id); if (! $category) { @@ -125,16 +129,18 @@ public function edit(int $id): string /** * Удаление раздела * - * @param int $id + * @param int $id + * @param Request $request * @return void * @throws \Exception */ - public function delete(int $id): void + public function delete(int $id, Request $request): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); } + /** @var Category $category */ $category = Category::query()->with('children')->find($id); if (! $category) { @@ -167,9 +173,10 @@ public function delete(int $id): void /** * Пересчет данных * + * @param Request $request * @return void */ - public function restatement(): void + public function restatement(Request $request): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -221,11 +228,13 @@ public function blog(int $id): string /** * Редактирование статьи * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function editBlog(int $id): string + public function editBlog(int $id, Request $request): string { + /** @var Blog $blog */ $blog = Blog::query()->find($id); if (! $blog) { @@ -274,11 +283,13 @@ public function editBlog(int $id): string /** * Перенос статьи * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function moveBlog(int $id): string + public function moveBlog(int $id, Request $request): string { + /** @var Blog $blog */ $blog = Blog::query()->find($id); if (! $blog) { @@ -290,6 +301,7 @@ public function moveBlog(int $id): string $token = check($request->input('token')); $cid = int($request->input('cid')); + /** @var Category $category */ $category = Category::query()->find($cid); $validator = new Validator(); @@ -332,15 +344,17 @@ public function moveBlog(int $id): string /** * Удаление статьи * - * @param int $id + * @param int $id + * @param Request $request * @return void * @throws \Exception */ - public function deleteBlog(int $id): void + public function deleteBlog(int $id, Request $request): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); + /** @var Blog $blog */ $blog = Blog::query()->find($id); if (! $blog) { diff --git a/app/Controllers/Admin/BoardController.php b/app/Controllers/Admin/BoardController.php index 009aba1dd..09a57d212 100644 --- a/app/Controllers/Admin/BoardController.php +++ b/app/Controllers/Admin/BoardController.php @@ -7,6 +7,7 @@ use App\Models\Item; use App\Models\User; use Exception; +use Illuminate\Database\Query\Builder; use Illuminate\Http\Request; class BoardController extends AdminController @@ -22,6 +23,7 @@ public function index($id = null): string $board = null; if ($id) { + /** @var Board $board */ $board = Board::query()->find($id); if (! $board) { @@ -30,7 +32,7 @@ public function index($id = null): string } $total = Item::query() - ->when($board, function ($query) use ($board) { + ->when($board, function (Builder $query) use ($board) { return $query->where('board_id', $board->id); }) ->where('expires_at', '>', SITETIME) @@ -39,7 +41,7 @@ public function index($id = null): string $page = paginate(10, $total); $items = Item::query() - ->when($board, function ($query) use ($board) { + ->when($board, function (Builder $query) use ($board) { return $query->where('board_id', $board->id); }) ->where('expires_at', '>', SITETIME) @@ -79,9 +81,10 @@ public function categories(): string /** * Создание раздела * + * @param Request $request * @return void */ - public function create(): void + public function create(Request $request): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -98,6 +101,7 @@ public function create(): void $max = Board::query()->max('sort') + 1; + /** @var Board $board */ $board = Board::query()->create([ 'name' => $name, 'sort' => $max, @@ -116,15 +120,17 @@ public function create(): void /** * Редактирование раздела * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit(int $id): string + public function edit(int $id, Request $request): string { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); } + /** @var Board $board */ $board = Board::query()->with('children')->find($id); if (! $board) { @@ -175,15 +181,17 @@ public function edit(int $id): string /** * Удаление раздела * - * @param int $id + * @param int $id + * @param Request $request * @throws Exception */ - public function delete(int $id): void + public function delete(int $id, Request $request): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); } + /** @var Board $board */ $board = Board::query()->with('children')->find($id); if (! $board) { @@ -216,11 +224,13 @@ public function delete(int $id): void /** * Редактирование объявления * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function editItem(int $id): string + public function editItem(int $id, Request $request): string { + /** @var Item $item */ $item = Item::query()->find($id); if (! $item) { @@ -235,6 +245,7 @@ public function editItem(int $id): string $price = check($request->input('price')); $phone = preg_replace('/\D/', '', $request->input('phone')); + /** @var Board $board */ $board = Board::query()->find($bid); $validator = new Validator(); @@ -285,13 +296,15 @@ public function editItem(int $id): string /** * Удаление объявления * - * @param int $id + * @param int $id + * @param Request $request * @throws Exception */ - public function deleteItem(int $id): void + public function deleteItem(int $id, Request $request): void { $token = check($request->input('token')); + /** @var Item $item */ $item = Item::query()->find($id); if (! $item) { @@ -318,9 +331,10 @@ public function deleteItem(int $id): void /** * Пересчет голосов * + * @param Request $request * @return void */ - public function restatement(): void + public function restatement(Request $request): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); diff --git a/app/Controllers/Admin/CacheController.php b/app/Controllers/Admin/CacheController.php index a775cb2e0..b96d2d6ef 100644 --- a/app/Controllers/Admin/CacheController.php +++ b/app/Controllers/Admin/CacheController.php @@ -22,9 +22,10 @@ public function __construct() /** * Главная страница * + * @param Request $request * @return string */ - public function index(): string + public function index(Request $request): string { $type = check($request->input('type', 'files')); @@ -47,9 +48,10 @@ public function index(): string /** * Очистка кеша * + * @param Request $request * @return void */ - public function clear(): void + public function clear(Request $request): void { $token = check($request->input('token')); $type = check($request->input('type', 'files')); diff --git a/app/Controllers/Admin/ChatController.php b/app/Controllers/Admin/ChatController.php index 98eb7da0d..0d8808dde 100644 --- a/app/Controllers/Admin/ChatController.php +++ b/app/Controllers/Admin/ChatController.php @@ -12,9 +12,10 @@ class ChatController extends AdminController /** * Главная страница * + * @param Request $request * @return string */ - public function index(): string + public function index(Request $request): string { if (getUser('newchat') !== statsNewChat()) { getUser()->update([ @@ -81,10 +82,11 @@ public function index(): string /** * Редактирование сообщения * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit(int $id): string + public function edit(int $id, Request $request): string { $page = int($request->input('page', 1)); @@ -92,6 +94,7 @@ public function edit(int $id): string abort(403); } + /** @var Chat $post */ $post = Chat::query()->where('user_id', getUser('id'))->find($id); if (! $post) { @@ -133,9 +136,10 @@ public function edit(int $id): string /** * Очистка чата * + * @param Request $request * @return void */ - public function clear(): void + public function clear(Request $request): void { $token = check($request->input('token')); diff --git a/app/Controllers/Admin/CheckerController.php b/app/Controllers/Admin/CheckerController.php index 48d642694..912273b0e 100644 --- a/app/Controllers/Admin/CheckerController.php +++ b/app/Controllers/Admin/CheckerController.php @@ -43,9 +43,10 @@ public function index(): string /** * Сканирование сайта * + * @param Request $request * @return void */ - public function scan(): void + public function scan(Request $request): void { $token = check($request->input('token')); diff --git a/app/Controllers/Admin/DelUserController.php b/app/Controllers/Admin/DelUserController.php index a3b463afe..556890f15 100644 --- a/app/Controllers/Admin/DelUserController.php +++ b/app/Controllers/Admin/DelUserController.php @@ -23,9 +23,10 @@ public function __construct() /** * Главная страница * + * @param Request $request * @return string */ - public function index(): string + public function index(Request $request): string { $users = collect(); $period = check($request->input('period')); @@ -55,9 +56,10 @@ public function index(): string /** * Очистка пользователей * + * @param Request $request * @return void */ - public function clear(): void + public function clear(Request $request): void { $token = check($request->input('token')); $period = check($request->input('period')); diff --git a/app/Controllers/Admin/DeliveryController.php b/app/Controllers/Admin/DeliveryController.php index cd07e424a..c119921a5 100644 --- a/app/Controllers/Admin/DeliveryController.php +++ b/app/Controllers/Admin/DeliveryController.php @@ -4,6 +4,7 @@ use App\Classes\Validator; use App\Models\User; +use Illuminate\Database\Eloquent\Collection; use Illuminate\Http\Request; class DeliveryController extends AdminController @@ -23,9 +24,10 @@ public function __construct() /** * Главная страница * + * @param Request $request * @return string */ - public function index(): string + public function index(Request $request): string { if ($request->isMethod('post')) { @@ -58,6 +60,7 @@ public function index(): string $users = User::query()->whereIn('level', User::USER_GROUPS)->get(); } + /** @var Collection $users */ $users = $users->filter(function ($value, $key) { return $value->id !== getUser('id'); }); diff --git a/app/Controllers/Admin/ErrorController.php b/app/Controllers/Admin/ErrorController.php index 4bb7c33e7..29e7c7e3a 100644 --- a/app/Controllers/Admin/ErrorController.php +++ b/app/Controllers/Admin/ErrorController.php @@ -30,8 +30,9 @@ public function __construct() abort(403, 'Доступ запрещен!'); } + $request = Request::createFromGlobals(); $this->code = int($request->input('code', 404)); - $this->lists = [404 => 'Ошибки 404', 403 => 'Ошибки 403', 666 => 'Автобаны']; + $this->lists = [403 => 'Ошибки 403', 404 => 'Ошибки 404', 666 => 'Автобаны']; if (! isset($this->lists[$this->code])) { abort(404, 'Указанный лог-файл не существует!'); @@ -65,9 +66,10 @@ public function index(): string /** * Очистка логов * + * @param Request $request * @return void */ - public function clear(): void + public function clear(Request $request): void { $token = check($request->input('token')); diff --git a/app/Controllers/Admin/FilesController.php b/app/Controllers/Admin/FilesController.php index 3c8c11ff4..5a7edb3b0 100644 --- a/app/Controllers/Admin/FilesController.php +++ b/app/Controllers/Admin/FilesController.php @@ -22,6 +22,7 @@ public function __construct() abort(403, 'Доступ запрещен!'); } + $request = Request::createFromGlobals(); $this->file = ltrim(check($request->input('file')), '/'); $this->path = rtrim(check($request->input('path')), '/'); @@ -67,9 +68,10 @@ public function index(): string /** * Редактирование файла * + * @param Request $request * @return string */ - public function edit(): string + public function edit(Request $request): string { $fileName = $this->path ? '/' . $this->file : $this->file; @@ -110,9 +112,10 @@ public function edit(): string /** * Создание файла * + * @param Request $request * @return string */ - public function create(): string + public function create(Request $request): string { if (! is_writable(RESOURCES . '/views/' . $this->path)) { abort('default', 'Директория ' . $this->path . ' недоступна для записи!'); @@ -170,9 +173,10 @@ public function create(): string /** * Удаление файла * + * @param Request $request * @return void */ - public function delete(): void + public function delete(Request $request): void { if (! is_writable(RESOURCES . '/views/' . $this->path)) { abort('default', 'Директория ' . $this->path . ' недоступна для записи!'); diff --git a/app/Controllers/Admin/ForumController.php b/app/Controllers/Admin/ForumController.php index 523da0542..c48c71173 100644 --- a/app/Controllers/Admin/ForumController.php +++ b/app/Controllers/Admin/ForumController.php @@ -31,8 +31,10 @@ public function index() /** * Создание раздела + * + * @param Request $request */ - public function create(): void + public function create(Request $request): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -49,6 +51,7 @@ public function create(): void $max = Forum::query()->max('sort') + 1; + /** @var Forum $forum */ $forum = Forum::query()->create([ 'title' => $title, 'sort' => $max, @@ -61,21 +64,23 @@ public function create(): void setFlash('danger', $validator->getErrors()); } - redirect('/admin/forum'); + redirect('/admin/forums'); } /** * Редактирование форума * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit(int $id): string + public function edit(int $id, Request $request): string { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); } + /** @var Forum $forum */ $forum = Forum::query()->with('children')->find($id); if (! $forum) { @@ -116,7 +121,7 @@ public function edit(int $id): string ]); setFlash('success', 'Раздел успешно отредактирован!'); - redirect('/admin/forum'); + redirect('/admin/forums'); } else { setInput($request->all()); setFlash('danger', $validator->getErrors()); @@ -129,16 +134,18 @@ public function edit(int $id): string /** * Удаление раздела * - * @param $id + * @param int $id + * @param Request $request * @return void * @throws \Exception */ - public function delete(int $id): void + public function delete(int $id, Request $request): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); } + /** @var Forum $forum */ $forum = Forum::query()->with('children')->find($id); if (! $forum) { @@ -165,13 +172,15 @@ public function delete(int $id): void setFlash('danger', $validator->getErrors()); } - redirect('/admin/forum'); + redirect('/admin/forums'); } /** * Пересчет данных + * + * @param Request $request */ - public function restatement(): void + public function restatement(Request $request): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -188,7 +197,7 @@ public function restatement(): void setFlash('danger', 'Ошибка! Неверный идентификатор сессии, повторите действие!'); } - redirect('/admin/forum'); + redirect('/admin/forums'); } /** @@ -199,6 +208,7 @@ public function restatement(): void */ public function forum(int $id): string { + /** @var Forum $forum */ $forum = Forum::query()->with('parent', 'children.lastTopic.lastPost.user')->find($id); if (! $forum) { @@ -224,11 +234,13 @@ public function forum(int $id): string /** * Редактирование темы * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function editTopic(int $id): string + public function editTopic(int $id, Request $request): string { + /** @var Topic $topic */ $topic = Topic::query()->find($id); if (! $topic) { @@ -275,11 +287,13 @@ public function editTopic(int $id): string /** * Перенос темы * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function moveTopic(int $id): string + public function moveTopic(int $id, Request $request): string { + /** @var Topic $topic */ $topic = Topic::query()->find($id); if (! $topic) { @@ -290,6 +304,7 @@ public function moveTopic(int $id): string $token = check($request->input('token')); $fid = int($request->input('fid')); + /** @var Forum $forum */ $forum = Forum::query()->find($fid); $validator = new Validator(); @@ -333,15 +348,17 @@ public function moveTopic(int $id): string /** * Закрытие и закрепление тем * + * @param int $id + * @param Request $request * @return void - * @param $id */ - public function actionTopic(int $id): void + public function actionTopic(int $id, Request $request): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); $type = check($request->input('type')); + /** @var Topic $topic */ $topic = Topic::query()->find($id); if (! $topic) { @@ -398,15 +415,17 @@ public function actionTopic(int $id): void /** * Удаление тем * - * @param $id + * @param int $id + * @param Request $request * @return void * @throws \Exception */ - public function deleteTopic(int $id): void + public function deleteTopic(int $id, Request $request): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); + /** @var Topic $topic */ $topic = Topic::query()->find($id); if (! $topic) { @@ -423,7 +442,7 @@ public function deleteTopic(int $id): void return $post->files->isNotEmpty(); }); - $filtered->each(function($post) { + $filtered->each(function(Post $post) { $post->delete(); }); @@ -513,13 +532,15 @@ public function topic(int $id): string /** * Редактирование сообщения * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function editPost(int $id): string + public function editPost(int $id, Request $request): string { $page = int($request->input('page', 1)); + /** @var Post $post */ $post = Post::query()->find($id); if (! $post) { @@ -577,9 +598,10 @@ public function editPost(int $id): string /** * Удаление тем * + * @param Request $request * @return void */ - public function deletePosts(): void + public function deletePosts(Request $request): void { $tid = int($request->input('tid')); $page = int($request->input('page', 1)); @@ -602,7 +624,7 @@ public function deletePosts(): void ->whereIn('id', $del) ->get(); - $posts->each(function($post) { + $posts->each(function(Post $post) { $post->delete(); }); @@ -625,6 +647,7 @@ public function deletePosts(): void */ public function end(int $id): void { + /** @var Topic $topic */ $topic = Topic::query()->find($id); if (! $topic) { diff --git a/app/Controllers/Admin/GuestbookController.php b/app/Controllers/Admin/GuestbookController.php index 94f7131ce..802e5d15f 100644 --- a/app/Controllers/Admin/GuestbookController.php +++ b/app/Controllers/Admin/GuestbookController.php @@ -30,10 +30,11 @@ public function index() /** * Редактирование сообщения * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit(int $id): string + public function edit(int $id, Request $request): string { $page = int($request->input('page')); $post = Guestbook::with('user')->find($id); @@ -75,10 +76,11 @@ public function edit(int $id): string /** * Ответ на сообщение * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function reply(int $id): string + public function reply(int $id, Request $request): string { $page = int($request->input('page')); $post = Guestbook::with('user')->find($id); @@ -118,9 +120,10 @@ public function reply(int $id): string /** * Удаление сообщений * + * @param Request $request * @return void */ - public function delete(): void + public function delete(Request $request): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); @@ -144,9 +147,10 @@ public function delete(): void /** * Очистка сообщений * + * @param Request $request * @return void */ - public function clear(): void + public function clear(Request $request): void { $token = check($request->input('token')); diff --git a/app/Controllers/Admin/InvitationController.php b/app/Controllers/Admin/InvitationController.php index dd1b0eac5..bedfc54cc 100644 --- a/app/Controllers/Admin/InvitationController.php +++ b/app/Controllers/Admin/InvitationController.php @@ -24,9 +24,10 @@ public function __construct() /** * Главная страница * + * @param Request $request * @return string */ - public function index(): string + public function index(Request $request): string { $used = $request->input('used') ? 1 : 0; @@ -63,10 +64,11 @@ public function keys(): string /** * Создание ключей * + * @param Request $request * @return string * @throws \Exception */ - public function create(): string + public function create(Request $request): string { if ($request->isMethod('post')) { $token = check($request->input('token')); @@ -106,10 +108,11 @@ public function create(): string /** * Отправка ключей пользователю * + * @param Request $request * @return void * @throws \Exception */ - public function send(): void + public function send(Request $request): void { $token = check($request->input('token')); $login = check($request->input('user')); @@ -158,12 +161,13 @@ public function send(): void /** * Отправка ключей активным пользователям * + * @param Request $request * @return void * @throws \Exception */ - public function mail(): void + public function mail(Request $request): void { - $token = check($request->input('token')); + $token = check($request->input('token')); $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -179,6 +183,7 @@ public function mail(): void if ($validator->isValid()) { + /** @var User $user */ foreach ($users as $user) { $key = str_random(random_int(12, 15)); @@ -204,9 +209,10 @@ public function mail(): void /** * Удаление ключей * + * @param Request $request * @return void */ - public function delete(): void + public function delete(Request $request): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); diff --git a/app/Controllers/Admin/IpBanController.php b/app/Controllers/Admin/IpBanController.php index 4f61600e5..4b78dad15 100644 --- a/app/Controllers/Admin/IpBanController.php +++ b/app/Controllers/Admin/IpBanController.php @@ -24,9 +24,10 @@ public function __construct() /** * Главная страница * + * @param Request $request * @return string */ - public function index(): string + public function index(Request $request): string { if ($request->isMethod('post')) { $token = check($request->input('token')); @@ -73,9 +74,10 @@ public function index(): string /** * Удаление ip * + * @param Request $request * @return void */ - public function delete(): void + public function delete(Request $request): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); @@ -101,9 +103,10 @@ public function delete(): void /** * Очистка ip * + * @param Request $request * @return void */ - public function clear(): void + public function clear(Request $request): void { $token = check($request->input('token')); diff --git a/app/Controllers/Admin/LoadController.php b/app/Controllers/Admin/LoadController.php index 9e184d20d..6ca1fc822 100644 --- a/app/Controllers/Admin/LoadController.php +++ b/app/Controllers/Admin/LoadController.php @@ -42,9 +42,10 @@ public function index(): string /** * Создание раздела * + * @param Request $request * @return void */ - public function create(): void + public function create(Request $request): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -61,6 +62,7 @@ public function create(): void $max = Load::query()->max('sort') + 1; + /** @var Load $load */ $load = Load::query()->create([ 'name' => $name, 'sort' => $max, @@ -79,15 +81,17 @@ public function create(): void /** * Редактирование раздела * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit(int $id): string + public function edit(int $id, Request $request): string { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); } + /** @var Load $load */ $load = Load::query()->with('children')->find($id); if (! $load) { @@ -138,16 +142,18 @@ public function edit(int $id): string /** * Удаление раздела * - * @param int $id + * @param int $id + * @param Request $request * @return void * @throws \Exception */ - public function delete(int $id): void + public function delete(int $id, Request $request): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); } + /** @var Load $load */ $load = Load::query()->with('children')->find($id); if (! $load) { @@ -180,9 +186,10 @@ public function delete(int $id): void /** * Пересчет данных * + * @param Request $request * @return void */ - public function restatement(): void + public function restatement(Request $request): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -205,11 +212,13 @@ public function restatement(): void /** * Просмотр загрузок раздела * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function load(int $id): string + public function load(int $id, Request $request): string { + /** @var Load $category */ $category = Load::query()->with('parent')->find($id); if (! $category) { @@ -249,11 +258,13 @@ public function load(int $id): string /** * Редактирование загрузки * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function editDown(int $id): string + public function editDown(int $id, Request $request): string { + /** @var Down $down */ $down = Down::query()->find($id); if (! $down) { @@ -267,6 +278,7 @@ public function editDown(int $id): string $text = check($request->input('text')); $files = (array) $request->file('files'); + /** @var Load $category */ $category = Load::query()->find($category); $validator = new Validator(); @@ -338,13 +350,16 @@ public function editDown(int $id): string /** * Удаление загрузки * - * @param $id + * @param int $id + * @param Request $request * @return void * @throws \Exception */ - public function deleteDown(int $id): void + public function deleteDown(int $id, Request $request): void { $token = check($request->input('token')); + + /** @var Down $down */ $down = Down::query()->find($id); if (! $down) { @@ -382,12 +397,14 @@ public function deleteDown(int $id): void */ public function deleteFile(int $id, int $fid): void { + /** @var Down $down */ $down = Down::query()->find($id); if (! $down) { abort(404, 'Файла не существует!'); } + /** @var File $file */ $file = File::query()->where('relate_id', $down->id)->find($fid); if (! $file) { @@ -426,13 +443,15 @@ public function new(): string /** * Публикация загрузки * - * @param int $id + * @param int $id + * @param Request $request * @return void */ - public function publish(int $id): void + public function publish(int $id, Request $request): void { - $token = check($request->input('token')); + /** @var Down $down */ $down = Down::query()->find($id); + $token = check($request->input('token')); if (! $down) { abort(404, 'Данного файла не существует!'); @@ -451,14 +470,14 @@ public function publish(int $id): void $type = 'опубликована' ; $down->category->increment('count_downs'); - $text = 'Уведомеление о публикации файла.'.PHP_EOL.'Ваш файл '.$down->title.' успешно прошел проверку и добавлен в загрузки'; + $text = 'Уведомеление о публикации файла.' . PHP_EOL . 'Ваш файл ' . $down->title . ' успешно прошел проверку и добавлен в загрузки'; $down->user->sendMessage(null, $text); } else { $type = 'снята с публикации'; $down->category->decrement('count_downs'); - $text = 'Уведомеление о снятии с публикации.'.PHP_EOL.'Ваш файл '.$down->title.' снят с публикации из загрузок'; + $text = 'Уведомеление о снятии с публикации.' . PHP_EOL . 'Ваш файл ' . $down->title . ' снят с публикации из загрузок'; $down->user->sendMessage(null, $text); } diff --git a/app/Controllers/Admin/LogController.php b/app/Controllers/Admin/LogController.php index ecec866c4..0825aaba6 100644 --- a/app/Controllers/Admin/LogController.php +++ b/app/Controllers/Admin/LogController.php @@ -43,9 +43,10 @@ public function index(): string /** * Очистка логов * + * @param Request $request * @return void */ - public function clear(): void + public function clear(Request $request): void { $token = check($request->input('token')); diff --git a/app/Controllers/Admin/NewsController.php b/app/Controllers/Admin/NewsController.php index 0932161c1..b5e80cd26 100644 --- a/app/Controllers/Admin/NewsController.php +++ b/app/Controllers/Admin/NewsController.php @@ -45,13 +45,15 @@ public function index(): string /** * Редактирование новости * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit(int $id): string + public function edit(int $id, Request $request): string { - $page = int($request->input('page', 1)); + /** @var News $news */ $news = News::query()->find($id); + $page = int($request->input('page', 1)); if (! $news) { abort(404, 'Новость не существует, возможно она была удалена!'); @@ -107,9 +109,10 @@ public function edit(int $id): string /** * Создание новости * + * @param Request $request * @return string */ - public function create(): string + public function create(Request $request): string { if ($request->isMethod('post')) { $token = check($request->input('token')); @@ -137,6 +140,7 @@ public function create(): string $upload = (new News())->uploadFile($image); } + /** @var News $news */ $news = News::query()->create([ 'user_id' => getUser('id'), 'title' => $title, @@ -167,9 +171,10 @@ public function create(): string /** * Пересчет комментариев * + * @param Request $request * @return void */ - public function restatement(): void + public function restatement(Request $request): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -192,15 +197,17 @@ public function restatement(): void /** * Удаление новостей * - * @param int $id + * @param int $id + * @param Request $request * @return void * @throws \Exception */ - public function delete(int $id): void + public function delete(int $id, Request $request): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); + /** @var News $news */ $news = News::query()->find($id); if (! $news) { diff --git a/app/Controllers/Admin/NoticeController.php b/app/Controllers/Admin/NoticeController.php index 2c8d8a579..ce6af6850 100644 --- a/app/Controllers/Admin/NoticeController.php +++ b/app/Controllers/Admin/NoticeController.php @@ -39,9 +39,10 @@ public function index(): string /** * Создание шаблона * + * @param Request $request * @return string */ - public function create(): string + public function create(Request $request): string { if ($request->isMethod('post')) { $token = check($request->input('token')); @@ -62,6 +63,7 @@ public function create(): string if ($validator->isValid()) { + /** @var Notice $notice */ $notice = Notice::query()->create([ 'type' => $type, 'name' => $name, @@ -87,11 +89,13 @@ public function create(): string /** * Редактирование шаблона * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit(int $id): string + public function edit(int $id, Request $request): string { + /** @var Notice $notice */ $notice = Notice::query()->find($id); if (! $notice) { @@ -134,16 +138,18 @@ public function edit(int $id): string /** * Удаление шаблона * - * @param $id + * @param int $id + * @param Request $request * @return void * @throws \Exception */ - public function delete(int $id): void + public function delete(int $id, Request $request): void { - $token = check($request->input('token')); - + /** @var Notice $notice */ $notice = Notice::query()->find($id); + $token = check($request->input('token')); + $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($notice, 'Не найден шаблон для удаления!') diff --git a/app/Controllers/Admin/OfferController.php b/app/Controllers/Admin/OfferController.php index cccbe7ff1..36588a295 100644 --- a/app/Controllers/Admin/OfferController.php +++ b/app/Controllers/Admin/OfferController.php @@ -26,10 +26,11 @@ public function __construct() /** * Главная страница * - * @param string $type + * @param string $type + * @param Request $request * @return string */ - public function index($type = Offer::OFFER): string + public function index(Request $request, $type = Offer::OFFER): string { $otherType = $type === Offer::OFFER ? Offer::ISSUE : Offer::OFFER; @@ -87,10 +88,11 @@ public function view(int $id): string /** * Редактирование записи * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit(int $id): string + public function edit(int $id, Request $request): string { $offer = Offer::query()->where('id', $id)->first(); @@ -139,10 +141,11 @@ public function edit(int $id): string /** * Ответ на предложение * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function reply(int $id): string + public function reply(int $id, Request $request): string { $offer = Offer::query()->where('id', $id)->first(); @@ -190,9 +193,10 @@ public function reply(int $id): string /** * Пересчет комментариев * + * @param Request $request * @return void */ - public function restatement(): void + public function restatement(Request $request): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -215,9 +219,10 @@ public function restatement(): void /** * Удаление записей * + * @param Request $request * @return void */ - public function delete(): void + public function delete(Request $request): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); diff --git a/app/Controllers/Admin/PhotoController.php b/app/Controllers/Admin/PhotoController.php index 8eea51f59..2c39c1259 100644 --- a/app/Controllers/Admin/PhotoController.php +++ b/app/Controllers/Admin/PhotoController.php @@ -28,10 +28,11 @@ public function __construct() */ public function index(): string { - $total = Photo::count(); + $total = Photo::query()->count(); $page = paginate(setting('fotolist'), $total); - $photos = Photo::orderBy('created_at', 'desc') + $photos = Photo::query() + ->orderBy('created_at', 'desc') ->offset($page->offset) ->limit($page->limit) ->with('user') @@ -43,10 +44,11 @@ public function index(): string /** * Редактирование ссылки * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit(int $id): string + public function edit(int $id, Request $request): string { $page = int($request->input('page', 1)); $photo = Photo::query()->find($id); @@ -90,11 +92,12 @@ public function edit(int $id): string /** * Удаление записей * - * @param int $id + * @param int $id + * @param Request $request * @return void * @throws \Exception */ - public function delete(int $id): void + public function delete(int $id, Request $request): void { if (! is_writable(UPLOADS . '/photos')){ abort('default', 'Директория c фотографиями недоступна для записи!'); @@ -103,6 +106,7 @@ public function delete(int $id): void $page = int($request->input('page', 1)); $token = check($request->input('token')); + /** @var Photo $photo */ $photo = Photo::query()->find($id); if (! $photo) { @@ -128,9 +132,10 @@ public function delete(int $id): void /** * Пересчет комментариев * + * @param Request $request * @return void */ - public function restatement(): void + public function restatement(Request $request): void { $token = check($request->input('token')); diff --git a/app/Controllers/Admin/ReglistController.php b/app/Controllers/Admin/ReglistController.php index 9399d9b27..42c8a55dc 100644 --- a/app/Controllers/Admin/ReglistController.php +++ b/app/Controllers/Admin/ReglistController.php @@ -20,9 +20,10 @@ public function __construct() /** * Главная страница * + * @param Request $request * @return string */ - public function index(): string + public function index(Request $request): string { if ($request->isMethod('post')) { $page = int($request->input('page', 1)); diff --git a/app/Controllers/Admin/RekUserController.php b/app/Controllers/Admin/RekUserController.php index 5b9187dd7..23fd129d1 100644 --- a/app/Controllers/Admin/RekUserController.php +++ b/app/Controllers/Admin/RekUserController.php @@ -40,13 +40,15 @@ public function index(): string return view('admin/rekusers/index', compact('records', 'page')); } + /** * Редактирование ссылки * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit(int $id): string + public function edit(int $id, Request $request): string { $page = int($request->input('page', 1)); $link = RekUser::query()->find($id); @@ -90,12 +92,14 @@ public function edit(int $id): string return view('admin/rekusers/edit', compact('link', 'page')); } + /** * Удаление записей * + * @param Request $request * @return void */ - public function delete(): void + public function delete(Request $request): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); diff --git a/app/Controllers/Admin/RuleController.php b/app/Controllers/Admin/RuleController.php index 3d8b7b4cc..e8f1bbe80 100644 --- a/app/Controllers/Admin/RuleController.php +++ b/app/Controllers/Admin/RuleController.php @@ -44,9 +44,10 @@ public function index(): string /** * Редактирование правил * + * @param Request $request * @return string */ - public function edit(): string + public function edit(Request $request): string { $rules = Rule::query()->firstOrNew([]); diff --git a/app/Controllers/Admin/SettingController.php b/app/Controllers/Admin/SettingController.php index 44aa9d907..1f6a40046 100644 --- a/app/Controllers/Admin/SettingController.php +++ b/app/Controllers/Admin/SettingController.php @@ -24,9 +24,10 @@ public function __construct() /** * Главная страница * + * @param Request $request * @return string */ - public function index(): string + public function index(Request $request): string { $act = check($request->input('act', 'main')); diff --git a/app/Controllers/Admin/SmileController.php b/app/Controllers/Admin/SmileController.php index e22be0711..311a900ac 100644 --- a/app/Controllers/Admin/SmileController.php +++ b/app/Controllers/Admin/SmileController.php @@ -46,9 +46,10 @@ public function index(): string /** * Добавление смайла * + * @param Request $request * @return string */ - public function create(): string + public function create(Request $request): string { if (! is_writable(UPLOADS.'/smiles')){ abort('default', 'Директория со смайлами недоступна для записи!'); @@ -102,14 +103,15 @@ public function create(): string /** * Редактирование смайла * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit(int $id): string + public function edit(int $id, Request $request): string { - $page = int($request->input('page', 1)); - + /** @var Smile $smile */ $smile = Smile::query()->find($id); + $page = int($request->input('page', 1)); if (! $smile) { abort(404, 'Данного смайла не существует!'); @@ -150,9 +152,10 @@ public function edit(int $id): string /** * Удаление смайлов * + * @param Request $request * @return void */ - public function delete(): void + public function delete(Request $request): void { if (! is_writable(UPLOADS . '/smiles')){ abort('default', 'Директория со смайлами недоступна для записи!'); diff --git a/app/Controllers/Admin/SpamController.php b/app/Controllers/Admin/SpamController.php index 56a21fc4c..4054cf770 100644 --- a/app/Controllers/Admin/SpamController.php +++ b/app/Controllers/Admin/SpamController.php @@ -54,9 +54,10 @@ public function __construct() /** * Главная страница * + * @param Request $request * @return string */ - public function index(): string + public function index(Request $request): string { $type = check($request->input('type')); $type = isset($this->types[$type]) ? $type : 'post'; @@ -83,10 +84,11 @@ public function index(): string /** * Удаление жалоб * + * @param Request $request * @return void * @throws \Exception */ - public function delete(): void + public function delete(Request $request): void { $id = int($request->input('id')); $token = check($request->input('token')); diff --git a/app/Controllers/Admin/StatusController.php b/app/Controllers/Admin/StatusController.php index b267f3f34..c3e03bce4 100644 --- a/app/Controllers/Admin/StatusController.php +++ b/app/Controllers/Admin/StatusController.php @@ -36,9 +36,10 @@ public function index(): string /** * Добавление статуса * + * @param Request $request * @return string */ - public function create(): string + public function create(Request $request): string { if ($request->isMethod('post')) { $token = check($request->input('token')); @@ -76,9 +77,10 @@ public function create(): string /** * Редактирование статуса * + * @param Request $request * @return string */ - public function edit(): string + public function edit(Request $request): string { $id = int($request->input('id')); @@ -124,10 +126,11 @@ public function edit(): string /** * Удаление статуса * + * @param Request $request * @return void * @throws \Exception */ - public function delete(): void + public function delete(Request $request): void { $token = check($request->input('token')); $id = int($request->input('id')); diff --git a/app/Controllers/Admin/TransferController.php b/app/Controllers/Admin/TransferController.php index 51ea4fb95..4cea124dc 100644 --- a/app/Controllers/Admin/TransferController.php +++ b/app/Controllers/Admin/TransferController.php @@ -30,9 +30,10 @@ public function index(): string /** * Просмотр всех переводов * + * @param Request $request * @return string */ - public function view(): string + public function view(Request $request): string { $login = check($request->input('user')); diff --git a/app/Controllers/Admin/UserController.php b/app/Controllers/Admin/UserController.php index 10e4c1929..db595d891 100644 --- a/app/Controllers/Admin/UserController.php +++ b/app/Controllers/Admin/UserController.php @@ -48,9 +48,10 @@ public function index(): string /** * Поиск пользователей * + * @param Request $request * @return string */ - public function search(): string + public function search(Request $request): string { $q = check($request->input('q')); @@ -72,9 +73,10 @@ public function search(): string /** * Редактирование пользователя * + * @param Request $request * @return string */ - public function edit(): string + public function edit(Request $request): string { $login = check($request->input('user')); @@ -190,10 +192,11 @@ public function edit(): string /** * Удаление пользователя * + * @param Request $request * @return string * @throws \Exception */ - public function delete(): string + public function delete(Request $request): string { $login = check($request->input('user')); diff --git a/app/Controllers/Admin/VoteController.php b/app/Controllers/Admin/VoteController.php index 0fa48358f..6e4125e2d 100644 --- a/app/Controllers/Admin/VoteController.php +++ b/app/Controllers/Admin/VoteController.php @@ -64,10 +64,11 @@ public function history(): string /** * Редактирование голосования * - * @param int $id + * @param int $id + * @param Request $request * @return string */ - public function edit(int $id): string + public function edit(int $id, Request $request): string { $vote = Vote::query()->where('id', $id)->first(); @@ -125,10 +126,11 @@ public function edit(int $id): string /** * Удаление голосования * - * @param int $id + * @param int $id + * @param Request $request * @return void */ - public function delete(int $id): void + public function delete(int $id, Request $request): void { $token = check($request->input('token')); $vote = Vote::query()->where('id', $id)->first(); @@ -160,10 +162,11 @@ public function delete(int $id): void /** * Открытие-закрытие голосования * - * @param int $id + * @param int $id + * @param Request $request * @return void */ - public function close(int $id): void + public function close(int $id, Request $request): void { $token = check($request->input('token')); $vote = Vote::query()->where('id', $id)->first(); @@ -201,9 +204,10 @@ public function close(int $id): void /** * Пересчет голосов * + * @param Request $request * @return void */ - public function restatement(): void + public function restatement(Request $request): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -213,7 +217,7 @@ public function restatement(): void if ($token === $_SESSION['token']) { - DB::update('update vote set count = (select SUM(result) from voteanswer where vote.id = voteanswer.vote_id)'); + DB::update('update votes set count = (select SUM(result) from voteanswer where votes.id = voteanswer.vote_id)'); setFlash('success', 'Голосования успешно пересчитаны!'); } else { diff --git a/app/Models/Blog.php b/app/Models/Blog.php index 207e53f58..08027c0d7 100644 --- a/app/Models/Blog.php +++ b/app/Models/Blog.php @@ -21,6 +21,7 @@ * @property int count_comments * @property int created_at * @property Collection files + * @property Category category */ class Blog extends BaseModel { diff --git a/app/Models/Board.php b/app/Models/Board.php index 3d804ee2c..1f8fb4668 100644 --- a/app/Models/Board.php +++ b/app/Models/Board.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; @@ -14,6 +15,8 @@ * @property string name * @property int count_items * @property int closed + * @property Collection children + * @property Board parent */ class Board extends BaseModel { diff --git a/app/Models/Category.php b/app/Models/Category.php index 4fc6049db..1ecc0f2c0 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasOne; @@ -15,6 +16,7 @@ * @property string name * @property int count_blogs * @property int closed + * @property Collection children */ class Category extends BaseModel { diff --git a/app/Models/Down.php b/app/Models/Down.php index f615ed2a0..08d45f06a 100644 --- a/app/Models/Down.php +++ b/app/Models/Down.php @@ -28,6 +28,8 @@ * @property int active * @property int updated_at * @property Collection files + * @property Collection comments + * @property Load category */ class Down extends BaseModel { diff --git a/app/Models/Forum.php b/app/Models/Forum.php index dd1897f56..3668f1675 100644 --- a/app/Models/Forum.php +++ b/app/Models/Forum.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; @@ -18,6 +19,8 @@ * @property int last_topic_id * @property int closed * @property Forum parent + * @property Collection children + * @property Topic lastTopic */ class Forum extends BaseModel { diff --git a/app/Models/Load.php b/app/Models/Load.php index d67095818..d59788c31 100644 --- a/app/Models/Load.php +++ b/app/Models/Load.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasOne; @@ -15,6 +16,8 @@ * @property string name * @property int count_downs * @property int closed + * @property Load parent + * @property Collection children */ class Load extends BaseModel { diff --git a/app/Models/Topic.php b/app/Models/Topic.php index fffa26f3d..672a8af22 100644 --- a/app/Models/Topic.php +++ b/app/Models/Topic.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasOne; @@ -22,6 +23,8 @@ * @property int last_post_id * @property int created_at * @property Forum forum + * @property Collection posts + * @property Vote vote */ class Topic extends BaseModel { diff --git a/app/Tasks/RestatementBoard.php b/app/Tasks/RestatementBoard.php index bdbfdc35c..17f2bb77a 100644 --- a/app/Tasks/RestatementBoard.php +++ b/app/Tasks/RestatementBoard.php @@ -2,7 +2,6 @@ namespace App\Tasks; -use App\Models\Reader; use Crontask\Tasks\Task; class RestatementBoard extends Task From e662c2c80684b803c99ee41228acd3875bae7345 Mon Sep 17 00:00:00 2001 From: visavi Date: Sun, 14 Oct 2018 17:48:21 +0300 Subject: [PATCH 049/163] =?UTF-8?q?=D0=92=D1=8B=D0=B7=D0=BE=D0=B2=20=D0=B2?= =?UTF-8?q?=D0=B0=D0=BB=D0=B8=D0=B4=D0=B0=D1=82=D0=BE=D1=80=D0=B0=20=D1=87?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=B7=20Dependency=20Injection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/Admin/AntimatController.php | 18 +++--- app/Controllers/Admin/BackupController.php | 13 ++-- app/Controllers/Admin/BanController.php | 18 +++--- app/Controllers/Admin/BanhistController.php | 6 +- app/Controllers/Admin/BlacklistController.php | 12 ++-- app/Controllers/Admin/BlogController.php | 46 +++++++------- app/Controllers/Admin/BoardController.php | 38 ++++++------ app/Controllers/Admin/ChatController.php | 20 +++--- app/Controllers/Admin/DelUserController.php | 6 +- app/Controllers/Admin/DeliveryController.php | 6 +- app/Controllers/Admin/ErrorController.php | 6 +- app/Controllers/Admin/FilesController.php | 12 ++-- app/Controllers/Admin/ForumController.php | 61 +++++++++---------- app/Controllers/Admin/GuestbookController.php | 28 ++++----- .../Admin/InvitationController.php | 24 ++++---- app/Controllers/Admin/IpBanController.php | 18 +++--- app/Controllers/Admin/LoadController.php | 30 ++++----- app/Controllers/Admin/NewsController.php | 22 +++---- app/Controllers/Admin/NoticeController.php | 22 +++---- app/Controllers/Admin/OfferController.php | 22 +++---- app/Controllers/Admin/PhotoController.php | 16 ++--- app/Controllers/Admin/ReglistController.php | 6 +- app/Controllers/Admin/RekUserController.php | 15 +++-- app/Controllers/Admin/RuleController.php | 6 +- app/Controllers/Admin/SettingController.php | 6 +- app/Controllers/Admin/SmileController.php | 20 +++--- app/Controllers/Admin/SpamController.php | 6 +- app/Controllers/Admin/StatusController.php | 18 +++--- app/Controllers/Admin/UserController.php | 12 ++-- app/Controllers/Admin/VoteController.php | 10 +-- app/Controllers/Forum/ActiveController.php | 6 +- app/Controllers/Forum/ForumController.php | 6 +- app/Controllers/Forum/TopicController.php | 49 ++++++++------- app/Controllers/IgnoreController.php | 20 +++--- app/Controllers/Load/DownController.php | 46 +++++++------- app/Controllers/MailController.php | 18 +++--- app/Controllers/MessageController.php | 18 +++--- app/Controllers/NewsController.php | 18 +++--- app/Controllers/NotebookController.php | 6 +- app/Controllers/OfferController.php | 33 +++++----- app/Controllers/PhotoController.php | 40 ++++++------ app/Controllers/PictureController.php | 12 ++-- app/Controllers/RatingController.php | 14 ++--- app/Controllers/RekUserController.php | 6 +- app/Controllers/SocialController.php | 8 +-- app/Controllers/TransferController.php | 6 +- app/Controllers/User/BanController.php | 6 +- app/Controllers/User/UserController.php | 50 +++++++-------- app/Controllers/VoteController.php | 14 ++--- app/Controllers/WallController.php | 16 ++--- app/helpers.php | 4 ++ 51 files changed, 469 insertions(+), 470 deletions(-) diff --git a/app/Controllers/Admin/AntimatController.php b/app/Controllers/Admin/AntimatController.php index d8c1b59fa..8f0e0d5f1 100644 --- a/app/Controllers/Admin/AntimatController.php +++ b/app/Controllers/Admin/AntimatController.php @@ -24,16 +24,16 @@ public function __construct() /** * Главная страница * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function index(Request $request): string + public function index(Request $request, Validator $validator): string { if ($request->isMethod('post')) { $token = check($request->input('token')); $word = check(utfLower($request->input('word'))); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($word, 'Вы не ввели слово для занесения в список!'); @@ -64,16 +64,16 @@ public function index(Request $request): string /** * Удаление слова из списка * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void * @throws \Exception */ - public function delete(Request $request): void + public function delete(Request $request, Validator $validator): void { $token = check($request->input('token')); $id = int($request->input('id')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); $word = Antimat::query()->find($id); @@ -94,14 +94,14 @@ public function delete(Request $request): void /** * Очистка списка слов * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function clear(Request $request): void + public function clear(Request $request, Validator $validator): void { $token = check($request->input('token')); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true(isAdmin(User::BOSS), 'Очищать список может только владелец!'); diff --git a/app/Controllers/Admin/BackupController.php b/app/Controllers/Admin/BackupController.php index 9a39eea47..1dcc125d5 100644 --- a/app/Controllers/Admin/BackupController.php +++ b/app/Controllers/Admin/BackupController.php @@ -45,10 +45,11 @@ public function index(): string /** * Создание нового бэкапа * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function create(Request $request): string + public function create(Request $request, Validator $validator): string { if ($request->isMethod('post')) { @@ -57,7 +58,6 @@ public function create(Request $request): string $method = check($request->input('method')); $level = int($request->input('level')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($sheets, ['sheets' => 'Ошибка! Не выбраны таблицы для сохранения!']) ->in($method, ['none', 'gzip', 'bzip'], ['method' => 'Ошибка! Неправильный метод сжатия!']) @@ -133,16 +133,15 @@ public function create(Request $request): string /** * Удаляет сохраненный бэкап * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function delete(Request $request): void + public function delete(Request $request, Validator $validator): void { $token = check($request->input('token')); $file = check($request->input('file')); - - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($file, 'Не передано название бэкапа для удаления!') ->regex($file, '|^[\w\.\-]+$|i', 'Недопустимое название бэкапа!') diff --git a/app/Controllers/Admin/BanController.php b/app/Controllers/Admin/BanController.php index 74f6610fc..3b49e3717 100644 --- a/app/Controllers/Admin/BanController.php +++ b/app/Controllers/Admin/BanController.php @@ -31,10 +31,11 @@ public function index(): string /** * Бан пользователя * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(Request $request): string + public function edit(Request $request, Validator $validator): string { $login = check($request->input('user')); @@ -55,7 +56,6 @@ public function edit(Request $request): string $reason = check($request->input('reason')); $notice = check($request->input('notice')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->false($user->level === User::BANNED && $user->timeban > SITETIME, 'Данный аккаунт уже заблокирован!') ->gt($time, 0, ['time' => 'Вы не указали время бана!']) @@ -107,10 +107,11 @@ public function edit(Request $request): string /** * Изменение бана * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function change(Request $request): string + public function change(Request $request, Validator $validator): string { $login = check($request->input('user')); @@ -132,7 +133,6 @@ public function change(Request $request): string $timeban = strtotime($timeban); $term = $timeban - SITETIME; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->gt($term, 0, ['timeban' => 'Слишком маленькое время бана!']) ->length($reason, 5, 1000, ['reason' => 'Слишком длинная или короткая причина бана!']); @@ -167,10 +167,11 @@ public function change(Request $request): string /** * Снятие бана * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function unban(Request $request): void + public function unban(Request $request, Validator $validator): void { $token = check($request->input('token')); $login = check($request->input('user')); @@ -185,7 +186,6 @@ public function unban(Request $request): void abort('default', 'Данный пользователь не забанен!'); } - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); if ($validator->isValid()) { diff --git a/app/Controllers/Admin/BanhistController.php b/app/Controllers/Admin/BanhistController.php index 536f3d4c0..3f7a32060 100644 --- a/app/Controllers/Admin/BanhistController.php +++ b/app/Controllers/Admin/BanhistController.php @@ -71,17 +71,17 @@ public function view(Request $request): string /** * Удаление банов * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function delete(Request $request): void + public function delete(Request $request, Validator $validator): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); $del = intar($request->input('del')); $login = check($request->input('user')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true($del, 'Отсутствуют выбранные записи для удаления!'); diff --git a/app/Controllers/Admin/BlacklistController.php b/app/Controllers/Admin/BlacklistController.php index 4d62f452c..45973ccdb 100644 --- a/app/Controllers/Admin/BlacklistController.php +++ b/app/Controllers/Admin/BlacklistController.php @@ -38,10 +38,11 @@ public function __construct() /** * Главная страница * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function index(Request $request): string + public function index(Request $request, Validator $validator): string { $type = $this->type; @@ -49,7 +50,6 @@ public function index(Request $request): string $token = check($request->input('token')); $value = check(utfLower($request->input('value'))); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($value, 1, 100, ['value' => 'Вы не ввели запись или она слишком длинная!']); @@ -103,17 +103,17 @@ public function index(Request $request): string /** * Удаление записей * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function delete(Request $request): void + public function delete(Request $request, Validator $validator): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); $del = intar($request->input('del')); $type = $this->type; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true($del, 'Отсутствуют выбранные записи для удаления!'); diff --git a/app/Controllers/Admin/BlogController.php b/app/Controllers/Admin/BlogController.php index cfca8a0de..2480a8c87 100644 --- a/app/Controllers/Admin/BlogController.php +++ b/app/Controllers/Admin/BlogController.php @@ -29,10 +29,11 @@ public function index(): string /** * Создание раздела * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function create(Request $request): void + public function create(Request $request, Validator $validator): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -41,7 +42,6 @@ public function create(Request $request): void $token = check($request->input('token')); $name = check($request->input('name')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($name, 3, 50, ['name' => 'Слишком длинное или короткое название раздела!']); @@ -68,11 +68,12 @@ public function create(Request $request): void /** * Редактирование раздела * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -97,7 +98,6 @@ public function edit(int $id, Request $request): string $sort = check($request->input('sort')); $closed = empty($request->input('closed')) ? 0 : 1; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($name, 3, 50, ['title' => 'Слишком длинное или короткое название раздела!']) ->notEqual($parent, $category->id, ['parent' => 'Недопустимый выбор родительского раздела!']); @@ -129,12 +129,13 @@ public function edit(int $id, Request $request): string /** * Удаление раздела * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return void * @throws \Exception */ - public function delete(int $id, Request $request): void + public function delete(int $id, Request $request, Validator $validator): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -149,7 +150,6 @@ public function delete(int $id, Request $request): void $token = check($request->input('token')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true($category->children->isEmpty(), 'Удаление невозможно! Данный раздел имеет подразделы!'); @@ -228,11 +228,12 @@ public function blog(int $id): string /** * Редактирование статьи * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function editBlog(int $id, Request $request): string + public function editBlog(int $id, Request $request, Validator $validator): string { /** @var Blog $blog */ $blog = Blog::query()->find($id); @@ -248,7 +249,6 @@ public function editBlog(int $id, Request $request): string $text = check($request->input('text')); $tags = check($request->input('tags')); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($title, 5, 50, ['title' => 'Слишком длинный или короткий заголовок!']) @@ -283,11 +283,12 @@ public function editBlog(int $id, Request $request): string /** * Перенос статьи * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function moveBlog(int $id, Request $request): string + public function moveBlog(int $id, Request $request, Validator $validator): string { /** @var Blog $blog */ $blog = Blog::query()->find($id); @@ -304,7 +305,6 @@ public function moveBlog(int $id, Request $request): string /** @var Category $category */ $category = Category::query()->find($cid); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($category, ['cid' => 'Категории для статьи не существует!']); @@ -344,12 +344,13 @@ public function moveBlog(int $id, Request $request): string /** * Удаление статьи * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return void * @throws \Exception */ - public function deleteBlog(int $id, Request $request): void + public function deleteBlog(int $id, Request $request, Validator $validator): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); @@ -361,7 +362,6 @@ public function deleteBlog(int $id, Request $request): void abort(404, 'Данной статьи не существует!'); } - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); if ($validator->isValid()) { diff --git a/app/Controllers/Admin/BoardController.php b/app/Controllers/Admin/BoardController.php index 09a57d212..d5fdcad95 100644 --- a/app/Controllers/Admin/BoardController.php +++ b/app/Controllers/Admin/BoardController.php @@ -81,10 +81,11 @@ public function categories(): string /** * Создание раздела * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function create(Request $request): void + public function create(Request $request, Validator $validator): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -93,7 +94,6 @@ public function create(Request $request): void $token = check($request->input('token')); $name = check($request->input('name')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], trans('validator.token')) ->length($name, 3, 50, ['name' => 'Слишком длинное или короткое название раздела!']); @@ -120,11 +120,12 @@ public function create(Request $request): void /** * Редактирование раздела * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -149,7 +150,6 @@ public function edit(int $id, Request $request): string $sort = check($request->input('sort')); $closed = empty($request->input('closed')) ? 0 : 1; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], trans('validator.token')) ->length($name, 3, 50, ['title' => 'Слишком длинное или короткое название раздела!']) ->notEqual($parent, $board->id, ['parent' => 'Недопустимый выбор родительского раздела!']); @@ -181,11 +181,12 @@ public function edit(int $id, Request $request): string /** * Удаление раздела * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @throws Exception */ - public function delete(int $id, Request $request): void + public function delete(int $id, Request $request, Validator $validator): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -200,7 +201,6 @@ public function delete(int $id, Request $request): void $token = check($request->input('token')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], trans('validator.token')) ->true($board->children->isEmpty(), 'Удаление невозможно! Данный раздел имеет подразделы!'); @@ -224,11 +224,12 @@ public function delete(int $id, Request $request): void /** * Редактирование объявления * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function editItem(int $id, Request $request): string + public function editItem(int $id, Request $request, Validator $validator): string { /** @var Item $item */ $item = Item::query()->find($id); @@ -248,7 +249,6 @@ public function editItem(int $id, Request $request): string /** @var Board $board */ $board = Board::query()->find($bid); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], trans('validator.token')) ->length($title, 5, 50, ['title' => trans('validator.name')]) @@ -296,11 +296,12 @@ public function editItem(int $id, Request $request): string /** * Удаление объявления * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @throws Exception */ - public function deleteItem(int $id, Request $request): void + public function deleteItem(int $id, Request $request, Validator $validator): void { $token = check($request->input('token')); @@ -311,7 +312,6 @@ public function deleteItem(int $id, Request $request): void abort(404, 'Данного объявления не существует!'); } - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); if ($validator->isValid()) { diff --git a/app/Controllers/Admin/ChatController.php b/app/Controllers/Admin/ChatController.php index 0d8808dde..dc94e711a 100644 --- a/app/Controllers/Admin/ChatController.php +++ b/app/Controllers/Admin/ChatController.php @@ -12,10 +12,11 @@ class ChatController extends AdminController /** * Главная страница * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function index(Request $request): string + public function index(Request $request, Validator $validator): string { if (getUser('newchat') !== statsNewChat()) { getUser()->update([ @@ -27,7 +28,6 @@ public function index(Request $request): string $msg = check($request->input('msg')); $token = check($request->input('token')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) ->length($msg, 5, 1500, ['msg' => 'Слишком длинное или короткое сообщение!']); @@ -82,11 +82,12 @@ public function index(Request $request): string /** * Редактирование сообщения * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { $page = int($request->input('page', 1)); @@ -110,7 +111,6 @@ public function edit(int $id, Request $request): string $msg = check($request->input('msg')); $token = check($request->input('token')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) ->length($msg, 5, 1500, ['msg' => 'Слишком длинное или короткое сообщение!']); @@ -136,14 +136,14 @@ public function edit(int $id, Request $request): string /** * Очистка чата * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function clear(Request $request): void + public function clear(Request $request, Validator $validator): void { $token = check($request->input('token')); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true(isAdmin(User::BOSS), 'Очищать чат может только владелец!'); diff --git a/app/Controllers/Admin/DelUserController.php b/app/Controllers/Admin/DelUserController.php index 556890f15..b7dbbe0c7 100644 --- a/app/Controllers/Admin/DelUserController.php +++ b/app/Controllers/Admin/DelUserController.php @@ -56,16 +56,16 @@ public function index(Request $request): string /** * Очистка пользователей * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function clear(Request $request): void + public function clear(Request $request, Validator $validator): void { $token = check($request->input('token')); $period = check($request->input('period')); $point = check($request->input('point')); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->gte($period, 180, 'Указанно недопустимое время для удаления!'); diff --git a/app/Controllers/Admin/DeliveryController.php b/app/Controllers/Admin/DeliveryController.php index c119921a5..eaf0fdd43 100644 --- a/app/Controllers/Admin/DeliveryController.php +++ b/app/Controllers/Admin/DeliveryController.php @@ -24,10 +24,11 @@ public function __construct() /** * Главная страница * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function index(Request $request): string + public function index(Request $request, Validator $validator): string { if ($request->isMethod('post')) { @@ -35,7 +36,6 @@ public function index(Request $request): string $msg = check($request->input('msg')); $type = int($request->input('type')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) ->length($msg, 5, 1000, ['msg' => 'Слишком длинный или короткий текст комментария!']) ->between($type, 1, 4, 'Вы не выбрали получаетелей рассылки!'); diff --git a/app/Controllers/Admin/ErrorController.php b/app/Controllers/Admin/ErrorController.php index 29e7c7e3a..06cd2ac95 100644 --- a/app/Controllers/Admin/ErrorController.php +++ b/app/Controllers/Admin/ErrorController.php @@ -66,14 +66,14 @@ public function index(): string /** * Очистка логов * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function clear(Request $request): void + public function clear(Request $request, Validator $validator): void { $token = check($request->input('token')); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true(isAdmin(User::BOSS), 'Очищать логи может только владелец!'); diff --git a/app/Controllers/Admin/FilesController.php b/app/Controllers/Admin/FilesController.php index 5a7edb3b0..9599a25fb 100644 --- a/app/Controllers/Admin/FilesController.php +++ b/app/Controllers/Admin/FilesController.php @@ -112,10 +112,11 @@ public function edit(Request $request): string /** * Создание файла * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function create(Request $request): string + public function create(Request $request, Validator $validator): string { if (! is_writable(RESOURCES . '/views/' . $this->path)) { abort('default', 'Директория ' . $this->path . ' недоступна для записи!'); @@ -129,7 +130,6 @@ public function create(Request $request): string $fileName = $this->path ? '/' . $filename : $filename; $dirName = $this->path ? '/' . $dirname : $dirname; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); if ($filename) { @@ -173,10 +173,11 @@ public function create(Request $request): string /** * Удаление файла * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function delete(Request $request): void + public function delete(Request $request, Validator $validator): void { if (! is_writable(RESOURCES . '/views/' . $this->path)) { abort('default', 'Директория ' . $this->path . ' недоступна для записи!'); @@ -189,7 +190,6 @@ public function delete(Request $request): void $fileName = $this->path ? '/' . $filename : $filename; $dirName = $this->path ? '/' . $dirname : $dirname; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); if ($filename) { diff --git a/app/Controllers/Admin/ForumController.php b/app/Controllers/Admin/ForumController.php index c48c71173..d0fc57453 100644 --- a/app/Controllers/Admin/ForumController.php +++ b/app/Controllers/Admin/ForumController.php @@ -32,9 +32,10 @@ public function index() /** * Создание раздела * - * @param Request $request + * @param Request $request + * @param Validator $validator */ - public function create(Request $request): void + public function create(Request $request, Validator $validator: void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -43,7 +44,6 @@ public function create(Request $request): void $token = check($request->input('token')); $title = check($request->input('title')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($title, 5, 50, ['title' => 'Слишком длинное или короткое название раздела!']); @@ -70,11 +70,12 @@ public function create(Request $request): void /** * Редактирование форума * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -100,7 +101,6 @@ public function edit(int $id, Request $request): string $sort = check($request->input('sort')); $closed = empty($request->input('closed')) ? 0 : 1; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($title, 5, 50, ['title' => 'Слишком длинное или короткое название раздела!']) ->length($description, 0, 100, ['description' => 'Слишком длинное описания раздела!']) @@ -134,12 +134,13 @@ public function edit(int $id, Request $request): string /** * Удаление раздела * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return void * @throws \Exception */ - public function delete(int $id, Request $request): void + public function delete(int $id, Request $request, Validator $validator): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -154,7 +155,6 @@ public function delete(int $id, Request $request): void $token = check($request->input('token')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true($forum->children->isEmpty(), 'Удаление невозможно! Данный раздел имеет подфорумы!'); @@ -234,11 +234,12 @@ public function forum(int $id): string /** * Редактирование темы * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function editTopic(int $id, Request $request): string + public function editTopic(int $id, Request $request, Validator $validator): string { /** @var Topic $topic */ $topic = Topic::query()->find($id); @@ -256,7 +257,6 @@ public function editTopic(int $id, Request $request): string $locked = empty($request->input('locked')) ? 0 : 1; $closed = empty($request->input('closed')) ? 0 : 1; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($title, 5, 50, ['title' => 'Слишком длинное или короткое название темы!']) ->length($note, 0, 250, ['note' => 'Слишком длинное объявление!']); @@ -287,11 +287,12 @@ public function editTopic(int $id, Request $request): string /** * Перенос темы * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function moveTopic(int $id, Request $request): string + public function moveTopic(int $id, Request $request, Validator $validator): string { /** @var Topic $topic */ $topic = Topic::query()->find($id); @@ -307,7 +308,6 @@ public function moveTopic(int $id, Request $request): string /** @var Forum $forum */ $forum = Forum::query()->find($fid); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($forum, ['forum' => 'Выбранного раздела не существует!']); @@ -415,12 +415,13 @@ public function actionTopic(int $id, Request $request): void /** * Удаление тем * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return void * @throws \Exception */ - public function deleteTopic(int $id, Request $request): void + public function deleteTopic(int $id, Request $request, Validator $validator): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); @@ -432,7 +433,6 @@ public function deleteTopic(int $id, Request $request): void abort(404, 'Данной темы не существует!'); } - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); if ($validator->isValid()) { @@ -532,11 +532,12 @@ public function topic(int $id): string /** * Редактирование сообщения * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function editPost(int $id, Request $request): string + public function editPost(int $id, Request $request, Validator $validator): string { $page = int($request->input('page', 1)); @@ -553,8 +554,6 @@ public function editPost(int $id, Request $request): string $msg = check($request->input('msg')); $delfile = intar($request->input('delfile')); - - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($msg, 5, setting('forumtextlength'), ['msg' => 'Слишком длинное или короткое сообщение!']); @@ -598,10 +597,11 @@ public function editPost(int $id, Request $request): string /** * Удаление тем * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function deletePosts(Request $request): void + public function deletePosts(Request $request, Validator $validator): void { $tid = int($request->input('tid')); $page = int($request->input('page', 1)); @@ -614,7 +614,6 @@ public function deletePosts(Request $request): void abort(404, 'Данной темы не существует!'); } - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true($del, 'Отсутствуют выбранные сообщения для удаления!'); diff --git a/app/Controllers/Admin/GuestbookController.php b/app/Controllers/Admin/GuestbookController.php index 802e5d15f..4baa51feb 100644 --- a/app/Controllers/Admin/GuestbookController.php +++ b/app/Controllers/Admin/GuestbookController.php @@ -30,11 +30,12 @@ public function index() /** * Редактирование сообщения * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { $page = int($request->input('page')); $post = Guestbook::with('user')->find($id); @@ -48,7 +49,6 @@ public function edit(int $id, Request $request): string $msg = check($request->input('msg')); $token = check($request->input('token')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) ->length($msg, 5, setting('guesttextlength'), ['msg' => 'Слишком длинное или короткое сообщение!']); @@ -76,11 +76,12 @@ public function edit(int $id, Request $request): string /** * Ответ на сообщение * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function reply(int $id, Request $request): string + public function reply(int $id, Request $request, Validator $validator): string { $page = int($request->input('page')); $post = Guestbook::with('user')->find($id); @@ -94,7 +95,6 @@ public function reply(int $id, Request $request): string $reply = check($request->input('reply')); $token = check($request->input('token')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) ->length($reply, 5, setting('guesttextlength'), ['msg' => 'Слишком длинный или короткий ответ!']); @@ -120,16 +120,16 @@ public function reply(int $id, Request $request): string /** * Удаление сообщений * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function delete(Request $request): void + public function delete(Request $request, Validator $validator): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); $del = intar($request->input('del')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true($del, 'Отсутствуют выбранные сообщения для удаления!'); @@ -147,14 +147,14 @@ public function delete(Request $request): void /** * Очистка сообщений * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function clear(Request $request): void + public function clear(Request $request, Validator $validator): void { $token = check($request->input('token')); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true(isAdmin(User::BOSS), 'Очищать гостевую может только владелец!'); diff --git a/app/Controllers/Admin/InvitationController.php b/app/Controllers/Admin/InvitationController.php index bedfc54cc..92e5c13fe 100644 --- a/app/Controllers/Admin/InvitationController.php +++ b/app/Controllers/Admin/InvitationController.php @@ -64,17 +64,17 @@ public function keys(): string /** * Создание ключей * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string * @throws \Exception */ - public function create(Request $request): string + public function create(Request $request, Validator $validator): string { if ($request->isMethod('post')) { $token = check($request->input('token')); $keys = int($request->input('keys')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($keys, ['keys' => 'Не указано число ключей!']); @@ -108,11 +108,12 @@ public function create(Request $request): string /** * Отправка ключей пользователю * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void * @throws \Exception */ - public function send(Request $request): void + public function send(Request $request, Validator $validator): void { $token = check($request->input('token')); $login = check($request->input('user')); @@ -121,7 +122,6 @@ public function send(Request $request): void /* @var User $user */ $user = getUserByLogin($login); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($user, ['user' => 'Пользователя с данным логином не существует!']) ->notEmpty($userkeys, ['userkeys' => 'Не указано число ключей!']); @@ -161,15 +161,15 @@ public function send(Request $request): void /** * Отправка ключей активным пользователям * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void * @throws \Exception */ - public function mail(Request $request): void + public function mail(Request $request, Validator $validator): void { $token = check($request->input('token')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true(isAdmin(User::BOSS), 'Рассылать ключи может только владелец'); @@ -209,17 +209,17 @@ public function mail(Request $request): void /** * Удаление ключей * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function delete(Request $request): void + public function delete(Request $request, Validator $validator): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); $del = intar($request->input('del')); $used = $request->input('used') ? 1 : 0; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true($del, 'Отсутствуют выбранные записи для удаления!'); diff --git a/app/Controllers/Admin/IpBanController.php b/app/Controllers/Admin/IpBanController.php index 4b78dad15..b515f4814 100644 --- a/app/Controllers/Admin/IpBanController.php +++ b/app/Controllers/Admin/IpBanController.php @@ -24,16 +24,16 @@ public function __construct() /** * Главная страница * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function index(Request $request): string + public function index(Request $request, Validator $validator): string { if ($request->isMethod('post')) { $token = check($request->input('token')); $ip = check($request->input('ip')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->regex($ip, '|^[0-9]{1,3}\.[0-9,*]{1,3}\.[0-9,*]{1,3}\.[0-9,*]{1,3}$|', ['ip' => 'Вы ввели недопустимый IP-адрес для бана!']); @@ -74,16 +74,16 @@ public function index(Request $request): string /** * Удаление ip * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function delete(Request $request): void + public function delete(Request $request, Validator $validator): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); $del = intar($request->input('del')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true($del, 'Отсутствуют выбранные ip для удаления!'); @@ -103,14 +103,14 @@ public function delete(Request $request): void /** * Очистка ip * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function clear(Request $request): void + public function clear(Request $request, Validator $validator): void { $token = check($request->input('token')); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true(isAdmin(User::BOSS), 'Очищать список IP может только владелец!'); diff --git a/app/Controllers/Admin/LoadController.php b/app/Controllers/Admin/LoadController.php index 6ca1fc822..3b717df44 100644 --- a/app/Controllers/Admin/LoadController.php +++ b/app/Controllers/Admin/LoadController.php @@ -42,10 +42,11 @@ public function index(): string /** * Создание раздела * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function create(Request $request): void + public function create(Request $request, Validator $validator): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -54,7 +55,6 @@ public function create(Request $request): void $token = check($request->input('token')); $name = check($request->input('name')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($name, 5, 50, ['title' => 'Слишком длинное или короткое название раздела!']); @@ -81,11 +81,12 @@ public function create(Request $request): void /** * Редактирование раздела * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -110,7 +111,6 @@ public function edit(int $id, Request $request): string $sort = check($request->input('sort')); $closed = empty($request->input('closed')) ? 0 : 1; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($name, 5, 50, ['title' => 'Слишком длинное или короткое название раздела!']) ->notEqual($parent, $load->id, ['parent' => 'Недопустимый выбор родительского раздела!']); @@ -142,12 +142,13 @@ public function edit(int $id, Request $request): string /** * Удаление раздела * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return void * @throws \Exception */ - public function delete(int $id, Request $request): void + public function delete(int $id, Request $request, Validator $validator): void { if (! isAdmin(User::BOSS)) { abort(403, 'Доступ запрещен!'); @@ -162,7 +163,6 @@ public function delete(int $id, Request $request): void $token = check($request->input('token')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true($load->children->isEmpty(), 'Удаление невозможно! Данный раздел имеет подразделы!'); @@ -258,11 +258,12 @@ public function load(int $id, Request $request): string /** * Редактирование загрузки * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function editDown(int $id, Request $request): string + public function editDown(int $id, Request $request, Validator $validator): string { /** @var Down $down */ $down = Down::query()->find($id); @@ -281,7 +282,6 @@ public function editDown(int $id, Request $request): string /** @var Load $category */ $category = Load::query()->find($category); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($title, 5, 50, ['title' => 'Слишком длинное или короткое название!']) ->length($text, 50, 5000, ['text' => 'Слишком длинное или короткое описание!']) diff --git a/app/Controllers/Admin/NewsController.php b/app/Controllers/Admin/NewsController.php index b5e80cd26..bcbfcd2df 100644 --- a/app/Controllers/Admin/NewsController.php +++ b/app/Controllers/Admin/NewsController.php @@ -45,11 +45,12 @@ public function index(): string /** * Редактирование новости * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { /** @var News $news */ $news = News::query()->find($id); @@ -67,7 +68,6 @@ public function edit(int $id, Request $request): string $closed = empty($request->input('closed')) ? 0 : 1; $top = empty($request->input('top')) ? 0 : 1; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($title, 5, 50, ['title' => 'Слишком длинный или короткий заголовок новости!']) ->length($text, 5, 10000, ['text' => 'Слишком длинный или короткий текст новости!']); @@ -109,10 +109,11 @@ public function edit(int $id, Request $request): string /** * Создание новости * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function create(Request $request): string + public function create(Request $request, Validator $validator): string { if ($request->isMethod('post')) { $token = check($request->input('token')); @@ -122,7 +123,6 @@ public function create(Request $request): string $closed = empty($request->input('closed')) ? 0 : 1; $top = empty($request->input('top')) ? 0 : 1; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($title, 5, 50, ['title' => 'Слишком длинный или короткий заголовок новости!']) ->length($text, 5, 10000, ['text' => 'Слишком длинный или короткий текст новости!']); @@ -197,12 +197,13 @@ public function restatement(Request $request): void /** * Удаление новостей * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return void * @throws \Exception */ - public function delete(int $id, Request $request): void + public function delete(int $id, Request $request, Validator $validator): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); @@ -214,7 +215,6 @@ public function delete(int $id, Request $request): void abort(404, 'Новость не существует, возможно она была удалена!'); } - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); if ($validator->isValid()) { diff --git a/app/Controllers/Admin/NoticeController.php b/app/Controllers/Admin/NoticeController.php index ce6af6850..59a55975a 100644 --- a/app/Controllers/Admin/NoticeController.php +++ b/app/Controllers/Admin/NoticeController.php @@ -39,10 +39,11 @@ public function index(): string /** * Создание шаблона * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function create(Request $request): string + public function create(Request $request, Validator $validator): string { if ($request->isMethod('post')) { $token = check($request->input('token')); @@ -51,7 +52,6 @@ public function create(Request $request): string $text = check($request->input('text')); $protect = empty($request->input('protect')) ? 0 : 1; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->regex($type, '|^[a-z0-9_\-]+$|i', ['type' => 'Недопустимое название типа шаблона!']) ->length($type, 3, 20, ['type' => 'Слишком длинный или короткий тип шаблона!']) @@ -89,11 +89,12 @@ public function create(Request $request): string /** * Редактирование шаблона * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { /** @var Notice $notice */ $notice = Notice::query()->find($id); @@ -108,7 +109,6 @@ public function edit(int $id, Request $request): string $text = check($request->input('text')); $protect = empty($request->input('protect')) ? 0 : 1; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($name, 5, 100, ['name' => 'Слишком длинное или короткое название шаблона!']) ->length($text, 10, 65000, ['text' => 'Слишком длинный или короткий текст шаблона!']); @@ -138,19 +138,19 @@ public function edit(int $id, Request $request): string /** * Удаление шаблона * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return void * @throws \Exception */ - public function delete(int $id, Request $request): void + public function delete(int $id, Request $request, Validator $validator): void { /** @var Notice $notice */ $notice = Notice::query()->find($id); $token = check($request->input('token')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($notice, 'Не найден шаблон для удаления!') ->empty($notice->protect, 'Запрещено удалять защищенный шаблон!'); diff --git a/app/Controllers/Admin/OfferController.php b/app/Controllers/Admin/OfferController.php index 36588a295..5c0a272a4 100644 --- a/app/Controllers/Admin/OfferController.php +++ b/app/Controllers/Admin/OfferController.php @@ -88,11 +88,12 @@ public function view(int $id): string /** * Редактирование записи * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { $offer = Offer::query()->where('id', $id)->first(); @@ -108,7 +109,6 @@ public function edit(int $id, Request $request): string $type = check($request->input('type')); $closed = empty($request->input('closed')) ? 0 : 1; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['Неверный идентификатор сессии, повторите действие!']) ->length($title, 5, 50, ['title' => 'Слишком длинный или короткий заголовок!']) ->length($text, 5, 1000, ['text' => 'Слишком длинное или короткое описание!']) @@ -141,11 +141,12 @@ public function edit(int $id, Request $request): string /** * Ответ на предложение * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function reply(int $id, Request $request): string + public function reply(int $id, Request $request, Validator $validator): string { $offer = Offer::query()->where('id', $id)->first(); @@ -160,7 +161,6 @@ public function reply(int $id, Request $request): string $status = check($request->input('status')); $closed = empty($request->input('closed')) ? 0 : 1; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['Неверный идентификатор сессии, повторите действие!']) ->length($reply, 5, 3000, ['reply' => 'Слишком длинный или короткий текст ответа!']) ->in($status, array_keys(Offer::STATUSES), ['status' => 'Недопустимый статус предложения или проблемы!']); @@ -219,17 +219,17 @@ public function restatement(Request $request): void /** * Удаление записей * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function delete(Request $request): void + public function delete(Request $request, Validator $validator): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); $del = intar($request->input('del')); $type = $request->input('type') === Offer::OFFER ? Offer::OFFER : Offer::ISSUE; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true($del, 'Отсутствуют выбранные записи для удаления!'); diff --git a/app/Controllers/Admin/PhotoController.php b/app/Controllers/Admin/PhotoController.php index 2c39c1259..e554f4be8 100644 --- a/app/Controllers/Admin/PhotoController.php +++ b/app/Controllers/Admin/PhotoController.php @@ -44,11 +44,12 @@ public function index(): string /** * Редактирование ссылки * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { $page = int($request->input('page', 1)); $photo = Photo::query()->find($id); @@ -63,7 +64,6 @@ public function edit(int $id, Request $request): string $text = check($request->input('text')); $closed = empty($request->input('closed')) ? 0 : 1; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($title, 5, 50, ['title' => 'Слишком длинное или короткое название!']) ->length($text, 0, 1000, ['text' => 'Слишком длинное описание (Необходимо не более 1000 символов)!']); @@ -92,12 +92,13 @@ public function edit(int $id, Request $request): string /** * Удаление записей * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return void * @throws \Exception */ - public function delete(int $id, Request $request): void + public function delete(int $id, Request $request, Validator $validator): void { if (! is_writable(UPLOADS . '/photos')){ abort('default', 'Директория c фотографиями недоступна для записи!'); @@ -113,7 +114,6 @@ public function delete(int $id, Request $request): void abort(404, 'Данной фотографии не существует!'); } - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); if ($validator->isValid()) { diff --git a/app/Controllers/Admin/ReglistController.php b/app/Controllers/Admin/ReglistController.php index 42c8a55dc..b00109a60 100644 --- a/app/Controllers/Admin/ReglistController.php +++ b/app/Controllers/Admin/ReglistController.php @@ -20,10 +20,11 @@ public function __construct() /** * Главная страница * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function index(Request $request): string + public function index(Request $request, Validator $validator): string { if ($request->isMethod('post')) { $page = int($request->input('page', 1)); @@ -31,7 +32,6 @@ public function index(Request $request): string $choice = intar($request->input('choice')); $action = check($request->input('action')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($choice, 'Отсутствуют выбранные пользователи!') ->in($action, ['yes', 'no'], ['action' => 'Необходимо выбрать действие!']); diff --git a/app/Controllers/Admin/RekUserController.php b/app/Controllers/Admin/RekUserController.php index 23fd129d1..696340cfe 100644 --- a/app/Controllers/Admin/RekUserController.php +++ b/app/Controllers/Admin/RekUserController.php @@ -44,11 +44,12 @@ public function index(): string /** * Редактирование ссылки * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { $page = int($request->input('page', 1)); $link = RekUser::query()->find($id); @@ -64,7 +65,6 @@ public function edit(int $id, Request $request): string $color = check($request->input('color')); $bold = empty($request->input('bold')) ? 0 : 1; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->regex($site, '|^https?://([а-яa-z0-9_\-\.])+(\.([а-яa-z0-9\/\-?_=#])+)+$|iu', ['site' => 'Недопустимый адрес сайта!. Разрешены символы [а-яa-z0-9_-.?=#/]!']) ->length($site, 5, 50, ['site' => 'Слишком длинный или короткий адрес ссылки!']) @@ -96,17 +96,16 @@ public function edit(int $id, Request $request): string /** * Удаление записей * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function delete(Request $request): void + public function delete(Request $request, Validator $validator): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); $del = intar($request->input('del')); - $validator = new Validator(); - $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true($del, 'Отсутствуют выбранные записи для удаления!'); diff --git a/app/Controllers/Admin/RuleController.php b/app/Controllers/Admin/RuleController.php index e8f1bbe80..dbb4a706e 100644 --- a/app/Controllers/Admin/RuleController.php +++ b/app/Controllers/Admin/RuleController.php @@ -44,10 +44,11 @@ public function index(): string /** * Редактирование правил * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(Request $request): string + public function edit(Request $request, Validator $validator): string { $rules = Rule::query()->firstOrNew([]); @@ -55,7 +56,6 @@ public function edit(Request $request): string $token = check($request->input('token')); $msg = check($request->input('msg')); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($msg, ['msg' => 'Вы не ввели текст с правилами сайта!']); diff --git a/app/Controllers/Admin/SettingController.php b/app/Controllers/Admin/SettingController.php index 1f6a40046..d46ec86f7 100644 --- a/app/Controllers/Admin/SettingController.php +++ b/app/Controllers/Admin/SettingController.php @@ -24,10 +24,11 @@ public function __construct() /** * Главная страница * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function index(Request $request): string + public function index(Request $request, Validator $validator): string { $act = check($request->input('act', 'main')); @@ -42,7 +43,6 @@ public function index(Request $request): string $opt = check($request->input('opt')); $token = check($request->input('token')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) ->notEmpty($sets, ['sets' => 'Ошибка! Не переданы настройки сайта']); diff --git a/app/Controllers/Admin/SmileController.php b/app/Controllers/Admin/SmileController.php index 311a900ac..6230e4f60 100644 --- a/app/Controllers/Admin/SmileController.php +++ b/app/Controllers/Admin/SmileController.php @@ -46,10 +46,11 @@ public function index(): string /** * Добавление смайла * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function create(Request $request): string + public function create(Request $request, Validator $validator): string { if (! is_writable(UPLOADS.'/smiles')){ abort('default', 'Директория со смайлами недоступна для записи!'); @@ -60,7 +61,6 @@ public function create(Request $request): string $code = check(utfLower($request->input('code'))); $smile = $request->file('smile'); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($code, 2, 20, ['code' => 'Слишком длинный или короткий код смайла!']) ->regex($code, '|^:+[a-яa-z0-9_\-/\(\)]+$|i', ['code' => 'Код смайла должен начинаться с двоеточия. Разрешены буквы, цифры и дефис!']); @@ -103,11 +103,12 @@ public function create(Request $request): string /** * Редактирование смайла * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { /** @var Smile $smile */ $smile = Smile::query()->find($id); @@ -122,7 +123,6 @@ public function edit(int $id, Request $request): string $token = check($request->input('token')); $code = check(utfLower($request->input('code'))); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($code, 2, 20, ['code' => 'Слишком длинный или короткий код смайла!']) ->regex($code, '|^:+[a-яa-z0-9_\-/\(\)]+$|i', ['code' => 'Код смайла должен начинаться с двоеточия. Разрешены буквы, цифры и дефис!']); @@ -152,10 +152,11 @@ public function edit(int $id, Request $request): string /** * Удаление смайлов * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function delete(Request $request): void + public function delete(Request $request, Validator $validator): void { if (! is_writable(UPLOADS . '/smiles')){ abort('default', 'Директория со смайлами недоступна для записи!'); @@ -165,7 +166,6 @@ public function delete(Request $request): void $token = check($request->input('token')); $del = intar($request->input('del')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true($del, 'Отсутствуют выбранные смайлы для удаления!'); diff --git a/app/Controllers/Admin/SpamController.php b/app/Controllers/Admin/SpamController.php index 4054cf770..598023ab7 100644 --- a/app/Controllers/Admin/SpamController.php +++ b/app/Controllers/Admin/SpamController.php @@ -84,16 +84,16 @@ public function index(Request $request): string /** * Удаление жалоб * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void * @throws \Exception */ - public function delete(Request $request): void + public function delete(Request $request, Validator $validator): void { $id = int($request->input('id')); $token = check($request->input('token')); - $validator = new Validator(); $validator ->true($request->ajax(), 'Это не ajax запрос!') ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') diff --git a/app/Controllers/Admin/StatusController.php b/app/Controllers/Admin/StatusController.php index c3e03bce4..1fa604f37 100644 --- a/app/Controllers/Admin/StatusController.php +++ b/app/Controllers/Admin/StatusController.php @@ -36,10 +36,11 @@ public function index(): string /** * Добавление статуса * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function create(Request $request): string + public function create(Request $request, Validator $validator): string { if ($request->isMethod('post')) { $token = check($request->input('token')); @@ -48,7 +49,6 @@ public function create(Request $request): string $name = check($request->input('name')); $color = check($request->input('color')); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($name, 5, 30, ['name' => 'Слишком длинное или короткое название статуса!']) @@ -77,10 +77,11 @@ public function create(Request $request): string /** * Редактирование статуса * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(Request $request): string + public function edit(Request $request, Validator $validator): string { $id = int($request->input('id')); @@ -97,7 +98,6 @@ public function edit(Request $request): string $name = check($request->input('name')); $color = check($request->input('color')); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($name, 5, 30, ['name' => 'Слишком длинное или короткое название статуса!']) @@ -126,16 +126,16 @@ public function edit(Request $request): string /** * Удаление статуса * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void * @throws \Exception */ - public function delete(Request $request): void + public function delete(Request $request, Validator $validator): void { $token = check($request->input('token')); $id = int($request->input('id')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); $status = Status::query()->find($id); diff --git a/app/Controllers/Admin/UserController.php b/app/Controllers/Admin/UserController.php index db595d891..b132ba93d 100644 --- a/app/Controllers/Admin/UserController.php +++ b/app/Controllers/Admin/UserController.php @@ -73,10 +73,11 @@ public function search(Request $request): string /** * Редактирование пользователя * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(Request $request): string + public function edit(Request $request, Validator $validator): string { $login = check($request->input('user')); @@ -117,7 +118,6 @@ public function edit(Request $request): string $info = check($request->input('info')); $created = check($request->input('created')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->in($level, User::ALL_GROUPS, ['level' => 'Недопустимый уровень пользователя!']) ->length($password, 6, 20, 'Слишком длинный или короткий новый пароль!', false) @@ -192,11 +192,12 @@ public function edit(Request $request): string /** * Удаление пользователя * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string * @throws \Exception */ - public function delete(Request $request): string + public function delete(Request $request, Validator $validator): string { $login = check($request->input('user')); @@ -216,7 +217,6 @@ public function delete(Request $request): string $delcomments = empty($request->input('delcomments')) ? 0 : 1; $delimages = empty($request->input('delimages')) ? 0 : 1; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notIn($user->level, User::ADMIN_GROUPS, 'Запрещено удалять пользователей из группы администраторов!'); diff --git a/app/Controllers/Admin/VoteController.php b/app/Controllers/Admin/VoteController.php index 6e4125e2d..dd633db8c 100644 --- a/app/Controllers/Admin/VoteController.php +++ b/app/Controllers/Admin/VoteController.php @@ -64,11 +64,12 @@ public function history(): string /** * Редактирование голосования * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { $vote = Vote::query()->where('id', $id)->first(); @@ -82,7 +83,6 @@ public function edit(int $id, Request $request): string $title = check($request->input('title')); $answers = check($request->input('answers')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); $validator->length($title, 5, 100, ['title' => 'Слишком длинный или короткий текст вопроса!']); @@ -217,7 +217,7 @@ public function restatement(Request $request): void if ($token === $_SESSION['token']) { - DB::update('update votes set count = (select SUM(result) from voteanswer where votes.id = voteanswer.vote_id)'); + restatement('votes'); setFlash('success', 'Голосования успешно пересчитаны!'); } else { diff --git a/app/Controllers/Forum/ActiveController.php b/app/Controllers/Forum/ActiveController.php index b32dd6b26..556638de2 100644 --- a/app/Controllers/Forum/ActiveController.php +++ b/app/Controllers/Forum/ActiveController.php @@ -87,11 +87,12 @@ public function posts(): string /** * Удаление сообщений * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string * @throws \Exception */ - public function delete(Request $request): string + public function delete(Request $request, Validator $validator): string { if (! $request->ajax()) { redirect('/'); @@ -104,7 +105,6 @@ public function delete(Request $request): string $token = check($request->input('token')); $tid = int($request->input('tid')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); $post = Post::query() diff --git a/app/Controllers/Forum/ForumController.php b/app/Controllers/Forum/ForumController.php index 39d23d1be..89a340e6d 100644 --- a/app/Controllers/Forum/ForumController.php +++ b/app/Controllers/Forum/ForumController.php @@ -71,10 +71,11 @@ public function forum(int $id): string /** * Создание новой темы * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function create(Request $request): string + public function create(Request $request, Validator $validator): string { $fid = int($request->input('fid')); @@ -104,7 +105,6 @@ public function create(Request $request): string /** @var Forum $forum */ $forum = Forum::query()->find($fid); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($forum, ['fid' => 'Форума для новой темы не существует!']) ->equal(Flood::isFlood(), true, ['msg' => 'Антифлуд! Разрешается cоздавать темы раз в '.Flood::getPeriod().' сек!']) diff --git a/app/Controllers/Forum/TopicController.php b/app/Controllers/Forum/TopicController.php index c6c6b4c77..a0dc249f9 100644 --- a/app/Controllers/Forum/TopicController.php +++ b/app/Controllers/Forum/TopicController.php @@ -99,11 +99,12 @@ public function index(int $id): string /** * Создание сообщения * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return void */ - public function create(int $id, Request $request): void + public function create(int $id, Request $request, Validator $validator): void { $msg = check($request->input('msg')); $token = check($request->input('token')); @@ -123,7 +124,6 @@ public function create(int $id, Request $request): void abort(404, 'Выбранная вами тема не существует, возможно она была удалена!'); } - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) ->empty($topic->closed, ['msg' => 'Запрещено писать в закрытую тему!']) ->equal(Flood::isFlood(), true, ['msg' => 'Антифлуд! Разрешается отправлять сообщения раз в ' . Flood::getPeriod() . ' сек!']) @@ -224,11 +224,12 @@ public function create(int $id, Request $request): void /** * Удаление сообщений * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return void */ - public function delete(int $id, Request $request): void + public function delete(int $id, Request $request, Validator $validator): void { $token = check($request->input('token')); $del = intar($request->input('del')); @@ -243,7 +244,6 @@ public function delete(int $id, Request $request): void $isModer = \in_array(getUser('id'), explode(',', $topic->moderators), true) ? true : false; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true(getUser(), 'Для закрытия тем необходимо авторизоваться') ->notEmpty($del, 'Отстутствуют выбранные сообщения для удаления!') @@ -281,18 +281,18 @@ public function delete(int $id, Request $request): void /** * Закрытие темы * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return void */ - public function close(int $id, Request $request): void + public function close(int $id, Request $request, Validator $validator): void { $token = check($request->input('token')); /** @var Topic $topic */ $topic = Topic::query()->find($id); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true(getUser(), 'Для закрытия тем необходимо авторизоваться') ->gte(getUser('point'), setting('editforumpoint'), 'Для закрытия тем вам необходимо набрать ' . plural(setting('editforumpoint'), setting('scorename')) . '!') @@ -324,11 +324,12 @@ public function close(int $id, Request $request): void /** * Редактирование темы * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { if (! getUser()) { abort(403, 'Авторизуйтесь для изменения темы!'); @@ -363,8 +364,6 @@ public function edit(int $id, Request $request): string $title = check($request->input('title')); $msg = check($request->input('msg')); - - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($title, 5, 50, ['title' => 'Слишком длинное или короткое название темы!']); @@ -402,11 +401,12 @@ public function edit(int $id, Request $request): string /** * Редактирование сообщения * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function editPost(int $id, Request $request): string + public function editPost(int $id, Request $request, Validator $validator): string { $page = int($request->input('page')); @@ -444,7 +444,6 @@ public function editPost(int $id, Request $request): string $msg = check($request->input('msg')); $delfile = intar($request->input('delfile')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($msg, 5, setting('forumtextlength'), ['msg' => 'Слишком длинное или короткое сообщение!']); @@ -488,11 +487,12 @@ public function editPost(int $id, Request $request): string /** * Голосование * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return void */ - public function vote(int $id, Request $request): void + public function vote(int $id, Request $request, Validator $validator): void { if (! getUser()) { abort(403, 'Авторизуйтесь для голосования!'); @@ -508,7 +508,6 @@ public function vote(int $id, Request $request): void $poll = int($request->input('poll')); $page = int($request->input('page')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); if ($vote->closed) { diff --git a/app/Controllers/IgnoreController.php b/app/Controllers/IgnoreController.php index b45905715..fd508b927 100644 --- a/app/Controllers/IgnoreController.php +++ b/app/Controllers/IgnoreController.php @@ -24,17 +24,17 @@ public function __construct() /** * Главная страница * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function index(Request $request): string + public function index(Request $request, Validator $validator): string { if ($request->isMethod('post')) { $page = int($request->input('page', 1)); $token = check($request->input('token')); $login = check($request->input('user')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); $user = User::query()->where('login', $login)->first(); @@ -88,11 +88,12 @@ public function index(Request $request): string /** * Заметка для пользователя * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function note(int $id, Request $request): string + public function note(int $id, Request $request, Validator $validator): string { $ignore = Ignore::query() ->where('user_id', getUser('id')) @@ -108,7 +109,6 @@ public function note(int $id, Request $request): string $token = check($request->input('token')); $msg = check($request->input('msg')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) ->length($msg, 0, 1000, ['msg' => 'Слишком большая заметка, не более 1000 символов!']); @@ -132,15 +132,15 @@ public function note(int $id, Request $request): string /** * Удаление контактов * - * @param Request $request + * @param Request $request + * @param Validator $validator */ - public function delete(Request $request): void + public function delete(Request $request, Validator $validator): void { $page = int($request->input('page', 1)); $token = check($request->input('token')); $del = intar($request->input('del')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true($del, 'Отсутствуют выбранные пользователи для удаления!'); diff --git a/app/Controllers/Load/DownController.php b/app/Controllers/Load/DownController.php index 1dfe78795..f291865cf 100644 --- a/app/Controllers/Load/DownController.php +++ b/app/Controllers/Load/DownController.php @@ -55,11 +55,12 @@ public function index(int $id): string /** * Редактирование загрузки * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { /** @var Down $down */ $down = Down::query()->where('user_id', getUser('id'))->find($id); @@ -78,7 +79,6 @@ public function edit(int $id, Request $request): string $text = check($request->input('text')); $files = (array) $request->file('files'); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($title, 5, 50, ['title' => 'Слишком длинное или короткое название!']) ->length($text, 50, 5000, ['text' => 'Слишком длинное или короткое описание!']); @@ -159,10 +159,11 @@ public function deleteFile(int $id, int $fid): void /** * Создание загрузки * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function create(Request $request): string + public function create(Request $request, Validator $validator): string { $cid = int($request->input('cid')); @@ -194,7 +195,6 @@ public function create(Request $request): string /** @var Load $category */ $category = Load::query()->find($cid); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($title, 5, 50, ['title' => 'Слишком длинное или короткое название!']) @@ -265,11 +265,12 @@ public function create(Request $request): string /** * Голосование * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return void */ - public function vote(int $id, Request $request): void + public function vote(int $id, Request $request, Validator $validator): void { $token = check($request->input('token')); $score = int($request->input('score')); @@ -281,7 +282,6 @@ public function vote(int $id, Request $request): void abort(404, 'Данного файла не существует!'); } - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], ['score' => 'Неверный идентификатор сессии, повторите действие!']) ->true(getUser(), ['score' => 'Для голосования необходимо авторизоваться!']) @@ -332,10 +332,11 @@ public function vote(int $id, Request $request): void /** * Скачивание файла * - * @param $id + * @param int $id + * @param Validator $validator * @return void */ - public function download(int $id): void + public function download(int $id, Validator $validator): void { /** @var File $file */ $file = File::query()->where('relate_type', Down::class)->find($id); @@ -348,7 +349,6 @@ public function download(int $id): void abort('default', 'Данный файл еще не проверен модератором!'); } - $validator = new Validator(); $validator ->true(file_exists(HOME . $file->hash), 'Файла для скачивания не существует!'); @@ -381,11 +381,12 @@ public function download(int $id): void /** * Комментарии * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function comments(int $id, Request $request): string + public function comments(int $id, Request $request, Validator $validator): string { /** @var Down $down */ $down = Down::query()->find($id); @@ -403,7 +404,6 @@ public function comments(int $id, Request $request): string $token = check($request->input('token')); $msg = check($request->input('msg')); - $validator = new Validator(); $validator ->true(getUser(), 'Для добавления комментария необходимо авторизоваться!') ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -459,12 +459,13 @@ public function comments(int $id, Request $request): string /** * Подготовка к редактированию комментария * - * @param int $id - * @param int $cid - * @param Request $request + * @param int $id + * @param int $cid + * @param Request $request + * @param Validator $validator * @return string */ - public function editComment(int $id, int $cid, Request $request): string + public function editComment(int $id, int $cid, Request $request, Validator $validator): string { $down = Down::query()->find($id); @@ -497,7 +498,6 @@ public function editComment(int $id, int $cid, Request $request): string $msg = check($request->input('msg')); $page = int($request->input('page', 1)); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($msg, 5, 1000, ['msg' => 'Слишком длинный или короткий комментарий!']); diff --git a/app/Controllers/MailController.php b/app/Controllers/MailController.php index fce6281ec..b73489734 100644 --- a/app/Controllers/MailController.php +++ b/app/Controllers/MailController.php @@ -11,10 +11,11 @@ class MailController extends BaseController /** * Главная страница * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function index(Request $request): string + public function index(Request $request, Validator $validator): string { if ($request->isMethod('post')) { @@ -27,7 +28,6 @@ public function index(Request $request): string $email = getUser('email'); } - $validator = new Validator(); $validator->true(captchaVerify(), ['protect' => 'Не удалось пройти проверку captcha!']) ->length($name, 5, 100, ['name' => 'Слишком длинное или короткое имя']) ->length($message, 5, 50000, ['message' => 'Слишком длинное или короткое сообшение']) @@ -55,10 +55,11 @@ public function index(Request $request): string /** * Восстановление пароля * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function recovery(Request $request): string + public function recovery(Request $request, Validator $validator): string { if (getUser()) { abort('default', 'Вы авторизованы, восстановление пароля невозможно!'); @@ -74,7 +75,6 @@ public function recovery(Request $request): string abort('default', 'Пользователь с данным логином или email не найден!'); } - $validator = new Validator(); $validator->true(captchaVerify(), ['protect' => 'Не удалось пройти проверку captcha!']) ->lte($user['timepasswd'], SITETIME, ['user' => 'Восстанавливать пароль можно не чаще чем раз в 12 часов!']); @@ -108,10 +108,11 @@ public function recovery(Request $request): string /** * Восстановление пароля * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function restore(Request $request): ?string + public function restore(Request $request, Validator $validator): ?string { if (getUser()) { abort(403, 'Вы авторизованы, восстановление пароля невозможно!'); @@ -124,7 +125,6 @@ public function restore(Request $request): ?string abort('default', 'Ключ для восстановления недействителен!'); } - $validator = new Validator(); $validator->notEmpty($key, 'Отсутствует секретный код в ссылке для восстановления пароля!') ->notEmpty($user['keypasswd'], 'Данный пользователь не запрашивал восстановление пароля!') ->gte($user['timepasswd'], SITETIME, 'Секретный ключ для восстановления уже устарел!'); diff --git a/app/Controllers/MessageController.php b/app/Controllers/MessageController.php index e38a8bd8a..60950642b 100644 --- a/app/Controllers/MessageController.php +++ b/app/Controllers/MessageController.php @@ -81,10 +81,11 @@ public function outbox() /** * Отправка сообщений * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function send(Request $request): string + public function send(Request $request, Validator $validator): string { $login = check($request->input('user')); @@ -99,7 +100,6 @@ public function send(Request $request): string $token = check($request->input('token')); $msg = check($request->input('msg')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) ->true($user, ['user' => 'Пользователь не найден!']) ->length($msg, 5, 1000, ['msg' => 'Слишком длинное или короткое сообщение!']) @@ -169,16 +169,16 @@ public function send(Request $request): string /** * Удаление сообщений * - * @param Request $request + * @param Request $request + * @param Validator $validator */ - public function delete(Request $request): void + public function delete(Request $request, Validator $validator): void { $token = check($request->input('token')); $type = check($request->input('type')); $del = intar($request->input('del')); $page = int($request->input('page', 1)); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true($del, 'Отсутствуют выбранные сообщения для удаления!'); @@ -208,15 +208,15 @@ public function delete(Request $request): void /** * Очистка сообщений * - * @param Request $request + * @param Request $request + * @param Validator $validator */ - public function clear(Request $request): void + public function clear(Request $request, Validator $validator): void { $token = check($request->input('token')); $type = check($request->input('type')); $page = int($request->input('page', 1)); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->empty(getUser('newprivat'), 'У вас имеются непрочитанные сообщения!'); diff --git a/app/Controllers/NewsController.php b/app/Controllers/NewsController.php index f1211f9a1..bd903f071 100644 --- a/app/Controllers/NewsController.php +++ b/app/Controllers/NewsController.php @@ -62,11 +62,12 @@ public function view(int $id): string /** * Комментарии * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function comments(int $id, Request $request): string + public function comments(int $id, Request $request, Validator $validator): string { /** @var News $news */ $news = News::query()->find($id); @@ -79,7 +80,6 @@ public function comments(int $id, Request $request): string $msg = check($request->input('msg')); $token = check($request->input('token')); - $validator = new Validator(); $validator->true(getUser(), 'Чтобы добавить комментарий необходимо авторизоваться') ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->equal(Flood::isFlood(), true, ['msg' => 'Антифлуд! Разрешается комментировать раз в ' . Flood::getPeriod() . ' сек!']) @@ -147,12 +147,13 @@ public function comments(int $id, Request $request): string /** * Редактирование комментария * - * @param int $id - * @param int $cid - * @param Request $request + * @param int $id + * @param int $cid + * @param Request $request + * @param Validator $validator * @return string */ - public function editComment(int $id, int $cid, Request $request): string + public function editComment(int $id, int $cid, Request $request, Validator $validator): string { $page = int($request->input('page', 1)); @@ -185,7 +186,6 @@ public function editComment(int $id, int $cid, Request $request): string $msg = check($request->input('msg')); $token = check($request->input('token')); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($msg, 5, 1000, ['msg' => 'Слишком длинный или короткий комментарий!']); diff --git a/app/Controllers/NotebookController.php b/app/Controllers/NotebookController.php index 1c12c86d5..a3a41b2b7 100644 --- a/app/Controllers/NotebookController.php +++ b/app/Controllers/NotebookController.php @@ -37,16 +37,16 @@ public function index() /** * Редактирование * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(Request $request): string + public function edit(Request $request, Validator $validator): string { if ($request->isMethod('post')) { $token = check($request->input('token')); $msg = check($request->input('msg')); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) ->length($msg, 0, 10000, ['msg' => 'Слишком длинная запись!'], false); diff --git a/app/Controllers/OfferController.php b/app/Controllers/OfferController.php index db884f922..4fd9ead01 100644 --- a/app/Controllers/OfferController.php +++ b/app/Controllers/OfferController.php @@ -82,10 +82,11 @@ public function view(int $id): string /** * Создание записи * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function create(Request $request): string + public function create(Request $request, Validator $validator): string { if (! $user = getUser()) { abort(403, 'Авторизуйтесь для добавления записи!'); @@ -99,8 +100,6 @@ public function create(Request $request): string $title = check($request->input('title')); $text = check($request->input('text')); - - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['Неверный идентификатор сессии, повторите действие!']) ->length($title, 5, 50, ['title' => 'Слишком длинный или короткий заголовок!']) ->length($text, 5, 1000, ['text' => 'Слишком длинное или короткое описание!']) @@ -138,11 +137,12 @@ public function create(Request $request): string /** * Редактирование записи * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { if (! $user = getUser()) { abort(403, 'Авторизуйтесь для редактирования записи!'); @@ -168,7 +168,6 @@ public function edit(int $id, Request $request): string $text = check($request->input('text')); $type = check($request->input('type')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['Неверный идентификатор сессии, повторите действие!']) ->length($title, 5, 50, ['title' => 'Слишком длинный или короткий заголовок!']) ->length($text, 5, 1000, ['text' => 'Слишком длинное или короткое описание!']) @@ -200,11 +199,12 @@ public function edit(int $id, Request $request): string /** * Комментарии * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function comments(int $id, Request $request): string + public function comments(int $id, Request $request, Validator $validator): string { /** @var Offer $offer */ $offer = Offer::query()->find($id); @@ -218,7 +218,6 @@ public function comments(int $id, Request $request): string $token = check($request->input('token')); $msg = check($request->input('msg')); - $validator = new Validator(); $validator ->true(getUser(), 'Для добавления комментария необходимо авторизоваться!') ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -274,12 +273,13 @@ public function comments(int $id, Request $request): string /** * Подготовка к редактированию комментария * - * @param int $id - * @param int $cid - * @param Request $request + * @param int $id + * @param int $cid + * @param Request $request + * @param Validator $validator * @return string */ - public function editComment(int $id, int $cid, Request $request): string + public function editComment(int $id, int $cid, Request $request, Validator $validator): string { $page = int($request->input('page', 1)); @@ -313,7 +313,6 @@ public function editComment(int $id, int $cid, Request $request): string $msg = check($request->input('msg')); $page = int($request->input('page', 1)); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($msg, 5, 1000, ['msg' => 'Слишком длинный или короткий комментарий!']); diff --git a/app/Controllers/PhotoController.php b/app/Controllers/PhotoController.php index 82075d47b..c27684aba 100644 --- a/app/Controllers/PhotoController.php +++ b/app/Controllers/PhotoController.php @@ -63,10 +63,11 @@ public function view(int $id): string /** * Форма загрузки фото * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function create(Request $request): string + public function create(Request $request, Validator $validator): string { if (! getUser()) { abort(403, 'Для добавления фотографий небходимо авторизоваться!'); @@ -79,7 +80,6 @@ public function create(Request $request): string $text = check($request->input('text')); $closed = empty($request->input('closed')) ? 0 : 1; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($title, 5, 50, ['title' => 'Слишком длинное или короткое название!']) ->length($text, 0, 1000, ['text' => 'Слишком длинное описание!']) @@ -122,11 +122,12 @@ public function create(Request $request): string /** * Редактирование фото * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function edit(int $id, Request $request): string + public function edit(int $id, Request $request, Validator $validator): string { $page = int($request->input('page', 1)); @@ -147,7 +148,6 @@ public function edit(int $id, Request $request): string $text = check($request->input('text')); $closed = empty($request->input('closed')) ? 0 : 1; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($title, 5, 50, ['title' => 'Слишком длинное или короткое название!']) ->length($text, 0, 1000, ['text' => 'Слишком длинное описание!']); @@ -177,11 +177,12 @@ public function edit(int $id, Request $request): string /** * Список комментариев * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function comments(int $id, Request $request): string + public function comments(int $id, Request $request, Validator $validator): string { /** @var Photo $photo */ $photo = Photo::query()->find($id); @@ -194,7 +195,6 @@ public function comments(int $id, Request $request): string $msg = check($request->input('msg')); $token = check($request->input('token')); - $validator = new Validator(); $validator ->true(getUser(), 'Чтобы добавить комментарий необходимо авторизоваться') ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') @@ -256,12 +256,13 @@ public function comments(int $id, Request $request): string /** * Редактирование комментария * - * @param int $id - * @param int $cid - * @param Request $request + * @param int $id + * @param int $cid + * @param Request $request + * @param Validator $validator * @return string */ - public function editComment(int $id, int $cid, Request $request): string + public function editComment(int $id, int $cid, Request $request, Validator $validator): string { $page = int($request->input('page', 1)); @@ -300,7 +301,6 @@ public function editComment(int $id, int $cid, Request $request): string $msg = check($request->input('msg')); $token = check($request->input('token')); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($msg, 5, 1000, ['msg' => 'Слишком длинный или короткий комментарий!']) @@ -326,11 +326,12 @@ public function editComment(int $id, int $cid, Request $request): string /** * Удаление фотографий * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @throws \Exception */ - public function delete(int $id, Request $request): void + public function delete(int $id, Request $request, Validator $validator): void { $page = int($request->input('page', 1)); @@ -347,7 +348,6 @@ public function delete(int $id, Request $request): void abort(404, 'Выбранное вами фото не найдено или вы не автор этой фотографии!'); } - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->empty($photo->count_comments, 'Запрещено удалять фотографии к которым имеются комментарии!'); diff --git a/app/Controllers/PictureController.php b/app/Controllers/PictureController.php index c947b64cd..3f03d9bf7 100644 --- a/app/Controllers/PictureController.php +++ b/app/Controllers/PictureController.php @@ -25,17 +25,17 @@ public function __construct() /** * Главная страница * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function index(Request $request): string + public function index(Request $request, Validator $validator): string { if ($request->isMethod('post')) { $token = check($request->input('token')); $photo = $request->file('photo'); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['photo' => 'Неверный идентификатор сессии, повторите действие!']); $rules = [ @@ -83,13 +83,13 @@ public function index(Request $request): string /** * Удаление фотографии * - * @param Request $request + * @param Request $request + * @param Validator $validator */ - public function delete(Request $request): void + public function delete(Request $request, Validator $validator): void { $token = check($request->input('token')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['photo' => 'Неверный идентификатор сессии, повторите действие!']); diff --git a/app/Controllers/RatingController.php b/app/Controllers/RatingController.php index 46d26665f..34e2476aa 100644 --- a/app/Controllers/RatingController.php +++ b/app/Controllers/RatingController.php @@ -25,11 +25,12 @@ public function __construct() /** * Изменение рейтинга * - * @param string $login - * @param Request $request + * @param string $login + * @param Request $request + * @param Validator $validator * @return string */ - public function index(string $login, Request $request): string + public function index(string $login, Request $request, Validator $validator): string { $vote = $request->input('vote'); $user = User::query()->where('login', $login)->first(); @@ -62,7 +63,6 @@ public function index(string $login, Request $request): string $token = check($request->input('token')); $text = check($request->input('text')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($text, 5, 250, ['text' => 'Слишком длинный или короткий комментарий!']); @@ -172,16 +172,16 @@ public function gave(string $login): string /** * Удаление истории * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void * @throws \Exception */ - public function delete(Request $request): void + public function delete(Request $request, Validator $validator): void { $id = int($request->input('id')); $token = check($request->input('token')); - $validator = new Validator(); $validator ->true($request->ajax(), 'Это не ajax запрос!') ->true(isAdmin(User::ADMIN), 'Удалять рейтинг могут только администраторы') diff --git a/app/Controllers/RekUserController.php b/app/Controllers/RekUserController.php index c363d7d2f..ddba237f1 100644 --- a/app/Controllers/RekUserController.php +++ b/app/Controllers/RekUserController.php @@ -45,10 +45,11 @@ public function index(): string /** * Покупка рекламы * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function create(Request $request): string + public function create(Request $request, Validator $validator): string { if (! getUser()) { abort(403, 'Для покупки рекламы необходимо авторизоваться!'); @@ -89,7 +90,6 @@ public function create(Request $request): string $price += setting('rekuseroptprice'); } - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->gte(getUser('point'), setting('rekuserpoint'), 'Для покупки рекламы вам необходимо набрать '.plural(50, setting('scorename')).'!') ->true(captchaVerify(), ['protect' => 'Не удалось пройти проверку captcha!']) diff --git a/app/Controllers/SocialController.php b/app/Controllers/SocialController.php index a5825cb25..d36b10c29 100644 --- a/app/Controllers/SocialController.php +++ b/app/Controllers/SocialController.php @@ -79,17 +79,17 @@ public function index(Request $request): string /** * Удаление привязки * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @throws \Exception */ - public function delete(int $id, Request $request): void + public function delete(int $id, Request $request, Validator $validator): void { $token = check($request->input('token')); $social = Social::query()->where('user_id', $this->user->id)->find($id); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEmpty($social, 'Не найдена привязка к социальной сети!'); diff --git a/app/Controllers/TransferController.php b/app/Controllers/TransferController.php index 69b2497e5..df6fa5a27 100644 --- a/app/Controllers/TransferController.php +++ b/app/Controllers/TransferController.php @@ -41,16 +41,16 @@ public function index(): string /** * Перевод денег * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function send(Request $request): void + public function send(Request $request, Validator $validator): void { $money = int($request->input('money')); $msg = check($request->input('msg')); $token = check($request->input('token')); - $validator = new Validator(); $validator ->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) ->true($this->user, ['user' => 'Ошибка! Пользователь не найден!']) diff --git a/app/Controllers/User/BanController.php b/app/Controllers/User/BanController.php index 36d4c6849..e9aba3a18 100644 --- a/app/Controllers/User/BanController.php +++ b/app/Controllers/User/BanController.php @@ -13,10 +13,11 @@ class BanController extends BaseController /** * Бан пользователя * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function ban(Request $request): string + public function ban(Request $request, Validator $validator): string { if (! $user = getUser()) { abort(403, 'Вы не авторизованы!'); @@ -48,7 +49,6 @@ public function ban(Request $request): string $sendUser = getUserById($banhist->send_user_id); - $validator = new Validator(); $validator ->true(setting('addbansend'), 'Писать объяснительные запрещено администрацией!') ->true($banhist->explain, 'Ошибка! Вы уже писали объяснение!') diff --git a/app/Controllers/User/UserController.php b/app/Controllers/User/UserController.php index 681decf69..836e37ee5 100644 --- a/app/Controllers/User/UserController.php +++ b/app/Controllers/User/UserController.php @@ -39,11 +39,12 @@ public function index(string $login): string /** * Заметка * - * @param string $login - * @param Request $request + * @param string $login + * @param Request $request + * @param Validator $validator * @return string */ - public function note(string $login, Request $request): string + public function note(string $login, Request $request, Validator $validator): string { if (! isAdmin()) { abort(403, 'Данная страница доступна только администрации!'); @@ -58,7 +59,6 @@ public function note(string $login, Request $request): string $notice = check($request->input('notice')); $token = check($request->input('token')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], ['notice' => 'Неверный идентификатор сессии, повторите действие!']) ->length($notice, 0, 1000, ['notice' => 'Слишком большая заметка, не более 1000 символов!']); @@ -85,11 +85,12 @@ public function note(string $login, Request $request): string /** * Регистрация * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string * @throws ErrorException */ - public function register(Request $request): string + public function register(Request $request, Validator $validator): string { if (getUser()) { abort('403', 'Вы уже регистрировались, запрещено создавать несколько аккаунтов!'); @@ -111,7 +112,6 @@ public function register(Request $request): string $activateKey = null; $level = User::USER; - $validator = new Validator(); $validator->true(captchaVerify(), ['protect' => 'Не удалось пройти проверку captcha!']) ->regex($login, '|^[a-z0-9\-]+$|i', ['login' => 'Недопустимые символы в логине. Разрешены знаки латинского алфавита, цифры и дефис!']) ->regex(utfSubstr($login, 0, 1), '|^[a-z0-9]+$|i', ['login' => 'Логин должен начинаться с буквы или цифры!']) @@ -305,10 +305,11 @@ public function logout(Request $request): void /** * Редактирование профиля * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function profile(Request $request): string + public function profile(Request $request, Validator $validator): string { if (! $user = getUser()) { abort(403, 'Авторизуйтесь для изменения данных в профиле!'); @@ -328,7 +329,6 @@ public function profile(Request $request): string $birthday = check($request->input('birthday')); $gender = $request->input('gender') === 'male' ? 'male' : 'female'; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->regex($site, '#^https?://([а-яa-z0-9_\-\.])+(\.([а-яa-z0-9\/])+)+$#u', ['site' => 'Недопустимый адрес сайта, необходим формата http://my_site.domen!'], false) ->regex($birthday, '#^[0-9]{2}+\.[0-9]{2}+\.[0-9]{4}$#', ['birthday' => 'Недопустимый формат даты рождения, необходим формат дд.мм.гггг!'], false) @@ -412,10 +412,11 @@ public function key(Request $request): string /** * Настройки * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function setting(Request $request): string + public function setting(Request $request, Validator $validator): string { if (! $user = getUser()) { abort(403, 'Для изменения настроек необходимо авторизоваться!'); @@ -434,7 +435,6 @@ public function setting(Request $request): string $notify = $request->input('notify') ? 1 : 0; $subscribe = $request->input('subscribe') ? str_random(32) : null; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->regex($themes, '|^[a-z0-9_\-]+$|i', ['themes' => 'Недопустимое название темы!']) ->true(\in_array($themes, $setting['themes'], true) || empty($themes), ['themes' => 'Данная тема не установлена на сайте!']) @@ -480,11 +480,12 @@ public function account(): string /** * Инициализация изменения email * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void * @throws Exception */ - public function changeMail(Request $request): void + public function changeMail(Request $request, Validator $validator): void { if (! $user = getUser()) { abort(403, 'Для изменения данных необходимо авторизоваться!'); @@ -494,7 +495,6 @@ public function changeMail(Request $request): void $email = check(strtolower($request->input('email'))); $password = check($request->input('password')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->notEqual($email, $user->email, ['email' => 'Новый адрес email должен отличаться от текущего!']) ->email($email, ['email' => 'Неправильный адрес email, необходим формат name@site.domen!']) @@ -541,11 +541,12 @@ public function changeMail(Request $request): void /** * Изменение email * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void * @throws Exception */ - public function editMail(Request $request): void + public function editMail(Request $request, Validator $validator): void { if (! $user = getUser()) { abort(403, 'Для изменения данных необходимо авторизоваться!'); @@ -557,7 +558,6 @@ public function editMail(Request $request): void $changeMail = ChangeMail::query()->where('hash', $key)->where('user_id', $user->id)->first(); - $validator = new Validator(); $validator->notEmpty($key, 'Вы не ввели код изменения электронной почты!') ->notEmpty($changeMail, 'Данный код изменения электронной почты не найден в списке!'); @@ -590,10 +590,11 @@ public function editMail(Request $request): void /** * Изменение статуса * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function editStatus(Request $request): void + public function editStatus(Request $request, Validator $validator): void { if (! $user = getUser()) { abort(403, 'Для изменения данных необходимо авторизоваться!'); @@ -603,7 +604,6 @@ public function editStatus(Request $request): void $status = check($request->input('status')); $cost = $status ? setting('editstatusmoney') : 0; - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->empty($user->ban, ['status' => 'Для изменения статуса у вас не должно быть нарушений!']) ->notEqual($status, $user->status, ['status' => 'Новый статус должен отличаться от текущего!']) @@ -636,10 +636,11 @@ public function editStatus(Request $request): void /** * Изменение пароля * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return void */ - public function editPassword(Request $request): void + public function editPassword(Request $request, Validator $validator): void { if (! $user = getUser()) { abort(403, 'Для изменения данных необходимо авторизоваться!'); @@ -650,7 +651,6 @@ public function editPassword(Request $request): void $newpass2 = check($request->input('newpass2')); $oldpass = check($request->input('oldpass')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->true(password_verify($oldpass, $user->password), ['oldpass' => 'Введенный пароль не совпадает с данными в профиле!']) ->length($newpass, 6, 20, ['newpass' => 'Слишком длинный или короткий новый пароль!']) diff --git a/app/Controllers/VoteController.php b/app/Controllers/VoteController.php index 94c25681f..bec4cc342 100644 --- a/app/Controllers/VoteController.php +++ b/app/Controllers/VoteController.php @@ -34,11 +34,12 @@ public function index(): string /** * Просмотр голосования * - * @param int $id - * @param Request $request + * @param int $id + * @param Request $request + * @param Validator $validator * @return string */ - public function view(int $id, Request $request): string + public function view(int $id, Request $request, Validator $validator): string { $show = $request->input('show'); @@ -70,7 +71,6 @@ public function view(int $id, Request $request): string $token = check($request->input('token')); $poll = int($request->input('poll')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->empty($vote->poll, 'Вы уже проголосовали в этом опросе!') ->notEmpty($poll, 'Вы не выбрали вариант ответа!'); @@ -202,10 +202,11 @@ public function viewHistory(int $id): string /** * Создание голосования * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function create(Request $request): string + public function create(Request $request, Validator $validator): string { if ($request->isMethod('post')) { @@ -213,7 +214,6 @@ public function create(Request $request): string $question = check($request->input('question')); $answers = check($request->input('answer')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($question, 5, 100, ['question' => 'Слишком длинный или короткий текст вопроса!']); diff --git a/app/Controllers/WallController.php b/app/Controllers/WallController.php index 297e1f078..f6dcceb20 100644 --- a/app/Controllers/WallController.php +++ b/app/Controllers/WallController.php @@ -50,11 +50,12 @@ public function index(string $login): string /** * Добавление сообщения * - * @param string $login - * @param Request $request + * @param string $login + * @param Request $request + * @param Validator $validator * @return void */ - public function create($login, Request $request): void + public function create($login, Request $request, Validator $validator): void { if (! getUser()) { abort(403, 'Для отправки сообщений необходимо авторизоваться!'); @@ -70,7 +71,6 @@ public function create($login, Request $request): void $token = check($request->input('token')); $msg = check($request->input('msg')); - $validator = new Validator(); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($msg, 5, 1000, ['msg' => 'Слишком длинное или короткое сообщение!']) ->equal(Flood::isFlood(), true, ['msg' => 'Антифлуд! Разрешается отправлять сообщения раз в ' . Flood::getPeriod() . ' сек!']); @@ -117,18 +117,18 @@ public function create($login, Request $request): void /** * Удаление сообщений * - * @param string $login - * @param Request $request + * @param string $login + * @param Request $request + * @param Validator $validator * @return void */ - public function delete(string $login, Request $request): void + public function delete(string $login, Request $request, Validator $validator): void { $id = int($request->input('id')); $token = check($request->input('token')); $user = User::query()->where('login', $login)->first(); - $validator = new Validator(); $validator ->true($request->ajax(), 'Это не ajax запрос!') ->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') diff --git a/app/helpers.php b/app/helpers.php index c29422a17..3ca57e779 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -1265,6 +1265,10 @@ function restatement($mode) case 'boards': DB::update('update boards set count_items = (select count(*) from items where boards.id = items.board_id and items.expires_at > ' . SITETIME . ');'); break; + + case 'votes': + DB::update('update votes set count = (select ifnull(sum(result), 0) from voteanswer where votes.id = voteanswer.vote_id)'); + break; } } From 988a97b9049cb110b3f46c151d8c4b6adec3a341 Mon Sep 17 00:00:00 2001 From: visavi Date: Sun, 14 Oct 2018 23:20:35 +0300 Subject: [PATCH 050/163] travis test --- app/Controllers/Admin/AdminController.php | 4 ++-- tests/RouterTest.php | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 tests/RouterTest.php diff --git a/app/Controllers/Admin/AdminController.php b/app/Controllers/Admin/AdminController.php index 6e3ab5db3..9f4f9292c 100644 --- a/app/Controllers/Admin/AdminController.php +++ b/app/Controllers/Admin/AdminController.php @@ -46,11 +46,11 @@ public function main(): string /** * Проверка обновлений * + * @param PhinxApplication $app * @return string */ - public function upgrade(): string + public function upgrade(PhinxApplication $app): string { - $app = new PhinxApplication(); $wrap = new TextWrapper($app); $app->setName('Rotor by Vantuz - http://visavi.net'); diff --git a/tests/RouterTest.php b/tests/RouterTest.php new file mode 100644 index 000000000..59b725098 --- /dev/null +++ b/tests/RouterTest.php @@ -0,0 +1,16 @@ +get('//' . $_SERVER['SERVER_NAME'] . '/guestbooks'); + + $this->assertEquals(200, $curl->getHttpStatusCode()); + + } +} From 38e92dccb519a18d408240ad51b8012ac8dc43c4 Mon Sep 17 00:00:00 2001 From: visavi Date: Mon, 15 Oct 2018 03:19:11 +0300 Subject: [PATCH 051/163] travis --- .travis.yml | 3 ++- tests/RouterTest.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1409da829..933e890aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -language: php +language: phpSITE_URL php: - 7.1 @@ -30,6 +30,7 @@ env: - DB_DATABASE=test - DB_USERNAME=root - DB_PASSWORD= + - SITE_URL=//localhost after_success: - travis_retry php vendor/bin/php-coveralls -v diff --git a/tests/RouterTest.php b/tests/RouterTest.php index 59b725098..2eae8fd1c 100644 --- a/tests/RouterTest.php +++ b/tests/RouterTest.php @@ -8,7 +8,7 @@ class RouterTest extends TestCase public function testRouter(): void { $curl = new Curl(); - $curl->get('//' . $_SERVER['SERVER_NAME'] . '/guestbooks'); + $curl->get(env('SITE_URL') . '/guestbooks'); $this->assertEquals(200, $curl->getHttpStatusCode()); From 48fc6343496d13175d548c958d908f4fea2ea52b Mon Sep 17 00:00:00 2001 From: visavi Date: Mon, 15 Oct 2018 03:26:19 +0300 Subject: [PATCH 052/163] travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 933e890aa..afef83926 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -language: phpSITE_URL +language: php php: - 7.1 From 829e9340ecf0a19587ccb5afbd8d80543f83f27f Mon Sep 17 00:00:00 2001 From: visavi Date: Mon, 15 Oct 2018 23:08:02 +0300 Subject: [PATCH 053/163] travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index afef83926..4ea3f6592 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ env: - DB_DATABASE=test - DB_USERNAME=root - DB_PASSWORD= - - SITE_URL=//localhost + - SITE_URL=//127.0.0.1 after_success: - travis_retry php vendor/bin/php-coveralls -v From bd17aef2ac61a7a8991d7964223224418580ff7d Mon Sep 17 00:00:00 2001 From: visavi Date: Mon, 15 Oct 2018 23:14:15 +0300 Subject: [PATCH 054/163] travis --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4ea3f6592..1ef55c0ce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,10 @@ script: - mkdir -p build/logs - vendor/bin/phpunit --coverage-clover build/logs/clover.xml --stderr +addons: + hosts: + - rotor.ll + env: global: - APP_ENV=testing @@ -30,7 +34,7 @@ env: - DB_DATABASE=test - DB_USERNAME=root - DB_PASSWORD= - - SITE_URL=//127.0.0.1 + - SITE_URL=http://rotor.ll after_success: - travis_retry php vendor/bin/php-coveralls -v From 9ce79dc1e7fd93a55d7cb364199508536d988699 Mon Sep 17 00:00:00 2001 From: visavi Date: Tue, 16 Oct 2018 00:39:09 +0300 Subject: [PATCH 055/163] travis --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1ef55c0ce..ac4ecb385 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,8 +22,7 @@ script: - vendor/bin/phpunit --coverage-clover build/logs/clover.xml --stderr addons: - hosts: - - rotor.ll + hostname: rotor.ll env: global: From ff4330aded55106431b4493f138701431b32132e Mon Sep 17 00:00:00 2001 From: visavi Date: Wed, 17 Oct 2018 00:17:03 +0300 Subject: [PATCH 056/163] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=82=D0=B5=D1=81=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 4 ---- ...ollerTest.php => GuestbookControllerTest.php} | 3 ++- tests/RouterTest.php | 16 ---------------- 3 files changed, 2 insertions(+), 21 deletions(-) rename tests/{GuestControllerTest.php => GuestbookControllerTest.php} (91%) delete mode 100644 tests/RouterTest.php diff --git a/.travis.yml b/.travis.yml index ac4ecb385..1409da829 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,9 +21,6 @@ script: - mkdir -p build/logs - vendor/bin/phpunit --coverage-clover build/logs/clover.xml --stderr -addons: - hostname: rotor.ll - env: global: - APP_ENV=testing @@ -33,7 +30,6 @@ env: - DB_DATABASE=test - DB_USERNAME=root - DB_PASSWORD= - - SITE_URL=http://rotor.ll after_success: - travis_retry php vendor/bin/php-coveralls -v diff --git a/tests/GuestControllerTest.php b/tests/GuestbookControllerTest.php similarity index 91% rename from tests/GuestControllerTest.php rename to tests/GuestbookControllerTest.php index c618518de..fb3260efd 100644 --- a/tests/GuestControllerTest.php +++ b/tests/GuestbookControllerTest.php @@ -5,7 +5,7 @@ class GuestbookControllerTest extends TestCase { - public function testGuest() + public function testGuest(): void { $guest = new Guestbook(); $guest->user_id = 1; @@ -17,6 +17,7 @@ public function testGuest() $this->assertTrue($guest->save()); + /** @var Guestbook $getGuest */ $getGuest = Guestbook::query()->find($guest->id); $this->assertEquals($getGuest->text, 'Test text message'); diff --git a/tests/RouterTest.php b/tests/RouterTest.php deleted file mode 100644 index 2eae8fd1c..000000000 --- a/tests/RouterTest.php +++ /dev/null @@ -1,16 +0,0 @@ -get(env('SITE_URL') . '/guestbooks'); - - $this->assertEquals(200, $curl->getHttpStatusCode()); - - } -} From 4049921fb1fb04fae3ff5a2469b0ea3539957ae9 Mon Sep 17 00:00:00 2001 From: visavi Date: Thu, 18 Oct 2018 01:09:47 +0300 Subject: [PATCH 057/163] package-lock.json update --- package-lock.json | 2598 ++------------------------------------------- 1 file changed, 114 insertions(+), 2484 deletions(-) diff --git a/package-lock.json b/package-lock.json index 62e9e93a1..5d995bbd0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -126,14 +126,6 @@ "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=" }, - "ansi-gray": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-gray/-/ansi-gray-0.1.1.tgz", - "integrity": "sha1-KWLPVOyXksSFEKPetSRDaGHvclE=", - "requires": { - "ansi-wrap": "0.1.0" - } - }, "ansi-html": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.7.tgz", @@ -152,11 +144,6 @@ "color-convert": "^1.9.0" } }, - "ansi-wrap": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", - "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=" - }, "anymatch": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", @@ -171,21 +158,6 @@ "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" }, - "archive-type": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/archive-type/-/archive-type-3.2.0.tgz", - "integrity": "sha1-nNnABpV+vpX62tW9YJiUKoE3N/Y=", - "requires": { - "file-type": "^3.1.0" - }, - "dependencies": { - "file-type": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", - "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=" - } - } - }, "are-we-there-yet": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", @@ -218,11 +190,6 @@ "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=" }, - "array-differ": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", - "integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=" - }, "array-find-index": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", @@ -311,11 +278,6 @@ "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=" }, - "async-each-series": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/async-each-series/-/async-each-series-1.1.0.tgz", - "integrity": "sha1-9C/YFV048hpbjqB8KOBj7RcAsTg=" - }, "async-foreach": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/async-foreach/-/async-foreach-0.1.3.tgz", @@ -1050,11 +1012,6 @@ } } }, - "base64-js": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-0.0.8.tgz", - "integrity": "sha1-EQHpVE9KdrG8OybUUsqW16NeeXg=" - }, "batch": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", @@ -1069,112 +1026,16 @@ "tweetnacl": "^0.14.3" } }, - "beeper": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.1.tgz", - "integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=" - }, "big.js": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==" }, - "bin-build": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/bin-build/-/bin-build-2.2.0.tgz", - "integrity": "sha1-EfjdYfcP/Por3KpbRvXo/t1CIcw=", - "requires": { - "archive-type": "^3.0.1", - "decompress": "^3.0.0", - "download": "^4.1.2", - "exec-series": "^1.0.0", - "rimraf": "^2.2.6", - "tempfile": "^1.0.0", - "url-regex": "^3.0.0" - }, - "dependencies": { - "tempfile": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/tempfile/-/tempfile-1.1.1.tgz", - "integrity": "sha1-W8xOrsxKsscH2LwR2ZzMmiyyh/I=", - "requires": { - "os-tmpdir": "^1.0.0", - "uuid": "^2.0.1" - } - }, - "uuid": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", - "integrity": "sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho=" - } - } - }, - "bin-check": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/bin-check/-/bin-check-2.0.0.tgz", - "integrity": "sha1-hvjm9CU4k99g3DFpV/WvAqywWTA=", - "requires": { - "executable": "^1.0.0" - } - }, - "bin-version": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/bin-version/-/bin-version-1.0.4.tgz", - "integrity": "sha1-nrSY7m/Xb3q5p8FgQ2+JV5Q1144=", - "requires": { - "find-versions": "^1.0.0" - } - }, - "bin-version-check": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/bin-version-check/-/bin-version-check-2.1.0.tgz", - "integrity": "sha1-5OXfKQuQaffRETJAMe/BP90RpbA=", - "requires": { - "bin-version": "^1.0.0", - "minimist": "^1.1.0", - "semver": "^4.0.3", - "semver-truncate": "^1.0.0" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" - }, - "semver": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", - "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=" - } - } - }, - "bin-wrapper": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/bin-wrapper/-/bin-wrapper-3.0.2.tgz", - "integrity": "sha1-Z9MwYmLksaXy+I7iNGT2plVneus=", - "requires": { - "bin-check": "^2.0.0", - "bin-version-check": "^2.1.0", - "download": "^4.0.0", - "each-async": "^1.1.1", - "lazy-req": "^1.0.0", - "os-filter-obj": "^1.0.0" - } - }, "binary-extensions": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=" }, - "bl": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", - "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", - "requires": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, "block-stream": { "version": "0.0.9", "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", @@ -1230,11 +1091,6 @@ "multicast-dns-service-types": "^1.1.0" } }, - "boolbase": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" - }, "boom": { "version": "2.10.1", "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", @@ -1365,40 +1221,6 @@ "electron-to-chromium": "^1.3.30" } }, - "buffer": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-3.6.0.tgz", - "integrity": "sha1-pyyTb3e5a/UvX357RnGAYoVR3vs=", - "requires": { - "base64-js": "0.0.8", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" - } - }, - "buffer-alloc": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", - "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", - "requires": { - "buffer-alloc-unsafe": "^1.1.0", - "buffer-fill": "^1.0.0" - } - }, - "buffer-alloc-unsafe": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", - "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" - }, - "buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=" - }, - "buffer-fill": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", - "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=" - }, "buffer-from": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz", @@ -1409,29 +1231,6 @@ "resolved": "https://registry.npmjs.org/buffer-indexof/-/buffer-indexof-1.1.1.tgz", "integrity": "sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g==" }, - "buffer-to-vinyl": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-to-vinyl/-/buffer-to-vinyl-1.1.0.tgz", - "integrity": "sha1-APFfruOreh3aLN5tkSG//dB7ImI=", - "requires": { - "file-type": "^3.1.0", - "readable-stream": "^2.0.2", - "uuid": "^2.0.1", - "vinyl": "^1.0.0" - }, - "dependencies": { - "file-type": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", - "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=" - }, - "uuid": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", - "integrity": "sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho=" - } - } - }, "buffer-xor": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", @@ -1550,34 +1349,11 @@ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000865.tgz", "integrity": "sha512-vs79o1mOSKRGv/1pSkp4EXgl4ZviWeYReXw60XfacPU64uQWZwJT6vZNmxRF9O+6zu71sJwMxLK5JXxbzuVrLw==" }, - "capture-stack-trace": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz", - "integrity": "sha1-Sm+gc5nCa7pH8LJJa00PtAjFVQ0=" - }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, - "caw": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/caw/-/caw-1.2.0.tgz", - "integrity": "sha1-/7Im/n78VHKI3GLuPpcHPCEtEDQ=", - "requires": { - "get-proxy": "^1.0.1", - "is-obj": "^1.0.0", - "object-assign": "^3.0.0", - "tunnel-agent": "^0.4.0" - }, - "dependencies": { - "object-assign": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", - "integrity": "sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I=" - } - } - }, "center-align": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", @@ -1760,11 +1536,6 @@ } } }, - "clone-stats": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", - "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=" - }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -1823,11 +1594,6 @@ "color-name": "^1.0.0" } }, - "color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==" - }, "colormin": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/colormin/-/colormin-1.1.2.tgz", @@ -1919,15 +1685,6 @@ "globs": "^0.1.2" } }, - "config-chain": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.11.tgz", - "integrity": "sha1-q6CXR9++TD5w52am5BWG4YWfxvI=", - "requires": { - "ini": "^1.3.4", - "proto-list": "~1.2.1" - } - }, "connect-history-api-fallback": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.5.0.tgz", @@ -1946,11 +1703,6 @@ "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" }, - "console-stream": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/console-stream/-/console-stream-0.1.1.tgz", - "integrity": "sha1-oJX+B7IEZZVfL6/Si11yvM2UnUQ=" - }, "consolidate": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/consolidate/-/consolidate-0.14.5.tgz", @@ -2062,14 +1814,6 @@ "elliptic": "^6.0.0" } }, - "create-error-class": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", - "integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=", - "requires": { - "capture-stack-trace": "^1.0.0" - } - }, "create-hash": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", @@ -2162,22 +1906,82 @@ "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz", "integrity": "sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=" }, - "css-select": { - "version": "1.3.0-rc0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.3.0-rc0.tgz", - "integrity": "sha1-b5MZaqrnN2ZuoQNqjLFKj8t6kjE=", + "css-loader": { + "version": "0.28.11", + "resolved": "http://registry.npmjs.org/css-loader/-/css-loader-0.28.11.tgz", + "integrity": "sha512-wovHgjAx8ZIMGSL8pTys7edA1ClmzxHeY6n/d97gg5odgsxEgKjULPR0viqyC+FWMCL9sfqoC/QCUBo62tLvPg==", "requires": { - "boolbase": "^1.0.0", - "css-what": "2.1", - "domutils": "1.5.1", - "nth-check": "^1.0.1" + "babel-code-frame": "^6.26.0", + "css-selector-tokenizer": "^0.7.0", + "cssnano": "^3.10.0", + "icss-utils": "^2.1.0", + "loader-utils": "^1.0.2", + "lodash.camelcase": "^4.3.0", + "object-assign": "^4.1.1", + "postcss": "^5.0.6", + "postcss-modules-extract-imports": "^1.2.0", + "postcss-modules-local-by-default": "^1.2.0", + "postcss-modules-scope": "^1.1.0", + "postcss-modules-values": "^1.3.0", + "postcss-value-parser": "^3.3.0", + "source-list-map": "^2.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" + }, + "chalk": { + "version": "1.1.3", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "dependencies": { + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" + } + } + }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=" + }, + "postcss": { + "version": "5.2.18", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-5.2.18.tgz", + "integrity": "sha512-zrUjRRe1bpXKsX1qAJNJjqZViErVuyEkMTRrwu4ud4sbTtIBRmtaYDrHmcGgmrbsW3MHfmtIf+vJumgQn+PrXg==", + "requires": { + "chalk": "^1.1.3", + "js-base64": "^2.1.9", + "source-map": "^0.5.6", + "supports-color": "^3.2.3" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + }, + "supports-color": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "requires": { + "has-flag": "^1.0.0" + } + } } }, - "css-select-base-adapter": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/css-select-base-adapter/-/css-select-base-adapter-0.1.0.tgz", - "integrity": "sha1-AQKz0UYw34bD65+p9UVicBBs+ZA=" - }, "css-selector-tokenizer": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/css-selector-tokenizer/-/css-selector-tokenizer-0.7.0.tgz", @@ -2200,32 +2004,6 @@ } } }, - "css-tree": { - "version": "1.0.0-alpha25", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha25.tgz", - "integrity": "sha512-XC6xLW/JqIGirnZuUWHXCHRaAjje2b3OIB0Vj5RIJo6mIi/AdJo30quQl5LxUl0gkXDIrTrFGbMlcZjyFplz1A==", - "requires": { - "mdn-data": "^1.0.0", - "source-map": "^0.5.3" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" - } - } - }, - "css-url-regex": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/css-url-regex/-/css-url-regex-1.1.0.tgz", - "integrity": "sha1-g4NCMMyfdMRX3lnuvRVD/uuDt+w=" - }, - "css-what": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.0.tgz", - "integrity": "sha1-lGfQMsOM+u+58teVASUwYvh/ob0=" - }, "cssesc": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-0.1.0.tgz", @@ -2404,11 +2182,6 @@ "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=" }, - "dateformat": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-2.2.0.tgz", - "integrity": "sha1-QGXiATz5+5Ft39gu+1Bq1MZ2kGI=" - }, "de-indent": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz", @@ -2432,168 +2205,11 @@ "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" }, - "decompress": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/decompress/-/decompress-3.0.0.tgz", - "integrity": "sha1-rx3VDQbjv8QyRh033hGzjA2ZG+0=", - "requires": { - "buffer-to-vinyl": "^1.0.0", - "concat-stream": "^1.4.6", - "decompress-tar": "^3.0.0", - "decompress-tarbz2": "^3.0.0", - "decompress-targz": "^3.0.0", - "decompress-unzip": "^3.0.0", - "stream-combiner2": "^1.1.1", - "vinyl-assign": "^1.0.1", - "vinyl-fs": "^2.2.0" - } - }, - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "requires": { - "mimic-response": "^1.0.0" - } - }, - "decompress-tar": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-3.1.0.tgz", - "integrity": "sha1-IXx4n5uURQ76rcXF5TeXj8MzxGY=", - "requires": { - "is-tar": "^1.0.0", - "object-assign": "^2.0.0", - "strip-dirs": "^1.0.0", - "tar-stream": "^1.1.1", - "through2": "^0.6.1", - "vinyl": "^0.4.3" - }, - "dependencies": { - "clone": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", - "integrity": "sha1-xhJqkK1Pctv1rNskPMN3JP6T/B8=" - }, - "object-assign": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-2.1.1.tgz", - "integrity": "sha1-Q8NuXVaf+OSBbE76i+AtJpZ8GKo=" - }, - "vinyl": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz", - "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", - "requires": { - "clone": "^0.2.0", - "clone-stats": "^0.0.1" - } - } - } - }, - "decompress-tarbz2": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-3.1.0.tgz", - "integrity": "sha1-iyOTVoE1X58YnYclag+L3ZbZZm0=", - "requires": { - "is-bzip2": "^1.0.0", - "object-assign": "^2.0.0", - "seek-bzip": "^1.0.3", - "strip-dirs": "^1.0.0", - "tar-stream": "^1.1.1", - "through2": "^0.6.1", - "vinyl": "^0.4.3" - }, - "dependencies": { - "clone": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", - "integrity": "sha1-xhJqkK1Pctv1rNskPMN3JP6T/B8=" - }, - "object-assign": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-2.1.1.tgz", - "integrity": "sha1-Q8NuXVaf+OSBbE76i+AtJpZ8GKo=" - }, - "vinyl": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz", - "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", - "requires": { - "clone": "^0.2.0", - "clone-stats": "^0.0.1" - } - } - } - }, - "decompress-targz": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-3.1.0.tgz", - "integrity": "sha1-ssE9+YFmJomRtxXWRH9kLpaW9aA=", - "requires": { - "is-gzip": "^1.0.0", - "object-assign": "^2.0.0", - "strip-dirs": "^1.0.0", - "tar-stream": "^1.1.1", - "through2": "^0.6.1", - "vinyl": "^0.4.3" - }, - "dependencies": { - "clone": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", - "integrity": "sha1-xhJqkK1Pctv1rNskPMN3JP6T/B8=" - }, - "object-assign": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-2.1.1.tgz", - "integrity": "sha1-Q8NuXVaf+OSBbE76i+AtJpZ8GKo=" - }, - "vinyl": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz", - "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", - "requires": { - "clone": "^0.2.0", - "clone-stats": "^0.0.1" - } - } - } - }, - "decompress-unzip": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-3.4.0.tgz", - "integrity": "sha1-YUdbQVIGa74/7hL51inRX+ZHjus=", - "requires": { - "is-zip": "^1.0.0", - "read-all-stream": "^3.0.0", - "stat-mode": "^0.2.0", - "strip-dirs": "^1.0.0", - "through2": "^2.0.0", - "vinyl": "^1.0.0", - "yauzl": "^2.2.1" - }, - "dependencies": { - "through2": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", - "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", - "requires": { - "readable-stream": "^2.1.5", - "xtend": "~4.0.1" - } - } - } - }, "deep-equal": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=" }, - "deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" - }, "define-properties": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz", @@ -2732,41 +2348,11 @@ "buffer-indexof": "^1.0.0" } }, - "dom-serializer": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", - "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", - "requires": { - "domelementtype": "~1.1.1", - "entities": "~1.1.1" - }, - "dependencies": { - "domelementtype": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", - "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=" - } - } - }, "domain-browser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==" }, - "domelementtype": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz", - "integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI=" - }, - "domutils": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", - "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, "dotenv": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-4.0.0.tgz", @@ -2777,41 +2363,6 @@ "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-4.2.0.tgz", "integrity": "sha1-3vHxyl1gWdJKdm5YeULCEQbOEnU=" }, - "download": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/download/-/download-4.4.3.tgz", - "integrity": "sha1-qlX9rTktldS2jowr4D4MKqIbqaw=", - "requires": { - "caw": "^1.0.1", - "concat-stream": "^1.4.7", - "each-async": "^1.0.0", - "filenamify": "^1.0.1", - "got": "^5.0.0", - "gulp-decompress": "^1.2.0", - "gulp-rename": "^1.2.0", - "is-url": "^1.2.0", - "object-assign": "^4.0.1", - "read-all-stream": "^3.0.0", - "readable-stream": "^2.0.2", - "stream-combiner2": "^1.1.1", - "vinyl": "^1.0.0", - "vinyl-fs": "^2.2.0", - "ware": "^1.2.0" - } - }, - "duplexer2": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", - "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", - "requires": { - "readable-stream": "^2.0.2" - } - }, - "duplexer3": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", - "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=" - }, "duplexify": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.0.tgz", @@ -2823,15 +2374,6 @@ "stream-shift": "^1.0.0" } }, - "each-async": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/each-async/-/each-async-1.1.1.tgz", - "integrity": "sha1-3uUim98KtrogEqOV4bhpq/iBNHM=", - "requires": { - "onetime": "^1.0.0", - "set-immediate-shim": "^1.0.0" - } - }, "ecc-jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", @@ -2894,11 +2436,6 @@ "tapable": "^0.2.7" } }, - "entities": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", - "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=" - }, "errno": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", @@ -3104,27 +2641,6 @@ "safe-buffer": "^5.1.1" } }, - "exec-buffer": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/exec-buffer/-/exec-buffer-3.2.0.tgz", - "integrity": "sha512-wsiD+2Tp6BWHoVv3B+5Dcx6E7u5zky+hUwOHjuH2hKSLR3dvRmX8fk8UD8uqQixHs4Wk6eDmiegVrMPjKj7wpA==", - "requires": { - "execa": "^0.7.0", - "p-finally": "^1.0.0", - "pify": "^3.0.0", - "rimraf": "^2.5.4", - "tempfile": "^2.0.0" - } - }, - "exec-series": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/exec-series/-/exec-series-1.0.3.tgz", - "integrity": "sha1-bSV6m+rEgqhyx3g7yGFYOfx3FDo=", - "requires": { - "async-each-series": "^1.1.0", - "object-assign": "^4.1.0" - } - }, "execa": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", @@ -3139,14 +2655,6 @@ "strip-eof": "^1.0.0" } }, - "executable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/executable/-/executable-1.1.0.tgz", - "integrity": "sha1-h3mA6REvM5EGbaNyZd562ENKtNk=", - "requires": { - "meow": "^3.1.0" - } - }, "expand-brackets": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", @@ -3279,23 +2787,6 @@ } } }, - "ext-list": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/ext-list/-/ext-list-2.2.2.tgz", - "integrity": "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA==", - "requires": { - "mime-db": "^1.28.0" - } - }, - "ext-name": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ext-name/-/ext-name-5.0.0.tgz", - "integrity": "sha512-yblEwXAbGv1VQDmow7s38W77hzAgJAO50ztBLMcUyUBfxv1HC+LGwtiEN+Co6LtlqT/5uwVOxsD4TNIilWhwdQ==", - "requires": { - "ext-list": "^2.0.0", - "sort-keys-length": "^1.0.0" - } - }, "extend": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", @@ -3395,16 +2886,6 @@ "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" }, - "fancy-log": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.2.tgz", - "integrity": "sha1-9BEl49hPLn2JpD0G2VjI94vha+E=", - "requires": { - "ansi-gray": "^0.1.1", - "color-support": "^1.1.3", - "time-stamp": "^1.0.0" - } - }, "fast-deep-equal": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", @@ -3428,23 +2909,6 @@ "websocket-driver": ">=0.5.1" } }, - "fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", - "requires": { - "pend": "~1.2.0" - } - }, - "figures": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", - "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", - "requires": { - "escape-string-regexp": "^1.0.5", - "object-assign": "^4.1.0" - } - }, "file-loader": { "version": "0.11.2", "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-0.11.2.tgz", @@ -3453,31 +2917,11 @@ "loader-utils": "^1.0.2" } }, - "file-type": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-4.4.0.tgz", - "integrity": "sha1-G2AOX8ofvcboDApwxxyNul95BsU=" - }, "filename-regex": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=" }, - "filename-reserved-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-1.0.0.tgz", - "integrity": "sha1-5hz4BfDeHJhFZ9A4bcXfUO5a9+Q=" - }, - "filenamify": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-1.2.1.tgz", - "integrity": "sha1-qfL/0RxQO+0wABUCknI3jx8TZaU=", - "requires": { - "filename-reserved-regex": "^1.0.0", - "strip-outer": "^1.0.0", - "trim-repeated": "^1.0.0" - } - }, "fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -3531,22 +2975,6 @@ "locate-path": "^2.0.0" } }, - "find-versions": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-1.2.1.tgz", - "integrity": "sha1-y96fEuOFdaCvG+G5osXV/Y8Ya2I=", - "requires": { - "array-uniq": "^1.0.0", - "get-stdin": "^4.0.1", - "meow": "^3.5.0", - "semver-regex": "^1.0.0" - } - }, - "first-chunk-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz", - "integrity": "sha1-Wb+1DNkF9g18OUzT2ayqtOatk04=" - }, "flatten": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz", @@ -3673,11 +3101,6 @@ "readable-stream": "^2.0.0" } }, - "fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" - }, "fs-extra": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-3.0.1.tgz", @@ -3739,13 +3162,11 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, - "optional": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3758,18 +3179,15 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "concat-map": { "version": "0.0.1", - "bundled": true, - "optional": true + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "core-util-is": { "version": "1.0.2", @@ -3872,8 +3290,7 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, - "optional": true + "bundled": true }, "ini": { "version": "1.3.5", @@ -3883,7 +3300,6 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3896,20 +3312,17 @@ "minimatch": { "version": "3.0.4", "bundled": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true, - "optional": true + "bundled": true }, "minipass": { "version": "2.2.4", "bundled": true, - "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -3926,7 +3339,6 @@ "mkdirp": { "version": "0.5.1", "bundled": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -3999,8 +3411,7 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, - "optional": true + "bundled": true }, "object-assign": { "version": "4.1.1", @@ -4010,7 +3421,6 @@ "once": { "version": "1.4.0", "bundled": true, - "optional": true, "requires": { "wrappy": "1" } @@ -4116,7 +3526,6 @@ "string-width": { "version": "1.0.2", "bundled": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -4244,14 +3653,6 @@ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==" }, - "get-proxy": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/get-proxy/-/get-proxy-1.1.0.tgz", - "integrity": "sha1-iUhUSRvFkbDxR9euVw9cZ4tyVus=", - "requires": { - "rc": "^1.1.2" - } - }, "get-stdin": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", @@ -4282,16 +3683,6 @@ } } }, - "gifsicle": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/gifsicle/-/gifsicle-3.0.4.tgz", - "integrity": "sha1-9Fy17RAWW2ZdySng6TKLbIId+js=", - "requires": { - "bin-build": "^2.0.0", - "bin-wrapper": "^3.0.0", - "logalot": "^2.0.0" - } - }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", @@ -4356,115 +3747,6 @@ } } }, - "glob-stream": { - "version": "5.3.5", - "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-5.3.5.tgz", - "integrity": "sha1-pVZlqajM3EGRWofHAeMtTgFvrSI=", - "requires": { - "extend": "^3.0.0", - "glob": "^5.0.3", - "glob-parent": "^3.0.0", - "micromatch": "^2.3.7", - "ordered-read-streams": "^0.3.0", - "through2": "^0.6.0", - "to-absolute-glob": "^0.1.1", - "unique-stream": "^2.0.2" - }, - "dependencies": { - "arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", - "requires": { - "arr-flatten": "^1.0.1" - } - }, - "array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=" - }, - "braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", - "requires": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" - } - }, - "expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", - "requires": { - "is-posix-bracket": "^0.1.0" - } - }, - "extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", - "requires": { - "is-extglob": "^1.0.0" - } - }, - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", - "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "requires": { - "is-extglob": "^1.0.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "requires": { - "is-buffer": "^1.1.5" - } - }, - "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", - "requires": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" - } - } - } - }, "globals": { "version": "9.18.0", "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", @@ -4507,204 +3789,39 @@ "minimatch": "~3.0.2" } }, - "glogg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.1.tgz", - "integrity": "sha512-ynYqXLoluBKf9XGR1gA59yEJisIL7YHEH4xr3ZziHB5/yl4qWfaK8Js9jGe6gBGCSCKVqiyO30WnRZADvemUNw==", - "requires": { - "sparkles": "^1.0.0" - } - }, - "got": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/got/-/got-5.7.1.tgz", - "integrity": "sha1-X4FjWmHkplifGAVp6k44FoClHzU=", - "requires": { - "create-error-class": "^3.0.1", - "duplexer2": "^0.1.4", - "is-redirect": "^1.0.0", - "is-retry-allowed": "^1.0.0", - "is-stream": "^1.0.0", - "lowercase-keys": "^1.0.0", - "node-status-codes": "^1.0.0", - "object-assign": "^4.0.1", - "parse-json": "^2.1.0", - "pinkie-promise": "^2.0.0", - "read-all-stream": "^3.0.0", - "readable-stream": "^2.0.5", - "timed-out": "^3.0.0", - "unzip-response": "^1.0.2", - "url-parse-lax": "^1.0.0" - } - }, "graceful-fs": { "version": "4.1.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" }, - "graceful-readlink": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", - "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=" - }, "growly": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=" }, - "gulp-decompress": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/gulp-decompress/-/gulp-decompress-1.2.0.tgz", - "integrity": "sha1-jutlpeAV+O2FMsr+KEVJYGJvDcc=", - "requires": { - "archive-type": "^3.0.0", - "decompress": "^3.0.0", - "gulp-util": "^3.0.1", - "readable-stream": "^2.0.2" - } + "handle-thing": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-1.2.5.tgz", + "integrity": "sha1-/Xqtcmvxpf0W38KbL3pmAdJxOcQ=" }, - "gulp-rename": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-1.3.0.tgz", - "integrity": "sha512-nEuZB7/9i0IZ8AXORTizl2QLP9tcC9uWc/s329zElBLJw1CfOhmMXBxwVlCRKjDyrWuhVP0uBKl61KeQ32TiCg==" + "har-schema": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", + "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=" }, - "gulp-sourcemaps": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-1.6.0.tgz", - "integrity": "sha1-uG/zSdgBzrVuHZ59x7vLS33uYAw=", + "har-validator": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", + "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", "requires": { - "convert-source-map": "^1.1.1", - "graceful-fs": "^4.1.2", - "strip-bom": "^2.0.0", - "through2": "^2.0.0", - "vinyl": "^1.0.0" + "ajv": "^4.9.1", + "har-schema": "^1.0.5" }, "dependencies": { - "through2": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", - "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", - "requires": { - "readable-stream": "^2.1.5", - "xtend": "~4.0.1" - } - } - } - }, - "gulp-util": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.8.tgz", - "integrity": "sha1-AFTh50RQLifATBh8PsxQXdVLu08=", - "requires": { - "array-differ": "^1.0.0", - "array-uniq": "^1.0.2", - "beeper": "^1.0.0", - "chalk": "^1.0.0", - "dateformat": "^2.0.0", - "fancy-log": "^1.1.0", - "gulplog": "^1.0.0", - "has-gulplog": "^0.1.0", - "lodash._reescape": "^3.0.0", - "lodash._reevaluate": "^3.0.0", - "lodash._reinterpolate": "^3.0.0", - "lodash.template": "^3.0.0", - "minimist": "^1.1.0", - "multipipe": "^0.1.2", - "object-assign": "^3.0.0", - "replace-ext": "0.0.1", - "through2": "^2.0.0", - "vinyl": "^0.5.0" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" - }, - "object-assign": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", - "integrity": "sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I=" - }, - "replace-ext": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", - "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=" - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" - }, - "through2": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", - "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", - "requires": { - "readable-stream": "^2.1.5", - "xtend": "~4.0.1" - } - }, - "vinyl": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.5.3.tgz", - "integrity": "sha1-sEVbOPxeDPMNQyUTLkYZcMIJHN4=", - "requires": { - "clone": "^1.0.0", - "clone-stats": "^0.0.1", - "replace-ext": "0.0.1" - } - } - } - }, - "gulplog": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz", - "integrity": "sha1-4oxNRdBey77YGDY86PnFkmIp/+U=", - "requires": { - "glogg": "^1.0.0" - } - }, - "handle-thing": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-1.2.5.tgz", - "integrity": "sha1-/Xqtcmvxpf0W38KbL3pmAdJxOcQ=" - }, - "har-schema": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", - "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=" - }, - "har-validator": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", - "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", - "requires": { - "ajv": "^4.9.1", - "har-schema": "^1.0.5" - }, - "dependencies": { - "ajv": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", - "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", + "ajv": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", "requires": { "co": "^4.6.0", "json-stable-stringify": "^1.0.1" @@ -4733,27 +3850,6 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, - "has-gulplog": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz", - "integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=", - "requires": { - "sparkles": "^1.0.0" - } - }, - "has-symbol-support-x": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz", - "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw==" - }, - "has-to-string-tag-x": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz", - "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==", - "requires": { - "has-symbol-support-x": "^1.4.1" - } - }, "has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", @@ -5100,206 +4196,11 @@ "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz", "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=" }, - "imagemin": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/imagemin/-/imagemin-5.3.1.tgz", - "integrity": "sha1-8Zwu7h5xumxlWMUV+fyWaAGJptQ=", - "requires": { - "file-type": "^4.1.0", - "globby": "^6.1.0", - "make-dir": "^1.0.0", - "p-pipe": "^1.1.0", - "pify": "^2.3.0", - "replace-ext": "^1.0.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" - } - } - }, - "imagemin-gifsicle": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/imagemin-gifsicle/-/imagemin-gifsicle-5.2.0.tgz", - "integrity": "sha512-K01m5QuPK+0en8oVhiOOAicF7KjrHlCZxS++mfLI2mV/Ksfq/Y9nCXCWDz6jRv13wwlqe5T7hXT+ji2DnLc2yQ==", - "requires": { - "exec-buffer": "^3.0.0", - "gifsicle": "^3.0.0", - "is-gif": "^1.0.0" - } - }, - "imagemin-mozjpeg": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/imagemin-mozjpeg/-/imagemin-mozjpeg-7.0.0.tgz", - "integrity": "sha1-2SZHf8bvXzp2ikIi97LYCNPrpWg=", - "requires": { - "execa": "^0.8.0", - "is-jpg": "^1.0.0", - "mozjpeg": "^5.0.0" - }, - "dependencies": { - "execa": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.8.0.tgz", - "integrity": "sha1-2NdrvBtVIX7RkP1t1J08d07PyNo=", - "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - } - } - }, - "imagemin-optipng": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/imagemin-optipng/-/imagemin-optipng-5.2.1.tgz", - "integrity": "sha1-0i2kEsCfX/AKQzmWC5ioix2+hpU=", - "requires": { - "exec-buffer": "^3.0.0", - "is-png": "^1.0.0", - "optipng-bin": "^3.0.0" - } - }, - "imagemin-pngquant": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/imagemin-pngquant/-/imagemin-pngquant-5.1.0.tgz", - "integrity": "sha512-RtIUPbp8/HYX5EKY6p/L1NLKnkxNj37I92IFNsrptzBVql8FqBgPra9DO/eUgE4EWx+zq6ih4a/Y9YhF3pNM5A==", - "requires": { - "execa": "^0.10.0", - "is-png": "^1.0.0", - "is-stream": "^1.1.0", - "pngquant-bin": "^4.0.0" - }, - "dependencies": { - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "execa": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.10.0.tgz", - "integrity": "sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw==", - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - } - } - }, - "imagemin-svgo": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/imagemin-svgo/-/imagemin-svgo-6.0.0.tgz", - "integrity": "sha512-xwjBZQKpbkklHtJYnCOwRJjTRJA/nR0hQzKMh+CUZRvm/L0QwKKPJQ9tkPWQHrg+cydPu2i1vLgHuy2E0hKEkg==", - "requires": { - "buffer-from": "^0.1.1", - "is-svg": "^2.0.0", - "svgo": "^1.0.0" - }, - "dependencies": { - "buffer-from": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-0.1.2.tgz", - "integrity": "sha512-RiWIenusJsmI2KcvqQABB83tLxCByE3upSP8QU3rJDMVFGPWLvPQJt/O1Su9moRWeH7d+Q2HYb68f6+v+tw2vg==" - }, - "coa": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/coa/-/coa-2.0.1.tgz", - "integrity": "sha512-5wfTTO8E2/ja4jFSxePXlG5nRu5bBtL/r1HCIpJW/lzT6yDtKl0u0Z4o/Vpz32IpKmBn7HerheEZQgA9N2DarQ==", - "requires": { - "q": "^1.1.2" - } - }, - "csso": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/csso/-/csso-3.5.1.tgz", - "integrity": "sha512-vrqULLffYU1Q2tLdJvaCYbONStnfkfimRxXNaGjxMldI0C7JPBC4rB1RyjhfdZ4m1frm8pM9uRPKH3d2knZ8gg==", - "requires": { - "css-tree": "1.0.0-alpha.29" - }, - "dependencies": { - "css-tree": { - "version": "1.0.0-alpha.29", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.29.tgz", - "integrity": "sha512-sRNb1XydwkW9IOci6iB2xmy8IGCj6r/fr+JWitvJ2JxQRPzN3T4AGGVWCMlVmVwM1gtgALJRmGIlWv5ppnGGkg==", - "requires": { - "mdn-data": "~1.1.0", - "source-map": "^0.5.3" - } - } - } - }, - "esprima": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==" - }, - "js-yaml": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", - "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" - }, - "svgo": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-1.0.5.tgz", - "integrity": "sha512-nYrifviB77aNKDNKKyuay3M9aYiK6Hv5gJVDdjj2ZXTQmI8WZc8+UPLR5IpVlktJfSu3co/4XcWgrgI6seGBPg==", - "requires": { - "coa": "~2.0.1", - "colors": "~1.1.2", - "css-select": "~1.3.0-rc0", - "css-select-base-adapter": "~0.1.0", - "css-tree": "1.0.0-alpha25", - "css-url-regex": "^1.1.0", - "csso": "^3.5.0", - "js-yaml": "~3.10.0", - "mkdirp": "~0.5.1", - "object.values": "^1.0.4", - "sax": "~1.2.4", - "stable": "~0.1.6", - "unquote": "~1.1.1", - "util.promisify": "~1.0.0" - } - } - } - }, "img-loader": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/img-loader/-/img-loader-2.0.1.tgz", - "integrity": "sha512-cD5D+zzIDvVPyX9nmz6+GL20BfpRUKUEXFur9IPeUC8/LRJT/PQ3YJVyKelIum8R5rCVZXgSFB0ccpsnS4IyAQ==", - "requires": { - "imagemin": "^5.3.1", - "imagemin-gifsicle": "^5.2.0", - "imagemin-mozjpeg": "^7.0.0", - "imagemin-optipng": "^5.2.0", - "imagemin-pngquant": "^5.0.1", - "imagemin-svgo": "^6.0.0", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/img-loader/-/img-loader-3.0.0.tgz", + "integrity": "sha512-2TuWF+qS5zcXPbE+w1Yoquizy4slmEKmAlAuNlRAvzZ1F9JK2wkbtx8FfkIxBqEr56cbLiT2Xg2HgPt03SgrjQ==", + "requires": { "loader-utils": "^1.1.0" } }, @@ -5370,11 +4271,6 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, - "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" - }, "internal-ip": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/internal-ip/-/internal-ip-1.2.0.tgz", @@ -5406,24 +4302,11 @@ "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" }, - "ip-regex": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-1.0.3.tgz", - "integrity": "sha1-3FiQdvZZ9BnCIgOaMzFvHHOH7/0=" - }, "ipaddr.js": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz", "integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs=" }, - "is-absolute": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-0.1.7.tgz", - "integrity": "sha1-hHSREZ/MtftDYhfMc39/qtUPYD8=", - "requires": { - "is-relative": "^0.1.0" - } - }, "is-absolute-url": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.1.0.tgz", @@ -5473,11 +4356,6 @@ "builtin-modules": "^1.0.0" } }, - "is-bzip2": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-bzip2/-/is-bzip2-1.0.0.tgz", - "integrity": "sha1-XuWOqlounIDiFAe+3yOuWsCRs/w=" - }, "is-callable": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", @@ -5564,11 +4442,6 @@ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" }, - "is-gif": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-gif/-/is-gif-1.0.0.tgz", - "integrity": "sha1-ptKumIkwB7/6l6HYwB1jIFgyCX4=" - }, "is-glob": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", @@ -5577,21 +4450,6 @@ "is-extglob": "^2.1.1" } }, - "is-gzip": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-gzip/-/is-gzip-1.0.0.tgz", - "integrity": "sha1-bKiwe5nHeZgCWQDlVc7Y7YCHmoM=" - }, - "is-jpg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-jpg/-/is-jpg-1.0.1.tgz", - "integrity": "sha1-KW1X/dmc4BBDSnKD40armhA16XU=" - }, - "is-natural-number": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-2.1.1.tgz", - "integrity": "sha1-fUxXKDd+84bD4ZSpkRv1fG3DNec=" - }, "is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", @@ -5610,16 +4468,6 @@ } } }, - "is-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", - "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=" - }, - "is-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz", - "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=" - }, "is-path-cwd": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", @@ -5654,11 +4502,6 @@ "isobject": "^3.0.1" } }, - "is-png": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-png/-/is-png-1.1.0.tgz", - "integrity": "sha1-1XSxK/J1wDUEVVcLDltXqwYgd84=" - }, "is-posix-bracket": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", @@ -5669,11 +4512,6 @@ "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=" }, - "is-redirect": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", - "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=" - }, "is-regex": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", @@ -5682,16 +4520,6 @@ "has": "^1.0.1" } }, - "is-relative": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-0.1.3.tgz", - "integrity": "sha1-kF/uiuhvRbPsYUvDwVyGnfCHboI=" - }, - "is-retry-allowed": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", - "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=" - }, "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", @@ -5710,31 +4538,16 @@ "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz", "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=" }, - "is-tar": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-tar/-/is-tar-1.0.0.tgz", - "integrity": "sha1-L2suF5LB9bs2UZrKqdZcDSb+hT0=" - }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, - "is-url": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz", - "integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==" - }, "is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" }, - "is-valid-glob": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-0.3.0.tgz", - "integrity": "sha1-1LVcafUYhvm2XHDWwmItN+KfSP4=" - }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -5745,11 +4558,6 @@ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=" }, - "is-zip": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-zip/-/is-zip-1.0.0.tgz", - "integrity": "sha1-R7Co/004p2QxzP2ZqOFaTIa6IyU=" - }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -5770,15 +4578,6 @@ "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, - "isurl": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz", - "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==", - "requires": { - "has-to-string-tag-x": "^1.2.0", - "is-object": "^1.0.1" - } - }, "js-base64": { "version": "2.4.5", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.4.5.tgz", @@ -5894,9 +4693,9 @@ "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" }, "laravel-mix": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/laravel-mix/-/laravel-mix-2.1.11.tgz", - "integrity": "sha512-+iDqVPOuHSq6Ng/WX0w8V2O7R8847u1N1jybB/AAuRca3nRw4iI9BNNJ307ViiXb1GulxKixLe67shPFatJjvQ==", + "version": "2.1.14", + "resolved": "https://registry.npmjs.org/laravel-mix/-/laravel-mix-2.1.14.tgz", + "integrity": "sha512-M/Vzgr6+QQGukciAQ91SZvOhUyrPm41bq/nRyF2j2HR8/g3vzvTQbRkdTGOpq9Z+y3REEj8qR2A3ScnEG37Dgw==", "requires": { "autoprefixer": "^7.2.6", "babel-core": "^6.24.1", @@ -5904,7 +4703,7 @@ "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-plugin-transform-runtime": "^6.23.0", "babel-preset-env": "^1.5.1", - "chokidar": "^2.0.0", + "chokidar": "^2.0.3", "clean-css": "^4.1.3", "concatenate": "0.0.2", "css-loader": "^0.28.9", @@ -5916,10 +4715,10 @@ "fs-extra": "^3.0.1", "glob": "^7.1.2", "html-loader": "^0.4.5", - "img-loader": "^2.0.1", + "img-loader": "^3.0.0", "lodash": "^4.17.5", "md5": "^2.2.1", - "node-sass": "^4.7.2", + "node-sass": "^4.9.0", "postcss-loader": "^2.1.0", "resolve-url-loader": "^2.2.1", "sass-loader": "^6.0.5", @@ -5934,82 +4733,6 @@ "webpack-merge": "^4.1.0", "webpack-notifier": "^1.5.1", "yargs": "^8.0.2" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - }, - "dependencies": { - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" - } - } - }, - "css-loader": { - "version": "0.28.11", - "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-0.28.11.tgz", - "integrity": "sha512-wovHgjAx8ZIMGSL8pTys7edA1ClmzxHeY6n/d97gg5odgsxEgKjULPR0viqyC+FWMCL9sfqoC/QCUBo62tLvPg==", - "requires": { - "babel-code-frame": "^6.26.0", - "css-selector-tokenizer": "^0.7.0", - "cssnano": "^3.10.0", - "icss-utils": "^2.1.0", - "loader-utils": "^1.0.2", - "lodash.camelcase": "^4.3.0", - "object-assign": "^4.1.1", - "postcss": "^5.0.6", - "postcss-modules-extract-imports": "^1.2.0", - "postcss-modules-local-by-default": "^1.2.0", - "postcss-modules-scope": "^1.1.0", - "postcss-modules-values": "^1.3.0", - "postcss-value-parser": "^3.3.0", - "source-list-map": "^2.0.0" - } - }, - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=" - }, - "postcss": { - "version": "5.2.18", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-5.2.18.tgz", - "integrity": "sha512-zrUjRRe1bpXKsX1qAJNJjqZViErVuyEkMTRrwu4ud4sbTtIBRmtaYDrHmcGgmrbsW3MHfmtIf+vJumgQn+PrXg==", - "requires": { - "chalk": "^1.1.3", - "js-base64": "^2.1.9", - "source-map": "^0.5.6", - "supports-color": "^3.2.3" - } - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" - }, - "supports-color": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", - "requires": { - "has-flag": "^1.0.0" - } - } } }, "lazy-cache": { @@ -6017,19 +4740,6 @@ "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=" }, - "lazy-req": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/lazy-req/-/lazy-req-1.1.0.tgz", - "integrity": "sha1-va6+rTD42CQDnODOFJ1Nqge6H6w=" - }, - "lazystream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz", - "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", - "requires": { - "readable-stream": "^2.0.5" - } - }, "lcid": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", @@ -6100,16 +4810,6 @@ "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=" }, - "lodash._basetostring": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz", - "integrity": "sha1-0YYdh3+CSlL2aYMtyvPuFVZqB9U=" - }, - "lodash._basevalues": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz", - "integrity": "sha1-W3dXYoAr3j0yl1A+JjAIIP32Ybc=" - }, "lodash._bindcallback": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz", @@ -6135,26 +4835,6 @@ "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=" }, - "lodash._reescape": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reescape/-/lodash._reescape-3.0.0.tgz", - "integrity": "sha1-Kx1vXf4HyKNVdT5fJ/rH8c3hYWo=" - }, - "lodash._reevaluate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz", - "integrity": "sha1-WLx0xAZklTrgsSTYBpltrKQx4u0=" - }, - "lodash._reinterpolate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", - "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=" - }, - "lodash._root": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", - "integrity": "sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI=" - }, "lodash.assign": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", @@ -6180,14 +4860,6 @@ "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" }, - "lodash.escape": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz", - "integrity": "sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg=", - "requires": { - "lodash._root": "^3.0.0" - } - }, "lodash.isarguments": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", @@ -6198,11 +4870,6 @@ "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=" }, - "lodash.isequal": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=" - }, "lodash.keys": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", @@ -6226,52 +4893,18 @@ "lodash.restparam": { "version": "3.6.1", "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", - "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=" - }, - "lodash.tail": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.tail/-/lodash.tail-4.1.1.tgz", - "integrity": "sha1-0jM6NtnncXyK0vfKyv7HwytERmQ=" - }, - "lodash.template": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.2.tgz", - "integrity": "sha1-+M3sxhaaJVvpCYrosMU9N4kx0U8=", - "requires": { - "lodash._basecopy": "^3.0.0", - "lodash._basetostring": "^3.0.0", - "lodash._basevalues": "^3.0.0", - "lodash._isiterateecall": "^3.0.0", - "lodash._reinterpolate": "^3.0.0", - "lodash.escape": "^3.0.0", - "lodash.keys": "^3.0.0", - "lodash.restparam": "^3.0.0", - "lodash.templatesettings": "^3.0.0" - } + "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=" }, - "lodash.templatesettings": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz", - "integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=", - "requires": { - "lodash._reinterpolate": "^3.0.0", - "lodash.escape": "^3.0.0" - } + "lodash.tail": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.tail/-/lodash.tail-4.1.1.tgz", + "integrity": "sha1-0jM6NtnncXyK0vfKyv7HwytERmQ=" }, "lodash.uniq": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" }, - "logalot": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/logalot/-/logalot-2.1.0.tgz", - "integrity": "sha1-X46MkNME7fElMJUaVVSruMXj9VI=", - "requires": { - "figures": "^1.3.5", - "squeak": "^1.0.0" - } - }, "loglevel": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.1.tgz", @@ -6304,22 +4937,6 @@ "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", "integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw=" }, - "lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==" - }, - "lpad-align": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/lpad-align/-/lpad-align-1.1.2.tgz", - "integrity": "sha1-IfYArBwwlcPG5JfuZyce4ISB/p4=", - "requires": { - "get-stdin": "^4.0.1", - "indent-string": "^2.1.0", - "longest": "^1.0.0", - "meow": "^3.3.0" - } - }, "lru-cache": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", @@ -6384,11 +5001,6 @@ "inherits": "^2.0.1" } }, - "mdn-data": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-1.1.4.tgz", - "integrity": "sha512-FSYbp3lyKjyj3E7fMl6rYvUdX0FBXaluGqlFoYESWQlyUTq8R+wp0rkFxoYFqZlHCvsUXGjyJmLQSnXToYhOSA==" - }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -6440,14 +5052,6 @@ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" }, - "merge-stream": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-1.0.1.tgz", - "integrity": "sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE=", - "requires": { - "readable-stream": "^2.0.1" - } - }, "methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -6512,11 +5116,6 @@ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==" }, - "mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" - }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -6624,16 +5223,6 @@ "run-queue": "^1.0.3" } }, - "mozjpeg": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/mozjpeg/-/mozjpeg-5.0.0.tgz", - "integrity": "sha1-uGccSSRWijY94AP/L9OXq4P3UsU=", - "requires": { - "bin-build": "^2.2.0", - "bin-wrapper": "^3.0.0", - "logalot": "^2.0.0" - } - }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -6653,45 +5242,6 @@ "resolved": "https://registry.npmjs.org/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz", "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=" }, - "multipipe": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", - "integrity": "sha1-Ko8t33Du1WTf8tV/HhoTfZ8FB4s=", - "requires": { - "duplexer2": "0.0.2" - }, - "dependencies": { - "duplexer2": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz", - "integrity": "sha1-xhTc9n4vsUmVqRcR5aYX6KYKMds=", - "requires": { - "readable-stream": "~1.1.9" - } - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - } - } - }, "nan": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", @@ -6730,11 +5280,6 @@ "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" }, - "nice-try": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.4.tgz", - "integrity": "sha512-2NpiFHqC87y/zFke0fC0spBXL3bBsoh/p5H1EFhshxjCR5+0g2d6BiXbUFz9v1sAcxsk2htp2eQnNIci2dIYcA==" - }, "no-case": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", @@ -6928,11 +5473,6 @@ } } }, - "node-status-codes": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-status-codes/-/node-status-codes-1.0.0.tgz", - "integrity": "sha1-WuVUHQJGRdMqWPzdyc7s6nrjrC8=" - }, "nopt": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", @@ -6976,15 +5516,6 @@ "sort-keys": "^1.0.0" } }, - "npm-conf": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/npm-conf/-/npm-conf-1.1.3.tgz", - "integrity": "sha512-Yic4bZHJOt9RCFbRP3GgpqhScOY4HH3V2P8yBj6CeYq118Qr+BLXqT2JvpJ00mryLESpgOxf5XlFv4ZjXxLScw==", - "requires": { - "config-chain": "^1.1.11", - "pify": "^3.0.0" - } - }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -7004,14 +5535,6 @@ "set-blocking": "~2.0.0" } }, - "nth-check": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.1.tgz", - "integrity": "sha1-mSms32KPwsQQmN6rgqxYDPFJquQ=", - "requires": { - "boolbase": "~1.0.0" - } - }, "num2fraction": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz", @@ -7078,15 +5601,6 @@ "isobject": "^3.0.0" } }, - "object.getownpropertydescriptors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", - "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", - "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.5.1" - } - }, "object.omit": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", @@ -7104,17 +5618,6 @@ "isobject": "^3.0.1" } }, - "object.values": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.0.4.tgz", - "integrity": "sha1-5STaCbT2b/Bd9FdUbscqyZ8TBpo=", - "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.6.1", - "function-bind": "^1.1.0", - "has": "^1.0.1" - } - }, "obuf": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", @@ -7141,11 +5644,6 @@ "wrappy": "1" } }, - "onetime": { - "version": "1.1.0", - "resolved": "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", - "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=" - }, "opn": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/opn/-/opn-5.3.0.tgz", @@ -7154,25 +5652,6 @@ "is-wsl": "^1.1.0" } }, - "optipng-bin": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/optipng-bin/-/optipng-bin-3.1.4.tgz", - "integrity": "sha1-ldNPLEiHBPb9cGBr/qDGWfHZXYQ=", - "requires": { - "bin-build": "^2.0.0", - "bin-wrapper": "^3.0.0", - "logalot": "^2.0.0" - } - }, - "ordered-read-streams": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-0.3.0.tgz", - "integrity": "sha1-cTfmmzKYuzQiR6G77jiByA4v14s=", - "requires": { - "is-stream": "^1.0.1", - "readable-stream": "^2.0.1" - } - }, "original": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/original/-/original-1.0.1.tgz", @@ -7186,11 +5665,6 @@ "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=" }, - "os-filter-obj": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/os-filter-obj/-/os-filter-obj-1.0.3.tgz", - "integrity": "sha1-WRUzDZDs7VV9LZOKMcbdIU2cY60=" - }, "os-homedir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", @@ -7218,19 +5692,6 @@ "os-tmpdir": "^1.0.0" } }, - "p-cancelable": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz", - "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==" - }, - "p-event": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-event/-/p-event-1.3.0.tgz", - "integrity": "sha1-jmtPT2XHK8W2/ii3XtqHT5akoIU=", - "requires": { - "p-timeout": "^1.1.1" - } - }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", @@ -7257,32 +5718,6 @@ "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==" }, - "p-map-series": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-map-series/-/p-map-series-1.0.0.tgz", - "integrity": "sha1-v5j+V1cFZYqeE1G++4WuTB8Hvco=", - "requires": { - "p-reduce": "^1.0.0" - } - }, - "p-pipe": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/p-pipe/-/p-pipe-1.2.0.tgz", - "integrity": "sha1-SxoROZoRUgpneQ7loMHViB1r7+k=" - }, - "p-reduce": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz", - "integrity": "sha1-GMKw3ZNqRpClKfgjH1ig/bakffo=" - }, - "p-timeout": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-1.2.1.tgz", - "integrity": "sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y=", - "requires": { - "p-finally": "^1.0.0" - } - }, "p-try": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", @@ -7436,11 +5871,6 @@ "sha.js": "^2.4.8" } }, - "pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" - }, "performance-now": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", @@ -7472,294 +5902,6 @@ "find-up": "^2.1.0" } }, - "pngquant-bin": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/pngquant-bin/-/pngquant-bin-4.0.0.tgz", - "integrity": "sha512-jhjMp87bvaUeQOfNaPhSKx3tLCEwRaAycgDpIhMflgFr2+vYhw4ZrcK06eQeYg4OprXPanFljXLl5VuuAP2IHw==", - "requires": { - "bin-build": "^3.0.0", - "bin-wrapper": "^3.0.0", - "execa": "^0.10.0", - "logalot": "^2.0.0" - }, - "dependencies": { - "bin-build": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bin-build/-/bin-build-3.0.0.tgz", - "integrity": "sha512-jcUOof71/TNAI2uM5uoUaDq2ePcVBQ3R/qhxAz1rX7UfvduAL/RXD3jXzvn8cVcDJdGVkiR1shal3OH0ImpuhA==", - "requires": { - "decompress": "^4.0.0", - "download": "^6.2.2", - "execa": "^0.7.0", - "p-map-series": "^1.0.0", - "tempfile": "^2.0.0" - }, - "dependencies": { - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", - "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" - } - } - }, - "caw": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/caw/-/caw-2.0.1.tgz", - "integrity": "sha512-Cg8/ZSBEa8ZVY9HspcGUYaK63d/bN7rqS3CYCzEGUxuYv6UlmcjzDUz2fCFFHyTvUW5Pk0I+3hkA3iXlIj6guA==", - "requires": { - "get-proxy": "^2.0.0", - "isurl": "^1.0.0-alpha5", - "tunnel-agent": "^0.6.0", - "url-to-options": "^1.0.1" - } - }, - "decompress": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.0.tgz", - "integrity": "sha1-eu3YVCflqS2s/lVnSnxQXpbQH50=", - "requires": { - "decompress-tar": "^4.0.0", - "decompress-tarbz2": "^4.0.0", - "decompress-targz": "^4.0.0", - "decompress-unzip": "^4.0.1", - "graceful-fs": "^4.1.10", - "make-dir": "^1.0.0", - "pify": "^2.3.0", - "strip-dirs": "^2.0.0" - } - }, - "decompress-tar": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz", - "integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==", - "requires": { - "file-type": "^5.2.0", - "is-stream": "^1.1.0", - "tar-stream": "^1.5.2" - } - }, - "decompress-tarbz2": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz", - "integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==", - "requires": { - "decompress-tar": "^4.1.0", - "file-type": "^6.1.0", - "is-stream": "^1.1.0", - "seek-bzip": "^1.0.5", - "unbzip2-stream": "^1.0.9" - }, - "dependencies": { - "file-type": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz", - "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==" - } - } - }, - "decompress-targz": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz", - "integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==", - "requires": { - "decompress-tar": "^4.1.1", - "file-type": "^5.2.0", - "is-stream": "^1.1.0" - } - }, - "decompress-unzip": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz", - "integrity": "sha1-3qrM39FK6vhVePczroIQ+bSEj2k=", - "requires": { - "file-type": "^3.8.0", - "get-stream": "^2.2.0", - "pify": "^2.3.0", - "yauzl": "^2.4.2" - }, - "dependencies": { - "file-type": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", - "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=" - } - } - }, - "download": { - "version": "6.2.5", - "resolved": "https://registry.npmjs.org/download/-/download-6.2.5.tgz", - "integrity": "sha512-DpO9K1sXAST8Cpzb7kmEhogJxymyVUd5qz/vCOSyvwtp2Klj2XcDt5YUuasgxka44SxF0q5RriKIwJmQHG2AuA==", - "requires": { - "caw": "^2.0.0", - "content-disposition": "^0.5.2", - "decompress": "^4.0.0", - "ext-name": "^5.0.0", - "file-type": "5.2.0", - "filenamify": "^2.0.0", - "get-stream": "^3.0.0", - "got": "^7.0.0", - "make-dir": "^1.0.0", - "p-event": "^1.0.0", - "pify": "^3.0.0" - }, - "dependencies": { - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" - }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" - } - } - }, - "execa": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.10.0.tgz", - "integrity": "sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw==", - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - }, - "dependencies": { - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" - } - } - }, - "file-type": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", - "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY=" - }, - "filename-reserved-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", - "integrity": "sha1-q/c9+rc10EVECr/qLZHzieu/oik=" - }, - "filenamify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-2.1.0.tgz", - "integrity": "sha512-ICw7NTT6RsDp2rnYKVd8Fu4cr6ITzGy3+u4vUujPkabyaz+03F24NWEX7fs5fp+kBonlaqPH8fAO2NM+SXt/JA==", - "requires": { - "filename-reserved-regex": "^2.0.0", - "strip-outer": "^1.0.0", - "trim-repeated": "^1.0.0" - } - }, - "get-proxy": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/get-proxy/-/get-proxy-2.1.0.tgz", - "integrity": "sha512-zmZIaQTWnNQb4R4fJUEp/FC51eZsc6EkErspy3xtIYStaq8EB/hDIWipxsal+E8rz0qD7f2sL/NA9Xee4RInJw==", - "requires": { - "npm-conf": "^1.1.0" - } - }, - "get-stream": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", - "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=", - "requires": { - "object-assign": "^4.0.1", - "pinkie-promise": "^2.0.0" - } - }, - "got": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/got/-/got-7.1.0.tgz", - "integrity": "sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw==", - "requires": { - "decompress-response": "^3.2.0", - "duplexer3": "^0.1.4", - "get-stream": "^3.0.0", - "is-plain-obj": "^1.1.0", - "is-retry-allowed": "^1.0.0", - "is-stream": "^1.0.0", - "isurl": "^1.0.0-alpha5", - "lowercase-keys": "^1.0.0", - "p-cancelable": "^0.3.0", - "p-timeout": "^1.1.1", - "safe-buffer": "^5.0.1", - "timed-out": "^4.0.0", - "url-parse-lax": "^1.0.0", - "url-to-options": "^1.0.1" - }, - "dependencies": { - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" - } - } - }, - "is-natural-number": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz", - "integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg=" - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" - }, - "strip-dirs": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz", - "integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==", - "requires": { - "is-natural-number": "^4.0.1" - } - }, - "timed-out": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", - "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "requires": { - "safe-buffer": "^5.0.1" - } - } - } - }, "portfinder": { "version": "1.0.13", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.13.tgz", @@ -9623,11 +7765,6 @@ "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=" }, - "proto-list": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", - "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=" - }, "proxy-addr": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz", @@ -9790,33 +7927,6 @@ } } }, - "rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" - } - } - }, - "read-all-stream": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/read-all-stream/-/read-all-stream-3.1.0.tgz", - "integrity": "sha1-NcPhd/IHjveJ7kv6+kNzB06u9Po=", - "requires": { - "pinkie-promise": "^2.0.0", - "readable-stream": "^2.0.0" - } - }, "read-pkg": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", @@ -10044,11 +8154,6 @@ "is-finite": "^1.0.0" } }, - "replace-ext": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", - "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=" - }, "request": { "version": "2.87.0", "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", @@ -10391,24 +8496,6 @@ } } }, - "seek-bzip": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.5.tgz", - "integrity": "sha1-z+kXyz0nS8/6x5J1ivUxc+sfq9w=", - "requires": { - "commander": "~2.8.1" - }, - "dependencies": { - "commander": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz", - "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=", - "requires": { - "graceful-readlink": ">= 1.0.0" - } - } - } - }, "select-hose": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", @@ -10427,19 +8514,6 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==" }, - "semver-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-1.0.0.tgz", - "integrity": "sha1-kqSWkGX5xwxpR1PVUkj8aPj2Usk=" - }, - "semver-truncate": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/semver-truncate/-/semver-truncate-1.1.2.tgz", - "integrity": "sha1-V/Qd5pcHpicJp+AQS6IRcQnqR+g=", - "requires": { - "semver": "^5.3.0" - } - }, "send": { "version": "0.16.2", "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", @@ -10739,15 +8813,7 @@ "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=", "requires": { - "is-plain-obj": "^1.0.0" - } - }, - "sort-keys-length": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sort-keys-length/-/sort-keys-length-1.0.1.tgz", - "integrity": "sha1-nLb09OnkgVWmqgZx7dM2/xR5oYg=", - "requires": { - "sort-keys": "^1.0.0" + "is-plain-obj": "^1.0.0" } }, "source-list-map": { @@ -10792,11 +8858,6 @@ "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=" }, - "sparkles": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.1.tgz", - "integrity": "sha512-dSO0DDYUahUt/0/pD/Is3VIm5TGJjludZ0HVymmhYF6eNA53PVLhnUk0znSYbH8IYBuJdCE+1luR22jNLMaQdw==" - }, "spdx-correct": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz", @@ -10865,40 +8926,6 @@ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, - "squeak": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/squeak/-/squeak-1.3.0.tgz", - "integrity": "sha1-MwRQN7ZDiLVnZ0uEMiplIQc5FsM=", - "requires": { - "chalk": "^1.0.0", - "console-stream": "^0.1.1", - "lpad-align": "^1.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" - } - } - }, "sshpk": { "version": "1.14.2", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", @@ -10930,21 +8957,11 @@ "safe-buffer": "^5.1.1" } }, - "stable": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", - "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==" - }, "stackframe": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.0.4.tgz", "integrity": "sha512-to7oADIniaYwS3MhtCa/sQhrxidCCQiF/qp4/m5iN3ipf0Y7Xlri0f6eG29r08aL7JYl8n32AF3Q5GYBZ7K8vw==" }, - "stat-mode": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/stat-mode/-/stat-mode-0.2.2.tgz", - "integrity": "sha1-5sgLYjEj19gM8TLOU480YokHJQI=" - }, "static-extend": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", @@ -10986,15 +9003,6 @@ "readable-stream": "^2.0.2" } }, - "stream-combiner2": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", - "integrity": "sha1-+02KFCDqNidk4hrUeAOXvry0HL4=", - "requires": { - "duplexer2": "~0.1.0", - "readable-stream": "^2.0.2" - } - }, "stream-each": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.2.tgz", @@ -11079,57 +9087,6 @@ "is-utf8": "^0.2.0" } }, - "strip-bom-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-bom-stream/-/strip-bom-stream-1.0.0.tgz", - "integrity": "sha1-5xRDmFd9Uaa+0PoZlPoF9D/ZiO4=", - "requires": { - "first-chunk-stream": "^1.0.0", - "strip-bom": "^2.0.0" - } - }, - "strip-dirs": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-1.1.1.tgz", - "integrity": "sha1-lgu9EoeETzl1pFWKoQOoJV4kVqA=", - "requires": { - "chalk": "^1.0.0", - "get-stdin": "^4.0.1", - "is-absolute": "^0.1.5", - "is-natural-number": "^2.0.0", - "minimist": "^1.1.0", - "sum-up": "^1.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" - } - } - }, "strip-eof": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", @@ -11143,19 +9100,6 @@ "get-stdin": "^4.0.1" } }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" - }, - "strip-outer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", - "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", - "requires": { - "escape-string-regexp": "^1.0.2" - } - }, "style-loader": { "version": "0.18.2", "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-0.18.2.tgz", @@ -11165,38 +9109,6 @@ "schema-utils": "^0.3.0" } }, - "sum-up": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sum-up/-/sum-up-1.0.3.tgz", - "integrity": "sha1-HGYfZnBX9jvLeHWqFDi8FiUlFW4=", - "requires": { - "chalk": "^1.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" - } - } - }, "supports-color": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", @@ -11234,106 +9146,16 @@ "inherits": "2" } }, - "tar-stream": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.1.tgz", - "integrity": "sha512-IFLM5wp3QrJODQFPm6/to3LJZrONdBY/otxcvDIQzu217zKye6yVR3hhi9lAjrC2Z+m/j5oDxMPb1qcd8cIvpA==", - "requires": { - "bl": "^1.0.0", - "buffer-alloc": "^1.1.0", - "end-of-stream": "^1.0.0", - "fs-constants": "^1.0.0", - "readable-stream": "^2.3.0", - "to-buffer": "^1.1.0", - "xtend": "^4.0.0" - } - }, - "temp-dir": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz", - "integrity": "sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0=" - }, - "tempfile": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/tempfile/-/tempfile-2.0.0.tgz", - "integrity": "sha1-awRGhWqbERTRhW/8vlCczLCXcmU=", - "requires": { - "temp-dir": "^1.0.0", - "uuid": "^3.0.1" - } - }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, - "through2": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", - "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", - "requires": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - } - } - }, - "through2-filter": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-2.0.0.tgz", - "integrity": "sha1-YLxVoNrLdghdsfna6Zq0P4PWIuw=", - "requires": { - "through2": "~2.0.0", - "xtend": "~4.0.0" - }, - "dependencies": { - "through2": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", - "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", - "requires": { - "readable-stream": "^2.1.5", - "xtend": "~4.0.1" - } - } - } - }, "thunky": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.0.2.tgz", "integrity": "sha1-qGLgGOP7HqLsP85dVWBc9X8kc3E=" }, - "time-stamp": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.1.0.tgz", - "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=" - }, - "timed-out": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-3.1.3.tgz", - "integrity": "sha1-lYYL/MXHbCd/j4Mm/Q9bLiDrohc=" - }, "timers-browserify": { "version": "2.0.10", "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.10.tgz", @@ -11342,34 +9164,11 @@ "setimmediate": "^1.0.4" } }, - "to-absolute-glob": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-0.1.1.tgz", - "integrity": "sha1-HN+kcqnvUMI57maZm2YsoOs5k38=", - "requires": { - "extend-shallow": "^2.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, "to-arraybuffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=" }, - "to-buffer": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", - "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==" - }, "to-fast-properties": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", @@ -11426,14 +9225,6 @@ "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=" }, - "trim-repeated": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", - "integrity": "sha1-42RqLqTokTEr9+rObPsFOAvAHCE=", - "requires": { - "escape-string-regexp": "^1.0.2" - } - }, "trim-right": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", @@ -11466,11 +9257,6 @@ "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=" }, - "tunnel-agent": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", - "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=" - }, "tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", @@ -11601,15 +9387,6 @@ } } }, - "unbzip2-stream": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.2.5.tgz", - "integrity": "sha512-izD3jxT8xkzwtXRUZjtmRwKnZoeECrfZ8ra/ketwOcusbZEp4mjULMnJOCfTDZBgGQAAY1AJ/IgxcwkavcX9Og==", - "requires": { - "buffer": "^3.0.1", - "through": "^2.3.6" - } - }, "union-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", @@ -11668,15 +9445,6 @@ "imurmurhash": "^0.1.4" } }, - "unique-stream": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.2.1.tgz", - "integrity": "sha1-WqADz76Uxf+GbE59ZouxxNuts2k=", - "requires": { - "json-stable-stringify": "^1.0.0", - "through2-filter": "^2.0.0" - } - }, "universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", @@ -11687,11 +9455,6 @@ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" }, - "unquote": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz", - "integrity": "sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=" - }, "unset-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", @@ -11728,11 +9491,6 @@ } } }, - "unzip-response": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-1.0.2.tgz", - "integrity": "sha1-uYTwh3/AqJwsdzzB73tbIytbBv4=" - }, "upath": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz", @@ -11788,27 +9546,6 @@ "requires-port": "^1.0.0" } }, - "url-parse-lax": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", - "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", - "requires": { - "prepend-http": "^1.0.1" - } - }, - "url-regex": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/url-regex/-/url-regex-3.2.0.tgz", - "integrity": "sha1-260eDJ4p4QXdCx8J9oYvf9tIJyQ=", - "requires": { - "ip-regex": "^1.0.1" - } - }, - "url-to-options": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz", - "integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=" - }, "use": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/use/-/use-3.1.0.tgz", @@ -11837,15 +9574,6 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, - "util.promisify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", - "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", - "requires": { - "define-properties": "^1.1.2", - "object.getownpropertydescriptors": "^2.0.3" - } - }, "utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", @@ -11856,11 +9584,6 @@ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" }, - "vali-date": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/vali-date/-/vali-date-1.0.0.tgz", - "integrity": "sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY=" - }, "validate-npm-package-license": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz", @@ -11897,67 +9620,6 @@ } } }, - "vinyl": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-1.2.0.tgz", - "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", - "requires": { - "clone": "^1.0.0", - "clone-stats": "^0.0.1", - "replace-ext": "0.0.1" - }, - "dependencies": { - "replace-ext": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", - "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=" - } - } - }, - "vinyl-assign": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/vinyl-assign/-/vinyl-assign-1.2.1.tgz", - "integrity": "sha1-TRmIkbVRWRHXcajNnFSApGoHSkU=", - "requires": { - "object-assign": "^4.0.1", - "readable-stream": "^2.0.0" - } - }, - "vinyl-fs": { - "version": "2.4.4", - "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-2.4.4.tgz", - "integrity": "sha1-vm/zJwy1Xf19MGNkDegfJddTIjk=", - "requires": { - "duplexify": "^3.2.0", - "glob-stream": "^5.3.2", - "graceful-fs": "^4.0.0", - "gulp-sourcemaps": "1.6.0", - "is-valid-glob": "^0.3.0", - "lazystream": "^1.0.0", - "lodash.isequal": "^4.0.0", - "merge-stream": "^1.0.0", - "mkdirp": "^0.5.0", - "object-assign": "^4.0.0", - "readable-stream": "^2.0.4", - "strip-bom": "^2.0.0", - "strip-bom-stream": "^1.0.0", - "through2": "^2.0.0", - "through2-filter": "^2.0.0", - "vali-date": "^1.0.0", - "vinyl": "^1.0.0" - }, - "dependencies": { - "through2": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", - "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", - "requires": { - "readable-stream": "^2.1.5", - "xtend": "~4.0.1" - } - } - } - }, "vm-browserify": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", @@ -12051,14 +9713,6 @@ "resolved": "https://registry.npmjs.org/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.6.0.tgz", "integrity": "sha512-x3LV3wdmmERhVCYy3quqA57NJW7F3i6faas++pJQWtknWT+n7k30F4TVdHvCLn48peTJFRvCpxs3UuFPqgeELg==" }, - "ware": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/ware/-/ware-1.3.0.tgz", - "integrity": "sha1-0bFPOdLiy0q4xAmPdW/ksWTkc9Q=", - "requires": { - "wrap-fn": "^0.1.0" - } - }, "watchpack": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", @@ -12395,21 +10049,6 @@ } } }, - "wrap-fn": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/wrap-fn/-/wrap-fn-0.1.5.tgz", - "integrity": "sha1-8htuQQFv9KfjFyDbxjoJAWvfmEU=", - "requires": { - "co": "3.1.0" - }, - "dependencies": { - "co": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/co/-/co-3.1.0.tgz", - "integrity": "sha1-TqVOpaCJOBUxheFSEMaNkJK8G3g=" - } - } - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -12542,15 +10181,6 @@ "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=" } } - }, - "yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", - "requires": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } } } } From 34639c846a8d2cbbb10707bf27352ebf41acca30 Mon Sep 17 00:00:00 2001 From: visavi Date: Thu, 18 Oct 2018 01:15:12 +0300 Subject: [PATCH 058/163] package.json update --- package-lock.json | 43 +++++++++++++++++++++++++++++++++---------- package.json | 4 +++- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5d995bbd0..c6d90e993 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1855,11 +1855,21 @@ "integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=" }, "cryptiles": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-4.1.2.tgz", + "integrity": "sha512-U2ALcoAHvA1oO2xOreyHvtkQ+IELqDG2WVWRI1GH/XEmmfGIOalnM5MU5Dd2ITyWfr3m6kNqXiy8XuYyd4wKJw==", "requires": { - "boom": "2.x.x" + "boom": "7.x.x" + }, + "dependencies": { + "boom": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-7.2.0.tgz", + "integrity": "sha1-K/8kpVVldn/ehp7ICDF+sQxI6WY=", + "requires": { + "hoek": "5.x.x" + } + } } }, "crypto-browserify": { @@ -3918,6 +3928,14 @@ "sntp": "1.x.x" }, "dependencies": { + "cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "requires": { + "boom": "2.x.x" + } + }, "hoek": { "version": "2.16.3", "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", @@ -3940,6 +3958,11 @@ "minimalistic-crypto-utils": "^1.0.1" } }, + "hoek": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-5.0.4.tgz", + "integrity": "sha512-Alr4ZQgoMlnere5FZJsIyfIjORBqZll5POhDsF4q64dPuJR6rNxXdDxtHSQq8OXRurhmx+PWYEE8bXRROY8h0w==" + }, "home-or-tmp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", @@ -7850,9 +7873,9 @@ "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=" }, "querystringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.0.0.tgz", - "integrity": "sha512-eTPo5t/4bgaMNZxyjWx6N2a6AuE0mq51KWvpc7nU/MAqixcI6v6KrGUKES0HaomdnolQBBXU/++X6/QQ9KL4tw==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.0.tgz", + "integrity": "sha512-sluvZZ1YiTLD5jsqZcDmFyV2EwToyXZBfpoVOmktMmW+VEnhgakFHnasVph65fOjGPTWN0Nw3+XQaSeMayr0kg==" }, "randomatic": { "version": "3.0.0", @@ -9538,9 +9561,9 @@ } }, "url-parse": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.1.tgz", - "integrity": "sha512-x95Td74QcvICAA0+qERaVkRpTGKyBHHYdwL2LXZm5t/gBtCB9KQSO/0zQgSTYEV1p0WcvSg79TLNPSvd5IDJMQ==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.3.tgz", + "integrity": "sha512-rh+KuAW36YKo0vClhQzLLveoj8FwPJNu65xLb7Mrt+eZht0IPT0IXgSv8gcMegZ6NvjJUALf6Mf25POlMwD1Fw==", "requires": { "querystringify": "^2.0.0", "requires-port": "^1.0.0" diff --git a/package.json b/package.json index fcc9bc6a1..1cf520fdc 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,9 @@ "production": "NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js && rm mix-manifest.json" }, "dependencies": { - "laravel-mix": "^2.1.11" + "laravel-mix": "^2.1.11", + "url-parse": ">=1.4.3", + "cryptiles": ">=4.1.2" }, "repository": { "type": "git", From 7f218dd773e9a140c0fd52edf40736080cd3ad09 Mon Sep 17 00:00:00 2001 From: visavi Date: Sat, 20 Oct 2018 02:01:19 +0300 Subject: [PATCH 059/163] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=20=D1=87=D0=B0=D1=81?= =?UTF-8?q?=D1=82=D0=B8=D1=87=D0=BD=D0=BE=20=D1=81=D0=BA=D1=80=D1=8B=D1=82?= =?UTF-8?q?=D0=BE=D0=B3=D0=BE=20email=20=D0=BF=D1=80=D0=B8=20=D0=B2=D0=BE?= =?UTF-8?q?=D1=81=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=BF=D0=B0=D1=80=D0=BE=D0=BB=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/MailController.php | 2 +- app/helpers.php | 17 ++++++++++++++--- resources/views/news/rss.blade.php | 2 -- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/Controllers/MailController.php b/app/Controllers/MailController.php index b73489734..e15692ab0 100644 --- a/app/Controllers/MailController.php +++ b/app/Controllers/MailController.php @@ -94,7 +94,7 @@ public function recovery(Request $request, Validator $validator): string $body = view('mailer.recovery', compact('subject', 'message', 'resetLink')); sendMail($user['email'], $subject, $body); - setFlash('success', 'Восстановление пароля инициализировано!'); + setFlash('success', 'Инструкция по восстановлению пароля отправлена на ' . hideMail($user['email']) . '!'); redirect('/login'); } else { setInput($request->all()); diff --git a/app/helpers.php b/app/helpers.php index 3ca57e779..878bd5473 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -774,13 +774,13 @@ function statsBoard() /** * Обфусцирует email * - * @param string $mail email + * @param string $email email * @return string обфусцированный email */ -function cryptMail($mail) +function cryptMail($email) { $output = ''; - $symbols = str_split($mail); + $symbols = str_split($email); foreach ($symbols as $symbol) { $output .= '&#' . ord($symbol) . ';'; @@ -789,6 +789,17 @@ function cryptMail($mail) return $output; } +/** + * Частично скрывает email + * + * @param string $email + * @return string + */ +function hideMail($email) +{ + return preg_replace('/(?<=.).(?=.*@)/u', '*', $email); +} + /** * Возвращает статистику текущих голосований из кэш-файла, * предварительно сформировав этот файл, если он устарел diff --git a/resources/views/news/rss.blade.php b/resources/views/news/rss.blade.php index 4a95d7e9b..708b92e85 100644 --- a/resources/views/news/rss.blade.php +++ b/resources/views/news/rss.blade.php @@ -5,11 +5,9 @@ @stop @section('content') - @foreach ($newses as $news): text = bbCode($news->text); ?> text = str_replace(['/uploads/smiles', '[cut]'], [siteUrl().'/uploads/smiles', ''], $news->text); ?> - {{ $news->title }} {{ siteUrl() }}/news/{{ $news->id }} From 6a641c85e01f3d02618b1a402f646925d695f962 Mon Sep 17 00:00:00 2001 From: visavi Date: Sat, 20 Oct 2018 22:16:09 +0300 Subject: [PATCH 060/163] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=8C=20=D0=BE=D1=82=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D1=8F=D1=82=D1=8C=20=D0=BA=D0=BE=D0=B4=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=BF=D0=BE=D0=B4=D1=82=D0=B2=D0=B5=D1=80=D0=B6=D0=B4?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=80=D0=B5=D0=B3=D0=B8=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BF=D0=BE=D0=B2=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=BD=D0=BE,=20=D0=B0=20=D1=82=D0=B0=D0=BA=D0=B6=D0=B5?= =?UTF-8?q?=20=D0=B5=D1=81=D1=82=D1=8C=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE?= =?UTF-8?q?=D0=B6=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20=D0=BE=D1=82=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=BD=D0=B0=20=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=B0=D0=B4=D1=80=D0=B5=D1=81,=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=BF=D0=BE=D0=B4?= =?UTF-8?q?=D1=81=D0=BA=D0=B0=D0=B7=D0=BA=D0=B8=20=D0=BF=D1=80=D0=B8=20?= =?UTF-8?q?=D0=B2=D0=BE=D1=81=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B8=20=D0=BF=D0=B0=D1=80=D0=BE=D0=BB=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/MailController.php | 2 +- app/Controllers/User/UserController.php | 71 +++++++++++++++++--- app/routes.php | 2 +- app/start.php | 2 + public/assets/js/app.js | 9 +++ public/install/index.php | 5 +- public/themes/bluewater/theme.blade.php | 3 - public/themes/default/theme.blade.php | 3 - public/themes/motor/theme.blade.php | 3 - public/themes/sky/theme.blade.php | 3 - public/themes/toonel/theme.blade.php | 3 - resources/views/app/_captcha.blade.php | 1 + resources/views/files/index.blade.php | 4 +- resources/views/layout_simple.blade.php | 1 - resources/views/mailer/register.blade.php | 8 +-- resources/views/mails/index.blade.php | 2 +- resources/views/mails/recovery.blade.php | 6 +- resources/views/pages/faq.blade.php | 2 +- resources/views/users/key.blade.php | 43 ++++++++++-- resources/views/users/registration.blade.php | 2 +- 20 files changed, 129 insertions(+), 46 deletions(-) diff --git a/app/Controllers/MailController.php b/app/Controllers/MailController.php index e15692ab0..dc43640bc 100644 --- a/app/Controllers/MailController.php +++ b/app/Controllers/MailController.php @@ -84,7 +84,7 @@ public function recovery(Request $request, Validator $validator): string $user->update([ 'keypasswd' => $resetKey, - 'timepasswd' => SITETIME + 43200, + 'timepasswd' => SITETIME + 3600, ]); //Инструкция по восстановлению пароля на email diff --git a/app/Controllers/User/UserController.php b/app/Controllers/User/UserController.php index 836e37ee5..2503bac2f 100644 --- a/app/Controllers/User/UserController.php +++ b/app/Controllers/User/UserController.php @@ -136,7 +136,7 @@ public function register(Request $request, Validator $validator): string // Проверка логина в черном списке $blackLogin = Blacklist::query() - ->where('type', 2) + ->where('type', 'login') ->where('value', strtolower($login)) ->count(); $validator->empty($blackLogin, ['login' => 'Выбранный вами логин занесен в черный список!']); @@ -148,14 +148,14 @@ public function register(Request $request, Validator $validator): string // Проверка домена от email в черном списке $blackDomain = Blacklist::query() - ->where('type', 3) + ->where('type', 'domain') ->where('value', $domain) ->count(); $validator->empty($blackDomain, ['email' => 'Домен от вашего адреса email занесен в черный список!']); // Проверка email в черном списке $blackMail = Blacklist::query() - ->where('type', 1) + ->where('type', 'email') ->where('value', $email) ->count(); $validator->empty($blackMail, ['email' => 'Указанный вами адрес email занесен в черный список!']); @@ -174,9 +174,6 @@ public function register(Request $request, Validator $validator): string // Регистрация аккаунта if ($validator->isValid()) { - // --- Уведомление о регистрации на email ---// - $message = 'Добро пожаловать, ' . $login . '
Теперь вы зарегистрированный пользователь сайта ' . setting('title') . ' , сохраните ваш пароль и логин в надежном месте, они вам еще пригодятся.
Ваши данные для входа на сайт
Логин: ' . $login . '
Пароль: ' . $password . '

'; - if (setting('regkeys')) { $activateKey = str_random(); $activateLink = siteUrl(true).'/key?code=' . $activateKey; @@ -212,6 +209,9 @@ public function register(Request $request, Validator $validator): string $textNotice = textNotice('register', ['%username%' => $login]); $user->sendMessage(null, $textNotice); + // --- Уведомление о регистрации на email ---// + $message = 'Добро пожаловать, ' . $login . '
Теперь вы зарегистрированный пользователь сайта ' . setting('title') . ' , сохраните ваш пароль и логин в надежном месте, они вам еще пригодятся.
Ваши данные для входа на сайт
Логин: ' . $login . '
Пароль: ' . $password . '

'; + $subject = 'Регистрация на сайте ' . setting('title'); $body = view('mailer.register', compact('subject', 'message', 'activateKey', 'activateLink')); sendMail($email, $subject, $body); @@ -371,11 +371,13 @@ public function profile(Request $request, Validator $validator): string /** * Подтверждение регистрации * - * @param Request $request + * @param Request $request + * @param Validator $validator * @return string */ - public function key(Request $request): string + public function key(Request $request, Validator $validator): string { + /* @var User $user */ if (! $user = getUser()) { abort(403, 'Для подтверждения регистрации необходимо быть авторизованным!'); } @@ -388,6 +390,53 @@ public function key(Request $request): string abort(403, 'Вашему профилю не требуется подтверждение регистрации!'); } + /* Повторная отправка */ + if ($request->has('email') && $request->isMethod('post')) { + + $token = check($request->input('token')); + $email = strtolower(check($request->input('email'))); + $domain = utfSubstr(strrchr($email, '@'), 1); + + $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') + ->true(captchaVerify(), ['protect' => 'Не удалось пройти проверку captcha!']) + ->email($email, ['email' => 'Вы ввели неверный адрес email, необходим формат name@site.domen!']); + + $regMail = User::query()->where('login', '<>', $user->login)->where('email', $email)->count(); + $validator->empty($regMail, ['email' => 'Указанный вами адрес email уже используется в системе!']); + + $blackMail = BlackList::query()->where('type', 'email')->where('value', $email)->count(); + $validator->empty($blackMail, ['email' => 'Указанный вами адрес email занесен в черный список!']); + + $blackDomain = Blacklist::query()->where('type', 'domain')->where('value', $domain)->count(); + $validator->empty($blackDomain, ['email' => 'Домен от вашего адреса email занесен в черный список!']); + + if ($validator->isValid()) { + + $activateKey = str_random(); + $activateLink = siteUrl(true).'/key?code=' . $activateKey; + + $user->update([ + 'email' => $email, + 'confirmregkey' => $activateKey, + ]); + + /* Уведомление о регистрации на email */ + $message = 'Добро пожаловать, ' . $user->login . '
Теперь вы зарегистрированный пользователь сайта ' . setting('title') . ' , сохраните ваш пароль и логин в надежном месте, они вам еще пригодятся.

'; + + $subject = 'Регистрация на сайте ' . setting('title'); + $body = view('mailer.register', compact('subject', 'message', 'activateKey', 'activateLink')); + + sendMail($email, $subject, $body); + + setFlash('success', 'Новый код подтверждения успешно отправлен!'); + redirect('/'); + } else { + setInput($request->all()); + setFlash('danger', $validator->getErrors()); + } + } + + /* Подтверждение кода */ if ($request->has('code')) { $code = check(trim($request->input('code'))); @@ -406,7 +455,7 @@ public function key(Request $request): string } } - return view('users/key'); + return view('users/key', compact('user')); } /** @@ -564,10 +613,10 @@ public function editMail(Request $request, Validator $validator): void if ($changeMail) { $validator->notEqual($changeMail->mail, $user->mail, 'Новый адрес email должен отличаться от текущего!'); - $regMail = User::query()->where('email', $changeMail->mail)->first(); + $regMail = User::query()->where('email', $changeMail->mail)->count(); $validator->empty($regMail, 'Указанный вами адрес email уже используется в системе!'); - $blackMail = BlackList::query()->where('type', 'email')->where('value', $changeMail->mail)->first(); + $blackMail = BlackList::query()->where('type', 'email')->where('value', $changeMail->mail)->count(); $validator->empty($blackMail, 'Указанный вами адрес email занесен в черный список!'); } diff --git a/app/routes.php b/app/routes.php index 4279b6131..edc22fe63 100644 --- a/app/routes.php +++ b/app/routes.php @@ -306,7 +306,7 @@ $r->addRoute(['GET', 'POST'], '/users/{login:[\w\-]+}/rating', [App\Controllers\RatingController::class, 'index']); $r->get('/logout', [App\Controllers\User\UserController::class, 'logout']); - $r->get('/key', [App\Controllers\User\UserController::class, 'key']); + $r->addRoute(['GET', 'POST'], '/key', [App\Controllers\User\UserController::class, 'key']); $r->addRoute(['GET', 'POST'], '/users/{login:[\w\-]+}/note', [App\Controllers\User\UserController::class, 'note']); $r->addRoute(['GET', 'POST'], '/login', [App\Controllers\User\UserController::class, 'login']); $r->addRoute(['GET', 'POST'], '/register', [App\Controllers\User\UserController::class, 'register']); diff --git a/app/start.php b/app/start.php index 9b11b0fce..3e09d9eea 100644 --- a/app/start.php +++ b/app/start.php @@ -14,6 +14,8 @@ date_default_timezone_set(setting('timezone')); +$request = Request::createFromGlobals(); + /** * Авторизация по кукам */ diff --git a/public/assets/js/app.js b/public/assets/js/app.js index 3e0d8ada1..538f8f249 100644 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -477,3 +477,12 @@ function deleteImage(el) return false; } + +/* Показывает форму для повторной отправки код подтверждения */ +function resendingCode(el) +{ + $('.js-resending-link').hide(); + $('.js-resending-form').show(); + + return false; +} diff --git a/public/install/index.php b/public/install/index.php index b82b601f2..dcc7f44ab 100644 --- a/public/install/index.php +++ b/public/install/index.php @@ -19,6 +19,8 @@ include_once DIR . '/app/bootstrap.php'; include_once DIR . '/app/helpers.php'; +$request = Request::createFromGlobals(); + function parsePHPModules() { ob_start(); phpinfo(INFO_MODULES); @@ -73,9 +75,8 @@ function getModuleSetting($pModuleName, $pSettings) { $wrap->setOption('configuration', DIR.'/app/migration.php'); $wrap->setOption('parser', 'php'); $wrap->setOption('environment', 'default'); - -header("Content-type:text/html; charset=utf-8"); ?> + diff --git a/public/themes/bluewater/theme.blade.php b/public/themes/bluewater/theme.blade.php index 27277fd43..9e6f6a0a9 100644 --- a/public/themes/bluewater/theme.blade.php +++ b/public/themes/bluewater/theme.blade.php @@ -1,6 +1,3 @@ - diff --git a/public/themes/default/theme.blade.php b/public/themes/default/theme.blade.php index c3c7b7fde..aa93230eb 100644 --- a/public/themes/default/theme.blade.php +++ b/public/themes/default/theme.blade.php @@ -1,6 +1,3 @@ - diff --git a/public/themes/motor/theme.blade.php b/public/themes/motor/theme.blade.php index 56c25ea86..0005cd5f4 100644 --- a/public/themes/motor/theme.blade.php +++ b/public/themes/motor/theme.blade.php @@ -1,6 +1,3 @@ - diff --git a/public/themes/sky/theme.blade.php b/public/themes/sky/theme.blade.php index 8ffb79685..40f421b50 100644 --- a/public/themes/sky/theme.blade.php +++ b/public/themes/sky/theme.blade.php @@ -1,6 +1,3 @@ - diff --git a/public/themes/toonel/theme.blade.php b/public/themes/toonel/theme.blade.php index fda0a9357..daa40e46e 100644 --- a/public/themes/toonel/theme.blade.php +++ b/public/themes/toonel/theme.blade.php @@ -1,6 +1,3 @@ - diff --git a/resources/views/app/_captcha.blade.php b/resources/views/app/_captcha.blade.php index efc631ebd..72ab3b2a1 100644 --- a/resources/views/app/_captcha.blade.php +++ b/resources/views/app/_captcha.blade.php @@ -1,6 +1,7 @@ @if (setting('recaptcha_public') && setting('recaptcha_private'))
+ {!! textError('protect') !!} @else
diff --git a/resources/views/files/index.blade.php b/resources/views/files/index.blade.php index e4101ad94..fb0405a3e 100644 --- a/resources/views/files/index.blade.php +++ b/resources/views/files/index.blade.php @@ -22,10 +22,11 @@ 5. Теперь попробуйте перейти на созданную станицу, введите в браузере /files/library
6. Если страница отобразилась, значит вы все сделали правильно
-
+

В одной директории может быть неограниченное число файлов, расширение указывать не нужно, только имя папки и имя файла через слеш, к примеру /library/simplepage, /library/index то же что и просто /library

Также можно указать заголовок страницы, который автоматически подставится в блок title, для этого нужно написать следующий код +

 @@section('title')
@@ -44,7 +45,6 @@
     Описание страниц
 @@stop
 
-
Посмотрите пример страниц в виде документации Rotor
@stop diff --git a/resources/views/layout_simple.blade.php b/resources/views/layout_simple.blade.php index 921173ed5..961411087 100644 --- a/resources/views/layout_simple.blade.php +++ b/resources/views/layout_simple.blade.php @@ -1,4 +1,3 @@ - diff --git a/resources/views/mailer/register.blade.php b/resources/views/mailer/register.blade.php index 69fdf74f9..44572709f 100644 --- a/resources/views/mailer/register.blade.php +++ b/resources/views/mailer/register.blade.php @@ -9,17 +9,17 @@ @if (setting('regkeys')) Внимание!
- Для подтверждения регистрации необходимо в течение 24 часов ввести мастер-ключ!
- Ваш мастер-ключ: {{ $activateKey }}
+ Для подтверждения регистрации необходимо в течение 24 часов ввести код!
+ Ваш код: {{ $activateKey }}
Введите его после авторизации на сайте
Или перейдите по прямой ссылке:

{{ $activateLink }}

- Активировать аккаунт

+ Активировать аккаунт

Если в течение 24 часов вы не подтвердите регистрацию, ваш аккаунт будет автоматически удален

@else - Войти на сайт

+ Войти на сайт

@endif Надеемся вам понравится на нашем портале!
diff --git a/resources/views/mails/index.blade.php b/resources/views/mails/index.blade.php index ee378bfba..e5713902d 100644 --- a/resources/views/mails/index.blade.php +++ b/resources/views/mails/index.blade.php @@ -40,7 +40,7 @@ {!! textError('message') !!}
- {!! view('app/_captcha') !!} + {!! view('app/_captcha') !!} diff --git a/resources/views/mails/recovery.blade.php b/resources/views/mails/recovery.blade.php index 965ae33a7..4d8c97a87 100644 --- a/resources/views/mails/recovery.blade.php +++ b/resources/views/mails/recovery.blade.php @@ -30,7 +30,11 @@

+

+ Если по какой-то причине письмо не приходит или утрачен доступ к почтовому ящику, то вам необходимо связаться с поддержкой +

+ Письмо с инструкцией по восстановлению пароля будет выслано на email указанный в профиле
Внимательно прочтите письмо и выполните все необходимые действия
- Восстанавливать пароль можно не чаще чем раз в 12 часов

+ Отправлять данные для восстанавления пароля можно не чаще чем раз в час
@stop diff --git a/resources/views/pages/faq.blade.php b/resources/views/pages/faq.blade.php index e39742b90..50c30ec80 100644 --- a/resources/views/pages/faq.blade.php +++ b/resources/views/pages/faq.blade.php @@ -72,7 +72,7 @@ 1. Вводите желаемый логин и пароль
2. Указываете свой email и проверочный код
3. Нажимаете кнопку регистрации и создается ваш профиль
- 4. Теперь если включена функция подтверждения регистрации, то вам на email будет выслан мастер-ключ, который необходим для подтверждения регистрации
+ 4. Теперь если включена функция подтверждения регистрации, то вам на email будет выслан код подтверждения, который необходим для окончания регистрации
5. Если подтверждение регистрации выключено, то после входа на сайт вы становитесь полноправным пользователем сайта
6. Теперь вы можете добавить побольше информации о себе в профиле, а также изменить свои настройки
diff --git a/resources/views/users/key.blade.php b/resources/views/users/key.blade.php index dacc2fc07..ecc3ce9ff 100644 --- a/resources/views/users/key.blade.php +++ b/resources/views/users/key.blade.php @@ -16,18 +16,51 @@ Добро пожаловать, {{ getUser('login') }}!
- Для подтверждения регистрации вам необходимо ввести мастер-ключ, который был отправлен вам на email

+ Для подтверждения регистрации вам необходимо ввести код, который был отправлен вам на email

- Код подтверждения:
+
- +

- Пока вы не подтвердите регистрацию вы не сможете войти на сайт
- Ваш профиль будет ждать активации в течение 24 часов, после чего автоматически удален

+ + + +
+
+
+ + +
+ + + {!! textError('email') !!} +
+ + {!! view('app/_captcha') !!} + +
+

+ +

+ При повторной отправке старый код подтверждения станет недействительным +

+
+ + @if (! $checkEmail) + + @endif + +

+ Пока вы не подтвердите регистрацию вы не сможете войти на сайт
+ Активацию аккаунта необходимо произвести в течение 24 часов
+ После 24 часов неподтвержденные аккаунты автоматически удаляются +

Выход
@stop diff --git a/resources/views/users/registration.blade.php b/resources/views/users/registration.blade.php index 71e28eaa0..6ed08863d 100644 --- a/resources/views/users/registration.blade.php +++ b/resources/views/users/registration.blade.php @@ -20,7 +20,7 @@ Логин должен состоять только из знаков латинского алфавита и цифр, допустим знак дефиса!
@if (setting('regkeys')) - Включено подтверждение регистрации! Вам на почтовый ящик будет выслан мастер-ключ, который необходим для подтверждения регистрации!
+ Включено подтверждение регистрации! Вам на почтовый ящик будет выслан код, который необходим для подтверждения регистрации!
@endif @if (!empty(setting('invite'))) From 48edfdbdadf2b99c9ed61143af97d15da6174113 Mon Sep 17 00:00:00 2001 From: visavi Date: Sat, 20 Oct 2018 23:21:58 +0300 Subject: [PATCH 061/163] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D1=81=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D0=B5=20=D0=B8=D0=B7=20?= =?UTF-8?q?app/start.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Classes/Application.php | 127 +++++++++++++++++++++++++++++ app/Controllers/PageController.php | 4 +- app/start.php | 119 --------------------------- public/index.php | 9 +- 4 files changed, 136 insertions(+), 123 deletions(-) delete mode 100644 app/start.php diff --git a/app/Classes/Application.php b/app/Classes/Application.php index 431d48908..4bbb28922 100644 --- a/app/Classes/Application.php +++ b/app/Classes/Application.php @@ -2,12 +2,23 @@ namespace App\Classes; +use App\Models\Login; +use App\Models\User; use DI\Container; use FastRoute\Dispatcher; +use Illuminate\Database\Capsule\Manager as DB; use Illuminate\Http\Request; +use Mobile_Detect; class Application { + public function __construct() + { + $this->cookieAuth(); + $this->checkAuth(); + $this->setSetting(); + } + /** * Запускает приложение */ @@ -63,4 +74,120 @@ private function getRouter(): array return $dispatcher->dispatch(server('REQUEST_METHOD'), server('PHP_SELF')); } + + /** + * Авторизует по кукам + * + * @return void + */ + private function cookieAuth(): void + { + if (empty($_SESSION['id']) && isset($_COOKIE['login'], $_COOKIE['password'])) { + + $cookLogin = check($_COOKIE['login']); + $cookPass = check($_COOKIE['password']); + + $user = User::query()->where('login', $cookLogin)->first(); + + if ($user && $cookLogin === $user->login && $cookPass === md5($user->password . env('APP_KEY'))) { + session_regenerate_id(1); + + $_SESSION['id'] = $user->id; + $_SESSION['password'] = md5(env('APP_KEY') . $user->password); + + $authorization = Login::query() + ->where('user_id', $user->id) + ->where('created_at', '>', SITETIME - 30) + ->first(); + + if (! $authorization) { + + Login::query()->create([ + 'user_id' => $user->id, + 'ip' => getIp(), + 'brow' => getBrowser(), + 'created_at' => SITETIME, + ]); + } + + $user->update([ + 'visits' => DB::raw('visits + 1'), + 'updated_at' => SITETIME + ]); + } + } + } + + /** + * Проверяет пользователя + * + * @return void + */ + private function checkAuth(): void + { + $request = Request::createFromGlobals(); + + if ($user = checkAuth()) { + + Registry::set('user', $user); + + setSetting([ + 'themes' => $user->themes, + 'language' => $user->language, + ]); + + // Забанен + if ($user->level === User::BANNED && ! $request->is('ban', 'rules', 'logout')) { + redirect('/ban?user=' . $user->login); + } + + // Подтверждение регистрации + if ($user->level === User::PENDED && setting('regkeys') && ! $request->is('key', 'ban', 'login', 'logout')) { + redirect('/key?user=' . $user->login); + } + + // ---------------------- Получение ежедневного бонуса -----------------------// + if ($user->timebonus < SITETIME - 82800) { + $user->update([ + 'timebonus' => SITETIME, + 'money' => DB::raw('money + ' . setting('bonusmoney')), + ]); + + setFlash('success', 'Получен ежедневный бонус ' . plural(setting('bonusmoney'), setting('moneyname')) . '!'); + } + } + } + + /** + * Устанавливает настройки + * + * @return void + * @throws \Exception + */ + private function setSetting(): void + { + $browser = new Mobile_Detect(); + + if (! getUser() || empty(setting('themes'))) { + if (! empty(setting('webthemes')) && ! $browser->isMobile() && ! $browser->isTablet()) { + setSetting(['themes' => setting('webthemes')]); + } + } + + if (empty(setting('themes')) || ! file_exists(HOME . '/themes/' . setting('themes'))) { + setSetting(['themes' => 'default']); + } + + if (empty(setting('language')) || ! file_exists(RESOURCES . '/lang/' . setting('language'))) { + setSetting(['language' => 'ru']); + } + + /* Установка сессионных переменных */ + if (empty($_SESSION['token'])) { + $_SESSION['token'] = str_random(8); + } + if (empty($_SESSION['protect'])) { + $_SESSION['protect'] = random_int(1000, 99999); + } + } } diff --git a/app/Controllers/PageController.php b/app/Controllers/PageController.php index 28ff2c51a..77a18dc36 100644 --- a/app/Controllers/PageController.php +++ b/app/Controllers/PageController.php @@ -14,10 +14,10 @@ class PageController extends BaseController * Главная страница * * @param string $action - * @param string $params + * @param array $params * @return string */ - public function __call(string $action, string $params) + public function __call(string $action, array $params) { if (! preg_match('|^[a-z0-9_\-]+$|i', $action)) { abort(404); diff --git a/app/start.php b/app/start.php deleted file mode 100644 index 3e09d9eea..000000000 --- a/app/start.php +++ /dev/null @@ -1,119 +0,0 @@ -where('login', $cookLogin)->first(); - - if ($user && $cookLogin === $user->login && $cookPass === md5($user->password . env('APP_KEY'))) { - session_regenerate_id(1); - - $_SESSION['id'] = $user->id; - $_SESSION['password'] = md5(env('APP_KEY') . $user->password); - - $authorization = Login::query() - ->where('user_id', $user->id) - ->where('created_at', '>', SITETIME - 30) - ->first(); - - if (! $authorization) { - - Login::query()->create([ - 'user_id' => $user->id, - 'ip' => getIp(), - 'brow' => getBrowser(), - 'created_at' => SITETIME, - ]); - } - - $user->update([ - 'visits' => DB::raw('visits + 1'), - 'updated_at' => SITETIME - ]); - } -} - -/** - * Установка сессионных переменных - */ -if (empty($_SESSION['token'])) { - $_SESSION['token'] = str_random(8); -} -if (empty($_SESSION['protect'])) { - $_SESSION['protect'] = random_int(1000, 99999); -} - -/** - * Операции с пользователями - */ -if ($user = checkAuth()) { - - Registry::set('user', $user); - - setSetting([ - 'themes' => $user->themes, - 'language' => $user->language, - ]); - - // Забанен - if ($user->level === User::BANNED && ! $request->is('ban', 'rules', 'logout')) { - redirect('/ban?user=' . $user->login); - } - - // Подтверждение регистрации - if ($user->level === User::PENDED && setting('regkeys') && ! $request->is('key', 'ban', 'login', 'logout')) { - redirect('/key?user=' . $user->login); - } - - // ---------------------- Получение ежедневного бонуса -----------------------// - if ($user->timebonus < SITETIME - 82800) { - $user->update([ - 'timebonus' => SITETIME, - 'money' => DB::raw('money + ' . setting('bonusmoney')), - ]); - - setFlash('success', 'Получен ежедневный бонус ' . plural(setting('bonusmoney'), setting('moneyname')) . '!'); - } -} - -/** - * Автоопределение системы - */ -$browser_detect = new Mobile_Detect(); - -if (! getUser() || empty(setting('themes'))) { - if (! empty(setting('webthemes')) && ! $browser_detect->isMobile() && ! $browser_detect->isTablet()) { - setSetting(['themes' => setting('webthemes')]); - } -} - -if (empty(setting('themes')) || ! file_exists(HOME . '/themes/' . setting('themes'))) { - setSetting(['themes' => 'default']); -} - -if (empty(setting('language')) || ! file_exists(RESOURCES . '/lang/' . setting('language'))) { - setSetting(['language' => 'ru']); -} - -return new \App\Classes\Application(); diff --git a/public/index.php b/public/index.php index 405eff369..2a4c343fa 100644 --- a/public/index.php +++ b/public/index.php @@ -8,6 +8,11 @@ * @copyright 2005-2018 */ -/** @var App\Classes\Application $app */ -$app = require __DIR__ . '/../app/start.php'; +require __DIR__ . '/../app/bootstrap.php'; + +ob_start(); +session_start(); +date_default_timezone_set(setting('timezone')); + +$app = new \App\Classes\Application(); $app->run(); From 25fb68e715723f401a180c988597b38334b90c3a Mon Sep 17 00:00:00 2001 From: visavi Date: Sat, 20 Oct 2018 23:38:00 +0300 Subject: [PATCH 062/163] =?UTF-8?q?=D0=BE=D0=BF=D1=82=D0=B8=D0=BC=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Classes/Application.php | 4 ++++ public/index.php | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Classes/Application.php b/app/Classes/Application.php index 4bbb28922..6055bd08d 100644 --- a/app/Classes/Application.php +++ b/app/Classes/Application.php @@ -14,6 +14,10 @@ class Application { public function __construct() { + ob_start(); + session_start(); + date_default_timezone_set(setting('timezone')); + $this->cookieAuth(); $this->checkAuth(); $this->setSetting(); diff --git a/public/index.php b/public/index.php index 2a4c343fa..cc3bf2ee8 100644 --- a/public/index.php +++ b/public/index.php @@ -10,9 +10,5 @@ require __DIR__ . '/../app/bootstrap.php'; -ob_start(); -session_start(); -date_default_timezone_set(setting('timezone')); - $app = new \App\Classes\Application(); $app->run(); From 8d557c76c4a38f9b8dcc616c3b1b696d8c24ae1a Mon Sep 17 00:00:00 2001 From: visavi Date: Sat, 20 Oct 2018 23:59:21 +0300 Subject: [PATCH 063/163] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BF=D1=80=D0=BE=D1=81=D0=BC=D0=BE=D1=82=D1=80=20?= =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA=20405?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/Admin/ErrorController.php | 2 +- app/bootstrap.php | 2 +- composer.lock | 36 ++++++++++---------- resources/views/admin/errors/index.blade.php | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/Controllers/Admin/ErrorController.php b/app/Controllers/Admin/ErrorController.php index 06cd2ac95..c88701ed9 100644 --- a/app/Controllers/Admin/ErrorController.php +++ b/app/Controllers/Admin/ErrorController.php @@ -32,7 +32,7 @@ public function __construct() $request = Request::createFromGlobals(); $this->code = int($request->input('code', 404)); - $this->lists = [403 => 'Ошибки 403', 404 => 'Ошибки 404', 666 => 'Автобаны']; + $this->lists = [403 => 'Ошибки 403', 404 => 'Ошибки 404', 405 => 'Ошибки 405', 666 => 'Автобаны']; if (! isset($this->lists[$this->code])) { abort(404, 'Указанный лог-файл не существует!'); diff --git a/app/bootstrap.php b/app/bootstrap.php index f9b4a659a..5a5c1ce8e 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -14,7 +14,7 @@ define('RESOURCES', BASEDIR . '/resources'); define('STORAGE', BASEDIR . '/storage'); define('SITETIME', time()); -define('VERSION', '7.3'); +define('VERSION', '7.4'); require_once BASEDIR . '/vendor/autoload.php'; diff --git a/composer.lock b/composer.lock index 1c90a7532..c5abdbd54 100644 --- a/composer.lock +++ b/composer.lock @@ -3385,16 +3385,16 @@ }, { "name": "filp/whoops", - "version": "2.2.1", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "e79cd403fb77fc8963a99ecc30e80ddd885b3311" + "reference": "a9f129b99df316f847584d482c89c14a9f796e2b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/e79cd403fb77fc8963a99ecc30e80ddd885b3311", - "reference": "e79cd403fb77fc8963a99ecc30e80ddd885b3311", + "url": "https://api.github.com/repos/filp/whoops/zipball/a9f129b99df316f847584d482c89c14a9f796e2b", + "reference": "a9f129b99df316f847584d482c89c14a9f796e2b", "shasum": "" }, "require": { @@ -3442,7 +3442,7 @@ "throwable", "whoops" ], - "time": "2018-06-30T13:14:06+00:00" + "time": "2018-10-20T09:00:00+00:00" }, { "name": "guzzlehttp/guzzle", @@ -4010,16 +4010,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "6.0.8", + "version": "6.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "848f78b3309780fef7ec8c4666b7ab4e6b09b22f" + "reference": "b097681a19a48e52706f57e47a09594bac4f7cab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/848f78b3309780fef7ec8c4666b7ab4e6b09b22f", - "reference": "848f78b3309780fef7ec8c4666b7ab4e6b09b22f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b097681a19a48e52706f57e47a09594bac4f7cab", + "reference": "b097681a19a48e52706f57e47a09594bac4f7cab", "shasum": "" }, "require": { @@ -4030,7 +4030,7 @@ "phpunit/php-text-template": "^1.2.1", "phpunit/php-token-stream": "^3.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1", + "sebastian/environment": "^3.1 || ^4.0", "sebastian/version": "^2.0.1", "theseer/tokenizer": "^1.1" }, @@ -4043,7 +4043,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.0-dev" + "dev-master": "6.1-dev" } }, "autoload": { @@ -4069,7 +4069,7 @@ "testing", "xunit" ], - "time": "2018-10-04T03:41:23+00:00" + "time": "2018-10-18T09:01:38+00:00" }, { "name": "phpunit/php-file-iterator", @@ -4262,16 +4262,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.4.0", + "version": "7.4.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f3837fa1e07758057ae06e8ddec6d06ba183f126" + "reference": "c5a120ade60992bd671a912188ee9ee9f8083bbd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3837fa1e07758057ae06e8ddec6d06ba183f126", - "reference": "f3837fa1e07758057ae06e8ddec6d06ba183f126", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c5a120ade60992bd671a912188ee9ee9f8083bbd", + "reference": "c5a120ade60992bd671a912188ee9ee9f8083bbd", "shasum": "" }, "require": { @@ -4292,7 +4292,7 @@ "phpunit/php-timer": "^2.0", "sebastian/comparator": "^3.0", "sebastian/diff": "^3.0", - "sebastian/environment": "^3.1", + "sebastian/environment": "^3.1 || ^4.0", "sebastian/exporter": "^3.1", "sebastian/global-state": "^2.0", "sebastian/object-enumerator": "^3.0.3", @@ -4342,7 +4342,7 @@ "testing", "xunit" ], - "time": "2018-10-05T04:05:24+00:00" + "time": "2018-10-18T09:02:52+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", diff --git a/resources/views/admin/errors/index.blade.php b/resources/views/admin/errors/index.blade.php index 8ef97bb3f..4625c00c2 100644 --- a/resources/views/admin/errors/index.blade.php +++ b/resources/views/admin/errors/index.blade.php @@ -23,7 +23,7 @@
diff --git a/resources/views/blogs/view.blade.php b/resources/views/blogs/view.blade.php index d18be2181..f800c49be 100644 --- a/resources/views/blogs/view.blade.php +++ b/resources/views/blogs/view.blade.php @@ -56,13 +56,13 @@ {!! $tags !!}
Рейтинг: - @unless (getUser('id') == $blog->user_id) - - @endunless + @if (getUser() && getUser('id') !== $blog->user_id) + + @endif {!! formatNum($blog->rating) !!} - @unless (getUser('id') == $blog->user_id) - - @endunless + @if (getUser() && getUser('id') !== $blog->user_id) + + @endif
Просмотров: {{ $blog->visits }}
diff --git a/resources/views/forums/topic.blade.php b/resources/views/forums/topic.blade.php index 6c39d02fc..341289c07 100644 --- a/resources/views/forums/topic.blade.php +++ b/resources/views/forums/topic.blade.php @@ -108,7 +108,7 @@
@if (getUser()) - @if (getUser('id') != $data->user_id) + @if (getUser('id') !== $data->user_id) @@ -116,7 +116,7 @@ @endif - @if ((getUser('id') == $data->user_id && $data->created_at + 600 > SITETIME) || $topic->isModer) + @if ($topic->isModer || (getUser('id') === $data->user_id && $data->created_at + 600 > SITETIME)) @if ($topic->isModer) @@ -125,12 +125,12 @@ @endif
- @if (getUser() && getUser('id') != $data->user_id) - + @if (getUser() && getUser('id') !== $data->user_id) + @endif {!! formatNum($data->rating) !!} - @if (getUser() && getUser('id') != $data->user_id) - + @if (getUser() && getUser('id') !== $data->user_id) + @endif
diff --git a/resources/views/offers/view.blade.php b/resources/views/offers/view.blade.php index e8255cd7b..a5c4a4704 100644 --- a/resources/views/offers/view.blade.php +++ b/resources/views/offers/view.blade.php @@ -36,13 +36,13 @@ Добавлено: {!! $offer->user->getProfile() !!} ({{ dateFixed($offer->created_at) }})
Рейтинг: - @unless (getUser('id') == $offer->user_id) - - @endunless + @if (getUser() && getUser('id') !== $offer->user_id) + + @endif {!! formatNum($offer->rating) !!} - @unless (getUser('id') == $offer->user_id) - - @endunless + @if (getUser() && getUser('id') !== $offer->user_id) + + @endif

diff --git a/resources/views/photos/view.blade.php b/resources/views/photos/view.blade.php index c3aee6113..ba1c3916a 100644 --- a/resources/views/photos/view.blade.php +++ b/resources/views/photos/view.blade.php @@ -37,13 +37,13 @@ @endif
Рейтинг: - @unless (getUser('id') == $photo->user_id) - - @endunless + @if (getUser() && getUser('id') !== $photo->user_id) + + @endif {!! formatNum($photo->rating) !!} - @unless (getUser('id') == $photo->user_id) - - @endunless + @if (getUser() && getUser('id') !== $photo->user_id) + + @endif
Добавлено: {!! $photo->user->getProfile() !!} ({{ dateFixed($photo->created_at) }})
From 87b3801af121901e9d90348a742804842dc2cf6c Mon Sep 17 00:00:00 2001 From: visavi Date: Sat, 27 Oct 2018 23:51:58 +0300 Subject: [PATCH 067/163] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=80=D0=BE=D1=83=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/routes.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/routes.php b/app/routes.php index edc22fe63..bc552286e 100644 --- a/app/routes.php +++ b/app/routes.php @@ -297,7 +297,7 @@ $r->addRoute(['GET', 'POST'], '/who', [App\Controllers\User\UserController::class, 'who']); $r->get('/faq', [App\Controllers\PageController::class, 'faq']); - $r->get('/statusfaq', [App\Controllers\PageController::class, 'tatusfaq']); + $r->get('/statusfaq', [App\Controllers\PageController::class, 'statusfaq']); $r->get('/surprise', [App\Controllers\PageController::class, 'surprise']); @@ -314,14 +314,14 @@ $r->addRoute(['GET', 'POST'], '/settings', [App\Controllers\User\UserController::class, 'setting']); $r->get('/menu', [App\Controllers\PageController::class, 'menu']); - $r->get('/pages[/{action:[a-zA-Z0-9]+}]', [App\Controllers\PageController::class, 'index']); + $r->get('/pages[/{page:[a-zA-Z0-9]+}]', [App\Controllers\PageController::class, 'index']); $r->get('/tags', [App\Controllers\PageController::class, 'tags']); $r->get('/rules', [App\Controllers\PageController::class, 'rules']); $r->get('/smiles', [App\Controllers\PageController::class, 'smiles']); $r->get('/online[/{action:all}]', [App\Controllers\OnlineController::class, 'index']); $r->get('/counters', [App\Controllers\CounterController::class, 'index']); - $r->get('/files[/{action:.+}]', [App\Controllers\FileController::class, 'index']); + $r->get('/files[/{page:.+}]', [App\Controllers\FileController::class, 'index']); /* Админ-панель */ $r->addGroup('/admin', function (RouteCollector $r) { @@ -337,7 +337,7 @@ $r->get('/downs/new', [App\Controllers\Admin\LoadController::class, 'new']); $r->get('/downs/publish/{id:\d+}', [App\Controllers\Admin\LoadController::class, 'publish']); - $r->get('', [App\Controllers\Admin\AdminController::class, 'main', 'admin']); + $r->get('', [App\Controllers\Admin\AdminController::class, 'main']); $r->get('/spam', [App\Controllers\Admin\SpamController::class, 'index']); $r->post('/spam/delete', [App\Controllers\Admin\SpamController::class, 'delete']); $r->get('/errors', [App\Controllers\Admin\ErrorController::class, 'index']); From 1dbf7135afecca311c505d7d8d8bca3e108846f3 Mon Sep 17 00:00:00 2001 From: visavi Date: Sun, 28 Oct 2018 00:26:02 +0300 Subject: [PATCH 068/163] =?UTF-8?q?=D0=A3=D0=BF=D1=80=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BD=D1=82=D0=BE=D0=BB=D0=BB=D0=B5=D1=80=D0=BE=D0=B2,=20?= =?UTF-8?q?=D1=83=D0=B1=D1=80=D0=B0=D0=BB=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2?= =?UTF-8?q?=20=D0=BD=D0=B5=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D1=8B=D1=85=20?= =?UTF-8?q?=D0=BC=D0=B0=D0=B3=D0=B8=D1=87=D0=B5=D1=81=D0=BA=D0=B8=D1=85=20?= =?UTF-8?q?=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Classes/Application.php | 9 +- app/Controllers/FileController.php | 15 ++- app/Controllers/PageController.php | 13 ++- app/Controllers/SitemapController.php | 64 ++++++++----- app/routes.php | 2 +- composer.lock | 124 ++++++++++++------------- resources/views/admin/index.blade.php | 2 +- resources/views/files/index.blade.php | 7 +- resources/views/files/layout.blade.php | 2 +- resources/views/main/layout.blade.php | 2 +- 10 files changed, 127 insertions(+), 113 deletions(-) diff --git a/app/Classes/Application.php b/app/Classes/Application.php index 6055bd08d..94a0d9183 100644 --- a/app/Classes/Application.php +++ b/app/Classes/Application.php @@ -60,11 +60,7 @@ private function call($router) $container = new Container(); $container->set(Request::class, Request::createFromGlobals()); - try { - return $container->call($controller, $params); - } catch (\Exception $e) { - return \call_user_func_array([new $controller[0], $controller[1]], $params); - } + return $container->call($controller, $params); } /** @@ -150,7 +146,7 @@ private function checkAuth(): void redirect('/key?user=' . $user->login); } - // ---------------------- Получение ежедневного бонуса -----------------------// + // Получение ежедневного бонуса if ($user->timebonus < SITETIME - 82800) { $user->update([ 'timebonus' => SITETIME, @@ -190,6 +186,7 @@ private function setSetting(): void if (empty($_SESSION['token'])) { $_SESSION['token'] = str_random(8); } + if (empty($_SESSION['protect'])) { $_SESSION['protect'] = random_int(1000, 99999); } diff --git a/app/Controllers/FileController.php b/app/Controllers/FileController.php index 15e51a9e3..7351f10bc 100644 --- a/app/Controllers/FileController.php +++ b/app/Controllers/FileController.php @@ -7,26 +7,25 @@ class FileController extends BaseController /** * Главная страница * - * @param string $action - * @param string $params + * @param string $page * @return string */ - public function __call($action, $params) + public function index(string $page = 'index'): string { - if ($action === 'index') { + if ($page === 'index') { return view('files/index'); } - if (! preg_match('|^[a-z0-9_\-/]+$|i', $action)) { + if (! preg_match('|^[a-z0-9_\-/]+$|i', $page)) { abort(404); } - $action = str_contains($action, '/') ? $action : $action . '/index'; + $page = str_contains($page, '/') ? $page : $page . '/index'; - if (! file_exists(RESOURCES.'/views/files/' . $action . '.blade.php')) { + if (! file_exists(RESOURCES . '/views/files/' . $page . '.blade.php')) { abort(404); } - return view('files/layout', compact('action')); + return view('files/layout', compact('page')); } } diff --git a/app/Controllers/PageController.php b/app/Controllers/PageController.php index 77a18dc36..400645358 100644 --- a/app/Controllers/PageController.php +++ b/app/Controllers/PageController.php @@ -13,25 +13,24 @@ class PageController extends BaseController /** * Главная страница * - * @param string $action - * @param array $params + * @param string $page * @return string */ - public function __call(string $action, array $params) + public function index(string $page = 'index'): string { - if (! preg_match('|^[a-z0-9_\-]+$|i', $action)) { + if (! preg_match('|^[a-z0-9_\-]+$|i', $page)) { abort(404); } - if (! file_exists(RESOURCES . '/views/main/' . $action . '.blade.php')){ + if (! file_exists(RESOURCES . '/views/main/' . $page . '.blade.php')){ abort(404); } - if ($action === 'menu' && ! getUser()){ + if ($page === 'menu' && ! getUser()){ abort(404); } - return view('main/layout', compact('action')); + return view('main/layout', compact('page')); } /** diff --git a/app/Controllers/SitemapController.php b/app/Controllers/SitemapController.php index abd1ccc13..36718da19 100644 --- a/app/Controllers/SitemapController.php +++ b/app/Controllers/SitemapController.php @@ -10,23 +10,26 @@ class SitemapController extends BaseController { + /** + * @var array + */ + public $pages = [ + 'news', + 'blogs', + 'topics', + 'downs', + ]; + /** * Генерируем главную страницу */ public function index() { - $pages = [ - 'news.xml', - 'blogs.xml', - 'topics.xml', - 'downs.xml', - ]; - $locs = []; - foreach ($pages as $page) { + foreach ($this->pages as $page) { $locs[] = [ - 'loc' => siteUrl(true) . '/sitemap/' . $page, + 'loc' => siteUrl(true) . '/sitemap/' . $page . '.xml', 'lastmod' => date('c', SITETIME), ]; } @@ -34,10 +37,27 @@ public function index() return view('sitemap/index', compact('locs')); } + /** + * Вызывает страницу + * + * @param $page + * @return string + */ + public function page(string $page): string + { + if (! \in_array($page, $this->pages, true)) { + abort(404); + } + + return $this->$page(); + } + /** * Генерируем блоги + * + * @return string */ - public function blogs() + private function blogs(): string { $blogs = Blog::query() ->selectRaw('blogs.*, max(c.created_at) as last_time') @@ -67,10 +87,13 @@ public function blogs() return view('sitemap/url', compact('locs')); } + /** * Генерируем новости + * + * @return string */ - public function news() + private function news(): string { $newses = News::query() ->selectRaw('news.*, max(c.created_at) as last_time') @@ -103,8 +126,10 @@ public function news() /** * Генерируем темы форума + * + * @return string */ - public function topics() + private function topics(): string { $topics = Topic::query()->orderBy('updated_at', 'desc')->limit(15000)->get(); @@ -126,8 +151,10 @@ public function topics() /** * Генерируем загрузки + * + * @return string */ - public function downs() + private function downs(): string { $downs = Down::query() ->selectRaw('downs.*, max(c.created_at) as last_time') @@ -157,15 +184,4 @@ public function downs() return view('sitemap/url', compact('locs')); } - - /** - * Если вызывается несуществуюший метод - * - * @param string $name - * @param array $arguments - */ - public function __call($name, $arguments) - { - abort(404); - } } diff --git a/app/routes.php b/app/routes.php index bc552286e..708184b4b 100644 --- a/app/routes.php +++ b/app/routes.php @@ -12,7 +12,7 @@ /* Карта сайта */ $r->get('/sitemap.xml', [App\Controllers\SitemapController::class, 'index']); - $r->get('/sitemap/{action:[a-z]+}.xml', [App\Controllers\SitemapController::class]); + $r->get('/sitemap/{page:[a-z]+}.xml', [App\Controllers\SitemapController::class, 'page']); /* Категории объявления */ $r->addGroup('/boards', function (RouteCollector $r) { diff --git a/composer.lock b/composer.lock index c5abdbd54..d40e1f020 100644 --- a/composer.lock +++ b/composer.lock @@ -631,16 +631,16 @@ }, { "name": "illuminate/container", - "version": "v5.7.9", + "version": "v5.7.11", "source": { "type": "git", "url": "https://github.com/illuminate/container.git", - "reference": "73cde7bd4985eefb1d468a745e1d50d03e276121" + "reference": "4c90c3d3ba88e52da152e885d24c9f891a2ec545" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/container/zipball/73cde7bd4985eefb1d468a745e1d50d03e276121", - "reference": "73cde7bd4985eefb1d468a745e1d50d03e276121", + "url": "https://api.github.com/repos/illuminate/container/zipball/4c90c3d3ba88e52da152e885d24c9f891a2ec545", + "reference": "4c90c3d3ba88e52da152e885d24c9f891a2ec545", "shasum": "" }, "require": { @@ -672,11 +672,11 @@ ], "description": "The Illuminate Container package.", "homepage": "https://laravel.com", - "time": "2018-10-07T15:52:17+00:00" + "time": "2018-10-18T03:39:45+00:00" }, { "name": "illuminate/contracts", - "version": "v5.7.9", + "version": "v5.7.11", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", @@ -720,16 +720,16 @@ }, { "name": "illuminate/database", - "version": "v5.7.9", + "version": "v5.7.11", "source": { "type": "git", "url": "https://github.com/illuminate/database.git", - "reference": "1f4a0881ca0012732ae7b73809cf50ef8d964547" + "reference": "95300422e4607bbf1b06baf141d83c2d6e289bd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/database/zipball/1f4a0881ca0012732ae7b73809cf50ef8d964547", - "reference": "1f4a0881ca0012732ae7b73809cf50ef8d964547", + "url": "https://api.github.com/repos/illuminate/database/zipball/95300422e4607bbf1b06baf141d83c2d6e289bd1", + "reference": "95300422e4607bbf1b06baf141d83c2d6e289bd1", "shasum": "" }, "require": { @@ -775,11 +775,11 @@ "orm", "sql" ], - "time": "2018-10-06T18:48:42+00:00" + "time": "2018-10-24T12:48:02+00:00" }, { "name": "illuminate/events", - "version": "v5.7.9", + "version": "v5.7.11", "source": { "type": "git", "url": "https://github.com/illuminate/events.git", @@ -824,16 +824,16 @@ }, { "name": "illuminate/filesystem", - "version": "v5.7.9", + "version": "v5.7.11", "source": { "type": "git", "url": "https://github.com/illuminate/filesystem.git", - "reference": "a09fae4470494dc9867609221b46fe844f2f3b70" + "reference": "cbb5650be36d7370f7ae5f039d2143952fa58f51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/filesystem/zipball/a09fae4470494dc9867609221b46fe844f2f3b70", - "reference": "a09fae4470494dc9867609221b46fe844f2f3b70", + "url": "https://api.github.com/repos/illuminate/filesystem/zipball/cbb5650be36d7370f7ae5f039d2143952fa58f51", + "reference": "cbb5650be36d7370f7ae5f039d2143952fa58f51", "shasum": "" }, "require": { @@ -872,20 +872,20 @@ ], "description": "The Illuminate Filesystem package.", "homepage": "https://laravel.com", - "time": "2018-08-14T19:42:44+00:00" + "time": "2018-10-24T12:49:16+00:00" }, { "name": "illuminate/http", - "version": "v5.7.9", + "version": "v5.7.11", "source": { "type": "git", "url": "https://github.com/illuminate/http.git", - "reference": "fcf1940b9bde323bdf2500d49dc2ff5580ece19c" + "reference": "693a78d4cde0de82f52f46683fb96943af75f0e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/http/zipball/fcf1940b9bde323bdf2500d49dc2ff5580ece19c", - "reference": "fcf1940b9bde323bdf2500d49dc2ff5580ece19c", + "url": "https://api.github.com/repos/illuminate/http/zipball/693a78d4cde0de82f52f46683fb96943af75f0e7", + "reference": "693a78d4cde0de82f52f46683fb96943af75f0e7", "shasum": "" }, "require": { @@ -918,20 +918,20 @@ ], "description": "The Illuminate Http package.", "homepage": "https://laravel.com", - "time": "2018-10-05T19:25:25+00:00" + "time": "2018-10-19T04:42:40+00:00" }, { "name": "illuminate/session", - "version": "v5.7.9", + "version": "v5.7.11", "source": { "type": "git", "url": "https://github.com/illuminate/session.git", - "reference": "2657efcbf9be18da34d354e3f66809b45c92f3da" + "reference": "966b62512666bec8a5bf473cf277f0876ec2aeb8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/session/zipball/2657efcbf9be18da34d354e3f66809b45c92f3da", - "reference": "2657efcbf9be18da34d354e3f66809b45c92f3da", + "url": "https://api.github.com/repos/illuminate/session/zipball/966b62512666bec8a5bf473cf277f0876ec2aeb8", + "reference": "966b62512666bec8a5bf473cf277f0876ec2aeb8", "shasum": "" }, "require": { @@ -968,20 +968,20 @@ ], "description": "The Illuminate Session package.", "homepage": "https://laravel.com", - "time": "2018-07-30T13:42:51+00:00" + "time": "2018-10-10T20:24:53+00:00" }, { "name": "illuminate/support", - "version": "v5.7.9", + "version": "v5.7.11", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "ea95697233b06650382eb0f5798be22b4e520dea" + "reference": "45bfc0cd080c51946f61c04e324c2b4c6df58a9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/ea95697233b06650382eb0f5798be22b4e520dea", - "reference": "ea95697233b06650382eb0f5798be22b4e520dea", + "url": "https://api.github.com/repos/illuminate/support/zipball/45bfc0cd080c51946f61c04e324c2b4c6df58a9d", + "reference": "45bfc0cd080c51946f61c04e324c2b4c6df58a9d", "shasum": "" }, "require": { @@ -1027,20 +1027,20 @@ ], "description": "The Illuminate Support package.", "homepage": "https://laravel.com", - "time": "2018-10-07T15:51:39+00:00" + "time": "2018-10-22T17:36:06+00:00" }, { "name": "illuminate/translation", - "version": "v5.7.9", + "version": "v5.7.11", "source": { "type": "git", "url": "https://github.com/illuminate/translation.git", - "reference": "92904065217ef4ce6c365ab89c6004eea6f6f2f5" + "reference": "6c6eabf018d106778cba7015a8d5753ebe1078a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/translation/zipball/92904065217ef4ce6c365ab89c6004eea6f6f2f5", - "reference": "92904065217ef4ce6c365ab89c6004eea6f6f2f5", + "url": "https://api.github.com/repos/illuminate/translation/zipball/6c6eabf018d106778cba7015a8d5753ebe1078a2", + "reference": "6c6eabf018d106778cba7015a8d5753ebe1078a2", "shasum": "" }, "require": { @@ -1072,20 +1072,20 @@ ], "description": "The Illuminate Translation package.", "homepage": "https://laravel.com", - "time": "2018-10-06T18:48:42+00:00" + "time": "2018-10-18T03:39:45+00:00" }, { "name": "illuminate/view", - "version": "v5.7.9", + "version": "v5.7.11", "source": { "type": "git", "url": "https://github.com/illuminate/view.git", - "reference": "040b1a85d12eeae0335cb06827de4fd2fdcb5b51" + "reference": "97dbb6910aa5df5a7414877da89b7520f4260a58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/view/zipball/040b1a85d12eeae0335cb06827de4fd2fdcb5b51", - "reference": "040b1a85d12eeae0335cb06827de4fd2fdcb5b51", + "url": "https://api.github.com/repos/illuminate/view/zipball/97dbb6910aa5df5a7414877da89b7520f4260a58", + "reference": "97dbb6910aa5df5a7414877da89b7520f4260a58", "shasum": "" }, "require": { @@ -1120,7 +1120,7 @@ ], "description": "The Illuminate View package.", "homepage": "https://laravel.com", - "time": "2018-10-06T18:48:42+00:00" + "time": "2018-10-11T15:32:19+00:00" }, { "name": "intervention/image", @@ -1430,16 +1430,16 @@ }, { "name": "nelexa/zip", - "version": "3.1.6", + "version": "3.1.8", "source": { "type": "git", "url": "https://github.com/Ne-Lexa/php-zip.git", - "reference": "9bb20cc15e0a61bd0fba7c09dd526e1d699f8522" + "reference": "9934a860c1b6bbca1bc7762880056c8d18f14854" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Ne-Lexa/php-zip/zipball/9bb20cc15e0a61bd0fba7c09dd526e1d699f8522", - "reference": "9bb20cc15e0a61bd0fba7c09dd526e1d699f8522", + "url": "https://api.github.com/repos/Ne-Lexa/php-zip/zipball/9934a860c1b6bbca1bc7762880056c8d18f14854", + "reference": "9934a860c1b6bbca1bc7762880056c8d18f14854", "shasum": "" }, "require": { @@ -1485,7 +1485,7 @@ "zipalign", "ziparchive" ], - "time": "2018-10-11T07:54:30+00:00" + "time": "2018-10-21T16:31:21+00:00" }, { "name": "nesbot/carbon", @@ -3385,16 +3385,16 @@ }, { "name": "filp/whoops", - "version": "2.3.0", + "version": "2.3.1", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "a9f129b99df316f847584d482c89c14a9f796e2b" + "reference": "bc0fd11bc455cc20ee4b5edabc63ebbf859324c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/a9f129b99df316f847584d482c89c14a9f796e2b", - "reference": "a9f129b99df316f847584d482c89c14a9f796e2b", + "url": "https://api.github.com/repos/filp/whoops/zipball/bc0fd11bc455cc20ee4b5edabc63ebbf859324c7", + "reference": "bc0fd11bc455cc20ee4b5edabc63ebbf859324c7", "shasum": "" }, "require": { @@ -3442,7 +3442,7 @@ "throwable", "whoops" ], - "time": "2018-10-20T09:00:00+00:00" + "time": "2018-10-23T09:00:00+00:00" }, { "name": "guzzlehttp/guzzle", @@ -4010,16 +4010,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "6.1.1", + "version": "6.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "b097681a19a48e52706f57e47a09594bac4f7cab" + "reference": "4d3ae9b21a7d7e440bd0cf65565533117976859f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b097681a19a48e52706f57e47a09594bac4f7cab", - "reference": "b097681a19a48e52706f57e47a09594bac4f7cab", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/4d3ae9b21a7d7e440bd0cf65565533117976859f", + "reference": "4d3ae9b21a7d7e440bd0cf65565533117976859f", "shasum": "" }, "require": { @@ -4069,7 +4069,7 @@ "testing", "xunit" ], - "time": "2018-10-18T09:01:38+00:00" + "time": "2018-10-23T05:59:32+00:00" }, { "name": "phpunit/php-file-iterator", @@ -4262,16 +4262,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.4.1", + "version": "7.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c5a120ade60992bd671a912188ee9ee9f8083bbd" + "reference": "c151651fb6ed264038d486ea262e243af72e5e64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c5a120ade60992bd671a912188ee9ee9f8083bbd", - "reference": "c5a120ade60992bd671a912188ee9ee9f8083bbd", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c151651fb6ed264038d486ea262e243af72e5e64", + "reference": "c151651fb6ed264038d486ea262e243af72e5e64", "shasum": "" }, "require": { @@ -4342,7 +4342,7 @@ "testing", "xunit" ], - "time": "2018-10-18T09:02:52+00:00" + "time": "2018-10-23T05:57:41+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", diff --git a/resources/views/admin/index.blade.php b/resources/views/admin/index.blade.php index 24048b490..23a9f1441 100644 --- a/resources/views/admin/index.blade.php +++ b/resources/views/admin/index.blade.php @@ -66,7 +66,7 @@ Приват-рассылка
Логи посещений
Шаблоны писем
- Редактирование файлов
+ Редактирование страниц
Чистка пользователей
@endif diff --git a/resources/views/files/index.blade.php b/resources/views/files/index.blade.php index fb0405a3e..2d7874840 100644 --- a/resources/views/files/index.blade.php +++ b/resources/views/files/index.blade.php @@ -19,12 +19,15 @@ 2. Создайте в ней директорию с произвольным латинским названием (к примеру library)
3. Положите в созданную директорию обычный файл с расширением .blade.php (к примеру index.blade.php)
4. Напишите любой текст на этой странице, это может быть как html код, так и php
- 5. Теперь попробуйте перейти на созданную станицу, введите в браузере /files/library
+ 5. Теперь попробуйте перейти на созданную станицу, введите в браузере /files/library
6. Если страница отобразилась, значит вы все сделали правильно
+

+ Все страницы сайта можно создавать, редактировать и удалять прямо из админки в разделе Редактирование страниц +

+

В одной директории может быть неограниченное число файлов, расширение указывать не нужно, только имя папки и имя файла через слеш, к примеру /library/simplepage, /library/index то же что и просто /library

- Также можно указать заголовок страницы, который автоматически подставится в блок title, для этого нужно написать следующий код

diff --git a/resources/views/files/layout.blade.php b/resources/views/files/layout.blade.php index d2f066893..dc197cda0 100644 --- a/resources/views/files/layout.blade.php +++ b/resources/views/files/layout.blade.php @@ -1,5 +1,5 @@ @extends('layout') @section('content') - @include('files/' . $action) + @include('files/' . $page) @stop diff --git a/resources/views/main/layout.blade.php b/resources/views/main/layout.blade.php index ab7173427..ca24062fe 100755 --- a/resources/views/main/layout.blade.php +++ b/resources/views/main/layout.blade.php @@ -1,5 +1,5 @@ @extends('layout') @section('content') - @include('main/' . $action) + @include('main/' . $page) @stop From 1c7c9999ed966cbe144b56ea8804975ab5ce7d51 Mon Sep 17 00:00:00 2001 From: visavi Date: Sun, 28 Oct 2018 01:13:45 +0300 Subject: [PATCH 069/163] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=83=20=D0=BE?= =?UTF-8?q?=D1=87=D0=B8=D1=81=D1=82=D0=BA=D0=B8=20=D1=80=D0=BE=D1=82=D1=83?= =?UTF-8?q?=D1=82=D0=BE=D0=B2,=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=83=20=D0=B2=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=BF=D0=BE=D0=B7=D0=B5=D1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Commands/{Install.php => AppInstall.php} | 10 +++--- app/Commands/CacheClear.php | 4 +-- app/Commands/KeyGenerate.php | 8 ++--- app/Commands/RouteClear.php | 37 ++++++++++++++++++++ composer.json | 5 ++- readme.md | 2 +- rotor | 3 +- 7 files changed, 55 insertions(+), 14 deletions(-) rename app/Commands/{Install.php => AppInstall.php} (83%) create mode 100644 app/Commands/RouteClear.php diff --git a/app/Commands/Install.php b/app/Commands/AppInstall.php similarity index 83% rename from app/Commands/Install.php rename to app/Commands/AppInstall.php index f807bc8a0..97196a6fe 100644 --- a/app/Commands/Install.php +++ b/app/Commands/AppInstall.php @@ -6,16 +6,16 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -class Install extends AbstractCommand +class AppInstall extends AbstractCommand { /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { parent::configure(); - $this->setName('install') + $this->setName('app:install') ->setDescription('Setting permissions on folders'); } @@ -26,7 +26,7 @@ protected function configure() * @param OutputInterface $output * @return void */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): void { $storage = glob(STORAGE.'/*', GLOB_ONLYDIR); $uploads = glob(UPLOADS.'/*', GLOB_ONLYDIR); @@ -35,7 +35,7 @@ protected function execute(InputInterface $input, OutputInterface $output) foreach ($dirs as $dir) { $old = umask(0); - chmod ($dir, 0777); + chmod($dir, 0777); umask($old); } diff --git a/app/Commands/CacheClear.php b/app/Commands/CacheClear.php index 82e23ab06..968edeac1 100644 --- a/app/Commands/CacheClear.php +++ b/app/Commands/CacheClear.php @@ -11,7 +11,7 @@ class CacheClear extends AbstractCommand /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { parent::configure(); @@ -26,7 +26,7 @@ protected function configure() * @param OutputInterface $output * @return void */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): void { $cacheFiles = glob(STORAGE.'/caches/*.php'); diff --git a/app/Commands/KeyGenerate.php b/app/Commands/KeyGenerate.php index 405950116..e09d53646 100644 --- a/app/Commands/KeyGenerate.php +++ b/app/Commands/KeyGenerate.php @@ -11,7 +11,7 @@ class KeyGenerate extends AbstractCommand /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { parent::configure(); @@ -26,7 +26,7 @@ protected function configure() * @param OutputInterface $output * @return void */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): void { $key = str_random(32); $this->writeNewEnvironmentFileWith($key); @@ -40,7 +40,7 @@ protected function execute(InputInterface $input, OutputInterface $output) * @param string $key * @return void */ - protected function writeNewEnvironmentFileWith($key) + protected function writeNewEnvironmentFileWith($key): void { file_put_contents(BASEDIR . '/.env', preg_replace( $this->keyReplacementPattern(), @@ -54,7 +54,7 @@ protected function writeNewEnvironmentFileWith($key) * * @return string */ - protected function keyReplacementPattern() + protected function keyReplacementPattern(): string { $escaped = preg_quote('=' . env('APP_KEY'), '/'); return "/^APP_KEY{$escaped}/m"; diff --git a/app/Commands/RouteClear.php b/app/Commands/RouteClear.php new file mode 100644 index 000000000..291ebe111 --- /dev/null +++ b/app/Commands/RouteClear.php @@ -0,0 +1,37 @@ +setName('route:clear') + ->setDescription('Flush the routes cache'); + } + + /** + * Route cleared + * + * @param InputInterface $input + * @param OutputInterface $output + * @return void + */ + protected function execute(InputInterface $input, OutputInterface $output): void + { + if (file_exists(STORAGE . '/temp/routes.dat')) { + unlink (STORAGE . '/temp/routes.dat'); + } + + $output->writeln('Routes cleared successfully.'); + } +} diff --git a/composer.json b/composer.json index c8c44fc55..a02bac88b 100644 --- a/composer.json +++ b/composer.json @@ -42,9 +42,12 @@ "php-coveralls/php-coveralls": "^2.1" }, "scripts": { + "post-autoload-dump": [ + "@php rotor route:clear" + ], "post-create-project-cmd": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"", - "@php rotor install", + "@php rotor app:install", "@php rotor key:generate" ] }, diff --git a/readme.md b/readme.md index dfc6aec8e..9ca685bdc 100644 --- a/readme.md +++ b/readme.md @@ -39,7 +39,7 @@ Rotor 7.1 6. Настройте конфигурационный файл .env, окружение, данные для доступа к БД, логин и email администратора и данные для отправки писем, sendmail или smtp. Если устанавливаете CMS вручную, то переименуйте конфигурационный файл .env.example в .env (Файл не отслеживается git'ом, поэтому на сервере и на локальном сайте могут находиться 2 разных файла с разными окружениями указанными в APP_ENV) -7. Установите права на запись всем директориям внутри `public/uploads` и `storage` или выполните команду `php rotor install` +7. Установите права на запись всем директориям внутри `public/uploads` и `storage` или выполните команду `php rotor app:install` 8. Если вы впервые устанавливаете движок, то необходимо очистить папку /database/upgrades и настройка APP_NEW должна быть true, если вы обновляетесь с предыдущей версии, то APP_NEW должна быть false. diff --git a/rotor b/rotor index 7ad21eddd..6568de652 100644 --- a/rotor +++ b/rotor @@ -15,9 +15,10 @@ $app->setName('Rotor by Vantuz - http://visavi.net'); $app->setVersion(VERSION); $app->addCommands([ - new \App\Commands\Install(), + new \App\Commands\AppInstall(), new \App\Commands\KeyGenerate(), new \App\Commands\CacheClear(), + new \App\Commands\RouteClear(), ]); $dispatcher = new EventDispatcher(); From 195df1e91802df162f3d27c37c444ed62266166e Mon Sep 17 00:00:00 2001 From: visavi Date: Sun, 28 Oct 2018 19:54:37 +0300 Subject: [PATCH 070/163] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=20=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D1=8E=20=D0=B8=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=20=D0=B4?= =?UTF-8?q?=D0=B0=D1=82=D1=8B=20=D0=BD=D0=BE=D0=B2=D0=BE=D1=81=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/PageController.php | 45 ++++++++++++++++++++++------- app/routes.php | 2 +- resources/views/news/view.blade.php | 5 ++-- 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/app/Controllers/PageController.php b/app/Controllers/PageController.php index 400645358..e0bb54566 100644 --- a/app/Controllers/PageController.php +++ b/app/Controllers/PageController.php @@ -18,33 +18,47 @@ class PageController extends BaseController */ public function index(string $page = 'index'): string { - if (! preg_match('|^[a-z0-9_\-]+$|i', $page)) { + if ( + $page === 'menu' || + ! preg_match('|^[a-z0-9_\-]+$|i', $page) || + ! file_exists(RESOURCES . '/views/main/' . $page . '.blade.php') + ) { abort(404); } - if (! file_exists(RESOURCES . '/views/main/' . $page . '.blade.php')){ - abort(404); - } + return view('main/layout', compact('page')); + } - if ($page === 'menu' && ! getUser()){ + /** + * Меню + * + * @return string + */ + public function menu(): string + { + if (! getUser()) { abort(404); } - return view('main/layout', compact('page')); + return view('main/layout', ['page' => 'menu']); } /** * Теги + * + * @return string */ - public function tags() + public function tags(): string { return view('pages/tags'); } /** * Правила + * + * @return string */ - public function rules() + public function rules(): string { $rules = Rule::query()->first(); @@ -57,8 +71,10 @@ public function rules() /** * Смайлы + * + * @return string */ - public function smiles() + public function smiles(): string { $total = Smile::query()->count(); $page = paginate(setting('smilelist'), $total); @@ -75,6 +91,9 @@ public function smiles() /** * Ежегодный сюрприз + * + * @return void + * @throws \Exception */ public function surprise(): void { @@ -130,8 +149,10 @@ public function surprise(): void /** * FAQ по сайту + * + * @return string */ - public function faq() + public function faq(): string { return view('pages/faq'); } @@ -139,8 +160,10 @@ public function faq() /** * FAQ по статусам + * + * @return string */ - public function statusfaq() + public function statusfaq(): string { $statuses = Status::query() ->orderBy('topoint', 'desc') diff --git a/app/routes.php b/app/routes.php index 708184b4b..a5e717ac4 100644 --- a/app/routes.php +++ b/app/routes.php @@ -313,8 +313,8 @@ $r->addRoute(['GET', 'POST'], '/profile', [App\Controllers\User\UserController::class, 'profile']); $r->addRoute(['GET', 'POST'], '/settings', [App\Controllers\User\UserController::class, 'setting']); + $r->get('/pages[/{page:[\w\-]+}]', [App\Controllers\PageController::class, 'index']); $r->get('/menu', [App\Controllers\PageController::class, 'menu']); - $r->get('/pages[/{page:[a-zA-Z0-9]+}]', [App\Controllers\PageController::class, 'index']); $r->get('/tags', [App\Controllers\PageController::class, 'tags']); $r->get('/rules', [App\Controllers\PageController::class, 'rules']); $r->get('/smiles', [App\Controllers\PageController::class, 'smiles']); diff --git a/resources/views/news/view.blade.php b/resources/views/news/view.blade.php index 57afaf4cc..694bfda63 100644 --- a/resources/views/news/view.blade.php +++ b/resources/views/news/view.blade.php @@ -8,8 +8,7 @@ @section('content') -

{{ $news->title }} ({{ dateFixed($news->created_at) }})

- +

{{ $news->title }}

@if ($user->level === 'pended') - Внимание, аккаунт требует подтверждение регистрации!
+
+ + Внимание, аккаунт требует подтверждение регистрации! +
@endif @if ($user->level === 'banned' && $user->timeban > SITETIME) From 05e83281c3cd3816d0cebf57469d92e666bbef03 Mon Sep 17 00:00:00 2001 From: visavi Date: Fri, 16 Nov 2018 01:18:45 +0300 Subject: [PATCH 098/163] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D1=83?= =?UTF-8?q?=20=D1=84=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Traits/UploadTrait.php | 2 +- composer.lock | 151 +++++++++++++++++++------------------ 2 files changed, 78 insertions(+), 75 deletions(-) diff --git a/app/Traits/UploadTrait.php b/app/Traits/UploadTrait.php index fba75dc54..dbfc9f5b0 100644 --- a/app/Traits/UploadTrait.php +++ b/app/Traits/UploadTrait.php @@ -52,7 +52,7 @@ public function uploadFile(UploadedFile $file, $record = true): array 'relate_type' => static::class, 'hash' => $path, 'name' => utfSubstr($basename, 0, 50) . '.' . $extension, - 'size' => $file->getSize(), + 'size' => filesize($fullPath), 'user_id' => getUser('id'), 'created_at' => SITETIME, ]); diff --git a/composer.lock b/composer.lock index 71c2d107f..5e92d79b7 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": "95d9015216b400967d094708e008dff5", + "content-hash": "9b896f6b43fe6f181c0da3ec529f7974", "packages": [ { "name": "alchemy/binary-driver", @@ -75,12 +75,12 @@ "source": { "type": "git", "url": "https://github.com/cbschuld/Browser.php.git", - "reference": "6bde9efb0b14a4917affe741500c29149419e491" + "reference": "f8655aedba32168ed34a6b89c7cceeb502fee3e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cbschuld/Browser.php/zipball/6bde9efb0b14a4917affe741500c29149419e491", - "reference": "6bde9efb0b14a4917affe741500c29149419e491", + "url": "https://api.github.com/repos/cbschuld/Browser.php/zipball/f8655aedba32168ed34a6b89c7cceeb502fee3e4", + "reference": "f8655aedba32168ed34a6b89c7cceeb502fee3e4", "shasum": "" }, "type": "library", @@ -112,7 +112,7 @@ "detection", "user agent" ], - "time": "2017-07-31T23:43:17+00:00" + "time": "2018-11-05T16:46:30+00:00" }, { "name": "doctrine/cache", @@ -1352,16 +1352,16 @@ }, { "name": "monolog/monolog", - "version": "1.23.0", + "version": "1.24.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4" + "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4", - "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", + "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", "shasum": "" }, "require": { @@ -1426,7 +1426,7 @@ "logging", "psr-3" ], - "time": "2017-06-19T01:22:40+00:00" + "time": "2018-11-05T09:00:11+00:00" }, { "name": "nelexa/zip", @@ -1489,16 +1489,16 @@ }, { "name": "nesbot/carbon", - "version": "1.34.0", + "version": "1.35.1", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33" + "reference": "5c05a2be472b22f63291d192410df9f0e0de3b19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33", - "reference": "1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/5c05a2be472b22f63291d192410df9f0e0de3b19", + "reference": "5c05a2be472b22f63291d192410df9f0e0de3b19", "shasum": "" }, "require": { @@ -1506,9 +1506,12 @@ "symfony/translation": "~2.6 || ~3.0 || ~4.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2", "phpunit/phpunit": "^4.8.35 || ^5.7" }, + "suggest": { + "friendsofphp/php-cs-fixer": "Needed for the `composer phpcs` command. Allow to automatically fix code style.", + "phpstan/phpstan": "Needed for the `composer phpstan` command. Allow to detect potential errors." + }, "type": "library", "extra": { "laravel": { @@ -1540,7 +1543,7 @@ "datetime", "time" ], - "time": "2018-09-20T19:36:25+00:00" + "time": "2018-11-14T21:55:58+00:00" }, { "name": "neutron/temporary-filesystem", @@ -1681,16 +1684,16 @@ }, { "name": "php-curl-class/php-curl-class", - "version": "8.3.2", + "version": "8.3.3", "source": { "type": "git", "url": "https://github.com/php-curl-class/php-curl-class.git", - "reference": "3193b41dcd19025ad579ea26eb48774421d84708" + "reference": "8f0a52bb17b444bf41c8c7e6953e6077e9158494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-curl-class/php-curl-class/zipball/3193b41dcd19025ad579ea26eb48774421d84708", - "reference": "3193b41dcd19025ad579ea26eb48774421d84708", + "url": "https://api.github.com/repos/php-curl-class/php-curl-class/zipball/8f0a52bb17b444bf41c8c7e6953e6077e9158494", + "reference": "8f0a52bb17b444bf41c8c7e6953e6077e9158494", "shasum": "" }, "require": { @@ -1742,7 +1745,7 @@ "web-service", "xml" ], - "time": "2018-09-09T07:05:39+00:00" + "time": "2018-11-14T07:02:19+00:00" }, { "name": "php-di/invoker", @@ -2297,16 +2300,16 @@ }, { "name": "symfony/config", - "version": "v4.1.6", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "b3d4d7b567d7a49e6dfafb6d4760abc921177c96" + "reference": "991fec8bbe77367fc8b48ecbaa8a4bd6e905a238" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/b3d4d7b567d7a49e6dfafb6d4760abc921177c96", - "reference": "b3d4d7b567d7a49e6dfafb6d4760abc921177c96", + "url": "https://api.github.com/repos/symfony/config/zipball/991fec8bbe77367fc8b48ecbaa8a4bd6e905a238", + "reference": "991fec8bbe77367fc8b48ecbaa8a4bd6e905a238", "shasum": "" }, "require": { @@ -2356,20 +2359,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2018-09-08T13:24:10+00:00" + "time": "2018-10-31T09:09:42+00:00" }, { "name": "symfony/console", - "version": "v4.1.6", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "dc7122fe5f6113cfaba3b3de575d31112c9aa60b" + "reference": "432122af37d8cd52fba1b294b11976e0d20df595" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/dc7122fe5f6113cfaba3b3de575d31112c9aa60b", - "reference": "dc7122fe5f6113cfaba3b3de575d31112c9aa60b", + "url": "https://api.github.com/repos/symfony/console/zipball/432122af37d8cd52fba1b294b11976e0d20df595", + "reference": "432122af37d8cd52fba1b294b11976e0d20df595", "shasum": "" }, "require": { @@ -2424,20 +2427,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-10-03T08:15:46+00:00" + "time": "2018-10-31T09:30:44+00:00" }, { "name": "symfony/debug", - "version": "v4.1.6", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "e3f76ce6198f81994e019bb2b4e533e9de1b9b90" + "reference": "19090917b848a799cbae4800abf740fe4eb71c1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/e3f76ce6198f81994e019bb2b4e533e9de1b9b90", - "reference": "e3f76ce6198f81994e019bb2b4e533e9de1b9b90", + "url": "https://api.github.com/repos/symfony/debug/zipball/19090917b848a799cbae4800abf740fe4eb71c1d", + "reference": "19090917b848a799cbae4800abf740fe4eb71c1d", "shasum": "" }, "require": { @@ -2480,20 +2483,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-10-02T16:36:10+00:00" + "time": "2018-10-31T09:09:42+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.1.6", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e" + "reference": "552541dad078c85d9414b09c041ede488b456cd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/bfb30c2ad377615a463ebbc875eba64a99f6aa3e", - "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/552541dad078c85d9414b09c041ede488b456cd5", + "reference": "552541dad078c85d9414b09c041ede488b456cd5", "shasum": "" }, "require": { @@ -2543,20 +2546,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2018-07-26T09:10:45+00:00" + "time": "2018-10-10T13:52:42+00:00" }, { "name": "symfony/filesystem", - "version": "v4.1.6", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "596d12b40624055c300c8b619755b748ca5cf0b5" + "reference": "fd7bd6535beb1f0a0a9e3ee960666d0598546981" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/596d12b40624055c300c8b619755b748ca5cf0b5", - "reference": "596d12b40624055c300c8b619755b748ca5cf0b5", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/fd7bd6535beb1f0a0a9e3ee960666d0598546981", + "reference": "fd7bd6535beb1f0a0a9e3ee960666d0598546981", "shasum": "" }, "require": { @@ -2593,11 +2596,11 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2018-10-02T12:40:59+00:00" + "time": "2018-10-30T13:18:25+00:00" }, { "name": "symfony/finder", - "version": "v4.1.6", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -2646,16 +2649,16 @@ }, { "name": "symfony/http-foundation", - "version": "v4.1.6", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "d528136617ff24f530e70df9605acc1b788b08d4" + "reference": "82d494c1492b0dd24bbc5c2d963fb02eb44491af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d528136617ff24f530e70df9605acc1b788b08d4", - "reference": "d528136617ff24f530e70df9605acc1b788b08d4", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/82d494c1492b0dd24bbc5c2d963fb02eb44491af", + "reference": "82d494c1492b0dd24bbc5c2d963fb02eb44491af", "shasum": "" }, "require": { @@ -2696,20 +2699,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2018-10-03T08:48:45+00:00" + "time": "2018-10-31T09:09:42+00:00" }, { "name": "symfony/http-kernel", - "version": "v4.1.6", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "f5e7c15a5d010be0e16ce798594c5960451d4220" + "reference": "958be64ab13b65172ad646ef5ae20364c2305fae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/f5e7c15a5d010be0e16ce798594c5960451d4220", - "reference": "f5e7c15a5d010be0e16ce798594c5960451d4220", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/958be64ab13b65172ad646ef5ae20364c2305fae", + "reference": "958be64ab13b65172ad646ef5ae20364c2305fae", "shasum": "" }, "require": { @@ -2783,7 +2786,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2018-10-03T12:53:38+00:00" + "time": "2018-11-03T11:11:23+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3012,16 +3015,16 @@ }, { "name": "symfony/process", - "version": "v4.1.6", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "ee33c0322a8fee0855afcc11fff81e6b1011b529" + "reference": "3e83acef94d979b1de946599ef86b3a352abcdc9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/ee33c0322a8fee0855afcc11fff81e6b1011b529", - "reference": "ee33c0322a8fee0855afcc11fff81e6b1011b529", + "url": "https://api.github.com/repos/symfony/process/zipball/3e83acef94d979b1de946599ef86b3a352abcdc9", + "reference": "3e83acef94d979b1de946599ef86b3a352abcdc9", "shasum": "" }, "require": { @@ -3057,20 +3060,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-10-02T12:40:59+00:00" + "time": "2018-10-14T20:48:13+00:00" }, { "name": "symfony/translation", - "version": "v4.1.6", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "9f0b61e339160a466ebcde167a6c5521c810e304" + "reference": "aa04dc1c75b7d3da7bd7003104cd0cfc5dff635c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/9f0b61e339160a466ebcde167a6c5521c810e304", - "reference": "9f0b61e339160a466ebcde167a6c5521c810e304", + "url": "https://api.github.com/repos/symfony/translation/zipball/aa04dc1c75b7d3da7bd7003104cd0cfc5dff635c", + "reference": "aa04dc1c75b7d3da7bd7003104cd0cfc5dff635c", "shasum": "" }, "require": { @@ -3126,11 +3129,11 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2018-10-02T16:36:10+00:00" + "time": "2018-10-28T18:38:52+00:00" }, { "name": "symfony/yaml", - "version": "v4.1.6", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -4262,16 +4265,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.4.3", + "version": "7.4.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c151651fb6ed264038d486ea262e243af72e5e64" + "reference": "b1be2c8530c4c29c3519a052c9fb6cee55053bbd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c151651fb6ed264038d486ea262e243af72e5e64", - "reference": "c151651fb6ed264038d486ea262e243af72e5e64", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b1be2c8530c4c29c3519a052c9fb6cee55053bbd", + "reference": "b1be2c8530c4c29c3519a052c9fb6cee55053bbd", "shasum": "" }, "require": { @@ -4342,7 +4345,7 @@ "testing", "xunit" ], - "time": "2018-10-23T05:57:41+00:00" + "time": "2018-11-14T16:52:02+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -4909,7 +4912,7 @@ }, { "name": "symfony/stopwatch", - "version": "v4.1.6", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", From 37bdcf0538a662bd3f17e5e93c97f9cd65c8e338 Mon Sep 17 00:00:00 2001 From: visavi Date: Fri, 16 Nov 2018 11:59:54 +0300 Subject: [PATCH 099/163] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BB=20=D0=BF=D0=BE=D0=BB=D0=B5?= =?UTF-8?q?=20read,=20=D0=BC=D0=B8=D0=B3=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D1=80=D1=8B=D1=85=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86?= =?UTF-8?q?=20inbox,=20outbox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/ApiController.php | 2 +- app/Controllers/MessageController.php | 4 +-- ...20181104230534_move_outbox_to_messages.php | 1 + ...20181116004251_rename_read_in_messages.php | 15 +++++++++ .../20181116015911_remove_inbox_table.php | 32 +++++++++++++++++++ .../20181116021134_remove_outbox_table.php | 32 +++++++++++++++++++ resources/views/messages/index.blade.php | 2 +- resources/views/messages/talk.blade.php | 2 +- .../views/messages/talk_system.blade.php | 2 +- 9 files changed, 86 insertions(+), 6 deletions(-) create mode 100644 database/upgrades/20181116004251_rename_read_in_messages.php create mode 100644 database/upgrades/20181116015911_remove_inbox_table.php create mode 100644 database/upgrades/20181116021134_remove_outbox_table.php diff --git a/app/Controllers/ApiController.php b/app/Controllers/ApiController.php index f55d41aac..95700b143 100644 --- a/app/Controllers/ApiController.php +++ b/app/Controllers/ApiController.php @@ -118,7 +118,7 @@ public function messages(Request $request): void 'author_id' => $data->author_id, 'login' => $data->author->id ? $data->author->login : 'Система', 'text' => $data->text, - 'read' => $data->read, + 'reading' => $data->reading, 'created_at' => $data->created_at, ]; } diff --git a/app/Controllers/MessageController.php b/app/Controllers/MessageController.php index be4893d1b..14adbdcc1 100644 --- a/app/Controllers/MessageController.php +++ b/app/Controllers/MessageController.php @@ -110,7 +110,7 @@ public function talk(?string $login = null): string Message::query() ->where('user_id', $this->user->id) ->where('author_id', $user->id) - ->update(['read' => 1]); + ->update(['reading' => 1]); $view = $user->id ? 'messages/talk' : 'messages/talk_system'; @@ -169,7 +169,7 @@ public function send(Request $request, Validator $validator): void 'author_id' => $user->id, 'text' => $msg, 'type' => 'out', - 'read' => 1, + 'reading' => 1, 'created_at' => SITETIME, ]); diff --git a/database/upgrades/20181104230534_move_outbox_to_messages.php b/database/upgrades/20181104230534_move_outbox_to_messages.php index ff9453864..0b731a4de 100644 --- a/database/upgrades/20181104230534_move_outbox_to_messages.php +++ b/database/upgrades/20181104230534_move_outbox_to_messages.php @@ -20,6 +20,7 @@ public function up() 'author_id' => $row['recipient_id'], 'text' => $row['text'], 'type' => 'out', + 'read' => 1, 'created_at' => $row['created_at'], ]; } diff --git a/database/upgrades/20181116004251_rename_read_in_messages.php b/database/upgrades/20181116004251_rename_read_in_messages.php new file mode 100644 index 000000000..c4cfab0e8 --- /dev/null +++ b/database/upgrades/20181116004251_rename_read_in_messages.php @@ -0,0 +1,15 @@ +table('messages'); + $table->renameColumn('read', 'reading'); + } +} diff --git a/database/upgrades/20181116015911_remove_inbox_table.php b/database/upgrades/20181116015911_remove_inbox_table.php new file mode 100644 index 000000000..9e24c6efc --- /dev/null +++ b/database/upgrades/20181116015911_remove_inbox_table.php @@ -0,0 +1,32 @@ +dropTable('inbox'); + } + + /** + * Migrate Down. + */ + public function down() + { + if (! $this->hasTable('inbox')) { + $table = $this->table('inbox', ['collation' => env('DB_COLLATION')]); + $table + ->addColumn('user_id', 'integer') + ->addColumn('author_id', 'integer', ['null' => true]) + ->addColumn('text', 'text', ['null' => true]) + ->addColumn('created_at', 'integer') + ->addIndex('user_id') + ->addIndex('created_at') + ->create(); + } + } +} diff --git a/database/upgrades/20181116021134_remove_outbox_table.php b/database/upgrades/20181116021134_remove_outbox_table.php new file mode 100644 index 000000000..d338da667 --- /dev/null +++ b/database/upgrades/20181116021134_remove_outbox_table.php @@ -0,0 +1,32 @@ +dropTable('outbox'); + } + + /** + * Migrate Down. + */ + public function down() + { + if (! $this->hasTable('outbox')) { + $table = $this->table('outbox', ['collation' => env('DB_COLLATION')]); + $table + ->addColumn('user_id', 'integer') + ->addColumn('recipient_id', 'integer') + ->addColumn('text', 'text', ['null' => true]) + ->addColumn('created_at', 'integer') + ->addIndex('user_id') + ->addIndex('created_at') + ->create(); + } + } +} diff --git a/resources/views/messages/index.blade.php b/resources/views/messages/index.blade.php index 0c8ee8cec..0cd9d42b1 100644 --- a/resources/views/messages/index.blade.php +++ b/resources/views/messages/index.blade.php @@ -36,7 +36,7 @@ @endif
{!! stripString(bbCode($data->text)) !!}
- @unless ($data->read) + @unless ($data->reading) Новое @endunless diff --git a/resources/views/messages/talk.blade.php b/resources/views/messages/talk.blade.php index d556193ca..d79e1620b 100644 --- a/resources/views/messages/talk.blade.php +++ b/resources/views/messages/talk.blade.php @@ -45,7 +45,7 @@ {!! $author->getProfile() !!} - @unless ($data->read) + @unless ($data->reading)
Новое @endunless diff --git a/resources/views/messages/talk_system.blade.php b/resources/views/messages/talk_system.blade.php index 5b67b9f4e..4a4e4da6e 100644 --- a/resources/views/messages/talk_system.blade.php +++ b/resources/views/messages/talk_system.blade.php @@ -31,7 +31,7 @@ Система - @unless ($data->read) + @unless ($data->reading)
Новое @endunless From 2f124f8567a54b43f1f3a1d6e18bf2a941aaad93 Mon Sep 17 00:00:00 2001 From: visavi Date: Fri, 16 Nov 2018 13:36:47 +0300 Subject: [PATCH 100/163] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=20=D1=81=D1=87=D0=B5=D1=82=D1=87=D0=B8=D0=BA?= =?UTF-8?q?=20=D1=83=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B9=20=D0=BF=D1=80=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B2?= =?UTF-8?q?=D0=BE=D0=B4=D0=B5=20=D0=B4=D0=B5=D0=BD=D0=B5=D0=B3,=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B2=D0=BE=D0=B4=D0=B5?= =?UTF-8?q?,=20=D0=B8=D0=B3=D0=BD=D0=BE=D1=80=D0=B5=20=D0=B8=20=D0=B4?= =?UTF-8?q?=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B0=D0=BA=D1=82=D1=8B,=20=D0=BF?= =?UTF-8?q?=D0=B8=D1=81=D1=8C=D0=BC=D0=B0=20=D1=82=D0=B5=D0=BF=D0=B5=D1=80?= =?UTF-8?q?=D1=8C=20=D0=BF=D1=80=D0=B8=D1=85=D0=BE=D0=B4=D1=8F=D1=82=20?= =?UTF-8?q?=D0=BE=D1=82=20=D1=81=D0=B8=D1=81=D1=82=D0=B5=D0=BC=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/ContactController.php | 4 ++-- app/Controllers/IgnoreController.php | 4 ++-- app/Controllers/TransferController.php | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/Controllers/ContactController.php b/app/Controllers/ContactController.php index 42e8a5ca3..e5c5b3ddd 100644 --- a/app/Controllers/ContactController.php +++ b/app/Controllers/ContactController.php @@ -59,8 +59,8 @@ public function index(Request $request, Validator $validator): string ]); if (! $user->isIgnore(getUser())) { - $message = 'Пользователь [b]'.getUser('login').'[/b] добавил вас в свой контакт-лист!'; - $user->sendMessage(getUser(), $message); + $message = 'Пользователь @' . getUser('login') . ' добавил вас в свой контакт-лист!'; + $user->sendMessage(null, $message); } setFlash('success', 'Пользователь успешно добавлен в контакт-лист!'); diff --git a/app/Controllers/IgnoreController.php b/app/Controllers/IgnoreController.php index f9af4d83e..f0e0c9f75 100644 --- a/app/Controllers/IgnoreController.php +++ b/app/Controllers/IgnoreController.php @@ -60,8 +60,8 @@ public function index(Request $request, Validator $validator): string ]); if (! $user->isIgnore(getUser())) { - $message = 'Пользователь [b]' . getUser('login') . '[/b] добавил вас в свой игнор-лист!'; - $user->sendMessage(getUser(), $message); + $message = 'Пользователь @' . getUser('login') . '[/b] добавил вас в свой игнор-лист!'; + $user->sendMessage(null, $message); } setFlash('success', 'Пользователь успешно добавлен в игнор-лист!'); diff --git a/app/Controllers/TransferController.php b/app/Controllers/TransferController.php index 491d083e7..f87b35995 100644 --- a/app/Controllers/TransferController.php +++ b/app/Controllers/TransferController.php @@ -70,13 +70,12 @@ public function send(Request $request, Validator $validator): void DB::transaction(function () use ($money, $msg) { getUser()->decrement('money', $money); $this->user->increment('money', $money); - $this->user->increment('newprivat'); $comment = $msg ?? 'Не указано'; $message = 'Пользователь @' . getUser('login') . ' перечислил вам ' . plural($money, setting('moneyname')) . PHP_EOL . 'Примечание: ' . $comment; // Уведомление по привату - $this->user->sendMessage(getUser(), $message); + $this->user->sendMessage(null, $message); // Запись логов Transfer::query()->create([ From b34470a93f5e22c22f1fa6c609c4aaf880a54491 Mon Sep 17 00:00:00 2001 From: visavi Date: Fri, 16 Nov 2018 15:33:30 +0300 Subject: [PATCH 101/163] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Classes/Application.php | 4 +- app/Classes/BBCode.php | 2 +- app/Classes/Metrika.php | 26 +- app/Controllers/Admin/AdminController.php | 2 +- app/Controllers/Admin/BackupController.php | 10 +- app/Controllers/Admin/SmileController.php | 2 +- app/Controllers/Admin/VoteController.php | 2 +- app/Controllers/BaseController.php | 2 +- app/Controllers/BlogController.php | 10 +- app/Controllers/Forum/ForumController.php | 10 +- app/Controllers/Forum/TopicController.php | 10 +- app/Controllers/GuestbookController.php | 6 +- app/Controllers/Load/DownController.php | 4 +- app/Controllers/MessageController.php | 2 +- app/Controllers/NewsController.php | 6 +- app/Controllers/PageController.php | 10 +- app/Controllers/PhotoController.php | 6 +- app/Controllers/RatingController.php | 8 +- app/Controllers/TransferController.php | 3 +- app/Controllers/User/UserController.php | 2 +- app/Controllers/WallController.php | 2 +- app/Models/Antimat.php | 2 +- app/Models/Message.php | 1 + app/Models/User.php | 2 +- app/helpers.php | 26 +- composer.json | 2 + composer.lock | 738 ++++++++++++++++++++- 27 files changed, 820 insertions(+), 80 deletions(-) diff --git a/app/Classes/Application.php b/app/Classes/Application.php index 94a0d9183..066754e2c 100644 --- a/app/Classes/Application.php +++ b/app/Classes/Application.php @@ -111,7 +111,7 @@ private function cookieAuth(): void } $user->update([ - 'visits' => DB::raw('visits + 1'), + 'visits' => DB::connection()->raw('visits + 1'), 'updated_at' => SITETIME ]); } @@ -150,7 +150,7 @@ private function checkAuth(): void if ($user->timebonus < SITETIME - 82800) { $user->update([ 'timebonus' => SITETIME, - 'money' => DB::raw('money + ' . setting('bonusmoney')), + 'money' => DB::connection()->raw('money + ' . setting('bonusmoney')), ]); setFlash('success', 'Получен ежедневный бонус ' . plural(setting('bonusmoney'), setting('moneyname')) . '!'); diff --git a/app/Classes/BBCode.php b/app/Classes/BBCode.php index 36ebbc103..730cf572d 100644 --- a/app/Classes/BBCode.php +++ b/app/Classes/BBCode.php @@ -268,7 +268,7 @@ public function parseSmiles($source): string $smiles = Smile::query() ->select('code', 'name') - ->orderBy(DB::raw('CHAR_LENGTH(code)'), 'desc') + ->orderBy(DB::connection()->raw('CHAR_LENGTH(code)'), 'desc') ->get() ->toArray(); diff --git a/app/Classes/Metrika.php b/app/Classes/Metrika.php index 9083cafac..6adfbd1a3 100644 --- a/app/Classes/Metrika.php +++ b/app/Classes/Metrika.php @@ -111,30 +111,30 @@ public function saveStatistic(): void $counter = Counter::query()->first(); if (date('Y-m-d 00:00:00', strtotime($counter->period)) !== $day) { - DB::insert('insert ignore into counters31 (period, hosts, hits) values (?, ?, ?);', [$day, $counter->dayhosts, $counter->dayhits]); - DB::update('update counters set period=?, dayhosts=?, dayhits=?;', [$period, 0, 0]); + DB::connection()->insert('insert ignore into counters31 (period, hosts, hits) values (?, ?, ?);', [$day, $counter->dayhosts, $counter->dayhits]); + DB::connection()->update('update counters set period=?, dayhosts=?, dayhits=?;', [$period, 0, 0]); } if ($counter->period !== $period) { - DB::insert('insert ignore into counters24 (period, hosts, hits) values (?, ?, ?);', [$period, $counter->hosts24, $counter->hits24]); - DB::update('update counters set period=?, hosts24=?, hits24=?;', [$period, 0, 0]); + DB::connection()->insert('insert ignore into counters24 (period, hosts, hits) values (?, ?, ?);', [$period, $counter->hosts24, $counter->hits24]); + DB::connection()->update('update counters set period=?, hosts24=?, hits24=?;', [$period, 0, 0]); } // -----------------------------------------------------------// if ($newHost) { $counter->update([ - 'allhosts' => DB::raw('allhosts + 1'), - 'allhits' => DB::raw('allhits + 1'), - 'dayhosts' => DB::raw('dayhosts + 1'), - 'dayhits' => DB::raw('dayhits + 1'), - 'hosts24' => DB::raw('hosts24 + 1'), - 'hits24' => DB::raw('hits24 + 1'), + 'allhosts' => DB::connection()->raw('allhosts + 1'), + 'allhits' => DB::connection()->raw('allhits + 1'), + 'dayhosts' => DB::connection()->raw('dayhosts + 1'), + 'dayhits' => DB::connection()->raw('dayhits + 1'), + 'hosts24' => DB::connection()->raw('hosts24 + 1'), + 'hits24' => DB::connection()->raw('hits24 + 1'), ]); } else { $counter->update([ - 'allhits' => DB::raw('allhits + 1'), - 'dayhits' => DB::raw('dayhits + 1'), - 'hits24' => DB::raw('hits24 + 1'), + 'allhits' => DB::connection()->raw('allhits + 1'), + 'dayhits' => DB::connection()->raw('dayhits + 1'), + 'hits24' => DB::connection()->raw('hits24 + 1'), ]); } } diff --git a/app/Controllers/Admin/AdminController.php b/app/Controllers/Admin/AdminController.php index 9f4f9292c..8753cf13e 100644 --- a/app/Controllers/Admin/AdminController.php +++ b/app/Controllers/Admin/AdminController.php @@ -85,7 +85,7 @@ public function phpinfo(): string $gdInfo = parseVersion($gdInfo['GD Version']); } - $mysqlVersion = DB::selectOne('SHOW VARIABLES LIKE "version"'); + $mysqlVersion = DB::connection()->selectOne('SHOW VARIABLES LIKE "version"'); $mysqlVersion = parseVersion($mysqlVersion->Value); return view('admin/phpinfo', compact('iniInfo', 'gdInfo', 'mysqlVersion')); diff --git a/app/Controllers/Admin/BackupController.php b/app/Controllers/Admin/BackupController.php index 1dcc125d5..f66bbf70a 100644 --- a/app/Controllers/Admin/BackupController.php +++ b/app/Controllers/Admin/BackupController.php @@ -65,7 +65,7 @@ public function create(Request $request, Validator $validator): string if ($validator->isValid()) { - $selectTables = DB::select('SHOW TABLE STATUS where name IN("' . implode('","', $sheets) . '")'); + $selectTables = DB::connection()->select('SHOW TABLE STATUS where name IN("' . implode('","', $sheets) . '")'); $limit = 3000; $filename = 'backup_'.$this->date.'.sql'; @@ -74,12 +74,12 @@ public function create(Request $request, Validator $validator): string foreach ($selectTables as $table) { - $show = DB::selectOne("SHOW CREATE TABLE `{$table->Name}`"); + $show = DB::connection()->selectOne("SHOW CREATE TABLE `{$table->Name}`"); $this->fwrite($fp, "--\n-- Структура таблицы `{$table->Name}`\n--\n\n", $method); $this->fwrite($fp, "DROP TABLE IF EXISTS `{$table->Name}`;\n{$show->{'Create Table'}};\n\n", $method); - $total = DB::table($table->Name)->count(); + $total = DB::connection()->table($table->Name)->count(); if (! $total) { continue; @@ -90,7 +90,7 @@ public function create(Request $request, Validator $validator): string for ($i = 0; $i < $total; $i += $limit) { - $cols = DB::table($table->Name)->lockForUpdate()->limit($limit)->offset($i)->get(); + $cols = DB::connection()->table($table->Name)->lockForUpdate()->limit($limit)->offset($i)->get(); foreach ($cols as $key => $col) { $records = get_object_vars($col); @@ -120,7 +120,7 @@ public function create(Request $request, Validator $validator): string } } - $tables = DB::select('SHOW TABLE STATUS'); + $tables = DB::connection()->select('SHOW TABLE STATUS'); $bzopen = \function_exists('bzopen') ? true : false; $gzopen = \function_exists('gzopen') ? true : false; diff --git a/app/Controllers/Admin/SmileController.php b/app/Controllers/Admin/SmileController.php index 6230e4f60..084767ca1 100644 --- a/app/Controllers/Admin/SmileController.php +++ b/app/Controllers/Admin/SmileController.php @@ -34,7 +34,7 @@ public function index(): string $page = paginate(setting('smilelist'), $total); $smiles = Smile::query() - ->orderBy(DB::raw('CHAR_LENGTH(`code`)')) + ->orderBy(DB::connection()->raw('CHAR_LENGTH(`code`)')) ->orderBy('name') ->limit($page->limit) ->offset($page->offset) diff --git a/app/Controllers/Admin/VoteController.php b/app/Controllers/Admin/VoteController.php index dd633db8c..49b5d6590 100644 --- a/app/Controllers/Admin/VoteController.php +++ b/app/Controllers/Admin/VoteController.php @@ -145,7 +145,7 @@ public function delete(int $id, Request $request): void if ($token === $_SESSION['token']) { - DB::transaction(function () use ($vote) { + DB::connection()->transaction(function () use ($vote) { $vote->delete(); $vote->answers()->delete(); $vote->pollings()->delete(); diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index c4780c700..9cb0e7c6f 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -79,7 +79,7 @@ public function __construct() ]); - DB::insert( + DB::connection()->insert( 'insert ignore into ban (`ip`, `created_at`) values (?, ?);', [getIp(), SITETIME] ); diff --git a/app/Controllers/BlogController.php b/app/Controllers/BlogController.php index 46c2e4bbb..ab9ffb8b1 100644 --- a/app/Controllers/BlogController.php +++ b/app/Controllers/BlogController.php @@ -299,8 +299,8 @@ public function create(Request $request, Validator $validator): string $category->increment('count_blogs'); getUser()->update([ - 'point' => DB::raw('point + 5'), - 'money' => DB::raw('money + 100'), + 'point' => DB::connection()->raw('point + 5'), + 'money' => DB::connection()->raw('money + 100'), ]); File::query() @@ -370,9 +370,9 @@ public function comments(int $id, Request $request, Validator $validator): strin ]); getUser()->update([ - 'allcomments' => DB::raw('allcomments + 1'), - 'point' => DB::raw('point + 1'), - 'money' => DB::raw('money + 5'), + 'allcomments' => DB::connection()->raw('allcomments + 1'), + 'point' => DB::connection()->raw('point + 1'), + 'money' => DB::connection()->raw('money + 5'), ]); $blog->increment('count_comments'); diff --git a/app/Controllers/Forum/ForumController.php b/app/Controllers/Forum/ForumController.php index 89a340e6d..834c30b3a 100644 --- a/app/Controllers/Forum/ForumController.php +++ b/app/Controllers/Forum/ForumController.php @@ -137,9 +137,9 @@ public function create(Request $request, Validator $validator): string $msg = antimat($msg); $user->update([ - 'allforum' => DB::raw('allforum + 1'), - 'point' => DB::raw('point + 1'), - 'money' => DB::raw('money + 5'), + 'allforum' => DB::connection()->raw('allforum + 1'), + 'point' => DB::connection()->raw('point + 1'), + 'money' => DB::connection()->raw('money + 5'), ]); /** @var Topic $topic */ @@ -165,8 +165,8 @@ public function create(Request $request, Validator $validator): string Topic::query()->where('id', $topic->id)->update(['last_post_id' => $post->id]); $forum->update([ - 'count_topics' => DB::raw('count_topics + 1'), - 'count_posts' => DB::raw('count_posts + 1'), + 'count_topics' => DB::connection()->raw('count_topics + 1'), + 'count_posts' => DB::connection()->raw('count_posts + 1'), 'last_topic_id' => $topic->id, ]); diff --git a/app/Controllers/Forum/TopicController.php b/app/Controllers/Forum/TopicController.php index a0dc249f9..ae25ca080 100644 --- a/app/Controllers/Forum/TopicController.php +++ b/app/Controllers/Forum/TopicController.php @@ -178,19 +178,19 @@ public function create(int $id, Request $request, Validator $validator): void ]); $user->update([ - 'allforum' => DB::raw('allforum + 1'), - 'point' => DB::raw('point + 1'), - 'money' => DB::raw('money + 5'), + 'allforum' => DB::connection()->raw('allforum + 1'), + 'point' => DB::connection()->raw('point + 1'), + 'money' => DB::connection()->raw('money + 5'), ]); $topic->update([ - 'count_posts' => DB::raw('count_posts + 1'), + 'count_posts' => DB::connection()->raw('count_posts + 1'), 'last_post_id' => $post->id, 'updated_at' => SITETIME, ]); $topic->forum->update([ - 'count_posts' => DB::raw('count_posts + 1'), + 'count_posts' => DB::connection()->raw('count_posts + 1'), 'last_topic_id' => $topic->id, ]); diff --git a/app/Controllers/GuestbookController.php b/app/Controllers/GuestbookController.php index f52b3ad06..656e393c9 100644 --- a/app/Controllers/GuestbookController.php +++ b/app/Controllers/GuestbookController.php @@ -62,9 +62,9 @@ public function add(Request $request, Validator $validator): void $bookscores = setting('bookscores') ? 1 : 0; getUser()->update([ - 'allguest' => DB::raw('allguest + 1'), - 'point' => DB::raw('point + ' . $bookscores), - 'money' => DB::raw('money + 5'), + 'allguest' => DB::connection()->raw('allguest + 1'), + 'point' => DB::connection()->raw('point + ' . $bookscores), + 'money' => DB::connection()->raw('money + 5'), ]); } diff --git a/app/Controllers/Load/DownController.php b/app/Controllers/Load/DownController.php index 956439739..b813fcd91 100644 --- a/app/Controllers/Load/DownController.php +++ b/app/Controllers/Load/DownController.php @@ -317,8 +317,8 @@ public function vote(int $id, Request $request, Validator $validator): void ]); $down->update([ - 'rating' => DB::raw('rating + ' . $score), - 'rated' => DB::raw('rated + 1'), + 'rating' => DB::connection()->raw('rating + ' . $score), + 'rated' => DB::connection()->raw('rated + 1'), ]); } diff --git a/app/Controllers/MessageController.php b/app/Controllers/MessageController.php index 14adbdcc1..765f3e0a3 100644 --- a/app/Controllers/MessageController.php +++ b/app/Controllers/MessageController.php @@ -39,7 +39,7 @@ public function index(): string $page = paginate(setting('privatpost'), $total); $latestMessage = Message::query() - ->select('author_id', DB::raw('max(created_at) as last_created_at')) + ->select('author_id', DB::connection()->raw('max(created_at) as last_created_at')) ->where('user_id', $this->user->id) ->groupBy('author_id'); diff --git a/app/Controllers/NewsController.php b/app/Controllers/NewsController.php index bd903f071..c0cbf887e 100644 --- a/app/Controllers/NewsController.php +++ b/app/Controllers/NewsController.php @@ -102,9 +102,9 @@ public function comments(int $id, Request $request, Validator $validator): strin $user = User::query()->where('id', getUser('id')); $user->update([ - 'allcomments' => DB::raw('allcomments + 1'), - 'point' => DB::raw('point + 1'), - 'money' => DB::raw('money + 5'), + 'allcomments' => DB::connection()->raw('allcomments + 1'), + 'point' => DB::connection()->raw('point + 1'), + 'money' => DB::connection()->raw('money + 5'), ]); $news->increment('count_comments'); diff --git a/app/Controllers/PageController.php b/app/Controllers/PageController.php index e0bb54566..75b84c149 100644 --- a/app/Controllers/PageController.php +++ b/app/Controllers/PageController.php @@ -80,7 +80,7 @@ public function smiles(): string $page = paginate(setting('smilelist'), $total); $smiles = Smile::query() - ->orderBy(DB::raw('CHAR_LENGTH(`code`)')) + ->orderBy(DB::connection()->raw('CHAR_LENGTH(`code`)')) ->orderBy('name') ->limit($page->limit) ->offset($page->offset) @@ -127,10 +127,10 @@ public function surprise(): void } $user->update([ - 'point' => DB::raw('point + '.$surprisePoint), - 'money' => DB::raw('money + '.$surpriseMoney), - 'rating' => DB::raw('posrating - negrating + '.$surpriseRating), - 'posrating' => DB::raw('posrating + '.$surpriseRating), + 'point' => DB::connection()->raw('point + '.$surprisePoint), + 'money' => DB::connection()->raw('money + '.$surpriseMoney), + 'rating' => DB::connection()->raw('posrating - negrating + '.$surpriseRating), + 'posrating' => DB::connection()->raw('posrating + '.$surpriseRating), ]); $text = 'Поздравляем с новым '.$currentYear.' годом!'.PHP_EOL.'В качестве сюрприза вы получаете '.PHP_EOL.plural($surprisePoint, setting('scorename')).PHP_EOL.plural($surpriseMoney, setting('moneyname')).PHP_EOL.$surpriseRating.' рейтинга репутации'.PHP_EOL.'Ура!!!'; diff --git a/app/Controllers/PhotoController.php b/app/Controllers/PhotoController.php index 576fe0dfd..6f22d56b0 100644 --- a/app/Controllers/PhotoController.php +++ b/app/Controllers/PhotoController.php @@ -218,9 +218,9 @@ public function comments(int $id, Request $request, Validator $validator): strin $user = User::query()->where('id', getUser('id')); $user->update([ - 'allcomments' => DB::raw('allcomments + 1'), - 'point' => DB::raw('point + 1'), - 'money' => DB::raw('money + 5'), + 'allcomments' => DB::connection()->raw('allcomments + 1'), + 'point' => DB::connection()->raw('point + 1'), + 'money' => DB::connection()->raw('money + 5'), ]); $photo->increment('count_comments'); diff --git a/app/Controllers/RatingController.php b/app/Controllers/RatingController.php index 5826a9170..a6907d21b 100644 --- a/app/Controllers/RatingController.php +++ b/app/Controllers/RatingController.php @@ -86,8 +86,8 @@ public function index(string $login, Request $request, Validator $validator): st $text = 'Пользователь @' . getUser('login') . ' поставил вам плюс! (Ваш рейтинг: ' . ($user['rating'] + 1) . ')' . PHP_EOL . 'Комментарий: ' . $text; $user->update([ - 'rating' => DB::raw('posrating - negrating + 1'), - 'posrating' => DB::raw('posrating + 1'), + 'rating' => DB::connection()->raw('posrating - negrating + 1'), + 'posrating' => DB::connection()->raw('posrating + 1'), ]); } else { @@ -95,8 +95,8 @@ public function index(string $login, Request $request, Validator $validator): st $text = 'Пользователь @' . getUser('login') . ' поставил вам минус! (Ваш рейтинг: ' . ($user['rating'] - 1) . ')' . PHP_EOL . 'Комментарий: ' . $text; $user->update([ - 'rating' => DB::raw('posrating - negrating - 1'), - 'negrating' => DB::raw('negrating + 1'), + 'rating' => DB::connection()->raw('posrating - negrating - 1'), + 'negrating' => DB::connection()->raw('negrating + 1'), ]); } diff --git a/app/Controllers/TransferController.php b/app/Controllers/TransferController.php index f87b35995..a232265f4 100644 --- a/app/Controllers/TransferController.php +++ b/app/Controllers/TransferController.php @@ -23,6 +23,7 @@ public function __construct() if (! getUser()) { abort(403, 'Для совершения операций необходимо авторизоваться'); } + $request = Request::createFromGlobals(); $login = check($request->input('user')); $this->user = User::query()->where('login', $login)->first(); @@ -67,7 +68,7 @@ public function send(Request $request, Validator $validator): void if ($validator->isValid()) { - DB::transaction(function () use ($money, $msg) { + DB::connection()->transaction(function () use ($money, $msg) { getUser()->decrement('money', $money); $this->user->increment('money', $money); diff --git a/app/Controllers/User/UserController.php b/app/Controllers/User/UserController.php index 2503bac2f..417d6ae6c 100644 --- a/app/Controllers/User/UserController.php +++ b/app/Controllers/User/UserController.php @@ -669,7 +669,7 @@ public function editStatus(Request $request, Validator $validator): void $user->update([ 'status' => $status, - 'money' => DB::raw('money - '.$cost), + 'money' => DB::connection()->raw('money - '.$cost), ]); $user->saveStatus(); diff --git a/app/Controllers/WallController.php b/app/Controllers/WallController.php index f6dcceb20..5e3c7a905 100644 --- a/app/Controllers/WallController.php +++ b/app/Controllers/WallController.php @@ -95,7 +95,7 @@ public function create($login, Request $request, Validator $validator): void 'created_at' => SITETIME, ]); - DB::delete(' + DB::connection()->delete(' DELETE FROM walls WHERE user_id = ? AND created_at < ( SELECT min(created_at) FROM ( SELECT created_at FROM walls WHERE user_id = ? ORDER BY created_at DESC LIMIT ? diff --git a/app/Models/Antimat.php b/app/Models/Antimat.php index c7ef09111..6f552ffaf 100644 --- a/app/Models/Antimat.php +++ b/app/Models/Antimat.php @@ -42,7 +42,7 @@ class Antimat extends BaseModel public static function replace($str): string { $words = self::query() - ->orderBy(DB::raw('CHAR_LENGTH(string)'), 'desc') + ->orderBy(DB::connection()->raw('CHAR_LENGTH(string)'), 'desc') ->pluck('string') ->all(); diff --git a/app/Models/Message.php b/app/Models/Message.php index ea4d5cef9..59b8142ac 100644 --- a/app/Models/Message.php +++ b/app/Models/Message.php @@ -12,6 +12,7 @@ * @property int author_id * @property string text * @property string type + * @property int reading * @property int created_at */ class Message extends BaseModel diff --git a/app/Models/User.php b/app/Models/User.php index d81da3342..80749f934 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -266,7 +266,7 @@ public static function auth($login, $password, $remember = true) } $user->update([ - 'visits' => DB::raw('visits + 1'), + 'visits' => DB::connection()->raw('visits + 1'), 'updated_at' => SITETIME ]); diff --git a/app/helpers.php b/app/helpers.php index ae210bd74..b426becb5 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -1248,39 +1248,39 @@ function restatement($mode) { switch ($mode) { case 'forums': - DB::update('update topics set count_posts = (select count(*) from posts where topics.id = posts.topic_id)'); - DB::update('update forums set count_topics = (select count(*) from topics where forums.id = topics.forum_id)'); - DB::update('update forums set count_posts = (select ifnull(sum(count_posts), 0) from topics where forums.id = topics.forum_id)'); + DB::connection()->update('update topics set count_posts = (select count(*) from posts where topics.id = posts.topic_id)'); + DB::connection()->update('update forums set count_topics = (select count(*) from topics where forums.id = topics.forum_id)'); + DB::connection()->update('update forums set count_posts = (select ifnull(sum(count_posts), 0) from topics where forums.id = topics.forum_id)'); break; case 'blogs': - DB::update('update categories set count_blogs = (select count(*) from blogs where categories.id = blogs.category_id)'); - DB::update('update blogs set count_comments = (select count(*) from comments where relate_type = "' . addslashes(Blog::class) . '" and blogs.id = comments.relate_id)'); + DB::connection()->update('update categories set count_blogs = (select count(*) from blogs where categories.id = blogs.category_id)'); + DB::connection()->update('update blogs set count_comments = (select count(*) from comments where relate_type = "' . addslashes(Blog::class) . '" and blogs.id = comments.relate_id)'); break; case 'loads': - DB::update('update loads set count_downs = (select count(*) from downs where loads.id = downs.category_id and active = ?)', [1]); - DB::update('update downs set count_comments = (select count(*) from comments where relate_type = "' . addslashes(Down::class) . '" and downs.id = comments.relate_id)'); + DB::connection()->update('update loads set count_downs = (select count(*) from downs where loads.id = downs.category_id and active = ?)', [1]); + DB::connection()->update('update downs set count_comments = (select count(*) from comments where relate_type = "' . addslashes(Down::class) . '" and downs.id = comments.relate_id)'); break; case 'news': - DB::update('update news set count_comments = (select count(*) from comments where relate_type = "' . addslashes(News::class) . '" and news.id = comments.relate_id)'); + DB::connection()->update('update news set count_comments = (select count(*) from comments where relate_type = "' . addslashes(News::class) . '" and news.id = comments.relate_id)'); break; case 'photos': - DB::update('update photos set count_comments = (select count(*) from comments where relate_type= "' . addslashes(Photo::class) . '" and photos.id = comments.relate_id)'); + DB::connection()->update('update photos set count_comments = (select count(*) from comments where relate_type= "' . addslashes(Photo::class) . '" and photos.id = comments.relate_id)'); break; case 'offers': - DB::update('update offers set count_comments = (select count(*) from comments where relate_type= "' . addslashes(Offer::class) . '" and offers.id = comments.relate_id)'); + DB::connection()->update('update offers set count_comments = (select count(*) from comments where relate_type= "' . addslashes(Offer::class) . '" and offers.id = comments.relate_id)'); break; case 'boards': - DB::update('update boards set count_items = (select count(*) from items where boards.id = items.board_id and items.expires_at > ' . SITETIME . ');'); + DB::connection()->update('update boards set count_items = (select count(*) from items where boards.id = items.board_id and items.expires_at > ' . SITETIME . ');'); break; case 'votes': - DB::update('update votes set count = (select ifnull(sum(result), 0) from voteanswer where votes.id = voteanswer.vote_id)'); + DB::connection()->update('update votes set count = (select ifnull(sum(result), 0) from voteanswer where votes.id = voteanswer.vote_id)'); break; } } @@ -2191,7 +2191,7 @@ function trans_choice($id, $number, array $replace = [], $locale = null) */ function getQueryLog() { - $queries = DB::getQueryLog(); + $queries = DB::connection()->getQueryLog(); $formattedQueries = []; foreach ($queries as $query) { $prep = $query['query']; diff --git a/composer.json b/composer.json index c3a47c69e..f25d384dd 100644 --- a/composer.json +++ b/composer.json @@ -39,9 +39,11 @@ "require-dev": { "filp/whoops": "^2.2", "phpunit/phpunit": "^7.3", + "phpstan/phpstan": "^0.10.5", "php-coveralls/php-coveralls": "^2.1" }, "scripts": { + "phpstan": "phpstan analyse app --autoload-file=app/bootstrap.php --level=1 --no-progress -vvv", "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], diff --git a/composer.lock b/composer.lock index 5e92d79b7..dc7799a00 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": "9b896f6b43fe6f181c0da3ec529f7974", + "content-hash": "39ae174b532881814f808e5dba081d89", "packages": [ { "name": "alchemy/binary-driver", @@ -3332,6 +3332,50 @@ } ], "packages-dev": [ + { + "name": "composer/xdebug-handler", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "b8e9745fb9b06ea6664d8872c4505fb16df4611c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/b8e9745fb9b06ea6664d8872c4505fb16df4611c", + "reference": "b8e9745fb9b06ea6664d8872c4505fb16df4611c", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0", + "psr/log": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "time": "2018-08-31T19:07:57+00:00" + }, { "name": "doctrine/instantiator", "version": "1.1.0", @@ -3563,6 +3607,57 @@ ], "time": "2016-12-20T10:07:11+00:00" }, + { + "name": "jean85/pretty-package-versions", + "version": "1.2", + "source": { + "type": "git", + "url": "https://github.com/Jean85/pretty-package-versions.git", + "reference": "75c7effcf3f77501d0e0caa75111aff4daa0dd48" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/75c7effcf3f77501d0e0caa75111aff4daa0dd48", + "reference": "75c7effcf3f77501d0e0caa75111aff4daa0dd48", + "shasum": "" + }, + "require": { + "ocramius/package-versions": "^1.2.0", + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Jean85\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alessandro Lai", + "email": "alessandro.lai85@gmail.com" + } + ], + "description": "A wrapper for ocramius/package-versions to get pretty versions strings", + "keywords": [ + "composer", + "package", + "release", + "versions" + ], + "time": "2018-06-13T13:22:40+00:00" + }, { "name": "myclabs/deep-copy", "version": "1.8.1", @@ -3611,6 +3706,532 @@ ], "time": "2018-06-11T23:09:50+00:00" }, + { + "name": "nette/bootstrap", + "version": "v2.4.6", + "source": { + "type": "git", + "url": "https://github.com/nette/bootstrap.git", + "reference": "268816e3f1bb7426c3a4ceec2bd38a036b532543" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/bootstrap/zipball/268816e3f1bb7426c3a4ceec2bd38a036b532543", + "reference": "268816e3f1bb7426c3a4ceec2bd38a036b532543", + "shasum": "" + }, + "require": { + "nette/di": "~2.4.7", + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "latte/latte": "~2.2", + "nette/application": "~2.3", + "nette/caching": "~2.3", + "nette/database": "~2.3", + "nette/forms": "~2.3", + "nette/http": "~2.4.0", + "nette/mail": "~2.3", + "nette/robot-loader": "^2.4.2 || ^3.0", + "nette/safe-stream": "~2.2", + "nette/security": "~2.3", + "nette/tester": "~2.0", + "tracy/tracy": "^2.4.1" + }, + "suggest": { + "nette/robot-loader": "to use Configurator::createRobotLoader()", + "tracy/tracy": "to use Configurator::enableTracy()" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🅱 Nette Bootstrap: the simple way to configure and bootstrap your Nette application.", + "homepage": "https://nette.org", + "keywords": [ + "bootstrapping", + "configurator", + "nette" + ], + "time": "2018-05-17T12:52:20+00:00" + }, + { + "name": "nette/di", + "version": "v2.4.14", + "source": { + "type": "git", + "url": "https://github.com/nette/di.git", + "reference": "923da3e2c0aa53162ef455472c0ac7787b096c5a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/di/zipball/923da3e2c0aa53162ef455472c0ac7787b096c5a", + "reference": "923da3e2c0aa53162ef455472c0ac7787b096c5a", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "nette/neon": "^2.3.3 || ~3.0.0", + "nette/php-generator": "^2.6.1 || ~3.0.0", + "nette/utils": "^2.4.3 || ~3.0.0", + "php": ">=5.6.0" + }, + "conflict": { + "nette/bootstrap": "<2.4", + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "💎 Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new PHP 7.1 features.", + "homepage": "https://nette.org", + "keywords": [ + "compiled", + "di", + "dic", + "factory", + "ioc", + "nette", + "static" + ], + "time": "2018-09-17T15:47:40+00:00" + }, + { + "name": "nette/finder", + "version": "v2.4.2", + "source": { + "type": "git", + "url": "https://github.com/nette/finder.git", + "reference": "ee951a656cb8ac622e5dd33474a01fd2470505a0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/finder/zipball/ee951a656cb8ac622e5dd33474a01fd2470505a0", + "reference": "ee951a656cb8ac622e5dd33474a01fd2470505a0", + "shasum": "" + }, + "require": { + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🔍 Nette Finder: find files and directories with an intuitive API.", + "homepage": "https://nette.org", + "keywords": [ + "filesystem", + "glob", + "iterator", + "nette" + ], + "time": "2018-06-28T11:49:23+00:00" + }, + { + "name": "nette/neon", + "version": "v2.4.3", + "source": { + "type": "git", + "url": "https://github.com/nette/neon.git", + "reference": "5e72b1dd3e2d34f0863c5561139a19df6a1ef398" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/neon/zipball/5e72b1dd3e2d34f0863c5561139a19df6a1ef398", + "reference": "5e72b1dd3e2d34f0863c5561139a19df6a1ef398", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "ext-json": "*", + "php": ">=5.6.0" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🍸 Nette NEON: encodes and decodes NEON file format.", + "homepage": "http://ne-on.org", + "keywords": [ + "export", + "import", + "neon", + "nette", + "yaml" + ], + "time": "2018-03-21T12:12:21+00:00" + }, + { + "name": "nette/php-generator", + "version": "v3.0.5", + "source": { + "type": "git", + "url": "https://github.com/nette/php-generator.git", + "reference": "ea90209c2e8a7cd087b2742ca553c047a8df5eff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/php-generator/zipball/ea90209c2e8a7cd087b2742ca553c047a8df5eff", + "reference": "ea90209c2e8a7cd087b2742ca553c047a8df5eff", + "shasum": "" + }, + "require": { + "nette/utils": "^2.4.2 || ~3.0.0", + "php": ">=7.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 7.2 features.", + "homepage": "https://nette.org", + "keywords": [ + "code", + "nette", + "php", + "scaffolding" + ], + "time": "2018-08-09T14:32:27+00:00" + }, + { + "name": "nette/robot-loader", + "version": "v3.1.0", + "source": { + "type": "git", + "url": "https://github.com/nette/robot-loader.git", + "reference": "fc76c70e740b10f091e502b2e393d0be912f38d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/robot-loader/zipball/fc76c70e740b10f091e502b2e393d0be912f38d4", + "reference": "fc76c70e740b10f091e502b2e393d0be912f38d4", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "nette/finder": "^2.3 || ^3.0", + "nette/utils": "^2.4 || ^3.0", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🍀 Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.", + "homepage": "https://nette.org", + "keywords": [ + "autoload", + "class", + "interface", + "nette", + "trait" + ], + "time": "2018-08-13T14:19:06+00:00" + }, + { + "name": "nette/utils", + "version": "v2.5.3", + "source": { + "type": "git", + "url": "https://github.com/nette/utils.git", + "reference": "17b9f76f2abd0c943adfb556e56f2165460b15ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/utils/zipball/17b9f76f2abd0c943adfb556e56f2165460b15ce", + "reference": "17b9f76f2abd0c943adfb556e56f2165460b15ce", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "suggest": { + "ext-gd": "to use Image", + "ext-iconv": "to use Strings::webalize() and toAscii()", + "ext-intl": "for script transliteration in Strings::webalize() and toAscii()", + "ext-json": "to use Nette\\Utils\\Json", + "ext-mbstring": "to use Strings::lower() etc...", + "ext-xml": "to use Strings::length() etc. when mbstring is not available" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ], + "files": [ + "src/loader.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", + "homepage": "https://nette.org", + "keywords": [ + "array", + "core", + "datetime", + "images", + "json", + "nette", + "paginator", + "password", + "slugify", + "string", + "unicode", + "utf-8", + "utility", + "validation" + ], + "time": "2018-09-18T10:22:16+00:00" + }, + { + "name": "ocramius/package-versions", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/Ocramius/PackageVersions.git", + "reference": "4489d5002c49d55576fa0ba786f42dbb009be46f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/4489d5002c49d55576fa0ba786f42dbb009be46f", + "reference": "4489d5002c49d55576fa0ba786f42dbb009be46f", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0.0", + "php": "^7.1.0" + }, + "require-dev": { + "composer/composer": "^1.6.3", + "ext-zip": "*", + "infection/infection": "^0.7.1", + "phpunit/phpunit": "^7.0.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "time": "2018-02-05T13:05:30+00:00" + }, { "name": "phar-io/manifest", "version": "1.0.3", @@ -4011,6 +4632,121 @@ ], "time": "2018-08-05T17:53:17+00:00" }, + { + "name": "phpstan/phpdoc-parser", + "version": "0.3", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "ed3223362174b8067729930439e139794e9e514a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/ed3223362174b8067729930439e139794e9e514a", + "reference": "ed3223362174b8067729930439e139794e9e514a", + "shasum": "" + }, + "require": { + "php": "~7.1" + }, + "require-dev": { + "consistence/coding-standard": "^2.0.0", + "jakub-onderka/php-parallel-lint": "^0.9.2", + "phing/phing": "^2.16.0", + "phpstan/phpstan": "^0.10@dev", + "phpunit/phpunit": "^6.3", + "slevomat/coding-standard": "^3.3.0", + "symfony/process": "^3.4 || ^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.3-dev" + } + }, + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "time": "2018-06-20T17:48:01+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "0.10.5", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "c6a8cd1fe08a23b9d101a55ffa9ff6b91d71ef5d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c6a8cd1fe08a23b9d101a55ffa9ff6b91d71ef5d", + "reference": "c6a8cd1fe08a23b9d101a55ffa9ff6b91d71ef5d", + "shasum": "" + }, + "require": { + "composer/xdebug-handler": "^1.3.0", + "jean85/pretty-package-versions": "^1.0.3", + "nette/bootstrap": "^2.4 || ^3.0", + "nette/di": "^2.4.7 || ^3.0", + "nette/robot-loader": "^3.0.1", + "nette/utils": "^2.4.5 || ^3.0", + "nikic/php-parser": "^4.0.2", + "php": "~7.1", + "phpstan/phpdoc-parser": "^0.3", + "symfony/console": "~3.2 || ~4.0", + "symfony/finder": "~3.2 || ~4.0" + }, + "require-dev": { + "brianium/paratest": "^2.0", + "consistence/coding-standard": "^3.5", + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", + "ext-gd": "*", + "ext-intl": "*", + "ext-mysqli": "*", + "ext-zip": "*", + "jakub-onderka/php-parallel-lint": "^1.0", + "localheinz/composer-normalize": "~0.9.0", + "phing/phing": "^2.16.0", + "phpstan/phpstan-deprecation-rules": "^0.10.2", + "phpstan/phpstan-php-parser": "^0.10", + "phpstan/phpstan-phpunit": "^0.10", + "phpstan/phpstan-strict-rules": "^0.10", + "phpunit/phpunit": "^7.0", + "slevomat/coding-standard": "^4.7.2" + }, + "bin": [ + "bin/phpstan" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.10-dev" + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": [ + "src/", + "build/PHPStan" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "time": "2018-10-20T17:24:55+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "6.1.4", From bbe64d4093a979f36cae188b9c6399a05b5a9323 Mon Sep 17 00:00:00 2001 From: visavi Date: Fri, 16 Nov 2018 16:40:09 +0300 Subject: [PATCH 102/163] =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=20phpstan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/Admin/DeliveryController.php | 1 + app/Controllers/Admin/LoadController.php | 4 +- app/Controllers/Load/DownController.php | 56 +++++++++----------- app/Controllers/User/UserController.php | 5 +- app/Models/Flood.php | 2 +- app/bootstrap.php | 2 +- resources/views/app/_performance.blade.php | 2 +- 7 files changed, 34 insertions(+), 38 deletions(-) diff --git a/app/Controllers/Admin/DeliveryController.php b/app/Controllers/Admin/DeliveryController.php index eaf0fdd43..de60d48c7 100644 --- a/app/Controllers/Admin/DeliveryController.php +++ b/app/Controllers/Admin/DeliveryController.php @@ -35,6 +35,7 @@ public function index(Request $request, Validator $validator): string $token = check($request->input('token')); $msg = check($request->input('msg')); $type = int($request->input('type')); + $users = collect(); $validator->equal($token, $_SESSION['token'], ['msg' => 'Неверный идентификатор сессии, повторите действие!']) ->length($msg, 5, 1000, ['msg' => 'Слишком длинный или короткий текст комментария!']) diff --git a/app/Controllers/Admin/LoadController.php b/app/Controllers/Admin/LoadController.php index 6944a9040..90c1f1a31 100644 --- a/app/Controllers/Admin/LoadController.php +++ b/app/Controllers/Admin/LoadController.php @@ -56,7 +56,7 @@ public function create(Request $request, Validator $validator): void $name = check($request->input('name')); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') - ->length($name, 5, 50, ['title' => 'Слишком длинное или короткое название раздела!']); + ->length($name, 3, 50, ['title' => 'Слишком длинное или короткое название раздела!']); if ($validator->isValid()) { @@ -112,7 +112,7 @@ public function edit(int $id, Request $request, Validator $validator): string $closed = empty($request->input('closed')) ? 0 : 1; $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') - ->length($name, 5, 50, ['title' => 'Слишком длинное или короткое название раздела!']) + ->length($name, 3, 50, ['title' => 'Слишком длинное или короткое название раздела!']) ->notEqual($parent, $load->id, ['parent' => 'Недопустимый выбор родительского раздела!']); if (! empty($parent) && $load->children->isNotEmpty()) { diff --git a/app/Controllers/Load/DownController.php b/app/Controllers/Load/DownController.php index b813fcd91..1a0171be2 100644 --- a/app/Controllers/Load/DownController.php +++ b/app/Controllers/Load/DownController.php @@ -571,17 +571,18 @@ public function zip(int $id): string try { $archive = new ZipFile(); $archive->openFile(HOME . $file->hash); + + $down = $file->relate; + $page = paginate(setting('ziplist'), $archive->count()); + $getDocuments = array_values($archive->getAllInfo()); + + $viewExt = Down::getViewExt(); + $documents = \array_slice($getDocuments, $page->offset, $page->limit, true); + } catch (Exception $e) { abort('default', 'Не удалось открыть архив!'); } - $down = $file->relate; - $page = paginate(setting('ziplist'), $archive->count()); - $getDocuments = array_values($archive->getAllInfo()); - - $viewExt = Down::getViewExt(); - $documents = \array_slice($getDocuments, $page->offset, $page->limit, true); - return view('loads/zip', compact('down', 'file', 'documents', 'page', 'viewExt')); } @@ -612,38 +613,31 @@ public function zipView(int $id, int $fid): string try { $archive = new ZipFile(); $archive->openFile(HOME . $file->hash); - } catch (Exception $e) { - abort('default', 'Не удалось открыть архив!'); - } - /** @var ZipFile $archive */ - $getDocuments = array_values($archive->getAllInfo()); - $document = $getDocuments[$fid] ?? null; - if (! $document) { - abort('default', 'Не удалось вывести содержимое файла'); - } + /** @var ZipFile $archive */ + $getDocuments = array_values($archive->getAllInfo()); + $document = $getDocuments[$fid] ?? null; - try { $content = $archive[$document->getName()]; - } catch (Exception $e) { - abort('default', 'Не удалось прочитать файл!'); - } - if ($document->getSize() > 0 && preg_match("/\.(gif|png|bmp|jpg|jpeg)$/", $document->getName())) { + if ($document->getSize() > 0 && preg_match("/\.(gif|png|bmp|jpg|jpeg)$/", $document->getName())) { - $ext = getExtension($document->getName()); + $ext = getExtension($document->getName()); - header('Content-type: image/' . $ext); - header('Content-Length: ' . \strlen($content)); - header('Content-Disposition: inline; filename="' . $document->getName() . '";'); - exit($content); - } + header('Content-type: image/' . $ext); + header('Content-Length: ' . \strlen($content)); + header('Content-Disposition: inline; filename="' . $document->getName() . '";'); + exit($content); + } - if (! isUtf($content)) { - $content = winToUtf($content); - } + if (! isUtf($content)) { + $content = winToUtf($content); + } - $down = $file->relate; + $down = $file->relate; + } catch (Exception $e) { + abort('default', 'Не удалось прочитать файл!'); + } return view('loads/zip_view', compact('down', 'file', 'document', 'content')); } diff --git a/app/Controllers/User/UserController.php b/app/Controllers/User/UserController.php index 417d6ae6c..e4a019b4a 100644 --- a/app/Controllers/User/UserController.php +++ b/app/Controllers/User/UserController.php @@ -109,8 +109,9 @@ public function register(Request $request, Validator $validator): string $email = strtolower(check($request->input('email'))); $domain = utfSubstr(strrchr($email, '@'), 1); $gender = $request->input('gender') === 'male' ? 'male' : 'female'; - $activateKey = null; $level = User::USER; + $activateKey = null; + $invitation = null; $validator->true(captchaVerify(), ['protect' => 'Не удалось пройти проверку captcha!']) ->regex($login, '|^[a-z0-9\-]+$|i', ['login' => 'Недопустимые символы в логине. Разрешены знаки латинского алфавита, цифры и дефис!']) @@ -198,7 +199,7 @@ public function register(Request $request, Validator $validator): string ]); // Активация пригласительного ключа - if (setting('invite')) { + if ($invitation && setting('invite')) { $invitation->update([ 'used' => 1, 'invite_user_id' => $user->id, diff --git a/app/Models/Flood.php b/app/Models/Flood.php index 27450d395..c205ad1ac 100644 --- a/app/Models/Flood.php +++ b/app/Models/Flood.php @@ -77,7 +77,7 @@ public static function isFlood($period = 0): bool ->first(); if (! $flood) { - self::create([ + self::query()->create([ 'user_id' => $userId, 'page' => server('PHP_SELF'), 'created_at' => SITETIME + $period, diff --git a/app/bootstrap.php b/app/bootstrap.php index 5a5c1ce8e..e5f03d998 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -6,7 +6,7 @@ use Whoops\Handler\PrettyPageHandler; use Whoops\Run; -define('STARTTIME', microtime(1)); +define('STARTTIME', microtime(true)); define('BASEDIR', dirname(__DIR__)); define('APP', BASEDIR . '/app'); define('HOME', BASEDIR . '/public'); diff --git a/resources/views/app/_performance.blade.php b/resources/views/app/_performance.blade.php index 926ed0bea..312875363 100644 --- a/resources/views/app/_performance.blade.php +++ b/resources/views/app/_performance.blade.php @@ -7,7 +7,7 @@
  • {{ round($cpu[0], 2) }}
  • -
  • {{ round(microtime(1) - STARTTIME, 4) }} сек.
  • +
  • {{ round(microtime(true) - STARTTIME, 4) }} сек.
  • @if (env('APP_DEBUG')) From 896c3897495e139aa7fd1a3149cbadd6a7de7db0 Mon Sep 17 00:00:00 2001 From: visavi Date: Fri, 16 Nov 2018 18:18:49 +0300 Subject: [PATCH 103/163] =?UTF-8?q?=D0=92=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83?= =?UTF-8?q?=D0=B7=D0=BA=D0=B0=D1=85=20=D1=84=D0=B0=D0=B9=D0=BB=20=D1=81?= =?UTF-8?q?=D0=BA=D0=B0=D1=87=D0=B8=D0=B2=D0=B0=D0=B5=D1=82=D1=81=D1=8F=20?= =?UTF-8?q?=D1=81=20=D1=80=D0=B5=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B=D0=BC=20?= =?UTF-8?q?=D0=B8=D0=BC=D0=B5=D0=BD=D0=B5=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/Load/DownController.php | 6 ++---- app/Models/File.php | 16 ++++++++++++++++ composer.json | 3 ++- phpstan.neon | 9 +++++++++ resources/views/forums/topic.blade.php | 2 +- 5 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 phpstan.neon diff --git a/app/Controllers/Load/DownController.php b/app/Controllers/Load/DownController.php index 1a0171be2..a7312419e 100644 --- a/app/Controllers/Load/DownController.php +++ b/app/Controllers/Load/DownController.php @@ -350,11 +350,9 @@ public function download(int $id, Validator $validator): void abort('default', 'Данный файл еще не проверен модератором!'); } - $validator - ->true(file_exists(HOME . $file->hash), 'Файла для скачивания не существует!'); + $validator->true(file_exists(HOME . $file->hash), 'Файла для скачивания не существует!'); if ($validator->isValid()) { - $reader = Reader::query() ->where('relate_type', Down::class) ->where('relate_id', $file->relate->id) @@ -372,7 +370,7 @@ public function download(int $id, Validator $validator): void $file->relate->increment('loads'); } - redirect($file->hash); + $file->download(); } else { setFlash('danger', $validator->getErrors()); redirect('/downs/' . $file->relate->id); diff --git a/app/Models/File.php b/app/Models/File.php index ba67acf32..f2b80c4ef 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -16,6 +16,7 @@ * @property int user_id * @property int created_at * @property string extension + * @property object relate */ class File extends BaseModel { @@ -62,4 +63,19 @@ public function isImage(): string { return \in_array($this->extension, ['jpg', 'jpeg', 'gif', 'png']); } + + /** + * Скачивает файл + * + * @return void + */ + public function download(): void + { + header('Content-Type: application/octet-stream'); + header('Content-Disposition: attachment; filename="' . $this->name . '"'); + header('Content-Transfer-Encoding: binary'); + header('Content-Length: ' . $this->size); + readfile(HOME . $this->hash); + exit; + } } diff --git a/composer.json b/composer.json index f25d384dd..adf23b76b 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,7 @@ "ext-gd": "*", "ext-json": "*", "ext-mbstring": "*", + "ext-fileinfo": "*", "cbschuld/browser.php": "dev-master", "gregwar/captcha": "^1.1", "google/recaptcha": "~1.2", @@ -43,7 +44,7 @@ "php-coveralls/php-coveralls": "^2.1" }, "scripts": { - "phpstan": "phpstan analyse app --autoload-file=app/bootstrap.php --level=1 --no-progress -vvv", + "phpstan": "phpstan analyse --no-progress -vvv", "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 000000000..21e3feee3 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,9 @@ +parameters: + level: 1 + universalObjectCratesClasses: + - Illuminate\Database\Eloquent\Model + - Illuminate\Http\Request + paths: + - app + bootstrap: app/bootstrap.php + reportUnmatchedIgnoredErrors: false diff --git a/resources/views/forums/topic.blade.php b/resources/views/forums/topic.blade.php index 341289c07..386580dbd 100644 --- a/resources/views/forums/topic.blade.php +++ b/resources/views/forums/topic.blade.php @@ -26,7 +26,7 @@ Печать / RSS-лента @if (getUser()) - @if ($topic->user->id == getUser('id') && empty($topic->closed) && getUser('point') >= setting('editforumpoint')) + @if (! $topic->closed && $topic->user->id === getUser('id') && getUser('point') >= setting('editforumpoint')) / Закрыть / Изменить @endif From 56b6507b47dff9c156a68266f72985f2fca648c8 Mon Sep 17 00:00:00 2001 From: visavi Date: Fri, 16 Nov 2018 18:44:06 +0300 Subject: [PATCH 104/163] =?UTF-8?q?=D0=B2=20=D1=81=D0=BF=D0=B8=D1=81=D0=BE?= =?UTF-8?q?=D0=BA=20=D0=B1=D0=BB=D0=BE=D0=B3=D0=BE=D0=B2=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20=D0=BA=D0=BE=D1=80=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B8=D0=B9=20=D1=82=D0=B5=D0=BA=D1=81=D1=82=20?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D1=82=D1=8C=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/admin/blogs/blog.blade.php | 18 +++++++++--------- resources/views/blogs/blog.blade.php | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/resources/views/admin/blogs/blog.blade.php b/resources/views/admin/blogs/blog.blade.php index ef198f732..231073bef 100644 --- a/resources/views/admin/blogs/blog.blade.php +++ b/resources/views/admin/blogs/blog.blade.php @@ -5,15 +5,6 @@ @stop @section('content') - - @if (getUser() && ! $category->closed) -
    - @endif - -

    {{ $category->name }} (Статей: {{ $category->count_blogs }})

    - + @if (! $category->closed && getUser()) +
    + @endif + +

    {{ $category->name }} (Статей: {{ $category->count_blogs }})

    + @if ($blogs->isNotEmpty()) @foreach ($blogs as $data)
    @@ -46,6 +45,7 @@
    + {!! stripString(bbCode($data->text), 50) !!}
    Автор: {!! $data->user->getProfile() !!} ({{ dateFixed($data->created_at) }})
    Просмотров: {{ $data->visits }}
    Комментарии ({{ $data->count_comments }}) diff --git a/resources/views/blogs/blog.blade.php b/resources/views/blogs/blog.blade.php index 9f5ef1548..1598f0e0e 100644 --- a/resources/views/blogs/blog.blade.php +++ b/resources/views/blogs/blog.blade.php @@ -5,15 +5,6 @@ @stop @section('content') - - @if (getUser() && ! $category->closed) -
    - @endif - -

    {{ $category->name }} (Статей: {{ $category->count_blogs }})

    - + @if (! $category->closed && getUser()) +
    + @endif + +

    {{ $category->name }} (Статей: {{ $category->count_blogs }})

    + @if ($blogs->isNotEmpty()) @foreach ($blogs as $data)
    @@ -38,6 +37,7 @@ {{ $data->title }} ({!! formatNum($data->rating) !!})
    + {!! stripString(bbCode($data->text), 50) !!}
    Автор: {!! $data->user->getProfile() !!} ({{ dateFixed($data->created_at) }})
    Просмотров: {{ $data->visits }}
    Комментарии ({{ $data->count_comments }}) From e3af8fb8c173f3b569a8224c3120e1b4cbdcd252 Mon Sep 17 00:00:00 2001 From: visavi Date: Sun, 18 Nov 2018 00:02:53 +0300 Subject: [PATCH 105/163] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BF=D1=80=D0=B8=20=D0=B7=D0=B0=D0=BA=D1=80?= =?UTF-8?q?=D1=8B=D1=82=D0=B8=D0=B8=20=D1=82=D0=B5=D0=BC=D1=8B=20=D0=B2=20?= =?UTF-8?q?=D1=84=D0=BE=D1=80=D1=83=D0=BC=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/forums/topic.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/forums/topic.blade.php b/resources/views/forums/topic.blade.php index 386580dbd..b27fd91ee 100644 --- a/resources/views/forums/topic.blade.php +++ b/resources/views/forums/topic.blade.php @@ -27,7 +27,7 @@ @if (getUser()) @if (! $topic->closed && $topic->user->id === getUser('id') && getUser('point') >= setting('editforumpoint')) - / Закрыть + / Закрыть / Изменить @endif From 93569194f597812f2a9f7d11d3fc7b12ac7fb14f Mon Sep 17 00:00:00 2001 From: visavi Date: Wed, 21 Nov 2018 01:35:48 +0300 Subject: [PATCH 106/163] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=8C=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B3=D0=BE=D0=BB=D0=BE=D1=81=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B2=20=D1=82=D0=B5=D0=BC=D0=B5=20?= =?UTF-8?q?=D1=84=D0=BE=D1=80=D1=83=D0=BC=D0=B0=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=B0=D0=B2=D1=82=D0=BE=D1=80=D0=B0,=20=D0=B8=D1=81=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=BE=D1=88=D0=B8?= =?UTF-8?q?=D0=B1=D0=BA=D0=B0=20=D0=BF=D1=80=D0=B8=20=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B0=D0=BA=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=B3=D0=BE=D0=BB=D0=BE=D1=81=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/Admin/VoteController.php | 24 +++++--- app/Controllers/Forum/ForumController.php | 6 +- app/Controllers/Forum/TopicController.php | 60 +++++++++++++++++-- app/Models/VoteAnswer.php | 2 +- app/helpers.php | 2 +- composer.json | 1 - resources/views/admin/votes/edit.blade.php | 6 +- resources/views/forums/active_posts.blade.php | 5 +- .../views/forums/active_topics.blade.php | 5 +- resources/views/forums/bookmarks.blade.php | 4 +- resources/views/forums/forum.blade.php | 17 +++--- resources/views/forums/forum_create.blade.php | 15 +++-- resources/views/forums/index.blade.php | 13 ++-- resources/views/forums/new_posts.blade.php | 4 +- resources/views/forums/new_topics.blade.php | 4 +- resources/views/forums/search.blade.php | 4 +- resources/views/forums/search_posts.blade.php | 5 +- .../views/forums/search_topics.blade.php | 5 +- resources/views/forums/top.blade.php | 5 +- resources/views/forums/top_posts.blade.php | 4 +- resources/views/forums/topic.blade.php | 4 +- resources/views/forums/topic_edit.blade.php | 32 +++++++++- .../views/forums/topic_edit_post.blade.php | 4 +- 23 files changed, 152 insertions(+), 79 deletions(-) diff --git a/app/Controllers/Admin/VoteController.php b/app/Controllers/Admin/VoteController.php index 49b5d6590..a1be0fbd5 100644 --- a/app/Controllers/Admin/VoteController.php +++ b/app/Controllers/Admin/VoteController.php @@ -5,6 +5,7 @@ use App\Classes\Validator; use App\Models\User; use App\Models\Vote; +use App\Models\VoteAnswer; use Illuminate\Database\Capsule\Manager as DB; use Illuminate\Http\Request; @@ -78,10 +79,9 @@ public function edit(int $id, Request $request, Validator $validator): string } if ($request->isMethod('post')) { - $token = check($request->input('token')); $title = check($request->input('title')); - $answers = check($request->input('answers')); + $answers = check((array) $request->input('answers')); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!'); @@ -103,11 +103,18 @@ public function edit(int $id, Request $request, Validator $validator): string 'title' => $title, ]); + $countAnswers = $vote->answers()->count(); + foreach ($answers as $answerId => $answer) { - $vote->answers() - ->updateOrCreate(['id' => $answerId], [ - 'answer' => $answer - ]); + /** @var VoteAnswer $ans */ + $ans = $vote->answers()->firstOrNew(['id' => $answerId]); + + if ($ans->exists) { + $ans->update(['answer' => $answer]); + } else if ($countAnswers < 10) { + $ans->fill(['answer' => $answer])->save(); + $countAnswers++; + } } setFlash('success', 'Голосование успешно изменено!'); @@ -118,9 +125,9 @@ public function edit(int $id, Request $request, Validator $validator): string } } - $getAnswers = $vote->answers->pluck('answer', 'id')->all(); + $vote->getAnswers = $vote->answers->pluck('answer', 'id')->all(); - return view('admin/votes/edit', compact('vote', 'getAnswers')); + return view('admin/votes/edit', compact('vote')); } /** @@ -129,6 +136,7 @@ public function edit(int $id, Request $request, Validator $validator): string * @param int $id * @param Request $request * @return void + * @throws \Throwable */ public function delete(int $id, Request $request): void { diff --git a/app/Controllers/Forum/ForumController.php b/app/Controllers/Forum/ForumController.php index 834c30b3a..57599ff79 100644 --- a/app/Controllers/Forum/ForumController.php +++ b/app/Controllers/Forum/ForumController.php @@ -100,7 +100,7 @@ public function create(Request $request, Validator $validator): string $token = check($request->input('token')); $vote = empty($request->input('vote')) ? 0 : 1; $question = check($request->input('question')); - $answers = check($request->input('answer')); + $answers = check((array) $request->input('answers')); /** @var Forum $forum */ $forum = Forum::query()->find($fid); @@ -121,12 +121,12 @@ public function create(Request $request, Validator $validator): string foreach ($answers as $answer) { if (utfStrlen($answer) > 50) { - $validator->addError(['answer' => 'Длина вариантов ответа не должна быть более 50 символов!']); + $validator->addError(['answers' => 'Длина вариантов ответа не должна быть более 50 символов!']); break; } } - $validator->between(\count($answers), 2, 10, ['answer' => 'Недостаточное количество вариантов ответов!']); + $validator->between(\count($answers), 2, 10, ['answers' => 'Недостаточное количество вариантов ответов!']); } /* TODO: Сделать проверку поиска похожей темы */ diff --git a/app/Controllers/Forum/TopicController.php b/app/Controllers/Forum/TopicController.php index ae25ca080..2feab6f4e 100644 --- a/app/Controllers/Forum/TopicController.php +++ b/app/Controllers/Forum/TopicController.php @@ -358,11 +358,15 @@ public function edit(int $id, Request $request, Validator $validator): string ->orderBy('id') ->first(); - if ($request->isMethod('post')) { + /** @var Vote $vote */ + $vote = Vote::query()->where('topic_id', $id)->first(); - $token = check($request->input('token')); - $title = check($request->input('title')); - $msg = check($request->input('msg')); + if ($request->isMethod('post')) { + $token = check($request->input('token')); + $title = check($request->input('title')); + $msg = check($request->input('msg')); + $question = check($request->input('question')); + $answers = check((array) $request->input('answers')); $validator->equal($token, $_SESSION['token'], 'Неверный идентификатор сессии, повторите действие!') ->length($title, 5, 50, ['title' => 'Слишком длинное или короткое название темы!']); @@ -371,8 +375,26 @@ public function edit(int $id, Request $request, Validator $validator): string $validator->length($msg, 5, setting('forumtextlength'), ['msg' => 'Слишком длинный или короткий текст сообщения!']); } - if ($validator->isValid()) { + if ($vote) { + $validator->length($question, 5, 100, ['question' => 'Слишком длинный или короткий текст вопроса!']); + + if ($answers) { + $validator->empty($vote->count, ['question' => 'Изменение вариантов ответа доступно только до голосований!']); + + $answers = array_unique(array_diff($answers, [''])); + + foreach ($answers as $answer) { + if (utfStrlen($answer) > 50) { + $validator->addError(['answers' => 'Длина вариантов ответа не должна быть более 50 символов!']); + break; + } + } + + $validator->between(\count($answers), 2, 10, ['answers' => 'Недостаточное количество вариантов ответов!']); + } + } + if ($validator->isValid()) { $title = antimat($title); $msg = antimat($msg); @@ -386,6 +408,28 @@ public function edit(int $id, Request $request, Validator $validator): string ]); } + if ($vote) { + $vote->update([ + 'title' => $question, + ]); + + if ($answers) { + $countAnswers = $vote->answers()->count(); + + foreach ($answers as $answerId => $answer) { + /** @var VoteAnswer $ans */ + $ans = $vote->answers()->firstOrNew(['id' => $answerId]); + + if ($ans->exists) { + $ans->update(['answer' => $answer]); + } else if ($countAnswers < 10) { + $ans->fill(['answer' => $answer])->save(); + $countAnswers++; + } + } + } + } + setFlash('success', 'Тема успешно изменена!'); redirect('/topics/' . $topic->id); @@ -395,7 +439,11 @@ public function edit(int $id, Request $request, Validator $validator): string } } - return view('forums/topic_edit', compact('post', 'topic')); + if ($vote) { + $vote->getAnswers = $vote->answers->pluck('answer', 'id')->all(); + } + + return view('forums/topic_edit', compact('post', 'topic', 'vote')); } /** diff --git a/app/Models/VoteAnswer.php b/app/Models/VoteAnswer.php index 72f4dd4c4..7db2d9de4 100644 --- a/app/Models/VoteAnswer.php +++ b/app/Models/VoteAnswer.php @@ -31,6 +31,6 @@ class VoteAnswer extends BaseModel * * @var array */ - protected $guarded = []; + protected $guarded = ['id']; } diff --git a/app/helpers.php b/app/helpers.php index b426becb5..e71bbea77 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -1711,7 +1711,7 @@ function setInput(array $data) * * @param string $name имя поля * @param string $default - * @return string сохраненный текст + * @return mixed сохраненное значение */ function getInput($name, $default = null) { diff --git a/composer.json b/composer.json index adf23b76b..710c8de3b 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,6 @@ "ext-gd": "*", "ext-json": "*", "ext-mbstring": "*", - "ext-fileinfo": "*", "cbschuld/browser.php": "dev-master", "gregwar/captcha": "^1.1", "google/recaptcha": "~1.2", diff --git a/resources/views/admin/votes/edit.blade.php b/resources/views/admin/votes/edit.blade.php index eead88aa3..cedee9da3 100644 --- a/resources/views/admin/votes/edit.blade.php +++ b/resources/views/admin/votes/edit.blade.php @@ -29,12 +29,12 @@
    - - + getAnswers); ?> + @foreach ($answers as $key => $answer)