Выложите пожалуйста данный мануал или плагин

Статус
В этой теме нельзя размещать новые ответы.

grom12

Проверенные
Сообщения
76
Реакции
11
Баллы
710
Всем доброго вечера. Если кто может выложите данный мануал/плагин
Спасибо.
 
grom12,

This is how to hide IP address of Admin / Moderator's / Any other user that you pick (as long as you have defined specific user ID).
Well, it is not "hiding", actually it is overwriting their IP data in the database with a fake IP.

This modification needs file editing to core Xenforo file, which is located in :
Код:
/library/Xenforo/Model/Ip.php
Please make a backup copy of that file before proceeding ;)

But please note :
  • The file change will be overwriten if you upload new Xenforo files while upgrading the board.
  • Even when you undo the file edit, the fake IP data will not be replaced with the real IP. This is one-way replacement.
  • This mod does not replace IP data which was recorded before this mod is activated.
    So if you want to replace your old IP data, you have to run a SQL query such as this :
    Code:
    UPDATE xf_ip SET ip = 'cccc' WHERE user_id =1
    (cccc means 99.99.99.99, if you wonder)
~~~~~~~~~~~
First, you have to decide which fake IP do you want to use. 99.99.99.99, or 88.88.88.88 or something else.
Please note : i noticed that some IP such as 1.1.1.1 won't work, which means NULL will be recorded as the IP.
I don't know why that happens.
I pick 99.99.99.99 :D

Second, here goes the file editing, for example you want to set user ID 1 to have IP 99.99.99.99

Search for this
PHP:
    public function logIp($userId, $contentType, $contentId, $action, $ipAddress = null, $date = null)
    {
        $ipAddress = XenForo_Helper_Ip::getBinaryIp(null, $ipAddress);
        if (!$ipAddress)
        {
            return 0;
        }

        if ($date === null)
        {
            $date = XenForo_Application::$time;
        }

        $this->_getDb()->insert('xf_ip', array(
            'user_id' => $userId,
            'content_type' => $contentType,
            'content_id' => $contentId,
            'action' => $action,
            'ip' => $ipAddress,
            'log_date' => max(0, $date)
        ));

        return $this->_getDb()->lastInsertId();
    }
Replace with this :
PHP:
    public function logIp($userId, $contentType, $contentId, $action, $ipAddress = null, $date = null)
    {
        if (1 == $userId) {/* Semprot modification */
            $ipAddress = '99.99.99.99';
        }

        $ipAddress = XenForo_Helper_Ip::getBinaryIp(null, $ipAddress);
        if (!$ipAddress)
        {
            return 0;
        }

        if ($date === null)
        {
            $date = XenForo_Application::$time;
        }

        $this->_getDb()->insert('xf_ip', array(
            'user_id' => $userId,
            'content_type' => $contentType,
            'content_id' => $contentId,
            'action' => $action,
            'ip' => $ipAddress,
            'log_date' => max(0, $date)
        ));

        return $this->_getDb()->lastInsertId();
    }
If you want to hide IP of some user IDs (1, 22, 192, 391) :
Replace with this :
PHP:
    public function logIp($userId, $contentType, $contentId, $action, $ipAddress = null, $date = null)
    {
        if (in_array($userId, array(1, 22, 192, 391))) {/* Semprot modification */
            $ipAddress = '99.99.99.99';
        }

        $ipAddress = XenForo_Helper_Ip::getBinaryIp(null, $ipAddress);
        if (!$ipAddress)
        {
            return 0;
        }

        if ($date === null)
        {
            $date = XenForo_Application::$time;
        }

        $this->_getDb()->insert('xf_ip', array(
            'user_id' => $userId,
            'content_type' => $contentType,
            'content_id' => $contentId,
            'action' => $action,
            'ip' => $ipAddress,
            'log_date' => max(0, $date)
        ));

        return $this->_getDb()->lastInsertId();
    }
  • Tested on Xenforo 1.5.11
  • This modification is free, and you can use this code in your add on for free, just PM me first ;)
 
Статус
В этой теме нельзя размещать новые ответы.
Современный облачный хостинг провайдер | Aéza
Назад
Сверху Снизу