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