mirror of
https://github.com/standardebooks/web.git
synced 2025-07-13 18:11:52 -04:00
Parse URL when checking for approved museums
This commit is contained in:
parent
60eb118524
commit
57ed9c5c1e
2 changed files with 10 additions and 3 deletions
|
@ -462,11 +462,11 @@ class Artwork extends PropertiesBase{
|
||||||
$parsedUrl = parse_url($url);
|
$parsedUrl = parse_url($url);
|
||||||
}
|
}
|
||||||
catch(Exception){
|
catch(Exception){
|
||||||
throw new InvalidUrlException($url);
|
throw new Exceptions\InvalidUrlException($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_array($parsedUrl)){
|
if(!is_array($parsedUrl)){
|
||||||
throw new InvalidUrlException($url);
|
throw new Exceptions\InvalidUrlException($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(stripos($parsedUrl['host'], 'hathitrust.org') !== false){
|
if(stripos($parsedUrl['host'], 'hathitrust.org') !== false){
|
||||||
|
|
|
@ -9,12 +9,19 @@ class Museum extends PropertiesBase{
|
||||||
throw new Exceptions\MuseumNotFoundException();
|
throw new Exceptions\MuseumNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
$parsedUrl = parse_url($url);
|
||||||
|
}
|
||||||
|
catch(Exception){
|
||||||
|
throw new Exceptions\InvalidUrlException($url);
|
||||||
|
}
|
||||||
|
|
||||||
$result = Db::Query('
|
$result = Db::Query('
|
||||||
SELECT *
|
SELECT *
|
||||||
from Museums
|
from Museums
|
||||||
where ? like concat("%", Domain, "%")
|
where ? like concat("%", Domain, "%")
|
||||||
limit 1;
|
limit 1;
|
||||||
', [$url], 'Museum');
|
', [$parsedUrl['host']], 'Museum');
|
||||||
|
|
||||||
if(sizeof($result) == 0){
|
if(sizeof($result) == 0){
|
||||||
throw new Exceptions\MuseumNotFoundException();
|
throw new Exceptions\MuseumNotFoundException();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue