update plugin/sms

This commit is contained in:
Amberstone 2024-09-19 20:42:36 +09:00
parent 73ef7de539
commit 0d2b9e6b1e
Signed by: amber
GPG key ID: 094B0E55F98D8BF1
22 changed files with 249 additions and 8019 deletions

View file

@ -1,3 +1,2 @@
<?php <?php
include_once('../../common.php'); include_once('../../common.php');
?>

View file

@ -1,3 +0,0 @@
<?php
include_once("../../../common.php");
?>

View file

@ -1,62 +0,0 @@
<?php
include_once("./_common.php");
include_once(G5_SNS_PATH."/facebook/src/facebook.php");
$facebook = new Facebook(array(
'appId' => $config['cf_facebook_appid'],
'secret' => $config['cf_facebook_secret']
));
$user = $facebook->getUser();
if ($user) {
try {
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = NULL;
}
}
$g5['title'] = '페이스북 콜백';
include_once(G5_PATH.'/head.sub.php');
if ($user) {
$sns_name = $user_profile['name'];
$sns_user = $user;
set_cookie('ck_sns_name', $sns_name, 86400);
set_session('ss_facebook_user', $user);
$g5_sns_url = G5_SNS_URL;
echo <<<EOT
<script>
$(function() {
document.write("<strong>페이스북 승인이 되었습니다.</strong>");
var opener = window.opener;
opener.$("#wr_name").val("{$sns_name}");
opener.$("#facebook_icon").attr("src", "{$g5_sns_url}/icon/facebook.png");
opener.$("#facebook_checked").attr("disabled", false);
opener.$("#facebook_checked").attr("checked", true);
window.close();
});
</script>
EOT;
} else {
echo <<<EOT
<script>
$(function() {
alert("페이스북 승인이 되지 않았습니다.");
window.close();
});
</script>
EOT;
}
include_once(G5_PATH.'/tail.sub.php');
?>

View file

@ -1,28 +0,0 @@
Facebook PHP SDK (v.3.0.0)
==========================
The new PHP SDK (v3.0.0) is a major upgrade to the older one (v2.2.x):
- Uses OAuth authentication flows instead of our legacy authentication flow
- Consists of two classes. The first (class BaseFacebook) maintains the core of the upgrade, and the second one (class Facebook) is a small subclass that uses PHP sessions to store the user id and access token.
If youre currently using the PHP SDK (v2.2.x) for authentication, you will recall that the login code looked like this:
$facebook = new Facebook(…);
$session = $facebook->getSession();
if ($session) {
// proceed knowing you have a valid user session
} else {
// proceed knowing you require user login and/or authentication
}
The login code is now:
$facebook = new Facebook(…);
$user = $facebook->getUser();
if ($user) {
// proceed knowing you have a logged in user who's authenticated
} else {
// proceed knowing you require user login and/or authentication
}

View file

@ -1,22 +0,0 @@
{
"name": "facebook/php-sdk",
"description": "Facebook PHP SDK",
"keywords": ["facebook", "sdk"],
"type": "library",
"homepage": "https://github.com/facebook/facebook-php-sdk",
"license": "Apache2",
"authors": [
{
"name": "Facebook",
"homepage": "https://github.com/facebook/facebook-php-sdk/contributors"
}
],
"require": {
"php": ">=5.2.0",
"ext-curl": "*",
"ext-json": "*"
},
"autoload": {
"classmap": ["src"]
}
}

View file

