function PrintResultCnt($sqlgraph = "", $tr = array(), $displaying = "") { global $show_rows, $db; echo "<table class='container' style='height:30px'><tr><td>"; if ($displaying == "") { $displaying = gettext("Displaying %d to %d of <b>%s</b> events."); } if ($this->num_result_rows > 0) { if ($this->isCannedQuery()) { echo "<div class='siem_display_msg' style='text-align:left;margin:auto;padding:3px 0px'>" . gettext("Displaying") . " " . Util::htmlentities($this->GetCurrentCannedQueryDesc()) . "</div>"; } else { if (Session::am_i_admin()) { // Total rows $rt = $db->baseExecute("SELECT sum(cnt) from ac_acid_event"); // from ac_ table => faster way if ($rt) { $rows = $rt->baseFetchRow(); $this->num_acid_event_rows = $rows[0]; } $rt->baseFreeRows(); } printf("<div class='siem_display_msg' style='float:left;margin:auto;padding:4px 0px'>" . $displaying . "</div>\n", $this->current_view * $show_rows + 1, $this->current_view * $show_rows + $show_rows - 1 < $this->num_result_rows ? $this->current_view * $show_rows + $show_rows : $this->num_result_rows, Util::number_format_locale($this->num_result_rows, 0)); if (Session::am_i_admin()) { printf("<div class='siem_display_msg' style='float:right;margin:auto'>" . gettext(" <b>%s</b> total events in database.") . "</div>\n", Util::number_format_locale($this->num_acid_event_rows, 0)); } //printf("<div style='text-align:left;margin:auto'><table><tr><td><img src='../pixmaps/arrow_green.gif'></td><td>". $displaying . "</td>\n", ($this->current_view * $show_rows) + 1, (($this->current_view * $show_rows) + $show_rows - 1) < $this->num_result_rows ? (($this->current_view * $show_rows) + $show_rows) : $this->num_result_rows, Util::number_format_locale($this->num_result_rows,0), Util::number_format_locale($this->num_acid_event_rows,0)); if ($sqlgraph != "") { global $db, $graph_report_type; list($x, $y, $xticks, $xlabels) = range_graphic($tr); //echo "SQLG:$sqlgraph -->"; $res = $this->ExecuteOutputQueryNoCanned($sqlgraph, $db); //echo " COUNT:".$res->baseRecordCount()."<br>"; while ($rowgr = $res->baseFetchRow()) { //print_r($rowgr); $label = trim($rowgr[1] . " " . $rowgr[2]); if (isset($y[$label]) && $y[$label] == 0) { $y[$label] = $rowgr[0]; } //echo "$label = $rowgr[0] <br>"; } // Report data $gdata = array(); foreach ($y as $label => $val) { $gdata[] = array($label, "", "", "", "", "", "", "", "", "", "", $val, 0, 0); } $this->SaveReportData($gdata, $graph_report_type); //print_r($xlabels); //print_r($xticks); //print_r ($x); //print_r ($y); $plot = plot_graphic("plotareaglobal", 50, 400, $x, $y, $xticks, $xlabels, true); //echo "PLOT:".Util::htmlentities($plot)."."; echo "<td class=axis>{$plot}</td>"; } echo "</tr></table></div>\n"; } } else { printf("<B>" . _("No events matching your search criteria have been found. Try fewer conditions.") . "</B> <a style='color:white' href='base_qry_main.php?clear_allcriteria=1&num_result_rows=-1&submit=Query+DB¤t_view=-1&sort_order=time_d'>[..." . _("Clear All Criteria") . "...]</a>\n"); echo '<script>$("#actions_link").prop("disabled",true);</script>'; //printf("<P style='color:white;font-size:10px'><B>" . _("No events matching your search criteria have been found. Try fewer conditions.") . "</B> <a href='base_qry_main.php?clear_allcriteria=1&num_result_rows=-1&submit=Query+DB¤t_view=-1&sort_order=time_d'>[..." . _("Clear All Criteria") . "...]</a><P>\n"); } echo "</td></tr></table>"; }
<body> <center><div id="plotareaglobal" class="plot" style="text-align:center;margin:12px 15px 0px 0px;"></div></center> <?php $qs = new QueryState(); $db = NewBASEDBConnection($DBlib_path, $DBtype); $db->baseDBConnect($db_connect_method, $alert_dbname, $alert_host, $alert_port, $alert_user, $alert_password); $sqlgraph = $_SESSION['siem_current_query_graph']; $tr = $_SESSION["time_range"] != "" ? $_SESSION["time_range"] : "all"; $trdata = array(0, 0, $tr); if ($tr == "range") { $desde = strtotime($_SESSION["time"][0][4] . "-" . $_SESSION["time"][0][2] . "-" . $_SESSION["time"][0][3] . ' ' . $_SESSION['time'][0][5] . ':' . $_SESSION['time'][0][6] . ':' . $_SESSION['time'][0][7]); $hasta = strtotime($_SESSION["time"][1][4] . "-" . $_SESSION["time"][1][2] . "-" . $_SESSION["time"][1][3] . ' ' . $_SESSION['time'][1][5] . ':' . $_SESSION['time'][1][6] . ':' . $_SESSION['time'][1][7]); $trdata = array($desde, $hasta, "range"); } list($x, $y, $xticks, $xlabels) = range_graphic($trdata); if (count($y) > 1) { //echo "SQLG:$sqlgraph -->"; $res = $qs->ExecuteOutputQueryNoCanned($sqlgraph, $db); //echo " COUNT:".$res->baseRecordCount()."<br>"; while ($rowgr = $res->baseFetchRow()) { //print_r($rowgr); $label = trim($rowgr[1] . " " . $rowgr[2]); if (isset($y[$label]) && $y[$label] == 0) { $y[$label] = $rowgr[0]; } //echo "$label = $rowgr[0] <br>"; } // Report data $gdata = array(); foreach ($y as $label => $val) {