Пример #1
0
 public static function getInstance()
 {
     if (!isset(self::$classInstance)) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
Пример #2
0
 public function disconnect($params)
 {
     //	init
     if (!OW::getUser()->isAuthenticated()) {
         throw new AuthenticateException();
     }
     if (!isset($params['userLinkingId']) || !strlen(trim($params['userLinkingId']))) {
         $this->redirect(OW::getRouter()->urlForRoute('ynsocialconnect_user_user_linking'));
     }
     if (!isset($params['service']) || !strlen(trim($params['service']))) {
         $this->redirect(OW::getRouter()->urlForRoute('ynsocialconnect_user_user_linking'));
     }
     $userLinkingId = (int) $params['userLinkingId'];
     $service = $params['service'];
     $userId = (int) OW::getUser()->getId();
     //	process
     $provider = YNSOCIALCONNECT_BOL_ServicesService::getInstance()->getProvider($service);
     ////	remove ow_base_remote_auth
     $listRemoteAuth = YNSOCIALCONNECT_BOL_ExtendsRemoteAuthService::getInstance()->findAll();
     $deletedRemoteAuth = NULL;
     foreach ($listRemoteAuth as $val) {
         if ($val->userId == $userId && $val->type == $service) {
             YNSOCIALCONNECT_BOL_ExtendsRemoteAuthService::getInstance()->deleteById($val->id);
             break;
         }
     }
     ////	remove agent in social connect
     YNSOCIALCONNECT_BOL_AgentsService::getInstance()->deleteByUserIdAndServiceId($userId, $provider->id);
     ////	remove account linking
     YNSOCIALCONNECT_BOL_UserlinkingService::getInstance()->deleteById($userLinkingId);
     //// 	clear session
     if (isset($_SESSION['socialbridge_session'][$service])) {
         unset($_SESSION['socialbridge_session'][$service]);
     }
     //	end
     $this->redirect(OW::getRouter()->urlForRoute('ynsocialconnect_user_user_linking'));
 }