blue-twilight/resources/views/themes/base/admin/settings.blade.php

359 lines
25 KiB
PHP

@extends(Theme::viewName('layout'))
@section('title', trans('admin.settings_title'))
@section('breadcrumb')
<li class="breadcrumb-item"><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li>
<li class="breadcrumb-item"><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
<li class="breadcrumb-item active">@lang('navigation.breadcrumb.settings')</li>
@endsection
@section('content')
<div class="container">
<div class="row">
<div class="col">
<h1>@yield('title')</h1>
<p style="margin-bottom: 30px;">@lang('admin.settings_intro')</p>
<form action="{{ route('admin.saveSettings') }}" method="post">
{{ csrf_field() }}
<div>
{{-- Nav tabs --}}
<ul class="nav nav-tabs" role="tablist">
@include(Theme::viewName('partials.tab'), ['active_tab' => 'general', 'tab_name' => 'general', 'tab_icon' => 'info-circle', 'tab_text' => trans('admin.settings_general_tab')])
@include(Theme::viewName('partials.tab'), ['active_tab' => 'general', 'tab_name' => 'email', 'tab_icon' => 'envelope', 'tab_text' => trans('admin.settings_email_tab')])
@include(Theme::viewName('partials.tab'), ['active_tab' => 'general', 'tab_name' => 'security', 'tab_icon' => 'lock', 'tab_text' => trans('admin.settings_security_tab')])
@include(Theme::viewName('partials.tab'), ['active_tab' => 'general', 'tab_name' => 'analytics', 'tab_icon' => 'line-chart', 'tab_text' => trans('admin.settings.analytics_tab')])
</ul>
{{-- Tab panes --}}
<div class="tab-content">
{{-- General --}}
<div role="tabpanel" class="tab-pane active" id="general-tab">
<div class="form-group">
<label class="form-control-label" for="gallery-name">Gallery name:</label>
<input type="text" class="form-control{{ $errors->has('app_name') ? ' is-invalid' : '' }}" id="gallery-name" name="app_name" value="{{ old('app_name', $config['app_name']) }}">
@if ($errors->has('app_name'))
<div class="invalid-feedback">
<strong>{{ $errors->first('app_name') }}</strong>
</div>
@endif
</div>
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<label class="form-control-label" for="date-format">Date format:</label>
<select name="date_format" id="date-format" class="form-control">
@foreach ($date_formats as $key => $value)
<option value="{{ $key }}"{{ old('date_format', $config['date_format']) == $key ? ' selected="selected"' : '' }}>{{ $value }}</option>
@endforeach
</select>
@if ($errors->has('date_format'))
<div class="invalid-feedback">
<strong>{{ $errors->first('date_format') }}</strong>
</div>
@endif
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<label class="form-control-label" for="theme">Theme:</label>
<select name="theme" id="theme" class="form-control">
@foreach ($theme_names as $key => $value)
<option value="{{ $key }}"{{ old('theme', $config['theme']) == $key ? ' selected="selected"' : '' }}>{{ $value }}</option>
@endforeach
</select>
@if ($errors->has('theme'))
<div class="invalid-feedback">
<strong>{{ $errors->first('theme') }}</strong>
</div>
@endif
</div>
</div>
</div>
<hr/>
<fieldset>
<legend>@lang('admin.settings.albums_menu_heading')</legend>
<div class="form-check mb-3">
<input type="checkbox" class="form-check-input" id="albums-menu-parents-only" name="albums_menu_parents_only" @if (old('albums_menu_parents_only', UserConfig::get('albums_menu_parents_only')))checked="checked"@endif>
<label class="form-check-label" for="albums-menu-parents-only">
<strong>@lang('admin.settings.albums_menu_parents_only')</strong>
</label>
</div>
<div class="form-group">
<label class="form-control-label" for="albums-menu-number-items">@lang('admin.settings.albums_menu_number_items')</label>
<input type="number" class="form-control{{ $errors->has('albums_menu_number_items') ? ' is-invalid' : '' }}" id="albums-menu-number-items" name="albums_menu_number_items" value="{{ old('albums_menu_number_items', $config['albums_menu_number_items']) }}" style="max-width: 100px;">
@if ($errors->has('albums_menu_number_items'))
<div class="invalid-feedback">
<strong>{{ $errors->first('albums_menu_number_items') }}</strong>
</div>
@endif
</div>
</fieldset>
<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>If you do want to remove it, however, I understand - just check the box below.</p>
<div class="form-check mt-2">
<input type="checkbox" class="form-check-input" id="remove-copyright" name="remove_copyright" @if (old('remove_copyright', UserConfig::get('remove_copyright')))checked="checked"@endif>
<label class="form-check-label" for="remove-copyright">
<strong>Remove &quot;Powered by&quot; notice from the public gallery</strong>
</label>
</div>
</fieldset>
</div>
{{-- E-mail --}}
<div role="tabpanel" class="tab-pane" id="email-tab">
<div class="form-group">
<label class="form-control-label" for="email-sender-name">Sender name:</label>
<input type="text" class="form-control{{ $errors->has('sender_name') ? ' is-invalid' : '' }}" id="email-sender-name" name="sender_name" value="{{ old('sender_name', $config['sender_name']) }}">
@if ($errors->has('sender_name'))
<div class="invalid-feedback">
<strong>{{ $errors->first('sender_name') }}</strong>
</div>
@endif
</div>
<div class="form-group">
<label class="form-control-label" for="email-sender-address">Sender address:</label>
<input type="text" class="form-control{{ $errors->has('sender_address') ? ' is-invalid' : '' }}" id="email-sender-address" name="sender_address" value="{{ old('sender_address', $config['sender_address']) }}">
@if ($errors->has('sender_address'))
<div class="invalid-feedback">
<strong>{{ $errors->first('sender_address') }}</strong>
</div>
@endif
</div>
<fieldset style="margin-top: 20px;">
<legend>SMTP Server</legend>
<p style="margin-bottom: 15px;">Configure your SMTP server using the settings below. If your server does not require authentication, leave the Username and Password fields empty.</p>
<div class="form-group">
<label class="form-control-label" for="email-smtp-server">Hostname:</label>
<input type="text" class="form-control{{ $errors->has('smtp_server') ? ' is-invalid' : '' }}" id="email-smtp-server" name="smtp_server" value="{{ old('smtp_server', $config['smtp_server']) }}">
@if ($errors->has('smtp_server'))
<div class="invalid-feedback">
<strong>{{ $errors->first('smtp_server') }}</strong>
</div>
@endif
</div>
<div class="form-group">
<label class="form-control-label" for="email-smtp-port">Port:</label>
<input type="text" class="form-control{{ $errors->has('smtp_port') ? ' is-invalid' : '' }}" id="email-smtp-port" name="smtp_port" value="{{ old('smtp_port', $config['smtp_port']) }}">
@if ($errors->has('smtp_port'))
<div class="invalid-feedback">
<strong>{{ $errors->first('smtp_port') }}</strong>
</div>
@endif
</div>
<div class="form-group">
<label class="form-control-label" for="email-smtp-username">Username:</label>
<input type="text" class="form-control{{ $errors->has('smtp_username') ? ' is-invalid' : '' }}" id="email-smtp-username" name="smtp_username" value="{{ old('smtp_username', $config['smtp_username']) }}">
@if ($errors->has('smtp_username'))
<div class="invalid-feedback">
<strong>{{ $errors->first('smtp_username') }}</strong>
</div>
@endif
</div>
<div class="form-group">
<label class="form-control-label" for="email-smtp-password">Password:</label>
<input type="text" class="form-control{{ $errors->has('smtp_password') ? ' is-invalid' : '' }}" id="email-smtp-password" name="smtp_password" value="{{ old('smtp_password', $config['smtp_password']) }}">
@if ($errors->has('smtp_password'))
<div class="invalid-feedback">
<strong>{{ $errors->first('smtp_password') }}</strong>
</div>
@endif
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="smtp-encryption" name="smtp_encryption" @if (UserConfig::get('smtp_encryption'))checked="checked"@endif>
<label class="form-check-label" for="smtp-encryption">
<strong>Requires encrypted connection</strong>
</label>
</div>
<div style="margin-top: 20px;">
<button id="test-email-button" type="button" class="btn btn-primary">@lang('admin.settings_test_email_action')</button>
<div style="margin-top: 10px;">
<div class="alert alert-info" id="test-email-status" style="display: none;">
<img src="{{ asset('ripple.svg') }}"/> Testing e-mail settings...
</div>
<div class="alert" id="test-email-result" style="display: none;">
<i class="fa fa-fw fa-info-circle"></i>
<strong id="test-email-result-summary"></strong> <span id="test-email-result-message"></span>
</div>
</div>
</div>
</fieldset>
</div>
{{-- Security --}}
<div role="tabpanel" class="tab-pane" id="security-tab">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="allow-self-registration" name="allow_self_registration" @if (old('allow_self_registration', UserConfig::get('allow_self_registration')))checked="checked"@endif>
<label class="form-check-label" for="allow-self-registration">
<span class="custom-control-description"><strong>@lang('admin.settings.security_allow_self_registration')</strong><br/>
@lang('admin.settings.security_allow_self_registration_description')</span>
</label>
</div>
<div class="form-check mt-3">
<input type="checkbox" class="form-check-input" id="require-email-verification" name="require_email_verification" @if (old('require_email_verification', UserConfig::get('require_email_verification')))checked="checked"@endif>
<label class="form-check-label" for="require-email-verification">
<strong>Require e-mail verification for self-registered accounts</strong><br/>
<span class="text-danger">It is strongly recommended to enable this option.</span>
</label>
</div>
<div class="form-check mt-3">
<input type="checkbox" class="form-check-input" id="recaptcha-enabled-registration" name="recaptcha_enabled_registration" @if (old('recaptcha_enabled_registration', UserConfig::get('recaptcha_enabled_registration')))checked="checked"@endif>
<label class="form-check-label" for="recaptcha-enabled-registration">
<strong>Enable <a href="https://www.google.com/recaptcha" target="_blank">reCAPTCHA</a> for self-registrations</strong><br/>
<span class="text-danger">It is strongly recommended to enable this option.</span>
</label>
</div>
<fieldset style="margin-top: 30px;">
<legend>@lang('admin.settings_recaptcha')</legend>
<div class="form-group">
<label class="form-control-label" for="recaptcha-site-key">Site key:</label>
<input type="text" class="form-control{{ $errors->has('recaptcha_site_key') ? ' is-invalid' : '' }}" id="recaptcha-site-key" name="recaptcha_site_key" value="{{ old('recaptcha_site_key', $config['recaptcha_site_key']) }}">
@if ($errors->has('recaptcha_site_key'))
<div class="invalid-feedback">
<strong>{{ $errors->first('recaptcha_site_key') }}</strong>
</div>
@endif
</div>
<div class="form-group">
<label class="form-control-label" for="recaptcha-secret-key">Secret key:</label>
<input type="text" class="form-control{{ $errors->has('recaptcha_secret_key') ? ' is-invalid' : '' }}" id="recaptcha-secret-key" name="recaptcha_secret_key" value="{{ old('recaptcha_secret_key', $config['recaptcha_secret_key']) }}">
@if ($errors->has('recaptcha_secret_key'))
<div class="invalid-feedback">
<strong>{{ $errors->first('recaptcha_secret_key') }}</strong>
</div>
@endif
</div>
</fieldset>
<fieldset style="margin-top: 20px;">
<legend>@lang('admin.settings_image_protection')</legend>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="restrict-original-download" name="restrict_original_download" @if (old('restrict_original_download', UserConfig::get('restrict_original_download')))checked="checked"@endif>
<label class="form-check-label" for="restrict-original-download">
<strong>@lang('forms.settings_restrict_originals_download')</strong><br/>
@lang('forms.settings_restrict_originals_download_help')
</label>
</div>
<div class="form-check mt-3">
<input type="checkbox" class="form-check-input" id="hotlink-protection" name="hotlink_protection" @if (old('hotlink_protection', UserConfig::get('hotlink_protection')))checked="checked"@endif>
<label class="form-check-label" for="hotlink-protection">
<span class="custom-control-description"><strong>@lang('forms.settings_hotlink_protection')</strong><br/>
@lang('forms.settings_hotlink_protection_help')</span>
</label>
</div>
</fieldset>
</div>
{{-- Analytics --}}
<div role="tabpanel" class="tab-pane" id="analytics-tab">
<div class="alert alert-warning">
<p>@lang('admin.settings.analytics_cookie_warning_1')</p>
<p>@lang('admin.settings.analytics_cookie_warning_2')</p>
<p class="mb-0">
<a href="https://www.cookielaw.org/the-cookie-law/" target="_blank">@lang('admin.settings.analytics_cookie_link_1')</a><br/>
<a href="https://cookieconsent.insites.com/" target="_blank">@lang('admin.settings.analytics_cookie_link_2')</a>
</p>
</div>
<div class="form-check mt-4">
<input type="checkbox" class="form-check-input" id="enable-visitor-hits" name="enable_visitor_hits" @if (old('enable_visitor_hits', UserConfig::get('enable_visitor_hits')))checked="checked"@endif>
<label class="form-check-label" for="enable-visitor-hits">
<strong>@lang('admin.settings.analytics_enable_visitor_hits')</strong><br/>
@lang('admin.settings.analytics_enable_visitor_hits_description')
</label>
</div>
<hr/>
<fieldset>
<legend>@lang('admin.visitor_analytics_heading')</legend>
<p>@lang('admin.visitor_analytics_p')</p>
<p>@lang('admin.visitor_analytics_p2')</p>
<textarea class="form-control" rows="10" name="analytics_code">{{ old('analytics_code', $config['analytics_code']) }}</textarea>
</fieldset>
</div>
</div>
<div class="pull-right" style="margin-top: 15px;">
<a href="{{ route('admin') }}" class="btn btn-link">@lang('forms.cancel_action')</a>
<button type="submit" class="btn btn-success"><i class="fa fa-fw fa-check"></i> @lang('admin.settings_save_action')</button>
</div>
</div>
</form>
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
$(document).ready(function() {
$('#test-email-button').click(function() {
var data = $('form').serialize();
$('#test-email-status').show();
$.post('{{ route('admin.testMailSettings') }}', data, function(data)
{
$('#test-email-result').removeClass('alert-danger');
$('#test-email-result').removeClass('alert-success');
if (data.is_successful)
{
$('#test-email-result').addClass('alert-success');
$('#test-email-result-summary').html('@lang('admin.settings_test_email_summary_successful')');
}
else
{
$('#test-email-result').addClass('alert-danger');
$('#test-email-result-summary').html('@lang('admin.settings_test_email_summary_failed')');
}
$('#test-email-result-message').html(data.message);
$('#test-email-result').show();
$('#test-email-status').hide();
});
return false;
});
});
</script>
@endpush