"7") { $updated = 0; $override_sysLocation_bool = mres($_POST['override_sysLocation']); if (isset($_POST['sysLocation'])) { $override_sysLocation_string = $_POST['sysLocation']; } if ($device['override_sysLocation'] != $override_sysLocation_bool || $device['location'] != $override_sysLocation_string) { $updated = 1; } if ($override_sysLocation_bool) { $override_sysLocation = 1; } else { $override_sysLocation = 0; } dbUpdate(array('override_sysLocation'=>$override_sysLocation), 'devices', '`device_id`=?', array($device['device_id'])); if (isset($override_sysLocation_string)) { dbUpdate(array('location'=>$override_sysLocation_string), 'devices', '`device_id`=?', array($device['device_id'])); } #FIXME needs more sanity checking! and better feedback $param = array('purpose' => $vars['descr'], 'type' => $vars['type'], 'ignore' => $vars['ignore'], 'disabled' => $vars['disabled']); $rows_updated = dbUpdate($param, 'devices', '`device_id` = ?', array($device['device_id'])); if ($rows_updated > 0 || $updated) { $update_message = "Device record updated."; $updated = 1; $device = dbFetchRow("SELECT * FROM `devices` WHERE `device_id` = ?", array($device['device_id'])); } elseif ($rows_updated = '-1') { $update_message = "Device record unchanged. No update necessary."; $updated = -1; } else { $update_message = "Device record update error."; } if (isset($_POST['hostname']) && $_POST['hostname'] !== '' && $_POST['hostname'] !== $device['hostname']) { if (is_admin()) { $result = renamehost($device['device_id'], $_POST['hostname'], 'webui'); if ($result == "") { print_message("Hostname updated from {$device['hostname']} to {$_POST['hostname']}"); echo ' '; } else { print_error($result . ". Does your web server have permission to modify the rrd files?"); } } else { print_error('Only administrative users may update the device hostname'); } } } else { include 'includes/error-no-perm.inc.php'; } } $descr = $device['purpose']; $override_sysLocation = $device['override_sysLocation']; $override_sysLocation_string = $device['location']; if ($updated && $update_message) { print_message($update_message); } elseif ($update_message) { print_error($update_message); } ?>