From 25bce8592d52fc88e1b6b5f35afd1f1addb20eaa Mon Sep 17 00:00:00 2001 From: thisgun Date: Fri, 17 Nov 2017 10:30:42 +0900 Subject: [PATCH] =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=ED=83=88=ED=87=B4=20?= =?UTF-8?q?=EB=B6=80=EB=B6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adm/config_form.php | 17 ++- adm/config_form_update.php | 1 + extend/social_login.extend.php | 6 +- install/gnuboard5.sql | 1 + lib/common.lib.php | 5 + plugin/social/Hybrid/Providers/Kakao.php | 4 + plugin/social/Hybrid/Providers/Payco.php | 186 +---------------------- plugin/social/includes/functions.php | 4 +- 8 files changed, 39 insertions(+), 185 deletions(-) diff --git a/adm/config_form.php b/adm/config_form.php index 8f1f48990..c579d6505 100644 --- a/adm/config_form.php +++ b/adm/config_form.php @@ -210,6 +210,13 @@ if(!isset($config['cf_social_login_use'])) { ", true); } +//소셜 로그인 관련 필드 카카오 클라이언트 시크릿 추가 +if(!isset($config['cf_kakao_client_secret'])) { + sql_query("ALTER TABLE `{$g5['config_table']}` + ADD `cf_kakao_client_secret` varchar(100) NOT NULL DEFAULT '' AFTER `cf_kakao_rest_key` + ", true); +} + // 소셜 로그인 관리 테이블 없을 경우 생성 if(!sql_query(" DESC {$g5['social_profile_table']} ", false)) { sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['social_profile_table']}` ( @@ -439,7 +446,7 @@ if ($config['cf_sms_use'] && $config['cf_icode_id'] && $config['cf_icode_pw']) { - + 1) Kcaptcha 는 그누보드5의 기본캡챠입니다. ( 문자입력 )
2) reCAPTCHA V2 는 구글에서 서비스하는 원클릭 형식의 간편한 캡챠입니다. ( 모바일 친화적 UI )
3) Invisible reCAPTCHA 는 구글에서 서비스하는 안보이는 형식의 캡챠입니다. ( 간혹 퀴즈를 풀어야 합니다. )
') ?> 앱 등록하기 - + + + + + + + diff --git a/adm/config_form_update.php b/adm/config_form_update.php index 1896bcea2..2adf03d1f 100644 --- a/adm/config_form_update.php +++ b/adm/config_form_update.php @@ -143,6 +143,7 @@ $sql = " update {$g5['config_table']} cf_google_clientid = '{$_POST['cf_google_clientid']}', cf_google_secret = '{$_POST['cf_google_secret']}', cf_kakao_rest_key = '{$_POST['cf_kakao_rest_key']}', + cf_kakao_client_secret = '{$_POST['cf_kakao_client_secret']}', cf_social_servicelist = '{$cf_social_servicelist}', cf_captcha = '{$_POST['cf_captcha']}', cf_recaptcha_site_key = '{$_POST['cf_recaptcha_site_key']}', diff --git a/extend/social_login.extend.php b/extend/social_login.extend.php index 0a21ec3c2..064497fdb 100644 --- a/extend/social_login.extend.php +++ b/extend/social_login.extend.php @@ -1,8 +1,10 @@ $code ); + if( $this->api->client_secret && ($this->api->client_secret !== $this->api->client_id) ){ + $params['client_secret'] = $this->api->client_secret; + } + $response = $this->request($this->api->token_url, $params, $this->api->curl_authenticate_method); $response = $this->parseRequestResult($response); if ( ! $response || ! isset($response->access_token) ) { diff --git a/plugin/social/Hybrid/Providers/Payco.php b/plugin/social/Hybrid/Providers/Payco.php index b23e71a26..c0bb45480 100644 --- a/plugin/social/Hybrid/Providers/Payco.php +++ b/plugin/social/Hybrid/Providers/Payco.php @@ -5,15 +5,14 @@ * (c) 2009-2012, HybridAuth authors | http://hybridauth.sourceforge.net/licenses.html */ /** - * Hybrid_Providers_Facebook provider adapter based on OAuth2 protocol + * Hybrid_Providers_Payco provider adapter based on OAuth2 protocol + * Copyright (c) 2017 SIR - thisgun + * http://sir.kr * * */ class Hybrid_Providers_Payco extends Hybrid_Provider_Model_OAuth2 { - /** - * default permissions, and a lot of them. You can change them from the configuration by setting the scope to what you want/need - * {@inheritdoc} - */ + private $idNo; /** @@ -208,179 +207,6 @@ class Hybrid_Providers_Payco extends Hybrid_Provider_Model_OAuth2 { $this->user->profile->sid = get_social_convert_id( $this->user->profile->identifier, $this->providerId ); return $this->user->profile; - } - /** - * Attempt to retrieve the url to the cover image given the coverInfoURL - * - * @param string $coverInfoURL coverInfoURL variable - * @return string url to the cover image OR blank string - */ - function getCoverURL($coverInfoURL) { - try { - $headers = get_headers($coverInfoURL); - if (substr($headers[0], 9, 3) != "404") { - $coverOBJ = json_decode(file_get_contents($coverInfoURL)); - if (array_key_exists('cover', $coverOBJ)) { - return $coverOBJ->cover->source; - } - } - } catch (Exception $e) { - } - return ""; - } - /** - * {@inheritdoc} - */ - function getUserContacts() { - $apiCall = '?fields=link,name'; - $returnedContacts = array(); - $pagedList = false; - do { - try { - $response = $this->api->api('/me/friends' . $apiCall); - } catch (Exception $e) { - throw new Exception("User contacts request failed! {$this->providerId} returned an error {$e->getMessage()}", 0, $e); - } - // Prepare the next call if paging links have been returned - if (array_key_exists('paging', $response) && array_key_exists('next', $response['paging'])) { - $pagedList = true; - $next_page = explode('friends', $response['paging']['next']); - $apiCall = $next_page[1]; - } else { - $pagedList = false; - } - // Add the new page contacts - $returnedContacts = array_merge($returnedContacts, $response['data']); - } while ($pagedList == true); - $contacts = array(); - foreach ($returnedContacts as $item) { - $uc = new Hybrid_User_Contact(); - $uc->identifier = (array_key_exists("id", $item)) ? $item["id"] : ""; - $uc->displayName = (array_key_exists("name", $item)) ? $item["name"] : ""; - $uc->profileURL = (array_key_exists("link", $item)) ? $item["link"] : "https://www.facebook.com/profile.php?id=" . $uc->identifier; - $uc->photoURL = "https://graph.facebook.com/" . $uc->identifier . "/picture?width=150&height=150"; - $contacts[] = $uc; - } - return $contacts; - } - /** - * Update user status - * - * @param mixed $status An array describing the status, or string - * @param string $pageid (optional) User page id - * @return array - * @throw Exception - */ - function setUserStatus($status, $pageid = null) { - if (!is_array($status)) { - $status = array('message' => $status); - } - if (is_null($pageid)) { - $pageid = 'me'; - // if post on page, get access_token page - } else { - $access_token = null; - foreach ($this->getUserPages(true) as $p) { - if (isset($p['id']) && intval($p['id']) == intval($pageid)) { - $access_token = $p['access_token']; - break; - } - } - if (is_null($access_token)) { - throw new Exception("Update user page failed, page not found or not writable!"); - } - $status['access_token'] = $access_token; - } - try { - $response = $this->api->api('/' . $pageid . '/feed', 'post', $status); - } catch (Exception $e) { - throw new Exception("Update user status failed! {$this->providerId} returned an error {$e->getMessage()}", 0, $e); - } - return $response; - } - /** - * {@inheridoc} - */ - function getUserStatus($postid) { - try { - $postinfo = $this->api->api("/" . $postid); - } catch (Exception $e) { - throw new Exception("Cannot retrieve user status! {$this->providerId} returned an error: {$e->getMessage()}", 0, $e); - } - return $postinfo; - } - /** - * {@inheridoc} - */ - function getUserPages($writableonly = false) { - if (( isset($this->config['scope']) && strpos($this->config['scope'], 'manage_pages') === false ) || (!isset($this->config['scope']) && strpos($this->scope, 'manage_pages') === false )) - throw new Exception("User status requires manage_page permission!"); - try { - $pages = $this->api->api("/me/accounts", 'get'); - } catch (Exception $e) { - throw new Exception("Cannot retrieve user pages! {$this->providerId} returned an error: {$e->getMessage()}", 0, $e); - } - if (!isset($pages['data'])) { - return array(); - } - if (!$writableonly) { - return $pages['data']; - } - $wrpages = array(); - foreach ($pages['data'] as $p) { - if (isset($p['perms']) && in_array('CREATE_CONTENT', $p['perms'])) { - $wrpages[] = $p; - } - } - return $wrpages; - } - /** - * load the user latest activity - * - timeline : all the stream - * - me : the user activity only - * {@inheritdoc} - */ - function getUserActivity($stream) { - try { - if ($stream == "me") { - $response = $this->api->api('/me/feed'); - } else { - $response = $this->api->api('/me/home'); - } - } catch (Exception $e) { - throw new Exception("User activity stream request failed! {$this->providerId} returned an error: {$e->getMessage()}", 0, $e); - } - if (!$response || !count($response['data'])) { - return array(); - } - $activities = array(); - foreach ($response['data'] as $item) { - if ($stream == "me" && $item["from"]["id"] != $this->api->getUser()) { - continue; - } - $ua = new Hybrid_User_Activity(); - $ua->id = (array_key_exists("id", $item)) ? $item["id"] : ""; - $ua->date = (array_key_exists("created_time", $item)) ? strtotime($item["created_time"]) : ""; - if ($item["type"] == "video") { - $ua->text = (array_key_exists("link", $item)) ? $item["link"] : ""; - } - if ($item["type"] == "link") { - $ua->text = (array_key_exists("link", $item)) ? $item["link"] : ""; - } - if (empty($ua->text) && isset($item["story"])) { - $ua->text = (array_key_exists("link", $item)) ? $item["link"] : ""; - } - if (empty($ua->text) && isset($item["message"])) { - $ua->text = (array_key_exists("message", $item)) ? $item["message"] : ""; - } - if (!empty($ua->text)) { - $ua->user->identifier = (array_key_exists("id", $item["from"])) ? $item["from"]["id"] : ""; - $ua->user->displayName = (array_key_exists("name", $item["from"])) ? $item["from"]["name"] : ""; - $ua->user->profileURL = "https://www.facebook.com/profile.php?id=" . $ua->user->identifier; - $ua->user->photoURL = "https://graph.facebook.com/" . $ua->user->identifier . "/picture?type=square"; - $activities[] = $ua; - } - } - return $activities; - } + } //end function getUserProfile + } \ No newline at end of file diff --git a/plugin/social/includes/functions.php b/plugin/social/includes/functions.php index f1bd33f3c..0de274e81 100644 --- a/plugin/social/includes/functions.php +++ b/plugin/social/includes/functions.php @@ -305,7 +305,9 @@ function social_extends_get_keys($provider){ // Kakao $r['Kakao'] = array( "enabled" => option_array_checked('kakao', $config['cf_social_servicelist']) ? true : false, - "keys" => array("id" => $config['cf_kakao_rest_key'], "secret" => $config['cf_kakao_rest_key']), + "keys" => array("id" => $config['cf_kakao_rest_key'], + "secret" => $config['cf_kakao_client_secret'] ? $config['cf_kakao_client_secret'] : $config['cf_kakao_rest_key'] + ), "redirect_uri" => get_social_callbackurl('kakao') );