private function reset() { $this->_set('limit', 50); $this->_def('limitstart', 0); $query = 'SELECT remote_ip ' . 'FROM raw_log ' . 'GROUP BY remote_ip'; $this->gates = F::$dbo->fetch($query, 'remote_ip'); $this->_set('gate', isset($_GET['gate']) ? $_GET['gate'] : reset($this->gates)); $this->categories = helper::getCount('raw_log', 'cat_name', $this->_get('gate')); $this->_set('category', isset($_GET['category']) ? $_GET['category'] : ''); }
<?php $highlight = array(); $events = helper::getCount('cat_conn', 'event'); $rules = helper::getCount('cat_conn', 'rule'); $proto = helper::getCount('cat_conn', 'connipproto'); helper::fixFilterLabels($proto); $select = array(); $from = "FROM cat_conn\n"; $where = array(); $group = array(); if (R::_('connsrcip') && R::_('connsrcip-group')) { $select[] = '*'; $select[] = 'sum(origsent) AS origsent'; $select[] = 'sum(termsent) AS termsent'; $select[] = 'sum(conntime) AS conntime'; } helper::processFilterSimple($where, 'remote_ip', R::_('gate')); helper::processFilterSimple($where, 'event', R::_('event')); helper::processFilterSimple($where, 'rule', R::_('rule')); helper::processFilterCanBeEmpty($where, 'connipproto', R::_('proto')); helper::processFilterCanBeEmpty($where, 'connsrcip', R::_('connsrcip')); if (R::_('connsrcip-group')) { $select[] = 'count(id) AS cnt'; $group[] = 'conndestip'; } helper::processFilterDefault($where); helper::processFilterFreeText($where, R::_('free_text'), $highlight); $select = 'SELECT' . (!empty($select) ? "\n " . implode(",\n ", $select) : ' *') . "\n"; $where = !empty($where) ? "WHERE " . implode("\nAND ", $where) . "\n" : ''; $group = !empty($group) ? "GROUP BY " . implode(' ', $group) . "\n" : '';
<?php $highlight = array(); $events = helper::getCount('cat_rule', 'event'); $rules = helper::getCount('cat_rule', 'rule'); $actions = helper::getCount('cat_rule', 'action'); $proto = helper::getCount('cat_rule', 'ipproto'); helper::fixFilterLabels($proto); $select = array('*'); $from = "FROM cat_rule\n"; $where = array(); $group = array(); helper::processFilterSimple($where, 'remote_ip', R::_('gate')); helper::processFilterSimple($where, 'event', R::_('event')); helper::processFilterSimple($where, 'action', R::_('action')); helper::processFilterSimple($where, 'rule', R::_('rule')); helper::processFilterCanBeEmpty($where, 'ipproto', R::_('proto')); helper::processFilterCanBeEmpty($where, 'srcip', R::_('srcip')); helper::processFilterCanBeEmpty($where, 'destip', R::_('destip')); if (R::_('srcip-group')) { $select[] = 'count(id) AS cnt'; $group[] = 'destip'; } helper::processFilterDefault($where); helper::processFilterFreeText($where, R::_('free_text'), $highlight); $select = 'SELECT' . (!empty($select) ? "\n " . implode(",\n ", $select) : ' *') . "\n"; $where = !empty($where) ? "WHERE " . implode("\nAND ", $where) . "\n" : ''; $group = !empty($group) ? "GROUP BY " . implode(' ', $group) . "\n" : ''; $rows = F::$dbo->fetchLimited($select . $from . $where . $group); $group = !empty($group) ? $group : "GROUP BY id\n"; $q = F::$dbo->query('SELECT COUNT(id),min(datetime),max(datetime) FROM (SELECT id,datetime ' . $from . $where . $group . ') AS rows');