yf_log_user_auth_fails admin module

Log authentification fails viewer.

Fileplugins/logs/admin_modules/yf_log_user_auth_fails.class.php
Useadmin URL ?object=log_user_auth_fails

Public properties

PropertyDefaultDescription
None declared in this class.

Public methods 4

filter_save

public function filter_save()
    public function filter_save()
    {
        return _class('admin_methods')->filter_save();
    }

show

public function show()
    public function show()
    {
        $filter_name = ($_GET['object'] ?? null) . '__' . ($_GET['action'] ?? null);
        $default_filter = [
            'order_by' => 'time',
            'order_direction' => 'desc',
        ];
        $sql = 'SELECT * FROM ' . db('log_auth_fails');
        return table($sql, [
                'filter' => (array) ($_SESSION[$filter_name] ?? null) + $default_filter,
                'filter_params' => [
                    'name' => 'like',
                ],
            ])
            ->text('reason', ['data' => $this->_reasons])
            ->date('time', ['format' => 'full', 'nowrap' => 1])
            ->link('ip', './?object=' . ($_GET['object'] ?? null) . '&action=show_for_ip&id=%d')
            ->text('login')
            ->text('pswd')
            ->text('user_agent')
            ->text('referer');
    }

show_for_ip

public function show_for_ip()
    public function show_for_ip()
    {
        $_GET['page'] = 'clear';
        $_GET['filter'] = 'ip:' . preg_replace('~[^0-9\.]+~ims', '', $_GET['id']);
        return $this->filter_save();
    }

Methods starting with _ hooks and helpers; not routable as page actions

_show_filter

public function _show_filter()
    public function _show_filter()
    {
        if ( ! in_array(($_GET['action'] ?? null), ['show'])) {
            return false;
        }
        $order_fields = [];
        foreach (explode('|', 'login|time|ip|user_agent|referer') as $f) {
            $order_fields[$f] = $f;
        }
        return form([], [
                'filter' => true,
            ])
            ->text('login')
            ->text('ip')
            ->select_box('reason', $this->_reasons, ['show_text' => 1])
            ->select_box('order_by', $order_fields, ['show_text' => 1])
            ->order_box()
            ->save_and_clear();
    }