Skip to content

Commit

Permalink
Merge pull request #354 from FitzwilliamMuseum/issue353-env-missing-i…
Browse files Browse the repository at this point in the history
…mage-key

Change env key. This closes #353
  • Loading branch information
portableant authored May 17, 2022
2 parents 53f1e0b + 30cc3af commit 9180a34
Show file tree
Hide file tree
Showing 88 changed files with 1,063 additions and 993 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,5 @@ SHOPIFY_FITZ_PRINTS_SECRET=
SHOPIFY_FITZ_PRINTS_URL=
SHOPIFY_FITZ_PRINTS_PROTOCOL=
SHOPIFY_FITZ_PRINTS_CATALOGUE='/products/'

MISSING_IMAGE_URL="https://content.fitz.ms/fitz-website/assets/gallery3_roof.jpg?key=exhibition"
11 changes: 10 additions & 1 deletion app/Http/Controllers/aboutusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public function vacancies(): View
}

/**
* Returns a list of vacancies
* Returns a list of archived vacancies
* @param Request $request
* @return View
*/
public function archiveVacancies(Request $request): View
Expand Down Expand Up @@ -153,12 +154,20 @@ public function hockneyTerms(): View
return view('aboutus.hockney', compact('terms'));
}

/**
* @param Request $request
* @return View
*/
public function spoliation(Request $request): View
{
$claims = SpoliationClaims::list($request );
return view('aboutus.spoliation', compact('claims'));
}

