00001 <?php
00002
00003
00004
00005 function PMA_transformation_text_plain__external_nowrap($options = array()) {
00006 if (!isset($options[3]) || $options[3] == '') {
00007 $nowrap = true;
00008 } elseif ($options[3] == '1' || $options[3] == 1) {
00009 $nowrap = true;
00010 } else {
00011 $nowrap = false;
00012 }
00013
00014 return $nowrap;
00015 }
00016
00017 function PMA_transformation_text_plain__external($buffer, $options = array(), $meta = '') {
00018
00019
00020
00021
00022
00023 $allowed_programs = array();
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 if (count($allowed_programs) == 0) {
00041 return $buffer;
00042 }
00043
00044 if (!isset($options[0]) || $options[0] == '' || !isset($allowed_programs[$options[0]])) {
00045 $program = $allowed_programs[0];
00046 } else {
00047 $program = $allowed_programs[$options[0]];
00048 }
00049
00050 if (!isset($options[1]) || $options[1] == '') {
00051 $poptions = '-f /dev/null -i -wrap -q';
00052 } else {
00053 $poptions = $options[1];
00054 }
00055
00056 if (!isset($options[2]) || $options[2] == '') {
00057 $options[2] = 1;
00058 }
00059
00060 if (!isset($options[3]) || $options[3] == '') {
00061 $options[3] = 1;
00062 }
00063
00064
00065 $newstring = '';
00066 $descriptorspec = array(
00067 0 => array("pipe", "r"),
00068 1 => array("pipe", "w")
00069 );
00070 $process = proc_open($program . ' ' . $poptions, $descriptorspec, $pipes = array());
00071 if (is_resource($process)) {
00072 fwrite($pipes[0], $buffer);
00073 fclose($pipes[0]);
00074
00075 while (!feof($pipes[1])) {
00076 $newstring .= fgets($pipes[1], 1024);
00077 }
00078 fclose($pipes[1]);
00079
00080 $return_value = proc_close($process);
00081 }
00082
00083 if ($options[2] == 1 || $options[2] == '2') {
00084 $retstring = htmlspecialchars($newstring);
00085 } else {
00086 $retstring = $newstring;
00087 }
00088
00089 return $retstring;
00090 }
00091 ?>