2018-02-09 03:49:49 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @file src/Module/Logout.php
|
|
|
|
*/
|
2018-12-26 06:06:24 +00:00
|
|
|
|
2018-02-09 03:49:49 +00:00
|
|
|
namespace Friendica\Module;
|
|
|
|
|
|
|
|
use Friendica\BaseModule;
|
2018-10-17 12:19:58 +00:00
|
|
|
use Friendica\Core\Authentication;
|
2019-09-29 06:26:02 +00:00
|
|
|
use Friendica\Core\Cache;
|
2018-12-26 06:06:24 +00:00
|
|
|
use Friendica\Core\Hook;
|
2018-02-09 03:49:49 +00:00
|
|
|
use Friendica\Core\L10n;
|
2019-06-11 23:41:11 +00:00
|
|
|
use Friendica\Core\System;
|
|
|
|
use Friendica\Model\Profile;
|
2018-02-09 03:49:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Logout module
|
|
|
|
*
|
2018-09-15 23:28:38 +00:00
|
|
|
* @author Hypolite Petovan <hypolite@mrpetovan.com>
|
2018-02-09 03:49:49 +00:00
|
|
|
*/
|
|
|
|
class Logout extends BaseModule
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @brief Process logout requests
|
|
|
|
*/
|
|
|
|
public static function init()
|
|
|
|
{
|
2019-06-11 23:41:11 +00:00
|
|
|
$visitor_home = null;
|
|
|
|
if (remote_user()) {
|
|
|
|
$visitor_home = Profile::getMyURL();
|
2019-09-29 06:26:02 +00:00
|
|
|
Cache::delete('zrlInit:' . $visitor_home);
|
2019-06-11 23:41:11 +00:00
|
|
|
}
|
|
|
|
|
2018-12-26 06:06:24 +00:00
|
|
|
Hook::callAll("logging_out");
|
2018-10-17 19:30:41 +00:00
|
|
|
Authentication::deleteSession();
|
2019-06-11 23:41:11 +00:00
|
|
|
|
|
|
|
if ($visitor_home) {
|
|
|
|
System::externalRedirect($visitor_home);
|
|
|
|
} else {
|
|
|
|
info(L10n::t('Logged out.'));
|
|
|
|
self::getApp()->internalRedirect();
|
|
|
|
}
|
2018-02-09 03:49:49 +00:00
|
|
|
}
|
|
|
|
}
|