]> git.mxchange.org Git - friendica.git/blob - src/Module/Logout.php
Added parameters
[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\Core\Authentication;
10 use Friendica\Core\Cache;
11 use Friendica\Core\Hook;
12 use Friendica\Core\L10n;
13 use Friendica\Core\System;
14 use Friendica\Model\Profile;
15
16 /**
17  * Logout module
18  *
19  * @author Hypolite Petovan <hypolite@mrpetovan.com>
20  */
21 class Logout extends BaseModule
22 {
23         /**
24          * @brief Process logout requests
25          */
26         public static function init($parameters)
27         {
28                 $visitor_home = null;
29                 if (remote_user()) {
30                         $visitor_home = Profile::getMyURL();
31                         Cache::delete('zrlInit:' . $visitor_home);
32                 }
33
34                 Hook::callAll("logging_out");
35                 Authentication::deleteSession();
36
37                 if ($visitor_home) {
38                         System::externalRedirect($visitor_home);
39                 } else {
40                         info(L10n::t('Logged out.'));
41                         self::getApp()->internalRedirect();
42                 }
43         }
44 }