From f51c9ed2abe5c68211bb3736be5f70b1fe2c9ec0 Mon Sep 17 00:00:00 2001 From: M.Gergo Date: Fri, 8 Mar 2019 21:20:34 +0100 Subject: további rendrakás --- .../policy/private/session/facebookConnect-pre.php | 91 ---------------------- 1 file changed, 91 deletions(-) delete mode 100644 mayor-orig/www/policy/private/session/facebookConnect-pre.php (limited to 'mayor-orig/www/policy/private/session/facebookConnect-pre.php') diff --git a/mayor-orig/www/policy/private/session/facebookConnect-pre.php b/mayor-orig/www/policy/private/session/facebookConnect-pre.php deleted file mode 100644 index b0988ae5..00000000 --- a/mayor-orig/www/policy/private/session/facebookConnect-pre.php +++ /dev/null @@ -1,91 +0,0 @@ - __FB_APP_ID, - 'app_secret' => __FB_APP_SECRET, - 'cookie' => true, - 'status' => true, - 'default_graph_version' => 'v2.5', - )); - $oAuth2Client = $fb->getOAuth2Client(); - - $helper = $fb->getJavaScriptHelper(); - try { - $accessToken = $helper->getAccessToken(); - // convert - if ($accessToken !='' && !$accessToken->isLongLived()) { - try { - $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken); - } catch (Facebook\Exceptions\FacebookSDKException $e) { - $_SESSION['alert'][] = "info::Error getting long-lived access token: " . $helper->getMessage() . ""; - } - } - } catch(Facebook\Exceptions\FacebookResponseException $e) { - // When Graph returns an error - $_SESSION['alert'][] = 'info::Graph returned an error: ' . $e->getMessage(); - } catch(Facebook\Exceptions\FacebookSDKException $e) { - // When validation fails or other local issues - $_SESSION['alert'][] = 'info::Facebook SDK returned an error: ' . $e->getMessage(); - } - if (isset($accessToken)) { - $_SESSION['facebook_access_token'] = (string) $accessToken; - $_SESSION['facebook_access_token_object'] = $accessToken; - $response = $fb->get('/me?fields=id,name,email',$accessToken); - $userNode = $response->getGraphUser(); - $ADAT['fbUserId'] = $userNode->getField('id'); - $ADAT['fbUserCn'] = $userNode->getField('name'); - $ADAT['fbUserEmail'] = $userNode->getField('email'); - } - } - if ($action=='revokeFbAuth') { - fbConnectRevoke($ADAT['fbUserId']); - } elseif ($action=='grantFbAuth') { - fbConnectGrant($ADAT); - } - - $ADAT['fbUserIdStatusz'] = checkFbConnectAssoc($ADAT); - - function checkFbConnectAssoc($ADAT) { - if ($ADAT['fbUserId']=='') return 0; - - $q = "SELECT count(*) AS db FROM facebookConnect where userAccount='%s' AND policy='%s' AND fbUserId='%s'"; - $v = array('userAccount'=>_USERACCOUNT,'policy'=>_POLICY,'fbUserId'=>$ADAT['fbUserId']); - $db = db_query($q,array('fv'=>'facebookConnectCheck','modul'=>'login','result'=>'value','values'=>$v)); - if ($db==1) return 1; // 'OK'; - - $q = "SELECT count(*) AS db FROM facebookConnect where userAccount='%s' AND policy='%s' AND fbUserId!='%s'"; - $v = array('userAccount'=>_USERACCOUNT,'policy'=>_POLICY,'fbUserId'=>$ADAT['fbUserId']); - $db = db_query($q,array('fv'=>'facebookConnectCheck','modul'=>'login','result'=>'value','values'=>$v)); - if ($db==1) return 2; // 'masik fbUserId van megadva'; - - $q = "SELECT count(*) AS db FROM facebookConnect where userAccount!='%s' AND policy='%s' AND fbUserId='%s'"; - $v = array('userAccount'=>_USERACCOUNT,'policy'=>_POLICY,'fbUserId'=>$ADAT['fbUserId']); - $db = db_query($q,array('fv'=>'facebookConnectCheck','modul'=>'login','result'=>'value','values'=>$v)); - if ($db==1) return 3; // 'masik userAccount van hozzárendelve ehhez a fb azonosítóhoz'; - - return false; - } - - function fbConnectRevoke($fbUserId) { - if ($fbUserId=='') return 0; - - $q = "DELETE FROM facebookConnect where userAccount='%s' AND policy='%s' AND fbUserId='%s'"; - $v = array('userAccount'=>_USERACCOUNT,'policy'=>_POLICY,'fbUserId'=>$fbUserId); - return db_query($q,array('fv'=>'facebookConnectCheck','modul'=>'login','values'=>$v)); - } - function fbConnectGrant($ADAT) { - if ($ADAT['fbUserId']=='') return 0; - - $q = "INSERT IGNORE INTO facebookConnect (userAccount,policy,fbUserId,fbUserCn,fbUserEmail,studyId) VALUES ('%s','%s','%s','%s','%s','%s')"; - $v = array('userAccount'=>_USERACCOUNT,'policy'=>_POLICY,'fbUserId'=>$ADAT['fbUserId'],'fbUserCn'=>_USERCN.' ('.$ADAT['fbUserCn'].')','fbUserEmail'=>$ADAT['fbUserEmail'],'studyId'=>_STUDYID); - return db_query($q,array('fv'=>'facebookConnectCheck','modul'=>'login','result'=>'insert','values'=>$v)); - } - -?> \ No newline at end of file -- cgit v1.2.3