$data['status'] = 'error'; $data['data'] = _('Error! Sensor not allowed'); } $db->close(); } } if ($data['status'] == 'error') { $data['status'] = 'error'; $data['data'] = _('We found the followings errors:') . "<div style='padding-left: 15px; text-align:left;'>" . $data['data'] . '</div>'; echo json_encode($data); exit; } //Level key $lk_name = Ossec::get_key_name($file); //Rule file $rule_file = Ossec_utilities::get_real_path($sensor_id, Ossec::RULES_PATH . '/' . $file); if (!Ossec::is_editable($file)) { $data['status'] = 'error'; $data['data'] = _('XML file can not be edited'); echo json_encode($data); exit; } $file_tmp = uniqid($file) . '_tmp.xml'; $path_tmp = "/tmp/tmp_" . $file_tmp; if (copy($rule_file, $path_tmp) == FALSE) { $data['status'] = 'error'; $data['data'] = _('Failure to create temporary copy from XML file'); echo json_encode($data); exit; } $node_name = $_SESSION['_current_node'];