From b3171cc63f44c715a2b29200d9549d866e94d123 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Mon, 11 Apr 2016 19:30:45 -0500 Subject: [PATCH] SFTP: fix logging constants --- phpseclib/Net/SFTP.php | 14 +++++++------- phpseclib/Net/SSH2.php | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index 0c568e53..a1e561af 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -2705,13 +2705,13 @@ class SFTP extends SSH2 if (defined('NET_SFTP_LOGGING')) { $packet_type = '-> ' . $this->packet_types[$type] . ' (' . round($stop - $start, 4) . 's)'; - if (NET_SFTP_LOGGING == NET_SFTP_LOG_REALTIME) { + if (NET_SFTP_LOGGING == self::LOG_REALTIME) { echo "
\r\n" . $this->_format_log(array($data), array($packet_type)) . "\r\n
\r\n"; flush(); ob_flush(); } else { $this->packet_type_log[] = $packet_type; - if (NET_SFTP_LOGGING == NET_SFTP_LOG_COMPLEX) { + if (NET_SFTP_LOGGING == self::LOG_COMPLEX) { $this->packet_log[] = $data; } } @@ -2781,13 +2781,13 @@ class SFTP extends SSH2 if (defined('NET_SFTP_LOGGING')) { $packet_type = '<- ' . $this->packet_types[$this->packet_type] . ' (' . round($stop - $start, 4) . 's)'; - if (NET_SFTP_LOGGING == NET_SFTP_LOG_REALTIME) { + if (NET_SFTP_LOGGING == self::LOG_REALTIME) { echo "
\r\n" . $this->_format_log(array($packet), array($packet_type)) . "\r\n
\r\n"; flush(); ob_flush(); } else { $this->packet_type_log[] = $packet_type; - if (NET_SFTP_LOGGING == NET_SFTP_LOG_COMPLEX) { + if (NET_SFTP_LOGGING == self::LOG_COMPLEX) { $this->packet_log[] = $packet; } } @@ -2799,7 +2799,7 @@ class SFTP extends SSH2 /** * Returns a log of the packets that have been sent and received. * - * Returns a string if NET_SFTP_LOGGING == NET_SFTP_LOG_COMPLEX, an array if NET_SFTP_LOGGING == NET_SFTP_LOG_SIMPLE and false if !defined('NET_SFTP_LOGGING') + * Returns a string if NET_SFTP_LOGGING == self::LOG_COMPLEX, an array if NET_SFTP_LOGGING == self::LOG_SIMPLE and false if !defined('NET_SFTP_LOGGING') * * @access public * @return string or Array @@ -2811,10 +2811,10 @@ class SFTP extends SSH2 } switch (NET_SFTP_LOGGING) { - case NET_SFTP_LOG_COMPLEX: + case self::LOG_COMPLEX: return $this->_format_log($this->packet_log, $this->packet_type_log); break; - //case NET_SFTP_LOG_SIMPLE: + //case self::LOG_SIMPLE: default: return $this->packet_type_log; } diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 7111b860..83cc68dc 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -3488,14 +3488,14 @@ class SSH2 @flush(); @ob_flush(); break; - // basically the same thing as self::LOG_REALTIME with the caveat that self::LOG_REALTIME_FILE + // basically the same thing as self::LOG_REALTIME with the caveat that NET_SFTP_LOG_REALTIME_FILENAME // needs to be defined and that the resultant log file will be capped out at self::LOG_MAX_SIZE. // the earliest part of the log file is denoted by the first <<< START >>> and is not going to necessarily // at the beginning of the file case self::LOG_REALTIME_FILE: if (!isset($this->realtime_log_file)) { // PHP doesn't seem to like using constants in fopen() - $filename = self::LOG_REALTIME_FILENAME; + $filename = NET_SSH2_LOG_REALTIME_FILENAME; $fp = fopen($filename, 'w'); $this->realtime_log_file = $fp; }