Merge branch 'master' into release

This commit is contained in:
Dan Brown 2017-12-10 18:19:20 +00:00
commit 8b30c7f02e
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
103 changed files with 10345 additions and 2899 deletions

View File

@ -46,6 +46,9 @@ GITHUB_APP_ID=false
GITHUB_APP_SECRET=false GITHUB_APP_SECRET=false
GOOGLE_APP_ID=false GOOGLE_APP_ID=false
GOOGLE_APP_SECRET=false GOOGLE_APP_SECRET=false
OKTA_BASE_URL=false
OKTA_KEY=false
OKTA_SECRET=false
# External services such as Gravatar # External services such as Gravatar
DISABLE_EXTERNAL_SERVICES=false DISABLE_EXTERNAL_SERVICES=false

7
.gitignore vendored
View File

@ -2,8 +2,10 @@
/node_modules /node_modules
Homestead.yaml Homestead.yaml
.env .env
/public/dist
.idea .idea
npm-debug.log
yarn-error.log
/public/dist
/public/plugins /public/plugins
/public/css/*.map /public/css/*.map
/public/js/*.map /public/js/*.map
@ -18,5 +20,4 @@ yarn.lock
nbproject nbproject
.buildpath .buildpath
.project .project
.settings/org.eclipse.wst.common.project.facet.core.xml .settings/
.settings/org.eclipse.php.core.prefs

View File

@ -2,7 +2,8 @@ dist: trusty
sudo: false sudo: false
language: php language: php
php: php:
- 7.0.7 - 7.0.20
- 7.1.9
cache: cache:
directories: directories:
@ -14,7 +15,6 @@ before_script:
- mysql -u root -e "GRANT ALL ON \`bookstack-test\`.* TO 'bookstack-test'@'localhost';" - mysql -u root -e "GRANT ALL ON \`bookstack-test\`.* TO 'bookstack-test'@'localhost';"
- mysql -u root -e "FLUSH PRIVILEGES;" - mysql -u root -e "FLUSH PRIVILEGES;"
- phpenv config-rm xdebug.ini - phpenv config-rm xdebug.ini
- composer dump-autoload --no-interaction
- composer install --prefer-dist --no-interaction - composer install --prefer-dist --no-interaction
- php artisan clear-compiled -n - php artisan clear-compiled -n
- php artisan optimize -n - php artisan optimize -n

View File

@ -3,7 +3,7 @@
class Book extends Entity class Book extends Entity
{ {
protected $fillable = ['name', 'description']; protected $fillable = ['name', 'description', 'image_id'];
/** /**
* Get the url for this book. * Get the url for this book.
@ -18,6 +18,33 @@ class Book extends Entity
return baseUrl('/books/' . urlencode($this->slug)); return baseUrl('/books/' . urlencode($this->slug));
} }
/**
* Returns book cover image, if book cover not exists return default cover image.
* @param int $width - Width of the image
* @param int $height - Height of the image
* @return string
*/
public function getBookCover($width = 440, $height = 250)
{
$default = baseUrl('/book_default_cover.png');
if (!$this->image_id) return $default;
try {
$cover = $this->cover ? baseUrl($this->cover->getThumb($width, $height, false)) : $default;
} catch (\Exception $err) {
$cover = $default;
}
return $cover;
}
/**
* Get the cover image of the book
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function cover()
{
return $this->belongsTo(Image::class, 'image_id');
}
/* /*
* Get the edit url for this book. * Get the edit url for this book.
* @return string * @return string

View File

@ -11,12 +11,7 @@ class Kernel extends ConsoleKernel
* @var array * @var array
*/ */
protected $commands = [ protected $commands = [
Commands\ClearViews::class, //
Commands\ClearActivity::class,
Commands\ClearRevisions::class,
Commands\RegeneratePermissions::class,
Commands\RegenerateSearch::class,
Commands\UpgradeDatabaseEncoding::class
]; ];
/** /**
@ -29,4 +24,14 @@ class Kernel extends ConsoleKernel
{ {
// //
} }
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
}
} }

View File

@ -26,10 +26,10 @@ class Handler extends ExceptionHandler
/** /**
* Report or log an exception. * Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc. * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
* *
* @param \Exception $e * @param \Exception $e
* @return mixed
*/ */
public function report(Exception $e) public function report(Exception $e)
{ {
@ -103,4 +103,16 @@ class Handler extends ExceptionHandler
return redirect()->guest('login'); return redirect()->guest('login');
} }
/**
* Convert a validation exception into a JSON response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Validation\ValidationException $exception
* @return \Illuminate\Http\JsonResponse
*/
protected function invalidJson($request, ValidationException $exception)
{
return response()->json($exception->errors(), $exception->status);
}
} }

View File

