Added registration ip address to user profile and ACP user list
authorAlexander Ebert <ebert@woltlab.com>
Sun, 23 Jul 2017 16:46:19 +0000 (18:46 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 23 Jul 2017 16:46:24 +0000 (18:46 +0200)
Closes #2348

com.woltlab.wcf/templates/user.tpl
wcfsetup/install/files/acp/templates/userList.tpl
wcfsetup/install/files/lib/data/user/User.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index da731a40977799ef9adb2f5858126ea27e7c8c7f..40b2f50785de0db18ff7d2cde1f9fd69690cc79b 100644 (file)
                                        {event name='userDataRow1'}
                                </ul>
                                
-                               {if $user->canViewOnlineStatus() && $user->getLastActivityTime()}
+                               {hascontent}
                                        <ul class="inlineList commaSeparated">
-                                               <li>{lang}wcf.user.usersOnline.lastActivity{/lang}: {@$user->getLastActivityTime()|time}</li>
-                                               {if $user->getCurrentLocation()}<li>{@$user->getCurrentLocation()}</li>{/if}
+                                               {content}
+                                                       {if $user->canViewOnlineStatus() && $user->getLastActivityTime()}
+                                                               <li>{lang}wcf.user.usersOnline.lastActivity{/lang}: {@$user->getLastActivityTime()|time}</li>
+                                                               {if $user->getCurrentLocation()}<li>{@$user->getCurrentLocation()}</li>{/if}
+                                                       {/if}
+                                                       {if $__wcf->session->getPermission('admin.user.canViewIpAddress') && $user->registrationIpAddress}
+                                                               <li>{lang}wcf.user.registrationIpAddress{/lang}: <span class="userRegistrationIpAddress">{$user->getRegistrationIpAddress()}</span></li>
+                                                       {/if}
+                                               {/content}
                                        </ul>
-                               {/if}
+                               {/hascontent}
                                
                                <dl class="plain inlineDataList">
                                        {include file='userInformationStatistics'}
index a74cd028bb596fd209761b4a3ec4e127f345f834..c1fc17eb82575f737e71212b6a7cdc4a4a493f2c 100644 (file)
@@ -95,7 +95,7 @@
                                        <th class="columnTitle columnUsername{if $sortField == 'username'} active {@$sortOrder}{/if}" colspan="2"><a href="{link controller='UserList' id=$searchID}action={@$encodedAction}&pageNo={@$pageNo}&sortField=username&sortOrder={if $sortField == 'username' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.user.username{/lang}</a></th>
                                        
                                        {foreach from=$columnHeads key=column item=columnLanguageVariable}
-                                               <th class="column{$column|ucfirst}{if $columnStyling[$column]|isset} {$columnStyling[$column]}{/if}{if $sortField == $column} active {@$sortOrder}{/if}"><a href="{link controller='UserList' id=$searchID}action={@$encodedAction}&pageNo={@$pageNo}&sortField={$column}&sortOrder={if $sortField == $column && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}{$columnLanguageVariable}{/lang}</a></th>
+                                               <th class="column{$column|ucfirst}{if $columnStyling[$column]|isset} {$columnStyling[$column]}{/if}{if $sortField == $column} active {@$sortOrder}{/if}"{if $column === 'registrationDate'} colspan="2"{/if}><a href="{link controller='UserList' id=$searchID}action={@$encodedAction}&pageNo={@$pageNo}&sortField={$column}&sortOrder={if $sortField == $column && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}{$columnLanguageVariable}{/lang}</a></th>
                                        {/foreach}
                                        
                                        {event name='columnHeads'}
                                                </td>
                                                
                                                {foreach from=$columnHeads key=column item=columnLanguageVariable}
+                                                       {if $column === 'registrationDate'}
+                                                               <td class="columnDate columnRegistrationIpAddress">
+                                                                       {if $__wcf->session->getPermission('admin.user.canViewIpAddress') && $user->registrationIpAddress}
+                                                                               <span class="jsTooltip" title="{lang}wcf.user.registrationIpAddress{/lang}">{$user->getRegistrationIpAddress()}</span>
+                                                                       {/if}
+                                                               </td>
+                                                       {/if}
                                                        <td class="column{$column|ucfirst}{if $columnStyling[$column]|isset} {$columnStyling[$column]}{/if}">{if $columnValues[$user->userID][$column]|isset}{@$columnValues[$user->userID][$column]}{/if}</td>
                                                {/foreach}
                                                
index 97c6c5dadfd95ae35b9c1434c0f71c125370f182..a66ded5a2ae4e41289560ce9d113b2be286af8eb 100644 (file)
@@ -12,6 +12,7 @@ use wcf\system\user\storage\UserStorageHandler;
 use wcf\system\WCF;
 use wcf\util\CryptoUtil;
 use wcf\util\PasswordUtil;
+use wcf\util\UserUtil;
 
 /**
  * Represents a user.
@@ -524,4 +525,17 @@ final class User extends DatabaseObject implements IRouteController, IUserConten
                        'twitter' => false
                ];
        }
+       
+       /**
+        * Returns the registration ip address, attempts to convert to IPv4.
+        * 
+        * @return      string
+        */
+       public function getRegistrationIpAddress() {
+               if ($this->registrationIpAddress) {
+                       return UserUtil::convertIPv6To4($this->registrationIpAddress);
+               }
+               
+               return '';
+       }
 }
index 3e8d95d2fc242588a91639afdf3c9104fc679278..1b6cc3b105bbbaa2b11dbad684761494309c8a3b 100644 (file)
@@ -3347,6 +3347,7 @@ Fehler sind beispielsweise:
                <item name="wcf.user.logout.sure"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Willst du dich{else}Wollen Sie sich{/if} wirklich abmelden?]]></item>
                <item name="wcf.user.password"><![CDATA[Kennwort]]></item>
                <item name="wcf.user.registrationDate"><![CDATA[Registrierungsdatum]]></item>
+               <item name="wcf.user.registrationIpAddress"><![CDATA[Registrierungs-IP-Adresse]]></item>
                <item name="wcf.user.visibleLanguages"><![CDATA[Inhaltssprachen]]></item>
                <item name="wcf.user.visibleLanguages.description"><![CDATA[Zeigt Inhalte in den ausgewählten Sprachen an]]></item>
                <item name="wcf.user.unknownUser"><![CDATA[Dieser Benutzer existiert nicht oder wurde gelöscht.]]></item>
index 3ac5953b05d3dbf385de504d12c7ddeab7091f07..5a1d0ab638200b3a4949925aeb94b31f37af7118 100644 (file)
@@ -3344,6 +3344,7 @@ Errors are:
                <item name="wcf.user.logout.sure"><![CDATA[Do you really want to log out?]]></item>
                <item name="wcf.user.password"><![CDATA[Password]]></item>
                <item name="wcf.user.registrationDate"><![CDATA[Registration Date]]></item>
+               <item name="wcf.user.registrationIpAddress"><![CDATA[Registration IP Address]]></item>
                <item name="wcf.user.visibleLanguages"><![CDATA[Multilingualism]]></item>
                <item name="wcf.user.visibleLanguages.description"><![CDATA[Limits visibility to content associated with the selected languages.]]></item>
                <item name="wcf.user.unknownUser"><![CDATA[This user does not exist or has been deleted.]]></item>