Пример #1
0
 /**
  * @param $authId
  * @return boolean
  */
 private function isLastUserWithAuthID($authId)
 {
     $guser = new Gpf_Db_User();
     $guser->setAuthId($authId);
     try {
         $guser->loadFromData(array(Gpf_Db_Table_Users::AUTHID));
     } catch (Gpf_Exception $e) {
         return false;
     }
     return true;
 }
Пример #2
0
    public function save() {
        if ($this->isFirstChangeStatus()) {
            $this->setDateApproved(Gpf_Common_DateUtils::now());
        }
        try {
            $authUser = new Gpf_Db_AuthUser();
            $authUser->setPrimaryKeyValue($this->authUser->getPrimaryKeyValue());
            $authUser->load();
            $this->accountUser->setAuthId($authUser->getId());
        } catch (Gpf_Exception $e) {
            try {
                $this->authUser->loadFromUsername();
                $this->accountUser->setAuthId($this->authUser->getId());
            } catch (Exception $e) {
            }
        }

        $this->inserting = !$this->user->rowExists();

        $this->checkConstraints();

        Gpf_Plugins_Engine::extensionPoint('PostAffiliate.User.beforeSave', $this);

        $this->authUser->save();
        $this->accountUser->setAuthId($this->authUser->getId());

        try {
            $this->accountUser->save();
        } catch (Gpf_Exception $e) {
            $this->authUser->delete();
            throw new Gpf_Exception($e->getMessage());
        }

        $this->user->set('accountuserid', $this->accountUser->get('accountuserid'));
        $this->initRefid($this->accountUser->getId());
        $this->initMinimupPayout();

        try {
            $this->user->save();
        } catch (Gpf_Exception $e) {
            $this->authUser->delete();
            $this->accountUser->delete();
            throw new Gpf_Exception($e->getMessage());
        }

        if($this->inserting) {
            $this->afterInsert();
        } else {
            Pap_Db_Table_CachedBanners::deleteCachedBannersForUser($this->user->getId(), $this->user->getRefId());
            Gpf_Plugins_Engine::extensionPoint('PostAffiliate.User.afterSave', $this);
        }
    }
Пример #3
0
 private function getAccountUser($authUserId)
 {
     $accountUser = new Gpf_Db_User();
     $accountUser->setAuthId($authUserId);
     try {
         $accountUser->loadFromData(array(Gpf_Db_Table_Users::AUTHID));
     } catch (Exception $e) {
         return null;
     }
     return $accountUser;
 }