[Fusionforge-commits] r8293 - trunk/gforge/common/docman/engine

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Fri Oct 16 17:08:36 CEST 2009


Author: nerville
Date: 2009-10-16 17:08:36 +0200 (Fri, 16 Oct 2009)
New Revision: 8293

Added:
   trunk/gforge/common/docman/engine/parser_doc.php
Modified:
   trunk/gforge/common/docman/engine/parser_list.txt
Log:
add quick parser for msword file

Copied: trunk/gforge/common/docman/engine/parser_doc.php (from rev 8290, trunk/gforge/common/docman/engine/parser_pdf.php)
===================================================================
--- trunk/gforge/common/docman/engine/parser_doc.php	                        (rev 0)
+++ trunk/gforge/common/docman/engine/parser_doc.php	2009-10-16 15:08:36 UTC (rev 8293)
@@ -0,0 +1,55 @@
+#! /usr/bin/php5
+<?php
+/**
+ * FusionForge document search engine
+ *
+ * Copyright 2005, Fabio Bertagnin
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ * 
+ * FusionForge is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+require dirname(__FILE__).'/../../../www/env.inc.php';
+
+require_once $gfcommon.'docman/engine/parser_text.inc.php';
+
+
+if ($argc != 2)
+{
+	echo "Usage : parser_doc.php <filename>\n";
+	exit (1);
+}
+
+$fichin = $argv[1];
+if (!is_file($fichin)) exit (1);
+$fichout = "/tmp/gfo".rand(10000, 99999).".tmp";
+$cmd = "/usr/bin/antiword -i1 -t $fichin - > $fichout";
+$res = shell_exec($cmd);
+
+
+$rep = parser_text($fichout);
+// envoi du résultat sur stdout
+echo "$rep";
+// efface les fichiers témporaires
+unlink ($fichout);
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>

Modified: trunk/gforge/common/docman/engine/parser_list.txt
===================================================================
--- trunk/gforge/common/docman/engine/parser_list.txt	2009-10-16 14:46:00 UTC (rev 8292)
+++ trunk/gforge/common/docman/engine/parser_list.txt	2009-10-16 15:08:36 UTC (rev 8293)
@@ -27,3 +27,4 @@
 application/pdf				parser_pdf.php
 application/vnd.sun.xml.writer		parser_oo.php
 application/vnd.oasis.opendocument.text	parser_oo.php
+application/msword			parser_doc.php




More information about the Fusionforge-commits mailing list