]> git.mxchange.org Git - friendica.git/blob - src/Module/Logout.php
Merge pull request #8006 from MrPetovan/bug/7991-remove-group-add-restrictions
[friendica.git] / src / Module / Logout.php
1 <?php
2 /**
3  * @file src/Module/Logout.php
4  */
5
6 namespace Friendica\Module;
7
8 use Friendica\BaseModule;
9 use Friendica\App\Authentication;
10 use Friendica\Core\Cache;
11 use Friendica\Core\Hook;
12 use Friendica\Core\L10n;
13 use Friendica\Core\Session;
14 use Friendica\Core\System;
15 use Friendica\Model\Profile;
16
17 /**
18  * Logout module
19  *
20  * @author Hypolite Petovan <hypolite@mrpetovan.com>
21  */
22 class Logout extends BaseModule
23 {
24         /**
25          * @brief Process logout requests
26          */
27         public static function init(array $parameters = [])
28         {
29                 $visitor_home = null;
30                 if (remote_user()) {
31                         $visitor_home = Profile::getMyURL();
32                         Cache::delete('zrlInit:' . $visitor_home);
33                 }
34
35                 Hook::callAll("logging_out");
36                 Session::clear();
37
38                 if ($visitor_home) {
39                         System::externalRedirect($visitor_home);
40                 } else {
41                         info(L10n::t('Logged out.'));
42                         self::getApp()->internalRedirect();
43                 }
44         }
45 }