<?php /* For licensing terms, see /license.txt */ //require_once '../inc/global.inc.php'; if (api_get_setting('platform_unsubscribe_allowed') != 'true') { api_not_allowed(); } $tool_name = get_lang('Unsubscribe'); $message = Display::return_message(get_lang('UnsubscribeFromPlatform'), 'warning'); $form = new FormValidator('user_add'); $form->addElement('button', 'submit', get_lang('Unsubscribe'), array('onclick' => "javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang("UnsubscribeFromPlatformConfirm"))) . "')) return false;")); $content = $form->returnForm(); if ($form->validate()) { $user_info = api_get_user_info(); $result = UserManager::delete_user($user_info['user_id']); if ($result) { $message = Display::return_message(sprintf(get_lang('UnsubscribeFromPlatformSuccess', $user_info['username']))); $content = null; online_logout($user_info['user_id'], false); api_not_allowed(true, $message); } } //$tpl = new Template($tool_name); echo $actions; echo $message; echo $content;
/** * Alias for the online_logout() function */ function logout() { online_logout($this->user_id, true); }
/** * Alias for the online_logout() function * @param bool $redirect Whether to ask online_logout to redirect to index.php or not */ function logout($redirect = true) { online_logout($this->user_id, true); }
$osso->check_user(); } else { error_log('Check the sso_referer URL in your script, it doesn\'t match any of the possibilities'); //Request comes from unknown source $loginFailed = true; Session::erase('_uid'); Session::write('loginFailed', '1'); header('Location: ' . api_get_path(WEB_PATH) . 'index.php?loginFailed=1&error=unrecognize_sso_origin'); exit; } } //end logout ... else ... login } elseif ($logout) { //if there was an attempted logout without a previous login, log // this anonymous user out as well but avoid redirect online_logout(null, false); $osso->logout(); //redirects and exits } } elseif (api_get_setting('openid_authentication') == 'true') { if (!empty($_POST['openid_url'])) { include api_get_path(SYS_CODE_PATH) . 'auth/openid/login.php'; openid_begin(trim($_POST['openid_url']), api_get_path(WEB_PATH) . 'index.php'); //this last function should trigger a redirect, so we can die here safely die('Openid login redirection should be in progress'); } elseif (!empty($_GET['openid_identity'])) { //it's usual for PHP to replace '.' (dot) by '_' (underscore) in URL parameters include api_get_path(SYS_CODE_PATH) . 'auth/openid/login.php'; $res = openid_complete($_GET); if ($res['status'] == 'success') { $id1 = Database::escape_string($res['openid.identity']);
function logout() { $_SESSION['_user'] = array(); online_logout(null, false); }
/** * TODO: * - Work on a better validation for webservices paths. Current is very poor and exit */ $subsso = api_get_setting('sso_authentication_subclass'); if (!empty($subsso)) { require_once api_get_path(SYS_CODE_PATH).'auth/sso/sso.'.$subsso.'.class.php'; $subsso = 'sso'.$subsso; $osso = new $subsso(); //load the subclass } else { $osso = new sso(); } if (isset($_SESSION['_user']['user_id'])) { if ($logout) { // Make custom redirect after logout online_logout($_SESSION['_user']['user_id'], false); $osso->logout(); //redirects and exits } } elseif (!$logout) { // Handle cookie comming from Master Server // Use this first line if you want users to still see the // homepage without connecting //if (!isset($_GET['sso_referer']) && !isset($_GET['loginFailed']) && isset($_GET['sso_cookie'])) { // Use this second line if you want all users to be redirected // unless they are connected (removed req on sso_cookie) if (!isset($_GET['sso_referer']) && !isset($_GET['loginFailed'])) { // Redirect to master server $osso->ask_master(); } elseif (isset($_GET['sso_cookie'])) { // Here we are going to check the origin of