Fixed helper's getComplexLoggedInAs()

Should now correctly default to standard login string when neither page
exists
This commit is contained in:
Simon DELAGE 2015-02-02 09:57:09 +01:00
parent 7410099319
commit 5dc591bf74

View file

@ -56,20 +56,18 @@ class helper_plugin_userhomepage extends DokuWiki_Plugin {
function getComplexLoggedInAs() {
global $INFO;
global $lang;
// If user's private namespace and public page exist, return a 'Logged in as' string with both style links)
// If user's private namespace and public page exist, return a 'Logged in as' string with both styled links)
if ((page_exists($this->getPrivateID())) && (page_exists($this->getPublicID()))) {
return '<li>'.$lang['loggedinas'].' <a href="'.wl($this->getPrivateID()).'" class="uhp_private" rel="nofollow" title="'.$this->getLang('privatenamespace').'">'.$INFO['userinfo']['name'].'</a> (<a href="'.wl($this->getPublicID()).'" class="uhp_public" rel="nofollow" title="'.$this->getLang('publicpage').'">'.$_SERVER['REMOTE_USER'].'</a>)</li>';
// Else if only private namespace exists, return 'Logged in as' string with private namespace link
// Else if only private namespace exists, return 'Logged in as' string with private namespace styled link
} elseif (page_exists($this->getPrivateID())) {
return $this->getPrivateLink("loggedinas");
// Else if only ppublic page exists, return 'Logged in as' string with public page link
// Else if only public page exists, return 'Logged in as' string with public page styled link
} elseif (page_exists($this->getPublicID())) {
return $this->getPublicLink("loggedinas");
// Else default back to standard string
} else {
echo '<li class="user">';
tpl_userinfo(); /* 'Logged in as ...' */
echo '</li>';
return '<li class="user">'.$lang['loggedinas'].' '.userlink().'</li>';
}
}