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']); }
/** * Get Client Instance and retrieve authentication url * */ protected function generateAuthURL() { $this->client = OauthClient::getInstance()->getClient(); $this->authURL = $this->client->createAuthUrl(); }
public function setTemplateVars() { $this->template->jobs = $this->jobs; $this->template->fast_analysis_wc = $this->fast_analysis_wc; $this->template->fast_analysis_wc_print = $this->fast_analysis_wc_print; $this->template->tm_analysis_wc = $this->tm_analysis_wc; $this->template->tm_analysis_wc_print = $this->tm_analysis_wc_print; $this->template->standard_analysis_wc = $this->standard_analysis_wc; $this->template->standard_analysis_wc_print = $this->standard_analysis_wc_print; $this->template->total_raw_word_count = $this->total_raw_word_count; $this->template->total_raw_word_count_print = $this->total_raw_word_count_print; $this->template->pname = $this->pname; $this->template->pid = $this->pid; $this->template->project_password = $this->ppassword; $this->template->project_not_found = $this->project_not_found; $this->template->fast_wc_time = $this->fast_wc_time; $this->template->tm_wc_time = $this->tm_wc_time; $this->template->tm_wc_unit = $this->tm_wc_unit; $this->template->fast_wc_unit = $this->fast_wc_unit; $this->template->standard_wc_unit = $this->standard_wc_unit; $this->template->raw_wc_time = $this->raw_wc_time; $this->template->standard_wc_time = $this->standard_wc_time; $this->template->raw_wc_unit = $this->raw_wc_unit; $this->template->project_status = $this->project_status; $this->template->num_segments = $this->num_segments; $this->template->num_segments_analyzed = $this->num_segments_analyzed; $this->template->logged_user = $this->logged_user !== false ? $this->logged_user->shortName() : ""; $this->template->extended_user = $this->logged_user !== false ? trim($this->logged_user->fullName()) : ""; $this->template->build_number = INIT::$BUILD_NUMBER; $this->template->enable_outsource = INIT::$ENABLE_OUTSOURCE; $this->template->outsource_service_login = $this->_outsource_login_API; $this->template->support_mail = INIT::$SUPPORT_MAIL; $langDomains = Langs_LanguageDomains::getInstance(); $this->subject = $langDomains::getDisplayDomain($this->subject); $this->template->subject = $this->subject; $this->template->isLoggedIn = $this->isLoggedIn(); if (isset($_SESSION['_anonym_pid']) && !empty($_SESSION['_anonym_pid'])) { $_SESSION['incomingUrl'] = INIT::$HTTPHOST . $_SERVER['REQUEST_URI']; $_SESSION['_newProject'] = 1; $this->template->showModalBoxLogin = true; } else { $this->template->showModalBoxLogin = false; } //url to which to send data in case of login $client = OauthClient::getInstance()->getClient(); $this->template->oauthFormUrl = $client->createAuthUrl(); $this->template->incomingUrl = '/login?incomingUrl=' . $_SERVER['REQUEST_URI']; //perform check on running daemons and send a mail randomly $misconfiguration = Analysis_Manager::thereIsAMisconfiguration(); if ($misconfiguration && mt_rand(1, 3) == 1) { $msg = "<strong>The analysis daemons seem not to be running despite server configuration.</strong><br />Change the application configuration or start analysis daemons."; Utils::sendErrMailReport($msg, "Matecat Misconfiguration"); } $this->template->daemon_misconfiguration = var_export($misconfiguration, true); }