fix false check in comic post

This commit is contained in:
John Bintz 2009-11-18 21:54:43 -05:00
parent cd64f57885
commit e90cd16563
2 changed files with 20 additions and 18 deletions

View File

@ -168,27 +168,29 @@ class ComicPressComicPost {
$normalized_children = $this->normalize_ordering($skip_checks);
$remove_from_list = array();
foreach ($normalized_children as $id => $info) {
if (isset($info['children'])) {
$remove_from_list = array_merge($remove_from_list, array_values($info['children']));
}
}
$attachments_with_children = array();
foreach ($normalized_children as $id => $info) {
if (!in_array($id, $remove_from_list)) {
if ($info['enabled']) {
$attachment = array('default' => $id);
if (is_string($default_type)) { $attachment[$default_type] = $id; }
if (isset($info['children'])) {
$attachment = array_merge($attachment, $info['children']);
$remove_from_list = array_merge($remove_from_list, array_values($info['children']));
if (is_array($normalized_children)) {
$remove_from_list = array();
foreach ($normalized_children as $id => $info) {
if (isset($info['children'])) {
$remove_from_list = array_merge($remove_from_list, array_values($info['children']));
}
}
foreach ($normalized_children as $id => $info) {
if (!in_array($id, $remove_from_list)) {
if ($info['enabled']) {
$attachment = array('default' => $id);
if (is_string($default_type)) { $attachment[$default_type] = $id; }
if (isset($info['children'])) {
$attachment = array_merge($attachment, $info['children']);
$remove_from_list = array_merge($remove_from_list, array_values($info['children']));
}
$attachments_with_children[] = $attachment;
}
$attachments_with_children[] = $attachment;
}
}
}
}
return $attachments_with_children;
}

View File

@ -210,7 +210,7 @@ class ComicPressComicPostTest extends PHPUnit_Framework_TestCase {
array('comic' => 'test-1', 'rss' => 'test-3', 'default' => 'test-1'),
)
),
array(false, array())
);
}