]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Logout.php
Update doignore() in main.js to match new Item\Ignore return type
[friendica.git] / src / Module / Logout.php
index bfa917a393fa427f3b574aa285a21246aabefbf6..49ede01a3d7a1544c32417ff1606ec36a6ff0cdd 100644 (file)
@@ -2,14 +2,16 @@
 /**
  * @file src/Module/Logout.php
  */
+
 namespace Friendica\Module;
 
 use Friendica\BaseModule;
-use Friendica\Core\Addon;
+use Friendica\Core\Authentication;
+use Friendica\Core\Cache;
+use Friendica\Core\Hook;
 use Friendica\Core\L10n;
-
-require_once 'boot.php';
-require_once 'include/security.php';
+use Friendica\Core\System;
+use Friendica\Model\Profile;
 
 /**
  * Logout module
@@ -21,11 +23,22 @@ class Logout extends BaseModule
        /**
         * @brief Process logout requests
         */
-       public static function init()
+       public static function init(array $parameters = [])
        {
-               Addon::callHooks("logging_out");
-               nuke_session();
-               info(L10n::t('Logged out.') . EOL);
-               goaway(self::getApp()->get_baseurl());
+               $visitor_home = null;
+               if (remote_user()) {
+                       $visitor_home = Profile::getMyURL();
+                       Cache::delete('zrlInit:' . $visitor_home);
+               }
+
+               Hook::callAll("logging_out");
+               Authentication::deleteSession();
+
+               if ($visitor_home) {
+                       System::externalRedirect($visitor_home);
+               } else {
+                       info(L10n::t('Logged out.'));
+                       self::getApp()->internalRedirect();
+               }
        }
 }