mirror of
https://github.com/standardebooks/web.git
synced 2025-07-23 07:44:49 -04:00
Fix permissions on OPDS feeds
This commit is contained in:
parent
6252cff1e5
commit
ffa3ab8a74
3 changed files with 20 additions and 11 deletions
|
@ -20,17 +20,23 @@ class OpdsFeed{
|
|||
}
|
||||
|
||||
private function Sha1Entries(string $xmlString): string{
|
||||
$xml = new SimpleXMLElement(str_replace('xmlns=', 'ns=', $xmlString));
|
||||
$xml->registerXPathNamespace('dc', 'http://purl.org/dc/elements/1.1/');
|
||||
$xml->registerXPathNamespace('schema', 'http://schema.org/');
|
||||
$entries = $xml->xpath('/feed/entry') ?? [];
|
||||
try{
|
||||
$xml = new SimpleXMLElement(str_replace('xmlns=', 'ns=', $xmlString));
|
||||
$xml->registerXPathNamespace('dc', 'http://purl.org/dc/elements/1.1/');
|
||||
$xml->registerXPathNamespace('schema', 'http://schema.org/');
|
||||
$entries = $xml->xpath('/feed/entry') ?? [];
|
||||
|
||||
$output = '';
|
||||
foreach($entries as $entry){
|
||||
$output .= $entry->asXml();
|
||||
$output = '';
|
||||
foreach($entries as $entry){
|
||||
$output .= $entry->asXml();
|
||||
}
|
||||
|
||||
return sha1(preg_replace('/\s/ius', '', $output));
|
||||
}
|
||||
catch(Exception $ex){
|
||||
// Invalid XML
|
||||
return '';
|
||||
}
|
||||
|
||||
return sha1(preg_replace('/\s/ius', '', $output));
|
||||
}
|
||||
|
||||
public function Save(string $filename): void{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue