DashboardHooks::gdn_dispatcher_appStartup_handler PHP Method

gdn_dispatcher_appStartup_handler() public method

This must be done in the Dispatcher because of PrivateCommunity. That precludes using Controller->SetHeader. This is done so comment & forum embedding can work in old IE.
public gdn_dispatcher_appStartup_handler ( Gdn_Dispatcher $Sender )
$Sender Gdn_Dispatcher
    public function gdn_dispatcher_appStartup_handler($Sender)
    {
        safeHeader('P3P: CP="CAO PSA OUR"', true);
        if ($SSO = Gdn::request()->get('sso')) {
            saveToConfig('Garden.Registration.SendConnectEmail', false, false);
            $IsApi = preg_match('`\\.json$`i', Gdn::request()->path());
            $UserID = false;
            try {
                $CurrentUserID = Gdn::session()->UserID;
                $UserID = Gdn::userModel()->sso($SSO);
            } catch (Exception $Ex) {
                trace($Ex, TRACE_ERROR);
            }
            if ($UserID) {
                Gdn::session()->start($UserID, !$IsApi, !$IsApi);
                if ($IsApi) {
                    Gdn::session()->validateTransientKey(true);
                }
                if ($UserID != $CurrentUserID) {
                    Gdn::userModel()->fireEvent('AfterSignIn');
                }
            } else {
                // There was some sort of error. Let's print that out.
                foreach (Gdn::userModel()->Validation->resultsArray() as $msg) {
                    trace($msg, TRACE_ERROR);
                }
                Gdn::userModel()->Validation->reset();
            }
        }
    }