mirror of
https://github.com/standardebooks/web.git
synced 2025-07-08 15:50:29 -04:00
Tweak style
This commit is contained in:
parent
93adef171f
commit
e3ea224256
5 changed files with 29 additions and 35 deletions
|
@ -296,7 +296,7 @@ Define webroot /standardebooks.org/web
|
|||
RewriteRule ^/bulk-downloads/([^/\.]+)$ /bulk-downloads/collection.php?class=$1
|
||||
|
||||
# Rewrite rules for cover art
|
||||
RewriteRule ^/artworks/([^\./]+?)$ /artworks/artist.php?artist-url-name=$1 [L]
|
||||
RewriteRule ^/artworks/([^\./]+?)$ /artists/get.php?artist-url-name=$1 [L]
|
||||
|
||||
RewriteCond expr "tolower(%{REQUEST_METHOD}) =~ /^get$/"
|
||||
RewriteRule ^/artworks/([^/\.]+)/([^/\.]+)$ /artworks/get.php?artist-url-name=$1&artwork-url-name=$2 [L]
|
||||
|
|
|
@ -278,7 +278,7 @@ Define webroot /standardebooks.org/web
|
|||
RewriteRule ^/bulk-downloads/([^/\.]+)$ /bulk-downloads/collection.php?class=$1
|
||||
|
||||
# Rewrite rules for cover art
|
||||
RewriteRule ^/artworks/([^\./]+?)$ /artworks/artist.php?artist-url-name=$1 [L]
|
||||
RewriteRule ^/artworks/([^\./]+?)$ /artists/get.php?artist-url-name=$1 [L]
|
||||
|
||||
RewriteCond expr "tolower(%{REQUEST_METHOD}) =~ /^get$/"
|
||||
RewriteRule ^/artworks/([^/\.]+)/([^/\.]+)$ /artworks/get.php?artist-url-name=$1&artwork-url-name=$2 [L]
|
||||
|
|
|
@ -250,7 +250,11 @@ class Library{
|
|||
/**
|
||||
* @return array<Artwork>
|
||||
*/
|
||||
public static function GetArtworksByArtist(string $artistUrlName): array{
|
||||
public static function GetArtworksByArtist(?string $artistUrlName): array{
|
||||
if($artistUrlName === null){
|
||||
throw new Exceptions\ArtistNotFoundException();
|
||||
}
|
||||
|
||||
$artworks = Db::Query('
|
||||
SELECT art.*
|
||||
from Artworks art
|
||||
|
|
22
www/artists/get.php
Normal file
22
www/artists/get.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?
|
||||
try{
|
||||
$artworks = Library::GetArtworksByArtist(HttpInput::Str(GET, 'artist-url-name'));
|
||||
|
||||
if(sizeof($artworks) == 0){
|
||||
throw new Exceptions\ArtistNotFoundException();
|
||||
}
|
||||
}
|
||||
catch(Exceptions\ArtistNotFoundException){
|
||||
Template::Emit404();
|
||||
}
|
||||
?><?= Template::Header(['title' => 'Artwork by ' . $artworks[0]->Artist->Name, 'artwork' => true]) ?>
|
||||
<main class="artworks">
|
||||
<section class="narrow">
|
||||
<h1>Artwork by <?= Formatter::EscapeHtml($artworks[0]->Artist->Name) ?></h1>
|
||||
|
||||
<?= Template::ImageCopyrightNotice() ?>
|
||||
|
||||
<?= Template::ArtworkList(['artworks' => $artworks]) ?>
|
||||
</section>
|
||||
</main>
|
||||
<?= Template::Footer() ?>
|
|
@ -1,32 +0,0 @@
|
|||
<?
|
||||
$artistUrlName = '';
|
||||
|
||||
try{
|
||||
$artistUrlName = trim(HttpInput::Str(GET, 'artist-url-name') ?? '');
|
||||
|
||||
if($artistUrlName == ''){
|
||||
throw new Exceptions\ArtistNotFoundException();
|
||||
}
|
||||
|
||||
$artworks = Library::GetArtworksByArtist($artistUrlName);
|
||||
|
||||
if(sizeof($artworks) == 0){
|
||||
throw new Exceptions\ArtistNotFoundException();
|
||||
}
|
||||
|
||||
$artistName = $artworks[0]->Artist->Name;
|
||||
}
|
||||
catch(Exceptions\ArtistNotFoundException){
|
||||
Template::Emit404();
|
||||
}
|
||||
?><?= Template::Header(['title' => 'Artwork by ' . $artistName, 'artwork' => true]) ?>
|
||||
<main class="artworks">
|
||||
<section class="narrow">
|
||||
<h1>Artwork by <?= Formatter::EscapeHtml($artistName) ?></h1>
|
||||
|
||||
<?= Template::ImageCopyrightNotice() ?>
|
||||
|
||||
<?= Template::ArtworkList(['artworks' => $artworks]) ?>
|
||||
</section>
|
||||
</main>
|
||||
<?= Template::Footer() ?>
|
Loading…
Add table
Add a link
Reference in a new issue