From 5271a343d75d41446ae64b9caffaadd7c1372ddd Mon Sep 17 00:00:00 2001 From: kevin_fourie Date: Tue, 5 Jun 2007 13:19:30 +0000 Subject: [PATCH] KTS-1784 "trying to upload excel document and this is making KT crash" Fixed. Added range limiting. --- plugins/ktstandard/contents/ExcelIndexer.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/ktstandard/contents/ExcelIndexer.php b/plugins/ktstandard/contents/ExcelIndexer.php index 0d5601c..23ed74a 100644 --- a/plugins/ktstandard/contents/ExcelIndexer.php +++ b/plugins/ktstandard/contents/ExcelIndexer.php @@ -61,16 +61,16 @@ class KTExcelIndexerTrigger extends KTBaseIndexerTrigger { $reader = new Spreadsheet_Excel_Reader(); $reader->setOutputEncoding('UTF-8'); $reader->read($sFilename); - + $t = fopen($sTempFilename, "w"); foreach ($reader->sheets as $aSheet) { - for ($i = 1; $i <= $aSheet['numRows']; $i++) { - for ($j = 1; $j <= $aSheet['numCols']; $j++) { - fwrite($t, $aSheet['cells'][$i][$j] . " "); - } - fwrite($t, "\n"); - } - fwrite($t, "\n\n\n"); + for ($i = 1; $i <= $aSheet['numRows'] && $i <= 1000; $i++) { + for ($j = 1; $j <= $aSheet['numCols'] && $j <= 1000; $j++) { + fwrite($t, $aSheet['cells'][$i][$j] . " "); + } + fwrite($t, "\n"); + } + fwrite($t, "\n\n\n"); } fclose($t); return file_get_contents($sTempFilename); -- libgit2 0.21.4