Exemplo n.º 1
0
 public function executeImport(sfWebRequest $request)
 {
     $users_infos = sfFacebook::getFacebookApi()->users_getInfo(array(sfFacebook::getAnyFacebookUid()), array('pic', 'email', 'email_hashes', 'name'));
     $form = new RegistrationFacebookForm(array(), array(), false);
     $bind = $this->mapToBindArray($users_infos[0]);
     if (!($user = Doctrine::getTable('PublicUser')->findOneByEmail($users_infos[0]['email']))) {
         $form->bind($bind, array());
         if ($form->isValid()) {
             $user = $form->save();
         } else {
             $schema = $form->getErrorSchema();
             foreach ($schema as $index => $err) {
                 echo $index . " " . $err;
             }
         }
     }
     $this->getUser()->authAs($user);
     $this->redirect($this->getComponent('linker', 'localizedHomepage'));
     return sfView::NONE;
 }
Exemplo n.º 2
0
 public function getFbId()
 {
     return sfFacebook::getAnyFacebookUid();
 }
Exemplo n.º 3
0
<?php

if ($sf_user->isAuthenticated() && sfFacebook::getAnyFacebookUid()) {
    ?>
    <?php 
    echo __('Hello');
    ?>
    <?php 
    echo $sf_user->getFacebookFirstName();
    ?>
    <img src="<?php 
    echo $sf_user->getFacebookProfilePic();
    ?>
" title="<?php 
    echo $sf_user->getFacebookName();
    ?>
"/>
    <a href="<?php 
    echo url_for('sfGuardAuth/signout');
    ?>
"><?php 
    echo __('Logout');
    ?>
</a>

<?php 
} else {
    ?>
    <fb:login-button v="2" onlogin="updateLoginBox('<?php 
    echo url_for('sfFacebookConnectAuth/signin');
    ?>