getProviders() 공개 메소드

public getProviders ( ) : array | null | type
리턴 array | null | type
예제 #1
0
 /**
  *
  *
  * @param string $UserReference
  * @param string $Username
  * @param $Provider
  * @throws Exception
  */
 public function disconnect($UserReference = '', $Username = '', $Provider)
 {
     if (!Gdn::request()->isAuthenticatedPostBack(true)) {
         throw new Exception('Requires POST', 405);
     }
     $this->permission('Garden.SignIn.Allow');
     $this->getUserInfo($UserReference, $Username, '', true);
     // First try and delete the authentication the fast way.
     Gdn::sql()->delete('UserAuthentication', array('UserID' => $this->User->UserID, 'ProviderKey' => $Provider));
     // Delete the profile information.
     Gdn::userModel()->saveAttribute($this->User->UserID, $Provider, null);
     if ($this->deliveryType() == DELIVERY_TYPE_ALL) {
         redirect(userUrl($this->User), '', 'connections');
     } else {
         // Grab all of the providers again.
         $PModel = new Gdn_AuthenticationProviderModel();
         $Providers = $PModel->getProviders();
         $this->setData('_Providers', $Providers);
         $this->setData('Connections', array());
         $this->fireEvent('GetConnections');
         // Send back the connection button.
         $Connection = $this->data("Connections.{$Provider}");
         require_once $this->fetchViewLocation('connection_functions');
         $this->jsonTarget("#Provider_{$Provider} .ActivateSlider", connectButton($Connection), 'ReplaceWith');
         $this->render('Blank', 'Utility', 'Dashboard');
     }
 }
예제 #2
0
 /**
  * Get an array of all of the trusted domains in the application.
  *
  * @return array
  */
 function trustedDomains()
 {
     // This domain is safe.
     $trustedDomains = [Gdn::request()->host()];
     $configuredDomains = c('Garden.TrustedDomains', []);
     if (!is_array($configuredDomains)) {
         $configuredDomains = is_string($configuredDomains) ? explode("\n", $configuredDomains) : [];
     }
     $configuredDomains = array_filter($configuredDomains);
     $trustedDomains = array_merge($trustedDomains, $configuredDomains);
     // Build a collection of authentication provider URLs.
     $authProviderModel = new Gdn_AuthenticationProviderModel();
     $providers = $authProviderModel->getProviders();
     $providerUrls = ['PasswordUrl', 'ProfileUrl', 'RegisterUrl', 'SignInUrl', 'SignOutUrl', 'URL'];
     // Iterate through the providers, only grabbing URLs if they're not empty and not already present.
     if (is_array($providers) && count($providers) > 0) {
         foreach ($providers as $key => $record) {
             foreach ($providerUrls as $urlKey) {
                 $providerUrl = $record[$urlKey];
                 if ($providerUrl && ($providerDomain = parse_url($providerUrl, PHP_URL_HOST))) {
                     if (!in_array($providerDomain, $trustedDomains)) {
                         $trustedDomains[] = $providerDomain;
                     }
                 }
             }
         }
     }
     Gdn::pluginManager()->EventArguments['TrustedDomains'] =& $trustedDomains;
     Gdn::pluginManager()->fireAs('EntryController')->fireEvent('BeforeTargetReturn');
     return array_unique($trustedDomains);
 }