第 1 頁 (共 2 頁)
[問題] phpBB狀態簽名檔中文版使用問題
發表於 : 2005-08-09 01:32
由 佐藤雅史
問題外掛:phpBB狀態簽名檔中文版
參考連結:
phpBB狀態簽名檔中文版+iconv安裝教學+修改
狀況描述:
這個是我見過的同類型外掛中容量佔最少的一個,
可是他是要連到php檔案不是輸出圖片,所以使用上碰上了麻煩。
使用來貼圖時除了副檔名為:jpg, jpeg, gif和png外,其他都會失效。
因此要使用這個外就得修改 includes/bbcode.php 中的這一段:
代碼: 選擇全部
// [img]image_url_here[/img] code..
$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"
\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\\1' . str_replace(' ', '%20', '\\\3') . '[/img:$uid]'", $text);
在png後加上以下數個字元就能正常使用了 :
|php
但這樣論壇的安全性就會大大降低,
所以想在這裡請教各位要怎樣才能令階級是ADMIN能夠在中使用 .php ?
我的想法是這樣,把上面那段語法修改成這樣:
代碼: 選擇全部
// [img]image_url_here[/img] code..
if ( 階級 == ADMIN )
{
$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"
\t<]*?(\.(jpg|jpeg|gif|png|php)))\[/img\]#sie", "'[img:$uid]\\\1' . str_replace(' ', '%20', '\\\3') . '[/img:$uid]'", $text);
}
else
{
$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"
\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\\1' . str_replace(' ', '%20', '\\\3') . '[/img:$uid]'", $text);
}
可是我還沒學會SQL語法方面,不知道應該如何修改……Orz
發表於 : 2005-08-09 02:31
由 hpo14
試試看把你的code 改成這樣\r
// [img]image_url_here[/img] code..
if ( user_level >=1 )
{
$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"
\t<]*?(\.(jpg|jpeg|gif|png|php)))\[/img\]#sie", "'[img:$uid]\\\1' . str_replace(' ', '%20', '\\\3') . '[/img:$uid]'", $text);
}
else
{
$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"
\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\\1' . str_replace(' ', '%20', '\\\3') . '[/img:$uid]'", $text);
}
user_level
0 : 一般會員(包括 訪客 )
1 : 最高的管理員(架設起此phpbb的人)
2 : 區塊版主
發表於 : 2005-08-09 02:52
由 佐藤雅史
hpo14 寫:試試看把你的code 改成這樣\r
恕刪\r
user_level
0 : 一般會員(包括 訪客 )
1 : 最高的管理員(架設起此phpbb的人)
2 : 區塊版主
^^"抱歉了,單是這樣修改仍是不行。
現在卡了如何在從資庫中讀取user_level,看見那些長長的SQL語法已經令我頭暈。= ="
發表於 : 2005-08-10 10:40
由 *tytsim*
試用\r
代碼: 選擇全部
// [img]image_url_here[/img] code..
if ( $userdata['user_level'] == ADMIN )
{
$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"
\t<]*?(\.(jpg|jpeg|gif|png|php|cgi)))\[/img\]#sie", "'[img:$uid]\\\1' . str_replace(' ', '%20', '\\\3') . '[/img:$uid]'", $text);
}
else
{
$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"
\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\\1' . str_replace(' ', '%20', '\\\3') . '[/img:$uid]'", $text);
}
加了支援cgi
發表於 : 2005-08-10 10:43
由 Kill
加了cgi更不安全(ro06)
發表於 : 2005-08-10 10:47
由 *tytsim*
管理員才用得....
有些cgi可以做到圖片的隨機效果!!
發表於 : 2005-08-10 10:55
由 Kill
原來有加上這段\r
代碼: 選擇全部
if ( $userdata['user_level'] == ADMIN )
剛才沒看到\r
這樣的話就沒什麼問題了
發表於 : 2005-08-10 23:45
由 hpo14
我在自己的論壇上有事過..我照上面的作法還是一樣的說..
發表於 : 2005-08-11 17:12
由 佐藤雅史
hpo14 寫:我在自己的論壇上有事過..我照上面的作法還是一樣的說..
嗯,的確仍然不行。
bbcode.php好像讀不到 $userdata['user_level'] 這個變數,
我試過改為 includes/page_header.php 中的
$row['user_level']也不行
看來要在 bbcode.php中的 bbencode_first_pass() 裡面加上sql語法才行
(還在研究phpBB的資料庫格式和相關函數中= =")
發表於 : 2005-08-11 17:18
由 *tytsim*
sorry!!
忘掉了要叫你在bbcode.php上面加
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
發表於 : 2005-08-11 17:28
由 Kill
直接這麼做是沒辦法讀取到SQL的
我正在寫
寫好了馬上放出來
-----
寫好了..
你試試看吧\r
#
#-----[ OPEN 打開 ]------------------------------------------------
#
代碼: 選擇全部
includes/bbcode.php
#
#-----[ FIND 尋找 ]------------------------------------------------
#
代碼: 選擇全部
// [img]image_url_here[/img] code..
$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"
\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\\1' . str_replace(' ', '%20', '\\\3') . '[/img:$uid]'", $text);
#
#-----[ REPLACE WITH 替換 ]-----------------------------------
#
代碼: 選擇全部
// [img]image_url_here[/img] code..
global $userdata;
if ( $userdata['user_level'] == 1 )
{
$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"
\t<]*?(\.(jpg|jpeg|gif|png|php)))\[/img\]#sie", "'[img:$uid]\\\1' . str_replace(' ', '%20', '\\\3') . '[/img:$uid]'", $text);
}
else
{
$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"
\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\\1' . str_replace(' ', '%20', '\\\3') . '[/img:$uid]'", $text);
}
#
#-----[ SAVE/CLOSE ALL FILES 儲存/關閉所有檔案 ]----------
#
# EoM 外掛修正結束
發表於 : 2005-08-11 23:37
由 佐藤雅史
感謝k122417901大

已經成功顯示了
發表於 : 2005-08-12 02:07
由 hpo14
我在我論壇上改成這樣\r
global $userdata;
if ( $userdata[user_level] >= 1 )
{
$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"
\t<]*?(\.(jpg|jpeg|gif|png|php)?))\[/img\]#sie", "'[img:$uid]\\\1' . str_replace(' ', '%20', '\\\3') . '[/img:$uid]'", $text);
}
else
{
$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"
\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\\1' . str_replace(' ', '%20', '\\\3') . '[/img:$uid]'", $text);
}
卻無法顯示我最上面的那種連結
上面的原網址是\r
http://stat.numist.net/ud/websigs.php/u350.0.dfh.jpg
發表於 : 2005-08-12 02:38
由 ~倉木麻衣~
hpo14 寫:我在我論壇上改成這樣\r
global $userdata;
if ( $userdata[user_level] >= 1 )
{
$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#"
\t<]*?(\.(jpg|jpeg|gif|png|php)?))\[/img\]#sie", "'[img:$uid]\\\1' . str_replace(' ', '%20', '\\\3') . '[/img:$uid]'", $text);
}
?放錯位置了, 或許應該說弄錯群組
(\.(jpg|jpeg|gif|png|php)?)這樣的話\r
就表示至少還得有一個「.」, 而其後的jpg、jpeg、gif、png、php則可有可無\r
改成這樣就可以了, (\.(jpg|jpeg|gif|png|php))?
發表於 : 2005-08-12 02:50
由 hpo14
自爆..= =
但是如果該圖片的短連結 放在簽名檔內還是無效...
不知道處理簽名檔部份BBcode的相關位置在哪..