[Fusionforge-commits] r16570 - trunk/src/common/docman/engine

Franck VILLAUME nerville at fusionforge.org
Wed Oct 17 23:25:28 CEST 2012


Author: nerville
Date: 2012-10-17 23:25:27 +0200 (Wed, 17 Oct 2012)
New Revision: 16570

Modified:
   trunk/src/common/docman/engine/parser_doc.php
   trunk/src/common/docman/engine/parser_oo.php
   trunk/src/common/docman/engine/parser_pdf.php
   trunk/src/common/docman/engine/parser_text.inc.php
   trunk/src/common/docman/engine/parser_text.php
Log:
global cleanup

Modified: trunk/src/common/docman/engine/parser_doc.php
===================================================================
--- trunk/src/common/docman/engine/parser_doc.php	2012-10-17 21:24:10 UTC (rev 16569)
+++ trunk/src/common/docman/engine/parser_doc.php	2012-10-17 21:25:27 UTC (rev 16570)
@@ -5,6 +5,7 @@
  *
  * Copyright 2005, Fabio Bertagnin
  * Copyright 2011, Franck Villaume - Capgemini
+ * Copyright 2012, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -28,7 +29,7 @@
 require_once $gfcommon.'docman/engine/parser_text.inc.php';
 
 if ($argc != 2) {
-	echo "Usage : parser_doc.php <filename>\n";
+	echo 'Usage : parser_doc.php <filename>'."\n";
 	exit (1);
 }
 
@@ -36,8 +37,8 @@
 if (!is_file($fichin))
 	exit (1);
 
-$fichout = tempnam(forge_get_config('data_path'), "tmp");
-$cmd = "/usr/bin/antiword -i1 -t $fichin > $fichout";
+$fichout = tempnam(forge_get_config('data_path'), 'tmp');
+$cmd = '/usr/bin/antiword -i1 -t '.$fichin.' > '.$fichout;
 $res = shell_exec($cmd);
 
 echo parser_text($fichout);
@@ -47,5 +48,3 @@
 // mode: php
 // c-file-style: "bsd"
 // End:
-
-?>

Modified: trunk/src/common/docman/engine/parser_oo.php
===================================================================
--- trunk/src/common/docman/engine/parser_oo.php	2012-10-17 21:24:10 UTC (rev 16569)
+++ trunk/src/common/docman/engine/parser_oo.php	2012-10-17 21:25:27 UTC (rev 16570)
@@ -28,7 +28,7 @@
 require_once $gfcommon.'docman/engine/parser_text.inc.php';
 
 if ($argc != 2) {
-	echo "Usage : parser_oo.php <filename>\n";
+	echo 'Usage : parser_oo.php <filename>'."\n";
 	exit(1);
 }
 
