Example #1
0
 public static function processFilterDefault(array &$where)
 {
     if (R::_('date_start')) {
         $where[] = 'datetime > ' . F::$dbo->escape(R::_('date_start'), true);
     }
     if (R::_('date_end')) {
         $where[] = 'datetime < ' . F::$dbo->escape(R::_('date_end'), true);
     }
 }
Example #2
0
        $pages[$i]['label'] = $i;
    }
    for ($i = $totalPages - 4; $i <= $totalPages; $i++) {
        $pages[$i] = array();
        $pages[$i]['liclass'] = $i == $active ? ' class="disabled"' : '';
        $pages[$i]['limitstart'] = $i - 1;
        $pages[$i]['label'] = $i;
    }
}
ksort($pages);
?>

<nav>
	<ul class="pagination">
		<li<?php 
echo R::_('limitstart') == 0 ? ' class="disabled"' : '';
?>
>
			<a href="#" <?php 
echo $active > 1 ? ' data-limitstart="' . ($active - 2) . '"' : '';
?>
>
				<span aria-hidden="true">&laquo;</span>
			</a>
		</li>
		<?php 
foreach ($pages as $i => $info) {
    if ($i > 1 && !array_key_exists($i - 1, $pages)) {
        echo '<li class="disabled">';
        echo '<a href="#">...</a>';
        echo '</li>';
Example #3
0
    $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" : '';
$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),sum(oSent),sum(tSent) FROM (SELECT id,datetime,sum(origsent) AS oSent, sum(termsent) AS tSent ' . $from . $where . $group . ') AS rows');
if ($result = $q->fetch_array()) {
    $resultsTotal = $result[0];
    $resultsStart = $result[1];
    $resultsEnd = $result[2];
    if (R::_('connsrcip')) {
        $resultsOrigSent = $result[3];
        $resultsTermSent = $result[4];
    }
}
Example #4
0
	<div class="col-sm-10"><b><?php 
    echo R::_('srcip');
    ?>
</b></div>
</div>
<?php 
}
?>

<?php 
if (R::_('destip')) {
    ?>
<div class="row">
	<div class="col-sm-2"><b>DestIp</b></div>
	<div class="col-sm-10"><b><?php 
    echo R::_('destip');
    ?>
</b></div>
</div>
<?php 
}
?>

<div class="row">
	<div class="col-sm-2">Время SQL запроса</div>
	<div class="col-sm-10"><?php 
echo F::$dbo->getTimer(false);
?>
</div>
</div>
Example #5
0
$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');
if ($result = $q->fetch_array()) {
    $resultsTotal = $result[0];
    $resultsStart = $result[1];
    $resultsEnd = $result[2];
}
Example #6
0
			Текст для поиска
			<span class="small text-muted">Одна строка - одно устовие</span>
			<span class="small text-muted">Префикс "!" для исключения</span>
			<span class="small text-muted">Префикс "+" для включения</span>
		</label>
		<div>
			<textarea id="free_text"
				name="free_text"
				class="form-control"
				wrap='off'
				rows="<?php 
echo max(4, count(explode("\n", trim(R::_('free_text')))) + 1);
?>
"
			><?php 
echo R::_('free_text');
?>
</textarea>
		</div>
	</div>

	<div class="form-group">
		<button type="submit" class="btn btn-primary btn-block">Применить</button>
	</div>
	<div class="form-group">
		<button type="button" id="refresh" class="btn btn-default btn-block">Обновить</button>
	</div>
	<div class="form-group">
		<button type="button" id="reset" class="btn btn-warning btn-block">Очистить</button>
	</div>
</form>
Example #7
0
						<li<?php 
echo R::_('category') == '' ? ' class="disabled"' : '';
?>
>
							<a href="#"
									data-role="filter"
									data-key="category"
									data-value="">
									- Все категории -
								</a>
						</li>
						<?php 
foreach (R::categories() as $row) {
    ?>
							<li<?php 
    echo $row['label'] == R::_('category') ? ' class="disabled"' : '';
    ?>
>
								<a href="#"
									data-role="filter"
									data-key="category"
									data-value="<?php 
    echo $row['label'];
    ?>
">
									<?php 
    echo $row['label'];
    ?>
 (<?php 
    echo $row['count'];
    ?>
Example #8
0
    }
    ?>

			<?php 
    if (!R::_('proto')) {
        ?>
				<td><?php 
        echo $row['ipproto'];
        ?>
</td>
			<?php 
    }
    ?>

			<?php 
    if (R::_('srcip-group')) {
        ?>
				<td><?php 
        echo $row['cnt'];
        ?>
</td>
			<?php 
    }
    ?>

			<td><?php 
    echo $row['srcip'];
    ?>
</td>
			<td><?php 
    echo $row['destip'];
Example #9
0
    }
    ?>

			<?php 
    if (R::_('connsrcip-group')) {
        ?>
				<td><?php 
        echo $row['cnt'];
        ?>
</td>
			<?php 
    }
    ?>

			<?php 
    if (!R::_('proto')) {
        ?>
				<td><?php 
        echo $row['connipproto'];
        ?>
</td>
			<?php 
    }
    ?>
			<td><?php 
    if (!empty($row['connsrcip'])) {
        echo '<div>';
        echo $row['connrecvif'] ? $row['connrecvif'] . '@' : '';
        echo $row['connsrcip'];
        echo $row['connsrcport'] ? ':' . $row['connsrcport'] : '';
        echo '</div>';
Example #10
0
	<div class="col-sm-10"><b><?php 
    echo R::_('proto');
    ?>
</b></div>
</div>
<?php 
}
?>

<?php 
if (R::_('connsrcip')) {
    ?>
<div class="row">
	<div class="col-sm-2"><b>ConnSrcIp</b></div>
	<div class="col-sm-10"><b><?php 
    echo R::_('connsrcip');
    ?>
</b></div>
</div>
<div class="row">
	<div class="col-sm-2"><b>origSent</b></div>
	<div class="col-sm-10"><b><?php 
    echo number_format($resultsOrigSent, 0);
    ?>
 байт</b></div>
</div>
<div class="row">
	<div class="col-sm-2"><b>TermSent</b></div>
	<div class="col-sm-10"><b><?php 
    echo number_format($resultsTermSent, 0);
    ?>
Example #11
0
 public function getLimit()
 {
     return ' LIMIT ' . R::_('limit') * R::_('limitstart') . ', ' . R::_('limit');
 }