Improved user profile privacy function
authorMarcel Werk <burntime@woltlab.com>
Tue, 24 Jun 2014 21:03:13 +0000 (23:03 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 24 Jun 2014 21:03:13 +0000 (23:03 +0200)
com.woltlab.wcf/templates/user.tpl
com.woltlab.wcf/templates/userSidebar.tpl
wcfsetup/install/files/lib/page/UserPage.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 6f3656a01c547d22f0795afbf832d66c7364e790..af4abc8cf5e81f84790387b69135fa9cfbd3ad86 100644 (file)
 
 {include file='userNotice'}
 
-<div class="contentNavigation">
-       {hascontent}
-               <nav>
+{if !$user->isProtected()}
+       <div class="contentNavigation">
+               {hascontent}
+                       <nav>
+                               <ul>
+                                       {content}
+                                               {event name='contentNavigationButtons'}
+                                       {/content}
+                               </ul>
+                       </nav>
+               {/hascontent}
+       </div>
+       
+       <section id="profileContent" class="marginTop tabMenuContainer" data-active="{$__wcf->getUserProfileMenu()->getActiveMenuItem()->getIdentifier()}">
+               <nav class="tabMenu">
                        <ul>
-                               {content}
-                                       {event name='contentNavigationButtons'}
-                               {/content}
+                               {foreach from=$__wcf->getUserProfileMenu()->getMenuItems() item=menuItem}
+                                       {if $menuItem->getContentManager()->isVisible($userID)}
+                                               <li><a href="{$__wcf->getAnchor($menuItem->getIdentifier())}">{lang}wcf.user.profile.menu.{@$menuItem->menuItem}{/lang}</a></li>
+                                       {/if}
+                               {/foreach}
                        </ul>
                </nav>
-       {/hascontent}
-</div>
-
-<section id="profileContent" class="marginTop tabMenuContainer" data-active="{$__wcf->getUserProfileMenu()->getActiveMenuItem()->getIdentifier()}">
-       <nav class="tabMenu">
-               <ul>
-                       {foreach from=$__wcf->getUserProfileMenu()->getMenuItems() item=menuItem}
-                               {if $menuItem->getContentManager()->isVisible($userID)}
-                                       <li><a href="{$__wcf->getAnchor($menuItem->getIdentifier())}">{lang}wcf.user.profile.menu.{@$menuItem->menuItem}{/lang}</a></li>
-                               {/if}
-                       {/foreach}
-               </ul>
-       </nav>
-       
-       {foreach from=$__wcf->getUserProfileMenu()->getMenuItems() item=menuItem}
-               {if $menuItem->getContentManager()->isVisible($userID)}
-                       <div id="{$menuItem->getIdentifier()}" class="container tabMenuContent" data-menu-item="{$menuItem->menuItem}">
-                               {if $menuItem === $__wcf->getUserProfileMenu()->getActiveMenuItem()}
-                                       {@$profileContent}
-                               {/if}
-                       </div>
-               {/if}
-       {/foreach}
-</section>
+               
+               {foreach from=$__wcf->getUserProfileMenu()->getMenuItems() item=menuItem}
+                       {if $menuItem->getContentManager()->isVisible($userID)}
+                               <div id="{$menuItem->getIdentifier()}" class="container tabMenuContent" data-menu-item="{$menuItem->menuItem}">
+                                       {if $menuItem === $__wcf->getUserProfileMenu()->getActiveMenuItem()}
+                                               {@$profileContent}
+                                       {/if}
+                               </div>
+                       {/if}
+               {/foreach}
+       </section>
+{else}
+       <p class="info">{lang}wcf.user.profile.proctected{/lang}</p>
+{/if}
 
 {include file='footer'}
 
index 24fc23268e10f480b8545db487dddf2bdde467db..c5d01c3b02ddef92f78c66f838e0ed6fcbd96422 100644 (file)
        </fieldset>
 {/hascontent}
 
-{if $followingCount}
-       <fieldset>
-               <legend>{lang}wcf.user.profile.following{/lang} <span class="badge">{#$followingCount}</span></legend>
-               
-               <div>
-                       <ul class="framedIconList">
-                               {foreach from=$following item=followingUser}
-                                       <li><a href="{link controller='User' object=$followingUser}{/link}" title="{$followingUser->username}" class="framed jsTooltip">{@$followingUser->getAvatar()->getImageTag(48)}</a></li>
-                               {/foreach}
-                       </ul>
+{if !$user->isProtected()}
+       {if $followingCount}
+               <fieldset>
+                       <legend>{lang}wcf.user.profile.following{/lang} <span class="badge">{#$followingCount}</span></legend>
                        
-                       {if $followingCount > 10}
-                               <a id="followingAll" class="button small more jsOnly">{lang}wcf.global.button.showAll{/lang}</a>
-                       {/if}
-               </div>
-       </fieldset>
-{/if}
-
-{if $followerCount}
-       <fieldset>
-               <legend>{lang}wcf.user.profile.followers{/lang} <span class="badge">{#$followerCount}</span></legend>
-               
-               <div>
-                       <ul class="framedIconList">
-                               {foreach from=$followers item=follower}
-                                       <li><a href="{link controller='User' object=$follower}{/link}" title="{$follower->username}" class="framed jsTooltip">{@$follower->getAvatar()->getImageTag(48)}</a></li>
-                               {/foreach}
-                       </ul>
+                       <div>
+                               <ul class="framedIconList">
+                                       {foreach from=$following item=followingUser}
+                                               <li><a href="{link controller='User' object=$followingUser}{/link}" title="{$followingUser->username}" class="framed jsTooltip">{@$followingUser->getAvatar()->getImageTag(48)}</a></li>
+                                       {/foreach}
+                               </ul>
                                
-                       {if $followerCount > 10}
-                               <a id="followerAll" class="button small more jsOnly">{lang}wcf.global.button.showAll{/lang}</a>
-                       {/if}
-               </div>
-       </fieldset>
-{/if}
-
-{if $visitorCount}
-       <fieldset>
-               <legend>{lang}wcf.user.profile.visitors{/lang} <span class="badge">{#$visitorCount}</span></legend>
-               
-               <div>
-                       <ul class="framedIconList">
-                               {foreach from=$visitors item=visitor}
-                                       <li><a href="{link controller='User' object=$visitor}{/link}" title="{$visitor->username} ({@$visitor->time|plainTime})" class="framed jsTooltip">{@$visitor->getAvatar()->getImageTag(48)}</a></li>
-                               {/foreach}
-                       </ul>
-                               
-                       {if $visitorCount > 10}
-                               <a id="visitorAll" class="button small more jsOnly">{lang}wcf.global.button.showAll{/lang}</a>
-                       {/if}
-               </div>
-       </fieldset>
+                               {if $followingCount > 10}
+                                       <a id="followingAll" class="button small more jsOnly">{lang}wcf.global.button.showAll{/lang}</a>
+                               {/if}
+                       </div>
+               </fieldset>
+       {/if}
+       
+       {if $followerCount}
+               <fieldset>
+                       <legend>{lang}wcf.user.profile.followers{/lang} <span class="badge">{#$followerCount}</span></legend>
+                       
+                       <div>
+                               <ul class="framedIconList">
+                                       {foreach from=$followers item=follower}
+                                               <li><a href="{link controller='User' object=$follower}{/link}" title="{$follower->username}" class="framed jsTooltip">{@$follower->getAvatar()->getImageTag(48)}</a></li>
+                                       {/foreach}
+                               </ul>
+                                       
+                               {if $followerCount > 10}
+                                       <a id="followerAll" class="button small more jsOnly">{lang}wcf.global.button.showAll{/lang}</a>
+                               {/if}
+                       </div>
+               </fieldset>
+       {/if}
+       
+       {if $visitorCount}
+               <fieldset>
+                       <legend>{lang}wcf.user.profile.visitors{/lang} <span class="badge">{#$visitorCount}</span></legend>
+                       
+                       <div>
+                               <ul class="framedIconList">
+                                       {foreach from=$visitors item=visitor}
+                                               <li><a href="{link controller='User' object=$visitor}{/link}" title="{$visitor->username} ({@$visitor->time|plainTime})" class="framed jsTooltip">{@$visitor->getAvatar()->getImageTag(48)}</a></li>
+                                       {/foreach}
+                               </ul>
+                                       
+                               {if $visitorCount > 10}
+                                       <a id="visitorAll" class="button small more jsOnly">{lang}wcf.global.button.showAll{/lang}</a>
+                               {/if}
+                       </div>
+               </fieldset>
+       {/if}
+       
+       {event name='boxes'}
 {/if}
-
-{event name='boxes'}
index c079dce1e268199a93c0cd8a6f70bb6cad78846c..c3057cba07ae8ddff668288227e3432af74f0525 100644 (file)
@@ -102,11 +102,6 @@ class UserPage extends AbstractPage {
                        throw new PermissionDeniedException();
                }
                
-               // check is Accessible
-               if ($this->user->isProtected()) {
-                       throw new PermissionDeniedException();
-               }
-               
                if (isset($_REQUEST['editOnInit'])) $this->editOnInit = true;
        }
        
@@ -185,7 +180,7 @@ class UserPage extends AbstractPage {
         */
        public function show() {
                // update profile hits
-               if ($this->user->userID != WCF::getUser()->userID && !WCF::getSession()->spiderID) {
+               if ($this->user->userID != WCF::getUser()->userID && !WCF::getSession()->spiderID && !$this->user->isProtected()) {
                        $editor = new UserEditor($this->user->getDecoratedObject());
                        $editor->updateCounters(array('profileHits' => 1));
                        
index 6d9210ce40f98838e7f8bad866d4d707fc47010f..e61af85e2bce7da30dd1713e082074e5f857c302 100644 (file)
@@ -2930,6 +2930,7 @@ Möchten Sie diese E-Mail-Benachrichtigung in Zukunft nicht mehr erhalten, könn
                <item name="wcf.user.profile.report"><![CDATA[Benutzerprofil melden]]></item>
                <item name="wcf.user.profile.likes.profileComment"><![CDATA[Mag den Kommentar von <a href="{link controller='User' object=$commentAuthor}{/link}">{$commentAuthor->username}</a> an der <a href="{link controller='User' object=$user}{/link}#wall">Pinnwand von {$user->username}</a>{if $like->isDislike()} nicht{/if}.]]></item>
                <item name="wcf.user.profile.likes.profileCommentResponse"><![CDATA[Mag die Antwort von <a href="{link controller='User' object=$responseAuthor}{/link}">{$responseAuthor->username}</a> zum Kommentar von <a href="{link controller='User' object=$commentAuthor}{/link}">{$commentAuthor->username}</a> an der <a href="{link controller='User' object=$user}{/link}#wall">Pinnwand von {$user->username}</a>{if $like->isDislike()} nicht{/if}.]]></item>
+               <item name="wcf.user.profile.protected"><![CDATA[Der Benutzer hat den Zugriff auf sein vollständiges Profil eingeschränkt.]]></item>
        </category>
        
        <category name="wcf.user.objectWatch">
index 83ccb68afe3ce60e93eba51c7660afe9e2a5d544..d8d6bada2f97f7886b1c6fac50c856fcf61f172a 100644 (file)
@@ -2787,6 +2787,7 @@ If you do not want to receive further email notifications for this event, you ca
                <item name="wcf.user.profile.report"><![CDATA[Report User Profile]]></item>
                <item name="wcf.user.profile.likes.profileComment"><![CDATA[TODO: Mag den Kommentar von <a href="{link controller='User' object=$commentAuthor}{/link}">{$commentAuthor->username}</a> an der <a href="{link controller='User' object=$user}{/link}#wall">Pinnwand von {$user->username}</a>{if $like->isDislike()} nicht{/if}.]]></item>
                <item name="wcf.user.profile.likes.profileCommentResponse"><![CDATA[TODO: Mag die Antwort von <a href="{link controller='User' object=$responseAuthor}{/link}">{$responseAuthor->username}</a> zum Kommentar von <a href="{link controller='User' object=$commentAuthor}{/link}">{$commentAuthor->username}</a> an der <a href="{link controller='User' object=$user}{/link}#wall">Pinnwand von {$user->username}</a>{if $like->isDislike()} nicht{/if}.]]></item>
+               <item name="wcf.user.profile.protected"><![CDATA[This member limits who may view their full profile information.]]></item>
        </category>
        
        <category name="wcf.user.objectWatch">