english/libraries/joomla/application/application.php
/**
	 * Logout authentication function.
	 *
	 * Passed the current user information to the onUserLogout event and reverts the current
	 * session record back to 'anonymous' parameters.
	 * If any of the authentication plugins did not successfully complete
	 * the logout routine then the whole method fails.  Any errors raised
	 * should be done in the plugin as this provides the ability to give
	 * much more information about why the routine may have failed.
	 *
	 * @param   integer  $userid   The user to load - Can be an integer or string - If string, it is converted to ID automatically
	 * @param   array    $options  Array('clientid' => array of client id's)
	 *
	 * @return  boolean  True on success
	 *
	 * @since   11.1
	 */
Logout authentication function.
Passed the current user information to the onUserLogout event and reverts the current
session record back to 'anonymous' parameters.
If any of the authentication plugins did not successfully complete
the logout routine then the whole method fails.  Any errors raised
should be done in the plugin as this provides the ability to give
much more information about why the routine may have failed.

@param   integer  $userid   The user to load - Can be an integer or string - If string, it is converted to ID automatically
@param   array    $options  Array('clientid' => array of client id's)

@return  boolean  True on success


Logout authentication function . Passed the current user information to the onUserLogout event and reverts the current session record back to ' anonymous ' parameters . If any of the authentication plugins did not successfully complete the logout routine then the whole method fails . Any errors raised should be done in the plugin as this provides the ability to give much more information about why the routine may have failed . @param integer $userid The user to load - Can be an integer or string - If string it is converted to ID automatically @param array $options Array ( ' clientid ' = > array of client id ' s ) @return boolean True on success
public function logout($userid = null, $options = array())
	{
		$retval = false;
		$user = JFactory::getUser($userid);
		$parameters['username']	= $user->get('username');
		$parameters['id']		= $user->get('id');
		if (!isset($options['clientid'])) {
			$options['clientid']= $this->getClientId();
		}
		JPluginHelper::importPlugin('user');
		$results = $this->triggerEvent('onUserLogout', array($parameters, $options));
		if (!in_array(false, $results, true)) {
			$cookie_domain = $this->getCfg('cookie_domain', '');
			$cookie_path = $this->getCfg('cookie_path', '/');
			setcookie(JUtility::getHash('JLOGIN_REMEMBER'), false, time() - 86400, $cookie_path, $cookie_domain);
			return true;
		}
		$this->triggerEvent('onUserLogoutFailure', array($parameters));
		return false;
	}
public function logout ( $ userid = null , $ options = array ( ) ) { $ retval = false ; $ user = JFactory :: getUser ( $ userid ) ; $ parameters [ 'username' ] = $ user -> get ( 'username' ) ; $ parameters [ 'id' ] = $ user -> get ( 'id' ) ; if ( ! isset ( $ options [ 'clientid' ] ) ) { $ options [ 'clientid' ] = $ this -> getClientId ( ) ; } JPluginHelper :: importPlugin ( 'user' ) ; $ results = $ this -> triggerEvent ( 'onUserLogout' , array ( $ parameters , $ options ) ) ; if ( ! in_array ( false , $ results , true ) ) { $ cookie_domain = $ this -> getCfg ( 'cookie_domain' , '' ) ; $ cookie_path = $ this -> getCfg ( 'cookie_path' , '/' ) ; setcookie ( JUtility :: getHash ( 'JLOGIN_REMEMBER' ) , false , time ( ) - 86400 , $ cookie_path , $ cookie_domain ) ; return true ; } $ this -> triggerEvent ( 'onUserLogoutFailure' , array ( $ parameters ) ) ; return false ; }
Logout authentication function.
Logout authentication function .
// Initialise variables. // Get a user object from the JApplication. // Build the credentials array. // Set clientid in the options array if it hasn't been set already. // Import the user plugin group. // OK, the credentials are built. Lets fire the onLogout event. // Check if any of the plugins failed. If none did, success. // Use domain and path set in config for cookie if it exists. // Trigger onUserLoginFailure Event.