ENXF NET
Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
- Joined
- Nov 13, 2018
- Messages
- 31,343
- Points
- 823
Reputation:
PHP:
By default stringToBinary will throw if passed an invalid IP, but
Continue reading...
Code:
protected function setupLogEntityActor(ModeratorLog $log, User $actor)
{
$log->user_id = $actor->user_id ?? 0;
if ($actor->user_id == \XF::visitor()->user_id)
{
$log->ip_address = Ip::stringToBinary(\XF::app()->request()->getIp());
}
}
By default stringToBinary will throw if passed an invalid IP, but
ModeratorLog will accept an empty ip address for example if this code gets invoked from the CLI where no IP address for the request exists.Continue reading...