diff --git a/.php_cs b/.php_cs index 1dc05a1a2..248190fd3 100755 --- a/.php_cs +++ b/.php_cs @@ -16,6 +16,7 @@ $rules = [ 'braces' => true, 'cast_spaces' => true, 'class_definition' => true, + 'concat_space' => ['spacing' => 'one'], 'declare_equal_normalize' => true, 'elseif' => true, 'encoding' => true, @@ -89,15 +90,14 @@ $rules = [ 'switch_case_semicolon_to_colon' => true, 'switch_case_space' => true, 'ternary_operator_spaces' => true, + 'trailing_comma_in_multiline_array' => true, 'trim_array_spaces' => true, 'unary_operator_spaces' => true, 'visibility_required' => true, 'whitespace_after_comma_in_array' => true, 'header_comment' => [ - 'header' => $header, - 'separate' => 'bottom', - 'comment_type' => 'PHPDoc', + 'header' => $header ] ]; diff --git a/.styleci.yml b/.styleci.yml new file mode 100644 index 000000000..e4e90a027 --- /dev/null +++ b/.styleci.yml @@ -0,0 +1,13 @@ +finder: + exclude: + - "tests" + name: "*.php" + not-name: + - "*Stub.php" + - "*Test.php" + +enabled: + - concat_with_spaces + +disabled: + - concat_without_spaces diff --git a/.travis.yml b/.travis.yml index 1c8beab66..5e72d174a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,8 @@ language: php services: - mysql - postgresql + - memcached + - redis-server php: - 5.6 @@ -18,11 +20,12 @@ env: - DB=mysql - DB=sqlite - DB=pgsql + - DB=memory cache: directories: - $HOME/.composer/cache - + before_install: # copy sprinkles.json - cp app/sprinkles.example.json app/sprinkles.json @@ -30,6 +33,9 @@ before_install: - bash build/before_install.sh $DB # update node - nvm install 10.12.0 + # Install Redis and Memcached + - echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + - printf "\n" | pecl install -f redis before_script: # install deps and UF diff --git a/CHANGELOG.md b/CHANGELOG.md index ab4774da2..32e8f904c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,31 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [v4.2.2] + +### Added +- New group factory (`'UserFrosting\Sprinkle\Account\Database\Models\Group'`) +- New `withController` Trait, as an alternative for deprecated `ControllerTestCase` +- StyleCI config +- [Travis] SQLite in-memory DB testing +- [Travis] enabled memcache & Redis service + +### Fixed +- DefaultPermissions seed results in SQL errors ([#981]; [#983]) +- Make group & role schema consistent between creation and edition. Prevents group and role without a name or slug to be created during edition. +- Factories changed to make sure slugs are unique +- Fix `WithTestUser` Trait returning a user with id of zero or reserve master id when a non-master user was asked. If master user already exist, will return it instead of trying to create a new one (with the same id) +- Force close db connection on test `tearDown` procedure + +### Changed +- Recommended PHP version is now 7.2, as 7.1 will be EOL in less than 6 months +- Added tests coverage for all build-in controllers +- Applied styling rules from StyleCI & updated php-cs-fixer rules to match StyleCI config + +### Deprecated +- `ControllerTestCase`. Use `withController` Trait instead. + + ## [v4.2.1] ### Added @@ -731,6 +756,9 @@ See [http://learn.userfrosting.com/upgrading/40-to-41](Upgrading 4.0.x to 4.1.x [#958]: https://github.com/userfrosting/UserFrosting/issues/958 [#963]: https://github.com/userfrosting/UserFrosting/issues/963 [#968]: https://github.com/userfrosting/UserFrosting/issues/968 +[#981]: https://github.com/userfrosting/UserFrosting/issues/981 +[#983]: https://github.com/userfrosting/UserFrosting/issues/983 [v4.2.0]: https://github.com/userfrosting/UserFrosting/compare/v4.1.22...v4.2.0 -[v4.2.1]: https://github.com/userfrosting/UserFrosting/compare/v4.2.0...v4.2.1 +[v4.2.1]: https://github.com/userfrosting/UserFrosting/compare/v4.2.0...v.4.2.1 +[v4.2.2]: https://github.com/userfrosting/UserFrosting/compare/v.4.2.1...v4.2.2 diff --git a/README.md b/README.md index 35d5c7161..efde315bc 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,29 @@ # UserFrosting 4.2 [![Latest Version](https://img.shields.io/github/release/userfrosting/UserFrosting.svg)](https://github.com/userfrosting/UserFrosting/releases) +![PHP Version](https://img.shields.io/packagist/php-v/userfrosting/userfrosting.svg?color=brightgreen) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md) [![Join the chat at https://chat.userfrosting.com/channel/support](https://demo.rocket.chat/images/join-chat.svg)](https://chat.userfrosting.com/channel/support) [![Backers on Open Collective](https://opencollective.com/userfrosting/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/userfrosting/sponsors/badge.svg)](#sponsors) [![Donate](https://img.shields.io/badge/Open%20Collective-Donate-blue.svg)](https://opencollective.com/userfrosting#backer) -| Branch | Status | -| ------ | ------ | -| master | [![Build Status](https://travis-ci.org/userfrosting/UserFrosting.svg?branch=master)](https://travis-ci.org/userfrosting/UserFrosting) [![codecov](https://codecov.io/gh/userfrosting/userfrosting/branch/master/graph/badge.svg)](https://codecov.io/gh/userfrosting/userfrosting/branch/master) | -| develop | [![Build Status](https://travis-ci.org/userfrosting/UserFrosting.svg?branch=develop)](https://travis-ci.org/userfrosting/UserFrosting) [![codecov](https://codecov.io/gh/userfrosting/userfrosting/branch/develop/graph/badge.svg)](https://codecov.io/gh/userfrosting/userfrosting/branch/develop) | +| Branch | Version | Build | Coverage | Style | +| ------ |:-------:|:-----:|:--------:|:-----:| +| [master] | ![](https://img.shields.io/github/release/userfrosting/userfrosting.svg?color=success&label=Version) | [![](https://travis-ci.org/userfrosting/UserFrosting.svg?branch=master)][UF-Travis] | [![](https://codecov.io/gh/userfrosting/userfrosting/branch/master/graph/badge.svg)][UF-Codecov] | [![][style-master]][style] | +| [hotfix] | ![](https://img.shields.io/badge/Version-v4.2.x-yellow.svg) | [![](https://travis-ci.org/userfrosting/UserFrosting.svg?branch=hotfix)][UF-Travis] | [![](https://codecov.io/gh/userfrosting/userfrosting/branch/hotfix/graph/badge.svg)][UF-Codecov] | [![][style-hotfix]][style] | +| [develop] | ![](https://img.shields.io/badge/Version-v4.3.x-orange.svg) | [![](https://travis-ci.org/userfrosting/UserFrosting.svg?branch=develop)][UF-Travis] | [![](https://codecov.io/gh/userfrosting/userfrosting/branch/develop/graph/badge.svg)][UF-Codecov] | [![][style-develop]][style] | + + +[master]: https://github.com/userfrosting/UserFrosting +[hotfix]: https://github.com/userfrosting/UserFrosting/tree/hotfix +[develop]: https://github.com/userfrosting/UserFrosting/tree/develop +[UF-Travis]: https://travis-ci.org/userfrosting/UserFrosting +[UF-Codecov]: https://codecov.io/gh/userfrosting/userfrosting +[style-master]: https://github.styleci.io/repos/18148206/shield?branch=master&style=flat +[style-hotfix]: https://github.styleci.io/repos/18148206/shield?branch=hotfix&style=flat +[style-develop]: https://github.styleci.io/repos/18148206/shield?branch=develop&style=flat +[style]: https://github.styleci.io/repos/18148206 [https://www.userfrosting.com](https://www.userfrosting.com) diff --git a/app/defines.php b/app/defines.php index 522296035..eb94fa14c 100755 --- a/app/defines.php +++ b/app/defines.php @@ -1,5 +1,6 @@ [ - 'auth' => true + 'auth' => true, ], ]; diff --git a/app/sprinkles/account/config/default.php b/app/sprinkles/account/config/default.php index c38b50006..359dbdd05 100644 --- a/app/sprinkles/account/config/default.php +++ b/app/sprinkles/account/config/default.php @@ -1,5 +1,6 @@ [ - 'auth' => false + 'auth' => false, ], /* @@ -45,8 +46,8 @@ 'algorithm' => 'sha512', 'timeouts' => [ 'create' => 86400, - 'reset' => 10800 - ] + 'reset' => 10800, + ], ], /* @@ -57,12 +58,12 @@ */ 'remember_me' => [ 'cookie' => [ - 'name' => 'rememberme' + 'name' => 'rememberme', ], 'expire_time' => 604800, 'session' => [ - 'path' => '/' - ] + 'path' => '/', + ], ], /* @@ -74,7 +75,7 @@ */ 'reserved_user_ids' => [ 'guest' => -1, - 'master' => 1 + 'master' => 1, ], /* @@ -86,8 +87,8 @@ 'session' => [ 'keys' => [ 'current_user_id' => 'account.current_user_id', // the key to use for storing the authenticated user's id - 'captcha' => 'account.captcha' // Key used to store a captcha hash during captcha verification - ] + 'captcha' => 'account.captcha', // Key used to store a captcha hash during captcha verification + ], ], /* @@ -99,7 +100,7 @@ */ 'site' => [ 'login' => [ - 'enable_email' => true // Set to false to allow login by username only + 'enable_email' => true, // Set to false to allow login by username only ], 'registration' => [ 'enabled' => true, //if this set to false, you probably want to also set require_email_verification to false as well to disable the link on the signup page @@ -110,10 +111,10 @@ 'locale' => 'en_US', 'group' => 'terran', 'roles' => [ - 'user' => true - ] - ] - ] + 'user' => true, + ], + ], + ], ], /* @@ -129,7 +130,7 @@ 'password_reset_request' => null, 'registration_attempt' => null, 'sign_in_attempt' => null, - 'verification_request' => null + 'verification_request' => null, ], /* @@ -139,6 +140,6 @@ */ 'verification' => [ 'algorithm' => 'sha512', - 'timeout' => 10800 - ] + 'timeout' => 10800, + ], ]; diff --git a/app/sprinkles/account/config/production.php b/app/sprinkles/account/config/production.php index b7ce4111f..5d1cbe914 100644 --- a/app/sprinkles/account/config/production.php +++ b/app/sprinkles/account/config/production.php @@ -1,5 +1,6 @@ 'ip', 'interval' => 3600, 'delays' => [ - 40 => 1000 - ] + 40 => 1000, + ], ], 'password_reset_request' => [ 'method' => 'ip', @@ -36,8 +37,8 @@ 4 => 20, 5 => 40, 6 => 80, - 7 => 600 - ] + 7 => 600, + ], ], 'registration_attempt' => [ 'method' => 'ip', @@ -48,8 +49,8 @@ 4 => 20, 5 => 40, 6 => 80, - 7 => 600 - ] + 7 => 600, + ], ], 'sign_in_attempt' => [ 'method' => 'ip', @@ -60,8 +61,8 @@ 6 => 20, 7 => 40, 8 => 80, - 9 => 600 - ] + 9 => 600, + ], ], 'verification_request' => [ 'method' => 'ip', @@ -72,8 +73,8 @@ 4 => 20, 5 => 40, 6 => 80, - 7 => 600 - ] - ] - ] + 7 => 600, + ], + ], + ], ]; diff --git a/app/sprinkles/account/factories/Group.php b/app/sprinkles/account/factories/Group.php new file mode 100644 index 000000000..7866fe5a1 --- /dev/null +++ b/app/sprinkles/account/factories/Group.php @@ -0,0 +1,22 @@ +define('UserFrosting\Sprinkle\Account\Database\Models\Group')->setDefinitions([ + 'name' => Faker::word(), + 'description' => Faker::paragraph(), + 'slug' => function ($object, $saved) { + return uniqid(); + }, +]); diff --git a/app/sprinkles/account/factories/Permissions.php b/app/sprinkles/account/factories/Permissions.php index be7b9fcf5..c336436fd 100644 --- a/app/sprinkles/account/factories/Permissions.php +++ b/app/sprinkles/account/factories/Permissions.php @@ -1,5 +1,6 @@ define('UserFrosting\Sprinkle\Account\Database\Models\Permission')->setDefinitions([ - 'slug' => Faker::word(), 'name' => Faker::word(), 'description' => Faker::paragraph(), - 'conditions' => Faker::word() + 'conditions' => Faker::word(), + 'slug' => function ($object, $saved) { + return uniqid(); + }, ]); diff --git a/app/sprinkles/account/factories/Roles.php b/app/sprinkles/account/factories/Roles.php index 34704f3f2..95c29960d 100644 --- a/app/sprinkles/account/factories/Roles.php +++ b/app/sprinkles/account/factories/Roles.php @@ -1,5 +1,6 @@ define('UserFrosting\Sprinkle\Account\Database\Models\Role')->setDefinitions([ - 'slug' => Faker::unique()->word(), 'name' => Faker::word(), - 'description' => Faker::paragraph() + 'description' => Faker::paragraph(), + 'slug' => function ($object, $saved) { + return uniqid(); + }, ]); diff --git a/app/sprinkles/account/factories/Users.php b/app/sprinkles/account/factories/Users.php index abd34c4fd..a35e236cb 100644 --- a/app/sprinkles/account/factories/Users.php +++ b/app/sprinkles/account/factories/Users.php @@ -1,5 +1,6 @@ define('UserFrosting\Sprinkle\Account\Database\Models\User')->setDefinitions([ - 'user_name' => Faker::unique()->firstNameMale(), + 'user_name' => Faker::username(), 'first_name' => Faker::firstNameMale(), 'last_name' => Faker::firstNameMale(), 'email' => Faker::unique()->email(), 'locale' => 'en_US', 'flag_verified' => 1, 'flag_enabled' => 1, - 'password' => Faker::password() + 'password' => Faker::password(), ]); diff --git a/app/sprinkles/account/locale/ar/messages.php b/app/sprinkles/account/locale/ar/messages.php index 5cec36485..2f84bb141 100644 --- a/app/sprinkles/account/locale/ar/messages.php +++ b/app/sprinkles/account/locale/ar/messages.php @@ -1,5 +1,6 @@ [ '@TRANSLATION' => 'تم اختراق جلسنك يجب عليك الخروج على كافة الأجهزة، ثم تسجيل الدخول مرة أخرى والتأكد من أن المعلومات الخاصة بك لم يعبث بها', 'TITLE' => 'من الممكن أن حسابك قد اخترق', - 'TEXT' => 'ربما استخدم شخص معلومات التسجيل الدخول للدخول إلى هذه الصفحة. لسلامتك، تم انتهاء جميع الجلسات يرجا التسجيل مرة اخرى وتحقق من حسابك بسبب النشاط الغريب قد ترغب في تغيير كلمة المرور' + 'TEXT' => 'ربما استخدم شخص معلومات التسجيل الدخول للدخول إلى هذه الصفحة. لسلامتك، تم انتهاء جميع الجلسات يرجا التسجيل مرة اخرى وتحقق من حسابك بسبب النشاط الغريب قد ترغب في تغيير كلمة المرور', ], 'SESSION_EXPIRED' => 'انتهت جلستك تستطيع تسجيل الدخول مرة أخرى', @@ -40,7 +41,7 @@ '@TRANSLATION' => 'إعدادات الحساب', 'DESCRIPTION' => 'غير إعدادات حسابك، بما في ذلك البريد الإلكتروني، واسم وكلمة المرور ', - 'UPDATED' => 'تم تجديد إعدادات الحساب' + 'UPDATED' => 'تم تجديد إعدادات الحساب', ], 'TOOLS' => 'أدوات الحساب', @@ -55,12 +56,12 @@ 'PAGE' => 'إعادة إرسال البريد الإلكتروني التحقق من حسابك الجديد', 'SEND' => 'ارسل رابط للتحقق عبر البريد الالكتروني', 'TOKEN_NOT_FOUND' => 'رمز التحقق غير موجود أو تم تحقق الحساب من قبل', - ] + ], ], 'EMAIL' => [ 'INVALID' => 'لا يوجد حساب ل {{email}}', - 'IN_USE' => 'البريد الإلكتروني {{email}} قيد الاستخدام' + 'IN_USE' => 'البريد الإلكتروني {{email}} قيد الاستخدام', ], 'FIRST_NAME' => 'الاسم الاول', @@ -76,7 +77,7 @@ 'ALREADY_COMPLETE' => 'انت بالفعل داخل', 'SOCIAL' => 'أو الدخول مع', - 'REQUIRED' => 'عذرا، يجب عليك تسجيل الدخول للوصول إلى هذا المكان' + 'REQUIRED' => 'عذرا، يجب عليك تسجيل الدخول للوصول إلى هذا المكان', ], 'LOGOUT' => 'تسجيل الخروج', @@ -88,7 +89,7 @@ 'DESCRIPTION' => 'سجل الدخول إلى حسابك في {{site_name}} أو سجيل للحصول على حساب جديد', 'SUBTITLE' => 'التسجيل مجانا أو قم بتسجيل الدخول باستخدام حساب موجود', 'TITLE' => 'هيا نبدأ', - ] + ], ], 'PASSWORD' => [ @@ -114,14 +115,14 @@ 'INVALID' => 'لم يتم العثور على إعادة تعيين كلمة المرور، أو انتهت صلاحية رابط حاول إعادة تقديم طلبك', 'PAGE' => 'الحصول على رابط لإعادة تعيين كلمة المرور', 'REQUEST_CANNED' => 'إلغاء طلب كلمة المرور', - 'REQUEST_SENT' => 'إذا تطابق البريد الإلكتروني {{email}} حسابا في نظامنا، فسيتم إرسال رابط إعادة تعيين كلمة المرور إلى {{email}}.' + 'REQUEST_SENT' => 'إذا تطابق البريد الإلكتروني {{email}} حسابا في نظامنا، فسيتم إرسال رابط إعادة تعيين كلمة المرور إلى {{email}}.', ], 'RESET' => [ '@TRANSLATION' => 'إعادة تعيين كلمة المرور', 'CHOOSE' => 'اختيار كلمة مرور جديدة للتواصل', 'PAGE' => 'اختيار كلمة مرور جديدة لحسابك', - 'SEND' => 'تعيين كلمة المرور الجديدة وتسجيل الدخول' + 'SEND' => 'تعيين كلمة المرور الجديدة وتسجيل الدخول', ], 'HASH_FAILED' => 'فشلت التجزئة كلمة المرور يرجى الاتصال بمسؤول الموقع', @@ -133,8 +134,8 @@ 'CREATE' => [ '@TRANSLATION' => 'إنشاء كلمة مرور', 'PAGE' => 'اختر كلمة مرور لحسابك الجديد', - 'SET' => 'تعيين كلمة المرور وتسجيل الدخول' - ] + 'SET' => 'تعيين كلمة المرور وتسجيل الدخول', + ], ], 'REGISTER' => 'تسجيل', @@ -147,7 +148,7 @@ 'COMPLETE_TYPE2' => 'لقد سجلت بنجاح سوف تتلقى قريبا رسالة التحقق تحتوي على رابط لتفعيل حسابك لن تكون قادرا على تسجيل الدخول حتى الانتهاء من هذه الخطوة', 'DISABLED' => 'عذرا، لقد تم تعطيل تسجيل اي حساب', 'LOGOUT' => 'لا يمكنك التسجيل للحصول على حساب أثناء تسجيل الدخول', - 'WELCOME' => 'التسجيل سريع وبسيط' + 'WELCOME' => 'التسجيل سريع وبسيط', ], 'RATE_LIMIT_EXCEEDED' => 'تم تجاوز الحد عددا لهذا الإجراء يجب الانتظار {{delay}} ثواني قبل القيام بمحاولة أخرى', @@ -167,12 +168,12 @@ 'CHOOSE' => 'اختيار اسم مستخدم فريد', 'INVALID' => 'اسم المستخدم غير صالح', - 'IN_USE' => 'اسم المستخدم {{user_name}} قيد الاستخدام' + 'IN_USE' => 'اسم المستخدم {{user_name}} قيد الاستخدام', ], 'USER_ID_INVALID' => 'عدم وجود هوية المستخدم المطلوب', 'USER_OR_EMAIL_INVALID' => 'اسم المستخدم أو عنوان البريد الإلكتروني غير صالح', 'USER_OR_PASS_INVALID' => 'اسم المستخدم أو كلمة المرور غير صالحة', - 'WELCOME' => 'مرحبا بعودتك, {{first_name}}' + 'WELCOME' => 'مرحبا بعودتك, {{first_name}}', ]; diff --git a/app/sprinkles/account/locale/ar/validate.php b/app/sprinkles/account/locale/ar/validate.php index 5bdb39469..1747af409 100644 --- a/app/sprinkles/account/locale/ar/validate.php +++ b/app/sprinkles/account/locale/ar/validate.php @@ -1,5 +1,6 @@ [ - 'PASSWORD_MISMATCH' => 'يجب أن تكون كلمة المرور وكلمة المرور التأكيدية نفس' - ] + 'PASSWORD_MISMATCH' => 'يجب أن تكون كلمة المرور وكلمة المرور التأكيدية نفس', + ], ]; diff --git a/app/sprinkles/account/locale/de_DE/messages.php b/app/sprinkles/account/locale/de_DE/messages.php index 0b2a7b436..a6e68df07 100644 --- a/app/sprinkles/account/locale/de_DE/messages.php +++ b/app/sprinkles/account/locale/de_DE/messages.php @@ -1,5 +1,6 @@ [ '@TRANSLATION' => 'Ihre Sitzung wurde beeinträchtigt. Sie sollten sich auf allen Geräten abmelden, sich dann wieder anmelden und sicherstellen, dass Ihre Daten nicht manipuliert wurden.', 'TITLE' => 'Ihr Konto wurde möglicherweise beeinträchtigt', - 'TEXT' => 'Möglicherweise ist es jemandem gelungen, Ihren Zugang zu dieser Seite zu übernehmen. Aus Sicherheitsgründen wurden Sie überall abgemeldet. Bitte melden Sie sich neu an und untersuchen Sie das Konto nach verdächtigen Aktivitäten. Außerdem sollten Sie Ihr Passwort ändern.' + 'TEXT' => 'Möglicherweise ist es jemandem gelungen, Ihren Zugang zu dieser Seite zu übernehmen. Aus Sicherheitsgründen wurden Sie überall abgemeldet. Bitte melden Sie sich neu an und untersuchen Sie das Konto nach verdächtigen Aktivitäten. Außerdem sollten Sie Ihr Passwort ändern.', ], 'SESSION_EXPIRED' => 'Ihre Sitzung ist abgelaufen. Bitte melden Sie sich erneut an.', 'SETTINGS' => [ '@TRANSLATION' => 'Kontoeinstellungen', 'DESCRIPTION' => 'Aktualisieren Sie Ihre Kontoeinstellungen, einschließlich E-Mail, Name und Passwort.', - 'UPDATED' => 'Kontoeinstellungen aktualisiert' + 'UPDATED' => 'Kontoeinstellungen aktualisiert', ], 'TOOLS' => 'Konto-Werkzeuge', @@ -53,14 +54,14 @@ 'EMAIL' => 'Bitte geben Sie die E-Mail-Adresse ein, mit der Sie sich registriert haben, Überprüfen Sie Ihr E-Mails/Spam-Ordner für die Bestätigungs-E-Mail.', 'PAGE' => 'Senden Sie die Bestätigungs-E-Mail erneut für Ihr neues Konto.', 'SEND' => 'Bestätigungslink erneut per E-Mail zusenden', - 'TOKEN_NOT_FOUND' => 'Verifizierungstoken existiert nicht / Konto wurde bereits verifiziert' - ] + 'TOKEN_NOT_FOUND' => 'Verifizierungstoken existiert nicht / Konto wurde bereits verifiziert', + ], ], 'EMAIL' => [ 'INVALID' => 'Es gibt kein Konto für {{email}}.', 'IN_USE' => 'Die E-Mail Adresse {{email}} wird bereits verwendet.', - 'VERIFICATION_REQUIRED' => 'E-Mail (Bestätigung benötigt - Benutzen Sie eine echte E-Mail Adresse!)' + 'VERIFICATION_REQUIRED' => 'E-Mail (Bestätigung benötigt - Benutzen Sie eine echte E-Mail Adresse!)', ], 'EMAIL_OR_USERNAME' => 'Benutzername oder E-mail Adresse', @@ -73,14 +74,14 @@ 'LOCALE' => [ 'ACCOUNT' => 'Die Sprache und das Gebietsschema für Ihr Konto', - 'INVALID' => '{{locale}} ist kein gültiges Gebietsschema.' + 'INVALID' => '{{locale}} ist kein gültiges Gebietsschema.', ], 'LOGIN' => [ '@TRANSLATION' => 'Anmelden', 'ALREADY_COMPLETE' => 'Sie sind bereits eingeloggt!', 'SOCIAL' => 'Oder loggen Sie sich ein mit', - 'REQUIRED' => 'Sorry, Sie müssen angemeldet sein. Um auf diese Ressource zugreifen zu können.' + 'REQUIRED' => 'Sorry, Sie müssen angemeldet sein. Um auf diese Ressource zugreifen zu können.', ], 'LOGOUT' => 'Ausloggen', @@ -93,8 +94,8 @@ 'LOGIN' => [ 'DESCRIPTION' => 'Melden Sie sich in Ihr {{site_name}} Konto an oder registrieren Sie sich für ein neues Konto.', 'SUBTITLE' => 'Registrieren Sie sich kostenlos oder melden Sie sich mit einem bestehenden Konto an.', - 'TITLE' => 'Lass uns anfangen!' - ] + 'TITLE' => 'Lass uns anfangen!', + ], ], 'PASSWORD' => [ @@ -110,7 +111,7 @@ 'CREATE' => [ '@TRANSLATION' => 'Passwort setzen', 'PAGE' => 'Setzen Sie ein Passwort für den Account.', - 'SET' => 'Passwort setzen und anmelden' + 'SET' => 'Passwort setzen und anmelden', ], 'CURRENT' => 'Aktuelles Passwort', 'CURRENT_EXPLAIN' => 'Sie müssen Ihr aktuelles Passwort bestätigen, um Änderungen vorzunehmen', @@ -125,7 +126,7 @@ 'INVALID' => "Diese Anforderung zum Zurücksetzen des Passworts wurde nicht gefunden oder ist abgelaufen.Bitte versuchen Sie Ihre Anfrage erneut einzureichen.", 'PAGE' => 'Holen Sie sich einen Link, um Ihr Passwort zurückzusetzen.', 'REQUEST_CANNED' => 'Verlorene Passwortanforderung abgebrochen.', - 'REQUEST_SENT' => 'Wenn die E-Mail {{email}} mit einem Account in unserem System übereinstimmt, wird ein Passwort-Reset-Link an {{email}} gesendet.' + 'REQUEST_SENT' => 'Wenn die E-Mail {{email}} mit einem Account in unserem System übereinstimmt, wird ein Passwort-Reset-Link an {{email}} gesendet.', ], 'HASH_FAILED' => 'Passwort Hashing fehlgeschlagen. Bitte kontaktieren Sie einen Administrator.', @@ -137,15 +138,15 @@ '@TRANSLATION' => 'Passwort zurücksetzen', 'CHOOSE' => 'Bitte wählen Sie ein neues Passwort, um fortzufahren.', 'PAGE' => 'Wählen Sie ein neues Passwort für Ihr Konto.', - 'SEND' => 'Neues Passwort festlegen und anmelden' + 'SEND' => 'Neues Passwort festlegen und anmelden', ], - 'UPDATED' => 'Konto Passwort aktualisiert' + 'UPDATED' => 'Konto Passwort aktualisiert', ], 'PROFILE' => [ 'SETTINGS' => 'Profileinstellungen', - 'UPDATED' => 'Profileinstellungen aktualisiert' + 'UPDATED' => 'Profileinstellungen aktualisiert', ], 'RATE_LIMIT_EXCEEDED' => 'Die grenze für diese Maßnahme wurde überschritten. Sie müssen weitere {{delay}} Sekunden warten, bevor Sie einen weiteren Versuch machen dürfen.', @@ -158,7 +159,7 @@ 'COMPLETE_TYPE2' => 'Sie haben sich erfolgreich registriert. Sie erhalten in Kürze eine Bestätigungs-E-Mail mit einem Link zur Aktivierung Ihres Kontos. Sie können sich nicht anmelden, bis Sie diesen Schritt abgeschlossen haben.', 'DISABLED' => 'Es tut uns leid, Die Registrierung des Kontos ist deaktiviert.', 'LOGOUT' => 'Es tut uns leid, Sie können kein neues Konto registrieren, während Sie angemeldet sind. Bitte melden Sie sich zuerst ab.', - 'WELCOME' => 'Die Registrierung ist schnell und einfach.' + 'WELCOME' => 'Die Registrierung ist schnell und einfach.', ], 'REMEMBER_ME' => 'Erinnere dich an mich!', 'REMEMBER_ME_ON_COMPUTER' => 'Erinnere dich an mich auf diesem Computer (nicht für öffentliche Computer empfohlen)', @@ -178,12 +179,12 @@ 'CHOOSE' => 'Wählen Sie einen eindeutigen Benutzernamen', 'INVALID' => 'Ungültiger Benutzername', 'IN_USE' => 'Benutzername {{user_name}} wird bereits verwendet.', - 'NOT_AVAILABLE' => "Benutzername {{user_name}} ist nicht verfügbar. Wähle einen anderen Namen, der klicken Sie auf 'vorschlagen'." + 'NOT_AVAILABLE' => "Benutzername {{user_name}} ist nicht verfügbar. Wähle einen anderen Namen, der klicken Sie auf 'vorschlagen'.", ], 'USER_ID_INVALID' => 'Die angeforderte Benutzer-ID existiert nicht.', 'USER_OR_EMAIL_INVALID' => 'Benutzername oder E-Mail-Adresse ist ungültig.', 'USER_OR_PASS_INVALID' => 'Benutzername oder Passwort ist ungültig.', - 'WELCOME' => 'Willkommen zurück, {{first_name}}' + 'WELCOME' => 'Willkommen zurück, {{first_name}}', ]; diff --git a/app/sprinkles/account/locale/de_DE/validate.php b/app/sprinkles/account/locale/de_DE/validate.php index c81a7334d..7c86d9a91 100644 --- a/app/sprinkles/account/locale/de_DE/validate.php +++ b/app/sprinkles/account/locale/de_DE/validate.php @@ -1,5 +1,6 @@ [ 'PASSWORD_MISMATCH' => 'Ihr Passwort und das Bestätigungspasswort müssen übereinstimmen.', - 'USERNAME' => "Benutzernamen dürfen nur aus Kleinbuchstaben, Zahlen, '.', '-' und '_' bestehen." - ] + 'USERNAME' => "Benutzernamen dürfen nur aus Kleinbuchstaben, Zahlen, '.', '-' und '_' bestehen.", + ], ]; diff --git a/app/sprinkles/account/locale/el/messages.php b/app/sprinkles/account/locale/el/messages.php index 06fc51f4d..4120bc32e 100644 --- a/app/sprinkles/account/locale/el/messages.php +++ b/app/sprinkles/account/locale/el/messages.php @@ -1,176 +1,173 @@ [ - "@TRANSLATION" => "Λογαριασμός", - - "ACCESS_DENIED" => "Χμμ, φαίνεται ότι δεν έχετε άδεια να το κάνετε αυτό", - - "DISABLED" => "Αυτός ο λογαριασμός έχει απενεργοποιηθεί. Επικοινωνήστε μαζί μας για περισσότερες πληροφορίες.", - - "EMAIL_UPDATED" => "Ενημερώθηκε η διεύθυνση ηλεκτρονικού ταχυδρομείου του λογαριασμού", - - "INVALID" => "Αυτός ο λογαριασμός δεν υπάρχει, μπορεί να έχει διαγραφεί. Παρακαλούμε επικοινωνήστε μαζί μας για περισσότερες πληροφορίες.", - - "MASTER_NOT_EXISTS" => "Δεν μπορείτε να καταχωρίσετε έναν λογαριασμό μέχρι να δημιουργηθεί ο κύριος λογαριασμός!", - - "MY" => "Ο λογαριασμός μου", - - "SESSION_COMPROMISED" => [ - "@TRANSLATION" => "Η συνεδρία σας έχει παραβιαστεί, θα πρέπει να αποσυνδεθείτε σε όλες τις συσκευές και στη συνέχεια, να συνδεθείτε ξανά και να βεβαιωθείτε ότι τα δεδομένα σας δεν έχουν αλλοιωθεί.", - "TITLE" => "Ο λογαριασμός σας ενδέχεται να έχει παραβιαστεί", - "TEXT" => "Κάποιος μπορεί να έχει χρησιμοποιήσει τα στοιχεία σύνδεσής σας για να συνδεθεί στον ιστόποτο. Για την ασφάλειά σας, όλες οι σύνδεσεις σας αποσυνδέθηκαν. Ελέγξτε το λογαριασμό σας για ύποπτη δραστηριότητα. Καλό είναι να αλλάξετε τον κωδικό πρόσβασής σας." + 'ACCOUNT' => [ + '@TRANSLATION' => 'Λογαριασμός', + + 'ACCESS_DENIED' => 'Χμμ, φαίνεται ότι δεν έχετε άδεια να το κάνετε αυτό', + + 'DISABLED' => 'Αυτός ο λογαριασμός έχει απενεργοποιηθεί. Επικοινωνήστε μαζί μας για περισσότερες πληροφορίες.', + + 'EMAIL_UPDATED' => 'Ενημερώθηκε η διεύθυνση ηλεκτρονικού ταχυδρομείου του λογαριασμού', + + 'INVALID' => 'Αυτός ο λογαριασμός δεν υπάρχει, μπορεί να έχει διαγραφεί. Παρακαλούμε επικοινωνήστε μαζί μας για περισσότερες πληροφορίες.', + + 'MASTER_NOT_EXISTS' => 'Δεν μπορείτε να καταχωρίσετε έναν λογαριασμό μέχρι να δημιουργηθεί ο κύριος λογαριασμός!', + + 'MY' => 'Ο λογαριασμός μου', + + 'SESSION_COMPROMISED' => [ + '@TRANSLATION' => 'Η συνεδρία σας έχει παραβιαστεί, θα πρέπει να αποσυνδεθείτε σε όλες τις συσκευές και στη συνέχεια, να συνδεθείτε ξανά και να βεβαιωθείτε ότι τα δεδομένα σας δεν έχουν αλλοιωθεί.', + 'TITLE' => 'Ο λογαριασμός σας ενδέχεται να έχει παραβιαστεί', + 'TEXT' => 'Κάποιος μπορεί να έχει χρησιμοποιήσει τα στοιχεία σύνδεσής σας για να συνδεθεί στον ιστόποτο. Για την ασφάλειά σας, όλες οι σύνδεσεις σας αποσυνδέθηκαν. Ελέγξτε το λογαριασμό σας για ύποπτη δραστηριότητα. Καλό είναι να αλλάξετε τον κωδικό πρόσβασής σας.', ], - "SESSION_EXPIRED" => "Η περίοδος σύνδεσης σας έχει λήξει. Συνδεθείτε ξανά.", + 'SESSION_EXPIRED' => 'Η περίοδος σύνδεσης σας έχει λήξει. Συνδεθείτε ξανά.', - "SETTINGS" => [ - "@TRANSLATION" => "Ρυθμίσεις λογαριασμού", - "DESCRIPTION" => "Ενημερώστε τις ρυθμίσεις του λογαριασμού σας, συμπεριλαμβανομένου του email, του ονόματος και του κωδικού πρόσβασης.", - "UPDATED" => "Οι ρυθμίσεις λογαριασμού ενημερώθηκαν" + 'SETTINGS' => [ + '@TRANSLATION' => 'Ρυθμίσεις λογαριασμού', + 'DESCRIPTION' => 'Ενημερώστε τις ρυθμίσεις του λογαριασμού σας, συμπεριλαμβανομένου του email, του ονόματος και του κωδικού πρόσβασης.', + 'UPDATED' => 'Οι ρυθμίσεις λογαριασμού ενημερώθηκαν', ], - "TOOLS" => "Εργαλεία λογαριασμού", + 'TOOLS' => 'Εργαλεία λογαριασμού', - "UNVERIFIED" => "Ο λογαριασμός σας δεν έχει ακόμη επαληθευτεί. Ελέγξτε τα μηνύματα ηλεκτρονικού ταχυδρομείου / (και τον φάκελο ανεπιθύμητης αλληλογραφίας) για τις οδηγίες ενεργοποίησης λογαριασμού.", + 'UNVERIFIED' => 'Ο λογαριασμός σας δεν έχει ακόμη επαληθευτεί. Ελέγξτε τα μηνύματα ηλεκτρονικού ταχυδρομείου / (και τον φάκελο ανεπιθύμητης αλληλογραφίας) για τις οδηγίες ενεργοποίησης λογαριασμού.', - "VERIFICATION" => [ - "NEW_LINK_SENT" => "Έχουμε στείλει ένα νέο σύνδεσμο επιβεβαίωσης με μήνυμα ηλεκτρονικού ταχυδρομείου στη διεύθυνση {{email}}. Ελέγξτε τους φακέλους εισερχομένων και ανεπιθύμητων μηνυμάτων για αυτό το μήνυμα ηλεκτρονικού ταχυδρομείου.", - "RESEND" => "Επανααποστολή του ηλ. μηνύματος επιβεβαίωσης", - "COMPLETE" => "Έχετε επαληθεύσει με επιτυχία το λογαριασμό σας. Μπορείτε τώρα να συνδεθείτε.", - "EMAIL" => "Παρακαλώ εισάγετε τη διεύθυνση ηλεκτρονικού ταχυδρομείου που χρησιμοποιήσατε για να εγγραφείτε και το e-mail επιβεβαίωσης θα σας αποσταλεί.", - "PAGE" => "Επανααποστολή του μήνυματος ηλ. ταχυδρομείου επιβεβαίωσης για το νέο σας λογαριασμό.", - "SEND" => "Αποστολή μηνύματος ηλ. ταχυδρομείου με τον σύνδεσμο επιβεβαίωσης για τον λογαριασμό μου", - "TOKEN_NOT_FOUND" => "Το διακριτικό ελέγχου επιβεβαίωσης δεν υπάρχει / ο λογαριασμός έχει ήδη επαληθευτεί", - ] + 'VERIFICATION' => [ + 'NEW_LINK_SENT' => 'Έχουμε στείλει ένα νέο σύνδεσμο επιβεβαίωσης με μήνυμα ηλεκτρονικού ταχυδρομείου στη διεύθυνση {{email}}. Ελέγξτε τους φακέλους εισερχομένων και ανεπιθύμητων μηνυμάτων για αυτό το μήνυμα ηλεκτρονικού ταχυδρομείου.', + 'RESEND' => 'Επανααποστολή του ηλ. μηνύματος επιβεβαίωσης', + 'COMPLETE' => 'Έχετε επαληθεύσει με επιτυχία το λογαριασμό σας. Μπορείτε τώρα να συνδεθείτε.', + 'EMAIL' => 'Παρακαλώ εισάγετε τη διεύθυνση ηλεκτρονικού ταχυδρομείου που χρησιμοποιήσατε για να εγγραφείτε και το e-mail επιβεβαίωσης θα σας αποσταλεί.', + 'PAGE' => 'Επανααποστολή του μήνυματος ηλ. ταχυδρομείου επιβεβαίωσης για το νέο σας λογαριασμό.', + 'SEND' => 'Αποστολή μηνύματος ηλ. ταχυδρομείου με τον σύνδεσμο επιβεβαίωσης για τον λογαριασμό μου', + 'TOKEN_NOT_FOUND' => 'Το διακριτικό ελέγχου επιβεβαίωσης δεν υπάρχει / ο λογαριασμός έχει ήδη επαληθευτεί', + ], ], - "EMAIL" => [ - "INVALID" => "Δεν υπάρχει λογαριασμό για το {{email}}.", - "IN_USE" => "Το email {{email}} χρησιμοποιείται ήδη.", - "VERIFICATION_REQUIRED" => "Email (απαιτείται επιβεβαίωση - χρησιμοποιήστε μια πραγματική διεύθυνση!)" + 'EMAIL' => [ + 'INVALID' => 'Δεν υπάρχει λογαριασμό για το {{email}}.', + 'IN_USE' => 'Το email {{email}} χρησιμοποιείται ήδη.', + 'VERIFICATION_REQUIRED' => 'Email (απαιτείται επιβεβαίωση - χρησιμοποιήστε μια πραγματική διεύθυνση!)', ], - "EMAIL_OR_USERNAME" => "Όνομα χρήστη ή διεύθυνση ηλεκτρονικού ταχυδρομείου", + 'EMAIL_OR_USERNAME' => 'Όνομα χρήστη ή διεύθυνση ηλεκτρονικού ταχυδρομείου', - "FIRST_NAME" => "Όνομα", + 'FIRST_NAME' => 'Όνομα', - "HEADER_MESSAGE_ROOT" => "YOU ARE SIGNED IN AS THE ROOT USER", + 'HEADER_MESSAGE_ROOT' => 'YOU ARE SIGNED IN AS THE ROOT USER', - "LAST_NAME" => "Επώνυμο", - "LOCALE" => [ - "ACCOUNT" => "Η γλώσσα και η τοπική ρύθμιση που πρέπει να χρησιμοποιήσετε για το λογαριασμό σας", - "INVALID" => "{{locale}} δεν είναι έγκυρη τοπική ρύθμιση." + 'LAST_NAME' => 'Επώνυμο', + 'LOCALE' => [ + 'ACCOUNT' => 'Η γλώσσα και η τοπική ρύθμιση που πρέπει να χρησιμοποιήσετε για το λογαριασμό σας', + 'INVALID' => '{{locale}} δεν είναι έγκυρη τοπική ρύθμιση.', ], - "LOGIN" => [ - "@TRANSLATION" => "Σύνδεση", - "ALREADY_COMPLETE" => "Έχετε ήδη συνδεθεί!", - "SOCIAL" => "Ή συνδεθείτε με", - "REQUIRED" => "Λυπούμαστε, πρέπει να είστε συνδεδεμένοι για να αποκτήσετε πρόσβαση σε αυτόν τον πόρο." + 'LOGIN' => [ + '@TRANSLATION' => 'Σύνδεση', + 'ALREADY_COMPLETE' => 'Έχετε ήδη συνδεθεί!', + 'SOCIAL' => 'Ή συνδεθείτε με', + 'REQUIRED' => 'Λυπούμαστε, πρέπει να είστε συνδεδεμένοι για να αποκτήσετε πρόσβαση σε αυτόν τον πόρο.', ], - "LOGOUT" => "Αποσύνδεση", - - "NAME" => "Όνομα", - "NAME_AND_EMAIL" => "Όνομα και ηλεκτρονικό ταχυδρομείο", - "PAGE" => [ - "LOGIN" => [ - "DESCRIPTION" => "Συνδεθείτε στον λογαριασμό σας {{site_name}} ή εγγραφείτε για ένα νέο λογαριασμό.", - "SUBTITLE" => "Εγγραφείτε δωρεάν ή συνδεθείτε με έναν υπάρχοντα λογαριασμό.", - "TITLE" => "Ας ξεκινήσουμε!", - ] + 'LOGOUT' => 'Αποσύνδεση', + + 'NAME' => 'Όνομα', + 'NAME_AND_EMAIL' => 'Όνομα και ηλεκτρονικό ταχυδρομείο', + 'PAGE' => [ + 'LOGIN' => [ + 'DESCRIPTION' => 'Συνδεθείτε στον λογαριασμό σας {{site_name}} ή εγγραφείτε για ένα νέο λογαριασμό.', + 'SUBTITLE' => 'Εγγραφείτε δωρεάν ή συνδεθείτε με έναν υπάρχοντα λογαριασμό.', + 'TITLE' => 'Ας ξεκινήσουμε!', + ], ], - "PASSWORD" => [ - "@TRANSLATION" => "Κωδικός πρόσβασης", - "BETWEEN" => "Μεταξύ {{min}} - {{max}} χαρακτήρων", - "CONFIRM" => "Επιβεβαίωση κωδικού πρόσβασης", - "CONFIRM_CURRENT" => "Επιβεβαιώστε τον τρέχοντα κωδικό πρόσβασης", - "CONFIRM_NEW" => "Επιβεβαίωση νέου κωδικού πρόσβασης", - "CONFIRM_NEW_EXPLAIN" => "Πληκτρολογήστε ξανά τον νέο κωδικό πρόσβασής σας", - "CONFIRM_NEW_HELP" => "Απαιτείται μόνο αν επιλέξετε νέο κωδικό πρόσβασης", - "CREATE" => [ - "@TRANSLATION" => "Δημιουργία κωδικού πρόσβασης", - "PAGE" => "Επιλέξτε έναν κωδικό πρόσβασης για το νέο σας λογαριασμό.", - "SET" => "Ορισμός κωδικού πρόσβασης και σύνδεση" + 'PASSWORD' => [ + '@TRANSLATION' => 'Κωδικός πρόσβασης', + 'BETWEEN' => 'Μεταξύ {{min}} - {{max}} χαρακτήρων', + 'CONFIRM' => 'Επιβεβαίωση κωδικού πρόσβασης', + 'CONFIRM_CURRENT' => 'Επιβεβαιώστε τον τρέχοντα κωδικό πρόσβασης', + 'CONFIRM_NEW' => 'Επιβεβαίωση νέου κωδικού πρόσβασης', + 'CONFIRM_NEW_EXPLAIN' => 'Πληκτρολογήστε ξανά τον νέο κωδικό πρόσβασής σας', + 'CONFIRM_NEW_HELP' => 'Απαιτείται μόνο αν επιλέξετε νέο κωδικό πρόσβασης', + 'CREATE' => [ + '@TRANSLATION' => 'Δημιουργία κωδικού πρόσβασης', + 'PAGE' => 'Επιλέξτε έναν κωδικό πρόσβασης για το νέο σας λογαριασμό.', + 'SET' => 'Ορισμός κωδικού πρόσβασης και σύνδεση', ], - "CURRENT" => "Τρέχων κωδικός πρόσβασης", - "CURRENT_EXPLAIN" => "Πρέπει να επιβεβαιώσετε τον τρέχοντα κωδικό πρόσβασης για να κάνετε αλλαγές", - "FORGOTTEN" => "Ξέχασα τον κωδικό μου", - "FORGET" => [ - "@TRANSLATION" => "Ξέχασα τον κωδικό μου", - "COULD_NOT_UPDATE" => "Δεν ήταν δυνατή η αλλαγή του κωδικού πρόσβασης", - "EMAIL" => "Παρακαλώ εισάγετε τη διεύθυνση ηλεκτρονικού ταχυδρομείου που χρησιμοποιήσατε για να εγγραφείτε. Θα σας αποσταλεί ένας σύνδεσμος με οδηγίες για την επαναφορά του κωδικού πρόσβασής σας.", - "EMAIL_SEND" => "Σύνδεσμος επαναφοράς κωδικού πρόσβασης ηλεκτρονικού ταχυδρομείου", - "INVALID" => "Αυτό το αίτημα επαναφοράς κωδικού πρόσβασης δεν βρέθηκε ή έχει λήξει.", - "PAGE" => "Λήψη συνδέσμου για επαναφορά του κωδικού πρόσβασής σας", - "REQUEST_CANNED" => "Ακυρώθηκε το αίτημα επαναφοράς κωδικού πρόσβασης.", - "REQUEST_SENT" => "Αν το μήνυμα ηλεκτρονικού ταχυδρομείου {{email}} αντιστοιχεί σε ένα λογαριασμό στο σύστημά μας, ένας σύνδεσμος επαναφοράς κωδικού πρόσβασης θα αποσταλεί στο {{email}} ." + 'CURRENT' => 'Τρέχων κωδικός πρόσβασης', + 'CURRENT_EXPLAIN' => 'Πρέπει να επιβεβαιώσετε τον τρέχοντα κωδικό πρόσβασης για να κάνετε αλλαγές', + 'FORGOTTEN' => 'Ξέχασα τον κωδικό μου', + 'FORGET' => [ + '@TRANSLATION' => 'Ξέχασα τον κωδικό μου', + 'COULD_NOT_UPDATE' => 'Δεν ήταν δυνατή η αλλαγή του κωδικού πρόσβασης', + 'EMAIL' => 'Παρακαλώ εισάγετε τη διεύθυνση ηλεκτρονικού ταχυδρομείου που χρησιμοποιήσατε για να εγγραφείτε. Θα σας αποσταλεί ένας σύνδεσμος με οδηγίες για την επαναφορά του κωδικού πρόσβασής σας.', + 'EMAIL_SEND' => 'Σύνδεσμος επαναφοράς κωδικού πρόσβασης ηλεκτρονικού ταχυδρομείου', + 'INVALID' => 'Αυτό το αίτημα επαναφοράς κωδικού πρόσβασης δεν βρέθηκε ή έχει λήξει.', + 'PAGE' => 'Λήψη συνδέσμου για επαναφορά του κωδικού πρόσβασής σας', + 'REQUEST_CANNED' => 'Ακυρώθηκε το αίτημα επαναφοράς κωδικού πρόσβασης.', + 'REQUEST_SENT' => 'Αν το μήνυμα ηλεκτρονικού ταχυδρομείου {{email}} αντιστοιχεί σε ένα λογαριασμό στο σύστημά μας, ένας σύνδεσμος επαναφοράς κωδικού πρόσβασης θα αποσταλεί στο {{email}} .', ], - - "HASH_FAILED" => "Η ενημέρωση του κωδικού πρόσβασης απέτυχε. Επικοινωνήστε με έναν διαχειριστή ιστότοπου.", - "INVALID" => "Ο τρέχων κωδικός πρόσβασης δεν ταιριάζει με αυτόν που έχουμε στην εγγραφή", - "NEW" => "Νέος κωδικός πρόσβασης", - "NOTHING_TO_UPDATE" => "Δεν μπορείτε να ενημερώσετε με τον ίδιο κωδικό πρόσβασης", - - "RESET" => [ - "@TRANSLATION" => "Επαναφορά κωδικού πρόσβασης", - "CHOOSE" => "Παρακαλώ επιλέξτε νέο κωδικό πρόσβασης για να συνεχίσετε.", - "PAGE" => "Επιλέξτε έναν νέο κωδικό πρόσβασης για το λογαριασμό σας.", - "SEND" => "Ορισμός νέου κωδικού πρόσβασης και σύνδεσης" + + 'HASH_FAILED' => 'Η ενημέρωση του κωδικού πρόσβασης απέτυχε. Επικοινωνήστε με έναν διαχειριστή ιστότοπου.', + 'INVALID' => 'Ο τρέχων κωδικός πρόσβασης δεν ταιριάζει με αυτόν που έχουμε στην εγγραφή', + 'NEW' => 'Νέος κωδικός πρόσβασης', + 'NOTHING_TO_UPDATE' => 'Δεν μπορείτε να ενημερώσετε με τον ίδιο κωδικό πρόσβασης', + + 'RESET' => [ + '@TRANSLATION' => 'Επαναφορά κωδικού πρόσβασης', + 'CHOOSE' => 'Παρακαλώ επιλέξτε νέο κωδικό πρόσβασης για να συνεχίσετε.', + 'PAGE' => 'Επιλέξτε έναν νέο κωδικό πρόσβασης για το λογαριασμό σας.', + 'SEND' => 'Ορισμός νέου κωδικού πρόσβασης και σύνδεσης', ], - - "UPDATED" => "Ο κωδικός πρόσβασης λογαριασμού ενημερώθηκε" + + 'UPDATED' => 'Ο κωδικός πρόσβασης λογαριασμού ενημερώθηκε', ], - - "PROFILE" => [ - "SETTINGS" => "Ρυθμίσεις προφίλ", - "UPDATED" => "Οι ρυθμίσεις του προφίλ ενημερώθηκαν" + + 'PROFILE' => [ + 'SETTINGS' => 'Ρυθμίσεις προφίλ', + 'UPDATED' => 'Οι ρυθμίσεις του προφίλ ενημερώθηκαν', ], - "RATE_LIMIT_EXCEEDED" => "Το όριο προσπαθειών για αυτήν τη ενέργεια έχει ξεπεραστεί. Θα πρέπει να περιμένετε {{delay}} δευτερόλεπτα πριν να σας επιτραπεί να κάνετε μια άλλη προσπάθεια.", - - "REGISTER" => "Εγγραφή", - "REGISTER_ME" => "Θέλω να εγγραφώ", - "REGISTRATION" => [ - "BROKEN" => "Λυπούμαστε, υπάρχει πρόβλημα στη διαδικασία εγγραφής στο λογαριασμό μας. Επικοινωνήστε απευθείας μαζί μας για βοήθεια.", - "COMPLETE_TYPE1" => "Έχετε εγγραφεί επιτυχώς, μπορείτε τώρα να συνδεθείτε.", - "COMPLETE_TYPE2" => "Έχετε εγγραφεί επιτυχώς. Ένας σύνδεσμος για την ενεργοποίηση του λογαριασμού σας έχει αποσταλεί στο {{email}} και δεν θα μπορείτε να συνδεθείτε μέχρι να ολοκληρώσετε αυτό το βήμα.", - "DISABLED" => "Λυπούμαστε, η εγγραφή λογαριασμών έχει απενεργοποιηθεί.", - "LOGOUT" => "Λυπούμαστε, δεν μπορείτε να εγγραφείτε για λογαριασμό ενώ είστε συνδεδεμένοι. Παρακαλώ αποσυνδεθείτε πρώτα.", - "WELCOME" => "Η εγγραφή είναι γρήγορη και απλή." + 'RATE_LIMIT_EXCEEDED' => 'Το όριο προσπαθειών για αυτήν τη ενέργεια έχει ξεπεραστεί. Θα πρέπει να περιμένετε {{delay}} δευτερόλεπτα πριν να σας επιτραπεί να κάνετε μια άλλη προσπάθεια.', + + 'REGISTER' => 'Εγγραφή', + 'REGISTER_ME' => 'Θέλω να εγγραφώ', + 'REGISTRATION' => [ + 'BROKEN' => 'Λυπούμαστε, υπάρχει πρόβλημα στη διαδικασία εγγραφής στο λογαριασμό μας. Επικοινωνήστε απευθείας μαζί μας για βοήθεια.', + 'COMPLETE_TYPE1' => 'Έχετε εγγραφεί επιτυχώς, μπορείτε τώρα να συνδεθείτε.', + 'COMPLETE_TYPE2' => 'Έχετε εγγραφεί επιτυχώς. Ένας σύνδεσμος για την ενεργοποίηση του λογαριασμού σας έχει αποσταλεί στο {{email}} και δεν θα μπορείτε να συνδεθείτε μέχρι να ολοκληρώσετε αυτό το βήμα.', + 'DISABLED' => 'Λυπούμαστε, η εγγραφή λογαριασμών έχει απενεργοποιηθεί.', + 'LOGOUT' => 'Λυπούμαστε, δεν μπορείτε να εγγραφείτε για λογαριασμό ενώ είστε συνδεδεμένοι. Παρακαλώ αποσυνδεθείτε πρώτα.', + 'WELCOME' => 'Η εγγραφή είναι γρήγορη και απλή.', ], - "REMEMBER_ME" => "Να με θυμάσαι", - "REMEMBER_ME_ON_COMPUTER" => "Να με θυμάσαι σε αυτόν τον υπολογιστή (δεν συνιστάται για δημόσιους υπολογιστές)", - - "SIGN_IN_HERE" => "Έχετε ήδη λογαριασμό; Συνδεθείτε εδώ. ", - "SIGNIN" => "Σύνδεση", - "SIGNIN_OR_REGISTER" => "Σύνδεση ή εγγραφή", - "SIGNUP" => "Εγγραφή", - - "TOS" => "Όροι και Προϋποθέσεις", - "TOS_AGREEMENT" => "Με την εγγραφή ενός λογαριασμού στο {{site_title}}, αποδέχεστε τους όρους και προϋποθέσεις .", - "TOS_FOR" => "Όροι και προϋποθέσεις για {{title}}", - - "USERNAME" => [ - "@TRANSLATION" => "Όνομα χρήστη", - - "CHOOSE" => "Επιλέξτε ένα μοναδικό όνομα χρήστη", - "INVALID" => "Μη έγκυρο όνομα χρήστη", - "IN_USE" => "Το όνομα χρήστη {{user_name}} χρησιμοποιείται ήδη.", - "NOT_AVAILABLE" => "Το όνομα χρήστη {{user_name}} δεν είναι διαθέσιμο. Επιλέξτε ένα διαφορετικό όνομα ή κάντε κλικ στο κουμπί 'Πρόταση'." + 'REMEMBER_ME' => 'Να με θυμάσαι', + 'REMEMBER_ME_ON_COMPUTER' => 'Να με θυμάσαι σε αυτόν τον υπολογιστή (δεν συνιστάται για δημόσιους υπολογιστές)', + + 'SIGN_IN_HERE' => 'Έχετε ήδη λογαριασμό; Συνδεθείτε εδώ. ', + 'SIGNIN' => 'Σύνδεση', + 'SIGNIN_OR_REGISTER' => 'Σύνδεση ή εγγραφή', + 'SIGNUP' => 'Εγγραφή', + + 'TOS' => 'Όροι και Προϋποθέσεις', + 'TOS_AGREEMENT' => 'Με την εγγραφή ενός λογαριασμού στο {{site_title}}, αποδέχεστε τους όρους και προϋποθέσεις .', + 'TOS_FOR' => 'Όροι και προϋποθέσεις για {{title}}', + + 'USERNAME' => [ + '@TRANSLATION' => 'Όνομα χρήστη', + + 'CHOOSE' => 'Επιλέξτε ένα μοναδικό όνομα χρήστη', + 'INVALID' => 'Μη έγκυρο όνομα χρήστη', + 'IN_USE' => 'Το όνομα χρήστη {{user_name}} χρησιμοποιείται ήδη.', + 'NOT_AVAILABLE' => "Το όνομα χρήστη {{user_name}} δεν είναι διαθέσιμο. Επιλέξτε ένα διαφορετικό όνομα ή κάντε κλικ στο κουμπί 'Πρόταση'.", ], - - "USER_ID_INVALID" => "Το id χρήστη που ζητήθηκε δεν υπάρχει.", - "USER_OR_EMAIL_INVALID" => "Το όνομα χρήστη ή η διεύθυνση ηλεκτρονικού ταχυδρομείου δεν είναι έγκυρη.", - "USER_OR_PASS_INVALID" => "Ο χρήστης δεν βρέθηκε ή ο κωδικός πρόσβασης δεν είναι έγκυρος.", - - "WELCOME" => "Καλωσορίσατε ξανά, {{first_name}}" + + 'USER_ID_INVALID' => 'Το id χρήστη που ζητήθηκε δεν υπάρχει.', + 'USER_OR_EMAIL_INVALID' => 'Το όνομα χρήστη ή η διεύθυνση ηλεκτρονικού ταχυδρομείου δεν είναι έγκυρη.', + 'USER_OR_PASS_INVALID' => 'Ο χρήστης δεν βρέθηκε ή ο κωδικός πρόσβασης δεν είναι έγκυρος.', + + 'WELCOME' => 'Καλωσορίσατε ξανά, {{first_name}}', ]; diff --git a/app/sprinkles/account/locale/el/validate.php b/app/sprinkles/account/locale/el/validate.php index 2a8a79778..c857c1af6 100644 --- a/app/sprinkles/account/locale/el/validate.php +++ b/app/sprinkles/account/locale/el/validate.php @@ -1,20 +1,16 @@ [ - "PASSWORD_MISMATCH" => "Ο κωδικός πρόσβασής σας και ο κωδικός επιβεβαίωσης πρέπει να ταιριάζουν", - "USERNAME" => "Το όνομα χρήστη μπορεί να αποτελείται μόνο από πεζά γράμματα, αριθμούς, '.', '-', and '_'." - ] + 'VALIDATE' => [ + 'PASSWORD_MISMATCH' => 'Ο κωδικός πρόσβασής σας και ο κωδικός επιβεβαίωσης πρέπει να ταιριάζουν', + 'USERNAME' => "Το όνομα χρήστη μπορεί να αποτελείται μόνο από πεζά γράμματα, αριθμούς, '.', '-', and '_'.", + ], ]; diff --git a/app/sprinkles/account/locale/en_US/messages.php b/app/sprinkles/account/locale/en_US/messages.php index 998856f32..39637df49 100644 --- a/app/sprinkles/account/locale/en_US/messages.php +++ b/app/sprinkles/account/locale/en_US/messages.php @@ -1,5 +1,6 @@ [ '@TRANSLATION' => 'Your session has been compromised. You should log out on all devices, then log back in and make sure that your data has not been tampered with.', 'TITLE' => 'Your account may have been compromised', - 'TEXT' => 'Someone may have used your login information to acccess this page. For your safety, all sessions were logged out. Please log in and check your account for suspicious activity. You may also wish to change your password.' + 'TEXT' => 'Someone may have used your login information to acccess this page. For your safety, all sessions were logged out. Please log in and check your account for suspicious activity. You may also wish to change your password.', ], 'SESSION_EXPIRED' => 'Your session has expired. Please sign in again.', 'SETTINGS' => [ '@TRANSLATION' => 'Account settings', 'DESCRIPTION' => 'Update your account settings, including email, name, and password.', - 'UPDATED' => 'Account settings updated' + 'UPDATED' => 'Account settings updated', ], 'TOOLS' => 'Account tools', @@ -52,13 +53,13 @@ 'PAGE' => 'Resend the verification email for your new account.', 'SEND' => 'Email the verification link for my account', 'TOKEN_NOT_FOUND' => 'Verification token does not exist / Account is already verified', - ] + ], ], 'EMAIL' => [ 'INVALID' => 'There is no account for {{email}}.', 'IN_USE' => 'Email {{email}} is already in use.', - 'VERIFICATION_REQUIRED' => 'Email (verification required - use a real address!)' + 'VERIFICATION_REQUIRED' => 'Email (verification required - use a real address!)', ], 'EMAIL_OR_USERNAME' => 'Username or email address', @@ -70,13 +71,13 @@ 'LAST_NAME' => 'Last name', 'LOCALE' => [ 'ACCOUNT' => 'The language and locale to use for your account', - 'INVALID' => '{{locale}} is not a valid locale.' + 'INVALID' => '{{locale}} is not a valid locale.', ], 'LOGIN' => [ '@TRANSLATION' => 'Login', 'ALREADY_COMPLETE' => 'You are already logged in!', 'SOCIAL' => 'Or login with', - 'REQUIRED' => 'Sorry, you must be logged in to access this resource.' + 'REQUIRED' => 'Sorry, you must be logged in to access this resource.', ], 'LOGOUT' => 'Logout', @@ -89,7 +90,7 @@ 'DESCRIPTION' => 'Sign in to your {{site_name}} account, or register for a new account.', 'SUBTITLE' => 'Register for free, or sign in with an existing account.', 'TITLE' => "Let's get started!", - ] + ], ], 'PASSWORD' => [ @@ -105,7 +106,7 @@ 'CREATE' => [ '@TRANSLATION' => 'Create Password', 'PAGE' => 'Choose a password for your new account.', - 'SET' => 'Set Password and Sign In' + 'SET' => 'Set Password and Sign In', ], 'CURRENT' => 'Current Password', 'CURRENT_EXPLAIN' => 'You must confirm your current password to make changes', @@ -120,7 +121,7 @@ 'INVALID' => 'This password reset request could not be found, or has expired. Please try resubmitting your request.', 'PAGE' => 'Get a link to reset your password.', 'REQUEST_CANNED' => 'Lost password request cancelled.', - 'REQUEST_SENT' => 'If the email {{email}} matches an account in our system, a password reset link will be sent to {{email}}.' + 'REQUEST_SENT' => 'If the email {{email}} matches an account in our system, a password reset link will be sent to {{email}}.', ], 'HASH_FAILED' => 'Password hashing failed. Please contact a site administrator.', @@ -132,15 +133,15 @@ '@TRANSLATION' => 'Reset Password', 'CHOOSE' => 'Please choose a new password to continue.', 'PAGE' => 'Choose a new password for your account.', - 'SEND' => 'Set New Password and Sign In' + 'SEND' => 'Set New Password and Sign In', ], - 'UPDATED' => 'Account password updated' + 'UPDATED' => 'Account password updated', ], 'PROFILE' => [ 'SETTINGS' => 'Profile settings', - 'UPDATED' => 'Profile settings updated' + 'UPDATED' => 'Profile settings updated', ], 'RATE_LIMIT_EXCEEDED' => 'The rate limit for this action has been exceeded. You must wait another {{delay}} seconds before you will be allowed to make another attempt.', @@ -153,7 +154,7 @@ 'COMPLETE_TYPE2' => 'You have successfully registered. A link to activate your account has been sent to {{email}}. You will not be able to sign in until you complete this step.', 'DISABLED' => "We're sorry, account registration has been disabled.", 'LOGOUT' => "I'm sorry, you cannot register for an account while logged in. Please log out first.", - 'WELCOME' => 'Registration is fast and simple.' + 'WELCOME' => 'Registration is fast and simple.', ], 'REMEMBER_ME' => 'Keep me signed in', 'REMEMBER_ME_ON_COMPUTER' => 'Remember me on this computer (not recommended for public computers)', @@ -173,12 +174,12 @@ 'CHOOSE' => 'Choose a unique username', 'INVALID' => 'Invalid username', 'IN_USE' => 'Username {{user_name}} is already in use.', - 'NOT_AVAILABLE' => "Username {{user_name}} is not available. Choose a different name, or click 'suggest'." + 'NOT_AVAILABLE' => "Username {{user_name}} is not available. Choose a different name, or click 'suggest'.", ], 'USER_ID_INVALID' => 'The requested user id does not exist.', 'USER_OR_EMAIL_INVALID' => 'Username or email address is invalid.', 'USER_OR_PASS_INVALID' => 'User not found or password is invalid.', - 'WELCOME' => 'Welcome back, {{first_name}}' + 'WELCOME' => 'Welcome back, {{first_name}}', ]; diff --git a/app/sprinkles/account/locale/en_US/validate.php b/app/sprinkles/account/locale/en_US/validate.php index d91ef2a9f..317ec11b3 100644 --- a/app/sprinkles/account/locale/en_US/validate.php +++ b/app/sprinkles/account/locale/en_US/validate.php @@ -1,5 +1,6 @@ [ 'PASSWORD_MISMATCH' => 'Your password and confirmation password must match.', - 'USERNAME' => "Username may consist only of lowercase letters, numbers, '.', '-', and '_'." - ] + 'USERNAME' => "Username may consist only of lowercase letters, numbers, '.', '-', and '_'.", + ], ]; diff --git a/app/sprinkles/account/locale/es_ES/messages.php b/app/sprinkles/account/locale/es_ES/messages.php index 01503acc8..3bcdf77a2 100755 --- a/app/sprinkles/account/locale/es_ES/messages.php +++ b/app/sprinkles/account/locale/es_ES/messages.php @@ -1,5 +1,6 @@ [ '@TRANSLATION' => 'Tu sesión ha sido comprometida. Debes desconectarse de todos los dispositivos y, a continuación, volver a iniciar sesión y asegurarte de que sus datos no han sido manipulados.', 'TITLE' => 'Es posible que tu cuenta se haya visto comprometida.', - 'TEXT' => 'Alguien puede haber utilizado tu información de acceso para acceder a esta página. Para tu seguridad, todas las sesiones se cerraron. ingrese y comprueba si tu actividad es sospechosa en tu cuenta. También puedes cambiar su contraseña.' + 'TEXT' => 'Alguien puede haber utilizado tu información de acceso para acceder a esta página. Para tu seguridad, todas las sesiones se cerraron. ingrese y comprueba si tu actividad es sospechosa en tu cuenta. También puedes cambiar su contraseña.', ], 'SESSION_EXPIRED' => 'Tu sesión ha caducado. Inicie sesión nuevamente.', 'SETTINGS' => [ '@TRANSLATION' => 'Configuraciones de la cuenta', 'DESCRIPTION' => 'Actualiza la configuración de su cuenta, incluido el correo electrónico, el nombre y la contraseña.', - 'UPDATED' => 'Configuración de la cuenta actualizada' + 'UPDATED' => 'Configuración de la cuenta actualizada', ], 'TOOLS' => 'Herramientas de la cuenta', @@ -52,13 +53,13 @@ 'PAGE' => 'Vuelve a enviar el correo electrónico de verificación de tu nueva cuenta.', 'SEND' => 'Reenviar correo de verificación', 'TOKEN_NOT_FOUND' => 'El token de verificación no existe / La cuenta ya está verificada', - ] + ], ], 'EMAIL' => [ 'INVALID' => 'No hay cuenta para {{email}} .', 'IN_USE' => 'El correo electrónico {{email}} ya está en uso.', - 'VERIFICATION_REQUIRED' => 'Correo electrónico (se requiere verificación - ¡usa una dirección real!)' + 'VERIFICATION_REQUIRED' => 'Correo electrónico (se requiere verificación - ¡usa una dirección real!)', ], 'EMAIL_OR_USERNAME' => 'Nombre de usuario o dirección de correo electrónico', @@ -71,14 +72,14 @@ 'LOCALE' => [ 'ACCOUNT' => 'El idioma y la configuración regional para utilizar en tu cuenta', - 'INVALID' => '{{locale}} no es un idioma válido.' + 'INVALID' => '{{locale}} no es un idioma válido.', ], 'LOGIN' => [ '@TRANSLATION' => 'Acceder', 'ALREADY_COMPLETE' => '¡Ya te has autentificado!', 'SOCIAL' => 'O ingresa con', - 'REQUIRED' => 'Lo sentimos, debes iniciar sesión para acceder a este recurso.' + 'REQUIRED' => 'Lo sentimos, debes iniciar sesión para acceder a este recurso.', ], 'LOGOUT' => 'Cerrar sesión', @@ -92,7 +93,7 @@ 'DESCRIPTION' => 'Inicia sesión en tu cuenta de {{site_name}} o regístrate para obtener una nueva cuenta.', 'SUBTITLE' => 'Regístrate gratis o inicia sesión con una cuenta existente.', 'TITLE' => '¡Empecemos!', - ] + ], ], 'PASSWORD' => [ @@ -108,7 +109,7 @@ 'CREATE' => [ '@TRANSLATION' => 'Crear contraseña', 'PAGE' => 'Elije una contraseña para su nueva cuenta.', - 'SET' => 'Establecer contraseña e iniciar sesión' + 'SET' => 'Establecer contraseña e iniciar sesión', ], 'CURRENT' => 'Contraseña actual', 'CURRENT_EXPLAIN' => 'Debes confirmar tu contraseña actual para realizar cambios', @@ -123,26 +124,26 @@ 'INVALID' => 'No se pudo encontrar esta solicitud de restablecimiento de contraseña o ha caducado. Intenta volver a enviar tu solicitud .', 'PAGE' => 'Obtén un enlace para restablecer tu contraseña.', 'REQUEST_CANNED' => 'Se ha cancelado la solicitud de contraseña perdida.', - 'REQUEST_SENT' => 'Se ha enviado un enlace de restablecimiento de contraseña a {{email}} .' + 'REQUEST_SENT' => 'Se ha enviado un enlace de restablecimiento de contraseña a {{email}} .', ], 'RESET' => [ '@TRANSLATION' => 'Restablecer la contraseña', 'CHOOSE' => 'Por favor, elije una nueva contraseña para continuar.', 'PAGE' => 'Elige una nueva contraseña para tu cuenta.', - 'SEND' => 'Establecer nueva contraseña e iniciar sesión' + 'SEND' => 'Establecer nueva contraseña e iniciar sesión', ], 'HASH_FAILED' => 'El hash de la contraseña ha fallado. Ponte en contacto con un administrador del sitio.', 'INVALID' => 'La contraseña actual no coincide con la que tenemos registrada', 'NEW' => 'Nueva contraseña', 'NOTHING_TO_UPDATE' => 'No se puede actualizar con la misma contraseña', - 'UPDATED' => 'Contraseña de la cuenta actualizada' + 'UPDATED' => 'Contraseña de la cuenta actualizada', ], 'PROFILE' => [ 'SETTINGS' => 'Configuración de perfil', - 'UPDATED' => 'Configuración del perfil actualizada' + 'UPDATED' => 'Configuración del perfil actualizada', ], 'RATE_LIMIT_EXCEEDED' => 'Se ha superado el límite de velocidad para esta acción. Debe esperar otro {{delay}} segundos antes de que se le permita hacer otro intento.', @@ -155,7 +156,7 @@ 'COMPLETE_TYPE2' => 'Te has registrado exitosamente. Se ha enviado un enlace para activar tu cuenta a {{email}} . No podrás iniciar sesión hasta que complete este paso.', 'DISABLED' => 'Lo sentimos, el registro de cuenta se ha deshabilitado.', 'LOGOUT' => 'Lo siento, no puedes registrarte para una cuenta mientras está conectado. Por favor, cierra la sesión primero.', - 'WELCOME' => 'El registro es rápido y sencillo.' + 'WELCOME' => 'El registro es rápido y sencillo.', ], 'REMEMBER_ME' => '¡Recuérdame!', @@ -178,12 +179,12 @@ 'CHOOSE' => 'Elige un nombre de usuario único', 'INVALID' => 'Nombre de usuario no válido', 'IN_USE' => 'El nombre de usuario {{user_name}} ya está en uso.', - 'NOT_AVAILABLE' => 'El nombre de usuario {{user_name}} no está disponible. Elija otro nombre o haga clic en "sugerir".' + 'NOT_AVAILABLE' => 'El nombre de usuario {{user_name}} no está disponible. Elija otro nombre o haga clic en "sugerir".', ], 'USER_ID_INVALID' => 'El ID de usuario solicitado no existe.', 'USER_OR_EMAIL_INVALID' => 'El nombre de usuario o la dirección de correo electrónico no son válidos.', 'USER_OR_PASS_INVALID' => 'Usuario no encontrado o la contraseña no es válida.', - 'WELCOME' => 'Bienvenido de nuevo, {{first_name}}' + 'WELCOME' => 'Bienvenido de nuevo, {{first_name}}', ]; diff --git a/app/sprinkles/account/locale/es_ES/validate.php b/app/sprinkles/account/locale/es_ES/validate.php index 246034eff..07df3216f 100755 --- a/app/sprinkles/account/locale/es_ES/validate.php +++ b/app/sprinkles/account/locale/es_ES/validate.php @@ -1,5 +1,6 @@ [ 'PASSWORD_MISMATCH' => 'Tu contraseña y contraseña de confirmación deben coincidir.', - 'USERNAME' => "El nombre de usuario puede consistir sólo en letras minúsculas, números, '.', '-' y '_'." - ] + 'USERNAME' => "El nombre de usuario puede consistir sólo en letras minúsculas, números, '.', '-' y '_'.", + ], ]; diff --git a/app/sprinkles/account/locale/fa/messages.php b/app/sprinkles/account/locale/fa/messages.php index 0c2d8c789..9f84e483c 100644 --- a/app/sprinkles/account/locale/fa/messages.php +++ b/app/sprinkles/account/locale/fa/messages.php @@ -1,5 +1,6 @@ [ '@TRANSLATION' => 'تنظیمات حساب', 'DESCRIPTION' => 'اطلاعات حسابتان یعنی پست الکترونیکی،نام و گذرواژه خود را به روز رسانی کنید', - 'UPDATED' => 'تنظیمات حساب به روز رسانی شد' + 'UPDATED' => 'تنظیمات حساب به روز رسانی شد', ], 'TOOLS' => 'ابزار حساب', @@ -49,13 +50,13 @@ 'PAGE' => 'ارسال دوباره ایمیل فعال سازی برای حساب جدید شما', 'SEND' => 'ارسال ایمیل فعال سازی برای حساب کاربری', 'TOKEN_NOT_FOUND' => 'این حساب کاربری یا قبلا فعال شده است و یا کد فعال سازی موجود نیست.', - ] + ], ], 'EMAIL' => [ 'INVALID' => 'حساب کاربری با {{email}} ثبت نشده است.', 'IN_USE' => 'ایمیل {{email}} قبلا استفاده شده است', - 'VERIFICATION_REQUIRED' => 'آدرس پست الکترونیکی را بصورت صحیح وارد کنید' + 'VERIFICATION_REQUIRED' => 'آدرس پست الکترونیکی را بصورت صحیح وارد کنید', ], 'EMAIL_OR_USERNAME' => 'نام کاربری یا آدرس پست الکترونیکی', @@ -68,14 +69,14 @@ 'LOCALE' => [ 'ACCOUNT' => 'زبان انتخابی برای حساب شما', - 'INVALID' => '{{locale}} زبان صحیحی نیست' + 'INVALID' => '{{locale}} زبان صحیحی نیست', ], 'LOGIN' => [ '@TRANSLATION' => 'ورود', 'ALREADY_COMPLETE' => 'شما قبلا وارد شده اید.', 'SOCIAL' => 'یا با روش های زیر وارد شوید', - 'REQUIRED' => 'برای دیدن این صفحه لازم است که وارد شوید' + 'REQUIRED' => 'برای دیدن این صفحه لازم است که وارد شوید', ], 'LOGOUT' => 'خروج', @@ -89,7 +90,7 @@ 'DESCRIPTION' => 'به حساب کاربری خود در {{site_name}} وارد شوید و یا حساب کاربری جدیدی بسازید', 'SUBTITLE' => 'ثبت نام کنید و یا با حساب کاربری خود وارد شوید', 'TITLE' => 'بیایید شروع کنیم!', - ] + ], ], 'PASSWORD' => [ @@ -115,26 +116,26 @@ 'INVALID' => 'درخواست بازیابی کذرواژه پیدا نشد و یا منقضی شده است. لطفا درخواست را دوباره ارسال کنید', 'PAGE' => 'دریافت لینک بازیابی گذرواژه', 'REQUEST_CANNED' => 'درخواست فراموشی گذرواژه، حذف شد.', - 'REQUEST_SENT' => 'ایمیل بازیابی گذرواژه به {{email}} ارسال شد.' + 'REQUEST_SENT' => 'ایمیل بازیابی گذرواژه به {{email}} ارسال شد.', ], 'RESET' => [ '@TRANSLATION' => 'تغییر گذرواژه', 'CHOOSE' => 'لطفا گذرواژه جدید را انتخاب کنید', 'PAGE' => 'برای حساب خود، گذرواژه جدیدی انتخاب کنید.', - 'SEND' => 'گذرواژه جدید را انتخاب کرده و وارد شوید' + 'SEND' => 'گذرواژه جدید را انتخاب کرده و وارد شوید', ], 'HASH_FAILED' => 'هشینگ گذرواژه با مشکل روبرو شد. لطفا با مسولین وب سایت تماس برقرار کنید', 'INVALID' => 'گذرواژه فعلی درست وارد نشده است', 'NEW' => 'گذرواژه جدید', 'NOTHING_TO_UPDATE' => 'شما نمیتوانید همان گذرواژه را دوباره وارد کنید', - 'UPDATED' => 'گذرواژه به روز رسانی شد' + 'UPDATED' => 'گذرواژه به روز رسانی شد', ], 'PROFILE' => [ 'SETTINGS' => 'تنظیمات شخصی حساب', - 'UPDATED' => 'تنظیمات شخصی حساب به روز رسانی شد' + 'UPDATED' => 'تنظیمات شخصی حساب به روز رسانی شد', ], 'REGISTER' => 'ثبت نام', @@ -146,7 +147,7 @@ 'COMPLETE_TYPE2' => 'شما با موفقیت ثبت نام کردید. لینک فعال سازی حساب به آدرس پست الکترونیکیتان {{email}} ارسال شد. بدون فعال سازی نمیتوانید وارد شوید.', 'DISABLED' => 'با عرض تاسف، امکان ثبت در وب سایت، غیر فعال شده است.', 'LOGOUT' => 'شما همزمان این که وارد شده اید نمیتوانید حساب کاربری جدیدی بسازید. لطفا ابتدا خارج شوید.', - 'WELCOME' => 'سریع و ساده ثبت نام کنید' + 'WELCOME' => 'سریع و ساده ثبت نام کنید', ], 'RATE_LIMIT_EXCEEDED' => 'شما محدودیت تعداد انجام این کار را پشت سر گذاشتید. لطفا {{delay}} ثانیه دیگر صبر کرده و دوباره تلاش کنید.', @@ -167,12 +168,12 @@ 'CHOOSE' => 'یک نام کاربری منحصر به فرد انتخاب کنید', 'INVALID' => 'نام کاربری معتبر نیست', 'IN_USE' => 'نام کاربری {{user_name}} قبلا استفاده شده است', - 'NOT_AVAILABLE' => 'نام کاربری {{user_name}} موجود نیست. لطفا نام کاربری دیگری انتخاب کنید' + 'NOT_AVAILABLE' => 'نام کاربری {{user_name}} موجود نیست. لطفا نام کاربری دیگری انتخاب کنید', ], 'USER_ID_INVALID' => 'آی دی کاربری مد نظر شما موجود نیست', 'USER_OR_EMAIL_INVALID' => 'نام کاربری و یا آدرس پست الکترونیکی معتبر نیست', 'USER_OR_PASS_INVALID' => 'کاربری یافت نشد و یا گذرواژه صحیح نیست', - 'WELCOME' => 'خوش آمدید {{first_name}}' + 'WELCOME' => 'خوش آمدید {{first_name}}', ]; diff --git a/app/sprinkles/account/locale/fa/validate.php b/app/sprinkles/account/locale/fa/validate.php index 84afbec53..4b91c6907 100644 --- a/app/sprinkles/account/locale/fa/validate.php +++ b/app/sprinkles/account/locale/fa/validate.php @@ -1,5 +1,6 @@ [ 'PASSWORD_MISMATCH' => 'گذرواژه و تکرار آن باید با یکدیگر تطبیق پیدا کنند', - 'USERNAME' => "نام کاربری فقط میتواند از حروف کوچک، اعداد، '.'، '-' و '_' متشکل شوند." - ] + 'USERNAME' => "نام کاربری فقط میتواند از حروف کوچک، اعداد، '.'، '-' و '_' متشکل شوند.", + ], ]; diff --git a/app/sprinkles/account/locale/fr_FR/messages.php b/app/sprinkles/account/locale/fr_FR/messages.php index 5af63230f..81fee0e85 100644 --- a/app/sprinkles/account/locale/fr_FR/messages.php +++ b/app/sprinkles/account/locale/fr_FR/messages.php @@ -1,5 +1,6 @@ [ '@TRANSLATION' => "Votre session a été compromise. Vous devez vous déconnecter de tous les périphériques, puis vous reconnecter et vous assurer que vos données n'ont pas été altérées.", - 'TITLE' => 'Votre compte peut avoir été compromis' + 'TITLE' => 'Votre compte peut avoir été compromis', ], 'SESSION_EXPIRED' => 'Votre session a expiré. Veuillez vous connecter à nouveau.', 'SETTINGS' => [ '@TRANSLATION' => 'Paramètres du compte', 'DESCRIPTION' => 'Mettez à jour les paramètres de votre compte, y compris votre adresse e-mail, votre nom et votre mot de passe.', - 'UPDATED' => 'Paramètres du compte mis à jour' + 'UPDATED' => 'Paramètres du compte mis à jour', ], 'TOOLS' => 'Outils du compte', @@ -51,13 +52,13 @@ 'PAGE' => "Renvoyer l'email de validation de votre nouveau compte.", 'SEND' => 'Envoyer le lien de validation de mon compte', 'TOKEN_NOT_FOUND' => "Le jeton de vérification n'existe pas / Le compte est déjà vérifié", - ] + ], ], 'EMAIL' => [ 'INVALID' => "Il n'y a aucun compte pour {{email}}.", 'IN_USE' => 'Le email {{email}} est déjà utilisé.', - 'VERIFICATION_REQUIRED' => 'Email (vérification requise - utiliser une adresse réelle!)' + 'VERIFICATION_REQUIRED' => 'Email (vérification requise - utiliser une adresse réelle!)', ], 'EMAIL_OR_USERNAME' => "Nom d'utilisateur ou adresse email", @@ -70,14 +71,14 @@ 'LOCALE' => [ 'ACCOUNT' => "La langue utilisé pour votre compte d'utilisateur", - 'INVALID' => "{{locale}} n'est pas une langue valide." + 'INVALID' => "{{locale}} n'est pas une langue valide.", ], 'LOGIN' => [ '@TRANSLATION' => 'Connexion', 'ALREADY_COMPLETE' => 'Vous êtes déjà connecté!', 'SOCIAL' => 'Ou se connecter avec', - 'REQUIRED' => 'Désolé, vous devez être connecté pour accéder à cette ressource.' + 'REQUIRED' => 'Désolé, vous devez être connecté pour accéder à cette ressource.', ], 'LOGOUT' => 'Déconnexion', @@ -91,7 +92,7 @@ 'DESCRIPTION' => 'Connectez-vous à votre compte {{site_name}} ou enregistrez-vous pour un nouveau compte.', 'SUBTITLE' => 'Inscrivez-vous gratuitement ou connectez-vous avec un compte existant.', 'TITLE' => 'Commençons!', - ] + ], ], 'PASSWORD' => [ @@ -117,26 +118,26 @@ 'INVALID' => "Cette requête de réinitialisation de mot de passe n'a pas pu être trouvée ou a expiré. Veuillez réessayer de soumettre votre demande .", 'PAGE' => 'Obtenir un lien pour réinitialiser votre mot de passe.', 'REQUEST_CANNED' => 'Demande de mot de passe perdu annulée.', - 'REQUEST_SENT' => "Si l'adresse e-mail {{email}} correspond à un compte dans notre système, un lien de réinitialisation de mot de passe sera envoyé à {{email}}." + 'REQUEST_SENT' => "Si l'adresse e-mail {{email}} correspond à un compte dans notre système, un lien de réinitialisation de mot de passe sera envoyé à {{email}}.", ], 'RESET' => [ '@TRANSLATION' => 'Réinitialiser le mot de passe', 'CHOOSE' => 'Veuillez choisir un nouveau mot de passe pour continuer.', 'PAGE' => 'Choisissez un nouveau mot de passe pour votre compte.', - 'SEND' => 'Définir un nouveau mot de passe' + 'SEND' => 'Définir un nouveau mot de passe', ], 'HASH_FAILED' => 'Le hachage du mot de passe a échoué. Veuillez contacter un administrateur de site.', 'INVALID' => 'Le mot de passe actuel ne correspond pas à celui que nous avons au dossier', 'NEW' => 'Nouveau mot de passe', 'NOTHING_TO_UPDATE' => 'Vous ne pouvez pas mettre à jour avec le même mot de passe', - 'UPDATED' => 'Mot de passe du compte mis à jour' + 'UPDATED' => 'Mot de passe du compte mis à jour', ], 'PROFILE' => [ 'SETTINGS' => 'Paramètres du profil', - 'UPDATED' => 'Paramètres du profil mis à jour' + 'UPDATED' => 'Paramètres du profil mis à jour', ], 'REGISTER' => "S'inscrire", @@ -148,7 +149,7 @@ 'COMPLETE_TYPE2' => "Vous êtes inscrit avec succès. Vous recevrez bientôt un e-mail de validation contenant un lien pour activer votre compte. Vous ne pourrez pas vous connecter avant d'avoir terminé cette étape.", 'DISABLED' => "Désolé, l'enregistrement de compte a été désactivé.", 'LOGOUT' => 'Désolé, vous ne pouvez pas vous inscrire tout en étant connecté. Veuillez vous déconnecter en premier.', - 'WELCOME' => "L'inscription est rapide et simple." + 'WELCOME' => "L'inscription est rapide et simple.", ], 'RATE_LIMIT_EXCEEDED' => 'La limite de tentatives pour cette action a été dépassée. Vous devez attendre {{delay}} secondes avant de pouvoir effectuer une autre tentative.', @@ -169,12 +170,12 @@ 'CHOOSE' => "Choisissez un nom d'utilisateur unique", 'INVALID' => "Nom d'utilisateur invalide", 'IN_USE' => "Le nom d'utilisateur '{{username}}' est déjà utilisé.", - 'NOT_AVAILABLE' => "Le nom d'utilisateur {{user_name}} n'est pas disponible. Choisissez un autre nom, ou cliquez sur « suggérer »." + 'NOT_AVAILABLE' => "Le nom d'utilisateur {{user_name}} n'est pas disponible. Choisissez un autre nom, ou cliquez sur « suggérer ».", ], 'USER_ID_INVALID' => "L'identifiant d'utilisateur demandé n'existe pas.", 'USER_OR_EMAIL_INVALID' => "Nom d'utilisateur ou adresse e-mail non valide.", 'USER_OR_PASS_INVALID' => "Nom d'utilisateur ou mot de passe incorrect.", - 'WELCOME' => 'Bienvenue {{first_name}}' + 'WELCOME' => 'Bienvenue {{first_name}}', ]; diff --git a/app/sprinkles/account/locale/fr_FR/validate.php b/app/sprinkles/account/locale/fr_FR/validate.php index 395995a2b..0d2367d76 100644 --- a/app/sprinkles/account/locale/fr_FR/validate.php +++ b/app/sprinkles/account/locale/fr_FR/validate.php @@ -1,5 +1,6 @@ [ - 'PASSWORD_MISMATCH' => 'Votre mot de passe et votre mot de passe de confirmation doivent correspondre.' - ] + 'PASSWORD_MISMATCH' => 'Votre mot de passe et votre mot de passe de confirmation doivent correspondre.', + ], ]; diff --git a/app/sprinkles/account/locale/it_IT/messages.php b/app/sprinkles/account/locale/it_IT/messages.php index 55c7b8c6c..c3ec1a627 100644 --- a/app/sprinkles/account/locale/it_IT/messages.php +++ b/app/sprinkles/account/locale/it_IT/messages.php @@ -1,5 +1,6 @@ [ '@TRANSLATION' => 'La tua sessione è stata compromessa. Devi eseguire il logout su tutti i dispositivi, quindi accedere nuovamente e assicurarti che i tuoi dati non siano stati manomessi.', 'TITLE' => 'Il tuo account potrebbe essere stato compromesso', - 'TEXT' => "Qualcuno potrebbe aver utilizzato le tue informazioni di accesso per accedere a questa pagina. Per la tua sicurezza tutte le sessioni sono state disconnesse. Accedi e controlla l'account per attività sospette. Potresti anche voler cambiare la password." + 'TEXT' => "Qualcuno potrebbe aver utilizzato le tue informazioni di accesso per accedere a questa pagina. Per la tua sicurezza tutte le sessioni sono state disconnesse. Accedi e controlla l'account per attività sospette. Potresti anche voler cambiare la password.", ], 'SESSION_EXPIRED' => 'La tua sessione è scaduta. Accedi nuovamente.', 'SETTINGS' => [ '@TRANSLATION' => 'Impostazioni account', 'DESCRIPTION' => 'Aggiorna le impostazioni del tuo account, tra cui email, nome e password.', - 'UPDATED' => 'Impostazioni account aggiornate' + 'UPDATED' => 'Impostazioni account aggiornate', ], 'TOOLS' => 'Strumenti account', @@ -53,14 +54,14 @@ 'EMAIL' => "Inserisci l'indirizzo email che hai utilizzato per registrarti e la tua email di verifica sarà inviata nuovamente.", 'PAGE' => "Invia nuovamente l'email di verifica per il tuo nuovo account.", 'SEND' => 'Invia il collegamento di verifica per il mio account', - 'TOKEN_NOT_FOUND' => "Il token non esiste / l'account è già stato attivato" - ] + 'TOKEN_NOT_FOUND' => "Il token non esiste / l'account è già stato attivato", + ], ], 'EMAIL' => [ 'INVALID' => 'Non esiste alcun account per {{email}}.', 'IN_USE' => "L'email '{{email}}' è già in uso", - 'VERIFICATION_REQUIRED' => 'Email (verifica richiesta - utilizza un indirizzo reale!)' + 'VERIFICATION_REQUIRED' => 'Email (verifica richiesta - utilizza un indirizzo reale!)', ], 'EMAIL_OR_USERNAME' => 'Nome utente o Indirizzo Email', @@ -79,7 +80,7 @@ '@TRANSLATION' => 'Accesso', 'ALREADY_COMPLETE' => "Hai già eseguito l'accesso!", 'SOCIAL' => 'O accedi con', - 'REQUIRED' => "Devi eseguire l'accesso per accedere a questa risorsa" + 'REQUIRED' => "Devi eseguire l'accesso per accedere a questa risorsa", ], 'LOGOUT' => 'Esci', @@ -92,7 +93,7 @@ 'DESCRIPTION' => 'Accedi al tuo account {{site_name}} o iscriviti per un nuovo account.', 'SUBTITLE' => 'Registrati gratuitamente o accedi con un account esistente.', 'TITLE' => 'Iniziamo!', - ] + ], ], 'PASSWORD' => [ @@ -108,7 +109,7 @@ 'CREATE' => [ '@TRANSLATION' => 'Crea password', 'PAGE' => 'Scegli una password per il tuo nuovo account.', - 'SET' => 'Imposta password e accedi' + 'SET' => 'Imposta password e accedi', ], 'CURRENT' => 'Password attuale', 'CURRENT_EXPLAIN' => 'Devi confermare la tua password corrente per apportare modifiche', @@ -123,7 +124,7 @@ 'INVALID' => 'Questa richiesta di ripristino della password non è stata trovata o è scaduta. Prova a reinviare la tua richiesta.', 'PAGE' => 'Ottieni un collegamento per reimpostare la tua password.', 'REQUEST_CANNED' => 'Richiesta di recupero password annullata.', - 'REQUEST_SENT' => "Se l'email {{email}} corrisponde a un account, verrà inviato un collegamento per la reimpostazione della password a {{email}}." + 'REQUEST_SENT' => "Se l'email {{email}} corrisponde a un account, verrà inviato un collegamento per la reimpostazione della password a {{email}}.", ], 'HASH_FAILED' => "Hash della password fallito. Contatta l'amministratore di sistema.", @@ -135,15 +136,15 @@ '@TRANSLATION' => 'Reimposta la Password', 'CHOOSE' => 'Inserisci la tua nuova password', 'PAGE' => 'Scegli una nuova password per il tuo account.', - 'SEND' => 'Imposta nuova password e accedi' + 'SEND' => 'Imposta nuova password e accedi', ], - 'UPDATED' => 'Password aggiornata' + 'UPDATED' => 'Password aggiornata', ], 'PROFILE' => [ 'SETTINGS' => 'Impostazioni profilo', - 'UPDATED' => 'Impostazioni profilo aggiornate' + 'UPDATED' => 'Impostazioni profilo aggiornate', ], 'RATE_LIMIT_EXCEEDED' => 'Il limite di esecuzioni per questa azione è stato superato. Devi aspettare altri {{delay}} secondi prima che tu possa fare un altro tentativo.', @@ -155,7 +156,7 @@ 'COMPLETE_TYPE2' => "Registrazione effettuata con successo. Riceverai presto una mail a {{email}} per l'attivazione. Devi attivare il tuo account prima di eseguire il login.", 'DISABLED' => 'La registrazione di nuovi account è limitata', 'LOGOUT' => "Non è possibile registrare un account mentre hai eseguito l'accesso ad un altro account", - 'WELCOME' => 'La registrazione è semplice e veloce' + 'WELCOME' => 'La registrazione è semplice e veloce', ], 'REMEMBER_ME' => 'Ricordami', 'REMEMBER_ME_ON_COMPUTER' => 'Ricordami su questo dispositivo (non consigliato per i computer pubblici)', @@ -175,12 +176,12 @@ 'CHOOSE' => 'Inserisci il tuo nome utente', 'INVALID' => 'Nome utente non valido', 'IN_USE' => "Il nome utente '{{user_name}}' è già in uso", - 'NOT_AVAILABLE' => 'Il nome utente {{user_name}} non è disponibile. Scegli un nome diverso, oppure fai clic su "suggerisci".' + 'NOT_AVAILABLE' => 'Il nome utente {{user_name}} non è disponibile. Scegli un nome diverso, oppure fai clic su "suggerisci".', ], 'USER_ID_INVALID' => 'Questo ID utente non esiste', 'USER_OR_EMAIL_INVALID' => "L'indirizzo mail o il nome utente non sono validi", 'USER_OR_PASS_INVALID' => 'Il nome utente o la password non sono validi', - 'WELCOME' => 'Bentornato, {{first_name}}' + 'WELCOME' => 'Bentornato, {{first_name}}', ]; diff --git a/app/sprinkles/account/locale/it_IT/validate.php b/app/sprinkles/account/locale/it_IT/validate.php index 7ee338b2a..63f002661 100644 --- a/app/sprinkles/account/locale/it_IT/validate.php +++ b/app/sprinkles/account/locale/it_IT/validate.php @@ -1,5 +1,6 @@ [ 'PASSWORD_MISMATCH' => 'I due campi devono combaciare', - 'USERNAME' => "Il nome utente può essere composto solo da caratteri alfanumerici, '.', '-', e '_'." - ] + 'USERNAME' => "Il nome utente può essere composto solo da caratteri alfanumerici, '.', '-', e '_'.", + ], ]; diff --git a/app/sprinkles/account/locale/pt_PT/messages.php b/app/sprinkles/account/locale/pt_PT/messages.php index d3fa04f91..bc902da40 100644 --- a/app/sprinkles/account/locale/pt_PT/messages.php +++ b/app/sprinkles/account/locale/pt_PT/messages.php @@ -1,5 +1,6 @@ [ '@TRANSLATION' => 'A sua sessão foi comprometida. Deverá fechar todas as sessões, voltar a iniciar sessão e verificar que os seus dados não foram alterados por alheios.', - 'TITLE' => 'A sua sessão pode ter sido comprometida' + 'TITLE' => 'A sua sessão pode ter sido comprometida', ], 'SESSION_EXPIRED' => 'A sua sessão expirou. Por favor inicie nova sessão.', 'SETTINGS' => [ '@TRANSLATION' => 'Definições de conta', 'DESCRIPTION' => 'Atualize as suas definições, incluindo email, nome e password.', - 'UPDATED' => 'Definições de conta atualizadas' + 'UPDATED' => 'Definições de conta atualizadas', ], 'TOOLS' => 'Ferramentas de conta', @@ -51,12 +52,12 @@ 'PAGE' => 'Reenviar email de verificação para a sua nova conta.', 'SEND' => 'Enviar email com link de verificação', 'TOKEN_NOT_FOUND' => 'Token de verificação inexistente / Conta já verificada', - ] + ], ], 'EMAIL' => [ 'INVALID' => 'Não existe nenhuma conta para {{email}}.', - 'IN_USE' => 'O email {{email}} já se encontra em uso.' + 'IN_USE' => 'O email {{email}} já se encontra em uso.', ], 'FIRST_NAME' => 'Primeiro nome', @@ -72,7 +73,7 @@ 'ALREADY_COMPLETE' => 'Sessão já iniciada!', 'SOCIAL' => 'Ou inicie sessão com', - 'REQUIRED' => 'Lamentamos, tem de iniciar sessão para aceder a este recurso.' + 'REQUIRED' => 'Lamentamos, tem de iniciar sessão para aceder a este recurso.', ], 'LOGOUT' => 'Sair', @@ -84,7 +85,7 @@ 'DESCRIPTION' => 'Inicie sessão na sua conta {{site_name}}, ou registre-se para uma nova conta.', 'SUBTITLE' => 'Registre-se gratuitamente, ou inicie sessão com uma conta existente.', 'TITLE' => 'Vamos começar!', - ] + ], ], 'PASSWORD' => [ @@ -110,21 +111,21 @@ 'INVALID' => 'This password reset request could not be found, or has expired. Please try resubmitting your request.', 'PAGE' => 'Obtenha um link para fazer reset à sua password.', 'REQUEST_CANNED' => 'Pedido de password esquecida foi cancelado.', - 'REQUEST_SENT' => 'Se o email {{email}} corresponder a uma conta em nosso sistema, um link de redefinição de senha será enviado para {{email}}.' + 'REQUEST_SENT' => 'Se o email {{email}} corresponder a uma conta em nosso sistema, um link de redefinição de senha será enviado para {{email}}.', ], 'RESET' => [ '@TRANSLATION' => 'Reset Password', 'CHOOSE' => 'Por favor escolha uma nova password para continuar.', 'PAGE' => 'Escolha uma nova password para a sua conta.', - 'SEND' => 'Definir nova password e registrar' + 'SEND' => 'Definir nova password e registrar', ], 'HASH_FAILED' => 'Falhou o hashing da password. Por favor contacte um administrador do site.', 'INVALID' => 'A password atual não coincide com a que temos em sistema', 'NEW' => 'Nova Password', 'NOTHING_TO_UPDATE' => 'Não pode atualizar para a mesma password', - 'UPDATED' => 'Password da conta foi atualizada' + 'UPDATED' => 'Password da conta foi atualizada', ], 'REGISTER' => 'Registrar', @@ -136,7 +137,7 @@ 'COMPLETE_TYPE2' => 'Registrou-se com sucesso. Receberá em breve um email de verificação contendo um link para verificar a sua conta. Não será possível iniciar sessão até completar este passo.', 'DISABLED' => 'Lamentamos, o registro de novas contas foi desativado.', 'LOGOUT' => 'Não pode registrar uma nova conta enquanto tiver sessão iniciada. Por favor feche a sua sessão primeiro.', - 'WELCOME' => 'O registro é rápido e simples.' + 'WELCOME' => 'O registro é rápido e simples.', ], 'RATE_LIMIT_EXCEEDED' => 'Excedeu o número de tentativas para esta ação. Tem de aguardar {{delay}} segundos até lhe ser permitida nova tentativa.', @@ -156,12 +157,12 @@ 'CHOOSE' => 'Escolha um nome de utilizador único', 'INVALID' => 'Nome de utilizador inválido', - 'IN_USE' => 'O nome de utilizador {{user_name}} já se encontra em uso.' + 'IN_USE' => 'O nome de utilizador {{user_name}} já se encontra em uso.', ], 'USER_ID_INVALID' => 'O id de utilizador solicitado não existe.', 'USER_OR_EMAIL_INVALID' => 'Nome de utilizador ou endereço de email inválidos.', 'USER_OR_PASS_INVALID' => 'Nome de utilizador ou password inválidos.', - 'WELCOME' => 'Bem-vindo, {{first_name}}' + 'WELCOME' => 'Bem-vindo, {{first_name}}', ]; diff --git a/app/sprinkles/account/locale/pt_PT/validate.php b/app/sprinkles/account/locale/pt_PT/validate.php index f0a3eb0a1..4b8b43f64 100644 --- a/app/sprinkles/account/locale/pt_PT/validate.php +++ b/app/sprinkles/account/locale/pt_PT/validate.php @@ -1,5 +1,6 @@ [ - 'PASSWORD_MISMATCH' => 'A password e respetiva confirmação têm de coincidir.' - ] + 'PASSWORD_MISMATCH' => 'A password e respetiva confirmação têm de coincidir.', + ], ]; diff --git a/app/sprinkles/account/locale/ru_RU/messages.php b/app/sprinkles/account/locale/ru_RU/messages.php index 1111bf249..4312892f4 100644 --- a/app/sprinkles/account/locale/ru_RU/messages.php +++ b/app/sprinkles/account/locale/ru_RU/messages.php @@ -1,5 +1,6 @@ [ '@TRANSLATION' => 'Ваша сессия была скомпрометирована. Вы должны выйти на всех устройствах, а затем снова войти и убедиться, что ваши данные не были изменены.', 'TITLE' => 'Возможно, ваш аккаунт был скомпрометированн', - 'TEXT' => 'Возможно, кто-то использовал ваши данные для входа на эту страницу. В целях безопасности все сеансы были завершены. Пожалуйста, повторно войдите и проверьте свой аккаунт на подозрительную активность. Рекомендуем сменить пароль.' + 'TEXT' => 'Возможно, кто-то использовал ваши данные для входа на эту страницу. В целях безопасности все сеансы были завершены. Пожалуйста, повторно войдите и проверьте свой аккаунт на подозрительную активность. Рекомендуем сменить пароль.', ], 'SESSION_EXPIRED' => 'Срок вашей сессии истек. Пожалуйста войдите еще раз.', 'SETTINGS' => [ '@TRANSLATION' => 'Настройки аккаунта', 'DESCRIPTION' => 'Обновите настройки своего аккаунта, включая адрес электронной почты, имя и пароль.', - 'UPDATED' => 'Данные аккаунта обновлены' + 'UPDATED' => 'Данные аккаунта обновлены', ], 'TOOLS' => 'Инструменты аккаунта', @@ -52,13 +53,13 @@ 'PAGE' => 'Повторно оправить письмо подтверждения на email для нового аккаунта.', 'SEND' => 'Проверка по электронной почте для аккаунта', 'TOKEN_NOT_FOUND' => 'Код подтверждения не действителен либо аккаунт уже подтверждён', - ] + ], ], 'EMAIL' => [ 'INVALID' => 'Нет не одного аккаунта с {{email}} .', 'IN_USE' => 'Email {{email}} уже используется.', - 'VERIFICATION_REQUIRED' => 'Email (указывайте верный - необходим для активации!)' + 'VERIFICATION_REQUIRED' => 'Email (указывайте верный - необходим для активации!)', ], 'EMAIL_OR_USERNAME' => 'Имя пользователя или Email', @@ -70,13 +71,13 @@ 'LAST_NAME' => 'Фамилия', 'LOCALE' => [ 'ACCOUNT' => 'Основной язык для вашего аккаунта', - 'INVALID' => '{{locale}} язык недопустим.' + 'INVALID' => '{{locale}} язык недопустим.', ], 'LOGIN' => [ '@TRANSLATION' => 'Вход', 'ALREADY_COMPLETE' => 'Вы уже выполнили вход!', 'SOCIAL' => 'Или войти через', - 'REQUIRED' => 'Извините, Вы должны авторизоваться для доступа к этому ресурсу.' + 'REQUIRED' => 'Извините, Вы должны авторизоваться для доступа к этому ресурсу.', ], 'LOGOUT' => 'Выход', @@ -89,7 +90,7 @@ 'DESCRIPTION' => 'Войдите в свой аккаунт {{site_name}}, или Зарегистрируйтесь.', 'SUBTITLE' => 'Зарегистрироваться или войти в существующий аккаунт.', 'TITLE' => 'Приступим!', - ] + ], ], 'PASSWORD' => [ @@ -105,7 +106,7 @@ 'CREATE' => [ '@TRANSLATION' => 'Создать пароль', 'PAGE' => 'Выберите пароль для вашего аккаунта.', - 'SET' => 'Установить пароль и войти' + 'SET' => 'Установить пароль и войти', ], 'CURRENT' => 'Текущий пароль', 'CURRENT_EXPLAIN' => 'Для продолжения вы должны ввести текущий пароль', @@ -120,7 +121,7 @@ 'INVALID' => 'Этот запрос сброса пароля не может быть найден, или истек. Пожалуйста, попробуйте повторно сбросить пароль.', 'PAGE' => 'Получите ссылку для сброса пароля.', 'REQUEST_CANNED' => 'Запрос на сброс пароля отменен.', - 'REQUEST_SENT' => 'Если email {{email}} существует в нашей системе у какого-либо аккаунта, ссылка на сброс пароля будет направлена на {{email}}.' + 'REQUEST_SENT' => 'Если email {{email}} существует в нашей системе у какого-либо аккаунта, ссылка на сброс пароля будет направлена на {{email}}.', ], 'HASH_FAILED' => 'Хэширование пароля не удалось. Пожалуйста, попробуйте другой пароль, либо свяжитесь с администратором сайта.', @@ -132,15 +133,15 @@ '@TRANSLATION' => 'Сбросить пароль', 'CHOOSE' => 'Пожалуйста, выберите новый пароль, чтобы продолжить.', 'PAGE' => 'Выберите новый пароль для вашего аккаунта.', - 'SEND' => 'Задать новый пароль и войти' + 'SEND' => 'Задать новый пароль и войти', ], - 'UPDATED' => 'Пароль аккаунта обновлён' + 'UPDATED' => 'Пароль аккаунта обновлён', ], 'PROFILE' => [ 'SETTINGS' => 'Настройки профиля', - 'UPDATED' => 'Настройки профиля обновлены' + 'UPDATED' => 'Настройки профиля обновлены', ], 'RATE_LIMIT_EXCEEDED' => 'Превышен лимит попыток для этого действия. Вы должны подождать еще {{delay}} секунд, прежде чем вам вам будет разрешено сделать ещё попытку.', @@ -153,7 +154,7 @@ 'COMPLETE_TYPE2' => 'Вы успешно зарегистрировались. Ссылка для активации вашего аккаунта была отправлена на {{email}}. Вы сможете войти в систему только после активации аккаунта.', 'DISABLED' => 'Извините, регистрация аккаунта была отключена.', 'LOGOUT' => 'Извините, вы не можете зарегистрироваться когда уже авторизовались в системе. Сначала выйдите из системы.', - 'WELCOME' => 'Быстрая и простая регистрация.' + 'WELCOME' => 'Быстрая и простая регистрация.', ], 'REMEMBER_ME' => 'Запомнить', 'REMEMBER_ME_ON_COMPUTER' => 'Запомнить меня на этом компьютере (не рекомендуется для общедоступных компьютеров)', @@ -173,12 +174,12 @@ 'CHOOSE' => 'Выберите имя пользователя', 'INVALID' => 'Недопустимое имя пользователя', 'IN_USE' => '{{user_name}} имя пользователя уже используется.', - 'NOT_AVAILABLE' => 'Имя пользователя {{user_name}} не доступно. Выберите другое имя или нажмите кнопку «предложить».' + 'NOT_AVAILABLE' => 'Имя пользователя {{user_name}} не доступно. Выберите другое имя или нажмите кнопку «предложить».', ], 'USER_ID_INVALID' => 'ID запрашиваемого пользователя не существует.', 'USER_OR_EMAIL_INVALID' => 'Имя пользователя или email не верный.', 'USER_OR_PASS_INVALID' => 'Пользователь не найден или пароль является недействительным.', - 'WELCOME' => 'Добро пожаловать, {{first_name}}' + 'WELCOME' => 'Добро пожаловать, {{first_name}}', ]; diff --git a/app/sprinkles/account/locale/ru_RU/validate.php b/app/sprinkles/account/locale/ru_RU/validate.php index 0d74fff6f..1b8cc78f6 100644 --- a/app/sprinkles/account/locale/ru_RU/validate.php +++ b/app/sprinkles/account/locale/ru_RU/validate.php @@ -1,5 +1,6 @@ [ 'PASSWORD_MISMATCH' => 'Пароли не совпадают.', - 'USERNAME' => "Имя может состоять только из строчных букв, цифр, '.', '-' и «_»." - ] + 'USERNAME' => "Имя может состоять только из строчных букв, цифр, '.', '-' и «_».", + ], ]; diff --git a/app/sprinkles/account/locale/th_TH/messages.php b/app/sprinkles/account/locale/th_TH/messages.php index 7a301c096..f4e592e85 100644 --- a/app/sprinkles/account/locale/th_TH/messages.php +++ b/app/sprinkles/account/locale/th_TH/messages.php @@ -1,5 +1,6 @@ [ '@TRANSLATION' => 'การตั้งค่าบัญชี', 'DESCRIPTION' => 'ปรับปรุงการตั้งค่าบัญชีของคุณ รวมไปถึงอีเมล ชื่อ และรหัสผ่าน', - 'UPDATED' => 'ปรับปรุงการตั้งค่าบัญชีของคุณแล้ว' + 'UPDATED' => 'ปรับปรุงการตั้งค่าบัญชีของคุณแล้ว', ], 'TOOLS' => 'เครื่องมือบัญชี', @@ -49,12 +50,12 @@ 'PAGE' => 'ส่งอีเมลยืนยันสำหรับบัญชีของฉันใหม่', 'SEND' => 'ส่งอีเมลยืนยันให้บัญชีของฉัน', 'TOKEN_NOT_FOUND' => 'ไม่พบโทเคนยืนยันอีเมล / บัญชีนี้ได้ยืนยันแล้ว', - ] + ], ], 'EMAIL' => [ 'INVALID' => 'อีเมล {{email}} ไม่มีอยู่จริง', - 'IN_USE' => 'อีเมล {{email}} ได้ถูกใช้งานแล้ว' + 'IN_USE' => 'อีเมล {{email}} ได้ถูกใช้งานแล้ว', ], 'FIRST_NAME' => 'ชื่อจริง', @@ -70,7 +71,7 @@ 'ALREADY_COMPLETE' => 'คุณได้เข้าสู่ระบบอยู่แล้ว!', 'SOCIAL' => 'หรือเข้าสู่ระบบด้วย', - 'REQUIRED' => 'ขออภัย คุณจะต้องเข้าสู่ระบบเพื่อเข้าถึงส่วนนี้' + 'REQUIRED' => 'ขออภัย คุณจะต้องเข้าสู่ระบบเพื่อเข้าถึงส่วนนี้', ], 'LOGOUT' => 'ออกจากระบบ', @@ -82,7 +83,7 @@ 'DESCRIPTION' => 'เข้าสู่ระบบไปยังบัญชี {{site_name}} หรือสมัครสมาชิกสำหรับบัญชีใหม่', 'SUBTITLE' => 'สมัครสมาชิกฟรี หรือเข้าสู่ระบบด้วยบัญชีที่มีอยู่', 'TITLE' => 'มาเริ่มกันเลย!', - ] + ], ], 'PASSWORD' => [ @@ -108,21 +109,21 @@ 'INVALID' => 'ขอรีเซ็ตรหัสผ่านนี้ไม่มีอยู่ หรือหมดอายุไปแล้ว กรุณาลอง ส่งคำขอของคุณอีกครั้ง', 'PAGE' => 'รับลิงก์สำหรับการรีเซ็ตรหัสผ่านของคุณ', 'REQUEST_CANNED' => 'คำขอลืมรหัสผ่านได้ถูกยกเลิก', - 'REQUEST_SENT' => 'หากอีเมล {{email}} ตรงกับบัญชีในระบบของเราลิงก์การรีเซ็ตรหัสผ่านจะถูกส่งไปที่ {{email}}' + 'REQUEST_SENT' => 'หากอีเมล {{email}} ตรงกับบัญชีในระบบของเราลิงก์การรีเซ็ตรหัสผ่านจะถูกส่งไปที่ {{email}}', ], 'RESET' => [ '@TRANSLATION' => 'รีเซ็ตรหัสผ่าน', 'CHOOSE' => 'กรุณาเลือกรหัสผ่านใหม่เพื่อดำเนินการต่อ', 'PAGE' => 'เลือกรหัสผ่านใหม่สำหรับบัญชีของคุณ', - 'SEND' => 'ตั้งรหัสผ่านใหม่และเข้าสู่ระบบ' + 'SEND' => 'ตั้งรหัสผ่านใหม่และเข้าสู่ระบบ', ], 'HASH_FAILED' => 'เข้ารหัสรหัสผ่านล้มเหลว กรุณาติดต่อผู้ดูแลระบบของเว็บไซต์', 'INVALID' => 'รหัสผ่านปัจจุบันไม่ตรงกับรหัสผ่านที่เราบันทึกไว้', 'NEW' => 'รหัสผ่านใหม่', 'NOTHING_TO_UPDATE' => 'คุณไม่สามารถปรังปรุงด้วยรหัสผ่านเดียวกัน', - 'UPDATED' => 'ปรังปรุงรหัสผ่านของบัญชีแล้ว' + 'UPDATED' => 'ปรังปรุงรหัสผ่านของบัญชีแล้ว', ], 'REGISTER' => 'สมัครสมาชิก', @@ -134,7 +135,7 @@ 'COMPLETE_TYPE2' => 'คุณได้สมัครสมาชิกเรียบร้อยแล้ว คุณจะได้รับอีเมลยืนยันที่มีลิงก์สำหรับเปิดใช้งานบัญชีของคุณอยู่ คุณจะไม่สามารถเข้าสู่ระบบจนกว่าคุณจะยืนยันอีเมลแล้ว', 'DISABLED' => 'เราขออภัย ระบบสมัครสมาชิกได้ถูกปิดไว้', 'LOGOUT' => 'เราขออภัย คุณไม่สามารถสมัครสมาชิกขณะที่เข้าสู่ระบบอยู่ กรุณาออกจากระบบก่อน', - 'WELCOME' => 'การสมัครสมาชิกนั้นรวดเร็ว และง่ายดาย' + 'WELCOME' => 'การสมัครสมาชิกนั้นรวดเร็ว และง่ายดาย', ], 'RATE_LIMIT_EXCEEDED' => 'ถึงขีดจำกัดสำหรับการกระทำนี้แล้ว คุณจะต้องรออีก {{delay}} วินาที ก่อนที่คุณจะได้รับอนุญาตให้ลองใหม่อีกครั้ง', @@ -154,12 +155,12 @@ 'CHOOSE' => 'เลือกชื่อผู้ใช้ที่เป็นเป็นเอกลักษณ์', 'INVALID' => 'ชื่อผู้ใช้ไม่ถูกต้อง', - 'IN_USE' => 'ชื่อผู้ใช้ {{user_name}} ถูกใช้งานแล้ว' + 'IN_USE' => 'ชื่อผู้ใช้ {{user_name}} ถูกใช้งานแล้ว', ], 'USER_ID_INVALID' => 'ไม่พบหมายเลขผู้ใช้ที่ร้องขอมา', 'USER_OR_EMAIL_INVALID' => 'ชื่อผู้ใช้หรือที่อยู่อีเมลไม่ถูกต้อง', 'USER_OR_PASS_INVALID' => 'ชื่อผู้ใช้หรือรหัสผ่านไม่ถูกต้อง', - 'WELCOME' => 'ยินดีต้อนรับ {{first_name}}' + 'WELCOME' => 'ยินดีต้อนรับ {{first_name}}', ]; diff --git a/app/sprinkles/account/locale/th_TH/validate.php b/app/sprinkles/account/locale/th_TH/validate.php index 092e0be0e..d349c8d75 100644 --- a/app/sprinkles/account/locale/th_TH/validate.php +++ b/app/sprinkles/account/locale/th_TH/validate.php @@ -1,5 +1,6 @@ [ - 'PASSWORD_MISMATCH' => 'รหัสผ่านและรหัสผ่านยืนยันของคุณจะต้องตรงกัน' - ] + 'PASSWORD_MISMATCH' => 'รหัสผ่านและรหัสผ่านยืนยันของคุณจะต้องตรงกัน', + ], ]; diff --git a/app/sprinkles/account/locale/tr/messages.php b/app/sprinkles/account/locale/tr/messages.php index c8e8396e0..f3d706394 100644 --- a/app/sprinkles/account/locale/tr/messages.php +++ b/app/sprinkles/account/locale/tr/messages.php @@ -1,5 +1,6 @@ [ '@TRANSLATION' => 'Oturumunuz tehlikeye atıldı. Tüm cihazlardan çıkmanız, daha sonra giriş yapmanız ve bilgilerinizin değiştirilmediğini kontrol etmeniz gerekir.', 'TITLE' => 'Hesabınız tehlikeye atılmış olabilir', - 'TEXT' => 'Birisi bu sayfayı ele geçirmek için giriş verilerinizi kullanmış olabilir. Güvenliğiniz için tüm oturumlar günlüğe kaydedildi. Lütfen giriş yapınve şüpheli hareketler için hesabınızı kontrol edin. Ayrıca şifrenizi değiştirmek isteyebilirsiniz.' + 'TEXT' => 'Birisi bu sayfayı ele geçirmek için giriş verilerinizi kullanmış olabilir. Güvenliğiniz için tüm oturumlar günlüğe kaydedildi. Lütfen giriş yapınve şüpheli hareketler için hesabınızı kontrol edin. Ayrıca şifrenizi değiştirmek isteyebilirsiniz.', ], 'SESSION_EXPIRED' => 'Oturumunuz sona erdi. Lütfen tekrar oturum açın.', 'SETTINGS' => [ '@TRANSLATION' => 'Hesap ayarları', 'DESCRIPTION' => 'E-posta, isim ve parolanız da dahil olmak üzere hesap ayarlarınızı güncelleyin.', - 'UPDATED' => 'Hesap ayarları güncellendi' + 'UPDATED' => 'Hesap ayarları güncellendi', ], 'TOOLS' => 'Hesap araçları', @@ -52,13 +53,13 @@ 'PAGE' => 'Yeni hesabınız için doğrulama e-postasını tekrar gönder.', 'SEND' => 'Hesabım için doğrulama bağlantısını e-posta ile gönder', 'TOKEN_NOT_FOUND' => 'Doğrulama belirteci bulunumadı / Hesap zaten doğrulandı', - ] + ], ], 'EMAIL' => [ 'INVALID' => '{{email}} için hesap yoktur.', 'IN_USE' => 'E-posta {{email}} zaten kullanılıyor.', - 'VERIFICATION_REQUIRED' => 'E-posta (doğrulama gerekli - gerçek bir adres kullanın!)' + 'VERIFICATION_REQUIRED' => 'E-posta (doğrulama gerekli - gerçek bir adres kullanın!)', ], 'EMAIL_OR_USERNAME' => 'Kullanıcı adı veya e-posta adresi', @@ -70,13 +71,13 @@ 'LAST_NAME' => 'Soyadı', 'LOCALE' => [ 'ACCOUNT' => 'Hesabınız için kullanılacak dil ve yerel ayar', - 'INVALID' => '{{locale}} geçersiz bir yerel.' + 'INVALID' => '{{locale}} geçersiz bir yerel.', ], 'LOGIN' => [ '@TRANSLATION' => 'Oturum Aç', 'ALREADY_COMPLETE' => 'Zaten oturum açtınız!', 'SOCIAL' => 'Veya şununla oturum aç', - 'REQUIRED' => 'Üzgünüm, bu sayfaya ulaşmak için oturum açmalısın.' + 'REQUIRED' => 'Üzgünüm, bu sayfaya ulaşmak için oturum açmalısın.', ], 'LOGOUT' => 'Oturumu kapat', @@ -89,7 +90,7 @@ 'DESCRIPTION' => '{{site_name}} hesabınız ile giriş yapın ya da yeni bir hesap oluşturun.', 'SUBTITLE' => 'Ücretsiz üye ol veya mevcut bir hesap ile giriş yapın.', 'TITLE' => 'Hadi başlayalım!', - ] + ], ], 'PASSWORD' => [ @@ -105,7 +106,7 @@ 'CREATE' => [ '@TRANSLATION' => 'Parola Oluştur', 'PAGE' => 'Yeni hesabınız için bir şifre belirleyin.', - 'SET' => 'Parolayı Ayarla ve Giriş Yap' + 'SET' => 'Parolayı Ayarla ve Giriş Yap', ], 'CURRENT' => 'Şimdiki Parola', 'CURRENT_EXPLAIN' => 'Değişiklikler için şimdiki parolanız ile onaylamalısınız', @@ -120,7 +121,7 @@ 'INVALID' => 'Bu şifre sıfırlama isteği bulunamadı ya da süresi bitmiş. Lütfen isteğinizi yeniden göndermeyideneyin.', 'PAGE' => 'Şifrenizi sıfırlamak için bir bağlantı oluşturun.', 'REQUEST_CANNED' => 'Kayıp parola isteği iptal edildi.', - 'REQUEST_SENT' => 'Eğer e-posta{{email}} sistemdeki bir hesap ile eşleşirse, bir şifre yenileme bağlantısı{{email}} gönderilir.' + 'REQUEST_SENT' => 'Eğer e-posta{{email}} sistemdeki bir hesap ile eşleşirse, bir şifre yenileme bağlantısı{{email}} gönderilir.', ], 'HASH_FAILED' => 'Parola karma başarısız oldu. Lütfen bir site yöneticisiyle iletişime geçin.', @@ -132,15 +133,15 @@ '@TRANSLATION' => 'Şifre sıfırlama', 'CHOOSE' => 'Lütfen devam etmek için yeni bir şifre belirleyiniz.', 'PAGE' => 'Hesabınız için yeni bir şifre belirleyiniz.', - 'SEND' => 'Yeni şifre ayarla ve giriş yap' + 'SEND' => 'Yeni şifre ayarla ve giriş yap', ], - 'UPDATED' => 'Hesap şifresi güncellendi' + 'UPDATED' => 'Hesap şifresi güncellendi', ], 'PROFILE' => [ 'SETTINGS' => 'Profil ayarları', - 'UPDATED' => 'Profil ayarları güncellendi' + 'UPDATED' => 'Profil ayarları güncellendi', ], 'RATE_LIMIT_EXCEEDED' => 'Bu işlem için belirlenen son oran aşıldı. Başka bir deneme yapmanıza izin verilene kadar {{delay}} bir süre beklemelisiniz.', @@ -153,7 +154,7 @@ 'COMPLETE_TYPE2' => 'Kaydınız başarıyla tamamlandı. Hesabınızı aktifleştirmek için bir bağlantı gönderildi{{email}}. Bu adımı tamamlayana kadar oturum açamazsınız.', 'DISABLED' => 'Üzgünüz, hesap kaydı devre dışı bırakıldı.', 'LOGOUT' => 'Üzgünüm, oturumunuz açıkken yeni bir hesap oluşturamazsınız. Lütfen önce oturumunuzdan çıkış yapınız.', - 'WELCOME' => 'Kaydolmak hızlı ve basittir.' + 'WELCOME' => 'Kaydolmak hızlı ve basittir.', ], 'REMEMBER_ME' => 'Beni hatırla!', 'REMEMBER_ME_ON_COMPUTER' => 'Bu bilgisayarda beni hatırla ( genel bilgisayarlar için önerilmez)', @@ -173,12 +174,12 @@ 'CHOOSE' => 'Benzersiz bir kullanıcı adı seç', 'INVALID' => 'Geçersiz kullanıcı adı', 'IN_USE' => '{{user_name}} kullanıcı adı zaten mevcut.', - 'NOT_AVAILABLE' => "{{user_name}} kullanıcı adı kullanılamaz. Farklı bir isim veya 'öneriye' tıklayın." + 'NOT_AVAILABLE' => "{{user_name}} kullanıcı adı kullanılamaz. Farklı bir isim veya 'öneriye' tıklayın.", ], 'USER_ID_INVALID' => 'İstenen kullanıcı adı mevcut değil.', 'USER_OR_EMAIL_INVALID' => 'Kullanıcı adı veya e-posta adresi hatalı.', 'USER_OR_PASS_INVALID' => 'Kullanıcı bulunamadı ya da şifre hatalı.', - 'WELCOME' => 'Tekrar Hoşgeldiniz.{{first_name}}' + 'WELCOME' => 'Tekrar Hoşgeldiniz.{{first_name}}', ]; diff --git a/app/sprinkles/account/locale/tr/validate.php b/app/sprinkles/account/locale/tr/validate.php index 9b8529478..90c84ecdc 100644 --- a/app/sprinkles/account/locale/tr/validate.php +++ b/app/sprinkles/account/locale/tr/validate.php @@ -1,5 +1,6 @@ [ 'PASSWORD_MISMATCH' => 'Şifreniz ve onaylama şifreniz eşleşmiyor.', - 'USERNAME' => "Kullanıcı adınız sadece küçük harfler, sayılar, '.', '-', ve '_' içerebilir." - ] + 'USERNAME' => "Kullanıcı adınız sadece küçük harfler, sayılar, '.', '-', ve '_' içerebilir.", + ], ]; diff --git a/app/sprinkles/account/locale/zh_CN/messages.php b/app/sprinkles/account/locale/zh_CN/messages.php index aaef801e3..1dfb59010 100644 --- a/app/sprinkles/account/locale/zh_CN/messages.php +++ b/app/sprinkles/account/locale/zh_CN/messages.php @@ -1,5 +1,6 @@ [ '@TRANSLATION' => '账户设置', 'DESCRIPTION' => '更新你的账户, 包括邮箱、姓名和密码.', - 'UPDATED' => '账户更新成功' + 'UPDATED' => '账户更新成功', ], 'TOOLS' => '账户工具', @@ -49,13 +50,13 @@ 'PAGE' => '重新发送验证邮件给你的新账户.', 'SEND' => '为我的账户发送验证邮件', 'TOKEN_NOT_FOUND' => '验证令牌不存在 / 账户已经验证', - ] + ], ], 'EMAIL' => [ 'INVALID' => '{{email}} 没有账户注册.', 'IN_USE' => '邮箱 {{email}} 已被使用.', - 'VERIFICATION_REQUIRED' => '邮箱 (需要进行验证 - 请使用一个有效的!)' + 'VERIFICATION_REQUIRED' => '邮箱 (需要进行验证 - 请使用一个有效的!)', ], 'EMAIL_OR_USERNAME' => '用户名或邮箱地址', @@ -68,14 +69,14 @@ 'LOCALE' => [ 'ACCOUNT' => '设置你账户的地区和语言', - 'INVALID' => '{{locale}} 不是一个有效的地区.' + 'INVALID' => '{{locale}} 不是一个有效的地区.', ], 'LOGIN' => [ '@TRANSLATION' => '登陆', 'ALREADY_COMPLETE' => '你已经登陆!', 'SOCIAL' => '用其他方式登陆', - 'REQUIRED' => '对不起, 你需要登陆才能获取资源.' + 'REQUIRED' => '对不起, 你需要登陆才能获取资源.', ], 'LOGOUT' => '注销', @@ -89,7 +90,7 @@ 'DESCRIPTION' => '用 {{site_name}} 账户登陆, 或者创建新账户.', 'SUBTITLE' => '免费注册, 或用已有账户登陆.', 'TITLE' => '让我们开始吧!', - ] + ], ], 'PASSWORD' => [ @@ -115,26 +116,26 @@ 'INVALID' => '这个重置密码请求无法使用, 或已过期. 请 重新发送请求.', 'PAGE' => '获取重置密码的链接.', 'REQUEST_CANNED' => '取消重置请求.', - 'REQUEST_SENT' => '重置密码的链接已经发送 {{email}}.' + 'REQUEST_SENT' => '重置密码的链接已经发送 {{email}}.', ], 'RESET' => [ '@TRANSLATION' => '重置密码', 'CHOOSE' => '请输入新密码.', 'PAGE' => '为账户设置新密码.', - 'SEND' => '设置密码并登陆' + 'SEND' => '设置密码并登陆', ], 'HASH_FAILED' => '密码验证失败. 请联系网站管理.', 'INVALID' => '当前密码无法与记录匹配', 'NEW' => '新密码', 'NOTHING_TO_UPDATE' => '新密码不能与旧密码相同', - 'UPDATED' => '账户密码更新成功' + 'UPDATED' => '账户密码更新成功', ], 'PROFILE' => [ 'SETTINGS' => '简介设置', - 'UPDATED' => '简介设置成功' + 'UPDATED' => '简介设置成功', ], 'REGISTER' => '注册', @@ -146,7 +147,7 @@ 'COMPLETE_TYPE2' => '成功注册. 激活链接已经发送给 {{email}}. 激活之前无法登陆.', 'DISABLED' => '抱歉, 账户注册以禁用.', 'LOGOUT' => '抱歉, 登陆时不能注册. 请先注销.', - 'WELCOME' => '注册简单快速.' + 'WELCOME' => '注册简单快速.', ], 'RATE_LIMIT_EXCEEDED' => '行动速度过快. 请等 {{delay}} 秒后再尝试新的操作.', @@ -167,12 +168,12 @@ 'CHOOSE' => '取一个唯一的用户名', 'INVALID' => '无效的用户名', 'IN_USE' => '用户名 {{user_name}} 已存在.', - 'NOT_AVAILABLE' => "用户名 {{user_name}} 不可用. 重新选择用户名, 或者点击 '建议'." + 'NOT_AVAILABLE' => "用户名 {{user_name}} 不可用. 重新选择用户名, 或者点击 '建议'.", ], 'USER_ID_INVALID' => '请求的用户不存在.', 'USER_OR_EMAIL_INVALID' => '用户名或邮箱无效.', 'USER_OR_PASS_INVALID' => '没有发现用户或密码错误.', - 'WELCOME' => '欢迎回来, {{first_name}}' + 'WELCOME' => '欢迎回来, {{first_name}}', ]; diff --git a/app/sprinkles/account/locale/zh_CN/validate.php b/app/sprinkles/account/locale/zh_CN/validate.php index 2f0c8c516..c68fc8c31 100644 --- a/app/sprinkles/account/locale/zh_CN/validate.php +++ b/app/sprinkles/account/locale/zh_CN/validate.php @@ -1,5 +1,6 @@ [ 'PASSWORD_MISMATCH' => '密码不一致.', - 'USERNAME' => "用户名必须以小写字母, 数字, '.', '-', 和 '_'组成." - ] + 'USERNAME' => "用户名必须以小写字母, 数字, '.', '-', 和 '_'组成.", + ], ]; diff --git a/app/sprinkles/account/routes/routes.php b/app/sprinkles/account/routes/routes.php index bb89382b7..dade82ff7 100644 --- a/app/sprinkles/account/routes/routes.php +++ b/app/sprinkles/account/routes/routes.php @@ -1,5 +1,6 @@ defaultGroup}' does not exist."); $e->addUserMessage('ACCOUNT.REGISTRATION_BROKEN'); + throw $e; } @@ -121,7 +123,7 @@ public function register() // Create activity record $this->ci->userActivityLogger->info("User {$user->user_name} registered for a new account.", [ 'type' => 'sign_up', - 'user_id' => $user->id + 'user_id' => $user->id, ]); // Load default roles @@ -143,10 +145,11 @@ public function register() } /** - * Validate the user name and email is unique + * Validate the user name and email is unique. * * @throws HttpException If data doesn't validate - * @return bool Returns true if the data is valid + * + * @return bool Returns true if the data is valid */ public function validate() { @@ -155,6 +158,7 @@ public function validate() if (!isset($this->userdata[$property])) { $e = new HttpException("Account can't be registrated as '$property' is required to create a new user."); $e->addUserMessage('USERNAME.IN_USE'); + throw $e; } } @@ -163,6 +167,7 @@ public function validate() if (!$this->usernameIsUnique($this->userdata['user_name'])) { $e = new HttpException('Username is already in use.'); $e->addUserMessage('USERNAME.IN_USE', ['user_name' => $this->userdata['user_name']]); + throw $e; } @@ -170,6 +175,7 @@ public function validate() if (!$this->emailIsUnique($this->userdata['email'])) { $e = new HttpException('Email is already in use.'); $e->addUserMessage('EMAIL.IN_USE', ['email' => $this->userdata['email']]); + throw $e; } @@ -181,10 +187,11 @@ public function validate() /** * Check Unique Username - * Make sure the username is not already in use + * Make sure the username is not already in use. * - * @param string $username - * @return bool Return true if username is unique + * @param string $username + * + * @return bool Return true if username is unique */ public function usernameIsUnique($username) { @@ -193,10 +200,11 @@ public function usernameIsUnique($username) /** * Check Unique Email - * Make sure the email is not already in use + * Make sure the email is not already in use. + * + * @param string $email * - * @param string $email - * @return bool Return true if email is unique + * @return bool Return true if email is unique */ public function emailIsUnique($email) { @@ -204,7 +212,7 @@ public function emailIsUnique($email) } /** - * Hash the user password in the userdata array + * Hash the user password in the userdata array. */ protected function hashPassword() { @@ -212,7 +220,7 @@ protected function hashPassword() } /** - * Set default value from config + * Set default value from config. */ protected function setDefaults() { @@ -223,7 +231,7 @@ protected function setDefaults() } /** - * Send verification email for specified user + * Send verification email for specified user. * * @param UserInterface $user The user to send the email for */ @@ -239,7 +247,7 @@ protected function sendVerificationEmail(UserInterface $user) ->addEmailRecipient(new EmailRecipient($user->email, $user->full_name)) ->addParams([ 'user' => $user, - 'token' => $verification->getToken() + 'token' => $verification->getToken(), ]); $this->ci->mailer->send($message); @@ -254,7 +262,8 @@ public function getRequireEmailVerification() } /** - * @param bool $requireEmailVerification + * @param bool $requireEmailVerification + * * @return static */ public function setRequireEmailVerification($requireEmailVerification) @@ -273,7 +282,8 @@ public function getDefaultGroup() } /** - * @param string $defaultGroup + * @param string $defaultGroup + * * @return static */ public function setDefaultGroup($defaultGroup) @@ -292,7 +302,8 @@ public function getDefaultRoles() } /** - * @param array $defaultRoles + * @param array $defaultRoles + * * @return static */ public function setDefaultRoles($defaultRoles) @@ -323,7 +334,7 @@ public function setUserdata($userdata) } /** - * Define a user property + * Define a user property. * * @param string $property The property to set * @param mixed $value The property value diff --git a/app/sprinkles/account/src/Authenticate/AuthGuard.php b/app/sprinkles/account/src/Authenticate/AuthGuard.php index 7f6ce786b..5ab13c750 100644 --- a/app/sprinkles/account/src/Authenticate/AuthGuard.php +++ b/app/sprinkles/account/src/Authenticate/AuthGuard.php @@ -1,5 +1,6 @@ validateRememberMeCookie()) { $this->logout(); + throw new AuthExpiredException(); } } @@ -399,9 +410,12 @@ protected function validateRememberMeCookie() * Tries to load the specified user by id from the database. * * Checks that the account is valid and enabled, throwing an exception if not. - * @param int $userId + * + * @param int $userId + * * @throws AccountInvalidException * @throws AccountDisabledException + * * @return UserInterface|null */ protected function validateUserAccount($userId) @@ -431,9 +445,10 @@ protected function validateUserAccount($userId) } /** - * Flush the cache associated with a session id + * Flush the cache associated with a session id. + * + * @param string $id The session id * - * @param string $id The session id * @return bool */ public function flushSessionCache($id) diff --git a/app/sprinkles/account/src/Authenticate/Exception/AccountDisabledException.php b/app/sprinkles/account/src/Authenticate/Exception/AccountDisabledException.php index 7bf831797..ef9e1858d 100644 --- a/app/sprinkles/account/src/Authenticate/Exception/AccountDisabledException.php +++ b/app/sprinkles/account/src/Authenticate/Exception/AccountDisabledException.php @@ -1,5 +1,6 @@ values, specifying any additional data to provide the authorization module - * when determining whether or not this user has access. - * @return bool True if the user has access, false otherwise. + * @param UserInterface|null $user + * @param string $slug The permission slug to check for access. + * @param array $params An array of field names => values, specifying any additional data to provide the authorization module + * when determining whether or not this user has access. + * + * @return bool True if the user has access, false otherwise. */ public function checkAccess($user, $slug, array $params = []) { @@ -146,7 +150,8 @@ public function checkAccess($user, $slug, array $params = []) /** * Remove extraneous information from the permission to reduce verbosity. * - * @param array $permissions + * @param array $permissions + * * @return array */ protected function getPermissionsArrayDebugInfo($permissions) diff --git a/app/sprinkles/account/src/Authorize/ParserNodeFunctionEvaluator.php b/app/sprinkles/account/src/Authorize/ParserNodeFunctionEvaluator.php index 936dc2f1c..9caf95c35 100644 --- a/app/sprinkles/account/src/Authorize/ParserNodeFunctionEvaluator.php +++ b/app/sprinkles/account/src/Authorize/ParserNodeFunctionEvaluator.php @@ -1,5 +1,6 @@ $argString + 'expression' => $argString, ]; // Resolve parameter placeholders ('variable' names (either single-word or array-dot identifiers)) if (($arg->value instanceof \PhpParser\Node\Expr\BinaryOp\Concat) || ($arg->value instanceof \PhpParser\Node\Expr\ConstFetch)) { @@ -144,7 +146,7 @@ public function leaveNode(Node $node) } /** - * Set params + * Set params. * * @param array $params */ @@ -156,7 +158,8 @@ public function setParams($params) /** * Resolve an array expression in a condition expression into an actual array. * - * @param string $arg the array, represented as a string. + * @param string $arg the array, represented as a string. + * * @return array[mixed] the array, as a plain ol' PHP array. */ private function resolveArray($arg) @@ -177,9 +180,11 @@ private function resolveArray($arg) /** * Resolve a parameter path (e.g. "user.id", "post", etc) into its value. * - * @param string $path the name of the parameter to resolve, based on the parameters set in this object. + * @param string $path the name of the parameter to resolve, based on the parameters set in this object. + * * @throws \Exception the path could not be resolved. Path is malformed or key does not exist. - * @return mixed the value of the specified parameter. + * + * @return mixed the value of the specified parameter. */ private function resolveParamPath($path) { diff --git a/app/sprinkles/account/src/Bakery/CreateAdminUser.php b/app/sprinkles/account/src/Bakery/CreateAdminUser.php index ea28a6a78..3e77118ac 100644 --- a/app/sprinkles/account/src/Bakery/CreateAdminUser.php +++ b/app/sprinkles/account/src/Bakery/CreateAdminUser.php @@ -1,5 +1,6 @@ $email, 'first_name' => $firstName, 'last_name' => $lastName, - 'password' => $password + 'password' => $password, ]); $registration->setRequireEmailVerification(false); $registration->setDefaultRoles(['user', 'group-admin', 'site-admin']); @@ -128,9 +129,10 @@ protected function execute(InputInterface $input, OutputInterface $output) } /** - * Ask for the username and return a valid one + * Ask for the username and return a valid one. + * + * @param string $username The base/default username * - * @param string $username The base/default username * @return string The validated username */ protected function askUsername($username = '') @@ -145,8 +147,9 @@ protected function askUsername($username = '') /** * Validate the username. * - * @param string $username The input - * @return bool Is the username validated ? + * @param string $username The input + * + * @return bool Is the username validated ? */ protected function validateUsername($username) { @@ -160,8 +163,8 @@ protected function validateUsername($username) // Validate format $options = [ 'options' => [ - 'regexp' => "/^\S((.*\S)|)$/" - ] + 'regexp' => "/^\S((.*\S)|)$/", + ], ]; $validate = filter_var($username, FILTER_VALIDATE_REGEXP, $options); if (!$validate) { @@ -174,9 +177,10 @@ protected function validateUsername($username) } /** - * Ask for the email and return a valid one + * Ask for the email and return a valid one. + * + * @param string $email The base/default email * - * @param string $email The base/default email * @return string The validated email */ protected function askEmail($email = '') @@ -191,8 +195,9 @@ protected function askEmail($email = '') /** * Validate the email. * - * @param string $email The input - * @return bool Is the email validated ? + * @param string $email The input + * + * @return bool Is the email validated ? */ protected function validateEmail($email) { @@ -214,9 +219,10 @@ protected function validateEmail($email) } /** - * Ask for the first name and return a valid one + * Ask for the first name and return a valid one. + * + * @param string $firstName The base/default first name * - * @param string $firstName The base/default first name * @return string The validated first name */ protected function askFirstName($firstName = '') @@ -229,10 +235,11 @@ protected function askFirstName($firstName = '') } /** - * Validate the first name + * Validate the first name. + * + * @param string $firstName The input * - * @param string $firstName The input - * @return bool Is the input validated ? + * @return bool Is the input validated ? */ protected function validateFirstName($firstName) { @@ -247,9 +254,10 @@ protected function validateFirstName($firstName) } /** - * Ask for the last name and return a valid one + * Ask for the last name and return a valid one. + * + * @param string $lastName The base/default last name * - * @param string $lastName The base/default last name * @return string The validated last name */ protected function askLastName($lastName = '') @@ -262,10 +270,11 @@ protected function askLastName($lastName = '') } /** - * Validate the last name entered is valid + * Validate the last name entered is valid. + * + * @param string $lastName The lastname * - * @param string $lastName The lastname - * @return bool Input is valid or not + * @return bool Input is valid or not */ protected function validateLastName($lastName) { @@ -280,10 +289,11 @@ protected function validateLastName($lastName) } /** - * Ask for the password and return a valid one + * Ask for the password and return a valid one. + * + * @param string $password The base/default password + * @param bool $requireConfirmation (default true) * - * @param string $password The base/default password - * @param bool $requireConfirmation (default true) * @return string The validated password */ protected function askPassword($password = '', $requireConfirmation = true) @@ -296,10 +306,11 @@ protected function askPassword($password = '', $requireConfirmation = true) } /** - * Validate password input + * Validate password input. + * + * @param string $password The input * - * @param string $password The input - * @return bool Is the password valid or not + * @return bool Is the password valid or not */ protected function validatePassword($password) { @@ -314,11 +325,12 @@ protected function validatePassword($password) } /** - * Ask for password confirmation + * Ask for password confirmation. * - * @param string $passwordToConfirm - * @param bool $requireConfirmation (default true) - * @return bool Is the password confirmed or not + * @param string $passwordToConfirm + * @param bool $requireConfirmation (default true) + * + * @return bool Is the password confirmed or not */ protected function confirmPassword($passwordToConfirm, $requireConfirmation = true) { @@ -334,11 +346,12 @@ protected function confirmPassword($passwordToConfirm, $requireConfirmation = tr } /** - * Validate the confirmation password + * Validate the confirmation password. + * + * @param string $password The confirmation + * @param string $passwordToConfirm The password to confirm * - * @param string $password The confirmation - * @param string $passwordToConfirm The password to confirm - * @return bool Is the confirmation password valid or not + * @return bool Is the confirmation password valid or not */ protected function validatePasswordConfirmation($password, $passwordToConfirm) { diff --git a/app/sprinkles/account/src/Controller/AccountController.php b/app/sprinkles/account/src/Controller/AccountController.php index e38b383cd..d184b773d 100644 --- a/app/sprinkles/account/src/Controller/AccountController.php +++ b/app/sprinkles/account/src/Controller/AccountController.php @@ -1,5 +1,6 @@ addUserMessage($error); } } + throw $e; } @@ -118,6 +123,7 @@ public function checkUsername(Request $request, Response $response, $args) * Route: /account/set-password/deny * Route Name: {none} * Request type: GET + * * @param Request $request * @param Response $response * @param array $args @@ -150,6 +156,7 @@ public function denyResetPassword(Request $request, Response $response, $args) return $response->withRedirect($loginPage); } + /** @var \UserFrosting\Sprinkle\Account\Repository\PasswordResetRepository $passwordReset */ $passwordReset = $this->ci->repoPasswordReset->cancel($data['token']); if (!$passwordReset) { @@ -173,6 +180,7 @@ public function denyResetPassword(Request $request, Response $response, $args) * Note that we have removed the requirement that a password reset request not already be in progress. * This is because we need to allow users to re-request a reset, even if they lose the first reset email. * This route is "public access". + * * @todo require additional user information * @todo prevent password reset requests for root account? * @@ -180,6 +188,7 @@ public function denyResetPassword(Request $request, Response $response, $args) * Route: /account/forgot-password * Route Name: {none} * Request type: POST + * * @param Request $request * @param Response $response * @param array $args @@ -214,12 +223,11 @@ public function forgotPassword(Request $request, Response $response, $args) } // Throttle requests - /** @var \UserFrosting\Sprinkle\Core\Throttle\Throttler $throttler */ $throttler = $this->ci->throttler; $throttleData = [ - 'email' => $data['email'] + 'email' => $data['email'], ]; $delay = $throttler->getDelay('password_reset_request', $throttleData); @@ -253,7 +261,7 @@ public function forgotPassword(Request $request, Response $response, $args) ->addParams([ 'user' => $user, 'token' => $passwordReset->getToken(), - 'request_date' => Carbon::now()->format('Y-m-d H:i:s') + 'request_date' => Carbon::now()->format('Y-m-d H:i:s'), ]); $this->ci->mailer->send($message); @@ -276,6 +284,7 @@ public function forgotPassword(Request $request, Response $response, $args) * Route: /modals/account/tos * Route Name: {none} * Request type: GET + * * @param Request $request * @param Response $response * @param array $args @@ -292,6 +301,7 @@ public function getModalAccountTos(Request $request, Response $response, $args) * Route: /account/captcha * Route Name: {none} * Request type: GET + * * @param Request $request * @param Response $response * @param array $args @@ -322,6 +332,7 @@ public function imageCaptcha(Request $request, Response $response, $args) * Route: /account/login * Route Name: {none} * Request type: POST + * * @param Request $request * @param Response $response * @param array $args @@ -376,13 +387,13 @@ public function login(Request $request, Response $response, $args) $userIdentifier = $data['user_name']; $throttleData = [ - 'user_identifier' => $userIdentifier + 'user_identifier' => $userIdentifier, ]; $delay = $throttler->getDelay('sign_in_attempt', $throttleData); if ($delay > 0) { $ms->addMessageTranslated('danger', 'RATE_LIMIT_EXCEEDED', [ - 'delay' => $delay + 'delay' => $delay, ]); return $response->withJson([], 429); @@ -420,6 +431,7 @@ public function login(Request $request, Response $response, $args) * Route: /account/logout * Route Name: {none} * Request type: GET + * * @param Request $request * @param Response $response * @param array $args @@ -445,6 +457,7 @@ public function logout(Request $request, Response $response, $args) * Route: /account/forgot-password * Route Name: forgot-password * Request type: GET + * * @param Request $request * @param Response $response * @param array $args @@ -458,9 +471,9 @@ public function pageForgotPassword(Request $request, Response $response, $args) return $this->ci->view->render($response, 'pages/forgot-password.html.twig', [ 'page' => [ 'validators' => [ - 'forgot_password' => $validator->rules('json', false) - ] - ] + 'forgot_password' => $validator->rules('json', false), + ], + ], ]); } @@ -475,9 +488,11 @@ public function pageForgotPassword(Request $request, Response $response, $args) * Route: /account/register * Route Name: register * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If site registration is disabled */ public function pageRegister(Request $request, Response $response, $args) @@ -512,7 +527,7 @@ public function pageRegister(Request $request, Response $response, $args) // Hide the locale field if there is only 1 locale available $fields = [ 'hidden' => [], - 'disabled' => [] + 'disabled' => [], ]; if (count($config->getDefined('site.locales.available')) <= 1) { $fields['hidden'][] = 'locale'; @@ -521,14 +536,14 @@ public function pageRegister(Request $request, Response $response, $args) return $this->ci->view->render($response, 'pages/register.html.twig', [ 'page' => [ 'validators' => [ - 'register' => $validatorRegister->rules('json', false) - ] + 'register' => $validatorRegister->rules('json', false), + ], ], - 'fields' => $fields, + 'fields' => $fields, 'locales' => [ 'available' => $config['site.locales.available'], - 'current' => end($currentLocales) - ] + 'current' => end($currentLocales), + ], ]); } @@ -542,6 +557,7 @@ public function pageRegister(Request $request, Response $response, $args) * Route: /account/resend-verification * Route Name: {none} * Request type: GET + * * @param Request $request * @param Response $response * @param array $args @@ -555,9 +571,9 @@ public function pageResendVerification(Request $request, Response $response, $ar return $this->ci->view->render($response, 'pages/resend-verification.html.twig', [ 'page' => [ 'validators' => [ - 'resend_verification' => $validator->rules('json', false) - ] - ] + 'resend_verification' => $validator->rules('json', false), + ], + ], ]); } @@ -570,6 +586,7 @@ public function pageResendVerification(Request $request, Response $response, $ar * Route: /account/set-password/confirm * Route Name: {none} * Request type: GET + * * @param Request $request * @param Response $response * @param array $args @@ -586,8 +603,8 @@ public function pageResetPassword(Request $request, Response $response, $args) return $this->ci->view->render($response, 'pages/reset-password.html.twig', [ 'page' => [ 'validators' => [ - 'set_password' => $validator->rules('json', false) - ] + 'set_password' => $validator->rules('json', false), + ], ], 'token' => isset($params['token']) ? $params['token'] : '', ]); @@ -603,6 +620,7 @@ public function pageResetPassword(Request $request, Response $response, $args) * Route: * Route Name: {none} * Request type: GET + * * @param Request $request * @param Response $response * @param array $args @@ -619,8 +637,8 @@ public function pageSetPassword(Request $request, Response $response, $args) return $this->ci->view->render($response, 'pages/set-password.html.twig', [ 'page' => [ 'validators' => [ - 'set_password' => $validator->rules('json', false) - ] + 'set_password' => $validator->rules('json', false), + ], ], 'token' => isset($params['token']) ? $params['token'] : '', ]); @@ -637,9 +655,11 @@ public function pageSetPassword(Request $request, Response $response, $args) * Route: /account/settings * Route Name: {none} * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws ForbiddenException If user is not authozied to access page */ public function pageSettings(Request $request, Response $response, $args) @@ -671,7 +691,7 @@ public function pageSettings(Request $request, Response $response, $args) // Hide the locale field if there is only 1 locale available $fields = [ 'hidden' => [], - 'disabled' => [] + 'disabled' => [], ]; if (count($config->getDefined('site.locales.available')) <= 1) { $fields['hidden'][] = 'locale'; @@ -679,14 +699,14 @@ public function pageSettings(Request $request, Response $response, $args) return $this->ci->view->render($response, 'pages/account-settings.html.twig', [ 'locales' => $locales, - 'fields' => $fields, + 'fields' => $fields, 'page' => [ 'validators' => [ 'account_settings' => $validatorAccountSettings->rules('json', false), - 'profile_settings' => $validatorProfileSettings->rules('json', false) + 'profile_settings' => $validatorProfileSettings->rules('json', false), ], - 'visibility' => ($authorizer->checkAccess($currentUser, 'update_account_settings') ? '' : 'disabled') - ] + 'visibility' => ($authorizer->checkAccess($currentUser, 'update_account_settings') ? '' : 'disabled'), + ], ]); } @@ -701,6 +721,7 @@ public function pageSettings(Request $request, Response $response, $args) * Route: /account/sign-in * Route Name: login * Request type: GET + * * @param Request $request * @param Response $response * @param array $args @@ -727,9 +748,9 @@ public function pageSignIn(Request $request, Response $response, $args) return $this->ci->view->render($response, 'pages/sign-in.html.twig', [ 'page' => [ 'validators' => [ - 'login' => $validatorLogin->rules('json', false) - ] - ] + 'login' => $validatorLogin->rules('json', false), + ], + ], ]); } @@ -745,6 +766,7 @@ public function pageSignIn(Request $request, Response $response, $args) * Route: /account/settings/profile * Route Name: {none} * Request type: POST + * * @param Request $request * @param Response $response * @param array $args @@ -800,7 +822,7 @@ public function profile(Request $request, Response $response, $args) // Check that locale is valid $locales = $config->getDefined('site.locales.available'); - if (!array_key_exists($data['locale'], $locales)) { + if (isset($data['locale']) && !array_key_exists($data['locale'], $locales)) { $ms->addMessageTranslated('danger', 'LOCALE.INVALID', $data); $error = true; } @@ -817,7 +839,7 @@ public function profile(Request $request, Response $response, $args) // Create activity record $this->ci->userActivityLogger->info("User {$currentUser->user_name} updated their profile settings.", [ - 'type' => 'update_profile_settings' + 'type' => 'update_profile_settings', ]); $ms->addMessageTranslated('success', 'PROFILE.UPDATED'); @@ -845,9 +867,11 @@ public function profile(Request $request, Response $response, $args) * Route: /account/register * Route Name: {none} * Request type: POST - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws SpammyRequestException */ public function register(Request $request, Response $response, $args) @@ -926,7 +950,7 @@ public function register(Request $request, Response $response, $args) // Check captcha, if required if ($config['site.registration.captcha']) { $captcha = new Captcha($this->ci->session, $this->ci->config['session.keys.captcha']); - if (!$data['captcha'] || !$captcha->verifyCode($data['captcha'])) { + if (!isset($data['captcha']) || !$captcha->verifyCode($data['captcha'])) { $ms->addMessageTranslated('danger', 'CAPTCHA.FAIL'); $error = true; } @@ -973,6 +997,7 @@ public function register(Request $request, Response $response, $args) * Route: /account/resend-verification * Route Name: {none} * Request type: POST + * * @param Request $request * @param Response $response * @param array $args @@ -1012,7 +1037,7 @@ public function resendVerification(Request $request, Response $response, $args) $throttler = $this->ci->throttler; $throttleData = [ - 'email' => $data['email'] + 'email' => $data['email'], ]; $delay = $throttler->getDelay('verification_request', $throttleData); @@ -1045,7 +1070,7 @@ public function resendVerification(Request $request, Response $response, $args) ->addEmailRecipient(new EmailRecipient($user->email, $user->full_name)) ->addParams([ 'user' => $user, - 'token' => $verification->getToken() + 'token' => $verification->getToken(), ]); $this->ci->mailer->send($message); @@ -1071,6 +1096,7 @@ public function resendVerification(Request $request, Response $response, $args) * Route: /account/set-password * Route Name: {none} * Request type: POST + * * @param Request $request * @param Response $response * @param array $args @@ -1108,7 +1134,7 @@ public function setPassword(Request $request, Response $response, $args) // Ok, try to complete the request with the specified token and new password $passwordReset = $this->ci->repoPasswordReset->complete($data['token'], [ - 'password' => $data['password'] + 'password' => $data['password'], ]); if (!$passwordReset) { @@ -1149,6 +1175,7 @@ public function setPassword(Request $request, Response $response, $args) * Route: /account/settings * Route Name: settings * Request type: POST + * * @param Request $request * @param Response $response * @param array $args @@ -1238,7 +1265,7 @@ public function settings(Request $request, Response $response, $args) // Create activity record $this->ci->userActivityLogger->info("User {$currentUser->user_name} updated their account settings.", [ - 'type' => 'update_account_settings' + 'type' => 'update_account_settings', ]); $ms->addMessageTranslated('success', 'ACCOUNT.SETTINGS.UPDATED'); @@ -1250,12 +1277,14 @@ public function settings(Request $request, Response $response, $args) * Suggest an available username for a specified first/last name. * * This route is "public access". + * * @todo Can this route be abused for account enumeration? If so we should throttle it as well. * * AuthGuard: false * Route: /account/suggest-username * Route Name: {none} * Request type: GET + * * @param Request $request * @param Response $response * @param array $args @@ -1273,7 +1302,7 @@ public function suggestUsername(Request $request, Response $response, $args) // Be careful how you consume this data - it has not been escaped and contains untrusted user-supplied content. // For example, if you plan to insert it into an HTML DOM, you must escape it on the client side (or use client-side templating). return $response->withJson([ - 'user_name' => $suggestion + 'user_name' => $suggestion, ], 200, JSON_PRETTY_PRINT); } @@ -1289,6 +1318,7 @@ public function suggestUsername(Request $request, Response $response, $args) * Route: /account/verify * Route Name: {none} * Request type: GET + * * @param Request $request * @param Response $response * @param array $args diff --git a/app/sprinkles/account/src/Controller/Exception/SpammyRequestException.php b/app/sprinkles/account/src/Controller/Exception/SpammyRequestException.php index 4bc90b894..6562c7738 100644 --- a/app/sprinkles/account/src/Controller/Exception/SpammyRequestException.php +++ b/app/sprinkles/account/src/Controller/Exception/SpammyRequestException.php @@ -1,5 +1,6 @@ [ - 'user_id' => ['id', 'users'] + 'user_id' => ['id', 'users'], ], 'password_resets' => [ - 'user_id' => ['id', 'users'] + 'user_id' => ['id', 'users'], ], 'permission_roles' => [ 'permission_id' => ['id', 'permissions'], - 'role_id' => ['id', 'roles'] + 'role_id' => ['id', 'roles'], ], 'persistences' => [ - 'user_id' => ['id', 'users'] + 'user_id' => ['id', 'users'], ], 'role_users' => [ 'user_id' => ['id', 'users'], - 'role_id' => ['id', 'roles'] + 'role_id' => ['id', 'roles'], ], 'users' => [ 'group_id' => ['id', 'groups'], - 'last_activity_id' => ['id', 'activities'] + 'last_activity_id' => ['id', 'activities'], ], 'verifications' => [ 'user_id' => ['id', 'users'], diff --git a/app/sprinkles/account/src/Database/Models/Activity.php b/app/sprinkles/account/src/Database/Models/Activity.php index a2202b9b8..f84a3fc3f 100644 --- a/app/sprinkles/account/src/Database/Models/Activity.php +++ b/app/sprinkles/account/src/Database/Models/Activity.php @@ -1,5 +1,6 @@ full_name` + * Allows you to get the full name of the user using `$user->full_name`. * * @return string */ @@ -64,7 +66,8 @@ public function reloadCachedPermissions(); /** * Get the amount of time, in seconds, that has elapsed since the last activity of a certain time for this user. * - * @param string $type The type of activity to search for. + * @param string $type The type of activity to search for. + * * @return int */ public function getSecondsSinceLastActivity($type); @@ -93,7 +96,8 @@ public function lastActivity(); /** * Find the most recent activity for this user of a particular type. * - * @param string $type + * @param string $type + * * @return \Illuminate\Database\Eloquent\Builder */ public function lastActivityOfType($type = null); @@ -101,7 +105,8 @@ public function lastActivityOfType($type = null); /** * Get the most recent time for a specified activity type for this user. * - * @param string $type + * @param string $type + * * @return string|null The last activity time, as a SQL formatted time (YYYY-MM-DD HH:MM:SS), or null if an activity of this type doesn't exist. */ public function lastActivityTime($type); @@ -110,7 +115,9 @@ public function lastActivityTime($type); * Performs tasks to be done after this user has been successfully authenticated. * * By default, adds a new sign-in activity and updates any legacy hash. + * * @param mixed[] $params Optional array of parameters used for this event handler. + * * @todo Transition to Laravel Event dispatcher to handle this */ public function onLogin($params = []); @@ -119,7 +126,9 @@ public function onLogin($params = []); * Performs tasks to be done after this user has been logged out. * * By default, adds a new sign-out activity. + * * @param mixed[] $params Optional array of parameters used for this event handler. + * * @todo Transition to Laravel Event dispatcher to handle this */ public function onLogout($params = []); @@ -148,8 +157,9 @@ public function roles(); /** * Query scope to get all users who have a specific role. * - * @param Builder $query - * @param int $roleId + * @param Builder $query + * @param int $roleId + * * @return Builder */ public function scopeForRole($query, $roleId); @@ -157,7 +167,8 @@ public function scopeForRole($query, $roleId); /** * Joins the user's most recent activity directly, so we can do things like sort, search, paginate, etc. * - * @param Builder $query + * @param Builder $query + * * @return Builder */ public function scopeJoinLastActivity($query); diff --git a/app/sprinkles/account/src/Database/Models/PasswordReset.php b/app/sprinkles/account/src/Database/Models/PasswordReset.php index 3f7c2b646..6501fb333 100644 --- a/app/sprinkles/account/src/Database/Models/PasswordReset.php +++ b/app/sprinkles/account/src/Database/Models/PasswordReset.php @@ -1,5 +1,6 @@ Events\DeleteUserCacheEvent::class, - 'deleted' => Events\DeleteUserCacheEvent::class + 'deleted' => Events\DeleteUserCacheEvent::class, ]; /** @@ -123,15 +127,16 @@ class User extends Model implements UserInterface * See http://stackoverflow.com/questions/29514081/cannot-access-eloquent-attributes-on-twig/35908957#35908957 * Every property in __get must also be implemented here for Twig to recognize it. * - * @param string $name the name of the property to check. - * @return bool true if the property is defined, false otherwise. + * @param string $name the name of the property to check. + * + * @return bool true if the property is defined, false otherwise. */ public function __isset($name) { if (in_array($name, [ 'group', 'last_sign_in_time', - 'avatar' + 'avatar', ])) { return true; } else { @@ -142,9 +147,11 @@ public function __isset($name) /** * Get a property for this object. * - * @param string $name the name of the property to retrieve. + * @param string $name the name of the property to retrieve. + * * @throws \Exception the property does not exist for this object. - * @return string the associated property. + * + * @return string the associated property. */ public function __get($name) { @@ -176,7 +183,8 @@ public function activities() /** * Delete this user from the database, along with any linked roles and activities. * - * @param bool $hardDelete Set to true to completely remove the user and all associated objects. + * @param bool $hardDelete Set to true to completely remove the user and all associated objects. + * * @return bool true if the deletion was successful, false otherwise. */ public function delete($hardDelete = false) @@ -209,12 +217,14 @@ public function delete($hardDelete = false) } /** - * Determines whether a user exists, including checking soft-deleted records + * Determines whether a user exists, including checking soft-deleted records. * * @deprecated since 4.1.7 This method conflicts with and overrides the Builder::exists() method. Use Model::findUnique instead. - * @param mixed $value - * @param string $identifier - * @param bool $checkDeleted set to true to include soft-deleted records + * + * @param mixed $value + * @param string $identifier + * @param bool $checkDeleted set to true to include soft-deleted records + * * @return User|null */ public static function exists($value, $identifier = 'user_name', $checkDeleted = true) @@ -223,17 +233,17 @@ public static function exists($value, $identifier = 'user_name', $checkDeleted = } /** - * Return a cache instance specific to that user + * Return a cache instance specific to that user. * * @return \Illuminate\Contracts\Cache\Store */ public function getCache() { - return static::$ci->cache->tags('_u'.$this->id); + return static::$ci->cache->tags('_u' . $this->id); } /** - * Allows you to get the full name of the user using `$user->full_name` + * Allows you to get the full name of the user using `$user->full_name`. * * @return string */ @@ -271,7 +281,8 @@ public function reloadCachedPermissions() /** * Get the amount of time, in seconds, that has elapsed since the last activity of a certain time for this user. * - * @param string $type The type of activity to search for. + * @param string $type The type of activity to search for. + * * @return int */ public function getSecondsSinceLastActivity($type) @@ -325,7 +336,8 @@ public function lastActivity() /** * Find the most recent activity for this user of a particular type. * - * @param string $type + * @param string $type + * * @return \Illuminate\Database\Eloquent\Builder */ public function lastActivityOfType($type = null) @@ -345,7 +357,8 @@ public function lastActivityOfType($type = null) /** * Get the most recent time for a specified activity type for this user. * - * @param string $type + * @param string $type + * * @return string|null The last activity time, as a SQL formatted time (YYYY-MM-DD HH:MM:SS), or null if an activity of this type doesn't exist. */ public function lastActivityTime($type) @@ -361,14 +374,16 @@ public function lastActivityTime($type) * Performs tasks to be done after this user has been successfully authenticated. * * By default, adds a new sign-in activity and updates any legacy hash. + * * @param mixed[] $params Optional array of parameters used for this event handler. + * * @todo Transition to Laravel Event dispatcher to handle this */ public function onLogin($params = []) { // Add a sign in activity (time is automatically set by database) static::$ci->userActivityLogger->info("User {$this->user_name} signed in.", [ - 'type' => 'sign_in' + 'type' => 'sign_in', ]); // Update password if we had encountered an outdated hash @@ -399,13 +414,15 @@ public function onLogin($params = []) * Performs tasks to be done after this user has been logged out. * * By default, adds a new sign-out activity. + * * @param mixed[] $params Optional array of parameters used for this event handler. + * * @todo Transition to Laravel Event dispatcher to handle this */ public function onLogout($params = []) { static::$ci->userActivityLogger->info("User {$this->user_name} signed out.", [ - 'type' => 'sign_out' + 'type' => 'sign_out', ]); return $this; @@ -462,8 +479,9 @@ public function roles() /** * Query scope to get all users who have a specific role. * - * @param Builder $query - * @param int $roleId + * @param Builder $query + * @param int $roleId + * * @return Builder */ public function scopeForRole($query, $roleId) @@ -477,7 +495,8 @@ public function scopeForRole($query, $roleId) /** * Joins the user's most recent activity directly, so we can do things like sort, search, paginate, etc. * - * @param Builder $query + * @param Builder $query + * * @return Builder */ public function scopeJoinLastActivity($query) diff --git a/app/sprinkles/account/src/Database/Models/Verification.php b/app/sprinkles/account/src/Database/Models/Verification.php index 441890d37..5d982c855 100644 --- a/app/sprinkles/account/src/Database/Models/Verification.php +++ b/app/sprinkles/account/src/Database/Models/Verification.php @@ -1,5 +1,6 @@ 'terran', 'name' => 'Terran', 'description' => 'The terrans are a young species with psionic potential. The terrans of the Koprulu sector descend from the survivors of a disastrous 23rd century colonization mission from Earth.', - 'icon' => 'sc sc-terran' + 'icon' => 'sc sc-terran', ]), new Group([ 'slug' => 'zerg', 'name' => 'Zerg', 'description' => 'Dedicated to the pursuit of genetic perfection, the zerg relentlessly hunt down and assimilate advanced species across the galaxy, incorporating useful genetic code into their own.', - 'icon' => 'sc sc-zerg' + 'icon' => 'sc sc-zerg', ]), new Group([ 'slug' => 'protoss', 'name' => 'Protoss', 'description' => 'The protoss, a.k.a. the Firstborn, are a sapient humanoid race native to Aiur. Their advanced technology complements and enhances their psionic mastery.', - 'icon' => 'sc sc-protoss' - ]) + 'icon' => 'sc sc-protoss', + ]), ]; } } diff --git a/app/sprinkles/account/src/Database/Seeds/DefaultPermissions.php b/app/sprinkles/account/src/Database/Seeds/DefaultPermissions.php index c29eb55dd..965f4a630 100644 --- a/app/sprinkles/account/src/Database/Seeds/DefaultPermissions.php +++ b/app/sprinkles/account/src/Database/Seeds/DefaultPermissions.php @@ -1,5 +1,6 @@ Role::where('slug', 'user')->first()->id, 'group-admin' => Role::where('slug', 'group-admin')->first()->id, - 'site-admin' => Role::where('slug', 'site-admin')->first()->id + 'site-admin' => Role::where('slug', 'site-admin')->first()->id, ]; return [ @@ -51,142 +52,143 @@ protected function getPermissions() 'slug' => 'create_group', 'name' => 'Create group', 'conditions' => 'always()', - 'description' => 'Create a new group.' + 'description' => 'Create a new group.', ]), 'create_user' => new Permission([ 'slug' => 'create_user', 'name' => 'Create user', 'conditions' => 'always()', - 'description' => 'Create a new user in your own group and assign default roles.' + 'description' => 'Create a new user in your own group and assign default roles.', ]), 'create_user_field' => new Permission([ 'slug' => 'create_user_field', 'name' => 'Set new user group', 'conditions' => "subset(fields,['group'])", - 'description' => 'Set the group when creating a new user.' + 'description' => 'Set the group when creating a new user.', ]), 'delete_group' => new Permission([ 'slug' => 'delete_group', 'name' => 'Delete group', 'conditions' => 'always()', - 'description' => 'Delete a group.' + 'description' => 'Delete a group.', ]), 'delete_user' => new Permission([ 'slug' => 'delete_user', 'name' => 'Delete user', 'conditions' => "!has_role(user.id,{$defaultRoleIds['site-admin']}) && !is_master(user.id)", - 'description' => 'Delete users who are not Site Administrators.' + 'description' => 'Delete users who are not Site Administrators.', ]), 'update_account_settings' => new Permission([ 'slug' => 'update_account_settings', 'name' => 'Edit user', 'conditions' => 'always()', - 'description' => 'Edit your own account settings.' + 'description' => 'Edit your own account settings.', ]), 'update_group_field' => new Permission([ 'slug' => 'update_group_field', 'name' => 'Edit group', 'conditions' => 'always()', - 'description' => 'Edit basic properties of any group.' + 'description' => 'Edit basic properties of any group.', ]), 'update_user_field' => new Permission([ 'slug' => 'update_user_field', 'name' => 'Edit user', 'conditions' => "!has_role(user.id,{$defaultRoleIds['site-admin']}) && subset(fields,['name','email','locale','group','flag_enabled','flag_verified','password'])", - 'description' => 'Edit users who are not Site Administrators.' + 'description' => 'Edit users who are not Site Administrators.', ]), 'update_user_field_group' => new Permission([ 'slug' => 'update_user_field', 'name' => 'Edit group user', 'conditions' => "equals_num(self.group_id,user.group_id) && !is_master(user.id) && !has_role(user.id,{$defaultRoleIds['site-admin']}) && (!has_role(user.id,{$defaultRoleIds['group-admin']}) || equals_num(self.id,user.id)) && subset(fields,['name','email','locale','flag_enabled','flag_verified','password'])", - 'description' => 'Edit users in your own group who are not Site or Group Administrators, except yourself.' + 'description' => 'Edit users in your own group who are not Site or Group Administrators, except yourself.', ]), 'uri_account_settings' => new Permission([ 'slug' => 'uri_account_settings', 'name' => 'Account settings page', 'conditions' => 'always()', - 'description' => 'View the account settings page.' + 'description' => 'View the account settings page.', ]), 'uri_activities' => new Permission([ 'slug' => 'uri_activities', 'name' => 'Activity monitor', 'conditions' => 'always()', - 'description' => 'View a list of all activities for all users.' + 'description' => 'View a list of all activities for all users.', ]), 'uri_dashboard' => new Permission([ 'slug' => 'uri_dashboard', 'name' => 'Admin dashboard', 'conditions' => 'always()', - 'description' => 'View the administrative dashboard.' + 'description' => 'View the administrative dashboard.', ]), 'uri_group' => new Permission([ 'slug' => 'uri_group', 'name' => 'View group', 'conditions' => 'always()', - 'description' => 'View the group page of any group.' + 'description' => 'View the group page of any group.', ]), 'uri_group_own' => new Permission([ 'slug' => 'uri_group', 'name' => 'View own group', 'conditions' => 'equals_num(self.group_id,group.id)', - 'description' => 'View the group page of your own group.' + 'description' => 'View the group page of your own group.', ]), 'uri_groups' => new Permission([ 'slug' => 'uri_groups', 'name' => 'Group management page', 'conditions' => 'always()', - 'description' => 'View a page containing a list of groups.' + 'description' => 'View a page containing a list of groups.', ]), 'uri_user' => new Permission([ 'slug' => 'uri_user', 'name' => 'View user', 'conditions' => 'always()', - 'description' => 'View the user page of any user.' + 'description' => 'View the user page of any user.', ]), 'uri_user_in_group' => new Permission([ 'slug' => 'uri_user', 'name' => 'View user', 'conditions' => "equals_num(self.group_id,user.group_id) && !is_master(user.id) && !has_role(user.id,{$defaultRoleIds['site-admin']}) && (!has_role(user.id,{$defaultRoleIds['group-admin']}) || equals_num(self.id,user.id))", - 'description' => 'View the user page of any user in your group, except the master user and Site and Group Administrators (except yourself).' + 'description' => 'View the user page of any user in your group, except the master user and Site and Group Administrators (except yourself).', ]), 'uri_users' => new Permission([ 'slug' => 'uri_users', 'name' => 'User management page', 'conditions' => 'always()', - 'description' => 'View a page containing a table of users.' + 'description' => 'View a page containing a table of users.', ]), 'view_group_field' => new Permission([ 'slug' => 'view_group_field', 'name' => 'View group', 'conditions' => "in(property,['name','icon','slug','description','users'])", - 'description' => 'View certain properties of any group.' + 'description' => 'View certain properties of any group.', ]), 'view_group_field_own' => new Permission([ 'slug' => 'view_group_field', 'name' => 'View group', 'conditions' => "equals_num(self.group_id,group.id) && in(property,['name','icon','slug','description','users'])", - 'description' => 'View certain properties of your own group.' + 'description' => 'View certain properties of your own group.', ]), 'view_user_field' => new Permission([ 'slug' => 'view_user_field', 'name' => 'View user', 'conditions' => "in(property,['user_name','name','email','locale','theme','roles','group','activities'])", - 'description' => 'View certain properties of any user.' + 'description' => 'View certain properties of any user.', ]), 'view_user_field_group' => new Permission([ 'slug' => 'view_user_field', 'name' => 'View user', 'conditions' => "equals_num(self.group_id,user.group_id) && !is_master(user.id) && !has_role(user.id,{$defaultRoleIds['site-admin']}) && (!has_role(user.id,{$defaultRoleIds['group-admin']}) || equals_num(self.id,user.id)) && in(property,['user_name','name','email','locale','roles','group','activities'])", - 'description' => 'View certain properties of any user in your own group, except the master user and Site and Group Administrators (except yourself).' - ]) + 'description' => 'View certain properties of any user in your own group, except the master user and Site and Group Administrators (except yourself).', + ]), ]; } /** - * Save permissions + * Save permissions. + * * @param array $permissions */ - protected function savePermissions(array $permissions) + protected function savePermissions(array &$permissions) { foreach ($permissions as $slug => $permission) { @@ -204,7 +206,8 @@ protected function savePermissions(array $permissions) } /** - * Sync permissions with default roles + * Sync permissions with default roles. + * * @param array $permissions */ protected function syncPermissionsRole(array $permissions) @@ -214,7 +217,7 @@ protected function syncPermissionsRole(array $permissions) $roleUser->permissions()->sync([ $permissions['update_account_settings']->id, $permissions['uri_account_settings']->id, - $permissions['uri_dashboard']->id + $permissions['uri_dashboard']->id, ]); } @@ -234,7 +237,7 @@ protected function syncPermissionsRole(array $permissions) $permissions['uri_user']->id, $permissions['uri_users']->id, $permissions['view_group_field']->id, - $permissions['view_user_field']->id + $permissions['view_user_field']->id, ]); } @@ -246,7 +249,7 @@ protected function syncPermissionsRole(array $permissions) $permissions['uri_group_own']->id, $permissions['uri_user_in_group']->id, $permissions['view_group_field_own']->id, - $permissions['view_user_field_group']->id + $permissions['view_user_field_group']->id, ]); } } diff --git a/app/sprinkles/account/src/Database/Seeds/DefaultRoles.php b/app/sprinkles/account/src/Database/Seeds/DefaultRoles.php index a3edead75..33cf52f3b 100644 --- a/app/sprinkles/account/src/Database/Seeds/DefaultRoles.php +++ b/app/sprinkles/account/src/Database/Seeds/DefaultRoles.php @@ -1,5 +1,6 @@ 'user', 'name' => 'User', - 'description' => 'This role provides basic user functionality.' + 'description' => 'This role provides basic user functionality.', ]), new Role([ 'slug' => 'site-admin', 'name' => 'Site Administrator', - 'description' => 'This role is meant for "site administrators", who can basically do anything except create, edit, or delete other administrators.' + 'description' => 'This role is meant for "site administrators", who can basically do anything except create, edit, or delete other administrators.', ]), new Role([ 'slug' => 'group-admin', 'name' => 'Group Administrator', - 'description' => 'This role is meant for "group administrators", who can basically do anything with users in their own group, except other administrators of that group.' - ]) + 'description' => 'This role is meant for "group administrators", who can basically do anything with users in their own group, except other administrators of that group.', + ]), ]; } } diff --git a/app/sprinkles/account/src/Error/Handler/AuthCompromisedExceptionHandler.php b/app/sprinkles/account/src/Error/Handler/AuthCompromisedExceptionHandler.php index 066ceebb8..b7e88178d 100644 --- a/app/sprinkles/account/src/Error/Handler/AuthCompromisedExceptionHandler.php +++ b/app/sprinkles/account/src/Error/Handler/AuthCompromisedExceptionHandler.php @@ -1,5 +1,6 @@ ci->router->pathFor('login', [], [ - 'redirect' => $path + 'redirect' => $path, ]); $response = $response->withRedirect($loginPage); diff --git a/app/sprinkles/account/src/Error/Handler/ForbiddenExceptionHandler.php b/app/sprinkles/account/src/Error/Handler/ForbiddenExceptionHandler.php index 9a55efa9b..fd29a4a1a 100644 --- a/app/sprinkles/account/src/Error/Handler/ForbiddenExceptionHandler.php +++ b/app/sprinkles/account/src/Error/Handler/ForbiddenExceptionHandler.php @@ -1,5 +1,6 @@ isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null, 'user_id' => $this->userId, 'occurred_at' => $record['datetime'], - 'description' => $record['message'] + 'description' => $record['message'], ]; $record['extra'] = array_replace_recursive($record['extra'], $additionalFields, $record['context']); diff --git a/app/sprinkles/account/src/Rememberme/PDOStorage.php b/app/sprinkles/account/src/Rememberme/PDOStorage.php index ce67e0499..42ab33e02 100644 --- a/app/sprinkles/account/src/Rememberme/PDOStorage.php +++ b/app/sprinkles/account/src/Rememberme/PDOStorage.php @@ -1,5 +1,6 @@ where([ 'user_id' => $credential, - 'persistent_token' => sha1($persistentToken) + 'persistent_token' => sha1($persistentToken), ])->first(); if (!$result) { @@ -65,7 +67,7 @@ public function storeTriplet($credential, $token, $persistentToken, $expire = 0) 'user_id' => $credential, 'token' => sha1($token), 'persistent_token' => sha1($persistentToken), - 'expires_at' => date('Y-m-d H:i:s', $expire) + 'expires_at' => date('Y-m-d H:i:s', $expire), ]); $persistence->save(); } @@ -78,12 +80,12 @@ public function cleanTriplet($credential, $persistentToken) { Persistence::where([ 'user_id' => $credential, - 'persistent_token' => sha1($persistentToken) + 'persistent_token' => sha1($persistentToken), ])->delete(); } /** - * Replace current token after successful authentication + * Replace current token after successful authentication. * * @param mixed $credential * @param string $token diff --git a/app/sprinkles/account/src/Repository/PasswordResetRepository.php b/app/sprinkles/account/src/Repository/PasswordResetRepository.php index 275d540db..853db28d9 100644 --- a/app/sprinkles/account/src/Repository/PasswordResetRepository.php +++ b/app/sprinkles/account/src/Repository/PasswordResetRepository.php @@ -1,5 +1,6 @@ fill([ 'completed' => true, - 'completed_at' => Carbon::now() + 'completed_at' => Carbon::now(), ]); $model->save(); @@ -121,9 +126,10 @@ public function complete($token, $userParams = []) /** * Create a new token for a specified user. * - * @param UserInterface $user The user object to associate with this token. - * @param int $timeout The time, in seconds, after which this token should expire. - * @return Model The model (PasswordReset, Verification, etc) object that stores the token. + * @param UserInterface $user The user object to associate with this token. + * @param int $timeout The time, in seconds, after which this token should expire. + * + * @return Model The model (PasswordReset, Verification, etc) object that stores the token. */ public function create(UserInterface $user, $timeout) { @@ -144,7 +150,7 @@ public function create(UserInterface $user, $timeout) $model->fill([ 'hash' => $hash, 'completed' => false, - 'expires_at' => $expiresAt + 'expires_at' => $expiresAt, ]); $model->user_id = $user->id; @@ -157,8 +163,9 @@ public function create(UserInterface $user, $timeout) /** * Determine if a specified user has an incomplete and unexpired token. * - * @param UserInterface $user The user object to look up. - * @param int $token Optionally, try to match a specific token. + * @param UserInterface $user The user object to look up. + * @param int $token Optionally, try to match a specific token. + * * @return Model|false */ public function exists(UserInterface $user, $token = null) @@ -180,7 +187,8 @@ public function exists(UserInterface $user, $token = null) /** * Delete all existing tokens from the database for a particular user. * - * @param UserInterface $user + * @param UserInterface $user + * * @return int */ protected function removeExisting(UserInterface $user) @@ -207,7 +215,9 @@ public function removeExpired() * Generate a new random token for this user. * * This generates a token to use for verifying a new account, resetting a lost password, etc. - * @param string $gen specify an existing token that, if we happen to generate the same value, we should regenerate on. + * + * @param string $gen specify an existing token that, if we happen to generate the same value, we should regenerate on. + * * @return string */ protected function generateRandomToken($gen = null) @@ -225,9 +235,11 @@ protected function generateRandomToken($gen = null) * Modify the user during the token completion process. * * This method is called during complete(), and is a way for concrete implementations to modify the user. - * @param UserInterface $user the user object to modify. - * @param mixed[] $args - * @return mixed[] $args the list of parameters that were supplied to the call to `complete()` + * + * @param UserInterface $user the user object to modify. + * @param mixed[] $args + * + * @return mixed[] $args the list of parameters that were supplied to the call to `complete()` */ abstract protected function updateUser(UserInterface $user, $args); } diff --git a/app/sprinkles/account/src/Repository/VerificationRepository.php b/app/sprinkles/account/src/Repository/VerificationRepository.php index e6c73df35..c7f76065f 100644 --- a/app/sprinkles/account/src/Repository/VerificationRepository.php +++ b/app/sprinkles/account/src/Repository/VerificationRepository.php @@ -1,5 +1,6 @@ extend(...) $callbacks = [ - /** + /* * Unconditionally grant permission - use carefully! * @return bool returns true no matter what. */ @@ -226,7 +227,7 @@ public function register(ContainerInterface $container) return true; }, - /** + /* * Check if the specified values are identical to one another (strict comparison). * @param mixed $val1 the first value to compare. * @param mixed $val2 the second value to compare. @@ -236,7 +237,7 @@ public function register(ContainerInterface $container) return $val1 === $val2; }, - /** + /* * Check if the specified values are numeric, and if so, if they are equal to each other. * @param mixed $val1 the first value to compare. * @param mixed $val2 the second value to compare. @@ -253,7 +254,7 @@ public function register(ContainerInterface $container) return $val1 == $val2; }, - /** + /* * Check if the specified user (by user_id) has a particular role. * * @param int $user_id the id of the user. @@ -267,7 +268,7 @@ public function register(ContainerInterface $container) ->count() > 0; }, - /** + /* * Check if the specified value $needle is in the values of $haystack. * * @param mixed $needle the value to look for in $haystack @@ -278,7 +279,7 @@ public function register(ContainerInterface $container) return in_array($needle, $haystack); }, - /** + /* * Check if the specified user (by user_id) is in a particular group. * * @param int $user_id the id of the user. @@ -291,7 +292,7 @@ public function register(ContainerInterface $container) return $user->group_id == $group_id; }, - /** + /* * Check if the specified user (by user_id) is the master user. * * @param int $user_id the id of the user. @@ -302,7 +303,7 @@ public function register(ContainerInterface $container) return $user_id == $config['reserved_user_ids.master']; }, - /** + /* * Check if all values in the array $needle are present in the values of $haystack. * * @param array[mixed] $needle the array whose values we should look for in $haystack @@ -313,7 +314,7 @@ public function register(ContainerInterface $container) return count($needle) == count(array_intersect($needle, $haystack)); }, - /** + /* * Check if all keys of the array $needle are present in the values of $haystack. * * This function is useful for whitelisting an array of key-value parameters. @@ -323,7 +324,7 @@ public function register(ContainerInterface $container) */ 'subset_keys' => function ($needle, $haystack) { return count($needle) == count(array_intersect(array_keys($needle), $haystack)); - } + }, ]; $authorizer = new AuthorizationManager($c, $callbacks); @@ -331,7 +332,7 @@ public function register(ContainerInterface $container) return $authorizer; }; - /** + /* * Loads the User object for the currently logged-in user. * * @return \UserFrosting\Sprinkle\Account\Database\Models\Interfaces\UserInterface @@ -348,7 +349,7 @@ public function register(ContainerInterface $container) return $currentUser; }; - /** + /* * Password Hasher service * * @return \UserFrosting\Sprinkle\Account\Authenticate\Hasher @@ -359,13 +360,13 @@ public function register(ContainerInterface $container) return $hasher; }; - /** + /* * Returns a callback that forwards to dashboard if user is already logged in. * * @return callable */ $container['redirect.onAlreadyLoggedIn'] = function ($c) { - /** + /* * This method is invoked when a user attempts to perform certain public actions when they are already logged in. * * @todo Forward to user's landing page or last visited page @@ -381,13 +382,13 @@ public function register(ContainerInterface $container) }; }; - /** + /* * Returns a callback that handles setting the `UF-Redirect` header after a successful login. * * @return callable */ $container['redirect.onLogin'] = function ($c) { - /** + /* * This method is invoked when a user completes the login process. * * Returns a callback that handles setting the `UF-Redirect` header after a successful login. @@ -417,7 +418,7 @@ public function register(ContainerInterface $container) }; }; - /** + /* * Repository for password reset requests. * * @return \UserFrosting\Sprinkle\Account\Repository\PasswordResetRepository @@ -431,7 +432,7 @@ public function register(ContainerInterface $container) return $repo; }; - /** + /* * Repository for verification requests. * * @return \UserFrosting\Sprinkle\Account\Repository\VerificationRepository @@ -445,7 +446,7 @@ public function register(ContainerInterface $container) return $repo; }; - /** + /* * Logger for logging the current user's activities to the database. * * Extend this service to push additional handlers onto the 'userActivity' log stack. diff --git a/app/sprinkles/account/src/Twig/AccountExtension.php b/app/sprinkles/account/src/Twig/AccountExtension.php index 69625a953..e45f85649 100644 --- a/app/sprinkles/account/src/Twig/AccountExtension.php +++ b/app/sprinkles/account/src/Twig/AccountExtension.php @@ -1,5 +1,6 @@ services->authenticator; return $authenticator->check(); - }) + }), ]; } @@ -70,7 +71,7 @@ public function getGlobals() } return [ - 'current_user' => $currentUser + 'current_user' => $currentUser, ]; } } diff --git a/app/sprinkles/account/src/Util/HashFailedException.php b/app/sprinkles/account/src/Util/HashFailedException.php index d394166c5..e65d8324e 100644 --- a/app/sprinkles/account/src/Util/HashFailedException.php +++ b/app/sprinkles/account/src/Util/HashFailedException.php @@ -1,5 +1,6 @@ - - - - - - - - -{% endblock %} - -{% block scripts_page %} - - - - - {{ assets.js('js/pages/register') | raw }} -{% endblock %} +{% extends "pages/abstract/base.html.twig" %} + +{# Overrides blocks in head of base template #} +{% block page_title %}{{translate('REGISTER')}}{% endblock %} + +{% block page_description %}{{translate('PAGE.LOGIN.DESCRIPTION', {'site_name': site.title })}}{% endblock %} + +{% block body_attributes %} + class="hold-transition login-page" +{% endblock %} + +{% block content %} + + +{% endblock %} + +{% block scripts_page %} + + + + + {{ assets.js('js/pages/register') | raw }} +{% endblock %} diff --git a/app/sprinkles/account/tests/Integration/AuthenticatorTest.php b/app/sprinkles/account/tests/Integration/AuthenticatorTest.php index 75bc42563..7fcb5d5c4 100644 --- a/app/sprinkles/account/tests/Integration/AuthenticatorTest.php +++ b/app/sprinkles/account/tests/Integration/AuthenticatorTest.php @@ -1,5 +1,6 @@ createTestUser(); $user = $this->invokeMethod($authenticator, 'validateUserAccount', [$testUser->id]); - $this->assertSame($testUser->id, $user->id); + $testUserId = $testUser->id; + $userId = $user->id; + $this->assertSame($testUserId, $userId); } /** @@ -305,7 +308,7 @@ public function testAttempt_withFlagEnabledFalse(Authenticator $authenticator) $password = 'FooBar'; $testUser = $this->createTestUser(false, false, [ 'password' => Password::hash($password), - 'flag_enabled' => 0 + 'flag_enabled' => 0, ]); $currentUser = $authenticator->attempt('user_name', $testUser->user_name, $password, false); @@ -322,7 +325,7 @@ public function testAttempt_withFlagVerifiedFalse(Authenticator $authenticator) $password = 'FooBar'; $testUser = $this->createTestUser(false, false, [ 'password' => Password::hash($password), - 'flag_verified' => 0 + 'flag_verified' => 0, ]); $currentUser = $authenticator->attempt('user_name', $testUser->user_name, $password, false); @@ -344,7 +347,7 @@ public function testAttempt_withFlagVerifiedFalseNoEmailVerification(Authenticat $password = 'FooBar'; $testUser = $this->createTestUser(false, false, [ 'password' => Password::hash($password), - 'flag_verified' => 0 + 'flag_verified' => 0, ]); $currentUser = $authenticator->attempt('user_name', $testUser->user_name, $password, false); @@ -365,7 +368,7 @@ public function testAttempt_withBadPassword(Authenticator $authenticator) { $password = 'FooBar'; $testUser = $this->createTestUser(false, false, [ - 'password' => Password::hash($password) + 'password' => Password::hash($password), ]); $currentUser = $authenticator->attempt('user_name', $testUser->user_name, 'BarFoo', false); diff --git a/app/sprinkles/account/tests/Integration/AuthorizationManagerTest.php b/app/sprinkles/account/tests/Integration/AuthorizationManagerTest.php index 01ae32d4c..5f2d930c6 100644 --- a/app/sprinkles/account/tests/Integration/AuthorizationManagerTest.php +++ b/app/sprinkles/account/tests/Integration/AuthorizationManagerTest.php @@ -1,5 +1,6 @@ setupTestDatabase(); + + if ($this->usingInMemoryDatabase() || !static::$initialized) { + + // Setup database, then setup User & default role + $this->refreshDatabase(); + static::$initialized = true; + } + } + + public function tearDown() + { + parent::tearDown(); + m::close(); + } + + /** + * @return AccountController + */ + public function testControllerConstructor() + { + $controller = $this->getController(); + $this->assertInstanceOf(AccountController::class, $controller); + + return $controller; + } + + /** + * N.B.: Must be first test, before any master user is created + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testRegisterWithNoMasterUser(AccountController $controller) + { + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'spiderbro' => 'http://', + ]); + + $result = $controller->register($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 403); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * N.B.: Run this register second, as it's easier if no test user is present. + * @depends testControllerConstructor + * @see UserFrosting\Sprinkle\Account\Tests\Integration\RegistrationTest for complete registration exception (for example duplicate email) testing + */ + public function testRegister() + { + // Force locale config + $this->ci->config['site.registration.user_defaults.locale'] = 'en_US'; + $this->ci->config['site.locales.available'] = [ + 'en_US' => 'English', + ]; + + // Create fake mailer + $mailer = m::mock(Mailer::class); + $mailer->shouldReceive('send')->once()->with(\Mockery::type(TwigMailMessage::class)); + $this->ci->mailer = $mailer; + + // Register will fail on PGSQL if a user is created with forced id + // before registration occurs because the forced id mess the auto_increment + // @see https://stackoverflow.com/questions/36157029/laravel-5-2-eloquent-save-auto-increment-pgsql-exception-on-same-id + // So we create a dummy user and assign the master id config to it's id + // to bypass the "no registration if no master user" security feature. + // (Note the dummy should by default be id n°1, but we still assign the config + // in case the default config does not return 1) + $fm = $this->ci->factory; + $dummyUser = $fm->create(User::class); + $this->ci->config['reserved_user_ids.master'] = $dummyUser->id; + + // Recreate controller to use fake config + $controller = $this->getController(); + + // Perfrom common test code + $this->performActualRegisterTest($controller); + } + + /** + * @depends testControllerConstructor + * @depends testRegister + */ + public function testRegisterWithNoEmailVerification() + { + // Delete previous attempt so we can reuse the same shared test code + if ($user = User::where('email', 'testRegister@test.com')->first()) { + $user->delete(true); + } + + // Force locale config, disable email verification + $this->ci->config['site.registration.require_email_verification'] = false; + $this->ci->config['site.registration.user_defaults.locale'] = 'en_US'; + $this->ci->config['site.locales.available'] = [ + 'en_US' => 'English', + ]; + + // Bypass security feature + $fm = $this->ci->factory; + $dummyUser = $fm->create(User::class); + $this->ci->config['reserved_user_ids.master'] = $dummyUser->id; + + // Recreate controller to use fake config + $controller = $this->getController(); + + // Perfrom common test code + $this->performActualRegisterTest($controller); + } + + /** + * @param AccountController $controller + */ + protected function performActualRegisterTest(AccountController $controller) + { + // Genereate a captcha for next request. + $captcha = new Captcha($this->ci->session, $this->ci->config['session.keys.captcha']); + $captcha->generateRandomCode(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'spiderbro' => 'http://', + 'captcha' => $captcha->getCaptcha(), + 'user_name' => 'RegisteredUser', + 'first_name' => 'Testing', + 'last_name' => 'Register', + 'email' => 'testRegister@test.com', + 'password' => 'FooBarFooBar123', + 'passwordc' => 'FooBarFooBar123', + 'locale' => '', + ]); + + $result = $controller->register($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure the user is added to the db by querying it + $users = User::where('email', 'testRegister@test.com')->get(); + $this->assertCount(1, $users); + $this->assertSame('RegisteredUser', $users->first()['user_name']); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + + /** + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testcheckUsername(AccountController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'potato' + ]); + + $result = $controller->checkUsername($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertSame('true', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + * @depends testcheckUsername + * @param AccountController $controller + */ + public function testcheckUsernameWithNoData(AccountController $controller) + { + $this->expectException(BadRequestException::class); + $controller->checkUsername($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructor + * @depends testcheckUsername + * @param AccountController $controller + */ + public function testcheckUsernameWithUsernameNotAvailable(AccountController $controller) + { + // Create test user + $this->createTestUser(false, false, [ + 'user_name' => 'userfoo' + ]); + + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'userfoo' + ]); + + $result = $controller->checkUsername($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + $this->assertNotSame('true', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + * @depends testcheckUsername + */ + public function testcheckUsernameWithThrottler() + { + // Create fake throttler + $throttler = m::mock(Throttler::class); + $throttler->shouldReceive('getDelay')->once()->with('check_username_request')->andReturn(90); + $this->ci->throttler = $throttler; + + // Recreate controller to use fake throttler + $controller = $this->getController(); + + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'potato' + ]); + + $result = $controller->checkUsername($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 429); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + */ + public function testdenyResetPassword() + { + // Create fake PasswordResetRepository + $repoPasswordReset = m::mock(PasswordResetRepository::class); + $repoPasswordReset->shouldReceive('cancel')->once()->with('potato')->andReturn(true); + $this->ci->repoPasswordReset = $repoPasswordReset; + + // Recreate controller to use fake PasswordResetRepository + $controller = $this->getController(); + + $request = $this->getRequest()->withQueryParams([ + 'token' => 'potato' + ]); + + $result = $controller->denyResetPassword($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 302); + $this->assertEquals($this->ci->router->pathFor('login'), $result->getHeaderLine('Location')); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testdenyResetPassword + */ + public function testdenyResetPasswordWithFailedPasswordReset() + { + // Create fake repoPasswordReset + $repoPasswordReset = m::mock(PasswordResetRepository::class); + $repoPasswordReset->shouldReceive('cancel')->once()->with('potato')->andReturn(false); + $this->ci->repoPasswordReset = $repoPasswordReset; + + // Recreate controller to use fake throttler + $controller = $this->getController(); + + $request = $this->getRequest()->withQueryParams([ + 'token' => 'potato' + ]); + + $result = $controller->denyResetPassword($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 302); + $this->assertEquals($this->ci->router->pathFor('login'), $result->getHeaderLine('Location')); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testdenyResetPassword + * @param AccountController $controller + */ + public function testdenyResetPasswordWithFailedValidation(AccountController $controller) + { + $result = $controller->denyResetPassword($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 302); + $this->assertEquals($this->ci->router->pathFor('login'), $result->getHeaderLine('Location')); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * N.B.: This test is incomplete as it doesn't actually check if + * repoPasswordReset returns the correct info and the message contains + * the right content + * @depends testControllerConstructor + */ + public function testforgotPassword() + { + // Create fake mailer + $mailer = m::mock(Mailer::class); + $mailer->shouldReceive('send')->once()->with(\Mockery::type(TwigMailMessage::class)); + $this->ci->mailer = $mailer; + + // Create fake user to test + $user = $this->createTestUser(false, false, [ + 'email' => 'foo@bar.com' + ]); + + // Recreate controller to use fake mailer + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'email' => 'foo@bar.com' + ]); + + $result = $controller->forgotPassword($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testforgotPassword + * @param AccountController $controller + */ + public function testforgotPasswordWithFailedValidation(AccountController $controller) + { + $request = $this->getRequest()->withParsedBody([]); + + $result = $controller->forgotPassword($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testforgotPassword + */ + public function testforgotPasswordWithThrottler() + { + // Create fake throttler + $throttler = m::mock(Throttler::class); + $throttler->shouldReceive('getDelay')->once()->with('password_reset_request', ['email' => 'foo@bar.com'])->andReturn(90); + $this->ci->throttler = $throttler; + + // Recreate controller to use fake throttler + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'email' => 'foo@bar.com' + ]); + + $result = $controller->forgotPassword($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 429); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testgetModalAccountTos(AccountController $controller) + { + $result = $controller->getModalAccountTos($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testimageCaptcha(AccountController $controller) + { + $result = $controller->imageCaptcha($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testlogin(AccountController $controller) + { + // Create a test user + $testUser = $this->createTestUser(); + + // Faker doesn't hash the password. Let's do that now + $unhashed = $testUser->password; + $testUser->password = Password::hash($testUser->password); + $testUser->save(); + + // Recreate controller to use test user + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'user_name' => $testUser->user_name, + 'password' => $unhashed, + 'rememberme' => false, + ]); + + $result = $controller->login($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + // Can't assert the status code or data, as this can be overwrited by sprinkles + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testlogin + * @param AccountController $controller + */ + public function testloginWithEmail(AccountController $controller) + { + // Create a test user + $testUser = $this->createTestUser(); + + // Faker doesn't hash the password. Let's do that now + $unhashed = $testUser->password; + $testUser->password = Password::hash($testUser->password); + $testUser->save(); + + // Recreate controller to use test user + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'user_name' => $testUser->email, + 'password' => $unhashed, + 'rememberme' => false, + ]); + + $result = $controller->login($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + // Can't assert the status code or data, as this can be overwrited by sprinkles + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testloginWithLoggedInUser(AccountController $controller) + { + // Create a test user + $testUser = $this->createTestUser(false, true); + + // Recreate controller to use fake throttler + $controller = $this->getController(); + + $result = $controller->login($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('warning', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testloginWithFailledValidation(AccountController $controller) + { + // Set POST + $request = $this->getRequest()->withParsedBody([]); + + $result = $controller->login($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + */ + public function testloginWithThrottler() + { + // Create fake throttler + $throttler = m::mock(Throttler::class); + $throttler->shouldReceive('getDelay')->once()->with('sign_in_attempt', ['user_identifier' => 'foo'])->andReturn(90); + $this->ci->throttler = $throttler; + + // Recreate controller to use fake throttler + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'user_name' => 'foo', + 'password' => 'bar', + 'rememberme' => false, + ]); + + $result = $controller->login($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 429); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + */ + public function testloginWithDisableEmail() + { + // Force config + $this->ci->config['site.login.enable_email'] = false; + + // Recreate controller to use new config + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'user_name' => 'foo@bar.com', + 'password' => 'bar', + ]); + + $result = $controller->login($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 403); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + */ + public function testlogoutWithLoggedInUser() + { + // Create a test user + $testUser = $this->createTestUser(false, true); + + // Recreate controller to use fake throttler + $controller = $this->getController(); + + $result = $controller->logout($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 302); + $this->assertEquals($this->ci->config['site.uri.public'], $result->getHeaderLine('Location')); + } + + /** + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testlogoutWithNoUser(AccountController $controller) + { + $result = $controller->logout($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 302); + $this->assertEquals($this->ci->config['site.uri.public'], $result->getHeaderLine('Location')); + } + + /** + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testpageForgotPassword(AccountController $controller) + { + $result = $controller->pageForgotPassword($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testpageRegister(AccountController $controller) + { + $result = $controller->pageRegister($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + * @depends testpageRegister + */ + public function testpageRegisterWithDisabledRegistration() + { + // Force config + $this->ci->config['site.registration.enabled'] = false; + + // Recreate controller to use new config + $controller = $this->getController(); + + $this->expectException(NotFoundException::class); + $controller->pageRegister($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructor + * @depends testpageRegister + */ + public function testpageRegisterWithNoLocales() + { + // Force config + $this->ci->config['site.locales.available'] = []; + + // Recreate controller to use new config + $controller = $this->getController(); + + $result = $controller->pageRegister($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + * @depends testpageRegister + */ + public function testpageRegisterWithLoggedInUser() + { + // Create a test user + $testUser = $this->createTestUser(false, true); + + // Recreate controller to use fake throttler + $controller = $this->getController(); + + $result = $controller->pageRegister($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 302); + } + + /** + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testpageResendVerification(AccountController $controller) + { + $result = $controller->pageResendVerification($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testpageResetPassword(AccountController $controller) + { + $result = $controller->pageResetPassword($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testpageSetPassword(AccountController $controller) + { + $result = $controller->pageSetPassword($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + */ + public function testpageSettings() + { + // Create admin user. He will have access + $testUser = $this->createTestUser(true, true); + + // Recreate controller to use user + $controller = $this->getController(); + + $this->actualpageSettings($controller); + } + + /** + * @depends testControllerConstructor + * @depends testpageSettings + */ + public function testpageSettingsWithPartialPermissions() + { + // Create a user and give him permissions + $testUser = $this->createTestUser(false, true); + $this->giveUserTestPermission($testUser, 'uri_account_settings'); + + // Force config + $this->ci->config['site.locales.available'] = []; + + // Recreate controller to use config & user + $controller = $this->getController(); + + $this->actualpageSettings($controller); + } + + /** + * @param AccountController $controller + */ + protected function actualpageSettings(AccountController $controller) + { + $result = $controller->pageSettings($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testpageSettingsWithNoPermissions(AccountController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->pageSettings($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testpageSignIn(AccountController $controller) + { + $result = $controller->pageSignIn($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + * @depends testpageSignIn + */ + public function testpageSignInWithLoggedInUser() + { + // Create a test user + $testUser = $this->createTestUser(false, true); + + // Recreate controller to use fake throttler + $controller = $this->getController(); + + $result = $controller->pageSignIn($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 302); + } + + /** + * @depends testControllerConstructor + */ + public function testProfile() + { + // Create admin user. He will have access + $testUser = $this->createTestUser(true, true); + + // Force config + $this->ci->config['site.locales.available'] = [ + 'en_US' => 'English', + 'fr_FR' => 'Français', + ]; + + // Recreate controller to use user + $controller = $this->getController(); + + $this->performActualProfileTests($controller, $testUser); + } + + /** + * @depends testControllerConstructor + * @depends testProfile + */ + public function testProfileWithPartialPermissions() + { + // Create a user and give him permissions + $testUser = $this->createTestUser(false, true); + $this->giveUserTestPermission($testUser, 'update_account_settings'); + + // Force config + $this->ci->config['site.locales.available'] = [ + 'en_US' => 'English', + ]; + + // Recreate controller to use config & user + $controller = $this->getController(); + + $this->performActualProfileTests($controller, $testUser); + } + + /** + * @param AccountController $controller + * @param UserInterface $user + */ + protected function performActualProfileTests(AccountController $controller, UserInterface $user) + { + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'first_name' => 'foo', + //'last_name' => 'bar', // don't change this one + 'locale' => 'en_US', + ]); + + $result = $controller->profile($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure user was update + $editedUser = User::where('user_name', $user->user_name)->first(); + $this->assertSame('foo', $editedUser->first_name); + $this->assertSame($user->last_name, $editedUser->last_name); + $this->assertSame($user->locale, $editedUser->locale); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testProfile + * @param AccountController $controller + */ + public function testProfileWithNoPermissions(AccountController $controller) + { + $result = $controller->profile($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 403); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testProfile + */ + public function testProfileWithFailedValidation() + { + // Create admin user. He will have access + $testUser = $this->createTestUser(true, true); + + // Force config + $this->ci->config['site.locales.available'] = [ + 'en_US' => 'English', + 'fr_FR' => 'Français', + ]; + + // Recreate controller to use user + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([]); + + $result = $controller->profile($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testProfile + */ + public function testProfileWithInvalidLocale() + { + // Create admin user. He will have access + $user = $this->createTestUser(true, true); + + // Force config + $this->ci->config['site.locales.available'] = [ + 'en_US' => 'English', + 'fr_FR' => 'Français', + ]; + + // Recreate controller to use user + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'first_name' => 'foobarfoo', + 'locale' => 'foobarfoo', + ]); + + $result = $controller->profile($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure user was NOT updated + $editedUser = User::where('user_name', $user->user_name)->first(); + $this->assertNotSame('foobarfoo', $editedUser->first_name); + $this->assertSame($user->first_name, $editedUser->first_name); + $this->assertSame($user->last_name, $editedUser->last_name); + $this->assertSame($user->locale, $editedUser->locale); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testRegisterWithHoneypot(AccountController $controller) + { + $this->expectException(SpammyRequestException::class); + $controller->register($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testRegisterWithRegistrationDisabled(AccountController $controller) + { + // Force config + $this->ci->config['site.registration.enabled'] = false; + + // Recreate controller to use fake config + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'spiderbro' => 'http://', + ]); + + $result = $controller->register($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 403); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + */ + public function testRegisterWithLoggedInUser() + { + // Create test user + $user = $this->createTestUser(false, true); + + // Recreate controller to use user + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'spiderbro' => 'http://', + ]); + + $result = $controller->register($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 403); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testRegisterWithLoggedInUser + */ + public function testRegisterWithFailedThrottle() + { + // Create fake throttler + $throttler = m::mock(Throttler::class); + $throttler->shouldReceive('getDelay')->once()->with('registration_attempt')->andReturn(90); + $this->ci->throttler = $throttler; + + // Bypass security feature + $fm = $this->ci->factory; + $dummyUser = $fm->create(User::class); + $this->ci->config['reserved_user_ids.master'] = $dummyUser->id; + + // Recreate controller to use fake throttler + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'spiderbro' => 'http://', + ]); + + $result = $controller->register($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 429); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + * @depends testRegisterWithFailedThrottle + * @param AccountController $controller + */ + public function testRegisterWithFailedCaptcha(AccountController $controller) + { + // Bypass security feature + $fm = $this->ci->factory; + $dummyUser = $fm->create(User::class); + $this->ci->config['reserved_user_ids.master'] = $dummyUser->id; + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'spiderbro' => 'http://', + ]); + + $result = $controller->register($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testRegisterWithFailedCaptcha + * @param AccountController $controller + */ + public function testRegisterWithFailedValidation(AccountController $controller) + { + // Bypass security feature + $fm = $this->ci->factory; + $dummyUser = $fm->create(User::class); + $this->ci->config['reserved_user_ids.master'] = $dummyUser->id; + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'spiderbro' => 'http://', + 'captcha' => '', + ]); + + $result = $controller->register($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + */ + public function testresendVerification() + { + // Create fake mailer + $mailer = m::mock(Mailer::class); + $mailer->shouldReceive('send')->once()->with(\Mockery::type(TwigMailMessage::class)); + $this->ci->mailer = $mailer; + + // Create fake user to test + $user = $this->createTestUser(false, false, [ + 'flag_verified' => 0 + ]); + + // Recreate controller to use fake mailer + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'email' => $user->email + ]); + + $result = $controller->resendVerification($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testresendVerification + */ + public function testresendVerificationWithVerifiedUser() + { + // Create fake user to test + $user = $this->createTestUser(false, false, [ + 'flag_verified' => 1 + ]); + + // Recreate controller to use fake mailer + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'email' => $user->email + ]); + + $result = $controller->resendVerification($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testresendVerification + */ + public function testresendVerificationWithFailedThrottle() + { + // Create fake throttler + $throttler = m::mock(Throttler::class); + $throttler->shouldReceive('getDelay')->once()->with('verification_request', ['email' => 'testresendVerificationWithVerifiedUser@test.com'])->andReturn(90); + $this->ci->throttler = $throttler; + + // Recreate controller to use fake throttler + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'email' => 'testresendVerificationWithVerifiedUser@test.com' + ]); + + $result = $controller->resendVerification($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 429); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + * @depends testresendVerification + * @param AccountController $controller + */ + public function testresendVerificationWithFailedValidation(AccountController $controller) + { + // Set POST + $request = $this->getRequest()->withParsedBody([]); + + $result = $controller->resendVerification($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + */ + public function testSetPassword() + { + // Create fake user to test + $user = $this->createTestUser(false, true); + + // Create fake PasswordResetRepository + $resetModel = $this->ci->repoPasswordReset->create($user, 9999); + + // Recreate controller to use fake PasswordResetRepository + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'password' => 'testSetPassword', + 'passwordc' => 'testSetPassword', + 'token' => $resetModel->getToken() + ]); + + $result = $controller->setPassword($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testSetPassword + * @param AccountController $controller + */ + public function testSetPasswordWithNoToken(AccountController $controller) + { + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'password' => 'testSetPassword', + 'passwordc' => 'testSetPassword', + 'token' => 'potato' + ]); + + $result = $controller->setPassword($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testSetPassword + * @param AccountController $controller + */ + public function testsetPasswordWithFailedValidation(AccountController $controller) + { + // Set POST + $request = $this->getRequest()->withParsedBody([]); + + $result = $controller->setPassword($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + */ + public function testSettings() + { + // Create fake admin to test + $user = $this->createTestUser(true, true); + + // Faker doesn't hash the password. Let's do that now + $unhashed = $user->password; + $user->password = Password::hash($user->password); + $user->save(); + + // Recreate controller to use fake user + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'passwordcheck' => $unhashed, + 'email' => 'testSettings@test.com', + 'password' => 'testrSetPassword', + 'passwordc' => 'testrSetPassword', + ]); + + $result = $controller->settings($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testSettings + */ + public function testSettingsOnlyEmailNoLocale() + { + // Create fake admin to test + $user = $this->createTestUser(true, true); + + // Faker doesn't hash the password. Let's do that now + $unhashed = $user->password; + $user->password = Password::hash($user->password); + $user->save(); + + // Force locale config + $this->ci->config['site.registration.user_defaults.locale'] = 'en_US'; + $this->ci->config['site.locales.available'] = [ + 'en_US' => 'English', + ]; + + // Recreate controller to use fake user + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'passwordcheck' => $unhashed, + 'email' => 'testSettings@test.com', + 'password' => '', + 'passwordc' => '', + ]); + + $result = $controller->settings($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testSettings + */ + public function testSettingsWithNoPermissions() + { + // Create fake normal user to test + $user = $this->createTestUser(false, true); + + // Recreate controller to use fake user + $controller = $this->getController(); + + $result = $controller->settings($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 403); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testSettings + */ + public function testSettingsWithFailedValidation() + { + // Create fake normal user to test + $user = $this->createTestUser(true, true); + + // Recreate controller to use fake user + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([]); + + $result = $controller->settings($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testSettings + */ + public function testSettingsWithFailedPasswordCheck() + { + // Create fake admin to test + $user = $this->createTestUser(true, true); + + // Faker doesn't hash the password. Let's do that now + $unhashed = $user->password; + $user->password = Password::hash($user->password); + $user->save(); + + // Recreate controller to use fake user + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'passwordcheck' => 'foo', + 'email' => 'testSettings@test.com', + 'password' => 'testrSetPassword', + 'passwordc' => 'testrSetPassword', + ]); + + $result = $controller->settings($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testSettings + */ + public function testSettingsWithEmailInUse() + { + // Create user which will be the duplicate email + $firstUser = $this->createTestUser(); + + // Create fake admin to test + $user = $this->createTestUser(true, true); + + // Recreate controller to use fake user + $controller = $this->getController(); + + // Set POST + $request = $this->getRequest()->withParsedBody([ + 'email' => $firstUser->email, + 'password' => '', + ]); + + $result = $controller->settings($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @param AccountController $controller + */ + public function testSuggestUsername(AccountController $controller) + { + $result = $controller->suggestUsername($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + + $body = (string) $result->getBody(); + $this->assertNotSame('[]', $body); + + // Make sure we got a string + $data = json_decode($body, true); + $this->assertInternalType('string', $data['user_name']); + $this->assertNotSame('', $data['user_name']); + } + + /** + * @depends testControllerConstructor + */ + public function testVerify() + { + // Create fake VerificationRepository + $repoVerification = m::mock(VerificationRepository::class); + $repoVerification->shouldReceive('complete')->once()->with('potato')->andReturn(true); + $this->ci->repoVerification = $repoVerification; + + // Recreate controller to use fake PasswordResetRepository + $controller = $this->getController(); + + $request = $this->getRequest()->withQueryParams([ + 'token' => 'potato' + ]); + + $result = $controller->verify($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 302); + $this->assertEquals($this->ci->router->pathFor('login'), $result->getHeaderLine('Location')); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testVerify + */ + public function testVerifyWithFailedVerification() + { + // Create fake VerificationRepository + $repoVerification = m::mock(VerificationRepository::class); + $repoVerification->shouldReceive('complete')->once()->with('potato')->andReturn(false); + $this->ci->repoVerification = $repoVerification; + + // Recreate controller to use fake PasswordResetRepository + $controller = $this->getController(); + + $request = $this->getRequest()->withQueryParams([ + 'token' => 'potato' + ]); + + $result = $controller->verify($request, $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 302); + $this->assertEquals($this->ci->router->pathFor('login'), $result->getHeaderLine('Location')); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructor + * @depends testVerify + */ + public function testVerifyWithFailedValidation() + { + // Create fake VerificationRepository + $repoVerification = m::mock(VerificationRepository::class); + $repoVerification->shouldNotReceive('complete'); + $this->ci->repoVerification = $repoVerification; + + // Recreate controller to use fake PasswordResetRepository + $controller = $this->getController(); + + $result = $controller->verify($this->getRequest(), $this->getResponse(), []); + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); + $this->assertSame($result->getStatusCode(), 302); + $this->assertEquals($this->ci->router->pathFor('login'), $result->getHeaderLine('Location')); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @return AccountController + */ + private function getController() + { + return new AccountController($this->ci); + } +} diff --git a/app/sprinkles/account/tests/Integration/Database/Models/UserModelTest.php b/app/sprinkles/account/tests/Integration/Database/Models/UserModelTest.php index 447be7c21..0b08b3003 100644 --- a/app/sprinkles/account/tests/Integration/Database/Models/UserModelTest.php +++ b/app/sprinkles/account/tests/Integration/Database/Models/UserModelTest.php @@ -1,5 +1,6 @@ assertInstanceOf(User::class, User::withTrashed()->find($user->id)); //$user->activities - activities - $this->ci->userActivityLogger->info("test", [ + $this->ci->userActivityLogger->info('test', [ 'type' => 'group_create', - 'user_id' => $user->id + 'user_id' => $user->id, ]); $this->assertSame(1, $user->activities()->count()); @@ -69,7 +70,7 @@ public function testUserHardDeleteWithUserRelations() 'user_id' => $user->id, 'token' => '', 'persistent_token' => '', - 'expires_at' => null + 'expires_at' => null, ]); $persistence->save(); $this->assertSame(1, Persistence::where('user_id', $user->id)->count()); diff --git a/app/sprinkles/account/tests/Unit/FactoriesTest.php b/app/sprinkles/account/tests/Integration/FactoriesTest.php similarity index 68% rename from app/sprinkles/account/tests/Unit/FactoriesTest.php rename to app/sprinkles/account/tests/Integration/FactoriesTest.php index 841772d54..1395839c7 100644 --- a/app/sprinkles/account/tests/Unit/FactoriesTest.php +++ b/app/sprinkles/account/tests/Integration/FactoriesTest.php @@ -1,5 +1,6 @@ setupTestDatabase(); $this->refreshDatabase(); - } - /** - * Test the user factory - */ - public function testUserFactory() - { $fm = $this->ci->factory; $user = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\User'); - $this->assertInstanceOf('UserFrosting\Sprinkle\Account\Database\Models\Interfaces\UserInterface', $user); + $this->assertInstanceOf(UserInterface::class, $user); } } diff --git a/app/sprinkles/account/tests/Unit/PDOStorageTest.php b/app/sprinkles/account/tests/Integration/PDOStorageTest.php similarity index 96% rename from app/sprinkles/account/tests/Unit/PDOStorageTest.php rename to app/sprinkles/account/tests/Integration/PDOStorageTest.php index faa5819b5..6e640f62e 100644 --- a/app/sprinkles/account/tests/Unit/PDOStorageTest.php +++ b/app/sprinkles/account/tests/Integration/PDOStorageTest.php @@ -1,5 +1,6 @@ $this->testUser->id, 'token' => 'dummy', 'persistent_token' => 'dummy', - 'expires_at' => null + 'expires_at' => null, ]); $persistence->save(); $this->storage->cleanAllTriplets($this->testUser->id); @@ -126,7 +127,7 @@ public function testCleanExpiredTokens() 'user_id' => $this->testUser->id, 'token' => 'dummy', 'persistent_token' => 'dummy', - 'expires_at' => Carbon::now()->subHour(1) + 'expires_at' => Carbon::now()->subHour(1), ]); $persistence->save(); $this->assertEquals(2, Persistence::count()); @@ -144,7 +145,7 @@ protected function insertTestData() 'user_id' => $this->testUser->id, 'token' => $this->validDBToken, 'persistent_token' => $this->validDBPersistentToken, - 'expires_at' => $this->expire + 'expires_at' => $this->expire, ]); $persistence->save(); diff --git a/app/sprinkles/account/tests/Unit/RegistrationTest.php b/app/sprinkles/account/tests/Integration/RegistrationTest.php similarity index 95% rename from app/sprinkles/account/tests/Unit/RegistrationTest.php rename to app/sprinkles/account/tests/Integration/RegistrationTest.php index 05ad7d1cd..1906f6c1f 100644 --- a/app/sprinkles/account/tests/Unit/RegistrationTest.php +++ b/app/sprinkles/account/tests/Integration/RegistrationTest.php @@ -1,5 +1,6 @@ 'Foo', 'last_name' => 'Bar', 'email' => 'Foo@Bar.com', - 'password' => 'FooBarFooBar123' + 'password' => 'FooBarFooBar123', ]; public function tearDown() @@ -65,7 +66,7 @@ public function testValidation() 'first_name' => 'Owl', 'last_name' => 'Fancy', 'email' => 'owl@fancy.com', - 'password' => 'owlFancy1234' + 'password' => 'owlFancy1234', ]); $validation = $registration->validate(); @@ -85,7 +86,7 @@ public function testMissingFields() //'first_name' => 'Owl', 'last_name' => 'Fancy', 'email' => 'owl@fancy.com', - 'password' => 'owlFancy1234' + 'password' => 'owlFancy1234', ]); $validation = $registration->validate(); diff --git a/app/sprinkles/account/tests/Integration/ServicesProvider/AlertsServiceTest.php b/app/sprinkles/account/tests/Integration/ServicesProvider/AlertsServiceTest.php new file mode 100644 index 000000000..12fa2f858 --- /dev/null +++ b/app/sprinkles/account/tests/Integration/ServicesProvider/AlertsServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(AuthGuard::class, $this->ci->authGuard); + } +} diff --git a/app/sprinkles/account/tests/Integration/ServicesProvider/AuthLoggerServiceTest.php b/app/sprinkles/account/tests/Integration/ServicesProvider/AuthLoggerServiceTest.php new file mode 100644 index 000000000..b975ec50d --- /dev/null +++ b/app/sprinkles/account/tests/Integration/ServicesProvider/AuthLoggerServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(Logger::class, $this->ci->authLogger); + } +} diff --git a/app/sprinkles/account/tests/Integration/ServicesProvider/AuthorizerServiceTest.php b/app/sprinkles/account/tests/Integration/ServicesProvider/AuthorizerServiceTest.php new file mode 100644 index 000000000..e09ae5e4e --- /dev/null +++ b/app/sprinkles/account/tests/Integration/ServicesProvider/AuthorizerServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(AuthorizationManager::class, $this->ci->authorizer); + } +} diff --git a/app/sprinkles/account/tests/Integration/ServicesProvider/CurrentUserServiceTest.php b/app/sprinkles/account/tests/Integration/ServicesProvider/CurrentUserServiceTest.php new file mode 100644 index 000000000..c46ab735f --- /dev/null +++ b/app/sprinkles/account/tests/Integration/ServicesProvider/CurrentUserServiceTest.php @@ -0,0 +1,43 @@ +assertNull($this->ci->currentUser); + } + + public function testService() + { + $this->setupTestDatabase(); + $this->refreshDatabase(); + + $testUser = $this->createTestUser(false, true); + + $this->assertInstanceOf(UserInterface::class, $this->ci->currentUser); + } +} diff --git a/app/sprinkles/account/tests/Integration/ServicesProvider/PasswordHasherServiceTest.php b/app/sprinkles/account/tests/Integration/ServicesProvider/PasswordHasherServiceTest.php new file mode 100644 index 000000000..27c0eed62 --- /dev/null +++ b/app/sprinkles/account/tests/Integration/ServicesProvider/PasswordHasherServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(Hasher::class, $this->ci->passwordHasher); + } +} diff --git a/app/sprinkles/account/tests/Integration/ServicesProvider/RepoPasswordResetServiceTest.php b/app/sprinkles/account/tests/Integration/ServicesProvider/RepoPasswordResetServiceTest.php new file mode 100644 index 000000000..ca8142833 --- /dev/null +++ b/app/sprinkles/account/tests/Integration/ServicesProvider/RepoPasswordResetServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(PasswordResetRepository::class, $this->ci->repoPasswordReset); + } +} diff --git a/app/sprinkles/account/tests/Integration/ServicesProvider/RepoVerificationServiceTest.php b/app/sprinkles/account/tests/Integration/ServicesProvider/RepoVerificationServiceTest.php new file mode 100644 index 000000000..6ca996976 --- /dev/null +++ b/app/sprinkles/account/tests/Integration/ServicesProvider/RepoVerificationServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(VerificationRepository::class, $this->ci->repoVerification); + } +} diff --git a/app/sprinkles/account/tests/Integration/ServicesProvider/UserActivityLoggerServiceTest.php b/app/sprinkles/account/tests/Integration/ServicesProvider/UserActivityLoggerServiceTest.php new file mode 100644 index 000000000..602c20941 --- /dev/null +++ b/app/sprinkles/account/tests/Integration/ServicesProvider/UserActivityLoggerServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(Logger::class, $this->ci->userActivityLogger); + } +} diff --git a/app/sprinkles/account/tests/Unit/UserModelTest.php b/app/sprinkles/account/tests/Integration/UserModelTest.php similarity index 96% rename from app/sprinkles/account/tests/Unit/UserModelTest.php rename to app/sprinkles/account/tests/Integration/UserModelTest.php index 8f243ed13..2f6c0886f 100644 --- a/app/sprinkles/account/tests/Unit/UserModelTest.php +++ b/app/sprinkles/account/tests/Integration/UserModelTest.php @@ -1,5 +1,6 @@ ci->config['reserved_user_ids.master']; } else { - $user_id = rand(0, 1222); + $user_id = $this->getRandomUserId($this->ci->config['reserved_user_ids.master']); } - $params = array_merge(['id' => $user_id], $params); + // If user exist, returns it, otherwise create a new one + if (!$user = User::find($user_id)) { + $params = array_merge(['id' => $user_id], $params); - $fm = $this->ci->factory; - $user = $fm->create(User::class, $params); + $fm = $this->ci->factory; + $user = $fm->create(User::class, $params); + } if ($login) { $this->loginUser($user); @@ -69,6 +73,20 @@ protected function createTestUser($isMaster = false, $login = false, array $para return $user; } + /** + * Returns a random user id, exclusing th master id + * @param int $masterId + * @return int + */ + protected function getRandomUserId($masterId) + { + do { + $id = mt_rand(1, 9999); + } while (in_array($id, [$masterId])); + + return $id; + } + /** * Gives a user a new test permission * @param UserInterface $user @@ -83,7 +101,7 @@ protected function giveUserTestPermission(UserInterface $user, $slug, $condition $permission = $fm->create(Permission::class, [ 'slug' => $slug, - 'conditions' => $conditions + 'conditions' => $conditions, ]); // Add the permission to the user diff --git a/app/sprinkles/admin/locale/ar/messages.php b/app/sprinkles/admin/locale/ar/messages.php index 8c57858df..5622b715d 100644 --- a/app/sprinkles/admin/locale/ar/messages.php +++ b/app/sprinkles/admin/locale/ar/messages.php @@ -1,5 +1,6 @@ 'النشاط الاخير', 'PAGE' => 'قائمة من أنشطة المستخدم', - 'TIME' => 'وقت نشاط' + 'TIME' => 'وقت نشاط', ], 'CACHE' => [ 'CLEAR' => 'مسح ذاكرة التخزين', 'CLEAR_CONFIRM' => 'هل أنت متأكد أنك تريد مسح ذاكرة التخزين بالموقع؟', 'CLEAR_CONFIRM_YES' => 'نعم، إمسح ذاكرة التخزين', - 'CLEARED' => 'تم مسح ذاكرة التخزين بنجاح' + 'CLEARED' => 'تم مسح ذاكرة التخزين بنجاح', ], 'DASHBOARD' => 'لوحة القيادة', @@ -54,13 +55,13 @@ //"MANAGE" => "Manage group", 'NAME' => 'أسم المجموعة', 'NAME_EXPLAIN' => 'ادخال اسم للمجموعة', - 'PAGE_DESCRIPTION' => 'قائمة المجموعات لموقعك يوفر أدوات لإدارة التحرير وحذف مجموعات' + 'PAGE_DESCRIPTION' => 'قائمة المجموعات لموقعك يوفر أدوات لإدارة التحرير وحذف مجموعات', ], 'MANUALLY_ACTIVATED' => 'تم تفعيل حساب{{user_name}}', 'MASTER_ACCOUNT_EXISTS' => 'الحساب الرئيسي موجود بالفعل', 'MIGRATION' => [ - 'REQUIRED' => 'تحديث قاعدة البيانات مطلوب' + 'REQUIRED' => 'تحديث قاعدة البيانات مطلوب', ], 'PERMISSION' => [ @@ -71,7 +72,7 @@ 'HOOK_CONDITION' => 'الظروف', 'MANAGE' => 'إدارة المأذونات', 'PAGE_DESCRIPTION' => 'قائمة المأذونات لموقعك', - 'UPDATE' => 'تحديث المأذونات' + 'UPDATE' => 'تحديث المأذونات', ], 'ROLE' => [ @@ -89,7 +90,7 @@ 'NAME' => 'اسم', 'NAME_EXPLAIN' => 'أدخل اسما للدور', 'PAGE_DESCRIPTION' => 'قائمة الوظائف لموقعك', - 'UPDATED' => 'تحديث الوظائف' + 'UPDATED' => 'تحديث الوظائف', ], 'SYSTEM_INFO' => [ @@ -102,7 +103,7 @@ 'SERVER' => 'برنامج الخادم', 'SPRINKLES' => 'sprinkles المحمل', 'UF_VERSION' => 'إصدار UserFrosting', - 'URL' => 'رابط قاعدة الموقع' + 'URL' => 'رابط قاعدة الموقع', ], 'USER' => [ @@ -112,7 +113,7 @@ 'ADMIN' => [ 'CHANGE_PASSWORD' => 'تغيير كلمة المرور للمستخدم', 'SEND_PASSWORD_LINK' => 'إرسال المستخدم وصلة من شأنها أن تسمح لهم لاختيار كلمة المرور الخاصة بهم', - 'SET_PASSWORD' => 'تعيين كلمة المرور الخاصة بالمستخدم' + 'SET_PASSWORD' => 'تعيين كلمة المرور الخاصة بالمستخدم', ], 'ACTIVATE' => 'تفعيل المستخدم', @@ -126,11 +127,11 @@ 'INFO_PAGE' => 'صفحة معلومات المستخدم {{name}}', 'PAGE_DESCRIPTION' => 'قائمة المستخدمين لموقعك', 'LATEST' => 'أحدث المستخدمين', - 'VIEW_ALL' => 'عرض جميع المستخدمين' + 'VIEW_ALL' => 'عرض جميع المستخدمين', ], 'X_USER' => [ 0 => 'لا يوجد اي مستخدمين', 1 => '{{plural}} مستخدم', - 2 => '{{plural}} المستخدمين' - ] + 2 => '{{plural}} المستخدمين', + ], ]; diff --git a/app/sprinkles/admin/locale/de_DE/messages.php b/app/sprinkles/admin/locale/de_DE/messages.php index 575a73a18..50946cea5 100644 --- a/app/sprinkles/admin/locale/de_DE/messages.php +++ b/app/sprinkles/admin/locale/de_DE/messages.php @@ -1,5 +1,6 @@ 'Letzte Aktivität', 'PAGE' => 'Eine Auflistung der Benutzeraktivitäten', - 'TIME' => 'Aktivitätszeit' + 'TIME' => 'Aktivitätszeit', ], 'CACHE' => [ 'CLEAR' => 'Cache löschen', 'CLEAR_CONFIRM' => 'Sind Sie sicher, dass Sie den Seiten-Cache löschen möchten?', 'CLEAR_CONFIRM_YES' => 'Ja, Cache löschen', - 'CLEARED' => 'Cache wurde erfolgreich gelöscht!' + 'CLEARED' => 'Cache wurde erfolgreich gelöscht!', ], 'DASHBOARD' => 'Übersicht', @@ -63,13 +64,13 @@ 'NOT_EMPTY' => 'Sie können das nicht tun, denn es sind noch Benutzer mit der Gruppe {{name}} verbunden.', 'PAGE_DESCRIPTION' => 'Eine Liste der Gruppen für Ihre Website. Bietet Verwaltungstools für das Bearbeiten und Löschen von Gruppen.', 'SUMMARY' => 'Gruppen Zusammenfassung', - 'UPDATE' => 'Details für die Gruppe {{name}} aktualisiert' + 'UPDATE' => 'Details für die Gruppe {{name}} aktualisiert', ], 'MANUALLY_ACTIVATED' => "{{user_name}}'s Konto wurde manuell aktiviert.", 'MASTER_ACCOUNT_EXISTS' => 'Das Root-Konto existiert bereits!', 'MIGRATION' => [ - 'REQUIRED' => 'Datenbankaktualisierung erforderlich' + 'REQUIRED' => 'Datenbankaktualisierung erforderlich', ], 'PERMISSION' => [ @@ -85,7 +86,7 @@ 'PAGE_DESCRIPTION' => 'Eine Liste der Berechtigungen für Ihre Website. Bietet Verwaltungstools zum Bearbeiten und Löschen von Berechtigungen.', 'SUMMARY' => 'Berechtigungs Zusammenfassung', 'UPDATE' => 'Berechtigungen aktualisieren', - 'VIA_ROLES' => 'Besitzt die Berechtigung durch die Rolle' + 'VIA_ROLES' => 'Besitzt die Berechtigung durch die Rolle', ], 'ROLE' => [ @@ -110,7 +111,7 @@ 'PAGE_DESCRIPTION' => 'Eine Liste der Rollen für Ihre Website. Bietet Verwaltungstools zum Bearbeiten und Löschen von Rollen.', 'PERMISSIONS_UPDATED' => 'Berechtigungen für die Rolle {{name}} aktualisiert', 'SUMMARY' => 'Rollen Zusammenfassung', - 'UPDATED' => 'Rollen aktualisieren' + 'UPDATED' => 'Rollen aktualisieren', ], 'SYSTEM_INFO' => [ @@ -123,7 +124,7 @@ 'SERVER' => 'Web-Server-Software', 'SPRINKLES' => 'Geladene Sprinkles', 'UF_VERSION' => 'UserFrosting Version', - 'URL' => 'Website-Stamm-Url' + 'URL' => 'Website-Stamm-Url', ], 'TOGGLE_COLUMNS' => 'Spalten anpassen', @@ -135,7 +136,7 @@ 'ADMIN' => [ 'CHANGE_PASSWORD' => 'Benutzerpasswort ändern', 'SEND_PASSWORD_LINK' => 'Senden Sie dem Benutzer einen Link, der ihnen erlaubt, ihr eigenes Passwort zu wählen', - 'SET_PASSWORD' => 'Setzen Sie das Passwort des Benutzers als' + 'SET_PASSWORD' => 'Setzen Sie das Passwort des Benutzers als', ], 'ACTIVATE' => 'Benutzer aktivieren', @@ -152,11 +153,11 @@ 'PAGE_DESCRIPTION' => 'Eine Liste der Benutzer für Ihre Website. Bietet Management-Tools, einschließlich der Möglichkeit, Benutzerdaten bearbeiten, manuell aktivieren, Benutzer aktivieren/deaktivieren, und vieles mehr.', 'SUMMARY' => 'Benutzer Zusammenfassung', 'VIEW_ALL' => 'Alle Benutzer anzeigen', - 'WITH_PERMISSION' => 'Benutzer mit dieser Berechtigung' + 'WITH_PERMISSION' => 'Benutzer mit dieser Berechtigung', ], 'X_USER' => [ 0 => 'Keine Benutzer', 1 => '{{plural}} Benutzer', - 2 => '{{plural}} Benutzer' - ] + 2 => '{{plural}} Benutzer', + ], ]; diff --git a/app/sprinkles/admin/locale/el/messages.php b/app/sprinkles/admin/locale/el/messages.php index 60838e1a6..54f3d4e22 100644 --- a/app/sprinkles/admin/locale/el/messages.php +++ b/app/sprinkles/admin/locale/el/messages.php @@ -1,160 +1,157 @@ [ - 1 => "Δραστηριότητα", - 2 => "Δραστηριότητες", + 'ACTIVITY' => [ + 1 => 'Δραστηριότητα', + 2 => 'Δραστηριότητες', - "LAST" => "Τελευταία δραστηριότητα", - "PAGE" => "Λίστα δραστηριοτήτων των χρηστών", - "TIME" => "Χρόνος δραστηριότητας" + 'LAST' => 'Τελευταία δραστηριότητα', + 'PAGE' => 'Λίστα δραστηριοτήτων των χρηστών', + 'TIME' => 'Χρόνος δραστηριότητας', ], - "CACHE" => [ - "CLEAR" => "Διαγραφή της προσωρινής μνήμης", - "CLEAR_CONFIRM" => "Είστε βέβαιοι ότι θέλετε να εκκαθαρίσετε την προσωρινή μνήμη του ιστότοπου;", - "CLEAR_CONFIRM_YES" => "Ναι, διαγραφή της προσωρινής μνήμης", - "CLEARED" => "Η προσωρινή μνήμη διαγράφηκε με επιτυχία!" + 'CACHE' => [ + 'CLEAR' => 'Διαγραφή της προσωρινής μνήμης', + 'CLEAR_CONFIRM' => 'Είστε βέβαιοι ότι θέλετε να εκκαθαρίσετε την προσωρινή μνήμη του ιστότοπου;', + 'CLEAR_CONFIRM_YES' => 'Ναι, διαγραφή της προσωρινής μνήμης', + 'CLEARED' => 'Η προσωρινή μνήμη διαγράφηκε με επιτυχία!', ], - "DASHBOARD" => "Πίνακας ελέγχου", - "NO_FEATURES_YET" => "Δεν φαίνεται να έχει ρυθμιστεί καμία λειτουργία για αυτόν τον λογαριασμό ... ακόμα. ίσως δεν έχουν υλοποιηθεί ακόμη, ή ίσως κάποιος να ξέχασε να σας δώσει πρόσβαση. Χαιρόμαστε πάντως που είσαι μαζί μας! ", - "DELETE_MASTER" => "Δεν μπορείτε να διαγράψετε τον κύριο λογαριασμό!", - "DELETION_SUCCESSFUL" => "Ο χρήστης {{user_name}} διαγράφηκε.", - "DETAILS_UPDATED" => "Ενημέρωθηκαν οι πληροφορίες λογαριασμού για τον χρήστη {{user_name}}", - "DISABLE_MASTER" => "Δεν μπορείτε να απενεργοποιήσετε τον κύριο λογαριασμό!", - "DISABLE_SELF" => "Δεν μπορείτε να απενεργοποιήσετε τον δικό σας λογαριασμό!", - "DISABLE_SUCCESSFUL" => "Ο λογαριασμός του χρήστη {{user_name}} απενεργοποιήθηκε.", - - "ENABLE_SUCCESSFUL" => "Ο λογαριασμός του χρήστη {{user_name}} ενεργοποιήθηκε.", - - "GROUP" => [ - 1 => "Ομάδα", - 2 => "Ομάδες", - - "CREATE" => "Δημιουργία ομάδας", - "CREATION_SUCCESSFUL" => "Η ομάδα {{name}} δημιουργήθηκε", - "DELETE" => "Διαγραφή ομάδας", - "DELETE_CONFIRM" => "Είστε βέβαιοι ότι θέλετε να διαγράψετε την ομάδα {{name}}?", - "DELETE_DEFAULT" => "Δεν μπορείτε να διαγράψετε την ομάδα {{name}} επειδή είναι η προεπιλεγμένη ομάδα για τους νεοεισερχόμενους χρήστες.", - "DELETE_YES" => "Ναι, διαγραφή ομάδας", - "DELETION_SUCCESSFUL" => "Η ομάδα {{name}} διαγράφηκε", - "EDIT" => "Επεξεργασία ομάδας", - "ICON" => "Εικονίδιο ομάδας", - "ICON_EXPLAIN" => "Εικονίδιο για τα μέλη της ομάδας", - "INFO_PAGE" => "Σελίδα πληροφοριών για την ομάδα {{name}}", - "MANAGE" => "Διαχείριση ομάδας", - "NAME" => "Όνομα ομάδας", - "NAME_EXPLAIN" => "Παρακαλώ εισάγετε ένα όνομα για την ομάδα", - "NOT_EMPTY" => "Δεν μπορείτε να το κάνετε αυτό επειδή εξακολουθούν να υπάρχουν χρήστες που είναι μέλη της ομάδας {{name}}.", - "PAGE_DESCRIPTION" => "Λίστα των ομάδων του ιστότοπού σας. Παρέχει εργαλεία διαχείρισης για την επεξεργασία και τη διαγραφή ομάδων.", - "SUMMARY" => "Σύνοψη ομάδας", - "UPDATE" => "Ενημερώθηκαν οι λεπτομέρειες της ομάδας {{name}}" + 'DASHBOARD' => 'Πίνακας ελέγχου', + 'NO_FEATURES_YET' => 'Δεν φαίνεται να έχει ρυθμιστεί καμία λειτουργία για αυτόν τον λογαριασμό ... ακόμα. ίσως δεν έχουν υλοποιηθεί ακόμη, ή ίσως κάποιος να ξέχασε να σας δώσει πρόσβαση. Χαιρόμαστε πάντως που είσαι μαζί μας! ', + 'DELETE_MASTER' => 'Δεν μπορείτε να διαγράψετε τον κύριο λογαριασμό!', + 'DELETION_SUCCESSFUL' => 'Ο χρήστης {{user_name}} διαγράφηκε.', + 'DETAILS_UPDATED' => 'Ενημέρωθηκαν οι πληροφορίες λογαριασμού για τον χρήστη {{user_name}}', + 'DISABLE_MASTER' => 'Δεν μπορείτε να απενεργοποιήσετε τον κύριο λογαριασμό!', + 'DISABLE_SELF' => 'Δεν μπορείτε να απενεργοποιήσετε τον δικό σας λογαριασμό!', + 'DISABLE_SUCCESSFUL' => 'Ο λογαριασμός του χρήστη {{user_name}} απενεργοποιήθηκε.', + + 'ENABLE_SUCCESSFUL' => 'Ο λογαριασμός του χρήστη {{user_name}} ενεργοποιήθηκε.', + + 'GROUP' => [ + 1 => 'Ομάδα', + 2 => 'Ομάδες', + + 'CREATE' => 'Δημιουργία ομάδας', + 'CREATION_SUCCESSFUL' => 'Η ομάδα {{name}} δημιουργήθηκε', + 'DELETE' => 'Διαγραφή ομάδας', + 'DELETE_CONFIRM' => 'Είστε βέβαιοι ότι θέλετε να διαγράψετε την ομάδα {{name}}?', + 'DELETE_DEFAULT' => 'Δεν μπορείτε να διαγράψετε την ομάδα {{name}} επειδή είναι η προεπιλεγμένη ομάδα για τους νεοεισερχόμενους χρήστες.', + 'DELETE_YES' => 'Ναι, διαγραφή ομάδας', + 'DELETION_SUCCESSFUL' => 'Η ομάδα {{name}} διαγράφηκε', + 'EDIT' => 'Επεξεργασία ομάδας', + 'ICON' => 'Εικονίδιο ομάδας', + 'ICON_EXPLAIN' => 'Εικονίδιο για τα μέλη της ομάδας', + 'INFO_PAGE' => 'Σελίδα πληροφοριών για την ομάδα {{name}}', + 'MANAGE' => 'Διαχείριση ομάδας', + 'NAME' => 'Όνομα ομάδας', + 'NAME_EXPLAIN' => 'Παρακαλώ εισάγετε ένα όνομα για την ομάδα', + 'NOT_EMPTY' => 'Δεν μπορείτε να το κάνετε αυτό επειδή εξακολουθούν να υπάρχουν χρήστες που είναι μέλη της ομάδας {{name}}.', + 'PAGE_DESCRIPTION' => 'Λίστα των ομάδων του ιστότοπού σας. Παρέχει εργαλεία διαχείρισης για την επεξεργασία και τη διαγραφή ομάδων.', + 'SUMMARY' => 'Σύνοψη ομάδας', + 'UPDATE' => 'Ενημερώθηκαν οι λεπτομέρειες της ομάδας {{name}}', ], - "MANUALLY_ACTIVATED" => "Ο λογαριασμός του {{user_name}}'s ενεργοποίηθηκε χειροκίνητα", - "MASTER_ACCOUNT_EXISTS" => "Υπάρχει ήδη ο κύριος λογαριασμός!", - "MIGRATION" => [ - "REQUIRED" => "Απαιτείται ενημέρωση της βάσης δεδομένων" + 'MANUALLY_ACTIVATED' => "Ο λογαριασμός του {{user_name}}'s ενεργοποίηθηκε χειροκίνητα", + 'MASTER_ACCOUNT_EXISTS' => 'Υπάρχει ήδη ο κύριος λογαριασμός!', + 'MIGRATION' => [ + 'REQUIRED' => 'Απαιτείται ενημέρωση της βάσης δεδομένων', ], - "PERMISSION" => [ - 1 => "Δικαίωμα", - 2 => "Δικαιώματα", - - "ASSIGN_NEW" => "Αντιστοίχιση νέου δικαιώματος", - "HOOK_CONDITION" => "Hook/Conditions", - "ID" => "ID δικαιώματος", - "INFO_PAGE" => "Πληροφορίες δικαιώματων για '{{name}}'", - "MANAGE" => "Διαχείριση δικαιώματων", - "NOTE_READ_ONLY" => "Σημείωση: Τα δικαιώματα θεωρούνται ως \"κομμάτι του κώδικα\" και δεν μπορούν να τροποποιηθούν για το interface. Για να προσθέσετε, αφαιρέσετε, ή τροποποιήσετε δικαιώματα , θα πρέπει οι δημιουργοί του ιστότοπου να ακολουθήσουν την διαδικασία database migration.", - "PAGE_DESCRIPTION" => "Λίστα δικαιωμάτων για τον ιστότοπό σας. Παρέχει εργαλεία διαχείρισης για την επεξεργασία και τη διαγραφή των δικαιωμάτων", - "SUMMARY" => "Περίληψη δικαιωμάτος", - "UPDATE" => "Ενημέρωση δικαιωμάτων", - "VIA_ROLES" => "Έχει άδεια βάσει ρόλου" + 'PERMISSION' => [ + 1 => 'Δικαίωμα', + 2 => 'Δικαιώματα', + + 'ASSIGN_NEW' => 'Αντιστοίχιση νέου δικαιώματος', + 'HOOK_CONDITION' => 'Hook/Conditions', + 'ID' => 'ID δικαιώματος', + 'INFO_PAGE' => "Πληροφορίες δικαιώματων για '{{name}}'", + 'MANAGE' => 'Διαχείριση δικαιώματων', + 'NOTE_READ_ONLY' => 'Σημείωση: Τα δικαιώματα θεωρούνται ως "κομμάτι του κώδικα" και δεν μπορούν να τροποποιηθούν για το interface. Για να προσθέσετε, αφαιρέσετε, ή τροποποιήσετε δικαιώματα , θα πρέπει οι δημιουργοί του ιστότοπου να ακολουθήσουν την διαδικασία database migration.', + 'PAGE_DESCRIPTION' => 'Λίστα δικαιωμάτων για τον ιστότοπό σας. Παρέχει εργαλεία διαχείρισης για την επεξεργασία και τη διαγραφή των δικαιωμάτων', + 'SUMMARY' => 'Περίληψη δικαιωμάτος', + 'UPDATE' => 'Ενημέρωση δικαιωμάτων', + 'VIA_ROLES' => 'Έχει άδεια βάσει ρόλου', ], - "ROLE" => [ - 1 => "Ρόλος", - 2 => "Ρόλοι", - - "ASSIGN_NEW" => "Ανάθεση νέου ρόλου", - "CREATE" => "Δημιουργία ρόλου", - "CREATION_SUCCESSFUL" => "Επιτυχής δημιουργία ρόλου {{name}}", - "DELETE" => "Διαγραφή ρόλου", - "DELETE_CONFIRM" => "Είστε βέβαιοι ότι θέλετε να διαγράψετε το ρόλο {{name}}?", - "DELETE_DEFAULT" => "Δεν μπορείτε να διαγράψετε το ρόλο {{name}} επειδή είναι ένας προεπιλεγμένος ρόλος για τους νέους χρήστες.", - "DELETE_YES" => "Ναι, διαγραφή ρόλου", - "DELETION_SUCCESSFUL" => "Ο ρόλος {{name}} διαγράφηκε", - "EDIT" => "Επεξεργασία ρόλου", - "HAS_USERS" => "Δεν μπορείτε να το κάνετε επειδή υπάρχουν ακόμα χρήστες που έχουν τον ρόλο {{name}}.", - "INFO_PAGE" => "Σελίδα πληροφοριών του ρόλου {{name}}", - "MANAGE" => "Διαχείριση ρόλου", - "NAME" => "Όνομα", - "NAME_EXPLAIN" => "Παρακαλώ εισάγετε ένα όνομα για το ρόλο", - "NAME_IN_USE" => "Υπάρχει ήδη ρόλος με όνομα {{name}}", - "PAGE_DESCRIPTION" => "Λίστα των ρόλων για τον ιστότοπό σας.Παρέχει εργαλεία διαχείρισης για επεξεργασία και διαγραφή ρόλων.", - "PERMISSIONS_UPDATED" => "Τα δικαιώματα ενημερώθηκαν για τον ρόλο {{name}}", - "SUMMARY" => "Περίληψη ρόλου", - "UPDATED" => "Οι λεπτομέρειες του ρόλου {{name}} ενημερώθηκαν" + 'ROLE' => [ + 1 => 'Ρόλος', + 2 => 'Ρόλοι', + + 'ASSIGN_NEW' => 'Ανάθεση νέου ρόλου', + 'CREATE' => 'Δημιουργία ρόλου', + 'CREATION_SUCCESSFUL' => 'Επιτυχής δημιουργία ρόλου {{name}}', + 'DELETE' => 'Διαγραφή ρόλου', + 'DELETE_CONFIRM' => 'Είστε βέβαιοι ότι θέλετε να διαγράψετε το ρόλο {{name}}?', + 'DELETE_DEFAULT' => 'Δεν μπορείτε να διαγράψετε το ρόλο {{name}} επειδή είναι ένας προεπιλεγμένος ρόλος για τους νέους χρήστες.', + 'DELETE_YES' => 'Ναι, διαγραφή ρόλου', + 'DELETION_SUCCESSFUL' => 'Ο ρόλος {{name}} διαγράφηκε', + 'EDIT' => 'Επεξεργασία ρόλου', + 'HAS_USERS' => 'Δεν μπορείτε να το κάνετε επειδή υπάρχουν ακόμα χρήστες που έχουν τον ρόλο {{name}}.', + 'INFO_PAGE' => 'Σελίδα πληροφοριών του ρόλου {{name}}', + 'MANAGE' => 'Διαχείριση ρόλου', + 'NAME' => 'Όνομα', + 'NAME_EXPLAIN' => 'Παρακαλώ εισάγετε ένα όνομα για το ρόλο', + 'NAME_IN_USE' => 'Υπάρχει ήδη ρόλος με όνομα {{name}}', + 'PAGE_DESCRIPTION' => 'Λίστα των ρόλων για τον ιστότοπό σας.Παρέχει εργαλεία διαχείρισης για επεξεργασία και διαγραφή ρόλων.', + 'PERMISSIONS_UPDATED' => 'Τα δικαιώματα ενημερώθηκαν για τον ρόλο {{name}}', + 'SUMMARY' => 'Περίληψη ρόλου', + 'UPDATED' => 'Οι λεπτομέρειες του ρόλου {{name}} ενημερώθηκαν', ], - "SYSTEM_INFO" => [ - "@TRANSLATION" => "Πληροφορίες συστήματος", - - "DB_NAME" => "Όνομα βάσης δεδομένων", - "DB_VERSION" => "Έκδοση βάσης δεδομένων", - "DIRECTORY" => "Κατάλογος project", - "PHP_VERSION" => "Έκδοση PHP", - "SERVER" => "Λογισμικό διακομιστή Web", - "SPRINKLES" => "Φορτωμένα sprinkles", - "UF_VERSION" => "Έκδοση UserFrosting", - "URL" => "Site root url" + 'SYSTEM_INFO' => [ + '@TRANSLATION' => 'Πληροφορίες συστήματος', + + 'DB_NAME' => 'Όνομα βάσης δεδομένων', + 'DB_VERSION' => 'Έκδοση βάσης δεδομένων', + 'DIRECTORY' => 'Κατάλογος project', + 'PHP_VERSION' => 'Έκδοση PHP', + 'SERVER' => 'Λογισμικό διακομιστή Web', + 'SPRINKLES' => 'Φορτωμένα sprinkles', + 'UF_VERSION' => 'Έκδοση UserFrosting', + 'URL' => 'Site root url', ], - "TOGGLE_COLUMNS" => "Εναλλαγή στηλών", + 'TOGGLE_COLUMNS' => 'Εναλλαγή στηλών', - "USER" => [ - 1 => "Χρήστης", - 2 => "Χρήστες", + 'USER' => [ + 1 => 'Χρήστης', + 2 => 'Χρήστες', - "ADMIN" => [ - "CHANGE_PASSWORD" => "Αλλαγή κωδικού χρήστη", - "SEND_PASSWORD_LINK" => "Αποστολή στον χρήστη ενός συνδέσμου που θα του επιτρέψει να επιλέξει κωδικό πρόσβασης", - "SET_PASSWORD" => "Ορίστε τον κωδικό πρόσβασης του χρήστη ως" + 'ADMIN' => [ + 'CHANGE_PASSWORD' => 'Αλλαγή κωδικού χρήστη', + 'SEND_PASSWORD_LINK' => 'Αποστολή στον χρήστη ενός συνδέσμου που θα του επιτρέψει να επιλέξει κωδικό πρόσβασης', + 'SET_PASSWORD' => 'Ορίστε τον κωδικό πρόσβασης του χρήστη ως', ], - "ACTIVATE" => "Ενεργοποίηση χρήστη", - "CREATE" => "Δημιουργία χρήστη", - "CREATED" => "Ο χρήστης {{user_name}} δημιουργήθηκε", - "DELETE" => "Διαγραφή χρήστη", - "DELETE_CONFIRM" => "Είστε βέβαιοι ότι θέλετε να διαγράψετε τον χρήστη {{name}}?", - "DELETE_YES" => "Ναι, διαγραφή χρήστη", - "DELETED" => "Ο χρήστης διαγράφηκε", - "DISABLE" => "Απενεργοποίηση χρήστη", - "EDIT" => "Επεξεργασία χρήστη", - "ENABLE" => "Ενεργοποίηση χρήστη", - "INFO_PAGE" => "Σελίδα πληροφοριών για τον χρήστη {{name}}", - "LATEST" => "Πρόσφατοι χρήστες", - "PAGE_DESCRIPTION" => "Λίστα χρηστών για τον ιστότοπό σας.Παρέχει εργαλεία διαχείρισης, συμπεριλαμβανομένης της δυνατότητας επεξεργασίας λεπτομερειών χρηστών, χειροκίνητης ενεργοποίησης χρηστών, ενεργοποίησης / απενεργοποίησης χρηστών και πολλών άλλων.", - "SUMMARY" => "Περίληψη λογαριασμού", - "VIEW_ALL" => "Προβολή όλων των χρηστών", - "WITH_PERMISSION" => "Χρήστες με αυτό το δικαιώμα" + 'ACTIVATE' => 'Ενεργοποίηση χρήστη', + 'CREATE' => 'Δημιουργία χρήστη', + 'CREATED' => 'Ο χρήστης {{user_name}} δημιουργήθηκε', + 'DELETE' => 'Διαγραφή χρήστη', + 'DELETE_CONFIRM' => 'Είστε βέβαιοι ότι θέλετε να διαγράψετε τον χρήστη {{name}}?', + 'DELETE_YES' => 'Ναι, διαγραφή χρήστη', + 'DELETED' => 'Ο χρήστης διαγράφηκε', + 'DISABLE' => 'Απενεργοποίηση χρήστη', + 'EDIT' => 'Επεξεργασία χρήστη', + 'ENABLE' => 'Ενεργοποίηση χρήστη', + 'INFO_PAGE' => 'Σελίδα πληροφοριών για τον χρήστη {{name}}', + 'LATEST' => 'Πρόσφατοι χρήστες', + 'PAGE_DESCRIPTION' => 'Λίστα χρηστών για τον ιστότοπό σας.Παρέχει εργαλεία διαχείρισης, συμπεριλαμβανομένης της δυνατότητας επεξεργασίας λεπτομερειών χρηστών, χειροκίνητης ενεργοποίησης χρηστών, ενεργοποίησης / απενεργοποίησης χρηστών και πολλών άλλων.', + 'SUMMARY' => 'Περίληψη λογαριασμού', + 'VIEW_ALL' => 'Προβολή όλων των χρηστών', + 'WITH_PERMISSION' => 'Χρήστες με αυτό το δικαιώμα', + ], + 'X_USER' => [ + 0 => 'No χρήστες', + 1 => '{{plural}} χρήστης', + 2 => '{{plural}} χρήστες', ], - "X_USER" => [ - 0 => "No χρήστες", - 1 => "{{plural}} χρήστης", - 2 => "{{plural}} χρήστες" - ] ]; diff --git a/app/sprinkles/admin/locale/en_US/messages.php b/app/sprinkles/admin/locale/en_US/messages.php index b36fa3fac..ffed268a1 100644 --- a/app/sprinkles/admin/locale/en_US/messages.php +++ b/app/sprinkles/admin/locale/en_US/messages.php @@ -1,5 +1,6 @@ 'Last Activity', 'PAGE' => 'A listing of user activities', - 'TIME' => 'Activity Time' + 'TIME' => 'Activity Time', ], 'CACHE' => [ 'CLEAR' => 'Clear cache', 'CLEAR_CONFIRM' => 'Are you sure you want to clear the site cache?', 'CLEAR_CONFIRM_YES' => 'Yes, clear cache', - 'CLEARED' => 'Cache cleared successfully !' + 'CLEARED' => 'Cache cleared successfully !', ], 'DASHBOARD' => 'Dashboard', @@ -61,13 +62,13 @@ 'NOT_EMPTY' => "You can't do that because there are still users associated with the group {{name}}.", 'PAGE_DESCRIPTION' => 'A listing of the groups for your site. Provides management tools for editing and deleting groups.', 'SUMMARY' => 'Group Summary', - 'UPDATE' => 'Details updated for group {{name}}' + 'UPDATE' => 'Details updated for group {{name}}', ], 'MANUALLY_ACTIVATED' => "{{user_name}}'s account has been manually activated", 'MASTER_ACCOUNT_EXISTS' => 'The master account already exists!', 'MIGRATION' => [ - 'REQUIRED' => 'Database update required' + 'REQUIRED' => 'Database update required', ], 'PERMISSION' => [ @@ -83,7 +84,7 @@ 'PAGE_DESCRIPTION' => 'A listing of the permissions for your site. Provides management tools for editing and deleting permissions.', 'SUMMARY' => 'Permission Summary', 'UPDATE' => 'Update permissions', - 'VIA_ROLES' => 'Has permission via roles' + 'VIA_ROLES' => 'Has permission via roles', ], 'ROLE' => [ @@ -108,7 +109,7 @@ 'PAGE_DESCRIPTION' => 'A listing of the roles for your site. Provides management tools for editing and deleting roles.', 'PERMISSIONS_UPDATED' => 'Permissions updated for role {{name}}', 'SUMMARY' => 'Role Summary', - 'UPDATED' => 'Details updated for role {{name}}' + 'UPDATED' => 'Details updated for role {{name}}', ], 'SYSTEM_INFO' => [ @@ -121,7 +122,7 @@ 'SERVER' => 'Webserver software', 'SPRINKLES' => 'Loaded sprinkles', 'UF_VERSION' => 'UserFrosting version', - 'URL' => 'Site root url' + 'URL' => 'Site root url', ], 'TOGGLE_COLUMNS' => 'Toggle columns', @@ -133,7 +134,7 @@ 'ADMIN' => [ 'CHANGE_PASSWORD' => 'Change User Password', 'SEND_PASSWORD_LINK' => 'Send the user a link that will allow them to choose their own password', - 'SET_PASSWORD' => "Set the user's password as" + 'SET_PASSWORD' => "Set the user's password as", ], 'ACTIVATE' => 'Activate user', @@ -151,11 +152,11 @@ 'PAGE_DESCRIPTION' => 'A listing of the users for your site. Provides management tools including the ability to edit user details, manually activate users, enable/disable users, and more.', 'SUMMARY' => 'Account Summary', 'VIEW_ALL' => 'View all users', - 'WITH_PERMISSION' => 'Users with this permission' + 'WITH_PERMISSION' => 'Users with this permission', ], 'X_USER' => [ 0 => 'No users', 1 => '{{plural}} user', - 2 => '{{plural}} users' - ] + 2 => '{{plural}} users', + ], ]; diff --git a/app/sprinkles/admin/locale/es_ES/messages.php b/app/sprinkles/admin/locale/es_ES/messages.php index c62c408e8..318fc1dcb 100755 --- a/app/sprinkles/admin/locale/es_ES/messages.php +++ b/app/sprinkles/admin/locale/es_ES/messages.php @@ -1,5 +1,6 @@ 'Última actividad', 'PAGE' => 'Una lista de las actividades del usuario', - 'TIME' => 'Tiempo de Actividad' + 'TIME' => 'Tiempo de Actividad', ], 'ADMIN' => [ - 'PANEL' => 'Panel de administración' + 'PANEL' => 'Panel de administración', ], 'CACHE' => [ 'CLEAR' => 'Limpiar cache', 'CLEAR_CONFIRM' => '¿Estás seguro de que deseas borrar la caché del sitio?', 'CLEAR_CONFIRM_YES' => 'Sí, borrar caché', - 'CLEARED' => '¡Cache borrado correctamente!' + 'CLEARED' => '¡Cache borrado correctamente!', ], 'DASHBOARD' => 'Tablero', @@ -65,13 +66,13 @@ 'NOT_EMPTY' => 'No puedes hacerlo porque todavía hay usuarios asociados con el grupo {{name}} .', 'PAGE_DESCRIPTION' => 'Un listado de los grupos para tu sitio. Proporciona herramientas de administración para editar y eliminar grupos.', 'SUMMARY' => 'Resumen del grupo', - 'UPDATE' => 'Detalles actualizados para el grupo {{name}} ' + 'UPDATE' => 'Detalles actualizados para el grupo {{name}} ', ], 'MANUALLY_ACTIVATED' => 'La cuenta de {{user_name}} se ha activado manualmente', 'MASTER_ACCOUNT_EXISTS' => '¡La cuenta maestra ya existe!', 'MIGRATION' => [ - 'REQUIRED' => 'Se requiere actualizar la base de datos' + 'REQUIRED' => 'Se requiere actualizar la base de datos', ], 'PERMISSION' => [ @@ -87,7 +88,7 @@ 'PAGE_DESCRIPTION' => 'Una lista de los permisos para tu sitio. Proporciona herramientas de administración para editar y eliminar permisos.', 'SUMMARY' => 'Resumen del permiso', 'UPDATE' => 'Actualizar permisos', - 'VIA_ROLES' => 'Tiene permiso para los roles' + 'VIA_ROLES' => 'Tiene permiso para los roles', ], 'ROLE' => [ @@ -112,7 +113,7 @@ 'PAGE_DESCRIPTION' => 'Una lista de las funciones de tu sitio. Proporciona herramientas de administración para editar y eliminar roles.', 'PERMISSIONS_UPDATED' => 'Permisos actualizados para el rol {{name}} ', 'SUMMARY' => 'Resumen del rol', - 'UPDATED' => 'Detalles actualizados para el rol {{name}} ' + 'UPDATED' => 'Detalles actualizados para el rol {{name}} ', ], 'SYSTEM_INFO' => [ @@ -125,7 +126,7 @@ 'SERVER' => 'Software de servidor Web', 'SPRINKLES' => 'Sprinkles cargados', 'UF_VERSION' => 'UserFrosting versión', - 'URL' => 'URL root del sitio' + 'URL' => 'URL root del sitio', ], 'TOGGLE_COLUMNS' => 'Alternar columnas', @@ -138,7 +139,7 @@ 'ADMIN' => [ 'CHANGE_PASSWORD' => 'Cambiar contraseña de usuario', 'SEND_PASSWORD_LINK' => 'Enviar al usuario un enlace que les permita elegir su propia contraseña', - 'SET_PASSWORD' => 'Establece la contraseña del usuario como' + 'SET_PASSWORD' => 'Establece la contraseña del usuario como', ], 'ACTIVATE' => 'Activar usuario', @@ -155,11 +156,11 @@ 'PAGE_DESCRIPTION' => 'Una lista de los usuarios para tu sitio. Proporciona herramientas de administración que incluyen la capacidad de editar detalles de usuario, activar manualmente usuarios, habilitar / deshabilitar usuarios y más.', 'SUMMARY' => 'Resumen de la cuenta', 'VIEW_ALL' => 'Ver todos los usuarios', - 'WITH_PERMISSION' => 'Usuarios con este permiso' + 'WITH_PERMISSION' => 'Usuarios con este permiso', ], 'X_USER' => [ 0 => 'No hay usuarios', 1 => '{{plural}} usuario', - 2 => '{{plural}} usuarios' - ] + 2 => '{{plural}} usuarios', + ], ]; diff --git a/app/sprinkles/admin/locale/fa/messages.php b/app/sprinkles/admin/locale/fa/messages.php index 5a38ad65c..729b5b360 100644 --- a/app/sprinkles/admin/locale/fa/messages.php +++ b/app/sprinkles/admin/locale/fa/messages.php @@ -1,5 +1,6 @@ 'آخرین فعالیت', 'PAGE' => 'لیستی از فعالیت های کاربر', - 'TIME' => 'زمان فعالیت' + 'TIME' => 'زمان فعالیت', ], 'CACHE' => [ 'CLEAR' => 'پاک سازی کش', 'CLEAR_CONFIRM' => 'آیا مطمئن هستید که میخواهید کش سایت را پاک سازی کنید؟', 'CLEAR_CONFIRM_YES' => 'بله، کش پاک سازی شود', - 'CLEARED' => 'کش با موفقیت پاک سازی شد' + 'CLEARED' => 'کش با موفقیت پاک سازی شد', ], 'DASHBOARD' => 'کارتابل', @@ -59,13 +60,13 @@ 'NOT_EMPTY' => 'نمیتوان این کار را کرد چون هنوز کاربرانی عضو گروه {{name}} هستند.', 'PAGE_DESCRIPTION' => 'لیست گروه های وب سایت شما. امکان مدیریت این گروه ها در این صفحه وجود دارد.', 'SUMMARY' => 'توضیحات گروه', - 'UPDATE' => 'اطلاعات گروه {{name}} به روز رسانی شد.' + 'UPDATE' => 'اطلاعات گروه {{name}} به روز رسانی شد.', ], 'MANUALLY_ACTIVATED' => 'حساب کاربری {{user_name}} بصورت دستی فعال شد.', 'MASTER_ACCOUNT_EXISTS' => 'حساب کاربری اصلی وجود دارد!', 'MIGRATION' => [ - 'REQUIRED' => 'به روز رسانی پایگاه داده ها باید انجام شود' + 'REQUIRED' => 'به روز رسانی پایگاه داده ها باید انجام شود', ], 'PERMISSION' => [ @@ -81,7 +82,7 @@ 'PAGE_DESCRIPTION' => 'لیست دسترسی های وب سایت شما. امکان مدیریت این دسترسی ها در این صفحه وجود دارد.', 'SUMMARY' => 'توضیحات دسترسی ها', 'UPDATE' => 'به روز رسانی دسترسی ها', - 'VIA_ROLES' => 'از طریق وظیفه ها دسترسی دارد' + 'VIA_ROLES' => 'از طریق وظیفه ها دسترسی دارد', ], 'ROLE' => [ @@ -106,7 +107,7 @@ 'PAGE_DESCRIPTION' => 'لیست وظیفه های وب سایت شما. امکان مدیریت این وظیفه ها در این صفحه وجود دارد.', 'PERMISSIONS_UPDATED' => 'دسترسی ها برای وظیفه {{name}} به روز رسانی شد', 'SUMMARY' => 'خلاصه وظیفه', - 'UPDATED' => 'اطلاعات وظیفه {{name}} به روز رسانی شد' + 'UPDATED' => 'اطلاعات وظیفه {{name}} به روز رسانی شد', ], 'SYSTEM_INFO' => [ @@ -119,7 +120,7 @@ 'SERVER' => 'نرمافزار وب سرور', 'SPRINKLES' => 'اسپرینکل های بارگذاری شده', 'UF_VERSION' => 'نسخه یوزرفروستینگ', - 'URL' => 'آدرس رووت وب سایت' + 'URL' => 'آدرس رووت وب سایت', ], 'TOGGLE_COLUMNS' => 'تغییر ستون', @@ -131,7 +132,7 @@ 'ADMIN' => [ 'CHANGE_PASSWORD' => 'تغییر گذرواژه کاربر', 'SEND_PASSWORD_LINK' => 'برای کاربر ایمیلی ارسال شود تا گذرواژه خود را تغییر دهد', - 'SET_PASSWORD' => 'گذرواژه کاربر را انتخاب کنید' + 'SET_PASSWORD' => 'گذرواژه کاربر را انتخاب کنید', ], 'ACTIVATE' => 'کاربر فعال', @@ -148,11 +149,11 @@ 'PAGE_DESCRIPTION' => 'لیستی از کاربران سایت. این صفحه به شما امکان ویرایش، فعال سازی و غیر فعال سازی کاربران را می دهد.', 'SUMMARY' => 'خلاصه حساب', 'VIEW_ALL' => 'تماشای همه ی کاربران', - 'WITH_PERMISSION' => 'کاربرانی که این دسترسی را دارند' + 'WITH_PERMISSION' => 'کاربرانی که این دسترسی را دارند', ], 'X_USER' => [ 0 => 'هیچ کاربری', 1 => '{{plural}} کاربر', - 2 => '{{plural}} کاربر' - ] + 2 => '{{plural}} کاربر', + ], ]; diff --git a/app/sprinkles/admin/locale/fr_FR/messages.php b/app/sprinkles/admin/locale/fr_FR/messages.php index 6833da354..520abfe8c 100644 --- a/app/sprinkles/admin/locale/fr_FR/messages.php +++ b/app/sprinkles/admin/locale/fr_FR/messages.php @@ -1,5 +1,6 @@ 'Dernière activité', 'PAGE' => 'Une liste des activités des utilisateurs', - 'TIME' => "Date de l'activité" + 'TIME' => "Date de l'activité", ], 'CACHE' => [ 'CLEAR' => 'Vider le cache', 'CLEAR_CONFIRM' => 'Voulez-vous vraiment supprimer le cache du site?', 'CLEAR_CONFIRM_YES' => 'Oui, vider le cache', - 'CLEARED' => 'Cache effacé avec succès !' + 'CLEARED' => 'Cache effacé avec succès !', ], 'DASHBOARD' => 'Tableau de bord', @@ -60,13 +61,13 @@ 'NAME_EXPLAIN' => 'Spécifiez le nom du groupe', 'NOT_EMPTY' => 'Vous ne pouvez pas le faire car il y a encore des utilisateurs associés au groupe {{name}}.', 'PAGE_DESCRIPTION' => 'Une liste des groupes pour votre site. Fournit des outils de gestion pour éditer et supprimer des groupes.', - 'UPDATE' => 'Les détails du groupe {{name}} ont été enregistrés' + 'UPDATE' => 'Les détails du groupe {{name}} ont été enregistrés', ], 'MANUALLY_ACTIVATED' => 'Le compte de {{user_name}} a été activé manuellement', 'MASTER_ACCOUNT_EXISTS' => 'Le compte principal existe déjà !', 'MIGRATION' => [ - 'REQUIRED' => 'Mise à jour de la base de données requise' + 'REQUIRED' => 'Mise à jour de la base de données requise', ], 'PERMISSION' => [ @@ -77,7 +78,7 @@ 'HOOK_CONDITION' => 'Hook/Conditions', 'MANAGE' => 'Gestion des autorisations', 'PAGE_DESCRIPTION' => 'Une liste des autorisations pour votre site. Fournit des outils de gestion pour modifier et supprimer des autorisations.', - 'UPDATE' => 'Mettre à jour les autorisations' + 'UPDATE' => 'Mettre à jour les autorisations', ], 'ROLE' => [ @@ -101,7 +102,7 @@ 'NAME_IN_USE' => 'Un rôle nommé {{name}} existe déjà', 'PAGE_DESCRIPTION' => 'Une liste des rôles de votre site. Fournit des outils de gestion pour modifier et supprimer des rôles.', 'PERMISSIONS_UPDATED' => 'Autorisations mises à jour pour le rôle {{name}}', - 'UPDATED' => 'Détails mis à jour pour le rôle {{name}}' + 'UPDATED' => 'Détails mis à jour pour le rôle {{name}}', ], 'SYSTEM_INFO' => [ @@ -114,7 +115,7 @@ 'SERVER' => 'Logiciel server', 'SPRINKLES' => 'Sprinkles chargés', 'UF_VERSION' => 'Version de UserFrosting', - 'URL' => 'Url racine' + 'URL' => 'Url racine', ], 'USER' => [ @@ -124,7 +125,7 @@ 'ADMIN' => [ 'CHANGE_PASSWORD' => 'Changer le mot de passe', 'SEND_PASSWORD_LINK' => "Envoyer à l'utilisateur un lien qui lui permettra de choisir son propre mot de passe", - 'SET_PASSWORD' => "Définissez le mot de passe de l'utilisateur comme" + 'SET_PASSWORD' => "Définissez le mot de passe de l'utilisateur comme", ], 'ACTIVATE' => "Autoriser l'utilisateur", @@ -139,11 +140,11 @@ 'INFO_PAGE' => "Page d'information de l'utilisateur pour {{name}}", 'PAGE_DESCRIPTION' => "Une liste des utilisateurs de votre site. Fournit des outils de gestion incluant la possibilité de modifier les détails de l'utilisateur, d'activer manuellement les utilisateurs, d'activer / désactiver les utilisateurs et plus.", 'LATEST' => 'Derniers utilisateurs', - 'VIEW_ALL' => 'Voir tous les utilisateurs' + 'VIEW_ALL' => 'Voir tous les utilisateurs', ], 'X_USER' => [ 0 => 'Aucun utilisateur', 1 => '{{plural}} utilisateur', - 2 => '{{plural}} utilisateurs' - ] + 2 => '{{plural}} utilisateurs', + ], ]; diff --git a/app/sprinkles/admin/locale/it_IT/messages.php b/app/sprinkles/admin/locale/it_IT/messages.php index 413ba36e1..84d7c72ea 100644 --- a/app/sprinkles/admin/locale/it_IT/messages.php +++ b/app/sprinkles/admin/locale/it_IT/messages.php @@ -1,5 +1,6 @@ 'Ultima attività', 'PAGE' => 'Un elenco delle attività degli utenti', - 'TIME' => 'Tempo di attività' + 'TIME' => 'Tempo di attività', ], 'CACHE' => [ 'CLEAR' => 'Elimina cache', 'CLEAR_CONFIRM' => 'Sei sicuro di voler eliminare la cache del sito?', 'CLEAR_CONFIRM_YES' => 'Sì, elimina la cache', - 'CLEARED' => 'La cache è stata eliminata correttamente!' + 'CLEARED' => 'La cache è stata eliminata correttamente!', ], 'DASHBOARD' => 'Pannello di Controllo', @@ -62,13 +63,13 @@ 'NOT_EMPTY' => 'Non puoi farlo perché ci sono ancora utenti associati al gruppo {{name}}.', 'PAGE_DESCRIPTION' => "Un elenco dei gruppi per il tuo sito. Fornisce strumenti di gestione per la modifica e l'eliminazione di gruppi.", 'SUMMARY' => 'Riepilogo Gruppo', - 'UPDATE' => 'Dettagli del gruppo {{name}} aggiornati.' + 'UPDATE' => 'Dettagli del gruppo {{name}} aggiornati.', ], 'MANUALLY_ACTIVATED' => '{{user_name}} è stato attivato manualmente', 'MASTER_ACCOUNT_EXISTS' => "L'account primario esiste già!", 'MIGRATION' => [ - 'REQUIRED' => 'È necessario aggiornare il database' + 'REQUIRED' => 'È necessario aggiornare il database', ], 'PERMISSION' => [ @@ -84,7 +85,7 @@ 'PAGE_DESCRIPTION' => "Un elenco delle autorizzazioni per il tuo sito. Fornisce strumenti di gestione per la modifica e l'eliminazione delle autorizzazioni.", 'SUMMARY' => 'Sommario autorizzazioni', 'UPDATE' => 'Aggiorna autorizzazioni', - 'VIA_ROLES' => 'Ha i permessi tramite i ruoli' + 'VIA_ROLES' => 'Ha i permessi tramite i ruoli', ], 'ROLE' => [ @@ -109,7 +110,7 @@ 'PAGE_DESCRIPTION' => "Un elenco dei ruoli per il tuo sito. Fornisce strumenti di gestione per la modifica e l'eliminazione di ruoli.", 'PERMISSIONS_UPDATED' => 'Autorizzazioni aggiornate per il ruolo {{name}}', 'SUMMARY' => 'Riepilogo dei Ruoli', - 'UPDATED' => 'Dettagli aggiornati per il ruolo {{name}}' + 'UPDATED' => 'Dettagli aggiornati per il ruolo {{name}}', ], 'SYSTEM_INFO' => [ @@ -122,7 +123,7 @@ 'SERVER' => 'Software Webserver', 'SPRINKLES' => 'Sprinkles caricati', 'UF_VERSION' => 'Versione UserFrosting', - 'URL' => 'Url della root del sito' + 'URL' => 'Url della root del sito', ], 'TOGGLE_COLUMNS' => 'Scambia le colonne', @@ -134,7 +135,7 @@ 'ADMIN' => [ 'CHANGE_PASSWORD' => 'Cambia password utente', 'SEND_PASSWORD_LINK' => "Invia all'utente un link che gli permetterà di scegliere una nuova password.", - 'SET_PASSWORD' => "Impostare la password dell'utente come" + 'SET_PASSWORD' => "Impostare la password dell'utente come", ], 'ACTIVATE' => 'Attiva utente', @@ -151,11 +152,11 @@ 'PAGE_DESCRIPTION' => 'Un elenco degli utenti del tuo sito. Fornisce strumenti di gestione, tra cui la possibilità di modificare i dettagli utente, attivare manualmente gli utenti, abilitare / disabilitare gli utenti e altro ancora.', 'SUMMARY' => 'Riepilogo account', 'VIEW_ALL' => 'Visualizza tutti gli utenti', - 'WITH_PERMISSION' => 'Utenti con questa autorizzazione' + 'WITH_PERMISSION' => 'Utenti con questa autorizzazione', ], 'X_USER' => [ 0 => 'Nessun utente', 1 => '{{plural}} utente', - 2 => '{{plural}} utenti' - ] + 2 => '{{plural}} utenti', + ], ]; diff --git a/app/sprinkles/admin/locale/pt_PT/messages.php b/app/sprinkles/admin/locale/pt_PT/messages.php index aa1799059..50cee2aab 100644 --- a/app/sprinkles/admin/locale/pt_PT/messages.php +++ b/app/sprinkles/admin/locale/pt_PT/messages.php @@ -1,5 +1,6 @@ 'Última atividade', 'PAGE' => 'Lista de atividade dos utilizadores', - 'TIME' => 'Tempo da Atividade' + 'TIME' => 'Tempo da Atividade', ], 'CACHE' => [ 'CLEAR' => 'Limpar cache', 'CLEAR_CONFIRM' => 'Tem a certeza que pretende limpar a cache do site?', 'CLEAR_CONFIRM_YES' => 'Sim, limpar cache', - 'CLEARED' => 'Cache limpa com sucesso!' + 'CLEARED' => 'Cache limpa com sucesso!', ], 'DASHBOARD' => 'Painel de Controlo', @@ -55,13 +56,13 @@ //"MANAGE" => "Manage group", 'NAME' => 'Nome do grupo', 'NAME_EXPLAIN' => 'Por favor introduza um nome para o grupo', - 'PAGE_DESCRIPTION' => 'Lista de grupos do site. Contém opções para editar e remover grupos.' + 'PAGE_DESCRIPTION' => 'Lista de grupos do site. Contém opções para editar e remover grupos.', ], 'MANUALLY_ACTIVATED' => 'A conta de {{user_name}} foi ativada manualmente.', 'MASTER_ACCOUNT_EXISTS' => 'A contra principal já existe!', 'MIGRATION' => [ - 'REQUIRED' => 'É necessário uma atualização da base de dados.' + 'REQUIRED' => 'É necessário uma atualização da base de dados.', ], 'PERMISSION' => [ @@ -72,7 +73,7 @@ 'HOOK_CONDITION' => 'Hook/Condições', 'MANAGE' => 'Gerir permissões', 'PAGE_DESCRIPTION' => 'Lista de permissões do site. Contém opções para editar e remover permissões.', - 'UPDATE' => 'Atualizar permissões' + 'UPDATE' => 'Atualizar permissões', ], 'ROLE' => [ @@ -93,7 +94,7 @@ 'NAME_EXPLAIN' => 'Por favor introduza um nome para o cargo', 'PAGE_DESCRIPTION' => 'Lista de cargos do site. Contém opções para editar e remover cargos.', 'UPDATE' => 'Atualizar cargos', - 'UPDATED' => 'Cargo {{name}} atualizado' + 'UPDATED' => 'Cargo {{name}} atualizado', ], 'SYSTEM_INFO' => [ @@ -106,7 +107,7 @@ 'SERVER' => 'Software do servidor web', 'SPRINKLES' => 'Sprinkles carregados', 'UF_VERSION' => 'Versão do UserFrosting', - 'URL' => 'Raiz (url) do site' + 'URL' => 'Raiz (url) do site', ], 'USER' => [ @@ -116,7 +117,7 @@ 'ADMIN' => [ 'CHANGE_PASSWORD' => 'Alterar password', 'SEND_PASSWORD_LINK' => 'Enviar um link ao utilizador que lhe permita escolher a sua password', - 'SET_PASSWORD' => 'Definir a password do utilizador como' + 'SET_PASSWORD' => 'Definir a password do utilizador como', ], 'ACTIVATE' => 'Ativar utilizador', @@ -130,11 +131,11 @@ 'INFO_PAGE' => 'Página informativa do utilizador {{name}}', 'PAGE_DESCRIPTION' => 'Lista de utilizadores do site. Contém opções para editar detalhes, ativar/desativar utilizadores e outras.', 'LATEST' => 'Últimos Utilizadores', - 'VIEW_ALL' => 'Ver todos os utilizadores' + 'VIEW_ALL' => 'Ver todos os utilizadores', ], 'X_USER' => [ 0 => 'Nenhum utilizador', 1 => '{{plural}} utilizador', - 2 => '{{plural}} utilizadores' - ] + 2 => '{{plural}} utilizadores', + ], ]; diff --git a/app/sprinkles/admin/locale/ru_RU/messages.php b/app/sprinkles/admin/locale/ru_RU/messages.php index 6169cce38..55d327041 100644 --- a/app/sprinkles/admin/locale/ru_RU/messages.php +++ b/app/sprinkles/admin/locale/ru_RU/messages.php @@ -1,5 +1,6 @@ 'Последняя активность', 'PAGE' => 'Список действий пользователя', - 'TIME' => 'Время действия' + 'TIME' => 'Время действия', ], 'CACHE' => [ 'CLEAR' => 'Очистить кэш', 'CLEAR_CONFIRM' => 'Уверены, что хотите очистить кэш сайта?', 'CLEAR_CONFIRM_YES' => 'Да, очистить кэш', - 'CLEARED' => 'Кэш успешно очищен !' + 'CLEARED' => 'Кэш успешно очищен !', ], 'DASHBOARD' => 'Панель управления', @@ -61,13 +62,13 @@ 'NOT_EMPTY' => 'Вы не можете сделать это, потому что до сих пор есть пользователи, связанные с группой {{name}}.', 'PAGE_DESCRIPTION' => 'Список групп для вашего сайта. Предоставляет инструменты управления для редактирования и удаления групп.', 'SUMMARY' => 'Резюме группы', - 'UPDATE' => 'Информация обновлена для группы {{name}}' + 'UPDATE' => 'Информация обновлена для группы {{name}}', ], 'MANUALLY_ACTIVATED' => '{{user_name}} аккаунт был активирован вручную', 'MASTER_ACCOUNT_EXISTS' => 'Мастер-аккаунт уже существует!', 'MIGRATION' => [ - 'REQUIRED' => 'Необходимо обновление базы данных' + 'REQUIRED' => 'Необходимо обновление базы данных', ], 'PERMISSION' => [ @@ -83,7 +84,7 @@ 'PAGE_DESCRIPTION' => 'Список прав доступа для вашего сайта. Предоставляет инструменты управления для редактирования и удаления прав.', 'SUMMARY' => 'Сводка доступов', 'UPDATE' => 'Обновление прав', - 'VIA_ROLES' => 'Имеет права через роли' + 'VIA_ROLES' => 'Имеет права через роли', ], 'ROLE' => [ @@ -108,7 +109,7 @@ 'PAGE_DESCRIPTION' => 'Список ролей для вашего сайта. Предоставляет инструменты управления для редактирования и удаления ролей.', 'PERMISSIONS_UPDATED' => 'Права обновлены для роли {{name}}', 'SUMMARY' => 'Основная информация', - 'UPDATED' => 'Информация для роли {{name}}' + 'UPDATED' => 'Информация для роли {{name}}', ], 'SYSTEM_INFO' => [ @@ -121,7 +122,7 @@ 'SERVER' => 'ПО Сервера', 'SPRINKLES' => 'Загружены модули', 'UF_VERSION' => 'Версия UserFrosting', - 'URL' => 'URL-адрес сайта' + 'URL' => 'URL-адрес сайта', ], 'TOGGLE_COLUMNS' => 'Переключатель столбцов', @@ -133,7 +134,7 @@ 'ADMIN' => [ 'CHANGE_PASSWORD' => 'Сменить пароль пользователя', 'SEND_PASSWORD_LINK' => 'Отправить пользователю ссылку, которая позволит выбрать свой собственный пароль', - 'SET_PASSWORD' => 'Установите пароль пользователя как' + 'SET_PASSWORD' => 'Установите пароль пользователя как', ], 'ACTIVATE' => 'Активировать пользователя', @@ -151,11 +152,11 @@ 'PAGE_DESCRIPTION' => 'Список пользователей для вашего сайта. Предоставляет средства управления, включая возможность редактирования сведений о пользователях, ручной активации пользователей, включения/отключения пользователей и многое другое.', 'SUMMARY' => 'Сводка аккаунта', 'VIEW_ALL' => 'Все пользователи', - 'WITH_PERMISSION' => 'Пользователи с этим доступом' + 'WITH_PERMISSION' => 'Пользователи с этим доступом', ], 'X_USER' => [ 0 => 'Нет пользователей', 1 => '{{plural}} пользователя', - 2 => '{{plural}} пользователей' - ] + 2 => '{{plural}} пользователей', + ], ]; diff --git a/app/sprinkles/admin/locale/th_TH/messages.php b/app/sprinkles/admin/locale/th_TH/messages.php index e5b0c950d..f49eb535b 100644 --- a/app/sprinkles/admin/locale/th_TH/messages.php +++ b/app/sprinkles/admin/locale/th_TH/messages.php @@ -1,5 +1,6 @@ 'กิจกรรมล่าสุด', 'PAGE' => 'รายการกิจกรรมของผู้ใช้', - 'TIME' => 'เวลาที่ทำกิจกรรม' + 'TIME' => 'เวลาที่ทำกิจกรรม', ], 'CACHE' => [ 'CLEAR' => 'ล้างแคช', 'CLEAR_CONFIRM' => 'คุณแน่ใจหรือที่จะล้างแคชของเว็บ?', 'CLEAR_CONFIRM_YES' => 'ใช่ ล้างแคชเลย', - 'CLEARED' => 'ล้างแคชเรียบร้อยแล้ว!' + 'CLEARED' => 'ล้างแคชเรียบร้อยแล้ว!', ], 'DASHBOARD' => 'แผงควบคุม', @@ -53,13 +54,13 @@ //"MANAGE" => "Manage group", 'NAME' => 'ชื่อกลุ่ม', 'NAME_EXPLAIN' => 'กรุณาตั้งชื่อสำหรับกลุ่มนี้', - 'PAGE_DESCRIPTION' => 'รายชื่อกลุ่มในเว็บของคุณ ประกอบไปด้วยเครื่องมือในการจัดการสำหรับการแก้ไขและลบกลุ่ม' + 'PAGE_DESCRIPTION' => 'รายชื่อกลุ่มในเว็บของคุณ ประกอบไปด้วยเครื่องมือในการจัดการสำหรับการแก้ไขและลบกลุ่ม', ], 'MANUALLY_ACTIVATED' => 'บัญชีของ {{user_name}} ได้เปิดใช้งานเองแล้ว', 'MASTER_ACCOUNT_EXISTS' => 'มีบัญชีหลักอยู่แล้ว!', 'MIGRATION' => [ - 'REQUIRED' => 'ต้องการการปรับปรุงฐานข้อมูล' + 'REQUIRED' => 'ต้องการการปรับปรุงฐานข้อมูล', ], 'PERMISSION' => [ @@ -70,7 +71,7 @@ 'HOOK_CONDITION' => 'ข้อกำหนด/เงื่อนไข', 'MANAGE' => 'จัดการสิทธิการเข้าถึง', 'PAGE_DESCRIPTION' => 'รายการสิทธิการเข้าถึงในเว็บของคุณ ประกอบไปด้วยเครื่องมือในการจัดการสำหรับการแก้ไขและลบสิทธิการเข้าถึง', - 'UPDATE' => 'ปรับปรุงสิทธิการเข้าถึง' + 'UPDATE' => 'ปรับปรุงสิทธิการเข้าถึง', ], 'ROLE' => [ @@ -88,7 +89,7 @@ 'NAME' => 'ชื่อ', 'NAME_EXPLAIN' => 'กรุณาตั้งชื่อสำหรับตำแหน่งนี้', 'PAGE_DESCRIPTION' => 'รายชื่อตำแหน่งในเว็บของคุณ ประกอบไปด้วยเครื่องมือในการจัดการสำหรับแก้ไขและลบตำแหน่ง', - 'UPDATED' => 'ปรับปรุงตำแหน่ง' + 'UPDATED' => 'ปรับปรุงตำแหน่ง', ], 'SYSTEM_INFO' => [ @@ -101,7 +102,7 @@ 'SERVER' => 'ซอฟต์แวร์เว็บเซิร์ฟเวอร์', 'SPRINKLES' => 'Sprinkles ที่ถูกโหลด', 'UF_VERSION' => 'เวอร์ชั่น UserFrosting', - 'URL' => 'URL ของรากเว็บไซต์' + 'URL' => 'URL ของรากเว็บไซต์', ], 'USER' => [ @@ -111,7 +112,7 @@ 'ADMIN' => [ 'CHANGE_PASSWORD' => 'เปลี่ยนรหัสผ่านผู้ใช้', 'SEND_PASSWORD_LINK' => 'ส่งลิงก์ที่จะอนุญาตให้ผู้ใช้เลือกรหัสผ่านเองให้กับผู้ใช้', - 'SET_PASSWORD' => 'ตั้งรหัสผ่านของผู้ใช้เป็น' + 'SET_PASSWORD' => 'ตั้งรหัสผ่านของผู้ใช้เป็น', ], 'ACTIVATE' => 'เปิดใช้งานผู้ใช้', @@ -125,11 +126,11 @@ 'INFO_PAGE' => 'หน้าข้อมูลของผู้ใช้ {{name}}', 'PAGE_DESCRIPTION' => 'รายชื่อผู้ใช้ในเว็บของคุณ ประกอบไปด้วยเครื่องมือสำหรับการจัดการ รวมทั้งความสามารถในการแก้ไขรายละเอียดผู้ใช้ การเปิดใช้งานผู้ใช้ การเปิด/ปิดบัญชีผู้ใช้และอื่น ๆ', 'LATEST' => 'ผู้ใช้ล่าสุด', - 'VIEW_ALL' => 'ดูผู้ใช้ทั้งหมด' + 'VIEW_ALL' => 'ดูผู้ใช้ทั้งหมด', ], 'X_USER' => [ 0 => 'ไม่มีผู้ใช้', 1 => '{{plural}} ผู้ใช้', - 2 => '{{plural}} ผู้ใช้' - ] + 2 => '{{plural}} ผู้ใช้', + ], ]; diff --git a/app/sprinkles/admin/locale/tr/messages.php b/app/sprinkles/admin/locale/tr/messages.php index 5d4a455e6..5a56341be 100644 --- a/app/sprinkles/admin/locale/tr/messages.php +++ b/app/sprinkles/admin/locale/tr/messages.php @@ -1,5 +1,6 @@ 'Son Etkinlik', 'PAGE' => 'Kullanıcı etkinliklerinin listesi', - 'TIME' => 'Aktivite zamanı' + 'TIME' => 'Aktivite zamanı', ], 'CACHE' => [ 'CLEAR' => 'Önbelleği temizle', 'CLEAR_CONFIRM' => 'Site önbelleğini temizlemek istediğine emin misin?', 'CLEAR_CONFIRM_YES' => 'Evet, önbelleği temizle', - 'CLEARED' => 'Önbellek temizlenmesi başarıyla tamamlandı!' + 'CLEARED' => 'Önbellek temizlenmesi başarıyla tamamlandı!', ], 'DASHBOARD' => 'Pano', @@ -61,13 +62,13 @@ 'NOT_EMPTY' => 'Bunu yapamazsınız çünkü hala grupla ilişkili kullanıcılar var{{name}}.', 'PAGE_DESCRIPTION' => 'Siten için grupların bir listesi. Grupları silmek ve düzenlemek için yönetim araçları sağlar.', 'SUMMARY' => 'Grup özeti', - 'UPDATE' => 'Grup için detaylar güncellendi{{name}}' + 'UPDATE' => 'Grup için detaylar güncellendi{{name}}', ], 'MANUALLY_ACTIVATED' => "{{user_name}}'ın hesabı el ile aktifleştirildi", 'MASTER_ACCOUNT_EXISTS' => 'Ana hesap zaten mevcut!', 'MIGRATION' => [ - 'REQUIRED' => 'Veritabanını güncellemek gerek' + 'REQUIRED' => 'Veritabanını güncellemek gerek', ], 'PERMISSION' => [ @@ -83,7 +84,7 @@ 'PAGE_DESCRIPTION' => 'Siteniz için izinlerin bir listesi. Düzenleme yapmak ve izinleri kaldırmak yönetim araçları temin eder.', 'SUMMARY' => 'İzin Özeti', 'UPDATE' => 'İzinlerin Güncellenmesi', - 'VIA_ROLES' => 'Roller ile izin alımı' + 'VIA_ROLES' => 'Roller ile izin alımı', ], 'ROLE' => [ @@ -108,7 +109,7 @@ 'PAGE_DESCRIPTION' => 'Siteniz için rollerin bir listesi. Düzenlemek ve rolleri silmek için yönetim araçları sağlar.', 'PERMISSIONS_UPDATED' => 'Rol için izinler güncellendi{{name}}', 'SUMMARY' => 'Rol özeti', - 'UPDATED' => 'Rol için detaylar güncellendi{{name}}' + 'UPDATED' => 'Rol için detaylar güncellendi{{name}}', ], 'SYSTEM_INFO' => [ @@ -121,7 +122,7 @@ 'SERVER' => 'Web sunucu yazılımı', 'SPRINKLES' => 'Yüklü serpintiler', 'UF_VERSION' => 'UserFrosting sürümü', - 'URL' => 'Site kök url' + 'URL' => 'Site kök url', ], 'TOGGLE_COLUMNS' => 'Sütünları değiştirme', @@ -133,7 +134,7 @@ 'ADMIN' => [ 'CHANGE_PASSWORD' => 'Kullanıcı şifresini değiştir', 'SEND_PASSWORD_LINK' => 'Kullanıcıya kendi şifresini seçebileceği bir bağlantı gönder', - 'SET_PASSWORD' => 'Kullanıcının şifresi olarak ayarla' + 'SET_PASSWORD' => 'Kullanıcının şifresi olarak ayarla', ], 'ACTIVATE' => 'Aktif Kullanıcı', @@ -151,11 +152,11 @@ 'PAGE_DESCRIPTION' => 'Siten için kullanıcıların listesi. Kullanıcı detaylarını düzenlemek, elle kullanıcıları aktifleştirmek, kullanıcıları etkinleştirme/devre dışı bırakma, ve daha fazlası için yönetimsel araçlar sağlar.', 'SUMMARY' => 'Hesap özeti', 'VIEW_ALL' => 'Tüm kullanıcıları göster', - 'WITH_PERMISSION' => 'Bu izni olan kullanıcılar' + 'WITH_PERMISSION' => 'Bu izni olan kullanıcılar', ], 'X_USER' => [ 0 => 'Kullanıcı yok', 1 => '{{plural}} kullanıcı', - 2 => '{{plural}} kullanıcılar' - ] + 2 => '{{plural}} kullanıcılar', + ], ]; diff --git a/app/sprinkles/admin/locale/zh_CN/messages.php b/app/sprinkles/admin/locale/zh_CN/messages.php index 5030f2552..2a2e1a76c 100644 --- a/app/sprinkles/admin/locale/zh_CN/messages.php +++ b/app/sprinkles/admin/locale/zh_CN/messages.php @@ -1,5 +1,6 @@ '最后活动', 'PAGE' => '用户活动列表', - 'TIME' => '活动时间' + 'TIME' => '活动时间', ], 'ADMIN' => [ - 'PANEL' => '控制台' + 'PANEL' => '控制台', ], 'CACHE' => [ 'CLEAR' => '清除缓存', 'CLEAR_CONFIRM' => '你确定要清除此网站的缓存?', 'CLEAR_CONFIRM_YES' => '是的, 清除缓存', - 'CLEARED' => '缓存成功清除 !' + 'CLEARED' => '缓存成功清除 !', ], 'DASHBOARD' => '仪表盘', @@ -63,13 +64,13 @@ 'NOT_EMPTY' => '你不能这样做,因为还有用户在组 {{name}}.', 'PAGE_DESCRIPTION' => '网站组列表. 请管理编辑和删除组的工具.', 'SUMMARY' => '组简介', - 'UPDATE' => '组{{name}}的信息已经更新' + 'UPDATE' => '组{{name}}的信息已经更新', ], 'MANUALLY_ACTIVATED' => '{{user_name}} 账户已手动激活', 'MASTER_ACCOUNT_EXISTS' => '超级账户已存在!', 'MIGRATION' => [ - 'REQUIRED' => '数据库需要更新' + 'REQUIRED' => '数据库需要更新', ], 'PERMISSION' => [ @@ -85,7 +86,7 @@ 'PAGE_DESCRIPTION' => '网站的权限列表. 提供编辑和删除权限的工具.', 'SUMMARY' => '权限概要', 'UPDATE' => '更新权限', - 'VIA_ROLES' => '权限通过用户了' + 'VIA_ROLES' => '权限通过用户了', ], 'ROLE' => [ @@ -110,7 +111,7 @@ 'PAGE_DESCRIPTION' => '网站的角色列表. 请管理编辑和删除角色的工具.', 'PERMISSIONS_UPDATED' => '角色 {{name}} 的权限更新成功', 'SUMMARY' => '角色概要', - 'UPDATED' => '角色 {{name}} 更新成功' + 'UPDATED' => '角色 {{name}} 更新成功', ], 'SYSTEM_INFO' => [ @@ -123,7 +124,7 @@ 'SERVER' => '网站服务器', 'SPRINKLES' => '加载的 sprinkles', 'UF_VERSION' => 'UserFrosting 版本', - 'URL' => '网站根目录' + 'URL' => '网站根目录', ], 'TOGGLE_COLUMNS' => '加载列', @@ -135,7 +136,7 @@ 'ADMIN' => [ 'CHANGE_PASSWORD' => '修改用户密码', 'SEND_PASSWORD_LINK' => '发送允许该用户修改密码的链接', - 'SET_PASSWORD' => '设置用户的密码为' + 'SET_PASSWORD' => '设置用户的密码为', ], 'ACTIVATE' => '激活用户', @@ -152,11 +153,11 @@ 'PAGE_DESCRIPTION' => '网站用户列表. 提供编辑用户信息, 手动激活用户, 启用/禁用 用户等工具.', 'SUMMARY' => '账户概要', 'VIEW_ALL' => '浏览所有用户', - 'WITH_PERMISSION' => '有此权限的用户' + 'WITH_PERMISSION' => '有此权限的用户', ], 'X_USER' => [ 0 => '没有用户', 1 => '{{plural}} 用户', - 2 => '{{plural}} 用户' - ] + 2 => '{{plural}} 用户', + ], ]; diff --git a/app/sprinkles/admin/routes/activities.php b/app/sprinkles/admin/routes/activities.php index a68646556..ae64429d0 100644 --- a/app/sprinkles/admin/routes/activities.php +++ b/app/sprinkles/admin/routes/activities.php @@ -1,5 +1,6 @@ group('/activities', function () { diff --git a/app/sprinkles/admin/routes/admin.php b/app/sprinkles/admin/routes/admin.php index dd5baee99..f0fe77698 100644 --- a/app/sprinkles/admin/routes/admin.php +++ b/app/sprinkles/admin/routes/admin.php @@ -1,5 +1,6 @@ group('/dashboard', function () { diff --git a/app/sprinkles/admin/routes/groups.php b/app/sprinkles/admin/routes/groups.php index a4841a467..d10e140c5 100644 --- a/app/sprinkles/admin/routes/groups.php +++ b/app/sprinkles/admin/routes/groups.php @@ -1,5 +1,6 @@ group('/groups', function () { diff --git a/app/sprinkles/admin/routes/permissions.php b/app/sprinkles/admin/routes/permissions.php index 9f6871beb..4426575d4 100644 --- a/app/sprinkles/admin/routes/permissions.php +++ b/app/sprinkles/admin/routes/permissions.php @@ -1,5 +1,6 @@ group('/permissions', function () { diff --git a/app/sprinkles/admin/routes/roles.php b/app/sprinkles/admin/routes/roles.php index efcd21704..1c99ea90b 100644 --- a/app/sprinkles/admin/routes/roles.php +++ b/app/sprinkles/admin/routes/roles.php @@ -1,5 +1,6 @@ group('/roles', function () { diff --git a/app/sprinkles/admin/routes/users.php b/app/sprinkles/admin/routes/users.php index 0bcdbabd6..cebf8b459 100644 --- a/app/sprinkles/admin/routes/users.php +++ b/app/sprinkles/admin/routes/users.php @@ -1,5 +1,6 @@ group('/users', function () { diff --git a/app/sprinkles/admin/schema/requests/group/create.yaml b/app/sprinkles/admin/schema/requests/group/create.yaml index 8f5261ce4..09aa7c3b5 100644 --- a/app/sprinkles/admin/schema/requests/group/create.yaml +++ b/app/sprinkles/admin/schema/requests/group/create.yaml @@ -30,6 +30,4 @@ icon: min: 1 max: 100 message: VALIDATE.LENGTH_RANGE - required: - message: VALIDATE.REQUIRED description: diff --git a/app/sprinkles/admin/schema/requests/group/edit-info.yaml b/app/sprinkles/admin/schema/requests/group/edit-info.yaml index 6aa3f28e0..bce3dced9 100644 --- a/app/sprinkles/admin/schema/requests/group/edit-info.yaml +++ b/app/sprinkles/admin/schema/requests/group/edit-info.yaml @@ -1,6 +1,9 @@ --- name: validators: + required: + label: "&NAME" + message: VALIDATE.REQUIRED length: label: "&NAME" min: 1 @@ -10,6 +13,9 @@ name: - trim slug: validators: + required: + label: "&SLUG" + message: VALIDATE.REQUIRED length: label: "&SLUG" min: 1 @@ -24,4 +30,4 @@ icon: min: 1 max: 100 message: VALIDATE.LENGTH_RANGE -description: +description: diff --git a/app/sprinkles/admin/schema/requests/role/create.yaml b/app/sprinkles/admin/schema/requests/role/create.yaml index 8004184ee..26b0bb5e1 100644 --- a/app/sprinkles/admin/schema/requests/role/create.yaml +++ b/app/sprinkles/admin/schema/requests/role/create.yaml @@ -23,4 +23,4 @@ slug: message: VALIDATE.LENGTH_RANGE transformations: - trim -description: +description: diff --git a/app/sprinkles/admin/schema/requests/role/edit-field.yaml b/app/sprinkles/admin/schema/requests/role/edit-field.yaml index 05c1b2d89..6ac51ec30 100644 --- a/app/sprinkles/admin/schema/requests/role/edit-field.yaml +++ b/app/sprinkles/admin/schema/requests/role/edit-field.yaml @@ -17,7 +17,7 @@ slug: message: VALIDATE.LENGTH_RANGE transformations: - trim -description: +description: permissions: validators: array: diff --git a/app/sprinkles/admin/schema/requests/role/edit-info.yaml b/app/sprinkles/admin/schema/requests/role/edit-info.yaml index 1fa36c867..26b0bb5e1 100644 --- a/app/sprinkles/admin/schema/requests/role/edit-info.yaml +++ b/app/sprinkles/admin/schema/requests/role/edit-info.yaml @@ -1,6 +1,9 @@ --- name: validators: + required: + label: "&NAME" + message: VALIDATE.REQUIRED length: label: "&NAME" min: 1 @@ -10,6 +13,9 @@ name: - trim slug: validators: + required: + label: "&SLUG" + message: VALIDATE.REQUIRED length: label: "&SLUG" min: 1 @@ -17,4 +23,4 @@ slug: message: VALIDATE.LENGTH_RANGE transformations: - trim -description: +description: diff --git a/app/sprinkles/admin/src/Admin.php b/app/sprinkles/admin/src/Admin.php index 284d2f420..d3a98b0b8 100644 --- a/app/sprinkles/admin/src/Admin.php +++ b/app/sprinkles/admin/src/Admin.php @@ -1,5 +1,6 @@ [ 'users' => $classMapper->staticMethod('user', 'count'), 'roles' => $classMapper->staticMethod('role', 'count'), - 'groups' => $classMapper->staticMethod('group', 'count') + 'groups' => $classMapper->staticMethod('group', 'count'), ], 'info' => [ 'version' => [ 'UF' => \UserFrosting\VERSION, 'php' => phpversion(), - 'database' => EnvironmentInfo::database() + 'database' => EnvironmentInfo::database(), ], 'database' => [ - 'name' => $config['db.default.database'] + 'name' => $config['db.default.database'], ], 'environment' => $this->ci->environment, 'path' => [ - 'project' => \UserFrosting\ROOT_DIR - ] + 'project' => \UserFrosting\ROOT_DIR, + ], ], 'sprinkles' => $sprinkles, - 'users' => $users + 'users' => $users, ]); } @@ -98,6 +100,7 @@ public function pageDashboard(Request $request, Response $response, $args) * * This route requires authentication. * Request type: POST + * * @param Request $request * @param Response $response * @param array $args @@ -132,6 +135,7 @@ public function clearCache(Request $request, Response $response, $args) * This does NOT render a complete page. Instead, it renders the HTML for the modal, which can be embedded in other pages. * This page requires authentication. * Request type: GET + * * @param Request $request * @param Response $response * @param array $args @@ -152,7 +156,7 @@ public function getModalConfirmClearCache(Request $request, Response $response, return $this->ci->view->render($response, 'modals/confirm-clear-cache.html.twig', [ 'form' => [ 'action' => 'api/dashboard/clear-cache', - ] + ], ]); } } diff --git a/app/sprinkles/admin/src/Controller/GroupController.php b/app/sprinkles/admin/src/Controller/GroupController.php index 0e97b7df3..3e9a5f31b 100644 --- a/app/sprinkles/admin/src/Controller/GroupController.php +++ b/app/sprinkles/admin/src/Controller/GroupController.php @@ -1,5 +1,6 @@ ci->userActivityLogger->info("User {$currentUser->user_name} created group {$group->name}.", [ 'type' => 'group_create', - 'user_id' => $currentUser->id + 'user_id' => $currentUser->id, ]); $ms->addMessageTranslated('success', 'GROUP.CREATION_SUCCESSFUL', $data); @@ -134,9 +138,11 @@ public function create(Request $request, Response $response, $args) * This route requires authentication (and should generally be limited to admins or the root user). * * Request type: DELETE - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If group is not found * @throws ForbiddenException If user is not authozied to access page * @throws BadRequestException @@ -158,7 +164,7 @@ public function delete(Request $request, Response $response, $args) // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'delete_group', [ - 'group' => $group + 'group' => $group, ])) { throw new ForbiddenException(); } @@ -171,6 +177,7 @@ public function delete(Request $request, Response $response, $args) if ($group->slug == $config['site.registration.user_defaults.group']) { $e = new BadRequestException(); $e->addUserMessage('GROUP.DELETE_DEFAULT', $group->toArray()); + throw $e; } @@ -182,6 +189,7 @@ public function delete(Request $request, Response $response, $args) if ($countGroupUsers > 0) { $e = new BadRequestException(); $e->addUserMessage('GROUP.NOT_EMPTY', $group->toArray()); + throw $e; } @@ -195,7 +203,7 @@ public function delete(Request $request, Response $response, $args) // Create activity record $this->ci->userActivityLogger->info("User {$currentUser->user_name} deleted group {$groupName}.", [ 'type' => 'group_delete', - 'user_id' => $currentUser->id + 'user_id' => $currentUser->id, ]); }); @@ -203,7 +211,7 @@ public function delete(Request $request, Response $response, $args) $ms = $this->ci->alerts; $ms->addMessageTranslated('success', 'GROUP.DELETION_SUCCESSFUL', [ - 'name' => $groupName + 'name' => $groupName, ]); return $response->withJson([], 200); @@ -215,9 +223,11 @@ public function delete(Request $request, Response $response, $args) * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws ForbiddenException If user is not authozied to access page * @throws NotFoundException If group is not found */ @@ -255,15 +265,17 @@ public function getInfo(Request $request, Response $response, $args) } /** - * Returns a list of Groups + * Returns a list of Groups. * * Generates a list of groups, optionally paginated, sorted and/or filtered. * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws ForbiddenException If user is not authozied to access page */ public function getList(Request $request, Response $response, $args) @@ -293,11 +305,12 @@ public function getList(Request $request, Response $response, $args) } /** - * Get deletetion confirmation modal + * Get deletetion confirmation modal. + * + * @param Request $request + * @param Response $response + * @param array $args * - * @param Request $request - * @param Response $response - * @param array $args * @throws NotFoundException If group is not found * @throws ForbiddenException If user is not authozied to access page * @throws BadRequestException @@ -322,7 +335,7 @@ public function getModalConfirmDelete(Request $request, Response $response, $arg // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'delete_group', [ - 'group' => $group + 'group' => $group, ])) { throw new ForbiddenException(); } @@ -335,6 +348,7 @@ public function getModalConfirmDelete(Request $request, Response $response, $arg if ($countGroupUsers > 0) { $e = new BadRequestException(); $e->addUserMessage('GROUP.NOT_EMPTY', $group->toArray()); + throw $e; } @@ -342,7 +356,7 @@ public function getModalConfirmDelete(Request $request, Response $response, $arg 'group' => $group, 'form' => [ 'action' => "api/groups/g/{$group->slug}", - ] + ], ]); } @@ -353,16 +367,15 @@ public function getModalConfirmDelete(Request $request, Response $response, $arg * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws ForbiddenException If user is not authozied to access page */ public function getModalCreate(Request $request, Response $response, $args) { - // GET parameters - $params = $request->getQueryParams(); - /** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager $authorizer */ $authorizer = $this->ci->authorizer; @@ -388,7 +401,7 @@ public function getModalCreate(Request $request, Response $response, $args) $fieldNames = ['name', 'slug', 'icon', 'description']; $fields = [ 'hidden' => [], - 'disabled' => [] + 'disabled' => [], ]; // Load validation rules @@ -401,11 +414,11 @@ public function getModalCreate(Request $request, Response $response, $args) 'action' => 'api/groups', 'method' => 'POST', 'fields' => $fields, - 'submit_text' => $translator->translate('CREATE') + 'submit_text' => $translator->translate('CREATE'), ], 'page' => [ - 'validators' => $validator->rules('json', false) - ] + 'validators' => $validator->rules('json', false), + ], ]); } @@ -416,9 +429,11 @@ public function getModalCreate(Request $request, Response $response, $args) * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If group is not found * @throws ForbiddenException If user is not authozied to access page */ @@ -450,7 +465,7 @@ public function getModalEdit(Request $request, Response $response, $args) $fieldNames = ['name', 'slug', 'icon', 'description']; if (!$authorizer->checkAccess($currentUser, 'update_group_field', [ 'group' => $group, - 'fields' => $fieldNames + 'fields' => $fieldNames, ])) { throw new ForbiddenException(); } @@ -458,7 +473,7 @@ public function getModalEdit(Request $request, Response $response, $args) // Generate form $fields = [ 'hidden' => [], - 'disabled' => [] + 'disabled' => [], ]; // Load validation rules @@ -471,20 +486,21 @@ public function getModalEdit(Request $request, Response $response, $args) 'action' => "api/groups/g/{$group->slug}", 'method' => 'PUT', 'fields' => $fields, - 'submit_text' => $translator->translate('UPDATE') + 'submit_text' => $translator->translate('UPDATE'), ], 'page' => [ - 'validators' => $validator->rules('json', false) - ] + 'validators' => $validator->rules('json', false), + ], ]); } /** - * Users List API + * Users List API. + * + * @param Request $request + * @param Response $response + * @param array $args * - * @param Request $request - * @param Response $response - * @param array $args * @throws NotFoundException If group is not found * @throws ForbiddenException If user is not authozied to access page */ @@ -509,7 +525,7 @@ public function getUsers(Request $request, Response $response, $args) // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'view_group_field', [ 'group' => $group, - 'property' => 'users' + 'property' => 'users', ])) { throw new ForbiddenException(); } @@ -536,9 +552,11 @@ public function getUsers(Request $request, Response $response, $args) * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws ForbiddenException If user is not authozied to access page */ public function pageInfo(Request $request, Response $response, $args) @@ -558,7 +576,7 @@ public function pageInfo(Request $request, Response $response, $args) // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'uri_group', [ - 'group' => $group + 'group' => $group, ])) { throw new ForbiddenException(); } @@ -568,13 +586,13 @@ public function pageInfo(Request $request, Response $response, $args) // Generate form $fields = [ - 'hidden' => [] + 'hidden' => [], ]; foreach ($fieldNames as $field) { if (!$authorizer->checkAccess($currentUser, 'view_group_field', [ 'group' => $group, - 'property' => $field + 'property' => $field, ])) { $fields['hidden'][] = $field; } @@ -582,27 +600,27 @@ public function pageInfo(Request $request, Response $response, $args) // Determine buttons to display $editButtons = [ - 'hidden' => [] + 'hidden' => [], ]; if (!$authorizer->checkAccess($currentUser, 'update_group_field', [ 'group' => $group, - 'fields' => ['name', 'slug', 'icon', 'description'] + 'fields' => ['name', 'slug', 'icon', 'description'], ])) { $editButtons['hidden'][] = 'edit'; } if (!$authorizer->checkAccess($currentUser, 'delete_group', [ - 'group' => $group + 'group' => $group, ])) { $editButtons['hidden'][] = 'delete'; } return $this->ci->view->render($response, 'pages/group.html.twig', [ - 'group' => $group, - 'fields' => $fields, - 'tools' => $editButtons, - 'delete_redirect' => $this->ci->router->pathFor('uri_groups') + 'group' => $group, + 'fields' => $fields, + 'tools' => $editButtons, + 'delete_redirect' => $this->ci->router->pathFor('uri_groups'), ]); } @@ -614,9 +632,11 @@ public function pageInfo(Request $request, Response $response, $args) * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws ForbiddenException If user is not authozied to access page */ public function pageList(Request $request, Response $response, $args) @@ -645,10 +665,13 @@ public function pageList(Request $request, Response $response, $args) * This route requires authentication (and should generally be limited to admins or the root user). * * Request type: PUT + * * @see getModalGroupEdit - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If group is not found * @throws ForbiddenException If user is not authozied to access page */ @@ -661,9 +684,6 @@ public function updateInfo(Request $request, Response $response, $args) throw new NotFoundException(); } - /** @var \UserFrosting\Support\Repository\Repository $config */ - $config = $this->ci->config; - // Get PUT parameters: (name, slug, icon, description) $params = $request->getParsedBody(); @@ -701,7 +721,7 @@ public function updateInfo(Request $request, Response $response, $args) // Access-controlled resource - check that currentUser has permission to edit submitted fields for this group if (!$authorizer->checkAccess($currentUser, 'update_group_field', [ 'group' => $group, - 'fields' => array_values(array_unique($fieldNames)) + 'fields' => array_values(array_unique($fieldNames)), ])) { throw new ForbiddenException(); } @@ -746,22 +766,24 @@ public function updateInfo(Request $request, Response $response, $args) // Create activity record $this->ci->userActivityLogger->info("User {$currentUser->user_name} updated details for group {$group->name}.", [ 'type' => 'group_update_info', - 'user_id' => $currentUser->id + 'user_id' => $currentUser->id, ]); }); $ms->addMessageTranslated('success', 'GROUP.UPDATE', [ - 'name' => $group->name + 'name' => $group->name, ]); return $response->withJson([], 200); } /** - * Get group from params + * Get group from params. + * + * @param array $params * - * @param array $params * @throws BadRequestException + * * @return Group */ protected function getGroupFromParams($params) @@ -783,6 +805,7 @@ protected function getGroupFromParams($params) $e->addUserMessage($error); } } + throw $e; } diff --git a/app/sprinkles/admin/src/Controller/PermissionController.php b/app/sprinkles/admin/src/Controller/PermissionController.php index 402442ef6..6cab076ce 100644 --- a/app/sprinkles/admin/src/Controller/PermissionController.php +++ b/app/sprinkles/admin/src/Controller/PermissionController.php @@ -1,5 +1,6 @@ ci->view->render($response, 'pages/permission.html.twig', [ - 'permission' => $permission + 'permission' => $permission, ]); } @@ -198,9 +207,11 @@ public function pageInfo(Request $request, Response $response, $args) * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws ForbiddenException If user is not authozied to access page */ public function pageList(Request $request, Response $response, $args) diff --git a/app/sprinkles/admin/src/Controller/RoleController.php b/app/sprinkles/admin/src/Controller/RoleController.php index 3232e266c..fdf304e7b 100644 --- a/app/sprinkles/admin/src/Controller/RoleController.php +++ b/app/sprinkles/admin/src/Controller/RoleController.php @@ -1,5 +1,6 @@ ci->userActivityLogger->info("User {$currentUser->user_name} created role {$role->name}.", [ 'type' => 'role_create', - 'user_id' => $currentUser->id + 'user_id' => $currentUser->id, ]); $ms->addMessageTranslated('success', 'ROLE.CREATION_SUCCESSFUL', $data); @@ -134,9 +138,11 @@ public function create(Request $request, Response $response, $args) * This route requires authentication (and should generally be limited to admins or the root user). * * Request type: DELETE - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If role is not found * @throws ForbiddenException If user is not authozied to access page * @throws BadRequestException @@ -158,7 +164,7 @@ public function delete(Request $request, Response $response, $args) // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'delete_role', [ - 'role' => $role + 'role' => $role, ])) { throw new ForbiddenException(); } @@ -173,6 +179,7 @@ public function delete(Request $request, Response $response, $args) if (in_array($role->slug, $defaultRoleSlugs)) { $e = new BadRequestException(); $e->addUserMessage('ROLE.DELETE_DEFAULT'); + throw $e; } @@ -181,6 +188,7 @@ public function delete(Request $request, Response $response, $args) if ($countUsers > 0) { $e = new BadRequestException(); $e->addUserMessage('ROLE.HAS_USERS'); + throw $e; } @@ -194,7 +202,7 @@ public function delete(Request $request, Response $response, $args) // Create activity record $this->ci->userActivityLogger->info("User {$currentUser->user_name} deleted role {$roleName}.", [ 'type' => 'role_delete', - 'user_id' => $currentUser->id + 'user_id' => $currentUser->id, ]); }); @@ -202,7 +210,7 @@ public function delete(Request $request, Response $response, $args) $ms = $this->ci->alerts; $ms->addMessageTranslated('success', 'ROLE.DELETION_SUCCESSFUL', [ - 'name' => $roleName + 'name' => $roleName, ]); return $response->withJson([], 200); @@ -214,9 +222,11 @@ public function delete(Request $request, Response $response, $args) * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws ForbiddenException If user is not authozied to access page * @throws NotFoundException If role is not found */ @@ -254,15 +264,17 @@ public function getInfo(Request $request, Response $response, $args) } /** - * Returns a list of Roles + * Returns a list of Roles. * * Generates a list of roles, optionally paginated, sorted and/or filtered. * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws ForbiddenException If user is not authozied to access page */ public function getList(Request $request, Response $response, $args) @@ -292,11 +304,12 @@ public function getList(Request $request, Response $response, $args) } /** - * Display deletion confirmation modal + * Display deletion confirmation modal. + * + * @param Request $request + * @param Response $response + * @param array $args * - * @param Request $request - * @param Response $response - * @param array $args * @throws NotFoundException If role is not found * @throws ForbiddenException If user is not authozied to access page * @throws BadRequestException @@ -321,7 +334,7 @@ public function getModalConfirmDelete(Request $request, Response $response, $arg // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'delete_role', [ - 'role' => $role + 'role' => $role, ])) { throw new ForbiddenException(); } @@ -336,6 +349,7 @@ public function getModalConfirmDelete(Request $request, Response $response, $arg if (in_array($role->slug, $defaultRoleSlugs)) { $e = new BadRequestException(); $e->addUserMessage('ROLE.DELETE_DEFAULT', $role->toArray()); + throw $e; } @@ -344,6 +358,7 @@ public function getModalConfirmDelete(Request $request, Response $response, $arg if ($countUsers > 0) { $e = new BadRequestException(); $e->addUserMessage('ROLE.HAS_USERS', $role->toArray()); + throw $e; } @@ -351,7 +366,7 @@ public function getModalConfirmDelete(Request $request, Response $response, $arg 'role' => $role, 'form' => [ 'action' => "api/roles/r/{$role->slug}", - ] + ], ]); } @@ -362,9 +377,11 @@ public function getModalConfirmDelete(Request $request, Response $response, $arg * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws ForbiddenException If user is not authozied to access page */ public function getModalCreate(Request $request, Response $response, $args) @@ -395,7 +412,7 @@ public function getModalCreate(Request $request, Response $response, $args) $fieldNames = ['name', 'slug', 'description']; $fields = [ 'hidden' => [], - 'disabled' => [] + 'disabled' => [], ]; // Load validation rules @@ -408,11 +425,11 @@ public function getModalCreate(Request $request, Response $response, $args) 'action' => 'api/roles', 'method' => 'POST', 'fields' => $fields, - 'submit_text' => $translator->translate('CREATE') + 'submit_text' => $translator->translate('CREATE'), ], 'page' => [ - 'validators' => $validator->rules('json', false) - ] + 'validators' => $validator->rules('json', false), + ], ]); } @@ -423,9 +440,11 @@ public function getModalCreate(Request $request, Response $response, $args) * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If role is not found * @throws ForbiddenException If user is not authozied to access page */ @@ -457,7 +476,7 @@ public function getModalEdit(Request $request, Response $response, $args) $fieldNames = ['name', 'slug', 'description']; if (!$authorizer->checkAccess($currentUser, 'update_role_field', [ 'role' => $role, - 'fields' => $fieldNames + 'fields' => $fieldNames, ])) { throw new ForbiddenException(); } @@ -465,7 +484,7 @@ public function getModalEdit(Request $request, Response $response, $args) // Generate form $fields = [ 'hidden' => [], - 'disabled' => [] + 'disabled' => [], ]; // Load validation rules @@ -478,11 +497,11 @@ public function getModalEdit(Request $request, Response $response, $args) 'action' => "api/roles/r/{$role->slug}", 'method' => 'PUT', 'fields' => $fields, - 'submit_text' => $translator->translate('UPDATE') + 'submit_text' => $translator->translate('UPDATE'), ], 'page' => [ - 'validators' => $validator->rules('json', false) - ] + 'validators' => $validator->rules('json', false), + ], ]); } @@ -493,9 +512,11 @@ public function getModalEdit(Request $request, Response $response, $args) * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If role is not found * @throws ForbiddenException If user is not authozied to access page */ @@ -520,13 +541,13 @@ public function getModalEditPermissions(Request $request, Response $response, $a // Access-controlled resource - check that currentUser has permission to edit "permissions" field for this role if (!$authorizer->checkAccess($currentUser, 'update_role_field', [ 'role' => $role, - 'fields' => ['permissions'] + 'fields' => ['permissions'], ])) { throw new ForbiddenException(); } return $this->ci->view->render($response, 'modals/role-manage-permissions.html.twig', [ - 'role' => $role + 'role' => $role, ]); } @@ -537,9 +558,11 @@ public function getModalEditPermissions(Request $request, Response $response, $a * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If role is not found * @throws ForbiddenException If user is not authozied to access page */ @@ -564,7 +587,7 @@ public function getPermissions(Request $request, Response $response, $args) // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'view_role_field', [ 'role' => $role, - 'property' => 'permissions' + 'property' => 'permissions', ])) { throw new ForbiddenException(); } @@ -588,9 +611,11 @@ public function getPermissions(Request $request, Response $response, $args) * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If role is not found * @throws ForbiddenException If user is not authozied to access page */ @@ -618,7 +643,7 @@ public function getUsers(Request $request, Response $response, $args) // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'view_role_field', [ 'role' => $role, - 'property' => 'users' + 'property' => 'users', ])) { throw new ForbiddenException(); } @@ -642,9 +667,11 @@ public function getUsers(Request $request, Response $response, $args) * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws ForbiddenException If user is not authozied to access page */ public function pageInfo(Request $request, Response $response, $args) @@ -664,7 +691,7 @@ public function pageInfo(Request $request, Response $response, $args) // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'uri_role', [ - 'role' => $role + 'role' => $role, ])) { throw new ForbiddenException(); } @@ -674,13 +701,13 @@ public function pageInfo(Request $request, Response $response, $args) // Generate form $fields = [ - 'hidden' => [] + 'hidden' => [], ]; foreach ($fieldNames as $field) { if (!$authorizer->checkAccess($currentUser, 'view_role_field', [ 'role' => $role, - 'property' => $field + 'property' => $field, ])) { $fields['hidden'][] = $field; } @@ -688,27 +715,27 @@ public function pageInfo(Request $request, Response $response, $args) // Determine buttons to display $editButtons = [ - 'hidden' => [] + 'hidden' => [], ]; if (!$authorizer->checkAccess($currentUser, 'update_role_field', [ 'role' => $role, - 'fields' => ['name', 'slug', 'description'] + 'fields' => ['name', 'slug', 'description'], ])) { $editButtons['hidden'][] = 'edit'; } if (!$authorizer->checkAccess($currentUser, 'delete_role', [ - 'role' => $role + 'role' => $role, ])) { $editButtons['hidden'][] = 'delete'; } return $this->ci->view->render($response, 'pages/role.html.twig', [ - 'role' => $role, - 'fields' => $fields, - 'tools' => $editButtons, - 'delete_redirect' => $this->ci->router->pathFor('uri_roles') + 'role' => $role, + 'fields' => $fields, + 'tools' => $editButtons, + 'delete_redirect' => $this->ci->router->pathFor('uri_roles'), ]); } @@ -720,9 +747,11 @@ public function pageInfo(Request $request, Response $response, $args) * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws ForbiddenException If user is not authozied to access page */ public function pageList(Request $request, Response $response, $args) @@ -751,10 +780,13 @@ public function pageList(Request $request, Response $response, $args) * This route requires authentication (and should generally be limited to admins or the root user). * * Request type: PUT + * * @see getModalRoleEdit - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If role is not found * @throws ForbiddenException If user is not authozied to access page */ @@ -807,7 +839,7 @@ public function updateInfo(Request $request, Response $response, $args) // Access-controlled resource - check that currentUser has permission to edit submitted fields for this role if (!$authorizer->checkAccess($currentUser, 'update_role_field', [ 'role' => $role, - 'fields' => array_values(array_unique($fieldNames)) + 'fields' => array_values(array_unique($fieldNames)), ])) { throw new ForbiddenException(); } @@ -852,12 +884,12 @@ public function updateInfo(Request $request, Response $response, $args) // Create activity record $this->ci->userActivityLogger->info("User {$currentUser->user_name} updated details for role {$role->name}.", [ 'type' => 'role_update_info', - 'user_id' => $currentUser->id + 'user_id' => $currentUser->id, ]); }); $ms->addMessageTranslated('success', 'ROLE.UPDATED', [ - 'name' => $role->name + 'name' => $role->name, ]); return $response->withJson([], 200); @@ -872,9 +904,11 @@ public function updateInfo(Request $request, Response $response, $args) * This route requires authentication. * * Request type: PUT - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If role is not found * @throws ForbiddenException If user is not authozied to access page * @throws BadRequestException @@ -900,7 +934,7 @@ public function updateField(Request $request, Response $response, $args) // Access-controlled resource - check that currentUser has permission to edit the specified field for this user if (!$authorizer->checkAccess($currentUser, 'update_role_field', [ 'role' => $role, - 'fields' => [$fieldName] + 'fields' => [$fieldName], ])) { throw new ForbiddenException(); } @@ -916,7 +950,7 @@ public function updateField(Request $request, Response $response, $args) } $params = [ - $fieldName => $put['value'] + $fieldName => $put['value'], ]; // Validate key -> value pair @@ -938,6 +972,7 @@ public function updateField(Request $request, Response $response, $args) $e->addUserMessage($error); } } + throw $e; } @@ -960,18 +995,18 @@ public function updateField(Request $request, Response $response, $args) // Create activity record $this->ci->userActivityLogger->info("User {$currentUser->user_name} updated property '$fieldName' for role {$role->name}.", [ 'type' => 'role_update_field', - 'user_id' => $currentUser->id + 'user_id' => $currentUser->id, ]); }); // Add success messages if ($fieldName == 'permissions') { $ms->addMessageTranslated('success', 'ROLE.PERMISSIONS_UPDATED', [ - 'name' => $role->name + 'name' => $role->name, ]); } else { $ms->addMessageTranslated('success', 'ROLE.UPDATED', [ - 'name' => $role->name + 'name' => $role->name, ]); } @@ -979,10 +1014,12 @@ public function updateField(Request $request, Response $response, $args) } /** - * Get role instance from params + * Get role instance from params. + * + * @param array $params * - * @param array $params * @throws BadRequestException + * * @return Role */ protected function getRoleFromParams($params) @@ -1004,6 +1041,7 @@ protected function getRoleFromParams($params) $e->addUserMessage($error); } } + throw $e; } diff --git a/app/sprinkles/admin/src/Controller/UserController.php b/app/sprinkles/admin/src/Controller/UserController.php index 0ea0e2c1d..caf9caba3 100644 --- a/app/sprinkles/admin/src/Controller/UserController.php +++ b/app/sprinkles/admin/src/Controller/UserController.php @@ -1,5 +1,6 @@ ci->classMapper; - // Check if username or email already exists - if ($classMapper->staticMethod('user', 'findUnique', $data['user_name'], 'user_name')) { + // Check if username or email already exists. If not set, validator will pick it up + if (isset($data['user_name']) && $classMapper->staticMethod('user', 'findUnique', $data['user_name'], 'user_name')) { $ms->addMessageTranslated('danger', 'USERNAME.IN_USE', $data); $error = true; } - if ($classMapper->staticMethod('user', 'findUnique', $data['email'], 'email')) { + if (isset($data['email']) && $classMapper->staticMethod('user', 'findUnique', $data['email'], 'email')) { $ms->addMessageTranslated('danger', 'EMAIL.IN_USE', $data); $error = true; } @@ -116,7 +120,7 @@ public function create(Request $request, Response $response, $args) // If currentUser does not have permission to set the group, but they try to set it to something other than their own group, // throw an exception. if (!$authorizer->checkAccess($currentUser, 'create_user_field', [ - 'fields' => ['group'] + 'fields' => ['group'], ])) { if (isset($data['group_id']) && $data['group_id'] != $currentUser->group_id) { throw new ForbiddenException(); @@ -144,7 +148,7 @@ public function create(Request $request, Response $response, $args) // Create activity record $this->ci->userActivityLogger->info("User {$currentUser->user_name} created a new account for {$user->user_name}.", [ 'type' => 'account_create', - 'user_id' => $currentUser->id + 'user_id' => $currentUser->id, ]); // Load default roles @@ -166,7 +170,7 @@ public function create(Request $request, Response $response, $args) ->addParams([ 'user' => $user, 'create_password_expiration' => $config['password_reset.timeouts.create'] / 3600 . ' hours', - 'token' => $passwordRequest->getToken() + 'token' => $passwordRequest->getToken(), ]); $this->ci->mailer->send($message); @@ -188,9 +192,11 @@ public function create(Request $request, Response $response, $args) * This route requires authentication. * * Request type: POST - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If user is not found * @throws ForbiddenException If user is not authozied to access page */ @@ -212,7 +218,7 @@ public function createPasswordReset(Request $request, Response $response, $args) // Access-controlled resource - check that currentUser has permission to edit "password" for this user if (!$authorizer->checkAccess($currentUser, 'update_user_field', [ 'user' => $user, - 'fields' => ['password'] + 'fields' => ['password'], ])) { throw new ForbiddenException(); } @@ -237,14 +243,14 @@ public function createPasswordReset(Request $request, Response $response, $args) ->addParams([ 'user' => $user, 'token' => $passwordReset->getToken(), - 'request_date' => Carbon::now()->format('Y-m-d H:i:s') + 'request_date' => Carbon::now()->format('Y-m-d H:i:s'), ]); $this->ci->mailer->send($message); }); $ms->addMessageTranslated('success', 'PASSWORD.FORGET.REQUEST_SENT', [ - 'email' => $user->email + 'email' => $user->email, ]); return $response->withJson([], 200); @@ -260,9 +266,11 @@ public function createPasswordReset(Request $request, Response $response, $args) * This route requires authentication (and should generally be limited to admins or the root user). * * Request type: DELETE - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If user is not found * @throws ForbiddenException If user is not authozied to access page * @throws BadRequestException @@ -284,7 +292,7 @@ public function delete(Request $request, Response $response, $args) // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'delete_user', [ - 'user' => $user + 'user' => $user, ])) { throw new ForbiddenException(); } @@ -297,6 +305,7 @@ public function delete(Request $request, Response $response, $args) if ($user->id == $config['reserved_user_ids.master']) { $e = new BadRequestException(); $e->addUserMessage('DELETE_MASTER'); + throw $e; } @@ -310,7 +319,7 @@ public function delete(Request $request, Response $response, $args) // Create activity record $this->ci->userActivityLogger->info("User {$currentUser->user_name} deleted the account for {$userName}.", [ 'type' => 'account_delete', - 'user_id' => $currentUser->id + 'user_id' => $currentUser->id, ]); }); @@ -318,7 +327,7 @@ public function delete(Request $request, Response $response, $args) $ms = $this->ci->alerts; $ms->addMessageTranslated('success', 'DELETION_SUCCESSFUL', [ - 'user_name' => $userName + 'user_name' => $userName, ]); return $response->withJson([], 200); @@ -329,9 +338,11 @@ public function delete(Request $request, Response $response, $args) * * This page requires authentication. * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If user is not found * @throws ForbiddenException If user is not authozied to access page */ @@ -359,7 +370,7 @@ public function getActivities(Request $request, Response $response, $args) // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'view_user_field', [ 'user' => $user, - 'property' => 'activities' + 'property' => 'activities', ])) { throw new ForbiddenException(); } @@ -380,9 +391,11 @@ public function getActivities(Request $request, Response $response, $args) * * This page requires authentication. * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If user is not found * @throws ForbiddenException If user is not authozied to access page */ @@ -413,7 +426,7 @@ public function getInfo(Request $request, Response $response, $args) // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'uri_user', [ - 'user' => $user + 'user' => $user, ])) { throw new ForbiddenException(); } @@ -426,14 +439,16 @@ public function getInfo(Request $request, Response $response, $args) } /** - * Returns a list of Users + * Returns a list of Users. * * Generates a list of users, optionally paginated, sorted and/or filtered. * This page requires authentication. * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws ForbiddenException If user is not authozied to access page */ public function getList(Request $request, Response $response, $args) @@ -468,9 +483,11 @@ public function getList(Request $request, Response $response, $args) * This does NOT render a complete page. Instead, it renders the HTML for the modal, which can be embedded in other pages. * This page requires authentication. * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If user is not found * @throws ForbiddenException If user is not authozied to access page * @throws BadRequestException @@ -495,7 +512,7 @@ public function getModalConfirmDelete(Request $request, Response $response, $arg // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'delete_user', [ - 'user' => $user + 'user' => $user, ])) { throw new ForbiddenException(); } @@ -508,6 +525,7 @@ public function getModalConfirmDelete(Request $request, Response $response, $arg if ($user->id == $config['reserved_user_ids.master']) { $e = new BadRequestException(); $e->addUserMessage('DELETE_MASTER'); + throw $e; } @@ -515,7 +533,7 @@ public function getModalConfirmDelete(Request $request, Response $response, $arg 'user' => $user, 'form' => [ 'action' => "api/users/u/{$user->user_name}", - ] + ], ]); } @@ -528,16 +546,15 @@ public function getModalConfirmDelete(Request $request, Response $response, $arg * * This page requires authentication. * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws ForbiddenException If user is not authozied to access page */ public function getModalCreate(Request $request, Response $response, $args) { - // GET parameters - $params = $request->getQueryParams(); - /** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager $authorizer */ $authorizer = $this->ci->authorizer; @@ -562,7 +579,7 @@ public function getModalCreate(Request $request, Response $response, $args) // TODO: come back to this when we finish implementing theming $fields = [ 'hidden' => ['theme'], - 'disabled' => [] + 'disabled' => [], ]; // Get a list of all locales @@ -571,7 +588,7 @@ public function getModalCreate(Request $request, Response $response, $args) // Determine if currentUser has permission to modify the group. If so, show the 'group' dropdown. // Otherwise, set to the currentUser's group and disable the dropdown. if ($authorizer->checkAccess($currentUser, 'create_user_field', [ - 'fields' => ['group'] + 'fields' => ['group'], ])) { // Get a list of all groups $groups = $classMapper->staticMethod('group', 'all'); @@ -590,7 +607,7 @@ public function getModalCreate(Request $request, Response $response, $args) $data = [ 'group_id' => $currentUser->group_id, 'locale' => $config['site.registration.user_defaults.locale'], - 'theme' => '' + 'theme' => '', ]; $user = $classMapper->createInstance('user', $data); @@ -607,11 +624,11 @@ public function getModalCreate(Request $request, Response $response, $args) 'action' => 'api/users', 'method' => 'POST', 'fields' => $fields, - 'submit_text' => $translator->translate('CREATE') + 'submit_text' => $translator->translate('CREATE'), ], 'page' => [ - 'validators' => $validator->rules('json', false) - ] + 'validators' => $validator->rules('json', false), + ], ]); } @@ -622,9 +639,11 @@ public function getModalCreate(Request $request, Response $response, $args) * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If user is not found * @throws ForbiddenException If user is not authozied to access page */ @@ -658,7 +677,7 @@ public function getModalEdit(Request $request, Response $response, $args) $fieldNames = ['name', 'email', 'locale']; if (!$authorizer->checkAccess($currentUser, 'update_user_field', [ 'user' => $user, - 'fields' => $fieldNames + 'fields' => $fieldNames, ])) { throw new ForbiddenException(); } @@ -675,13 +694,13 @@ public function getModalEdit(Request $request, Response $response, $args) // Generate form $fields = [ 'hidden' => ['theme'], - 'disabled' => ['user_name'] + 'disabled' => ['user_name'], ]; // Disable group field if currentUser doesn't have permission to modify group if (!$authorizer->checkAccess($currentUser, 'update_user_field', [ 'user' => $user, - 'fields' => ['group'] + 'fields' => ['group'], ])) { $fields['disabled'][] = 'group'; } @@ -705,11 +724,11 @@ public function getModalEdit(Request $request, Response $response, $args) 'action' => "api/users/u/{$user->user_name}", 'method' => 'PUT', 'fields' => $fields, - 'submit_text' => $translator->translate('UPDATE') + 'submit_text' => $translator->translate('UPDATE'), ], 'page' => [ - 'validators' => $validator->rules('json', false) - ] + 'validators' => $validator->rules('json', false), + ], ]); } @@ -720,9 +739,11 @@ public function getModalEdit(Request $request, Response $response, $args) * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If user is not found * @throws ForbiddenException If user is not authozied to access page */ @@ -747,7 +768,7 @@ public function getModalEditPassword(Request $request, Response $response, $args // Access-controlled resource - check that currentUser has permission to edit "password" field for this user if (!$authorizer->checkAccess($currentUser, 'update_user_field', [ 'user' => $user, - 'fields' => ['password'] + 'fields' => ['password'], ])) { throw new ForbiddenException(); } @@ -759,8 +780,8 @@ public function getModalEditPassword(Request $request, Response $response, $args return $this->ci->view->render($response, 'modals/user-set-password.html.twig', [ 'user' => $user, 'page' => [ - 'validators' => $validator->rules('json', false) - ] + 'validators' => $validator->rules('json', false), + ], ]); } @@ -771,9 +792,11 @@ public function getModalEditPassword(Request $request, Response $response, $args * This page requires authentication. * * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If user is not found * @throws ForbiddenException If user is not authozied to access page */ @@ -798,13 +821,13 @@ public function getModalEditRoles(Request $request, Response $response, $args) // Access-controlled resource - check that currentUser has permission to edit "roles" field for this user if (!$authorizer->checkAccess($currentUser, 'update_user_field', [ 'user' => $user, - 'fields' => ['roles'] + 'fields' => ['roles'], ])) { throw new ForbiddenException(); } return $this->ci->view->render($response, 'modals/user-manage-roles.html.twig', [ - 'user' => $user + 'user' => $user, ]); } @@ -814,9 +837,11 @@ public function getModalEditRoles(Request $request, Response $response, $args) * Generates a list of permissions, optionally paginated, sorted and/or filtered. * This page requires authentication. * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If user is not found * @throws ForbiddenException If user is not authozied to access page */ @@ -841,7 +866,7 @@ public function getPermissions(Request $request, Response $response, $args) // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'view_user_field', [ 'user' => $user, - 'property' => 'permissions' + 'property' => 'permissions', ])) { throw new ForbiddenException(); } @@ -862,9 +887,11 @@ public function getPermissions(Request $request, Response $response, $args) * * This page requires authentication. * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If user is not found * @throws ForbiddenException If user is not authozied to access page */ @@ -892,7 +919,7 @@ public function getRoles(Request $request, Response $response, $args) // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'view_user_field', [ 'user' => $user, - 'property' => 'roles' + 'property' => 'roles', ])) { throw new ForbiddenException(); } @@ -916,9 +943,11 @@ public function getRoles(Request $request, Response $response, $args) * * This page requires authentication. * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws ForbiddenException If user is not authozied to access page */ public function pageInfo(Request $request, Response $response, $args) @@ -938,7 +967,7 @@ public function pageInfo(Request $request, Response $response, $args) // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'uri_user', [ - 'user' => $user + 'user' => $user, ])) { throw new ForbiddenException(); } @@ -955,14 +984,14 @@ public function pageInfo(Request $request, Response $response, $args) // Generate form $fields = [ // Always hide these - 'hidden' => ['theme'] + 'hidden' => ['theme'], ]; // Determine which fields should be hidden foreach ($fieldNames as $field) { if (!$authorizer->checkAccess($currentUser, 'view_user_field', [ 'user' => $user, - 'property' => $field + 'property' => $field, ])) { $fields['hidden'][] = $field; } @@ -975,76 +1004,76 @@ public function pageInfo(Request $request, Response $response, $args) // Determine buttons to display $editButtons = [ - 'hidden' => [] + 'hidden' => [], ]; if (!$authorizer->checkAccess($currentUser, 'update_user_field', [ 'user' => $user, - 'fields' => ['name', 'email', 'locale'] + 'fields' => ['name', 'email', 'locale'], ])) { $editButtons['hidden'][] = 'edit'; } if (!$authorizer->checkAccess($currentUser, 'update_user_field', [ 'user' => $user, - 'fields' => ['flag_enabled'] + 'fields' => ['flag_enabled'], ])) { $editButtons['hidden'][] = 'enable'; } if (!$authorizer->checkAccess($currentUser, 'update_user_field', [ 'user' => $user, - 'fields' => ['flag_verified'] + 'fields' => ['flag_verified'], ])) { $editButtons['hidden'][] = 'activate'; } if (!$authorizer->checkAccess($currentUser, 'update_user_field', [ 'user' => $user, - 'fields' => ['password'] + 'fields' => ['password'], ])) { $editButtons['hidden'][] = 'password'; } if (!$authorizer->checkAccess($currentUser, 'update_user_field', [ 'user' => $user, - 'fields' => ['roles'] + 'fields' => ['roles'], ])) { $editButtons['hidden'][] = 'roles'; } if (!$authorizer->checkAccess($currentUser, 'delete_user', [ - 'user' => $user + 'user' => $user, ])) { $editButtons['hidden'][] = 'delete'; } // Determine widgets to display $widgets = [ - 'hidden' => [] + 'hidden' => [], ]; if (!$authorizer->checkAccess($currentUser, 'view_user_field', [ 'user' => $user, - 'property' => 'permissions' + 'property' => 'permissions', ])) { $widgets['hidden'][] = 'permissions'; } if (!$authorizer->checkAccess($currentUser, 'view_user_field', [ 'user' => $user, - 'property' => 'activities' + 'property' => 'activities', ])) { $widgets['hidden'][] = 'activities'; } return $this->ci->view->render($response, 'pages/user.html.twig', [ - 'user' => $user, - 'locales' => $locales, - 'fields' => $fields, - 'tools' => $editButtons, - 'widgets' => $widgets, - 'delete_redirect' => $this->ci->router->pathFor('uri_users') + 'user' => $user, + 'locales' => $locales, + 'fields' => $fields, + 'tools' => $editButtons, + 'widgets' => $widgets, + 'delete_redirect' => $this->ci->router->pathFor('uri_users'), ]); } @@ -1056,9 +1085,11 @@ public function pageInfo(Request $request, Response $response, $args) * * This page requires authentication. * Request type: GET - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws ForbiddenException If user is not authozied to access page */ public function pageList(Request $request, Response $response, $args) @@ -1078,7 +1109,7 @@ public function pageList(Request $request, Response $response, $args) } /** - * Processes the request to update an existing user's basic details (first_name, last_name, email, locale, group_id) + * Processes the request to update an existing user's basic details (first_name, last_name, email, locale, group_id). * * Processes the request from the user update form, checking that: * 1. The target user's new email address, if specified, is not already in use; @@ -1087,9 +1118,11 @@ public function pageList(Request $request, Response $response, $args) * * This route requires authentication. * Request type: PUT - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If user is not found * @throws ForbiddenException If user is not authozied to access page */ @@ -1148,7 +1181,7 @@ public function updateInfo(Request $request, Response $response, $args) // Access-controlled resource - check that currentUser has permission to edit submitted fields for this user if (!$authorizer->checkAccess($currentUser, 'update_user_field', [ 'user' => $user, - 'fields' => array_values(array_unique($fieldNames)) + 'fields' => array_values(array_unique($fieldNames)), ])) { throw new ForbiddenException(); } @@ -1192,12 +1225,12 @@ public function updateInfo(Request $request, Response $response, $args) // Create activity record $this->ci->userActivityLogger->info("User {$currentUser->user_name} updated basic account info for user {$user->user_name}.", [ 'type' => 'account_update_info', - 'user_id' => $currentUser->id + 'user_id' => $currentUser->id, ]); }); $ms->addMessageTranslated('success', 'DETAILS_UPDATED', [ - 'user_name' => $user->user_name + 'user_name' => $user->user_name, ]); return $response->withJson([], 200); @@ -1214,9 +1247,11 @@ public function updateInfo(Request $request, Response $response, $args) * * This route requires authentication. * Request type: PUT - * @param Request $request - * @param Response $response - * @param array $args + * + * @param Request $request + * @param Response $response + * @param array $args + * * @throws NotFoundException If user is not found * @throws ForbiddenException If user is not authozied to access page * @throws BadRequestException @@ -1242,7 +1277,7 @@ public function updateField(Request $request, Response $response, $args) // Access-controlled resource - check that currentUser has permission to edit the specified field for this user if (!$authorizer->checkAccess($currentUser, 'update_user_field', [ 'user' => $user, - 'fields' => [$fieldName] + 'fields' => [$fieldName], ])) { throw new ForbiddenException(); } @@ -1267,7 +1302,7 @@ public function updateField(Request $request, Response $response, $args) // Create and validate key -> value pair $params = [ - $fieldName => $put['value'] + $fieldName => $put['value'], ]; // Load the request schema @@ -1287,6 +1322,7 @@ public function updateField(Request $request, Response $response, $args) $e->addUserMessage($error); } } + throw $e; } @@ -1305,6 +1341,7 @@ public function updateField(Request $request, Response $response, $args) ) { $e = new BadRequestException(); $e->addUserMessage('DISABLE_MASTER'); + throw $e; } elseif ( ($user->id == $currentUser->id) && @@ -1312,6 +1349,7 @@ public function updateField(Request $request, Response $response, $args) ) { $e = new BadRequestException(); $e->addUserMessage('DISABLE_SELF'); + throw $e; } } elseif ($fieldName == 'password') { @@ -1331,7 +1369,7 @@ public function updateField(Request $request, Response $response, $args) // Create activity record $this->ci->userActivityLogger->info("User {$currentUser->user_name} updated property '$fieldName' for user {$user->user_name}.", [ 'type' => 'account_update_field', - 'user_id' => $currentUser->id + 'user_id' => $currentUser->id, ]); }); @@ -1339,20 +1377,20 @@ public function updateField(Request $request, Response $response, $args) if ($fieldName == 'flag_enabled') { if ($fieldValue == '1') { $ms->addMessageTranslated('success', 'ENABLE_SUCCESSFUL', [ - 'user_name' => $user->user_name + 'user_name' => $user->user_name, ]); } else { $ms->addMessageTranslated('success', 'DISABLE_SUCCESSFUL', [ - 'user_name' => $user->user_name + 'user_name' => $user->user_name, ]); } } elseif ($fieldName == 'flag_verified') { $ms->addMessageTranslated('success', 'MANUALLY_ACTIVATED', [ - 'user_name' => $user->user_name + 'user_name' => $user->user_name, ]); } else { $ms->addMessageTranslated('success', 'DETAILS_UPDATED', [ - 'user_name' => $user->user_name + 'user_name' => $user->user_name, ]); } @@ -1360,10 +1398,12 @@ public function updateField(Request $request, Response $response, $args) } /** - * Get User instance from params + * Get User instance from params. + * + * @param array $params * - * @param array $params * @throws BadRequestException + * * @return User */ protected function getUserFromParams($params) @@ -1385,6 +1425,7 @@ protected function getUserFromParams($params) $e->addUserMessage($error); } } + throw $e; } diff --git a/app/sprinkles/admin/src/ServicesProvider/ServicesProvider.php b/app/sprinkles/admin/src/ServicesProvider/ServicesProvider.php index 37411feb1..c453d2c20 100644 --- a/app/sprinkles/admin/src/ServicesProvider/ServicesProvider.php +++ b/app/sprinkles/admin/src/ServicesProvider/ServicesProvider.php @@ -1,5 +1,6 @@ 'active', - 'text' => Translator::translate('ACTIVE') + 'text' => Translator::translate('ACTIVE'), ], [ 'value' => 'unactivated', - 'text' => Translator::translate('UNACTIVATED') + 'text' => Translator::translate('UNACTIVATED'), ], [ 'value' => 'disabled', - 'text' => Translator::translate('DISABLED') - ] + 'text' => Translator::translate('DISABLED'), + ], ]; } /** * Sort based on last activity time. * - * @param Builder $query - * @param string $direction + * @param Builder $query + * @param string $direction + * * @return self */ protected function sortLastActivity($query, $direction) @@ -165,8 +170,9 @@ protected function sortLastActivity($query, $direction) /** * Sort based on last name. * - * @param Builder $query - * @param string $direction + * @param Builder $query + * @param string $direction + * * @return self */ protected function sortName($query, $direction) @@ -177,10 +183,11 @@ protected function sortName($query, $direction) } /** - * Sort active, unactivated, disabled + * Sort active, unactivated, disabled. + * + * @param Builder $query + * @param string $direction * - * @param Builder $query - * @param string $direction * @return self */ protected function sortStatus($query, $direction) diff --git a/app/sprinkles/admin/tests/Integration/Controller/ActivityControllerTest.php b/app/sprinkles/admin/tests/Integration/Controller/ActivityControllerTest.php new file mode 100644 index 000000000..a2d99dbd4 --- /dev/null +++ b/app/sprinkles/admin/tests/Integration/Controller/ActivityControllerTest.php @@ -0,0 +1,120 @@ +getController(); + $this->assertInstanceOf(ActivityController::class, $controller); + + return $controller; + } + + /** + * @depends testControllerConstructor + * @expectedException \UserFrosting\Support\Exception\ForbiddenException + */ + public function testGetList_GuestUser() + { + $controller = $this->getController(); + $this->expectException(ForbiddenException::class); + $controller->getList($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructor + */ + public function testGetList_ForbiddenException() + { + // Non admin user, won't have access + $testUser = $this->createTestUser(false, true); + + // Get controller + $controller = $this->getController(); + $this->expectException(ForbiddenException::class); + $controller->getList($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructor + */ + public function testGetList() + { + // Admin user, WILL have access + $testUser = $this->createTestUser(true, true); + + // Get controller + $controller = $this->getController(); + + $result = $controller->getList($this->getRequest(), $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotSame('[]', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + */ + public function testPageList() + { + // Admin user, WILL have access + $testUser = $this->createTestUser(true, true); + + // Get controller + $controller = $this->getController(); + + // Get controller stuff + $result = $controller->pageList($this->getRequest(), $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructor + */ + public function testPageListWithNoPermission() + { + // Admin user, WILL have access + $testUser = $this->createTestUser(false, true); + + // Get controller + $controller = $this->getController(); + + // Set expectations + $this->expectException(ForbiddenException::class); + + // Execute + $controller->pageList($this->getRequest(), $this->getResponse(), []); + } + + /** + * @return ActivityController + */ + private function getController() + { + return new ActivityController($this->ci); + } +} diff --git a/app/sprinkles/admin/tests/Integration/AdminControllerTest.php b/app/sprinkles/admin/tests/Integration/Controller/AdminControllerTest.php similarity index 63% rename from app/sprinkles/admin/tests/Integration/AdminControllerTest.php rename to app/sprinkles/admin/tests/Integration/Controller/AdminControllerTest.php index 5cb4db334..db3cd2328 100644 --- a/app/sprinkles/admin/tests/Integration/AdminControllerTest.php +++ b/app/sprinkles/admin/tests/Integration/Controller/AdminControllerTest.php @@ -1,5 +1,6 @@ getController(); + $this->expectException(ForbiddenException::class); $controller->pageDashboard($this->getRequest(), $this->getResponse(), []); } /** * @depends testControllerConstructor - * @expectedException \UserFrosting\Support\Exception\ForbiddenException */ public function testPageDashboard_ForbiddenException() { @@ -52,6 +53,7 @@ public function testPageDashboard_ForbiddenException() // Get controller $controller = $this->getController(); + $this->expectException(ForbiddenException::class); $controller->pageDashboard($this->getRequest(), $this->getResponse(), []); } @@ -102,12 +104,65 @@ public function testClearCache() /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ $ms = $this->ci->alerts; $messages = $ms->getAndClearMessages(); - $expectedMessage = end($messages)['message']; + $actualMessage = end($messages)['message']; - $actualMessage = $this->ci->translator->translate('CACHE.CLEARED'); + $expectedMessage = $this->ci->translator->translate('CACHE.CLEARED'); $this->assertSame($expectedMessage, $actualMessage); } + /** + * @depends testControllerConstructor + */ + public function testClearCacheWithNoPermission() + { + // Normal user, WON'T have access + $testUser = $this->createTestUser(false, true); + + // Get controller + $controller = $this->getController(); + + // Set expectations + $this->expectException(ForbiddenException::class); + + // Execute + $controller->clearCache($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testClearCache + */ + public function testGetModalConfirmClearCache() + { + // Admin user, WILL have access + $testUser = $this->createTestUser(true, true); + + // Get controller + $controller = $this->getController(); + + // Get controller stuff + $result = $controller->getModalConfirmClearCache($this->getRequest(), $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testGetModalConfirmClearCache + */ + public function testGetModalConfirmClearCacheWithNoPermission() + { + // Admin user, WILL have access + $testUser = $this->createTestUser(false, true); + + // Get controller + $controller = $this->getController(); + + // Set expectations + $this->expectException(ForbiddenException::class); + + // Execute + $controller->getModalConfirmClearCache($this->getRequest(), $this->getResponse(), []); + } + /** * @return AdminController */ diff --git a/app/sprinkles/admin/tests/Integration/Controller/GroupControllerGuestTest.php b/app/sprinkles/admin/tests/Integration/Controller/GroupControllerGuestTest.php new file mode 100644 index 000000000..d78a3f864 --- /dev/null +++ b/app/sprinkles/admin/tests/Integration/Controller/GroupControllerGuestTest.php @@ -0,0 +1,409 @@ +setupTestDatabase(); + + if ($this->usingInMemoryDatabase()) { + + // Setup database, then setup User & default role + $this->refreshDatabase(); + $this->setupUser(); + + } else if (!static::$initialized) { + + // Only refresh db once + $this->refreshDatabase(); + static::$initialized = true; + } + } + + /** + */ + public function testControllerConstructor() + { + $controller = $this->getController(); + $this->assertInstanceOf(GroupController::class, $controller); + } + + /** + * @return GroupController + */ + public function testControllerConstructorWithUser() + { + // Skip user setup if using in-memory db + if (!$this->usingInMemoryDatabase()) { + $this->setupUser(); + } + + $controller = $this->getController(); + $this->assertInstanceOf(GroupController::class, $controller); + + return $controller; + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testGetInfo_GuestUser(GroupController $controller) + { + $controller = $this->getController(); + $this->expectException(ForbiddenException::class); + $controller->getInfo($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testGetInfo_ForbiddenException(GroupController $controller) + { + // Non admin user, won't have access + $testUser = $this->createTestUser(false, true); + + // Get controller + $controller = $this->getController(); + $this->expectException(ForbiddenException::class); + $controller->getInfo($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testGetListWithNoPermission(GroupController $controller) + { + // Admin user, WILL have access + $testUser = $this->createTestUser(false, true); + + // Get controller + $controller = $this->getController(); + + // Set expectations + $this->expectException(ForbiddenException::class); + + // Execute + $controller->getList($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testGetUsersWithNoPermission(GroupController $controller) + { + // Admin user, WILL have access + $testUser = $this->createTestUser(false, true); + + // Create test group + $fm = $this->ci->factory; + $group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group'); + + // Get controller + $controller = $this->getController(); + + // Set expectations + $this->expectException(ForbiddenException::class); + + // Execute + $controller->getUsers($this->getRequest(), $this->getResponse(), ['slug' => $group->slug]); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testpageInfoWithNoPermission(GroupController $controller) + { + // Admin user, WILL have access + $testUser = $this->createTestUser(false, true); + + // Create test group + $fm = $this->ci->factory; + $group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group'); + + // Get controller + $controller = $this->getController(); + + // Set expectations + $this->expectException(ForbiddenException::class); + + // Execute + $controller->pageInfo($this->getRequest(), $this->getResponse(), ['slug' => $group->slug]); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testpageInfoWithPartialPermissions(GroupController $controller) + { + // Guest user + $testUser = $this->createTestUser(false, true); + + // Create test group + $fm = $this->ci->factory; + $group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group'); + + // Give user partial permissions + $this->giveUserTestPermission($testUser, 'uri_group'); // Can view, but can't edit or delete + + // Get controller + $controller = $this->getController(); + + // Get controller stuff + $result = $controller->pageInfo($this->getRequest(), $this->getResponse(), ['slug' => $group->slug]); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + + // Can't test edit / delete button not displayed ? + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testpageListWithNoPermission(GroupController $controller) + { + // Guest user, WILL have access + $testUser = $this->createTestUser(false, true); + + // Get controller + $controller = $this->getController(); + + // Set expectations + $this->expectException(ForbiddenException::class); + + // Execute + $controller->pageList($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testCreateWithNoPermission(GroupController $controller) + { + // Guest user, WILL have access + $testUser = $this->createTestUser(false, true); + + // Get controller + $controller = $this->getController(); + + // Set expectations + $this->expectException(ForbiddenException::class); + + // Execute + $controller->create($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @todo test individual permission with the delete_group permission too + * @param GroupController $controller + */ + public function testDeleteWithNoPermission(GroupController $controller) + { + // Guest user, WILL have access + $testUser = $this->createTestUser(false, true); + + // Create test group + $fm = $this->ci->factory; + $group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group'); + + // Get controller + $controller = $this->getController(); + + // Set expectations + $this->expectException(ForbiddenException::class); + + // Execute + $controller->delete($this->getRequest(), $this->getResponse(), ['slug' => $group->slug]); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testGetModalConfirmDeleteWithNoPermission(GroupController $controller) + { + // Guest user, WILL have access + $testUser = $this->createTestUser(false, true); + + // Create test group + $fm = $this->ci->factory; + $group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group'); + + // Get controller + $controller = $this->getController(); + + $request = $this->getRequest()->withQueryParams([ + 'slug' => $group->slug + ]); + + // Set expectations + $this->expectException(ForbiddenException::class); + + // Execute + $controller->getModalConfirmDelete($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testGetModalCreateWithNoPermission(GroupController $controller) + { + // Guest user, WILL have access + $testUser = $this->createTestUser(false, true); + + // Get controller + $controller = $this->getController(); + + // Set expectations + $this->expectException(ForbiddenException::class); + + // Execute + $controller->getModalCreate($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testGetModalEditWithNoPermission(GroupController $controller) + { + // Guest user, WILL have access + $testUser = $this->createTestUser(false, true); + + // Create test group + $fm = $this->ci->factory; + $group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group'); + + // Get controller + $controller = $this->getController(); + + $request = $this->getRequest()->withQueryParams([ + 'slug' => $group->slug + ]); + + // Set expectations + $this->expectException(ForbiddenException::class); + + // Execute + $controller->getModalEdit($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testUpdateInfoWithNoPermission(GroupController $controller) + { + // Guest user, won't have access + $testUser = $this->createTestUser(false, true); + + // Create a group + $fm = $this->ci->factory; + $group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group'); + + // Get controller + $controller = $this->getController(); + + // Set post data + $data = [ + 'name' => 'foo', + 'slug' => 'foo', + 'icon' => 'foo' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Set expectations + $this->expectException(ForbiddenException::class); + + // Execute + $controller->updateInfo($request, $this->getResponse(), ['slug' => $group->slug]); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testUpdateInfoWithNoGroup(GroupController $controller) + { + // Guest user, WILL have access + $testUser = $this->createTestUser(false, true); + + // Get controller + $controller = $this->getController(); + + // Set expectations + $this->expectException(NotFoundException::class); + + // Execute + $controller->updateInfo($this->getRequest(), $this->getResponse(), ['slug' => 'blah']); + } + + + /** + * @return GroupController + */ + private function getController() + { + return new GroupController($this->ci); + } + + /** + */ + private function setupUser() + { + // Guest user, won't have any access + $testUser = $this->createTestUser(false, true); + + // Create test role + $fm = $this->ci->factory; + $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group', [ + 'slug' => 'foo', + 'name' => 'bar' + ]); + } +} diff --git a/app/sprinkles/admin/tests/Integration/Controller/GroupControllerTest.php b/app/sprinkles/admin/tests/Integration/Controller/GroupControllerTest.php new file mode 100644 index 000000000..3df60928e --- /dev/null +++ b/app/sprinkles/admin/tests/Integration/Controller/GroupControllerTest.php @@ -0,0 +1,701 @@ +setupTestDatabase(); + + if ($this->usingInMemoryDatabase()) { + + // Setup database, then setup User & default role + $this->refreshDatabase(); + $this->setupUser(); + + } else if (!static::$initialized) { + + // Only refresh db once + $this->refreshDatabase(); + static::$initialized = true; + } + } + + /** + */ + public function testControllerConstructor() + { + $controller = $this->getController(); + $this->assertInstanceOf(GroupController::class, $controller); + } + + /** + * @return GroupController + */ + public function testControllerConstructorWithUser() + { + // Skip user setup if using in-memory db + if (!$this->usingInMemoryDatabase()) { + $this->setupUser(); + } + + $controller = $this->getController(); + $this->assertInstanceOf(GroupController::class, $controller); + + return $controller; + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testGetInfoWithNotFoundException(GroupController $controller) + { + $this->expectException(NotFoundException::class); + $controller->getInfo($this->getRequest(), $this->getResponse(), ['slug' => '']); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testGetInfo(GroupController $controller) + { + $result = $controller->getInfo($this->getRequest(), $this->getResponse(), ['slug' => 'foo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + $this->assertContains('bar', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testGetList(GroupController $controller) + { + $result = $controller->getList($this->getRequest(), $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testGetUsersWithBadSlug(GroupController $controller) + { + $this->expectException(NotFoundException::class); + $controller->getUsers($this->getRequest(), $this->getResponse(), ['slug' => 'foobar']); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testGetUsersWithNoSlug(GroupController $controller) + { + $this->expectException(BadRequestException::class); + $controller->getUsers($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testGetUsers(GroupController $controller) + { + $result = $controller->getUsers($this->getRequest(), $this->getResponse(), ['slug' => 'foo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testpageInfo(GroupController $controller) + { + $result = $controller->pageInfo($this->getRequest(), $this->getResponse(), ['slug' => 'foo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testpageInfoWithBadSlug(GroupController $controller) + { + $this->expectException(NotFoundException::class); + $controller->pageInfo($this->getRequest(), $this->getResponse(), ['slug' => 'foobar']); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testpageList(GroupController $controller) + { + $result = $controller->pageList($this->getRequest(), $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testCreate(GroupController $controller) + { + // Set post data + $data = [ + 'name' => 'foo', + 'slug' => 'bar', + 'icon' => 'icon' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->create($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure group was created + $group = Group::where('slug', 'bar')->first(); + $this->assertSame('foo', $group->name); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testCreate + * @param GroupController $controller + */ + public function testCreateWithMissingName(GroupController $controller) + { + // Set post data + $data = [ + 'name' => '', + 'slug' => 'missingName', + 'icon' => 'foo' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->create($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure group was created + $group = Group::where('slug', 'missingName')->first(); + $this->assertNull($group); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testCreate + * @param GroupController $controller + */ + public function testCreateWithDuplicateSlug(GroupController $controller) + { + // Set post data + $data = [ + 'name' => 'bar', + 'slug' => 'foo', + 'icon' => 'foo' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->create($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testCreate + * @param GroupController $controller + */ + public function testCreateWithDuplicateName(GroupController $controller) + { + // Set post data + $data = [ + 'name' => 'bar', + 'slug' => 'duplicateName', + 'icon' => 'foo' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->create($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure group was created + $group = Group::where('slug', 'duplicateName')->first(); + $this->assertNull($group); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testDelete(GroupController $controller) + { + // Create test group + $fm = $this->ci->factory; + $group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group'); + + // Get controller stuff + $result = $controller->delete($this->getRequest(), $this->getResponse(), ['slug' => $group->slug]); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Group is deleted + $this->assertNull(Group::where('slug', $group->slug)->first()); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testDelete + * @param GroupController $controller + */ + public function testDeleteWithNotExistingGroup(GroupController $controller) + { + $this->expectException(NotFoundException::class); + $controller->delete($this->getRequest(), $this->getResponse(), ['slug' => 'foobar']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testDelete + * @param GroupController $controller + */ + public function testDeleteWithDefaultGroup(GroupController $controller) + { + // Admin user, WILL have access + $testUser = User::find(1)->first(); + $this->loginUser($testUser); + + // Change config + $this->ci->config['site.registration.user_defaults.group'] = 'foo'; + + // Recreate controller so config is accepted + $controller = $this->getController(); + + // Make sure group exist + $this->assertNotNull(Group::where('slug', 'foo')->first()); + + // Assert + $this->expectException(BadRequestException::class); + $controller->delete($this->getRequest(), $this->getResponse(), ['slug' => 'foo']); + + // Make sure group is still there + $this->assertNotNull(Group::where('slug', 'foo')->first()); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testDeleteWithDefaultGroup + * @param GroupController $controller + */ + public function testDeleteWithUserInGroup(GroupController $controller) + { + $testUser = User::find(1)->first(); + + // Create test group + $fm = $this->ci->factory; + $group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group'); + + // Associate user to group + $testUser->group()->associate($group); + $testUser->save(); + + $this->expectException(BadRequestException::class); + $controller->delete($this->getRequest(), $this->getResponse(), ['slug' => $group->slug]); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testDeleteWithUserInGroup + * @param GroupController $controller + */ + public function testGetModalConfirmDelete(GroupController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'slug' => 'foo' + ]); + + // Get controller stuff + $result = $controller->getModalConfirmDelete($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalConfirmDelete + * @param GroupController $controller + */ + public function testGetModalConfirmDeleteWithNoGetData(GroupController $controller) + { + $this->expectException(BadRequestException::class); + $controller->getModalConfirmDelete($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalConfirmDelete + * @param GroupController $controller + */ + public function testGetModalConfirmDeleteWithNonExistingGroup(GroupController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'slug' => 'foobar' + ]); + + $this->expectException(NotFoundException::class); + $controller->getModalConfirmDelete($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalConfirmDelete + * @param GroupController $controller + */ + public function testGetModalConfirmDeleteWithUserInGroup(GroupController $controller) + { + $testUser = User::find(1)->first(); + + // Create test group + $fm = $this->ci->factory; + $group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group'); + + // Associate user to group + $testUser->group()->associate($group); + $testUser->save(); + + $request = $this->getRequest()->withQueryParams([ + 'slug' => $group->slug + ]); + + $this->expectException(BadRequestException::class); + $controller->getModalConfirmDelete($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testGetModalCreate(GroupController $controller) + { + $result = $controller->getModalCreate($this->getRequest(), $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testGetModalEdit(GroupController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'slug' => 'foo' + ]); + + // Get controller stuff + $result = $controller->getModalEdit($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalEdit + * @param GroupController $controller + */ + public function testGetModalEditWithNoGetData(GroupController $controller) + { + $this->expectException(BadRequestException::class); + $controller->getModalEdit($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalEdit + * @param GroupController $controller + */ + public function testGetModalEditWithNonExistingGroup(GroupController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'slug' => 'foobar' + ]); + + $this->expectException(NotFoundException::class); + $controller->getModalEdit($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param GroupController $controller + */ + public function testUpdateInfo(GroupController $controller) + { + // Create a group + $fm = $this->ci->factory; + $group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group', [ + 'name' => 'barbar', + 'slug' => 'foofoo', + ]); + + // Set post data + $data = [ + 'name' => 'barbarbar', + 'slug' => 'foofoo', + 'icon' => 'icon' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateInfo($request, $this->getResponse(), ['slug' => $group->slug]); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure group was update + $editedGroup = Group::where('slug', 'foofoo')->first(); + $this->assertSame('barbarbar', $editedGroup->name); + $this->assertNotSame($group->name, $editedGroup->name); + $this->assertSame($group->description, $editedGroup->description); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateInfo + * @param GroupController $controller + */ + public function testUpdateInfoWithMissingName(GroupController $controller) + { + // Set post data + $data = [ + 'name' => '', + 'slug' => 'foo', + 'icon' => 'foo' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateInfo($request, $this->getResponse(), ['slug' => 'foo']); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure group was NOT update + $editedGroup = Group::where('slug', 'foo')->first(); + $this->assertSame('bar', $editedGroup->name); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateInfo + * @param GroupController $controller + */ + public function testUpdateInfoWithMissingSlug(GroupController $controller) + { + // Set post data + $data = [ + 'name' => 'bar', + 'slug' => '', + 'icon' => 'foo' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateInfo($request, $this->getResponse(), ['slug' => 'foo']); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure group was NOT update + $editedGroup = Group::where('slug', 'foo')->first(); + $this->assertNotNull($editedGroup); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateInfo + * @param GroupController $controller + */ + public function testUpdateInfoWithDuplicateSlug(GroupController $controller) + { + // Create a group + $fm = $this->ci->factory; + $group2 = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group'); + + // Set post data + $data = [ + 'slug' => $group2->slug + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateInfo($request, $this->getResponse(), ['slug' => 'foo']); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateInfo + * @param GroupController $controller + */ + public function testUpdateInfoWithDuplicateName(GroupController $controller) + { + // Create a group + $fm = $this->ci->factory; + $group2 = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group'); + + // Set post data + $data = [ + 'name' => $group2->name + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateInfo($request, $this->getResponse(), ['slug' => 'foo']); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + + /** + * @return GroupController + */ + private function getController() + { + return new GroupController($this->ci); + } + + /** + */ + private function setupUser() + { + // Admin user, WILL have access + $testUser = $this->createTestUser(true, true); + + // Create test role + $fm = $this->ci->factory; + $role = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group', [ + 'slug' => 'foo', + 'name' => 'bar' + ]); + } +} diff --git a/app/sprinkles/admin/tests/Integration/Controller/PermissionControllerGuestTest.php b/app/sprinkles/admin/tests/Integration/Controller/PermissionControllerGuestTest.php new file mode 100644 index 000000000..4fc5ba67a --- /dev/null +++ b/app/sprinkles/admin/tests/Integration/Controller/PermissionControllerGuestTest.php @@ -0,0 +1,158 @@ +setupTestDatabase(); + + if ($this->usingInMemoryDatabase()) { + + // Setup database, then setup User & default role + $this->refreshDatabase(); + $this->setupUser(); + + } else if (!static::$initialized) { + + // Only refresh db once + $this->refreshDatabase(); + static::$initialized = true; + } + } + + /** + */ + public function testControllerConstructor() + { + $controller = $this->getController(); + $this->assertInstanceOf(PermissionController::class, $controller); + } + + /** + * @depends testControllerConstructor + * @return PermissionController + */ + public function testControllerConstructorWithUser() + { + // Skip user setup if using in-memory db + if (!$this->usingInMemoryDatabase()) { + $this->setupUser(); + } + + $controller = $this->getController(); + $this->assertInstanceOf(PermissionController::class, $controller); + + return $controller; + } + + /** + * @depends testControllerConstructorWithUser + */ + public function testGetInfo_GuestUser() + { + $controller = $this->getController(); + $this->expectException(ForbiddenException::class); + $controller->getInfo($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param PermissionController $controller + */ + public function testGetInfo_ForbiddenException(PermissionController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->getInfo($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param PermissionController $controller + */ + public function testGetListWithNoPermission(PermissionController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->getList($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param PermissionController $controller + */ + public function testGetUsersWithNoPermission(PermissionController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->getUsers($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param PermissionController $controller + */ + public function testpageInfoWithNoPermission(PermissionController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->pageInfo($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param PermissionController $controller + */ + public function testpageListWithNoPermission(PermissionController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->pageList($this->getRequest(), $this->getResponse(), []); + } + + /** + * @return PermissionController + */ + private function getController() + { + return new PermissionController($this->ci); + } + + /** + */ + private function setupUser() + { + $this->createTestUser(false, true); + } +} diff --git a/app/sprinkles/admin/tests/Integration/Controller/PermissionControllerTest.php b/app/sprinkles/admin/tests/Integration/Controller/PermissionControllerTest.php new file mode 100644 index 000000000..5ad53fc94 --- /dev/null +++ b/app/sprinkles/admin/tests/Integration/Controller/PermissionControllerTest.php @@ -0,0 +1,189 @@ +setupTestDatabase(); + + if ($this->usingInMemoryDatabase()) { + + // Setup database, then setup User & default role + $this->refreshDatabase(); + $this->setupUser(); + + } else if (!static::$initialized) { + + // Only refresh db once + $this->refreshDatabase(); + static::$initialized = true; + } + } + + /** + */ + public function testControllerConstructor() + { + $controller = $this->getController(); + $this->assertInstanceOf(PermissionController::class, $controller); + } + + /** + * @depends testControllerConstructor + * @return PermissionController + */ + public function testControllerConstructorWithUser() + { + // Skip user setup if using in-memory db + if (!$this->usingInMemoryDatabase()) { + $this->setupUser(); + } + + $controller = $this->getController(); + $this->assertInstanceOf(PermissionController::class, $controller); + + return $controller; + } + + /** + * @depends testControllerConstructorWithUser + * @param PermissionController $controller + */ + public function testGetInfoWithNotFoundException(PermissionController $controller) + { + $this->expectException(NotFoundException::class); + $controller->getInfo($this->getRequest(), $this->getResponse(), ['id' => 0]); + } + + /** + * @depends testControllerConstructorWithUser + * @param PermissionController $controller + */ + public function testGetInfo(PermissionController $controller) + { + $result = $controller->getInfo($this->getRequest(), $this->getResponse(), ['id' => self::$permissionID]); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + $this->assertContains('bar', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param PermissionController $controller + */ + public function testGetList(PermissionController $controller) + { + $result = $controller->getList($this->getRequest(), $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param PermissionController $controller + */ + public function testGetUsers(PermissionController $controller) + { + $result = $controller->getUsers($this->getRequest(), $this->getResponse(), ['id' => self::$permissionID]); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param PermissionController $controller + */ + public function testpageInfo(PermissionController $controller) + { + $result = $controller->pageInfo($this->getRequest(), $this->getResponse(), ['id' => self::$permissionID]); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param PermissionController $controller + */ + public function testpageInfoWithNotFoundPermission(PermissionController $controller) + { + $this->expectException(NotFoundException::class); + $controller->pageInfo($this->getRequest(), $this->getResponse(), ['id' => 0]); + } + + /** + * @depends testControllerConstructorWithUser + * @param PermissionController $controller + */ + public function testpageList(PermissionController $controller) + { + $result = $controller->pageList($this->getRequest(), $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @return PermissionController + */ + private function getController() + { + return new PermissionController($this->ci); + } + + /** + */ + private function setupUser() + { + // Admin user, WILL have access + $testUser = $this->createTestUser(true, true); + + // Create test Permission + $fm = $this->ci->factory; + $permission = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Permission', [ + 'slug' => 'foo', + 'name' => 'bar' + ]); + + self::$permissionID = $permission->id; + } +} diff --git a/app/sprinkles/admin/tests/Integration/Controller/RoleControllerGuestTest.php b/app/sprinkles/admin/tests/Integration/Controller/RoleControllerGuestTest.php new file mode 100644 index 000000000..d4e34e914 --- /dev/null +++ b/app/sprinkles/admin/tests/Integration/Controller/RoleControllerGuestTest.php @@ -0,0 +1,303 @@ +setupTestDatabase(); + + if ($this->usingInMemoryDatabase()) { + + // Setup database, then setup User & default role + $this->refreshDatabase(); + $this->setupUser(); + + } else if (!static::$initialized) { + + // Only refresh db once + $this->refreshDatabase(); + static::$initialized = true; + } + } + + /** + */ + public function testControllerConstructor() + { + $controller = $this->getController(); + $this->assertInstanceOf(RoleController::class, $controller); + } + + /** + * @depends testControllerConstructor + * @return RoleController + */ + public function testControllerConstructorWithUser() + { + // Skip user setup if using in-memory db + if (!$this->usingInMemoryDatabase()) { + $this->setupUser(); + } + + $controller = $this->getController(); + $this->assertInstanceOf(RoleController::class, $controller); + + return $controller; + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testCreateWithNoPermission(RoleController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->create($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @todo test individual permissions too + * @param RoleController $controller + */ + public function testDeleteWithNoPermission(RoleController $controller) + { + // Set expectations + $this->expectException(ForbiddenException::class); + + // Execute. Foo has already been set by testCreate + $controller->delete($this->getRequest(), $this->getResponse(), ['slug' => 'foo']); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetInfoWithGuestUser(RoleController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->getInfo($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetListWithNoPermission(RoleController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->getList($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetModalConfirmDeleteWithNoPermission(RoleController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'slug' => 'foo' + ]); + + $this->expectException(ForbiddenException::class); + $controller->getModalConfirmDelete($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetModalCreateWithNoPermission(RoleController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->getModalCreate($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetModalEditWithNoPermission(RoleController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'slug' => 'foo' + ]); + + $this->expectException(ForbiddenException::class); + $controller->getModalEdit($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetModalEditPermissionsWithNoPermission(RoleController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'slug' => 'foo' + ]); + + $this->expectException(ForbiddenException::class); + $controller->getModalEditPermissions($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetPermissionsWithNoPermission(RoleController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->getPermissions($this->getRequest(), $this->getResponse(), ['slug' => 'foo']); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testUpdateFieldWithNoPermission(RoleController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->updateField($this->getRequest(), $this->getResponse(), ['slug' => 'foo', 'field' => 'name']); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetUsersWithNoPermission(RoleController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->getUsers($this->getRequest(), $this->getResponse(), ['slug' => 'foo']); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testpageInfoWithNoPermission(RoleController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->pageInfo($this->getRequest(), $this->getResponse(), ['slug' => 'foo']); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testpageInfoWithPartialPermissions(RoleController $controller) + { + // Give user partial permissions + $testUser = $this->createTestUser(false, true); + $this->giveUserTestPermission($testUser, 'uri_role'); // Can view, but can't edit or delete + + // Get a new controller with this user + $controller = $this->getController(); + + // Get controller stuff + $result = $controller->pageInfo($this->getRequest(), $this->getResponse(), ['slug' => 'foo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + + // Can't test edit / delete button not displayed ? + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testpageListWithNoPermission(RoleController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->pageList($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testUpdateInfoWithNoPermission(RoleController $controller) + { + // Set post data + $data = [ + 'name' => 'foo', + 'slug' => 'foo' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Set expectations + $this->expectException(ForbiddenException::class); + + // Execute + $controller->updateInfo($request, $this->getResponse(), ['slug' => 'foo']); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testUpdateInfoWithNoRole(RoleController $controller) + { + $this->expectException(NotFoundException::class); + $controller->updateInfo($this->getRequest(), $this->getResponse(), ['slug' => 'blah']); + } + + /** + * @return RoleController + */ + private function getController() + { + return new RoleController($this->ci); + } + + /** + */ + private function setupUser() + { + // Guest user, won't have any access + $testUser = $this->createTestUser(false, true); + + // Create test role + $fm = $this->ci->factory; + $role = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Role', [ + 'slug' => 'foo', + 'name' => 'bar' + ]); + } +} diff --git a/app/sprinkles/admin/tests/Integration/Controller/RoleControllerTest.php b/app/sprinkles/admin/tests/Integration/Controller/RoleControllerTest.php new file mode 100644 index 000000000..e8c0bb293 --- /dev/null +++ b/app/sprinkles/admin/tests/Integration/Controller/RoleControllerTest.php @@ -0,0 +1,892 @@ +setupTestDatabase(); + + if ($this->usingInMemoryDatabase()) { + + // Setup database, then setup User & default role + $this->refreshDatabase(); + $this->setupUser(); + + } else if (!static::$initialized) { + + // Only refresh db once + $this->refreshDatabase(); + static::$initialized = true; + } + } + + /** + */ + public function testControllerConstructor() + { + $controller = $this->getController(); + $this->assertInstanceOf(RoleController::class, $controller); + } + + /** + * @depends testControllerConstructor + * @return RoleController + */ + public function testControllerConstructorWithUser() + { + // Skip user setup if using in-memory db + if (!$this->usingInMemoryDatabase()) { + $this->setupUser(); + } + + $controller = $this->getController(); + $this->assertInstanceOf(RoleController::class, $controller); + + return $controller; + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testCreate(RoleController $controller) + { + // Set post data + $data = [ + 'name' => 'foo', + 'slug' => 'bar' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->create($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure role was created + $role = Role::where('slug', 'bar')->first(); + $this->assertSame('foo', $role->name); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testCreateWithMissingName(RoleController $controller) + { + // Set post data + $data = [ + 'name' => '', + 'slug' => 'foo' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->create($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testCreateWithDuplicateSlug(RoleController $controller) + { + // Set post data. Foo has already been set by testCreate + $data = [ + 'name' => 'bar', + 'slug' => 'foo' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->create($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testCreateWithDuplicateName(RoleController $controller) + { + // Set post data. Bar has already been set by testCreate + $data = [ + 'name' => 'bar', + 'slug' => 'foo' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->create($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testDelete(RoleController $controller) + { + // Create test role + $fm = $this->ci->factory; + $role = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Role'); + + // Get controller stuff + $result = $controller->delete($this->getRequest(), $this->getResponse(), ['slug' => $role->slug]); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // role is deleted + $this->assertNull(Role::where('slug', $role->slug)->first()); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testDelete + * @param RoleController $controller + */ + public function testDeleteWithNotExistingRole(RoleController $controller) + { + // Set expectations + $this->expectException(NotFoundException::class); + + // Execute + $controller->delete($this->getRequest(), $this->getResponse(), ['slug' => 'foobar']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testDelete + * @param RoleController $controller + */ + public function testDeleteWithDefaultRole(RoleController $controller) + { + // Change config + $this->ci->config['site.registration.user_defaults.roles'] = ['foo' => true]; + + $this->expectException(BadRequestException::class); + $controller->delete($this->getRequest(), $this->getResponse(), ['slug' => 'foo']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testDelete + * @param RoleController $controller + */ + public function testDeleteWithUserInRole(RoleController $controller) + { + $testUser = User::find(1)->first(); + + // Create a role + $fm = $this->ci->factory; + $role = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Role'); + + // Associate user to role + $testUser->roles()->attach($role); + $testUser->save(); + + $this->expectException(BadRequestException::class); + $controller->delete($this->getRequest(), $this->getResponse(), ['slug' => $role->slug]); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetInfoWithNotFoundException(RoleController $controller) + { + $this->expectException(NotFoundException::class); + $controller->getInfo($this->getRequest(), $this->getResponse(), ['slug' => '']); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetInfo(RoleController $controller) + { + $result = $controller->getInfo($this->getRequest(), $this->getResponse(), ['slug' => 'foo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + $this->assertContains('bar', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetList(RoleController $controller) + { + $result = $controller->getList($this->getRequest(), $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetModalConfirmDelete(RoleController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'slug' => 'foo' + ]); + + // Get controller stuff + $result = $controller->getModalConfirmDelete($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalConfirmDelete + * @param RoleController $controller + */ + public function testGetModalConfirmDeleteWithNoGetData(RoleController $controller) + { + $this->expectException(BadRequestException::class); + $controller->getModalConfirmDelete($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalConfirmDelete + * @param RoleController $controller + */ + public function testGetModalConfirmDeleteWithNonExistingRole(RoleController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'slug' => 'foobar' + ]); + + $this->expectException(NotFoundException::class); + $controller->getModalConfirmDelete($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalConfirmDelete + * @param RoleController $controller + */ + public function testGetModalConfirmDeleteWithUserInRole(RoleController $controller) + { + $testUser = User::find(1)->first(); + + // Create test role + $fm = $this->ci->factory; + $role = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Role'); + + // Associate user to role + $testUser->roles()->attach($role); + $testUser->save(); + + $request = $this->getRequest()->withQueryParams([ + 'slug' => $role->slug + ]); + + $this->expectException(BadRequestException::class); + $controller->getModalConfirmDelete($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalConfirmDelete + * @param RoleController $controller + */ + public function testGetModalConfirmDeleteWithDefaultRole(RoleController $controller) + { + // Change config + $this->ci->config['site.registration.user_defaults.roles'] = ['foo' => true]; + + $request = $this->getRequest()->withQueryParams([ + 'slug' => 'foo' + ]); + + // Set expectations + $this->expectException(BadRequestException::class); + + // Execute + $controller->getModalConfirmDelete($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetModalCreate(RoleController $controller) + { + $result = $controller->getModalCreate($this->getRequest(), $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetModalEdit(RoleController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'slug' => 'foo' + ]); + + // Get controller stuff + $result = $controller->getModalEdit($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalEdit + * @param RoleController $controller + */ + public function testGetModalEditWithNoGetData(RoleController $controller) + { + $this->expectException(BadRequestException::class); + $controller->getModalEdit($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalEdit + * @param RoleController $controller + */ + public function testGetModalEditWithNonExistingRole(RoleController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'slug' => 'foobar' + ]); + + $this->expectException(NotFoundException::class); + $controller->getModalEdit($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetUsersWithBadSlug(RoleController $controller) + { + $this->expectException(NotFoundException::class); + $controller->getUsers($this->getRequest(), $this->getResponse(), ['slug' => 'foobar']); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetUsersWithNoSlug(RoleController $controller) + { + $this->expectException(BadRequestException::class); + $controller->getUsers($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetUsers(RoleController $controller) + { + $result = $controller->getUsers($this->getRequest(), $this->getResponse(), ['slug' => 'foo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testpageInfo(RoleController $controller) + { + $result = $controller->pageInfo($this->getRequest(), $this->getResponse(), ['slug' => 'foo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testpageInfoWithBadSlug(RoleController $controller) + { + $this->expectException(NotFoundException::class); + $controller->pageInfo($this->getRequest(), $this->getResponse(), ['slug' => 'foobar']); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testpageList(RoleController $controller) + { + $result = $controller->pageList($this->getRequest(), $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testUpdateInfo(RoleController $controller) + { + // Create a role + $fm = $this->ci->factory; + $role = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Role', [ + 'name' => 'barbar', + 'slug' => 'foofoo', + ]); + + // Set post data + $data = [ + 'name' => 'foofoo', + 'slug' => 'foofoo' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateInfo($request, $this->getResponse(), ['slug' => $role->slug]); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure role was update + $editedRole = Role::where('slug', 'foofoo')->first(); + $this->assertSame('foofoo', $editedRole->name); + $this->assertNotSame('barbar', $editedRole->name); + $this->assertSame($role->description, $editedRole->description); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateInfo + * @param RoleController $controller + */ + public function testUpdateInfoWithMissingName(RoleController $controller) + { + // Set post data + $data = [ + 'name' => '', + 'slug' => 'foo' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateInfo($request, $this->getResponse(), ['slug' => 'foo']); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure role was NOT update + $editedRole = Role::where('slug', 'foo')->first(); + $this->assertSame('bar', $editedRole->name); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateInfo + * @param RoleController $controller + */ + public function testUpdateInfoWithMissingSlug(RoleController $controller) + { + // Set post data + $data = [ + 'name' => 'bar', + 'slug' => '' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateInfo($request, $this->getResponse(), ['slug' => 'foo']); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure role was NOT update + $editedRole = Role::where('slug', 'foo')->first(); + $this->assertNotNull($editedRole); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateInfo + * @param RoleController $controller + */ + public function testUpdateInfoWithDuplicateSlug(RoleController $controller) + { + // Create a role + $fm = $this->ci->factory; + $role2 = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Role'); + + // Set post data + $data = [ + 'slug' => $role2->slug + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateInfo($request, $this->getResponse(), ['slug' => 'foo']); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateInfo + * @param RoleController $controller + */ + public function testUpdateInfoWithDuplicateName(RoleController $controller) + { + // Create a role + $fm = $this->ci->factory; + $role2 = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Role'); + + // Set post data + $data = [ + 'name' => $role2->name, + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateInfo($request, $this->getResponse(), ['slug' => 'foo']); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetModalEditPermissions(RoleController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'slug' => 'foo' + ]); + + // Get controller stuff + $result = $controller->getModalEditPermissions($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalEditPermissions + * @param RoleController $controller + */ + public function testGetModalEditPermissionsWithNoGetData(RoleController $controller) + { + $this->expectException(BadRequestException::class); + $controller->getModalEditPermissions($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalEditPermissions + * @param RoleController $controller + */ + public function testGetModalEditPermissionsWithNonExistingRole(RoleController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'slug' => 'foobar' + ]); + + $this->expectException(NotFoundException::class); + $controller->getModalEditPermissions($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testGetPermissions(RoleController $controller) + { + $result = $controller->getPermissions($this->getRequest(), $this->getResponse(), ['slug' => 'foo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetPermissions + * @param RoleController $controller + */ + public function testGetPermissionsWithNoArgs(RoleController $controller) + { + $this->expectException(BadRequestException::class); + $controller->getPermissions($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetPermissions + * @param RoleController $controller + */ + public function testGetPermissionsWithNonExistingRole(RoleController $controller) + { + $this->expectException(NotFoundException::class); + $controller->getPermissions($this->getRequest(), $this->getResponse(), ['slug' => 'foobar']); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testupdateField(RoleController $controller) + { + // Create a role + $fm = $this->ci->factory; + $role = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Role', [ + 'name' => 'bar123', + 'slug' => 'foo123', + ]); + + // Set post data + $data = [ + 'value' => 'foo123' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateField($request, $this->getResponse(), ['slug' => $role->slug, 'field' => 'name']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure role was update + $editedRole = Role::where('slug', 'foo123')->first(); + $this->assertSame('foo123', $editedRole->name); + $this->assertNotSame('bar123', $editedRole->name); + $this->assertSame($role->description, $editedRole->description); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testupdateFieldWithNonExistingRole(RoleController $controller) + { + $this->expectException(NotFoundException::class); + $controller->updateField($this->getRequest(), $this->getResponse(), ['slug' => 'foobar']); + } + + /** + * @depends testControllerConstructorWithUser + * @param RoleController $controller + */ + public function testupdateFieldNoValue(RoleController $controller) + { + $this->expectException(BadRequestException::class); + $controller->updateField($this->getRequest(), $this->getResponse(), ['slug' => 'foo', 'field' => 'name']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testupdateField + * @param RoleController $controller + */ + public function testupdateFieldWithFailedValidation(RoleController $controller) + { + // Create a string wich will be too long for validation + $faker = Faker::getGenerator(); + $value = $faker->text(500); + + // Set post data + $data = [ + 'value' => $value + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $this->expectException(BadRequestException::class); + $controller->updateField($request, $this->getResponse(), ['slug' => 'foo', 'field' => 'name']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testupdateField + * @param RoleController $controller + */ + public function testupdateFieldWithPermissionField(RoleController $controller) + { + // Create a role + $fm = $this->ci->factory; + $permission = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Permission'); + + // Expected input : + // value[0][permission_id]: 2 + // value[1][permission_id]: 9 + + // Set post data + $data = [ + 'value' => [['permission_id' => $permission->id]] + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Check the default role has how many permisions + $role = Role::where('slug', 'foo')->first(); + $this->assertEmpty($role->permissions); + + // Get controller stuff + $result = $controller->updateField($request, $this->getResponse(), ['slug' => 'foo', 'field' => 'permissions']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure role permisions was updated + $role = Role::where('slug', 'foo')->first(); + $this->assertCount(1, $role->permissions); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + + /** + * @return RoleController + */ + private function getController() + { + return new RoleController($this->ci); + } + + /** + */ + private function setupUser() + { + // Admin user, WILL have access + $testUser = $this->createTestUser(true, true); + + // Create test role + $fm = $this->ci->factory; + $role = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Role', [ + 'slug' => 'foo', + 'name' => 'bar' + ]); + } +} diff --git a/app/sprinkles/admin/tests/Integration/Controller/UserControllerCreateTest.php b/app/sprinkles/admin/tests/Integration/Controller/UserControllerCreateTest.php new file mode 100644 index 000000000..def451864 --- /dev/null +++ b/app/sprinkles/admin/tests/Integration/Controller/UserControllerCreateTest.php @@ -0,0 +1,176 @@ +setupTestDatabase(); + $this->refreshDatabase(); + } + + public function tearDown() + { + parent::tearDown(); + m::close(); + } + + /** + */ + public function testCreate() + { + $fm = $this->ci->factory; + + // Create fake mailer + $mailer = m::mock(Mailer::class); + $mailer->shouldReceive('send')->once()->with(\Mockery::type(TwigMailMessage::class)); + $this->ci->mailer = $mailer; + + // Create will fail on PGSQL if a user is created with forced id + // because it mess the auto_increment + // @see https://stackoverflow.com/questions/36157029/laravel-5-2-eloquent-save-auto-increment-pgsql-exception-on-same-id + $user = $fm->create(User::class); + $this->giveUserTestPermission($user, 'create_user'); + $this->giveUserTestPermission($user, 'create_user_field'); + $this->loginUser($user); + + // Recreate controller to use the fake mailer + $controller = $this->getController(); + + // Create a fake group + $group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group'); + + // Set post data + $data = [ + 'user_name' => 'foo', + 'first_name' => 'foo name', + 'last_name' => 'foo last', + 'email' => 'foo@bar.com', + 'group_id' => $group->id + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->create($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure role was created + $user = User::where('user_name', 'foo')->first(); + $this->assertSame('foo name', $user->first_name); + $this->assertSame($group->id, $user->group->id); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testCreate + */ + public function testCreateWithNoLocale() + { + $this->ci->config['site.locales.available'] = []; + $this->testCreate(); + } + + /** + * @depends testCreate + */ + public function testCreateWithNoGroupId() + { + $fm = $this->ci->factory; + + // Create fake mailer + $mailer = m::mock(Mailer::class); + $mailer->shouldReceive('send')->once()->with(\Mockery::type(TwigMailMessage::class)); + $this->ci->mailer = $mailer; + + // Also create a group + $group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group'); + + // Create will fail on PGSQL if a user is created with forced id + // because it mess the auto_increment + // @see https://stackoverflow.com/questions/36157029/laravel-5-2-eloquent-save-auto-increment-pgsql-exception-on-same-id + $user = $fm->create(User::class, [ + 'group_id' => $group->id, + ]); + $this->giveUserTestPermission($user, 'create_user'); + $this->loginUser($user); + + // Recreate controller to use the fake mailer + $controller = $this->getController(); + + // Set post data + $data = [ + 'user_name' => 'foo', + 'first_name' => 'foo name', + 'last_name' => 'foo last', + 'email' => 'foo@bar.com', + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->create($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure role was created + $user = User::where('user_name', 'foo')->first(); + $this->assertSame('foo name', $user->first_name); + $this->assertSame($group->id, $user->group->id); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @return UserController + */ + private function getController() + { + return new UserController($this->ci); + } +} diff --git a/app/sprinkles/admin/tests/Integration/Controller/UserControllerGuestTest.php b/app/sprinkles/admin/tests/Integration/Controller/UserControllerGuestTest.php new file mode 100644 index 000000000..8d6318816 --- /dev/null +++ b/app/sprinkles/admin/tests/Integration/Controller/UserControllerGuestTest.php @@ -0,0 +1,774 @@ +setupTestDatabase(); + + if ($this->usingInMemoryDatabase()) { + + // Setup database, then setup User & default role + $this->refreshDatabase(); + $this->setupUser(); + + } else if (!static::$initialized) { + + // Only refresh db once + $this->refreshDatabase(); + static::$initialized = true; + } + } + + public function tearDown() + { + parent::tearDown(); + m::close(); + } + + /** + */ + public function testControllerConstructor() + { + $controller = $this->getController(); + $this->assertInstanceOf(UserController::class, $controller); + } + + /** + * @depends testControllerConstructor + * @return UserController + */ + public function testControllerConstructorWithUser() + { + // Skip user setup if using in-memory db + if (!$this->usingInMemoryDatabase()) { + $this->setupUser(); + } + + $controller = $this->getController(); + $this->assertInstanceOf(UserController::class, $controller); + + return $controller; + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testCreateWithNoPermissions(UserController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->create($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + */ + public function testCreateWithNoGroupPermissions() + { + $user = $this->createTestUser(false, true); + $this->giveUserTestPermission($user, 'create_user'); + + // Recreate controller to use new user + $controller = $this->getController(); + + // Create a fake group + $fm = $this->ci->factory; + $group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group'); + + // Set post data + $data = [ + 'user_name' => 'foo', + 'first_name' => 'foo name', + 'last_name' => 'foo last', + 'email' => 'foo@bar.com', + 'group_id' => $group->id + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $this->expectException(ForbiddenException::class); + $result = $controller->create($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testCreatePasswordResetWithNoPermissions(UserController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->createPasswordReset($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testCreatePasswordResetWithNoPermissions + * @param UserController $controller + */ + public function testCreatePasswordResetWithPartialPermissions(UserController $controller) + { + // Create fake mailer + $mailer = m::mock(Mailer::class); + $mailer->shouldReceive('send')->once()->with(\Mockery::type(TwigMailMessage::class)); + $this->ci->mailer = $mailer; + + // Recreate controller to use the fake mailer + $user = $this->createTestUser(false, true); + $this->giveUserTestPermission($user, 'update_user_field'); + $controller = $this->getController(); + + // Get controller stuff + $result = $controller->createPasswordReset($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testDeleteWithNoPermission(UserController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->delete($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetActivitiesWithNoPermission(UserController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->getActivities($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetActivitiesWithPartialPermission(UserController $controller) + { + // Guest user + $testUser = $this->createTestUser(false, true); + + // Give user partial permissions + $this->giveUserTestPermission($testUser, 'view_user_field'); + + // Get new controller to propagate new user + $controller = $this->getController(); + + $result = $controller->getActivities($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetInfoWithNoPermission(UserController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->getInfo($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetInfoWithPartialPermission(UserController $controller) + { + // Guest user + $testUser = $this->createTestUser(false, true); + + // Give user partial permissions + $this->giveUserTestPermission($testUser, 'uri_user'); + + // Get new controller to propagate new user + $controller = $this->getController(); + + $result = $controller->getInfo($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetListWithNoPermission(UserController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->getList($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetModalConfirmDeleteWithNoPermission(UserController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'userfoo' + ]); + + $this->expectException(ForbiddenException::class); + $controller->getModalConfirmDelete($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetModalCreateWithNoPermission(UserController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'userfoo' + ]); + + $this->expectException(ForbiddenException::class); + $controller->getModalCreate($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetModalCreateWithNoUserGroup(UserController $controller) + { + // Guest user + $testUser = $this->createTestUser(false, true); + + // Give user partial permissions + $this->giveUserTestPermission($testUser, 'create_user'); + + // Get new controller to propagate new user + $controller = $this->getController(); + + $result = $controller->getModalCreate($this->getRequest(), $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetModalEditWithNoPermissions(UserController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'userfoo' + ]); + + $this->expectException(ForbiddenException::class); + $controller->getModalEdit($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetModalEditWithPartialPermissions(UserController $controller) + { + // Guest user + $testUser = $this->createTestUser(false, true); + + // Give user partial permissions + $this->giveUserTestPermission($testUser, 'update_user_field'); + + // Get new controller to propagate new user + $controller = $this->getController(); + + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'userfoo' + ]); + + $result = $controller->getModalEdit($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetModalEditWithNoGroupPermissions(UserController $controller) + { + // Guest user + $testUser = $this->createTestUser(false, true); + + // Give user partial permissions + $this->giveUserTestPermission($testUser, 'update_user_field', "subset(fields,['name','email','locale','flag_enabled','flag_verified','password'])"); + + // Get new controller to propagate new user + $controller = $this->getController(); + + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'userfoo' + ]); + + $result = $controller->getModalEdit($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetModalEditPasswordWithNoPermissions(UserController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'userfoo' + ]); + + $this->expectException(ForbiddenException::class); + $controller->getModalEditPassword($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetModalEditPasswordWithPartialPermissions(UserController $controller) + { + // Guest user + $testUser = $this->createTestUser(false, true); + + // Give user partial permissions + $this->giveUserTestPermission($testUser, 'update_user_field'); + + // Get new controller to propagate new user + $controller = $this->getController(); + + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'userfoo' + ]); + + $result = $controller->getModalEditPassword($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetModalEditRolesWithNoPermission(UserController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'userfoo' + ]); + + $this->expectException(ForbiddenException::class); + $controller->getModalEditRoles($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetPermissionsWithNoPermissions(UserController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->getPermissions($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetPermissionsWithPartialPermissions(UserController $controller) + { + // Guest user + $testUser = $this->createTestUser(false, true); + + // Give user partial permissions + $this->giveUserTestPermission($testUser, 'view_user_field'); + + // Get new controller to propagate new user + $controller = $this->getController(); + + $result = $controller->getPermissions($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetRolesWithNoPermissions(UserController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->getRoles($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetRolesWithPartialPermissions(UserController $controller) + { + // Guest user + $testUser = $this->createTestUser(false, true); + + // Give user partial permissions + $this->giveUserTestPermission($testUser, 'view_user_field'); + + // Get new controller to propagate new user + $controller = $this->getController(); + + $result = $controller->getRoles($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testPageInfoWithNoPermissions(UserController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->pageInfo($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testPageInfoWithPartialPermissions(UserController $controller) + { + // Guest user + $testUser = $this->createTestUser(false, true); + + // Give user partial permissions + $this->giveUserTestPermission($testUser, 'uri_user'); + + // Get new controller to propagate new user + $controller = $this->getController(); + + $result = $controller->pageInfo($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testPageListWithNoPermission(UserController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->pageList($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testUpdateInfoWithNoPermissions(UserController $controller) + { + // Create a user + $fm = $this->ci->factory; + $user = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\User', [ + 'user_name' => 'testUpdateInfoWithNoPermissions', + 'first_name' => 'foo', + ]); + + // Set post data + $data = [ + 'first_name' => 'bar', + ]; + $request = $this->getRequest()->withParsedBody($data); + + $this->expectException(ForbiddenException::class); + $controller->updateInfo($request, $this->getResponse(), ['user_name' => $user->user_name]); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testUpdateInfoWithPartialPermissions(UserController $controller) + { + // Guest user + $testUser = $this->createTestUser(false, true); + + // Give user partial permissions + $this->giveUserTestPermission($testUser, 'update_user_field'); + + // Get new controller to propagate new user + $controller = $this->getController(); + + // Create a user + $fm = $this->ci->factory; + $user = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\User', [ + 'user_name' => 'testUpdateInfoWithPartialPermissions', + 'first_name' => 'foo', + ]); + + // Also create a group + $group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group'); + + // Set post data + $data = [ + 'first_name' => 'bar', + 'group_id' => $group->id, + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateInfo($request, $this->getResponse(), ['user_name' => $user->user_name]); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure user was update + $editedUser = User::where('user_name', $user->user_name)->first(); + $this->assertSame('bar', $editedUser->first_name); + $this->assertNotSame($user->first_name, $editedUser->first_name); + $this->assertSame($user->last_name, $editedUser->last_name); + $this->assertSame($group->id, $editedUser->group->id); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testUpdateInfoForMasterUserWithNoPermissions(UserController $controller) + { + // Guest user + $testUser = $this->createTestUser(false, true); + + // Give user partial permissions + $this->giveUserTestPermission($testUser, 'update_user_field'); + + // Get new controller to propagate new user + $controller = $this->getController(); + + // Default should be the existing admin user. + $user = User::find($this->ci->config['reserved_user_ids.master']); + + // In case the user don't exist + if (!$user) { + $fm = $this->ci->factory; + $user = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\User', [ + 'id' => $this->ci->config['reserved_user_ids.master'] + ]); + } + + // Set post data + $data = [ + 'first_name' => 'bar', + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $this->expectException(ForbiddenException::class); + $controller->updateInfo($request, $this->getResponse(), ['user_name' => $user->user_name]); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testUpdateFieldWithNoPermissions(UserController $controller) + { + $this->expectException(ForbiddenException::class); + $controller->updateField($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo', 'field' => 'first_name']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testUpdateFieldWithPartialPermissions(UserController $controller) + { + // Guest user + $testUser = $this->createTestUser(false, true); + + // Give user partial permissions + $this->giveUserTestPermission($testUser, 'update_user_field'); + + // Get new controller to propagate new user + $controller = $this->getController(); + + // Create a user + $fm = $this->ci->factory; + $user = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\User', [ + 'user_name' => 'testUpdateFieldWithPartialPermissions', + 'first_name' => 'foo', + ]); + + // Set post data + $data = [ + 'value' => 'bar', + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateField($request, $this->getResponse(), ['user_name' => $user->user_name, 'field' => 'first_name']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure user was update + $editedUser = User::where('user_name', $user->user_name)->first(); + $this->assertSame('bar', $editedUser->first_name); + $this->assertNotSame($user->first_name, $editedUser->first_name); + $this->assertSame($user->last_name, $editedUser->last_name); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testUpdateFieldWithMasterUserWithNoPermissions(UserController $controller) + { + // Guest user + $testUser = $this->createTestUser(false, true); + + // Give user partial permissions + $this->giveUserTestPermission($testUser, 'update_user_field'); + + // Get new controller to propagate new user + $controller = $this->getController(); + + // Default should be the existing admin user. + $user = User::find($this->ci->config['reserved_user_ids.master']); + + // In case the user don't exist + if (!$user) { + $fm = $this->ci->factory; + $user = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\User', [ + 'id' => $this->ci->config['reserved_user_ids.master'] + ]); + } + + // Set post data + $data = [ + 'value' => 'bar', + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $this->expectException(ForbiddenException::class); + $controller->updateField($request, $this->getResponse(), ['user_name' => $user->user_name, 'field' => 'first_name']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testUpdateFieldForFlagEnabledWithCurrentUser(UserController $controller) + { + // Guest user + $user = $this->createTestUser(false, true); + + // Give user partial permissions + $this->giveUserTestPermission($user, 'update_user_field'); + + // Get new controller to propagate new user + $controller = $this->getController(); + + // Set post data + $data = [ + 'value' => '0', + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $this->expectException(BadRequestException::class); + $controller->updateField($request, $this->getResponse(), ['user_name' => $user->user_name, 'field' => 'flag_enabled']); + } + + /** + * @return UserController + */ + private function getController() + { + return new UserController($this->ci); + } + + /** + */ + private function setupUser() + { + // Admin user, WILL have access + $testUser = $this->createTestUser(false, true); + + // Create test user + $fm = $this->ci->factory; + $user = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\User', [ + 'id' => '9999', + 'user_name' => 'userfoo', + 'email' => 'bar@foo.com' + ]); + } +} diff --git a/app/sprinkles/admin/tests/Integration/Controller/UserControllerTest.php b/app/sprinkles/admin/tests/Integration/Controller/UserControllerTest.php new file mode 100644 index 000000000..cc59cb9b7 --- /dev/null +++ b/app/sprinkles/admin/tests/Integration/Controller/UserControllerTest.php @@ -0,0 +1,1105 @@ +setupTestDatabase(); + + if ($this->usingInMemoryDatabase()) { + + // Setup database, then setup User & default role + $this->refreshDatabase(); + $this->setupUser(); + + } else if (!static::$initialized) { + + // Only refresh db once + $this->refreshDatabase(); + static::$initialized = true; + } + } + + public function tearDown() + { + parent::tearDown(); + m::close(); + } + + /** + */ + public function testControllerConstructor() + { + $controller = $this->getController(); + $this->assertInstanceOf(UserController::class, $controller); + } + + /** + * @depends testControllerConstructor + * @return UserController + */ + public function testControllerConstructorWithUser() + { + // Skip user setup if using in-memory db + if (!$this->usingInMemoryDatabase()) { + $this->setupUser(); + } + + $controller = $this->getController(); + $this->assertInstanceOf(UserController::class, $controller); + + return $controller; + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testCreateWithNoUsername(UserController $controller) + { + // Set post data + $data = [ + //'user_name' => 'foo', + 'first_name' => 'foo name', + 'last_name' => 'foo last', + 'email' => 'foo@bar.com' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->create($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testCreateWithNoEmail(UserController $controller) + { + // Set post data + $data = [ + 'user_name' => 'foo', + 'first_name' => 'foo name', + 'last_name' => 'foo last', + //'email' => 'foo@bar.com' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->create($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testCreateWithDuplicateUsername(UserController $controller) + { + // Set post data. Foo has already been set by testCreate + $data = [ + 'user_name' => 'userfoo', + 'first_name' => 'foo name', + 'last_name' => 'foo last', + 'email' => 'foo@bar.com' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->create($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testCreateWithDuplicateEmail(UserController $controller) + { + // Set post data. Foo has already been set by testCreate + $data = [ + 'user_name' => 'barbarbar', + 'first_name' => 'foo name', + 'last_name' => 'foo last', + 'email' => 'bar@foo.com' + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->create($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + */ + public function testCreatePasswordReset() + { + // Create fake mailer + $mailer = m::mock(Mailer::class); + $mailer->shouldReceive('send')->once()->with(\Mockery::type(TwigMailMessage::class)); + $this->ci->mailer = $mailer; + + // Recreate controller to use the fake mailer + $this->createTestUser(true, true); + $controller = $this->getController(); + + // Get controller stuff + $result = $controller->createPasswordReset($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testCreatePasswordResetWithNotExistingUser(UserController $controller) + { + $this->expectException(NotFoundException::class); + $result = $controller->createPasswordReset($this->getRequest(), $this->getResponse(), ['user_name' => 'potato']); + + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testDelete(UserController $controller) + { + // Create test user + $user = $this->createTestUser(); + + // Get controller stuff + $result = $controller->delete($this->getRequest(), $this->getResponse(), ['user_name' => $user->user_name]); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // role is deleted + $this->assertNull(User::where('id', $user->id)->first()); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testDelete + * @param UserController $controller + */ + public function testDeleteWithNotExistingUser(UserController $controller) + { + $this->expectException(NotFoundException::class); + $controller->delete($this->getRequest(), $this->getResponse(), ['user_name' => 'potato']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testDelete + * @param UserController $controller + */ + public function testDeleteWithReservedIds(UserController $controller) + { + $user = User::find($this->ci->config['reserved_user_ids.master']); + $this->expectException(BadRequestException::class); + $controller->delete($this->getRequest(), $this->getResponse(), ['user_name' => $user->user_name]); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetActivities(UserController $controller) + { + $result = $controller->getActivities($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetActivities + * @param UserController $controller + */ + public function testGetActivitiesWithBadUser(UserController $controller) + { + $this->expectException(NotFoundException::class); + $controller->getActivities($this->getRequest(), $this->getResponse(), ['user_name' => 'potato']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetInfo(UserController $controller) + { + $result = $controller->getInfo($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetInfo + * @param UserController $controller + */ + public function testGetInfoWithBadUser(UserController $controller) + { + $this->expectException(NotFoundException::class); + $controller->getInfo($this->getRequest(), $this->getResponse(), ['user_name' => 'potato']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetList(UserController $controller) + { + $result = $controller->getList($this->getRequest(), $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetModalConfirmDelete(UserController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'userfoo' + ]); + + // Get controller stuff + $result = $controller->getModalConfirmDelete($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalConfirmDelete + * @param UserController $controller + */ + public function testGetModalConfirmDeleteWithNoUser(UserController $controller) + { + $this->expectException(BadRequestException::class); + $controller->getModalConfirmDelete($this->getRequest(), $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalConfirmDelete + * @param UserController $controller + */ + public function testGetModalConfirmDeleteWithNonExistingUser(UserController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'foobar' + ]); + + $this->expectException(NotFoundException::class); + $controller->getModalConfirmDelete($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalConfirmDelete + * @param UserController $controller + */ + public function testGetModalConfirmDeleteWithReservedId(UserController $controller) + { + $user = User::find($this->ci->config['reserved_user_ids.master']); + + $request = $this->getRequest()->withQueryParams([ + 'user_name' => $user->user_name + ]); + + $this->expectException(BadRequestException::class); + $controller->getModalConfirmDelete($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetModalCreate(UserController $controller) + { + $result = $controller->getModalCreate($this->getRequest(), $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalCreate + * @param UserController $controller + */ + public function testGetModalCreateWithNoLocale(UserController $controller) + { + // Change config + $this->ci->config['site.locales.available'] = []; + + // Get new controller to propagate new config + $user = $this->createTestUser(true, true); + $controller = $this->getController(); + + $result = $controller->getModalCreate($this->getRequest(), $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetModalEdit(UserController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'userfoo' + ]); + + $result = $controller->getModalEdit($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testGetModalEdit + * @param UserController $controller + */ + public function testGetModalEditWithNoLocale(UserController $controller) + { + // Change config + $this->ci->config['site.locales.available'] = []; + + // Get new controller to propagate new config + $user = $this->createTestUser(true, true); + $controller = $this->getController(); + + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'userfoo' + ]); + + $result = $controller->getModalEdit($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetModalEditWithNoUser(UserController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'foobar' + ]); + + $this->expectException(NotFoundException::class); + $controller->getModalEdit($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetModalEditPassword(UserController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'userfoo' + ]); + + $result = $controller->getModalEditPassword($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetModalEditPasswordWithNoUser(UserController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'foobar' + ]); + + $this->expectException(NotFoundException::class); + $controller->getModalEditPassword($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetModalEditRoles(UserController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'userfoo' + ]); + + $result = $controller->getModalEditRoles($request, $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetModalEditRolesWithNoUser(UserController $controller) + { + $request = $this->getRequest()->withQueryParams([ + 'user_name' => 'foobar' + ]); + + $this->expectException(NotFoundException::class); + $controller->getModalEditRoles($request, $this->getResponse(), []); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetPermissions(UserController $controller) + { + $result = $controller->getPermissions($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetPermissionsWithNoUser(UserController $controller) + { + $this->expectException(NotFoundException::class); + $controller->getPermissions($this->getRequest(), $this->getResponse(), ['user_name' => 'foobar']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetRoles(UserController $controller) + { + $result = $controller->getRoles($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertNotEmpty((string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testGetRolesWithNoUser(UserController $controller) + { + $this->expectException(NotFoundException::class); + $controller->getRoles($this->getRequest(), $this->getResponse(), ['user_name' => 'foobar']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testPageInfo(UserController $controller) + { + $result = $controller->pageInfo($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testPageInfoWithNoLocale(UserController $controller) + { + // Change config + $this->ci->config['site.locales.available'] = []; + + // Get new controller to propagate new config + $user = $this->createTestUser(true, true); + $controller = $this->getController(); + + $result = $controller->pageInfo($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testPageInfoWithNoUser(UserController $controller) + { + $this->expectException(NotFoundException::class); + $controller->pageInfo($this->getRequest(), $this->getResponse(), ['user_name' => 'foobar']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testPageList(UserController $controller) + { + $result = $controller->pageList($this->getRequest(), $this->getResponse(), []); + $this->assertSame($result->getStatusCode(), 200); + $this->assertNotSame('', (string) $result->getBody()); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testUpdateInfo(UserController $controller) + { + // Create a user + $user = $this->createTestUser(); + + // Also create a group + $fm = $this->ci->factory; + $group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group'); + + // Set post data + $data = [ + 'first_name' => 'bar', + 'group_id' => $group->id, + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateInfo($request, $this->getResponse(), ['user_name' => $user->user_name]); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure user was update + $editedUser = User::where('user_name', $user->user_name)->first(); + $this->assertSame('bar', $editedUser->first_name); + $this->assertNotSame($user->first_name, $editedUser->first_name); + $this->assertSame($user->last_name, $editedUser->last_name); + $this->assertSame($group->id, $editedUser->group->id); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateInfo + * @param UserController $controller + */ + public function testUpdateInfoWithNoUser(UserController $controller) + { + $this->expectException(NotFoundException::class); + $controller->updateInfo($this->getRequest(), $this->getResponse(), ['user_name' => 'foobar']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateInfo + * @param UserController $controller + */ + public function testUpdateInfoWithValidationError(UserController $controller) + { + // Create a string wich will be too long for validation + $faker = Faker::getGenerator(); + $value = $faker->text(100); + + // Set post data + $data = [ + 'first_name' => $value + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateInfo($request, $this->getResponse(), ['user_name' => 'userfoo']); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure user was NOT update + $editedUser = User::where('user_name', 'userfoo')->first(); + $this->assertNotSame($value, $editedUser->first_name); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateInfo + * @param UserController $controller + */ + public function testUpdateInfoWithDuplicateEmail(UserController $controller) + { + // Create a user + $user = $this->createTestUser(); + + // Set post data + $data = [ + 'email' => 'bar@foo.com', + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateInfo($request, $this->getResponse(), ['user_name' => $user->user_name]); + $this->assertSame($result->getStatusCode(), 400); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure user was NOT update + $editedUser = User::where('user_name', $user->user_name)->first(); + $this->assertNotSame('bar@foo.com', $editedUser->email); + $this->assertSame($user->email, $editedUser->email); + + // Test message + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('danger', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateInfo + * @param UserController $controller + */ + public function testUpdateInfoForMasterUser(UserController $controller) + { + // Default should be the existing admin user. + $user = User::find($this->ci->config['reserved_user_ids.master']); + + // Set post data + $data = [ + 'first_name' => 'bar', + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateInfo($request, $this->getResponse(), ['user_name' => $user->user_name]); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure user was update + $editedUser = User::where('user_name', $user->user_name)->first(); + $this->assertSame('bar', $editedUser->first_name); + $this->assertNotSame($user->first_name, $editedUser->first_name); + $this->assertSame($user->last_name, $editedUser->last_name); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @param UserController $controller + */ + public function testUpdateField(UserController $controller) + { + // Create a user + $user = $this->createTestUser(); + + // Set post data + $data = [ + 'value' => 'bar', + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateField($request, $this->getResponse(), ['user_name' => $user->user_name, 'field' => 'first_name']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure user was update + $editedUser = User::where('user_name', $user->user_name)->first(); + $this->assertSame('bar', $editedUser->first_name); + $this->assertNotSame($user->first_name, $editedUser->first_name); + $this->assertSame($user->last_name, $editedUser->last_name); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateField + * @param UserController $controller + */ + public function testUpdateFieldWithNoUser(UserController $controller) + { + $this->expectException(NotFoundException::class); + $controller->updateField($this->getRequest(), $this->getResponse(), ['user_name' => 'foobar']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateField + * @param UserController $controller + */ + public function testUpdateFieldWithNoUserWithNoValue(UserController $controller) + { + $this->expectException(BadRequestException::class); + $controller->updateField($this->getRequest(), $this->getResponse(), ['user_name' => 'userfoo', 'field' => 'first_name']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateField + * @param UserController $controller + */ + public function testUpdateFieldWithMasterUser(UserController $controller) + { + // Default should be the existing admin user. + $user = User::find($this->ci->config['reserved_user_ids.master']); + + // Set post data + $data = [ + 'value' => 'barbar', + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateField($request, $this->getResponse(), ['user_name' => $user->user_name, 'field' => 'first_name']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure user was update + $editedUser = User::where('user_name', $user->user_name)->first(); + $this->assertSame('barbar', $editedUser->first_name); + $this->assertNotSame($user->first_name, $editedUser->first_name); + $this->assertSame($user->last_name, $editedUser->last_name); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateField + * @param UserController $controller + */ + public function testUpdateFieldWithValidationError(UserController $controller) + { + // Create a string wich will be too long for validation + $faker = Faker::getGenerator(); + $value = $faker->text(100); + + // Set post data + $data = [ + 'value' => $value, + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $this->expectException(BadRequestException::class); + $controller->updateField($request, $this->getResponse(), ['user_name' => 'userfoo', 'field' => 'first_name']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateField + * @param UserController $controller + */ + public function testUpdateFieldForFlagEnabled(UserController $controller) + { + // Set post data + $data = [ + 'value' => '1', + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateField($request, $this->getResponse(), ['user_name' => 'userfoo', 'field' => 'flag_enabled']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure user was update + $editedUser = User::where('user_name', 'userfoo')->first(); + $this->assertSame('1', (string) $editedUser->flag_enabled); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateFieldForFlagEnabled + * @param UserController $controller + */ + public function testUpdateFieldForFlagEnabledDisabled(UserController $controller) + { + // Set post data + $data = [ + 'value' => '0', + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateField($request, $this->getResponse(), ['user_name' => 'userfoo', 'field' => 'flag_enabled']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure user was update + $editedUser = User::where('user_name', 'userfoo')->first(); + $this->assertEquals(0, $editedUser->flag_enabled); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateField + * @param UserController $controller + */ + public function testUpdateFieldForFlagVerified(UserController $controller) + { + // Set post data + $data = [ + 'value' => '1', + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateField($request, $this->getResponse(), ['user_name' => 'userfoo', 'field' => 'flag_verified']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure user was update + $editedUser = User::where('user_name', 'userfoo')->first(); + $this->assertSame('1', (string) $editedUser->flag_verified); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateField + * @param UserController $controller + */ + public function testUpdateFieldForFlagEnabledWithMasterUser(UserController $controller) + { + // Default should be the existing admin user. + $user = User::find($this->ci->config['reserved_user_ids.master']); + + // Set post data + $data = [ + 'value' => '0', + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $this->expectException(BadRequestException::class); + $controller->updateField($request, $this->getResponse(), ['user_name' => $user->user_name, 'field' => 'flag_enabled']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateField + * @param UserController $controller + */ + public function testUpdateFieldForPassword(UserController $controller) + { + // Set post data + $data = [ + 'value' => '1234567890abc', + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateField($request, $this->getResponse(), ['user_name' => 'userfoo', 'field' => 'password']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure user was update + $editedUser = User::where('user_name', 'userfoo')->first(); + $this->assertNotSame('blablabla', $editedUser->password); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @depends testControllerConstructorWithUser + * @depends testUpdateField + * @param UserController $controller + */ + public function testUpdateFieldForRoles(UserController $controller) + { + // Create a user + $fm = $this->ci->factory; + $role = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Role'); + + // Expected input : + // value[0][role_id]: 2 + // value[1][role_id]: 9 + + // Set post data + $data = [ + 'value' => [['role_id' => $role->id]] + ]; + $request = $this->getRequest()->withParsedBody($data); + + // Get controller stuff + $result = $controller->updateField($request, $this->getResponse(), ['user_name' => 'userfoo', 'field' => 'roles']); + $this->assertSame($result->getStatusCode(), 200); + $this->assertJson((string) $result->getBody()); + $this->assertSame('[]', (string) $result->getBody()); + + // Make sure user was update + $editedUser = User::where('user_name', 'userfoo')->first(); + $this->assertSame($role->id, $editedUser->roles->first()->id); + + // Test message + /** @var \UserFrosting\Sprinkle\Core\Alert\AlertStream $ms */ + $ms = $this->ci->alerts; + $messages = $ms->getAndClearMessages(); + $this->assertSame('success', end($messages)['type']); + } + + /** + * @return UserController + */ + private function getController() + { + return new UserController($this->ci); + } + + /** + */ + private function setupUser() + { + // Admin user, WILL have access + $testUser = $this->createTestUser(true, true); + + // Create test user + $this->createTestUser(false, false, [ + 'user_name' => 'userfoo', + 'email' => 'bar@foo.com' + ]); + } +} diff --git a/app/sprinkles/admin/tests/Integration/SprunjeTests.php b/app/sprinkles/admin/tests/Integration/SprunjeTests.php index ceffb4615..65fc6e2a0 100644 --- a/app/sprinkles/admin/tests/Integration/SprunjeTests.php +++ b/app/sprinkles/admin/tests/Integration/SprunjeTests.php @@ -1,5 +1,6 @@ classMapper, [ - 'user_id' => $users[0]->id + 'user_id' => $users[0]->id, ]); list($count, $countFiltered, $models) = $sprunje->getModels(); @@ -86,7 +87,7 @@ public function testUserPermissionSprunje() // Test user 1 $sprunje = new UserPermissionSprunje($this->classMapper, [ - 'user_id' => $users[1]->id + 'user_id' => $users[1]->id, ]); list($count, $countFiltered, $models) = $sprunje->getModels(); @@ -99,12 +100,12 @@ public function testUserPermissionSprunje() static::ignoreRelations($models); $this->assertCollectionsSame(collect([ $permissions[1], - $permissions[2] + $permissions[2], ]), $models); // Test user 2 $sprunje = new UserPermissionSprunje($this->classMapper, [ - 'user_id' => $users[2]->id + 'user_id' => $users[2]->id, ]); list($count, $countFiltered, $models) = $sprunje->getModels(); @@ -116,7 +117,7 @@ public function testUserPermissionSprunje() // Ignore pivot and roles_via. These are covered by the tests for the relationships themselves. static::ignoreRelations($models); $this->assertCollectionsSame(collect([ - $permissions[2] + $permissions[2], ]), $models); } } diff --git a/app/sprinkles/core/assets/userfrosting/favicons/ieconfig.xml b/app/sprinkles/core/assets/userfrosting/favicons/ieconfig.xml index 21fa5ad8b..e3e3d05d0 100644 --- a/app/sprinkles/core/assets/userfrosting/favicons/ieconfig.xml +++ b/app/sprinkles/core/assets/userfrosting/favicons/ieconfig.xml @@ -1,12 +1,12 @@ - - - - - - - - - #603cba - - - + + + + + + + + + #603cba + + + diff --git a/app/sprinkles/core/assets/userfrosting/images/logo.svg b/app/sprinkles/core/assets/userfrosting/images/logo.svg index b11b0b5cb..148efe6bd 100644 --- a/app/sprinkles/core/assets/userfrosting/images/logo.svg +++ b/app/sprinkles/core/assets/userfrosting/images/logo.svg @@ -1,514 +1,514 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/sprinkles/core/assets/userfrosting/js/uf-tablesorter-parsers.js b/app/sprinkles/core/assets/userfrosting/js/uf-tablesorter-parsers.js index 444b4ac62..0d83c10bf 100755 --- a/app/sprinkles/core/assets/userfrosting/js/uf-tablesorter-parsers.js +++ b/app/sprinkles/core/assets/userfrosting/js/uf-tablesorter-parsers.js @@ -1,53 +1,53 @@ -// Parser for sorting integers, timestamps, etc based on metadata from attributes -// Adapted from http://mottie.github.io/tablesorter/docs/example-parsers-advanced.html -$.tablesorter.addParser({ - // set a unique id - id: 'metanum', - is: function(s) { - // return false so this parser is not auto detected - return false; - }, - format: function(s, table, cell, cellIndex) { - var $cell = $(cell); - // returns metadata, or cell text (s) if it doesn't exist - return $cell.attr('data-num') || s; - - }, - // set type to numeric - type: 'numeric' -}); - -$.tablesorter.addParser({ - // set a unique id - id: 'metatext', - is: function(s) { - // return false so this parser is not auto detected - return false; - }, - format: function(s, table, cell, cellIndex) { - var $cell = $(cell); - // returns metadata, or cell text (s) if it doesn't exist - return $cell.attr('data-text') || s; - - }, - - type: 'text' -}); - -$.tablesorter.addParser({ - // set a unique id - id: 'isblank', - is: function(s) { - // return false so this parser is not auto detected - return false; - }, - format: function(s, table, cell, cellIndex) { - var $cell = $(cell); - // returns 1 if blank (whitespace), 0 otherwise - var isBlank = $cell.html().trim() == " " ? 1 : 0; - return isBlank; - - }, - - type: 'numeric' -}); +// Parser for sorting integers, timestamps, etc based on metadata from attributes +// Adapted from http://mottie.github.io/tablesorter/docs/example-parsers-advanced.html +$.tablesorter.addParser({ + // set a unique id + id: 'metanum', + is: function(s) { + // return false so this parser is not auto detected + return false; + }, + format: function(s, table, cell, cellIndex) { + var $cell = $(cell); + // returns metadata, or cell text (s) if it doesn't exist + return $cell.attr('data-num') || s; + + }, + // set type to numeric + type: 'numeric' +}); + +$.tablesorter.addParser({ + // set a unique id + id: 'metatext', + is: function(s) { + // return false so this parser is not auto detected + return false; + }, + format: function(s, table, cell, cellIndex) { + var $cell = $(cell); + // returns metadata, or cell text (s) if it doesn't exist + return $cell.attr('data-text') || s; + + }, + + type: 'text' +}); + +$.tablesorter.addParser({ + // set a unique id + id: 'isblank', + is: function(s) { + // return false so this parser is not auto detected + return false; + }, + format: function(s, table, cell, cellIndex) { + var $cell = $(cell); + // returns 1 if blank (whitespace), 0 otherwise + var isBlank = $cell.html().trim() == " " ? 1 : 0; + return isBlank; + + }, + + type: 'numeric' +}); diff --git a/app/sprinkles/core/config/debug.php b/app/sprinkles/core/config/debug.php index 330897072..2f05a776a 100644 --- a/app/sprinkles/core/config/debug.php +++ b/app/sprinkles/core/config/debug.php @@ -1,5 +1,6 @@ [ - 'use_raw' => true + 'use_raw' => true, ], 'cache' => [ - 'twig' => false + 'twig' => false, ], 'debug' => [ 'deprecation' => true, 'queries' => true, 'smtp' => true, - 'twig' => true + 'twig' => true, ], 'settings' => [ - 'displayErrorDetails' => true + 'displayErrorDetails' => true, ], 'site' => [ 'debug' => [ 'ajax' => true, - 'info' => true - ] - ] + 'info' => true, + ], + ], ]; diff --git a/app/sprinkles/core/config/default.php b/app/sprinkles/core/config/default.php index aec6d554e..1da67ffd6 100755 --- a/app/sprinkles/core/config/default.php +++ b/app/sprinkles/core/config/default.php @@ -1,5 +1,6 @@ [ 'admin' => [ 'email' => getenv('SMTP_USER') ?: null, - 'name' => 'Site Administrator' - ] + 'name' => 'Site Administrator', + ], ], /* @@ -51,13 +52,13 @@ 'assets' => [ 'compiled' => [ 'path' => 'assets', - 'schema' => 'bundle.result.json' + 'schema' => 'bundle.result.json', ], 'raw' => [ 'path' => 'assets-raw', - 'schema' => 'asset-bundles.json' + 'schema' => 'asset-bundles.json', ], - 'use_raw' => true + 'use_raw' => true, ], /* @@ -76,16 +77,16 @@ 'memcached' => [ 'host' => '127.0.0.1', 'port' => 11211, - 'weight' => 100 + 'weight' => 100, ], 'redis' => [ 'host' => '127.0.0.1', 'password' => null, 'port' => 6379, - 'database' => 0 + 'database' => 0, ], // Cache twig file to disk - 'twig' => false + 'twig' => false, ], /* @@ -108,7 +109,7 @@ // Regular expressions will be delimited with ~ in preg_match, so if you // have routes with ~ in them, you must escape this character in your regex. // Also, remember to use ^ when you only want to match the beginning of a URL path! - ] + ], ], /* @@ -131,8 +132,8 @@ 'password' => getenv('DB_PASSWORD') ?: null, 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', - 'prefix' => '' - ] + 'prefix' => '', + ], ], /* @@ -145,7 +146,7 @@ 'deprecation' => true, 'queries' => false, 'smtp' => false, - 'twig' => false + 'twig' => false, ], /* @@ -171,7 +172,7 @@ */ 'local' => [ 'driver' => 'local', - 'root' => \UserFrosting\STORAGE_DIR + 'root' => \UserFrosting\STORAGE_DIR, ], /* * Public files are directly accessible throught the webserver for @@ -182,7 +183,7 @@ 'public' => [ 'driver' => 'local', 'root' => \UserFrosting\STORAGE_PUBLIC_DIR, - 'url' => 'files/' + 'url' => 'files/', ], /* * Amazon S3 Bucket Config. Config should go in .env file. For help, see : @@ -217,8 +218,8 @@ 'message_options' => [ 'CharSet' => 'UTF-8', 'isHtml' => true, - 'Timeout' => 15 - ] + 'Timeout' => 15, + ], ], /* @@ -228,7 +229,7 @@ * `repository_table` is the table with the list of ran migrations */ 'migrations' => [ - 'repository_table' => 'migrations' + 'repository_table' => 'migrations', ], /* @@ -238,7 +239,7 @@ */ 'path' => [ 'document_root' => str_replace(DIRECTORY_SEPARATOR, \UserFrosting\DS, $_SERVER['DOCUMENT_ROOT']), - 'public_relative' => dirname($_SERVER['SCRIPT_NAME']) // The location of `index.php` relative to the document root. Use for sites installed in subdirectories of your web server's document root. + 'public_relative' => dirname($_SERVER['SCRIPT_NAME']), // The location of `index.php` relative to the document root. Use for sites installed in subdirectories of your web server's document root. ], /* @@ -252,7 +253,7 @@ 'handler' => 'file', // Supported Handler : `file`, `database` or `array` // Config values for when using db-based sessions 'database' => [ - 'table' => 'sessions' + 'table' => 'sessions', ], 'name' => 'uf4', 'minutes' => 120, @@ -260,7 +261,7 @@ // Decouples the session keys used to store certain session info 'keys' => [ 'csrf' => 'site.csrf', // the key (prefix) used to store an ArrayObject of CSRF tokens. - ] + ], ], /* @@ -271,7 +272,7 @@ * Set `displayErrorDetails` to true to display full error details */ 'settings' => [ - 'displayErrorDetails' => true + 'displayErrorDetails' => true, ], /* @@ -284,20 +285,20 @@ // AdminLTE skin color // See https://adminlte.io/themes/AdminLTE/documentation/index.html#layout 'AdminLTE' => [ - 'skin' => 'blue' + 'skin' => 'blue', ], // Google Analytics Settings 'analytics' => [ 'google' => [ 'code' => '', - 'enabled' => false - ] + 'enabled' => false, + ], ], 'author' => 'Author', // Site author 'csrf' => null, // Do not set this variable. The core Twig extension will override it with values from the CSRF service. 'debug' => [ 'ajax' => false, - 'info' => true + 'info' => true, ], 'locales' => [ // Should be ordered according to https://en.wikipedia.org/wiki/List_of_languages_by_total_number_of_speakers, @@ -323,12 +324,12 @@ // First locale is the base one and the other one are loaded on top. // For example, 'en_US,es_ES' will use the English (en_US) // translation as a base and load the Spanish (es_ES) translation on top. - 'default' => 'en_US' + 'default' => 'en_US', ], 'title' => 'UserFrosting', // Site display name // Global ufTable settings 'uf_table' => [ - 'use_loading_transition' => true + 'use_loading_transition' => true, ], // URLs 'uri' => [ @@ -337,11 +338,11 @@ 'host' => isset($_SERVER['SERVER_NAME']) ? trim($_SERVER['SERVER_NAME'], '/') : 'localhost', 'scheme' => empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off' ? 'http' : 'https', 'port' => isset($_SERVER['SERVER_PORT']) ? (int) $_SERVER['SERVER_PORT'] : null, - 'path' => isset($_SERVER['SCRIPT_NAME']) ? trim(dirname($_SERVER['SCRIPT_NAME']), '/\\') : '' + 'path' => isset($_SERVER['SCRIPT_NAME']) ? trim(dirname($_SERVER['SCRIPT_NAME']), '/\\') : '', ], 'author' => 'https://www.userfrosting.com', - 'publisher' => '' - ] + 'publisher' => '', + ], ], /* @@ -355,6 +356,6 @@ 'display_errors' => 'true', 'log_errors' => 'false', // Let PHP itself render errors natively. Useful if a fatal error is raised in our custom shutdown handler. - 'display_errors_native' => 'false' - ] + 'display_errors_native' => 'false', + ], ]; diff --git a/app/sprinkles/core/config/production.php b/app/sprinkles/core/config/production.php index e3b217bcf..6c57a6757 100644 --- a/app/sprinkles/core/config/production.php +++ b/app/sprinkles/core/config/production.php @@ -1,5 +1,6 @@ [ - 'use_raw' => false + 'use_raw' => false, ], /* * Enable Twig cache */ 'cache' => [ - 'twig' => true + 'twig' => true, ], /* * Turn off debug logs @@ -29,14 +30,14 @@ 'debug' => [ 'twig' => false, 'auth' => false, - 'smtp' => false + 'smtp' => false, ], /* * Use router cache, disable full error details */ 'settings' => [ 'routerCacheFile' => 'routes.cache', - 'displayErrorDetails' => false + 'displayErrorDetails' => false, ], /* * Enable analytics, disable more debugging @@ -44,19 +45,19 @@ 'site' => [ 'analytics' => [ 'google' => [ - 'enabled' => true - ] + 'enabled' => true, + ], ], 'debug' => [ 'ajax' => false, - 'info' => false - ] + 'info' => false, + ], ], /* * Send errors to log */ 'php' => [ 'display_errors' => 'false', - 'log_errors' => 'true' - ] + 'log_errors' => 'true', + ], ]; diff --git a/app/sprinkles/core/config/testing.php b/app/sprinkles/core/config/testing.php index 980219548..38a87253f 100755 --- a/app/sprinkles/core/config/testing.php +++ b/app/sprinkles/core/config/testing.php @@ -1,5 +1,6 @@ [ 'illuminate' => [ 'default' => 'array', - ] + ], ], /* * Define in memory db for testing @@ -26,7 +27,7 @@ 'test_integration' => [ 'driver' => 'sqlite', 'database' => ':memory:', - ] + ], ], /* * Don't log deprecations in tests @@ -46,26 +47,26 @@ ], 'testingDriver' => [ 'driver' => 'localTest', - 'root' => \UserFrosting\STORAGE_DIR . \UserFrosting\DS . 'testingDriver' + 'root' => \UserFrosting\STORAGE_DIR . \UserFrosting\DS . 'testingDriver', ], - ] + ], ], /* * Don't display error detail in test. Return the non formatted errors */ 'settings' => [ - 'displayErrorDetails' => false + 'displayErrorDetails' => false, ], /* * Disable native sessions in tests */ 'session' => [ - 'handler' => getenv('TEST_SESSION_HANDLER') ?: 'array' + 'handler' => getenv('TEST_SESSION_HANDLER') ?: 'array', ], /* * Database to use when using the TestDatabase Trait */ 'testing' => [ - 'dbConnection' => getenv('TEST_DB') ?: 'test_integration' - ] + 'dbConnection' => getenv('TEST_DB') ?: 'test_integration', + ], ]; diff --git a/app/sprinkles/core/defines.php b/app/sprinkles/core/defines.php index 0dc0268a2..4df74c10b 100644 --- a/app/sprinkles/core/defines.php +++ b/app/sprinkles/core/defines.php @@ -1,5 +1,6 @@ ' لا يبدو للعثور على ما كنت تبحث عن', 'DETAIL' => 'حاولنا العثور على صفحتك', 'EXPLAIN' => 'لم نتمكن من العثور على الصفحة التي تبحث عنها', - 'RETURN' => 'وفي كلتا الحالتين، اضغط هنا للعودة إلى الصفحة الأولى' + 'RETURN' => 'وفي كلتا الحالتين، اضغط هنا للعودة إلى الصفحة الأولى', ], 'CONFIG' => [ 'TITLE' => 'مشكلة في تكوين UserFrosting', 'DESCRIPTION' => 'لم تتحقق بعض متطلبات التكوين UserFrosting', 'DETAIL' => 'شيء ليس صحيحا هنا', - 'RETURN' => 'يرجى تصحيح الأخطاء التالية، ثم إعادة تحميل' + 'RETURN' => 'يرجى تصحيح الأخطاء التالية، ثم إعادة تحميل', ], 'DESCRIPTION' => 'لقد لمست اضطراب كبير في الموقع', @@ -47,6 +48,6 @@ 'SERVER' => 'يبدو خادمنا قد أخطأ إذا كنت المسير، يرجى مراجعة سجلات الخطأ PHP أو UF', - 'TITLE' => 'اضطراب في الموقع' - ] + 'TITLE' => 'اضطراب في الموقع', + ], ]; diff --git a/app/sprinkles/core/locale/ar/messages.php b/app/sprinkles/core/locale/ar/messages.php index 706e36832..ec26f6a70 100644 --- a/app/sprinkles/core/locale/ar/messages.php +++ b/app/sprinkles/core/locale/ar/messages.php @@ -1,5 +1,6 @@ 'كلمة التحقق', 'FAIL' => 'لم تقم بإدخال رمز كلمة التحقق بشكل صحيح', 'SPECIFY' => 'أدخل كلمة التحقق', - 'VERIFY' => 'التحقق من كلمة التحقق' + 'VERIFY' => 'التحقق من كلمة التحقق', ], 'CSRF_MISSING' => 'رمز CSRF غير موجود حاول تحديث الصفحة ومن ثم إرساله مرة أخرى', @@ -30,19 +31,19 @@ 'DESCRIPTION' => 'وصف', 'DOWNLOAD' => [ '@TRANSLATION' => 'تحميل', - 'CSV' => 'تحميل CSV' + 'CSV' => 'تحميل CSV', ], 'EMAIL' => [ '@TRANSLATION' => 'البريد الإلكتروني', - 'YOUR' => 'عنوان بريدك الإلكتروني' + 'YOUR' => 'عنوان بريدك الإلكتروني', ], 'HOME' => 'الصفحة الرئيسية', 'LEGAL' => [ '@TRANSLATION' => 'السياسة القانونية', - 'DESCRIPTION' => 'تسري سياستنا القانونية على استخدامك لهذا الموقع وخدماتنا' + 'DESCRIPTION' => 'تسري سياستنا القانونية على استخدامك لهذا الموقع وخدماتنا', ], 'LOCALE' => [ @@ -58,11 +59,11 @@ 'NEXT' => 'الصفحة التالية', 'PREVIOUS' => 'الصفحة السابقة', 'FIRST' => 'الصفحة الأولى', - 'LAST' => 'آخر صفحة' + 'LAST' => 'آخر صفحة', ], 'PRIVACY' => [ '@TRANSLATION' => 'سياسة الخصوصية', - 'DESCRIPTION' => 'تحدد سياسة الخصوصية لدينا نوع المعلومات التي نجمعها منك وكيفية استخدامها.' + 'DESCRIPTION' => 'تحدد سياسة الخصوصية لدينا نوع المعلومات التي نجمعها منك وكيفية استخدامها.', ], 'SLUG' => 'Slug', @@ -109,5 +110,5 @@ // Misc 'BUILT_WITH_UF' => 'بنيت مع UserFrosting', 'ADMINLTE_THEME_BY' => 'فكرة رئيسية Almsaeed Studio كل الحقوق محفوظة', - 'WELCOME_TO' => 'مرحبا بك في {{title}}!' + 'WELCOME_TO' => 'مرحبا بك في {{title}}!', ]; diff --git a/app/sprinkles/core/locale/ar/validate.php b/app/sprinkles/core/locale/ar/validate.php index c85517632..f204e74c3 100644 --- a/app/sprinkles/core/locale/ar/validate.php +++ b/app/sprinkles/core/locale/ar/validate.php @@ -1,5 +1,6 @@ '{{label}} لابد ان تكون بين {{min}} و {{max}} حورف', 'NO_LEAD_WS' => 'القيم ل {{label}} لا يمكن أن تبدأ المساحات، علامات، أو بيضاء أخرى', 'NO_TRAIL_WS' => 'القيم ل {{label}} لا يمكن أن ينتهي مع مسافات، علامات، أو بيضاء أخرى', - 'REQUIRED' => ' تحديد قيمة ل {{label}}' - ] + 'REQUIRED' => ' تحديد قيمة ل {{label}}', + ], ]; diff --git a/app/sprinkles/core/locale/de_DE/errors.php b/app/sprinkles/core/locale/de_DE/errors.php index 5450433f0..fd731280d 100644 --- a/app/sprinkles/core/locale/de_DE/errors.php +++ b/app/sprinkles/core/locale/de_DE/errors.php @@ -1,5 +1,6 @@ 'Die angeforderte Ressource wurde nicht gefunden.', 'DETAIL' => 'Wir haben versucht Ihre Seite zu finden ...', 'EXPLAIN' => 'Die von Ihnen gesuchte Seite konnte nicht gefunden werden.', - 'RETURN' => "Klicken Sie Hier, um zur Startseite zurückzukehren." + 'RETURN' => "Klicken Sie Hier, um zur Startseite zurückzukehren.", ], 'CONFIG' => [ 'TITLE' => 'UserFrosting Konfigurationsproblem!', 'DESCRIPTION' => 'Einige UserFrosting-Konfigurationsanforderungen wurden nicht erfüllt.', 'DETAIL' => 'Etwas stimmt hier nicht.', - 'RETURN' => "Bitte beheben Sie die folgenden Fehler dann laden Sie die Website neu." + 'RETURN' => "Bitte beheben Sie die folgenden Fehler dann laden Sie die Website neu.", ], 'DESCRIPTION' => 'Wir haben eine große Störung in der Macht erkannt.', @@ -49,6 +50,6 @@ 'SERVER' => 'Hoppla, sieht aus als hätte der Server möglicherweise gepatzt. Wenn Sie ein Administrator sind, überprüfen Sie bitte die PHP- oder UF-Fehlerprotokolle.', - 'TITLE' => 'Störung in der Kraft' - ] + 'TITLE' => 'Störung in der Kraft', + ], ]; diff --git a/app/sprinkles/core/locale/de_DE/messages.php b/app/sprinkles/core/locale/de_DE/messages.php index ae79b3083..0a6295366 100644 --- a/app/sprinkles/core/locale/de_DE/messages.php +++ b/app/sprinkles/core/locale/de_DE/messages.php @@ -1,5 +1,6 @@ 'Sicherheitscode', 'FAIL' => 'Sie haben den Sicherheitscode nicht korrekt eingegeben.', 'SPECIFY' => 'Geben Sie den Sicherheitscode ein', - 'VERIFY' => 'Überprüfen Sie den Sicherheitscode' + 'VERIFY' => 'Überprüfen Sie den Sicherheitscode', ], 'CSRF_MISSING' => 'Fehlender CSRF-Token. Versuchen, die Seite zu aktualisieren und erneut zu senden?', @@ -32,23 +33,23 @@ 'DESCRIPTION' => 'Beschreibung', 'DOWNLOAD' => [ '@TRANSLATION' => 'Herunterladen', - 'CSV' => 'CSV herunterladen' + 'CSV' => 'CSV herunterladen', ], 'EMAIL' => [ '@TRANSLATION' => 'E-Mail', - 'YOUR' => 'Ihre E-Mail-Adresse' + 'YOUR' => 'Ihre E-Mail-Adresse', ], 'HOME' => 'Startseite', 'LEGAL' => [ '@TRANSLATION' => 'Rechtsgrundsatz', - 'DESCRIPTION' => 'Unser Rechtsgrundsatz gilt für die Benutzung dieser Internetseite und unserer Dienste.' + 'DESCRIPTION' => 'Unser Rechtsgrundsatz gilt für die Benutzung dieser Internetseite und unserer Dienste.', ], 'LOCALE' => [ - '@TRANSLATION' => 'Sprache' + '@TRANSLATION' => 'Sprache', ], 'NAME' => 'Name', @@ -67,11 +68,11 @@ 'NEXT' => 'Nächste Seite', 'PREVIOUS' => 'Vorherige Seite', 'FIRST' => 'Erste Seite', - 'LAST' => 'Letzte Seite' + 'LAST' => 'Letzte Seite', ], 'PRIVACY' => [ '@TRANSLATION' => 'Datenschutzbestimmungen', - 'DESCRIPTION' => 'In unsere Datenschutzbestimmungen erklären wir Ihnen, welche Daten wir sammeln und wozu wir diese benutzen.' + 'DESCRIPTION' => 'In unsere Datenschutzbestimmungen erklären wir Ihnen, welche Daten wir sammeln und wozu wir diese benutzen.', ], 'SLUG' => 'Schnecke', @@ -120,5 +121,5 @@ // Misc. 'BUILT_WITH_UF' => 'Errichtet mit UserFrosting', 'ADMINLTE_THEME_BY' => 'Theme von Almsaeed Studio. Alle Rechte vorbehalten', - 'WELCOME_TO' => 'Willkommen auf {{title}}!' + 'WELCOME_TO' => 'Willkommen auf {{title}}!', ]; diff --git a/app/sprinkles/core/locale/de_DE/validate.php b/app/sprinkles/core/locale/de_DE/validate.php index 5f49d0491..f6bda6072 100644 --- a/app/sprinkles/core/locale/de_DE/validate.php +++ b/app/sprinkles/core/locale/de_DE/validate.php @@ -1,5 +1,6 @@ [ 'BAD_FILTER' => '{{name}} ist kein gültiger Filter für dieses Sprunje.', 'BAD_LIST' => '{{name}} ist kein gültige Liste für dieses Sprunje.', - 'BAD_SORT' => '{{name}} ist kein gültiges Sortierungsfeld für dieses Sprunje.' - ] - ] + 'BAD_SORT' => '{{name}} ist kein gültiges Sortierungsfeld für dieses Sprunje.', + ], + ], ]; diff --git a/app/sprinkles/core/locale/el/errors.php b/app/sprinkles/core/locale/el/errors.php index 6b7701556..a5c89ff67 100644 --- a/app/sprinkles/core/locale/el/errors.php +++ b/app/sprinkles/core/locale/el/errors.php @@ -1,51 +1,48 @@ [ - "@TRANSLATION" => "Σφάλμα", - - "400" => [ - "TITLE" => "Σφάλμα 400: Bad Request", - "DESCRIPTION" => "Μάλλον δεν είναι δικό σου λάθος.", + 'ERROR' => [ + '@TRANSLATION' => 'Σφάλμα', + + '400' => [ + 'TITLE' => 'Σφάλμα 400: Bad Request', + 'DESCRIPTION' => 'Μάλλον δεν είναι δικό σου λάθος.', ], - - "404" => [ - "TITLE" => "Σφάλμα 404: Δεν βρέθηκε", - "DESCRIPTION" => "Δεν μπορούμε να βρούμε αυτό που ψάχνετε.", - "DETAIL" => "Προσπαθήσαμε να βρούμε τη σελίδα σας ...", - "EXPLAIN" => "Δεν βρήκαμε τη σελίδα που ψάχνατε.", - "RETURN" => 'Όπως κι αν είναι, κάντε κλικ εδώ για να επιστρέψετε στην αρχική σελίδα.', + + '404' => [ + 'TITLE' => 'Σφάλμα 404: Δεν βρέθηκε', + 'DESCRIPTION' => 'Δεν μπορούμε να βρούμε αυτό που ψάχνετε.', + 'DETAIL' => 'Προσπαθήσαμε να βρούμε τη σελίδα σας ...', + 'EXPLAIN' => 'Δεν βρήκαμε τη σελίδα που ψάχνατε.', + 'RETURN' => 'Όπως κι αν είναι, κάντε κλικ εδώ για να επιστρέψετε στην αρχική σελίδα.', ], - - "CONFIG" => [ - "TITLE" => "Πρόβλημα ρύθμισης παραμέτρων του UserFrosting!", - "DESCRIPTION" => "Ορισμένες απαιτήσεις διαμόρφωσης του UserFrosting δεν πληρούνται.", - "DETAIL" => "Κάτι δεν είναι εδώ.", - "RETURN" => 'Παρακαλούμε διορθώστε τα ακόλουθα σφάλματα και στη συνέχεια, επαναλάβετε τη φόρτωση.' + + 'CONFIG' => [ + 'TITLE' => 'Πρόβλημα ρύθμισης παραμέτρων του UserFrosting!', + 'DESCRIPTION' => 'Ορισμένες απαιτήσεις διαμόρφωσης του UserFrosting δεν πληρούνται.', + 'DETAIL' => 'Κάτι δεν είναι εδώ.', + 'RETURN' => 'Παρακαλούμε διορθώστε τα ακόλουθα σφάλματα και στη συνέχεια, επαναλάβετε τη φόρτωση.', ], - - "DESCRIPTION" => "Έχουμε αισθανθεί μια μεγάλη διαταραχή στη Δύναμη.", - "DETAIL" => "Λοιπόν έχουμε αυτά τα στοιχεία:", - - "ENCOUNTERED" => "Εεεε ... κάτι συνέβη, δεν ξέρουμε τι.", - - "MAIL" => "Κρίσιμο σφάλμα κατά την προσπάθεια αποστολής ηλ. μηνύματος, επικοινωνήστε με τον διαχειριστή του διακομιστή σας. Αν είστε ο διαχειριστής, ελέγξτε το αρχείο καταγραφής UserFrosting.", - - "RETURN" => 'Κάντε κλικ εδώ για να επιστρέψετε στην αρχική σελίδα.', - - "SERVER" => "Ωχ, φαίνεται ότι ο διακομιστής μας μπορεί να έχει μπερδευτεί. Αν είστε ο διαχειριστής, ελέγξτε τα αρχεία καταγραφής PHP ή UserFrosting.", - - "TITLE" => "Διαταραχή της Δύναμης" - ] + + 'DESCRIPTION' => 'Έχουμε αισθανθεί μια μεγάλη διαταραχή στη Δύναμη.', + 'DETAIL' => 'Λοιπόν έχουμε αυτά τα στοιχεία:', + + 'ENCOUNTERED' => 'Εεεε ... κάτι συνέβη, δεν ξέρουμε τι.', + + 'MAIL' => 'Κρίσιμο σφάλμα κατά την προσπάθεια αποστολής ηλ. μηνύματος, επικοινωνήστε με τον διαχειριστή του διακομιστή σας. Αν είστε ο διαχειριστής, ελέγξτε το αρχείο καταγραφής UserFrosting.', + + 'RETURN' => 'Κάντε κλικ εδώ για να επιστρέψετε στην αρχική σελίδα.', + + 'SERVER' => 'Ωχ, φαίνεται ότι ο διακομιστής μας μπορεί να έχει μπερδευτεί. Αν είστε ο διαχειριστής, ελέγξτε τα αρχεία καταγραφής PHP ή UserFrosting.', + + 'TITLE' => 'Διαταραχή της Δύναμης', + ], ]; diff --git a/app/sprinkles/core/locale/el/messages.php b/app/sprinkles/core/locale/el/messages.php index 688da9ceb..5ba0b5afa 100644 --- a/app/sprinkles/core/locale/el/messages.php +++ b/app/sprinkles/core/locale/el/messages.php @@ -1,105 +1,102 @@ 1, - "ABOUT" => "Σχετικά", - "CAPTCHA" => [ - "@TRANSLATION" => "Captcha", - "FAIL" => "Δεν έχετε εισάγει σωστά τον κωδικό captcha.", - "SPECIFY" => "Εισαγάγετε τον captcha", - "VERIFY" => "Επαλήθευση του captcha" + '@PLURAL_RULE' => 1, + 'ABOUT' => 'Σχετικά', + 'CAPTCHA' => [ + '@TRANSLATION' => 'Captcha', + 'FAIL' => 'Δεν έχετε εισάγει σωστά τον κωδικό captcha.', + 'SPECIFY' => 'Εισαγάγετε τον captcha', + 'VERIFY' => 'Επαλήθευση του captcha', ], - "CSRF_MISSING" => "Λείπει το CSRF token. Γιατί δεν δοκιμάζετε να ανανεώσετε τη σελίδα και στη συνέχεια να υποβάλετε ξανά;", - "DB_INVALID" => "Δεν είναι δυνατή η σύνδεση με τη βάση δεδομένων Εάν είστε διαχειριστής, ελέγξτε το αρχείο καταγραφής σφαλμάτων.", - "DESCRIPTION" => "Περιγραφή", - "DOWNLOAD" => [ - "@TRANSLATION" => "Λήψη", - "CSV" => "Λήψη CSV" + 'CSRF_MISSING' => 'Λείπει το CSRF token. Γιατί δεν δοκιμάζετε να ανανεώσετε τη σελίδα και στη συνέχεια να υποβάλετε ξανά;', + 'DB_INVALID' => 'Δεν είναι δυνατή η σύνδεση με τη βάση δεδομένων Εάν είστε διαχειριστής, ελέγξτε το αρχείο καταγραφής σφαλμάτων.', + 'DESCRIPTION' => 'Περιγραφή', + 'DOWNLOAD' => [ + '@TRANSLATION' => 'Λήψη', + 'CSV' => 'Λήψη CSV', ], - "EMAIL" => [ - "@TRANSLATION" => "Email", - "YOUR" => "Η διεύθυνσή σας ηλεκτρονικού ταχυδρομείου" + 'EMAIL' => [ + '@TRANSLATION' => 'Email', + 'YOUR' => 'Η διεύθυνσή σας ηλεκτρονικού ταχυδρομείου', ], - "HOME" => "Αρχική σελίδα", - "LEGAL" => [ - "@TRANSLATION" => "Όροι χρήσης", - "DESCRIPTION" => "Οι όροι χρήσης που ισχύουν για τη χρήση αυτού του ιστότοπου και των υπηρεσιών μας." + 'HOME' => 'Αρχική σελίδα', + 'LEGAL' => [ + '@TRANSLATION' => 'Όροι χρήσης', + 'DESCRIPTION' => 'Οι όροι χρήσης που ισχύουν για τη χρήση αυτού του ιστότοπου και των υπηρεσιών μας.', ], - "LOCALE" => [ - "@TRANSLATION" => "Γλώσσα" + 'LOCALE' => [ + '@TRANSLATION' => 'Γλώσσα', ], - "NAME" => "Όνομα", - "NAVIGATION" => "Πλοήγηση", - "NO_RESULTS" => "Λυπούμαστε, δεν έχουμε τίποτα εδώ", - "PAGINATION" => [ - "GOTO" => "Μετάβαση στη σελίδα", - "SHOW" => "Εμφάνιση", "OUTPUT" => "{startRow} έως {endRow} από {filteredRows} ({totalRows})", + 'NAME' => 'Όνομα', + 'NAVIGATION' => 'Πλοήγηση', + 'NO_RESULTS' => 'Λυπούμαστε, δεν έχουμε τίποτα εδώ', + 'PAGINATION' => [ + 'GOTO' => 'Μετάβαση στη σελίδα', + 'SHOW' => 'Εμφάνιση', 'OUTPUT' => '{startRow} έως {endRow} από {filteredRows} ({totalRows})', // Paginator // possible variables: {size}, {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows} // also {page:input} & {startRow:input} will add a modifiable input in place of the value - "OUTPUT" => "{startRow} έως {endRow} από {filteredRows} ({totalRows})", - "NEXT" => "Επόμενη σελίδα", - "PREVIOUS" => "Προηγούμενη σελίδα", - "FIRST" => "Πρώτη σελίδα", - "LAST" => "Τελευταία σελίδα" + 'OUTPUT' => '{startRow} έως {endRow} από {filteredRows} ({totalRows})', + 'NEXT' => 'Επόμενη σελίδα', + 'PREVIOUS' => 'Προηγούμενη σελίδα', + 'FIRST' => 'Πρώτη σελίδα', + 'LAST' => 'Τελευταία σελίδα', ], - "PRIVACY" => [ - "@TRANSLATION" => "Πολιτική απορρήτου", - "DESCRIPTION" => "Η πολιτική απορρήτου μας περιγράφει τι είδους πληροφορίες συλλέγουμε από εσάς και πώς θα το χρησιμοποιήσουμε" . -     ], - "SLUG" => "Slug", - "SLUG_CONDITION" => "Slug/ Προϋποθέσεις", - "SLUG_IN_USE" => "Υπάρχει ήδη ένα slug {{slug}} ", - "STATUS" => "Κατάσταση", - "SUGGEST" => "Προτείνετε", - "UNKNOWN" => "Άγνωστο", + 'PRIVACY' => [ + '@TRANSLATION' => 'Πολιτική απορρήτου', + 'DESCRIPTION' => 'Η πολιτική απορρήτου μας περιγράφει τι είδους πληροφορίες συλλέγουμε από εσάς και πώς θα το χρησιμοποιήσουμε' . +     , ], + 'SLUG' => 'Slug', + 'SLUG_CONDITION' => 'Slug/ Προϋποθέσεις', + 'SLUG_IN_USE' => 'Υπάρχει ήδη ένα slug {{slug}} ', + 'STATUS' => 'Κατάσταση', + 'SUGGEST' => 'Προτείνετε', + 'UNKNOWN' => 'Άγνωστο', // Actions words - "ACTIONS" => "Ενέργειες", - "ACTIVATE" => "Ενεργοποίηση", - "ACTIVE" => "Ενεργό", - "ADD" => "Προσθήκη", - "CANCEL" => "Ακύρωση", - "CONFIRM" => "Επιβεβαίωση", - "CREATE" => "Δημιουργία", - "DELETE" => "Διαγραφή", - "DELETE_CONFIRM" => "Είστε βέβαιοι ότι θέλετε να γίνει η διαγραφή;", - "DELETE_CONFIRM_YES" => "Ναι, διαγραφή", - "DELETE_CONFIRM_NAMED" => "Είστε βέβαιοι ότι θέλετε να διαγράψετε το {{name}};", - "DELETE_CONFIRM_YES_NAMED" => "Ναι, διαγραφή του {{name}}", - "DELETE_CANNOT_UNDONE" => "Αυτή η ενέργεια δεν μπορεί να ακυρωθεί.", - "DELETE_NAMED" => "Διαγραφή {{name}}", - "DENY" => "Άρνηση", - "DISABLE" => "Απενεργοποίηση", - "DISABLED" => "Απενεργοποιημένο", - "EDIT" => "Επεξεργασία", - "ENABLE" => "Ενεργοποίηση", - "ENABLED" => "Ενεργοποιημένο", - "OVERRIDE" => "Παράκαμψη", - "RESET" => "Επαναφορά", - "SAVE" => "Αποθήκευση", - "ΑΝΑΖΗΤΗΣΗ" => "Αναζήτηση", - "SORT" => "Ταξινόμηση", - "SUBMIT" => "Υποβολή", - "PRINT" => "Εκτύπωση", - "REMOVE" => "Κατάργηση", - "UNACTIVATED" => "Απενεργοποιημένο", - "UPDATE" => "Ενημέρωση", - "YES" => "Ναι", - "NO" => "Όχι", - "OPTIONAL" => "Προαιρετικό", + 'ACTIONS' => 'Ενέργειες', + 'ACTIVATE' => 'Ενεργοποίηση', + 'ACTIVE' => 'Ενεργό', + 'ADD' => 'Προσθήκη', + 'CANCEL' => 'Ακύρωση', + 'CONFIRM' => 'Επιβεβαίωση', + 'CREATE' => 'Δημιουργία', + 'DELETE' => 'Διαγραφή', + 'DELETE_CONFIRM' => 'Είστε βέβαιοι ότι θέλετε να γίνει η διαγραφή;', + 'DELETE_CONFIRM_YES' => 'Ναι, διαγραφή', + 'DELETE_CONFIRM_NAMED' => 'Είστε βέβαιοι ότι θέλετε να διαγράψετε το {{name}};', + 'DELETE_CONFIRM_YES_NAMED' => 'Ναι, διαγραφή του {{name}}', + 'DELETE_CANNOT_UNDONE' => 'Αυτή η ενέργεια δεν μπορεί να ακυρωθεί.', + 'DELETE_NAMED' => 'Διαγραφή {{name}}', + 'DENY' => 'Άρνηση', + 'DISABLE' => 'Απενεργοποίηση', + 'DISABLED' => 'Απενεργοποιημένο', + 'EDIT' => 'Επεξεργασία', + 'ENABLE' => 'Ενεργοποίηση', + 'ENABLED' => 'Ενεργοποιημένο', + 'OVERRIDE' => 'Παράκαμψη', + 'RESET' => 'Επαναφορά', + 'SAVE' => 'Αποθήκευση', + 'ΑΝΑΖΗΤΗΣΗ' => 'Αναζήτηση', + 'SORT' => 'Ταξινόμηση', + 'SUBMIT' => 'Υποβολή', + 'PRINT' => 'Εκτύπωση', + 'REMOVE' => 'Κατάργηση', + 'UNACTIVATED' => 'Απενεργοποιημένο', + 'UPDATE' => 'Ενημέρωση', + 'YES' => 'Ναι', + 'NO' => 'Όχι', + 'OPTIONAL' => 'Προαιρετικό', // Misc. - "BUILT_WITH_UF" => "Κατασκευάστηκε με το UserFrosting ", - "ADMINLTE_THEME_BY" => "Θέμα από > Almsaeed Studio . Όλα τα δικαιώματα διατηρούνται", - "WELCOME_TO" => "Καλώς ορίσατε στο {{title}}!" + 'BUILT_WITH_UF' => 'Κατασκευάστηκε με το UserFrosting ', + 'ADMINLTE_THEME_BY' => "Θέμα από > Almsaeed Studio . Όλα τα δικαιώματα διατηρούνται", + 'WELCOME_TO' => 'Καλώς ορίσατε στο {{title}}!', ]; diff --git a/app/sprinkles/core/locale/el/validate.php b/app/sprinkles/core/locale/el/validate.php index 1cd362dfc..3fb814f8b 100644 --- a/app/sprinkles/core/locale/el/validate.php +++ b/app/sprinkles/core/locale/el/validate.php @@ -1,32 +1,35 @@ [ - "ARRAY" => "Οι τιμές για {{label}} πρέπει να βρίσκονται σε πίνακα.", - "BOOLEAN" => "Η τιμή του {{label}} πρέπει να είναι είτε '0' είτε '1'.", - "INTEGER" => "Η τιμή του {{label}} πρέπει να είναι ακέραιος.", - "INVALID_EMAIL" => "Μη έγκυρη διεύθυνση ηλεκτρονικού ταχυδρομείου.", - "LENGTH_RANGE" => "Το {{label}} πρέπει να έχει μήκος από {{min}} έως {{max}} χαρακτήρες.", - "MAX_LENGTH" => "Το {{label}} πρέπει να έχει το πολύ {{max}} χαρακτήρες.", - "MIN_LENGTH" => "Το {{label}} πρέπει να έχει τουλάχιστον {{min}} χαρακτήρες.", - "NO_LEAD_WS" => "Η τιμή του {{label}} δεν μπορεί να ξεκινήσει με κενά, στηλοθέτες ή άλλου τύπου κενό διάστημα.", - "NO_TRAIL_WS" => "Η τιμή του {{label}} δεν μπορεί να τερματίζει σε κενά, τηλοθέτες ή άλλου τύπου κενό διάστημα.", - "RANGE" => "Η τιμή του {{label}} πρέπει να είναι μεταξύ {{min}} και {{max}.", - "REQUIRED" => "Παρακαλούμε προσδιορίστε μια τιμή για το {{label}}.", - "SPRUNJE" => [ - "BAD_FILTER" => "Το {{name}} δεν είναι έγκυρο φίλτρο για αυτό το Sprunje.", - "BAD_LIST" => "Το {{name}} δεν είναι έγκυρη λίστα για αυτό το Sprunje.", - "BAD_SORT" => "Το {{name}} δεν είναι έγκυρο πεδίο ταξινόμησης για αυτό το Sprunje." - ] - ] + 'VALIDATE' => [ + 'ARRAY' => 'Οι τιμές για {{label}} πρέπει να βρίσκονται σε πίνακα.', + 'BOOLEAN' => "Η τιμή του {{label}} πρέπει να είναι είτε '0' είτε '1'.", + 'INTEGER' => 'Η τιμή του {{label}} πρέπει να είναι ακέραιος.', + 'INVALID_EMAIL' => 'Μη έγκυρη διεύθυνση ηλεκτρονικού ταχυδρομείου.', + 'LENGTH_RANGE' => 'Το {{label}} πρέπει να έχει μήκος από {{min}} έως {{max}} χαρακτήρες.', + 'MAX_LENGTH' => 'Το {{label}} πρέπει να έχει το πολύ {{max}} χαρακτήρες.', + 'MIN_LENGTH' => 'Το {{label}} πρέπει να έχει τουλάχιστον {{min}} χαρακτήρες.', + 'NO_LEAD_WS' => 'Η τιμή του {{label}} δεν μπορεί να ξεκινήσει με κενά, στηλοθέτες ή άλλου τύπου κενό διάστημα.', + 'NO_TRAIL_WS' => 'Η τιμή του {{label}} δεν μπορεί να τερματίζει σε κενά, τηλοθέτες ή άλλου τύπου κενό διάστημα.', + 'RANGE' => 'Η τιμή του {{label}} πρέπει να είναι μεταξύ {{min}} και {{max}.', + 'REQUIRED' => 'Παρακαλούμε προσδιορίστε μια τιμή για το {{label}}.', + 'SPRUNJE' => [ + 'BAD_FILTER' => 'Το {{name}} δεν είναι έγκυρο φίλτρο για αυτό το Sprunje.', + 'BAD_LIST' => 'Το {{name}} δεν είναι έγκυρη λίστα για αυτό το Sprunje.', + 'BAD_SORT' => 'Το {{name}} δεν είναι έγκυρο πεδίο ταξινόμησης για αυτό το Sprunje.', + ], + ], ]; diff --git a/app/sprinkles/core/locale/en_US/errors.php b/app/sprinkles/core/locale/en_US/errors.php index 7cfd17e82..dcb3eaf28 100644 --- a/app/sprinkles/core/locale/en_US/errors.php +++ b/app/sprinkles/core/locale/en_US/errors.php @@ -1,5 +1,6 @@ "We can't seem to find what you're looking for.", 'DETAIL' => 'We tried to find your page...', 'EXPLAIN' => 'We could not find the page you were looking for.', - 'RETURN' => 'Either way, click here to return to the front page.' + 'RETURN' => 'Either way, click here to return to the front page.', ], 'CONFIG' => [ 'TITLE' => 'UserFrosting Configuration Issue!', 'DESCRIPTION' => 'Some UserFrosting configuration requirements have not been met.', 'DETAIL' => "Something's not right here.", - 'RETURN' => 'Please fix the following errors, then reload.' + 'RETURN' => 'Please fix the following errors, then reload.', ], 'DESCRIPTION' => "We've sensed a great disturbance in the Force.", @@ -48,6 +49,6 @@ 'SERVER' => "Oops, looks like our server might have goofed. If you're an admin, please check the PHP or UserFrosting logs.", - 'TITLE' => 'Disturbance in the Force' - ] + 'TITLE' => 'Disturbance in the Force', + ], ]; diff --git a/app/sprinkles/core/locale/en_US/messages.php b/app/sprinkles/core/locale/en_US/messages.php index 6d21d1f8d..b086909b3 100644 --- a/app/sprinkles/core/locale/en_US/messages.php +++ b/app/sprinkles/core/locale/en_US/messages.php @@ -1,5 +1,6 @@ 'Captcha', 'FAIL' => 'You did not enter the captcha code correctly.', 'SPECIFY' => 'Enter the captcha', - 'VERIFY' => 'Verify the captcha' + 'VERIFY' => 'Verify the captcha', ], 'CSRF_MISSING' => 'Missing CSRF token. Try refreshing the page and then submitting again?', @@ -30,23 +31,23 @@ 'DESCRIPTION' => 'Description', 'DOWNLOAD' => [ '@TRANSLATION' => 'Download', - 'CSV' => 'Download CSV' + 'CSV' => 'Download CSV', ], 'EMAIL' => [ '@TRANSLATION' => 'Email', - 'YOUR' => 'Your email address' + 'YOUR' => 'Your email address', ], 'HOME' => 'Home', 'LEGAL' => [ '@TRANSLATION' => 'Legal Policy', - 'DESCRIPTION' => 'Our legal policy applies to your usage of this website and our services.' + 'DESCRIPTION' => 'Our legal policy applies to your usage of this website and our services.', ], 'LOCALE' => [ - '@TRANSLATION' => 'Locale' + '@TRANSLATION' => 'Locale', ], 'NAME' => 'Name', @@ -64,11 +65,11 @@ 'NEXT' => 'Next page', 'PREVIOUS' => 'Previous page', 'FIRST' => 'First page', - 'LAST' => 'Last page' + 'LAST' => 'Last page', ], 'PRIVACY' => [ '@TRANSLATION' => 'Privacy Policy', - 'DESCRIPTION' => 'Our privacy policy outlines what kind of information we collect from you and how we will use it.' + 'DESCRIPTION' => 'Our privacy policy outlines what kind of information we collect from you and how we will use it.', ], 'SLUG' => 'Slug', @@ -117,5 +118,5 @@ // Misc. 'BUILT_WITH_UF' => 'Built with UserFrosting', 'ADMINLTE_THEME_BY' => 'Theme by Almsaeed Studio. All rights reserved', - 'WELCOME_TO' => 'Welcome to {{title}}!' + 'WELCOME_TO' => 'Welcome to {{title}}!', ]; diff --git a/app/sprinkles/core/locale/en_US/validate.php b/app/sprinkles/core/locale/en_US/validate.php index d978b746f..4872de007 100644 --- a/app/sprinkles/core/locale/en_US/validate.php +++ b/app/sprinkles/core/locale/en_US/validate.php @@ -1,5 +1,6 @@ [ 'BAD_FILTER' => '{{name}} is not a valid filter for this Sprunje.', 'BAD_LIST' => '{{name}} is not a valid list for this Sprunje.', - 'BAD_SORT' => '{{name}} is not a valid sort field for this Sprunje.' - ] - ] + 'BAD_SORT' => '{{name}} is not a valid sort field for this Sprunje.', + ], + ], ]; diff --git a/app/sprinkles/core/locale/es_ES/errors.php b/app/sprinkles/core/locale/es_ES/errors.php index 6040f0485..08458102c 100755 --- a/app/sprinkles/core/locale/es_ES/errors.php +++ b/app/sprinkles/core/locale/es_ES/errors.php @@ -1,5 +1,6 @@ 'Parece que no podemos encontrar lo que buscas.', 'DETAIL' => 'Intentamos encontrar tu página ...', 'EXPLAIN' => 'No pudimos encontrar la página que buscabas.', - 'RETURN' => 'De cualquier manera, haz clic en aquí para volver a la página principal.' + 'RETURN' => 'De cualquier manera, haz clic en aquí para volver a la página principal.', ], 'CONFIG' => [ 'TITLE' => '¡Problema de configuración del Servidor!', 'DESCRIPTION' => 'Algunos requisitos de configuración de Servidor no se han cumplido.', 'DETAIL' => 'Algo no está bien aquí.', - 'RETURN' => 'Corrije los siguientes errores, luego recargue .' + 'RETURN' => 'Corrije los siguientes errores, luego recargue .', ], 'DESCRIPTION' => 'Hemos sentido una gran perturbación en la Fuerza.', @@ -48,5 +49,5 @@ 'SERVER' => '¡Vaya! Parece que nuestro servidor pudo haber metido la pata. Si eres un administrador, comprueba los registros de errores de PHP o el log de UserFrosting.', 'TITLE' => 'Perturbación en la Fuerza', - ] + ], ]; diff --git a/app/sprinkles/core/locale/es_ES/messages.php b/app/sprinkles/core/locale/es_ES/messages.php index 34215d208..4d5766134 100755 --- a/app/sprinkles/core/locale/es_ES/messages.php +++ b/app/sprinkles/core/locale/es_ES/messages.php @@ -1,5 +1,6 @@ 'Captcha', 'FAIL' => 'No has introducido correctamente el código de captcha.', 'SPECIFY' => 'Introduzce el captcha', - 'VERIFY' => 'Verificar el captcha' + 'VERIFY' => 'Verificar el captcha', ], 'CSRF_MISSING' => '¿Falta el símbolo CSRF?. Intenta refrescar la página y luego volver a enviarla', @@ -31,12 +32,12 @@ 'DESCRIPTION' => 'Descripción', 'DOWNLOAD' => [ '@TRANSLATION' => 'Descargar', - 'CSV' => 'Descargar CSV' + 'CSV' => 'Descargar CSV', ], 'EMAIL' => [ '@TRANSLATION' => 'Email', - 'YOUR' => 'Tu correo electrónico' + 'YOUR' => 'Tu correo electrónico', ], 'HOME' => 'Inicio', @@ -44,7 +45,7 @@ 'LEGAL' => 'Política Legal', 'LOCALE' => [ - '@TRANSLATION' => 'Traducción' + '@TRANSLATION' => 'Traducción', ], 'MAIL_ERROR' => 'Error fatal al intentar enviar correo, ponte en contacto con el administrador del servidor. Si eres el administrador, comprueba el registro de correo de UF.', @@ -63,7 +64,7 @@ 'NEXT' => 'Siguiente página', 'PREVIOUS' => 'Pagina anterior', 'FIRST' => 'Primera página', - 'LAST' => 'Última página' + 'LAST' => 'Última página', ], 'PRIVACY' => 'Política de privacidad', @@ -112,5 +113,5 @@ // Misc. 'BUILT_WITH_UF' => 'Construido con UserFrosting ', - 'ADMINLTE_THEME_BY' => 'Theme by Almsaeed Studio. All rights reserved' + 'ADMINLTE_THEME_BY' => 'Theme by Almsaeed Studio. All rights reserved', ]; diff --git a/app/sprinkles/core/locale/es_ES/validate.php b/app/sprinkles/core/locale/es_ES/validate.php index 81614c931..5af12cc7c 100755 --- a/app/sprinkles/core/locale/es_ES/validate.php +++ b/app/sprinkles/core/locale/es_ES/validate.php @@ -1,5 +1,6 @@ [ 'BAD_FILTER' => ' {{name}} no es un filtro válido para este Sprunje.', 'BAD_LIST' => ' {{name}} no es una lista válida para este Sprunje.', - 'BAD_SORT' => '{{name}} no es un campo de clasificación válido para este Sprunje.' - ] - ] + 'BAD_SORT' => '{{name}} no es un campo de clasificación válido para este Sprunje.', + ], + ], ]; diff --git a/app/sprinkles/core/locale/fa/errors.php b/app/sprinkles/core/locale/fa/errors.php index ceaf96c51..ad048c2c4 100644 --- a/app/sprinkles/core/locale/fa/errors.php +++ b/app/sprinkles/core/locale/fa/errors.php @@ -1,5 +1,6 @@ 'به نظر نمیرسد چیزی را که دنبالش هستید پیدا کنیم.', 'DETAIL' => 'ما سعی کردیم صفحه شما را پیدا کنیم...', 'EXPLAIN' => 'ما نتوانستیم صفحه ی مورد نظر شما را پیدا کنیم.', - 'RETURN' => 'در هر حال، اینجا کلیک کنید تا به صفحه اصلی بازگردید.' + 'RETURN' => 'در هر حال، اینجا کلیک کنید تا به صفحه اصلی بازگردید.', ], 'CONFIG' => [ 'TITLE' => 'خطای تنظیمات یوزرفروستینگ!', 'DESCRIPTION' => 'برخی از الزامات پیکربندی یوزرفروستینگ به نتیجه نرسید.', 'DETAIL' => 'خطایی پیش آمد.', - 'RETURN' => 'لطفا خطاهای زیر را اصلاح کنید و سپس مجددا بارگذاری نمایید.' + 'RETURN' => 'لطفا خطاهای زیر را اصلاح کنید و سپس مجددا بارگذاری نمایید.', ], 'DESCRIPTION' => 'ما یک اختلال بزرگ در سیستم احساس کردیم.', @@ -47,6 +48,6 @@ 'SERVER' => 'به نظر می آید که در سرور خطایی بوجود آمد. لطفا لاگ پی اچ پی و یوزرفروستینگ را چک کنید.', - 'TITLE' => 'اختلالی پدید آمد.' - ] + 'TITLE' => 'اختلالی پدید آمد.', + ], ]; diff --git a/app/sprinkles/core/locale/fa/messages.php b/app/sprinkles/core/locale/fa/messages.php index 311a82555..76a910f58 100644 --- a/app/sprinkles/core/locale/fa/messages.php +++ b/app/sprinkles/core/locale/fa/messages.php @@ -1,5 +1,6 @@ 'کد امنیتی', 'FAIL' => 'کد امنیتی درست نیست', 'SPECIFY' => 'کد امنیتی را وارد کنید', - 'VERIFY' => 'کد امنیتی را بررسی کنید' + 'VERIFY' => 'کد امنیتی را بررسی کنید', ], 'CSRF_MISSING' => 'سی اس آر اف توکن یافت نشد. لطفا صفحه را از نو بارگذاری کرده و دوباره تلاش کنید.', @@ -30,12 +31,12 @@ 'DESCRIPTION' => 'توضیحات', 'DOWNLOAD' => [ '@TRANSLATION' => 'دانلود', - 'CSV' => 'دانلود سی اس وی' + 'CSV' => 'دانلود سی اس وی', ], 'EMAIL' => [ '@TRANSLATION' => 'ایمیل', - 'YOUR' => 'آدرس ایمیل' + 'YOUR' => 'آدرس ایمیل', ], 'HOME' => 'خانه', @@ -43,7 +44,7 @@ 'LEGAL' => 'سیاست حقوقی', 'LOCALE' => [ - '@TRANSLATION' => 'زبان' + '@TRANSLATION' => 'زبان', ], 'NAME' => 'نام', @@ -57,7 +58,7 @@ // Paginator // possible variables: {size}, {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows} // also {page:input} & {startRow:input} will add a modifiable input in place of the value - 'OUTPUT' => '{startRow} تا {endRow} از {filteredRows} ({totalRows})' + 'OUTPUT' => '{startRow} تا {endRow} از {filteredRows} ({totalRows})', ], 'PRIVACY' => 'سیاست حفظ حریم خصوصی', @@ -106,5 +107,5 @@ // Misc. 'BUILT_WITH_UF' => 'ساخته شده با یوزرفراستینگ', - 'ADMINLTE_THEME_BY' => 'قالب از Almsaeed Studio. تمامی حقوق محفوظ است' + 'ADMINLTE_THEME_BY' => 'قالب از Almsaeed Studio. تمامی حقوق محفوظ است', ]; diff --git a/app/sprinkles/core/locale/fa/validate.php b/app/sprinkles/core/locale/fa/validate.php index 950723cc0..c02949d5f 100644 --- a/app/sprinkles/core/locale/fa/validate.php +++ b/app/sprinkles/core/locale/fa/validate.php @@ -1,5 +1,6 @@ [ 'BAD_FILTER' => '{{name}} فیلتر صحیحی نیست.', 'BAD_LIST' => '{{name}} لیست صحیحی نیست.', - 'BAD_SORT' => '{{name}} فیلد مرتب سازی صحیحی نیست.' - ] - ] + 'BAD_SORT' => '{{name}} فیلد مرتب سازی صحیحی نیست.', + ], + ], ]; diff --git a/app/sprinkles/core/locale/fr_FR/errors.php b/app/sprinkles/core/locale/fr_FR/errors.php index 9ce11c531..f8ae19df3 100644 --- a/app/sprinkles/core/locale/fr_FR/errors.php +++ b/app/sprinkles/core/locale/fr_FR/errors.php @@ -1,5 +1,6 @@ 'Nous ne pouvons trouver ce que vous cherchez.', 'DETAIL' => 'Nous avons tout tenté...', 'EXPLAIN' => 'Nous ne pouvons trouver la page que vous cherchez.', - 'RETURN' => 'Cliquez ici pour retourner à la page d\'accueil.' + 'RETURN' => 'Cliquez ici pour retourner à la page d\'accueil.', ], 'CONFIG' => [ 'TITLE' => 'Problème de configuration UserFrosting!', 'DESCRIPTION' => "Les exigences de configuration de UserFrosting n'ont pas été satisfaites.", 'DETAIL' => 'Quelque chose cloche ici...', - 'RETURN' => 'Corrigez les erreurs suivantes, ensuite recharger la page.' + 'RETURN' => 'Corrigez les erreurs suivantes, ensuite recharger la page.', ], 'DESCRIPTION' => 'Nous avons ressenti un grand bouleversement de la Force.', @@ -47,6 +48,6 @@ 'SERVER' => "Oops, il semblerait que le serveur a gaffé. Si vous êtes administrateur, s-v-p vérifier les logs d'erreurs PHP ou ceux de UserFrosting.", - 'TITLE' => 'Bouleversement de la Force' - ] + 'TITLE' => 'Bouleversement de la Force', + ], ]; diff --git a/app/sprinkles/core/locale/fr_FR/messages.php b/app/sprinkles/core/locale/fr_FR/messages.php index 2d2a46a96..63ac067fa 100644 --- a/app/sprinkles/core/locale/fr_FR/messages.php +++ b/app/sprinkles/core/locale/fr_FR/messages.php @@ -1,5 +1,6 @@ 'Captcha', 'VERIFY' => 'Vérification du captcha', 'SPECIFY' => 'Entrer la valeur du captcha', - 'FAIL' => "La valeur du captcha n'a pas été entrée correctement." + 'FAIL' => "La valeur du captcha n'a pas été entrée correctement.", ], 'CSRF_MISSING' => 'Jeton CSRF manquant. Essayez de rafraîchir la page et de soumettre de nouveau?', @@ -30,12 +31,12 @@ 'DESCRIPTION' => 'Description', 'DOWNLOAD' => [ '@TRANSLATION' => 'Télécharger', - 'CSV' => 'Télécharger CSV' + 'CSV' => 'Télécharger CSV', ], 'EMAIL' => [ '@TRANSLATION' => 'Email', - 'YOUR' => 'Votre adresse email' + 'YOUR' => 'Votre adresse email', ], 'HOME' => 'Accueil', @@ -43,7 +44,7 @@ 'LEGAL' => 'Politique légale', 'LOCALE' => [ - '@TRANSLATION' => 'Langue' + '@TRANSLATION' => 'Langue', ], 'NAME' => 'Nom', @@ -53,7 +54,7 @@ 'PAGINATION' => [ 'GOTO' => 'Aller à la page', 'SHOW' => 'Afficher', - 'OUTPUT' => '{startRow} à {endRow} de {filteredRows} ({totalRows})' + 'OUTPUT' => '{startRow} à {endRow} de {filteredRows} ({totalRows})', ], 'PRIVACY' => 'Politique de confidentialité', @@ -102,5 +103,5 @@ // Misc. 'BUILT_WITH_UF' => 'Créé avec UserFrosting', - 'ADMINLTE_THEME_BY' => 'Thème par Almsaeed Studio. Tous droits réservés' + 'ADMINLTE_THEME_BY' => 'Thème par Almsaeed Studio. Tous droits réservés', ]; diff --git a/app/sprinkles/core/locale/fr_FR/validate.php b/app/sprinkles/core/locale/fr_FR/validate.php index 66809432a..cdd8953b3 100644 --- a/app/sprinkles/core/locale/fr_FR/validate.php +++ b/app/sprinkles/core/locale/fr_FR/validate.php @@ -1,5 +1,6 @@ [ 'BAD_FILTER' => '{{name}} ne peut pas être utilisé pour filtrer ce Sprunje.', 'BAD_LIST' => '{{name}} is not a valid list for this Sprunje.', - 'BAD_SORT' => '{{name}} ne peut pas être utilisé pour trier Sprunje.' - ] - ] + 'BAD_SORT' => '{{name}} ne peut pas être utilisé pour trier Sprunje.', + ], + ], ]; diff --git a/app/sprinkles/core/locale/it_IT/errors.php b/app/sprinkles/core/locale/it_IT/errors.php index ccd8b5ae8..26f257d8d 100644 --- a/app/sprinkles/core/locale/it_IT/errors.php +++ b/app/sprinkles/core/locale/it_IT/errors.php @@ -1,5 +1,6 @@ 'Non riusciamo a trovare quel che cerchi...', 'DETAIL' => 'Abbiamo provato a trovare quello che cercavi...', 'EXPLAIN' => 'Non abbiamo trovato la pagina che stavi cercando.', - 'RETURN' => 'Fai clic qui per tornare alla homepage.' + 'RETURN' => 'Fai clic qui per tornare alla homepage.', ], 'CONFIG' => [ 'TITLE' => 'Problema di configurazione di UserFrosting!', 'DESCRIPTION' => 'Alcuni requisiti di configurazione di UserFrosting non sono stati soddisfatti.', 'DETAIL' => 'Qualcosa qui non va bene.', - 'RETURN' => 'Correggi i seguenti errori, quindi ricarica la pagina.' + 'RETURN' => 'Correggi i seguenti errori, quindi ricarica la pagina.', ], 'DESCRIPTION' => 'Abbiamo notato un grande disturbo della Forza.', @@ -49,6 +50,6 @@ 'SERVER' => 'Sembra esserci un errore nel server. Se sei un admin, controlla i log di PHP o UserFrosting.', - 'TITLE' => 'Disturbo della Forza' - ] + 'TITLE' => 'Disturbo della Forza', + ], ]; diff --git a/app/sprinkles/core/locale/it_IT/messages.php b/app/sprinkles/core/locale/it_IT/messages.php index ae848a2cb..8d336b529 100644 --- a/app/sprinkles/core/locale/it_IT/messages.php +++ b/app/sprinkles/core/locale/it_IT/messages.php @@ -1,5 +1,6 @@ 'Captcha', 'FAIL' => 'Captcha errato', 'SPECIFY' => 'Inserisci il captcha', - 'VERIFY' => 'Verifica captcha' + 'VERIFY' => 'Verifica captcha', ], 'CSRF_MISSING' => 'Token CSRF mancante. Prova ad aggiornare la pagina e poi invia nuovamente la richiesta.', @@ -32,23 +33,23 @@ 'DESCRIPTION' => 'Descrizione', 'DOWNLOAD' => [ '@TRANSLATION' => 'Scarica', - 'CSV' => 'Scarica CSV' + 'CSV' => 'Scarica CSV', ], 'EMAIL' => [ '@TRANSLATION' => 'Email', - 'YOUR' => 'La tua email' + 'YOUR' => 'La tua email', ], 'HOME' => 'Home', 'LEGAL' => [ '@TRANSLATION' => 'Politica legale', - 'DESCRIPTION' => 'La nostra politica legale si applica al tuo utilizzo di questo sito e dei nostri servizi.' + 'DESCRIPTION' => 'La nostra politica legale si applica al tuo utilizzo di questo sito e dei nostri servizi.', ], 'LOCALE' => [ - '@TRANSLATION' => 'Lingua' + '@TRANSLATION' => 'Lingua', ], 'NAME' => 'Nome', @@ -66,11 +67,11 @@ 'NEXT' => 'Pagina successiva', 'PREVIOUS' => 'Pagina precedente', 'FIRST' => 'Prima pagina', - 'LAST' => 'Ultima pagina' + 'LAST' => 'Ultima pagina', ], 'PRIVACY' => [ '@TRANSLATION' => 'Politica sulla riservatezza', - 'DESCRIPTION' => 'La nostra politica sulla privacy descrive quali tipi di informazioni raccoglieremo da te e come le useremo.' + 'DESCRIPTION' => 'La nostra politica sulla privacy descrive quali tipi di informazioni raccoglieremo da te e come le useremo.', ], 'SLUG' => 'Slug', @@ -120,5 +121,5 @@ // Misc. 'BUILT_WITH_UF' => 'Construito con UserFrosting', 'ADMINLTE_THEME_BY' => 'Tema di Almsaeed Studio. Tutti i diritti riservati', - 'WELCOME_TO' => 'Benvenuto su {{title}}!' + 'WELCOME_TO' => 'Benvenuto su {{title}}!', ]; diff --git a/app/sprinkles/core/locale/it_IT/validate.php b/app/sprinkles/core/locale/it_IT/validate.php index c252f56bb..d5dc3931c 100644 --- a/app/sprinkles/core/locale/it_IT/validate.php +++ b/app/sprinkles/core/locale/it_IT/validate.php @@ -1,5 +1,6 @@ [ 'BAD_FILTER' => '{{name}} non è un filtro valido per questo Sprunje.', 'BAD_LIST' => ' {{name}} non è un elenco valido per questo Sprunje.', - 'BAD_SORT' => '{{name}} non è un campo di ordinamento valido per questo Sprunje.' - ] - ] + 'BAD_SORT' => '{{name}} non è un campo di ordinamento valido per questo Sprunje.', + ], + ], ]; diff --git a/app/sprinkles/core/locale/pt_PT/errors.php b/app/sprinkles/core/locale/pt_PT/errors.php index b456361ec..d04e64443 100644 --- a/app/sprinkles/core/locale/pt_PT/errors.php +++ b/app/sprinkles/core/locale/pt_PT/errors.php @@ -1,5 +1,6 @@ 'Parece que não conseguimos encontrar a página que procura.', 'DETAIL' => 'Tentámos encontrar a sua página...', 'EXPLAIN' => 'Não conseguimos encontrar a página que procura.', - 'RETURN' => 'De qualquer forma, clique aqui para regressar à página inicial.' + 'RETURN' => 'De qualquer forma, clique aqui para regressar à página inicial.', ], 'CONFIG' => [ 'TITLE' => 'Problema de Configuração do UserFrosting!', 'DESCRIPTION' => 'Alguns requisitos de configuração do UserFrosting não foram satisfeitos.', 'DETAIL' => 'Algo não está bem.', - 'RETURN' => 'Por favor corrija os seguintes erros, depois refresque a página.' + 'RETURN' => 'Por favor corrija os seguintes erros, depois refresque a página.', ], 'DESCRIPTION' => 'Sentimos uma grande perturbância na Força.', @@ -47,6 +48,6 @@ 'SERVER' => 'Oops, parece que o nosso servidor deu o berro. Se é um administrador, por favor consulte o log de erros PHP ou UF.', - 'TITLE' => 'Perturbância na Força' - ] + 'TITLE' => 'Perturbância na Força', + ], ]; diff --git a/app/sprinkles/core/locale/pt_PT/messages.php b/app/sprinkles/core/locale/pt_PT/messages.php index a8648192a..57978df3a 100644 --- a/app/sprinkles/core/locale/pt_PT/messages.php +++ b/app/sprinkles/core/locale/pt_PT/messages.php @@ -1,5 +1,6 @@ 'Captcha', 'FAIL' => 'Código captcha não introduzido corretamente.', 'SPECIFY' => 'Introduza o código captcha', - 'VERIFY' => 'Verifique o código captcha' + 'VERIFY' => 'Verifique o código captcha', ], 'CSRF_MISSING' => 'Token CSRF em falta. Tente refrescar a página e submeter de novo?', @@ -30,12 +31,12 @@ 'DESCRIPTION' => 'Descrição', 'DOWNLOAD' => [ '@TRANSLATION' => 'Descarregar', - 'CSV' => 'Descarregar CSV' + 'CSV' => 'Descarregar CSV', ], 'EMAIL' => [ '@TRANSLATION' => 'Email', - 'YOUR' => 'O seu endereço de email' + 'YOUR' => 'O seu endereço de email', ], 'HOME' => 'Início', @@ -43,7 +44,7 @@ 'LEGAL' => 'Política Legal', 'LOCALE' => [ - '@TRANSLATION' => 'Localização' + '@TRANSLATION' => 'Localização', ], 'NAME' => 'Nome', @@ -52,7 +53,7 @@ 'PAGINATION' => [ 'GOTO' => 'Saltar para Página', 'SHOW' => 'Mostrar', - 'OUTPUT' => '{startRow} to {endRow} of {filteredRows} ({totalRows})' + 'OUTPUT' => '{startRow} to {endRow} of {filteredRows} ({totalRows})', ], 'PRIVACY' => 'Política de Privacidade', @@ -99,5 +100,5 @@ // Misc. 'BUILT_WITH_UF' => 'Desenvolvido sobre UserFrosting', - 'ADMINLTE_THEME_BY' => 'Tema por Almsaeed Studio. Todos os direitos reservados' + 'ADMINLTE_THEME_BY' => 'Tema por Almsaeed Studio. Todos os direitos reservados', ]; diff --git a/app/sprinkles/core/locale/pt_PT/validate.php b/app/sprinkles/core/locale/pt_PT/validate.php index 85b33f72a..1a314ee7c 100644 --- a/app/sprinkles/core/locale/pt_PT/validate.php +++ b/app/sprinkles/core/locale/pt_PT/validate.php @@ -1,5 +1,6 @@ '{{label}} deve conter entre {{min}} e {{max}} caracteres.', 'NO_LEAD_WS' => 'O valor para {{label}} não pode começar por espaços, tabulações, ou outros espaços em branco.', 'NO_TRAIL_WS' => 'O valor para {{label}} não pode terminar em espaços, tabulações, ou outros espaços em branco.', - 'REQUIRED' => 'Por favor especifique um valor para {{label}}.' - ] + 'REQUIRED' => 'Por favor especifique um valor para {{label}}.', + ], ]; diff --git a/app/sprinkles/core/locale/ru_RU/errors.php b/app/sprinkles/core/locale/ru_RU/errors.php index 2b06d5143..9e4e414c4 100644 --- a/app/sprinkles/core/locale/ru_RU/errors.php +++ b/app/sprinkles/core/locale/ru_RU/errors.php @@ -1,5 +1,6 @@ 'Кажется, мы не можем найти то, что вам нужно.', 'DETAIL' => 'Мы пытались найти вашу страницу...', 'EXPLAIN' => 'Мы не можем найти страницу, которую вы искали.', - 'RETURN' => 'В любом случае, нажмите здесь чтобы вернуться на главную страницу.' + 'RETURN' => 'В любом случае, нажмите здесь чтобы вернуться на главную страницу.', ], 'CONFIG' => [ 'TITLE' => 'Проблема в конфигурации!', 'DESCRIPTION' => 'Некоторые требования к конфигурации UserFrosting, не были соблюдены.', 'DETAIL' => 'Что-то здесь не так.', - 'RETURN' => 'Пожалуйста, исправьте следующие ошибки, затем перезагрузите.' + 'RETURN' => 'Пожалуйста, исправьте следующие ошибки, затем перезагрузите.', ], 'DESCRIPTION' => 'Мы обнаружили большое и сильное нарушение.', @@ -47,6 +48,6 @@ 'SERVER' => 'К сожалению, кажется сервер имеет ошибки. Если вы являетесь администратором сервера, пожалуйста проверьте логи.', - 'TITLE' => 'Сильное нарушение' - ] + 'TITLE' => 'Сильное нарушение', + ], ]; diff --git a/app/sprinkles/core/locale/ru_RU/messages.php b/app/sprinkles/core/locale/ru_RU/messages.php index d0c05b5e8..c94df878f 100644 --- a/app/sprinkles/core/locale/ru_RU/messages.php +++ b/app/sprinkles/core/locale/ru_RU/messages.php @@ -1,5 +1,6 @@ 'Капча', 'FAIL' => 'Код безопасности был введен с ошибками.', 'SPECIFY' => 'Введите код капчи', - 'VERIFY' => 'Проверьте капчу' + 'VERIFY' => 'Проверьте капчу', ], 'CSRF_MISSING' => 'Отсутствует CSRF токен. Попробуйте обновить страницу и повторить попытку ещё раз?', @@ -30,23 +31,23 @@ 'DESCRIPTION' => 'Описание', 'DOWNLOAD' => [ '@TRANSLATION' => 'Скачать', - 'CSV' => 'Скачать CSV' + 'CSV' => 'Скачать CSV', ], 'EMAIL' => [ '@TRANSLATION' => 'Email', - 'YOUR' => 'Ваш e-mail' + 'YOUR' => 'Ваш e-mail', ], 'HOME' => 'Главная', 'LEGAL' => [ '@TRANSLATION' => 'Правовая информация', - 'DESCRIPTION' => 'Наша правовая политика применима к использованию вами данного веб-сайта и наших услуг.' + 'DESCRIPTION' => 'Наша правовая политика применима к использованию вами данного веб-сайта и наших услуг.', ], 'LOCALE' => [ - '@TRANSLATION' => 'Язык' + '@TRANSLATION' => 'Язык', ], 'NAME' => 'Имя', @@ -64,11 +65,11 @@ 'NEXT' => 'Следующая', 'PREVIOUS' => 'Предыдущая', 'FIRST' => 'Первая', - 'LAST' => 'Последняя' + 'LAST' => 'Последняя', ], 'PRIVACY' => [ '@TRANSLATION' => 'Политика конфиденциальности', - 'DESCRIPTION' => 'Наша политика конфиденциальности описывает, какую информацию мы собираем от вас и как мы будем использовать её.' + 'DESCRIPTION' => 'Наша политика конфиденциальности описывает, какую информацию мы собираем от вас и как мы будем использовать её.', ], 'SLUG' => 'Метка', @@ -117,5 +118,5 @@ // Misc. 'BUILT_WITH_UF' => 'Создано через UserFrosting', 'ADMINLTE_THEME_BY' => 'Тема от Almsaeed Studio. Все права защищены', - 'WELCOME_TO' => 'Добро пожаловать на {{title}}!' + 'WELCOME_TO' => 'Добро пожаловать на {{title}}!', ]; diff --git a/app/sprinkles/core/locale/ru_RU/validate.php b/app/sprinkles/core/locale/ru_RU/validate.php index 0e317351d..4a32ef837 100644 --- a/app/sprinkles/core/locale/ru_RU/validate.php +++ b/app/sprinkles/core/locale/ru_RU/validate.php @@ -1,5 +1,6 @@ [ 'BAD_FILTER' => '{{name}} не является допустимым фильтром.', 'BAD_LIST' => '{{name}} не является допустимым списком.', - 'BAD_SORT' => '{{name}} не является допустимым для сортировки полей.' - ] - ] + 'BAD_SORT' => '{{name}} не является допустимым для сортировки полей.', + ], + ], ]; diff --git a/app/sprinkles/core/locale/th_TH/errors.php b/app/sprinkles/core/locale/th_TH/errors.php index d526f0de3..d03070630 100644 --- a/app/sprinkles/core/locale/th_TH/errors.php +++ b/app/sprinkles/core/locale/th_TH/errors.php @@ -1,5 +1,6 @@ 'ดูเหมือนเราจะไม่สามารถหาสิ่งที่คุณต้องการได้', 'DETAIL' => 'เราพยายามได้ที่จะหาหน้าของคุณ...', 'EXPLAIN' => 'เราไม่สามารถหาหน้าที่คุณมองหาอยู่ได้', - 'RETURN' => 'อย่างไรก็ตาม คลิก ที่นี่ เพื่อกลับไปยังหน้าแรก' + 'RETURN' => 'อย่างไรก็ตาม คลิก ที่นี่ เพื่อกลับไปยังหน้าแรก', ], 'CONFIG' => [ 'TITLE' => 'เกิดปัญหาจากการตั้งค่า UserFrosting!', 'DESCRIPTION' => 'การตั้งค่าบางอย่างของ UserFrosting ยังไม่ตรงตามความต้องการ', 'DETAIL' => 'มีบางอย่างไม่ถูกต้องอยู่', - 'RETURN' => 'กรุณาแก้ไขข้อผิดพลาดดังกล่าว จากนั้น โหลดหน้านี้อีกครั้ง' + 'RETURN' => 'กรุณาแก้ไขข้อผิดพลาดดังกล่าว จากนั้น โหลดหน้านี้อีกครั้ง', ], 'DESCRIPTION' => 'เรารู้สึกความโกลาหลในกองทัพได้เป็นอย่างดี', @@ -47,6 +48,6 @@ 'SERVER' => 'โอ้ว ดูเหมือนระบบของเราอาจจะผิดพลาดเอง หากคุณเป็นผู้ดูแล กรุณาตรวจสอบบันทึกข้อผิดพลาดของ PHP หรือ UF', - 'TITLE' => 'เกิดความโกลาหลในกองทัพ' - ] + 'TITLE' => 'เกิดความโกลาหลในกองทัพ', + ], ]; diff --git a/app/sprinkles/core/locale/th_TH/messages.php b/app/sprinkles/core/locale/th_TH/messages.php index f203dfd63..2cd6e3dc8 100644 --- a/app/sprinkles/core/locale/th_TH/messages.php +++ b/app/sprinkles/core/locale/th_TH/messages.php @@ -1,5 +1,6 @@ 'รหัสยืนยัน', 'FAIL' => 'คุณยังกรอกรหัสยืนยันไม่ถูกต้อง', 'SPECIFY' => 'กรอกรหัสยืนยัน', - 'VERIFY' => 'ตรวจสอบรหัสยืนยัน' + 'VERIFY' => 'ตรวจสอบรหัสยืนยัน', ], 'CSRF_MISSING' => 'ไม่พบโทเคน CSRF กรุณารีเฟรชแล้วส่งข้อมูลใหม่', @@ -30,12 +31,12 @@ 'DESCRIPTION' => 'รายละเอียด', 'DOWNLOAD' => [ '@TRANSLATION' => 'ดาวน์โหลด', - 'CSV' => 'ดาวน์โหลด CSV' + 'CSV' => 'ดาวน์โหลด CSV', ], 'EMAIL' => [ '@TRANSLATION' => 'อีเมล', - 'YOUR' => 'ที่อยู่อีเมลของคุณ' + 'YOUR' => 'ที่อยู่อีเมลของคุณ', ], 'HOME' => 'หน้าแรก', @@ -43,7 +44,7 @@ 'LEGAL' => 'นโยบายทางกฎหมาย', 'LOCALE' => [ - '@TRANSLATION' => 'ภาษา' + '@TRANSLATION' => 'ภาษา', ], 'NAME' => 'ชื่อ', @@ -52,7 +53,7 @@ 'PAGINATION' => [ 'GOTO' => 'ข้ามไปยังหน้า', 'SHOW' => 'แสดง', - 'OUTPUT' => '{startRow} to {endRow} of {filteredRows} ({totalRows})' + 'OUTPUT' => '{startRow} to {endRow} of {filteredRows} ({totalRows})', ], 'PRIVACY' => 'นโยบายความเป็นส่วนตัว', @@ -99,5 +100,5 @@ // Misc. 'BUILT_WITH_UF' => 'สร้างด้วย UserFrosting', - 'ADMINLTE_THEME_BY' => 'ธีมโดย Almsaeed Studio สงวนลิขสิทธิ์' + 'ADMINLTE_THEME_BY' => 'ธีมโดย Almsaeed Studio สงวนลิขสิทธิ์', ]; diff --git a/app/sprinkles/core/locale/th_TH/validate.php b/app/sprinkles/core/locale/th_TH/validate.php index bf10729c5..41f984c63 100644 --- a/app/sprinkles/core/locale/th_TH/validate.php +++ b/app/sprinkles/core/locale/th_TH/validate.php @@ -1,5 +1,6 @@ 'ความยาวของ {{label}} จะต้องอยู่ระหว่าง {{min}} ถึง {{max}} ตัวอักษร', 'NO_LEAD_WS' => 'ค่าของ {{label}} ไม่สามารถเริ่มต้นด้วยช่องว่าง หรือ แท็บ', 'NO_TRAIL_WS' => 'ค่าของ {{label}} ไม่สามารถลงท้ายด้วยช่องว่าง หรือ แท็บ', - 'REQUIRED' => 'กรุณากำหนดค่าของ {{label}}' - ] + 'REQUIRED' => 'กรุณากำหนดค่าของ {{label}}', + ], ]; diff --git a/app/sprinkles/core/locale/valitron/ar.php b/app/sprinkles/core/locale/valitron/ar.php index ce711a8f0..0f246f2ff 100644 --- a/app/sprinkles/core/locale/valitron/ar.php +++ b/app/sprinkles/core/locale/valitron/ar.php @@ -1,5 +1,6 @@ "يجب ان يكون تاريخ بهذه الصيغة '%s'", 'dateBefore' => "التاريخ يجب ان يكون قبل '%s'", 'dateAfter' => "التاريخ يجب ان يكون بعد '%s'", - 'contains' => 'يجب ان يحتوي %s' + 'contains' => 'يجب ان يحتوي %s', ]; diff --git a/app/sprinkles/core/locale/valitron/de.php b/app/sprinkles/core/locale/valitron/de.php index 2dd0c4a8c..057edb744 100644 --- a/app/sprinkles/core/locale/valitron/de.php +++ b/app/sprinkles/core/locale/valitron/de.php @@ -1,5 +1,6 @@ 'benötigt zwischen %d und %d Zeichen', 'creditCard' => 'muss eine gültige Kreditkartennummer sein', 'lengthMin' => 'muss mindestens %d Zeichen enthalten', - 'lengthMax' => 'kann nicht mehr als %d Zeichen enthalten' + 'lengthMax' => 'kann nicht mehr als %d Zeichen enthalten', ]; diff --git a/app/sprinkles/core/locale/valitron/el.php b/app/sprinkles/core/locale/valitron/el.php index be3b963ec..04ecb157a 100644 --- a/app/sprinkles/core/locale/valitron/el.php +++ b/app/sprinkles/core/locale/valitron/el.php @@ -1,5 +1,6 @@ 'πρέπει να είναι ένα έγκυρο νούμερο πιστωτικής κάρτας', 'lengthMin' => 'πρέπει να περιέχει περισσότερους από %d χαρακτήρες', 'lengthMax' => 'πρέπει να περιέχει λιγότερους από %d χαρακτήρες', - 'instanceOf' => "πρέπει να είναι αντικείμενο της '%s'" + 'instanceOf' => "πρέπει να είναι αντικείμενο της '%s'", ]; diff --git a/app/sprinkles/core/locale/valitron/en.php b/app/sprinkles/core/locale/valitron/en.php index 33fba40bd..e1eca6c91 100644 --- a/app/sprinkles/core/locale/valitron/en.php +++ b/app/sprinkles/core/locale/valitron/en.php @@ -1,5 +1,6 @@ 'must be a valid credit card number', 'lengthMin' => 'must contain greater than %d characters', 'lengthMax' => 'must contain less than %d characters', - 'instanceOf' => "must be an instance of '%s'" + 'instanceOf' => "must be an instance of '%s'", ]; diff --git a/app/sprinkles/core/locale/valitron/es.php b/app/sprinkles/core/locale/valitron/es.php index 320a5e552..b229aa00e 100644 --- a/app/sprinkles/core/locale/valitron/es.php +++ b/app/sprinkles/core/locale/valitron/es.php @@ -1,5 +1,6 @@ 'debe ser un numero de tarjeta de crédito válido', 'lengthMin' => 'debe contener mas de %d caracteres', 'lengthMax' => 'debe contener menos de %d caracteres', - 'instanceOf' => "debe ser una instancia de '%s'" + 'instanceOf' => "debe ser una instancia de '%s'", ]; diff --git a/app/sprinkles/core/locale/valitron/fr.php b/app/sprinkles/core/locale/valitron/fr.php index 06be7497d..6585190d1 100644 --- a/app/sprinkles/core/locale/valitron/fr.php +++ b/app/sprinkles/core/locale/valitron/fr.php @@ -1,5 +1,6 @@ 'doit être un numéro de carte de crédit valide', 'lengthMin' => 'doit contenir plus de %d caractères', 'lengthMax' => 'doit contenir moins de %d caractères', - 'instanceOf' => "doit être une instance de '%s'" + 'instanceOf' => "doit être une instance de '%s'", ]; diff --git a/app/sprinkles/core/locale/valitron/id.php b/app/sprinkles/core/locale/valitron/id.php index c75ea215f..0b8164837 100644 --- a/app/sprinkles/core/locale/valitron/id.php +++ b/app/sprinkles/core/locale/valitron/id.php @@ -1,5 +1,6 @@ 'harus diantara karakter %d dan %d', 'creditCard' => 'nomor kartu kredit harus valid', 'lengthMin' => 'minimal berisi %d karakter', - 'lengthMax' => 'maksimal berisi %d karakter' + 'lengthMax' => 'maksimal berisi %d karakter', ]; diff --git a/app/sprinkles/core/locale/valitron/it.php b/app/sprinkles/core/locale/valitron/it.php index c25ba5458..0173ac08e 100644 --- a/app/sprinkles/core/locale/valitron/it.php +++ b/app/sprinkles/core/locale/valitron/it.php @@ -1,5 +1,6 @@ 'deve contenere %s', 'boolean' => 'deve essere un booleano', 'lengthBetween' => 'deve essere compreso tra %d e %d caratteri', - 'creditCard' => 'deve essere un numero di carta di credito valido' + 'creditCard' => 'deve essere un numero di carta di credito valido', ]; diff --git a/app/sprinkles/core/locale/valitron/ja.php b/app/sprinkles/core/locale/valitron/ja.php index 46ec8abd9..77f136d8e 100644 --- a/app/sprinkles/core/locale/valitron/ja.php +++ b/app/sprinkles/core/locale/valitron/ja.php @@ -1,5 +1,6 @@ 'は%d〜%d文字で入力してください', 'creditCard' => 'はクレジットカード番号の書式として正しくありません', 'lengthMin' => 'は%d文字以上入力してください', - 'lengthMax' => 'は%d文字以内で入力してください' + 'lengthMax' => 'は%d文字以内で入力してください', ]; diff --git a/app/sprinkles/core/locale/valitron/lv.php b/app/sprinkles/core/locale/valitron/lv.php index bd368ddf6..ab1727562 100644 --- a/app/sprinkles/core/locale/valitron/lv.php +++ b/app/sprinkles/core/locale/valitron/lv.php @@ -1,5 +1,6 @@ 'laukam jāsatur %s', 'boolean' => 'laukam jābūt ir/nav vērtībai', 'lengthBetween' => 'lauka garumam jābūt no %d līdz %d simbolu garam', - 'creditCard' => 'laukam jābūt derīgam kredītkartes numuram' + 'creditCard' => 'laukam jābūt derīgam kredītkartes numuram', ]; diff --git a/app/sprinkles/core/locale/valitron/pt-br.php b/app/sprinkles/core/locale/valitron/pt-br.php index 1d8407993..fa02fdc57 100644 --- a/app/sprinkles/core/locale/valitron/pt-br.php +++ b/app/sprinkles/core/locale/valitron/pt-br.php @@ -1,5 +1,6 @@ "deve ser uma data no formato '%s'", 'dateBefore' => "deve ser uma data anterior a '%s'", 'dateAfter' => "deve ser uma data posterior a '%s'", - 'contains' => 'deve conter %s' + 'contains' => 'deve conter %s', ]; diff --git a/app/sprinkles/core/locale/valitron/ro.php b/app/sprinkles/core/locale/valitron/ro.php index 262c42f92..7f08859ee 100644 --- a/app/sprinkles/core/locale/valitron/ro.php +++ b/app/sprinkles/core/locale/valitron/ro.php @@ -1,5 +1,6 @@ 'trebuie sa fie un card de credit valid', 'lengthMin' => 'trebuie sa contina mai mult de %d caractere', 'lengthMax' => 'trebuie sa contina mai putin de %d caractere', - 'instanceOf' => "trebuie sa fie o instanta a '%s'" + 'instanceOf' => "trebuie sa fie o instanta a '%s'", ]; diff --git a/app/sprinkles/core/locale/valitron/ru.php b/app/sprinkles/core/locale/valitron/ru.php index d6ee800c7..cd713e562 100644 --- a/app/sprinkles/core/locale/valitron/ru.php +++ b/app/sprinkles/core/locale/valitron/ru.php @@ -1,5 +1,6 @@ 'должно содержать от %d до %d символов', 'creditCard' => 'должно быть номером кредитной карты', 'lengthMin' => 'должно содержать более %d символов', - 'lengthMax' => 'должно содержать менее %d символов' + 'lengthMax' => 'должно содержать менее %d символов', ]; diff --git a/app/sprinkles/core/locale/valitron/th.php b/app/sprinkles/core/locale/valitron/th.php index b57f6cb83..e4dd31af7 100644 --- a/app/sprinkles/core/locale/valitron/th.php +++ b/app/sprinkles/core/locale/valitron/th.php @@ -1,5 +1,6 @@ 'จะต้องเป็นหมายเลขบัตรเครดิตที่ถูกต้อง', 'lengthMin' => 'จะต้องมีความยาวมากกว่า %d ตัวอักษร', 'lengthMax' => 'จะต้องมีความยาวน้อยกว่า %d ตัวอักษร', - 'instanceOf' => "จะต้องเป็นกรณีของ '%s'" + 'instanceOf' => "จะต้องเป็นกรณีของ '%s'", ]; diff --git a/app/sprinkles/core/locale/valitron/zh-cn.php b/app/sprinkles/core/locale/valitron/zh-cn.php index 8eaa55277..b114dcfe8 100644 --- a/app/sprinkles/core/locale/valitron/zh-cn.php +++ b/app/sprinkles/core/locale/valitron/zh-cn.php @@ -1,5 +1,6 @@ "日期的格式应该为 '%s'", 'dateBefore' => "日期必须在 '%s' 之前", 'dateAfter' => "日期必须在 '%s' 之后", - 'contains' => '必须包含 %s' + 'contains' => '必须包含 %s', ]; diff --git a/app/sprinkles/core/locale/valitron/zh-tw.php b/app/sprinkles/core/locale/valitron/zh-tw.php index b5e4fc043..98cc15693 100644 --- a/app/sprinkles/core/locale/valitron/zh-tw.php +++ b/app/sprinkles/core/locale/valitron/zh-tw.php @@ -1,5 +1,6 @@ "日期的格式應該為 '%s'", 'dateBefore' => "日期必須在 '%s' 之前", 'dateAfter' => "日期必須在 '%s' 之後", - 'contains' => '必須包含 %s' + 'contains' => '必須包含 %s', ]; diff --git a/app/sprinkles/core/locale/zh_CN/errors.php b/app/sprinkles/core/locale/zh_CN/errors.php index d0d6374b8..db22c4d8e 100644 --- a/app/sprinkles/core/locale/zh_CN/errors.php +++ b/app/sprinkles/core/locale/zh_CN/errors.php @@ -1,5 +1,6 @@ '我们无法找到你想要的东西.', 'DETAIL' => '我们正努力寻找网页...', 'EXPLAIN' => '我们无法找到你想要的网页.', - 'RETURN' => '不管怎样, 点击 这里 返回前一页.' + 'RETURN' => '不管怎样, 点击 这里 返回前一页.', ], 'CONFIG' => [ 'TITLE' => 'UserFrosting 配置问题!', 'DESCRIPTION' => '一些 UserFrosting 配置要求没有达到.', 'DETAIL' => '这里有些东西不正确.', - 'RETURN' => '请更正如下问题, 然后 重新加载.' + 'RETURN' => '请更正如下问题, 然后 重新加载.', ], 'DESCRIPTION' => '我们发现一股强力干扰.', @@ -45,6 +46,6 @@ 'SERVER' => '哦, 看起来我们的服务器出错了. 如果你是管理员, 请检查PHP及UF的logs.', - 'TITLE' => '强力干扰' - ] + 'TITLE' => '强力干扰', + ], ]; diff --git a/app/sprinkles/core/locale/zh_CN/messages.php b/app/sprinkles/core/locale/zh_CN/messages.php index 4ceb89f55..832933739 100644 --- a/app/sprinkles/core/locale/zh_CN/messages.php +++ b/app/sprinkles/core/locale/zh_CN/messages.php @@ -1,5 +1,6 @@ '验证码', 'FAIL' => 'Y验证码输入错误.', 'SPECIFY' => '输入验证码', - 'VERIFY' => '验证' + 'VERIFY' => '验证', ], 'CSRF_MISSING' => ' CSRF 标记丢失. 请尝试重新加载页面?', @@ -30,12 +31,12 @@ 'DESCRIPTION' => '描述', 'DOWNLOAD' => [ '@TRANSLATION' => '下载', - 'CSV' => '下载 CSV 文件' + 'CSV' => '下载 CSV 文件', ], 'EMAIL' => [ '@TRANSLATION' => '邮件', - 'YOUR' => '你的邮件地址' + 'YOUR' => '你的邮件地址', ], 'HOME' => '首页', @@ -43,7 +44,7 @@ 'LEGAL' => '法律政策', 'LOCALE' => [ - '@TRANSLATION' => '本地' + '@TRANSLATION' => '本地', ], 'MAIL_ERROR' => '尝试发送邮件发送致命错误, 联系网站管理员. 如果你是管理员,请检查UF邮件错误日志.', @@ -53,7 +54,7 @@ 'PAGINATION' => [ 'GOTO' => '跳到页', - 'SHOW' => '显示' + 'SHOW' => '显示', ], 'PRIVACY' => '隐私政策', @@ -102,5 +103,5 @@ // Misc. 'BUILT_WITH_UF' => '使用 UserFrosting', - 'ADMINLTE_THEME_BY' => '主题作者 Almsaeed Studio.保留所有权' + 'ADMINLTE_THEME_BY' => '主题作者 Almsaeed Studio.保留所有权', ]; diff --git a/app/sprinkles/core/locale/zh_CN/validate.php b/app/sprinkles/core/locale/zh_CN/validate.php index 070f5f682..6957b834a 100644 --- a/app/sprinkles/core/locale/zh_CN/validate.php +++ b/app/sprinkles/core/locale/zh_CN/validate.php @@ -1,5 +1,6 @@ '请为 {{label}} 确定一个值.', 'SPRUNJE' => [ 'BAD_FILTER' => '{{name}} 不是一个有效的 Sprunje 过滤器.', - 'BAD_SORT' => '{{name}} 不是一个有效的 Sprunje 排序.' - ] - ] + 'BAD_SORT' => '{{name}} 不是一个有效的 Sprunje 排序.', + ], + ], ]; diff --git a/app/sprinkles/core/routes/routes.php b/app/sprinkles/core/routes/routes.php index 9953af940..ce331d976 100755 --- a/app/sprinkles/core/routes/routes.php +++ b/app/sprinkles/core/routes/routes.php @@ -1,5 +1,6 @@ messageTranslator = $translator; @@ -60,16 +63,17 @@ public function setTranslator(MessageTranslator $translator) /** * Adds a raw text message to the cache message stream. * - * @param string $type The type of message, indicating how it will be styled when outputted. Should be set to "success", "danger", "warning", or "info". - * @param string $message The message to be added to the message stream. - * @return self this MessageStream object. + * @param string $type The type of message, indicating how it will be styled when outputted. Should be set to "success", "danger", "warning", or "info". + * @param string $message The message to be added to the message stream. + * + * @return self this MessageStream object. */ public function addMessage($type, $message) { $messages = $this->messages(); $messages[] = [ 'type' => $type, - 'message' => $message + 'message' => $message, ]; $this->saveMessages($messages); @@ -79,13 +83,15 @@ public function addMessage($type, $message) /** * Adds a text message to the cache message stream, translated into the currently selected language. * - * @param string $type The type of message, indicating how it will be styled when outputted. Should be set to "success", "danger", "warning", or "info". - * @param string $messageId The message id for the message to be added to the message stream. - * @param array[string] $placeholders An optional hash of placeholder names => placeholder values to substitute into the translated message. + * @param string $type The type of message, indicating how it will be styled when outputted. Should be set to "success", "danger", "warning", or "info". + * @param string $messageId The message id for the message to be added to the message stream. + * @param array $placeholders An optional hash of placeholder names => placeholder values to substitute into the translated message. + * * @throws \RuntimeException - * @return self this MessageStream object. + * + * @return self this MessageStream object. */ - public function addMessageTranslated($type, $messageId, $placeholders = []) + public function addMessageTranslated($type, $messageId, array $placeholders = []) { if (!$this->messageTranslator) { throw new \RuntimeException('No translator has been set! Please call MessageStream::setTranslator first.'); @@ -148,9 +154,9 @@ abstract public function messages(); abstract public function resetMessageStream(); /** - * Save messages to the stream + * Save messages to the stream. * - * @param string $message + * @param array $messages */ - abstract protected function saveMessages($message); + abstract protected function saveMessages(array $messages); } diff --git a/app/sprinkles/core/src/Alert/CacheAlertStream.php b/app/sprinkles/core/src/Alert/CacheAlertStream.php index 0dc048029..f4c2385b4 100644 --- a/app/sprinkles/core/src/Alert/CacheAlertStream.php +++ b/app/sprinkles/core/src/Alert/CacheAlertStream.php @@ -1,5 +1,6 @@ cache = $cache; - $this->config = $config; + $this->session_id = $sessionId; parent::__construct($messagesKey, $translator); } @@ -56,8 +56,8 @@ public function __construct($messagesKey, MessageTranslator $translator = null, */ public function messages() { - if ($this->cache->tags('_s'.session_id())->has($this->messagesKey)) { - return $this->cache->tags('_s'.session_id())->get($this->messagesKey) ?: []; + if ($this->getCache()->has($this->messagesKey)) { + return $this->getCache()->get($this->messagesKey) ?: []; } else { return []; } @@ -68,16 +68,24 @@ public function messages() */ public function resetMessageStream() { - $this->cache->tags('_s'.session_id())->forget($this->messagesKey); + $this->getCache()->forget($this->messagesKey); } /** - * Save messages to the stream + * Save messages to the stream. * - * @param string $messages The message + * @param array $messages The message + */ + protected function saveMessages(array $messages) + { + $this->getCache()->forever($this->messagesKey, $messages); + } + + /** + * @return \Illuminate\Cache\TaggedCache */ - protected function saveMessages($messages) + protected function getCache() { - $this->cache->tags('_s'.session_id())->forever($this->messagesKey, $messages); + return $this->cache->tags('_s' . $this->session_id); } } diff --git a/app/sprinkles/core/src/Alert/SessionAlertStream.php b/app/sprinkles/core/src/Alert/SessionAlertStream.php index 5a63d0a6c..a646bba7e 100644 --- a/app/sprinkles/core/src/Alert/SessionAlertStream.php +++ b/app/sprinkles/core/src/Alert/SessionAlertStream.php @@ -1,5 +1,6 @@ session[$this->messagesKey] ?: []; + return $this->session->get($this->messagesKey) ?: []; } /** @@ -54,16 +55,16 @@ public function messages() */ public function resetMessageStream() { - $this->session[$this->messagesKey] = []; + $this->session->set($this->messagesKey, []); } /** - * Save messages to the stream + * Save messages to the stream. * - * @param string $messages The message + * @param array $messages The message */ - protected function saveMessages($messages) + protected function saveMessages(array $messages) { - $this->session[$this->messagesKey] = $messages; + $this->session->set($this->messagesKey, $messages); } } diff --git a/app/sprinkles/core/src/Bakery/BakeCommand.php b/app/sprinkles/core/src/Bakery/BakeCommand.php index 170405364..c782cf507 100644 --- a/app/sprinkles/core/src/Bakery/BakeCommand.php +++ b/app/sprinkles/core/src/Bakery/BakeCommand.php @@ -1,5 +1,6 @@ io->writeln('PHP Version : ' . phpversion()); if (version_compare(phpversion(), \UserFrosting\PHP_MIN_VERSION, '<')) { - $this->io->error('UserFrosting requires php version '.\UserFrosting\PHP_MIN_VERSION." or above. You'll need to update you PHP version before you can continue."); + $this->io->error('UserFrosting requires php version ' . \UserFrosting\PHP_MIN_VERSION . " or above. You'll need to update you PHP version before you can continue."); exit(1); } // Check for deprecated versions if (version_compare(phpversion(), \UserFrosting\PHP_RECOMMENDED_VERSION, '<')) { - $this->io->warning('While your PHP version is still supported by UserFrosting, we recommends version '.\UserFrosting\PHP_RECOMMENDED_VERSION.' or above as '.phpversion().' will soon be unsupported. See http://php.net/supported-versions.php for more info.'); + $this->io->warning('While your PHP version is still supported by UserFrosting, we recommends version ' . \UserFrosting\PHP_RECOMMENDED_VERSION . ' or above as ' . phpversion() . ' will soon be unsupported. See http://php.net/supported-versions.php for more info.'); } } /** * List all sprinkles defined in the Sprinkles schema file, - * making sure this file exist at the same time + * making sure this file exist at the same time. * * @param InputInterface $input * @param OutputInterface $output @@ -130,7 +131,7 @@ protected function checkDatabase() } /** - * Display database config as for debug purposes + * Display database config as for debug purposes. */ protected function showConfig() { @@ -145,7 +146,7 @@ protected function showConfig() 'PORT : ' . $config['db.default.port'], 'DATABASE : ' . $config['db.default.database'], 'USERNAME : ' . $config['db.default.username'], - 'PASSWORD : ' . ($config['db.default.password'] ? '*********' : '') + 'PASSWORD : ' . ($config['db.default.password'] ? '*********' : ''), ]); } } diff --git a/app/sprinkles/core/src/Bakery/Helper/ConfirmableTrait.php b/app/sprinkles/core/src/Bakery/Helper/ConfirmableTrait.php index 8cc73fccb..acf3558b0 100644 --- a/app/sprinkles/core/src/Bakery/Helper/ConfirmableTrait.php +++ b/app/sprinkles/core/src/Bakery/Helper/ConfirmableTrait.php @@ -1,5 +1,6 @@ getPdo(); } catch (\PDOException $e) { - $message = "Could not connect to the database '{$dbParams['username']}@{$dbParams['host']}/{$dbParams['database']}':".PHP_EOL; - $message .= 'Exception: ' . $e->getMessage() . PHP_EOL.PHP_EOL; + $message = "Could not connect to the database '{$dbParams['username']}@{$dbParams['host']}/{$dbParams['database']}':" . PHP_EOL; + $message .= 'Exception: ' . $e->getMessage() . PHP_EOL . PHP_EOL; $message .= 'Please check your database configuration and/or google the exception shown above and run command again.'; throw new \Exception($message); } diff --git a/app/sprinkles/core/src/Bakery/Helper/NodeVersionCheck.php b/app/sprinkles/core/src/Bakery/Helper/NodeVersionCheck.php index 29989340f..14cba8e7b 100644 --- a/app/sprinkles/core/src/Bakery/Helper/NodeVersionCheck.php +++ b/app/sprinkles/core/src/Bakery/Helper/NodeVersionCheck.php @@ -1,5 +1,6 @@ io->writeln('Seeding database using class `'.get_class($seedClass).'`'); + $this->io->writeln('Seeding database using class `' . get_class($seedClass) . '`'); // Add seed class to list $seeds[] = $seedClass; diff --git a/app/sprinkles/core/src/Bakery/SeedListCommand.php b/app/sprinkles/core/src/Bakery/SeedListCommand.php index 83595685b..bc15f252b 100644 --- a/app/sprinkles/core/src/Bakery/SeedListCommand.php +++ b/app/sprinkles/core/src/Bakery/SeedListCommand.php @@ -1,5 +1,6 @@ ci->config; @@ -79,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output) 'DB_HOST' => ($dotenvEditor->keyExists('DB_HOST')) ? $dotenvEditor->getValue('DB_HOST') : '', 'DB_NAME' => ($dotenvEditor->keyExists('DB_NAME')) ? $dotenvEditor->getValue('DB_NAME') : '', 'DB_USER' => ($dotenvEditor->keyExists('DB_USER')) ? $dotenvEditor->getValue('DB_USER') : '', - 'DB_PASSWORD' => ($dotenvEditor->keyExists('DB_PASSWORD')) ? $dotenvEditor->getValue('DB_PASSWORD') : '' + 'DB_PASSWORD' => ($dotenvEditor->keyExists('DB_PASSWORD')) ? $dotenvEditor->getValue('DB_PASSWORD') : '', ]; // There may be some custom config or global env values defined on the server. @@ -117,7 +118,7 @@ protected function execute(InputInterface $input, OutputInterface $output) 'DB_PORT' => $dbParams['port'], 'DB_NAME' => $dbParams['database'], 'DB_USER' => $dbParams['username'], - 'DB_PASSWORD' => $dbParams['password'] + 'DB_PASSWORD' => $dbParams['password'], ]; foreach ($fileContent as $key => $value) { @@ -135,10 +136,11 @@ protected function execute(InputInterface $input, OutputInterface $output) } /** - * Ask for database crendentials + * Ask for database crendentials. * - * @param InputInterface $args Command arguments - * @return array The databse credentials + * @param InputInterface $args Command arguments + * + * @return array The databse credentials */ protected function askForDatabase(InputInterface $args) { @@ -171,7 +173,7 @@ protected function askForDatabase(InputInterface $args) 'port' => '', 'database' => $name, 'username' => '', - 'password' => '' + 'password' => '', ]; } else { $defaultPort = $driver['defaultPort']; @@ -192,17 +194,18 @@ protected function askForDatabase(InputInterface $args) 'database' => $name, 'username' => $user, 'password' => $password, - 'charset' => $this->ci->config['db.default.charset'] // Used when replacing config later + 'charset' => $this->ci->config['db.default.charset'], // Used when replacing config later ]; } } /** - * Test new database connecion + * Test new database connecion. + * + * @param array $dbParams Database params + * @param bool $displayMessage Display io message * - * @param array $dbParams Database params - * @param bool $displayMessage Display io message - * @return bool Return true if db is successful + * @return bool Return true if db is successful */ protected function testDatabase($dbParams, $displayMessage = true) { @@ -216,8 +219,8 @@ protected function testDatabase($dbParams, $displayMessage = true) $conn->getPdo(); } catch (\PDOException $e) { if ($displayMessage) { - $message = "Could not connect to the database '{$dbParams['username']}@{$dbParams['host']}/{$dbParams['database']}':".PHP_EOL; - $message .= 'Exception: ' . $e->getMessage() . PHP_EOL.PHP_EOL; + $message = "Could not connect to the database '{$dbParams['username']}@{$dbParams['host']}/{$dbParams['database']}':" . PHP_EOL; + $message .= 'Exception: ' . $e->getMessage() . PHP_EOL . PHP_EOL; $message .= 'Please check your database configuration and/or google the exception shown above and run the command again.'; $this->io->error($message); } @@ -240,31 +243,31 @@ protected function databaseDrivers() 'driver' => 'mysql', 'name' => 'MySQL / MariaDB', 'defaultDBName' => 'userfrosting', - 'defaultPort' => 3306 + 'defaultPort' => 3306, ], [ 'driver' => 'pgsql', 'name' => 'ProgreSQL', 'defaultDBName' => 'userfrosting', - 'defaultPort' => 5432 + 'defaultPort' => 5432, ], [ 'driver' => 'sqlsrv', 'name' => 'SQL Server', 'defaultDBName' => 'userfrosting', - 'defaultPort' => 1433 + 'defaultPort' => 1433, ], [ 'driver' => 'sqlite', 'name' => 'SQLite', 'defaultDBName' => \UserFrosting\DB_DIR . \UserFrosting\DS . 'userfrosting.db', - 'defaultPort' => null - ] + 'defaultPort' => null, + ], ]); } /** - * Returns a list of available drivers + * Returns a list of available drivers. * * @return array */ diff --git a/app/sprinkles/core/src/Bakery/SetupEnvCommand.php b/app/sprinkles/core/src/Bakery/SetupEnvCommand.php index 42bfc5e07..e7beb28d7 100644 --- a/app/sprinkles/core/src/Bakery/SetupEnvCommand.php +++ b/app/sprinkles/core/src/Bakery/SetupEnvCommand.php @@ -1,5 +1,6 @@ ci->config; @@ -87,7 +88,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $keys = [ 'SMTP_HOST' => ($dotenvEditor->keyExists('SMTP_HOST')) ? $dotenvEditor->getValue('SMTP_HOST') : '', 'SMTP_USER' => ($dotenvEditor->keyExists('SMTP_USER')) ? $dotenvEditor->getValue('SMTP_USER') : '', - 'SMTP_PASSWORD' => ($dotenvEditor->keyExists('SMTP_PASSWORD')) ? $dotenvEditor->getValue('SMTP_PASSWORD') : '' + 'SMTP_PASSWORD' => ($dotenvEditor->keyExists('SMTP_PASSWORD')) ? $dotenvEditor->getValue('SMTP_PASSWORD') : '', ]; // There may be some custom config or global env values defined on the server. @@ -120,10 +121,11 @@ protected function execute(InputInterface $input, OutputInterface $output) } /** - * Ask with setup method to use + * Ask with setup method to use. * - * @param InputInterface $input - * @return array The SMTP connection info + * @param InputInterface $input + * + * @return array The SMTP connection info */ protected function askForSmtpMethod(InputInterface $input) { @@ -152,10 +154,11 @@ protected function askForSmtpMethod(InputInterface $input) } /** - * Ask for SMTP credential + * Ask for SMTP credential. + * + * @param InputInterface $input Command arguments * - * @param InputInterface $input Command arguments - * @return array The SMTP connection info + * @return array The SMTP connection info */ protected function askForSmtp(InputInterface $input) { @@ -170,15 +173,16 @@ protected function askForSmtp(InputInterface $input) return [ 'SMTP_HOST' => $smtpHost, 'SMTP_USER' => $smtpUser, - 'SMTP_PASSWORD' => $smtpPassword + 'SMTP_PASSWORD' => $smtpPassword, ]; } /** - * Ask for Gmail + * Ask for Gmail. * - * @param InputInterface $input Command arguments - * @return array The SMTP connection info + * @param InputInterface $input Command arguments + * + * @return array The SMTP connection info */ protected function askForGmail(InputInterface $input) { @@ -191,15 +195,16 @@ protected function askForGmail(InputInterface $input) return [ 'SMTP_HOST' => 'smtp.gmail.com', 'SMTP_USER' => $smtpUser, - 'SMTP_PASSWORD' => $smtpPassword + 'SMTP_PASSWORD' => $smtpPassword, ]; } /** - * Process the "no email support" setup option + * Process the "no email support" setup option. + * + * @param InputInterface $input * - * @param InputInterface $input - * @return array The SMTP connection info + * @return array The SMTP connection info */ protected function askForNone(InputInterface $input) { @@ -210,7 +215,7 @@ protected function askForNone(InputInterface $input) return [ 'SMTP_HOST' => '', 'SMTP_USER' => '', - 'SMTP_PASSWORD' => '' + 'SMTP_PASSWORD' => '', ]; } else { $this->askForSmtpMethod($input); @@ -220,8 +225,9 @@ protected function askForNone(InputInterface $input) /** * Check if the app/.env SMTP portion is defined or not. * - * @param DotenvEditor $dotenvEditor - * @return bool true if SMTP is configured in .env file + * @param DotenvEditor $dotenvEditor + * + * @return bool true if SMTP is configured in .env file */ protected function isSmtpConfigured(DotenvEditor $dotenvEditor) { diff --git a/app/sprinkles/core/src/Bakery/SprinkleListCommand.php b/app/sprinkles/core/src/Bakery/SprinkleListCommand.php index 1f902cbaa..284b2e777 100644 --- a/app/sprinkles/core/src/Bakery/SprinkleListCommand.php +++ b/app/sprinkles/core/src/Bakery/SprinkleListCommand.php @@ -1,5 +1,6 @@ from($config['address_book.admin']) ->addEmailRecipient(new EmailRecipient($to, $to)) ->addParams([ - 'request_date' => Carbon::now()->format('Y-m-d H:i:s') + 'request_date' => Carbon::now()->format('Y-m-d H:i:s'), ]); try { diff --git a/app/sprinkles/core/src/Controller/CoreController.php b/app/sprinkles/core/src/Controller/CoreController.php index c0c7f2a5f..fff89b494 100644 --- a/app/sprinkles/core/src/Controller/CoreController.php +++ b/app/sprinkles/core/src/Controller/CoreController.php @@ -1,5 +1,6 @@ ['onSprinklesInitialized', 0], 'onSprinklesRegisterServices' => ['onSprinklesRegisterServices', 0], 'onAddGlobalMiddleware' => ['onAddGlobalMiddleware', 0], - 'onAppInitialize' => ['onAppInitialize', 0] + 'onAppInitialize' => ['onAppInitialize', 0], ]; } @@ -95,7 +96,7 @@ public function onSprinklesRegisterServices() '1', 'on', 'true', - 'yes' + 'yes', ])) { $displayErrors = true; } @@ -105,7 +106,7 @@ public function onSprinklesRegisterServices() } /** - * Register routes + * Register routes. * * @param Event $event */ @@ -125,7 +126,7 @@ public function onAddGlobalMiddleware(Event $event) } /** - * Register Core sprinkle locator streams + * Register Core sprinkle locator streams. */ protected function registerStreams() { @@ -149,6 +150,5 @@ protected function registerStreams() // Register core sprinkle class streams $locator->registerStream('seeds', '', \UserFrosting\SEEDS_DIR); $locator->registerStream('migrations', '', \UserFrosting\MIGRATIONS_DIR); - } } diff --git a/app/sprinkles/core/src/Csrf/CsrfProviderInterface.php b/app/sprinkles/core/src/Csrf/CsrfProviderInterface.php index de7adc450..7b9d21fc9 100644 --- a/app/sprinkles/core/src/Csrf/CsrfProviderInterface.php +++ b/app/sprinkles/core/src/Csrf/CsrfProviderInterface.php @@ -1,5 +1,6 @@ addUserMessage('CSRF_MISSING'); - throw $e; + throw $e; return $next($request, $response); }; diff --git a/app/sprinkles/core/src/Database/Builder.php b/app/sprinkles/core/src/Database/Builder.php index 12ec3b1c9..a1cb87dc3 100644 --- a/app/sprinkles/core/src/Database/Builder.php +++ b/app/sprinkles/core/src/Database/Builder.php @@ -1,5 +1,6 @@ query->columns)) { - $this->query->select([$this->query->from.'.*']); + $this->query->select([$this->query->from . '.*']); } $function = Str::lower($function); @@ -108,7 +114,7 @@ public function withAggregate($relations, $function = 'COUNT') $relation = $this->getRelationWithoutConstraints($name); - $expression = new Expression($function.'('.$this->query->getGrammar()->wrap($column).')'); + $expression = new Expression($function . '(' . $this->query->getGrammar()->wrap($column) . ')'); // Here we will get the relationship aggregate query and prepare to add it to the main query // as a sub-select. First, we'll get the "has" query and use that to get the relation @@ -126,7 +132,7 @@ public function withAggregate($relations, $function = 'COUNT') // Finally we will add the proper result column alias to the query and run the subselect // statement against the query builder. Then we will return the builder instance back // to the developer for further constraint chaining that needs to take place on it. - $column = snake_case(isset($alias) ? $alias : $name).'_'.$function; + $column = snake_case(isset($alias) ? $alias : $name) . '_' . $function; $this->selectSub($query->toBase(), $column); } diff --git a/app/sprinkles/core/src/Database/Migration.php b/app/sprinkles/core/src/Database/Migration.php index a9d805add..cdadb67ed 100644 --- a/app/sprinkles/core/src/Database/Migration.php +++ b/app/sprinkles/core/src/Database/Migration.php @@ -1,5 +1,6 @@ $dependency) { $messages[] = "=> $migration (Missing dependency : $dependency)"; } + throw new \Exception(implode("\n", $messages)); } @@ -108,8 +111,9 @@ public function run(array $options = []) /** * Get the migration classes that have not yet run. * - * @param array $available The available migrations returned by the migration locator - * @param array $ran The list of already ran migrations returned by the migration repository + * @param array $available The available migrations returned by the migration locator + * @param array $ran The list of already ran migrations returned by the migration repository + * * @return array The list of pending migrations, ie the available migrations not ran yet */ protected function pendingMigrations(array $available, array $ran) @@ -151,7 +155,7 @@ protected function runPending(array $migrations, array $options = []) } /** - * Run "up" a migration class + * Run "up" a migration class. * * @param string $migrationClassName The migration class name * @param int $batch The current bacth number @@ -195,7 +199,8 @@ protected function runUp($migrationClassName, $batch, $pretend) /** * Rollback the last migration operation. * - * @param array $options The options for the current operation [steps, pretend] + * @param array $options The options for the current operation [steps, pretend] + * * @return array The list of rolledback migration classes */ public function rollback(array $options = []) @@ -215,11 +220,12 @@ public function rollback(array $options = []) } /** - * Rollback a specific migration + * Rollback a specific migration. + * + * @param string $migrationClassName The Migration to rollback + * @param array $options * - * @param string $migrationClassName The Migration to rollback - * @param array $options - * @return array The list of rolledback migration classes + * @return array The list of rolledback migration classes */ public function rollbackMigration($migrationClassName, array $options = []) { @@ -241,7 +247,8 @@ public function rollbackMigration($migrationClassName, array $options = []) /** * Get the migrations for a rollback operation. * - * @param array $options The options for the current operation + * @param array $options The options for the current operation + * * @return array An ordered array of migrations to rollback */ protected function getMigrationsForRollback(array $options) @@ -257,8 +264,9 @@ protected function getMigrationsForRollback(array $options) /** * Rollback the given migrations. * - * @param array $migrations An array of migrations to rollback formated as an eloquent collection - * @param array $options The options for the current operation + * @param array $migrations An array of migrations to rollback formated as an eloquent collection + * @param array $options The options for the current operation + * * @return array The list of rolledback migration classes */ protected function rollbackMigrations(array $migrations, array $options) @@ -303,7 +311,8 @@ protected function rollbackMigrations(array $migrations, array $options) /** * Check if migrations can be rolledback. * - * @param array $migrations The migrations classes to rollback + * @param array $migrations The migrations classes to rollback + * * @throws \Exception If rollback can't be performed */ protected function checkRollbackDependencies(array $migrations) @@ -320,6 +329,7 @@ protected function checkRollbackDependencies(array $migrations) foreach ($unfulfillable as $migration => $dependency) { $messages[] = "=> $dependency is a dependency of $migration"; } + throw new \Exception(implode("\n", $messages)); } } @@ -327,7 +337,8 @@ protected function checkRollbackDependencies(array $migrations) /** * Rolls all of the currently applied migrations back. * - * @param bool $pretend Should this operation be pretended + * @param bool $pretend Should this operation be pretended + * * @return array An array of all the rolledback migration classes */ public function reset($pretend = false) @@ -377,7 +388,7 @@ protected function runDown($migrationClassName, $pretend) /** * Run a migration inside a transaction if the database supports it. - * Note : As of Laravel 5.4, only PostgresGrammar supports it + * Note : As of Laravel 5.4, only PostgresGrammar supports it. * * @param MigrationInterface $migration The migration instance * @param string $method The method used [up, down] @@ -417,9 +428,10 @@ protected function pretendToRun(MigrationInterface $migration, $method) /** * Get all of the queries that would be run for a migration. * - * @param MigrationInterface $migration The migration instance - * @param string $method The method used [up, down] - * @return array The queries executed by the processed schema + * @param MigrationInterface $migration The migration instance + * @param string $method The method used [up, down] + * + * @return array The queries executed by the processed schema */ protected function getQueries(MigrationInterface $migration, $method) { @@ -434,7 +446,8 @@ protected function getQueries(MigrationInterface $migration, $method) /** * Resolve a migration instance from it's class name. * - * @param string $migrationClassName The class name + * @param string $migrationClassName The class name + * * @return MigrationInterface The migration class instance */ public function resolve($migrationClassName) @@ -446,7 +459,7 @@ public function resolve($migrationClassName) $migration = new $migrationClassName($this->getSchemaBuilder()); if (!$migration instanceof MigrationInterface) { - throw new \Exception('Migration must be an instance of `'.MigrationInterface::class.'`'); + throw new \Exception('Migration must be an instance of `' . MigrationInterface::class . '`'); } return $migration; @@ -463,10 +476,11 @@ public function getAvailableMigrations() } /** - * Get a list of all ran migrations + * Get a list of all ran migrations. + * + * @param int $steps Number of batch to return + * @param string $order asc|desc * - * @param int $steps Number of batch to return - * @param string $order asc|desc * @return array */ public function getRanMigrations($steps = -1, $order = 'asc') @@ -475,7 +489,7 @@ public function getRanMigrations($steps = -1, $order = 'asc') } /** - * Get a list of pending migrations + * Get a list of pending migrations. * * @return array */ @@ -498,7 +512,7 @@ public function getRepository() } /** - * Set the migration repository instance + * Set the migration repository instance. * * @param MigrationRepositoryInterface $repository */ @@ -528,7 +542,7 @@ public function getLocator() } /** - * Set the migration locator instance + * Set the migration locator instance. * * @param MigrationLocatorInterface $locator */ @@ -548,7 +562,7 @@ public function getSchemaBuilder() } /** - * Return the connection instance + * Return the connection instance. * * @return \Illuminate\Database\Connection */ @@ -558,7 +572,7 @@ public function getConnection() } /** - * Define which connection to use + * Define which connection to use. * * @param string $name The connection name */ @@ -569,7 +583,8 @@ public function setConnection($name) } /** - * Get instance of Grammar + * Get instance of Grammar. + * * @return \Illuminate\Database\Schema\Grammars\Grammar */ protected function getSchemaGrammar() diff --git a/app/sprinkles/core/src/Database/Models/Concerns/HasRelationships.php b/app/sprinkles/core/src/Database/Models/Concerns/HasRelationships.php index 948a88c76..adf131fca 100644 --- a/app/sprinkles/core/src/Database/Models/Concerns/HasRelationships.php +++ b/app/sprinkles/core/src/Database/Models/Concerns/HasRelationships.php @@ -1,5 +1,6 @@ newQuery(), $this, - $instance->getTable().'.'.$foreignKey, + $instance->getTable() . '.' . $foreignKey, $localKey ); } @@ -60,11 +63,12 @@ public function hasMany($related, $foreignKey = null, $localKey = null) /** * Overrides the default Eloquent morphMany relationship to return a MorphManySyncable. * - * @param string $related - * @param string $name - * @param string $type - * @param string $id - * @param string $localKey + * @param string $related + * @param string $name + * @param string $type + * @param string $id + * @param string $localKey + * * @return MorphManySyncable */ public function morphMany($related, $name, $type = null, $id = null, $localKey = null) @@ -78,23 +82,24 @@ public function morphMany($related, $name, $type = null, $id = null, $localKey = $table = $instance->getTable(); $localKey = $localKey ?: $this->getKeyName(); - return new MorphManySyncable($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $localKey); + return new MorphManySyncable($instance->newQuery(), $this, $table . '.' . $type, $table . '.' . $id, $localKey); } /** * Define a many-to-many 'through' relationship. * This is basically hasManyThrough for many-to-many relationships. * - * @param string $related - * @param string $through - * @param string $firstJoiningTable - * @param string $firstForeignKey - * @param string $firstRelatedKey - * @param string $secondJoiningTable - * @param string $secondForeignKey - * @param string $secondRelatedKey - * @param string $throughRelation - * @param string $relation + * @param string $related + * @param string $through + * @param string $firstJoiningTable + * @param string $firstForeignKey + * @param string $firstRelatedKey + * @param string $secondJoiningTable + * @param string $secondForeignKey + * @param string $secondRelatedKey + * @param string $throughRelation + * @param string $relation + * * @return BelongsToManyThrough */ public function belongsToManyThrough( @@ -162,11 +167,12 @@ public function belongsToManyThrough( * Define a unique many-to-many relationship. Similar to a regular many-to-many relationship, but removes duplicate child objects. * Can also be used to implement ternary relationships. * - * @param string $related - * @param string $table - * @param string $foreignKey - * @param string $relatedKey - * @param string $relation + * @param string $related + * @param string $table + * @param string $foreignKey + * @param string $relatedKey + * @param string $relation + * * @return BelongsToManyUnique */ public function belongsToManyUnique($related, $table = null, $foreignKey = null, $relatedKey = null, $relation = null) @@ -207,12 +213,13 @@ public function belongsToManyUnique($related, $table = null, $foreignKey = null, /** * Define a unique morphs-to-many relationship. Similar to a regular morphs-to-many relationship, but removes duplicate child objects. * - * @param string $related - * @param string $name - * @param string $table - * @param string $foreignKey - * @param string $otherKey - * @param bool $inverse + * @param string $related + * @param string $name + * @param string $table + * @param string $foreignKey + * @param string $otherKey + * @param bool $inverse + * * @return MorphToManyUnique */ public function morphToManyUnique($related, $name, $table = null, $foreignKey = null, $otherKey = null, $inverse = false) @@ -222,7 +229,7 @@ public function morphToManyUnique($related, $name, $table = null, $foreignKey = // First, we will need to determine the foreign key and "other key" for the // relationship. Once we have determined the keys we will make the query // instances, as well as the relationship instances we need for these. - $foreignKey = $foreignKey ?: $name.'_id'; + $foreignKey = $foreignKey ?: $name . '_id'; $instance = new $related(); @@ -253,12 +260,14 @@ public function morphToManyUnique($related, $name, $table = null, $foreignKey = * This has been superseded by the belongsToManyUnique relationship's `withTernary` method since 4.1.7. * * @deprecated since 4.1.6 - * @param string $related - * @param string $constraintKey - * @param string $table - * @param string $foreignKey - * @param string $relatedKey - * @param string $relation + * + * @param string $related + * @param string $constraintKey + * @param string $table + * @param string $foreignKey + * @param string $relatedKey + * @param string $relation + * * @return BelongsToManyConstrained */ public function belongsToManyConstrained($related, $constraintKey, $table = null, $foreignKey = null, $relatedKey = null, $relation = null) diff --git a/app/sprinkles/core/src/Database/Models/Model.php b/app/sprinkles/core/src/Database/Models/Model.php index 26ef167c1..33b7cbbb3 100644 --- a/app/sprinkles/core/src/Database/Models/Model.php +++ b/app/sprinkles/core/src/Database/Models/Model.php @@ -1,5 +1,6 @@ foreignKey, $this->relatedKey]; $aliasedPivotColumns = collect(array_merge($defaults, $this->pivotColumns))->map(function ($column) { - return $this->table.'.'.$column.' as pivot_'.$column; + return $this->table . '.' . $column . ' as pivot_' . $column; }); $parentKeyName = $this->getParentKeyName(); diff --git a/app/sprinkles/core/src/Database/Relations/BelongsToManyUnique.php b/app/sprinkles/core/src/Database/Relations/BelongsToManyUnique.php index 60a98b799..5c608a966 100644 --- a/app/sprinkles/core/src/Database/Relations/BelongsToManyUnique.php +++ b/app/sprinkles/core/src/Database/Relations/BelongsToManyUnique.php @@ -1,5 +1,6 @@ query->getQuery()->unions) + * * @see \Illuminate\Database\Query\Builder - * @param int $value + * + * @param int $value + * * @return self */ public function offset($value) @@ -92,7 +97,8 @@ public function offset($value) /** * Alias to set the "limit" value of the query. * - * @param int $value + * @param int $value + * * @return self */ public function take($value) @@ -104,8 +110,11 @@ public function take($value) * Set the "limit" value of the query. * * @todo Implement for 'unionLimit' as well? (By checking the value of $this->query->getQuery()->unions) + * * @see \Illuminate\Database\Query\Builder - * @param int $value + * + * @param int $value + * * @return self */ public function limit($value) @@ -121,7 +130,9 @@ public function limit($value) * Set the limit on the number of intermediate models to load. * * @deprecated since 4.1.7 - * @param int $value + * + * @param int $value + * * @return $this */ public function withLimit($value) @@ -133,7 +144,9 @@ public function withLimit($value) * Set the offset when loading the intermediate models. * * @deprecated since 4.1.7 - * @param int $value + * + * @param int $value + * * @return $this */ public function withOffset($value) @@ -144,10 +157,11 @@ public function withOffset($value) /** * Add a query to load the nested tertiary models for this relationship. * - * @param string $tertiaryRelated - * @param string $tertiaryRelationName - * @param string $tertiaryKey - * @param callable $tertiaryCallback + * @param string $tertiaryRelated + * @param string $tertiaryRelationName + * @param string $tertiaryKey + * @param callable $tertiaryCallback + * * @return self */ public function withTertiary($tertiaryRelated, $tertiaryRelationName = null, $tertiaryKey = null, $tertiaryCallback = null) @@ -175,6 +189,7 @@ public function withTertiary($tertiaryRelated, $tertiaryRelationName = null, $te * Return the count of child models for this relationship. * * @see http://stackoverflow.com/a/29728129/2970321 + * * @return int */ public function count() @@ -190,8 +205,10 @@ public function count() * Add the constraints for a relationship count query. * * @see \Illuminate\Database\Eloquent\Relations\Relation - * @param Builder $query - * @param Builder $parentQuery + * + * @param Builder $query + * @param Builder $parentQuery + * * @return Builder */ public function getRelationExistenceCountQuery(Builder $query, Builder $parentQuery) @@ -204,11 +221,12 @@ public function getRelationExistenceCountQuery(Builder $query, Builder $parentQu } /** - * Match the eagerly loaded results to their parents + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param Collection $results + * @param string $relation * - * @param array $models - * @param Collection $results - * @param string $relation * @return array */ public function match(array $models, Collection $results, $relation) @@ -246,7 +264,8 @@ public function match(array $models, Collection $results, $relation) * Execute the query as a "select" statement, getting all requested models * and matching up any tertiary models. * - * @param array $columns + * @param array $columns + * * @return Collection */ public function get($columns = ['*']) @@ -264,9 +283,10 @@ public function get($columns = ['*']) * If we are applying either a limit or offset, we'll first determine a limited/offset list of model ids * to select from in the final query. * - * @param Builder $query - * @param int $limit - * @param int $offset + * @param Builder $query + * @param int $limit + * @param int $offset + * * @return Builder */ public function getPaginatedQuery(Builder $query, $limit = null, $offset = null) @@ -323,8 +343,9 @@ public function getEager() * Get the hydrated models and eager load their relations, optionally * condensing the set of models before performing the eager loads. * - * @param array $columns - * @param bool $condenseModels + * @param array $columns + * @param bool $condenseModels + * * @return Collection */ public function getModels($columns = ['*'], $condenseModels = true) @@ -370,7 +391,9 @@ public function getModels($columns = ['*'], $condenseModels = true) * * Before doing this, we may optionally find any tertiary models that should be * set as sub-relations on these models. - * @param array $models + * + * @param array $models + * * @return array */ protected function condenseModels(array $models) @@ -398,8 +421,9 @@ protected function condenseModels(array $models) * that maps parent ids to arrays of related ids, which in turn map to arrays * of tertiary models corresponding to each relationship. * - * @param Collection $results - * @param string $parentKey + * @param Collection $results + * @param string $parentKey + * * @return array */ protected function buildDictionary(Collection $results, $parentKey = null) @@ -461,7 +485,8 @@ protected function buildDictionary(Collection $results, $parentKey = null) /** * Build dictionary of tertiary models keyed by the corresponding related model keys. * - * @param array $models + * @param array $models + * * @return array */ protected function buildTertiaryDictionary(array $models) @@ -486,7 +511,7 @@ protected function buildTertiaryDictionary(array $models) } /** - * Transfer the pivot to the tertiary model + * Transfer the pivot to the tertiary model. * * @param Model $model * @param Model $tertiaryModel @@ -511,7 +536,8 @@ protected function transferPivotsToTertiary($model, $tertiaryModel) /** * Get the tertiary models for the relationship. * - * @param array $models + * @param array $models + * * @return Collection */ protected function getTertiaryModels(array $models) diff --git a/app/sprinkles/core/src/Database/Relations/HasManySyncable.php b/app/sprinkles/core/src/Database/Relations/HasManySyncable.php index ca35e93b6..215fc6ad2 100644 --- a/app/sprinkles/core/src/Database/Relations/HasManySyncable.php +++ b/app/sprinkles/core/src/Database/Relations/HasManySyncable.php @@ -1,5 +1,6 @@ ci->locator->listResources($this->scheme, false, false); - + return $this->loadSeeders($seeds); } /** - * Get a single seed info + * Get a single seed info. + * + * @param string $name The seed name * - * @param string $name The seed name * @throws \Exception If seed not found - * @return array The details about a seed file [name, class, sprinkle] + * + * @return array The details about a seed file [name, class, sprinkle] */ public function getSeed($name) { @@ -76,10 +79,12 @@ public function getSeed($name) } /** - * Return the class instance of a seed + * Return the class instance of a seed. + * + * @param string $name The seed name + * + * @throws \Exception If class doesn't exist or is not right interface * - * @param string $name The seed name - * @throws \Exception If class doesn't exist or is not right interface * @return SeedInterface The seed class instance */ public function getSeedClass($name) @@ -105,7 +110,7 @@ public function getSeedClass($name) } /** - * Execute a seed class + * Execute a seed class. * * @param SeedInterface $seed The seed to execute */ @@ -115,7 +120,7 @@ public function executeSeed(SeedInterface $seed) } /** - * Execute a seed based on it's name + * Execute a seed based on it's name. * * @param string $seedName */ @@ -126,9 +131,10 @@ public function execute($seedName) } /** - * Process seeder Resource into info + * Process seeder Resource into info. + * + * @param array $seedFiles List of seeds file * - * @param array $seedFiles List of seeds file * @return array */ protected function loadSeeders(array $seedFiles) @@ -142,10 +148,11 @@ protected function loadSeeders(array $seedFiles) } /** - * Return an array of seed details inclusing the classname and the sprinkle name + * Return an array of seed details inclusing the classname and the sprinkle name. + * + * @param ResourceInstance $file The seed file * - * @param ResourceInstance $file The seed file - * @return array The details about a seed file [name, class, sprinkle] + * @return array The details about a seed file [name, class, sprinkle] */ protected function getSeedDetails(ResourceInstance $file) { @@ -162,7 +169,7 @@ protected function getSeedDetails(ResourceInstance $file) return [ 'name' => $name, 'class' => "\\UserFrosting\\Sprinkle\\$sprinkleName\\Database\\Seeds\\$className", - 'sprinkle' => $sprinkleName + 'sprinkle' => $sprinkleName, ]; } } diff --git a/app/sprinkles/core/src/Error/ExceptionHandlerManager.php b/app/sprinkles/core/src/Error/ExceptionHandlerManager.php index 544b83b92..3cbab50db 100755 --- a/app/sprinkles/core/src/Error/ExceptionHandlerManager.php +++ b/app/sprinkles/core/src/Error/ExceptionHandlerManager.php @@ -1,5 +1,6 @@ withStatus($httpCode) ->withHeader('Content-type', $this->contentType) ->write($template->render([ - 'messages' => $messages + 'messages' => $messages, ])); } /** - * Write to the error log + * Write to the error log. */ public function writeToErrorLog() { @@ -189,9 +190,10 @@ public function writeAlerts() /** * Determine which renderer to use based on content type - * Overloaded $renderer from calling class takes precedence over all + * Overloaded $renderer from calling class takes precedence over all. * * @throws \RuntimeException + * * @return \UserFrosting\Sprinkle\Core\Error\Renderer\ErrorRendererInterface */ protected function determineRenderer() @@ -255,12 +257,12 @@ protected function determineStatusCode() protected function determineUserMessages() { return [ - new UserMessage('ERROR.SERVER') + new UserMessage('ERROR.SERVER'), ]; } /** - * Monolog logging for errors + * Monolog logging for errors. * * @param string $message */ diff --git a/app/sprinkles/core/src/Error/Handler/ExceptionHandlerInterface.php b/app/sprinkles/core/src/Error/Handler/ExceptionHandlerInterface.php index b6146e412..2f113b0b3 100644 --- a/app/sprinkles/core/src/Error/Handler/ExceptionHandlerInterface.php +++ b/app/sprinkles/core/src/Error/Handler/ExceptionHandlerInterface.php @@ -1,5 +1,6 @@ setEditor('sublime'); * - * @param string|callable $editor + * @param string|callable $editor + * * @throws InvalidArgumentException If invalid argument identifier provided */ public function setEditor($editor) @@ -443,9 +451,11 @@ public function setEditor($editor) * a string that may be used as the href property for that * file reference. * - * @param string $filePath - * @param int $line + * @param string $filePath + * @param int $line + * * @throws InvalidArgumentException If editor resolver does not return a string + * * @return string|bool */ public function getEditorHref($filePath, $line) @@ -473,11 +483,13 @@ public function getEditorHref($filePath, $line) /** * Given a boolean if the editor link should * act as an Ajax request. The editor must be a - * valid callable function/closure + * valid callable function/closure. + * + * @param string $filePath + * @param int $line * - * @param string $filePath - * @param int $line * @throws UnexpectedValueException If editor resolver does not return a boolean + * * @return bool */ public function getEditorAjax($filePath, $line) @@ -514,7 +526,8 @@ public function getPageTitle() * Adds a path to the list of paths to be searched for * resources. * - * @param string $path + * @param string $path + * * @throws InvalidArgumentException If $path is not a valid directory */ public function addResourcePath($path) @@ -548,6 +561,7 @@ public function getResourcePaths() /** * @deprecated + * * @return string */ public function getResourcesPath() @@ -560,6 +574,7 @@ public function getResourcesPath() /** * @deprecated + * * @param string $resourcesPath */ public function setResourcesPath($resourcesPath) @@ -600,10 +615,11 @@ public function setApplicationRootPath($applicationRootPath) /** * Given a boolean if the editor link should * act as an Ajax request. The editor must be a - * valid callable function/closure + * valid callable function/closure. + * + * @param string $filePath + * @param int $line * - * @param string $filePath - * @param int $line * @return array */ protected function getEditor($filePath, $line) @@ -664,8 +680,10 @@ protected function getInspector() * way back to the first, enabling a cascading-type system of overrides * for all resources. * - * @param string $resource + * @param string $resource + * * @throws RuntimeException If resource cannot be found in any of the available paths + * * @return string */ protected function getResource($resource) @@ -692,7 +710,7 @@ protected function getResource($resource) // If we got this far, nothing was found. throw new RuntimeException( "Could not find resource '$resource' in any resource paths." - . '(searched: ' . join(', ', $this->searchPaths). ')' + . '(searched: ' . implode(', ', $this->searchPaths) . ')' ); } @@ -702,9 +720,10 @@ protected function getResource($resource) * * We intentionally dont rely on $GLOBALS as it depends on 'auto_globals_jit' php.ini setting. * - * @param array $superGlobal One of the superglobal arrays - * @param string $superGlobalName the name of the superglobal array, e.g. '_GET' - * @return array $values without sensitive data + * @param array $superGlobal One of the superglobal arrays + * @param string $superGlobalName the name of the superglobal array, e.g. '_GET' + * + * @return array $values without sensitive data */ private function masked(array $superGlobal, $superGlobalName) { diff --git a/app/sprinkles/core/src/Error/Renderer/XmlRenderer.php b/app/sprinkles/core/src/Error/Renderer/XmlRenderer.php index ac3c0e267..8430e3793 100755 --- a/app/sprinkles/core/src/Error/Renderer/XmlRenderer.php +++ b/app/sprinkles/core/src/Error/Renderer/XmlRenderer.php @@ -1,5 +1,6 @@ cc[] = [ 'email' => $email, - 'name' => $name + 'name' => $name, ]; } @@ -81,7 +82,7 @@ public function bcc($email, $name = '') { $this->bcc[] = [ 'email' => $email, - 'name' => $name + 'name' => $name, ]; } diff --git a/app/sprinkles/core/src/Mail/MailMessage.php b/app/sprinkles/core/src/Mail/MailMessage.php index 6f0542a26..48b598b0b 100644 --- a/app/sprinkles/core/src/Mail/MailMessage.php +++ b/app/sprinkles/core/src/Mail/MailMessage.php @@ -1,5 +1,6 @@ config; if ($config['alert.storage'] == 'cache') { - return new CacheAlertStream($config['alert.key'], $c->translator, $c->cache, $c->config); + return new CacheAlertStream($config['alert.key'], $c->translator, $c->cache, $c->session->getId()); } elseif ($config['alert.storage'] == 'session') { return new SessionAlertStream($config['alert.key'], $c->translator, $c->session); } else { @@ -96,7 +97,7 @@ public function register(ContainerInterface $container) } }; - /** + /* * Asset loader service * * Loads assets from a specified relative location. @@ -109,7 +110,7 @@ public function register(ContainerInterface $container) return new AssetLoader($c->assets); }; - /** + /* * Asset manager service. * * Loads raw or compiled asset information from your bundle.config.json schema file. @@ -153,21 +154,23 @@ public function register(ContainerInterface $container) } else { // Register compiled assets stream in public folder + alias for vendor ones + build stream for CompiledAssetBundles - $c->locator->registerStream('assets', '', \UserFrosting\PUBLIC_DIR_NAME . '/' . \UserFrosting\ASSET_DIR_NAME, true); - $c->locator->registerStream('assets', 'vendor', \UserFrosting\PUBLIC_DIR_NAME . '/' . \UserFrosting\ASSET_DIR_NAME, true); - $c->locator->registerStream('build', '', \UserFrosting\BUILD_DIR_NAME, true); + $locator->registerStream('assets', '', \UserFrosting\PUBLIC_DIR_NAME . '/' . \UserFrosting\ASSET_DIR_NAME, true); + $locator->registerStream('assets', 'vendor', \UserFrosting\PUBLIC_DIR_NAME . '/' . \UserFrosting\ASSET_DIR_NAME, true); + $locator->registerStream('build', '', \UserFrosting\BUILD_DIR_NAME, true); $baseUrl = $config['site.uri.public'] . '/' . $config['assets.compiled.path']; $assets = new Assets($locator, 'assets', $baseUrl); // Load compiled asset bundle. - $assets->addAssetBundles(new CompiledAssetBundles($locator('build://' . $config['assets.compiled.schema'], true, true))); + $path = $locator->findResource('build://' . $config['assets.compiled.schema'], true, true); + $bundles = new CompiledAssetBundles($path); + $assets->addAssetBundles($bundles); } return $assets; }; - /** + /* * Cache service. * * @throws \Exception If cache handler is not supported @@ -194,7 +197,7 @@ public function register(ContainerInterface $container) return $cacheStore->instance(); }; - /** + /* * Middleware to check environment. * * @todo We should cache the results of this, the first time that it succeeds. @@ -205,7 +208,7 @@ public function register(ContainerInterface $container) return new CheckEnvironment($c->view, $c->locator, $c->cache); }; - /** + /* * Class mapper. * * Creates an abstraction on top of class names to allow extending them in sprinkles. @@ -221,7 +224,7 @@ public function register(ContainerInterface $container) return $classMapper; }; - /** + /* * Site config service (separate from Slim settings). * * Will attempt to automatically determine which config file(s) to use based on the value of the UF_MODE environment variable. @@ -257,7 +260,7 @@ public function register(ContainerInterface $container) // See https://github.com/laravel/framework/issues/8172#issuecomment-99112012 for more information on why it's bad to hit Laravel sessions multiple times in rapid succession. $csrfBlacklist = $config['csrf.blacklist']; $csrfBlacklist['^/' . $config['assets.raw.path']] = [ - 'GET' + 'GET', ]; $config->set('csrf.blacklist', $csrfBlacklist); @@ -265,18 +268,18 @@ public function register(ContainerInterface $container) return $config; }; - /** + /* * Initialize CSRF guard middleware. * * @see https://github.com/slimphp/Slim-Csrf - * @throws BadRequestException + * @throws \UserFrosting\Support\Exception\BadRequestException * @return \Slim\Csrf\Guard */ $container['csrf'] = function ($c) { return SlimCsrfProvider::setupService($c); }; - /** + /* * Initialize Eloquent Capsule, which provides the database layer for UF. * * @todo construct the individual objects rather than using the facade @@ -313,7 +316,7 @@ public function register(ContainerInterface $container) $logger->debug("Query executed on database [{$query->connectionName}]:", [ 'query' => $query->sql, 'bindings' => $query->bindings, - 'time' => $query->time . ' ms' + 'time' => $query->time . ' ms', ]); }); } @@ -321,7 +324,7 @@ public function register(ContainerInterface $container) return $capsule; }; - /** + /* * Debug logging with Monolog. * * Extend this service to push additional handlers onto the 'debug' log stack. @@ -343,7 +346,7 @@ public function register(ContainerInterface $container) return $logger; }; - /** + /* * Custom error-handler for recoverable errors. * * @return \UserFrosting\Sprinkle\Core\Error\ExceptionHandlerManager @@ -365,7 +368,7 @@ public function register(ContainerInterface $container) return $handler; }; - /** + /* * Error logging with Monolog. * * Extend this service to push additional handlers onto the 'error' log stack. @@ -387,7 +390,7 @@ public function register(ContainerInterface $container) return $log; }; - /** + /* * Factory service with FactoryMuffin. * * Provide access to factories for the rapid creation of objects for the purpose of testing @@ -411,7 +414,7 @@ public function register(ContainerInterface $container) return $fm; }; - /** + /* * Filesystem Service * @return \UserFrosting\Sprinkle\Core\Filesystem\FilesystemManager */ @@ -419,7 +422,7 @@ public function register(ContainerInterface $container) return new FilesystemManager($c->config); }; - /** + /* * Builds search paths for locales in all Sprinkles. * * @throws \UnexpectedValueException @@ -478,7 +481,7 @@ public function register(ContainerInterface $container) return new LocalePathBuilder($c->locator, 'locale://', $locales); }; - /** + /* * Mail service. * * @return \UserFrosting\Sprinkle\Core\Mail\Mailer @@ -494,7 +497,7 @@ public function register(ContainerInterface $container) return $mailer; }; - /** + /* * Mail logging service. * * PHPMailer will use this to log SMTP activity. @@ -516,7 +519,7 @@ public function register(ContainerInterface $container) return $log; }; - /** + /* * Migrator service. * * This service handles database migration operations @@ -538,7 +541,7 @@ public function register(ContainerInterface $container) return $migrator; }; - /** + /* * Error-handler for 404 errors. Notice that we manually create a UserFrosting NotFoundException, * and a NotFoundExceptionHandler. This lets us pass through to the UF error handling system. * @@ -553,7 +556,7 @@ public function register(ContainerInterface $container) }; }; - /** + /* * Error-handler for PHP runtime errors. Notice that we just pass this through to our general-purpose * error-handling service. * @@ -563,7 +566,7 @@ public function register(ContainerInterface $container) return $c->errorHandler; }; - /** + /* * Laravel query logging with Monolog. * * Extend this service to push additional handlers onto the 'query' log stack. @@ -585,7 +588,7 @@ public function register(ContainerInterface $container) return $logger; }; - /** + /* * Override Slim's default router with the UF router. * * @return \UserFrosting\Sprinkle\Core\Router @@ -600,7 +603,7 @@ public function register(ContainerInterface $container) return (new Router())->setCacheFile($routerCacheFile); }; - /** + /* * Return an instance of the database seeder * * @return \UserFrosting\Sprinkle\Core\Database\Seeder\Seeder @@ -609,7 +612,7 @@ public function register(ContainerInterface $container) return new Seeder($c); }; - /** + /* * Start the PHP session, with the name and parameters specified in the configuration file. * * @throws \Exception @@ -639,7 +642,7 @@ public function register(ContainerInterface $container) return $session; }; - /** + /* * Request throttler. * * Throttles (rate-limits) requests of a predefined type, with rules defined in site config. @@ -665,7 +668,7 @@ public function register(ContainerInterface $container) return $throttler; }; - /** + /* * Translation service, for translating message tokens. * * @return \UserFrosting\I18n\MessageTranslator @@ -681,7 +684,7 @@ public function register(ContainerInterface $container) return $translator; }; - /** + /* * Set up Twig as the view, adding template paths for all sprinkles and the Slim Twig extension. * * Also adds the UserFrosting core Twig extension, which provides additional functions, filters, global variables, etc. diff --git a/app/sprinkles/core/src/Session/DatabaseSessionHandler.php b/app/sprinkles/core/src/Session/DatabaseSessionHandler.php index b3e7a5e9c..3208009f6 100644 --- a/app/sprinkles/core/src/Session/DatabaseSessionHandler.php +++ b/app/sprinkles/core/src/Session/DatabaseSessionHandler.php @@ -1,5 +1,6 @@ payload); } - + return ''; } } diff --git a/app/sprinkles/core/src/Session/NullSessionHandler.php b/app/sprinkles/core/src/Session/NullSessionHandler.php index 42e737348..e5d3512af 100644 --- a/app/sprinkles/core/src/Session/NullSessionHandler.php +++ b/app/sprinkles/core/src/Session/NullSessionHandler.php @@ -1,5 +1,6 @@ [], 'size' => 'all', 'page' => null, - 'format' => 'json' + 'format' => 'json', ]; /** @@ -148,6 +148,7 @@ public function __construct(ClassMapper $classMapper, array $options) $e->addUserMessage($error); } } + throw $e; } @@ -164,7 +165,8 @@ public function __construct(ClassMapper $classMapper, array $options) /** * Extend the query by providing a callback. * - * @param callable $callback A callback which accepts and returns a Builder instance. + * @param callable $callback A callback which accepts and returns a Builder instance. + * * @return self */ public function extendQuery(callable $callback) @@ -177,7 +179,8 @@ public function extendQuery(callable $callback) /** * Execute the query and build the results, and append them in the appropriate format to the response. * - * @param Response $response + * @param Response $response + * * @return Response */ public function toResponse(Response $response) @@ -205,6 +208,7 @@ public function toResponse(Response $response) * * Returns an array containing `count` (the total number of rows, before filtering), `count_filtered` (the total number of rows after filtering), * and `rows` (the filtered result set). + * * @return mixed[] */ public function getArray() @@ -216,7 +220,7 @@ public function getArray() $this->countKey => $count, $this->countFilteredKey => $countFiltered, $this->rowsKey => $rows->values()->toArray(), - $this->listableKey => $this->getListable() + $this->listableKey => $this->getListable(), ]; } @@ -281,6 +285,7 @@ public function getCsv() * Executes the sprunje query, applying all sorts, filters, and pagination. * * Returns the filtered, paginated result set and the counts. + * * @return mixed[] */ public function getModels() @@ -322,7 +327,7 @@ public function getListable() foreach ($this->listable as $name) { // Determine if a custom filter method has been defined - $methodName = 'list'.studly_case($name); + $methodName = 'list' . studly_case($name); if (method_exists($this, $methodName)) { $result[$name] = $this->$methodName(); @@ -347,7 +352,8 @@ public function getQuery() /** * Set the underlying QueryBuilder object. * - * @param Builder $query + * @param Builder $query + * * @return self */ public function setQuery($query) @@ -360,7 +366,8 @@ public function setQuery($query) /** * Apply any filters from the options, calling a custom filter callback when appropriate. * - * @param Builder $query + * @param Builder $query + * * @return self */ public function applyFilters($query) @@ -370,6 +377,7 @@ public function applyFilters($query) if (($name != '_all') && !in_array($name, $this->filterable)) { $e = new BadRequestException(); $e->addUserMessage('VALIDATE.SPRUNJE.BAD_FILTER', ['name' => $name]); + throw $e; } // Since we want to match _all_ of the fields, we wrap the field callback in a 'where' callback @@ -384,7 +392,8 @@ public function applyFilters($query) /** * Apply any sorts from the options, calling a custom sorter callback when appropriate. * - * @param Builder $query + * @param Builder $query + * * @return self */ public function applySorts($query) @@ -394,11 +403,12 @@ public function applySorts($query) if (!in_array($name, $this->sortable)) { $e = new BadRequestException(); $e->addUserMessage('VALIDATE.SPRUNJE.BAD_SORT', ['name' => $name]); + throw $e; } // Determine if a custom sort method has been defined - $methodName = 'sort'.studly_case($name); + $methodName = 'sort' . studly_case($name); if (method_exists($this, $methodName)) { $this->$methodName($query, $direction); @@ -413,7 +423,8 @@ public function applySorts($query) /** * Apply pagination based on the `page` and `size` options. * - * @param Builder $query + * @param Builder $query + * * @return self */ public function applyPagination($query) @@ -434,8 +445,9 @@ public function applyPagination($query) /** * Match any filter in `filterable`. * - * @param Builder $query - * @param mixed $value + * @param Builder $query + * @param mixed $value + * * @return self */ protected function filterAll($query, $value) @@ -455,14 +467,15 @@ protected function filterAll($query, $value) /** * Build the filter query for a single field. * - * @param Builder $query - * @param string $name - * @param mixed $value + * @param Builder $query + * @param string $name + * @param mixed $value + * * @return self */ protected function buildFilterQuery($query, $name, $value) { - $methodName = 'filter'.studly_case($name); + $methodName = 'filter' . studly_case($name); // Determine if a custom filter method has been defined if (method_exists($this, $methodName)) { @@ -478,9 +491,10 @@ protected function buildFilterQuery($query, $name, $value) * Perform a 'like' query on a single field, separating the value string on the or separator and * matching any of the supplied values. * - * @param Builder $query - * @param string $name - * @param mixed $value + * @param Builder $query + * @param string $name + * @param mixed $value + * * @return self */ protected function buildFilterDefaultFieldQuery($query, $name, $value) @@ -498,7 +512,8 @@ protected function buildFilterDefaultFieldQuery($query, $name, $value) /** * Set any transformations you wish to apply to the collection, after the query is executed. * - * @param \Illuminate\Database\Eloquent\Collection $collection + * @param \Illuminate\Database\Eloquent\Collection $collection + * * @return \Illuminate\Database\Eloquent\Collection */ protected function applyTransformations($collection) @@ -517,7 +532,8 @@ abstract protected function baseQuery(); * Returns a list of distinct values for a specified column. * Formats results to have a "value" and "text" attribute. * - * @param string $column + * @param string $column + * * @return array */ protected function getColumnValues($column) @@ -527,7 +543,7 @@ protected function getColumnValues($column) foreach ($rawValues as $raw) { $values[] = [ 'value' => $raw[$column], - 'text' => $raw[$column] + 'text' => $raw[$column], ]; } @@ -537,7 +553,8 @@ protected function getColumnValues($column) /** * Get the unpaginated count of items (before filtering) in this query. * - * @param Builder $query + * @param Builder $query + * * @return int */ protected function count($query) @@ -548,7 +565,8 @@ protected function count($query) /** * Get the unpaginated count of items (after filtering) in this query. * - * @param Builder $query + * @param Builder $query + * * @return int */ protected function countFiltered($query) @@ -561,7 +579,9 @@ protected function countFiltered($query) * * Returns an array containing `count` (the total number of rows, before filtering), `count_filtered` (the total number of rows after filtering), * and `rows` (the filtered result set). + * * @deprecated since 4.1.7 Use getArray() instead. + * * @return mixed[] */ public function getResults() diff --git a/app/sprinkles/core/src/Throttle/ThrottleRule.php b/app/sprinkles/core/src/Throttle/ThrottleRule.php index 0c39d596d..f2d23d34a 100644 --- a/app/sprinkles/core/src/Throttle/ThrottleRule.php +++ b/app/sprinkles/core/src/Throttle/ThrottleRule.php @@ -1,5 +1,6 @@ classMapper->createInstance('throttle', [ 'type' => $type, 'ip' => $_SERVER['REMOTE_ADDR'], - 'request_data' => json_encode($requestData) + 'request_data' => json_encode($requestData), ]); $event->save(); @@ -163,9 +167,10 @@ public function logEvent($type, $requestData = []) /** * Returns the current delay for a specified throttle rule. * - * @param Collection $events a Collection of throttle events. - * @param ThrottleRule $throttleRule a rule representing the strategy to use for throttling a particular type of event. - * @return int seconds remaining until a particular event is permitted to be attempted again. + * @param Collection $events a Collection of throttle events. + * @param ThrottleRule $throttleRule a rule representing the strategy to use for throttling a particular type of event. + * + * @return int seconds remaining until a particular event is permitted to be attempted again. */ protected function computeDelay(Collection $events, ThrottleRule $throttleRule) { diff --git a/app/sprinkles/core/src/Throttle/ThrottlerException.php b/app/sprinkles/core/src/Throttle/ThrottlerException.php index 3bfefd2ee..022c0723a 100644 --- a/app/sprinkles/core/src/Throttle/ThrottlerException.php +++ b/app/sprinkles/core/src/Throttle/ThrottlerException.php @@ -1,5 +1,6 @@ services['translator']->translate($hook, $params); }, [ - 'is_safe' => ['html'] - ]) + 'is_safe' => ['html'], + ]), ]; } @@ -88,7 +89,7 @@ public function getFilters() }), new \Twig_SimpleFilter('unescape', function ($string) { return html_entity_decode($string); - }) + }), ]; } @@ -109,18 +110,18 @@ public function getGlobals() 'csrf' => [ 'keys' => [ 'name' => $csrfNameKey, - 'value' => $csrfValueKey + 'value' => $csrfValueKey, ], 'name' => $csrfName, - 'value' => $csrfValue - ] + 'value' => $csrfValue, + ], ]; $site = array_replace_recursive($this->services->config['site'], $csrf); return [ 'site' => $site, - 'assets' => new AssetsTemplatePlugin($this->services->assets) + 'assets' => new AssetsTemplatePlugin($this->services->assets), ]; } } diff --git a/app/sprinkles/core/src/Util/BadClassNameException.php b/app/sprinkles/core/src/Util/BadClassNameException.php index 7e3ce4c58..02d17230a 100644 --- a/app/sprinkles/core/src/Util/BadClassNameException.php +++ b/app/sprinkles/core/src/Util/BadClassNameException.php @@ -1,5 +1,6 @@ resultsFailed, $this->resultsSuccess); $response = $this->view->render($response, 'pages/error/config-errors.html.twig', [ - 'messages' => $results + 'messages' => $results, ]); } else { $response = $next($request, $response); @@ -158,13 +160,13 @@ public function checkApache() $this->resultsFailed['apache-' . $module] = [ 'title' => " Missing Apache module $module.", 'message' => "Please make sure that the $module Apache module is installed and enabled. If you use shared hosting, you will need to ask your web host to do this for you.", - 'success' => false + 'success' => false, ]; } else { $this->resultsSuccess['apache-' . $module] = [ 'title' => " Apache module $module is installed and enabled.", 'message' => "Great, we found the $module Apache module!", - 'success' => true + 'success' => true, ]; } } @@ -185,13 +187,13 @@ public function checkGd() $this->resultsFailed['gd'] = [ 'title' => " GD library not installed", 'message' => 'We could not confirm that the GD library is installed and enabled. GD is an image processing library that UserFrosting uses to generate captcha codes for user account registration.', - 'success' => false + 'success' => false, ]; } else { $this->resultsSuccess['gd'] = [ 'title' => " GD library installed!", 'message' => 'Great, you have GD installed and enabled.', - 'success' => true + 'success' => true, ]; } @@ -215,7 +217,7 @@ public function checkImageFunctions() 'imageline', 'imagesetpixel', 'imagefontwidth', - 'imagestring' + 'imagestring', ]; foreach ($funcs as $func) { @@ -224,13 +226,13 @@ public function checkImageFunctions() $this->resultsFailed['function-' . $func] = [ 'title' => " Missing image manipulation function.", 'message' => "It appears that function $func is not available. UserFrosting needs this to render captchas.", - 'success' => false + 'success' => false, ]; } else { $this->resultsSuccess['function-' . $func] = [ 'title' => " Function $func is available!", 'message' => 'Sweet!', - 'success' => true + 'success' => true, ]; } } @@ -250,13 +252,13 @@ public function checkPdo() $this->resultsFailed['pdo'] = [ 'title' => " PDO is not installed.", 'message' => "I'm sorry, you must have PDO installed and enabled in order for UserFrosting to access the database. If you don't know what PDO is, please see http://php.net/manual/en/book.pdo.php.", - 'success' => false + 'success' => false, ]; } else { $this->resultsSuccess['pdo'] = [ 'title' => " PDO is installed!", 'message' => "You've got PDO installed. Good job!", - 'success' => true + 'success' => true, ]; } @@ -273,7 +275,7 @@ public function checkDirectories() $directoryPaths = [ 'logs' => $this->locator->findResource('log://'), 'cache' => $this->locator->findResource('cache://'), - 'sessions' => $this->locator->findResource('session://') + 'sessions' => $this->locator->findResource('session://'), ]; foreach ($directoryPaths as $directory => $path) { @@ -282,13 +284,13 @@ public function checkDirectories() $this->resultsFailed['directory-' . $directory] = [ 'title' => " A required directory was not found.", 'message' => "Please check that userfrosting/app/$directory exists.", - 'success' => false + 'success' => false, ]; } else { $this->resultsSuccess['directory-' . $directory] = [ 'title' => " File/directory check passed!", 'message' => "userfrosting/app/$directory exists.", - 'success' => true + 'success' => true, ]; } } @@ -306,14 +308,14 @@ public function checkPermissions() $shouldBeWriteable = [ $this->locator->findResource('log://') => true, $this->locator->findResource('cache://') => true, - $this->locator->findResource('session://') => true + $this->locator->findResource('session://') => true, ]; if ($this->isProduction()) { // Should be write-protected in production! $shouldBeWriteable = array_merge($shouldBeWriteable, [ \UserFrosting\SPRINKLES_DIR => false, - \UserFrosting\VENDOR_DIR => false + \UserFrosting\VENDOR_DIR => false, ]); } @@ -331,7 +333,7 @@ public function checkPermissions() . '. Please modify the OS user or group permissions so that user ' . exec('whoami') . ' ' . ($assertWriteable ? 'has' : 'does not have') . ' write permissions for this directory.', - 'success' => false + 'success' => false, ]; } else { $this->resultsSuccess['file-' . $file] = [ @@ -339,7 +341,7 @@ public function checkPermissions() 'message' => "$file exists and is correctly set as " . ($writeable ? 'writeable' : 'not writeable') . '.', - 'success' => true + 'success' => true, ]; } } @@ -360,13 +362,13 @@ public function checkPhp() $this->resultsFailed['phpVersion'] = [ 'title' => " You need to upgrade your PHP installation.", 'message' => "I'm sorry, UserFrosting requires version " . \UserFrosting\PHP_MIN_VERSION . ' or greater. Please upgrade your version of PHP, or contact your web hosting service and ask them to upgrade it for you.', - 'success' => false + 'success' => false, ]; } else { $this->resultsSuccess['phpVersion'] = [ 'title' => " PHP version checks out!", - 'message' => "You're using PHP " . \UserFrosting\PHP_MIN_VERSION . 'or higher. Great!', - 'success' => true + 'message' => "You're using PHP " . \UserFrosting\PHP_MIN_VERSION . 'or higher. Great!', + 'success' => true, ]; } diff --git a/app/sprinkles/core/src/Util/ClassMapper.php b/app/sprinkles/core/src/Util/ClassMapper.php index b7314e781..c20e3202e 100644 --- a/app/sprinkles/core/src/Util/ClassMapper.php +++ b/app/sprinkles/core/src/Util/ClassMapper.php @@ -1,5 +1,6 @@ 'Parse error', E_CORE_ERROR => 'PHP core error', E_COMPILE_ERROR => 'Zend compile error', - E_RECOVERABLE_ERROR => 'Catchable fatal error' + E_RECOVERABLE_ERROR => 'Catchable fatal error', ]; return '' . $errorTypes[$error['type']] . ": $errstr in $errfile on line $errline"; @@ -122,7 +124,8 @@ protected function buildErrorInfoMessage(array $error) /** * Build an error response of the appropriate type as determined by the request's Accept header. * - * @param string $message + * @param string $message + * * @return string */ protected function buildErrorPage($message) @@ -147,7 +150,8 @@ protected function buildErrorPage($message) /** * Build an HTML error page from an error string. * - * @param string $message + * @param string $message + * * @return string */ protected function buildHtmlErrorPage($message) diff --git a/app/sprinkles/core/src/Util/Util.php b/app/sprinkles/core/src/Util/Util.php index 9cd14008a..b51dbf616 100644 --- a/app/sprinkles/core/src/Util/Util.php +++ b/app/sprinkles/core/src/Util/Util.php @@ -1,5 +1,6 @@ '.str_repeat('  ', $newLineLevel); + $result .= '
' . str_repeat('  ', $newLineLevel); } - $result .= $char.$post; + $result .= $char . $post; } return $result; @@ -148,10 +153,11 @@ public static function prettyPrintArray(array $arr) /** * Generate a random phrase, consisting of a specified number of adjectives, followed by a noun. * - * @param int $numAdjectives - * @param int $maxLength - * @param int $maxTries - * @param string $separator + * @param int $numAdjectives + * @param int $maxLength + * @param int $maxTries + * @param string $separator + * * @return string */ public static function randomPhrase($numAdjectives, $maxLength = 9999999, $maxTries = 10, $separator = '-') diff --git a/app/sprinkles/core/tests/ControllerTestCase.php b/app/sprinkles/core/tests/ControllerTestCase.php index da67cdda3..961c39ba8 100644 --- a/app/sprinkles/core/tests/ControllerTestCase.php +++ b/app/sprinkles/core/tests/ControllerTestCase.php @@ -1,5 +1,6 @@ setupTestDatabase(); $this->refreshDatabase(); } - - /** - * @param array $args Request arguments - * @return Request - */ - protected function getRequest($args = []) - { - $env = Environment::mock($args); - - return Request::createFromEnvironment($env); - } - - /** - * @return Response - */ - protected function getResponse() - { - return new Response(); - } } diff --git a/app/sprinkles/core/tests/DatabaseTransactions.php b/app/sprinkles/core/tests/DatabaseTransactions.php index 668905e1c..0fc331b24 100644 --- a/app/sprinkles/core/tests/DatabaseTransactions.php +++ b/app/sprinkles/core/tests/DatabaseTransactions.php @@ -1,5 +1,6 @@ $command->getName() + 'command' => $command->getName(), ], $input); // Execute command tester diff --git a/app/sprinkles/core/tests/Integration/BakeryMigrateRefreshCommandTest.php b/app/sprinkles/core/tests/Integration/Bakery/BakeryMigrateRefreshCommandTest.php similarity index 95% rename from app/sprinkles/core/tests/Integration/BakeryMigrateRefreshCommandTest.php rename to app/sprinkles/core/tests/Integration/Bakery/BakeryMigrateRefreshCommandTest.php index 58e3cb8a0..f8b3208f3 100644 --- a/app/sprinkles/core/tests/Integration/BakeryMigrateRefreshCommandTest.php +++ b/app/sprinkles/core/tests/Integration/Bakery/BakeryMigrateRefreshCommandTest.php @@ -1,5 +1,6 @@ $command->getName() + 'command' => $command->getName(), ], $input); // Execute command tester diff --git a/app/sprinkles/core/tests/Integration/BakeryMigrateResetCommandTest.php b/app/sprinkles/core/tests/Integration/Bakery/BakeryMigrateResetCommandTest.php similarity index 96% rename from app/sprinkles/core/tests/Integration/BakeryMigrateResetCommandTest.php rename to app/sprinkles/core/tests/Integration/Bakery/BakeryMigrateResetCommandTest.php index 7a995c319..242b65290 100644 --- a/app/sprinkles/core/tests/Integration/BakeryMigrateResetCommandTest.php +++ b/app/sprinkles/core/tests/Integration/Bakery/BakeryMigrateResetCommandTest.php @@ -1,5 +1,6 @@ $command->getName() + 'command' => $command->getName(), ], $input); // Execute command tester diff --git a/app/sprinkles/core/tests/Integration/BakeryMigrateRollbackCommandTest.php b/app/sprinkles/core/tests/Integration/Bakery/BakeryMigrateRollbackCommandTest.php similarity index 96% rename from app/sprinkles/core/tests/Integration/BakeryMigrateRollbackCommandTest.php rename to app/sprinkles/core/tests/Integration/Bakery/BakeryMigrateRollbackCommandTest.php index 6aba5a97d..6484d88d9 100644 --- a/app/sprinkles/core/tests/Integration/BakeryMigrateRollbackCommandTest.php +++ b/app/sprinkles/core/tests/Integration/Bakery/BakeryMigrateRollbackCommandTest.php @@ -1,5 +1,6 @@ $command->getName() + 'command' => $command->getName(), ], $input); // Execute command tester diff --git a/app/sprinkles/core/tests/Integration/BakeryMigrateStatusCommandTest.php b/app/sprinkles/core/tests/Integration/Bakery/BakeryMigrateStatusCommandTest.php similarity index 96% rename from app/sprinkles/core/tests/Integration/BakeryMigrateStatusCommandTest.php rename to app/sprinkles/core/tests/Integration/Bakery/BakeryMigrateStatusCommandTest.php index da0a83177..de1018c89 100644 --- a/app/sprinkles/core/tests/Integration/BakeryMigrateStatusCommandTest.php +++ b/app/sprinkles/core/tests/Integration/Bakery/BakeryMigrateStatusCommandTest.php @@ -1,5 +1,6 @@ $command->getName() + 'command' => $command->getName(), ], $input); // Execute command tester @@ -99,7 +103,7 @@ protected function getInstalledMigrationStub() { return collect([ (object) ['migration' => 'foo', 'batch' => 1, 'sprinkle' => 'foo'], - (object) ['migration' => 'bar', 'batch' => 2, 'sprinkle' => 'bar'] + (object) ['migration' => 'bar', 'batch' => 2, 'sprinkle' => 'bar'], ]); } } diff --git a/app/sprinkles/core/tests/Integration/Controllers/CoreControllerTest.php b/app/sprinkles/core/tests/Integration/Controllers/CoreControllerTest.php index 4b5aa5947..33bd93a12 100644 --- a/app/sprinkles/core/tests/Integration/Controllers/CoreControllerTest.php +++ b/app/sprinkles/core/tests/Integration/Controllers/CoreControllerTest.php @@ -1,5 +1,6 @@ 'David']); $user->emails()->create([ 'label' => 'primary', - 'email' => 'david@owlfancy.com' + 'email' => 'david@owlfancy.com', ]); $user->emails()->create([ 'label' => 'work', - 'email' => 'david@attenboroughsreef.com' + 'email' => 'david@attenboroughsreef.com', ]); $emails = $user->emails; @@ -163,24 +164,24 @@ public function testSyncOneToMany() $user->emails()->create([ 'id' => 1, 'label' => 'primary', - 'email' => 'david@owlfancy.com' + 'email' => 'david@owlfancy.com', ]); $user->emails()->create([ 'id' => 2, 'label' => 'work', - 'email' => 'david@attenboroughsreef.com' + 'email' => 'david@attenboroughsreef.com', ]); // Delete `work`, update `primary`, and add `gmail` $user->emails()->sync([ [ 'id' => 1, - 'email' => 'david@aol.com' + 'email' => 'david@aol.com', ], [ 'label' => 'gmail', - 'email' => 'davidattenborough@gmail.com' - ] + 'email' => 'davidattenborough@gmail.com', + ], ]); $emails = $user->emails->toArray(); @@ -190,14 +191,14 @@ public function testSyncOneToMany() 'id' => 1, 'user_id'=> 1, 'label' => 'primary', - 'email' => 'david@aol.com' + 'email' => 'david@aol.com', ], [ 'id' => 3, 'user_id' => 1, 'label' => 'gmail', - 'email' => 'davidattenborough@gmail.com' - ] + 'email' => 'davidattenborough@gmail.com', + ], ], $emails); } @@ -211,24 +212,24 @@ public function testSyncMorphMany() $user->phones()->create([ 'id' => 1, 'label' => 'primary', - 'number' => '5555551212' + 'number' => '5555551212', ]); $user->phones()->create([ 'id' => 2, 'label' => 'work', - 'number' => '2223334444' + 'number' => '2223334444', ]); // Delete `work`, update `primary`, and add `fax` $user->phones()->sync([ [ 'id' => 1, - 'number' => '8883332222' + 'number' => '8883332222', ], [ 'label' => 'fax', - 'number' => '5550005555' - ] + 'number' => '5550005555', + ], ]); $phones = $user->phones->toArray(); @@ -239,15 +240,15 @@ public function testSyncMorphMany() 'phoneable_id' => 1, 'phoneable_type' => EloquentTestUser::class, 'label' => 'primary', - 'number' => '8883332222' + 'number' => '8883332222', ], [ 'id' => 3, 'phoneable_id' => 1, 'phoneable_type' => EloquentTestUser::class, 'label' => 'fax', - 'number' => '5550005555' - ] + 'number' => '5550005555', + ], ], $phones); } @@ -268,17 +269,17 @@ public function testBelongsToManyUnique() 'slug' => 'soldier', 'pivot' => [ 'user_id' => 1, - 'role_id' => 2 - ] + 'role_id' => 2, + ], ], [ 'id' => 3, 'slug' => 'egg-layer', 'pivot' => [ 'user_id' => 1, - 'role_id' => 3 - ] - ] + 'role_id' => 3, + ], + ], ]; $roles = $user->jobRoles; @@ -307,17 +308,17 @@ public function testMorphsToManyUnique() 'name' => 'Chopping', 'pivot' => [ 'assignable_id' => 1, - 'task_id' => 2 - ] + 'task_id' => 2, + ], ], [ 'id' => 3, 'name' => 'Baleing', 'pivot' => [ 'assignable_id' => 1, - 'task_id' => 3 - ] - ] + 'task_id' => 3, + ], + ], ]; $tasks = $user->assignmentTasks; @@ -346,7 +347,7 @@ public function testMorphsToManyUniqueWithTertiary() 'name' => 'Chopping', 'pivot' => [ 'assignable_id' => 1, - 'task_id' => 2 + 'task_id' => 2, ], 'locations' => [ [ @@ -354,7 +355,7 @@ public function testMorphsToManyUniqueWithTertiary() 'name' => 'Hatchery', 'pivot' => [ 'location_id' => 1, - 'task_id' => 2 + 'task_id' => 2, ], ], [ @@ -362,17 +363,17 @@ public function testMorphsToManyUniqueWithTertiary() 'name' => 'Nexus', 'pivot' => [ 'location_id' => 2, - 'task_id' => 2 + 'task_id' => 2, ], - ] - ] + ], + ], ], [ 'id' => 3, 'name' => 'Baleing', 'pivot' => [ 'assignable_id' => 1, - 'task_id' => 3 + 'task_id' => 3, ], 'locations' => [ [ @@ -380,11 +381,11 @@ public function testMorphsToManyUniqueWithTertiary() 'name' => 'Nexus', 'pivot' => [ 'location_id' => 2, - 'task_id' => 3 + 'task_id' => 3, ], - ] - ] - ] + ], + ], + ], ]; $tasks = $user->tasks; @@ -412,7 +413,7 @@ public function testBelongsToManyUniqueWithTertiary() 'slug' => 'soldier', 'pivot' => [ 'user_id' => 1, - 'role_id' => 2 + 'role_id' => 2, ], 'locations' => [ [ @@ -421,8 +422,8 @@ public function testBelongsToManyUniqueWithTertiary() 'pivot' => [ 'title' => 'Grunt', 'location_id' => 1, - 'role_id' => 2 - ] + 'role_id' => 2, + ], ], [ 'id' => 2, @@ -430,17 +431,17 @@ public function testBelongsToManyUniqueWithTertiary() 'pivot' => [ 'title' => 'Sergeant', 'location_id' => 2, - 'role_id' => 2 - ] - ] - ] + 'role_id' => 2, + ], + ], + ], ], [ 'id' => 3, 'slug' => 'egg-layer', 'pivot' => [ 'user_id' => 1, - 'role_id' => 3 + 'role_id' => 3, ], 'locations' => [ [ @@ -449,11 +450,11 @@ public function testBelongsToManyUniqueWithTertiary() 'pivot' => [ 'title' => 'Queen', 'location_id' => 2, - 'role_id' => 3 - ] - ] - ] - ] + 'role_id' => 3, + ], + ], + ], + ], ]; $jobs = $user->jobs()->withPivot('title')->get(); @@ -491,7 +492,7 @@ public function testBelongsToManyUniqueWithTertiaryEagerLoad() 'slug' => 'soldier', 'pivot' => [ 'user_id' => 1, - 'role_id' => 2 + 'role_id' => 2, ], 'locations' => [ [ @@ -499,25 +500,25 @@ public function testBelongsToManyUniqueWithTertiaryEagerLoad() 'name' => 'Hatchery', 'pivot' => [ 'location_id' => 1, - 'role_id' => 2 - ] + 'role_id' => 2, + ], ], [ 'id' => 2, 'name' => 'Nexus', 'pivot' => [ 'location_id' => 2, - 'role_id' => 2 - ] - ] - ] + 'role_id' => 2, + ], + ], + ], ], [ 'id' => 3, 'slug' => 'egg-layer', 'pivot' => [ 'user_id' => 1, - 'role_id' => 3 + 'role_id' => 3, ], 'locations' => [ [ @@ -525,12 +526,12 @@ public function testBelongsToManyUniqueWithTertiaryEagerLoad() 'name' => 'Nexus', 'pivot' => [ 'location_id' => 2, - 'role_id' => 3 - ] - ] - ] - ] - ] + 'role_id' => 3, + ], + ], + ], + ], + ], ], [ 'id' => 2, @@ -541,7 +542,7 @@ public function testBelongsToManyUniqueWithTertiaryEagerLoad() 'slug' => 'egg-layer', 'pivot' => [ 'user_id' => 2, - 'role_id' => 3 + 'role_id' => 3, ], 'locations' => [ [ @@ -549,13 +550,13 @@ public function testBelongsToManyUniqueWithTertiaryEagerLoad() 'name' => 'Hatchery', 'pivot' => [ 'location_id' => 1, - 'role_id' => 3 - ] + 'role_id' => 3, + ], ], - ] - ] - ] - ] + ], + ], + ], + ], ], $users->toArray()); } @@ -577,25 +578,25 @@ public function testBelongsToManyThrough() 'slug' => 'uri_harvest', 'pivot' => [ 'user_id' => 1, - 'permission_id' => 1 - ] + 'permission_id' => 1, + ], ], [ 'id' => 2, 'slug' => 'uri_spit_acid', 'pivot' => [ 'user_id' => 1, - 'permission_id' => 2 - ] + 'permission_id' => 2, + ], ], [ 'id' => 3, 'slug' => 'uri_slash', 'pivot' => [ 'user_id' => 1, - 'permission_id' => 3 - ] - ] + 'permission_id' => 3, + ], + ], ], $user->permissions->toArray()); // Test counting @@ -614,25 +615,25 @@ public function testBelongsToManyThrough() 'slug' => 'uri_spit_acid', 'pivot' => [ 'user_id' => 2, - 'permission_id' => 2 - ] + 'permission_id' => 2, + ], ], [ 'id' => 3, 'slug' => 'uri_slash', 'pivot' => [ 'user_id' => 2, - 'permission_id' => 3 - ] + 'permission_id' => 3, + ], ], [ 'id' => 4, 'slug' => 'uri_royal_jelly', 'pivot' => [ 'user_id' => 2, - 'permission_id' => 4 - ] - ] + 'permission_id' => 4, + ], + ], ], $usersWithPermissions[1]['permissions']); // Test counting related models (withCount) @@ -664,17 +665,17 @@ public function testBelongsToManyThroughPaginated() 'slug' => 'uri_spit_acid', 'pivot' => [ 'user_id' => 1, - 'permission_id' => 2 - ] + 'permission_id' => 2, + ], ], [ 'id' => 3, 'slug' => 'uri_slash', 'pivot' => [ 'user_id' => 1, - 'permission_id' => 3 - ] - ] + 'permission_id' => 3, + ], + ], ], $paginatedPermissions->get()->toArray()); $this->assertEquals(2, $paginatedPermissions->count()); @@ -703,9 +704,9 @@ public function testBelongsToManyThroughPaginatedWithOrderByAggregateColumn() 'roles_count' => 3, 'pivot' => [ 'user_id' => 1, - 'permission_id' => 2 - ] - ] + 'permission_id' => 2, + ], + ], ], $paginatedPermissions->get()->toArray()); } @@ -752,7 +753,7 @@ public function testQueryExclude() $this->assertEquals([ 'role_id' => 2, - 'user_id' => 1 + 'user_id' => 1, ], $job->toArray()); } @@ -780,25 +781,25 @@ public function testQueryExcludeOnJoinedTable() 'id' => 1, 'pivot' => [ 'user_id' => 1, - 'permission_id' => 1 - ] + 'permission_id' => 1, + ], ], [ 'id' => 2, 'pivot' => [ 'user_id' => 1, - 'permission_id' => 2 - ] + 'permission_id' => 2, + ], ], [ 'id' => 3, 'pivot' => [ 'user_id' => 1, - 'permission_id' => 3 - ] - ] - ] - ] + 'permission_id' => 3, + ], + ], + ], + ], ], $users->toArray()); } @@ -828,19 +829,19 @@ public function testQueryExcludeUseQualifiedNamesOnJoinedTable() 'title' => null, 'pivot' => [ 'user_id' => 1, - 'role_id' => 1 - ] + 'role_id' => 1, + ], ], [ 'id' => 2, 'title' => null, 'pivot' => [ 'user_id' => 1, - 'role_id' => 2 - ] - ] - ] - ] + 'role_id' => 2, + ], + ], + ], + ], ], $users->toArray()); } @@ -854,19 +855,19 @@ public function testQueryExcludeWildcard() $job = EloquentTestJob::select('*')->addSelect('user_id')->exclude('*')->first(); $this->assertEquals([ - 'user_id' => 1 + 'user_id' => 1, ], $job->toArray()); $job = EloquentTestJob::select('jobs.*')->addSelect('user_id')->exclude('*')->first(); $this->assertEquals([ - 'user_id' => 1 + 'user_id' => 1, ], $job->toArray()); $job = EloquentTestJob::select('*')->addSelect('user_id')->exclude('jobs.*')->first(); $this->assertEquals([ - 'user_id' => 1 + 'user_id' => 1, ], $job->toArray()); } @@ -904,18 +905,18 @@ protected function generateRoles() return [ EloquentTestRole::create([ 'id' => 1, - 'slug' => 'forager' + 'slug' => 'forager', ]), EloquentTestRole::create([ 'id' => 2, - 'slug' => 'soldier' + 'slug' => 'soldier', ]), EloquentTestRole::create([ 'id' => 3, - 'slug' => 'egg-layer' - ]) + 'slug' => 'egg-layer', + ]), ]; } @@ -927,23 +928,23 @@ protected function generatePermissions() return [ EloquentTestPermission::create([ 'id' => 1, - 'slug' => 'uri_harvest' + 'slug' => 'uri_harvest', ]), EloquentTestPermission::create([ 'id' => 2, - 'slug' => 'uri_spit_acid' + 'slug' => 'uri_spit_acid', ]), EloquentTestPermission::create([ 'id' => 3, - 'slug' => 'uri_slash' + 'slug' => 'uri_slash', ]), EloquentTestPermission::create([ 'id' => 4, - 'slug' => 'uri_royal_jelly' - ]) + 'slug' => 'uri_royal_jelly', + ]), ]; } @@ -986,26 +987,26 @@ protected function generateJobs() 'role_id' => 2, 'location_id' => 1, 'user_id' => 1, - 'title' => 'Grunt' + 'title' => 'Grunt', ]), EloquentTestJob::create([ 'role_id' => 2, 'location_id' => 2, 'user_id' => 1, - 'title' => 'Sergeant' + 'title' => 'Sergeant', ]), EloquentTestJob::create([ 'role_id' => 3, 'location_id' => 2, 'user_id' => 1, - 'title' => 'Queen' + 'title' => 'Queen', ]), EloquentTestJob::create([ 'role_id' => 3, 'location_id' => 1, 'user_id' => 2, - 'title' => 'Demi-queen' - ]) + 'title' => 'Demi-queen', + ]), ]; } @@ -1017,13 +1018,13 @@ protected function generateLocations() return [ EloquentTestLocation::create([ 'id' => 1, - 'name' => 'Hatchery' + 'name' => 'Hatchery', ]), EloquentTestLocation::create([ 'id' => 2, - 'name' => 'Nexus' - ]) + 'name' => 'Nexus', + ]), ]; } @@ -1035,18 +1036,18 @@ protected function generateTasks() return [ EloquentTestTask::create([ 'id' => 1, - 'name' => 'Digging' + 'name' => 'Digging', ]), EloquentTestTask::create([ 'id' => 2, - 'name' => 'Chopping' + 'name' => 'Chopping', ]), EloquentTestTask::create([ 'id' => 3, - 'name' => 'Baleing' - ]) + 'name' => 'Baleing', + ]), ]; } @@ -1060,32 +1061,32 @@ protected function generateAssignments() 'task_id' => 2, 'location_id' => 1, 'assignable_id' => 1, - 'assignable_type' => EloquentTestUser::class + 'assignable_type' => EloquentTestUser::class, ]), EloquentTestAssignment::create([ 'task_id' => 2, 'location_id' => 2, 'assignable_id' => 1, - 'assignable_type' => EloquentTestUser::class + 'assignable_type' => EloquentTestUser::class, ]), EloquentTestAssignment::create([ 'task_id' => 3, 'location_id' => 2, 'assignable_id' => 1, - 'assignable_type' => EloquentTestUser::class + 'assignable_type' => EloquentTestUser::class, ]), EloquentTestAssignment::create([ 'task_id' => 3, 'location_id' => 3, 'assignable_id' => 1, - 'assignable_type' => 'UserFrosting\Tests\Integration\EloquentTestNonExistant' + 'assignable_type' => 'UserFrosting\Tests\Integration\EloquentTestNonExistant', ]), EloquentTestAssignment::create([ 'task_id' => 3, 'location_id' => 1, 'assignable_id' => 2, - 'assignable_type' => EloquentTestUser::class - ]) + 'assignable_type' => EloquentTestUser::class, + ]), ]; } @@ -1104,9 +1105,9 @@ protected function assertBelongsToManyThroughForDavid($permissions) 'slug' => 'forager', 'pivot' => [ 'permission_id' => 1, - 'role_id' => 1 - ] - ] + 'role_id' => 1, + ], + ], ], $permissions[0]['roles_via']); $this->assertEquals('uri_spit_acid', $permissions[1]['slug']); $this->assertEquals([ @@ -1115,17 +1116,17 @@ protected function assertBelongsToManyThroughForDavid($permissions) 'slug' => 'forager', 'pivot' => [ 'permission_id' => 2, - 'role_id' => 1 - ] + 'role_id' => 1, + ], ], [ 'id' => 2, 'slug' => 'soldier', 'pivot' => [ 'permission_id' => 2, - 'role_id' => 2 - ] - ] + 'role_id' => 2, + ], + ], ], $permissions[1]['roles_via']); $this->assertEquals('uri_slash', $permissions[2]['slug']); $this->assertEquals([ @@ -1134,9 +1135,9 @@ protected function assertBelongsToManyThroughForDavid($permissions) 'slug' => 'soldier', 'pivot' => [ 'permission_id' => 3, - 'role_id' => 2 - ] - ] + 'role_id' => 2, + ], + ], ], $permissions[2]['roles_via']); } @@ -1155,17 +1156,17 @@ protected function assertBelongsToManyThroughForAlex($permissions) 'slug' => 'soldier', 'pivot' => [ 'permission_id' => 2, - 'role_id' => 2 - ] + 'role_id' => 2, + ], ], [ 'id' => 3, 'slug' => 'egg-layer', 'pivot' => [ 'permission_id' => 2, - 'role_id' => 3 - ] - ] + 'role_id' => 3, + ], + ], ], $permissions[0]['roles_via']); $this->assertEquals('uri_slash', $permissions[1]['slug']); $this->assertEquals([ @@ -1174,9 +1175,9 @@ protected function assertBelongsToManyThroughForAlex($permissions) 'slug' => 'soldier', 'pivot' => [ 'permission_id' => 3, - 'role_id' => 2 - ] - ] + 'role_id' => 2, + ], + ], ], $permissions[1]['roles_via']); $this->assertEquals('uri_royal_jelly', $permissions[2]['slug']); $this->assertEquals([ @@ -1185,9 +1186,9 @@ protected function assertBelongsToManyThroughForAlex($permissions) 'slug' => 'egg-layer', 'pivot' => [ 'permission_id' => 4, - 'role_id' => 3 - ] - ] + 'role_id' => 3, + ], + ], ], $permissions[2]['roles_via']); } } diff --git a/app/sprinkles/core/tests/Integration/DatabaseMigratorIntegrationTest.php b/app/sprinkles/core/tests/Integration/Database/Migrator/DatabaseMigratorIntegrationTest.php similarity index 98% rename from app/sprinkles/core/tests/Integration/DatabaseMigratorIntegrationTest.php rename to app/sprinkles/core/tests/Integration/Database/Migrator/DatabaseMigratorIntegrationTest.php index a68530d29..981c2a40f 100644 --- a/app/sprinkles/core/tests/Integration/DatabaseMigratorIntegrationTest.php +++ b/app/sprinkles/core/tests/Integration/Database/Migrator/DatabaseMigratorIntegrationTest.php @@ -1,5 +1,6 @@ assertEquals([ - '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable', ], $migrated); } @@ -307,7 +311,7 @@ public function getMigrations() { return [ '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreateUsersTable', - '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable', ]; } } @@ -317,7 +321,7 @@ class FlightsTableMigrationLocatorStub extends MigrationLocator public function getMigrations() { return [ - '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable', ]; } } @@ -330,7 +334,7 @@ class InvalidMigrationLocatorStub extends MigrationLocator public function getMigrations() { return [ - '\\UserFrosting\\Tests\\Integration\\Migrations\\Foo' + '\\UserFrosting\\Tests\\Integration\\Migrations\\Foo', ]; } } @@ -347,7 +351,7 @@ public function getMigrations() return [ '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable', '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreateUsersTable', - '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable', ]; } } @@ -363,7 +367,7 @@ public function getMigrations() return [ '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreateUsersTable', '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable', - '\\UserFrosting\\Tests\\Integration\\Migrations\\UnfulfillableTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\UnfulfillableTable', ]; } } @@ -377,7 +381,7 @@ class DeprecatedMigrationLocatorStub extends MigrationLocator public function getMigrations() { return [ - '\\UserFrosting\\Tests\\Integration\\Migrations\\DeprecatedClassTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\DeprecatedClassTable', ]; } } diff --git a/app/sprinkles/core/tests/Integration/DatabaseMigratorServiceTest.php b/app/sprinkles/core/tests/Integration/Database/Migrator/DatabaseMigratorServiceTest.php similarity index 88% rename from app/sprinkles/core/tests/Integration/DatabaseMigratorServiceTest.php rename to app/sprinkles/core/tests/Integration/Database/Migrator/DatabaseMigratorServiceTest.php index e00b69d54..fb8def415 100644 --- a/app/sprinkles/core/tests/Integration/DatabaseMigratorServiceTest.php +++ b/app/sprinkles/core/tests/Integration/Database/Migrator/DatabaseMigratorServiceTest.php @@ -1,5 +1,6 @@ locator->shouldReceive('getMigrations')->andReturn([ '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreateUsersTable', '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable', - '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable', ]); // Repository will be asked to return the ran migrations (one), the next batch number and will log 2 new migrations $this->repository->shouldReceive('getMigrationsList')->andReturn([ - '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreateUsersTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreateUsersTable', ]); $this->repository->shouldReceive('getNextBatchNumber')->andReturn(2); $this->repository->shouldReceive('log')->times(2)->andReturn(null); @@ -166,7 +167,7 @@ public function testMigratorUpWithOneInstalledMigrations() // The migration already ran shoudn't be in the pending ones $this->assertEquals([ '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable', - '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable', ], $migrations); } @@ -179,7 +180,7 @@ public function testMigratorUpWithNoPendingMigrations() $testMigrations = [ '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreateUsersTable', '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable', - '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable', ]; // When running up, Locator will return all 3 migration classes @@ -229,7 +230,7 @@ public function testMigratorRollbackAllInstalledMigrations() $testMigrations = [ '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreateUsersTable', '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable', - '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable', ]; // When running up, Locator will return all 3 migration classes @@ -262,14 +263,14 @@ public function testMigratorRollbackAllInstalledMigrationsWithOneMissing() { // Locator will only return one of the two installed migrations $this->locator->shouldReceive('getMigrations')->once()->andReturn([ - '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable', ]); // Repository will be asked to return the ran migrations (two of them) // and will only be asked to delete one $installed = [ '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreateUsersTable', - '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable', ]; $this->repository->shouldReceive('getLast')->once()->andReturn($installed); $this->repository->shouldReceive('getMigrationsList')->once()->andReturn($installed); @@ -288,7 +289,7 @@ public function testMigratorRollbackAllInstalledMigrationsWithOneMissing() // The migration not available from the locator shouldn't have been run dowm $this->assertEquals([ - '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable', ], $migrations); } @@ -301,13 +302,13 @@ public function testMigratorRollbackSpecific() $testMigrations = [ '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreateUsersTable', '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable', - '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable', ]; // Migration object for the one being deleted $migration = '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable'; $migrationObject = (object) [ - 'migration' => $migration + 'migration' => $migration, ]; // Locator will return all 3 migration classes as available @@ -342,13 +343,13 @@ public function testMigratorRollbackSpecificWithDependencies() $testMigrations = [ '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreateUsersTable', '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable', - '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable', ]; // Migration object for the one being deleted $migration = '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreateUsersTable'; $migrationObject = (object) [ - 'migration' => $migration + 'migration' => $migration, ]; // Locator will return all 3 migration classes as available @@ -381,7 +382,7 @@ public function testMigratorResetAllInstalledMigrations() $testMigrations = [ '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreateUsersTable', '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable', - '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable', ]; // Locator will return all 3 migration classes diff --git a/app/sprinkles/core/tests/Integration/MigrationDependencyAnalyserTest.php b/app/sprinkles/core/tests/Integration/Database/Migrator/MigrationDependencyAnalyserTest.php similarity index 92% rename from app/sprinkles/core/tests/Integration/MigrationDependencyAnalyserTest.php rename to app/sprinkles/core/tests/Integration/Database/Migrator/MigrationDependencyAnalyserTest.php index 5a72ab04d..72b5362a0 100644 --- a/app/sprinkles/core/tests/Integration/MigrationDependencyAnalyserTest.php +++ b/app/sprinkles/core/tests/Integration/Database/Migrator/MigrationDependencyAnalyserTest.php @@ -1,5 +1,6 @@ assertEquals([], $analyser->getUnfulfillable()); $this->assertEquals([ '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreateUsersTable', '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable', - '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\two\\CreateFlightsTable', ], $analyser->getFulfillable()); } @@ -66,18 +67,18 @@ public function testAnalyserWithUnfulfillable() $migrations = [ '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreateUsersTable', '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable', - '\\UserFrosting\\Tests\\Integration\\Migrations\\UnfulfillableTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\UnfulfillableTable', ]; $analyser = new MigrationDependencyAnalyser($migrations, []); $this->assertEquals([ '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreateUsersTable', - '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable' + '\\UserFrosting\\Tests\\Integration\\Migrations\\one\\CreatePasswordResetsTable', ], $analyser->getFulfillable()); $this->assertEquals([ - '\\UserFrosting\\Tests\\Integration\\Migrations\\UnfulfillableTable' => '\UserFrosting\Tests\Integration\Migrations\NonExistingMigration' + '\\UserFrosting\\Tests\\Integration\\Migrations\\UnfulfillableTable' => '\UserFrosting\Tests\Integration\Migrations\NonExistingMigration', ], $analyser->getUnfulfillable()); } } diff --git a/app/sprinkles/core/tests/Integration/MigrationLocatorTest.php b/app/sprinkles/core/tests/Integration/Database/Migrator/MigrationLocatorTest.php similarity index 97% rename from app/sprinkles/core/tests/Integration/MigrationLocatorTest.php rename to app/sprinkles/core/tests/Integration/Database/Migrator/MigrationLocatorTest.php index 1ccab2b06..44c842263 100644 --- a/app/sprinkles/core/tests/Integration/MigrationLocatorTest.php +++ b/app/sprinkles/core/tests/Integration/Database/Migrator/MigrationLocatorTest.php @@ -1,5 +1,6 @@ assertTrue($files->delete('file.txt')); - $this->assertFileNotExists($this->testDir.'/file.txt'); + $this->assertFileNotExists($this->testDir . '/file.txt'); } /** @@ -116,7 +117,7 @@ public function testUrl(FilesystemAdapter $files) $url = $files->url('file.txt'); $this->assertEquals('files/testing/file.txt', $url); $this->assertTrue($files->delete('file.txt')); - $this->assertFileNotExists($this->testDir.'/file.txt'); + $this->assertFileNotExists($this->testDir . '/file.txt'); } /** diff --git a/app/sprinkles/core/tests/Integration/Migrations/DeprecatedClassTable.php b/app/sprinkles/core/tests/Integration/Migrations/DeprecatedClassTable.php index 4aee13c71..19055ed5f 100644 --- a/app/sprinkles/core/tests/Integration/Migrations/DeprecatedClassTable.php +++ b/app/sprinkles/core/tests/Integration/Migrations/DeprecatedClassTable.php @@ -1,5 +1,6 @@ 'Seed1', 'class' => '\\UserFrosting\\Sprinkle\\Core\\Database\\Seeds\\Seed1', - 'sprinkle' => 'Core' + 'sprinkle' => 'Core', ], [ 'name' => 'Seed2', 'class' => '\\UserFrosting\\Sprinkle\\Core\\Database\\Seeds\\Seed2', - 'sprinkle' => 'Core' + 'sprinkle' => 'Core', ], [ 'name' => 'Test/Seed', 'class' => '\\UserFrosting\\Sprinkle\\Core\\Database\\Seeds\\Test\\Seed', - 'sprinkle' => 'Core' - ] + 'sprinkle' => 'Core', + ], ], $seeds); } @@ -96,7 +97,7 @@ public function testGetSeed(Seeder $seeder) $this->assertEquals([ 'name' => 'Seed1', 'class' => '\\UserFrosting\\Sprinkle\\Core\\Database\\Seeds\\Seed1', - 'sprinkle' => 'Core' + 'sprinkle' => 'Core', ], $seed); } diff --git a/app/sprinkles/core/tests/Integration/Seeder/Seeds/Seed1.php b/app/sprinkles/core/tests/Integration/Seeder/Seeds/Seed1.php index d6923599e..b61ee6eff 100644 --- a/app/sprinkles/core/tests/Integration/Seeder/Seeds/Seed1.php +++ b/app/sprinkles/core/tests/Integration/Seeder/Seeds/Seed1.php @@ -1,5 +1,6 @@ ci->config['alert.storage'] = 'cache'; + $this->assertInstanceOf(CacheAlertStream::class, $this->ci->alerts); + } + + public function testSessionConfig() + { + $this->ci->config['alert.storage'] = 'session'; + $this->assertInstanceOf(SessionAlertStream::class, $this->ci->alerts); + } + + public function testBadConfig() + { + $this->ci->config['alert.storage'] = 'foo'; + $this->expectException(\Exception::class); + $alerts = $this->ci->alerts; + } +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/AssetLoaderServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/AssetLoaderServiceTest.php new file mode 100644 index 000000000..d02d57a02 --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/AssetLoaderServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(AssetLoader::class, $this->ci->assetLoader); + } +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/AssetsServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/AssetsServiceTest.php new file mode 100644 index 000000000..6f73b71cb --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/AssetsServiceTest.php @@ -0,0 +1,56 @@ +ci->config['assets.use_raw'] = true; + $this->assertInstanceOf(Assets::class, $this->ci->assets); + } + + // We don't know if assets are compiled or not during testing, so if + // `bundle.result.json` is available or not, this might fails + // This will need to be completed once we can mock a service in integration tests + /*public function testServiceWithCompiledAssets() + { + $this->ci->config['assets.use_raw'] = false; + + // Overwrite the locator to return our test `bundle.result.json` so we're sure it exist + // @TODO + + $this->assertInstanceOf(Assets::class, $this->ci->assets); + }*/ + + /* + public function testServiceWithCompiledAssetsAndNoBundleShema() + { + $this->ci->config['assets.use_raw'] = false; + + // Overwrite the locator to return a non-existing `bundle.result.json` + // @TODO + + // Should throw a FileNotFoundException or JsonException + $this->expectedException(\Exception::class); + $assets = $this->ci->assets; + }*/ +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/CacheServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/CacheServiceTest.php new file mode 100644 index 000000000..8d699df67 --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/CacheServiceTest.php @@ -0,0 +1,52 @@ +ci->config['cache.driver'] = 'file'; + $this->assertInstanceOf(Cache::class, $this->ci->cache); + } + + /** + * @requires extension Memcached + */ + public function testMemcachedConfig() + { + $this->ci->config['cache.driver'] = 'memcached'; + $this->assertInstanceOf(Cache::class, $this->ci->cache); + } + + /** + * @requires extension redis + */ + public function testRedisConfig() + { + $this->ci->config['cache.driver'] = 'redis'; + $this->assertInstanceOf(Cache::class, $this->ci->cache); + } + + public function testBadConfig() + { + $this->ci->config['cache.driver'] = 'foo'; + $this->expectException(\Exception::class); + $cache = $this->ci->cache; + } +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/CheckEnvironmentServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/CheckEnvironmentServiceTest.php new file mode 100644 index 000000000..c74e2132f --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/CheckEnvironmentServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(CheckEnvironment::class, $this->ci->checkEnvironment); + } +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/ClassMapperServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/ClassMapperServiceTest.php new file mode 100644 index 000000000..6a9badbaf --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/ClassMapperServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(ClassMapper::class, $this->ci->classMapper); + } +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/ConfigServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/ConfigServiceTest.php new file mode 100644 index 000000000..abd8047e7 --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/ConfigServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(Config::class, $this->ci->config); + } +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/DbServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/DbServiceTest.php new file mode 100644 index 000000000..e30c45d1c --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/DbServiceTest.php @@ -0,0 +1,32 @@ +assertInstanceOf(Manager::class, $this->ci->db); + } + + public function testServiceWithDebug() + { + $this->ci->config['debug.queries'] = true; + $this->assertInstanceOf(Manager::class, $this->ci->db); + } +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/DebugLoggerServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/DebugLoggerServiceTest.php new file mode 100644 index 000000000..d8a670523 --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/DebugLoggerServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(Logger::class, $this->ci->debugLogger); + } +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/ErrorHandlerServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/ErrorHandlerServiceTest.php new file mode 100644 index 000000000..daac9b3ae --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/ErrorHandlerServiceTest.php @@ -0,0 +1,34 @@ +assertInstanceOf(ExceptionHandlerManager::class, $this->ci->errorHandler); + } + + /** + * @depends testService + */ + public function testphpErrorHandlerService() + { + $this->assertInstanceOf(ExceptionHandlerManager::class, $this->ci->phpErrorHandler); + } +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/ErrorLoggerServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/ErrorLoggerServiceTest.php new file mode 100644 index 000000000..604c65569 --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/ErrorLoggerServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(Logger::class, $this->ci->errorLogger); + } +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/FactoryServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/FactoryServiceTest.php new file mode 100644 index 000000000..ee7a12841 --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/FactoryServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(FactoryMuffin::class, $this->ci->factory); + } +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/LocalePathBuilderServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/LocalePathBuilderServiceTest.php new file mode 100644 index 000000000..727a31e44 --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/LocalePathBuilderServiceTest.php @@ -0,0 +1,42 @@ +assertInstanceOf(LocalePathBuilder::class, $this->ci->localePathBuilder); + } + + public function testServiceWithUnexpectedValueExceptionOnNonStringConfig() + { + $this->ci->config['site.locales.default'] = []; + $this->expectException(\UnexpectedValueException::class); + $this->ci->localePathBuilder; + } + + public function testServiceWithUnexpectedValueExceptionOnEmptyStringConfig() + { + $this->ci->config['site.locales.default'] = ''; + $this->expectException(\UnexpectedValueException::class); + $this->ci->localePathBuilder; + } +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/MailerServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/MailerServiceTest.php new file mode 100644 index 000000000..26d768b41 --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/MailerServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(Mailer::class, $this->ci->mailer); + } +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/QueryLoggerServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/QueryLoggerServiceTest.php new file mode 100644 index 000000000..1a3738892 --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/QueryLoggerServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(Logger::class, $this->ci->queryLogger); + } +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/RouterServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/RouterServiceTest.php new file mode 100644 index 000000000..3d8de8c74 --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/RouterServiceTest.php @@ -0,0 +1,44 @@ +assertInstanceOf(Router::class, $this->ci->router); + } + + /** + * @depends testService + * Test router integration in Tests + */ + public function testBasicTest() + { + /** @var \UserFrosting\Sprinkle\Core\Router $router */ + $router = $this->ci->router; + + // Get all routes. We should have more than 0 in a default install + $routes = $router->getRoutes(); + $this->assertNotCount(0, $routes); + + // Try to get a path + $path = $router->pathFor('index'); + $this->assertEquals('/', $path); + } +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/ThrottlerServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/ThrottlerServiceTest.php new file mode 100644 index 000000000..50cbfe564 --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/ThrottlerServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(Throttler::class, $this->ci->throttler); + } +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/TranslatorServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/TranslatorServiceTest.php new file mode 100644 index 000000000..8296f6183 --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/TranslatorServiceTest.php @@ -0,0 +1,26 @@ +assertInstanceOf(MessageTranslator::class, $this->ci->translator); + } +} diff --git a/app/sprinkles/core/tests/Integration/ServicesProvider/ViewServiceTest.php b/app/sprinkles/core/tests/Integration/ServicesProvider/ViewServiceTest.php new file mode 100644 index 000000000..15ccfce4b --- /dev/null +++ b/app/sprinkles/core/tests/Integration/ServicesProvider/ViewServiceTest.php @@ -0,0 +1,44 @@ +assertInstanceOf(Twig::class, $this->ci->view); + } + + /** + * @depends testService + */ + public function testServiceWithCache() + { + $this->ci->config['cache.twig'] = true; + $this->assertInstanceOf(Twig::class, $this->ci->view); + } + + /** + * @depends testService + */ + public function testServiceWithDebug() + { + $this->ci->config['debug.twig'] = true; + $this->assertInstanceOf(Twig::class, $this->ci->view); + } +} diff --git a/app/sprinkles/core/tests/Integration/Session/SessionDatabaseHandlerTest.php b/app/sprinkles/core/tests/Integration/Session/SessionDatabaseHandlerTest.php index 885b34443..17726de83 100644 --- a/app/sprinkles/core/tests/Integration/Session/SessionDatabaseHandlerTest.php +++ b/app/sprinkles/core/tests/Integration/Session/SessionDatabaseHandlerTest.php @@ -1,5 +1,6 @@ ci->db->connection(); // Define random session ID - $session_id = 'test'.rand(1, 100000); + $session_id = 'test' . rand(1, 100000); // Make sure db is empty at first $this->assertEquals(0, SessionTable::count()); @@ -131,7 +132,7 @@ public function testUsingSessionService() } /** - * @param Session $session + * @param Session $session */ protected function sessionTests(Session $session) { diff --git a/app/sprinkles/core/tests/Integration/Session/SessionFileHandlerTest.php b/app/sprinkles/core/tests/Integration/Session/SessionFileHandlerTest.php index 86a060a1c..a90ef5ddf 100644 --- a/app/sprinkles/core/tests/Integration/Session/SessionFileHandlerTest.php +++ b/app/sprinkles/core/tests/Integration/Session/SessionFileHandlerTest.php @@ -1,5 +1,6 @@ ci->locator->findResource('session://'); @@ -123,7 +124,7 @@ protected function getSession() } /** - * @param Session $session + * @param Session $session */ protected function sessionTests(Session $session) { diff --git a/app/sprinkles/core/tests/Unit/TestDatabaseTraitTest.php b/app/sprinkles/core/tests/Integration/TestDatabaseTraitTest.php similarity index 94% rename from app/sprinkles/core/tests/Unit/TestDatabaseTraitTest.php rename to app/sprinkles/core/tests/Integration/TestDatabaseTraitTest.php index 0b6f69fbe..85903b329 100644 --- a/app/sprinkles/core/tests/Unit/TestDatabaseTraitTest.php +++ b/app/sprinkles/core/tests/Integration/TestDatabaseTraitTest.php @@ -1,5 +1,6 @@ key, $translator, $cache, $this->session_id); + + $this->assertInstanceOf(AlertStream::class, $stream); + $this->assertInstanceOf(CacheAlertStream::class, $stream); + } + + /** + * @depends testConstructor + */ + public function testSetTranslator() + { + $translator = m::mock(MessageTranslator::class); + $cache = m::mock(Cache::class); + $stream = new CacheAlertStream($this->key, $translator, $cache, $this->session_id); + + $this->assertSame($translator, $stream->translator()); + + $translator2 = m::mock(MessageTranslator::class); + $this->assertNotSame($translator, $translator2); + $this->assertInstanceOf(CacheAlertStream::class, $stream->setTranslator($translator2)); + $this->assertSame($translator2, $stream->translator()); + } + + /** + * @depends testConstructor + */ + public function testAddMessage() + { + // Build Mock + $translator = m::mock(MessageTranslator::class); + $cache = m::mock(Cache::class); + $tags = m::mock(\Illuminate\Cache\TaggedCache::class); + + // Set expectations + $message = [ + 'type' => 'success', + 'message' => 'foo', + ]; + $tags->shouldReceive('has')->with($this->key)->once()->andReturn(false); + $tags->shouldReceive('forever')->with($this->key, [$message])->once()->andReturn(null); + $cache->shouldReceive('tags')->with('_s' . $this->session_id)->andReturn($tags); + + // Process + $stream = new CacheAlertStream($this->key, $translator, $cache, $this->session_id); + $this->assertInstanceOf(CacheAlertStream::class, $stream->addMessage('success', 'foo')); + } + + /** + * @depends testAddMessage + */ + public function testAddMessageWithExistingkey() + { + // Build Mock + $translator = m::mock(MessageTranslator::class); + $cache = m::mock(Cache::class); + $tags = m::mock(\Illuminate\Cache\TaggedCache::class); + + // Set expectations + $message = [ + 'type' => 'success', + 'message' => 'foo', + ]; + $tags->shouldReceive('has')->with($this->key)->once()->andReturn(true); + $tags->shouldReceive('get')->with($this->key)->once()->andReturn(false); + $tags->shouldReceive('forever')->with($this->key, [$message])->once()->andReturn(null); + $cache->shouldReceive('tags')->with('_s' . $this->session_id)->andReturn($tags); + + // Process + $stream = new CacheAlertStream($this->key, $translator, $cache, $this->session_id); + $this->assertInstanceOf(CacheAlertStream::class, $stream->addMessage('success', 'foo')); + } + + /** + * @depends testAddMessageWithExistingkey + */ + public function testAddMessageWithExistingkeyNotEmpty() + { + // Build Mock + $translator = m::mock(MessageTranslator::class); + $cache = m::mock(Cache::class); + $tags = m::mock(\Illuminate\Cache\TaggedCache::class); + + // Set expectations + $message = [ + 'type' => 'success', + 'message' => 'foo', + ]; + $tags->shouldReceive('has')->with($this->key)->once()->andReturn(true); + $tags->shouldReceive('get')->with($this->key)->once()->andReturn([$message]); + $tags->shouldReceive('forever')->with($this->key, [$message, $message])->once()->andReturn(null); + $cache->shouldReceive('tags')->with('_s' . $this->session_id)->andReturn($tags); + + // Process + $stream = new CacheAlertStream($this->key, $translator, $cache, $this->session_id); + $this->assertInstanceOf(CacheAlertStream::class, $stream->addMessage('success', 'foo')); + } + + /** + * @depends testConstructor + */ + public function testResetMessageStream() + { + // Build Mock + $translator = m::mock(MessageTranslator::class); + $cache = m::mock(Cache::class); + $tags = m::mock(\Illuminate\Cache\TaggedCache::class); + + // Set expectations + $tags->shouldReceive('forget')->with($this->key)->once()->andReturn(true); + $cache->shouldReceive('tags')->with('_s' . $this->session_id)->andReturn($tags); + + // Process + $stream = new CacheAlertStream($this->key, $translator, $cache, $this->session_id); + $this->assertNull($stream->resetMessageStream()); + } + + /** + * @depends testConstructor + */ + public function testAddMessageTranslatedWithNoTranslator() + { + $cache = m::mock(Cache::class); + $stream = new CacheAlertStream($this->key, null, $cache, $this->session_id); + + $this->expectException(\RuntimeException::class); + $stream->addMessageTranslated('success', 'foo', []); + } + + /** + * @depends testConstructor + */ + public function testAddMessageTranslated() + { + // Build Mock + $translator = m::mock(MessageTranslator::class); + $cache = m::mock(Cache::class); + $tags = m::mock(\Illuminate\Cache\TaggedCache::class); + + // + $key = 'FOO'; + $placeholder = ['key' => 'value']; + $result = 'Bar'; + + // Set expectations + $translator->shouldReceive('translate')->with($key, $placeholder)->andReturn($result); + $message = [ + 'type' => 'success', + 'message' => $result, + ]; + $tags->shouldReceive('has')->with($this->key)->once()->andReturn(false); + $tags->shouldReceive('forever')->with($this->key, [$message])->once()->andReturn(null); + $cache->shouldReceive('tags')->with('_s' . $this->session_id)->andReturn($tags); + + // Process + $stream = new CacheAlertStream($this->key, $translator, $cache, $this->session_id); + $this->assertInstanceOf(CacheAlertStream::class, $stream->addMessageTranslated('success', $key, $placeholder)); + } + + /** + * @depends testAddMessageWithExistingkey + * @depends testResetMessageStream + */ + public function testGetAndClearMessages() + { + // Build Mock + $translator = m::mock(MessageTranslator::class); + $cache = m::mock(Cache::class); + $tags = m::mock(\Illuminate\Cache\TaggedCache::class); + + // Set expectations + $message = [ + 'type' => 'success', + 'message' => 'foo', + ]; + $tags->shouldReceive('forget')->with($this->key)->once()->andReturn(true); + $tags->shouldReceive('has')->with($this->key)->once()->andReturn(true); + $tags->shouldReceive('get')->with($this->key)->once()->andReturn([$message]); + $cache->shouldReceive('tags')->with('_s' . $this->session_id)->andReturn($tags); + + // Process + $stream = new CacheAlertStream($this->key, $translator, $cache, $this->session_id); + $this->assertSame([$message], $stream->getAndClearMessages()); + } + + /** + * @depends testAddMessage + */ + public function testAddValidationErrors() + { + // Build Mock + $translator = m::mock(MessageTranslator::class); + $cache = m::mock(Cache::class); + $tags = m::mock(\Illuminate\Cache\TaggedCache::class); + $validator = m::mock(\UserFrosting\Fortress\ServerSideValidator::class); + + // Set expectations + $data = [ + 'name' => ['Name is required'], + 'email' => ['Email should be a valid email address'], + ]; + $validator->shouldReceive('errors')->once()->andReturn($data); + + $message1 = [ + 'type' => 'danger', + 'message' => 'Name is required', + ]; + $message2 = [ + 'type' => 'danger', + 'message' => 'Email should be a valid email address', + ]; + $tags->shouldReceive('has')->with($this->key)->andReturn(false, [$message1], [$message1, $message2]); // Save 1, Save 2, display both + $tags->shouldReceive('get')->with($this->key)->andReturn([$message1], [$message1, $message2]); // Save 2, Display both + $tags->shouldReceive('forever')->with($this->key, [$message1])->once()->andReturn(null); // Save 1 + $tags->shouldReceive('forever')->with($this->key, [$message1, $message2])->once()->andReturn(null); // Save 2 + $cache->shouldReceive('tags')->with('_s' . $this->session_id)->andReturn($tags); + + // Process + $stream = new CacheAlertStream($this->key, $translator, $cache, $this->session_id); + $stream->addValidationErrors($validator); + $this->assertSame([$message1, $message2], $stream->messages()); + } +} diff --git a/app/sprinkles/core/tests/Unit/Alert/SessionAlertStreamTest.php b/app/sprinkles/core/tests/Unit/Alert/SessionAlertStreamTest.php new file mode 100644 index 000000000..e8dc2de21 --- /dev/null +++ b/app/sprinkles/core/tests/Unit/Alert/SessionAlertStreamTest.php @@ -0,0 +1,217 @@ +key, $translator, $session); + + $this->assertInstanceOf(AlertStream::class, $stream); + $this->assertInstanceOf(SessionAlertStream::class, $stream); + } + + /** + * @depends testConstructor + */ + public function testSetTranslator() + { + $translator = m::mock(MessageTranslator::class); + $session = m::mock(Session::class); + $stream = new SessionAlertStream($this->key, $translator, $session); + + $this->assertSame($translator, $stream->translator()); + + $translator2 = m::mock(MessageTranslator::class); + $this->assertNotSame($translator, $translator2); + $this->assertInstanceOf(SessionAlertStream::class, $stream->setTranslator($translator2)); + $this->assertSame($translator2, $stream->translator()); + } + + /** + * @depends testConstructor + */ + public function testAddMessage() + { + // Build Mock + $translator = m::mock(MessageTranslator::class); + $session = m::mock(Session::class); + + // Set expectations + $message = [ + 'type' => 'success', + 'message' => 'foo', + ]; + $session->shouldReceive('get')->with($this->key)->once()->andReturn(false); + $session->shouldReceive('set')->with($this->key, [$message])->once()->andReturn(null); + + // Process + $stream = new SessionAlertStream($this->key, $translator, $session); + $this->assertInstanceOf(SessionAlertStream::class, $stream->addMessage('success', 'foo')); + } + + /** + * @depends testAddMessage + */ + public function testAddMessageWithExistingkeyNotEmpty() + { + // Build Mock + $translator = m::mock(MessageTranslator::class); + $session = m::mock(Session::class); + + // Set expectations + $message = [ + 'type' => 'success', + 'message' => 'foo', + ]; + $session->shouldReceive('get')->with($this->key)->once()->andReturn([$message]); + $session->shouldReceive('set')->with($this->key, [$message, $message])->once()->andReturn(null); + + // Process + $stream = new SessionAlertStream($this->key, $translator, $session); + $this->assertInstanceOf(SessionAlertStream::class, $stream->addMessage('success', 'foo')); + } + + /** + * @depends testConstructor + */ + public function testResetMessageStream() + { + // Build Mock + $translator = m::mock(MessageTranslator::class); + $session = m::mock(Session::class); + + // Set expectations + $session->shouldReceive('set')->with($this->key, [])->once()->andReturn(true); + + // Process + $stream = new SessionAlertStream($this->key, $translator, $session); + $this->assertNull($stream->resetMessageStream()); + } + + /** + * @depends testConstructor + */ + public function testAddMessageTranslatedWithNoTranslator() + { + $session = m::mock(Session::class); + $stream = new SessionAlertStream($this->key, null, $session); + + $this->expectException(\RuntimeException::class); + $stream->addMessageTranslated('success', 'foo', []); + } + + /** + * @depends testConstructor + */ + public function testAddMessageTranslated() + { + // Build Mock + $translator = m::mock(MessageTranslator::class); + $session = m::mock(Session::class); + + // + $key = 'FOO'; + $placeholder = ['key' => 'value']; + $result = 'Bar'; + + // Set expectations + $translator->shouldReceive('translate')->with($key, $placeholder)->andReturn($result); + $message = [ + 'type' => 'success', + 'message' => $result, + ]; + $session->shouldReceive('get')->with($this->key)->once()->andReturn(false); + $session->shouldReceive('set')->with($this->key, [$message])->once()->andReturn(null); + + // Process + $stream = new SessionAlertStream($this->key, $translator, $session); + $this->assertInstanceOf(SessionAlertStream::class, $stream->addMessageTranslated('success', $key, $placeholder)); + } + + /** + * @depends testResetMessageStream + */ + public function testGetAndClearMessages() + { + // Build Mock + $translator = m::mock(MessageTranslator::class); + $session = m::mock(Session::class); + + // Set expectations + $message = [ + 'type' => 'success', + 'message' => 'foo', + ]; + $session->shouldReceive('get')->with($this->key)->once()->andReturn([$message]); + $session->shouldReceive('set')->with($this->key, [])->once()->andReturn(true); + + // Process + $stream = new SessionAlertStream($this->key, $translator, $session); + $this->assertSame([$message], $stream->getAndClearMessages()); + } + + /** + * @depends testAddMessage + */ + public function testAddValidationErrors() + { + // Build Mock + $translator = m::mock(MessageTranslator::class); + $session = m::mock(Session::class); + $validator = m::mock(\UserFrosting\Fortress\ServerSideValidator::class); + + // Set expectations + $data = [ + 'name' => ['Name is required'], + 'email' => ['Email should be a valid email address'], + ]; + $validator->shouldReceive('errors')->once()->andReturn($data); + + $message1 = [ + 'type' => 'danger', + 'message' => 'Name is required', + ]; + $message2 = [ + 'type' => 'danger', + 'message' => 'Email should be a valid email address', + ]; + $session->shouldReceive('get')->with($this->key)->andReturn(false, [$message1], [$message1, $message2]); // Save 1, Save 2, Display both + $session->shouldReceive('set')->with($this->key, [$message1])->andReturn(null); // Save 1 + $session->shouldReceive('set')->with($this->key, [$message1, $message2])->andReturn(null); // Save 2 + + // Process + $stream = new SessionAlertStream($this->key, $translator, $session); + $stream->addValidationErrors($validator); + $this->assertSame([$message1, $message2], $stream->messages()); + } +} diff --git a/app/sprinkles/core/tests/Unit/BelongsToManyThroughTest.php b/app/sprinkles/core/tests/Unit/Database/Relations/BelongsToManyThroughTest.php similarity index 97% rename from app/sprinkles/core/tests/Unit/BelongsToManyThroughTest.php rename to app/sprinkles/core/tests/Unit/Database/Relations/BelongsToManyThroughTest.php index 22e2ad203..200f475d3 100644 --- a/app/sprinkles/core/tests/Unit/BelongsToManyThroughTest.php +++ b/app/sprinkles/core/tests/Unit/Database/Relations/BelongsToManyThroughTest.php @@ -1,5 +1,6 @@ expectCreatedModel($relation, [ - 'id' => 'x' + 'id' => 'x', ]); $model->shouldReceive('getAttribute')->with('id')->andReturn('x'); @@ -89,17 +92,17 @@ public function syncMethodHasManyListProvider() [ [ 'id' => 2, - 'species' => 'Tyto' + 'species' => 'Tyto', ], [ 'id' => 3, - 'species' => 'Megascops' + 'species' => 'Megascops', ], [ - 'id' => 'x' - ] - ] - ] + 'id' => 'x', + ], + ], + ], // Additional test sets here ]; } diff --git a/app/sprinkles/core/tests/Unit/SprunjeTest.php b/app/sprinkles/core/tests/Unit/Sprunje/SprunjeTest.php similarity index 91% rename from app/sprinkles/core/tests/Unit/SprunjeTest.php rename to app/sprinkles/core/tests/Unit/Sprunje/SprunjeTest.php index 7346f1eee..c5501ea72 100644 --- a/app/sprinkles/core/tests/Unit/SprunjeTest.php +++ b/app/sprinkles/core/tests/Unit/Sprunje/SprunjeTest.php @@ -1,5 +1,6 @@ [ - 'species' => 'Tyto' - ] + 'species' => 'Tyto', + ], ]); $builder = $sprunje->getQuery(); @@ -54,8 +55,8 @@ public function testSprunjeApplySortsDefault() { $sprunje = new SprunjeStub([ 'sorts' => [ - 'species' => 'asc' - ] + 'species' => 'asc', + ], ]); $builder = $sprunje->getQuery(); @@ -67,11 +68,11 @@ public function testSprunjeApplySortsDefault() class SprunjeStub extends Sprunje { protected $filterable = [ - 'species' + 'species', ]; protected $sortable = [ - 'species' + 'species', ]; public function __construct($options) diff --git a/app/sprinkles/core/tests/withController.php b/app/sprinkles/core/tests/withController.php new file mode 100644 index 000000000..aafdd0c49 --- /dev/null +++ b/app/sprinkles/core/tests/withController.php @@ -0,0 +1,42 @@ +beforeApplicationDestroyedCallbacks[] = function() - { + $this->beforeApplicationDestroyedCallbacks[] = function () { putenv('TEST_SESSION_HANDLER'); }; diff --git a/app/system/Bakery/Bakery.php b/app/system/Bakery/Bakery.php index 68d5dda1f..1d8fe1a48 100644 --- a/app/system/Bakery/Bakery.php +++ b/app/system/Bakery/Bakery.php @@ -1,5 +1,6 @@ ci->locator; @@ -117,10 +118,11 @@ protected function loadCommands() } /** - * Transform a Bakery Command Resource into a classpath + * Transform a Bakery Command Resource into a classpath. * - * @param \UserFrosting\UniformResourceLocator\Resource $file The command resource - * @return string The command class path + * @param \UserFrosting\UniformResourceLocator\Resource $file The command resource + * + * @return string The command class path */ protected function getResourceClass(Resource $file) { @@ -144,9 +146,10 @@ protected function getResourceClass(Resource $file) } /** - * Return the classname from the file instance + * Return the classname from the file instance. + * + * @param \UserFrosting\UniformResourceLocator\Resource $file The command resource * - * @param \UserFrosting\UniformResourceLocator\Resource $file The command resource * @return string */ protected function getClassNameFromFile(Resource $file) diff --git a/app/system/Bakery/BaseCommand.php b/app/system/Bakery/BaseCommand.php index f150d47fc..217860fbe 100644 --- a/app/system/Bakery/BaseCommand.php +++ b/app/system/Bakery/BaseCommand.php @@ -1,5 +1,6 @@
' . - 'Version: UserFrosting '.\UserFrosting\VERSION.'
' . + 'Version: UserFrosting ' . \UserFrosting\VERSION . '
' . $errorMessage; $output = sprintf( "" . diff --git a/app/tests/DatabaseTransactions.php b/app/tests/DatabaseTransactions.php index 74844837b..5f914c186 100644 --- a/app/tests/DatabaseTransactions.php +++ b/app/tests/DatabaseTransactions.php @@ -1,5 +1,6 @@ ci->session->destroy(); + // Close DB connection + $this->ci->db->getDatabaseManager()->disconnect(); + $this->ci = null; } diff --git a/app/tests/Unit/ExampleTest.php b/app/tests/Unit/ExampleTest.php index 69d4c75fc..bc48800b8 100644 --- a/app/tests/Unit/ExampleTest.php +++ b/app/tests/Unit/ExampleTest.php @@ -1,5 +1,6 @@ assertEquals([ 'foo' => null, 'bar' => null, - 'test' => new \UserFrosting\Sprinkle\Test\Test() + 'test' => new \UserFrosting\Sprinkle\Test\Test(), ], $sprinkles); } diff --git a/build/before_install.sh b/build/before_install.sh index b37ce4f7b..90b3730f7 100644 --- a/build/before_install.sh +++ b/build/before_install.sh @@ -37,3 +37,14 @@ if [ "$DB" == "sqlite" ] ; then touch userfrosting.db printf "UF_MODE=\"debug\"\nDB_DRIVER=\"sqlite\"\nDB_NAME=\"userfrosting.db\"\nTEST_DB=\"default\"\n" > app/.env fi + +# +# set up memory +# Need to setup MySQL for the debug part +# +if [ "$DB" == "memory" ] ; then + echo "Setting up in memory sqlite ..." + mysql -u root -e "CREATE DATABASE userfrosting;" + mysql -u root -e "GRANT ALL ON userfrosting.* TO 'travis'@'localhost';" + printf "UF_MODE=\"debug\"\nDB_DRIVER=\"mysql\"\nDB_HOST=\"localhost\"\nDB_PORT=\"3306\"\nDB_NAME=\"userfrosting\"\nDB_USER=\"travis\"\nDB_PASSWORD=\"\"\n" > app/.env +fi diff --git a/public/index.php b/public/index.php index 95b6f339b..a26563f20 100755 --- a/public/index.php +++ b/public/index.php @@ -1,5 +1,6 @@