Пример #1
0
 }
 if ($query1 != '' && $query2 != '' && $columns != '') {
     $db = new ossim_db(true);
     $conn = $db->connect();
     $curid = 0;
     $name = str_replace('"', '', $name);
     $query = "SELECT id FROM custom_report_types WHERE name=\"{$name}\" and file='SIEM/CustomList.php'";
     $rs = $conn->Execute($query);
     if (!$rs) {
         Av_exception::write_log(Av_exception::DB_ERROR, $conn->ErrorMsg());
     } else {
         if (!$rs->EOF) {
             $curid = $rs->fields['id'];
         }
     }
     $id = Av_report::get_new_report_module_id($conn);
     if ($curid > 0) {
         $sql = "UPDATE custom_report_types SET name=?,type='Custom Security Events',file='SIEM/CustomList.php',inputs='Number of Events:top:text:OSS_DIGIT:25:1000',custom_report_types.sql=? WHERE id=?";
         $params = array($name, "{$query1};{$query2};{$columns}", $curid);
     } else {
         $sql = "INSERT INTO custom_report_types (id,name,type,file,inputs,custom_report_types.sql) VALUES (?,?,'Custom Security Events','SIEM/CustomList.php','Number of Events:top:text:OSS_DIGIT:25:1000',?)";
         $params = array($id, $name, "{$query1};{$query2};{$columns}");
     }
     if ($conn->Execute($sql, $params)) {
         $msg = $curid > 0 ? _("Report Module") . " <b>'Custom Security Events - {$name}'</b> " . _("successfully updated") : _("Report Module successfully created as") . " <b>'Custom Security Events - {$name}'</b>";
         $msg_type = 'nf_success';
     } else {
         Av_exception::write_log(Av_exception::DB_ERROR, $conn->ErrorMsg());
         $msg = _("Error creating a new report type.");
         $msg_type = 'nf_error';
     }