|
source\class\class_core.php
找到下面加入
- 'fbcon' => '',
- 'fbsup' => '',
- 'fblgl' => '',
複製代碼 找- $this->var['group'] = array_merge($this->var['group'], $this->var['cache']['admingroup_'.$this->var['member']['adminid']]);
- }
複製代碼 下面加上
- loadcache('plugin');
- $_G['fbcon'] = $this->var['cache']['plugin']['facebook_connect'];
- $_G['fbsup'] = 'ctY2YubmV0IiB0YXJnZXQ9Il9ibGFuayI+JiMyMTgzOTsmIzM4OTg4OyYjMjIyMzg7JiMyMjU3NzsmIzI1MTEwOyYjMjU1NTI7JiMyMDM3OTsmIzI0MzE0OyYjMzU2OTY7PC9hPg==';
- }
- function _request_uri() {
- if (isset($_SERVER['REQUEST_URI'])) {
- $uri = $_SERVER['REQUEST_URI'];
- } else {
- if (isset($_SERVER['argv'])) {
- $uri = htmlentities($_SERVER['PHP_SELF']) .'?'. $_SERVER['argv'][0];
- } else {
- $uri = htmlentities($_SERVER['PHP_SELF']) .'?'. $_SERVER['QUERY_STRING'];
- }
- }
- return $uri;
複製代碼 找- define('TEMPLATEID', $this->var['style']['templateid']);
複製代碼 下面加上- if(!$_G['fbcon']['appid'] || !$_G['fbcon']['secret']) {
- $_G['fblgl'] = "javascript:alert('請先到後台設定Facebook Connect插件,輸入正確的FB應用程式ID與密鑰。');";
- } else {
- require_once './fblib/facebook.php';
- $facebook = new Facebook(array('appId'=>$_G['fbcon']['appid'], 'secret'=>$_G['fbcon']['secret']));
- $_G['fblgl'] = $facebook->getLoginUrl(array('scope'=>'email,user_likes,publish_stream,offline_access', 'redirect_uri'=>$_G[siteurl].'fblogin.php?act=login&rf='.urlencode('http://'.$_SERVER['HTTP_HOST'].$this->_request_uri())));
- }
複製代碼 source\function\function_delete.php
找到- manyoulog('user', $uids, 'delete');
- return $numdeleted;
複製代碼 上面加上- DB::query("DELETE FROM ".DB::table('facebook_connect')." WHERE uid IN ($uids)", 'UNBUFFERED');
複製代碼 source\function\function_space.php
找到換成- global $_G, $space, $sfb, $isfriend;
複製代碼 找- $html .= "<li class='ul_pm'><a href=\"home.php?mod=spacecp&ac=pm&op=showmsg&handlekey=showmsg_$space[uid]&touid=$space[uid]&pmid=0&daterange=2\" id=\"a_sendpm_$space[uid]\" onclick=\"showWindow('showMsgBox', this.href, 'get', 0)\">".lang('space', 'block_profile_sendmessage')."</a></li>";
複製代碼 下面加上- if(($sfb['fbid'] && $_G['adminid'] > 0) || ($sfb['fbid'] && $sfb['showfblink'] == 0) || ($sfb['fbid'] && $sfb['showfblink'] == 1 && $isfriend)) {
- $html .= "<li><a href=\"http://www.facebook.com/profile.php?id=$sfb[fbid]\" target=\"_blank\" style=\"background-image:url(static/image/facebook_icon.png);\">".lang('space', 'facebook_profile')."</a></li>";
- $html .= "<li><a href=\"http://www.facebook.com/addfriend.php?id=$sfb[fbid]\" target=\"_blank\" style=\"background-image:url(static/image/facebook_icon.png);\">".lang('space', 'add_facebook_friend')."</a></li>";
- }
複製代碼 source\language\lang_space.php
找到- 'feed_view_only' => '只看此類動態',
複製代碼 下面加上- 'facebook_profile' => '看FB檔案',
- 'add_facebook_friend' => '加FB好友',
複製代碼 source\language\lang_template.php
找到上面加上- 'flogin_title' => '使用Facebook帳戶登入',
複製代碼 source\language\forum\lang_template.php
找到上面加上- 'facebook_profile' => '查看FB檔案',
- 'add_facebook_friend' => '加入FB好友',
- 'facebook_send' => '傳送',
- 'flogin_title' => '使用Facebook帳戶登入',
複製代碼 source\language\home\lang_template.php
找到下面加上- 'facebook_profile' => '看FB檔案',
- 'add_facebook_friend' => '加FB好友',
複製代碼 source\module\forum\forum_viewthread.php
找到- mf.medals, mf.sightml AS signature, mf.customstatus, mh.privacy $fieldsadd
複製代碼 換成- mf.medals, mf.sightml AS signature, mf.customstatus, mh.privacy, fc.fbid, fc.showfblink $fieldsadd
複製代碼 找到- LEFT JOIN ".DB::table('common_member_field_home')." mh USING(uid)
複製代碼 下面加上- LEFT JOIN ".DB::table('facebook_connect')." fc USING(uid)
複製代碼 找到- }
- }
- if($savepostposition && $positionlist) {
複製代碼 上面加上- $ofbcfarr = explode(',', $_G['fbcon']['ofbcfid']);
- if($_G['fbcon']['ofbc'] && !in_array($_G['fid'], $ofbcfarr)) {
- $_G['hfbcm'] = true;
複製代碼 找到- if(empty($postlist)) {
- showmessage('post_not_found');
- } else {
- foreach($postlist as $pid => $post) {
- $postlist[$pid]['message'] = preg_replace("/\[attach\]\d+\[\/attach\]/i", '', $postlist[$pid]['message']);
- }
- }
複製代碼 換成- if(empty($postlist)) {
- showmessage('post_not_found');
- } else {
- foreach($postlist as $pid => $post) {
- $postlist[$pid]['message'] = preg_replace("/\[attach\]\d+\[\/attach\]/i", '', $postlist[$pid]['message']);
- if($postlist[$pid]['first'] == 1) {
- $getmsgi = $postlist[$pid]['message'];
- }
- }
- preg_match_all('/<img.+file=[\'"]([^\'"]+)[\'"].*>/isU', $getmsgi, $iattrsA);
- preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/isU', $getmsgi, $iattrsB);
- if(strpos($iattrsB[1][0], 'fbshare.png') !== FALSE) {
- $iattrs = $_G['fbcon']['dfimg'];
- } elseif($iattrsA[1][0]) {
- if(strpos($iattrsA[1][0], "http://") !== FALSE || strpos($iattrsA[1][0], "https://") !== FALSE) {
- $iattrs = $iattrsA[1][0];
- } else {
- $iattrs = $_G['siteurl'].$iattrsA[1][0];
- }
- } elseif($iattrsB[1][0]) {
- if(strpos($iattrsB[1][0], "http://") !== FALSE || strpos($iattrsB[1][0], "https://") !== FALSE) {
- $iattrs = $iattrsB[1][0];
- } else {
- $iattrs = $_G['siteurl'].$iattrsB[1][0];
- }
- } else {
- $iattrs = $_G['fbcon']['dfimg'];
- }
- }
複製代碼 source\module\home\home_space.php
找到- if(empty($space)) {
- showmessage('space_does_not_exist');
- }
複製代碼 下面加上- $sfb = DB::fetch_first("SELECT fbid,showfblink FROM ".DB::table('facebook_connect')." WHERE uid='$uid' LIMIT 1");
- require_once libfile('function/friend');
- $isfriend = friend_check($uid);
複製代碼 找到下面加上- $sfb = DB::fetch_first("SELECT fbid,showfblink FROM ".DB::table('facebook_connect')." WHERE uid='$uid' LIMIT 1");
- require_once libfile('function/friend');
- $isfriend = friend_check($uid);
複製代碼 templates/default/headers_common.htm
找- <html xmlns="http://www.w3.org/1999/xhtml">
複製代碼 替換成- <html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="https://www.facebook.com/2008/fbml" xmlns:discuz="http://www.discuz.net/ns#">
複製代碼 找到- <meta http-equiv="MSThemeCompatible" content="Yes" />
複製代碼 下面加上- <!--{if $_G['tid']}-->
- <meta property="og:type" content="discuz:thread"/>
- <meta property="og:site_name" content="$_G[setting][bbname]"/>
- <!--{if in_array('forum_viewthread', $_G['setting']['rewritestatus'])}-->
- <meta property="og:url" content="$_G[siteurl]thread-{$_G[tid]}-1-1.html"/>
- <!--{else}-->
- <meta property="og:url" content="$_G[siteurl]forum.php?mod=viewthread&tid=$_G[tid]"/>
- <!--{/if}-->
- <meta property="og:title" content="$_G[forum_thread][subject] - $_G[setting][bbname]"/>
- <meta property="og:description" content="{if !empty($metadescription)}{echo htmlspecialchars($metadescription, ENT_QUOTES)}{/if}"/>
- <!--{if $iattrs}-->
- <meta property="og:image" content="$iattrs"/>
- <!--{/if}-->
複製代碼 ./template/default/common/ 下的文件
footer.htm
找上面加上[code]<div id="fb-root"></div>
<script type="text/javascript">
<!--{if in_array('forum_viewthread', $_G['setting']['rewritestatus'])}-->
var sc=0,scc=0,surl='{$_G[siteurl]}thread-{$_G[tid]}-1-1.html',uqstr='https://api.facebook.com/method/fql.query?format=json&callback=?&query='+encodeURIComponent('SELECT url,share_count FROM link_stat WHERE url="'+surl+'"');
<!--{else}-->
var sc=0,scc=0,surl='{$_G[siteurl]}forum.php?mod=viewthread&tid={$_G[tid]}',uqstr='https://api.facebook.com/method/fql.query?format=json&callback=?&query='+encodeURIComponent('SELECT url,share_count FROM link_stat WHERE url="'+surl+'"');
<!--{/if}-->
window.fbAsyncInit = function() {
FB.init({appId:'$_G[fbcon][appid]', status:true, cookie:true, xfbml:true, channelUrl:'{$_G[siteurl]}channel.html'});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/zh_CN/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
<!--{if $_G['tid']}-->
var f = document.createElement('script');
f.src = 'prikey.php?i='+HASH+'&j={$_G[hlike]}&k={$_G |
|