function check_phpgacl_install() { global $gacl; $db_table_prefix = $gacl->_db_table_prefix; require_once "ossim_db.inc"; $db = new ossim_db(); if (!($conn = $db->phpgacl_connect())) { echo "<p align=\"center\">\n <b>Can't connect to OSSIM acl database (phpgacl)</b><br/>\n Check for phpgacl values at framework configuration\n </p>"; exit; } $query1 = OssimQuery("SELECT * FROM acl"); $query2 = OssimQuery("SELECT * FROM " . $db_table_prefix . "_acl"); if (!$conn->Execute($query1) and !$conn->Execute($query2)) { echo "\n <p align=\"center\"><b>You need to configure phpGACL</b><br/>\n Remember to setup the database connection at phpGACL config files!\n <br/>\n Click <a href=\"/phpgacl/setup.php\">here</a> to enter setup\n </p>\n "; exit; } $db->close($conn); }
</th> <th><?php echo gettext("Percent"); ?> </th> </tr> <?php $db1 = new ossim_db(); $conn1 = $db1->connect(); $cmd = "ps ax | grep restoredb.pl | grep -v grep"; $output = explode("\n", `{$cmd}`); if (count($output) == 1 && $output[0] == "") { // Posibily failed $conn1->Execute("UPDATE restoredb_log SET status=-1 WHERE status=1"); } $query = OssimQuery("SELECT * FROM restoredb_log ORDER BY id DESC LIMIT 10"); if (!($rs1 = $conn1->Execute($query))) { print 'error: ' . $conn1->ErrorMsg() . '<BR>'; exit; } $results = array(); while (!$rs1->EOF) { $results[] = $rs1->fields; $rs1->MoveNext(); } $db1->close($conn1); if (count($results) < 1) { ?> <tr> <td colspan="6"><?php echo _("No Events found");
function less_stable_services() { global $NUM_HOSTS; /* opennms db connect */ $opennms_db = new ossim_db(); $opennms_conn = $opennms_db->opennms_connect(); $query = OssimQuery("SELECT servicename, count(servicename) \n FROM ifservices ifs, service s \n WHERE ifs.serviceid = s.serviceid AND ifs.status = 'D' \n GROUP BY servicename ORDER BY count(servicename) DESC \n LIMIT {$NUM_HOSTS}"); $rs =& $opennms_conn->Execute($query); if (!$rs) { print $opennms_conn->ErrorMsg(); } else { ?> <h2><?php echo _("Top"); ?> <?php echo "{$NUM_HOSTS}"; ?> <?php echo _("less stable services"); ?> </h2> <table align="center"> <tr> <th> <?php echo gettext("Service"); ?> </th> <th> <?php echo gettext("Ocurrences"); ?> </th> </tr> <?php while (!$rs->EOF) { $service = $rs->fields["servicename"]; $occurrences = number_format($rs->fields["count"], 0, ",", "."); ?> <tr> <td><?php echo $service; ?> </td> <td><?php echo $occurrences; ?> </td> </tr> <?php $rs->MoveNext(); } } $opennms_db->close($opennms_conn); echo "</table><br/>\n"; }
*/ header('Content-Type: text/xml'); require_once 'classes/Session.inc'; Session::logcheck("MenuIncidents", "IncidentsIncidents"); require_once 'ossim_db.inc'; require_once 'classes/Incident.inc'; require_once 'classes/Security.inc'; $q = GET('q'); ossim_valid($q, OSS_NULLABLE, OSS_SPACE, OSS_SCORE, OSS_ALPHA, OSS_PUNC, OSS_AT, 'illegal:' . _("q")); if (ossim_error()) { die(ossim_error()); } $db = new ossim_db(); $conn = $db->connect(); $countquery = OssimQuery("SELECT count(*) as count from incident_ticket\n where description like \"%{$q}%\""); $query = OssimQuery("SELECT description from incident_ticket where\n description like \"%{$q}%\""); if (!($rs =& $conn->Execute($countquery))) { print $conn->ErrorMsg(); } else { $num = $rs->fields["count"]; if ($num == 0) { ?> <response> <method>0</method> <result>no results</result> </response> <?php exit; } if (!($rs =& $conn->Execute($query))) { print $conn->ErrorMsg();
// 1) GET ALLOWED HOSTS $sensor_where = ""; if ($allowedSensors != "") { $user_sensors = explode(",", $allowedSensors); $sensor_str = ""; foreach ($user_sensors as $user_sensor) { if ($user_sensor != "") { $sensor_str .= ($sensor_str != "" ? "," : "") . "'" . $user_sensor . "'"; } } //if ($sensor_str == "") $sensor_str = "AND 0"; $sensor_where = "h.ip in (select hs.host_ip FROM host_sensor_reference hs,sensor s WHERE hs.sensor_name=s.name AND s.ip in(" . $sensor_str . "))"; } $network_where = ""; if ($allowedNets != "") { $query = OssimQuery("SELECT ip FROM host"); $hosts = ""; if (!($rs =& $conn->Execute($query))) { print $conn->ErrorMsg(); } else { while (!$rs->EOF) { if (Net::is_ip_in_cache_cidr($conn, $rs->fields["ip"], $allowedNets)) { $hosts .= ",'" . $rs->fields["ip"] . "'"; } $rs->MoveNext(); } $hosts = preg_replace("/^\\,/", "", $hosts); if ($hosts != "") { $network_where = "h.ip in ({$hosts})"; } }