- 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();
+ }