@ -1,85 +0,0 @@
Facebook PHP SDK (v.3.2.2)
The [Facebook Platform](http://developers.facebook.com/) is
a set of APIs that make your app more social.
This repository contains the open source PHP SDK that allows you to
access Facebook Platform from your PHP app. Except as otherwise noted,
the Facebook PHP SDK is licensed under the Apache Licence, Version 2.0
(http://www.apache.org/licenses/LICENSE-2.0.html).
Usage
-----
The [examples][examples] are a good place to start. The minimal you'll need to
have is:
require 'facebook-php-sdk/src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'YOUR_APP_ID',
'secret' => 'YOUR_APP_SECRET',
));
// Get User ID
$user = $facebook->getUser();
To make [API][API] calls:
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
Login or logout url will be needed depending on current user state.
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl();
}
[examples]: http://github.com/facebook/facebook-php-sdk/blob/master/examples/example.php
[API]: http://developers.facebook.com/docs/api
Tests
-----
In order to keep us nimble and allow us to bring you new functionality, without
compromising on stability, we have ensured full test coverage of the SDK.
We are including this in the open source repository to assure you of our
commitment to quality, but also with the hopes that you will contribute back to
help keep it stable. The easiest way to do so is to file bugs and include a
test case.
The tests can be executed by using this command from the base directory:
phpunit --stderr --bootstrap tests/bootstrap.php tests/tests.php
Contributing
===========
For us to accept contributions you will have to first have signed the
[Contributor License Agreement](https://developers.facebook.com/opensource/cla).
When commiting, keep all lines to less than 80 characters, and try to
follow the existing style.
Before creating a pull request, squash your commits into a single commit.
Add the comments where needed, and provide ample explanation in the
commit message.
Report Issues/Bugs
===============
[Bugs](https://developers.facebook.com/bugs)
[Questions](http://facebook.stackoverflow.com)

File diff suppressed because it is too large Load diff

View file

@ -1,160 +0,0 @@
<?php
/**
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
require_once "base_facebook.php";
/**
* Extends the BaseFacebook class with the intent of using
* PHP sessions to store user ids and access tokens.
*/
class Facebook extends BaseFacebook
{
const FBSS_COOKIE_NAME = 'fbss';
// We can set this to a high number because the main session
// expiration will trump this.
const FBSS_COOKIE_EXPIRE = 31556926; // 1 year
// Stores the shared session ID if one is set.
protected $sharedSessionID;
/**
* Identical to the parent constructor, except that
* we start a PHP session to store the user ID and
* access token if during the course of execution
* we discover them.
*
* @param Array $config the application configuration. Additionally
* accepts "sharedSession" as a boolean to turn on a secondary
* cookie for environments with a shared session (that is, your app
* shares the domain with other apps).
* @see BaseFacebook::__construct in facebook.php
*/
public function __construct($config) {
if (!session_id()) {
session_start();
}
parent::__construct($config);
if (!empty($config['sharedSession'])) {
$this->initSharedSession();
}
}
protected static $kSupportedKeys =
array('state', 'code', 'access_token', 'user_id');
protected function initSharedSession() {
$cookie_name = $this->getSharedSessionCookieName();
if (isset($_COOKIE[$cookie_name])) {
$data = $this->parseSignedRequest($_COOKIE[$cookie_name]);
if ($data && !empty($data['domain']) &&
self::isAllowedDomain($this->getHttpHost(), $data['domain'])) {
// good case
$this->sharedSessionID = $data['id'];
return;
}
// ignoring potentially unreachable data
}
// evil/corrupt/missing case
$base_domain = $this->getBaseDomain();
$this->sharedSessionID = md5(uniqid(mt_rand(), true));
$cookie_value = $this->makeSignedRequest(
array(
'domain' => $base_domain,
'id' => $this->sharedSessionID,
)
);
$_COOKIE[$cookie_name] = $cookie_value;
if (!headers_sent()) {
$expire = time() + self::FBSS_COOKIE_EXPIRE;
setcookie($cookie_name, $cookie_value, $expire, '/', '.'.$base_domain);
} else {
// @codeCoverageIgnoreStart
self::errorLog(
'Shared session ID cookie could not be set! You must ensure you '.
'create the Facebook instance before headers have been sent. This '.
'will cause authentication issues after the first request.'
);
// @codeCoverageIgnoreEnd
}
}
/**
* Provides the implementations of the inherited abstract
* methods. The implementation uses PHP sessions to maintain
* a store for authorization codes, user ids, CSRF states, and
* access tokens.
*/
protected function setPersistentData($key, $value) {
if (!in_array($key, self::$kSupportedKeys)) {
self::errorLog('Unsupported key passed to setPersistentData.');
return;
}
$session_var_name = $this->constructSessionVariableName($key);
$_SESSION[$session_var_name] = $value;
}
protected function getPersistentData($key, $default = false) {
if (!in_array($key, self::$kSupportedKeys)) {
self::errorLog('Unsupported key passed to getPersistentData.');
return $default;
}
$session_var_name = $this->constructSessionVariableName($key);
return isset($_SESSION[$session_var_name]) ?
$_SESSION[$session_var_name] : $default;
}
protected function clearPersistentData($key) {
if (!in_array($key, self::$kSupportedKeys)) {
self::errorLog('Unsupported key passed to clearPersistentData.');
return;
}
$session_var_name = $this->constructSessionVariableName($key);
unset($_SESSION[$session_var_name]);
}
protected function clearAllPersistentData() {
foreach (self::$kSupportedKeys as $key) {
$this->clearPersistentData($key);
}
if ($this->sharedSessionID) {
$this->deleteSharedSessionCookie();
}
}
protected function deleteSharedSessionCookie() {
$cookie_name = $this->getSharedSessionCookieName();
unset($_COOKIE[$cookie_name]);
$base_domain = $this->getBaseDomain();
setcookie($cookie_name, '', 1, '/', '.'.$base_domain);
}
protected function getSharedSessionCookieName() {
return self::FBSS_COOKIE_NAME . '_' . $this->getAppId();
}
protected function constructSessionVariableName($key) {
$parts = array('fb', $this->getAppId(), $key);
if ($this->sharedSessionID) {
array_unshift($parts, $this->sharedSessionID);
}
return implode('_', $parts);
}
}

View file

@ -1,5 +0,0 @@
<?php
$base = realpath(dirname(__FILE__) . '/..');
require "$base/src/base_facebook.php";
require "$base/src/facebook.php";

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -1,3 +1,2 @@
<?php <?php
include_once("../../../common.php"); include_once("../../../common.php");
?>

View file

@ -1,88 +1,87 @@
<?php <?php
include_once("./_common.php"); include_once("./_common.php");
/** /**
* @file * @file
* Take the user when they return from Twitter. Get access tokens. * Take the user when they return from Twitter. Get access tokens.
* Verify credentials and redirect to based on response from Twitter. * Verify credentials and redirect to based on response from Twitter.
*/ */
/* Start session and load lib */ /* Start session and load lib */
//session_start(); //session_start();
require_once(G5_SNS_PATH.'/twitter/twitteroauth/twitteroauth.php'); require_once(G5_SNS_PATH.'/twitter/twitteroauth/twitteroauth.php');
require_once(G5_SNS_PATH.'/twitter/twitterconfig.php'); require_once(G5_SNS_PATH.'/twitter/twitterconfig.php');
//print_r2($_SESSION); print_r2($_REQUEST); exit; //print_r2($_SESSION); print_r2($_REQUEST); exit;
/* If the oauth_token is old redirect to the connect page. */ /* If the oauth_token is old redirect to the connect page. */
if (isset($_REQUEST['oauth_token']) && $_SESSION['oauth_token'] !== $_REQUEST['oauth_token']) { if (isset($_REQUEST['oauth_token']) && $_SESSION['oauth_token'] !== $_REQUEST['oauth_token']) {
$_SESSION['oauth_status'] = 'oldtoken'; $_SESSION['oauth_status'] = 'oldtoken';
header('Location: ./clearsessions.php'); header('Location: ./clearsessions.php');
} }
/* Create TwitteroAuth object with app key/secret and token key/secret from default phase */ /* Create TwitteroAuth object with app key/secret and token key/secret from default phase */
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']); $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
/* Request access tokens from twitter */ /* Request access tokens from twitter */
$access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']); $access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']);
/* Save the access tokens. Normally these would be saved in a database for future use. */ /* Save the access tokens. Normally these would be saved in a database for future use. */
$_SESSION['access_token'] = $access_token; $_SESSION['access_token'] = $access_token;
/* Remove no longer needed request tokens */ /* Remove no longer needed request tokens */
unset($_SESSION['oauth_token']); unset($_SESSION['oauth_token']);
unset($_SESSION['oauth_token_secret']); unset($_SESSION['oauth_token_secret']);
/* /*
if (200 == $connection->http_code) { if (200 == $connection->http_code) {
$_SESSION['status'] = 'verified'; $_SESSION['status'] = 'verified';
header('Location: ./index.php'); header('Location: ./index.php');
} else { } else {
header('Location: ./clearsessions.php'); header('Location: ./clearsessions.php');
} }
exit; exit;
*/ */
$g5['title'] = '트위터 콜백'; $g5['title'] = '트위터 콜백';
include_once(G5_PATH.'/head.sub.php'); include_once(G5_PATH.'/head.sub.php');
if (200 == $connection->http_code) { if (200 == $connection->http_code) {
$content = $connection->get('account/verify_credentials'); $content = $connection->get('account/verify_credentials');
$sns_name = $content->name; $sns_name = $content->name;
$sns_user = $content->screen_name; $sns_user = $content->screen_name;
set_cookie('ck_sns_name', $sns_name, 86400); set_cookie('ck_sns_name', $sns_name, 86400);
set_session('ss_twitter_user', $sns_user); set_session('ss_twitter_user', $sns_user);
$g5_sns_url = G5_SNS_URL; $g5_sns_url = G5_SNS_URL;
echo <<<EOT echo <<<EOT
<script> <script>
$(function() { $(function() {
document.write("<strong>트위터에 승인이 되었습니다.</strong>"); document.write("<strong>트위터에 승인이 되었습니다.</strong>");
var opener = window.opener; var opener = window.opener;
opener.$("#wr_name").val("{$sns_name}"); opener.$("#wr_name").val("{$sns_name}");
opener.$("#twitter_icon").attr("src", "{$g5_sns_url}/icon/twitter.png"); opener.$("#twitter_icon").attr("src", "{$g5_sns_url}/icon/twitter.png");
opener.$("#twitter_checked").attr("disabled", false); opener.$("#twitter_checked").attr("disabled", false);
opener.$("#twitter_checked").attr("checked", true); opener.$("#twitter_checked").attr("checked", true);
window.close(); window.close();
}); });
</script> </script>
EOT; EOT;
} else { } else {
echo <<<EOT echo <<<EOT
<script> <script>
$(function() { $(function() {
alert("트위터에 승인이 되지 않았습니다."); alert("트위터에 승인이 되지 않았습니다.");
window.close(); window.close();
}); });
</script> </script>
EOT; EOT;
} }
include_once(G5_PATH.'/tail.sub.php'); include_once(G5_PATH.'/tail.sub.php');
?>

View file

@ -13,8 +13,8 @@ $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
$request_token = $connection->getRequestToken(OAUTH_CALLBACK); $request_token = $connection->getRequestToken(OAUTH_CALLBACK);
/* Save temporary credentials to session. */ /* Save temporary credentials to session. */
$_SESSION['oauth_token'] = $token = $request_token['oauth_token']; $_SESSION['oauth_token'] = $token = @$request_token['oauth_token'];
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret']; $_SESSION['oauth_token_secret'] = @$request_token['oauth_token_secret'];
//print_r2($_SESSION); exit; //print_r2($_SESSION); exit;

View file

@ -77,7 +77,7 @@ class TwitterOAuth {
$parameters['oauth_callback'] = $oauth_callback; $parameters['oauth_callback'] = $oauth_callback;
$request = $this->oAuthRequest($this->requestTokenURL(), 'GET', $parameters); $request = $this->oAuthRequest($this->requestTokenURL(), 'GET', $parameters);
$token = OAuthUtil::parse_parameters($request); $token = OAuthUtil::parse_parameters($request);
$this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']); $this->token = new OAuthConsumer(@$token['oauth_token'], @$token['oauth_token_secret']);
return $token; return $token;
} }

