[ Index ] |
|
Code source de Horde 3.1.3 |
1 <?php 2 /** 3 * The MIME_Viewer_deb class renders out lists of files in Debian packages by 4 * using the dpkg tool to query the package. 5 * 6 * $Horde: framework/MIME/MIME/Viewer/deb.php,v 1.11.10.8 2006/01/01 21:28:25 jan Exp $ 7 * 8 * Copyright 1999-2006 Anil Madhavapeddy <anil@recoil.org> 9 * 10 * See the enclosed file COPYING for license information (LGPL). If you 11 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. 12 * 13 * @author Anil Madhavapeddy <anil@recoil.org> 14 * @since Horde 1.3 15 * @package Horde_MIME_Viewer 16 */ 17 class MIME_Viewer_deb extends MIME_Viewer { 18 19 /** 20 * Render the data. 21 * 22 * @param array $params Any parameters the viewer may need. 23 * 24 * @return string The rendered data. 25 */ 26 function render($params = array()) 27 { 28 global $mime_drivers; 29 30 /* Check to make sure the program actually exists. */ 31 if (!file_exists($mime_drivers['horde']['deb']['location'])) { 32 return '<pre>' . sprintf(_("The program used to view this data type (%s) was not found on the system."), $mime_drivers['horde']['deb']['location']) . '</pre>'; 33 } 34 35 $tmp_deb = Horde::getTempFile('horde_deb'); 36 37 $fh = fopen($tmp_deb, 'w'); 38 fwrite($fh, $this->mime_part->getContents()); 39 fclose($fh); 40 41 $fh = popen($mime_drivers['horde']['deb']['location'] . " -f $tmp_deb 2>&1", 'r'); 42 while (($rc = fgets($fh, 8192))) { 43 $data .= $rc; 44 } 45 pclose($fh); 46 47 return '<pre>' . htmlspecialchars($data) . '</pre>'; 48 } 49 50 /** 51 * Return the MIME content type of the rendered content. 52 * 53 * @return string The content type of the output. 54 */ 55 function getType() 56 { 57 return 'text/html; charset=' . NLS::getCharset(); 58 } 59 60 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |