Merge branch 'sns'

Conflicts:
	skin/board/basic/style.css
	skin/member/basic/style.css
	skin/search/basic/style.css
This commit is contained in:
gnuboard
2013-05-28 15:23:17 +09:00
95 changed files with 10694 additions and 775 deletions

27
bbs/sns_send.php Normal file
View File

@ -0,0 +1,27 @@
<?php
include_once("./_common.php");
$title = str_replace('\"', '"',$_REQUEST['title']);
$short_url = googl_short_url($_REQUEST['longurl']);
$title_url = $title.' : '.$short_url;
switch($_REQUEST['sns']) {
case 'facebook' :
header("Location:http://www.facebook.com/sharer/sharer.php?s=100&p[url]=".$short_url."&p[title]=".$title);
break;
case 'twitter' :
header("Location:http://twitter.com/home?status=".$title_url);
break;
case 'me2day' :
header("Location:http://me2day.net/posts/new?new_post[body]=".$title_url);
break;
case 'yozm' :
header("Location:http://yozm.daum.net/api/popup/prePost?sourceid=41&prefix=".$title_url);
break;
case 'gplus' :
header("Location:https://plus.google.com/share?url=".$short_url);
break;
default :
echo 'Error';
}
?>

View File

@ -143,7 +143,7 @@ if ($w == 'c') // 댓글 입력
wr_is_comment = 1,
wr_comment = '$tmp_comment',
wr_comment_reply = '$tmp_comment_reply',
wr_subject = '$wr_subject',
wr_subject = '',
wr_content = '$wr_content',
mb_id = '$mb_id',
wr_password = '$wr_password',
@ -167,8 +167,13 @@ if ($w == 'c') // 댓글 입력
$comment_id = mysql_insert_id();
// SNS 등록
$wr_sns = array();
include_once("./write_comment_update.sns.php");
$wr_sns = implode(",", $wr_sns);
// 원글에 댓글수 증가 & 마지막 시간 반영
sql_query(" update $write_table set wr_comment = wr_comment + 1, wr_last = '".G4_TIME_YMDHIS."' where wr_id = '$wr_id' ");
sql_query(" update $write_table set wr_comment = wr_comment + 1, wr_sns = '$wr_sns', wr_last = '".G4_TIME_YMDHIS."' where wr_id = '$wr_id' ");
// 새글 INSERT
sql_query(" insert into {$g4['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '$bo_table', '$comment_id', '$wr_id', '".G4_TIME_YMDHIS."', '{$member['mb_id']}' ) ");
@ -179,6 +184,9 @@ if ($w == 'c') // 댓글 입력
// 포인트 부여
insert_point($member['mb_id'], $board['bo_comment_point'], "{$board['bo_subject']} {$wr_id}-{$comment_id} 댓글쓰기", $bo_table, $comment_id, '댓글');
$wr_subject = get_text(stripslashes($wr['wr_subject']));
// 메일발송 사용
if ($config['cf_email_use'] && $board['bo_use_email'])
{
@ -187,7 +195,6 @@ if ($w == 'c') // 댓글 입력
$group_admin = get_admin('group');
$board_admin = get_admin('board');
$wr_subject = get_text(stripslashes($wr['wr_subject']));
$wr_content = nl2br(get_text(stripslashes("원글\n{$wr['wr_subject']}\n\n\n댓글\n$wr_content")));
$warr = array( ''=>'입력', 'u'=>'수정', 'r'=>'답변', 'c'=>'댓글 ', 'cu'=>'댓글 수정' );

View File

@ -0,0 +1,87 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
if (!$board['bo_use_sns']) return;
set_cookie('ck_facebook_checked', false, 86400*31);
set_cookie('ck_twitter_checked' , false, 86400*31);
set_cookie('ck_me2day_checked' , false, 86400*31);
//============================================================================
// 페이스북
//----------------------------------------------------------------------------
if ($_POST['facebook_checked']) {
include_once(G4_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 {
$link = G4_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr['wr_parent'].'&#c_'.$comment_id;
$attachment = array(
'message' => stripslashes($wr_content),
'name' => $wr_subject,
'link' => $link,
'description' => stripslashes(strip_tags($wr['wr_content']))
);
// 등록
$facebook->api('/me/feed/', 'post', $attachment);
//$errors = error_get_last(); print_r2($errros); exit;
set_cookie('ck_facebook_checked', true, 86400*31);
} catch(FacebookApiException $e) {
;;;
}
}
$wr_sns[] = "fb";
}
//============================================================================
//============================================================================
// 트위터
//----------------------------------------------------------------------------
if ($_POST['twitter_checked']) {
include_once(G4_SNS_PATH."/twitter/twitteroauth/twitteroauth.php");
include_once(G4_SNS_PATH."/twitter/config.php");
if ( !(empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) ) {
$post = googl_short_url($comment_url).' '.$wr_content;
$post = utf8_strcut($post, 140);
$access_token = $_SESSION['access_token'];
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
// 등록
$connection->post('statuses/update', array('status' => $post));
set_cookie('ck_twitter_checked', true, 86400*31);
}
$wr_sns[] = "tw";
}
//============================================================================
//============================================================================
// 미투데이
//----------------------------------------------------------------------------
if ($_POST['me2day_checked']) {
if (!empty($_SESSION['me2day']['user_id']) && !empty($_SESSION['me2day']['user_key'])) {
$user_id = $_SESSION['me2day']['user_id'];
$user_key = $_SESSION['me2day']['user_key'];
$auth_key = "12345678" . md5("12345678" . $user_key);
$result = file_get_contents("http://me2day.net/api/create_post/{$user_id}.json?uid={$user_id}&ukey={$auth_key}&akey=".$config['cf_me2day_key']."&post[body]=".urlencode($wr_content));
set_cookie('ck_me2day_checked', true, 86400*31);
}
$wr_sns[] = "me";
}
//============================================================================
?>