diff --git a/config/apache/standardebooks.org.conf b/config/apache/standardebooks.org.conf index 9b5fc08e..4393baa7 100644 --- a/config/apache/standardebooks.org.conf +++ b/config/apache/standardebooks.org.conf @@ -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] diff --git a/config/apache/standardebooks.test.conf b/config/apache/standardebooks.test.conf index b154029e..a8043ec9 100644 --- a/config/apache/standardebooks.test.conf +++ b/config/apache/standardebooks.test.conf @@ -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] diff --git a/lib/Library.php b/lib/Library.php index 58d70975..243a1108 100644 --- a/lib/Library.php +++ b/lib/Library.php @@ -250,7 +250,11 @@ class Library{ /** * @return array */ - 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 diff --git a/www/artists/get.php b/www/artists/get.php new file mode 100644 index 00000000..ace3c19f --- /dev/null +++ b/www/artists/get.php @@ -0,0 +1,22 @@ + 'Artwork by ' . $artworks[0]->Artist->Name, 'artwork' => true]) ?> +
+
+

Artwork by Artist->Name) ?>

+ + + + $artworks]) ?> +
+
+ diff --git a/www/artworks/artist.php b/www/artworks/artist.php deleted file mode 100644 index 01f6a8e4..00000000 --- a/www/artworks/artist.php +++ /dev/null @@ -1,32 +0,0 @@ -Artist->Name; -} -catch(Exceptions\ArtistNotFoundException){ - Template::Emit404(); -} -?> 'Artwork by ' . $artistName, 'artwork' => true]) ?> -
-
-

Artwork by

- - - - $artworks]) ?> -
-
-