public function GoogleUser() { $client = new \Google_Client(); $client->setApplicationName(\SKT_GOOGLEOAUTH2_SETAPPLICATIONNAME); // Visit https://code.google.com/apis/console?api=plus to generate your // oauth2_client_id, oauth2_client_secret, and to register your oauth2_redirect_uri. $client->setClientId(\SKT_GOOGLEOAUTH2_SETCLIENTID); $client->setClientSecret(\SKT_GOOGLEOAUTH2_SETCLIENTSECRET); $client->setRedirectUri(\SKT_GOOGLEOAUTH2_SETREDIRECTURI); $client->setDeveloperKey(\SKT_GOOGLEOAUTH2_SETDEVELOPERKEY); $oauth2 = new \Google_Oauth2Service($client); if (isset($_GET['code'])) { $client->authenticate($_GET['code']); $_SESSION['token'] = $client->getAccessToken(); $redirect = \SITE_SERVER; \CmsDev\Header\refresh::refreshNow(\filter_var($redirect, FILTER_SANITIZE_URL)); return; } if (isset($_SESSION['token'])) { $client->setAccessToken($_SESSION['token']); } if (isset($_REQUEST['logout']) or \THIS_URL_REAL === 'UserLogout') { unset($_SESSION['token']); $client->revokeToken(); } if ($client->getAccessToken()) { $user = $oauth2->userinfo->get(); // These fields are currently filtered through the PHP sanitize filters. // See http://www.php.net/manual/en/filter.filters.sanitize.php $this->family_name = filter_var($user['family_name'], \FILTER_SANITIZE_STRING); $this->name = filter_var($user['name'], \FILTER_SANITIZE_STRING); $this->locale = filter_var($user['locale'], \FILTER_SANITIZE_STRING); $this->gender = filter_var($user['gender'], \FILTER_SANITIZE_STRING); $this->email = filter_var($user['email'], \FILTER_SANITIZE_EMAIL); $this->link = filter_var($user['link'], \FILTER_SANITIZE_URL); $this->given_name = filter_var($user['given_name'], \FILTER_SANITIZE_STRING); $this->id = filter_var($user['id'], \FILTER_SANITIZE_STRING); $this->verified_email = filter_var($user['verified_email'], \FILTER_SANITIZE_STRING); if (isset($user['picture']) && $user['picture'] != '') { $this->picture = filter_var($user['picture'], \FILTER_VALIDATE_URL); } else { $this->picture = \SKT_ACCESS_AVATAR; } $this->ClientAuth = 'Google'; $_SESSION['token'] = $client->getAccessToken(); $this->createAuthUrl = $client->createAuthUrl(); $this->Info = array('family_name' => HtmlSpecialChars($this->family_name), 'name' => HtmlSpecialChars($this->name), 'locale' => $this->locale, 'gender' => $this->gender, 'email' => $this->email, 'link' => $this->link, 'given_name' => HtmlSpecialChars($this->given_name), 'id' => $this->id, 'verified_email' => $this->verified_email, 'picture' => $this->picture, 'ClientAuth' => $this->ClientAuth, 'createAuthUrl' => $this->createAuthUrl); \CmsDev\Security\UserRegister::checkAction($this->Info); return true; } else { $this->createAuthUrl = $client->createAuthUrl(); new \CmsDev\Url\refer(); return false; } }
<?php $randomize = rand(2, 65487); $Type1 = 'selected="selected"'; $Type2 = ''; if (isset($_POST['PromoEmpresas'])) { $Type1 = ''; $Type2 = 'selected="selected"'; } ?> <div class="mb30" > <?php if (isset($_POST['username']) && $_POST['username'] != '' && isset($_POST['password']) && $_POST['password'] != '' && isset($_POST['password2']) && $_POST['password2'] != '' && isset($_POST['email']) && $_POST['email'] != '' && $_POST['password'] === $_POST['password2']) { echo \CmsDev\Security\UserRegister::checkAction($_POST); ?> <?php } else { ?> <div class="col-md-7"> <h2 class="page-header"><i class="skt-icon-user-profile"></i> <?php echo SKT_ADMIN_TitleRegistration; ?> </h2> <div class="gap-small"></div> <form action="" method="post" id="SKTRegister" enctype="multipart/form-data"> <input type="hidden" id="level" name="level" value="Publishers" /> <input type="hidden" id="usernameValid" name="usernameValid" value="0" /> <div class="col-md-12"> <h3><strong>1.</strong> <span>Finalidad del registro:</span></h3>