@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * @var bool |
26 | 26 | */ |
27 | - public $autoconnect = true; // Sets whether or not exec() will automatically connect() if needed |
|
27 | + public $autoconnect = TRUE; // Sets whether or not exec() will automatically connect() if needed |
|
28 | 28 | /** |
29 | 29 | * @var int |
30 | 30 | */ |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | //echo 'M:'.print_r($matches, TRUE).'<br>'; |
122 | 122 | $match = isset($matches[0]) ? $matches[0] : []; |
123 | 123 | } |
124 | - $pos = !empty($match) ? mb_strpos($this->_response, $match) : false; |
|
124 | + $pos = !empty($match) ? mb_strpos($this->_response, $match) : FALSE; |
|
125 | 125 | //echo ++$i . "POS:".var_export($pos, TRUE).'<br>'; |
126 | 126 | if ($pos !== FALSE) { |
127 | 127 | //echo "$match Matching $pattern @ $pos <br>"; |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | //echo "Connecting to " . $this->_hostname . "<br>"; |
155 | 155 | $this->_ssh = ssh2_connect($this->_hostname, $this->_port); |
156 | 156 | if ($this->_ssh === FALSE) |
157 | - return false; |
|
157 | + return FALSE; |
|
158 | 158 | ssh2_auth_password($this->_ssh, $this->_username, $this->_password); |
159 | 159 | $this->_stream = ssh2_shell($this->_ssh); |
160 | - $this->connected = true; |
|
160 | + $this->connected = TRUE; |
|
161 | 161 | $this->parse_motd_and_prompt(); |
162 | - return true; |
|
162 | + return TRUE; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $this->_motd = mb_substr($this->_motd, 0, -$length); |
175 | 175 | //echo "MOTD:".$this->_motd."<br>"; |
176 | 176 | //echo "Prompt:".$this->_prompt.'<br>'; |
177 | - return true; |
|
177 | + return TRUE; |
|
178 | 178 | sleep(1); |
179 | 179 | $this->_motd = ''; |
180 | 180 | while ($this->_response = fgets($this->_stream)) |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * @return string |
212 | 212 | */ |
213 | 213 | public function exec($cmd) { |
214 | - if ($this->autoconnect === true && $this->connected === FALSE) |
|
214 | + if ($this->autoconnect === TRUE && $this->connected === FALSE) |
|
215 | 215 | $this->connect(); |
216 | 216 | if (mb_substr($cmd, -1) != "\n") { |
217 | 217 | //error_log("Adding NEWLINE Character To SSH2 Command $cmd", __LINE__, __FILE__); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | * |
251 | 251 | */ |
252 | 252 | public function __destruct() { |
253 | - if ($this->connected === true) |
|
253 | + if ($this->connected === TRUE) |
|
254 | 254 | $this->disconnect(); |
255 | 255 | } |
256 | 256 | |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | $result = $this->_ssh->read($this->_prompt); |
751 | 751 | $result = explode("\r\n", $result); |
752 | 752 | if (count($this->_data) == (count($result) - 2)) |
753 | - return true; else |
|
753 | + return TRUE; else |
|
754 | 754 | die('Error: Switch rejected configuration: '.PHP_EOL . $config . "\n"); |
755 | 755 | } |
756 | 756 | |
@@ -760,8 +760,8 @@ discard block |
||
760 | 760 | public function write_config() { |
761 | 761 | $this->exec('write'); |
762 | 762 | if (mb_strpos($this->_data, '[OK]') !== FALSE) |
763 | - return true; else |
|
764 | - return false; |
|
763 | + return TRUE; else |
|
764 | + return FALSE; |
|
765 | 765 | } |
766 | 766 | } |
767 | 767 |