public function __construct() { //SESSION ENABLED parent::sessionStart(); parent::__construct(); parent::makeTemplate("oauth_response_handler.html"); $this->user_logged = true; $this->client = OauthClient::getInstance()->getClient(); $plus = new Google_Service_Oauth2($this->client); $filterArgs = array('code' => array('filter' => FILTER_SANITIZE_STRING), 'error' => array('filter' => FILTER_SANITIZE_STRING)); $__postInput = filter_input_array(INPUT_GET, $filterArgs); $code = $__postInput['code']; $error = $__postInput['error']; if (isset($code) && $code) { $this->client->authenticate($code); $_SESSION['access_token'] = $this->client->getAccessToken(); $user = $plus->userinfo->get(); //get response from third-party $this->userData['email'] = $user['email']; $this->userData['first_name'] = $user['givenName']; $this->userData['last_name'] = $user['familyName']; } else { if (isset($error)) { $this->user_logged = false; } } //get url to redirect to //add default if not set if (!isset($_SESSION['incomingUrl']) or empty($_SESSION['incomingUrl'])) { $_SESSION['incomingUrl'] = '/'; } $this->redirectUrl = $_SESSION['incomingUrl']; //remove no more used var unset($_SESSION['incomingUrl']); }
public function __construct() { //SESSION ENABLED parent::sessionStart(); parent::__construct(); parent::makeTemplate("login.html"); $filterArgs = array('incomingUrl' => array('filter' => FILTER_SANITIZE_URL)); $__postInput = filter_input_array(INPUT_GET, $filterArgs); $this->incomingUrl = $__postInput['incomingUrl']; //if nothing is specified by user if (empty($this->incomingUrl)) { //open session to pull put information about incoming url $this->incomingUrl = $_SESSION['incomingUrl']; } else { //else, update session $_SESSION['incomingUrl'] = $this->incomingUrl; } }
public function __construct() { parent::sessionStart(); parent::__construct(false); $filterArgs = array('pid' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'jid' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH)); $postInput = filter_input_array(INPUT_GET, $filterArgs); $this->pid = $postInput['pid']; $this->jid = $postInput['jid']; $pass = $postInput['password']; if (!empty($this->jid)) { parent::makeTemplate("jobAnalysis.html"); $this->jpassword = $pass; $this->ppassword = null; } else { parent::makeTemplate("analyze.html"); $this->jid = null; $this->jpassword = null; $this->ppassword = $pass; } }