@@ -38,7 +38,7 @@
 
 $zip = new ZipArchive;
 if ($zip->open($fichin) === TRUE) {
-	$output_dir = tempnam(forge_get_config('data_path'), "tmp");
+	$output_dir = tempnam(forge_get_config('data_path'), 'tmp');
 	unlink($output_dir);
 	mkdir($output_dir);
 	$zip->extractTo($output_dir, array('content.xml'));
@@ -50,7 +50,7 @@
 // transformer le context.xml en fichier txt
 $regexp_oo = "sed -e 's/<[^>]*>//g;s/</</g;s/>/>/g;s/'/'\"'\"'/g;s/"/\"/g;s/&/\&/g'";
 
-$cmd = $regexp_oo." ".$output_dir."/content.xml > ".$output_dir."/content.xml.txt";
+$cmd = $regexp_oo.' '.$output_dir.'/content.xml > '.$output_dir.'/content.xml.txt';
 
 $res = shell_exec($cmd);
 echo parser_text($output_dir.'/content.xml.txt');
@@ -63,5 +63,3 @@
 // mode: php
 // c-file-style: "bsd"
 // End:
-
-?>

Modified: trunk/src/common/docman/engine/parser_pdf.php
===================================================================
--- trunk/src/common/docman/engine/parser_pdf.php	2012-10-17 21:24:10 UTC (rev 16569)
+++ trunk/src/common/docman/engine/parser_pdf.php	2012-10-17 21:25:27 UTC (rev 16570)
@@ -5,6 +5,7 @@
  *
  * Copyright 2005, Fabio Bertagnin
  * Copyright 2009-2011, Franck Villaume - Capgemini
+ * Copyright 2012, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -29,7 +30,7 @@
 
 
 if ($argc != 2) {
-	echo "Usage : parser_pdf.php <filename>\n";
+	echo 'Usage : parser_pdf.php <filename>'."\n";
 	exit (1);
 }
 
@@ -37,8 +38,8 @@
 if (!is_file($fichin))
 	exit (1);
 
-$fichout = tempnam(forge_get_config('data_path'),"tmp");
-$cmd = "/usr/bin/pdftotext $fichin $fichout";
+$fichout = tempnam(forge_get_config('data_path'),'tmp');
+$cmd = '/usr/bin/pdftotext '.$fichin.' '.$fichout;
 $res = shell_exec($cmd);
 
 echo parser_text($fichout);
@@ -48,5 +49,3 @@
 // mode: php
 // c-file-style: "bsd"
 // End:
-
-?>

Modified: trunk/src/common/docman/engine/parser_text.inc.php
===================================================================
--- trunk/src/common/docman/engine/parser_text.inc.php	2012-10-17 21:24:10 UTC (rev 16569)
+++ trunk/src/common/docman/engine/parser_text.inc.php	2012-10-17 21:25:27 UTC (rev 16570)
@@ -5,6 +5,7 @@
  * Copyright 2005, Fabio Bertagnin
  * Copyright 2011, Franck Villaume - Capgemini
  * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
+ * Copyright 2012, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -27,12 +28,12 @@
 
 function parser_text($fichin) {
 	if (!is_file($fichin))
-		return "";
+		return '';
 
 	if (filesize($fichin) == 0)
-		return "";
+		return '';
 
-	$handle = fopen($fichin, "r");
+	$handle = fopen($fichin, 'r');
 	$buff = fread($handle, filesize($fichin));
 
 	// tout en minuscules
@@ -44,14 +45,14 @@
 
 	// élimination d'éventuels caractères unicode encore présents
 	if (function_exists('mb_convert_encoding')) {
-		$buff = mb_convert_encoding($buff, "ascii");
+		$buff = mb_convert_encoding($buff, 'ascii');
 	}
 
 	// élimination caractères avec accents
 	// et caractères spéciaux
 	$buff = suppression_diacritics($buff);
 	// tous les mots dans un tableau
-	$words = explode(" ", $buff);
+	$words = explode(' ', $buff);
 	// élimination des doublons
 	$words = array_unique($words);
 	// envoi du résultat sur stdout
@@ -60,9 +61,9 @@
 }
 
 function print_list($list) {
-	$rep = "";
+	$rep = '';
 	foreach ($list as $el) {
-		if (strlen($el) > 1) $rep .= "$el ";
+		if (strlen($el) > 1) $rep .= $el.' ';
 	}
 	return $rep;
 }
@@ -78,7 +79,7 @@
 	return ((float)$usec + (float)$sec);
 }
 
-function print_debug ($text) {
+function print_debug($text) {
 	echo "$text <br />\n";
 	ob_flush();
 }

Modified: trunk/src/common/docman/engine/parser_text.php
===================================================================
--- trunk/src/common/docman/engine/parser_text.php	2012-10-17 21:24:10 UTC (rev 16569)
+++ trunk/src/common/docman/engine/parser_text.php	2012-10-17 21:25:27 UTC (rev 16570)
@@ -5,6 +5,7 @@
  *
  * Copyright 2005, Fabio Bertagnin
  * Copyright 2009-2011, Franck Villaume - Capgemini
+ * Copyright 2012, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -28,7 +29,7 @@
 require_once $gfcommon.'docman/engine/parser_text.inc.php';
 
 if ($argc != 2) {
-	echo "Usage : parser_text.php <filename>\n";
+	echo 'Usage : parser_text.php <filename>'."\n";
 	exit(1);
 }
 
@@ -43,5 +44,3 @@
 // mode: php
 // c-file-style: "bsd"
 // End:
-
-?>




More information about the Fusionforge-commits mailing list