yf_log_admin_redirects admin module

Fileplugins/logs/admin_modules/yf_log_admin_redirects.class.php
Useadmin URL ?object=log_admin_redirects

Public properties

A site sets them in its config with $PROJECT_CONF['log_admin_redirects']['NAME'] = ...;

PropertyDefaultDescription
$FOR_USER null

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_redirects') . ' WHERE is_admin="' . (string) ( ! $this->FOR_USER ? 1 : 0) . '"';
        return table($sql, [
                'filter' => (array) ($_SESSION[$filter_name] ?? null) + $default_filter,
                'filter_params' => [
                    'url_from' => 'like',
                    'url_to' => 'like',
                    'ip' => 'like',
                    'user_agent' => 'like',
                    'referer' => 'like',
                ],
            ])
            ->admin('user_id')
            ->link('ip', './?object=' . ($_GET['object'] ?? null) . '&action=show_for_ip&id=%d')
            ->date('date', ['format' => 'full', 'nowrap' => 1])
            ->text('user_agent')
            ->text('referer')
            ->text('url_from')
            ->text('url_to')
            ->text('exec_time');
    }
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('|', 'user_id|user_group|date|ip|user_agent|referer|url_from|url_to') as $f) {
            $order_fields[$f] = $f;
        }
        return form([], [
                'filter' => true,
            ])
            ->number('user_id')
            ->text('ip')
            ->text('user_agent')
            ->text('referer')
            ->text('url_from')
            ->text('url_to')
            ->select_box('order_by', $order_fields, ['show_text' => 1])
            ->order_box()
            ->save_and_clear();
    }