inputEnc); // // However, htmlentities is very limited in it's ability to process // character encodings. We have to rely on something more powerful. if (version_compare(phpversion(), "4.1.0", "<")) { // In this case, we can't do any better than assume that the // input encoding is ISO-8859-1. $str = htmlentities($str, ENT_COMPAT); } else { $str = toOutputEncoding($str, $rep->getContentEncoding()); // $str is now encoded as UTF-8. $str = htmlentities($str, ENT_COMPAT, $config->outputEnc); } return $str; } // }}} // {{{ toOutputEncoding function toOutputEncoding($str, $inputEncoding = "") { global $config; if (empty($inputEncoding)) { $inputEncoding = $config->inputEnc; } // Try to convert the messages based on the locale information if ($config->inputEnc && $config->outputEnc) { if (function_exists("iconv")) { $output = @iconv($inputEncoding, $config->outputEnc, $str); if (!empty($output)) { $str = $output; } } } return $str; } // }}} // {{{ quoteCommand function quoteCommand($cmd) { global $config; // On Windows machines, the whole line needs quotes round it so that it's // passed to cmd.exe correctly if ($config->serverIsWindows) { $cmd = "\"$cmd\""; } return $cmd; } // }}} // {{{ execCommand function execCommand($cmd, &$retcode) { global $config; // On Windows machines, the whole line needs quotes round it so that it's // passed to cmd.exe correctly // Since php 5.3.0 the quoting seems to be done internally if ($config->serverIsWindows && version_compare(PHP_VERSION, '5.3.0alpha') === -1) { $cmd = "\"$cmd\""; } return @exec($cmd, $tmp, $retcode); } // }}} // {{{ popenCommand function popenCommand($cmd, $mode) { global $config; // On Windows machines, the whole line needs quotes round it so that it's // passed to cmd.exe correctly // Since php 5.3.0 the quoting seems to be done internally if ($config->serverIsWindows && version_compare(PHP_VERSION, '5.3.0alpha') === -1) { $cmd = "\"$cmd\""; } return popen($cmd, $mode); } // }}} // {{{ passthruCommand function passthruCommand($cmd) { global $config; // On Windows machines, the whole line needs quotes round it so that it's // passed to cmd.exe correctly // Since php 5.3.0 the quoting seems to be done internally if ($config->serverIsWindows && version_compare(PHP_VERSION, '5.3.0alpha') === -1) { $cmd = "\"$cmd\""; } return passthru($cmd); } // }}} // {{{ runCommand function runCommand($cmd, $mayReturnNothing = false) { global $lang; $output = array(); $err = false; $c = quoteCommand($cmd); $descriptorspec = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')); $resource = proc_open($c, $descriptorspec, $pipes); $error = ""; if (!is_resource($resource)) { echo"

".$lang['BADCMD'].": ".$cmd."

"; exit; } $handle = $pipes[1]; $firstline = true; while (!feof($handle)) { $line = fgets($handle); if ($firstline && empty($line) && !$mayReturnNothing) { $err = true; } $firstline = false; $output[] = toOutputEncoding(rtrim($line)); } while (!feof($pipes[2])) { $error .= fgets($pipes[2]); } $error = toOutputEncoding(trim($error)); fclose($pipes[0]); fclose($pipes[1]); fclose($pipes[2]); proc_close($resource); if (!$err) { return $output; } else { echo"

".$lang['BADCMD'].": ".$cmd."

".nl2br($error)."

"; } } // }}} // {{{ quote // // Quote a string to send to the command line function quote($str) { global $config; if ($config->serverIsWindows) { return "\"$str\""; } else { return escapeshellarg($str); } } // }}} WebSVN - websvn - Blame - Rev 5 - /include/command.php
  jablonka.czprosek.czf

websvn

Subversion Repositories:
[/] [include/] [command.php] - Blame information for rev 5

 

Line No. Rev Author Line

Powered by WebSVN 2.2.1