вопрос
Собственно сабж, как это реализовать?
Открыть /engine/modules/register.php
НАЙТИ:
Вставить НИЖЕ:
НАЙТИ:
$stopregistration = FALSE;
$_IP = get_ip();
Вставить НИЖЕ:
if($config['allow_social'] AND $config['allow_registration'] AND !$is_logged) {
include_once (ENGINE_DIR . '/data/socialconfig.php');
if( !$_SESSION['state'] ) $_SESSION['state'] = md5(uniqid(rand(), TRUE));
if ( $social_config['vk'] ) {
$social_params = array(
'client_id' => $social_config['vkid'],
'redirect_uri' => $config['http_home_url'] . "index.php?do=auth-social&provider=vk",
'scope' => 'offline,wall,email',
'state' => $_SESSION['state'],
'response_type' => 'code'
);
$vk_url = 'http://oauth.vk.com/authorize'.'?' . http_build_query($social_params);
$tpl->set( '[vk]', "" );
$tpl->set( '[/vk]', "" );
$tpl->set( '{vk_url}', $vk_url );
} else {
$tpl->set_block( "'\\[vk\\](.*?)\\[/vk\\]'si", "" );
$tpl->set( '{vk_url}', '' );
}
if ( $social_config['od'] ) {
$social_params = array(
'client_id' => $social_config['odid'],
'redirect_uri' => $config['http_home_url'] . "index.php?do=auth-social&provider=od",
'state' => $_SESSION['state'],
'response_type' => 'code'
);
$odnoklassniki_url = 'http://www.odnoklassniki.ru/oauth/authorize'.'?' . http_build_query($social_params);
$tpl->set( '[odnoklassniki]', "" );
$tpl->set( '[/odnoklassniki]', "" );
$tpl->set( '{odnoklassniki_url}', $odnoklassniki_url );
} else {
$tpl->set_block( "'\\[odnoklassniki\\](.*?)\\[/odnoklassniki\\]'si", "" );
$tpl->set( '{odnoklassniki_url}', '' );
}
if ( $social_config['fc'] ) {
$social_params = array(
'client_id' => $social_config['fcid'],
'redirect_uri' => $config['http_home_url'] . "index.php?do=auth-social&provider=fc",
'scope' => 'public_profile, email',
'display' => 'popup',
'state' => $_SESSION['state'],
'response_type' => 'code'
);
$facebook_url = 'https://www.facebook.com/v2.0/dialog/oauth'.'?' . http_build_query($social_params);
$tpl->set( '[facebook]', "" );
$tpl->set( '[/facebook]', "" );
$tpl->set( '{facebook_url}', $facebook_url );
} else {
$tpl->set_block( "'\\[facebook\\](.*?)\\[/facebook\\]'si", "" );
$tpl->set( '{facebook_url}', '' );
}
if ( $social_config['google'] ) {
$social_params = array(
'client_id' => $social_config['googleid'],
'redirect_uri' => $config['http_home_url'] . "index.php?do=auth-social&provider=google",
'scope' => 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile',
'state' => $_SESSION['state'],
'response_type' => 'code'
);
$google_url = 'https://accounts.google.com/o/oauth2/auth'.'?' . http_build_query($social_params);
$tpl->set( '[google]', "" );
$tpl->set( '[/google]', "" );
$tpl->set( '{google_url}', $google_url );
} else {
$tpl->set_block( "'\\[google\\](.*?)\\[/google\\]'si", "" );
$tpl->set( '{google_url}', '' );
}
if ( $social_config['mailru'] ) {
$social_params = array(
'client_id' => $social_config['mailruid'],
'redirect_uri' => $config['http_home_url'] . "index.php?do=auth-social&provider=mailru",
'state' => $_SESSION['state'],
'response_type' => 'code'
);
$mailru_url = 'https://connect.mail.ru/oauth/authorize'.'?' . http_build_query($social_params);
$tpl->set( '[mailru]', "" );
$tpl->set( '[/mailru]', "" );
$tpl->set( '{mailru_url}', $mailru_url );
} else {
$tpl->set_block( "'\\[mailru\\](.*?)\\[/mailru\\]'si", "" );
$tpl->set( '{mailru_url}', '' );
}
if ( $social_config['yandex'] ) {
$social_params = array(
'client_id' => $social_config['yandexid'],
'redirect_uri' => $config['http_home_url'] . "index.php?do=auth-social&provider=yandex",
'state' => $_SESSION['state'],
'response_type' => 'code'
);
$yandex_url = 'https://oauth.yandex.ru/authorize'.'?' . http_build_query($social_params);
$tpl->set( '[yandex]', "" );
$tpl->set( '[/yandex]', "" );
$tpl->set( '{yandex_url}', $yandex_url );
} else {
$tpl->set_block( "'\\[yandex\\](.*?)\\[/yandex\\]'si", "" );
$tpl->set( '{yandex_url}', '' );
}
} else {
$_SESSION['state'] = false;
$tpl->set_block( "'\\[vk\\](.*?)\\[/vk\\]'si", "" );
$tpl->set( '{vk_url}', '' );
$tpl->set_block( "'\\[odnoklassniki\\](.*?)\\[/odnoklassniki\\]'si", "" );
$tpl->set( '{odnoklassniki_url}', '' );
$tpl->set_block( "'\\[facebook\\](.*?)\\[/facebook\\]'si", "" );
$tpl->set( '{facebook_url}', '' );
$tpl->set_block( "'\\[google\\](.*?)\\[/google\\]'si", "" );
$tpl->set( '{google_url}', '' );
$tpl->set_block( "'\\[mailru\\](.*?)\\[/mailru\\]'si", "" );
$tpl->set( '{mailru_url}', '' );
$tpl->set_block( "'\\[yandex\\](.*?)\\[/yandex\\]'si", "" );
$tpl->set( '{yandex_url}', '' );
}