Commit 86233ae3a80b0b1083321105bdcc5ca403598a95

Authored by nbm
1 parent 77efe13c

Add a Microsoft Office (Powerpoint) presentation indexer


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4209 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/ktstandard/contents/PowerpointIndexer.php 0 → 100644
  1 +<?php
  2 +
  3 +class KTPowerpointIndexerTrigger {
  4 + function setDocument($oDocument) {
  5 + $this->oDocument = $oDocument;
  6 + }
  7 +
  8 + function transform() {
  9 + $oStorage = KTStorageManagerUtil::getSingleton();
  10 + $sFile = $oStorage->temporaryFile($this->oDocument);
  11 +
  12 + $cmdline = array("catppt", $sFile);
  13 + $myfilename = tempnam("/tmp", "kt.catppt");
  14 + $command = KTUtil::safeShellString($cmdline) . " >> " . $myfilename;
  15 + system($command);
  16 + $contents = file_get_contents($myfilename);
  17 + unlink($myfilename);
  18 + if (empty($contents)) {
  19 + return;
  20 + }
  21 + $aInsertValues = array(
  22 + 'document_id' => $this->oDocument->getId(),
  23 + 'document_text' => $contents,
  24 + );
  25 + $sTable = KTUtil::getTableName('document_text');
  26 + DBUtil::autoInsert($sTable, $aInsertValues, array('noid' => true));
  27 + }
  28 +}
  29 +
  30 +?>