diff --git a/ajax/showcomic.php b/ajax/showcomic.php index fcb4822..47a000f 100644 --- a/ajax/showcomic.php +++ b/ajax/showcomic.php @@ -66,27 +66,24 @@ if ( $extracted ) { $opened = $zip->open($comicfull); for ( $i=0; $i<$zip->numFiles; $i++ ) { $imgname = basename($zip->getNameIndex($i)); - //$myext = substr($imgname, -3); if ( ! isset(pathinfo($imgname)['extension']) ) continue; $myext = strtolower(pathinfo($imgname)['extension']); - if ( in_array($myext, VALIDIMAGETYPES) ) { - $imgname = str_replace("#", "", $imgname); - $imgcontents = $zip->getFromIndex($i); - $written = file_put_contents($comicoutputfull . $imgname, $imgcontents); - if ( $written ) $files[] = $imgname; - } + if ( ! in_array($myext, VALIDIMAGETYPES) ) continue; + $imgname = str_replace("#", "", $imgname); + $imgcontents = $zip->getFromIndex($i); + $written = file_put_contents($comicoutputfull . $imgname, $imgcontents); + if ( $written ) $files[] = $imgname; } } elseif ( $ext == "cbr" ) { $rar = RarArchive::open($comicfull); $entries = $rar->getEntries(); foreach ( $entries as $entry ) { $outfile = str_replace("#", "", basename($entry->getName())); - $entry->extract(false, $comicoutputfull . $outfile); if ( ! isset(pathinfo($outfile)['extension']) ) continue; $myext = strtolower(pathinfo($outfile)['extension']); - if ( in_array($myext, VALIDIMAGETYPES) ) { - $files[] = basename($outfile); - } + if ( ! in_array($myext, VALIDIMAGETYPES) ) continue; + $entry->extract(false, $comicoutputfull . $outfile); + $files[] = basename($outfile); } unset($entry); } else {