26
26
if (false === $first_zip_entry) {
27
27
$error_message = $GLOBALS['strNoFilesFoundInZip'];
29
zip_entry_open($zip_handle, $first_zip_entry, 'r');
30
$file_data = zip_entry_read($first_zip_entry, zip_entry_filesize($first_zip_entry));
31
zip_entry_close($first_zip_entry);
29
/* Is the the zip really an ODS file? */
30
$read = zip_entry_read($first_zip_entry);
31
$ods_mime = 'application/vnd.oasis.opendocument.spreadsheet';
32
if (!strcmp($ods_mime, $read)) {
33
/* Return the correct contents, not just the first entry */
35
$entry = zip_read($zip_handle);
36
if (is_resource($entry)) {
37
if (!strcmp('content.xml', zip_entry_name($entry))) {
38
zip_entry_open($zip_handle, $entry, 'r');
39
$file_data = zip_entry_read($entry, zip_entry_filesize($entry));
40
zip_entry_close($entry);
45
* Either we have reached the end of the zip and still
46
* haven't found 'content.xml' or there was a parsing
47
* error that we must display
49
if ($entry === FALSE) {
50
$error_message = $GLOBALS['strErrorInZipFile'] . ' Could not find "content.xml"';
52
$error_message = $GLOBALS['strErrorInZipFile'] . ' ' . PMA_getZipError($zip_handle);
59
zip_entry_open($zip_handle, $first_zip_entry, 'r');
60
/* File pointer has already been moved, so include what was read above */
62
$file_data .= zip_entry_read($first_zip_entry, zip_entry_filesize($first_zip_entry));
63
zip_entry_close($first_zip_entry);
34
67
$error_message = $GLOBALS['strErrorInZipFile'] . ' ' . PMA_getZipError($zip_handle);