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 --- .../www/policy/private/session/googleapi-pre.php | 100 --------------------- 1 file changed, 100 deletions(-) delete mode 100644 mayor-orig/www/policy/private/session/googleapi-pre.php (limited to 'mayor-orig/www/policy/private/session/googleapi-pre.php') diff --git a/mayor-orig/www/policy/private/session/googleapi-pre.php b/mayor-orig/www/policy/private/session/googleapi-pre.php deleted file mode 100644 index 49438dcc..00000000 --- a/mayor-orig/www/policy/private/session/googleapi-pre.php +++ /dev/null @@ -1,100 +0,0 @@ -setClientId(__GOOGLEAPI_CLIENT_ID); - $client->setClientSecret(__GOOGLEAPI_CLIENT_SECRET); - $client->setScopes('email'); - // $client->setAccessToken($_SESSION['googleapi_id_token']); - try { - $ADAT['payload'] = $payload = $client->verifyIdToken($_SESSION['googleapi_id_token']); - $ADAT['googleapiStatusz'] = 1; - } catch(Exception $e) { - $_SESSION['alert'][] = 'info::googleapi SDK hiba: ' . $e->getMessage(); - $ADAT['googleapiStatusz'] = 2; - } - } elseif ($_GET['id_token']!='') { - $redirect_uri = _BASE_URL.'/index.php'; - $client = new Google_Client(); - //$client->setAuthConfig($oauth_credentials); - $client->setClientId(__GOOGLEAPI_CLIENT_ID); - $client->setClientSecret(__GOOGLEAPI_CLIENT_SECRET); -// $client->setRedirectUri($redirect_uri); - $client->setScopes('email'); - try { - $payload = $client->verifyIdToken($_GET['id_token']); - } catch(Exception $e) { - $_SESSION['alert'][] = 'info::googleapi SDK hiba: ' . $e->getMessage(); - } - if (isset($payload['sub'])) { // subject - $_SESSION['google_access_token'] = (string) $payload; - $_SESSION['google_access_token_object'] = $payload; - // mayor auth start - $accountInformation=array(); - $toPolicy = 'public'; - $ADAT['googleSub'] = $payload['sub']; -// $ADAT['fbUserId'] = $userNode->getField('id'); - $ADAT['googleUserCn'] = $payload['name']; - $ADAT['googleUserEmail'] = $payload['email']; - googleapiGrant($ADAT); - /* mayor auth stop */ - } else { - $_SESSION['alert'][] = 'info:nem érvényes accessToken'; - } - } - - } - function googleapiCheckAssoc($ADAT) { - if ($ADAT['googleSub']=='') return 0; - - $q = "SELECT count(*) AS db FROM googleConnect where userAccount='%s' AND policy='%s' AND googleSub='%s'"; - $v = array('userAccount'=>_USERACCOUNT,'policy'=>_POLICY,'fbUserId'=>$ADAT['googleSub']); - $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 googleConnect where userAccount='%s' AND policy='%s' AND googleSub!='%s'"; - $v = array('userAccount'=>_USERACCOUNT,'policy'=>_POLICY,'fbUserId'=>$ADAT['googleSub']); - $db = db_query($q,array('fv'=>'facebookConnectCheck','modul'=>'login','result'=>'value','values'=>$v)); - if ($db==1) return 2; // 'masik googleSub van megadva'; - - $q = "SELECT count(*) AS db FROM googleConnect where userAccount!='%s' AND policy='%s' AND googleSub='%s'"; - $v = array('userAccount'=>_USERACCOUNT,'policy'=>_POLICY,'googleSub'=>$ADAT['googleSub']); - $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 googleSub azonosítóhoz'; - - return false; - } - - function googleapiRevoke() { - $q = "DELETE FROM googleConnect where userAccount='%s' AND policy='%s'"; - $v = array('userAccount'=>_USERACCOUNT,'policy'=>_POLICY); - return db_query($q,array('fv'=>'googleapiRevoke','modul'=>'login','values'=>$v)); - } - function googleapiGrant($ADAT) { - if ($ADAT['googleSub']=='') return 0; - $q = "INSERT IGNORE INTO googleConnect (userAccount,policy,googleSub,googleUserCn,googleUserEmail,studyId) VALUES ('%s','%s','%s','%s','%s','%s')"; - $v = array('userAccount'=>_USERACCOUNT,'policy'=>_POLICY,'googleSub'=>$ADAT['googleSub'],_USERACCOUNT.' ('.$ADAT['googleUserCn'].')',$ADAT['googleUserEmail'],_STUDYID); - return db_query($q,array('debug'=>true,'fv'=>'googleapiGrant','modul'=>'login','result'=>'insert','values'=>$v)); - } - -?> \ No newline at end of file -- cgit v1.2.3