@ -72,13 +72,13 @@ class LoginController extends Controller
// Explicitly log them out for now if they do no exist. // Explicitly log them out for now if they do no exist.
if (!$user->exists) auth()->logout($user); if (!$user->exists) auth()->logout($user);
if (!$user->exists && $user->email === null && !$request->has('email')) { if (!$user->exists && $user->email === null && !$request->filled('email')) {
$request->flash(); $request->flash();
session()->flash('request-email', true); session()->flash('request-email', true);
return redirect('/login'); return redirect('/login');
} }
if (!$user->exists && $user->email === null && $request->has('email')) { if (!$user->exists && $user->email === null && $request->filled('email')) {
$user->email = $request->get('email'); $user->email = $request->get('email');
} }
@ -102,12 +102,21 @@ class LoginController extends Controller
/** /**
* Show the application login form. * Show the application login form.
* @param Request $request
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function getLogin() public function getLogin(Request $request)
{ {
$socialDrivers = $this->socialAuthService->getActiveDrivers(); $socialDrivers = $this->socialAuthService->getActiveDrivers();
$authMethod = config('auth.method'); $authMethod = config('auth.method');
if ($request->has('email')) {
session()->flashInput([
'email' => $request->get('email'),
'password' => (config('app.env') === 'demo') ? $request->get('password', '') : ''
]);
}
return view('auth/login', ['socialDrivers' => $socialDrivers, 'authMethod' => $authMethod]); return view('auth/login', ['socialDrivers' => $socialDrivers, 'authMethod' => $authMethod]);
} }

View File

@ -53,7 +53,7 @@ class RegisterController extends Controller
*/ */
public function __construct(SocialAuthService $socialAuthService, EmailConfirmationService $emailConfirmationService, UserRepo $userRepo) public function __construct(SocialAuthService $socialAuthService, EmailConfirmationService $emailConfirmationService, UserRepo $userRepo)
{ {
$this->middleware('guest')->except(['socialCallback', 'detachSocialAccount']); $this->middleware('guest')->only(['getRegister', 'postRegister', 'socialRegister']);
$this->socialAuthService = $socialAuthService; $this->socialAuthService = $socialAuthService;
$this->emailConfirmationService = $emailConfirmationService; $this->emailConfirmationService = $emailConfirmationService;
$this->userRepo = $userRepo; $this->userRepo = $userRepo;
@ -250,15 +250,27 @@ class RegisterController extends Controller
/** /**
* The callback for social login services. * The callback for social login services.
* @param $socialDriver * @param $socialDriver
* @param Request $request
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @throws SocialSignInException * @throws SocialSignInException
* @throws UserRegistrationException
* @throws \BookStack\Exceptions\SocialDriverNotConfigured
* @throws ConfirmationEmailException
*/ */
public function socialCallback($socialDriver) public function socialCallback($socialDriver, Request $request)
{ {
if (!session()->has('social-callback')) { if (!session()->has('social-callback')) {
throw new SocialSignInException(trans('errors.social_no_action_defined'), '/login'); throw new SocialSignInException(trans('errors.social_no_action_defined'), '/login');
} }
// Check request for error information
if ($request->has('error') && $request->has('error_description')) {
throw new SocialSignInException(trans('errors.social_login_bad_response', [
'socialAccount' => $socialDriver,
'error' => $request->get('error_description'),
]), '/login');
}
$action = session()->pull('social-callback'); $action = session()->pull('social-callback');
if ($action == 'login') return $this->socialAuthService->handleLoginCallback($socialDriver); if ($action == 'login') return $this->socialAuthService->handleLoginCallback($socialDriver);
if ($action == 'register') return $this->socialRegisterCallback($socialDriver); if ($action == 'register') return $this->socialRegisterCallback($socialDriver);
@ -279,7 +291,9 @@ class RegisterController extends Controller
* Register a new user after a registration callback. * Register a new user after a registration callback.
* @param $socialDriver * @param $socialDriver
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @throws ConfirmationEmailException
* @throws UserRegistrationException * @throws UserRegistrationException
* @throws \BookStack\Exceptions\SocialDriverNotConfigured
*/ */
protected function socialRegisterCallback($socialDriver) protected function socialRegisterCallback($socialDriver)
{ {

View File

@ -40,12 +40,14 @@ class BookController extends Controller
$recents = $this->signedIn ? $this->entityRepo->getRecentlyViewed('book', 4, 0) : false; $recents = $this->signedIn ? $this->entityRepo->getRecentlyViewed('book', 4, 0) : false;
$popular = $this->entityRepo->getPopular('book', 4, 0); $popular = $this->entityRepo->getPopular('book', 4, 0);
$new = $this->entityRepo->getRecentlyCreated('book', 4, 0); $new = $this->entityRepo->getRecentlyCreated('book', 4, 0);
$this->setPageTitle('Books'); $booksViewType = setting()->getUser($this->currentUser, 'books_view_type', 'list');
$this->setPageTitle(trans('entities.books'));
return view('books/index', [ return view('books/index', [
'books' => $books, 'books' => $books,
'recents' => $recents, 'recents' => $recents,
'popular' => $popular, 'popular' => $popular,
'new' => $new 'new' => $new,
'booksViewType' => $booksViewType
]); ]);
} }
@ -125,9 +127,9 @@ class BookController extends Controller
'name' => 'required|string|max:255', 'name' => 'required|string|max:255',
'description' => 'string|max:1000' 'description' => 'string|max:1000'
]); ]);
$book = $this->entityRepo->updateFromInput('book', $book, $request->all()); $book = $this->entityRepo->updateFromInput('book', $book, $request->all());
Activity::add($book, 'book_update', $book->id); Activity::add($book, 'book_update', $book->id);
return redirect($book->getUrl()); return redirect($book->getUrl());
} }
/** /**
@ -183,7 +185,7 @@ class BookController extends Controller
$this->checkOwnablePermission('book-update', $book); $this->checkOwnablePermission('book-update', $book);
// Return if no map sent // Return if no map sent
if (!$request->has('sort-tree')) { if (!$request->filled('sort-tree')) {
return redirect($book->getUrl()); return redirect($book->getUrl());
} }

View File

@ -54,6 +54,7 @@ class HomeController extends Controller
/** /**
* Get a js representation of the current translations * Get a js representation of the current translations
* @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
* @throws \Exception
*/ */
public function getTranslations() { public function getTranslations() {
$locale = app()->getLocale(); $locale = app()->getLocale();
@ -86,4 +87,13 @@ class HomeController extends Controller
]); ]);
} }
/**
* Get custom head HTML, Used in ajax calls to show in editor.
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function customHeadContent()
{
return view('partials/custom-head-content');
}
} }

View File

@ -107,7 +107,7 @@ class ImageController extends Controller
$imageUpload = $request->file('file'); $imageUpload = $request->file('file');
try { try {
$uploadedTo = $request->has('uploaded_to') ? $request->get('uploaded_to') : 0; $uploadedTo = $request->filled('uploaded_to') ? $request->get('uploaded_to') : 0;
$image = $this->imageRepo->saveNew($imageUpload, $type, $uploadedTo); $image = $this->imageRepo->saveNew($imageUpload, $type, $uploadedTo);
} catch (ImageUploadException $e) { } catch (ImageUploadException $e) {
return response($e->getMessage(), 500); return response($e->getMessage(), 500);
@ -162,7 +162,7 @@ class ImageController extends Controller
$this->checkOwnablePermission('image-delete', $image); $this->checkOwnablePermission('image-delete', $image);
// Check if this image is used on any pages // Check if this image is used on any pages
$isForced = ($request->has('force') && ($request->get('force') === 'true') || $request->get('force') === true); $isForced = in_array($request->get('force', ''), [true, 'true']);
if (!$isForced) { if (!$isForced) {
$pageSearch = $entityRepo->searchForImage($image->url); $pageSearch = $entityRepo->searchForImage($image->url);
if ($pageSearch !== false) { if ($pageSearch !== false) {

View File

@ -161,14 +161,22 @@ class PageController extends Controller
$page->html = $this->entityRepo->renderPage($page); $page->html = $this->entityRepo->renderPage($page);
$sidebarTree = $this->entityRepo->getBookChildren($page->book); $sidebarTree = $this->entityRepo->getBookChildren($page->book);
$pageNav = $this->entityRepo->getPageNav($page->html); $pageNav = $this->entityRepo->getPageNav($page->html);
$page->load(['comments.createdBy']);
// check if the comment's are enabled
$commentsEnabled = !setting('app-disable-comments');
if ($commentsEnabled) {
$page->load(['comments.createdBy']);
}
Views::add($page); Views::add($page);
$this->setPageTitle($page->getShortName()); $this->setPageTitle($page->getShortName());
return view('pages/show', [ return view('pages/show', [
'page' => $page,'book' => $page->book, 'page' => $page,'book' => $page->book,
'current' => $page, 'sidebarTree' => $sidebarTree, 'current' => $page,
'pageNav' => $pageNav]); 'sidebarTree' => $sidebarTree,
'commentsEnabled' => $commentsEnabled,
'pageNav' => $pageNav
]);
} }
/** /**

View File

@ -36,7 +36,7 @@ class SearchController extends Controller
$searchTerm = $request->get('term'); $searchTerm = $request->get('term');
$this->setPageTitle(trans('entities.search_for_term', ['term' => $searchTerm])); $this->setPageTitle(trans('entities.search_for_term', ['term' => $searchTerm]));
$page = $request->has('page') && is_int(intval($request->get('page'))) ? intval($request->get('page')) : 1; $page = intval($request->get('page', '0')) ?: 1;
$nextPageLink = baseUrl('/search?term=' . urlencode($searchTerm) . '&page=' . ($page+1)); $nextPageLink = baseUrl('/search?term=' . urlencode($searchTerm) . '&page=' . ($page+1));
$results = $this->searchService->searchEntities($searchTerm, 'all', $page, 20); $results = $this->searchService->searchEntities($searchTerm, 'all', $page, 20);
@ -88,8 +88,8 @@ class SearchController extends Controller
*/ */
public function searchEntitiesAjax(Request $request) public function searchEntitiesAjax(Request $request)
{ {
$entityTypes = $request->has('types') ? collect(explode(',', $request->get('types'))) : collect(['page', 'chapter', 'book']); $entityTypes = $request->filled('types') ? collect(explode(',', $request->get('types'))) : collect(['page', 'chapter', 'book']);
$searchTerm = ($request->has('term') && trim($request->get('term')) !== '') ? $request->get('term') : false; $searchTerm = $request->get('term', false);
// Search for entities otherwise show most popular // Search for entities otherwise show most popular
if ($searchTerm !== false) { if ($searchTerm !== false) {

View File

@ -37,7 +37,7 @@ class TagController extends Controller
*/ */
public function getNameSuggestions(Request $request) public function getNameSuggestions(Request $request)
{ {
$searchTerm = $request->has('search') ? $request->get('search') : false; $searchTerm = $request->get('search', false);
$suggestions = $this->tagRepo->getNameSuggestions($searchTerm); $suggestions = $this->tagRepo->getNameSuggestions($searchTerm);
return response()->json($suggestions); return response()->json($suggestions);
} }
@ -49,8 +49,8 @@ class TagController extends Controller
*/ */
public function getValueSuggestions(Request $request) public function getValueSuggestions(Request $request)
{ {
$searchTerm = $request->has('search') ? $request->get('search') : false; $searchTerm = $request->get('search', false);
$tagName = $request->has('name') ? $request->get('name') : false; $tagName = $request->get('name', false);
$suggestions = $this->tagRepo->getValueSuggestions($searchTerm, $tagName); $suggestions = $this->tagRepo->getValueSuggestions($searchTerm, $tagName);
return response()->json($suggestions); return response()->json($suggestions);
} }

View File

@ -34,9 +34,9 @@ class UserController extends Controller
{ {
$this->checkPermission('users-manage'); $this->checkPermission('users-manage');
$listDetails = [ $listDetails = [
'order' => $request->has('order') ? $request->get('order') : 'asc', 'order' => $request->get('order', 'asc'),
'search' => $request->has('search') ? $request->get('search') : '', 'search' => $request->get('search', ''),
'sort' => $request->has('sort') ? $request->get('sort') : 'name', 'sort' => $request->get('sort', 'name'),
]; ];
$users = $this->userRepo->getAllUsersPaginatedAndSorted(20, $listDetails); $users = $this->userRepo->getAllUsersPaginatedAndSorted(20, $listDetails);
$this->setPageTitle(trans('settings.users')); $this->setPageTitle(trans('settings.users'));
@ -88,7 +88,7 @@ class UserController extends Controller
$user->save(); $user->save();
if ($request->has('roles')) { if ($request->filled('roles')) {
$roles = $request->get('roles'); $roles = $request->get('roles');
$user->roles()->sync($roles); $user->roles()->sync($roles);
} }
@ -155,24 +155,24 @@ class UserController extends Controller
$user->fill($request->all()); $user->fill($request->all());
// Role updates // Role updates
if (userCan('users-manage') && $request->has('roles')) { if (userCan('users-manage') && $request->filled('roles')) {
$roles = $request->get('roles'); $roles = $request->get('roles');
$user->roles()->sync($roles); $user->roles()->sync($roles);
} }
// Password updates // Password updates
if ($request->has('password') && $request->get('password') != '') { if ($request->filled('password')) {
$password = $request->get('password'); $password = $request->get('password');
$user->password = bcrypt($password); $user->password = bcrypt($password);
} }
// External auth id updates // External auth id updates
if ($this->currentUser->can('users-manage') && $request->has('external_auth_id')) { if ($this->currentUser->can('users-manage') && $request->filled('external_auth_id')) {
$user->external_auth_id = $request->get('external_auth_id'); $user->external_auth_id = $request->get('external_auth_id');
} }
// Save an user-specific settings // Save an user-specific settings
if ($request->has('setting')) { if ($request->filled('setting')) {
foreach ($request->get('setting') as $key => $value) { foreach ($request->get('setting') as $key => $value) {
setting()->putUser($user, $key, $value); setting()->putUser($user, $key, $value);
} }

View File

@ -15,6 +15,7 @@ class Kernel extends HttpKernel
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\BookStack\Http\Middleware\TrimStrings::class, \BookStack\Http\Middleware\TrimStrings::class,
\BookStack\Http\Middleware\TrustProxies::class,
]; ];
/** /**
@ -44,10 +45,11 @@ class Kernel extends HttpKernel
* @var array * @var array
*/ */
protected $routeMiddleware = [ protected $routeMiddleware = [
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'auth' => \BookStack\Http\Middleware\Authenticate::class, 'auth' => \BookStack\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \BookStack\Http\Middleware\RedirectIfAuthenticated::class, 'guest' => \BookStack\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'perm' => \BookStack\Http\Middleware\PermissionMiddleware::class 'perm' => \BookStack\Http\Middleware\PermissionMiddleware::class
]; ];
} }

View File

@ -30,8 +30,11 @@ class Authenticate
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
if ($this->auth->check() && setting('registration-confirmation') && !$this->auth->user()->email_confirmed) { if ($this->auth->check()) {
return redirect(baseUrl('/register/confirm/awaiting')); $requireConfirmation = (setting('registration-confirmation') || setting('registration-restrict'));
if ($requireConfirmation && !$this->auth->user()->email_confirmed) {
return redirect('/register/confirm/awaiting');
}
} }
if ($this->auth->guest() && !setting('app-public')) { if ($this->auth->guest() && !setting('app-public')) {

View File

@ -2,9 +2,9 @@
namespace BookStack\Http\Middleware; namespace BookStack\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter; use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends BaseEncrypter class EncryptCookies extends Middleware
{ {
/** /**
* The names of the cookies that should not be encrypted. * The names of the cookies that should not be encrypted.

View File

@ -2,9 +2,9 @@
namespace BookStack\Http\Middleware; namespace BookStack\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as BaseTrimmer; use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends BaseTrimmer class TrimStrings extends Middleware
{ {
/** /**
* The names of the attributes that should not be trimmed. * The names of the attributes that should not be trimmed.

View File

@ -0,0 +1,47 @@
<?php
namespace BookStack\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array
*/
protected $proxies;
/**
* The current proxy header mappings.
*
* @var array
*/
protected $headers = [
Request::HEADER_FORWARDED => 'FORWARDED',
Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR',
Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST',
Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT',
Request::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO',
];
/**
* Handle the request, Set the correct user-configured proxy information.
* @param Request $request
* @param Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$setProxies = config('app.proxies');
if ($setProxies !== '**' && $setProxies !== '*' && $setProxies !== '') {
$setProxies = explode(',', $setProxies);
}
$this->proxies = $setProxies;
return parent::handle($request, $next);
}
}

View File

@ -2,9 +2,9 @@
namespace BookStack\Http\Middleware; namespace BookStack\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends BaseVerifier class VerifyCsrfToken extends Middleware
{ {
/** /**
* The URIs that should be excluded from CSRF verification. * The URIs that should be excluded from CSRF verification.

View File

@ -17,6 +17,7 @@ class EventServiceProvider extends ServiceProvider
SocialiteWasCalled::class => [ SocialiteWasCalled::class => [
'SocialiteProviders\Slack\SlackExtendSocialite@handle', 'SocialiteProviders\Slack\SlackExtendSocialite@handle',
'SocialiteProviders\Azure\AzureExtendSocialite@handle', 'SocialiteProviders\Azure\AzureExtendSocialite@handle',
'SocialiteProviders\Okta\OktaExtendSocialite@handle',
], ],
]; ];

View File

@ -442,9 +442,10 @@ class EntityRepo
*/ */
public function updateEntityPermissionsFromRequest($request, Entity $entity) public function updateEntityPermissionsFromRequest($request, Entity $entity)
{ {
$entity->restricted = $request->has('restricted') && $request->get('restricted') === 'true'; $entity->restricted = $request->get('restricted', '') === 'true';
$entity->permissions()->delete(); $entity->permissions()->delete();
if ($request->has('restrictions')) {
if ($request->filled('restrictions')) {
foreach ($request->get('restrictions') as $roleId => $restrictions) { foreach ($request->get('restrictions') as $roleId => $restrictions) {
foreach ($restrictions as $action => $value) { foreach ($restrictions as $action => $value) {
$entity->permissions()->create([ $entity->permissions()->create([
@ -454,6 +455,7 @@ class EntityRepo
} }
} }
} }
$entity->save(); $entity->save();
$this->permissionService->buildJointPermissionsForEntity($entity); $this->permissionService->buildJointPermissionsForEntity($entity);
} }
@ -553,8 +555,9 @@ class EntityRepo
*/ */
protected function nameToSlug($name) protected function nameToSlug($name)
{ {
$slug = str_replace(' ', '-', strtolower($name)); $slug = preg_replace('/[\+\/\\\?\@\}\{\.\,\=\[\]\#\&\!\*\'\;\:\$\%]/', '', mb_strtolower($name));
$slug = preg_replace('/[\+\/\\\?\@\}\{\.\,\=\[\]\#\&\!\*\'\;\:\$\%]/', '', $slug); $slug = preg_replace('/\s{2,}/', ' ', $slug);
$slug = str_replace(' ', '-', $slug);
if ($slug === "") $slug = substr(md5(rand(1, 500)), 0, 5); if ($slug === "") $slug = substr(md5(rand(1, 500)), 0, 5);
return $slug; return $slug;
} }

View File

@ -127,7 +127,7 @@ class ExportService
$pdf = \SnappyPDF::loadHTML($containedHtml); $pdf = \SnappyPDF::loadHTML($containedHtml);
$pdf->setOption('print-media-type', true); $pdf->setOption('print-media-type', true);
} else { } else {
$pdf = \PDF::loadHTML($containedHtml); $pdf = \DomPDF::loadHTML($containedHtml);
} }
return $pdf->output(); return $pdf->output();
} }

View File

@ -205,12 +205,17 @@ class PermissionService
} }
$entities[] = $entity->book; $entities[] = $entity->book;
if ($entity->isA('page') && $entity->chapter_id) $entities[] = $entity->chapter;
if ($entity->isA('page') && $entity->chapter_id) {
$entities[] = $entity->chapter;
}
if ($entity->isA('chapter')) { if ($entity->isA('chapter')) {
foreach ($entity->pages as $page) { foreach ($entity->pages as $page) {
$entities[] = $page; $entities[] = $page;
} }
} }
$this->deleteManyJointPermissionsForEntities($entities); $this->deleteManyJointPermissionsForEntities($entities);
$this->buildJointPermissionsForEntities(collect($entities)); $this->buildJointPermissionsForEntities(collect($entities));
} }

View File

@ -1,5 +1,7 @@
<?php namespace BookStack\Services; <?php namespace BookStack\Services;
use BookStack\Http\Requests\Request;
use GuzzleHttp\Exception\ClientException;
use Laravel\Socialite\Contracts\Factory as Socialite; use Laravel\Socialite\Contracts\Factory as Socialite;
use BookStack\Exceptions\SocialDriverNotConfigured; use BookStack\Exceptions\SocialDriverNotConfigured;
use BookStack\Exceptions\SocialSignInException; use BookStack\Exceptions\SocialSignInException;
@ -14,7 +16,7 @@ class SocialAuthService
protected $socialite; protected $socialite;
protected $socialAccount; protected $socialAccount;
protected $validSocialDrivers = ['google', 'github', 'facebook', 'slack', 'twitter', 'azure']; protected $validSocialDrivers = ['google', 'github', 'facebook', 'slack', 'twitter', 'azure', 'okta'];
/** /**
* SocialAuthService constructor. * SocialAuthService constructor.
@ -91,7 +93,6 @@ class SocialAuthService
public function handleLoginCallback($socialDriver) public function handleLoginCallback($socialDriver)
{ {
$driver = $this->validateDriver($socialDriver); $driver = $this->validateDriver($socialDriver);
// Get user details from social driver // Get user details from social driver
$socialUser = $this->socialite->driver($driver)->user(); $socialUser = $this->socialite->driver($driver)->user();
$socialId = $socialUser->getId(); $socialId = $socialUser->getId();
@ -135,7 +136,7 @@ class SocialAuthService
$message .= trans('errors.social_account_register_instructions', ['socialAccount' => title_case($socialDriver)]); $message .= trans('errors.social_account_register_instructions', ['socialAccount' => title_case($socialDriver)]);
} }
throw new SocialSignInException($message . '.', '/login'); throw new SocialSignInException($message, '/login');
} }
/** /**

14
artisan
View File

@ -1,19 +1,19 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
define('LARAVEL_START', microtime(true));
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Register The Auto Loader | Initialize The App
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Composer provides a convenient, automatically generated class loader | We need to get things going before we start up the app.
| for our application. We just need to utilize it! We'll require it | The init file loads everything in, in the correct order.
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
| |
*/ */
require __DIR__.'/bootstrap/autoload.php'; require __DIR__.'/bootstrap/init.php';
$app = require_once __DIR__.'/bootstrap/app.php'; $app = require_once __DIR__.'/bootstrap/app.php';
@ -40,7 +40,7 @@ $status = $kernel->handle(
| Shutdown The Application | Shutdown The Application
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Once Artisan has finished running. We will fire off the shutdown events | Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut | so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request. | down the process. This is the last thing to happen to the request.
| |

View File

@ -1,6 +1,15 @@
<?php <?php
define('LARAVEL_START', microtime(true)); /*
|--------------------------------------------------------------------------
| Load Our Own Helpers
|--------------------------------------------------------------------------
|
| This custom function loads any helpers, before the Laravel Framework
| is built so we can override any helpers as we please.
|
*/
require __DIR__.'/../app/helpers.php';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -13,23 +22,4 @@ define('LARAVEL_START', microtime(true));
| loading of any our classes "manually". Feels great to relax. | loading of any our classes "manually". Feels great to relax.
| |
*/ */
require __DIR__.'/../app/helpers.php';
require __DIR__.'/../vendor/autoload.php'; require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Include The Compiled Class File
|--------------------------------------------------------------------------
|
| To dramatically increase your application's performance, you may use a
| compiled class file which contains all of the classes commonly used
| by a request. The Artisan "optimize" is used to create this file.
|
*/
$compiledPath = __DIR__.'/cache/compiled.php';
if (file_exists($compiledPath)) {
require $compiledPath;
}

View File

@ -1,32 +1,35 @@
{ {
"name": "ssddanbrown/bookstack", "name": "bookstackapp/bookstack",
"description": "BookStack documentation platform", "description": "BookStack documentation platform",
"keywords": ["BookStack", "Documentation"], "keywords": ["BookStack", "Documentation"],
"license": "MIT", "license": "MIT",
"type": "project", "type": "project",
"require": { "require": {
"php": ">=5.6.4", "php": ">=7.0.0",
"laravel/framework": "5.4.*", "laravel/framework": "5.5.*",
"fideloper/proxy": "~3.3",
"ext-tidy": "*", "ext-tidy": "*",
"intervention/image": "^2.3", "intervention/image": "^2.4",
"laravel/socialite": "^3.0", "laravel/socialite": "^3.0",
"barryvdh/laravel-ide-helper": "^2.2.3",
"barryvdh/laravel-debugbar": "^2.3.2",
"league/flysystem-aws-s3-v3": "^1.0", "league/flysystem-aws-s3-v3": "^1.0",
"barryvdh/laravel-dompdf": "^0.8", "barryvdh/laravel-dompdf": "^0.8.1",
"predis/predis": "^1.1", "predis/predis": "^1.1",
"gathercontent/htmldiff": "^0.2.1", "gathercontent/htmldiff": "^0.2.1",
"barryvdh/laravel-snappy": "^0.3.1", "barryvdh/laravel-snappy": "^0.4.0",
"laravel/browser-kit-testing": "^1.0",
"socialiteproviders/slack": "^3.0", "socialiteproviders/slack": "^3.0",
"socialiteproviders/microsoft-azure": "^3.0" "socialiteproviders/microsoft-azure": "^3.0",
"socialiteproviders/okta": "^1.0"
}, },
"require-dev": { "require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4", "fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*", "mockery/mockery": "~1.0",
"phpunit/phpunit": "~5.0", "phpunit/phpunit": "~6.0",
"symfony/css-selector": "3.1.*", "symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*" "symfony/dom-crawler": "3.1.*",
"laravel/browser-kit-testing": "^2.0",
"barryvdh/laravel-ide-helper": "^2.4.1",
"barryvdh/laravel-debugbar": "^3.1.0"
}, },
"autoload": { "autoload": {
"classmap": [ "classmap": [
@ -57,14 +60,12 @@
"php -r \"!file_exists('bootstrap/cache/compiled.php') || @unlink('bootstrap/cache/compiled.php');\"" "php -r \"!file_exists('bootstrap/cache/compiled.php') || @unlink('bootstrap/cache/compiled.php');\""
], ],
"post-install-cmd": [ "post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize",
"php artisan cache:clear", "php artisan cache:clear",
"php artisan view:clear" "php artisan view:clear"
], ],
"post-update-cmd": [ "post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate", "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"php artisan optimize" "@php artisan package:discover"
], ],
"refresh-test-database": [ "refresh-test-database": [
"php artisan migrate:refresh --database=mysql_testing", "php artisan migrate:refresh --database=mysql_testing",
@ -72,6 +73,10 @@
] ]
}, },
"config": { "config": {
"preferred-install": "dist" "optimize-autoloader": true,
"preferred-install": "dist",
"platform": {
"php": "7.0"
}
} }
} }

5831
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -219,7 +219,7 @@ return [
*/ */
'ImageTool' => Intervention\Image\Facades\Image::class, 'ImageTool' => Intervention\Image\Facades\Image::class,
'PDF' => Barryvdh\DomPDF\Facade::class, 'DomPDF' => Barryvdh\DomPDF\Facade::class,
'SnappyPDF' => Barryvdh\Snappy\Facades\SnappyPdf::class, 'SnappyPDF' => Barryvdh\Snappy\Facades\SnappyPdf::class,
'Debugbar' => Barryvdh\Debugbar\Facade::class, 'Debugbar' => Barryvdh\Debugbar\Facade::class,
@ -234,4 +234,6 @@ return [
], ],
'proxies' => env('APP_PROXIES', ''),
]; ];

