Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
smb.php with Windows OS
Browse files Browse the repository at this point in the history
  • Loading branch information
Nanomani committed Apr 1, 2014
1 parent aa2f79f commit f77a9e5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions core/src/plugins/access.smb/smb.php
Expand Up @@ -196,7 +196,12 @@ public function client ($params, $purl)
$process = proc_open($cmd, $descriptorspec, $pipes, null, $env);
if (is_resource($process)) {
fclose($pipes[0]);
$error = stream_get_contents($pipes[2]);
if (PHP_OS == "WIN32" || PHP_OS == "WINNT" || PHP_OS == "Windows") {
$error = stream_get_contents($pipes[2], 524);
} else {
$error = stream_get_contents($pipes[2]);
}

fclose($pipes[2]);
if ($error != "") {
$error = strtolower($error);
Expand All @@ -216,6 +221,11 @@ public function client ($params, $purl)
if (isset($output) && is_resource($output)) {

while ($line = fgets ($output, 4096)) {

if (PHP_OS == "WIN32" || PHP_OS == "WINNT" || PHP_OS == "Windows") {
$line = SystemTextEncoding::fromUTF8($line);
}

list ($tag, $regs, $i) = array ('skip', array (), array ());
reset ($regexp);
foreach ($regexp as $r => $t) if (preg_match ('/'.$r.'/', $line, $regs)) {
Expand Down Expand Up @@ -354,7 +364,7 @@ public function url_stat ($url, $flags = STREAM_URL_STAT_LINK)
return null;
}
$p = explode ("\\", $pu['path']);
$name = SystemTextEncoding::toUTF8($p[count($p)-1]);
$name = $p[count($p)-1];
if (isset ($o['info'][$name])) {
$stat = smb::addstatcache ($url, $o['info'][$name]);
} else {
Expand Down

0 comments on commit f77a9e5

Please sign in to comment.