TShopping

 找回密碼
 註冊
搜索
查看: 11138|回復: 5
打印 上一主題 下一主題

[X2.0] Facebook Connect 教學

    [複製鏈接]
跳轉到指定樓層
1#
發表於 2011-11-23 18:34:48 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
 
Push to Facebook
⊙ 插件名稱:Discuz X2 Facebook Connect
⊙ 主要功能:同時登入FB與DZ、自動以FB帳號註冊DZ新會員(新會員可自訂帳號與密碼)、自動以FB帳戶整合DZ舊會員(DZ使用的E-mail與FB註冊的E-mail相同就會自動綁定)
⊙ 插件版本:2.3
⊙ 插件語言:繁體中文、簡體中文
⊙ 適用版本:Discuz X2 (20110629) - BIG5、GBK、UTF8繁中、UTF8簡中
⊙ 插件開發:derek
⊙ 執行環境:建議使用 PHP 5.X (主機須開啟CURL以及allow_url_fopen支援)
⊙ 鄙視收費插件:抵制收費插件、本插件完全免費,各位就別再花錢了,用買的插件不一定好!
⊙ 安裝前請注意:覆蓋檔案前,應先備份原來的檔案,安裝完畢請至後台更新緩存。( 需被覆蓋的檔案若有自行修改過,請勿直接使用本站提供的檔案覆蓋,應自行比對修改。)


⊙ 最後更新時間:2011/7/27 13:20
⊙ 本次更新說明:修正BIG5版本無法使用問題,若非使BIG5版本者,可不需更新
⊙ 本次升級注意:請參閱壓縮檔內的安裝說明,上傳全部檔案覆蓋後,務必先卸載插件再重新安裝,設定完插件後再更新緩存。

關於在 Facebook 建立應用程式之相關教學於本帖底部。

forum.php
  1. 'heats', 'historyposts', 'onlinerecord', 'userstats', 'diytemplatenameforum'),
複製代碼
替換成
  1. 'heats', 'historyposts', 'onlinerecord', 'userstats', 'diytemplatenameforum', 'plugin'),
複製代碼
  1. 'onlinelist', 'forumstick', 'threadtable_info', 'threadtableids', 'stamps', 'diytemplatenameforum'),
複製代碼
換成
  1. 'onlinelist', 'forumstick', 'threadtable_info', 'threadtableids', 'stamps', 'diytemplatenameforum', 'plugin'),
複製代碼
  1. 'threadtableids', 'threadtable_info', 'posttable_info', 'diytemplatenameforum'),
  2.         'redirect'        => array('threadtableids', 'threadtable_info', 'posttable_info'),
複製代碼
替換成
  1. 'threadtableids', 'threadtable_info', 'posttable_info', 'diytemplatenameforum', 'plugin'),
  2.         'redirect'        => array('threadtableids', 'threadtable_info', 'posttable_info', 'plugin'),
複製代碼
找到
  1.         'domainwhitelist'),
  2.         'space'                => array('fields_required', 'fields_optional', 'custominfo'),
  3.         'group'                => array('grouptype', 'diytemplatenamegroup'),
複製代碼
換成


  1.         'domainwhitelist', 'plugin'),
  2.         'space'                => array('fields_required', 'fields_optional', 'custominfo', 'plugin'),
  3.         'group'                => array('grouptype', 'diytemplatenamegroup', 'plugin'),

複製代碼
group.php

  1. $cachelist = array('grouptype', 'groupindex', 'diytemplatenamegroup');
複製代碼
換成
  1. $cachelist = array('grouptype', 'groupindex', 'diytemplatenamegroup', 'plugin');
複製代碼
home.php

  1. $cachelist = array('magic','userapp','usergroups', 'diytemplatenamehome');
複製代碼
換成


  1. $cachelist = array('magic','userapp','usergroups', 'diytemplatenamehome', 'plugin');
複製代碼
misc.php
  1. 'ranklist' => array('forums', 'diytemplatename'),
複製代碼
換成
  1. 'ranklist' => array('forums', 'diytemplatename', 'plugin'),
複製代碼
portal.php

  1. $cachelist = array('userapp', 'portalcategory', 'diytemplatenameportal');
複製代碼
換成


  1. $cachelist = array('userapp', 'portalcategory', 'diytemplatenameportal', 'plugin');
複製代碼
./source/class 下的文件
class_core.php


  1. $_G['PHP_SELF'] = htmlspecialchars($this->_get_script_url());
複製代碼
換成


  1. $_G['PHP_SELF'] = htmlspecialchars($_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['PHP_SELF']);
複製代碼


  1. $this->var['config']['cookie']['cookiepre'] = $this->var['config']['cookie']['cookiepre'].substr(md5($this->var['config']['cookie']['cookiepath'].'|'.$this->var['config']['cookie']['cookiedomain']), 0, 4).'_';
