Ran phpcbf

This commit is contained in:
Dan Brown 2019-05-05 14:54:37 +01:00
parent adc866cb3d
commit 3f83c548f8
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
11 changed files with 11 additions and 20 deletions

View File

@ -224,7 +224,7 @@ class UserRepo
*/ */
public function getRecentlyCreated(User $user, $count = 20) public function getRecentlyCreated(User $user, $count = 20)
{ {
$createdByUserQuery = function(Builder $query) use ($user) { $createdByUserQuery = function (Builder $query) use ($user) {
$query->where('created_by', '=', $user->id); $query->where('created_by', '=', $user->id);
}; };

View File

@ -31,4 +31,4 @@ class BreadcrumbsViewComposer
} }
} }
} }
} }

View File

@ -37,7 +37,6 @@ class EntityContextManager
if ($shelf && $shelf->contains($book)) { if ($shelf && $shelf->contains($book)) {
return $shelf; return $shelf;
} }
} }
return null; return null;
} }
@ -58,5 +57,4 @@ class EntityContextManager
{ {
$this->session->forget($this->KEY_SHELF_CONTEXT_ID); $this->session->forget($this->KEY_SHELF_CONTEXT_ID);
} }
}
}

View File

@ -62,5 +62,4 @@ class PageRevision extends Model
{ {
return $type === 'revision'; return $type === 'revision';
} }
} }

View File

@ -132,7 +132,7 @@ abstract class Controller extends BaseController
*/ */
protected function checkPermissionOrCurrentUser(string $permissionName, int $userId) protected function checkPermissionOrCurrentUser(string $permissionName, int $userId)
{ {
return $this->checkPermissionOr($permissionName, function() use ($userId) { return $this->checkPermissionOr($permissionName, function () use ($userId) {
return $userId === $this->currentUser->id; return $userId === $this->currentUser->id;
}); });
} }

View File

@ -85,5 +85,4 @@ class DrawioImageController extends Controller
'content' => base64_encode($imageData) 'content' => base64_encode($imageData)
]); ]);
} }
} }

View File

@ -61,5 +61,4 @@ class GalleryImageController extends Controller
return response()->json($image); return response()->json($image);
} }
} }

View File

@ -368,5 +368,4 @@ class UserController extends Controller
return redirect()->back(302, [], "/settings/users/$userId"); return redirect()->back(302, [], "/settings/users/$userId");
} }
} }

View File

@ -25,8 +25,7 @@ class ImageRepo
ImageService $imageService, ImageService $imageService,
PermissionService $permissionService, PermissionService $permissionService,
Page $page Page $page
) ) {
{
$this->image = $image; $this->image = $image;
$this->imageService = $imageService; $this->imageService = $imageService;
$this->restrictionService = $permissionService; $this->restrictionService = $permissionService;
@ -87,8 +86,7 @@ class ImageRepo
int $uploadedTo = null, int $uploadedTo = null,
string $search = null, string $search = null,
callable $whereClause = null callable $whereClause = null
) ) {
{
$imageQuery = $this->image->newQuery()->where('type', '=', strtolower($type)); $imageQuery = $this->image->newQuery()->where('type', '=', strtolower($type));
if ($uploadedTo !== null) { if ($uploadedTo !== null) {
@ -126,13 +124,12 @@ class ImageRepo
int $pageSize = 24, int $pageSize = 24,
int $uploadedTo = null, int $uploadedTo = null,
string $search = null string $search = null
) ) {
{
$contextPage = $this->page->findOrFail($uploadedTo); $contextPage = $this->page->findOrFail($uploadedTo);
$parentFilter = null; $parentFilter = null;
if ($filterType === 'book' || $filterType === 'page') { if ($filterType === 'book' || $filterType === 'page') {
$parentFilter = function(Builder $query) use ($filterType, $contextPage) { $parentFilter = function (Builder $query) use ($filterType, $contextPage) {
if ($filterType === 'page') { if ($filterType === 'page') {
$query->where('uploaded_to', '=', $contextPage->id); $query->where('uploaded_to', '=', $contextPage->id);
} elseif ($filterType === 'book') { } elseif ($filterType === 'book') {

View File

@ -73,8 +73,7 @@ class ImageService extends UploadService
int $resizeWidth = null, int $resizeWidth = null,
int $resizeHeight = null, int $resizeHeight = null,
bool $keepRatio = true bool $keepRatio = true
) ) {
{
$imageName = $uploadedFile->getClientOriginalName(); $imageName = $uploadedFile->getClientOriginalName();
$imageData = file_get_contents($uploadedFile->getRealPath()); $imageData = file_get_contents($uploadedFile->getRealPath());

View File

@ -52,7 +52,8 @@ function signedInUser() : bool
* Check if the current user has general access. * Check if the current user has general access.
* @return bool * @return bool
*/ */
function hasAppAccess() : bool { function hasAppAccess() : bool
{
return !auth()->guest() || setting('app-public'); return !auth()->guest() || setting('app-public');
} }