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

334 lines
22 KiB
PHP
Raw Normal View History

@extends('themes.base.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{{ $errors->has('app_name') ? ' has-danger' : '' }}">
<label class="form-control-label" for="gallery-name">Gallery name:</label>
<input type="text" class="form-control" id="gallery-name" name="app_name" value="{{ old('app_name', $config['app_name']) }}">
@if ($errors->has('app_name'))
<div class="form-control-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="form-control-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="form-control-feedback">
<strong>{{ $errors->first('theme') }}</strong>
</div>
@endif
</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="form-check" style="margin-top: 20px;">
<label class="form-check-label">
<input class="form-check-input" type="checkbox" name="remove_copyright" @if (old('remove_copyright', 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 --}}
<div role="tabpanel" class="tab-pane" id="email-tab">
<div class="form-group{{ $errors->has('sender_name') ? ' has-danger' : '' }}">
<label class="form-control-label" for="email-sender-name">Sender name:</label>
<input type="text" class="form-control" id="email-sender-name" name="sender_name" value="{{ old('sender_name', $config['sender_name']) }}">
@if ($errors->has('sender_name'))
<div class="form-control-feedback">
<strong>{{ $errors->first('sender_name') }}</strong>
</div>
@endif
</div>
<div class="form-group{{ $errors->has('sender_address') ? ' has-danger' : '' }}">
<label class="form-control-label" for="email-sender-address">Sender address:</label>
<input type="text" class="form-control" id="email-sender-address" name="sender_address" value="{{ old('sender_address', $config['sender_address']) }}">
@if ($errors->has('sender_address'))
<div class="form-control-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{{ $errors->has('smtp_server') ? ' has-danger' : '' }}">
<label class="form-control-label" for="email-smtp-server">Hostname:</label>
<input type="text" class="form-control" id="email-smtp-server" name="smtp_server" value="{{ old('smtp_server', $config['smtp_server']) }}">
@if ($errors->has('smtp_server'))
<div class="form-control-feedback">
<strong>{{ $errors->first('smtp_server') }}</strong>
</div>
@endif
</div>
<div class="form-group{{ $errors->has('smtp_port') ? ' has-danger' : '' }}">
<label class="form-control-label" for="email-smtp-port">Port:</label>
<input type="text" class="form-control" id="email-smtp-port" name="smtp_port" value="{{ old('smtp_port', $config['smtp_port']) }}">
@if ($errors->has('smtp_port'))
<div class="form-control-feedback">
<strong>{{ $errors->first('smtp_port') }}</strong>
</div>
@endif
</div>
<div class="form-group{{ $errors->has('smtp_username') ? ' has-danger' : '' }}">
<label class="form-control-label" for="email-smtp-username">Username:</label>
<input type="text" class="form-control" id="email-smtp-username" name="smtp_username" value="{{ old('smtp_username', $config['smtp_username']) }}">
@if ($errors->has('smtp_username'))
<div class="form-control-feedback">
<strong>{{ $errors->first('smtp_username') }}</strong>
</div>
@endif
</div>
<div class="form-group{{ $errors->has('smtp_password') ? ' has-danger' : '' }}">
<label class="form-control-label" for="email-smtp-password">Password:</label>
<input type="text" class="form-control" id="email-smtp-password" name="smtp_password" value="{{ old('smtp_password', $config['smtp_password']) }}">
@if ($errors->has('smtp_password'))
<div class="form-control-feedback">
<strong>{{ $errors->first('smtp_password') }}</strong>
</div>
@endif
</div>
<div class="form-check">
<label class="form-check-label">
<input class="form-check-input" type="checkbox" name="smtp_encryption" @if (UserConfig::get('smtp_encryption'))checked="checked"@endif>
<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="checkbox">
<label>
<input type="checkbox" name="allow_self_registration" @if (old('allow_self_registration', UserConfig::get('allow_self_registration')))checked="checked"@endif>
<strong>@lang('admin.settings.security_allow_self_registration')</strong><br/>
@lang('admin.settings.security_allow_self_registration_description')
</label>
</div>
<div class="checkbox" style="margin-top: 20px;">
<label>
<input type="checkbox" name="require_email_verification" @if (old('require_email_verification', UserConfig::get('require_email_verification')))checked="checked"@endif>
<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="checkbox" style="margin-top: 20px;">
<label>
<input type="checkbox" name="recaptcha_enabled_registration" @if (old('recaptcha_enabled_registration', UserConfig::get('recaptcha_enabled_registration')))checked="checked"@endif>
<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{{ $errors->has('recaptcha_site_key') ? ' has-danger' : '' }}">
<label class="form-control-label" for="recaptcha-site-key">Site key:</label>
<input type="text" class="form-control" 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="form-control-feedback">
<strong>{{ $errors->first('recaptcha_site_key') }}</strong>
</div>
@endif
</div>
<div class="form-group{{ $errors->has('recaptcha_secret_key') ? ' has-danger' : '' }}">
<label class="form-control-label" for="recaptcha-secret-key">Secret key:</label>
<input type="text" class="form-control" 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="form-control-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="checkbox">
<label>
<input type="checkbox" name="restrict_original_download" @if (old('restrict_original_download', UserConfig::get('restrict_original_download')))checked="checked"@endif>
<strong>@lang('forms.settings_restrict_originals_download')</strong><br/>
@lang('forms.settings_restrict_originals_download_help')
</label>
</div>
<div class="checkbox" style="margin-top: 20px;">
<label>
<input type="checkbox" name="hotlink_protection" @if (old('hotlink_protection', UserConfig::get('hotlink_protection')))checked="checked"@endif>
<strong>@lang('forms.settings_hotlink_protection')</strong><br/>
@lang('forms.settings_hotlink_protection_help')
</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="checkbox mt-4">
<label>
<input type="checkbox" name="enable_visitor_hits" @if (old('enable_visitor_hits', UserConfig::get('enable_visitor_hits')))checked="checked"@endif>
<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