4 * FusionForge document search engine
6 * Copyright 2010-2011, Franck Villaume - Capgemini
7 * Copyright 2012, Franck Villaume - TrivialDev
8 * http://fusionforge.org
10 * This file is part of FusionForge. FusionForge is free software;
11 * you can redistribute it and/or modify it under the terms of the
12 * GNU General Public License as published by the Free Software
13 * Foundation; either version 2 of the Licence, or (at your option)
16 * FusionForge is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 require dirname(__FILE__).'/../../include/env.inc.php';
28 require_once $gfcommon.'docman/engine/parser_text.inc.php';
31 echo 'Usage : parser_oo.php <filename>'."\n";
36 if (!is_file($fichin))
39 $zip = new ZipArchive;
40 if ($zip->open($fichin) === TRUE) {
41 $output_dir = tempnam(forge_get_config('data_path'), 'tmp');
42 if (file_exists($output_dir))
46 $zip->extractTo($output_dir, array('content.xml'));
52 // transformer le context.xml en fichier txt
53 $regexp_oo = "sed -e 's/<[^>]*>//g;s/</</g;s/>/>/g;s/'/'\"'\"'/g;s/"/\"/g;s/&/\&/g'";
55 $cmd = $regexp_oo.' '.$output_dir.'/content.xml > '.$output_dir.'/content.xml.txt';
57 $res = shell_exec($cmd);
58 echo parser_text($output_dir.'/content.xml.txt');
60 unlink($output_dir.'/content.xml');
61 unlink($output_dir.'/content.xml.txt');
66 // c-file-style: "bsd"