$general['Metrics']['date_to_unix'] = mktime(0, 0, 0, $general['Metrics']['date_to_unix'][1], $general['Metrics']['date_to_unix'][2], $general['Metrics']['date_to_unix'][0]); $conf = $GLOBALS['CONF']; $db = new ossim_db(); $conn = $db->connect(); $query_temp = array(); $allowed = array(); $date_from_sql = "'" . $date_from . "'"; $date_to_sql = "'" . $date_to . "'"; $dates_filter = array(); $dates_filter['max_c_date'] = "AND (max_c_date BETWEEN {$date_from_sql} AND {$date_to_sql})"; $dates_filter['max_a_date'] = "AND (max_a_date BETWEEN {$date_from_sql} AND {$date_to_sql})"; // Join with control_panel. Prevent too long lists $host_filters['where'] = 'control_panel.id = HEX(host.id)'; $nets_filters['where'] = 'control_panel.id = HEX(net.id)'; $param['hosts'] = get_allowed_hosts($conn, ', control_panel', $host_filters); $param['nets'] = get_allowed_nets($conn, ', control_panel', $nets_filters); $param['user'] = Session::get_session_user(); /* echo "<pre>"; print_r($param); echo "</pre>"; exit; */ $dateDiff = strtotime($date_to) - strtotime($date_from); $ddiff = floor($dateDiff / (60 * 60 * 24)); function extractArray($array, $num_elem = NULL) { $num_elem = $num_elem == NULL ? 10 : $num_elem; $arrayTemp = count($array) > $num_elem ? array_splice($array, 0, $num_elem) : $array; return $arrayTemp; }
* * On Debian GNU/Linux systems, the complete text of the GNU General * Public License can be found in `/usr/share/common-licenses/GPL-2'. * * Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt * */ require_once 'classes/Security.inc'; Session::logcheck('report-menu', 'ReportsReportServer'); $db = new ossim_db(); $conn = $db->connect(); $user = Session::get_session_user(); $inserts = array(); $ips_filter = ''; $ips_filter_tmp = ''; $param['nets'] = get_allowed_nets($conn); if (count($param['nets']) > 0) { $tmp_filter = array(); foreach ($param['nets'] as $net_data) { $e_cidrs = Asset_net::expand_cidr($net_data['ips'], 'SHORT', 'LONG'); foreach ($e_cidrs as $long_ips) { $tmp_filter[] = "((INET_ATON(source) >= " . $long_ips[0] . " AND INET_ATON(source) <= " . $long_ips[1] . ") \n OR (INET_ATON(destination) >= " . $long_ips[0] . " AND INET_ATON(destination) <= " . $long_ips[1] . "))"; } } $ips_filter_tmp = implode(' OR ', $tmp_filter); } if ($ips_filter_tmp != '') { $ips_filter = 'AND ' . $ips_filter_tmp; } //$date_filter = ($year_to!=$year) ? "($year,$year_to)" : "($year)"; // Updated: Date filter disabled. Already filtering by date_from-date_to RANGE each query