Esempio n. 1
0
 $db = new ossim_db();
 $conn = $db->connect();
 $newcontext = POST('newcontext') != '' ? POST('newcontext') : $sname;
 if (POST('isolated') == 1 && $newcontext != '') {
     // Isolated sensor. Creating a new context first
     $new_context_uuid = Session::clone_default_ctx($conn, $newcontext);
     $entities = array($new_context_uuid);
     // Refresh current permissions
     $_SESSION['_user_vision'] = Acl::get_user_vision($conn);
 } elseif (POST('isolated') == 0 && preg_match("/[a-f\\d]{32}/i", POST('neighborsensor'))) {
     // Use selected sensor context
     $entities = array_keys(Av_sensor::get_ctx_by_id($conn, POST('neighborsensor')));
 }
 try {
     $old = new Av_Sensor($sensor_id);
     $old->load_from_db($conn);
     $cproperties = $old->get_properties();
     $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