Example #1
0
<?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 'gplus':
        header("Location:https://plus.google.com/share?url=" . $short_url);
        break;
    default:
        echo 'Error';
}
            $link = G5_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_facebook_user = get_session("ss_facebook_user");
}
//============================================================================
//============================================================================
// 트위터
//----------------------------------------------------------------------------
$wr_twitter_user = "";
if ($_POST['twitter_checked']) {
    include_once G5_SNS_PATH . "/twitter/twitteroauth/twitteroauth.php";
    include_once G5_SNS_PATH . "/twitter/twitterconfig.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_twitter_user = get_session("ss_twitter_user");
}
//============================================================================
Example #3
0
<?php

if (!defined('_GNUBOARD_')) {
    exit;
}
// 개별 페이지 접근 불가
if (!$board['bo_use_sns']) {
    return;
}
$sns_msg = urlencode(str_replace('\\"', '"', $view['subject']));
$sns_url = googl_short_url('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
$msg_url = $sns_msg . ' : ' . $sns_url;
// 카카오톡 매뉴얼 : https://github.com/kakao/kakaolink-web
$kakao_appid = $_SERVER['HTTP_HOST'];
// Mobile Site Domain 정확히 입력하지 않을 경우 이용이 제한될 수 있습니다.
$kakao_appname = urlencode(str_replace('\\"', '"', $g5['title']));
$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;
$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 .= '&amp;title='.urlencode(utf8_strcut(get_text($view['subject']),140));
$sns_send .= '&amp;title='.$sns_msg;
*/
?>
<ul id="bo_v_sns">
    <li><a href="<?php 
echo $facebook_url;
?>
" target="_blank"><img src="<?php 
echo G5_SNS_URL;