View file

@ -1,41 +1,74 @@
<?php <?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가 if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
if (!$board['bo_use_sns']) return; if (!$board['bo_use_sns']) return;
$sns_msg = urlencode(str_replace('\"', '"', $view['subject'])); $sns_msg = urlencode(str_replace('\"', '"', $view['subject']));
//$sns_url = googl_short_url('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); //$sns_url = googl_short_url('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
//$msg_url = $sns_msg.' : '.$sns_url; //$msg_url = $sns_msg.' : '.$sns_url;
/* /*
$facebook_url = 'http://www.facebook.com/sharer/sharer.php?s=100&p[url]='.$sns_url.'&p[title]='.$sns_msg; $facebook_url = 'http://www.facebook.com/sharer/sharer.php?s=100&p[url]='.$sns_url.'&p[title]='.$sns_msg;
$twitter_url = 'http://twitter.com/home?status='.$msg_url; $twitter_url = 'http://twitter.com/home?status='.$msg_url;
$gplus_url = 'https://plus.google.com/share?url='.$sns_url; $gplus_url = 'https://plus.google.com/share?url='.$sns_url;
*/ */
$sns_send = G5_BBS_URL.'/sns_send.php?longurl='.urlencode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); $sns_send = G5_BBS_URL.'/sns_send.php?longurl='.urlencode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
//$sns_send .= '&amp;title='.urlencode(utf8_strcut(get_text($view['subject']),140)); //$sns_send .= '&amp;title='.urlencode(utf8_strcut(get_text($view['subject']),140));
$sns_send .= '&amp;title='.$sns_msg; $sns_send .= '&amp;title='.$sns_msg;
$facebook_url = $sns_send.'&amp;sns=facebook'; $facebook_url = $sns_send.'&amp;sns=facebook';
$twitter_url = $sns_send.'&amp;sns=twitter'; $twitter_url = $sns_send.'&amp;sns=twitter';
$gplus_url = $sns_send.'&amp;sns=gplus'; $gplus_url = $sns_send.'&amp;sns=gplus';
?> $bo_v_sns_class = $config['cf_kakao_js_apikey'] ? 'show_kakao' : '';
?>
<?php if(G5_IS_MOBILE && $config['cf_kakao_js_apikey']) { ?>
<script src="https://developers.kakao.com/sdk/js/kakao.min.js"></script> <?php if($config['cf_kakao_js_apikey']) { ?>
<script src="<?php echo G5_JS_URL; ?>/kakaolink.js"></script> <script src="//developers.kakao.com/sdk/js/kakao.min.js" async charset="utf-8"></script>
<script> <script src="<?php echo G5_JS_URL; ?>/kakaolink.js?ver=<?php echo G5_JS_VER; ?>" charset="utf-8"></script>
// 사용할 앱의 Javascript 키를 설정해 주세요. <script type='text/javascript'>
Kakao.init("<?php echo $config['cf_kakao_js_apikey']; ?>"); //<![CDATA[
</script> var kakao_javascript_apikey = "<?php echo $config['cf_kakao_js_apikey']; ?>";
<?php } ?>
function Kakao_sendLink() {
<ul id="bo_v_sns">
<li><a href="<?php echo $facebook_url; ?>" target="_blank"><img src="<?php echo G5_SNS_URL; ?>/icon/facebook.png" alt="페이스북으로 보내기"></a></li> if (window.Kakao && (kakao_javascript_apikey !== undefined)) {
<li><a href="<?php echo $twitter_url; ?>" target="_blank"><img src="<?php echo G5_SNS_URL; ?>/icon/twitter.png" alt="트위터로 보내기"></a></li> if (! Kakao.isInitialized()) {
<li><a href="<?php echo $gplus_url; ?>" target="_blank"><img src="<?php echo G5_SNS_URL; ?>/icon/gplus.png" alt="구글플러스로 보내기"></a></li> Kakao.init(kakao_javascript_apikey);
<?php if(G5_IS_MOBILE && $config['cf_kakao_js_apikey']) { ?> }
<li><a href="javascript:kakaolink_send('<?php echo $sns_msg; ?>', '<?php echo urlencode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); ?>');"><img src="<?php echo G5_SNS_URL; ?>/icon/kakaotalk.png" alt="카카오톡으로 보내기"></a></li> }
<?php } ?>
</ul> var webUrl = location.protocol+"<?php echo '//'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>",
imageUrl = $("#bo_v_img").find("img").attr("src") || $(".view_image").find("img").attr("src") || '';
Kakao.Link.sendDefault({
objectType: 'feed',
content: {
title: "<?php echo str_replace(array('%27', '&#034;' , '\"'), '', strip_tags($view['subject'])); ?>",
description: "<?php echo preg_replace('/\r\n|\r|\n/','', strip_tags(get_text(cut_str(strip_tags($view['wr_content']), 200), 1))); ?>",
imageUrl: imageUrl,
link: {
mobileWebUrl: webUrl,
webUrl: webUrl
}
},
buttons: [{
title: '자세히 보기',
link: {
mobileWebUrl: webUrl,
webUrl: webUrl
}
}]
});
}
//]]>
</script>
<?php } ?>
<ul id="bo_v_sns" class="<?php echo $bo_v_sns_class; ?>">
<li><a href="<?php echo $facebook_url; ?>" target="_blank" class="sns_f"><img src="<?php echo G5_SNS_URL; ?>/icon/facebook.png" alt="페이스북으로 공유" width="20"><span>페이스북 공유</span></a></li>
<li><a href="<?php echo $twitter_url; ?>" target="_blank" class="sns_t"><img src="<?php echo G5_SNS_URL; ?>/icon/twitter.png" alt="트위터로 공유" width="20"><span>트위터 공유</span></a></li>
<?php if($config['cf_kakao_js_apikey']) { ?>
<li><a href="javascript:Kakao_sendLink();" class="sns_k" ><img src="<?php echo G5_SNS_URL; ?>/icon/kakaotalk.png" alt="카카오톡으로 보내기" width="20"></a></li>
<?php } ?>
</ul>

