Server : Apache
System : Linux iZ2vcgyutqttsd1p850kl8Z 3.10.0-1160.92.1.el7.x86_64 #1 SMP Tue Jun 20 11:48:01 UTC 2023 x86_64
User : www ( 1000)
PHP Version : 5.6.40
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Directory :  /www/wwwroot/saimikebio.com/mobile/include/website/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : /www/wwwroot/saimikebio.com/mobile/include/website/oath2.class.php
<?php 

if (!defined('WEBSITE'))

{

	include_once(dirname(__FILE__).'/cls_http.php');

	class oath2 extends cls_http

	{

		public $tokenURL;

		public $authorizeURL;

		public $userURL;

		

		

		public $scope = '';

		public $app_key;

		public $app_secret;

		public $display = '';

		public $graphURL = '';

		

		

		public $token = array();

		public $meth = array();

		

		public $post_login = array();

		public $post_token = array();

		public $post_msg = array();

		

		

		function login( $callblock)

		{

			$pare = array();

			

			$pare['client_id'] = $this->app_key;

			$pare['redirect_uri'] = $callblock;

			$pare['response_type'] = 'code';

			//$pare['state'] = $callblock;

			$pare['scope'] = $this->scope;

			$pare['display'] = $this->display;

			setcookie('___OATH2_CALLBLOCK__' , $callblock , time()+3600 , '/');



			$p = array_merge($pare , $this->post_login);

			$p = $this->unset_null($p);

			return $this->authorizeURL .'?'. http_build_query($p);

		}

		

		function getAccessToken()

		{

			if(method_exists($this , 'gettoken'))

			{

				$this->token = $this->gettoken();

				return $this->token;

			}

			

			$pare = array();

			

			$pare['client_id'] = $this->app_key;

			$pare['client_secret'] = $this->app_secret;

			$pare['grant_type'] = 'authorization_code';

			$pare['code'] = $_REQUEST['code'];

			$pare['redirect_uri'] = $_COOKIE['___OATH2_CALLBLOCK__'];

			

	

			setcookie('___OATH2_CALLBLOCK__' , '' , time()-3600 , '/');

			$p = array_merge( $pare , $this->post_token);

			$p = $this->unset_null($p);

			$result = $this->http($this->tokenURL , $this->meth , $p);

	

			if(method_exists($this , 'getGraph'))

			{

				$token = $this->getGraph($result);

			}

			else

			{

				$token = json_decode($result , true);

			}

			

			$this->token = $token;

			return $token;

		}

		

		function setAccessToken( $token ){$this->token = $token; return true;}

		

		function getMessage()

		{

			$pare = array();

			$pare['client_id'] = $this->app_key;

			$pare['client_secret'] = $this->app_secret;

			$pare['access_token'] = $this->token['access_token'];

			

			if(!empty($this->token['refresh_token']))

			{

				$pare['refresh_token'] = $this->token['refresh_token'];

			}

			

			$p = array_merge( $pare , $this->token , $this->post_msg);

			

			

			$p = $this->unset_null($p);

			

			

			if(method_exists($this , 'sign'))

			{

				$this->sign( $p );

			}

			

			$result = $this->http($this->userURL , $this->meth  , $p);

			if(method_exists($this , 'is_error'))

			{

				$info = $this->is_error($result);

			}

			else

			{

				$info = json_decode($result , true);

			}

			

			

			if( method_exists($this , 'message') )

			{

				$info = $this->message($info);

			}

			return $info;

		}

		

		

		function unset_null( $pare ){$arr = $pare;foreach($arr as $key => $val){if(empty($val)){unset($arr[$key]);}}return $arr;}

		

	}

}

?>