sns 글등록 진행중

This commit is contained in:
gnuboard
2013-05-27 18:24:35 +09:00
parent 45f46b5b92
commit f87e0e134f
14 changed files with 172 additions and 9 deletions

28
bbs/sns_send.php Normal file
View File

@ -0,0 +1,28 @@
<?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

@ -1,9 +1,15 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
if ($config['cf_sns_use']) return;
if (!$config['cf_sns_use']) return;
set_cookie('ck_facebook_checked', false);
set_cookie('ck_twitter_checked' , false);
set_cookie('ck_me2day_checked' , false);
//============================================================================
// 페이스북
//----------------------------------------------------------------------------
if ($_POST['facebook_checked']) {
include_once(G4_SNS_PATH."/facebook/src/facebook.php");
@ -26,13 +32,19 @@ if ($_POST['facebook_checked']) {
// 등록
$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) {
;;;
}
}
}
//============================================================================
//============================================================================
// 트위터
//----------------------------------------------------------------------------
if ($_POST['twitter_checked']) {
include_once(G4_SNS_PATH."/twitter/twitteroauth/twitteroauth.php");
include_once(G4_SNS_PATH."/twitter/config.php");
@ -45,6 +57,25 @@ if ($_POST['twitter_checked']) {
$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);
}
}
//============================================================================
//============================================================================
// 미투데이
//----------------------------------------------------------------------------
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);
}
}
//============================================================================
?>