<?php
/* Smarty version 4.5.6, created on 2025-12-20 23:19:20
  from '/var/www/html/tivi/panel/templates/security/dashboard.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.5.6',
  'unifunc' => 'content_694720e88fd681_99450053',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '7b2ef4f3b92c835ecde42079f69109908517095e' => 
    array (
      0 => '/var/www/html/tivi/panel/templates/security/dashboard.tpl',
      1 => 1766254364,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
),false)) {
function content_694720e88fd681_99450053 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_loadInheritance();
$_smarty_tpl->inheritance->init($_smarty_tpl, true);
?>


<?php 
$_smarty_tpl->inheritance->instanceBlock($_smarty_tpl, 'Block_1381866062694720e88f7121_65049747', "content");
?>

<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl, "layout.tpl");
}
/* {block "content"} */
class Block_1381866062694720e88f7121_65049747 extends Smarty_Internal_Block
{
public $subBlocks = array (
  'content' => 
  array (
    0 => 'Block_1381866062694720e88f7121_65049747',
  ),
);
public function callBlock(Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_checkPlugins(array(0=>array('file'=>'/var/www/html/tivi/vendor/smarty/smarty/libs/plugins/modifier.date_format.php','function'=>'smarty_modifier_date_format',),));
?>

<div class="container-fluid">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <div>
            <h4 class="mb-1">Bezpieczeństwo</h4>
            <p class="text-muted mb-0">Przegląd stanu bezpieczeństwa systemu</p>
        </div>
    </div>

    <!-- Statystyki -->
    <div class="row g-4 mb-4">
        <div class="col-sm-6 col-xl-3">
            <div class="card">
                <div class="card-body">
                    <div class="d-flex justify-content-between">
                        <div>
                            <p class="text-muted mb-1">Logowania (30 dni)</p>
                            <h3 class="mb-0"><?php echo (($tmp = $_smarty_tpl->tpl_vars['stats']->value['logins']['total'] ?? null)===null||$tmp==='' ? 0 ?? null : $tmp);?>
</h3>
                        </div>
                        <div class="text-primary"><i class="bi bi-door-open fs-1"></i></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-6 col-xl-3">
            <div class="card">
                <div class="card-body">
                    <div class="d-flex justify-content-between">
                        <div>
                            <p class="text-muted mb-1">Nieudane próby</p>
                            <h3 class="mb-0 text-danger"><?php echo (($tmp = $_smarty_tpl->tpl_vars['stats']->value['logins']['failed'] ?? null)===null||$tmp==='' ? 0 ?? null : $tmp);?>
</h3>
                        </div>
                        <div class="text-danger"><i class="bi bi-x-circle fs-1"></i></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-6 col-xl-3">
            <div class="card">
                <div class="card-body">
                    <div class="d-flex justify-content-between">
                        <div>
                            <p class="text-muted mb-1">Zablokowane IP</p>
                            <h3 class="mb-0 text-warning"><?php echo (($tmp = $_smarty_tpl->tpl_vars['stats']->value['blocked_ips'] ?? null)===null||$tmp==='' ? 0 ?? null : $tmp);?>
</h3>
                        </div>
                        <div class="text-warning"><i class="bi bi-shield-x fs-1"></i></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-6 col-xl-3">
            <div class="card">
                <div class="card-body">
                    <div class="d-flex justify-content-between">
                        <div>
                            <p class="text-muted mb-1">Reguły IP</p>
                            <h3 class="mb-0"><?php echo ((($tmp = $_smarty_tpl->tpl_vars['stats']->value['ip_rules']['whitelist'] ?? null)===null||$tmp==='' ? 0 ?? null : $tmp))+((($tmp = $_smarty_tpl->tpl_vars['stats']->value['ip_rules']['blacklist'] ?? null)===null||$tmp==='' ? 0 ?? null : $tmp));?>
</h3>
                        </div>
                        <div class="text-info"><i class="bi bi-shield-lock fs-1"></i></div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="row g-4">
        <!-- Ostatnie nieudane logowania -->
        <div class="col-lg-6">
            <div class="card">
                <div class="card-header d-flex justify-content-between align-items-center">
                    <h5 class="card-title mb-0"><i class="bi bi-exclamation-triangle me-2 text-danger"></i>Ostatnie nieudane logowania</h5>
                    <a href="<?php echo $_smarty_tpl->tpl_vars['baseUrl']->value;?>
/reports/logins?success=0" class="btn btn-sm btn-outline-secondary">Zobacz wszystkie</a>
                </div>
                <div class="card-body p-0">
                    <div class="table-responsive">
                        <table class="table table-hover mb-0">
                            <thead>
                                <tr>
                                    <th>IP</th>
                                    <th>Użytkownik</th>
                                    <th>Data</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['recentFailed']->value, 'login');
$_smarty_tpl->tpl_vars['login']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['login']->value) {
$_smarty_tpl->tpl_vars['login']->do_else = false;
?>
                                <tr>
                                    <td><code><?php echo $_smarty_tpl->tpl_vars['login']->value['ip_address'];?>
</code></td>
                                    <td><?php echo (($tmp = $_smarty_tpl->tpl_vars['login']->value['username'] ?? null)===null||$tmp==='' ? '-' ?? null : $tmp);?>
</td>
                                    <td><?php echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['login']->value['created_at'],"%d.%m %H:%M");?>
