diff --git a/app/Helpers/ConfigHelper.php b/app/Helpers/ConfigHelper.php index 43ec37a..18b8fc2 100644 --- a/app/Helpers/ConfigHelper.php +++ b/app/Helpers/ConfigHelper.php @@ -90,6 +90,7 @@ class ConfigHelper 'recaptcha_enabled_registration' => false, 'recaptcha_secret_key' => '', 'recaptcha_site_key' => '', + 'remove_copyright' => false, 'require_email_verification' => true, 'restrict_original_download' => true, 'sender_address' => sprintf('hostmaster@%s', (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost')), diff --git a/app/Http/Controllers/Admin/AlbumController.php b/app/Http/Controllers/Admin/AlbumController.php index 92e05e0..1131ac6 100644 --- a/app/Http/Controllers/Admin/AlbumController.php +++ b/app/Http/Controllers/Admin/AlbumController.php @@ -16,12 +16,14 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\View; class AlbumController extends Controller { public function __construct() { $this->middleware('auth'); + View::share('is_admin', true); } public function analyse($id) diff --git a/app/Http/Controllers/Admin/DefaultController.php b/app/Http/Controllers/Admin/DefaultController.php index 65eb404..0f0fc6c 100644 --- a/app/Http/Controllers/Admin/DefaultController.php +++ b/app/Http/Controllers/Admin/DefaultController.php @@ -17,12 +17,14 @@ use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Mail; +use Illuminate\Support\Facades\View; class DefaultController extends Controller { public function __construct() { $this->middleware('auth'); + View::share('is_admin', true); } public function index() @@ -56,6 +58,7 @@ class DefaultController extends Controller 'allow_self_registration', 'hotlink_protection', 'recaptcha_enabled_registration', + 'remove_copyright', 'require_email_verification', 'restrict_original_download', 'smtp_encryption', diff --git a/app/Http/Controllers/Admin/PhotoController.php b/app/Http/Controllers/Admin/PhotoController.php index 49b271e..018af20 100644 --- a/app/Http/Controllers/Admin/PhotoController.php +++ b/app/Http/Controllers/Admin/PhotoController.php @@ -18,6 +18,7 @@ use Illuminate\Http\UploadedFile; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\View; use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator; use Symfony\Component\HttpFoundation\File\File; @@ -26,6 +27,7 @@ class PhotoController extends Controller public function __construct() { $this->middleware(['auth', 'max_post_size_exceeded']); + View::share('is_admin', true); } public function analyse($photoId) diff --git a/app/Http/Controllers/Admin/StorageController.php b/app/Http/Controllers/Admin/StorageController.php index 1252f2b..978ea16 100644 --- a/app/Http/Controllers/Admin/StorageController.php +++ b/app/Http/Controllers/Admin/StorageController.php @@ -10,12 +10,14 @@ use Illuminate\Http\Request; use App\Http\Requests; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\App; +use Illuminate\Support\Facades\View; class StorageController extends Controller { public function __construct() { $this->middleware('auth'); + View::share('is_admin', true); } /** diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 8c1f693..5166cc5 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -11,9 +11,16 @@ use App\Http\Controllers\Controller; use Illuminate\Http\Request; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\View; class UserController extends Controller { + public function __construct() + { + $this->middleware('auth'); + View::share('is_admin', true); + } + public function delete(Request $request, $id) { $this->authorize('admin-access'); diff --git a/app/Http/Middleware/GlobalConfiguration.php b/app/Http/Middleware/GlobalConfiguration.php index c09545f..c547956 100644 --- a/app/Http/Middleware/GlobalConfiguration.php +++ b/app/Http/Middleware/GlobalConfiguration.php @@ -42,6 +42,7 @@ class GlobalConfiguration // When running migrations, CLI tasks or the installer, don't need to add things to the view if (php_sapi_name() != 'cli') { + $this->addLicenseInfoToView(); $this->addThemeInfoToView(); $this->addAlbumsToView(); } @@ -58,6 +59,21 @@ class GlobalConfiguration View::share('albums', $albums); } + private function addLicenseInfoToView() + { + $licenseName = null; + $licenseNo = null; + + if (function_exists('sg_get_const')) + { + $licenseName = sg_get_const('license_name'); + $licenseNo = sg_get_const('license_number'); + } + + View::share('license_name', strlen($licenseName) == 0 ? '**UNLICENSED**' : $licenseName); + View::share('license_no', strlen($licenseNo) == 0 ? '0' : $licenseNo); + } + private function addThemeInfoToView() { $themeInfo = Theme::info(); diff --git a/resources/lang/en/global.php b/resources/lang/en/global.php index 2f6f06f..67791ce 100644 --- a/resources/lang/en/global.php +++ b/resources/lang/en/global.php @@ -4,7 +4,11 @@ return [ 'filesystem' => 'Local filesystem' ], 'app_name' => 'Blue Twilight', + 'copyright' => '© :years :link_startAndy Heathershaw:link_end', + 'licensed_to' => 'Licensed to :name (:number)', + 'version_number' => 'Version :version', 'post_max_exceeded' => 'Your upload exceeded the maximum size the web server is configured to allow. Please check the value of the "post_max_size" parameter in php.ini.', + 'powered_by' => 'Powered by :link_startBlue Twilight:link_end - the self-hosted photo gallery software.', 'units' => [ 'megabytes' => 'MB' ] diff --git a/resources/views/themes/base/admin/settings.blade.php b/resources/views/themes/base/admin/settings.blade.php index d017d86..7b08fa8 100644 --- a/resources/views/themes/base/admin/settings.blade.php +++ b/resources/views/themes/base/admin/settings.blade.php @@ -56,6 +56,20 @@ + +
+
+ @lang('global.powered_by', [
+ 'link_start' => '',
+ 'link_end' => '',
+ ])
+
+ @lang('global.copyright', [
+ 'link_start' => '',
+ 'link_end' => '',
+ 'years' => (date('Y') == 2016 ? '2016' : '2016-' . date('Y'))
+ ])
+
+ @lang('global.licensed_to', ['name' => $license_name, 'number' => $license_no])
+ @lang('global.version_number', ['version' => config('app.version')])
+
+
+ @lang('global.powered_by', [
+ 'link_start' => '',
+ 'link_end' => '',
+ ])
+
+ @lang('global.copyright', [
+ 'link_start' => '',
+ 'link_end' => '',
+ 'years' => (date('Y') == 2016 ? '2016' : '2016-' . date('Y'))
+ ])
+