View file

@ -1,15 +1,15 @@
<?php <?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가 if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
$mobile_sns_icon = ''; $mobile_sns_icon = '';
if (G5_IS_MOBILE) $sns_mc_icon = ''; if (G5_IS_MOBILE) $sns_mc_icon = '';
else $sns_mc_icon = '_cmt'; else $sns_mc_icon = '_cmt';
if (!$board['bo_use_sns']) return; if (!$board['bo_use_sns']) return;
?> ?>
<?php if ($list[$i]['wr_facebook_user']) { ?> <?php if ($list[$i]['wr_facebook_user']) { ?>
<a href="https://www.facebook.com/profile.php?id=<?php echo $list[$i]['wr_facebook_user']; ?>" target="_blank"><img src="<?php echo G5_SNS_URL; ?>/icon/facebook<?php echo $sns_mc_icon; ?>.png" alt="페이스북에도 등록됨"></a> <a href="https://www.facebook.com/profile.php?id=<?php echo $list[$i]['wr_facebook_user']; ?>" target="_blank"><img src="<?php echo G5_SNS_URL; ?>/icon/facebook<?php echo $sns_mc_icon; ?>.png" alt="페이스북에도 등록됨"></a>
<?php } ?> <?php } ?>
<?php if ($list[$i]['wr_twitter_user']) { ?> <?php if ($list[$i]['wr_twitter_user']) { ?>
<a href="https://www.twitter.com/<?php echo $list[$i]['wr_twitter_user']; ?>" target="_blank"><img src="<?php echo G5_SNS_URL; ?>/icon/twitter<?php echo $sns_mc_icon; ?>.png" alt="트위터에도 등록됨"></a> <a href="https://www.twitter.com/<?php echo $list[$i]['wr_twitter_user']; ?>" target="_blank"><img src="<?php echo G5_SNS_URL; ?>/icon/twitter<?php echo $sns_mc_icon; ?>.png" alt="트위터에도 등록됨"></a>
<?php } ?> <?php }

