<?php namespace BookStack\Actions;
-use BookStack\Actions\Activity;
use BookStack\Auth\Permissions\PermissionService;
use BookStack\Entities\Entity;
use Session;
<?php namespace BookStack\Actions;
-use BookStack\Actions\Comment;
use BookStack\Entities\Entity;
/**
<?php namespace BookStack\Actions;
-use BookStack\Entities\Entity;
use BookStack\Auth\Permissions\PermissionService;
+use BookStack\Entities\Entity;
/**
* Class TagRepo
<?php namespace BookStack\Auth\Access;
-use BookStack\Notifications\ConfirmEmail;
+use BookStack\Auth\User;
use BookStack\Auth\UserRepo;
-use Carbon\Carbon;
use BookStack\Exceptions\ConfirmationEmailException;
use BookStack\Exceptions\UserRegistrationException;
-use BookStack\Auth\User;
+use BookStack\Notifications\ConfirmEmail;
+use Carbon\Carbon;
use Illuminate\Database\Connection as Database;
class EmailConfirmationService
<?php namespace BookStack\Auth\Access;
use BookStack\Auth\Access;
-use BookStack\Exceptions\LdapException;
-use BookStack\Auth\UserRepo;
use BookStack\Auth\Role;
use BookStack\Auth\User;
-use BookStack\Auth\Access\Ldap;
+use BookStack\Auth\UserRepo;
+use BookStack\Exceptions\LdapException;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Builder;
<?php namespace BookStack\Auth\Access;
-use BookStack\Exceptions\SocialSignInAccountNotUsed;
-use Laravel\Socialite\Contracts\Factory as Socialite;
+use BookStack\Auth\SocialAccount;
+use BookStack\Auth\UserRepo;
use BookStack\Exceptions\SocialDriverNotConfigured;
+use BookStack\Exceptions\SocialSignInAccountNotUsed;
use BookStack\Exceptions\UserRegistrationException;
-use BookStack\Auth\UserRepo;
-use BookStack\Auth\SocialAccount;
+use Laravel\Socialite\Contracts\Factory as Socialite;
use Laravel\Socialite\Contracts\User as SocialUser;
class SocialAuthService
<?php namespace BookStack\Auth\Permissions;
+use BookStack\Auth\Role;
use BookStack\Entities\Entity;
use BookStack\Model;
-use BookStack\Auth\Role;
class JointPermission extends Model
{
<?php namespace BookStack\Auth\Permissions;
use BookStack\Auth\Permissions;
+use BookStack\Auth\Role;
use BookStack\Entities\Book;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Chapter;
use BookStack\Entities\Entity;
-use BookStack\Auth\Permissions\EntityPermission;
-use BookStack\Auth\Permissions\JointPermission;
-use BookStack\Ownable;
use BookStack\Entities\Page;
-use BookStack\Auth\Role;
-use BookStack\Auth\User;
+use BookStack\Ownable;
use Illuminate\Database\Connection;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Query\Builder as QueryBuilder;
<?php namespace BookStack\Auth\Permissions;
use BookStack\Auth\Permissions;
-use BookStack\Exceptions\PermissionsException;
-use BookStack\Auth\Permissions\RolePermission;
use BookStack\Auth\Role;
-use BookStack\Auth\Permissions\PermissionService;
-use Setting;
+use BookStack\Exceptions\PermissionsException;
class PermissionsRepo
{
use BookStack\Auth\Permissions\JointPermission;
use BookStack\Model;
-use BookStack\Auth\Permissions\RolePermission;
class Role extends Model
{
<?php namespace BookStack\Auth;
-use BookStack\Auth\User;
use BookStack\Model;
class SocialAccount extends Model
<?php namespace BookStack\Auth;
-use BookStack\Uploads\Image;
use BookStack\Model;
use BookStack\Notifications\ResetPassword;
-use BookStack\Auth\Role;
-use BookStack\Auth\SocialAccount;
+use BookStack\Uploads\Image;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use BookStack\Entities\EntityRepo;
use BookStack\Exceptions\NotFoundException;
use BookStack\Uploads\Image;
-use BookStack\Auth\Role;
-use BookStack\Auth\User;
use Exception;
use Images;
<?php namespace BookStack\Entities;
use BookStack\Uploads\Image;
-use BookStack\Entities\Page;
class Book extends Entity
{
<?php namespace BookStack\Entities;
-use BookStack\Entities\Book;
-use BookStack\Entities\Entity;
-use BookStack\Entities\Page;
-
class Chapter extends Entity
{
public $searchFactor = 1.3;
use BookStack\Actions\Activity;
use BookStack\Actions\Comment;
+use BookStack\Actions\Tag;
+use BookStack\Actions\View;
use BookStack\Auth\Permissions\EntityPermission;
use BookStack\Auth\Permissions\JointPermission;
use BookStack\Ownable;
-use BookStack\Actions\Tag;
-use BookStack\Actions\View;
use Illuminate\Database\Eloquent\Relations\MorphMany;
class Entity extends Ownable
<?php namespace BookStack\Entities;
-
+/**
+ * Class EntityProvider
+ *
+ * Provides access to the core entity models.
+ * Wrapped up in this provider since they are often used together
+ * so this is a neater alternative to injecting all in individually.
+ *
+ * @package BookStack\Entities
+ */
class EntityProvider
{
- // TODO -
+
+ /**
+ * @var Bookshelf
+ */
+ protected $bookshelf;
+
+ /**
+ * @var Book
+ */
+ protected $book;
+
+ /**
+ * @var Chapter
+ */
+ protected $chapter;
+
+ /**
+ * @var Page
+ */
+ protected $page;
+
+ /**
+ * @var PageRevision
+ */
+ protected $pageRevision;
+
+ /**
+ * EntityProvider constructor.
+ * @param Bookshelf $bookshelf
+ * @param Book $book
+ * @param Chapter $chapter
+ * @param Page $page
+ * @param PageRevision $pageRevision
+ */
+ public function __construct(
+ Bookshelf $bookshelf,
+ Book $book,
+ Chapter $chapter,
+ Page $page,
+ PageRevision $pageRevision
+ ) {
+ $this->bookshelf = $bookshelf;
+ $this->book = $book;
+ $this->chapter = $chapter;
+ $this->page = $page;
+ $this->pageRevision = $pageRevision;
+ }
+
+ /**
+ * Fetch all core entity types as an associated array
+ * with their basic names as the keys.
+ * @return Entity[]
+ */
+ public function all()
+ {
+ return [
+ 'bookshelf' => $this->bookshelf,
+ 'book' => $this->book,
+ 'chapter' => $this->chapter,
+ 'page' => $this->page,
+ ];
+ }
+
+
}
\ No newline at end of file
<?php namespace BookStack\Entities;
-use BookStack\Entities\Book;
-use BookStack\Entities\Bookshelf;
-use BookStack\Entities\Chapter;
-use BookStack\Entities\Entity;
+use BookStack\Actions\TagRepo;
+use BookStack\Actions\ViewService;
+use BookStack\Auth\Permissions\PermissionService;
use BookStack\Exceptions\NotFoundException;
use BookStack\Exceptions\NotifyException;
-use BookStack\Entities\Page;
-use BookStack\Entities\PageRevision;
-use BookStack\Actions\TagRepo;
use BookStack\Uploads\AttachmentService;
-use BookStack\Auth\Permissions\PermissionService;
-use BookStack\Entities\SearchService;
-use BookStack\Actions\ViewService;
use Carbon\Carbon;
use DOMDocument;
use DOMXPath;
<?php namespace BookStack\Entities;
-use BookStack\Entities\Book;
-use BookStack\Entities\Chapter;
-use BookStack\Entities\Page;
-use BookStack\Entities\EntityRepo;
use BookStack\Uploads\ImageService;
class ExportService
/**
* ExportService constructor.
- * @param $entityRepo
+ * @param EntityRepo $entityRepo
+ * @param ImageService $imageService
*/
public function __construct(EntityRepo $entityRepo, ImageService $imageService)
{
<?php namespace BookStack\Entities;
use BookStack\Uploads\Attachment;
-use BookStack\Entities\Book;
-use BookStack\Entities\Chapter;
-use BookStack\Entities\Entity;
-use BookStack\Entities\PageRevision;
class Page extends Entity
{
<?php namespace BookStack\Entities;
-use BookStack\Entities\Page;
-use BookStack\Model;
use BookStack\Auth\User;
+use BookStack\Model;
class PageRevision extends Model
{
<?php namespace BookStack\Entities;
-use BookStack\Entities\Book;
-use BookStack\Entities\Bookshelf;
-use BookStack\Entities\Chapter;
-use BookStack\Entities\Entity;
-use BookStack\Entities\Page;
-use BookStack\Entities\SearchTerm;
use BookStack\Auth\Permissions\PermissionService;
use Illuminate\Database\Connection;
use Illuminate\Database\Query\Builder;
namespace BookStack\Exceptions;
use Exception;
+use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\AuthenticationException;
-use Illuminate\Validation\ValidationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
-use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
-use Illuminate\Auth\Access\AuthorizationException;
+use Illuminate\Validation\ValidationException;
+use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class Handler extends ExceptionHandler
<?php namespace BookStack\Http\Controllers;
+use BookStack\Entities\EntityRepo;
use BookStack\Exceptions\FileUploadException;
-use BookStack\Uploads\Attachment;
use BookStack\Exceptions\NotFoundException;
-use BookStack\Entities\EntityRepo;
+use BookStack\Uploads\Attachment;
use BookStack\Uploads\AttachmentService;
use Illuminate\Http\Request;
namespace BookStack\Http\Controllers\Auth;
-use BookStack\Exceptions\AuthException;
-use BookStack\Http\Controllers\Controller;
-use BookStack\Auth\UserRepo;
use BookStack\Auth\Access\LdapService;
use BookStack\Auth\Access\SocialAuthService;
+use BookStack\Auth\UserRepo;
+use BookStack\Exceptions\AuthException;
+use BookStack\Http\Controllers\Controller;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
namespace BookStack\Http\Controllers\Auth;
+use BookStack\Auth\SocialAccount;
+use BookStack\Auth\User;
+use BookStack\Auth\UserRepo;
use BookStack\Exceptions\SocialSignInAccountNotUsed;
use BookStack\Exceptions\SocialSignInException;
use BookStack\Exceptions\UserRegistrationException;
-use BookStack\Auth\UserRepo;
-use BookStack\Auth\Access\EmailConfirmationService;
-use BookStack\Auth\Access\SocialAuthService;
-use BookStack\Auth\SocialAccount;
-use BookStack\Auth\User;
+use BookStack\Http\Controllers\Controller;
use Exception;
+use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
-use Validator;
-use BookStack\Http\Controllers\Controller;
-use Illuminate\Foundation\Auth\RegistersUsers;
use Laravel\Socialite\Contracts\User as SocialUser;
+use Validator;
class RegisterController extends Controller
{
<?php namespace BookStack\Http\Controllers;
use Activity;
+use BookStack\Auth\UserRepo;
use BookStack\Entities\Book;
use BookStack\Entities\EntityRepo;
-use BookStack\Auth\UserRepo;
use BookStack\Entities\ExportService;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
<?php namespace BookStack\Http\Controllers;
use Activity;
-use BookStack\Entities\Book;
+use BookStack\Auth\UserRepo;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\EntityRepo;
-use BookStack\Auth\UserRepo;
use BookStack\Entities\ExportService;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
<?php namespace BookStack\Http\Controllers;
use Activity;
-use BookStack\Entities\EntityRepo;
use BookStack\Auth\UserRepo;
+use BookStack\Entities\EntityRepo;
use BookStack\Entities\ExportService;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
namespace BookStack\Http\Controllers;
+use BookStack\Auth\User;
use BookStack\Ownable;
use Illuminate\Foundation\Bus\DispatchesJobs;
+use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller as BaseController;
-use Illuminate\Foundation\Validation\ValidatesRequests;
-use BookStack\Auth\User;
abstract class Controller extends BaseController
{
use Activity;
use BookStack\Entities\EntityRepo;
-use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Views;
<?php namespace BookStack\Http\Controllers;
-use BookStack\Exceptions\ImageUploadException;
-use BookStack\Exceptions\NotFoundException;
use BookStack\Entities\EntityRepo;
+use BookStack\Exceptions\ImageUploadException;
+use BookStack\Repos\PageRepo;
+use BookStack\Uploads\Image;
use BookStack\Uploads\ImageRepo;
use Illuminate\Filesystem\Filesystem as File;
use Illuminate\Http\Request;
-use BookStack\Uploads\Image;
-use BookStack\Repos\PageRepo;
class ImageController extends Controller
{
<?php namespace BookStack\Http\Controllers;
use Activity;
-use BookStack\Exceptions\NotFoundException;
-use BookStack\Entities\EntityRepo;
use BookStack\Auth\UserRepo;
+use BookStack\Entities\EntityRepo;
use BookStack\Entities\ExportService;
+use BookStack\Exceptions\NotFoundException;
+use GatherContent\Htmldiff\Htmldiff;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Views;
-use GatherContent\Htmldiff\Htmldiff;
class PageController extends Controller
{
<?php namespace BookStack\Http\Controllers;
-use BookStack\Exceptions\PermissionsException;
use BookStack\Auth\Permissions\PermissionsRepo;
+use BookStack\Exceptions\PermissionsException;
use Illuminate\Http\Request;
class PermissionController extends Controller
<?php namespace BookStack\Http\Controllers;
+use BookStack\Actions\ViewService;
use BookStack\Entities\EntityRepo;
use BookStack\Entities\SearchService;
-use BookStack\Actions\ViewService;
use Illuminate\Http\Request;
class SearchController extends Controller
<?php namespace BookStack\Http\Controllers;
-use Exception;
-use Illuminate\Http\Request;
-use Illuminate\Http\Response;
-use BookStack\Auth\UserRepo;
use BookStack\Auth\Access\SocialAuthService;
use BookStack\Auth\User;
+use BookStack\Auth\UserRepo;
+use Illuminate\Http\Request;
+use Illuminate\Http\Response;
class UserController extends Controller
{
namespace BookStack\Http\Middleware;
use Closure;
-use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
+use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
namespace BookStack\Notifications;
use Illuminate\Bus\Queueable;
-use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
+use Illuminate\Notifications\Notification;
class ConfirmEmail extends Notification implements ShouldQueue
{
namespace BookStack\Notifications;
-use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;
+use Illuminate\Notifications\Notification;
class ResetPassword extends Notification
{
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Chapter;
use BookStack\Entities\Page;
-use BookStack\Settings\SettingService;
use BookStack\Settings\Setting;
+use BookStack\Settings\SettingService;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\ServiceProvider;
use Schema;
namespace BookStack\Providers;
use Illuminate\Support\ServiceProvider;
-use Illuminate\Support\Facades\Broadcast;
class BroadcastServiceProvider extends ServiceProvider
{
namespace BookStack\Providers;
use BookStack\Actions\Activity;
-use BookStack\Uploads\Image;
-use BookStack\Uploads\ImageService;
-use BookStack\Auth\Permissions\PermissionService;
+use BookStack\Actions\ActivityService;
+use BookStack\Actions\View;
use BookStack\Actions\ViewService;
+use BookStack\Auth\Permissions\PermissionService;
use BookStack\Settings\Setting;
-use BookStack\Actions\View;
+use BookStack\Settings\SettingService;
+use BookStack\Uploads\Image;
+use BookStack\Uploads\ImageService;
use Illuminate\Contracts\Cache\Repository;
use Illuminate\Contracts\Filesystem\Factory;
use Illuminate\Support\ServiceProvider;
-use BookStack\Actions\ActivityService;
-use BookStack\Settings\SettingService;
use Intervention\Image\ImageManager;
class CustomFacadeProvider extends ServiceProvider
namespace BookStack\Providers;
-use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use SocialiteProviders\Manager\SocialiteWasCalled;
namespace BookStack\Providers;
-use BookStack\Auth\Role;
use BookStack\Auth\Access\LdapService;
-use BookStack\Auth\User;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Contracts\Auth\UserProvider;
namespace BookStack\Providers;
-use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Route;
<?php namespace BookStack\Settings;
-use BookStack\Settings\Setting;
-use BookStack\Auth\User;
use Illuminate\Contracts\Cache\Repository as Cache;
/**
<?php namespace BookStack\Uploads;
use BookStack\Exceptions\FileUploadException;
-use BookStack\Uploads\Attachment;
-use BookStack\Uploads\UploadService;
use Exception;
use Symfony\Component\HttpFoundation\File\UploadedFile;
<?php namespace BookStack\Uploads;
-use BookStack\Uploads\Image;
-use BookStack\Entities\Page;
-use BookStack\Uploads\ImageService;
use BookStack\Auth\Permissions\PermissionService;
+use BookStack\Entities\Page;
use Symfony\Component\HttpFoundation\File\UploadedFile;
class ImageRepo
<?php namespace BookStack\Uploads;
-use BookStack\Exceptions\ImageUploadException;
-use BookStack\Uploads\Image;
use BookStack\Auth\User;
-use BookStack\Uploads\UploadService;
+use BookStack\Exceptions\ImageUploadException;
use DB;
use Exception;
+use Illuminate\Contracts\Cache\Repository as Cache;
+use Illuminate\Contracts\Filesystem\Factory as FileSystem;
use Intervention\Image\Exception\NotSupportedException;
use Intervention\Image\ImageManager;
-use Illuminate\Contracts\Filesystem\Factory as FileSystem;
-use Illuminate\Contracts\Cache\Repository as Cache;
use Symfony\Component\HttpFoundation\File\UploadedFile;
class ImageService extends UploadService