diff options
| -rw-r--r-- | includes/functions/functions_print.php | 29 | ||||
| -rw-r--r-- | themes/colors/header.php | 10 | ||||
| -rw-r--r-- | themes/fab/header.php | 10 |
3 files changed, 26 insertions, 23 deletions
diff --git a/includes/functions/functions_print.php b/includes/functions/functions_print.php index cb24359929..15a69d7be6 100644 --- a/includes/functions/functions_print.php +++ b/includes/functions/functions_print.php @@ -597,17 +597,32 @@ function print_user_links() { if (WT_USER_GEDCOM_ADMIN) { echo '<a href="admin.php" class="link">', i18n::translate('Administration'), '</a> | '; } - echo '<a href="index.php?logout=1" class="link">', i18n::translate('Logout'), '</a>'; + echo logout_link(); } else { if (empty($SEARCH_SPIDER)) { - if (WT_SCRIPT_NAME=='login.php') { - echo '<a href="#" class="link">', i18n::translate('Login'), '</a>'; - } else { - $LOGIN_URL=get_site_setting('LOGIN_URL', 'login.php'); - echo '<a href="', $LOGIN_URL, '?url=', rawurlencode(WT_SCRIPT_NAME.'?'.$QUERY_STRING), '" class="link">', i18n::translate('Login'), '</a>'; - } + echo login_link(); + } + } +} + +// Generate a login link +function login_link() { + global $QUERY_STRING; + + if (WT_SCRIPT_NAME=='login.php') { + $href='#'; + } else { + $href=get_site_setting('LOGIN_URL', 'login.php').'?url='.WT_SCRIPT_NAME; + if ($QUERY_STRING) { + $href.= rawurlencode('?'.$QUERY_STRING); } } + return '<a href="' . $href . '" class="link">' . i18n::translate('Login') . '</a>'; +} + +// Generate a logout link +function logout_link() { + return '<a href="index.php?logout=1" class="link">' . i18n::translate('Logout') . '</a>'; } // Print a link to allow email/messaging contact with a user diff --git a/themes/colors/header.php b/themes/colors/header.php index eab5123e76..53e2a38539 100644 --- a/themes/colors/header.php +++ b/themes/colors/header.php @@ -120,7 +120,7 @@ if ($view!='simple') { if (WT_USER_ID) { echo '<li><a href="edituser.php" class="icon_color">', getUserFullName(WT_USER_ID), '</a></li>', - ' | <li><a href="index.php?logout=1" class="icon_color">', i18n::translate('Logout'), '</a></li>'; + ' | <li class="icon_color">', logout_link(), '</li>'; if (WT_USER_GEDCOM_ADMIN) { echo ' | <li><a href="admin.php" class="icon_color">', i18n::translate('Administration'), '</a></li>'; } @@ -128,13 +128,7 @@ if ($view!='simple') { echo ' | <li><a href="javascript:;" onclick="window.open(\'edit_changes.php\',\'_blank\',\'width=600,height=500,resizable=1,scrollbars=1\'); return false;" style="color:red;">', i18n::translate('Pending Changes'), '</a></li>'; } } else { - $LOGIN_URL=get_site_setting('LOGIN_URL'); - if (WT_SCRIPT_NAME==$LOGIN_URL) { - echo '<li><a class="icon_color" href="', $LOGIN_URL, '">', i18n::translate('Login'), '</a></li>'; - } else { - $QUERY_STRING = normalize_query_string($QUERY_STRING.'&logout='); - echo '<li><a class="icon_color" href="', $LOGIN_URL, '?url=', WT_SCRIPT_PATH, WT_SCRIPT_NAME, decode_url(normalize_query_string($QUERY_STRING.'&ged='.WT_GEDCOM)), '">', i18n::translate('Login'), '</a></li>'; - } + echo '<li class="icon_color">', login_link(), '</li>'; } echo '<span class="link"> | ', MenuBar::getFavoritesMenu()->getMenuAsList(); $language_menu=MenuBar::getLanguageMenu(); diff --git a/themes/fab/header.php b/themes/fab/header.php index 8c0c084b96..80935a7812 100644 --- a/themes/fab/header.php +++ b/themes/fab/header.php @@ -105,7 +105,7 @@ if ($view!='simple') { if (WT_USER_ID) { echo '<li><a href="edituser.php" class="link">', getUserFullName(WT_USER_ID), '</a></li>', - ' | <li><a href="index.php?logout=1" class="link">', i18n::translate('Logout'), '</a></li>'; + ' | <li>', logout_link(), '</li>'; if (WT_USER_GEDCOM_ADMIN) { echo ' | <li><a href="admin.php" class="link">', i18n::translate('Administration'), '</a></li>'; } @@ -113,13 +113,7 @@ if ($view!='simple') { echo ' | <li><a href="javascript:;" onclick="window.open(\'edit_changes.php\',\'_blank\',\'width=600,height=500,resizable=1,scrollbars=1\'); return false;" style="color:red;">', i18n::translate('Pending Changes'), '</a></li>'; } } else { - $LOGIN_URL=get_site_setting('LOGIN_URL'); - if (WT_SCRIPT_NAME==$LOGIN_URL) { - echo '<li><a href="', $LOGIN_URL, '" class="link">', i18n::translate('Login'), '</a></li>'; - } else { - $QUERY_STRING = normalize_query_string($QUERY_STRING.'&logout='); - echo '<li><a href="', $LOGIN_URL, '?url=', WT_SCRIPT_PATH, WT_SCRIPT_NAME, decode_url(normalize_query_string($QUERY_STRING.'&ged='.WT_GEDCOM)), '" class="link">', i18n::translate('Login'), '</a></li>'; - } + echo '<li>', login_link(), '</li>'; } echo '<span class="link"> | ', MenuBar::getFavoritesMenu()->getMenuAsList(); $language_menu=MenuBar::getLanguageMenu(); |
