Пример #1
0
function writeConnection($Row)
{
    $c = Gdn::controller();
    $Connected = val('Connected', $Row);
    ?>
    <li id="<?php 
    echo "Provider_{$Row['ProviderKey']}";
    ?>
" class="Item">
        <div class="Connection-Header">
         <span class="IconWrap">
            <?php 
    echo img(val('Icon', $Row, Asset('/applications/dashboard/design/images/connection-64.png')));
    ?>
         </span>
         <span class="Connection-Name">
            <?php 
    echo val('Name', $Row, t('Unknown'));
    if ($Connected) {
        echo ' <span class="Gloss Connected">';
        if ($Photo = valr('Profile.Photo', $Row)) {
            echo ' ' . Img($Photo, array('class' => 'ProfilePhoto ProfilePhotoSmall'));
        }
        echo ' ' . htmlspecialchars(GetValueR('Profile.Name', $Row)) . '</span>';
    }
    ?>
         </span>
         <span class="Connection-Connect">
            <?php 
    echo ConnectButton($Row);
    ?>
         </span>
        </div>
        <!--      <div class="Connection-Body">
         <?php 
    //         if (Debug()) {
    //            decho(val($Row['ProviderKey'], $c->User->Attributes), 'Attributes');
    //         }
    ?>
      </div>-->
    </li>
<?php 
}
 public function Disconnect($UserReference = '', $Username = '', $Provider)
 {
     if (!$this->Request->IsPostBack()) {
         throw PermissionException('Javascript');
     }
     $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');
     }
 }