<?php

/**
 * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @package clearFusionCMS
 * @copyright Copyright (c) 2012 - 2017 clearFusionCMS. All rights reserved.
 * @link http://clearfusioncms.com
 */

/**
 * cfBackendLogoutAction Class
 *
 * The logout action class.
 *
 * @package clearFusionCMS
 */
class cfBackendLogoutAction extends cfBackendControllerAction {

	/**
	 * Logout page.
	 */
	function process() {
		cfUserAudit::logout($this->user->getId(), $this->user->getUsername());
		$this->user->logout();
		$this->response->setCookie(clearFusionCMS::getConfig()->get('authCookieMgrName', '__managerauth'), 0, -3600, clearFusionCMS::getConfig()->get('authCookieDomain', ''), clearFusionCMS::getConfig()->get('authCookiePath', '/'), false, true);
		flApp::getSession()->destorySession();
		$this->response->redirectTo($this->assemble('', 'login', array(), true));
	}
}
