public function getLogVisibleIp($ip, $user = null) { if ($user instanceof PermissionUser && $user->canViewRawIP()) { return $ip; } return ip_less($ip); }
public function getLogVisibleIp($ip, PermissionUser $user = null) { if ($user !== null) { return $user->getTextForIP($ip); } return ip_less($ip); }
public function getBoardHistory(Board $board, Post $post) { $posts = $board->posts()->with('op')->withEverything()->where('author_ip', $post->author_ip)->orderBy('post_id', 'desc')->paginate(15); foreach ($posts as $item) { $item->setRelation('board', $board); } return $this->view(static::VIEW_HISTORY, ['posts' => $posts, 'multiboard' => false, 'ip' => ip_less($post->author_ip->toText())]); }
/** * Returns a human-readable IP address based on user permissions. * This will obfuscate it if we do not have permission to view raw IPs. * * @param string $ip Normal IP string. * @return string Either $ip or an ip_less version. */ public function getTextForIP($ip) { if ($this->canViewRawIP()) { return $ip; } return ip_less($ip); }
/** * Returns a human-readable IP address based on user permissions. * This will obfuscate it if we do not have permission to view raw IPs. * * @param string|CIDR $ip Normal IP string or a CIDR support object. * @return string Either $ip or an ip_less version. */ public function getTextForIP($ip) { if ($this->canViewRawIP()) { return (string) $ip; } if ($ip instanceof CIDR && $ip->getStart() != $ip->getEnd()) { return ip_less($ip->getStart()) . "/" . $ip->getPrefix(); } return ip_less($ip); }