$new = new Av_Sensor($sensor_id); $new->set_properties($cproperties); $new->set_name($sname); $new->set_ip($ip); $new->set_priority($priority); $new->set_port($port); $new->set_tzone($tzone); $new->set_descr($descr); $new->set_rpass($rpass); foreach ($entities as $ctx) { $new->add_new_ctx($ctx, $ctx); } // try to attach a component // Only when modifying a remote sensor if ($cproperties['version'] != '' && !empty($_POST['rpass'])) { $new->set_component($conn); } $new->save_in_db($conn); if ($location != '') { Locations::insert_related_sensor($conn, $location, $sensor_id); } } catch (Exception $e) { if (Session::is_pro() && $new_context_uuid != '' && preg_match("/password/", $e->getMessage())) { Acl::delete_entities($conn, $new_context_uuid); // Refresh current permissions $_SESSION['_user_vision'] = Acl::get_user_vision($conn); } $config_nt = array('content' => $e->getMessage(), 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'width: 80%; margin: 20px auto; text-align:center;'); $nt = new Notification('nt_1', $config_nt); $nt->show(); $db->close();