mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-27 03:42:40 +00:00
SFTP/Stream: use $scheme instead of 'sftp'
This makes it easier for someone to change the scheme (which can be done by changng the stream_wrapper_register call at the bottom of the file)
This commit is contained in:
parent
aa5f9b77ec
commit
3dd92e56e4
@ -180,24 +180,24 @@ class Net_SFTP_Stream
|
|||||||
if (isset($this->context)) {
|
if (isset($this->context)) {
|
||||||
$context = stream_context_get_options($this->context);
|
$context = stream_context_get_options($this->context);
|
||||||
}
|
}
|
||||||
if (isset($context['sftp']['session'])) {
|
if (isset($context[$scheme]['session'])) {
|
||||||
$sftp = $context['sftp']['session'];
|
$sftp = $context[$scheme]['session'];
|
||||||
}
|
}
|
||||||
if (isset($context['sftp']['sftp'])) {
|
if (isset($context[$scheme]['sftp'])) {
|
||||||
$sftp = $context['sftp']['sftp'];
|
$sftp = $context[$scheme]['sftp'];
|
||||||
}
|
}
|
||||||
if (isset($sftp) && is_object($sftp) && get_class($sftp) == 'Net_SFTP') {
|
if (isset($sftp) && is_object($sftp) && get_class($sftp) == 'Net_SFTP') {
|
||||||
$this->sftp = $sftp;
|
$this->sftp = $sftp;
|
||||||
return $path;
|
return $path;
|
||||||
}
|
}
|
||||||
if (isset($context['sftp']['username'])) {
|
if (isset($context[$scheme]['username'])) {
|
||||||
$user = $context['sftp']['username'];
|
$user = $context[$scheme]['username'];
|
||||||
}
|
}
|
||||||
if (isset($context['sftp']['password'])) {
|
if (isset($context[$scheme]['password'])) {
|
||||||
$pass = $context['sftp']['password'];
|
$pass = $context[$scheme]['password'];
|
||||||
}
|
}
|
||||||
if (isset($context['sftp']['privkey']) && is_object($context['sftp']['privkey']) && get_Class($context['sftp']['privkey']) == 'Crypt_RSA') {
|
if (isset($context[$scheme]['privkey']) && is_object($context[$scheme]['privkey']) && get_Class($context[$scheme]['privkey']) == 'Crypt_RSA') {
|
||||||
$pass = $context['sftp']['privkey'];
|
$pass = $context[$scheme]['privkey'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($user) || !isset($pass)) {
|
if (!isset($user) || !isset($pass)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user