Esempio n. 1
0
     $nt->show();
     Util::make_form('POST', 'newsensorform.php');
     exit;
 }
 $db = new ossim_db();
 $conn = $db->connect();
 $new_id = Util::uuid();
 try {
     $new = new Av_Sensor($new_id);
     $new->set_properties(array('version' => '', 'has_nagios' => 0, 'has_ntop' => 1, 'has_vuln_scanner' => 1, 'has_kismet' => 0));
     $new->set_name($sname);
     $new->set_ip($ip);
     $new->set_priority($priority);
     $new->set_port($port);
     $new->set_tzone($tzone);
     $new->set_descr($descr);
     foreach ($entities as $ctx) {
         $new->add_new_ctx($ctx, $ctx);
     }
     $new->save_in_db($conn);
     if ($location != '') {
         Locations::insert_related_sensor($conn, $location, $new_id);
     }
 } catch (Exception $e) {
     $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();
     exit;
 }
 $db->close();