function transform() { global $default; $iMimeTypeId = $this->oDocument->getMimeTypeId(); $sMimeType = KTMime::getMimeTypeName($iMimeTypeId); $sFileName = $this->oDocument->getFileName(); $aTestTypes = array('application/octet-stream', 'application/zip', 'application/x-zip'); if (in_array($sMimeType, $aTestTypes)) { $sExtension = KTMime::stripAllButExtension($sFileName); $sTable = KTUtil::getTableName('mimetypes'); $sQuery = "SELECT id, mimetypes FROM {$sTable} WHERE LOWER(filetypes) = ?"; $aParams = array($sExtension); $aRow = DBUtil::getOneResult(array($sQuery, $aParams)); if (PEAR::isError($aRow)) { $default->log->debug("ODI: error in query: " . print_r($aRow, true)); return; } if (empty($aRow)) { $default->log->debug("ODI: query returned entry"); return; } $id = $aRow['id']; $mimetype = $aRow['mimetypes']; $default->log->debug("ODI: query returned: " . print_r($aRow, true)); if (in_array($mimetype, $aTestTypes)) { // Haven't changed, really not an OpenDocument file... return; } if ($id) { $this->oDocument->setMimeTypeId($id); $this->oDocument->update(); } } parent::transform(); }
function extract_contents($sFilename, $sTempFilename) { if (!OS_WINDOWS) { putenv('LANG=en_US.UTF-8'); $res = parent::extract_contents($sFilename, $sTempFilename); if (strstr($this->aCommandOutput[0], "encrypted")) { return ""; } if (!empty($res)) { return $res; } } return $this->_fallbackExcelReader($sFilename, $sTempFilename); }
function extract_contents($sFilename, $sTempFilename) { if (OS_WINDOWS) { $this->command = 'c:\\antiword\\antiword.exe'; $this->commandconfig = 'indexer/antiword'; $this->args = array(); } putenv('LANG=en_US.UTF-8'); $sCommand = KTUtil::findCommand($this->commandconfig, $this->command); if (empty($sCommand)) { return false; } if (OS_WINDOWS) { $sDir = dirname(dirname($sCommand)); putenv('HOME=' . $sDir); } return parent::extract_contents($sFilename, $sTempFilename); }