Merge branch 'fronkdev' into 'master'

Upgraded Net_Routeros to dev version

See merge request fronk/thetool!1587
This commit is contained in:
Frank Schubert
2025-07-29 18:15:08 +00:00
2 changed files with 21 additions and 15 deletions

View File

@@ -9,6 +9,6 @@
"phpseclib/phpseclib": "^3.0",
"stomp-php/stomp-php": "^5",
"phpmailer/phpmailer": "^6.9",
"pear2/net_routeros": "*@beta"
"pear2/net_routeros": "dev-develop@dev"
}
}

View File

@@ -1,31 +1,37 @@
<?php
use PEAR2\Net\RouterOS;
use PEAR2\Net\Transmitter\NetworkStream;
require __DIR__."/mfRouteros_Item.php";
class mfRouteros extends mfBaseModel {
class mfRouteros {
private $hostname;
private $port;
private $use_ssl;
private $username;
private $password;
private $ros = false;
protected function init() {
if(defined("MFROS_HOSTNAME")) {
$this->hostname(MFROS_HOSTNAME);
}
if(defined("MFROS_USERNAME")) {
$this->username(MFROS_USERNAME);
}
if(defined("MFROS_PASSWORD")) {
$this->password(MFROS_PASSWORD);
}
public function __construct($hostname, $username, $password, $port = 8729, $use_ssl = true) {
$this->hostname = $hostname;
$this->username = $username;
$this->password = $password;
$this->port = $port;
$this->use_ssl = $use_ssl;
}
private function _connect() {
$this->ros = new RouterOS\Client($this->hostname,$this->username,$this->password,8729,false,3);
$crypto = NetworkStream::CRYPTO_OFF;
if($this->use_ssl) {
$crypto = NetworkStream::CRYPTO_TLS;
}
$this->ros = new RouterOS\Client($this->hostname,$this->username,$this->password,$this->port,false,3, $crypto);
}
public function get($table, $filter = array()) {
if(!$this->ros) $this->_connect();