From: Dan Brown Date: Sun, 5 Feb 2017 21:24:15 +0000 (+0000) Subject: Merge bugfixes from branch 'v0.14' X-Git-Tag: v0.15.0~1^2~10 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/a6128a1df12cc37a2fd7fce2ecc0e08ba9fb3c91?ds=sidebyside;hp=-c Merge bugfixes from branch 'v0.14' --- a6128a1df12cc37a2fd7fce2ecc0e08ba9fb3c91 diff --combined app/helpers.php index f69f2c174,e68e29d13..153f1e49f --- a/app/helpers.php +++ b/app/helpers.php @@@ -37,6 -37,15 +37,15 @@@ function user( return auth()->user() ?: \BookStack\User::getDefault(); } + /** + * Check if current user is a signed in user. + * @return bool + */ + function signedInUser() + { + return auth()->user() && !auth()->user()->isDefault(); + } + /** * Check if the current user has a permission. * If an ownable element is passed in the jointPermissions are checked against @@@ -64,7 -73,7 +73,7 @@@ function userCan($permission, Ownable $ */ function setting($key = null, $default = false) { - $settingService = app(\BookStack\Services\SettingService::class); + $settingService = resolve(\BookStack\Services\SettingService::class); if (is_null($key)) return $settingService; return $settingService->get($key, $default); } @@@ -117,16 -126,6 +126,16 @@@ function redirect($to = null, $status return app('redirect')->to($to, $status, $headers, $secure); } +function icon($name, $attrs = []) { + $iconPath = resource_path('assets/icons/' . $name . '.svg'); + $attrString = ' '; + foreach ($attrs as $attrName => $attr) { + $attrString .= $attrName . '="' . $attr . '" '; + } + $fileContents = file_get_contents($iconPath); + return str_replace('asAdmin()->visit($page->getUrl()); + Auth::logout(); + view()->share('pageTitle', ''); + $this->forceVisit('/cats/dogs/hippos'); + $this->dontSee($page->name); + } + }