AL8 Forum
   登錄註冊幫助


標題: [D4.0 & 4.1] [原創]IFRAME嵌入網站(逸風版)_前台有按鈕+後台獨立設定組別使用權限,4/4.1都可用
  本主題被作者加入到個人文集中  
 windheart
 0005178
Rank: 3Rank: 3Rank: 3
點擊查看 windheart 的詳細資料

頭銜: Conqueror

帖子: 254

精華: 2

積分: 4080 點

現金: 364 元

存款: 36402 元

閱讀權限: 20

註冊: 2004-8-8

來自: 鐵心論壇

狀態: 離線
 
發表於 2006-2-7 07:07  資料  個人空間  主頁 短消息  加為好友 
[原創]IFRAME嵌入網站(逸風版)_前台有按鈕+後台獨立設定組別使用權限,4/4.1都可用

前言 : 個人來說, iframe功能在2.5版時本來是與多媒體線上播放連在一起改的, 最近研究4.0版時發現語法有不同, 決定把兩者分開寫, 亦為本來比較簡單的iframe加入後台設定, 用了一個晚上總算完工, 希望大家喜歡.

2006-4-27補充 : 已修正本hack, 現在同時可用在D4.0及D4.1

========================================
插件與版權說明
========================================

插件名稱:IFRAME嵌入網站-前後台(逸風版)
適用版本:Discuz! 4.0 / 4.1
插件作者:逸風
製作日期:7th, Feb, 2006

插件特色:
1、前台-在bbcode代碼插入欄增加插入按鈕,比後台手動加入代碼方式更便利論壇會員。
2、後台-可獨立設定各群組組別的使用權限,iframe功能可視乎實際需要開放給任何一個組別的論壇用戶,比只能限制為版主級別以上專用更具彈性,同時亦避免被一般會員濫用以妨害論壇安全。
3、支援WAP介面的運作
4、本插件依照正規程式開發流程進行編程,涵括後台設定、用戶中介輸入、程式檢測及輸出顯示部分,保持了與Discuz主程式的完善配合,亦為其他開源用戶在進一步修改上提供了穩健的基礎。


修改檔案:1、admin/groups.inc.php
               2、include/discuzcode.func.php
               3、include/bbcode.js
               4、post.php
               5、wap/include/post.inc.php
修改模版:1、templates/default/admincp.lang.php
               2、templates/default/post_bbinsert.htm
               3、templates/default/templates.lang.php
               4、templates/default/messages.lang.php
               5、templates/default/wap.lang.php

升級數據庫:有
安裝難易:易至中
技術支援: http://www.iron-heart.com/forum
效果展示: 2樓有演示圖

========================================
程式修改實作
========================================


1. 升級數據庫(注意如果你的數據庫表名前綴不是用預設的cdb, 請自行更改以下相關部分)

ALTER TABLE `cdb_usergroups` ADD `allowiframecode` tinyint(1) DEFAULT '0' NOT NULL AFTER `allowhidecode` ;


2. 在 templates/default/admincp.lang.php (如果其他風格裡有這檔也要改) 找 :

'usergroups_edit_hide_code_comment' => '設置是否允許帖子中使用 [hide] 隱藏標籤',


下面加入

'usergroups_edit_iframe_code' => '允許使用 [iframe] 代碼:',
    'usergroups_edit_iframe_code_comment' => '設置是否此用戶組允許帖子中使用 [iframe] 嵌入網站標籤。注意: 開放 iframe 功能將產生安全隱患,請慎用。建議只在開放給最核心的管理人員及特殊用戶組別',


3. 在 admin/groups.inc.php 找 :

showsetting('usergroups_edit_hide_code', 'allowhidecodenew', $group['allowhidecode'], 'radio');


下面加入

showsetting('usergroups_edit_iframe_code', 'allowiframecodenew', $group['allowiframecode'], 'radio');


再找

allowhidecode='$allowhidecodenew',


後面跟著加入

allowiframecode='$allowiframecodenew',


4. 在 include/discuzcode.func.php 找 :

