• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed  Unused variable in

R

ragtek

Guest
#1
In Method getContentIpInfo and getOnlineUserIp you set a variable contentHost, but you don't use it.

Instead of using it, you run _getHost a second time.

PHP:
    public function getContentIpInfo(array $content)
    {
        if ($content['ip_id'])
        {
            $ip = $this->getIpById($content['ip_id']);
            $contentIp = $ip['ip_address'];
            $contentHost = $this->_getHost($contentIp);
        }

        return $this->getRegistrationIps($content['user_id']) + array(
            'contentIp'    => (empty($contentIp) ? false : $contentIp),
            'contentHost'  => (empty($contentIp) ? false : $this->_getHost($contentIp)),
        );
    }

    /**
     * Gets IP info for an online user
     *
     * @param array $onlineUser
     *
     * @return array (contentIp, contentHost, registrationIp, registrationHost, confirmationIp, confirmationHost)
     */
    public function getOnlineUserIp($onlineUser)
    {
        if ($onlineUser['ip'])
        {
            $contentIp = long2ip($onlineUser['ip']);
            $contentHost = $this->_getHost($contentIp);
        }

        return $this->getRegistrationIps($onlineUser['user_id']) + array(
            'contentIp'   => (empty($contentIp) ? false : $contentIp),
            'contentHost' => (empty($contentIp) ? false : $this->_getHost($contentIp)),
        );
    }