yf_log_admin_auth admin module

Admin "log in" info analyser.

Fileplugins/logs/admin_modules/yf_log_admin_auth.class.php
Useadmin URL ?object=log_admin_auth

Public properties

PropertyDefaultDescription
None declared in this class.

Public methods 5

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' => 'date',
            'order_direction' => 'desc',
        ];
        $sql = 'SELECT * FROM ' . db('log_admin_auth');
        return table($sql, [
                'filter' => (array) ($_SESSION[$filter_name] ?? null) + $default_filter,
                'filter_params' => [
                    'name' => 'like',
                ],
            ])
            ->admin('admin_id')
            ->link('ip', './?object=' . ($_GET['object'] ?? null) . '&action=show_for_ip&id=%d')
            ->date('date', ['format' => 'full', 'nowrap' => 1])
            ->text('user_agent')
            ->text('referer');
    }
public function show_for_admin()
    public function show_for_admin()
    {
        $_GET['page'] = 'clear';
        $_GET['filter'] = 'admin_id:' . (int) (($_GET['id'] ?? null));
        return $this->filter_save();
    }

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('|', 'admin_id|login|group|date|ip|user_agent|referer') as $f) {
            $order_fields[$f] = $f;
        }
        return form([], [
                'filter' => true,
            ])
            ->number('admin_id')
            ->text('ip')
            ->select_box('order_by', $order_fields, ['show_text' => 1])
            ->order_box()
            ->save_and_clear();
    }