SNS 수정중

This commit is contained in:
whitedot
2013-05-29 19:11:03 +09:00
parent 21c2db173a
commit fe087865a7
11 changed files with 126 additions and 80 deletions

View File

@ -35,9 +35,9 @@ var char_max = parseInt(<?php echo $comment_max ?>); // 최대
<?php } ?>
작성일
<span class="bo_vc_hdinfo"><time datetime="<?php echo date('Y-m-d\TH:i:s+09:00', strtotime($list[$i]['datetime'])) ?>"><?php echo $list[$i]['datetime'] ?></time></span>
<?php if (strstr($list[$i]['wr_sns'], "fb")) { ?><img src="<?php echo G4_SNS_URL; ?>/icon/facebook.png" alt="페이스북에도 등록됨"><?php } ?>
<?php if (strstr($list[$i]['wr_sns'], "tw")) { ?><img src="<?php echo G4_SNS_URL; ?>/icon/twitter.png" alt="트위터에도 등록됨"><?php } ?>
<?php if (strstr($list[$i]['wr_sns'], "me")) { ?><img src="<?php echo G4_SNS_URL; ?>/icon/me2day.png" alt="미투데이에도 등록됨"><?php } ?>
<?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 G4_SNS_URL; ?>/icon/facebook.png" alt="페이스북에도 등록됨"></a><?php } ?>
<?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 G4_SNS_URL; ?>/icon/twitter.png" alt="트위터에도 등록됨"></a><?php } ?>
<?php if ($list[$i]['wr_me2day_user']) { ?><a href="http://me2day.net/<?php echo $list[$i]['wr_me2day_user']; ?>" target="_blank"><img src="<?php echo G4_SNS_URL; ?>/icon/me2day.png" alt="미투데이에도 등록됨"></a><?php } ?>
</header>
<!-- 댓글 출력 -->
@ -127,7 +127,7 @@ var char_max = parseInt(<?php echo $comment_max ?>); // 최대
<th scope="row">내용</th>
<td>
<?php if ($comment_min || $comment_max) { ?><strong id="char_cnt"><span id="char_count"></span>글자</strong><?php } ?>
<textarea id="wr_content" name="wr_content" maxlength="10000" required class="required"
<textarea id="wr_content" name="wr_content" maxlength="10000" required class="required" title="내용"
<?php if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?php } ?>><?php echo $c_wr_content; ?></textarea>
<?php if ($comment_min || $comment_max) { ?><script> check_byte('wr_content', 'char_count'); </script><?php } ?>
<script>
@ -146,7 +146,7 @@ var char_max = parseInt(<?php echo $comment_max ?>); // 최대
</table>
<div class="btn_confirm">
<input type="submit" class="btn_submit" value="댓글등록">
<input type="submit" id="btn_submit" class="btn_submit" value="댓글등록">
</div>
</form>

View File

@ -12,20 +12,23 @@ if (!$board['bo_use_sns']) return;
// 페이스북
//----------------------------------------------------------------------------
if ($config['cf_facebook_appid']) {
include_once(G4_SNS_PATH."/facebook/src/facebook.php");
$facebook = new Facebook(array(
'appId' => $config['cf_facebook_appid'],
'secret' => $config['cf_facebook_secret']
));
$facebook_user = get_session("ss_facebook_user");
if (!$facebook_user) {
include_once(G4_SNS_PATH."/facebook/src/facebook.php");
$facebook = new Facebook(array(
'appId' => $config['cf_facebook_appid'],
'secret' => $config['cf_facebook_secret']
));
$facebook_user = $facebook->getUser();
$facebook_user = $facebook->getUser();
if ($facebook_user) {
try {
$facebook_user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$facebook_user = null;
if ($facebook_user) {
try {
$facebook_user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$facebook_user = null;
}
}
}
@ -51,17 +54,33 @@ if (!$board['bo_use_sns']) return;
// 트위터
//----------------------------------------------------------------------------
if ($config['cf_twitter_key']) {
include_once(G4_SNS_PATH."/twitter/twitteroauth/twitteroauth.php");
include_once(G4_SNS_PATH."/twitter/twitterconfig.php");
$twitter_user = get_session("ss_twitter_user");
if (!$twitter_user) {
include_once(G4_SNS_PATH."/twitter/twitteroauth/twitteroauth.php");
include_once(G4_SNS_PATH."/twitter/twitterconfig.php");
$twitter_user = false;
if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) {
$twitter_url = G4_SNS_URL."/twitter/redirect.php";
} else {
$twitter_user = false;
/*
if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) {
$twitter_url = G4_SNS_URL."/twitter/redirect.php";
} else {
$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 = G4_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');
//print_r2($content);
switch ($connection->http_code) {
case 200:
@ -93,6 +112,7 @@ if (!$board['bo_use_sns']) return;
// 미투데이
//----------------------------------------------------------------------------
if ($config['cf_me2day_key']) {
/*
$me2day_user = false;
if (empty($_SESSION['me2day']['user_id']) || empty($_SESSION['me2day']['user_key'])) {
$result = json_decode(file_get_contents("http://me2day.net/api/get_auth_url.json?akey=".$config['cf_me2day_key']));
@ -100,6 +120,13 @@ if (!$board['bo_use_sns']) return;
} else {
$me2day_user = true;
}
*/
$me2day_user = get_session("ss_me2day_user");
if (!$me2day_user) {
$result = json_decode(file_get_contents("http://me2day.net/api/get_auth_url.json?akey=".$config['cf_me2day_key']));
$me2day_url = $result->url;
}
echo '<li>';
if ($me2day_user) {