static function logout($redirectUri = null) { $request = \ManiaLib\Application\Request::getInstance(); $maniaplanet = new \Maniaplanet\WebServices\ManiaConnect\Player(); $maniaplanet->logout(); $logoutURL = $maniaplanet->getLogoutURL($redirectUri ?: $request->createLink('/')); $request->redirectAbsolute($logoutURL); }
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3 * @author $Author: maximeraoust $: * @version $Revision: 10 $: * @date $Date: 2011-09-27 15:21:52 +0200 (mar., 27 sept. 2011) $: */ require_once __DIR__ . '/../../../libraries/autoload.php'; define('API_USERNAME', 'api_username'); define('API_PASSWORD', 'api_password'); define('SCOPE', ''); try { $trackmania = new \Maniaplanet\WebServices\ManiaConnect\Player(API_USERNAME, API_PASSWORD); // URLs to log in and out $loginURL = $trackmania->getLoginURL(SCOPE); $logoutURL = $trackmania->getLogoutURL(); if (isset($_POST['logout'])) { $trackmania->logout(); header('Location: ' . $logoutURL); exit; } // Retrive player information. If the user is not logged in, it will return false $player = $trackmania->getPlayer(); } catch (\Maniaplanet\WebServices\Exception $e) { $player = null; // Uncomment to debug... //var_dump($e); } if (array_key_exists('HTTP_USER_AGENT', $_SERVER) && substr($_SERVER['HTTP_USER_AGENT'], 0, 11) == 'ManiaPlanet') { ?> <manialink version="0"> <timeout>0</timeout> <frame posn="0 25 0">