├── README.md ├── config ├── autoload.php └── mikrotik.php ├── libraries ├── mikrotik │ ├── core │ │ ├── mapi_core.php │ │ └── mapi_query.php │ ├── file │ │ └── mapi_file.php │ ├── interface │ │ ├── mapi_interface_bonding.php │ │ ├── mapi_interface_bridge.php │ │ ├── mapi_interface_eoip.php │ │ ├── mapi_interface_ethernet.php │ │ ├── mapi_interface_ipip.php │ │ ├── mapi_interface_l2tp_client.php │ │ ├── mapi_interface_l2tp_server.php │ │ ├── mapi_interface_ppp_client.php │ │ ├── mapi_interface_ppp_server.php │ │ ├── mapi_interface_pppoe_client.php │ │ ├── mapi_interface_pppoe_server.php │ │ ├── mapi_interface_pptp_client.php │ │ ├── mapi_interface_pptp_server.php │ │ ├── mapi_interface_vlan.php │ │ ├── mapi_interface_vrrp.php │ │ └── mapi_interfaces.php │ ├── ip │ │ ├── mapi_ip.php │ │ ├── mapi_ip_accounting.php │ │ ├── mapi_ip_address.php │ │ ├── mapi_ip_arp.php │ │ ├── mapi_ip_dhcp_client.php │ │ ├── mapi_ip_dhcp_relay.php │ │ ├── mapi_ip_dhcp_server.php │ │ ├── mapi_ip_dns.php │ │ ├── mapi_ip_firewall.php │ │ ├── mapi_ip_hotspot.php │ │ ├── mapi_ip_pool.php │ │ ├── mapi_ip_proxy.php │ │ ├── mapi_ip_route.php │ │ └── mapi_ip_service.php │ ├── ppp │ │ ├── mapi_ppp.php │ │ ├── mapi_ppp_aaa.php │ │ ├── mapi_ppp_active.php │ │ ├── mapi_ppp_profile.php │ │ └── mapi_ppp_secret.php │ └── system │ │ ├── mapi_system.php │ │ └── mapi_system_scheduler.php └── mikrotik_api.php └── spark.info /README.md: -------------------------------------------------------------------------------- 1 | #Mikrotik RouterOS API 2 | This spark library for working with Mikrotik RouterOS API. The Library is developing 3 | from Denis Basta (denis.basta@gmail.com) routeros_api class and we change it to our 4 | core class with name Mapi_Core. 5 | 6 | We have been tested with RouterOS version 3 and above 7 | 8 | ##Documentation 9 | 10 | For get documentation about this library please go to http://doc.vthink.web.id 11 | 12 | For get spark library update information please go to our site at : http://vthink.web.id/index.php/content/categories/21 13 | 14 | And to know more about Mikrotik RouterOS API Manual you can go to site : http://wiki.mikrotik.com/wiki/Manual:API 15 | 16 | 17 | ##Requirement 18 | This spark library need minimum requirement for doing well on run. 19 | 20 | * CodeIgniter : version 2.0.3 21 | * PHP : version 5.2.x and above 22 | * Mikrotik RouterOS : version 3.xx and above 23 | 24 | ##Instalation 25 | For Install this spark, open your terminal and write down this command 26 | 27 | php tools/spark install mikrotik_api -v0.7.0 28 | 29 | ##Configuration 30 | You need to define your connection and authentication information in config file.
31 | The config file is located in sparks/mikrotik_api/0.7.0/config/mikrotik.php 32 | 33 | $config['mikrotik']['host'] = '192.168.88.1'; 34 | $config['mikrotik']['port'] = '8728'; 35 | $config['mikrotik']['username'] = 'admin'; 36 | $config['mikrotik']['password'] = ''; 37 | $config['mikrotik']['debug'] = FALSE; 38 | $config['mikrotik']['attempts'] = 5; 39 | $config['mikrotik']['delay'] = 2; 40 | $config['mikrotik']['timeout'] = 2; 41 | 42 | Descriptions: 43 | 44 | $config['mikrotik']['host'] = '192.168.88.1'; --> ip address or domain of your Mikrotik RouterOS 45 | $config['mikrotik']['port'] = '8728'; --> port of your Mikrotik RouterOS API service 46 | $config['mikrotik']['username'] = 'admin'; --> username of your Mikrotik RouterOS 47 | $config['mikrotik']['password'] = ''; --> password of your Mikrotik RouterOS 48 | $config['mikrotik']['debug'] = FALSE; --> if TRUE, the library will write the output of your command 49 | $config['mikrotik']['attempts'] = 5; --> how many times the library will attempt a connection before declare Connection Error 50 | $config['mikrotik']['delay'] = 2; --> how long delay between attempt a new connection 51 | $config['mikrotik']['timeout'] = 2; --> how long the library will declare a timeout when there is no response from Mikrotik RouterOS 52 | 53 | 54 | ##Run 55 | Okey, if you have finished yet to configure, lets try this code 56 | 57 | class Test extends CI_Controller { 58 | function __construct() { 59 | parent::__construct(); 60 | $this->load->spark('mikrotik_api/0.7.0'); 61 | } 62 | 63 | public function index(){ 64 | $test = $this->mikrotik_api->ip()->address()->get_all_address(); 65 | print_r($test); 66 | } 67 | 68 | } 69 | 70 | 71 | ##Bugs 72 | Please send us email when you got bugs or some idea for this spark library 73 | * nunenuh@gmail.com 74 | * krisna.pranata@gmail.com 75 | -------------------------------------------------------------------------------- /config/autoload.php: -------------------------------------------------------------------------------- 1 | 15 | * January 8, 2010, Fixed write function in 16 | * order to allow for queries to be executed 17 | * 18 | * Revised By Lalu Erfandi Maula Yusnu nunenuh@gmail.com 19 | * Create constructur for integrating with codeigniter 20 | * and added isset Response in function connect 21 | * 22 | * Revised By Krisna Pranata krisna.pranata@gmail.com 23 | * Change function encode_length from useing if code to switch code 24 | * and change class name from Routeros_api to Mapi_Core 25 | * 26 | * @category Library 27 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 28 | * @access protected 29 | * 30 | */ 31 | class Mapi_Core { 32 | /** 33 | * 34 | * @var type array 35 | */ 36 | private $param; 37 | 38 | /** 39 | * 40 | * @var type int 41 | */ 42 | private $error_no; // Variable for storing connection error number, if any 43 | /** 44 | * 45 | * @var type string 46 | */ 47 | private $error_str; // Variable for storing connection error text, if any 48 | 49 | /** 50 | * 51 | * @var type boolean 52 | */ 53 | private $connected = false; // Connection state 54 | 55 | /** 56 | * 57 | * @var type mixed 58 | */ 59 | private $socket; // Variable for storing socket resource 60 | 61 | /** 62 | * 63 | * @param type $param 64 | */ 65 | function __construct($param=array()) { 66 | $this->param = $param; 67 | } 68 | 69 | /** 70 | * @access protected 71 | * @param type $text string 72 | */ 73 | private function debug($text) { 74 | if ($this->param['debug']) echo $text . "\n"; 75 | } 76 | 77 | /** 78 | * @access protected 79 | * @param type $length 80 | * @return string 81 | */ 82 | private function encode_length($length) { 83 | switch ($length){ 84 | case $length < 0x80 : 85 | $length = chr($length); 86 | break; 87 | case $length < 0x4000: 88 | $length |= 0x8000; 89 | $length = chr( ($length >> 8 ) & 0xFF) . chr($length & 0x0FF); 90 | break; 91 | case $length < 200000: 92 | $length |= 0xC00000; 93 | $length = chr(($length >> 8) & 0xFF). chr(($length >> 8) & 0xFF). chr($length & 0xFF); 94 | break; 95 | case $length < 0x10000000: 96 | $length |= 0xE0000000; 97 | $length = chr(($length >> 8) & 0xFF). chr(($length >> 8) & 0xFF). chr(($length >> 8) & 0xFF). chr($length & 0xFF); 98 | break; 99 | case $length >= 0x10000000: 100 | $length = character_limiter(0xF0). chr(($length >> 8) & 0xFF). chr(($length >> 8) & 0xFF). chr(($length >> 8) & 0xFF). chr($length & 0xFF); 101 | break; 102 | } 103 | return $length; 104 | } 105 | 106 | /** 107 | * @access protected 108 | * @return type boolean 109 | */ 110 | function connect() { 111 | for ($ATTEMPT = 1; $ATTEMPT <= $this->param['attempts']; $ATTEMPT++) { 112 | $this->connected = false; 113 | $this->debug('Connection attempt #' . $ATTEMPT . ' to ' . $this->param['host'] . ':' . $this->param['port'] . '...'); 114 | if ($this->socket = @fsockopen($this->param['host'], $this->param['port'], $this->error_no, $this->error_str, $this->param['timeout']) ) { 115 | socket_set_timeout($this->socket, $this->param['timeout']); 116 | $this->write('/login'); 117 | $RESPONSE = $this->read(false); 118 | if ($RESPONSE[0] == '!done') { 119 | if (isset($RESPONSE[1])){ 120 | if (preg_match_all('/[^=]+/i', $RESPONSE[1], $MATCHES) ) { 121 | if ($MATCHES[0][0] == 'ret' && strlen($MATCHES[0][1]) == 32) { 122 | $this->write('/login', false); 123 | $this->write('=name=' . $this->param['username'], false); 124 | $this->write('=response=00' . md5(chr(0) . $this->param['password'] . pack('H*', $MATCHES[0][1]) ) ); 125 | $RESPONSE = $this->read(false); 126 | if (isset ($RESPONSE[0])){ 127 | if ($RESPONSE[0] == '!done') { 128 | $this->connected = true; 129 | break; 130 | } 131 | } 132 | } 133 | } 134 | } 135 | } 136 | fclose($this->socket); 137 | } 138 | sleep($this->param['delay']); 139 | } 140 | 141 | if ($this->connected) $this->debug('Connected...'); else $this->debug('Error...'); 142 | return $this->connected; 143 | } 144 | 145 | 146 | /** 147 | * @access protected 148 | */ 149 | public function disconnect() { 150 | fclose($this->socket); 151 | $this->connected = false; 152 | $this->debug('Disconnected...'); 153 | } 154 | 155 | /** 156 | * @access protected 157 | * @param type $response mixed 158 | * @return array 159 | */ 160 | private function parse_response($response) { 161 | if (is_array($response) ) { 162 | $PARSED = array(); 163 | $CURRENT = null; 164 | foreach ($response as $x) { 165 | if (in_array($x, array('!fatal', '!re', '!trap') ) ) { 166 | if ($x == '!re') 167 | $CURRENT = &$PARSED[]; 168 | else 169 | $CURRENT = &$PARSED[$x][]; 170 | } else if ($x != '!done') { 171 | if (preg_match_all('/[^=]+/i', $x, $MATCHES) ) 172 | $CURRENT[$MATCHES[0][0]] = (isset($MATCHES[0][1]) ? $MATCHES[0][1] : ''); 173 | } 174 | } 175 | return $PARSED; 176 | }else { 177 | return array(); 178 | } 179 | } 180 | 181 | /** 182 | * @access protected 183 | * @param type $array array 184 | * @return type 185 | */ 186 | private function array_change_key_name(&$array) { 187 | if (is_array($array) ) { 188 | foreach ($array as $k => $v) { 189 | $tmp = str_replace("-","_",$k); 190 | $tmp = str_replace("/","_",$tmp); 191 | if ($tmp) { 192 | $array_new[$tmp] = $v; 193 | } else { 194 | $array_new[$k] = $v; 195 | } 196 | } 197 | return $array_new; 198 | } else { 199 | return $array; 200 | } 201 | } 202 | 203 | /** 204 | * @access protected 205 | * @param type $response mixed 206 | * @return type array 207 | */ 208 | private function parse_response4smarty($response) { 209 | if (is_array($response) ) { 210 | $PARSED = array(); 211 | $CURRENT = null; 212 | foreach ($response as $x) { 213 | if (in_array($x, array('!fatal', '!re', '!trap') ) ) { 214 | if ($x == '!re') 215 | $CURRENT = &$PARSED[]; 216 | else 217 | $CURRENT = &$PARSED[$x][]; 218 | } 219 | else 220 | if ($x != '!done') { 221 | if (preg_match_all('/[^=]+/i', $x, $MATCHES) ) 222 | $CURRENT[$MATCHES[0][0]] = (isset($MATCHES[0][1]) ? $MATCHES[0][1] : ''); 223 | } 224 | } 225 | foreach ($PARSED as $key => $value) { 226 | $PARSED[$key] = $this->array_change_key_name($value); 227 | } 228 | return $PARSED; 229 | } 230 | else { 231 | return array(); 232 | } 233 | } 234 | 235 | /** 236 | * @access protected 237 | * @param type $parse boolean 238 | * @return type mixed 239 | */ 240 | function read($parse = true) { 241 | 242 | $RESPONSE = array(); 243 | 244 | while (true) { 245 | 246 | // Read the first byte of input which gives us some or all of the length 247 | // of the remaining reply. 248 | $BYTE = ord(fread($this->socket, 1) ); 249 | $LENGTH = 0; 250 | 251 | // If the first bit is set then we need to remove the first four bits, shift left 8 252 | // and then read another byte in. 253 | // We repeat this for the second and third bits. 254 | // If the fourth bit is set, we need to remove anything left in the first byte 255 | // and then read in yet another byte. 256 | if ($BYTE & 128) { 257 | if (($BYTE & 192) == 128) { 258 | $LENGTH = (($BYTE & 63) << 8 ) + ord(fread($this->socket, 1)) ; 259 | } else { 260 | if (($BYTE & 224) == 192) { 261 | $LENGTH = (($BYTE & 31) << 8 ) + ord(fread($this->socket, 1)) ; 262 | $LENGTH = ($LENGTH << 8 ) + ord(fread($this->socket, 1)) ; 263 | } else { 264 | if (($BYTE & 240) == 224) { 265 | $LENGTH = (($BYTE & 15) << 8 ) + ord(fread($this->socket, 1)) ; 266 | $LENGTH = ($LENGTH << 8 ) + ord(fread($this->socket, 1)) ; 267 | $LENGTH = ($LENGTH << 8 ) + ord(fread($this->socket, 1)) ; 268 | } else { 269 | $LENGTH = ord(fread($this->socket, 1)) ; 270 | $LENGTH = ($LENGTH << 8 ) + ord(fread($this->socket, 1)) ; 271 | $LENGTH = ($LENGTH << 8 ) + ord(fread($this->socket, 1)) ; 272 | $LENGTH = ($LENGTH << 8 ) + ord(fread($this->socket, 1)) ; 273 | } 274 | } 275 | } 276 | } else { 277 | $LENGTH = $BYTE; 278 | } 279 | 280 | // If we have got more characters to read, read them in. 281 | $note = ""; 282 | if ($LENGTH > 0) { 283 | 284 | $retlen=0; 285 | while ($retlen < $LENGTH) { 286 | $toread = $LENGTH - $retlen ; 287 | $note .= fread($this->socket, $toread); 288 | $retlen = strlen($note); 289 | } 290 | $RESPONSE[] = $note ; 291 | $this->debug('>>> [' . $retlen . '/' . $LENGTH . ' bytes read.'); 292 | } 293 | 294 | // If we get a !done, make a note of it. 295 | if ($note == "!done") 296 | $receiveddone=true; 297 | 298 | $STATUS = socket_get_status($this->socket); 299 | 300 | 301 | if ($LENGTH > 0) 302 | $this->debug('>>> [' . $LENGTH . ', ' . $STATUS['unread_bytes'] . '] ' . $note); 303 | 304 | if ( (!$this->connected && !$STATUS['unread_bytes']) || 305 | ($this->connected && !$STATUS['unread_bytes'] && isset ($receiveddone))) 306 | break; 307 | 308 | } 309 | 310 | if ($parse) 311 | $RESPONSE = $this->parse_response($RESPONSE); 312 | 313 | return $RESPONSE; 314 | 315 | } 316 | 317 | /** 318 | * @access protected 319 | * @param type $command string 320 | * @param type $param2 boolean 321 | * @return type mixed 322 | */ 323 | function write($command, $param2 = true) { 324 | if ($command) { 325 | $data = explode("\n",$command); 326 | foreach ($data as $com) { 327 | $com = trim($com); 328 | fwrite($this->socket, $this->encode_length(strlen($com) ) . $com); 329 | $this->debug('<<< [' . strlen($com) . '] ' . $com); 330 | } 331 | 332 | if (gettype($param2) == 'integer') { 333 | fwrite($this->socket, $this->encode_length(strlen('.tag=' . $param2) ) . '.tag=' . $param2 . chr(0) ); 334 | $this->debug('<<< [' . strlen('.tag=' . $param2) . '] .tag=' . $param2); 335 | } else if (gettype($param2) == 'boolean'){ 336 | fwrite($this->socket, ($param2 ? chr(0) : '') ); 337 | } 338 | 339 | return true; 340 | } else { 341 | return false; 342 | } 343 | } 344 | 345 | } 346 | 347 | -------------------------------------------------------------------------------- /libraries/mikrotik/core/mapi_query.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Krisna Pranata krisna.pranata@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | * @version 0.5.0 12 | */ 13 | class Mapi_Query extends Mapi_Core { 14 | /** 15 | * @access private 16 | * @var type array 17 | */ 18 | private $param; 19 | 20 | /** 21 | * Instantiation 22 | * @param type $param array 23 | */ 24 | function __construct($param=array()) { 25 | $this->param = $param; 26 | parent::__construct($param); //Mikrotik_Api_Core 27 | } 28 | 29 | /** 30 | * @access protected 31 | * @param type $param string/array 32 | * @return boolean 33 | */ 34 | function query($param){ 35 | $out=''; 36 | if ($this->connect()){ 37 | $out= $this->__build($param); 38 | $this->disconnect(); 39 | } else { 40 | $out = FALSE; 41 | } 42 | return $out; 43 | } 44 | 45 | /** 46 | * @access protected 47 | * @param type $param array 48 | * @return type array 49 | */ 50 | private function __build($param){ 51 | $tmp=''; 52 | if (!is_array($param)){ 53 | $tmp=explode('/', $param); 54 | } else { 55 | $tmp=explode('/', $param['command']); 56 | } 57 | 58 | $tmp_count=count($tmp); 59 | $last_command=$tmp[$tmp_count-1]; 60 | 61 | //write check 62 | if (is_array($param)){ 63 | $count = count($param); 64 | $i=0; 65 | foreach ($param as $key => $value){ 66 | $status=FALSE; 67 | if ($i==$count-1){ 68 | $status=TRUE; 69 | } 70 | if ($key=='command'){ 71 | $this->write($value,false); 72 | } else { 73 | if ($key=='id'){ 74 | if ($last_command=="print"){ 75 | $this->write('?.'.$key.'='.$value, $status); 76 | } else { 77 | $this->write('=.'.$key.'='.$value, $status); 78 | } 79 | } else { 80 | $this->write('='.$key.'='.$value,$status); 81 | } 82 | } 83 | $i++; 84 | } 85 | } else { 86 | $this->write($param); 87 | } 88 | 89 | $r_status=''; 90 | if ($last_command=="print"||$last_command=="getall"){ 91 | $r_status=TRUE; 92 | } else { 93 | $r_status=FALSE; 94 | } 95 | 96 | return $this->read($r_status); 97 | } 98 | 99 | } -------------------------------------------------------------------------------- /libraries/mikrotik/file/mapi_file.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | 13 | class Mapi_File extends Mapi_Query { 14 | /** 15 | * @access private 16 | * @var type array 17 | */ 18 | private $param; 19 | 20 | function __construct($param ) { 21 | $this->param = $param; 22 | parent::__construct($param); 23 | } 24 | 25 | /** 26 | * This method is used to display all file in mikrotik RouterOs 27 | * @return type array 28 | */ 29 | public function get_all_file(){ 30 | return $this->query('/file/getall'); 31 | } 32 | 33 | /** 34 | * This method is used to display one file 35 | * in detail based on the id 36 | * @param type $id string 37 | * @return type array 38 | */ 39 | public function detail_file($id){ 40 | $input = array( 41 | 'command' => '/file/print', 42 | 'id' => $id 43 | ); 44 | return $this->query($input); 45 | } 46 | 47 | /** 48 | * This method is used to delete file by id 49 | * @param type $id string 50 | * @return type array 51 | */ 52 | public function delete_file($id){ 53 | $input = array( 54 | 'command' => '/file/remove', 55 | 'id' => $id 56 | ); 57 | return $this->query($input); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /libraries/mikrotik/interface/mapi_interface_bonding.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Interface_Bonding extends Mapi_Query { 13 | /** 14 | * 15 | * @var type array 16 | */ 17 | private $param; 18 | 19 | function __construct($param ) { 20 | $this->param = $param; 21 | parent::__construct($param); 22 | } 23 | 24 | /** 25 | * This method is used to add interface bonding 26 | * 27 | * Example in Mikrotik RouterOs : 28 | * 29 | * [admin@Router1] interface bonding> add slaves=ether1,ether2 30 | * 31 | * Exmple : 32 | * 33 | * $param = array( 34 | * 'name' => 'bonding1', 35 | * 'slaves' => 'ether1,ether2'); 36 | * 37 | * $this->mikrotik_api->interfaces()->bonding()->add_bonding($param); 38 | * 39 | * The $param that you can send to Mikrotik RouterOs are : 40 | * 41 | * 1. arp -- Address Resolution Protocol 42 | * 43 | * 2. arp-interval -- Time in milliseconds for monitoring ARP requests 44 | * 45 | * 3. arp-ip-targets -- IP addresses for monitoring 46 | * 47 | * 4. comment -- Set comment for items 48 | * 49 | * 5. copy-from -- Item number 50 | * 51 | * 6. disabled -- Defines whether MAC Telnet Server is disabled or not 52 | * 53 | * 7. down-delay -- Time period the interface is disabled if a link failure has been detected 54 | * 55 | * 8. lacp-rate -- Link Aggregation Control Protocol rate specifies how often to exchange with LACPDUs between bonding peer 56 | * 57 | * 9. link-monitoring -- Method for monitoring the link 58 | * 59 | * 10. mii-interval -- Time in milliseconds for monitoring mii-type link 60 | * 61 | * 11. mode -- Interface bonding mode 62 | * 63 | * 12. mtu -- Maximum Transmit Unit 64 | * 65 | * 13. name -- Interface name 66 | * 67 | * 14. primary -- Slave that will be used in active-backup mode as active link 68 | * 69 | * 16. slaves -- Interfaces that are used in bonding 70 | * 71 | * 17. up-delay -- Time period the interface is disabled if a link has been brought up 72 | * 73 | * 18. up-delay -- Time period the interface is disabled if a link has been brought up 74 | * 75 | * @param type $param array 76 | * @return type array 77 | */ 78 | public function add_bonding($param){ 79 | $input = array( 80 | 'command' => '/interface/bonding/add' 81 | ); 82 | $out = array_merge($input, $param); 83 | return $this->query($out); 84 | } 85 | 86 | /** 87 | * This method is used to display all interface bonding 88 | * 89 | * Example : 90 | * 91 | * print_r($this->mikrotik_api->interfaces()->bonding()->get_all_bonding()); 92 | * @return type array 93 | */ 94 | public function get_all_bonding(){ 95 | return $this->query('/interface/bonding/getall'); 96 | } 97 | 98 | /** 99 | * This method is used to enable interface bonding by id 100 | * 101 | * Example : 102 | * 103 | * $this->mikrotik_api->interfaces()->bonding()->enable_bonding('*1'); 104 | * @param type $id string 105 | * @return type array 106 | */ 107 | public function enable_bonding($id){ 108 | $input = array( 109 | 'command' => '/interface/bonding/enable', 110 | 'id' => $id 111 | ); 112 | return $this->query($input); 113 | } 114 | 115 | /** 116 | * This method is used to disable interface bonding by id 117 | * 118 | * Example : 119 | * 120 | * $this->mikrotik_api->interfaces()->bonding()->disable_bonding('*1'); 121 | * @param type $id string 122 | * @return type array 123 | */ 124 | public function disable_bonding($id){ 125 | $input = array( 126 | 'command' => '/interface/bonding/disable', 127 | 'id' => $id 128 | ); 129 | return $this->query($input); 130 | } 131 | 132 | /** 133 | * This method is used to set or edit interface bonding by id 134 | * 135 | * Example : 136 | * 137 | * $param = array( 138 | * 'name' => 'bonding1', 139 | * 'slaves' => 'ether1,ether2'); 140 | * 141 | * $this->mikrotik_api->interfaces()->bonding()->set_bonding($param, '*1'); 142 | * 143 | * 144 | * The $param that you can send to Mikrotik RouterOs are : 145 | * 146 | * 1. arp -- Address Resolution Protocol 147 | * 148 | * 2. arp-interval -- Time in milliseconds for monitoring ARP requests 149 | * 150 | * 3. arp-ip-targets -- IP addresses for monitoring 151 | * 152 | * 4. comment -- Set comment for items 153 | * 154 | * 5. copy-from -- Item number 155 | * 156 | * 6. disabled -- Defines whether MAC Telnet Server is disabled or not 157 | * 158 | * 7. down-delay -- Time period the interface is disabled if a link failure has been detected 159 | * 160 | * 8. lacp-rate -- Link Aggregation Control Protocol rate specifies how often to exchange with LACPDUs between bonding peer 161 | * 162 | * 9. link-monitoring -- Method for monitoring the link 163 | * 164 | * 10. mii-interval -- Time in milliseconds for monitoring mii-type link 165 | * 166 | * 11. mode -- Interface bonding mode 167 | * 168 | * 12. mtu -- Maximum Transmit Unit 169 | * 170 | * 13. name -- Interface name 171 | * 172 | * 14. primary -- Slave that will be used in active-backup mode as active link 173 | * 174 | * 16. slaves -- Interfaces that are used in bonding 175 | * 176 | * 17. up-delay -- Time period the interface is disabled if a link has been brought up 177 | * 178 | * 18. up-delay -- Time period the interface is disabled if a link has been brought up 179 | * 180 | * @param type $param array 181 | * @param type $id string 182 | * @return type array 183 | */ 184 | public function set_bonding($param, $id){ 185 | $input = array( 186 | 'command' => '/interface/bonding/set', 187 | 'id' => $id 188 | ); 189 | $out=array_merge($input, $param); 190 | return $this->query($out); 191 | } 192 | 193 | /** 194 | * This method is used to display one interface bonding 195 | * in detail based on the id 196 | * 197 | * Example : 198 | * 199 | * $this->mikrotik_api->interfaces()->bonding()->detail_bonding('*1'); 200 | * @param type $id string 201 | * @return type array 202 | */ 203 | public function detail_bonding($id){ 204 | $input = array( 205 | 'command' => '/interface/bonding/print', 206 | 'id' => $id 207 | ); 208 | return $this->query($input); 209 | } 210 | /** 211 | * This method is used to delete interface bonding by id 212 | * 213 | * $this->mikrotik_api->interfaces()->bonding()->delete_bonding('*1'); 214 | * @param type $id string 215 | * @return type array 216 | */ 217 | public function delete_bonding($id){ 218 | $input = array( 219 | 'command' => '/interface/bonding/remove', 220 | 'id' => $id 221 | ); 222 | return $this->query($input); 223 | } 224 | } -------------------------------------------------------------------------------- /libraries/mikrotik/interface/mapi_interface_bridge.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Interface_Bridge extends Mapi_Query { 13 | private $param; 14 | function __construct($param ) { 15 | $this->param = $param; 16 | parent::__construct($param); 17 | } 18 | 19 | /** 20 | * This method used for add new interface bridge 21 | * @param type $param array 22 | * @return type array 23 | */ 24 | public function add_bridge($param){ 25 | $input = array( 26 | 'command' => '/interface/bridge/add', 27 | ); 28 | $out = array_merge($input, $param); 29 | return $this->query($out); 30 | } 31 | 32 | /** 33 | * This method used for disable interface bridge 34 | * @param type $id string 35 | * @return type array 36 | */ 37 | public function disable_bridge($id){ 38 | $input = array( 39 | 'command' => '/interface/bridge/disable', 40 | 'id' => $id 41 | ); 42 | return $this->query($input); 43 | } 44 | 45 | /** 46 | * This method used for enable interface bridge 47 | * @param type $id string 48 | * @return type array 49 | */ 50 | public function enable_bridge($id){ 51 | $input = array( 52 | 'command' => '/interface/bridge/enable', 53 | 'id' => $id 54 | ); 55 | return $this->query($input); 56 | } 57 | 58 | /** 59 | * This method used for delete interface bridge 60 | * @param type $id string 61 | * @return type array 62 | */ 63 | public function delete_bridge($id){ 64 | $input = array( 65 | 'command' => '/interface/bridge/remove', 66 | 'id' => $id 67 | ); 68 | return $this->query($input); 69 | } 70 | 71 | /** 72 | * This method used for get all interface bridge 73 | * @return type array 74 | */ 75 | public function get_all_bridge(){ 76 | return $this->query('/interface/bridge/getall'); 77 | } 78 | 79 | /** 80 | * This method used for set or edit interface bridge 81 | * @param type $param array 82 | * @param type $id string 83 | * @return type array 84 | */ 85 | public function set_bridge($param, $id){ 86 | $input = array( 87 | 'command' => '/interface/bridge/set', 88 | 'id' => $id 89 | ); 90 | $out = array_merge($input, $param); 91 | return $this->query($out); 92 | } 93 | 94 | /** 95 | * This method used for detail interface bridge 96 | * @param type $id string 97 | * @return type array 98 | */ 99 | public function detail_bridge($id){ 100 | $input = array( 101 | 'command' => '/interface/bridge/print', 102 | 'id' => $id 103 | ); 104 | return $this->query($input); 105 | } 106 | 107 | public function add_bridge_nat($param){ 108 | $input = array( 109 | 'command' => '/interface/bridge/nat/add', 110 | ); 111 | $out = array_merge($input, $param); 112 | return $this->query($out); 113 | } 114 | 115 | /** 116 | * This method used for disable interface bridge 117 | * @param type $id string 118 | * @return type array 119 | */ 120 | public function disable_bridge_nat($id){ 121 | $input = array( 122 | 'command' => '/interface/bridge/nat/disable', 123 | 'id' => $id 124 | ); 125 | return $this->query($input); 126 | } 127 | 128 | /** 129 | * This method used for enable interface bridge 130 | * @param type $id string 131 | * @return type array 132 | */ 133 | public function enable_bridge_nat($id){ 134 | $input = array( 135 | 'command' => '/interface/bridge/nat/enable', 136 | 'id' => $id 137 | ); 138 | return $this->query($input); 139 | } 140 | 141 | /** 142 | * This method used for delete interface bridge 143 | * @param type $id string 144 | * @return type array 145 | */ 146 | public function delete_bridge_nat($id){ 147 | $input = array( 148 | 'command' => '/interface/bridge/nat/remove', 149 | 'id' => $id 150 | ); 151 | return $this->query($input); 152 | } 153 | 154 | /** 155 | * This method used for get all interface bridge 156 | * @return type array 157 | */ 158 | public function get_all_bridge_nat(){ 159 | return $this->query('/interface/bridge/nat/getall'); 160 | } 161 | 162 | /** 163 | * This method used for set or edit interface bridge 164 | * @param type $param array 165 | * @param type $id string 166 | * @return type array 167 | */ 168 | public function set_bridge_nat($param, $id){ 169 | $input = array( 170 | 'command' => '/interface/bridge/nat/set', 171 | 'id' => $id 172 | ); 173 | $out = array_merge($input, $param); 174 | return $this->query($out); 175 | } 176 | 177 | /** 178 | * This method used for detail interface bridge 179 | * @param type $id string 180 | * @return type array 181 | */ 182 | public function detail_bridge_nat($id){ 183 | $input = array( 184 | 'command' => '/interface/bridge/nat/print', 185 | 'id' => $id 186 | ); 187 | return $this->query($input); 188 | } 189 | 190 | /** 191 | * This method used for set interface Bridge Settings 192 | * @param type $use_ip_firewall string (default : yes or no) 193 | * @param type $use_ip_firewall_for_vlan string (default : yes or no) 194 | * @param type $use_ip_firewall_for_pppoe string (default : yes or no) 195 | * @return type array 196 | */ 197 | public function set_bridge_settings($use_ip_firewall, $use_ip_firewall_for_vlan, $use_ip_firewall_for_pppoe){ 198 | $input = array( 199 | 'command' => '/interface/bridge/settings/set', 200 | 'use-ip-firewall' => $use_ip_firewall, 201 | 'use-ip-firewall-for-vlan' => $use_ip_firewall_for_vlan, 202 | 'use-ip-firewall-for-pppoe' => $use_ip_firewall_for_pppoe 203 | ); 204 | return $this->query($input); 205 | } 206 | 207 | /** 208 | * This method used for get all interface Bridge Settings 209 | * @return type array 210 | */ 211 | public function get_all_bridge_settings(){ 212 | return $this->query('/interface/bridge/settings/getall'); 213 | } 214 | } 215 | 216 | -------------------------------------------------------------------------------- /libraries/mikrotik/interface/mapi_interface_eoip.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Interface_Eoip extends Mapi_Query { 13 | /** 14 | * 15 | * @var type array 16 | */ 17 | private $param; 18 | 19 | function __construct($param ) { 20 | $this->param = $param; 21 | parent::__construct($param); 22 | } 23 | 24 | /** 25 | * This method is used to add interface eoip 26 | * 27 | * Example : 28 | * 29 | * $param = array( 30 | * 'remote-address' => '172.17.18.18', 31 | * 'tunnel-id' => '0', 32 | * 'arp' => 'disabled', 33 | * 'comment' => 'krisna-eoip', 34 | * 'mtu' => '0', 35 | * 'name' => 'krisna', 36 | * 'mac-address' => '00:00:00:00:00:00', 37 | * 'copy-from' => 'krisna.txt' 38 | * 'disabled' => 'no' 39 | * ); 40 | * 41 | * $this->mikrotik_api->interfaces()->eoip()->add_eoip($param); 42 | * 43 | * @param type $param array 44 | * @return type array 45 | */ 46 | public function add_eoip($param){ 47 | $input = array( 48 | 'command' => '/interface/eoip/add' 49 | ); 50 | $out = array_merge($input, $param); 51 | return $this->query($out); 52 | } 53 | 54 | /** 55 | * This method is used to display all interface eoip 56 | * 57 | * Example : 58 | * 59 | * print_r($this->mikrotik_api->interfaces()->eoip()->get_all_eoip()); 60 | * @return type array 61 | */ 62 | public function get_all_eoip(){ 63 | return $this->query('/interface/eoip/getall'); 64 | } 65 | 66 | /** 67 | * This method is used to enable interface eoip by id 68 | * 69 | * Example : 70 | * 71 | * $this->mikrotik_api->interfaces()->eoip()->enable_eoip('*1'); 72 | * @param type $id string 73 | * @return type array 74 | */ 75 | public function enable_eoip($id){ 76 | $input = array( 77 | 'command' => '/interface/eoip/enable', 78 | 'id' => $id 79 | ); 80 | return $this->query($input); 81 | } 82 | 83 | /** 84 | * This method is used to disable interface eoip by id 85 | * 86 | * Example : 87 | * 88 | * $this->mikrotik_api->interfaces()->eoip()->disable_eoip('*1'); 89 | * @param type $id string 90 | * @return type array 91 | */ 92 | public function disable_eoip($id){ 93 | $input = array( 94 | 'command' => '/interface/eoip/disable', 95 | 'id' => $id 96 | ); 97 | return $this->query($input); 98 | } 99 | 100 | /** 101 | * This method is used to remove interface eoip by id 102 | * 103 | * Example : 104 | * 105 | * $this->mikrotik_api->interfaces()->eoip()->delete_eoip('*1'); 106 | * @param type $id string 107 | * @return type array 108 | */ 109 | public function delete_eoip($id){ 110 | $input = array( 111 | 'command' => '/interface/eoip/remove', 112 | 'id' => $id 113 | ); 114 | return $this->query($input); 115 | } 116 | 117 | /** 118 | * This method is used to set or edit interface eoip by id 119 | * 120 | * Example : 121 | * 122 | * $param = array( 123 | * 'remote-address' => '172.17.18.18', 124 | * 'tunnel-id' => '0', 125 | * 'arp' => 'disabled', 126 | * 'comment' => 'krisna-eoip', 127 | * 'mtu' => '0', 128 | * 'name' => 'krisna', 129 | * 'mac-address' => '00:00:00:00:00:00', 130 | * 'copy-from' => 'krisna.txt' 131 | * 'disabled' => 'no' 132 | * ); 133 | * 134 | * $this->mikrotik_api->interfaces()->eoip()->set_eoip($param, '*1'); 135 | * @param type $param array 136 | * @param type $id string 137 | * @return type array 138 | */ 139 | public function set_eoip($param, $id){ 140 | $input = array( 141 | 'command' => '/interface/eoip/set', 142 | 'id' => $id 143 | ); 144 | $out=array_merge($input, $param); 145 | return $this->query($out); 146 | } 147 | 148 | /** 149 | * This method is used to display one interface eoip 150 | * in detail based on the id 151 | * 152 | * Example : 153 | * 154 | * $this->mikrotik_api->interfaces()->eoip()->detail_eoip($param, '*1'); 155 | * @param type $id string 156 | * @return type array 157 | */ 158 | public function detail_eoip($id){ 159 | $input = array( 160 | 'command' => '/interface/eoip/print', 161 | 'id' => $id 162 | ); 163 | return $this->query($input); 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /libraries/mikrotik/interface/mapi_interface_ethernet.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Interface_Ethernet extends Mapi_Query { 13 | /** 14 | * 15 | * @var type array 16 | */ 17 | private $param; 18 | 19 | function __construct($param) { 20 | $this->param = $param; 21 | parent::__construct($param); 22 | } 23 | 24 | /** 25 | * This method is used to display all interface 26 | * @return type array 27 | */ 28 | public function get_all_interface(){ 29 | return $this->query('/interface/getall'); 30 | } 31 | 32 | /** 33 | * This method is used to display one interface 34 | * in detail based on the id 35 | * @param type $param array 36 | * @param type $id string 37 | * @return type array 38 | */ 39 | 40 | public function set_interface($param, $id){ 41 | $input = array( 42 | 'command' => '/interface/set', 43 | 'id' => $id 44 | ); 45 | $out = array_merge($input, $param); 46 | return $this->query($out); 47 | } 48 | 49 | /** 50 | * This method is used to enable interface by id 51 | * @param type $id string 52 | * @return type array 53 | */ 54 | public function enable_interface($id){ 55 | $input = array( 56 | 'command' => '/interface/enable', 57 | 'id' => $id 58 | ); 59 | return $this->query($input); 60 | } 61 | 62 | /** 63 | * This method is used to disable interface by id 64 | * @param type $id string 65 | * @return type array 66 | */ 67 | public function disable_interface($id){ 68 | $input = array( 69 | 'command' => '/interface/disable', 70 | 'id' => $id 71 | ); 72 | return $this->query($input); 73 | } 74 | /** 75 | * This method is used to display one interafce 76 | * in detail based on the id 77 | * @param type $id string 78 | * @return type array 79 | * 80 | */ 81 | public function detail_interface($id){ 82 | $input = array( 83 | 'command' => '/interface/print', 84 | 'id' => $id 85 | ); 86 | return $this->query($input); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /libraries/mikrotik/interface/mapi_interface_ipip.php: -------------------------------------------------------------------------------- 1 | 6 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 7 | * @copyright Copyright (c) 2011, Virtual Think Team. 8 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 9 | * @category Libraries 10 | */ 11 | class Mapi_Interface_Ipip extends Mapi_Query { 12 | /** 13 | * 14 | * @var type array 15 | */ 16 | private $param; 17 | 18 | function __construct($param ) { 19 | $this->param = $param; 20 | parent::__construct($param); 21 | } 22 | 23 | /** 24 | * This method is used to add interface ipip 25 | * @param type $param array 26 | * @return type array 27 | */ 28 | public function add_ipip($param){ 29 | $input = array( 30 | 'command' => '/interface/ipip/add' 31 | ); 32 | $out = array_merge($input, $param); 33 | return $this->query($out); 34 | } 35 | 36 | /** 37 | * This method is used to display all interface ipip 38 | * @return type array 39 | */ 40 | public function get_all_ipip(){ 41 | return $this->query('/interface/ipip/getall'); 42 | } 43 | 44 | /** 45 | * This method is used to enable interface ipip by id 46 | * @param type $id string 47 | * @return type array 48 | */ 49 | public function enable_ipip($id){ 50 | $input = array( 51 | 'command' => '/interface/ipip/enable', 52 | 'id' => $id 53 | ); 54 | return $this->query($input); 55 | } 56 | 57 | /** 58 | * This method is used to disable interface ipip by id 59 | * @param type $id string 60 | * @return type array 61 | */ 62 | public function disable_ipip($id){ 63 | $input = array( 64 | 'command' => '/interface/ipip/disable', 65 | 'id' => $id 66 | ); 67 | return $this->query($input); 68 | } 69 | 70 | /** 71 | * This method is used to remove interface ipip 72 | * @param type $id string 73 | * @return type array 74 | */ 75 | public function delete_ipip($id){ 76 | $input = array( 77 | 'command' => '/interface/ipip/remove', 78 | 'id' => $id 79 | ); 80 | return $this->query($input); 81 | } 82 | 83 | /** 84 | * This method is used to set or edit interface ipip by id 85 | * @param type $param array 86 | * @param type $id string 87 | * @return type 88 | */ 89 | public function set_ipip($param, $id){ 90 | $input = array( 91 | 'command' => '/interface/ipip/set', 92 | 'id' => $id 93 | ); 94 | $out=array_merge($input, $param); 95 | return $this->query($out); 96 | } 97 | 98 | /** 99 | * This method is used to display one interface ipip 100 | * in detail based on the id 101 | * @param type $id string 102 | * @return type array 103 | */ 104 | public function detail_ipip($id){ 105 | $input = array( 106 | 'command' => '/interface/ipip/print', 107 | 'id' => $id 108 | ); 109 | return $this->query($input); 110 | } 111 | } -------------------------------------------------------------------------------- /libraries/mikrotik/interface/mapi_interface_l2tp_client.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Interface_L2tp_Client extends Mapi_Query { 13 | private $param; 14 | function __construct($param ) { 15 | $this->param = $param; 16 | parent::__construct($param); 17 | } 18 | 19 | /** 20 | * This method used for add new l2tp client 21 | * @param type $param array 22 | * @return type array 23 | */ 24 | public function add_l2tp_client($param){ 25 | $input = array( 26 | 'command' => '/interface/l2tp-client/add' 27 | ); 28 | $out = array_merge($input, $param); 29 | return $this->query($out); 30 | } 31 | 32 | /** 33 | * This method used for disable l2tp client 34 | * @param type $id string 35 | * @return type array 36 | */ 37 | public function disable_l2tp_client($id){ 38 | $input = array( 39 | 'command' => '/interface/l2tp-client/disable', 40 | 'id' => $id 41 | ); 42 | return $this->query($input); 43 | } 44 | 45 | /** 46 | * This method used for enable l2tp client 47 | * @param type $id string 48 | * @return type array 49 | */ 50 | public function enable_l2tp_client($id){ 51 | $input = array( 52 | 'command' => '/interface/l2tp-client/enable', 53 | 'id' => $id 54 | ); 55 | return $this->query($input); 56 | } 57 | 58 | /** 59 | * This method used for delete l2tp client 60 | * @param type $id string 61 | * @return type array 62 | */ 63 | public function delete_l2tp_client($id){ 64 | $input = array( 65 | 'command' => '/interface/l2tp-client/remove', 66 | 'id' => $id 67 | ); 68 | return $this->query($input); 69 | } 70 | 71 | /** 72 | * This method used for detail l2tp client 73 | * @param type $id string 74 | * @return type array 75 | */ 76 | public function detail_l2tp_client($id){ 77 | $input = array( 78 | 'command' => '/interface/l2tp-client/print', 79 | 'id' => $id 80 | ); 81 | return $this->query($input); 82 | } 83 | 84 | /** 85 | * This method used for set or edit l2tp client 86 | * @param type $param array 87 | * @param type $id string 88 | * @return type array 89 | */ 90 | public function set_l2tp_client($param, $id){ 91 | $input = array( 92 | 'command' => '/interface/l2tp-client/set', 93 | 'id' => $id 94 | ); 95 | $out = array_merge($input, $param); 96 | return $this->query($out); 97 | } 98 | 99 | /** 100 | * This method used for get all l2tp client 101 | * @return type array 102 | */ 103 | public function get_all_l2tp_client(){ 104 | return $this->query('/interface/l2tp-client/getall'); 105 | } 106 | } 107 | 108 | -------------------------------------------------------------------------------- /libraries/mikrotik/interface/mapi_interface_l2tp_server.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Interface_L2tp_Server extends Mapi_Query { 13 | private $param; 14 | function __construct($param ) { 15 | $this->param = $param; 16 | parent::__construct($param); 17 | } 18 | 19 | /** 20 | * This method used for add new l2tp server 21 | * @param type $param array 22 | * @return type array 23 | */ 24 | public function add_l2tp_server($param){ 25 | $input = array( 26 | 'command' => '/interface/l2tp-server/add' 27 | ); 28 | $out = array_merge($input, $param); 29 | return $this->query($out); 30 | } 31 | 32 | /** 33 | * This method used for disable l2tp server 34 | * @param type $id string 35 | * @return type array 36 | */ 37 | public function disable_l2tp_server($id){ 38 | $input = array( 39 | 'command' => '/interface/l2tp-server/disable', 40 | 'id' => $id 41 | ); 42 | return $this->query($input); 43 | } 44 | 45 | /** 46 | * This method used for enable l2tp server 47 | * @param type $id string 48 | * @return type array 49 | */ 50 | public function enable_l2tp_server($id){ 51 | $input = array( 52 | 'command' => '/interface/l2tp-server/enable', 53 | 'id' => $id 54 | ); 55 | return $this->query($input); 56 | } 57 | 58 | /** 59 | * This method used for delete l2tp server 60 | * @param type $id string 61 | * @return type array 62 | */ 63 | public function delete_l2tp_server($id){ 64 | $input = array( 65 | 'command' => '/interface/l2tp-server/remove', 66 | 'id' => $id 67 | ); 68 | return $this->query($input); 69 | } 70 | 71 | /** 72 | * This method used for detail l2tp server 73 | * @param type $id string 74 | * @return type array 75 | */ 76 | public function detail_l2tp_server($id){ 77 | $input = array( 78 | 'command' => '/interface/l2tp-server/print', 79 | 'id' => $id 80 | ); 81 | return $this->query($input); 82 | } 83 | 84 | /** 85 | * This method used for set or edit l2tp server 86 | * @param type $param array 87 | * @param type $id string 88 | * @return type array 89 | */ 90 | public function set_l2tp_server($param, $id){ 91 | $input = array( 92 | 'command' => '/interface/l2tp-server/set', 93 | 'id' => $id 94 | ); 95 | $out = array_merge($input, $param); 96 | return $this->query($out); 97 | } 98 | 99 | /** 100 | * This method used for get all l2tp server 101 | * @return type array 102 | */ 103 | public function get_all_l2tp_server(){ 104 | return $this->query('/interface/l2tp-server/getall'); 105 | } 106 | 107 | /** 108 | * This method used for get all l2tp server server 109 | * @return type array 110 | */ 111 | public function get_all_l2tp_server_server(){ 112 | return $this->query('/interface/l2tp-server/server/getall'); 113 | } 114 | 115 | /** 116 | * This method used for set l2tp server server 117 | * @param type $param array 118 | * @return type array 119 | */ 120 | public function set_l2tp_server_server($param){ 121 | $input = array( 122 | 'command' => '/interface/l2tp-server/server/set' 123 | ); 124 | $out = array_merge($input, $param); 125 | return $this->query($out); 126 | 127 | } 128 | } 129 | 130 | 131 | -------------------------------------------------------------------------------- /libraries/mikrotik/interface/mapi_interface_ppp_client.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Interface_Ppp_Client extends Mapi_Query { 13 | private $param; 14 | function __construct($param ) { 15 | $this->param = $param; 16 | parent::__construct($param); 17 | } 18 | 19 | /** 20 | * This method used for add new interface ppp-client 21 | * @param type $param array 22 | * @return type array 23 | */ 24 | public function add_ppp_client($param){ 25 | $input = array( 26 | 'command' => '/interface/ppp-client/add' 27 | ); 28 | $out = array_merge($input, $param); 29 | return $this->query($out); 30 | } 31 | 32 | /** 33 | * This method used for disable interface ppp-client 34 | * @param type $id string 35 | * @return type array 36 | */ 37 | public function disable_ppp_client($id){ 38 | $input = array( 39 | 'command' => '/interface/ppp-client/disable', 40 | 'id' => $id 41 | ); 42 | return $this->query($input); 43 | } 44 | 45 | /** 46 | * This method used for enable interface ppp-client 47 | * @param type $id string 48 | * @return type array 49 | */ 50 | public function enable_ppp_client($id){ 51 | $input = array( 52 | 'command' => '/interface/ppp-client/enable', 53 | 'id' => $id 54 | ); 55 | return $this->query($input); 56 | } 57 | 58 | /** 59 | * This method used for delete interface ppp-client 60 | * @param type $id string 61 | * @return type array 62 | */ 63 | public function delete_ppp_client($id){ 64 | $input = array( 65 | 'command' => '/interface/ppp-client/remove', 66 | 'id' => $id 67 | ); 68 | return $this->query($input); 69 | } 70 | 71 | /** 72 | * This method used for detail interface ppp-client 73 | * @param type $id string 74 | * @return type array 75 | */ 76 | public function detail_ppp_client($id){ 77 | $input = array( 78 | 'command' => '/interface/ppp-client/print', 79 | 'id' => $id 80 | ); 81 | return $this->query($input); 82 | } 83 | 84 | /** 85 | * This method used for set or edit interface ppp-client 86 | * @param type $param array 87 | * @param type $id string 88 | * @return type array 89 | */ 90 | public function set_ppp_client($param, $id){ 91 | $input = array( 92 | 'command' => '/interface/ppp-client/set', 93 | 'id' => $id 94 | ); 95 | $out = array_merge($input, $param); 96 | return $this->query($out); 97 | } 98 | 99 | /** 100 | * This method used for get all interface ppp-client 101 | * @return type array 102 | */ 103 | public function get_all_ppp_client(){ 104 | return $this->query('/interface/ppp-client/getall'); 105 | } 106 | } 107 | 108 | -------------------------------------------------------------------------------- /libraries/mikrotik/interface/mapi_interface_ppp_server.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Interface_Ppp_Server extends Mapi_Query { 13 | private $param; 14 | function __construct($param ) { 15 | $this->param = $param; 16 | parent::__construct($param); 17 | } 18 | /** 19 | * This method used for add new interface ppp-sever 20 | * @param type $param array 21 | * @return type array 22 | */ 23 | public function add_ppp_server($param){ 24 | $input = array( 25 | 'command' => '/interface/ppp-server/add' 26 | ); 27 | $out = array_merge($input, $param); 28 | return $this->query($out); 29 | } 30 | 31 | /** 32 | * This method used for disable interface ppp-sever 33 | * @param type $id string 34 | * @return type array 35 | */ 36 | public function disable_ppp_server($id){ 37 | $input = array( 38 | 'command' => '/interface/ppp-server/disable', 39 | 'id' => $id 40 | ); 41 | return $this->query($input); 42 | } 43 | 44 | /** 45 | * This method used for enable interface ppp-sever 46 | * @param type $id string 47 | * @return type array 48 | */ 49 | public function enable_ppp_server($id){ 50 | $input = array( 51 | 'command' => '/interface/ppp-server/enable', 52 | 'id' => $id 53 | ); 54 | return $this->query($input); 55 | } 56 | 57 | /** 58 | * This method used for delete interface ppp-sever 59 | * @param type $id string 60 | * @return type array 61 | */ 62 | public function delete_ppp_server($id){ 63 | $input = array( 64 | 'command' => '/interface/ppp-server/remove', 65 | 'id' => $id 66 | ); 67 | return $this->query($input); 68 | } 69 | 70 | /** 71 | * This method used for detail interface ppp-sever 72 | * @param type $id string 73 | * @return type array 74 | */ 75 | public function detail_ppp_server($id){ 76 | $input = array( 77 | 'command' => '/interface/ppp-server/print', 78 | 'id' => $id 79 | ); 80 | return $this->query($input); 81 | } 82 | 83 | /** 84 | * This method used for set or edit interface ppp-sever 85 | * @param type $param array 86 | * @param type $id string 87 | * @return type array 88 | */ 89 | public function set_ppp_server($param, $id){ 90 | $input = array( 91 | 'command' => '/interface/ppp-server/set', 92 | 'id' => $id 93 | ); 94 | $out = array_merge($input, $param); 95 | return $this->query($out); 96 | } 97 | 98 | /** 99 | * This method used for get all interface ppp-sever 100 | * @return type array 101 | */ 102 | public function get_all_ppp_server(){ 103 | return $this->query('/interface/ppp-server/getall'); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /libraries/mikrotik/interface/mapi_interface_pppoe_client.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Interface_Pppoe_Client extends Mapi_Query { 13 | /** 14 | * 15 | * @var type array 16 | */ 17 | private $param; 18 | 19 | function __construct($param) { 20 | $this->param = $param; 21 | parent::__construct($param); 22 | } 23 | 24 | /** 25 | * This method is used to add pppoe-client 26 | * @param type $param array 27 | * @return type array 28 | * 29 | */ 30 | public function add_pppoe_client($param){ 31 | $input = array( 32 | 'command' => '/interface/pppoe-client/add' 33 | ); 34 | $out = array_merge($input, $param); 35 | return $this->query($out); 36 | } 37 | 38 | /** 39 | * This method is used to display all pppoe-client 40 | * @return type array 41 | * 42 | */ 43 | public function get_all_pppoe_client(){ 44 | return $this->query('/interface/pppoe-client/getall'); 45 | } 46 | 47 | /** 48 | * This method is used to enable pppoe-client by id 49 | * @param type $id string 50 | * @return type array 51 | * 52 | */ 53 | public function enable_pppoe_client($id){ 54 | $input = array( 55 | 'command' => '/interface/pppoe-client/enable', 56 | 'id' => $id 57 | ); 58 | return $this->query($input); 59 | } 60 | 61 | /** 62 | * This method is used to disable pppoe-client by id 63 | * @param type $id string 64 | * @return type array 65 | * 66 | */ 67 | public function disable_pppoe_client($id){ 68 | $input = array( 69 | 'command' => '/interface/pppoe-client/disable', 70 | 'id' => $id 71 | ); 72 | return $this->query($input); 73 | } 74 | 75 | /** 76 | * This method is used to delete pppoe-client by id 77 | * @param type $id string 78 | * @return type array 79 | * 80 | */ 81 | public function delete_pppoe_client($id){ 82 | $input = array( 83 | 'command' => '/interface/pppoe-client/remove', 84 | 'id' => $id 85 | ); 86 | return $this->query($input); 87 | } 88 | 89 | /** 90 | * This method is used to set or edit by id 91 | * @param type $param array 92 | * @param type $id string 93 | * @return type array 94 | * 95 | */ 96 | public function set_pppoe_client($param, $id){ 97 | $input = array( 98 | 'command' => '/interface/pppoe-client/set', 99 | 'id' => $id 100 | ); 101 | $out=array_merge($input, $param); 102 | return $this->query($out); 103 | } 104 | 105 | /** 106 | * This method is used to display one pppoe-client 107 | * in detail based on the id 108 | * @param type $id string 109 | * @return type array 110 | */ 111 | public function detail_pppoe_client($id){ 112 | $input = array( 113 | 'command' => '/interface/pppoe-client/print', 114 | 'id' => $id 115 | ); 116 | return $this->query($input); 117 | } 118 | } 119 | 120 | 121 | -------------------------------------------------------------------------------- /libraries/mikrotik/interface/mapi_interface_pppoe_server.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Interface_Pppoe_Server extends Mapi_Query { 13 | /** 14 | * 15 | * @var type array 16 | */ 17 | private $param; 18 | 19 | function __construct($param) { 20 | $this->param = $param; 21 | parent::__construct($param); 22 | } 23 | 24 | /** 25 | * This method is used to add pppoe-server 26 | * @param type $param array 27 | * @return type array 28 | * 29 | */ 30 | public function add_pppoe_server($param){ 31 | $input = array( 32 | 'command' => '/interface/pppoe-server/server/add' 33 | ); 34 | $out = array_merge($input, $param); 35 | return $this->query($out); 36 | } 37 | 38 | /** 39 | * This method is used to disable pppoe-server by id 40 | * @param type $id string 41 | * @return type array 42 | * 43 | */ 44 | public function disable_pppoe_server($id){ 45 | $input = array( 46 | 'command' => '/interface/pppoe-server/server/disable', 47 | 'id' => $id 48 | ); 49 | return $this->query($input); 50 | } 51 | 52 | /** 53 | * This method is used to enable pppoe-server by id 54 | * @param type $id string 55 | * @return type array 56 | * 57 | */ 58 | public function enable_pppoe_server($id){ 59 | $input = array( 60 | 'command' => '/interface/pppoe-server/server/enable', 61 | 'id' => $id 62 | ); 63 | return $this->query($input); 64 | } 65 | 66 | /** 67 | * This method is used to set or edit by id 68 | * @param type $param array 69 | * @param type $id string 70 | * @return type array 71 | * 72 | */ 73 | public function set_pppoe_server($param, $id){ 74 | $input = array( 75 | 'command' => '/interface/pppoe-server/server/set', 76 | 'id' => $id 77 | ); 78 | $out=array_merge($input, $param); 79 | return $this->query($out); 80 | } 81 | 82 | /** 83 | * This method is used to delete pppoe-server by id 84 | * @param type $id string 85 | * @return type array 86 | * 87 | */ 88 | public function delete_pppoe_server($id){ 89 | $input = array( 90 | 'command' => '/interface/pppoe-server/server/remove', 91 | 'id' => $id 92 | ); 93 | return $this->query($input); 94 | } 95 | 96 | /** 97 | * This method is used to display all pppoe-server 98 | * @return type array 99 | * 100 | */ 101 | public function get_all_pppoe_server(){ 102 | return $this->query('/interface/pppoe-server/server/getall'); 103 | } 104 | 105 | /** 106 | * This method is used to display one pppoe-server 107 | * in detail based on the id 108 | * @param type $id string 109 | * @return type array 110 | * 111 | */ 112 | public function detail_pppoe_server($id){ 113 | $input = array( 114 | 'command' => '/interface/pppoe-server/server/print', 115 | 'id' => $id 116 | ); 117 | return $this->query($input); 118 | } 119 | } 120 | 121 | -------------------------------------------------------------------------------- /libraries/mikrotik/interface/mapi_interface_pptp_client.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Interface_Pptp_Client extends Mapi_Query { 13 | private $param; 14 | function __construct($param ) { 15 | $this->param = $param; 16 | parent::__construct($param); 17 | } 18 | 19 | /** 20 | * This method used for add new interface pptp-client 21 | * @param type $param array 22 | * @return type array 23 | */ 24 | public function add_pptp_client($param){ 25 | $input = array( 26 | 'command' => '/interface/pptp-client/add' 27 | ); 28 | $out = array_merge($input, $param); 29 | return $this->query($out); 30 | } 31 | 32 | /** 33 | * This method used for disable interface pptp-client 34 | * @param type $id string 35 | * @return type array 36 | */ 37 | public function disable_pptp_client($id){ 38 | $input = array( 39 | 'command' => '/interface/pptp-client/disable', 40 | 'id' => $id 41 | ); 42 | return $this->query($input); 43 | } 44 | 45 | /** 46 | * This method used for enable interface pptp-client 47 | * @param type $id string 48 | * @return type array 49 | */ 50 | public function enable_pptp_client($id){ 51 | $input = array( 52 | 'command' => '/interface/pptp-client/enable', 53 | 'id' => $id 54 | ); 55 | return $this->query($input); 56 | } 57 | 58 | /** 59 | * This method used for delete interface pptp-client 60 | * @param type $id string 61 | * @return type array 62 | */ 63 | public function delete_pptp_client($id){ 64 | $input = array( 65 | 'command' => '/interface/pptp-client/remove', 66 | 'id' => $id 67 | ); 68 | return $this->query($input); 69 | } 70 | 71 | /** 72 | * This method used for detail interface pptp-client 73 | * @param type $id string 74 | * @return type array 75 | */ 76 | public function detail_pptp_client($id){ 77 | $input = array( 78 | 'command' => '/interface/pptp-client/print', 79 | 'id' => $id 80 | ); 81 | return $this->query($input); 82 | } 83 | 84 | /** 85 | * This method used for set or edit interface pptp-client 86 | * @param type $param array 87 | * @param type $id string 88 | * @return type array 89 | */ 90 | public function set_pptp_client($param, $id){ 91 | $input = array( 92 | 'command' => '/interface/pptp-client/set', 93 | 'id' => $id 94 | ); 95 | $out = array_merge($input, $param); 96 | return $this->query($out); 97 | } 98 | 99 | /** 100 | * This method used for get all interface pptp-client 101 | * @return type array 102 | */ 103 | public function get_all_pptp_client(){ 104 | return $this->query('/interface/pptp-client/getall'); 105 | } 106 | } 107 | 108 | 109 | -------------------------------------------------------------------------------- /libraries/mikrotik/interface/mapi_interface_pptp_server.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Interface_Pptp_Server extends Mapi_Query { 13 | private $param; 14 | function __construct($param ) { 15 | $this->param = $param; 16 | parent::__construct($param); 17 | } 18 | /** 19 | * This method used for add new interface pptp-server 20 | * @param type $param array 21 | * @return type array 22 | */ 23 | public function add_pptp_server($param){ 24 | $input = array( 25 | 'command' => '/interface/pptp-server/add' 26 | ); 27 | $out = array_merge($input, $param); 28 | return $this->query($out); 29 | } 30 | 31 | /** 32 | * This method used for disable interface pptp-server 33 | * @param type $id string 34 | * @return type array 35 | */ 36 | public function disable_pptp_server($id){ 37 | $input = array( 38 | 'command' => '/interface/pptp-server/disable', 39 | 'id' => $id 40 | ); 41 | return $this->query($input); 42 | } 43 | 44 | /** 45 | * This method used for enable interface pptp-server 46 | * @param type $id string 47 | * @return type array 48 | */ 49 | public function enable_pptp_server($id){ 50 | $input = array( 51 | 'command' => '/interface/pptp-server/enable', 52 | 'id' => $id 53 | ); 54 | return $this->query($input); 55 | } 56 | 57 | /** 58 | * This method used for delete interface pptp-server 59 | * @param type $id string 60 | * @return type array 61 | */ 62 | public function delete_pptp_server($id){ 63 | $input = array( 64 | 'command' => '/interface/pptp-server/remove', 65 | 'id' => $id 66 | ); 67 | return $this->query($input); 68 | } 69 | 70 | /** 71 | * This method used for detail interface pptp-server 72 | * @param type $id string 73 | * @return type array 74 | */ 75 | public function detail_pptp_server($id){ 76 | $input = array( 77 | 'command' => '/interface/pptp-server/print', 78 | 'id' => $id 79 | ); 80 | return $this->query($input); 81 | } 82 | 83 | /** 84 | * This method used for set or edit interface pptp-server 85 | * @param type $param array 86 | * @param type $id string 87 | * @return type array 88 | */ 89 | public function set_pptp_server($param, $id){ 90 | $input = array( 91 | 'command' => '/interface/pptp-server/set', 92 | 'id' => $id 93 | ); 94 | $out = array_merge($input, $param); 95 | return $this->query($out); 96 | } 97 | 98 | /** 99 | * This method used for get all interface pptp-server 100 | * @return type array 101 | */ 102 | public function get_all_pptp_server(){ 103 | return $this->query('/interface/pptp-server/getall'); 104 | } 105 | 106 | /** 107 | * This method used for get all pptp-server server 108 | * @return type array 109 | */ 110 | public function get_all_pptp_server_server(){ 111 | return $this->query('/interface/pptp-server/server/getall'); 112 | } 113 | 114 | /** 115 | * This method used for set pptp-server server 116 | * @param type $param array 117 | * @return type array 118 | */ 119 | public function set_pptp_server_server($param){ 120 | $input = array( 121 | 'command' => '/interface/pptp-server/server/set' 122 | ); 123 | $out = array_merge($input, $param); 124 | return $this->query($out); 125 | 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /libraries/mikrotik/interface/mapi_interface_vlan.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Interface_Vlan extends Mapi_Query { 13 | /** 14 | * 15 | * @var type array 16 | */ 17 | private $param; 18 | 19 | function __construct($param ) { 20 | $this->param = $param; 21 | parent::__construct($param); 22 | } 23 | 24 | /** 25 | * This method is used to add vlan 26 | * @param type $param array 27 | * @return type array 28 | * 29 | */ 30 | public function add_vlan($param){ 31 | $input = array( 32 | 'command' => '/interface/vlan/add' 33 | ); 34 | $out = array_merge($input, $param); 35 | return $this->query($out); 36 | } 37 | 38 | /** 39 | * This method is used to display all vlan 40 | * @return type array 41 | * 42 | */ 43 | public function get_all_vlan(){ 44 | return $this->query('/interface/vlan/getall'); 45 | } 46 | 47 | 48 | /** 49 | * This method is used to enable vlan by id 50 | * @param type $id string 51 | * @return type array 52 | * 53 | */ 54 | public function enable_vlan($id){ 55 | $input = array( 56 | 'command' => '/interface/vlan/enable', 57 | 'id' => $id 58 | ); 59 | return $this->query($input); 60 | } 61 | 62 | /** 63 | * This method is used to disable vlan by id 64 | * @param type $id string 65 | * @return type array 66 | * 67 | */ 68 | public function disable_vlan($id){ 69 | $input = array( 70 | 'command' => '/interface/vlan/disable', 71 | 'id' => $id 72 | ); 73 | return $this->query($input); 74 | } 75 | 76 | /** 77 | * This method is used to delete vlan by id 78 | * @param type $id string 79 | * @return type array 80 | * 81 | */ 82 | public function delete_vlan($id){ 83 | $input = array( 84 | 'command' => '/interface/vlan/remove', 85 | 'id' => $id 86 | ); 87 | return $this->query($input); 88 | } 89 | 90 | /** 91 | * This method is used to set or edit by id 92 | * @param type $param array 93 | * @param type $id string 94 | * @return type array 95 | * 96 | */ 97 | public function set_vlan($param, $id){ 98 | $input = array( 99 | 'command' => '/interface/vlan/set', 100 | 'id' => $id 101 | ); 102 | $out=array_merge($input, $param); 103 | return $this->query($out); 104 | } 105 | 106 | /** 107 | * This method is used to display one vlan 108 | * in detail based on the id 109 | * @param type $id string 110 | * @return type array 111 | * 112 | */ 113 | public function detail_vlan($id){ 114 | $input = array( 115 | 'command' => '/interface/vlan/print', 116 | 'id' => $id 117 | ); 118 | return $this->query($input); 119 | } 120 | } 121 | 122 | -------------------------------------------------------------------------------- /libraries/mikrotik/interface/mapi_interface_vrrp.php: -------------------------------------------------------------------------------- 1 | 6 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 7 | * @copyright Copyright (c) 2011, Virtual Think Team. 8 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 9 | * @category Libraries 10 | */ 11 | class Mapi_Interface_Vrrp extends Mapi_Query { 12 | /** 13 | * 14 | * @var type array 15 | */ 16 | private $param; 17 | 18 | function __construct($param ) { 19 | $this->param = $param; 20 | parent::__construct($param); 21 | } 22 | 23 | /** 24 | * This method is used to to add vrrp 25 | * @param type $param array 26 | * @return type array 27 | * 28 | */ 29 | public function add_vrrp($param){ 30 | $input = array( 31 | 'command' => '/interface/vrrp/add' 32 | ); 33 | $out = array_merge($input, $param); 34 | return $this->query($out); 35 | } 36 | 37 | 38 | /** 39 | * This method is used to display all vrrp 40 | * @return type array 41 | * 42 | */ 43 | public function get_all_vrrp(){ 44 | return $this->query('/interface/vrrp/getall'); 45 | } 46 | 47 | 48 | /** 49 | * This method is used to to enable vrrp by id 50 | * @param type $id string 51 | * @return type array 52 | * 53 | */ 54 | public function enable_vrrp($id){ 55 | $input = array( 56 | 'command' => '/interface/vrrp/enable', 57 | 'id' => $id 58 | ); 59 | return $this->query($input); 60 | } 61 | 62 | /** 63 | * This method is used to to disable vrrp by id 64 | * @param type $id string 65 | * @return type array 66 | * 67 | */ 68 | public function disable_vrrp($id){ 69 | $input = array( 70 | 'command' => '/interface/vrrp/disable', 71 | 'id' => $id 72 | ); 73 | return $this->query($input); 74 | } 75 | 76 | /** 77 | * This method is used to to delete vrrp by id 78 | * @param type $id string 79 | * @return type array 80 | * 81 | */ 82 | public function delete_vrrp($id){ 83 | $input = array( 84 | 'command' => '/interface/vrrp/remove', 85 | 'id' => $id 86 | ); 87 | return $this->query($input); 88 | } 89 | 90 | /** 91 | * This method is used to change based on the id 92 | * @param type $param array 93 | * @param type $id string 94 | * @return type array 95 | * 96 | */ 97 | public function set_vrrp($param, $id){ 98 | $input = array( 99 | 'command' => '/interface/vrrp/set', 100 | 'id' => $id 101 | ); 102 | $out=array_merge($input, $param); 103 | return $this->query($out); 104 | } 105 | 106 | /** 107 | * This method is used to display one vrrp 108 | * in detail based on the id 109 | * @param type $id string 110 | * @return type array 111 | * 112 | */ 113 | public function detail_vrrp($id){ 114 | $input = array( 115 | 'command' => '/interface/vrrp/print', 116 | 'id' => $id 117 | ); 118 | return $this->query($input); 119 | } 120 | } -------------------------------------------------------------------------------- /libraries/mikrotik/interface/mapi_interfaces.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Interfaces { 13 | /** 14 | * 15 | * @var type array 16 | */ 17 | private $param; 18 | 19 | function __construct($param = array()) { 20 | $this->param = $param; 21 | } 22 | 23 | /** 24 | * This method is used to call class Mapi_Interface_Ethetrnet 25 | * @return Mapi_Ip 26 | */ 27 | public function ethernet(){ 28 | return new Mapi_Interface_Ethernet($this->param); 29 | } 30 | 31 | /** 32 | * This method is used to call class Mapi_Interface_Pppoe_Client 33 | * @return Mapi_Ip 34 | */ 35 | public function pppoe_client(){ 36 | return new Mapi_Interface_Pppoe_Client($this->param); 37 | } 38 | 39 | /** 40 | * This method is used to call class Mapi_Interface_Pppoe_Server 41 | * @return Mapi_Ip 42 | */ 43 | public function pppoe_server(){ 44 | return new Mapi_Interface_Pppoe_Server($this->param); 45 | } 46 | 47 | /** 48 | * This method is used to call class Mapi_Interface_Eoip 49 | * @return Mapi_Ip 50 | */ 51 | public function eoip(){ 52 | return new Mapi_Interface_Eoip($this->param); 53 | 54 | } 55 | 56 | /** 57 | * This method is used to call class Mapi_Interface_Ipip 58 | * @return Mapi_Ip 59 | */ 60 | public function ipip(){ 61 | return new Mapi_Interface_Ipip($this->param); 62 | } 63 | 64 | /** 65 | * This method is used to call class Mapi_Interface_Vlan 66 | * @return Mapi_Ip 67 | */ 68 | public function vlan(){ 69 | return new Mapi_Interface_Vlan($this->param); 70 | } 71 | 72 | /** 73 | * This method is used to call class Mapi_Interface_Vrrp 74 | * @return Mapi_Ip 75 | */ 76 | public function vrrp(){ 77 | return new Mapi_Interface_Vrrp($this->param); 78 | } 79 | 80 | /** 81 | * This method is used to call class Mapi_Interface_Bonding 82 | * @return Mapi_Ip 83 | */ 84 | public function bonding(){ 85 | return new Mapi_Interface_Bonding($this->param); 86 | } 87 | 88 | /** 89 | * This method for used call class Mapi_Interface_Bridge 90 | * @return Mapi_Ip 91 | */ 92 | public function bridge(){ 93 | return new Mapi_Interface_Bridge($this->param); 94 | } 95 | 96 | /** 97 | * This method used call class Mapi_Interface_L2tp_Client 98 | * @return Mapi_Ip 99 | */ 100 | public function l2tp_client(){ 101 | return new Mapi_Interface_L2tp_Client($this->param); 102 | } 103 | 104 | /** 105 | * This method used call class Mapi_Interface_L2tp_Server 106 | * @return Mapi_Ip 107 | */ 108 | public function l2tp_server(){ 109 | return new Mapi_Interface_L2tp_Server($this->param); 110 | } 111 | 112 | /** 113 | * This method used call class Mapi_Interface_Ppp_Client 114 | * @return Mapi_Ip 115 | */ 116 | public function ppp_client(){ 117 | return new Mapi_Interface_Ppp_Client($this->param); 118 | } 119 | 120 | /** 121 | * This method used call class Mapi_Interface_Ppp_Server 122 | * @return Mapi_Ip 123 | */ 124 | public function ppp_server(){ 125 | return new Mapi_Interface_Ppp_Server($this->param); 126 | } 127 | 128 | /** 129 | * This method used call class Mapi_Interface_Pptp_Client 130 | * @return Mapi_Ip 131 | */ 132 | public function pptp_client(){ 133 | return new Mapi_Interface_Pptp_Client($this->param); 134 | } 135 | 136 | /** 137 | * This method used call class Mapi_Interface_Pptp_Server 138 | * @return Mapi_Ip 139 | */ 140 | public function pptp_server(){ 141 | return new Mapi_Interface_Pptp_Server($this->param); 142 | } 143 | 144 | } 145 | 146 | -------------------------------------------------------------------------------- /libraries/mikrotik/ip/mapi_ip.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Ip{ 13 | /** 14 | * 15 | * @var type array 16 | */ 17 | private $param; 18 | 19 | function __construct($param=array()) { 20 | $this->param = $param; 21 | } 22 | 23 | /** 24 | * This method is used toclass Mapi_Ip_Address 25 | * @return Object of Mapi_Ip_Address class 26 | */ 27 | public function address(){ 28 | return new Mapi_Ip_Address($this->param); 29 | } 30 | 31 | /** 32 | * This method is used toclass Mapi_Ip_Hotspot 33 | * @return Object of Mapi_Ip_Hotspot class 34 | */ 35 | public function hotspot(){ 36 | return new Mapi_Ip_Hotspot($this->param); 37 | } 38 | 39 | /** 40 | * This method is used toclass Mapi_Ip_Pool 41 | * @return Object of Mapi_Ip_Pool class 42 | */ 43 | public function pool(){ 44 | return new Mapi_Ip_Pool($this->param); 45 | } 46 | 47 | /** 48 | * This method is used toclass Mapi_Ip_Dns 49 | * @return Object of Mapi_Ip_Dns class 50 | */ 51 | public function dns(){ 52 | return new Mapi_Ip_Dns($this->param); 53 | } 54 | 55 | /** 56 | * This method is used toclass Mapi_Ip_Firewall 57 | * @return Object of Mapi_Ip_Firewall class 58 | */ 59 | public function firewall(){ 60 | return new Mapi_Ip_Firewall($this->param); 61 | } 62 | 63 | /** 64 | * This method is used toclass Mapi_Ip_Accounting 65 | * @return Object of Mapi_Ip_Accounting class 66 | */ 67 | public function accounting(){ 68 | return new Mapi_Ip_Accounting($this->param); 69 | 70 | } 71 | 72 | /** 73 | * This method is used toclass Mapi_Ip_Arp 74 | * @return Object of Mapi_Ip_Arp class 75 | */ 76 | public function arp(){ 77 | return new Mapi_Ip_Arp($this->param); 78 | } 79 | 80 | /** 81 | * This method is used toclass Mapi_Ip_Dhcp_Client 82 | * @return Object of Mapi_Ip _Dhcp_Client class 83 | */ 84 | public function dhcp_client(){ 85 | return new Mapi_Ip_Dhcp_Client($this->param); 86 | } 87 | 88 | /** 89 | * This method is used toclass Mapi_Ip_Dhcp_Relay 90 | * @return Object of Mapi_Ip_Dhcp_Relay class 91 | */ 92 | public function dhcp_relay(){ 93 | return new Mapi_Ip_Dhcp_Relay($this->param); 94 | } 95 | 96 | /** 97 | * This method is used toclass Mapi_Ip_Dhcp_Server 98 | * @return Object of Mapi_Ip_Dhcp_Server class 99 | */ 100 | public function dhcp_server(){ 101 | return new Mapi_Ip_Dhcp_Server($this->param); 102 | } 103 | 104 | /** 105 | * This method is used toclass Mapi_Ip_Route 106 | * @return Object if Mapi_Ip_Router class 107 | */ 108 | public function route(){ 109 | return new Mapi_Ip_Route($this->param); 110 | } 111 | 112 | /** 113 | * This method is used toclass Mapi_Ip_Service 114 | * @return Object of Mapi_Ip_Service class 115 | */ 116 | public function service(){ 117 | return new Mapi_Ip_Service($this->param); 118 | 119 | } 120 | 121 | /** 122 | *This method is used to class Mapi_Ip_Proxy 123 | * @return object of Mapi_Ip_Proxy class 124 | */ 125 | public function proxy(){ 126 | return new Mapi_Ip_Proxy($this->param); 127 | 128 | } 129 | 130 | } 131 | 132 | -------------------------------------------------------------------------------- /libraries/mikrotik/ip/mapi_ip_accounting.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Ip_Accounting extends Mapi_Query{ 13 | /** 14 | * 15 | * @var type array 16 | */ 17 | private $param; 18 | 19 | function __construct($param) { 20 | $this->param = $param; 21 | parent::__construct($param); 22 | } 23 | 24 | /** 25 | * This method is used to set or edit ip accountng 26 | * @param type $account_local_traffic string 27 | * @param type $enabled string 28 | * @param type $threshold string 29 | * @return type array 30 | */ 31 | public function set_accounting($account_local_traffic, $enabled, $threshold){ 32 | $input = array( 33 | 'command' => '/ip/accounting/set', 34 | 'account-local-traffic' => $account_local_traffic, 35 | 'enabled' => $enabled, 36 | 'threshold' => $threshold 37 | ); 38 | return $this->query($input); 39 | } 40 | 41 | /** 42 | * This method is used to display all accounting 43 | * @return type array 44 | * 45 | */ 46 | public function get_all_accounting(){ 47 | return $this->query('/ip/accounting/getall'); 48 | } 49 | 50 | /** 51 | * This method is used to display all snapshot 52 | * @return type array 53 | * 54 | */ 55 | public function get_all_snapshot(){ 56 | return $this->query('/ip/accounting/snapshot/getall'); 57 | } 58 | 59 | /** 60 | * This method is used to display all uncounted 61 | * @return type array 62 | * 63 | */ 64 | public function get_all_uncounted(){ 65 | return $this->query('/ip/accounting/uncounted/getall'); 66 | } 67 | 68 | /** 69 | * This method is used to display all web-acces 70 | * @return type array 71 | * 72 | */ 73 | public function get_all_web_access(){ 74 | return $this->query('/ip/accounting/web-access/getall'); 75 | } 76 | /** 77 | * This method is used to ip accounting set web-acces 78 | * @param type $accessible_via_web string default : yes or no 79 | * @return type array 80 | * 81 | */ 82 | public function set_web_access($accessible_via_web){ 83 | $input = array( 84 | 'command' => '/ip/accounting/web-access/set', 85 | 'accessible-via-web' => $accessible_via_web, 86 | 'address' => '0.0.0.0/0' 87 | ); 88 | return $this->query($input); 89 | } 90 | } 91 | 92 | -------------------------------------------------------------------------------- /libraries/mikrotik/ip/mapi_ip_address.php: -------------------------------------------------------------------------------- 1 | 6 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 7 | * @copyright Copyright (c) 2011, Virtual Think Team. 8 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 9 | * @category Libraries 10 | */ 11 | class Mapi_Ip_Address extends Mapi_Query{ 12 | /** 13 | * 14 | * @var type array 15 | */ 16 | private $param; 17 | 18 | function __construct($param) { 19 | $this->param = $param; 20 | parent::__construct($param); 21 | } 22 | 23 | /** 24 | * This method is used to add the ip address 25 | * @param type $param array 26 | * @return type array 27 | * 28 | */ 29 | public function add_address($param){ 30 | $input=array( 31 | 'command' => '/ip/address/add' 32 | ); 33 | $out=array_merge($input, $param); 34 | return $this->query($out); 35 | } 36 | /** 37 | * This method is used to display all ip address 38 | * @return type array 39 | * 40 | */ 41 | public function get_all_address(){ 42 | return $this->query('/ip/address/getall'); 43 | } 44 | 45 | /** 46 | * This method is used to activate the ip address by id 47 | * @param type $id is not an array 48 | * @return type array 49 | * 50 | * 51 | */ 52 | public function enable_address($id){ 53 | $input = array( 54 | 'command' => '/ip/address/enable', 55 | 'id' => $id 56 | ); 57 | return $this->query($input); 58 | } 59 | 60 | /** 61 | * This method is used to disable ip address by id 62 | * @param type $id string 63 | * @return type array 64 | * 65 | * 66 | */ 67 | public function disable_address($id){ 68 | $input = array( 69 | 'command' => '/ip/address/disable', 70 | 'id' => $id 71 | ); 72 | return $this->query($input); 73 | } 74 | 75 | /** 76 | * This method is used to remove the ip address by id 77 | * @param type $id is not an array 78 | * @return type array 79 | * 80 | */ 81 | public function delete_address($id){ 82 | $input = array( 83 | 'command' => '/ip/address/remove', 84 | 'id' => $id 85 | ); 86 | return $this->query($input); 87 | } 88 | 89 | /** 90 | * This method is used to set or edit by id 91 | * @param type $param array 92 | * @return type array 93 | * 94 | */ 95 | public function set_address($param, $id){ 96 | $input = array( 97 | 'command' => '/ip/address/set', 98 | 'id' => $id 99 | ); 100 | $out=array_merge($input, $param); 101 | return $this->query($out); 102 | } 103 | 104 | /** 105 | * This method is used to display one ip address 106 | * in detail based on the id 107 | * @param type $id not array 108 | * @return type array 109 | * 110 | */ 111 | public function detail_address($id){ 112 | $input = array( 113 | 'command' => '/ip/address/print', 114 | 'id' => $id 115 | ); 116 | return $this->query($input); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /libraries/mikrotik/ip/mapi_ip_arp.php: -------------------------------------------------------------------------------- 1 | 6 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 7 | * @copyright Copyright (c) 2011, Virtual Think Team. 8 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 9 | * @category Libraries 10 | */ 11 | class Mapi_Ip_Arp extends Mapi_Query { 12 | /** 13 | * 14 | * @var type array 15 | */ 16 | private $param; 17 | 18 | function __construct($param) { 19 | $this->param = $param; 20 | parent::__construct($param); 21 | } 22 | 23 | /** 24 | * This method is used to add arp 25 | * @param type $param array 26 | * @return type array 27 | * j 28 | */ 29 | public function add_arp($param){ 30 | $input = array( 31 | 'command' => '/ip/arp/add' 32 | ); 33 | $out = array_merge($input, $param); 34 | return $this->query($out); 35 | } 36 | 37 | /** 38 | * This method is used to delete arp by id 39 | * @param type $id string 40 | * @return type array 41 | * 42 | */ 43 | public function delete_arp($id){ 44 | $input = array( 45 | 'command' => '/ip/arp/remove', 46 | 'id' => $id 47 | ); 48 | return $this->query($input); 49 | } 50 | 51 | /** 52 | * This method is used to enable arp by id 53 | * @param type $id string 54 | * @return type array 55 | * 56 | */ 57 | public function enable_arp($id){ 58 | $input = array( 59 | 'command' => '/ip/arp/enable', 60 | 'id' => $id 61 | ); 62 | return $this->query($input); 63 | } 64 | 65 | /** 66 | * This method is used to disable arp by id 67 | * @param type $id string 68 | * @return type array 69 | * 70 | */ 71 | public function disable($id){ 72 | $input = array( 73 | 'command' => '/ip/arp/disable', 74 | 'id' => $id 75 | ); 76 | return $this->query($input); 77 | } 78 | 79 | /** 80 | * This method is used to set or edit by id 81 | * @param type $param array 82 | * @param type $id string 83 | * @return type array 84 | * 85 | */ 86 | public function set_arp($param, $id){ 87 | $input = array( 88 | 'command' => '/ip/arp/set', 89 | 'id' => $id 90 | ); 91 | $out = array_merge($input, $param); 92 | return $this->query($out); 93 | 94 | } 95 | 96 | /** 97 | * This method is used to display all arp 98 | * @return type array 99 | * 100 | */ 101 | public function get_all_arp(){ 102 | return $this->query('/ip/arp/getall'); 103 | } 104 | 105 | /** 106 | * This method is used to display arp 107 | * in detail based on the id 108 | * @param type $id string 109 | * @return type array 110 | * 111 | */ 112 | public function detail_arp($id){ 113 | $input = array( 114 | 'command' => '/ip/arp/print', 115 | 'id' => $id 116 | ); 117 | return $this->query($input); 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /libraries/mikrotik/ip/mapi_ip_dhcp_client.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Ip_Dhcp_Client extends Mapi_Query { 13 | /** 14 | * 15 | * @var type 16 | */ 17 | private $param; 18 | 19 | function __construct($param ) { 20 | $this->param = $param; 21 | parent::__construct($param); 22 | } 23 | 24 | /** 25 | * This method is used to add dhcp client 26 | * @param type $param array 27 | * @return type array 28 | */ 29 | public function add_dhcp_client($param){ 30 | $input = array( 31 | 'command' => '/ip/dhcp-client/add' 32 | ); 33 | $out = array_merge($input, $param); 34 | return $this->query($out); 35 | } 36 | 37 | /** 38 | * This method is used to disable dhcp client by id 39 | * @param type $id string 40 | * @return type array 41 | */ 42 | public function disable_dhcp_client($id){ 43 | $input = array( 44 | 'command' => '/ip/dhcp-client/disable', 45 | 'id' => $id 46 | ); 47 | return $this->query($input); 48 | } 49 | 50 | /** 51 | * This method is used to enable dhcp client by id 52 | * @param type $id string 53 | * @return type array 54 | */ 55 | public function enable_dhcp_client($id){ 56 | $input = array( 57 | 'command' => '/ip/dhcp-client/enable', 58 | 'id' => $id 59 | ); 60 | return $this->query($input); 61 | } 62 | 63 | /** 64 | * This method is used to renew dhcp client by id 65 | * @param type $id string 66 | * @return type array 67 | */ 68 | public function renew_dhcp_client($id){ 69 | $input = array( 70 | 'command' => '/ip/dhcp-client/renew', 71 | 'id' => $id 72 | ); 73 | return $this->query($input); 74 | } 75 | 76 | /** 77 | * This method is used to release dhcp client by id 78 | * @param type $id string 79 | * @return type array 80 | */ 81 | public function release_dhcp_client($id){ 82 | $input = array( 83 | 'command' => '/ip/dhcp-client/release', 84 | 'id' => $id 85 | ); 86 | return $this->query($input); 87 | } 88 | 89 | /** 90 | * This method is used to set or edit dhcp client by id 91 | * @param type $param array 92 | * @param type $id string 93 | * @return type array 94 | */ 95 | public function set_dhcp_client($param, $id){ 96 | $input = array( 97 | 'command' => '/ip/dhcp-client/set', 98 | 'id' => $id 99 | ); 100 | $out = array_merge($input, $param); 101 | return $this->query($out); 102 | } 103 | 104 | /** 105 | * This method is used to remove dhcp client by id 106 | * @param type $id string 107 | * @return type array 108 | */ 109 | public function delete_dhcp_client($id){ 110 | $input = array( 111 | 'command' => '/ip/dhcp-client/remove', 112 | 'id' => $id 113 | ); 114 | return $this->query($input); 115 | } 116 | 117 | /** 118 | * This method is used to display all dhcp client 119 | * @return type array 120 | */ 121 | public function get_all_dhcp_client(){ 122 | return $this->query('/ip/dhcp-client/getall'); 123 | } 124 | 125 | /** 126 | * This method is used to display one ip dhcp client 127 | * in detail based on the id 128 | * @param type $id string 129 | * @return type array 130 | */ 131 | public function detail_dhcp_client($id){ 132 | $input = array( 133 | 'command' => '/ip/dhcp-client/print', 134 | 'id' => $id 135 | ); 136 | return $this->query($input); 137 | } 138 | } 139 | 140 | -------------------------------------------------------------------------------- /libraries/mikrotik/ip/mapi_ip_dhcp_relay.php: -------------------------------------------------------------------------------- 1 | 6 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 7 | * @copyright Copyright (c) 2011, Virtual Think Team. 8 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 9 | * @category Libraries 10 | */ 11 | class Mapi_Ip_Dhcp_Relay extends Mapi_Query { 12 | /** 13 | * 14 | * @var type 15 | */ 16 | private $param; 17 | 18 | function __construct($param) { 19 | $this->param = $param; 20 | parent::__construct($param); 21 | } 22 | 23 | /** 24 | * This method is used to ip add dhcp relay 25 | * @param type $param array 26 | * @return type array 27 | */ 28 | public function add_dhcp_relay($param){ 29 | $input = array( 30 | 'command' => '/ip/dhcp-relay/add' 31 | ); 32 | $out = array_merge($input, $param); 33 | return $this->query($out); 34 | } 35 | 36 | /** 37 | * This method is used to disable ip dhcp relay by id 38 | * @param type $id string 39 | * @return type array 40 | */ 41 | public function disable_dhcp_relay($id){ 42 | $input = array( 43 | 'command' => '/ip/dhcp-relay/disable', 44 | 'id' => $id 45 | ); 46 | return $this->query($input); 47 | } 48 | 49 | /** 50 | * This method is used to enable ip dhcp relay by id 51 | * @param type $id string 52 | * @return type array 53 | */ 54 | public function enable_dhcp_relay($id){ 55 | $input = array( 56 | 'command' => '/ip/dhcp-relay/enable', 57 | 'id' => $id 58 | ); 59 | return $this->query($input); 60 | } 61 | 62 | /** 63 | * This method is used to set or edit ip dhcp relay by id 64 | * @param type $param array 65 | * @param type $id string 66 | * @return type array 67 | */ 68 | public function set_dhcp_relay($param, $id){ 69 | $input = array( 70 | 'command' => '/ip/dhcp-relay/set', 71 | 'id' => $id 72 | ); 73 | $out = array_merge($input, $param); 74 | return $this->query($out); 75 | } 76 | 77 | /** 78 | * This method is used to remove ip dhcp relay by id 79 | * @param type $id string 80 | * @return type array 81 | */ 82 | public function delete_dhcp_relay($id){ 83 | $input = array( 84 | 'command' => '/ip/dhcp-relay/remove', 85 | 'id' => $id 86 | ); 87 | return $this->query($input); 88 | } 89 | 90 | /** 91 | * This method is used to display one interface bonding 92 | * in detail based on the id 93 | * @param type $id string 94 | * @return type array 95 | */ 96 | public function detail_dhcp_relay($id){ 97 | $input = array( 98 | 'command' => '/ip/dhcp-relay/print', 99 | 'id' => $id 100 | ); 101 | return $this->query($input); 102 | } 103 | 104 | /** 105 | * This method is used to display all ip dhcp relay 106 | * @return type array 107 | */ 108 | public function get_all_dhcp_relay(){ 109 | return $this->query('/ip/dhcp-relay/getall'); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /libraries/mikrotik/ip/mapi_ip_dhcp_server.php: -------------------------------------------------------------------------------- 1 | 6 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 7 | * @copyright Copyright (c) 2011, Virtual Think Team. 8 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 9 | * @category Libraries 10 | */ 11 | class Mapi_Ip_Dhcp_Server extends Mapi_Query { 12 | /** 13 | * 14 | * @var type array 15 | */ 16 | private $param; 17 | 18 | function __construct($param) { 19 | $this->param = $param; 20 | parent::__construct($param); 21 | } 22 | 23 | /** 24 | * This methode is used to add ip dhcp server network 25 | * @param type $param array 26 | * @return type array 27 | */ 28 | public function add_dhcp_server_network($param){ 29 | $input = array( 30 | 'command' => '/ip/dhcp-server/network/add' 31 | ); 32 | $out = array_merge($input, $param); 33 | return $this->query($out); 34 | } 35 | 36 | /** 37 | * This methode is used to add ip dhcp server 38 | * @param type $param array 39 | * @return type \array 40 | */ 41 | public function add_dhcp_server($param){ 42 | $input = array( 43 | 'command' => '/ip/dhcp-server/add' 44 | ); 45 | $out = array_merge($input, $param); 46 | return $this->query($out); 47 | } 48 | 49 | /** 50 | * This methode is used to set ip dhcp server config 51 | * @param type $store_leases_disk string 52 | * @return type array 53 | */ 54 | public function set_dhcp_server_config($store_leases_disk){ 55 | $input = array( 56 | 'command' => '/ip/dhcp-server/config/set', 57 | 'store-leases-disk' => $store_leases_disk 58 | ); 59 | return $this->query($input); 60 | } 61 | 62 | /** 63 | * This methode is used to set or edit ip dhcp server network 64 | * by id 65 | * @param type $param array 66 | * @param type $id string 67 | * @return type array 68 | */ 69 | public function set_dhcp_server_network($param, $id){ 70 | $input = array( 71 | 'command' => '/ip/dhcp-server/network/set', 72 | 'id' => $id 73 | ); 74 | $out = array_merge($input, $param); 75 | return $this->query($out); 76 | } 77 | 78 | /** 79 | * This methode is used to display all ip dhcp server network 80 | * @return type array 81 | */ 82 | public function get_all_dhcp_server_network(){ 83 | return $this->query('/ip/dhcp-server/network/getall'); 84 | } 85 | 86 | /** 87 | * This methode is used to delete ip dhcp server network by id 88 | * @param type $id string 89 | * @return type array 90 | */ 91 | public function delete_dhcp_server_network($id){ 92 | $input = array( 93 | 'command' => '/ip/dhcp-server/network/remove', 94 | 'id' => $id 95 | ); 96 | return $this->query($input); 97 | } 98 | /** 99 | * This method is used to display one ip dhcp server network 100 | * in detail based on the id 101 | * @param type $id string 102 | * @return type array 103 | */ 104 | public function detail_dhcp_server_network($id){ 105 | $input = array( 106 | 'command' => '/ip/dhcp-server/network/print', 107 | 'id' => $id 108 | ); 109 | return $this->query($input); 110 | } 111 | 112 | /** 113 | * This methode is used to disable ip dhcp server by id 114 | * @param type $id string 115 | * @return type array 116 | */ 117 | public function disable_dhcp_server($id){ 118 | $input = array( 119 | 'command' => '/ip/dhcp-server/disable', 120 | 'id' => $id 121 | ); 122 | return $this->query($input); 123 | } 124 | 125 | /** 126 | * This methode is used to enable ip dhcp server by id 127 | * @param type $id string 128 | * @return type array 129 | */ 130 | public function enable_dhcp_server($id){ 131 | $input = array( 132 | 'command' => '/ip/dhcp-server/enable', 133 | 'id' => $id 134 | ); 135 | return $this->query($input); 136 | } 137 | 138 | /** 139 | * This methode is used to remove ip dhcp server by id 140 | * @param type $id string 141 | * @return type array 142 | */ 143 | public function delete_dhcp_server($id){ 144 | $input = array( 145 | 'command' => '/ip/dhcp-server/remove', 146 | 'id' => $id 147 | ); 148 | return $this->query($input); 149 | } 150 | 151 | /** 152 | * This methode is used to det or edit ip dhcp server by id 153 | * @param type $param array 154 | * @param type $id string 155 | * @return type array 156 | */ 157 | public function set_dhcp_server($param, $id){ 158 | $input = array( 159 | 'command' => '/ip/dhcp-server/set', 160 | 'id' => $id 161 | ); 162 | $out = array_merge($input, $param); 163 | return $this->query($out); 164 | } 165 | 166 | /** 167 | * This methode is used to display all ip dhcp server 168 | * @return type array 169 | */ 170 | public function get_all_dhcp_server(){ 171 | return $this->query('/ip/dhcp-server/getall'); 172 | } 173 | 174 | /** 175 | * This method is used to display one ip dhcp server 176 | * in detail based on the id 177 | * @param type $id string 178 | * @return type array 179 | */ 180 | public function detail_dhcp_server($id){ 181 | $input = array( 182 | 'command' => '/ip/dhcp-server/print', 183 | 'id' => $id 184 | ); 185 | return $this->query($input); 186 | } 187 | 188 | public function get_all_dhcp_server_config(){ 189 | return $this->query('/ip/dhcp-server/config/getall'); 190 | } 191 | 192 | } 193 | -------------------------------------------------------------------------------- /libraries/mikrotik/ip/mapi_ip_dns.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Ip_Dns extends Mapi_Query { 13 | /** 14 | * 15 | * @var type array 16 | */ 17 | private $param; 18 | 19 | function __construct($param){ 20 | $this->param = $param; 21 | parent::__construct($param); 22 | } 23 | 24 | /** 25 | * This method is used to configure dns 26 | * @param type $servers string example : '192.168.1.1,192.168.2.1' 27 | * @return type array 28 | * 29 | */ 30 | public function set_dns($servers){ 31 | $input = array( 32 | 'command' => '/ip/dns/set', 33 | 'servers' => $servers 34 | ); 35 | return $this->query($input); 36 | } 37 | 38 | /** 39 | * This method is used to display 40 | * all dns 41 | * @return type array 42 | * 43 | */ 44 | public function get_all_dns(){ 45 | return $this->query('/ip/dns/getall'); 46 | } 47 | 48 | /** 49 | * This method is used to add the static dns 50 | * @param type $param array 51 | * @return type array 52 | * 53 | */ 54 | public function add_dns_static($param){ 55 | $input = array( 56 | 'command' => '/ip/dns/static/add' 57 | ); 58 | $out = array_merge($input, $param); 59 | return $this->query($out); 60 | } 61 | /** 62 | * This method is used to display 63 | * all static dns 64 | * @return type array 65 | * 66 | */ 67 | public function get_all_static_dns(){ 68 | return $this->query('/ip/dns/static/getall'); 69 | } 70 | 71 | /** 72 | * This method is used to display one static dns 73 | * in detail based on the id 74 | * @param type $id string 75 | * @return type array 76 | * 77 | */ 78 | public function detail_static_dns($id){ 79 | $input = array( 80 | 'command' => '/ip/dns/static/print', 81 | 'id' => $id 82 | ); 83 | return $this->query($input); 84 | } 85 | 86 | /** 87 | * This method is used to change based on the id 88 | * @param type $param array 89 | * @param type $id string 90 | * @return type array 91 | * 92 | */ 93 | public function set_static_dns($param, $id){ 94 | $input = array( 95 | 'command' => '/ip/dns/static/set', 96 | 'id' => $id 97 | ); 98 | $out = array_merge($input, $param); 99 | return $this->query($out); 100 | } 101 | 102 | /** 103 | * This method is used to display 104 | * all dns cache 105 | * @return type array 106 | * 107 | */ 108 | public function get_all_dns_cache(){ 109 | return $this->query('/ip/dns/cache/getall'); 110 | } 111 | 112 | /** 113 | * This method is used to display one dns cache 114 | * in detail based on the id 115 | * @param type $id string 116 | * @return type array 117 | * 118 | */ 119 | public function detail_dns_cache($id){ 120 | $input = array( 121 | 'command' => '/ip/dns/cache/print', 122 | 'id' => $id 123 | ); 124 | return $this->query($input); 125 | } 126 | 127 | /** 128 | * This method is used to display 129 | * all dns cache all cache 130 | * @return type array 131 | * 132 | */ 133 | public function get_all_dns_cache_all(){ 134 | return $this->query('/ip/dns/cache/all/getall'); 135 | } 136 | 137 | /** 138 | * This method is used to display one dns cache all 139 | * in detail based on the id 140 | * @param type $id string 141 | * @return type array 142 | * 143 | */ 144 | public function detail_dns_cache_all($id){ 145 | $input = array( 146 | 'command' => '/ip/dns/cache/all/print', 147 | 'id' => $id 148 | ); 149 | return $this->query($input); 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /libraries/mikrotik/ip/mapi_ip_firewall.php: -------------------------------------------------------------------------------- 1 | 6 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 7 | * @copyright Copyright (c) 2011, Virtual Think Team. 8 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 9 | * @category Libraries 10 | */ 11 | class Mapi_Ip_Firewall extends Mapi_Query { 12 | /** 13 | * 14 | * @var type array 15 | */ 16 | private $param; 17 | 18 | function __construct($param ) { 19 | $this->param = $param; 20 | parent::__construct($param); 21 | } 22 | 23 | /** 24 | * This method is used to add the firewall nat 25 | * @param type $param array 26 | * @return type array 27 | * 28 | */ 29 | public function add_firewall_nat($param){ 30 | $input = array( 31 | 'command' => '/ip/firewall/nat/add' 32 | ); 33 | $out = array_merge($input, $param); 34 | return $this->query($out); 35 | } 36 | 37 | /** 38 | * This method is used to disable firewall nat by id 39 | * @param type $id string 40 | * @return type array 41 | * 42 | */ 43 | public function disable_firewall_nat($id){ 44 | $input = array( 45 | 'command' => '/ip/firewall/nat/disable', 46 | 'id' => $id 47 | ); 48 | return $this->query($input); 49 | } 50 | 51 | /** 52 | * This method is used to enable firewall nat by id 53 | * @param type $id string 54 | * @return type array 55 | * 56 | */ 57 | public function enable_firewall_nat($id){ 58 | $input = array( 59 | 'command' => '/ip/firewall/nat/enable', 60 | 'id' => $id 61 | ); 62 | return $this->query($input); 63 | } 64 | 65 | /** 66 | * This method is used to change firewall nat based on the id 67 | * @param type $param array 68 | * @param type $id string 69 | * @return type array 70 | * 71 | */ 72 | public function set_firewall_nat($param, $id){ 73 | $input = array( 74 | 'command' => '/ip/firewall/nat/set', 75 | 'id' => $id 76 | ); 77 | $out=array_merge($input, $param); 78 | return $this->query($out); 79 | } 80 | 81 | /** 82 | * This method is used to remove firewall nat 83 | * @param type $id string 84 | * @return type array 85 | * 86 | */ 87 | public function delete_firewall_nat($id){ 88 | $input = array( 89 | 'command' => '/ip/firewall/nat/remove', 90 | 'id' => $id 91 | ); 92 | return $this->query($input); 93 | } 94 | 95 | /** 96 | * This method is used to display all firewall nat 97 | * @return type array 98 | * 99 | */ 100 | public function get_all_firewall_nat(){ 101 | return $this->query('/ip/firewall/nat/getall'); 102 | } 103 | 104 | /** 105 | * This method is used to display one firewall nat 106 | * in detail based on the id 107 | * @param type $id string 108 | * @return type array 109 | * 110 | */ 111 | public function detail_firewall_nat($id){ 112 | $input = array( 113 | 'command' => '/ip/firewall/nat/print', 114 | 'id' => $id 115 | ); 116 | return $this->query($input); 117 | } 118 | 119 | /** 120 | * 121 | * @param type $param array 122 | * @return type array 123 | * This method is used to add the firewall filter 124 | */ 125 | public function add_firewall_filter($param){ 126 | $input = array( 127 | 'command' => '/ip/firewall/filter/add' 128 | ); 129 | $out = array_merge($input, $param); 130 | return $this->query($out); 131 | } 132 | 133 | /** 134 | * This method is used to display all firewall filter 135 | * @return type array 136 | * 137 | */ 138 | public function get_all_firewall_filter(){ 139 | return $this->query('/ip/firewall/filter/getall'); 140 | } 141 | 142 | /** 143 | * This method is used to enable firewall filter by id 144 | * @param type $id string 145 | * @return type array 146 | * 147 | */ 148 | public function enable_firewall_filter($id){ 149 | $input = array( 150 | 'command' => '/ip/firewall/filter/enable', 151 | 'id' => $id 152 | ); 153 | return $this->query($input); 154 | } 155 | 156 | /** 157 | * This method is used to disable firewall filter by id 158 | * @param type $id string 159 | * @return type array 160 | * 161 | */ 162 | public function disable_firewall_filter($id){ 163 | $input = array( 164 | 'command' => '/ip/firewall/filter/disable', 165 | 'id' => $id 166 | ); 167 | return $this->query($input); 168 | } 169 | 170 | /** 171 | * This method is used to remove firewall filter by id 172 | * @param type $id string 173 | * @return type array 174 | * 175 | */ 176 | public function delete_firewall_filter($id){ 177 | $input = array( 178 | 'command' => '/ip/firewall/filter/remove', 179 | 'id' => $id 180 | ); 181 | return $this->query($input); 182 | } 183 | 184 | /** 185 | * This method is used to change firewall nat based on the id 186 | * @param type $param array 187 | * @param type $id string 188 | * @return type array 189 | * 190 | */ 191 | public function set_firewall_filter($param, $id){ 192 | $input = array( 193 | 'command' => '/ip/firewall/filter/set', 194 | 'id' => $id 195 | ); 196 | $out = array_merge($input, $param); 197 | return $this->query($out); 198 | } 199 | 200 | /** 201 | * This method is used to display one firewall filter 202 | * in detail based on the id 203 | * @param type $id string 204 | * @return type array 205 | * 206 | */ 207 | public function detail_firewall_filter($id){ 208 | $input = array( 209 | 'command' => '/ip/firewall/filter/print', 210 | 'id' => $id 211 | ); 212 | return $this->query($input); 213 | } 214 | 215 | /** 216 | * This method used for add new Ip Firewall Mangle 217 | * @param type $param array 218 | * @return type array 219 | */ 220 | public function add_firewall_mangle($param){ 221 | $input = array( 222 | 'command' => '/ip/firewall/mangle/add' 223 | ); 224 | $out = array_merge($input, $param); 225 | return $this->query($out); 226 | } 227 | 228 | /** 229 | * This method used for disable Ip Firewall Mangle 230 | * @param type $id string 231 | * @return type array 232 | */ 233 | public function disable_firewall_mangle($id){ 234 | $input = array( 235 | 'command' => '/ip/firewall/mangle/disable', 236 | 'id' => $id 237 | ); 238 | return $this->query($input); 239 | } 240 | 241 | /** 242 | * This method used for enable Ip Firewall Mangle 243 | * @param type $id string 244 | * @return type array 245 | */ 246 | public function enable_firewall_mangle($id){ 247 | $input = array( 248 | 'command' => '/ip/firewall/mangle/enable', 249 | 'id' => $id 250 | ); 251 | return $this->query($input); 252 | } 253 | 254 | /** 255 | * This method used for delete Ip Firewall Mangle 256 | * @param type $id string 257 | * @return type array 258 | */ 259 | public function delete_firewall_mangle($id){ 260 | $input = array( 261 | 'command' => '/ip/firewall/mangle/remove', 262 | 'id' => $id 263 | ); 264 | return $this->query($input); 265 | } 266 | 267 | /** 268 | * This method used for detail Ip Firewall Mangle 269 | * @param type $id string 270 | * @return type array 271 | */ 272 | public function detail_firewall_mangle($id){ 273 | $input = array( 274 | 'command' => '/ip/firewall/mangle/print', 275 | 'id' => $id 276 | ); 277 | return $this->query($input); 278 | } 279 | 280 | /** 281 | * This method used for set or edit Ip Firewall Mangle 282 | * @param type $param array 283 | * @param type $id string 284 | * @return type array 285 | */ 286 | public function set_firewall_mangle($param, $id){ 287 | $input = array( 288 | 'command' => '/ip/firewall/mangle/set', 289 | 'id' => $id 290 | ); 291 | $out = array_merge($input, $param); 292 | return $this->query($out); 293 | } 294 | 295 | /** 296 | * This method used for get all Ip Firewall Mangle 297 | * @return type array 298 | */ 299 | public function get_all_firewall_mangle(){ 300 | return $this->query('/ip/firewall/mangle/getall'); 301 | 302 | } 303 | 304 | /** 305 | * This method used for get all firewall connection 306 | * @return type array 307 | */ 308 | public function get_all_firewall_connection(){ 309 | return $this->query('/ip/firewall/connection/getall'); 310 | } 311 | 312 | /** 313 | * This method used for delete firewall connection 314 | * @param type $id string 315 | * @return type array 316 | */ 317 | public function delete_firewall_connection($id){ 318 | $input = array( 319 | 'command' => '/ip/firewall/connection/remove', 320 | 'id' => $id 321 | ); 322 | return $this->query($input); 323 | 324 | } 325 | 326 | /** 327 | * This method used for get all Ip Firewall Service Port 328 | * @return type arrray 329 | */ 330 | public function get_all_firewall_service_port(){ 331 | return $this->query('/ip/firewall/service-port/getall'); 332 | } 333 | 334 | /** 335 | * This method used for disable Ip Firewall Service Port 336 | * @param type $id string 337 | * @return type array 338 | */ 339 | public function disable_firewall_service_port($id){ 340 | $input = array( 341 | 'command' => '/ip/firewall/service-port/disable', 342 | 'id' => $id 343 | ); 344 | return $this->query($input); 345 | } 346 | 347 | /** 348 | * This method used for enable Ip Firewall Service Port 349 | * @param type $id string 350 | * @return type array 351 | */ 352 | public function enable_firewall_service_port($id){ 353 | $input = array( 354 | 'command' => '/ip/firewall/service-port/enable', 355 | 'id' => $id 356 | ); 357 | return $this->query($input); 358 | } 359 | 360 | } 361 | 362 | 363 | -------------------------------------------------------------------------------- /libraries/mikrotik/ip/mapi_ip_hotspot.php: -------------------------------------------------------------------------------- 1 | 6 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 7 | * @copyright Copyright (c) 2011, Virtual Think Team. 8 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 9 | * @category Libraries 10 | */ 11 | class Mapi_Ip_Hotspot extends Mapi_Query{ 12 | /** 13 | * 14 | * @var type array 15 | */ 16 | private $param; 17 | 18 | function __construct($param) { 19 | $this->param = $param; 20 | parent::__construct($param); 21 | } 22 | 23 | /** 24 | * This method is used to add the user hotspot 25 | * @param type $param array 26 | * @return type array 27 | * 28 | */ 29 | public function add_hotspot_user($param){ 30 | $input = array( 31 | 'command' => '/ip/hotspot/user/add' 32 | ); 33 | $out = array_merge($input, $param); 34 | return $this->query($out); 35 | } 36 | 37 | /** 38 | * This method is used to disable user hotspot by id 39 | * @param type $id string 40 | * @return type array 41 | * 42 | */ 43 | public function disable_hotspot_user($id){ 44 | $input = array( 45 | 'command' => '/ip/hotspot/user/disable', 46 | 'id' => $id 47 | ); 48 | return $this->query($input); 49 | } 50 | 51 | /** 52 | * This method is used to activate the user hotspot by id 53 | * @param type $id string 54 | * @return type array 55 | * 56 | */ 57 | public function enable_hotspot_user($id){ 58 | $input = array( 59 | 'command' => '/ip/hotspot/user/enable', 60 | 'id' => $id 61 | ); 62 | return $this->query($input); 63 | } 64 | 65 | /** 66 | * This method is used to change users hotspot based on the id 67 | * @param type $param array 68 | * @param type $id string 69 | * @return type array 70 | * 71 | */ 72 | public function set_hotspot_user($param, $id){ 73 | $input = array( 74 | 'command' => '/ip/hotspot/user/set', 75 | 'id' => $id 76 | ); 77 | $out=array_merge($input, $param); 78 | return $this->query($out); 79 | } 80 | 81 | /** 82 | * This method is used to remove the user hotspot by id 83 | * @param type $id string 84 | * @return type array 85 | * 86 | */ 87 | public function delete_hotspot_user($id){ 88 | $input = array( 89 | 'command' => '/ip/hotspot/user/remove', 90 | 'id' => $id 91 | ); 92 | return $this->query($input); 93 | } 94 | 95 | /** 96 | * This method is used to display 97 | * all users hotspot 98 | * @return type array 99 | * 100 | */ 101 | public function get_all_hotspot_user(){ 102 | return $this->query('/ip/hotspot/user/getall'); 103 | } 104 | 105 | /** 106 | * This method is used to display one user hotspot 107 | * in detail based on the id 108 | * @param type $id string 109 | * @return type array 110 | * 111 | */ 112 | public function detail_hotspot_user($id){ 113 | $input = array( 114 | 'command' => '/ip/hotspot/user/print', 115 | 'id' => $id 116 | ); 117 | return $this->query($input); 118 | } 119 | 120 | /** 121 | * This method is used to display 122 | * all hotspot 123 | * @return type array 124 | * 125 | */ 126 | public function get_all_hotspot(){ 127 | return $this->query('/ip/hotspot/getall'); 128 | } 129 | 130 | /** 131 | * This method is used to activate the hotspot by id 132 | * @param type $id string 133 | * @return type array 134 | * 135 | */ 136 | public function enable_hotspot($id){ 137 | $input = array( 138 | 'command' => '/ip/hotspot/enable', 139 | 'id' => $id 140 | ); 141 | return $this->query($input); 142 | } 143 | 144 | /** 145 | * This method is used to disable hotspot by id 146 | * @param type $id string 147 | * @return type array 148 | * 149 | */ 150 | public function disable_hotspot($id){ 151 | $input = array( 152 | 'command' => '/ip/hotspot/disable', 153 | 'id' => $id 154 | ); 155 | return $this->query($input); 156 | } 157 | 158 | /** 159 | * This method is used to remove the hotspot by id 160 | * @param type $id string 161 | * @return type array 162 | * 163 | */ 164 | public function delete_hotspot($id){ 165 | $input = array( 166 | 'command' => '/ip/hotspot/remove', 167 | 'id' => $id 168 | ); 169 | return $this->query($input); 170 | } 171 | 172 | /** 173 | * This method is used to change hotspot based on the id 174 | * @param type $param array 175 | * @param type $id string 176 | * @return type array 177 | * 178 | */ 179 | public function set_hotspot($param, $id){ 180 | $input = array( 181 | 'command' => '/ip/hotspot/set', 182 | 'id' => $id 183 | ); 184 | $out=array_merge($input, $param); 185 | return $this->query($out); 186 | } 187 | 188 | /** 189 | * This method is used to display one hotspot 190 | * in detail based on the id 191 | * @param type $id string 192 | * @return type array 193 | * 194 | */ 195 | public function detail_hotspot($id){ 196 | $input = array( 197 | 'command' => '/ip/hotspot/print', 198 | 'id' => $id 199 | ); 200 | return $this->query($input); 201 | } 202 | 203 | /** 204 | * This function is used to add hotspot 205 | * @return type array 206 | */ 207 | public function setup_hotspot($param){ 208 | $input = array( 209 | 'command' => '/ip/hotspot/add', 210 | '' 211 | ); 212 | $out = array_merge($input, $param); 213 | return $this->query($out); 214 | } 215 | 216 | /** 217 | * This method used for add new Ip Hotspot Ip-Binding 218 | * @param type $param array 219 | * @return type array 220 | */ 221 | public function add_ip_binding($param){ 222 | $input = array( 223 | 'command' => '/ip/hotspot/ip-binding/add' 224 | ); 225 | $out = array_merge($input, $param); 226 | return $this->query($out); 227 | } 228 | 229 | /** 230 | * This method used for disable Ip Hotspot Ip-Binding 231 | * @param type $id string 232 | * @return type array 233 | */ 234 | public function disable_ip_binding($id){ 235 | $input = array( 236 | 'command' => '/ip/hotspot/ip-binding/disable', 237 | 'id' => $id 238 | ); 239 | return $this->query($input); 240 | } 241 | 242 | /** 243 | * This method used for enable Ip Hotspot Ip-Binding 244 | * @param type $id string 245 | * @return type array 246 | */ 247 | public function enable_ip_binding($id){ 248 | $input = array( 249 | 'command' => '/ip/hotspot/ip-binding/enable', 250 | 'id' => $id 251 | ); 252 | return $this->query($input); 253 | } 254 | 255 | /** 256 | * This method used for get all Ip Hotspot Ip-Binding 257 | * @return type array 258 | */ 259 | public function get_all_ip_binding(){ 260 | return $this->query('/ip/hotspot/ip-binding/getall'); 261 | } 262 | 263 | /** 264 | * This method used for delete Ip Hotspot Ip-Binding 265 | * @param type $id string 266 | * @return type array 267 | */ 268 | public function delete_ip_binding($id){ 269 | $input = array( 270 | 'command' => '/ip/hotspot/ip-binding/remove', 271 | 'id' => $id 272 | ); 273 | return $this->query($input); 274 | } 275 | 276 | /** 277 | * This method used for set or edit Ip Hotspot Ip-Binding 278 | * @param type $param array 279 | * @param type $id string 280 | * @return type array 281 | */ 282 | public function set_ip_binding($param, $id){ 283 | $input = array( 284 | 'command' => '/ip/hotspot/ip-binding/set', 285 | 'id' => $id 286 | ); 287 | $out = array_merge($input, $param); 288 | return $this->query($out); 289 | } 290 | 291 | /** 292 | * This method used for detail Ip Hotspot Ip-Binding 293 | * @param type $id string 294 | * @return type array 295 | */ 296 | public function detail_ip_binding($id){ 297 | $input = array( 298 | 'command' => '/ip/hotspot/ip-binding/print', 299 | 'id' => $id 300 | ); 301 | return $this->query($input); 302 | } 303 | } 304 | -------------------------------------------------------------------------------- /libraries/mikrotik/ip/mapi_ip_pool.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Ip_Pool extends Mapi_Query { 13 | /** 14 | * 15 | * @var type array 16 | */ 17 | private $param; 18 | 19 | function __construct($param) { 20 | $this->param = $param; 21 | parent::__construct($param); 22 | } 23 | 24 | /** 25 | * This method is used to add pool 26 | * @param type $param array 27 | * @return type array 28 | * 29 | */ 30 | public function add_pool($param){ 31 | $input = array( 32 | 'command' => '/ip/pool/add' 33 | ); 34 | $out = array_merge($input, $param); 35 | return $this->query($out); 36 | } 37 | 38 | /** 39 | * This method is used to display 40 | * all pool 41 | * @return type array 42 | * 43 | */ 44 | public function get_all_pool(){ 45 | return $this->query('/ip/pool/getall'); 46 | } 47 | 48 | /** 49 | * This method is used to remove the pool by id 50 | * @param type $id string 51 | * @return type array 52 | * 53 | */ 54 | public function delete_pool($id){ 55 | $input = array( 56 | 'command' => '/ip/pool/remove', 57 | 'id' => $id 58 | ); 59 | return $this->query($input); 60 | } 61 | 62 | /** 63 | * This method is used to change pool based on the id 64 | * @param type $param array 65 | * @param type $id string 66 | * @return type array 67 | * 68 | */ 69 | public function set_pool($param, $id){ 70 | $input = array( 71 | 'command' => '/ip/pool/set', 72 | 'id' => $id 73 | ); 74 | $out = array_merge($input, $param); 75 | return $this->query($out); 76 | } 77 | /** 78 | * This method is used to display one pool 79 | * in detail based on the id 80 | * @param type $id string 81 | * @return type array 82 | * 83 | */ 84 | public function detail_pool($id){ 85 | $input = array( 86 | 'command' => '/ip/pool/print', 87 | 'id' => $id 88 | ); 89 | return $this->query($input); 90 | } 91 | } 92 | 93 | -------------------------------------------------------------------------------- /libraries/mikrotik/ip/mapi_ip_proxy.php: -------------------------------------------------------------------------------- 1 | param ; $param; 17 | parent::__construct($param); 18 | } 19 | 20 | /** 21 | * This method used for get all Ip Proxi 22 | * @return type array 23 | */ 24 | public function get_all_proxy(){ 25 | return $this->query('/ip/proxy/getall'); 26 | } 27 | 28 | /** 29 | * 30 | * This method used for set Ip proxy 31 | * @param type $param array 32 | * @return type array 33 | */ 34 | public function set_proxy($param){ 35 | $input = array( 36 | 'command' => '/ip/proxy/set' 37 | ); 38 | $out = array_merge($input, $param); 39 | return $this->query($out); 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /libraries/mikrotik/ip/mapi_ip_route.php: -------------------------------------------------------------------------------- 1 | 6 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 7 | * @copyright Copyright (c) 2011, Virtual Think Team. 8 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 9 | * @category Libraries 10 | */ 11 | class Mapi_Ip_Route extends Mapi_Query { 12 | /** 13 | * 14 | * @var type array 15 | */ 16 | private $param; 17 | 18 | function __construct($param ) { 19 | $this->param = $param; 20 | parent::__construct($param); 21 | } 22 | 23 | /** 24 | * This method is used to display all ip route 25 | * @return type array 26 | */ 27 | public function get_all_route(){ 28 | return $this->query('/ip/route/getall'); 29 | } 30 | 31 | /** 32 | * This method is used to add ip route gateway 33 | * @param type $param array 34 | * @return type array 35 | */ 36 | public function add_route_gateway($param){ 37 | $input = array( 38 | 'command' => '/ip/route/add' 39 | ); 40 | $out = array_merge($input, $param); 41 | return $this->query($out); 42 | } 43 | 44 | /** 45 | * Can change or disable only static routes 46 | * @param type $id is not array 47 | * 48 | */ 49 | public function disable_route($id){ 50 | $input = array( 51 | 'command' => '/ip/route/disable', 52 | 'id' => $id 53 | ); 54 | return $this->query($input); 55 | } 56 | 57 | /** 58 | * Can change or enable only static routes 59 | * @param type $id string 60 | * @return type array 61 | * 62 | */ 63 | public function enable_route($id){ 64 | $input = array( 65 | 'command' => '/ip/route/enable', 66 | 'id' => $id 67 | ); 68 | return $this->query($input); 69 | } 70 | 71 | /** 72 | * Can change or remove only static routes 73 | * @param type $id string 74 | * @return type array 75 | * 76 | */ 77 | public function delete_route($id){ 78 | $input = array( 79 | 'command' => '/ip/route/remove', 80 | 'id' => $id 81 | ); 82 | return $this->query($input); 83 | } 84 | 85 | /** 86 | * Can change only static routes 87 | * @param type $param array 88 | * @param type $id string 89 | * @return type array 90 | * 91 | */ 92 | public function set_route($param, $id){ 93 | $input = array( 94 | 'command' => '/ip/route/set', 95 | 'id' => $id 96 | ); 97 | $out=array_merge($input, $param); 98 | return $this->query($out); 99 | } 100 | 101 | /** 102 | * This method is used to display one ip route 103 | * in detail based on the id 104 | * @param type $id string 105 | * @return type array 106 | * 107 | */ 108 | public function detail_route($id){ 109 | $input = array( 110 | 'command' => '/ip/route/print', 111 | 'id' => $id 112 | ); 113 | return $this->query($input); 114 | } 115 | } 116 | 117 | -------------------------------------------------------------------------------- /libraries/mikrotik/ip/mapi_ip_service.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Ip_Service extends Mapi_Query { 13 | private $param; 14 | function __construct($param ) { 15 | $this->param = $param; 16 | parent::__construct($param); 17 | } 18 | 19 | /** 20 | * This methode is used to display all ip service 21 | * @return type array 22 | */ 23 | public function get_all_service(){ 24 | return $this->query('/ip/service/getall'); 25 | } 26 | 27 | /** 28 | * This methode is used to enable ip service by id 29 | * @param type $id string 30 | * @return type array 31 | */ 32 | public function enable_service($id){ 33 | $input = array( 34 | 'command' => '/ip/service/enable', 35 | 'id' => $id 36 | ); 37 | return $this->query($input); 38 | } 39 | 40 | /** 41 | * This methode is used to disable ip service by id 42 | * @param type $id string 43 | * @return type array 44 | */ 45 | public function disable_service($id){ 46 | $input = array( 47 | 'command' => '/ip/service/disable', 48 | 'id' => $id 49 | ); 50 | return $this->query($input); 51 | } 52 | 53 | /** 54 | * This method is used to display one ip service 55 | * in detail based on the id 56 | * @param type $id string 57 | * @return type array 58 | */ 59 | public function detail_service($id){ 60 | $input = array( 61 | 'command' => '/ip/service/print', 62 | 'id' => $id 63 | ); 64 | return $this->query($input); 65 | } 66 | 67 | public function set_service($param, $id){ 68 | $input = array( 69 | 'command' => '/ip/service/set', 70 | 'id' => $id 71 | ); 72 | $out = array_merge($input, $param); 73 | return $this->query($out); 74 | } 75 | } 76 | 77 | -------------------------------------------------------------------------------- /libraries/mikrotik/ppp/mapi_ppp.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Ppp { 13 | private $param; 14 | function __construct($param = array()) { 15 | $this->param = $param; 16 | } 17 | 18 | /** 19 | * This method for call class Mapi_Ppp_Profile 20 | * @return Object of Mapi_Ppp_Profile class 21 | */ 22 | public function ppp_profile(){ 23 | return new Mapi_Ppp_Profile($this->param); 24 | } 25 | 26 | /** 27 | * This method for call class Mapi_Ppp_Secret 28 | * @return Object of Mapi_Ppp_Secret 29 | */ 30 | public function ppp_secret(){ 31 | return new Mapi_Ppp_Secret($this->param); 32 | } 33 | 34 | 35 | /** 36 | * This method for call class Mapi_Ppp_Aaa 37 | * @access public 38 | * @return object of Mapi_Ppp_Aaa class 39 | */ 40 | public function ppp_aaa(){ 41 | return new Mapi_Ppp_Aaa($this->param); 42 | } 43 | 44 | /** 45 | * This method for call class Mapi_Ppp_Active 46 | * @return Object of Mapi_Ppp_Active class 47 | */ 48 | public function ppp_active(){ 49 | return new Mapi_Ppp_Active($this->param); 50 | } 51 | } -------------------------------------------------------------------------------- /libraries/mikrotik/ppp/mapi_ppp_aaa.php: -------------------------------------------------------------------------------- 1 | 6 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 7 | * @copyright Copyright (c) 2011, Virtual Think Team. 8 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 9 | * @category Libraries 10 | */ 11 | class Mapi_Ppp_Aaa extends Mapi_Query { 12 | /** 13 | * 14 | * @var type array 15 | */ 16 | private $param; 17 | 18 | function __construct($param){ 19 | $this->param = $param; 20 | parent::__construct($param); 21 | } 22 | 23 | /** 24 | * This method is used to display all ppp aaa 25 | * @return type array 26 | */ 27 | public function get_all_aaa(){ 28 | return $this->query('/ppp/aaa/getall'); 29 | } 30 | 31 | /** 32 | * This method is used to set ppp aaa 33 | * @param type $use_radius string 34 | * @param type $accounting string 35 | * @param type $interim_update string 36 | * @return type array 37 | */ 38 | public function set_ppp_aaa($use_radius, $accounting, $interim_update){ 39 | $input = array( 40 | 'command' => '/ppp/aaa/set', 41 | 'use-radius' => $use_radius, 42 | 'accounting' => $accounting, 43 | 'interim-update' => $interim_update 44 | ); 45 | return $this->query($input); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /libraries/mikrotik/ppp/mapi_ppp_active.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_Ppp_Active extends Mapi_Query { 13 | private $param; 14 | function __construct($param){ 15 | $this->param = $param; 16 | parent::__construct($param); 17 | } 18 | 19 | /** 20 | * This method is used to display all ppp active 21 | * @return type array 22 | */ 23 | public function get_all_ppp_active(){ 24 | return $this->query('/ppp/active/getall'); 25 | } 26 | 27 | /** 28 | * This method is used to delete ppp active 29 | * @param type $id string 30 | * @return type array 31 | */ 32 | public function delete_ppp_active($id){ 33 | $input = array( 34 | 'caommand' => '/ppp/active/remove', 35 | 'id' => $id 36 | ); 37 | return $this->query($input); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /libraries/mikrotik/ppp/mapi_ppp_profile.php: -------------------------------------------------------------------------------- 1 | 6 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 7 | * @copyright Copyright (c) 2011, Virtual Think Team. 8 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 9 | * @category Libraries 10 | */ 11 | class Mapi_Ppp_Profile extends Mapi_Query { 12 | /** 13 | * 14 | * @var type array 15 | */ 16 | private $param; 17 | 18 | function __construct($param) { 19 | $this->param = $param; 20 | parent::__construct($param); 21 | } 22 | 23 | /** 24 | * This method is used to add ppp profile 25 | * @param type $param array 26 | * @return type array 27 | * 28 | */ 29 | public function add_ppp_profile($param){ 30 | $input = array( 31 | 'command' => '/ppp/profile/add', 32 | ); 33 | $out = array_merge($input, $param); 34 | return $this->query($out); 35 | } 36 | 37 | /** 38 | * This method is used to display all ppp profile 39 | * @return type array 40 | * 41 | */ 42 | public function get_all_ppp_profile(){ 43 | return $this->query('/ppp/profile/getall'); 44 | } 45 | 46 | /** 47 | * This method is used to remove ppp profile by id 48 | * @param type $id string 49 | * @return type array 50 | * 51 | */ 52 | public function delete_ppp_profile($id){ 53 | $input = array( 54 | 'command' => '/ppp/profile/remove', 55 | 'id' => $id 56 | ); 57 | return $this->query($input); 58 | } 59 | 60 | /** 61 | * This method is used to set or edit ppp profile by id 62 | * @param type $param array 63 | * @param type $id string 64 | * @return type array 65 | * 66 | */ 67 | public function set_ppp_profile($param, $id){ 68 | $input = array( 69 | 'command' => '/ppp/profile/set', 70 | 'id' => $id 71 | ); 72 | $out = array_merge($input, $param); 73 | return $this->query($out); 74 | } 75 | 76 | /** 77 | * This method is used to display one ppp profile 78 | * in detail based on the id 79 | * @param type $id string 80 | * @return type array 81 | * 82 | */ 83 | public function detail_ppp_profile($id){ 84 | $input = array( 85 | 'command' => '/ppp/profile/print', 86 | 'id' => $id 87 | ); 88 | return $this->query($input); 89 | } 90 | 91 | } 92 | 93 | -------------------------------------------------------------------------------- /libraries/mikrotik/ppp/mapi_ppp_secret.php: -------------------------------------------------------------------------------- 1 | 6 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 7 | * @copyright Copyright (c) 2011, Virtual Think Team. 8 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 9 | * @category Libraries 10 | */ 11 | class Mapi_Ppp_Secret extends Mapi_Query { 12 | /** 13 | * 14 | * @var type array 15 | */ 16 | 17 | private $param; 18 | function __construct($param) { 19 | $this->param = $param; 20 | parent::__construct($param); 21 | } 22 | 23 | /** 24 | * This method is used to add ppp secret 25 | * @param type $param array 26 | * @return type array 27 | * 28 | */ 29 | public function add_ppp_secret($param){ 30 | $input = array( 31 | 'command' => '/ppp/secret/add' 32 | ); 33 | $out = array_merge($input, $param); 34 | return $this->query($out); 35 | } 36 | 37 | /** 38 | * This method is used to disable ppp secret 39 | * @param type $id string 40 | * @return type array 41 | * 42 | */ 43 | public function disable_ppp_secret($id){ 44 | $input = array( 45 | 'command' => '/ppp/secret/disable', 46 | 'id' => $id 47 | ); 48 | return $this->query($input); 49 | } 50 | 51 | /** 52 | * This method is used to enable ppp secret 53 | * @param type $id string 54 | * @return type array 55 | * 56 | */ 57 | public function enable_ppp_secret($id){ 58 | $input = array( 59 | 'command' => '/ppp/secret/enable', 60 | 'id' => $id 61 | ); 62 | return $this->query($input); 63 | } 64 | 65 | /** 66 | * This method is used to set or edit ppp secret 67 | * @param type $param array 68 | * @param type $id string 69 | * @return type array 70 | * 71 | */ 72 | public function set_ppp_secret($param, $id){ 73 | $input = array( 74 | 'command' => '/ppp/secret/set', 75 | 'id' => $id 76 | ); 77 | $out=array_merge($input, $param); 78 | return $this->query($out); 79 | } 80 | 81 | /** 82 | * This method is used to delete ppp secret 83 | * @param type $id string 84 | * @return type array 85 | */ 86 | public function delete_ppp_secret($id){ 87 | $input = array( 88 | 'command' => '/ppp/secret/remove', 89 | 'id' => $id 90 | ); 91 | return $this->query($input); 92 | } 93 | 94 | /** 95 | * This method is used to display all ppp secret 96 | * @return type array 97 | * 98 | */ 99 | public function get_all_ppp_secret(){ 100 | return $this->query('/ppp/secret/getall'); 101 | } 102 | 103 | /** 104 | * This method is used to display one ppp secret 105 | * in detail based on the id 106 | * @param type $id not array, harus di deklarasikan 107 | * @return type array 108 | * 109 | */ 110 | public function detail_ppp_secret($id){ 111 | $input = array( 112 | 'command' => '/ppp/secret/print', 113 | 'id' => $id 114 | ); 115 | return $this->query($input); 116 | } 117 | } 118 | 119 | -------------------------------------------------------------------------------- /libraries/mikrotik/system/mapi_system.php: -------------------------------------------------------------------------------- 1 | 6 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 7 | * @copyright Copyright (c) 2011, Virtual Think Team. 8 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 9 | * @category Libraries 10 | */ 11 | class Mapi_System extends Mapi_Query { 12 | /** 13 | * 14 | * @var type array 15 | */ 16 | private $param; 17 | 18 | function __construct($param) { 19 | $this->param = $param; 20 | parent::__construct($param); 21 | } 22 | /** 23 | * This method is used to set systemn identity 24 | * @param type $name string 25 | * @return type array 26 | */ 27 | public function set_identity($name){ 28 | $input = array( 29 | 'command' => '/system/identity/set', 30 | 'name' => $name 31 | ); 32 | return $this->query($input); 33 | } 34 | /** 35 | * This method is used to display all system identiy 36 | * @return type array 37 | */ 38 | public function get_all_identity(){ 39 | return $this->query('/system/identity/getall'); 40 | } 41 | 42 | /** 43 | * This method is used to display all system clock 44 | * @return type array 45 | */ 46 | public function get_all_clock(){ 47 | return $this->query('/system/clock/getall'); 48 | } 49 | 50 | /** 51 | * This method is used to system bacup save 52 | * @param type $name string 53 | * @return type array 54 | */ 55 | public function save_backup($name){ 56 | $input = array( 57 | 'command' => '/system/backup/save', 58 | 'name' => $name 59 | ); 60 | return $this->query($input); 61 | } 62 | 63 | /** 64 | * This method is used to system backup load 65 | * @param type $name string 66 | * @return type array 67 | */ 68 | public function load_backup($name){ 69 | $input = array( 70 | 'command' => '/system/backup/load', 71 | 'name' => $name 72 | ); 73 | return $this->query($input); 74 | } 75 | 76 | /** 77 | * This method is used to display all system history 78 | * @return type array 79 | */ 80 | public function get_all_history(){ 81 | return $this->query('/system/history/getall'); 82 | } 83 | 84 | /** 85 | * This method is used to display all system license 86 | * @return type array 87 | */ 88 | public function get_all_license(){ 89 | return $this->query('/system/license/getall'); 90 | } 91 | 92 | /** 93 | * This method is used to display all system routerboard 94 | * @return type array 95 | */ 96 | public function get_all_routerboard(){ 97 | return $this->query('/system/routerboard/getall'); 98 | } 99 | /** 100 | * This method is used to system reset configuration 101 | * @param type $keep_users string (yes or no) 102 | * @param type $no_defaults string (yes or no) 103 | * @param type $skip_backup string (yes or no) 104 | * @return type array 105 | */ 106 | public function reset($keep_users, $no_defaults, $skip_backup){ 107 | $input = array( 108 | 'command' => '/system/reset-configuration', 109 | 'keep-users' => $keep_users, 110 | 'no-defaults' => $no_defaults, 111 | 'skip-backup' => $skip_backup 112 | ); 113 | return $this->query($input); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /libraries/mikrotik/system/mapi_system_scheduler.php: -------------------------------------------------------------------------------- 1 | 7 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 8 | * @copyright Copyright (c) 2011, Virtual Think Team. 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 | * @category Libraries 11 | */ 12 | class Mapi_System_Scheduler extends Mapi_Query { 13 | private $param; 14 | function __construct($param) { 15 | $this->param = $param; 16 | parent::__construct($param); 17 | } 18 | /** 19 | * This method used for add new system scheduler 20 | * @param type $param array 21 | * @return type array 22 | */ 23 | public function add_system_scheduler($param){ 24 | $input = array( 25 | 'command' => '/system/scheduler/add' 26 | ); 27 | $out = array_merge($input, $param); 28 | return $this->query($out); 29 | } 30 | 31 | /** 32 | * This method used for disable system scheduler 33 | * @param type $id string 34 | * @return type array 35 | */ 36 | public function disable_system_scheduler($id){ 37 | $input = array( 38 | 'command' => '/system/scheduler/disable', 39 | 'id' => $id 40 | ); 41 | return $this->query($input); 42 | } 43 | 44 | /** 45 | * This method used for enable system scheduler 46 | * @param type $id string 47 | * @return type array 48 | */ 49 | public function enable_system_scheduler($id){ 50 | $input = array( 51 | 'command' => '/system/scheduler/enable', 52 | 'id' => $id 53 | ); 54 | return $this->query($input); 55 | } 56 | 57 | /** 58 | * This method used for delete system scheduler 59 | * @param type $id string 60 | * @return type array 61 | */ 62 | public function delete_system_scheduler($id){ 63 | $input = array( 64 | 'command' => '/system/scheduler/remove', 65 | 'id' => $id 66 | ); 67 | return $this->query($input); 68 | } 69 | 70 | /** 71 | * This method used for detail system scheduler 72 | * @param type $id string 73 | * @return type array 74 | */ 75 | public function detail_system_scheduler($id){ 76 | $input = array( 77 | 'command' => '/system/scheduler/print', 78 | 'id' => $id 79 | ); 80 | return $this->query($input); 81 | } 82 | 83 | /** 84 | * This method used for set or edit system scheduler 85 | * @param type $param array 86 | * @param type $id string 87 | * @return type array 88 | */ 89 | public function set_system_scheduler($param, $id){ 90 | $input = array( 91 | 'command' => '/system/scheduler/set', 92 | 'id' => $id 93 | ); 94 | $out = array_merge($input, $param); 95 | return $this->query($out); 96 | } 97 | 98 | /** 99 | * This method used for get all system scheduler 100 | * @return type array 101 | */ 102 | public function get_all_system_scheduler(){ 103 | return $this->query('/system/scheduler/getall'); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /libraries/mikrotik_api.php: -------------------------------------------------------------------------------- 1 | 58 | * @author Lalu Erfandi Maula Yusnu nunenuh@gmail.com 59 | * @author Krisna Pranata krisna.pranata@gmail.com 60 | * @copyright Copyright (c) 2011, Virtual Think Team. 61 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License 62 | * @category Libraries 63 | */ 64 | class Mikrotik_Api { 65 | /** 66 | * @access private 67 | * @var type Object 68 | */ 69 | private $CI; 70 | 71 | /** 72 | * Instantiation of Class Mikrotik_Api 73 | * @access private 74 | * @var type array 75 | */ 76 | private $param; 77 | 78 | function __construct($param=array()) { 79 | $this->CI = & get_instance(); 80 | $param_config=$this->CI->config->item('mikrotik'); 81 | 82 | if (isset($param_config) && is_array($param_config)){ 83 | $this->param = $param_config; 84 | } else { 85 | $this->param = $param; 86 | } 87 | } 88 | 89 | /** 90 | * This method for call class Mapi IP 91 | * @access public 92 | * @return Object of Mapi_Ip 93 | */ 94 | public function ip(){ 95 | return new Mapi_Ip($this->param); 96 | } 97 | 98 | /** 99 | * This method for call class Mapi Interface 100 | * @access public 101 | * @return Object of Mapi_Interface 102 | */ 103 | public function interfaces(){ 104 | return new Mapi_Interfaces($this->param); 105 | } 106 | 107 | /** 108 | * This method for call class Mapi Ppp 109 | * @access public 110 | * @return Object of Mapi_Ppp 111 | */ 112 | public function ppp(){ 113 | return new Mapi_Ppp($this->param); 114 | } 115 | 116 | /** 117 | * This method for call class Mapi_System 118 | * @access public 119 | * @return Mapi_System 120 | */ 121 | public function system(){ 122 | return new Mapi_System($this->param); 123 | } 124 | 125 | /** 126 | * This method for call class Mapi_File 127 | * @access public 128 | * @return Mapi_File 129 | */ 130 | public function file(){ 131 | return new Mapi_File($this->param); 132 | } 133 | 134 | /** 135 | * This metod used call class Mapi_System_Scheduler 136 | * @return Mapi_System_Scheduler 137 | */ 138 | public function system_scheduler(){ 139 | return new Mapi_System_Scheduler($this->param); 140 | } 141 | } 142 | 143 | -------------------------------------------------------------------------------- /spark.info: -------------------------------------------------------------------------------- 1 | name: mikrotik_api 2 | version: 0.7.0 3 | compatibility: 2.0.3 4 | --------------------------------------------------------------------------------