public function fbloginAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->getHelper("layout")->disableLayout(); $oModelUser = new Admin_Model_User(); $oFacebook = new Facebook_Facebook(); $sUserFbId = $oFacebook->getUser(); if (is_string($sUserFbId)) { $oUser = $oModelUser->findUserByFbId($sUserFbId); $aParam = $oFacebook->api("/me"); if (isset($oUser)) { $aParam["user_id"] = $oUser->id; $aParam["user_role_id"] = $oUser->user_role_id; $bResult = $this->_oAuth->fbAuth($aParam); } else { $aUser = $oModelUser->newUserFb($aParam); if (isset($aUser)) { $aParam["user_id"] = $aUser["id"]; $aParam["user_role_id"] = $aUser["user_role_id"]; $bResult = $this->_oAuth->fbAuth($aParam); } } } header("Content-type: application/json"); echo Zend_Json::encode($bResult); exit; }