diff --git flipping_book/includes/flipping_book.pages.inc flipping_book/includes/flipping_book.pages.inc index f323b24..81bb2b3 100644 --- flipping_book/includes/flipping_book.pages.inc +++ flipping_book/includes/flipping_book.pages.inc @@ -107,6 +107,15 @@ function flipping_book_management_form_submit($form, &$form_state) { try { $zip->extractTo(drupal_realpath($destination) . '/'); + // Attempt to find index.html + $iti = new RecursiveDirectoryIterator(drupal_realpath($destination) . '/'); + foreach(new RecursiveIteratorIterator($iti) as $file){ + if(strpos($file , 'index.html') !== false){ + $destination = str_replace('index.html', '', $file); + $destination = str_replace(drupal_realpath(flipping_book_dir()) . '/', '', $destination); + } + } + $record = array( 'title' => $title, 'dir' => str_replace(flipping_book_dir() . '/', '', $destination),