ssi_logout() always defers to 'echo' output method

Started by Doxugen, January 24, 2011, 02:19:23 AM

Previous topic - Next topic

Doxugen

Version: 1.1.12
Setup: Fresh installation on XAMPP 1.7.3

File: SSI.php
Line: 237

The stock installation did not have any return statement in ssi_logout(), so the function would always echo the link, regardless of $output_method.

I added a couple lines to fix this; it's not a major bug, but it was confusing to see one thing in the documentation and another thing in implementation.
Code (SSI.php:225) Select

// Show a logout link.
function ssi_logout($redirect_to = '', $output_method = 'echo')
{
global $context, $txt, $scripturl, $sc;

if ($redirect_to != '')
$_SESSION['logout_url'] = $redirect_to;

// Guests can't log out.
if ($context['user']['is_guest'])
return false;

//===== Change added here =====
if ($output_method != 'echo')
return '<a href="'. $scripturl. '?action=logout;sesc='. $sc.'">'. $txt[108]. '</a>';
//=========================
echo '<a href="', $scripturl, '?action=logout;sesc=', $sc, '">', $txt[108], '</a>';
}

Advertisement: