require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/employer.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/freelancer.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/wizard/wizard.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/Helpers/SubBarNotificationHelper.php'; $uid = get_uid(false); if ($uid) { $type = OpauthHelper::ACTION_BIND; $multilevel = OpauthHelper::getMultilevel(); $uri_part = $multilevel ? 'safety' : 'main'; $back_url = '/users/' . $_SESSION['login'] . '/setup/' . $uri_part . '/'; } else { $type = OpauthHelper::ACTION_REGISTER; $back_url = '/registration/'; } $Opauth = new Opauth(OpauthHelper::getConfig(), false); $response = $_SESSION['opauth']; unset($_SESSION['opauth_error']); $is_valid = $Opauth->validate(sha1(print_r($response['auth'], true)), $response['timestamp'], $response['signature'], $reason); $opauth_error = OpauthHelper::getError($is_valid, $response); if ($opauth_error) { $_SESSION['opauth_error'] = $opauth_error; header_location_exit($back_url); } $opauthModel = new OpauthModel(); $opauthModel->setData($response); $emp_redirect = OpauthHelper::getEmpRedirect(); $user = $opauthModel->getUser(); if ($user) { //Уже есть привязка unset($_SESSION['opauth']);
<?php define('IS_OPAUTH', true); require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/stdf.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/opauth/OpauthHelper.php"; $config = OpauthHelper::getConfig(); $uri = '/auth/'; $param = __paramInit('string', 'param'); if ($param) { $uri .= $param; } $action = __paramInit('string', 'action'); if ($action) { $uri .= '/' . $action; } else { OpauthHelper::setRole(__paramInit('int', 'role')); OpauthHelper::setMultilevel(__paramInit('int', 'multilevel')); OpauthHelper::saveRedirect(); } $config['request_uri'] = $uri; $Opauth = new Opauth($config);