Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Sun May 28, 2017 1:50 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: [PATCH] mactrack_devices.php
PostPosted: Tue Feb 09, 2016 7:47 am 
Offline

Joined: Sat Feb 06, 2016 9:03 pm
Posts: 3
Hi,
There is a problem in mactrack_devices.php (https://github.com/Cacti/plugin_mactrack/blob/master/mactrack_devices.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:
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:
if( count($selected_items) > 0 ) {
   foreach($selected_items as $item) {
      /* ================= input validation ================= */
      input_validate_input_number($item);
      /* ==================================================== */
      api_mactrack_device_remove($item);
   }
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group