Added copyright/powered by notices to the footers of all pages. Added a config option to turn it off on the public-facing gallery pages

This commit is contained in:
Andy Heathershaw 2016-10-05 16:31:37 +01:00
parent 36fcb6d765
commit 51b03acbcd
12 changed files with 101 additions and 0 deletions

View File

@ -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')),

View File

@ -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)

View File

@ -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',

View File

@ -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)

View File

@ -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);
}
/**

View File

@ -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');

View File

@ -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();

View File

@ -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'
]

View File

@ -56,6 +56,20 @@
</div>
</div>
</div>
<hr/>
<fieldset>
<legend>&quot;Powered by&quot; footer link</legend>
<p>To help spread the word about Blue Twilight, I'd really appreciate it if you left the &quot;Powered by&quot; notice in your gallery's footer.</p>
<p>This is not compulsory, however, and you may remove it by checking the box below.</p>
<div class="checkbox" style="margin-top: 20px;">
<label>
<input type="checkbox" name="remove_copyright" @if (UserConfig::get('remove_copyright'))checked="checked"@endif>
<strong>Remove &quot;Powered by&quot; notice from the public gallery</strong>
</label>
</div>
</fieldset>
</div>
{{-- E-mail --}}

View File

@ -62,6 +62,12 @@
@endif
@yield('content')
@if (isset($is_admin) && $is_admin)
@include(\App\Facade\Theme::viewName('partials.copyright_admin'))
@elseif (!\App\Facade\UserConfig::get('remove_copyright'))
@include(\App\Facade\Theme::viewName('partials.copyright_gallery'))
@endif
</div>
{{-- Cannot use $theme_url here: if a theme uses the base layout, it would also have to provide all these dependencies! --}}

View File

@ -0,0 +1,24 @@
<div class="container" style="margin-top: 40px;">
<div class="row">
<div class="col-xs-12">
<hr/>
<p style="font-size: smaller;">
<b>
@lang('global.powered_by', [
'link_start' => '<a href="http://www.andyheathershaw.uk/blue-twilight" target="_blank">',
'link_end' => '</a>',
])
</b><br/>
@lang('global.copyright', [
'link_start' => '<a href="http://www.andyheathershaw.uk/" target="_blank">',
'link_end' => '</a>',
'years' => (date('Y') == 2016 ? '2016' : '2016-' . date('Y'))
])
</p>
<p style="font-size: smaller;">
@lang('global.licensed_to', ['name' => $license_name, 'number' => $license_no])<br/>
@lang('global.version_number', ['version' => config('app.version')])
</p>
</div>
</div>
</div>

View File

@ -0,0 +1,20 @@
<div class="container" style="margin-top: 40px;">
<div class="row">
<div class="col-xs-12">
<hr/>
<p style="font-size: smaller;">
<b>
@lang('global.powered_by', [
'link_start' => '<a href="http://www.andyheathershaw.uk/blue-twilight" target="_blank">',
'link_end' => '</a>',
])
</b><br/>
@lang('global.copyright', [
'link_start' => '<a href="http://www.andyheathershaw.uk/" target="_blank">',
'link_end' => '</a>',
'years' => (date('Y') == 2016 ? '2016' : '2016-' . date('Y'))
])
</p>
</div>
</div>
</div>