mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Added and ran PHPCS
This commit is contained in:
parent
d0dc5e5c5d
commit
8a749c6acf
@ -22,10 +22,10 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
|||||||
*/
|
*/
|
||||||
class Webhook extends Model implements Loggable
|
class Webhook extends Model implements Loggable
|
||||||
{
|
{
|
||||||
protected $fillable = ['name', 'endpoint', 'timeout'];
|
|
||||||
|
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = ['name', 'endpoint', 'timeout'];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'last_called_at' => 'datetime',
|
'last_called_at' => 'datetime',
|
||||||
'last_errored_at' => 'datetime',
|
'last_errored_at' => 'datetime',
|
||||||
|
@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
*/
|
*/
|
||||||
class WebhookTrackedEvent extends Model
|
class WebhookTrackedEvent extends Model
|
||||||
{
|
{
|
||||||
protected $fillable = ['event'];
|
|
||||||
|
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = ['event'];
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ class LdapService
|
|||||||
'name' => $this->getUserResponseProperty($user, $displayNameAttr, $userCn),
|
'name' => $this->getUserResponseProperty($user, $displayNameAttr, $userCn),
|
||||||
'dn' => $user['dn'],
|
'dn' => $user['dn'],
|
||||||
'email' => $this->getUserResponseProperty($user, $emailAttr, null),
|
'email' => $this->getUserResponseProperty($user, $emailAttr, null),
|
||||||
'avatar'=> $thumbnailAttr ? $this->getUserResponseProperty($user, $thumbnailAttr, null) : null,
|
'avatar' => $thumbnailAttr ? $this->getUserResponseProperty($user, $thumbnailAttr, null) : null,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($this->config['dump_user_details']) {
|
if ($this->config['dump_user_details']) {
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace BookStack\Auth\Access\Oidc;
|
namespace BookStack\Auth\Access\Oidc;
|
||||||
|
|
||||||
use function auth;
|
|
||||||
use BookStack\Auth\Access\GroupSyncService;
|
use BookStack\Auth\Access\GroupSyncService;
|
||||||
use BookStack\Auth\Access\LoginService;
|
use BookStack\Auth\Access\LoginService;
|
||||||
use BookStack\Auth\Access\RegistrationService;
|
use BookStack\Auth\Access\RegistrationService;
|
||||||
@ -10,14 +9,11 @@ use BookStack\Auth\User;
|
|||||||
use BookStack\Exceptions\JsonDebugException;
|
use BookStack\Exceptions\JsonDebugException;
|
||||||
use BookStack\Exceptions\StoppedAuthenticationException;
|
use BookStack\Exceptions\StoppedAuthenticationException;
|
||||||
use BookStack\Exceptions\UserRegistrationException;
|
use BookStack\Exceptions\UserRegistrationException;
|
||||||
use function config;
|
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use League\OAuth2\Client\OptionProvider\HttpBasicAuthOptionProvider;
|
use League\OAuth2\Client\OptionProvider\HttpBasicAuthOptionProvider;
|
||||||
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
|
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
|
||||||
use Psr\Http\Client\ClientInterface as HttpClient;
|
use Psr\Http\Client\ClientInterface as HttpClient;
|
||||||
use function trans;
|
|
||||||
use function url;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class OpenIdConnectService
|
* Class OpenIdConnectService
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
* Configuration should be altered via the `.env` file or environment variables.
|
* Configuration should be altered via the `.env` file or environment variables.
|
||||||
* Do not edit this file unless you're happy to maintain any changes yourself.
|
* Do not edit this file unless you're happy to maintain any changes yourself.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$dompdfPaperSizeMap = [
|
$dompdfPaperSizeMap = [
|
||||||
'a4' => 'a4',
|
'a4' => 'a4',
|
||||||
'letter' => 'letter',
|
'letter' => 'letter',
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
* Configuration should be altered via the `.env` file or environment variables.
|
* Configuration should be altered via the `.env` file or environment variables.
|
||||||
* Do not edit this file unless you're happy to maintain any changes yourself.
|
* Do not edit this file unless you're happy to maintain any changes yourself.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$snappyPaperSizeMap = [
|
$snappyPaperSizeMap = [
|
||||||
'a4' => 'A4',
|
'a4' => 'A4',
|
||||||
'letter' => 'Letter',
|
'letter' => 'Letter',
|
||||||
|
@ -42,7 +42,7 @@ class PageEditActivity
|
|||||||
$userMessage = trans('entities.pages_draft_edit_active.start_b', ['userName' => $firstDraft->createdBy->name ?? '']);
|
$userMessage = trans('entities.pages_draft_edit_active.start_b', ['userName' => $firstDraft->createdBy->name ?? '']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$timeMessage = trans('entities.pages_draft_edit_active.time_b', ['minCount'=> 60]);
|
$timeMessage = trans('entities.pages_draft_edit_active.time_b', ['minCount' => 60]);
|
||||||
|
|
||||||
return trans('entities.pages_draft_edit_active.message', ['start' => $userMessage, 'time' => $timeMessage]);
|
return trans('entities.pages_draft_edit_active.message', ['start' => $userMessage, 'time' => $timeMessage]);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ class ForgotPasswordController extends Controller
|
|||||||
| your application to your users. Feel free to explore this trait.
|
| your application to your users. Feel free to explore this trait.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use SendsPasswordResetEmails;
|
use SendsPasswordResetEmails;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,8 +24,9 @@ class LoginController extends Controller
|
|||||||
| to conveniently provide its functionality to your applications.
|
| to conveniently provide its functionality to your applications.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
use AuthenticatesUsers {
|
||||||
use AuthenticatesUsers { logout as traitLogout; }
|
logout as traitLogout;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirection paths.
|
* Redirection paths.
|
||||||
@ -112,8 +113,10 @@ class LoginController extends Controller
|
|||||||
// If the class is using the ThrottlesLogins trait, we can automatically throttle
|
// If the class is using the ThrottlesLogins trait, we can automatically throttle
|
||||||
// the login attempts for this application. We'll key this by the username and
|
// the login attempts for this application. We'll key this by the username and
|
||||||
// the IP address of the client making these requests into this application.
|
// the IP address of the client making these requests into this application.
|
||||||
if (method_exists($this, 'hasTooManyLoginAttempts') &&
|
if (
|
||||||
$this->hasTooManyLoginAttempts($request)) {
|
method_exists($this, 'hasTooManyLoginAttempts') &&
|
||||||
|
$this->hasTooManyLoginAttempts($request)
|
||||||
|
) {
|
||||||
$this->fireLockoutEvent($request);
|
$this->fireLockoutEvent($request);
|
||||||
|
|
||||||
Activity::logFailedLogin($username);
|
Activity::logFailedLogin($username);
|
||||||
|
@ -27,7 +27,6 @@ class RegisterController extends Controller
|
|||||||
| provide this functionality without requiring any additional code.
|
| provide this functionality without requiring any additional code.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use RegistersUsers;
|
use RegistersUsers;
|
||||||
|
|
||||||
protected SocialAuthService $socialAuthService;
|
protected SocialAuthService $socialAuthService;
|
||||||
|
@ -20,7 +20,6 @@ class ResetPasswordController extends Controller
|
|||||||
| explore this trait and override any methods you wish to tweak.
|
| explore this trait and override any methods you wish to tweak.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use ResetsPasswords;
|
use ResetsPasswords;
|
||||||
|
|
||||||
protected $redirectTo = '/';
|
protected $redirectTo = '/';
|
||||||
|
@ -147,7 +147,7 @@ class BookController extends Controller
|
|||||||
{
|
{
|
||||||
$book = $this->bookRepo->getBySlug($slug);
|
$book = $this->bookRepo->getBySlug($slug);
|
||||||
$this->checkOwnablePermission('book-update', $book);
|
$this->checkOwnablePermission('book-update', $book);
|
||||||
$this->setPageTitle(trans('entities.books_edit_named', ['bookName'=>$book->getShortName()]));
|
$this->setPageTitle(trans('entities.books_edit_named', ['bookName' => $book->getShortName()]));
|
||||||
|
|
||||||
return view('books.edit', ['book' => $book, 'current' => $book]);
|
return view('books.edit', ['book' => $book, 'current' => $book]);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ class BookSortController extends Controller
|
|||||||
|
|
||||||
$bookChildren = (new BookContents($book))->getTree(false);
|
$bookChildren = (new BookContents($book))->getTree(false);
|
||||||
|
|
||||||
$this->setPageTitle(trans('entities.books_sort_named', ['bookName'=>$book->getShortName()]));
|
$this->setPageTitle(trans('entities.books_sort_named', ['bookName' => $book->getShortName()]));
|
||||||
|
|
||||||
return view('books.sort', ['book' => $book, 'current' => $book, 'bookChildren' => $bookChildren]);
|
return view('books.sort', ['book' => $book, 'current' => $book, 'bookChildren' => $bookChildren]);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ class PageRevisionController extends Controller
|
|||||||
// TODO - Refactor PageContent so we don't need to juggle this
|
// TODO - Refactor PageContent so we don't need to juggle this
|
||||||
$page->html = $revision->html;
|
$page->html = $revision->html;
|
||||||
$page->html = (new PageContent($page))->render();
|
$page->html = (new PageContent($page))->render();
|
||||||
$this->setPageTitle(trans('entities.pages_revision_named', ['pageName'=>$page->getShortName()]));
|
$this->setPageTitle(trans('entities.pages_revision_named', ['pageName' => $page->getShortName()]));
|
||||||
|
|
||||||
return view('pages.revision', [
|
return view('pages.revision', [
|
||||||
'page' => $page,
|
'page' => $page,
|
||||||
|
@ -315,7 +315,7 @@ class ImageService
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$thumb = $this->imageTool->make($imageData);
|
$thumb = $this->imageTool->make($imageData);
|
||||||
} catch (ErrorException|NotSupportedException $e) {
|
} catch (ErrorException | NotSupportedException $e) {
|
||||||
throw new ImageUploadException(trans('errors.cannot_create_thumbs'));
|
throw new ImageUploadException(trans('errors.cannot_create_thumbs'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
"nunomaduro/collision": "^5.10",
|
"nunomaduro/collision": "^5.10",
|
||||||
"nunomaduro/larastan": "^1.0",
|
"nunomaduro/larastan": "^1.0",
|
||||||
"phpunit/phpunit": "^9.5",
|
"phpunit/phpunit": "^9.5",
|
||||||
|
"squizlabs/php_codesniffer": "^3.7",
|
||||||
"ssddanbrown/asserthtml": "^1.0"
|
"ssddanbrown/asserthtml": "^1.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
58
composer.lock
generated
58
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "4ab21f732b2380ed1c3dd1a4eca2ef1a",
|
"content-hash": "1d3bd88b99d07b5410ee4b245bece28e",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "aws/aws-crt-php",
|
"name": "aws/aws-crt-php",
|
||||||
@ -10645,6 +10645,62 @@
|
|||||||
},
|
},
|
||||||
"time": "2022-07-20T18:31:45+00:00"
|
"time": "2022-07-20T18:31:45+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "squizlabs/php_codesniffer",
|
||||||
|
"version": "3.7.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
||||||
|
"reference": "1359e176e9307e906dc3d890bcc9603ff6d90619"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619",
|
||||||
|
"reference": "1359e176e9307e906dc3d890bcc9603ff6d90619",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-simplexml": "*",
|
||||||
|
"ext-tokenizer": "*",
|
||||||
|
"ext-xmlwriter": "*",
|
||||||
|
"php": ">=5.4.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
||||||
|
},
|
||||||
|
"bin": [
|
||||||
|
"bin/phpcs",
|
||||||
|
"bin/phpcbf"
|
||||||
|
],
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Greg Sherwood",
|
||||||
|
"role": "lead"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
|
||||||
|
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
|
||||||
|
"keywords": [
|
||||||
|
"phpcs",
|
||||||
|
"standards"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
|
||||||
|
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
|
||||||
|
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
|
||||||
|
},
|
||||||
|
"time": "2022-06-18T07:21:10+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "ssddanbrown/asserthtml",
|
"name": "ssddanbrown/asserthtml",
|
||||||
"version": "v1.0.1",
|
"version": "v1.0.1",
|
||||||
|
35
phpcs.xml
Normal file
35
phpcs.xml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd">
|
||||||
|
<description>The coding standard for BookStack</description>
|
||||||
|
|
||||||
|
<file>app</file>
|
||||||
|
<file>bootstrap/app.php</file>
|
||||||
|
<file>database</file>
|
||||||
|
<file>public/index.php</file>
|
||||||
|
<file>routes</file>
|
||||||
|
<file>tests</file>
|
||||||
|
|
||||||
|
<arg name="basepath" value="."/>
|
||||||
|
<arg name="colors"/>
|
||||||
|
<arg name="parallel" value="75"/>
|
||||||
|
<arg value="np"/>
|
||||||
|
|
||||||
|
<rule ref="PSR12"/>
|
||||||
|
|
||||||
|
<rule ref="PSR1.Methods.CamelCapsMethodName">
|
||||||
|
<exclude-pattern>./tests/*</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
|
||||||
|
<exclude-pattern>./tests/*</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
|
||||||
|
<exclude-pattern>./database/*</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<rule ref="PSR12.Files.FileHeader.IncorrectOrder">
|
||||||
|
<exclude-pattern>./app/Config/*</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
</ruleset>
|
@ -1,5 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Routes for the BookStack API.
|
||||||
|
* Routes have a uri prefix of /api/.
|
||||||
|
* Controllers are all within app/Http/Controllers/Api.
|
||||||
|
*/
|
||||||
|
|
||||||
use BookStack\Http\Controllers\Api\ApiDocsController;
|
use BookStack\Http\Controllers\Api\ApiDocsController;
|
||||||
use BookStack\Http\Controllers\Api\AttachmentApiController;
|
use BookStack\Http\Controllers\Api\AttachmentApiController;
|
||||||
use BookStack\Http\Controllers\Api\BookApiController;
|
use BookStack\Http\Controllers\Api\BookApiController;
|
||||||
@ -14,11 +20,6 @@ use BookStack\Http\Controllers\Api\SearchApiController;
|
|||||||
use BookStack\Http\Controllers\Api\UserApiController;
|
use BookStack\Http\Controllers\Api\UserApiController;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
/**
|
|
||||||
* Routes for the BookStack API.
|
|
||||||
* Routes have a uri prefix of /api/.
|
|
||||||
* Controllers are all within app/Http/Controllers/Api.
|
|
||||||
*/
|
|
||||||
Route::get('docs.json', [ApiDocsController::class, 'json']);
|
Route::get('docs.json', [ApiDocsController::class, 'json']);
|
||||||
|
|
||||||
Route::get('attachments', [AttachmentApiController::class, 'list']);
|
Route::get('attachments', [AttachmentApiController::class, 'list']);
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace Tests\Actions;
|
namespace Tests\Actions;
|
||||||
|
|
||||||
use function app;
|
|
||||||
use BookStack\Actions\Activity;
|
use BookStack\Actions\Activity;
|
||||||
use BookStack\Actions\ActivityLogger;
|
use BookStack\Actions\ActivityLogger;
|
||||||
use BookStack\Actions\ActivityType;
|
use BookStack\Actions\ActivityType;
|
||||||
@ -12,7 +11,6 @@ use BookStack\Entities\Models\Page;
|
|||||||
use BookStack\Entities\Repos\PageRepo;
|
use BookStack\Entities\Repos\PageRepo;
|
||||||
use BookStack\Entities\Tools\TrashCan;
|
use BookStack\Entities\Tools\TrashCan;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use function config;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class AuditLogTest extends TestCase
|
class AuditLogTest extends TestCase
|
||||||
|
@ -80,7 +80,7 @@ class AttachmentTest extends TestCase
|
|||||||
|
|
||||||
$expectedResp = [
|
$expectedResp = [
|
||||||
'name' => $fileName,
|
'name' => $fileName,
|
||||||
'uploaded_to'=> $page->id,
|
'uploaded_to' => $page->id,
|
||||||
'extension' => 'txt',
|
'extension' => 'txt',
|
||||||
'order' => 1,
|
'order' => 1,
|
||||||
'created_by' => $admin->id,
|
'created_by' => $admin->id,
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace Tests;
|
namespace Tests;
|
||||||
|
|
||||||
use BookStack\Http\Request;
|
use BookStack\Http\Request;
|
||||||
|
|
||||||
use function request;
|
use function request;
|
||||||
use function url;
|
use function url;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user