if(empty($discuzcodes['searcharray']['imgcode'])) {
                        $discuzcodes['searcharray']['imgcode'] = array(
                                "/\[swf\]\s*([^\[\<\r\n]+?)\s*\[\/swf\]/ies",
                                "/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies",
                                "/\[img=(\d{1,3})[x|\,](\d{1,3})\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies"


因為很多hack都可能改動這段, 所以特別說明一下. 找不到的話切除以上一小段來找就可找到. 找到之後留意看ies"之後有沒有","(逗號), 有或無分開兩種情況, 4.1或4.2, 只做其一就可以.

4.1 - 沒逗號的話先在ies"後面加一個逗號

然後在後面加入
"/\[iframe\]\s*(.+?)\s*\[\/iframe\]/ies"

4.2 - 有逗號的話在後面加入
"/\[iframe\]\s*(.+?)\s*\[\/iframe\]/ies",


改完以上其一後, 再下一點找 :

"bbcodeurl('\\3', '<img width=\"\\1\" height=\"\\2\" src=\"%s\" border=\"0\">')"


同樣, 找到之後留意看')"之後有沒有","(逗號), 有或無分開兩種情況, 4.3或4.4, 只做其一就可以.

4.3 - 沒逗號的話先在')"後面加一個逗號

然後在後面加入
"bbcodeurl('\\1', '<a href=\"%s\" target=\"_blank\">按此開新視窗</a><br><br><iframe src=\"%s\" frameborder=\"0\" allowtransparency=\"true\" scrolling=\"yes\" width=\"97%%\" height=\"480\"></iframe>')"

4.4 - 有逗號的話在後面加入
"bbcodeurl('\\1', '<a href=\"%s\" target=\"_blank\">按此開新視窗</a><br><br><iframe src=\"%s\" frameborder=\"0\" allowtransparency=\"true\" scrolling=\"yes\" width=\"97%%\" height=\"480\"></iframe>')",


5. 在 include/bbcode.js 的最底部加入 :

function bb_iframe() {
               
                if (helpmode) {
                alert(iframe_help);
        } else if (document.selection && document.selection.type == "Text") {
                var range = document.selection.createRange();
                range.text = "[iframe]" + range.text + "[/iframe]";
        } else if (advmode) {
                AddTxt="\r[iframe]\r[/iframe]";
                AddText(AddTxt);
        } else {   
                txt=prompt(iframe_normal,"http://");     
                if (txt!=null) {         
                        AddTxt="\r[iframe]"+txt;
                        AddText(AddTxt);
                        AddText("[/iframe]");
                }              
        }
}


6. 在 templates/default/post_bbinsert.htm (如其他風格裡有此檔也要修改) 找 :

var underline_normal = "{lang post_discuzcode_underline_normal}";


下面加入

var iframe_help = "{lang post_discuzcode_iframe_help}";
        var iframe_normal = "{lang post_discuzcode_iframe_normal}";


再找

<a href="javascript:list()"><img src="{IMGDIR}/bb_list.gif" border="0" alt="{lang post_discuzcode_list}"></a>


下面加入

<a href="javascript:bb_iframe()"><img src="{IMGDIR}/bb_iframe.gif" border="0" alt="插入網頁"></a>


7. 在 templates/default/templates.lang.php (如其他風格裡有此檔也要修改) 找 :

'post_discuzcode_list_normal_input' => '請輸入列表項目內容﹐如果留空表示項目結束。',


PS:若找不到請以 'post_discuzcode_list_normal_input' => 作為查找條件就會找到該句

在該句下面加入

'post_discuzcode_iframe_help' =>  '插入一個網站網址(*請注意您是否有權限可使用iframe功能!)。\n例如﹕\n[url]http://www.windheart.com[/url]\n[url=http://www.windheart.com]這就是逸風[/url]',
        'post_discuzcode_iframe_normal' => '請輸入要插入網頁的網址.*請注意您是否有權限可使用iframe功能!',


*******超過字數限制, 請繼續看2樓*******

[ 本帖最後由 windheart 於 2006-4-29 18:14 編輯 ]



 附件: 您所在的用戶組無法下載或查看附件



Discuz進階之路:沒有捷徑, 看所有文件+裝風格插件+學php語言,想美化再學htm,dreamweaver,photoshop
 AL8 Forum © All rights reserved.
頂部
 windheart
 0005178
Rank: 3Rank: 3Rank: 3
點擊查看 windheart 的詳細資料

頭銜: Conqueror

帖子: 254

精華: 2

積分: 4080 點

現金: 364 元

存款: 36402 元

閱讀權限: 20

註冊: 2004-8-8

來自: 鐵心論壇

狀態: 離線
 
發表於 2006-2-7 07:08  資料  個人空間  主頁 短消息  加為好友 
8. 在 post.php 找 : (For D4.0)

if(empty($bbcodeoff) && !$allowhidecode && preg_match("/\[hide=?\d*\].+?\[\/hide\]/is", preg_replace("/(\[code\].*\[\/code\])/is", '', $message))) {
        showmessage('post_hide_nopermission');
}


如果是D4.1的話就找 :

if(empty($bbcodeoff) && !$allowhidecode && preg_match("/\[hide=?\d*\].+?\[\/hide\]/is", preg_replace("/(\[code\](.+?)\[\/code\])/is", '', $message))) {
        showmessage('post_hide_nopermission');
}


下面加入

if(empty($bbcodeoff) && !$allowiframecode && preg_match("/\[iframe=?\d*\].+?\[\/iframe\]/is", preg_replace("/(\[code\].*\[\/code\])/is", '', $message))) {
        showmessage('post_iframe_nopermission');
}


9. 在 wap/include/post.inc.php 找 :

if(empty($bbcodeoff) && !$allowhidecode && preg_match("/\[hide=?\d*\].+?\[\/hide\]/is", preg_replace("/(\[code\].*\[\/code\])/is", '', $message))) {
        wapmsg('post_hide_nopermission');
}


下面加入

if(empty($bbcodeoff && !$allowiframecode && preg_match("/\[iframe=?\d*\].+?\[\/iframe\]/is", preg_replace("/(\[code\].*\[\/code\])/is", '', $message))) {
        wapmsg('post_iframe_nopermission');
}


10. 在 templates/default/messages.lang.php (如其他風格裡有此檔也要修改) 找 :

'post_hide_nopermission' => '對不起,您沒有權限使用 [hide] 代碼,請返回修改。',


下面加入

'post_iframe_nopermission' => '對不起﹐您沒有權限使用 [iframe] 代碼﹐請返回修改。',


11. 在 templates/default/wap.lang.php (如其他風格裡有此檔也要修改) 找 :

'post_hide_nopermission' => '無權使用[hide]代碼',


下面加入

'post_iframe_nopermission' => '對不起﹐您沒有權限使用 [iframe] 代碼﹐請返回修改。',


12. 把以上修改過的檔存檔上載,再把1樓附檔的圖示上載到images/風格目錄下

13. 後台更新緩存,然後到[用戶組]裡設定每個組別的使用權限(預設是所有群組連管理員都無權用),至此這個插件完成 !


如果你有裝 雪狼 (伊樂園中文論壇) 的"我的許可權"插件, 你可以繼續看下一個部分.

========================================
小點心 修改
========================================


以下修改是讓iframe的使用權限可以顯示在會員權限表中, 進行修改前請先確定你有安裝 雪狼 (伊樂園中文論壇) 的"我的許可權"插件, 此插件cache版修改者為 別問我是誰.
原文在 :
http://www.alan888.com/Discuz/viewthread.php?tid=51392

14. 在 templates/status_index.htm 找 :

[code<td bgcolor="{ALTBG2}">允許使用 [hide] 代碼</td>
<td bgcolor="{ALTBG1}">$allowhidecode_display</td>[/code]

替換

<td bgcolor="{ALTBG2}">允許使用 [hide] 代碼<br>允許使用 [iframe] 代碼</td>
<td bgcolor="{ALTBG1}">$allowhidecode_display<br>$allowiframe_display</td>


15. 在 status.php 找 :

// 允許使用 html 代碼:


上面加入

// 允許使用 [iframe] 代碼:
$allowiframe_display = $allowiframecode  == "1" ? "<font color=green>√</font>" : "<font color=red>×</font>";


********** 所有修改完畢************

演示圖 :



[ 本帖最後由 windheart 於 2006-4-29 18:12 編輯 ]




Discuz進階之路:沒有捷徑, 看所有文件+裝風格插件+學php語言,想美化再學htm,dreamweaver,photoshop
 AL8 Forum © All rights reserved.
頂部
 瓦李李
 0038606
Rank: 3Rank: 3Rank: 3

頭銜: Conqueror

帖子: 135

精華: 0

積分: 1410 點

現金: 134 元

存款: 0 元

閱讀權限: 20

註冊: 2006-1-14

狀態: 離線
 
發表於 2006-2-7 07:09  資料  個人空間  短消息  加為好友 
支持...........




 AL8 Forum © All rights reserved.
頂部
 豪少
 0019554
Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6

頭銜: Forum Legend

帖子: 2347

精華: 0

積分: 10208 點

現金: 98 元

存款: 57920 元

閱讀權限: 70

註冊: 2005-4-20

狀態: 離線
 
發表於 2006-2-7 07:20  資料  個人空間  短消息  加為好友 
先佔個位置, 回家再安裝




 AL8 Forum © All rights reserved.
頂部
 mansiu
 0025668
Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6

頭銜: Forum Legend

帖子: 1783

精華: 0

積分: 3160 點

現金: 10058 元

存款: 1000 元

閱讀權限: 70

註冊: 2005-7-7

狀態: 離線
 
發表於 2006-2-7 07:24  資料  個人空間  短消息  加為好友 
收下待用




 AL8 Forum © All rights reserved.
頂部
 eric1218
 0034083
Rank: 3Rank: 3Rank: 3
點擊查看 eric1218 的詳細資料

頭銜: Conqueror

帖子: 164

精華: 0

積分: 2310 點

現金: 218 元

存款: 2000 元

閱讀權限: 20

註冊: 2005-11-3

狀態: 離線
 
發表於 2006-2-7 09:15  資料  個人空間  短消息  加為好友 
首先多謝大大分享

我已成功安裝,但有一d小問題
如下



http://ericlam.minidns.net/php/r ... 92&goto=newpost

點樣可以整闊d個框

[ 本帖最後由 eric1218 於 2006-2-7 09:25 編輯 ]




 AL8 Forum © All rights reserved.
頂部
 windheart
 0005178
Rank: 3Rank: 3Rank: 3
點擊查看 windheart 的詳細資料

頭銜: Conqueror

帖子: 254

精華: 2

積分: 4080 點

現金: 364 元

存款: 36402 元

閱讀權限: 20

註冊: 2004-8-8

來自: 鐵心論壇

狀態: 離線
 
發表於 2006-2-7 23:23  資料  個人空間  主頁 短消息  加為好友 
QUOTE:
原帖由 eric1218 於 2006-2-7 09:15 發表。&nbsp;
首先多謝大大分享
我已成功安裝,但有一d小問題
如下

http://ericlam.minidns.net/php/r ... 92&goto=newpost
點樣可 ...


是漫畫框的問題, 我剛回家, 已收到你的檔, 等等幫你看看問題怎樣解決.




Discuz進階之路:沒有捷徑, 看所有文件+裝風格插件+學php語言,想美化再學htm,dreamweaver,photoshop
 AL8 Forum © All rights reserved.
頂部
 windheart
 0005178
Rank: 3Rank: 3Rank: 3
點擊查看 windheart 的詳細資料

頭銜: Conqueror

帖子: 254

精華: 2

積分: 4080 點

現金: 364 元

存款: 36402 元

閱讀權限: 20

註冊: 2004-8-8

來自: 鐵心論壇

狀態: 離線
 
發表於 2006-2-8 00:54  資料  個人空間  主頁 短消息  加為好友 
QUOTE:
原帖由 eric1218 於 2006-2-7 09:15 發表。&nbsp;
首先多謝大大分享
我已成功安裝,但有一d小問題
如下
點樣可加闊個框 ...


你在viewthread.htm 裡找 :

<TD style=LINE-HEIGHT: 14pt bgColor=#fffff1>


替換

<TD style=LINE-HEIGHT: 14pt bgColor=#fffff1 width=600>


600就是漫畫對話框的闊度. 你可以自行再調一下. 不過個人覺得600-700是比較合適的設定.




Discuz進階之路:沒有捷徑, 看所有文件+裝風格插件+學php語言,想美化再學htm,dreamweaver,photoshop
 AL8 Forum © All rights reserved.
頂部
 eric1218
 0034083
Rank: 3Rank: 3Rank: 3
點擊查看 eric1218 的詳細資料

頭銜: Conqueror

帖子: 164

精華: 0

積分: 2310 點

現金: 218 元

存款: 2000 元

閱讀權限: 20

註冊: 2005-11-3

狀態: 離線
 
發表於 2006-2-8 01:29  資料  個人空間  短消息  加為好友 
做好了
唔該晒大大
大力支持
好好用




 AL8 Forum © All rights reserved.
頂部
 ff2100
 0039117
Rank: 1

頭銜: Newbie

帖子: 20

精華: 0

積分: 220 點

現金: 88 元

存款: 0 元

閱讀權限: 10

註冊: 2006-1-23

狀態: 離線
 
發表於 2006-2-8 23:38  資料  個人空間  短消息  加為好友 
大大不好意思我改好之後變成這樣是那邊改錯了嗎




 AL8 Forum © All rights reserved.
頂部
 windheart
 0005178
Rank: 3Rank: 3Rank: 3
點擊查看 windheart 的詳細資料

頭銜: Conqueror

帖子: 254

精華: 2

積分: 4080 點

現金: 364 元

存款: 36402 元

閱讀權限: 20

註冊: 2004-8-8

來自: 鐵心論壇

狀態: 離線
 
發表於 2006-2-9 23:09  資料  個人空間  主頁 短消息  加為好友 
QUOTE:
原帖由 ff2100 於 2006-2-8 23:38 發表。&nbsp;
大大不好意思我改好之後變成這樣是那邊改錯了嗎


請問你輸入了甚麼? 就是"iframe"包住的內容是甚麼




Discuz進階之路:沒有捷徑, 看所有文件+裝風格插件+學php語言,想美化再學htm,dreamweaver,photoshop
 AL8 Forum © All rights reserved.
頂部
 無罪
 0023553
Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6

頭銜: Forum Legend

帖子: 1039

精華: 0

積分: 4019 點

現金: 0 元

存款: 110 元

閱讀權限: 70

註冊: 2005-6-12

狀態: 離線
 
發表於 2006-2-9 23:32  資料  個人空間  主頁 短消息  加為好友 
discuz!代碼咪得囉~
ed咁煩既野,最好唔好比咁多會員知........
唔係就好麻煩.......




閒見狶獸走禽物,鮮遇胡種惡野髒。
 AL8 Forum © All rights reserved.
頂部
 gtonizuka
 0032115
Rank: 3Rank: 3Rank: 3
點擊查看 gtonizuka 的詳細資料

頭銜: Conqueror

帖子: 165

精華: 0

積分: 196 點

現金: 0 元

存款: 3237 元

閱讀權限: 20

註冊: 2005-10-5

狀態: 離線
 
發表於 2006-2-10 10:39  資料  個人空間  主頁 短消息  加為好友 
來試試看~~
THX~~




 AL8 Forum © All rights reserved.
頂部
 piyr11
 0029367
Rank: 3Rank: 3Rank: 3
點擊查看 piyr11 的詳細資料

頭銜: Conqueror

帖子: 235

精華: 0

積分: 2770 點

現金: 0 元

存款: 296 元

閱讀權限: 20

註冊: 2005-8-26

狀態: 離線
 
發表於 2006-2-10 18:08  資料  個人空間  短消息  加為好友 
支持.先收下.




 AL8 Forum © All rights reserved.
頂部
 stevesteve
 0012801
Rank: 3Rank: 3Rank: 3
點擊查看 stevesteve 的詳細資料

頭銜: Conqueror

帖子: 115

精華: 0

積分: 1030 點

現金: 0 元

存款: 1448 元

閱讀權限: 20

註冊: 2004-12-8

狀態: 離線
 
發表於 2006-2-11 00:55  資料  個人空間  短消息  加為好友 
完成安裝!!
多謝分享~~~




 AL8 Forum © All rights reserved.
頂部
 123qwe
 0025370
Rank: 3Rank: 3Rank: 3

頭銜: Conqueror

帖子: 238

精華: 0

積分: 4280 點

現金: 88 元

存款: 0 元

閱讀權限: 20

註冊: 2005-7-3

狀態: 離線