diff --git a/phpseclib/Crypt/Random.php b/phpseclib/Crypt/Random.php index 948512da..8532aab5 100644 --- a/phpseclib/Crypt/Random.php +++ b/phpseclib/Crypt/Random.php @@ -21,10 +21,10 @@ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/phpseclib/Net/SCP.php b/phpseclib/Net/SCP.php index 5f9517e1..88180cac 100644 --- a/phpseclib/Net/SCP.php +++ b/phpseclib/Net/SCP.php @@ -161,10 +161,11 @@ class Net_SCP { * @param String $remote_file * @param String $data * @param optional Integer $mode + * @param optional Callable $callback * @return Boolean * @access public */ - function put($remote_file, $data, $mode = NET_SCP_STRING) + function put($remote_file, $data, $mode = NET_SCP_STRING, $callback = null) { if (!isset($this->ssh)) { return false; @@ -213,6 +214,10 @@ class Net_SCP { $temp = $mode & NET_SCP_STRING ? substr($data, $sent, $this->packet_size) : fread($fp, $this->packet_size); $this->_send($temp); $sent+= strlen($temp); + + if (is_callable($callback)) { + $callback($sent); + } } $this->_close(); diff --git a/phpseclib/Net/SFTP/Stream.php b/phpseclib/Net/SFTP/Stream.php index 30cbc86b..4df25c16 100644 --- a/phpseclib/Net/SFTP/Stream.php +++ b/phpseclib/Net/SFTP/Stream.php @@ -169,7 +169,7 @@ class Net_SFTP_Stream { if ($host[0] == '$') { $host = substr($host, 1); global $$host; - if (!is_object($$host) || get_class($$host) != 'Net_sFTP') { + if (!is_object($$host) || get_class($$host) != 'Net_SFTP') { return false; } $this->sftp = $$host;