Skip to content

Commit

Permalink
Merge pull request #564 from koter84/nzb-merge-fix
Browse files Browse the repository at this point in the history
fix for when there are no meta headers
  • Loading branch information
Sweepr committed Jul 17, 2020
2 parents 0d8a9c6 + 7d9440c commit bea93a1
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions lib/services/NzbHandler/Services_NzbHandler_abs.php
Expand Up @@ -230,18 +230,21 @@ protected function mergeNzbList($nzbList)
$oneNzbFile = simplexml_load_string($nzb['nzb']);

// go through all the head -> meta elements
foreach ($oneNzbFile->head->meta as $meta) {
// check for password type
if ($meta['type'] == 'password') {
// create a meta element with the password as value
$domMeta = $dom->createElement('meta', ''.$meta[0]);
// create attribute: type=password
$domAttribute = $dom->createAttribute('type');
$domAttribute->value = 'password';
// append attribute to meta-element
$domMeta->appendChild($domAttribute);
// append meta-element to head
$domHead->appendChild($domMeta);
if (is_object($oneNzbFile->head->meta))
{
foreach ($oneNzbFile->head->meta as $meta) {
// check for password type
if ($meta['type'] == 'password') {
// create a meta element with the password as value
$domMeta = $dom->createElement('meta', ''.$meta[0]);
// create attribute: type=password
$domAttribute = $dom->createAttribute('type');
$domAttribute->value = 'password';
// append attribute to meta-element
$domMeta->appendChild($domAttribute);
// append meta-element to head
$domHead->appendChild($domMeta);
}
}
}
}
Expand Down

0 comments on commit bea93a1

Please sign in to comment.