[PATCH] mactrack_devices.php

Support questions about the MAC Track plugin

Moderators: Moderators, Developers

Post Reply
Author
Message
yuurii
Posts: 3
Joined: Sat Feb 06, 2016 9:03 pm

[PATCH] mactrack_devices.php

#1 Post by yuurii » Tue Feb 09, 2016 7:47 am

Hi,
There is a problem in mactrack_devices.php (https://github.com/Cacti/plugin_mactrac ... evices.php), which exists also in mactrack 2.9. At line 244, there is a loop that goes other the selected devices to delete, but the json that is passed through the post parameters unserializes into an array that starts at index 1, and the loop does not work well.
The correct behavior can be achieved by the following :
Replacing the lines (244-250) :

Code: Select all

for ($i=0; $i<count($selected_items); $i++) {
	/* ================= input validation ================= */
	input_validate_input_number($selected_items[$i]);
	/* ==================================================== */
	api_mactrack_device_remove($selected_items[$i]);
}
With :

Code: Select all

if( count($selected_items) > 0 ) {
	foreach($selected_items as $item) {
		/* ================= input validation ================= */
		input_validate_input_number($item);
		/* ==================================================== */
		api_mactrack_device_remove($item);
	}
}

Post Reply