<tr class="{if $sessionLog->active} activeContainer{/if}">
<td class="columnID columnSessionLogID"><p>{@$sessionLog->sessionLogID}</p></td>
<td class="columnTitle columnUsername"><p>{if $__wcf->user->userID == $sessionLog->userID}<img src="{@$__wcf->getPath()}icon/user.svg" alt="" class="icon16" />{/if} <a href="{link controller='ACPSessionLog' id=$sessionLog->sessionLogID}{/link}">{$sessionLog->username}</a></p></td>
- <td class="columnSmallText columnIpAddress"><p><a href="{link controller='ACPSessionLog' id=$sessionLog->sessionLogID}{/link}">{$sessionLog->ipAddress}</a>{if $sessionLog->hostname != $sessionLog->ipAddress}<br /><a href="{link controller='ACPSessionLog' id=$sessionLog->sessionLogID}{/link}">{$sessionLog->hostname}</a>{/if}</p></td>
+ <td class="columnSmallText columnIpAddress"><p><a href="{link controller='ACPSessionLog' id=$sessionLog->sessionLogID}{/link}">{$sessionLog->getIpAddress()}</a>{if $sessionLog->hostname != $sessionLog->ipAddress}<br /><a href="{link controller='ACPSessionLog' id=$sessionLog->sessionLogID}{/link}">{$sessionLog->hostname}</a>{/if}</p></td>
<td class="columnSmallText columnUserAgent" title="{$sessionLog->userAgent}"><p><a href="{link controller='ACPSessionLog' id=$sessionLog->sessionLogID}{/link}">{$sessionLog->userAgent|truncate:75}</a></p></td>
<td class="columnDate columnTime"><p>{@$sessionLog->time|time}</p></td>
<td class="columnDate columnLastActivityTime"><p>{@$sessionLog->lastActivityTime|time}</p></td>
namespace wcf\data\acp\session\log;
use wcf\data\DatabaseObject;
use wcf\system\WCF;
+use wcf\util\UserUtil;
/**
* Represents a session log entry.
return 0;
}
+
+ /**
+ * Returns the ip address and attempts to convert into IPv4.
+ *
+ * @return string
+ */
+ public function getIpAddress() {
+ return UserUtil::convertIPv6To4($this->ipAddress);
+ }
}
use wcf\data\acp\session\log\ACPSessionLogEditor;
use wcf\system\event\IEventListener;
use wcf\system\WCF;
+use wcf\util\UserUtil;
/**
* Creates the session access log.
$sessionLog = ACPSessionLogEditor::create(array(
'sessionID' => WCF::getSession()->sessionID,
'userID' => WCF::getUser()->userID,
- 'ipAddress' => WCF::getSession()->ipAddress,
+ 'ipAddress' => UserUtil::getIpAddress(),
'hostname' => @gethostbyaddr(WCF::getSession()->ipAddress),
'userAgent' => WCF::getSession()->userAgent,
'time' => TIME_NOW,
// save access
ACPSessionAccessLogEditor::create(array(
'sessionLogID' => $sessionLogID,
- 'ipAddress' => WCF::getSession()->ipAddress,
+ 'ipAddress' => UserUtil::getIpAddress(),
'time' => TIME_NOW,
'requestURI' => $requestURI,
'requestMethod' => WCF::getSession()->requestMethod,
// set up data
$data = array(
- 'ipAddress' => $this->ipAddress,
+ 'ipAddress' => UserUtil::getIpAddress(),
'userAgent' => $this->userAgent,
'requestURI' => $this->requestURI,
'requestMethod' => $this->requestMethod,