improve escaping

This commit is contained in:
Robin Appelman 2012-12-18 00:37:21 +01:00
commit adf5ec0e6d
3 changed files with 15 additions and 5 deletions

View file

@ -53,7 +53,8 @@ abstract class Command {
*/
public function escapePath($path) {
$path = str_replace('/', '\\', $path);
return '"' . trim(escapeshellarg($path), "'") . '"';
$path = str_replace('"', '^"', $path);
return '"' . $path . '"';
}
/**
@ -61,6 +62,7 @@ abstract class Command {
* @return string
*/
public function escapeLocalPath($path) {
return '"' . trim(escapeshellarg($path), "'") . '"';
$path = str_replace('"', '\"', $path);
return '"' . $path . '"';
}
}

View file

@ -152,7 +152,7 @@ class Share {
* @return array
*/
public function read() {
fgets($this->pipes[1]);//first line is promt
fgets($this->pipes[1]);//first line is prompt
$output = array();
$line = fgets($this->pipes[1]);
while (substr($line, 0, 4) !== 'smb:') { //next prompt functions as delimiter
@ -160,6 +160,5 @@ class Share {
$line = fgets($this->pipes[1]);
}
return $output;
// return explode(PHP_EOL, stream_get_contents($this->pipes[1]));
}
}