View File

@ -80,6 +80,14 @@ return [
'name' => 'Microsoft Azure', 'name' => 'Microsoft Azure',
], ],
'okta' => [
'client_id' => env('OKTA_APP_ID'),
'client_secret' => env('OKTA_APP_SECRET'),
'redirect' => env('APP_URL') . '/login/service/okta/callback',
'base_url' => env('OKTA_BASE_URL'),
'name' => 'Okta',
],
'ldap' => [ 'ldap' => [
'server' => env('LDAP_SERVER', false), 'server' => env('LDAP_SERVER', false),
'dn' => env('LDAP_DN', false), 'dn' => env('LDAP_DN', false),

View File

@ -29,7 +29,7 @@ return [
| |
*/ */
'lifetime' => 120, 'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false, 'expire_on_close' => false,

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddCoverImageDisplay extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('books', function (Blueprint $table) {
$table->integer('image_id')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('books', function (Blueprint $table) {
$table->dropColumn('image_id');
});
}
}

View File

@ -11,25 +11,31 @@ class DummyContentSeeder extends Seeder
*/ */
public function run() public function run()
{ {
$user = factory(\BookStack\User::class)->create(); // Create an editor user
$role = \BookStack\Role::getRole('editor'); $editorUser = factory(\BookStack\User::class)->create();
$user->attachRole($role); $editorRole = \BookStack\Role::getRole('editor');
$editorUser->attachRole($editorRole);
factory(\BookStack\Book::class, 20)->create(['created_by' => $user->id, 'updated_by' => $user->id]) // Create a viewer user
->each(function($book) use ($user) { $viewerUser = factory(\BookStack\User::class)->create();
$chapters = factory(\BookStack\Chapter::class, 5)->create(['created_by' => $user->id, 'updated_by' => $user->id]) $role = \BookStack\Role::getRole('viewer');
->each(function($chapter) use ($user, $book){ $viewerUser->attachRole($role);
$pages = factory(\BookStack\Page::class, 5)->make(['created_by' => $user->id, 'updated_by' => $user->id, 'book_id' => $book->id]);
factory(\BookStack\Book::class, 20)->create(['created_by' => $editorUser->id, 'updated_by' => $editorUser->id])
->each(function($book) use ($editorUser) {
$chapters = factory(\BookStack\Chapter::class, 5)->create(['created_by' => $editorUser->id, 'updated_by' => $editorUser->id])
->each(function($chapter) use ($editorUser, $book){
$pages = factory(\BookStack\Page::class, 5)->make(['created_by' => $editorUser->id, 'updated_by' => $editorUser->id, 'book_id' => $book->id]);
$chapter->pages()->saveMany($pages); $chapter->pages()->saveMany($pages);
}); });
$pages = factory(\BookStack\Page::class, 3)->make(['created_by' => $user->id, 'updated_by' => $user->id]); $pages = factory(\BookStack\Page::class, 3)->make(['created_by' => $editorUser->id, 'updated_by' => $editorUser->id]);
$book->chapters()->saveMany($chapters); $book->chapters()->saveMany($chapters);
$book->pages()->saveMany($pages); $book->pages()->saveMany($pages);
}); });
$largeBook = factory(\BookStack\Book::class)->create(['name' => 'Large book' . str_random(10), 'created_by' => $user->id, 'updated_by' => $user->id]); $largeBook = factory(\BookStack\Book::class)->create(['name' => 'Large book' . str_random(10), 'created_by' => $editorUser->id, 'updated_by' => $editorUser->id]);
$pages = factory(\BookStack\Page::class, 200)->make(['created_by' => $user->id, 'updated_by' => $user->id]); $pages = factory(\BookStack\Page::class, 200)->make(['created_by' => $editorUser->id, 'updated_by' => $editorUser->id]);
$chapters = factory(\BookStack\Chapter::class, 50)->make(['created_by' => $user->id, 'updated_by' => $user->id]); $chapters = factory(\BookStack\Chapter::class, 50)->make(['created_by' => $editorUser->id, 'updated_by' => $editorUser->id]);
$largeBook->pages()->saveMany($pages); $largeBook->pages()->saveMany($pages);
$largeBook->chapters()->saveMany($chapters); $largeBook->chapters()->saveMany($chapters);
app(\BookStack\Services\PermissionService::class)->buildJointPermissions(); app(\BookStack\Services\PermissionService::class)->buildJointPermissions();

5977
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false" <phpunit backupGlobals="false"
backupStaticAttributes="false" backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php" bootstrap="bootstrap/init.php"
colors="true" colors="true"
convertErrorsToExceptions="true" convertErrorsToExceptions="true"
convertNoticesToExceptions="true" convertNoticesToExceptions="true"

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -4,22 +4,22 @@
* Laravel - A PHP Framework For Web Artisans * Laravel - A PHP Framework For Web Artisans
* *
* @package Laravel * @package Laravel
* @author Taylor Otwell <taylorotwell@gmail.com> * @author Taylor Otwell <taylor@laravel.com>
*/ */
define('LARAVEL_START', microtime(true));
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Register The Auto Loader | Initialize The App
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Composer provides a convenient, automatically generated class loader for | We need to get things going before we start up the app.
| our application. We just need to utilize it! We'll simply require it | The init file loads everything in, in the correct order.
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels nice to relax.
| |
*/ */
require __DIR__.'/../bootstrap/autoload.php'; require __DIR__.'/../bootstrap/init.php';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -55,7 +55,18 @@ As part of BookStack v0.14 support for translations has been built in. All text
You will also need to add the language to the `locales` array in the `config/app.php` file. You will also need to add the language to the `locales` array in the `config/app.php` file.
Some strings have colon-prefixed variables in such as `:userName`. Leave these values as they are as they will be replaced at run-time. There is a script available which compares translation content to `en` files to see what items are missing or redundant. This can be ran like so from your BookStack install folder:
```bash
# Syntax
php resources/lang/check.php <lang>
# Examples
php resources/lang/check.php fr
php resources/lang/check.php pt_BR
```
Some strings have colon-prefixed variables in such as `:userName`. Leave these values as they are as they will be replaced at run-time.
## Contributing ## Contributing

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path d="M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm-.035 5.537a6.427 6.427 0 0 1 6.428 6.428 6.427 6.427 0 0 1-6.428 6.428 6.427 6.427 0 0 1-6.428-6.428 6.427 6.427 0 0 1 6.428-6.428z" fill="#007dc1"/></svg>

After

Width:  |  Height:  |  Size: 392 B

View File

@ -0,0 +1,37 @@
/**
* Collapsible
* Provides some simple logic to allow collapsible sections.
*/
class Collapsible {
constructor(elem) {
this.elem = elem;
this.trigger = elem.querySelector('[collapsible-trigger]');
this.content = elem.querySelector('[collapsible-content]');
if (!this.trigger) return;
this.trigger.addEventListener('click', this.toggle.bind(this));
}
open() {
this.elem.classList.add('open');
$(this.content).slideDown(400);
}
close() {
this.elem.classList.remove('open');
$(this.content).slideUp(400);
}
toggle() {
if (this.elem.classList.contains('open')) {
this.close();
} else {
this.open();
}
}
}
module.exports = Collapsible;

View File

@ -0,0 +1,59 @@
class ImagePicker {
constructor(elem) {
this.elem = elem;
this.imageElem = elem.querySelector('img');
this.input = elem.querySelector('input');
this.isUsingIds = elem.getAttribute('data-current-id') !== '';
this.isResizing = elem.getAttribute('data-resize-height') && elem.getAttribute('data-resize-width');
this.isResizeCropping = elem.getAttribute('data-resize-crop') !== '';
let selectButton = elem.querySelector('button[data-action="show-image-manager"]');
selectButton.addEventListener('click', this.selectImage.bind(this));
let resetButton = elem.querySelector('button[data-action="reset-image"]');
resetButton.addEventListener('click', this.reset.bind(this));
let removeButton = elem.querySelector('button[data-action="remove-image"]');
if (removeButton) {
removeButton.addEventListener('click', this.removeImage.bind(this));
}
}
selectImage() {
window.ImageManager.show(image => {
if (!this.isResizing) {
this.setImage(image);
return;
}
let requestString = '/images/thumb/' + image.id + '/' + this.elem.getAttribute('data-resize-width') + '/' + this.elem.getAttribute('data-resize-height') + '/' + (this.isResizeCropping ? 'true' : 'false');
window.$http.get(window.baseUrl(requestString)).then(resp => {
image.url = resp.data.url;
this.setImage(image);
});
});
}
reset() {
this.setImage({id: 0, url: this.elem.getAttribute('data-default-image')});
}
setImage(image) {
this.imageElem.src = image.url;
this.input.value = this.isUsingIds ? image.id : image.url;
this.imageElem.classList.remove('none');
}
removeImage() {
this.imageElem.src = this.elem.getAttribute('data-default-image');
this.imageElem.classList.add('none');
this.input.value = 'none';
}
}
module.exports = ImagePicker;

View File

@ -14,6 +14,8 @@ let componentMapping = {
'wysiwyg-editor': require('./wysiwyg-editor'), 'wysiwyg-editor': require('./wysiwyg-editor'),
'markdown-editor': require('./markdown-editor'), 'markdown-editor': require('./markdown-editor'),
'editor-toolbox': require('./editor-toolbox'), 'editor-toolbox': require('./editor-toolbox'),
'image-picker': require('./image-picker'),
'collapsible': require('./collapsible'),
}; };
window.components = {}; window.components = {};

View File

@ -84,6 +84,8 @@ class MarkdownEditor {
}; };
// Save draft // Save draft
extraKeys[`${metaKey}-S`] = cm => {window.$events.emit('editor-save-draft')}; extraKeys[`${metaKey}-S`] = cm => {window.$events.emit('editor-save-draft')};
// Save page
extraKeys[`${metaKey}-Enter`] = cm => {window.$events.emit('editor-save-page')};
// Show link selector // Show link selector
extraKeys[`Shift-${metaKey}-K`] = cm => {this.actionShowLinkSelector()}; extraKeys[`Shift-${metaKey}-K`] = cm => {this.actionShowLinkSelector()};
// Insert Link // Insert Link

View File

@ -71,6 +71,11 @@ function registerEditorShortcuts(editor) {
window.$events.emit('editor-save-draft'); window.$events.emit('editor-save-draft');
}); });
// Save page shortcut
editor.shortcuts.add('meta+13', '', () => {
window.$events.emit('editor-save-page');
});
// Loop through callout styles // Loop through callout styles
editor.shortcuts.add('meta+9', '', function() { editor.shortcuts.add('meta+9', '', function() {
let selectedNode = editor.selection.getNode(); let selectedNode = editor.selection.getNode();
@ -92,6 +97,17 @@ function registerEditorShortcuts(editor) {
} }
/**
* Load custom HTML head content from the settings into the editor.
* @param editor
*/
function loadCustomHeadContent(editor) {
window.$http.get(window.baseUrl('/custom-head-content')).then(resp => {
if (!resp.data) return;
let head = editor.getDoc().querySelector('head');
head.innerHTML += resp.data;
});
}
/** /**
* Create and enable our custom code plugin * Create and enable our custom code plugin
@ -317,6 +333,9 @@ module.exports = {
args.content = ''; args.content = '';
} }
}, },
init_instance_callback: function(editor) {
loadCustomHeadContent(editor);
},
setup: function (editor) { setup: function (editor) {
editor.on('init ExecCommand change input NodeChange ObjectResized', editorChange); editor.on('init ExecCommand change input NodeChange ObjectResized', editorChange);

View File

@ -102,23 +102,28 @@ let setupPageShow = window.setupPageShow = function (pageId) {
let $window = $(window); let $window = $(window);
let $sidebar = $("#sidebar .scroll-body"); let $sidebar = $("#sidebar .scroll-body");
let $bookTreeParent = $sidebar.parent(); let $bookTreeParent = $sidebar.parent();
// Check the page is scrollable and the content is taller than the tree // Check the page is scrollable and the content is taller than the tree
let pageScrollable = ($(document).height() > $window.height()) && ($sidebar.height() < $('.page-content').height()); let pageScrollable = ($(document).height() > $window.height()) && ($sidebar.height() < $('.page-content').height());
// Get current tree's width and header height // Get current tree's width and header height
let headerHeight = $("#header").height() + $(".toolbar").height(); let headerHeight = $("#header").height() + $(".toolbar").height();
let isFixed = $window.scrollTop() > headerHeight; let isFixed = $window.scrollTop() > headerHeight;
// Function to fix the tree as a sidebar
// Fix the tree as a sidebar
function stickTree() { function stickTree() {
$sidebar.width($bookTreeParent.width() + 15); $sidebar.width($bookTreeParent.width() + 15);
$sidebar.addClass("fixed"); $sidebar.addClass("fixed");
isFixed = true; isFixed = true;
} }
// Function to un-fix the tree back into position
// Un-fix the tree back into position
function unstickTree() { function unstickTree() {
$sidebar.css('width', 'auto'); $sidebar.css('width', 'auto');
$sidebar.removeClass("fixed"); $sidebar.removeClass("fixed");
isFixed = false; isFixed = false;
} }
// Checks if the tree stickiness state should change // Checks if the tree stickiness state should change
function checkTreeStickiness(skipCheck) { function checkTreeStickiness(skipCheck) {
let shouldBeFixed = $window.scrollTop() > headerHeight; let shouldBeFixed = $window.scrollTop() > headerHeight;
@ -150,6 +155,59 @@ let setupPageShow = window.setupPageShow = function (pageId) {
unstickTree(); unstickTree();
} }
}); });
// Check if support is present for IntersectionObserver
if ('IntersectionObserver' in window &&
'IntersectionObserverEntry' in window &&
'intersectionRatio' in window.IntersectionObserverEntry.prototype) {
addPageHighlighting();
}
function addPageHighlighting() {
let pageNav = document.querySelector('.sidebar-page-nav');
// fetch all the headings.
let headings = document.querySelector('.page-content').querySelectorAll('h1, h2, h3, h4, h5, h6');
// if headings are present, add observers.
if (headings.length > 0 && pageNav !== null) {
addNavObserver(headings);
}
function addNavObserver(headings) {
// Setup the intersection observer.
let intersectOpts = {
rootMargin: '0px 0px 0px 0px',
threshold: 1.0
};
let pageNavObserver = new IntersectionObserver(headingVisibilityChange, intersectOpts);
// observe each heading
for (let i = 0; i !== headings.length; ++i) {
pageNavObserver.observe(headings[i]);
}
}
function headingVisibilityChange(entries, observer) {
for (let i = 0; i < entries.length; i++) {
let currentEntry = entries[i];
let isVisible = (currentEntry.intersectionRatio === 1);
toggleAnchorHighlighting(currentEntry.target.id, isVisible);
}
}
function toggleAnchorHighlighting(elementId, shouldHighlight) {
let anchorsToHighlight = pageNav.querySelectorAll('a[href="#' + elementId + '"]');
for (let i = 0; i < anchorsToHighlight.length; i++) {
// Change below to use classList.toggle when IE support is dropped.
if (shouldHighlight) {
anchorsToHighlight[i].classList.add('current-heading');
} else {
anchorsToHighlight[i].classList.remove('current-heading');
}
}
}
}
}; };
module.exports = setupPageShow; module.exports = setupPageShow;

View File

@ -125,6 +125,4 @@ const methods = {
}; };
const computed = []; module.exports = {template, data, props, methods};
module.exports = {template, data, props, methods, computed};

View File

@ -34,8 +34,9 @@ function mounted() {
this.draftText = trans('entities.pages_editing_page'); this.draftText = trans('entities.pages_editing_page');
} }
// Listen to save draft events from editor // Listen to save events from editor
window.$events.listen('editor-save-draft', this.saveDraft); window.$events.listen('editor-save-draft', this.saveDraft);
window.$events.listen('editor-save-page', this.savePage);
// Listen to content changes from the editor // Listen to content changes from the editor
window.$events.listen('editor-html-change', html => { window.$events.listen('editor-html-change', html => {
@ -106,6 +107,9 @@ let methods = {
}); });
}, },
savePage() {
this.$el.closest('form').submit();
},
draftNotifyChange(text) { draftNotifyChange(text) {
this.draftText = text; this.draftText = text;

View File

@ -9,8 +9,6 @@ let data = {
const components = {draggable, autosuggest}; const components = {draggable, autosuggest};
const directives = {}; const directives = {};
let computed = {};
let methods = { let methods = {
addEmptyTag() { addEmptyTag() {
@ -64,5 +62,5 @@ function mounted() {
} }
module.exports = { module.exports = {
data, computed, methods, mounted, components, directives data, methods, mounted, components, directives
}; };

View File

@ -63,9 +63,10 @@
padding: 0 $-m 0; padding: 0 $-m 0;
margin-left: -1px; margin-left: -1px;
overflow-y: scroll; overflow-y: scroll;
.page-content { }
margin: 0 auto; .markdown-display.page-content {
} margin: 0 auto;
max-width: 100%;
} }
} }
.editor-toolbar { .editor-toolbar {
@ -190,6 +191,41 @@ input:checked + .toggle-switch {
} }
} }
.form-group[collapsible] {
margin-left: -$-m;
margin-right: -$-m;
padding: 0 $-m;
border-top: 1px solid #DDD;
border-bottom: 1px solid #DDD;
.collapse-title {
margin-left: -$-m;
margin-right: -$-m;
padding: $-s $-m;
}
.collapse-title, .collapse-title label {
cursor: pointer;
}
.collapse-title label {
padding-bottom: 0;
margin-bottom: 0;
color: inherit;
}
.collapse-title label:before {
display: inline-block;
content: '';
margin-right: $-m;
transition: all ease-in-out 400ms;
transform: rotate(0);
}
.collapse-content {
display: none;
padding-bottom: $-m;
}
&.open .collapse-title label:before {
transform: rotate(90deg);
}
}
.inline-input-style { .inline-input-style {
display: block; display: block;
width: 100%; width: 100%;

View File

@ -135,7 +135,7 @@ body.flexbox {
width: 30%; width: 30%;
left: 0; left: 0;
height: 100%; height: 100%;
overflow-y: scroll; overflow-y: auto;
-ms-overflow-style: none; -ms-overflow-style: none;
//background-color: $primary-faded; //background-color: $primary-faded;
border-left: 1px solid #DDD; border-left: 1px solid #DDD;
@ -195,6 +195,14 @@ div[class^="col-"] img {
display: inline-block; display: inline-block;
} }
@include larger-than(991px) {
.row.auto-clear .col-md-4:nth-child(3n+1){clear:left;}
}
@include smaller-than(992px) {
.row.auto-clear .col-xs-6:nth-child(2n+1){clear:left;}
}
.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 { .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
position: relative; position: relative;
min-height: 1px; min-height: 1px;

View File

@ -82,6 +82,9 @@
.h6 { .h6 {
margin-left: $nav-indent*4; margin-left: $nav-indent*4;
} }
.current-heading {
font-weight: bold;
}
} }
// Sidebar list // Sidebar list
@ -373,3 +376,51 @@ ul.pagination {
border-bottom: 1px solid #DDD; border-bottom: 1px solid #DDD;
} }
} }
// Books grid view
.featured-image-container {
position: relative;
overflow: hidden;
background: #F2F2F2;
border: 1px solid #ddd;
border-bottom: 0;
img {
display: block;
max-width: 100%;
height: auto;
transition: all .5s ease;
}
img:hover {
transform: scale(1.15);
opacity: .5;
}
}
.book-grid-content {
padding: 30px;
border: 1px solid #ddd;
border-top: 0;
border-bottom-width: 2px;
h2 {
font-size: 1.5em;
margin: 0 0 10px;
}
h2 a {
display: block;
line-height: 1.2;
color: #009688;;
text-decoration: none;
}
p {
font-size: .85em;
margin: 0 0 10px;
line-height: 1.6em;
}
p.small {
font-size: .8em;
}
}
.book-grid-item {
margin-bottom : 20px;
}

View File

@ -1,16 +1,13 @@
.mce-tinymce.mce-container.mce-fullscreen {
.mce-tinymce.mce-container.fullscreen {
position: fixed; position: fixed;
top: 0; top: 0;
height: 100%; height: 100%;
width: 825px; width: 100%;
max-width: 100%; max-width: 100%;
margin-left: -$-s; z-index: 100;
box-shadow: 0 0 4px 2px rgba(0, 0, 0, 0.08);
} }
.mce-tinymce { .mce-tinymce {
.mce-panel { .mce-panel {
background-color: #FFF; background-color: #FFF;

View File

@ -232,6 +232,3 @@ $btt-size: 40px;
width: 100%; width: 100%;
} }
} }

114
resources/lang/check.php Executable file
View File

@ -0,0 +1,114 @@
#!/usr/bin/env php
<?php
/**
* Compares translation files to find missing and redundant content.
*/
$args = array_slice($argv, 1);
if (count($args) === 0) {
errorOut("Please provide a language code as the first argument (./check.php fr)");
}
// Get content from files
$lang = formatLang($args[0]);
$enContent = loadLang('en');
$langContent = loadLang($lang);
if (count($langContent) === 0) {
errorOut("No language content found for '{$lang}'");
}
info("Checking '{$lang}' translation content against 'en'");
// Track missing lang strings
$missingLangStrings = [];
foreach ($enContent as $enKey => $enStr) {
if (strpos($enKey, 'settings.language_select.') === 0) {
unset($langContent[$enKey]);
continue;
}
if (!isset($langContent[$enKey])) {
$missingLangStrings[$enKey] = $enStr;
continue;
}
unset($langContent[$enKey]);
}
if (count($missingLangStrings) > 0) {
info("\n========================");
info("Missing language content");
info("========================");
outputFlatArray($missingLangStrings, $lang);
}
if (count($langContent) > 0) {
info("\n==========================");
info("Redundant language content");
info("==========================");
outputFlatArray($langContent, $lang);
}
function outputFlatArray($arr, $lang) {
$grouped = [];
foreach ($arr as $key => $val) {
$explodedKey = explode('.', $key);
$group = $explodedKey[0];
$path = implode('.', array_slice($explodedKey, 1));
if (!isset($grouped[$group])) $grouped[$group] = [];
$grouped[$group][$path] = $val;
}
foreach ($grouped as $filename => $arr) {
echo "\e[36m" . $lang . '/' . $filename . ".php\e[0m\n";
echo json_encode($arr, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE) . "\n";
}
}
function formatLang($lang) {
$langParts = explode('_', strtoupper($lang));
$langParts[0] = strtolower($langParts[0]);
return implode('_', $langParts);
}
function loadLang(string $lang) {
$dir = __DIR__ . "/{$lang}";
if (!file_exists($dir)) {
errorOut("Expected directory '{$dir}' does not exist");
}
$files = scandir($dir);
$data = [];
foreach ($files as $file) {
if (substr($file, -4) !== '.php') continue;
$fileData = include ($dir . '/' . $file);
$name = substr($file, 0, -4);
$data[$name] = $fileData;
}
return flattenArray($data);
}
function flattenArray(array $arr) {
$data = [];
foreach ($arr as $key => $arrItem) {
if (!is_array($arrItem)) {
$data[$key] = $arrItem;
continue;
}
$toUse = flattenArray($arrItem);
foreach ($toUse as $innerKey => $item) {
$data[$key . '.' . $innerKey] = $item;
}
}
return $data;
}
function info($text) {
echo "\e[34m" . $text . "\e[0m\n";
}
function errorOut($text) {
echo "\e[31m" . $text . "\e[0m\n";
exit(1);
}

View File

@ -17,6 +17,8 @@ return [
'name' => 'Name', 'name' => 'Name',
'description' => 'Beschreibung', 'description' => 'Beschreibung',
'role' => 'Rolle', 'role' => 'Rolle',
'cover_image' => 'Titelbild',
'cover_image_description' => 'Das Bild sollte eine Auflösung von 300x170px haben.',
/** /**
* Actions * Actions
@ -43,7 +45,7 @@ return [
'no_items' => 'Keine Einträge gefunden.', 'no_items' => 'Keine Einträge gefunden.',
'back_to_top' => 'nach oben', 'back_to_top' => 'nach oben',
'toggle_details' => 'Details zeigen/verstecken', 'toggle_details' => 'Details zeigen/verstecken',
'toggle_thumbnails' => 'Thumbnails zeigen/verstecken',
/** /**
* Header * Header
*/ */

View File

@ -31,6 +31,8 @@ return [
'app_logo_desc' => "Dieses Bild sollte 43px hoch sein.\nGrößere Bilder werden verkleinert.", 'app_logo_desc' => "Dieses Bild sollte 43px hoch sein.\nGrößere Bilder werden verkleinert.",
'app_primary_color' => 'Primäre Anwendungsfarbe', 'app_primary_color' => 'Primäre Anwendungsfarbe',
'app_primary_color_desc' => "Dies sollte ein HEX Wert sein.\nWenn Sie nicht eingeben, wird die Anwendung auf die Standardfarbe zurückgesetzt.", 'app_primary_color_desc' => "Dies sollte ein HEX Wert sein.\nWenn Sie nicht eingeben, wird die Anwendung auf die Standardfarbe zurückgesetzt.",
'app_disable_comments' => 'Kommentare deaktivieren',
'app_disable_comments_desc' => 'Deaktiviert Kommentare über alle Seiten in der Anwendung. Vorhandene Kommentare werden nicht angezeigt.',
/** /**
* Registration settings * Registration settings
@ -96,6 +98,7 @@ return [
'users_delete_warning' => 'Der Benutzer ":userName" wird aus dem System gelöscht.', 'users_delete_warning' => 'Der Benutzer ":userName" wird aus dem System gelöscht.',
'users_delete_confirm' => 'Sind Sie sicher, dass Sie diesen Benutzer löschen möchten?', 'users_delete_confirm' => 'Sind Sie sicher, dass Sie diesen Benutzer löschen möchten?',
'users_delete_success' => 'Benutzer erfolgreich gelöscht.', 'users_delete_success' => 'Benutzer erfolgreich gelöscht.',
'users_books_view_type' => 'Bevorzugtes Display-Layout für Bücher',
'users_edit' => 'Benutzer bearbeiten', 'users_edit' => 'Benutzer bearbeiten',
'users_edit_profile' => 'Profil bearbeiten', 'users_edit_profile' => 'Profil bearbeiten',
'users_edit_success' => 'Benutzer erfolgreich aktualisisert', 'users_edit_success' => 'Benutzer erfolgreich aktualisisert',

View File

@ -18,6 +18,8 @@ return [
'name' => 'Name', 'name' => 'Name',
'description' => 'Description', 'description' => 'Description',
'role' => 'Role', 'role' => 'Role',
'cover_image' => 'Cover image',
'cover_image_description' => 'This image should be approx 440x250px.',
/** /**
* Actions * Actions
@ -45,6 +47,7 @@ return [
'no_items' => 'No items available', 'no_items' => 'No items available',
'back_to_top' => 'Back to top', 'back_to_top' => 'Back to top',
'toggle_details' => 'Toggle Details', 'toggle_details' => 'Toggle Details',
'toggle_thumbnails' => 'Toggle Thumbnails',
'details' => 'Details', 'details' => 'Details',
/** /**

View File

@ -20,6 +20,7 @@ return [
'ldap_extension_not_installed' => 'LDAP PHP extension not installed', 'ldap_extension_not_installed' => 'LDAP PHP extension not installed',
'ldap_cannot_connect' => 'Cannot connect to ldap server, Initial connection failed', 'ldap_cannot_connect' => 'Cannot connect to ldap server, Initial connection failed',
'social_no_action_defined' => 'No action defined', 'social_no_action_defined' => 'No action defined',
'social_login_bad_response' => "Error received during :socialAccount login: \n:error",
'social_account_in_use' => 'This :socialAccount account is already in use, Try logging in via the :socialAccount option.', 'social_account_in_use' => 'This :socialAccount account is already in use, Try logging in via the :socialAccount option.',
'social_account_email_in_use' => 'The email :email is already in use. If you already have an account you can connect your :socialAccount account from your profile settings.', 'social_account_email_in_use' => 'The email :email is already in use. If you already have an account you can connect your :socialAccount account from your profile settings.',
'social_account_existing' => 'This :socialAccount is already attached to your profile.', 'social_account_existing' => 'This :socialAccount is already attached to your profile.',

View File

@ -34,6 +34,8 @@ return [
'app_homepage' => 'Application Homepage', 'app_homepage' => 'Application Homepage',
'app_homepage_desc' => 'Select a page to show on the homepage instead of the default view. Page permissions are ignored for selected pages.', 'app_homepage_desc' => 'Select a page to show on the homepage instead of the default view. Page permissions are ignored for selected pages.',
'app_homepage_default' => 'Default homepage view chosen', 'app_homepage_default' => 'Default homepage view chosen',
'app_disable_comments' => 'Disable comments',
'app_disable_comments_desc' => 'Disable comments across all pages in the application. Existing comments are not shown.',
/** /**
* Registration settings * Registration settings
@ -94,6 +96,7 @@ return [
'users_external_auth_id' => 'External Authentication ID', 'users_external_auth_id' => 'External Authentication ID',
'users_password_warning' => 'Only fill the below if you would like to change your password:', 'users_password_warning' => 'Only fill the below if you would like to change your password:',
'users_system_public' => 'This user represents any guest users that visit your instance. It cannot be used to log in but is assigned automatically.', 'users_system_public' => 'This user represents any guest users that visit your instance. It cannot be used to log in but is assigned automatically.',
'users_books_view_type' => 'Preferred layout for books viewing',
'users_delete' => 'Delete User', 'users_delete' => 'Delete User',
'users_delete_named' => 'Delete user :userName', 'users_delete_named' => 'Delete user :userName',
'users_delete_warning' => 'This will fully delete this user with the name \':userName\' from the system.', 'users_delete_warning' => 'This will fully delete this user with the name \':userName\' from the system.',

View File

@ -17,7 +17,8 @@ return [
'name' => 'Nombre', 'name' => 'Nombre',
'description' => 'Descripción', 'description' => 'Descripción',
'role' => 'Rol', 'role' => 'Rol',
'cover_image' => 'Imagen de portada',
'cover_image_description' => 'Esta imagen debe ser aproximadamente 300x170px.',
/** /**
* Actions * Actions
*/ */
@ -43,6 +44,7 @@ return [
'no_items' => 'No hay items disponibles', 'no_items' => 'No hay items disponibles',
'back_to_top' => 'Volver arriba', 'back_to_top' => 'Volver arriba',
'toggle_details' => 'Alternar detalles', 'toggle_details' => 'Alternar detalles',
'toggle_thumbnails' => 'Alternar miniaturas',
/** /**
* Header * Header

View File

@ -31,6 +31,8 @@ return [
'app_logo_desc' => 'Esta imagen debería de ser 43px en altura. <br>Iágenes grandes seán escaladas.', 'app_logo_desc' => 'Esta imagen debería de ser 43px en altura. <br>Iágenes grandes seán escaladas.',
'app_primary_color' => 'Color primario de la aplicación', 'app_primary_color' => 'Color primario de la aplicación',
'app_primary_color_desc' => 'Esto debería ser un valor hexadecimal. <br>Deje el valor vaío para reiniciar al valor por defecto.', 'app_primary_color_desc' => 'Esto debería ser un valor hexadecimal. <br>Deje el valor vaío para reiniciar al valor por defecto.',
'app_disable_comments' => 'Deshabilitar comentarios',
'app_disable_comments_desc' => 'Deshabilita los comentarios en todas las páginas de la aplicación. Los comentarios existentes no se muestran. ',
/** /**
* Registration settings * Registration settings
@ -91,6 +93,7 @@ return [
'users_external_auth_id' => 'ID externo de autenticación', 'users_external_auth_id' => 'ID externo de autenticación',
'users_password_warning' => 'Solo rellene a continuación si desea cambiar su password:', 'users_password_warning' => 'Solo rellene a continuación si desea cambiar su password:',
'users_system_public' => 'Este usuario representa cualquier usuario invitado que visita la aplicación. No puede utilizarse para hacer login sio que es asignado automáticamente.', 'users_system_public' => 'Este usuario representa cualquier usuario invitado que visita la aplicación. No puede utilizarse para hacer login sio que es asignado automáticamente.',
'users_books_view_type' => 'Diseño de pantalla preferido para libros',
'users_delete' => 'Borrar usuario', 'users_delete' => 'Borrar usuario',
'users_delete_named' => 'Borrar usuario :userName', 'users_delete_named' => 'Borrar usuario :userName',
'users_delete_warning' => 'Se borrará completamente el usuario con el nombre \':userName\' del sistema.', 'users_delete_warning' => 'Se borrará completamente el usuario con el nombre \':userName\' del sistema.',

View File

@ -17,7 +17,8 @@ return [
'name' => 'Nom', 'name' => 'Nom',
'description' => 'Description', 'description' => 'Description',
'role' => 'Rôle', 'role' => 'Rôle',
'cover_image' => 'Image de couverture',
'cover_image_description' => 'Cette image doit être environ 300x170px.',
/** /**
* Actions * Actions
*/ */
@ -43,6 +44,7 @@ return [
'no_items' => 'Aucun élément', 'no_items' => 'Aucun élément',
'back_to_top' => 'Retour en haut', 'back_to_top' => 'Retour en haut',
'toggle_details' => 'Afficher les détails', 'toggle_details' => 'Afficher les détails',
'toggle_thumbnails' => 'Afficher les vignettes',
/** /**
* Header * Header

View File

@ -31,7 +31,8 @@ return [
'app_logo_desc' => 'Cette image doit faire 43px de hauteur. <br>Les images plus larges seront réduites.', 'app_logo_desc' => 'Cette image doit faire 43px de hauteur. <br>Les images plus larges seront réduites.',
'app_primary_color' => 'Couleur principale de l\'application', 'app_primary_color' => 'Couleur principale de l\'application',
'app_primary_color_desc' => 'Cela devrait être une valeur hexadécimale. <br>Laisser vide pour rétablir la couleur par défaut.', 'app_primary_color_desc' => 'Cela devrait être une valeur hexadécimale. <br>Laisser vide pour rétablir la couleur par défaut.',
'app_disable_comments' => 'Désactiver les commentaires',
'app_disable_comments_desc' => 'Désactive les commentaires sur toutes les pages de l\'application. Les commentaires existants ne sont pas affichés.',
/** /**
* Registration settings * Registration settings
*/ */
@ -91,6 +92,7 @@ return [
'users_external_auth_id' => 'Identifiant d\'authentification externe', 'users_external_auth_id' => 'Identifiant d\'authentification externe',
'users_password_warning' => 'Remplissez ce fomulaire uniquement si vous souhaitez changer de mot de passe:', 'users_password_warning' => 'Remplissez ce fomulaire uniquement si vous souhaitez changer de mot de passe:',
'users_system_public' => 'Cet utilisateur représente les invités visitant votre instance. Il est assigné automatiquement aux invités.', 'users_system_public' => 'Cet utilisateur représente les invités visitant votre instance. Il est assigné automatiquement aux invités.',
'users_books_view_type' => 'Disposition d\'affichage préférée pour les livres',
'users_delete' => 'Supprimer un utilisateur', 'users_delete' => 'Supprimer un utilisateur',
'users_delete_named' => 'Supprimer l\'utilisateur :userName', 'users_delete_named' => 'Supprimer l\'utilisateur :userName',
'users_delete_warning' => 'Ceci va supprimer \':userName\' du système.', 'users_delete_warning' => 'Ceci va supprimer \':userName\' du système.',

View File

@ -34,11 +34,12 @@ return [
'app_homepage' => 'Homepage Applicazione', 'app_homepage' => 'Homepage Applicazione',
'app_homepage_desc' => 'Seleziona una pagina da mostrare nella home anzichè quella di default. I permessi della pagina sono ignorati per quella selezionata.', 'app_homepage_desc' => 'Seleziona una pagina da mostrare nella home anzichè quella di default. I permessi della pagina sono ignorati per quella selezionata.',
'app_homepage_default' => 'Homepage di default scelta', 'app_homepage_default' => 'Homepage di default scelta',
'app_disable_comments' => 'Disattiva commenti',
'app_disable_comments_desc' => 'Disabilita i commenti su tutte le pagine nell\'applicazione. I commenti esistenti non sono mostrati. ',
/** /**
* Registration settings * Registration settings
*/ */
'reg_settings' => 'Impostazioni Registrazione', 'reg_settings' => 'Impostazioni Registrazione',
'reg_allow' => 'Consentire Registrazione?', 'reg_allow' => 'Consentire Registrazione?',
'reg_default_role' => 'Ruolo predefinito dopo la registrazione', 'reg_default_role' => 'Ruolo predefinito dopo la registrazione',

View File

@ -17,7 +17,7 @@ return [
'name' => '名称', 'name' => '名称',
'description' => '概要', 'description' => '概要',
'role' => '権限', 'role' => '権限',
'cover_image_description' => 'この画像は約 300x170px をする必要があります。',
/** /**
* Actions * Actions
*/ */

View File

@ -31,6 +31,8 @@ return [
'app_logo_desc' => '高さ43pxで表示されます。これを上回る場合、自動で縮小されます。', 'app_logo_desc' => '高さ43pxで表示されます。これを上回る場合、自動で縮小されます。',
'app_primary_color' => 'プライマリカラー', 'app_primary_color' => 'プライマリカラー',
'app_primary_color_desc' => '16進数カラーコードで入力します。空にした場合、デフォルトの色にリセットされます。', 'app_primary_color_desc' => '16進数カラーコードで入力します。空にした場合、デフォルトの色にリセットされます。',
'app_disable_comments' => 'コメントを無効にする',
'app_disable_comments_desc' => 'アプリケーション内のすべてのページのコメントを無効にします。既存のコメントは表示されません。',
/** /**
* Registration settings * Registration settings

View File

@ -18,7 +18,8 @@ return [
'name' => 'Naam', 'name' => 'Naam',
'description' => 'Beschrijving', 'description' => 'Beschrijving',
'role' => 'Rol', 'role' => 'Rol',
'cover_image' => 'Omslagfoto',
'cover_image_description' => 'Deze afbeelding moet ongeveer 300x170px zijn.',
/** /**
* Actions * Actions
*/ */
@ -44,6 +45,7 @@ return [
'no_items' => 'Geen items beschikbaar', 'no_items' => 'Geen items beschikbaar',
'back_to_top' => 'Terug naar boven', 'back_to_top' => 'Terug naar boven',
'toggle_details' => 'Details Weergeven', 'toggle_details' => 'Details Weergeven',
'toggle_thumbnails' => 'Thumbnails Weergeven',
/** /**
* Header * Header

View File

@ -31,6 +31,8 @@ return [
'app_logo_desc' => 'De afbeelding moet 43px hoog zijn. <br>Grotere afbeeldingen worden geschaald.', 'app_logo_desc' => 'De afbeelding moet 43px hoog zijn. <br>Grotere afbeeldingen worden geschaald.',
'app_primary_color' => 'Applicatie hoofdkleur', 'app_primary_color' => 'Applicatie hoofdkleur',
'app_primary_color_desc' => 'Geef een hexadecimale waarde. <br>Als je niks invult wordt de standaardkleur gebruikt.', 'app_primary_color_desc' => 'Geef een hexadecimale waarde. <br>Als je niks invult wordt de standaardkleur gebruikt.',
'app_disable_comments' => 'Reacties uitschakelen',
'app_disable_comments_desc' => 'Schakel opmerkingen uit op alle pagina\'s in de applicatie. Bestaande opmerkingen worden niet getoond.',
/** /**
* Registration settings * Registration settings
@ -91,6 +93,7 @@ return [
'users_external_auth_id' => 'External Authentication ID', 'users_external_auth_id' => 'External Authentication ID',
'users_password_warning' => 'Vul onderstaande formulier alleen in als je het wachtwoord wilt aanpassen:', 'users_password_warning' => 'Vul onderstaande formulier alleen in als je het wachtwoord wilt aanpassen:',
'users_system_public' => 'De eigenschappen van deze gebruiker worden voor elke gastbezoeker gebruikt. Er kan niet mee ingelogd worden en wordt automatisch toegewezen.', 'users_system_public' => 'De eigenschappen van deze gebruiker worden voor elke gastbezoeker gebruikt. Er kan niet mee ingelogd worden en wordt automatisch toegewezen.',
'users_books_view_type' => 'Voorkeursuitleg voor het weergeven van boeken',
'users_delete' => 'Verwijder gebruiker', 'users_delete' => 'Verwijder gebruiker',
'users_delete_named' => 'Verwijder gebruiker :userName', 'users_delete_named' => 'Verwijder gebruiker :userName',
'users_delete_warning' => 'Dit zal de gebruiker \':userName\' volledig uit het systeem verwijderen.', 'users_delete_warning' => 'Dit zal de gebruiker \':userName\' volledig uit het systeem verwijderen.',

View File

@ -17,6 +17,8 @@ return [
'name' => 'Nazwa', 'name' => 'Nazwa',
'description' => 'Opis', 'description' => 'Opis',
'role' => 'Rola', 'role' => 'Rola',
'cover_image' => 'Zdjęcie z okładki',
'cover_image_description' => 'Ten obraz powinien wynosić około 300 x 170 piksli.',
/** /**
* Actions * Actions

View File

@ -31,6 +31,8 @@ return [
'app_logo_desc' => 'Ten obrazek powinien mieć nie więcej niż 43px w pionie. <br>Większe obrazki będą skalowane w dół.', 'app_logo_desc' => 'Ten obrazek powinien mieć nie więcej niż 43px w pionie. <br>Większe obrazki będą skalowane w dół.',
'app_primary_color' => 'Podstawowy kolor aplikacji', 'app_primary_color' => 'Podstawowy kolor aplikacji',
'app_primary_color_desc' => 'To powinna być wartość HEX. <br>Zostaw to pole puste, by powrócić do podstawowego koloru.', 'app_primary_color_desc' => 'To powinna być wartość HEX. <br>Zostaw to pole puste, by powrócić do podstawowego koloru.',
'app_disable_comments' => 'Wyłącz komentarze',
'app_disable_comments_desc' => 'Wyłącz komentarze na wszystkich stronach w aplikacji. Istniejące komentarze nie są pokazywane.',
/** /**
* Registration settings * Registration settings

View File

@ -37,4 +37,6 @@ return [
'book_sort' => 'livro classificado', 'book_sort' => 'livro classificado',
'book_sort_notification' => 'Livro reclassificado com sucesso', 'book_sort_notification' => 'Livro reclassificado com sucesso',
// Other
'commented_on' => 'comentou em',
]; ];

View File

@ -18,6 +18,8 @@ return [
*/ */
'sign_up' => 'Registrar-se', 'sign_up' => 'Registrar-se',
'log_in' => 'Entrar', 'log_in' => 'Entrar',
'log_in_with' => 'Entrar com :socialDriver',
'sign_up_with' => 'Registrar com :socialDriver',
'logout' => 'Sair', 'logout' => 'Sair',
'name' => 'Nome', 'name' => 'Nome',

View File

@ -10,6 +10,7 @@ return [
'save' => 'Salvar', 'save' => 'Salvar',
'continue' => 'Continuar', 'continue' => 'Continuar',
'select' => 'Selecionar', 'select' => 'Selecionar',
'more' => 'Mais',
/** /**
* Form Labels * Form Labels
@ -17,7 +18,8 @@ return [
'name' => 'Nome', 'name' => 'Nome',
'description' => 'Descrição', 'description' => 'Descrição',
'role' => 'Regra', 'role' => 'Regra',
'cover_image' => 'Imagem de capa',
'cover_image_description' => 'Esta imagem deve ser aproximadamente 300x170px.',
/** /**
* Actions * Actions
*/ */
@ -28,12 +30,13 @@ return [
'edit' => 'Editar', 'edit' => 'Editar',
'sort' => 'Ordenar', 'sort' => 'Ordenar',
'move' => 'Mover', 'move' => 'Mover',
'reply' => 'Responder',
'delete' => 'Excluir', 'delete' => 'Excluir',
'search' => 'Pesquisar', 'search' => 'Pesquisar',
'search_clear' => 'Limpar Pesquisa', 'search_clear' => 'Limpar Pesquisa',
'reset' => 'Resetar', 'reset' => 'Resetar',
'remove' => 'Remover', 'remove' => 'Remover',
'add' => 'Adicionar',
/** /**
* Misc * Misc
@ -43,6 +46,8 @@ return [
'no_items' => 'Nenhum item disponível', 'no_items' => 'Nenhum item disponível',
'back_to_top' => 'Voltar ao topo', 'back_to_top' => 'Voltar ao topo',
'toggle_details' => 'Alternar Detalhes', 'toggle_details' => 'Alternar Detalhes',
'toggle_thumbnails' => 'Alternar Miniaturas',
'details' => 'Detalhes',
/** /**
* Header * Header

View File

@ -20,5 +20,13 @@ return [
'image_preview' => 'Virtualização de Imagem', 'image_preview' => 'Virtualização de Imagem',
'image_upload_success' => 'Upload de imagem efetuado com sucesso', 'image_upload_success' => 'Upload de imagem efetuado com sucesso',
'image_update_success' => 'Upload de detalhes da imagem efetuado com sucesso', 'image_update_success' => 'Upload de detalhes da imagem efetuado com sucesso',
'image_delete_success' => 'Imagem excluída com sucesso' 'image_delete_success' => 'Imagem excluída com sucesso',
/**
* Code editor
*/
'code_editor' => 'Editar Código',
'code_language' => 'Linguagem do Código',
'code_content' => 'Código',
'code_save' => 'Salvar Código',
]; ];

View File

@ -14,11 +14,11 @@ return [
'recent_activity' => 'Atividade recente', 'recent_activity' => 'Atividade recente',
'create_now' => 'Criar um agora', 'create_now' => 'Criar um agora',
'revisions' => 'Revisões', 'revisions' => 'Revisões',
'meta_revision' => 'Revisão #:revisionCount',
'meta_created' => 'Criado em :timeLength', 'meta_created' => 'Criado em :timeLength',
'meta_created_name' => 'Criado em :timeLength por :user', 'meta_created_name' => 'Criado em :timeLength por :user',
'meta_updated' => 'Atualizado em :timeLength', 'meta_updated' => 'Atualizado em :timeLength',
'meta_updated_name' => 'Atualizado em :timeLength por :user', 'meta_updated_name' => 'Atualizado em :timeLength por :user',
'x_pages' => ':count Páginas',
'entity_select' => 'Seleção de Entidade', 'entity_select' => 'Seleção de Entidade',
'images' => 'Imagens', 'images' => 'Imagens',
'my_recent_drafts' => 'Meus rascunhos recentes', 'my_recent_drafts' => 'Meus rascunhos recentes',
@ -43,19 +43,39 @@ return [
* Search * Search
*/ */
'search_results' => 'Resultado(s) da Pesquisa', 'search_results' => 'Resultado(s) da Pesquisa',
'search_total_results_found' => ':count resultado encontrado|:count resultados encontrados',
'search_clear' => 'Limpar Pesquisa', 'search_clear' => 'Limpar Pesquisa',
'search_no_pages' => 'Nenhuma página corresponde à pesquisa', 'search_no_pages' => 'Nenhuma página corresponde à pesquisa',
'search_for_term' => 'Pesquisar por :term', 'search_for_term' => 'Pesquisar por :term',
'search_more' => 'Mais Resultados',
'search_filters' => 'Filtros de Pesquisa',
'search_content_type' => 'Tipo de Conteúdo',
'search_exact_matches' => 'Correspondências Exatas',
'search_tags' => 'Tags',
'search_viewed_by_me' => 'Visto por mim',
'search_not_viewed_by_me' => 'Não visto por mim',
'search_permissions_set' => 'Permissão definida',
'search_created_by_me' => 'Criado por mim',
'search_updated_by_me' => 'Atualizado por mim',
'search_updated_before' => 'Atualizado antes de',
'search_updated_after' => 'Atualizado depois de',
'search_created_before' => 'Criado antes de',
'search_created_after' => 'Criado depois de',
'search_set_date' => 'Definir data',
'search_update' => 'Refazer Pesquisa',
/** /**
* Books * Books
*/ */
'book' => 'Livro', 'book' => 'Livro',
'books' => 'Livros', 'books' => 'Livros',
'x_books' => ':count Livro|:count Livros',
'books_empty' => 'Nenhum livro foi criado', 'books_empty' => 'Nenhum livro foi criado',
'books_popular' => 'Livros populares', 'books_popular' => 'Livros populares',
'books_recent' => 'Livros recentes', 'books_recent' => 'Livros recentes',
'books_new' => 'Livros novos',
'books_popular_empty' => 'Os livros mais populares aparecerão aqui.', 'books_popular_empty' => 'Os livros mais populares aparecerão aqui.',
'books_new_empty' => 'Os livros criados mais recentemente aparecerão aqui.',
'books_create' => 'Criar novo Livro', 'books_create' => 'Criar novo Livro',
'books_delete' => 'Excluir Livro', 'books_delete' => 'Excluir Livro',
'books_delete_named' => 'Excluir Livro :bookName', 'books_delete_named' => 'Excluir Livro :bookName',
@ -83,18 +103,18 @@ return [
/** /**
* Chapters * Chapters
*/ */
'chapter' => 'Capitulo', 'chapter' => 'Capítulo',
'chapters' => 'Capítulos', 'chapters' => 'Capítulos',
'x_chapters' => ':count Capítulo|:count Capítulos',
'chapters_popular' => 'Capítulos Populares', 'chapters_popular' => 'Capítulos Populares',
'chapters_new' => 'Novo Capítulo', 'chapters_new' => 'Novo Capítulo',
'chapters_create' => 'Criar novo Capítulo', 'chapters_create' => 'Criar novo Capítulo',
'chapters_delete' => 'Excluír Capítulo', 'chapters_delete' => 'Excluír Capítulo',
'chapters_delete_named' => 'Excluir Capítulo :chapterName', 'chapters_delete_named' => 'Excluir Capítulo :chapterName',
'chapters_delete_explain' => 'A ação vai excluír o capítulo de nome \':chapterName\'. Todas as páginas do capítulo serão removidas 'chapters_delete_explain' => 'A ação vai excluír o capítulo de nome \':chapterName\'. Todas as páginas do capítulo serão removidas e adicionadas diretamente ao livro pai.',
e adicionadas diretamente ao livro pai.', 'chapters_delete_confirm' => 'Tem certeza que deseja excluír o capítulo?',
'chapters_delete_confirm' => 'Tem certeza que deseja excluír o capitulo?',
'chapters_edit' => 'Editar Capítulo', 'chapters_edit' => 'Editar Capítulo',
'chapters_edit_named' => 'Editar capitulo :chapterName', 'chapters_edit_named' => 'Editar capítulo :chapterName',
'chapters_save' => 'Salvar Capítulo', 'chapters_save' => 'Salvar Capítulo',
'chapters_move' => 'Mover Capítulo', 'chapters_move' => 'Mover Capítulo',
'chapters_move_named' => 'Mover Capítulo :chapterName', 'chapters_move_named' => 'Mover Capítulo :chapterName',
@ -103,12 +123,14 @@ return [
'chapters_empty' => 'Nenhuma página existente nesse capítulo.', 'chapters_empty' => 'Nenhuma página existente nesse capítulo.',
'chapters_permissions_active' => 'Permissões de Capítulo ativadas', 'chapters_permissions_active' => 'Permissões de Capítulo ativadas',
'chapters_permissions_success' => 'Permissões de Capítulo atualizadas', 'chapters_permissions_success' => 'Permissões de Capítulo atualizadas',
'chapters_search_this' => 'Pesquisar este Capítulo',
/** /**
* Pages * Pages
*/ */
'page' => 'Página', 'page' => 'Página',
'pages' => 'Páginas', 'pages' => 'Páginas',
'x_pages' => ':count Página|:count Páginas',
'pages_popular' => 'Páginas Popular', 'pages_popular' => 'Páginas Popular',
'pages_new' => 'Nova Página', 'pages_new' => 'Nova Página',
'pages_attachments' => 'Anexos', 'pages_attachments' => 'Anexos',
@ -145,11 +167,13 @@ return [
'pages_move_success' => 'Pagina movida para ":parentName"', 'pages_move_success' => 'Pagina movida para ":parentName"',
'pages_permissions' => 'Permissões de Página', 'pages_permissions' => 'Permissões de Página',
'pages_permissions_success' => 'Permissões de Página atualizadas', 'pages_permissions_success' => 'Permissões de Página atualizadas',
'pages_revision' => 'Revisão',
'pages_revisions' => 'Revisões de Página', 'pages_revisions' => 'Revisões de Página',
'pages_revisions_named' => 'Revisões de Página para :pageName', 'pages_revisions_named' => 'Revisões de Página para :pageName',
'pages_revision_named' => 'Revisão de Página para :pageName', 'pages_revision_named' => 'Revisão de Página para :pageName',
'pages_revisions_created_by' => 'Criado por', 'pages_revisions_created_by' => 'Criado por',
'pages_revisions_date' => 'Data da Revisão', 'pages_revisions_date' => 'Data da Revisão',
'pages_revisions_number' => '#',
'pages_revisions_changelog' => 'Changelog', 'pages_revisions_changelog' => 'Changelog',
'pages_revisions_changes' => 'Mudanças', 'pages_revisions_changes' => 'Mudanças',
'pages_revisions_current' => 'Versão atual', 'pages_revisions_current' => 'Versão atual',
@ -218,8 +242,19 @@ return [
/** /**
* Comments * Comments
*/ */
'comentário' => 'Comentário', 'comment' => 'Comentário',
'comentários' => 'Comentários', 'comments' => 'Comentários',
'comment_placeholder' => 'Digite seus comentários aqui', 'comment_placeholder' => 'Digite seus comentários aqui',
'comment_count' => '{0} Nenhum comentário|{1} 1 Comentário|[2,*] :count Comentários',
'comment_save' => 'Salvar comentário', 'comment_save' => 'Salvar comentário',
'comment_saving' => 'Salvando comentário...',
'comment_deleting' => 'Removendo comentário...',
'comment_new' => 'Novo comentário',
'comment_created' => 'comentado :createDiff',
'comment_updated' => 'Editado :updateDiff por :username',
'comment_deleted_success' => 'Comentário removido',
'comment_created_success' => 'Comentário adicionado',
'comment_updated_success' => 'Comentário editado',
'comment_delete_confirm' => 'Você tem certeza de que quer deletar este comentário?',
'comment_in_reply_to' => 'Em resposta à :commentId',
]; ];

View File

@ -41,6 +41,7 @@ return [
// Pages // Pages
'page_draft_autosave_fail' => 'Falou ao tentar salvar o rascunho. Certifique-se que a conexão de internet está funcional antes de tentar salvar essa página', 'page_draft_autosave_fail' => 'Falou ao tentar salvar o rascunho. Certifique-se que a conexão de internet está funcional antes de tentar salvar essa página',
'page_custom_home_deletion' => 'Não pode deletar uma página que está definida como página inicial',
// Entities // Entities
'entity_not_found' => 'Entidade não encontrada', 'entity_not_found' => 'Entidade não encontrada',
@ -60,6 +61,13 @@ return [
'role_system_cannot_be_deleted' => 'Esse perfil é um perfil de sistema e não pode ser excluído', 'role_system_cannot_be_deleted' => 'Esse perfil é um perfil de sistema e não pode ser excluído',
'role_registration_default_cannot_delete' => 'Esse perfil não poderá se excluído enquando estiver registrado como o perfil padrão', 'role_registration_default_cannot_delete' => 'Esse perfil não poderá se excluído enquando estiver registrado como o perfil padrão',
// comments
'comment_list' => 'Ocorreu um erro ao buscar os comentários.',
'cannot_add_comment_to_draft' => 'Você não pode adicionar comentários a um rascunho.',
'comment_add' => 'Ocorreu um erro ao adicionar o comentário.',
'comment_delete' => 'Ocorreu um erro ao excluir o comentário.',
'empty_comment' => 'Não é possível adicionar um comentário vazio.',
// Error pages // Error pages
'404_page_not_found' => 'Página não encontrada', '404_page_not_found' => 'Página não encontrada',
'sorry_page_not_found' => 'Desculpe, a página que você está procurando não pôde ser encontrada.', 'sorry_page_not_found' => 'Desculpe, a página que você está procurando não pôde ser encontrada.',
@ -67,11 +75,4 @@ return [
'error_occurred' => 'Um erro ocorreu', 'error_occurred' => 'Um erro ocorreu',
'app_down' => ':appName está fora do ar no momento', 'app_down' => ':appName está fora do ar no momento',
'back_soon' => 'Voltaremos em seguida.', 'back_soon' => 'Voltaremos em seguida.',
// comments
'comment_list' => 'Ocorreu um erro ao buscar os comentários.',
'cannot_add_comment_to_draft' => 'Você não pode adicionar comentários a um rascunho.',
'comment_add' => 'Ocorreu um erro ao adicionar o comentário.',
'comment_delete' => 'Ocorreu um erro ao excluir o comentário.',
'empty_comment' => 'Não é possível adicionar um comentário vazio.',
]; ];

View File

@ -31,6 +31,11 @@ return [
'app_logo_desc' => 'A imagem deve ter 43px de altura. <br>Imagens mais largas devem ser reduzidas.', 'app_logo_desc' => 'A imagem deve ter 43px de altura. <br>Imagens mais largas devem ser reduzidas.',
'app_primary_color' => 'Cor primária da Aplicação', 'app_primary_color' => 'Cor primária da Aplicação',
'app_primary_color_desc' => 'Esse valor deverá ser Hexadecimal. <br>Deixe em branco para que o Bookstack assuma a cor padrão.', 'app_primary_color_desc' => 'Esse valor deverá ser Hexadecimal. <br>Deixe em branco para que o Bookstack assuma a cor padrão.',
'app_homepage' => 'Página incial',
'app_homepage_desc' => 'Selecione a página para ser usada como página inicial em vez da padrão. Permissões da página serão ignoradas.',
'app_homepage_default' => 'Escolhida página inicial padrão',
'app_disable_comments' => 'Desativar comentários',
'app_disable_comments_desc' => 'Desativar comentários em todas as páginas no aplicativo. Os comentários existentes não são exibidos.',
/** /**
* Registration settings * Registration settings
@ -91,6 +96,7 @@ return [
'users_external_auth_id' => 'ID de Autenticação Externa', 'users_external_auth_id' => 'ID de Autenticação Externa',
'users_password_warning' => 'Preencha os dados abaixo caso queira modificar a sua senha:', 'users_password_warning' => 'Preencha os dados abaixo caso queira modificar a sua senha:',
'users_system_public' => 'Esse usuário representa quaisquer convidados que visitam o aplicativo. Ele não pode ser usado para login.', 'users_system_public' => 'Esse usuário representa quaisquer convidados que visitam o aplicativo. Ele não pode ser usado para login.',
'users_books_view_type' => 'Layout preferido para mostrar livros',
'users_delete' => 'Excluir Usuário', 'users_delete' => 'Excluir Usuário',
'users_delete_named' => 'Excluir :userName', 'users_delete_named' => 'Excluir :userName',
'users_delete_warning' => 'A ação vai excluir completamente o usuário de nome \':userName\' do sistema.', 'users_delete_warning' => 'A ação vai excluir completamente o usuário de nome \':userName\' do sistema.',
@ -101,6 +107,7 @@ return [
'users_edit_success' => 'Usuário atualizado com sucesso', 'users_edit_success' => 'Usuário atualizado com sucesso',
'users_avatar' => 'Imagem de Usuário', 'users_avatar' => 'Imagem de Usuário',
'users_avatar_desc' => 'Essa imagem deve ser um quadrado com aproximadamente 256px de altura e largura.', 'users_avatar_desc' => 'Essa imagem deve ser um quadrado com aproximadamente 256px de altura e largura.',
'users_preferred_language' => 'Linguagem de Preferência',
'users_social_accounts' => 'Contas Sociais', 'users_social_accounts' => 'Contas Sociais',
'users_social_accounts_info' => 'Aqui você pode conectar outras contas para acesso mais rápido. Desconectar uma conta não retira a possibilidade de acesso usando-a. Para revogar o acesso ao perfil através da conta social, você deverá fazê-lo na sua conta social.', 'users_social_accounts_info' => 'Aqui você pode conectar outras contas para acesso mais rápido. Desconectar uma conta não retira a possibilidade de acesso usando-a. Para revogar o acesso ao perfil através da conta social, você deverá fazê-lo na sua conta social.',
'users_social_connect' => 'Contas conectadas', 'users_social_connect' => 'Contas conectadas',

View File

@ -34,6 +34,8 @@ return [
'app_homepage' => 'Домашняя страница приложения', 'app_homepage' => 'Домашняя страница приложения',
'app_homepage_desc' => 'Выберите страницу, которая будет отображаться на главной странице вместо стандартной. Права на страницы игнорируются для выбранных страниц.', 'app_homepage_desc' => 'Выберите страницу, которая будет отображаться на главной странице вместо стандартной. Права на страницы игнорируются для выбранных страниц.',
'app_homepage_default' => 'Выбрана домашняя страница по-умолчанию', 'app_homepage_default' => 'Выбрана домашняя страница по-умолчанию',
'app_disable_comments' => 'Отключить комментарии',
'app_disable_comments_desc' => 'Отключить комментарии на всех страницах приложения. Существующие комментарии не отображаются.',
/** /**
* Registration * Registration

View File

@ -17,7 +17,8 @@ return [
'name' => 'Meno', 'name' => 'Meno',
'description' => 'Popis', 'description' => 'Popis',
'role' => 'Rola', 'role' => 'Rola',
'cover_image' => 'Obal knihy',
'cover_image_description' => 'Tento obrázok by mal byť približne 300 x 170 pixelov.',
/** /**
* Actions * Actions
*/ */
@ -43,6 +44,7 @@ return [
'no_items' => 'Žiadne položky nie sú dostupné', 'no_items' => 'Žiadne položky nie sú dostupné',
'back_to_top' => 'Späť nahor', 'back_to_top' => 'Späť nahor',
'toggle_details' => 'Prepnúť detaily', 'toggle_details' => 'Prepnúť detaily',
'toggle_thumbnails' => 'Prepnúť náhľady',
/** /**
* Header * Header

View File

@ -31,6 +31,8 @@ return [
'app_logo_desc' => 'Tento obrázok by mal mať 43px na výšku. <br>Veľké obrázky budú preškálované na menší rozmer.', 'app_logo_desc' => 'Tento obrázok by mal mať 43px na výšku. <br>Veľké obrázky budú preškálované na menší rozmer.',
'app_primary_color' => 'Primárna farba pre aplikáciu', 'app_primary_color' => 'Primárna farba pre aplikáciu',
'app_primary_color_desc' => 'Toto by mala byť hodnota v hex tvare. <br>Nechajte prázdne ak chcete použiť prednastavenú farbu.', 'app_primary_color_desc' => 'Toto by mala byť hodnota v hex tvare. <br>Nechajte prázdne ak chcete použiť prednastavenú farbu.',
'app_disable_comments' => 'Zakázať komentáre',
'app_disable_comments_desc' => 'Zakázať komentáre na všetkých stránkach aplikácie. Existujúce komentáre sa nezobrazujú.',
/** /**
* Registration settings * Registration settings
@ -91,6 +93,7 @@ return [
'users_external_auth_id' => 'Externé autentifikačné ID', 'users_external_auth_id' => 'Externé autentifikačné ID',
'users_password_warning' => 'Pole nižšie vyplňte iba ak chcete zmeniť heslo:', 'users_password_warning' => 'Pole nižšie vyplňte iba ak chcete zmeniť heslo:',
'users_system_public' => 'Tento účet reprezentuje každého hosťovského používateľa, ktorý navštívi Vašu inštanciu. Nedá sa pomocou neho prihlásiť a je priradený automaticky.', 'users_system_public' => 'Tento účet reprezentuje každého hosťovského používateľa, ktorý navštívi Vašu inštanciu. Nedá sa pomocou neho prihlásiť a je priradený automaticky.',
'users_books_view_type' => 'Preferované rozloženie pre prezeranie kníh',
'users_delete' => 'Zmazať používateľa', 'users_delete' => 'Zmazať používateľa',
'users_delete_named' => 'Zmazať používateľa :userName', 'users_delete_named' => 'Zmazať používateľa :userName',
'users_delete_warning' => ' Toto úplne odstráni používateľa menom \':userName\' zo systému.', 'users_delete_warning' => ' Toto úplne odstráni používateľa menom \':userName\' zo systému.',

View File

@ -17,11 +17,12 @@
<div class="card"> <div class="card">
<h3><i class="zmdi zmdi-plus"></i> {{ trans('entities.books_create') }}</h3> <h3><i class="zmdi zmdi-plus"></i> {{ trans('entities.books_create') }}</h3>
<div class="body"> <div class="body">
<form action="{{ baseUrl("/books") }}" method="POST"> <form action="{{ baseUrl("/books") }}" method="POST" enctype="multipart/form-data">
@include('books/form') @include('books/form')
</form> </form>
</div> </div>
</div> </div>
</div> </div>
<p class="margin-top large"><br></p>
@include('components.image-manager', ['imageType' => 'cover'])
@stop @stop

View File

@ -20,5 +20,5 @@
</div> </div>
</div> </div>
</div> </div>
@include('components.image-manager', ['imageType' => 'cover'])
@stop @stop

View File

@ -10,6 +10,26 @@
@include('form/textarea', ['name' => 'description']) @include('form/textarea', ['name' => 'description'])
</div> </div>
<div class="form-group" collapsible id="logo-control">
<div class="collapse-title text-primary" collapsible-trigger>
<label for="user-avatar">{{ trans('common.cover_image') }}</label>
</div>
<div class="collapse-content" collapsible-content>
<p class="small">{{ trans('common.cover_image_description') }}</p>
@include('components.image-picker', [
'resizeHeight' => '512',
'resizeWidth' => '512',
'showRemove' => false,
'defaultImage' => baseUrl('/book_default_cover.png'),
'currentImage' => @isset($model) ? $model->getBookCover() : baseUrl('/book_default_cover.png') ,
'currentId' => @isset($model) ? $model->image_id : 0,
'name' => 'image_id',
'imageClass' => 'cover'
])
</div>
</div>
<div class="form-group text-right"> <div class="form-group text-right">
<a href="{{ isset($book) ? $book->getUrl() : baseUrl('/books') }}" class="button outline">{{ trans('common.cancel') }}</a> <a href="{{ isset($book) ? $book->getUrl() : baseUrl('/books') }}" class="button outline">{{ trans('common.cancel') }}</a>
<button type="submit" class="button pos">{{ trans('entities.books_save') }}</button> <button type="submit" class="button pos">{{ trans('entities.books_save') }}</button>

View File

@ -0,0 +1,18 @@
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4 book-grid-item" data-entity-type="book" data-entity-id="{{$book->id}}">
<div class="featured-image-container">
<a href="{{$book->getUrl()}}" title="{{$book->name}}">
<img width="1600" height="900" src="{{$book->getBookCover()}}" alt="{{$book->name}}">
</a>
</div>
<div class="book-grid-content">
<h2><a href="{{$book->getUrl()}}" title="{{$book->name}}" > {{$book->getShortName(35)}} </a></h2>
@if(isset($book->searchSnippet))
<p >{!! $book->searchSnippet !!}</p>
@else
<p >{{ $book->getExcerpt(130) }}</p>
@endif
<div >
<span>@include('partials.entity-meta', ['entity' => $book])</span>
</div>
</div>
</div>

View File

@ -39,15 +39,29 @@
@stop @stop
@section('body') @section('body')
@if($booksViewType === 'list')
<div class="container small" ng-non-bindable> <div class="container small" ng-non-bindable>
@else
<div class="container" ng-non-bindable>
@endif
<h1>{{ trans('entities.books') }}</h1> <h1>{{ trans('entities.books') }}</h1>
@if(count($books) > 0) @if(count($books) > 0)
@foreach($books as $book) @if($booksViewType === 'list')
@include('books/list-item', ['book' => $book]) @foreach($books as $book)
<hr> @include('books/list-item', ['book' => $book])
@endforeach <hr>
{!! $books->render() !!} @endforeach
{!! $books->render() !!}
@else
<div class="row auto-clear">
@foreach($books as $key => $book)
@include('books/grid-item', ['book' => $book])
@endforeach
<div class="col-xs-12">
{!! $books->render() !!}
</div>
</div>
@endif
@else @else
<p class="text-muted">{{ trans('entities.books_empty') }}</p> <p class="text-muted">{{ trans('entities.books_empty') }}</p>
@if(userCan('books-create-all')) @if(userCan('books-create-all'))
@ -55,5 +69,4 @@
@endif @endif
@endif @endif
</div> </div>
@stop @stop

View File

@ -13,54 +13,5 @@
<button class="text-button neg" data-action="remove-image" type="button">{{ trans('common.remove') }}</button> <button class="text-button neg" data-action="remove-image" type="button">{{ trans('common.remove') }}</button>
@endif @endif
<input type="hidden" name="{{$name}}" id="{{$name}}" value="{{ isset($currentId) && ($currentId !== '' && $currentId !== false) ? $currentId : $currentImage}}"> <input type="hidden" name="{{$name}}" id="{{$name}}" value="{{ isset($currentId) && ($currentId !== 0 && $currentId !== false) ? $currentId : $currentImage}}">
</div> </div>
<script>
(function(){
var picker = document.querySelector('[image-picker="{{$name}}"]');
picker.addEventListener('click', function(event) {
if (event.target.nodeName.toLowerCase() !== 'button') return;
var button = event.target;
var action = button.getAttribute('data-action');
var resize = picker.getAttribute('data-resize-height') && picker.getAttribute('data-resize-width');
var usingIds = picker.getAttribute('data-current-id') !== '';
var resizeCrop = picker.getAttribute('data-resize-crop') !== '';
var imageElem = picker.querySelector('img');
var input = picker.querySelector('input');
function setImage(image) {
if (image === 'none') {
imageElem.src = picker.getAttribute('data-default-image');
imageElem.classList.add('none');
input.value = 'none';
return;
}
imageElem.src = image.url;
input.value = usingIds ? image.id : image.url;
imageElem.classList.remove('none');
}
if (action === 'show-image-manager') {
window.ImageManager.show((image) => {
if (!resize) {
setImage(image);
return;
}
var requestString = '/images/thumb/' + image.id + '/' + picker.getAttribute('data-resize-width') + '/' + picker.getAttribute('data-resize-height') + '/' + (resizeCrop ? 'true' : 'false');
$.get(window.baseUrl(requestString), resp => {
image.url = resp.url;
setImage(image);
});
});
} else if (action === 'reset-image') {
setImage({id: 0, url: picker.getAttribute('data-default-image')});
} else if (action === 'remove-image') {
setImage('none');
}
});
})();
</script>

View File

@ -19,11 +19,11 @@
<div v-for="(tag, i) in tags" :key="tag.key" class="card drag-card"> <div v-for="(tag, i) in tags" :key="tag.key" class="card drag-card">
<div class="handle" ><i class="zmdi zmdi-menu"></i></div> <div class="handle" ><i class="zmdi zmdi-menu"></i></div>
<div> <div>
<autosuggest url="/ajax/tags/suggest/names" type="name" class="outline" :name="getTagFieldName(i, 'name')" <autosuggest url="{{ baseUrl('/ajax/tags/suggest/names') }}" type="name" class="outline" :name="getTagFieldName(i, 'name')"
v-model="tag.name" @input="tagChange(tag)" @blur="tagBlur(tag)" placeholder="{{ trans('entities.tag') }}"/> v-model="tag.name" @input="tagChange(tag)" @blur="tagBlur(tag)" placeholder="{{ trans('entities.tag') }}"/>
</div> </div>
<div> <div>
<autosuggest url="/ajax/tags/suggest/values" type="value" class="outline" :name="getTagFieldName(i, 'value')" <autosuggest url="{{ baseUrl('/ajax/tags/suggest/values') }}" type="value" class="outline" :name="getTagFieldName(i, 'value')"
v-model="tag.value" @change="tagChange(tag)" @blur="tagBlur(tag)" placeholder="{{ trans('entities.tag_value') }}"/> v-model="tag.value" @change="tagChange(tag)" @blur="tagBlur(tag)" placeholder="{{ trans('entities.tag_value') }}"/>
</div> </div>
<div v-show="tags.length !== 1" class="text-center drag-card-action text-neg" @click="removeTag(tag)"><i class="zmdi zmdi-close"></i></div> <div v-show="tags.length !== 1" class="text-center drag-card-action text-neg" @click="removeTag(tag)"><i class="zmdi zmdi-close"></i></div>

View File

@ -97,8 +97,7 @@
<div class="editor-toolbar"> <div class="editor-toolbar">
<div class="">{{ trans('entities.pages_md_preview') }}</div> <div class="">{{ trans('entities.pages_md_preview') }}</div>
</div> </div>
<div class="markdown-display"> <div class="markdown-display page-content">
<div class="page-content"></div>
</div> </div>
</div> </div>
<input type="hidden" name="html"/> <input type="hidden" name="html"/>

View File

@ -148,10 +148,11 @@
@include('pages/page-display') @include('pages/page-display')
</div> </div>
@if ($commentsEnabled)
<div class="container small nopad"> <div class="container small nopad">
@include('comments/comments', ['page' => $page]) @include('comments/comments', ['page' => $page])
</div> </div>
@endif
@stop @stop
@section('scripts') @section('scripts')

View File

@ -0,0 +1,5 @@
@if(setting('app-custom-head', false))
<!-- Custom user content -->
{!! setting('app-custom-head') !!}
<!-- End custom user content -->
@endif

View File

@ -7,6 +7,7 @@
} }
.button-base, .button, input[type="button"], input[type="submit"] { .button-base, .button, input[type="button"], input[type="submit"] {
background-color: {{ setting('app-color') }}; background-color: {{ setting('app-color') }};
border-color: {{ setting('app-color') }};
} }
.button-base:hover, .button:hover, input[type="button"]:hover, input[type="submit"]:hover, .button:focus { .button-base:hover, .button:hover, input[type="button"]:hover, input[type="submit"]:hover, .button:focus {
background-color: {{ setting('app-color') }}; background-color: {{ setting('app-color') }};

View File

@ -38,6 +38,11 @@
<p class="small">{{ trans('settings.app_secure_images_desc') }}</p> <p class="small">{{ trans('settings.app_secure_images_desc') }}</p>
@include('components.toggle-switch', ['name' => 'setting-app-secure-images', 'value' => setting('app-secure-images')]) @include('components.toggle-switch', ['name' => 'setting-app-secure-images', 'value' => setting('app-secure-images')])
</div> </div>
<div class="form-group">
<label>{{ trans('settings.app_disable_comments') }}</label>
<p class="small">{{ trans('settings.app_disable_comments_desc') }}</p>
@include('components.toggle-switch', ['name' => 'setting-app-disable-comments', 'value' => setting('app-disable-comments')])
</div>
<div class="form-group"> <div class="form-group">
<label for="setting-app-editor">{{ trans('settings.app_editor') }}</label> <label for="setting-app-editor">{{ trans('settings.app_editor') }}</label>
<p class="small">{{ trans('settings.app_editor_desc') }}</p> <p class="small">{{ trans('settings.app_editor_desc') }}</p>

View File

@ -43,6 +43,13 @@
@endforeach @endforeach
</select> </select>
</div> </div>
<div class="form-group">
<label for="books-view-type">{{ trans('settings.users_books_view_type') }}</label>
<select name="setting[books_view_type]" id="books-view-type">
<option @if(setting()->getUser($user, 'books_view_type', 'list') === 'list') selected @endif value="list">List</option>
<option @if(setting()->getUser($user, 'books_view_type', 'list') === 'grid') selected @endif value="grid">Grid</option>
</select>
</div>
</div> </div>
</div> </div>
<div class="form-group text-right"> <div class="form-group text-right">

View File

@ -135,6 +135,7 @@ Route::group(['middleware' => 'auth'], function () {
// Other Pages // Other Pages
Route::get('/', 'HomeController@index'); Route::get('/', 'HomeController@index');
Route::get('/home', 'HomeController@index'); Route::get('/home', 'HomeController@index');
Route::get('/custom-head-content', 'HomeController@customHeadContent');
// Settings // Settings
Route::group(['prefix' => 'settings'], function() { Route::group(['prefix' => 'settings'], function() {

View File

@ -124,6 +124,45 @@ class AuthTest extends BrowserKitTest
->press('Create Account') ->press('Create Account')
->seePageIs('/register/confirm') ->seePageIs('/register/confirm')
->seeInDatabase('users', ['name' => $user->name, 'email' => $user->email, 'email_confirmed' => false]); ->seeInDatabase('users', ['name' => $user->name, 'email' => $user->email, 'email_confirmed' => false]);
$this->visit('/')->seePageIs('/login')
->type($user->email, '#email')
->type($user->password, '#password')
->press('Log In')
->seePageIs('/register/confirm/awaiting')
->seeText('Email Address Not Confirmed');
}
public function test_restricted_registration_with_confirmation_disabled()
{
$this->setSettings(['registration-enabled' => 'true', 'registration-confirmation' => 'false', 'registration-restrict' => 'example.com']);
$user = factory(\BookStack\User::class)->make();
// Go through registration process
$this->visit('/register')
->type($user->name, '#name')
->type($user->email, '#email')
->type($user->password, '#password')
->press('Create Account')
->seePageIs('/register')
->dontSeeInDatabase('users', ['email' => $user->email])
->see('That email domain does not have access to this application');
$user->email = 'barry@example.com';
$this->visit('/register')
->type($user->name, '#name')
->type($user->email, '#email')
->type($user->password, '#password')
->press('Create Account')
->seePageIs('/register/confirm')
->seeInDatabase('users', ['name' => $user->name, 'email' => $user->email, 'email_confirmed' => false]);
$this->visit('/')->seePageIs('/login')
->type($user->email, '#email')
->type($user->password, '#password')
->press('Log In')
->seePageIs('/register/confirm/awaiting')
->seeText('Email Address Not Confirmed');
} }
public function test_user_creation() public function test_user_creation()

View File

@ -3,6 +3,7 @@
use BookStack\Entity; use BookStack\Entity;
use BookStack\Role; use BookStack\Role;
use BookStack\Services\PermissionService; use BookStack\Services\PermissionService;
use BookStack\User;
use Illuminate\Contracts\Console\Kernel; use Illuminate\Contracts\Console\Kernel;
use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Foundation\Testing\DatabaseTransactions;
use Laravel\BrowserKitTesting\TestCase; use Laravel\BrowserKitTesting\TestCase;
@ -129,15 +130,25 @@ abstract class BrowserKitTest extends TestCase
} }
/** /**
* Quick way to create a new user * Get an instance of a user with 'editor' permissions
* @param array $attributes * @param array $attributes
* @return mixed * @return mixed
*/ */
protected function getEditor($attributes = []) protected function getEditor($attributes = [])
{ {
$user = factory(\BookStack\User::class)->create($attributes); $user = \BookStack\Role::getRole('editor')->users()->first();
$role = Role::getRole('editor'); if (!empty($attributes)) $user->forceFill($attributes)->save();
$user->attachRole($role);; return $user;
}
/**
* Get an instance of a user with 'viewer' permissions
* @return mixed
*/
protected function getViewer()
{
$user = \BookStack\Role::getRole('viewer')->users()->first();
if (!empty($attributes)) $user->forceFill($attributes)->save();
return $user; return $user;
} }

View File

@ -0,0 +1,28 @@
<?php namespace Tests;
class CommentSettingTest extends BrowserKitTest {
protected $page;
public function setUp() {
parent::setUp();
$this->page = \BookStack\Page::first();
}
public function test_comment_disable () {
$this->asAdmin();
$this->setSettings(['app-disable-comments' => 'true']);
$this->asAdmin()->visit($this->page->getUrl())
->pageNotHasElement('.comments-list');
}
public function test_comment_enable () {
$this->asAdmin();
$this->setSettings(['app-disable-comments' => 'false']);
$this->asAdmin()->visit($this->page->getUrl())
->pageHasElement('.comments-list');
}
}

View File

@ -11,7 +11,6 @@ class EntityTest extends BrowserKitTest
public function test_entity_creation() public function test_entity_creation()
{ {
// Test Creation // Test Creation
$book = $this->bookCreation(); $book = $this->bookCreation();
$chapter = $this->chapterCreation($book); $chapter = $this->chapterCreation($book);
@ -257,4 +256,25 @@ class EntityTest extends BrowserKitTest
->seeInElement('#recently-updated-pages', $page->name); ->seeInElement('#recently-updated-pages', $page->name);
} }
public function test_slug_multi_byte_lower_casing()
{
$entityRepo = app(EntityRepo::class);
$book = $entityRepo->createFromInput('book', [
'name' => 'КНИГА'
]);
$this->assertEquals('книга', $book->slug);
}
public function test_slug_format()
{
$entityRepo = app(EntityRepo::class);
$book = $entityRepo->createFromInput('book', [
'name' => 'PartA / PartB / PartC'
]);
$this->assertEquals('parta-partb-partc', $book->slug);
}
} }

Some files were not shown because too many files have changed in this diff Show More