public function dir_opendir($url, $options) { $d = $this->getdircache($url); if (is_array($d)) { $this->dir = $d; $this->dir_index = 0; return TRUE; } $url = smb::cleanUrl($url); $pu = smb::parse_url($url); switch ($pu['type']) { case 'host': if ($o = smb::look($pu)) { $this->dir = $o['disk']; //$this->dir = 'test'; $this->dir_index = 0; } else { trigger_error("dir_opendir(): list failed for host '{$pu['host']}'", E_USER_WARNING); } break; case 'share': case 'path': $o = smb::execute('dir "' . $pu['path'] . '\\*"', $pu); if (is_array($o)) { if (isset($o['info'])) { $this->dir = array_keys($o['info']); $this->dir_index = 0; $this->adddircache($url, $this->dir); foreach ($o['info'] as $name => $info) { self::debug("Adding to statcache " . $url . '/' . $name); //smb::addstatcache($url . '/' . urlencode($name), $info); smb::addstatcache($url . '/' . $name, $info); } } else { $this->dir = array(); $this->dir_index = 0; $this->adddircache($url, $this->dir); } } else { trigger_error("dir_opendir(): dir failed for path '{$pu['path']}'", E_USER_WARNING); } break; default: trigger_error('dir_opendir(): error in URL', E_USER_ERROR); } return TRUE; }
function dir_opendir($url, $options) { if ($d = $this->getdircache($url)) { $this->dir = $d; $this->dir_index = 0; return TRUE; } $pu = smb::parse_url($url); switch ($pu['type']) { case 'host': if ($o = smb::look($pu)) { $this->dir = $o['disk']; $this->dir_index = 0; } else { trigger_error("dir_opendir(): list failed for host '{$pu['host']}'", E_USER_WARNING); return false; } break; case 'share': case 'path': if (is_array($o = smb::execute('dir "' . $pu['path'] . '\\*"', $pu))) { $this->dir = array_keys($o['info']); $this->dir_index = 0; $this->adddircache($url, $this->dir); if (substr($url, -1, 1) == '/') { $url = substr($url, 0, -1); } foreach ($o['info'] as $name => $info) { smb::addstatcache($url . '/' . $name, $info); } } else { trigger_error("dir_opendir(): dir failed for path '" . $pu['path'] . "'", E_USER_WARNING); return false; } break; default: trigger_error('dir_opendir(): error in URL', E_USER_ERROR); return false; } return TRUE; }
function dir_opendir($url, $options) { if ($d = $this->getdircache($url)) { $this->dir = $d; $this->dir_index = 0; return TRUE; } $pu = smb::parse_url($url); switch ($pu['type']) { case 'host': if ($o = smb::look($pu)) { $this->dir = $o['disk']; $this->dir_index = 0; } else { error_log("dir_opendir(): list failed for host '{$pu['host']}'", E_USER_WARNING); } break; case 'share': case 'path': if ($o = smb::execute('dir "' . $pu['path'] . '\\*"', $pu)) { $this->dir = array_keys($o['info']); $this->dir_index = 0; $this->adddircache($url, $this->dir); foreach ($o['info'] as $name => $info) { smb::addstatcache($url . '/' . urlencode($name), $info); } } else { error_log("dir_opendir(): dir failed for path '{$path}'", E_USER_WARNING); } break; default: error_log('dir_opendir(): error in URL', E_USER_ERROR); } return TRUE; }