</td>
                                </tr>
                                <?php
}
if ($_smarty_tpl->tpl_vars['login']->do_else) {
?>
                                <tr>
                                    <td colspan="3" class="text-center py-4 text-muted">Brak nieudanych prób</td>
                                </tr>
                                <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>

        <!-- Top failed IPs -->
        <div class="col-lg-6">
            <div class="card">
                <div class="card-header">
                    <h5 class="card-title mb-0"><i class="bi bi-bar-chart me-2"></i>Najczęstsze nieudane IP</h5>
                </div>
                <div class="card-body p-0">
                    <ul class="list-group list-group-flush">
                        <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['stats']->value['top_failed_ips'], 'ip');
$_smarty_tpl->tpl_vars['ip']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['ip']->value) {
$_smarty_tpl->tpl_vars['ip']->do_else = false;
?>
                        <li class="list-group-item d-flex justify-content-between align-items-center">
                            <code><?php echo $_smarty_tpl->tpl_vars['ip']->value['ip_address'];?>
</code>
                            <span class="badge bg-danger rounded-pill"><?php echo $_smarty_tpl->tpl_vars['ip']->value['count'];?>
 prób</span>
                        </li>
                        <?php
}
if ($_smarty_tpl->tpl_vars['ip']->do_else) {
?>
                        <li class="list-group-item text-center text-muted">Brak danych</li>
                        <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                    </ul>
                </div>
            </div>
        </div>
    </div>

    <!-- Szybkie akcje -->
    <div class="card mt-4">
        <div class="card-header">
            <h5 class="card-title mb-0"><i class="bi bi-lightning me-2"></i>Szybkie akcje</h5>
        </div>
        <div class="card-body">
            <div class="row g-3">
                <div class="col-md-4">
                    <a href="<?php echo $_smarty_tpl->tpl_vars['baseUrl']->value;?>
/security/ip-rules" class="btn btn-outline-primary w-100">
                        <i class="bi bi-shield-lock me-2"></i>Zarządzaj regułami IP
                    </a>
                </div>
                <div class="col-md-4">
                    <a href="<?php echo $_smarty_tpl->tpl_vars['baseUrl']->value;?>
/reports/logins" class="btn btn-outline-secondary w-100">
                        <i class="bi bi-clock-history me-2"></i>Historia logowań
                    </a>
                </div>
                <div class="col-md-4">
                    <a href="<?php echo $_smarty_tpl->tpl_vars['baseUrl']->value;?>
/admin/settings" class="btn btn-outline-secondary w-100">
                        <i class="bi bi-gear me-2"></i>Ustawienia bezpieczeństwa
                    </a>
                </div>
            </div>
        </div>
    </div>
</div>
<?php
}
}
/* {/block "content"} */
}