View file

@ -1,108 +1,68 @@
<?php <?php
include_once('./_common.php'); include_once('./_common.php');
if (!$board['bo_use_sns']) die(''); if (!$board['bo_use_sns']) return;
?> ?>
<ul id="bo_vc_sns"> <ul id="bo_vc_sns">
<?php <?php
//============================================================================ //============================================================================
// 페이스북 // 트위터
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
if ($config['cf_facebook_appid']) { if ($config['cf_twitter_key']) {
$facebook_user = get_session("ss_facebook_user"); $twitter_user = get_session("ss_twitter_user");
if (!$facebook_user) { if (!$twitter_user) {
include_once(G5_SNS_PATH."/facebook/src/facebook.php"); include_once(G5_SNS_PATH."/twitter/twitteroauth/twitteroauth.php");
$facebook = new Facebook(array( include_once(G5_SNS_PATH."/twitter/twitterconfig.php");
'appId' => $config['cf_facebook_appid'],
'secret' => $config['cf_facebook_secret'] $twitter_user = false;
)); /*
if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) {
$facebook_user = $facebook->getUser(); $twitter_url = G5_SNS_URL."/twitter/redirect.php";
} else {
if ($facebook_user) { $access_token = $_SESSION['access_token'];
try { $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
$facebook_user_profile = $facebook->api('/me'); $content = $connection->get('account/verify_credentials');
} catch (FacebookApiException $e) {
error_log($e); switch ($connection->http_code) {
$facebook_user = null; case 200:
} $twitter_user = true;
} $twitter_url = $connection->getAuthorizeURL($token);
} break;
default :
echo '<li>'; $twitter_url = G5_SNS_URL."/twitter/redirect.php";
if ($facebook_user) { }
echo '<img src="'.G5_SNS_URL.'/icon/facebook.png" id="facebook_icon">'; }
echo '<label for="" class="sound_only">페이스북 동시 등록</label>'; */
echo '<input type="checkbox" name="facebook_checked" id="facebook_checked" '.(get_cookie('ck_facebook_checked')?'checked':'').' value="1">'; $access_token = get_session('access_token');
} else { $access_oauth_token = isset($access_token['oauth_token']) ? $access_token['oauth_token'] : '';
$facebook_url = $facebook->getLoginUrl(array("redirect_uri"=>G5_SNS_URL."/facebook/callback.php", "scope"=>"publish_stream,read_stream,offline_access", "display"=>"popup")); $access_oauth_token_secret = isset($access_token['oauth_token_secret']) ? $access_token['oauth_token_secret'] : '';
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_oauth_token, $access_oauth_token_secret);
echo '<a href="'.$facebook_url.'" id="facebook_url" onclick="return false;"><img src="'.G5_SNS_URL.'/icon/facebook'.($facebook_user?'':'_off').'.png" id="facebook_icon"></a>'; $content = $connection->get('account/verify_credentials');
echo '<label for="" class="sound_only">페이스북 동시 등록</label>';
echo '<input type="checkbox" name="facebook_checked" id="facebook_checked" disabled value="1">'; switch ($connection->http_code) {
echo '<script>$(function(){ $(document).on("click", "#facebook_url", function(){ window.open(this.href, "facebook_url", "width=600,height=250"); }); });</script>'; case 200:
} $twitter_user = true;
echo '</li>'; $twitter_url = $connection->getAuthorizeURL($token);
} break;
//============================================================================ default :
$twitter_url = G5_SNS_URL."/twitter/redirect.php";
}
//============================================================================ }
// 트위터
//---------------------------------------------------------------------------- echo '<li class="sns_li_t '.($twitter_user?'':'sns_li_off').'">';
if ($config['cf_twitter_key']) { if ($twitter_user) {
$twitter_user = get_session("ss_twitter_user"); echo '<img src="'.G5_SNS_URL.'/icon/twitter.png" id="twitter_icon">';
if (!$twitter_user) { echo '<label for="" class="sound_only">트위터 동시 등록</label>';
include_once(G5_SNS_PATH."/twitter/twitteroauth/twitteroauth.php"); echo '<input type="checkbox" name="twitter_checked" id="twitter_checked" '.(get_cookie('ck_twitter_checked')?'checked':'').' value="1">';
include_once(G5_SNS_PATH."/twitter/twitterconfig.php"); } else {
echo '<label for="" class="sound_only">트위터 동시 등록</label>';
$twitter_user = false; echo '<input type="checkbox" name="twitter_checked" id="twitter_checked" disabled value="1">';
/* echo '<a href="'.$twitter_url.'" id="twitter_url" onclick="return false;" "><img src="'.G5_SNS_URL.'/icon/twitter.png" id="twitter_icon" width="20"></a>';
if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) { echo '<script>$(function(){ $(document).on("click", "#twitter_url", function(){ window.open(this.href, "twitter_url", "width=600,height=250"); }); });</script>';
$twitter_url = G5_SNS_URL."/twitter/redirect.php"; }
} else { echo '</li>';
$access_token = $_SESSION['access_token']; }
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']); //============================================================================
$content = $connection->get('account/verify_credentials'); ?>
switch ($connection->http_code) {
case 200:
$twitter_user = true;
$twitter_url = $connection->getAuthorizeURL($token);
break;
default :
$twitter_url = G5_SNS_URL."/twitter/redirect.php";
}
}
*/
$access_token = $_SESSION['access_token'];
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
$content = $connection->get('account/verify_credentials');
switch ($connection->http_code) {
case 200:
$twitter_user = true;
$twitter_url = $connection->getAuthorizeURL($token);
break;
default :
$twitter_url = G5_SNS_URL."/twitter/redirect.php";
}
}
echo '<li>';
if ($twitter_user) {
echo '<img src="'.G5_SNS_URL.'/icon/twitter.png" id="twitter_icon">';
echo '<label for="" class="sound_only">트위터 동시 등록</label>';
echo '<input type="checkbox" name="twitter_checked" id="twitter_checked" '.(get_cookie('ck_twitter_checked')?'checked':'').' value="1">';
} else {
echo '<a href="'.$twitter_url.'" id="twitter_url" onclick="return false;"><img src="'.G5_SNS_URL.'/icon/twitter'.($twitter_user?'':'_off').'.png" id="twitter_icon"></a>';
echo '<label for="" class="sound_only">트위터 동시 등록</label>';
echo '<input type="checkbox" name="twitter_checked" id="twitter_checked" disabled value="1">';
echo '<script>$(function(){ $(document).on("click", "#twitter_url", function(){ window.open(this.href, "twitter_url", "width=600,height=250"); }); });</script>';
}
echo '</li>';
}
//============================================================================
?>
</ul> </ul>