. 'Config'
. ($path ? DIRECTORY_SEPARATOR.$path : $path);
}
-
-}
\ No newline at end of file
+}
return setting('registration-confirmation')
|| setting('registration-restrict');
}
-
}
$token = $this->createTokenForUser($user);
$user->notify(new UserInvite($token));
}
-
}
return Carbon::now()->subHours($this->expiryTime)
->gt(new Carbon($tokenEntry->created_at));
}
-
-}
\ No newline at end of file
+}
],
],
-];
\ No newline at end of file
+];
$memcachedServers = explode(',', trim(env('MEMCACHED_SERVERS', '127.0.0.1:11211:100'), ','));
foreach ($memcachedServers as $index => $memcachedServer) {
$memcachedServerDetails = explode(':', $memcachedServer);
- if (count($memcachedServerDetails) < 2) $memcachedServerDetails[] = '11211';
- if (count($memcachedServerDetails) < 3) $memcachedServerDetails[] = '100';
+ if (count($memcachedServerDetails) < 2) {
+ $memcachedServerDetails[] = '11211';
+ }
+ if (count($memcachedServerDetails) < 3) {
+ $memcachedServerDetails[] = '100';
+ }
$memcachedServers[$index] = array_combine($memcachedServerKeys, $memcachedServerDetails);
}
}
// REDIS
// Split out configuration into an array
if (env('REDIS_SERVERS', false)) {
-
$redisDefaults = ['host' => '127.0.0.1', 'port' => '6379', 'database' => '0', 'password' => null];
$redisServers = explode(',', trim(env('REDIS_SERVERS', '127.0.0.1:6379:0'), ','));
$redisConfig = ['client' => 'predis'];
* should be an absolute path.
* This is only checked on command line call by dompdf.php, but not by
* direct class use like:
- * $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
+ * $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
*/
"DOMPDF_CHROOT" => realpath(base_path()),
'time' => 2,
],
-];
\ No newline at end of file
+];
],
],
-];
\ No newline at end of file
+];
// Global "From" address & name
'from' => [
- 'name' => env('MAIL_FROM_NAME','BookStack')
+ 'name' => env('MAIL_FROM_NAME', 'BookStack')
],
// Email encryption protocol
'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'),
+ 'redirect' => env('APP_URL') . '/login/service/okta/callback',
+ 'base_url' => env('OKTA_BASE_URL'),
'name' => 'Okta',
'auto_register' => env('OKTA_AUTO_REGISTER', false),
'auto_confirm' => env('OKTA_AUTO_CONFIRM_EMAIL', false),
'email_attribute' => env('LDAP_EMAIL_ATTRIBUTE', 'mail'),
'display_name_attribute' => env('LDAP_DISPLAY_NAME_ATTRIBUTE', 'cn'),
'follow_referrals' => env('LDAP_FOLLOW_REFERRALS', false),
- 'user_to_groups' => env('LDAP_USER_TO_GROUPS',false),
- 'group_attribute' => env('LDAP_GROUP_ATTRIBUTE', 'memberOf'),
- 'remove_from_groups' => env('LDAP_REMOVE_FROM_GROUPS',false),
- 'tls_insecure' => env('LDAP_TLS_INSECURE', false),
- ]
+ 'user_to_groups' => env('LDAP_USER_TO_GROUPS', false),
+ 'group_attribute' => env('LDAP_GROUP_ATTRIBUTE', 'memberOf'),
+ 'remove_from_groups' => env('LDAP_REMOVE_FROM_GROUPS', false),
+ 'tls_insecure' => env('LDAP_TLS_INSECURE', false),
+ ]
];
'app-custom-head' => false,
'registration-enabled' => false,
-];
\ No newline at end of file
+];
return [];
}
- $tree = collect($headers)->map(function($header) {
+ $tree = collect($headers)->map(function ($header) {
$text = trim(str_replace("\xc2\xa0", '', $header->nodeValue));
$text = mb_substr($text, 0, 100);
'link' => '#' . $header->getAttribute('id'),
'text' => $text,
];
- })->filter(function($header) {
+ })->filter(function ($header) {
return mb_strlen($header['text']) > 0;
});
* @param string $search
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
*/
- public function getPageTemplates(int $count = 10, int $page = 1, string $search = '')
+ public function getPageTemplates(int $count = 10, int $page = 1, string $search = '')
{
$query = $this->entityQuery('page')
->where('template', '=', true)
->orderBy('name', 'asc')
- ->skip( ($page - 1) * $count)
+ ->skip(($page - 1) * $count)
->take($count);
if ($search) {
<?php namespace BookStack\Exceptions;
-class UserTokenExpiredException extends \Exception {
+class UserTokenExpiredException extends \Exception
+{
public $userId;
$this->userId = $userId;
parent::__construct($message);
}
-
-
-}
\ No newline at end of file
+}
<?php namespace BookStack\Exceptions;
-class UserTokenNotFoundException extends \Exception {}
\ No newline at end of file
+class UserTokenNotFoundException extends \Exception
+{
+
+}
try {
$userId = $this->emailConfirmationService->checkTokenAndGetUserId($token);
} catch (Exception $exception) {
-
if ($exception instanceof UserTokenNotFoundException) {
session()->flash('error', trans('errors.email_confirmation_invalid'));
return redirect('/register');
session()->flash('success', trans('auth.email_confirm_resent'));
return redirect('/register/confirm');
}
-
}
'markdown' => $page->markdown,
]);
}
-
}
protected $except = [
//
];
-}
\ No newline at end of file
+}
return $base;
}
-
-}
\ No newline at end of file
+}
return "<?php echo icon($expression); ?>";
});
- Blade::directive('exposeTranslations', function($expression) {
+ Blade::directive('exposeTranslations', function ($expression) {
return "<?php \$__env->startPush('translations'); ?>" .
"<?php foreach({$expression} as \$key): ?>" .
'<meta name="translation" key="<?php echo e($key); ?>" value="<?php echo e(trans($key)); ?>">' . "\n" .
* @return string
* @throws Exception
*/
-function versioned_asset($file = '') : string
+function versioned_asset(string $file = ''): string
{
static $version = null;
* Defaults to public 'Guest' user if not logged in.
* @return User
*/
-function user() : User
+function user(): User
{
return auth()->user() ?: User::getDefault();
}
* Check if current user is a signed in user.
* @return bool
*/
-function signedInUser() : bool
+function signedInUser(): bool
{
return auth()->user() && !auth()->user()->isDefault();
}
* Check if the current user has general access.
* @return bool
*/
-function hasAppAccess() : bool
+function hasAppAccess(): bool
{
return !auth()->guest() || setting('app-public');
}
* @param Ownable $ownable
* @return bool
*/
-function userCan(string $permission, Ownable $ownable = null) : bool
+function userCan(string $permission, Ownable $ownable = null): bool
{
if ($ownable === null) {
return user() && user()->can($permission);
* @param string|null $entityClass
* @return bool
*/
-function userCanOnAny(string $permission, string $entityClass = null) : bool
+function userCanOnAny(string $permission, string $entityClass = null): bool
{
$permissionService = app(PermissionService::class);
return $permissionService->checkUserHasPermissionOnAnything($permission, $entityClass);
* @param bool $default
* @return bool|string|SettingService
*/
-function setting($key = null, $default = false)
+function setting(string $key = null, bool $default = false)
{
$settingService = resolve(SettingService::class);
if (is_null($key)) {
* @param string $path
* @return string
*/
-function theme_path($path = '') : string
+function theme_path(string $path = ''): string
{
$theme = config('view.theme');
if (!$theme) {
* @param array $attrs
* @return mixed
*/
-function icon($name, $attrs = [])
+function icon(string $name, array $attrs = []): string
{
$attrs = array_merge([
'class' => 'svg-icon',
* Generate a url with multiple parameters for sorting purposes.
* Works out the logic to set the correct sorting direction
* Discards empty parameters and allows overriding.
- * @param $path
+ * @param string $path
* @param array $data
* @param array $overrideData
* @return string
*/
-function sortUrl($path, $data, $overrideData = [])
+function sortUrl(string $path, array $data, array $overrideData = []): string
{
$queryStringSections = [];
$queryData = array_merge($data, $overrideData);