| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Excel 2007-2019/Office 365 Reader class |
| 4 | 4 | * |
| 5 | - * Based on SimpleXLSX v1.1.16 by Sergey Shuchkin. | |
| 5 | + * Based on SimpleXLSX v1.1.19 by Sergey Shuchkin. | |
| 6 | 6 | * @link https://github.com/shuchkin/simplexlsx/ |
| 7 | 7 | * |
| 8 | 8 | * @package TablePress |
| 9 | 9 | * @subpackage Import |
| @@ -230,18 +230,37 @@ | ||
| 230 | 230 | $mF = $aP['EFL']; |
| 231 | 231 | |
| 232 | 232 | // Special case : value block after the compressed data |
| 233 | 233 | if ($aP['GPF'] & 0x0008) { |
| 234 | - $aP1 = unpack('V1CRC/V1CS/V1UCS', self::substr($vZ, -12)); | |
| 234 | + // Signed ZIP64 descriptor: | |
| 235 | + // signature + CRC32 + 64-bit compressed size + 64-bit uncompressed size | |
| 236 | + if (self::substr($vZ, -24, 4) === "\x50\x4b\x07\x08") { | |
| 237 | + $aP1 = unpack( | |
| 238 | + 'V1CRC/V1CSLow/V1CSHigh/V1UCSLow/V1UCSHigh', | |
| 239 | + self::substr($vZ, -20) | |
| 240 | + ); | |
| 235 | 241 | |
| 236 | - $aP['CRC'] = $aP1['CRC']; | |
| 237 | - $aP['CS'] = $aP1['CS']; | |
| 238 | - $aP['UCS'] = $aP1['UCS']; | |
| 239 | - // 2013-08-10 | |
| 240 | - $vZ = self::substr($vZ, 0, -12); | |
| 241 | - if (self::substr($vZ, -4) === "\x50\x4b\x07\x08") { | |
| 242 | - $vZ = self::substr($vZ, 0, -4); | |
| 243 | - } | |
| 242 | + if ((int)$aP1['CSHigh'] !== 0 || (int)$aP1['UCSHigh'] !== 0) { | |
| 243 | + $aI['E'] = 6; | |
| 244 | + $aI['EM'] = 'ZIP64 entry is too large to process.'; | |
| 245 | + } | |
| 246 | + | |
| 247 | + $aP['CRC'] = $aP1['CRC']; | |
| 248 | + $aP['CS'] = $aP1['CSLow']; | |
| 249 | + $aP['UCS'] = $aP1['UCSLow']; | |
| 250 | + $vZ = self::substr($vZ, 0, -24); | |
| 251 | + } else { | |
| 252 | + $aP1 = unpack('V1CRC/V1CS/V1UCS', self::substr($vZ, -12)); | |
| 253 | + | |
| 254 | + $aP['CRC'] = $aP1['CRC']; | |
| 255 | + $aP['CS'] = $aP1['CS']; | |
| 256 | + $aP['UCS'] = $aP1['UCS']; | |
| 257 | + // 2013-08-10 | |
| 258 | + $vZ = self::substr($vZ, 0, -12); | |
| 259 | + if (self::substr($vZ, -4) === "\x50\x4b\x07\x08") { | |
| 260 | + $vZ = self::substr($vZ, 0, -4); | |
| 261 | + } | |
| 262 | + } | |
| 244 | 263 | } |
| 245 | 264 | |
| 246 | 265 | // Getting stored filename |
| 247 | 266 | $aI['N'] = self::substr($vZ, 26, $nF); |
| @@ -914,10 +933,12 @@ | ||
| 914 | 933 | |
| 915 | 934 | if ($x === 0 && $c['height']) { |
| 916 | 935 | $css .= 'height: '.round($c['height'] * 1.3333).'px;'; |
| 917 | 936 | } |
| 937 | + $v = htmlspecialchars($c['value'], ENT_QUOTES); | |
| 938 | + $v = preg_replace('/\R/', "<br>\r\n", $v); | |
| 918 | 939 | $s .= '<'.$tag.' style="'.$css.'" nowrap>' |
| 919 | - . ($c['value'] === '' ? ' ' : htmlspecialchars($c['value'], ENT_QUOTES)) . '</'.$tag.'>'; | |
| 940 | + . ($v === '' ? ' ' : $v) . '</'.$tag.'>'; | |
| 920 | 941 | $x++; |
| 921 | 942 | } |
| 922 | 943 | $s .= "</tr>\r\n"; |
| 923 | 944 | $y++; |