/** * @param $user * @param $inject_html * @param $userName * @return bool */ static function onUserLogoutComplete(&$user, &$inject_html, $userName) { global $wgCentralAuthCookies, $wgCentralAuthAutoLoginWikis; if (!$wgCentralAuthCookies) { // Nothing to do. return true; } elseif (!$wgCentralAuthAutoLoginWikis) { $inject_html .= wfMsgExt('centralauth-logout-no-others', 'parse'); return true; } $centralUser = CentralAuthUser::getInstance($user); if (!$centralUser->exists() || !$centralUser->isAttached()) { return true; } elseif (!$wgCentralAuthAutoLoginWikis) { $inject_html .= wfMsgExt('centralauth-logout-no-others', 'parse'); return true; } // Generate the images $inject_html .= '<div class="centralauth-logout-box"><p>' . wfMsg('centralauth-logout-progress') . "</p>\n<p>"; $centralUser = new CentralAuthUser($userName); foreach ($wgCentralAuthAutoLoginWikis as $alt => $wiki) { $data = array('userName' => $userName, 'token' => $centralUser->getAuthToken(), 'remember' => false, 'wiki' => $wiki); $loginToken = wfGenerateToken($centralUser->getId()); global $wgMemc; $wgMemc->set(CentralAuthUser::memcKey('login-token', $loginToken), $data, 600); $wiki = WikiMap::getWiki($wiki); // Use WikiReference::getFullUrl(), returns a protocol-relative URL if needed $url = $wiki->getFullUrl('Special:AutoLogin'); if (strpos($url, '?') > 0) { $url .= "&logout=1&token={$loginToken}"; } else { $url .= "?logout=1&token={$loginToken}"; } $inject_html .= Xml::element('img', array('src' => $url, 'alt' => $alt, 'title' => $alt, 'width' => 20, 'height' => 20, 'style' => 'border: 1px solid #ccc;')); } $inject_html .= '</p></div>'; return true; }