複製代碼
下面加上


  1. $this->var['authkey'] = md5($_config['security']['authkey'].$_SERVER['HTTP_USER_AGENT']);
複製代碼


  1. } elseif((!defined('ALLOWGUEST') || !ALLOWGUEST) && !in_array(CURSCRIPT, array('member', 'api')) && !$this->var['inajax']) {
複製代碼
換成


  1. } elseif((!defined('ALLOWGUEST') || !ALLOWGUEST) && !in_array(CURSCRIPT, array('member', 'api')) && !$this->var['inajax'] && !$_GET['act']) {
複製代碼
class_member.php


  1. function logging_ctl() {
複製代碼
下面加上


  1. loadcache(array('plugin'));
複製代碼


  1. loadcache(array('modreasons', 'stamptypeid', 'fields_required', 'fields_optional', 'fields_register', 'ipctrl'));
複製代碼
替換成
  1. loadcache(array('modreasons', 'stamptypeid', 'fields_required', 'fields_optional', 'fields_register', 'ipctrl', 'plugin'));
複製代碼
./source/function/ 下的文件
function_delete.php


  1. DB::query("DELETE FROM ".DB::table('common_mailcron').", ".DB::table('common_mailqueue')." USING ".DB::table('common_mailcron').", ".DB::table('common_mailqueue')." WHERE ".DB::table('common_mailcron').".touid IN ($uids) AND ".DB::table('common_mailcron').".cid=".DB::table('common_mailqueue').".cid", 'UNBUFFERED');
複製代碼
下面加上


  1. DB::query("DELETE FROM ".DB::table('facebook_connect')." WHERE uid IN ($uids)", 'UNBUFFERED');
複製代碼
function_space.php


  1. global $_G, $space;
複製代碼
換成
  1. global $_G, $space, $sfb, $isfriend;
複製代碼


  1. $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>";
複製代碼
下面加上
  1. if(($sfb[fbid] && $_G['adminid'] > 0) || ($sfb[fbid] && $sfb[showfblink] == 0) || ($sfb[fbid] && $sfb[showfblink] == 1 && $isfriend)) {
  2.                                         $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>";
  3.                                         $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>";
  4.                                 }
複製代碼
./source/language/ 下面文件
lang_message.php
  1. 'post_hide_nopermission' => '抱歉,您沒有權限使用 [hide] 代碼',
複製代碼
下面加上
  1.   'post_like_nopermission' => '對不起,你沒有權限使用 [like] 代碼,請返回修改。',
  2.   'post_like_dontinreply' => '對不起,回帖不可使用 [like] 代碼,請返回修改。',
  3.   'facebook_not_yet_like' => '您還未點讚,請返回。',
  4.   'facebook_not_yet_comm' => '您還未於本帖的Facebook留言版上留言 (請使用FB帳戶進行留言),請返回。',
複製代碼
lang_space.php
  1.         'facebook_profile' => '看FB檔案',
  2.         'add_facebook_friend' => '加FB好友',
複製代碼
./source/language/forum/ 下的文件
lang_template.php
  1. 'post_hide_reply_hidden' => ',如果您要查看本帖隱藏內容請<a href="forum.php?mod=post&action=reply&fid=$_G[fid]&tid=$_G[tid]" onclick="showWindow(\'reply\', this.href)">回復</a>',
複製代碼
換成
  1. 'post_hide_reply_hidden' => ',如果您要查看本帖隱藏內容請<a href="forum.php?mod=post&action=reply&fid=$_G[fid]&tid=$_G[tid]" onclick="showWindow(\'reply\', this.href)">回覆</a>',
  2.   'post_hide_reply_like_hidden' => ',如果你要查看本帖隱藏內容請 <a href="forum.php?mod=post&action=reply&fid=$_G[fid]&tid=$_G[tid]" onclick="showWindow(\'reply\', this.href)">回覆</a> 或 <b>點讚</b>:',
  3.   'post_hide_like_hidden' => ',如果你要查看本帖隱藏內容請<b>點讚</b>:',
  4.   'first_login' => '請先登入會員:',
  5.   'facebook_profile' => '查看FB檔案',
  6.   'add_facebook_friend' => '加入FB好友',
  7.   'facebook_send' => '傳送',
  8.   'facebook_invite_friend_add' => '邀請朋友加入',
  9.   'facebook_invite_friend_addmsg' => '我在 [ {$_G[setting][bbname]} ] 加入會員了!誠摯邀請您一同加入!',
  10.   'facebook_already_like' => '[ 若您已點過讚,請點此重新檢查 ]',
  11.   'facebook_already_comm' => '[ 已在FB版留言?請點此重新檢查 ]',
  12.   'facebook_already_like_t' => '因為您目前並無登入本論壇,所以必須手動檢查您是否已點過讚。',
  13.   'facebook_already_comm_t' => '因為您目前並無登入本論壇,所以必須手動檢查您是否已在本帖的Facebook留言版上留言 (請使用FB帳戶進行留言)。',
複製代碼
  1. 'facebook_profile' => '看FB檔案',
  2.   'add_facebook_friend' => '加FB好友',
複製代碼
./source/module/forum/ 下的文件
forum_viewthread.php
  1. LEFT JOIN ".DB::table('facebook_connect')." fc USING(uid)
複製代碼
  1. require_once libfile('function/friend');
複製代碼
  1. $postlist[$pid] = viewthread_procpost($post, $_G['member']['lastvisit'], $ordertype);
複製代碼
下面加上
  1. if($postlist[$pid]['first'] == 1) {
  2.                         $getmsgi = $postlist[$pid]['message'];
  3.                 }
  4.         }
  5.         preg_match_all('/<img.+file=[\'"]([^\'"]+)[\'"].*>/i', $getmsgi, $iattrsA);
  6.         preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $getmsgi, $iattrsB);
  7.         if($iattrsA[1][0]) {
  8.                 $iattrs = $_G[siteurl].$iattrsA[1][0];
  9.         } elseif($iattrsB[1][0]) {
  10.                 if(stristr($iattrsB[1][0], "http://")) {
  11.                         $iattrs = $iattrsB[1][0];
  12.                 } else {
  13.                         $iattrs = $_G[siteurl].$iattrsB[1][0];
  14.                 }
  15.         } else {
  16.                 $iattrs = $_G['cache']['plugin']['facebook_connect']['dfimg'];
複製代碼
./source/module/home/ 下的文件
home_space.php
  1. <meta http-equiv="MSThemeCompatible" content="Yes" />
複製代碼
下面加上
  1. <!--{if $_G[tid]}-->
  2.         <meta property="og:type" content="discuz:thread"/>
  3.         <meta property="og:site_name" content="$_G['setting']['bbname']"/>
  4.         <!--{if in_array('forum_viewthread', $_G['setting']['rewritestatus'])}-->
  5.         <meta property="og:url" content="$_G[siteurl]thread-{$_G[tid]}-1-1.html"/>
  6.         <!--{else}-->
  7.         <meta property="og:url" content="$_G[siteurl]forum.php?mod=viewthread&tid=$_G[tid]"/>
  8.         <!--{/if}-->
  9.         <meta property="og:title" content="$_G[forum_thread][subject] - $_G['setting']['bbname']"/>
  10.         <meta property="og:description" content="{if !empty($metadescription)}{echo htmlspecialchars($metadescription)}{/if}"/>
  11.         <!--{if $iattrs}-->
  12.         <meta property="og:image" content="$iattrs"/>
  13.         <!--{/if}-->
  14.         <meta property="fb:app_id" content="$_G['cache']['plugin']['facebook_connect']['appid']"/>
  15.         <!--{/if}-->
複製代碼
./template/default/common/ 下的文件
footer.htm
  1. <!--{eval userappprompt();}-->
  2. <!--{if $_G['basescript'] != 'userapp'}-->
  3. <span id="scrolltop" onclick="window.scrollTo('0','0')">{lang scrolltop}</span>
  4. <script type="text/javascript">_attachEvent(window, 'scroll', function(){showTopLink();});</script>
  5. <!--{/if}-->
複製代碼
下面加上[code]<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
        FB.init({appId:'$_G['cache']['plugin']['facebook_connect']['appid']', status:true, cookie:true, xfbml:true, channelUrl:'{$_G[siteurl]}channel.html'});
<!--{if $_G[tid]}-->
        <!--{if $_G['like'] == 'no'}-->
        FB.Event.subscribe('edge.create', function() {
                location.replace('forum.php?mod=viewthread&tid={$_G[tid]}&page={$_G

 

臉書網友討論

本帖子中包含更多資源

您需要 登錄 才可以下載或查看,沒有帳號?註冊

x
2#
發表於 2012-2-10 00:14:21 | 只看該作者
真的非常感謝!試了好多方法都沒能順利成功...相信不會再有下次了!

版主招募中

3#
發表於 2012-11-23 18:55:39 | 只看該作者
囧!雷人!


4#
發表於 2013-2-1 11:40:36 | 只看該作者
感謝大大不知能不能成功..我試囉好多種方法..都不能登錄...我對原碼又一竅不通只能慢慢學...
謝謝大大辛苦囉...:D


5#
發表於 2014-8-27 10:16:15 | 只看該作者

  很可能是煮的


*滑块验证:
您需要登錄後才可以回帖 登錄 | 註冊 |

本版積分規則



Archiver|手機版|小黑屋|免責聲明|TShopping

GMT+8, 2024-4-26 08:24 , Processed in 0.219550 second(s), 23 queries .

本論壇言論純屬發表者個人意見,與 TShopping綜合論壇 立場無關 如有意見侵犯了您的權益 請寫信聯絡我們。

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表