/**
* @param string $priref
* @return View
*/
public function spoliationClaim(string $priref): View
{
$claims = SpoliationClaims::find($priref);
Expand Down
61 changes: 32 additions & 29 deletions app/Http/Controllers/exhibitionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ public static function injectLoanImmunity(): array
*/
public function index(): View
{
$pages = Stubs::getLanding('exhibitions');
$current = Exhibitions::list();
$pages = Stubs::getLanding('exhibitions');
$current = Exhibitions::list();
$displays = Exhibitions::list('current', '-ticketed', 'display');
$future = Exhibitions::listFuture();
$archive = Exhibitions::archive('archived', '-exhibition_end_date', 3);
$future = Exhibitions::listFuture();
$archive = Exhibitions::archive('archived', '-exhibition_end_date', 3);
return view('exhibitions.index', compact(
'current', 'pages', 'archive',
'future', 'displays'
Expand Down Expand Up @@ -177,19 +177,21 @@ public function ttnArtist(string $slug): View
*/
public function ttnLabels(): View
{
$one = TtnLabels::listByTheme(1)['data'];
$two = TtnLabels::listByTheme(2)['data'];
$three = TtnLabels::listByTheme(3)['data'];
$four = TtnLabels::listByTheme(4)['data'];
$five = TtnLabels::listByTheme(5)['data'];
$six = TtnLabels::listByTheme(6)['data'];
$seven = TtnLabels::listByTheme(7)['data'];
$eight = TtnLabels::listByTheme(8)['data'];
$nine = TtnLabels::listByTheme(9)['data'];
$ten = TtnLabels::listByTheme(10)['data'];
$sectionOne = TtnLabels::listByTheme(1)['data'];
$sectionTwo = TtnLabels::listByTheme(2)['data'];
$sectionThree = TtnLabels::listByTheme(3)['data'];
$sectionFour = TtnLabels::listByTheme(4)['data'];
$sectionFive = TtnLabels::listByTheme(5)['data'];
$sectionSix = TtnLabels::listByTheme(6)['data'];
$sectionSeven = TtnLabels::listByTheme(7)['data'];
$sectionEight = TtnLabels::listByTheme(8)['data'];
$sectionNine = TtnLabels::listByTheme(9)['data'];
$sectionTen = TtnLabels::listByTheme(10)['data'];
return view('exhibitions.ttn-labels', compact(
'one', 'two', 'three',
'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'
'sectionOne', 'sectionTwo', 'sectionThree',
'sectionFour', 'sectionFive', 'sectionSix',
'sectionSeven', 'sectionEight', 'sectionNine',
'sectionTen'
));
}

Expand Down Expand Up @@ -283,31 +285,31 @@ public function linkedPasts()
foreach ($labels as $label) {
$feature = array(
"type" => "Feature",
"@id" => route('exhibition.ttn.label', $label['slug']),
"@id" => route('exhibition.ttn.label', $label['slug']),
'properties' => array(
'title' => $label['title'] . ' - ' . $label['artist']['display_name'],
'artist' => $label['artist']['display_name'] ?? 'Not known',
'slug' => $label['slug'],
'birth' => trim(preg_replace('/\t+/', '',$label['artist']['place_of_birth'])),
'death' => trim(preg_replace('/\t+/', '',$label['artist']['place_of_death'])),
'birth' => trim(preg_replace('/\t+/', '', $label['artist']['place_of_birth'])),
'death' => trim(preg_replace('/\t+/', '', $label['artist']['place_of_death'])),
'theme' => $label['theme']['theme_name'],
'institution' => $label['institution'],
'media' => $label['media']
),
),
'descriptions' => array(
array(
'value' => $label['artist']['biography']
)
),
'depictions' => array(
array(
'license' => 'cc:by-sa/3.0/',
'thumbnail' => $label ['image']['data']['url'],
'@id' => $label ['image']['data']['url']
'license' => 'cc:by-sa/3.0/',
'thumbnail' => $label ['image']['data']['url'],
'@id' => $label ['image']['data']['url']
)
),
'geometry' => array(
"type" => "Point",
"type" => "Point",
"coordinates" => array(
$label['lng'], $label['lat']
),
Expand Down Expand Up @@ -354,20 +356,20 @@ public function linkedPastsBirths()
foreach ($labels as $label) {
$feature = array(
"type" => "Feature",
"@id" => route('exhibition.ttn.artist', $label['slug']),
"@id" => route('exhibition.ttn.artist', $label['slug']),
'properties' => array(
'title' => $label['display_name'] ?? 'Not known',
'slug' => $label['slug'],
),
'depictions' => array(
array(
array(
'license' => 'cc:by-sa/3.0/',
'thumbnail' => $label['image']['data']['url'] ?? '',
'@id' => $label ['image']['data']['url'] ?? ''
),
),
'geometry' => array(
"type" => "Point",
"type" => "Point",
"coordinates" => array(
$label['birth_lon'], $label['birth_lat']
),
Expand Down Expand Up @@ -413,7 +415,7 @@ public function linkedPastsDeaths()
foreach ($labels as $label) {
$feature = array(
"type" => "Feature",
"@id" => route('exhibition.ttn.artist', $label['slug']),
"@id" => route('exhibition.ttn.artist', $label['slug']),
'properties' => array(
'title' => $label['display_name'] ?? 'Not known',
'slug' => $label['slug']
Expand All @@ -426,7 +428,7 @@ public function linkedPastsDeaths()
),
),
'geometry' => array(
"type" => "Point",
"type" => "Point",
"coordinates" => array(
$label['death_lon'], $label['death_lat']
),
Expand All @@ -438,6 +440,7 @@ public function linkedPastsDeaths()
}
return response()->json($geoJson);
}

/**
* @return View
*/
Expand Down
92 changes: 60 additions & 32 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,57 @@

namespace App\Http;

use App\Http\Middleware\Authenticate;
use App\Http\Middleware\CheckForMaintenanceMode;
use App\Http\Middleware\EncryptCookies;
use App\Http\Middleware\RedirectIfAuthenticated;
use App\Http\Middleware\SecureHeaders;
use App\Http\Middleware\SecureHeadersMiddleware;
use App\Http\Middleware\TrimStrings;
use App\Http\Middleware\VerifyCsrfToken;
use App\Http\Middleware\XFrameHeadersMiddleware;
use App\Http\Middleware\XssClean;
use Fruitcake\Cors\HandleCors;
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
use Illuminate\Auth\Middleware\Authorize;
use Illuminate\Auth\Middleware\EnsureEmailIsVerified;
use Illuminate\Auth\Middleware\RequirePassword;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull;
use Illuminate\Foundation\Http\Middleware\ValidatePostSize;
use Illuminate\Http\Middleware\SetCacheHeaders;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Routing\Middleware\ThrottleRequests;
use Illuminate\Routing\Middleware\ValidateSignature;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
use Spatie\GoogleTagManager\GoogleTagManagerMiddleware;
use Spatie\MissingPageRedirector\RedirectsMissingPages;
use Spatie\ResponseCache\Middlewares\CacheResponse;
use Spatie\ResponseCache\Middlewares\DoNotCacheResponse;

class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
* Middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\SecureHeaders::class,
\Spatie\MissingPageRedirector\RedirectsMissingPages::class,
\App\Http\Middleware\XssClean::class, //Add Middleware XSS
\Spatie\GoogleTagManager\GoogleTagManagerMiddleware::class,
\App\Http\Middleware\XFrameHeadersMiddleware::class,
\App\Http\Middleware\SecureHeadersMiddleware::class,
HandleCors::class,
CheckForMaintenanceMode::class,
ValidatePostSize::class,
TrimStrings::class,
ConvertEmptyStringsToNull::class,
SecureHeaders::class,
RedirectsMissingPages::class,
XssClean::class, //Add Middleware XSS
GoogleTagManagerMiddleware::class,
XFrameHeadersMiddleware::class,
SecureHeadersMiddleware::class,

];

Expand All @@ -35,40 +63,40 @@ class Kernel extends HttpKernel
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\Spatie\ResponseCache\Middlewares\CacheResponse::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
CacheResponse::class,
],

'api' => [
'throttle:60,1',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
SubstituteBindings::class,
],
];

/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
* Middleware may be assigned to a group(2) or used individually.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'doNotCacheResponse' => \Spatie\ResponseCache\Middlewares\DoNotCacheResponse::class,
'auth' => Authenticate::class,
'auth.basic' => AuthenticateWithBasicAuth::class,
'bindings' => SubstituteBindings::class,
'cache.headers' => SetCacheHeaders::class,
'can' => Authorize::class,
'guest' => RedirectIfAuthenticated::class,
'password.confirm' => RequirePassword::class,
'signed' => ValidateSignature::class,
'throttle' => ThrottleRequests::class,
'verified' => EnsureEmailIsVerified::class,
'doNotCacheResponse' => DoNotCacheResponse::class,
];
}
1 change: 1 addition & 0 deletions app/Models/AssociatedPeople.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class AssociatedPeople extends Model
{
/**
* @param string $filters
* @return array
*/
public static function list(string $filters = 'podcastGuest'): array
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Exhibitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public static function loanImmunity(): array
}

/**
* @param int $slug
* @param int $curator
* @return array
*/
public static function findByExternals(int $curator): array
Expand Down
Loading

0 comments on commit 9180a34

Please sign in to comment.