第 1 頁 (共 2 頁)
[問題]當回覆到達上限時自動鎖定主題
發表於 : 2005-12-26 11:35
由 動機不明
問題外掛:當回覆到達上限時自動鎖定主題
參考連結:
http://phpbb-tw.net/phpbb/viewtopic.php?t=41096
使用版本:phpBB 2.0.17
網站位置:(密)
狀況描述:
因為論壇的某些情況下所以我需要這樣的功能 ^^" ,非常感謝 MAC 開發這外掛
現在我就來回報狀況
裝完之後是正常可用的,但是這一段\r
代碼: 選擇全部
#
#-----[ 尋找 ]------------------------------------------
#
$sql = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE
#
#-----[ 在該行內尋找 ]------------------------------------------
#
, topic_vote
#
#-----[ 在該行後, ?#91;上 ]------------------------------------------
#
, enable_auto_lock
#
#-----[ 在該行內尋找 ]------------------------------------------
#
, $topic_vote
#
#-----[ 在該行後, ?#91;上 ]------------------------------------------
#
, $enable_auto_lock
#
#-----[ 在該行內尋找 ]------------------------------------------
#
$topic_vote : "") . "
#
#-----[ 在該行後, ?#91;上 ]------------------------------------------
#
, enable_auto_lock = " . $enable_auto_lock ." " . $topic_status . "
若加上去,會導致文章無法順利編輯\r
Error in posting
DEBUG MODE
SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0 WHERE topic_id = 400' at line 1
UPDATE phpbb_topics SET topic_title = '[求物]尋歌一首', topic_type = 0, topic_status = 0 , enable_auto_lock = 0 0 WHERE topic_id = 400
Line : 265
File : functions_post.php
還有,我是把最後一行的
" . $topic_status . " 它刪掉之後才正常 (但是 cash mod 的顯示功能則消失)
不知道這樣有沒有什麼影響?是我安裝上的問題嗎? 謝謝
補充:
已裝 cash mod
發表於 : 2005-12-26 20:09
由 Mac
我會檢查看看
~Mac
發表於 : 2005-12-26 20:50
由 Mac
發現一個Bug,但是跟動機提出的沒有關係
代碼: 選擇全部
// Lock Topic When Maximum Reply Reached
$topic_status = "";
if (empty($enable_auto_lock))
{
$topic_status = ', topic_status = 0';
}
改為\r
代碼: 選擇全部
// Lock Topic When Maximum Reply Reached
$topic_status = "";
if (!empty($enable_auto_lock))
{
$topic_status = ', topic_status = ' . TOPIC_LOCKED;
}
可以請動機把你的下面哪一整行貼出來看看嗎?我發現在新安裝的討論中並沒有任何問題
代碼: 選擇全部
$sql = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE
這是我的測試討論版顯示的 SQL 指令\r
代碼: 選擇全部
UPDATE phpbb_topics SET topic_title = 'Test Auto Lock', topic_type = 0 , enable_auto_lock = 1 , topic_status = 1 WHERE topic_id = 2
~Mac
發表於 : 2005-12-26 21:58
由 心靈捕手
To 動機不明:
我在測試論壇( 有安裝虛擬貨幣), 安裝此外掛, 並沒有出現您提出的錯誤訊息.
http://wang5555.dnsfor.me/test/phpbb2/viewforum.php?f=1
--
To Mac:
原以為您上頭的修正, 是針對回覆達到上限時, 如果不進入 viewforum.php 的話( 其他會員, 只要從首頁, 點選最後回覆), 仍可以繼續回文的錯誤.
但是經過幾次測試後, 發現問題依舊存在.
後來, 我是在 viewtopic.php 加入( 同 viewforum.php) 以下代碼後, 才算正常.
以下修改, 提供您參考:
#
#-----[ OPEN ]-----
#
viewtopic.php
#
#-----[ FIND ]-----
#
代碼: 選擇全部
//
// End session management
//
#
#-----[ AFTER, ADD ]-----
#
代碼: 選擇全部
//
// Lock Topic When Maximum Reply Reached
// Check and do Auto Lock
//
include($phpbb_root_path . 'includes/functions_auto_lock.'.$phpEx);
topic_auto_lock($forum_id);
//
// End of Auto Lock
//
#
#-----[ SAVE & CLOSE ]-----
#
發表於 : 2005-12-26 22:03
由 Mac
ㄟ,我還以為 viewtopic 我有加上,呵呵,謝謝 心靈捕手 喔
其實在寫這個外掛時,我先把檔案全都改好了,才回去寫外掛安裝指示,結果還是有漏掉的地方
~Mac
發表於 : 2005-12-26 23:34
由 jeffyuan
請問為何我安裝後卻沒什麼東西出現呢?
我的是phpbb 2.0.17
發表於 : 2005-12-27 08:37
由 Mac
到 ACP -> 版面管理 -> 管理選項 看看吧\r
~Mac
發表於 : 2005-12-27 09:39
由 動機不明
感謝兩位大哥的協助
這是我的代碼
代碼: 選擇全部
$sql = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote, enable_auto_lock) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, $topic_status, $topic_type, $topic_vote, $enable_auto_lock)" : "UPDATE " . TOPICS_TABLE . " SET topic_title = '$post_subject', topic_type = $topic_type, topic_status = $topic_status " . (($post_data['edit_vote'] || !empty($poll_title)) ? ", topic_vote = " . $topic_vote : "") . ", enable_auto_lock = " . $enable_auto_lock ."" . $topic_status . " WHERE topic_id = $topic_id";
發表於 : 2005-12-27 09:42
由 Mac
動機不明 寫:感謝兩位大哥的協助
這是我的代碼
代碼: 選擇全部
$sql = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote, enable_auto_lock) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, $topic_status, $topic_type, $topic_vote, $enable_auto_lock)" : "UPDATE " . TOPICS_TABLE . " SET topic_title = '$post_subject', topic_type = $topic_type, topic_status = $topic_status " . (($post_data['edit_vote'] || !empty($poll_title)) ? ", topic_vote = " . $topic_vote : "") . ", enable_auto_lock = " . $enable_auto_lock ."" . $topic_status . " WHERE topic_id = $topic_id";
你把那一行前面加上 "#"
然後下面放上
代碼: 選擇全部
$sql = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote, enable_auto_lock) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote, $enable_auto_lock)" : "UPDATE " . TOPICS_TABLE . " SET topic_title = '$post_subject', topic_type = $topic_type " . (($post_data['edit_vote'] || !empty($poll_title)) ? ", topic_vote = " . $topic_vote : "") . ", enable_auto_lock = " . $enable_auto_lock ." " . $topic_status . " WHERE topic_id = $topic_id";
~Mac
發表於 : 2005-12-27 10:14
由 動機不明
問題一樣
Error in posting
DEBUG MODE
SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0 WHERE topic_id = 375' at line 1
UPDATE phpbb_topics SET topic_title = '[民調]想要我每天在ACG版貼圖嗎?', topic_type = 0 , topic_vote = 1, enable_auto_lock = 0 0 WHERE topic_id = 375
Line : 266
File : functions_post.php
發表於 : 2005-12-27 10:31
由 Mac
奇怪了,怎麼會顯示 0 呢?這個應該有加上吧?
代碼: 選擇全部
#
#-----[ FIND ]------------------------------------------
#
$topic_vote = (!empty($poll_title) && count($poll_options) >= 2) ? 1 : 0;
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Lock Topic When Maximum Reply Reached
$topic_status = "";
if (!empty($enable_auto_lock))
{
$topic_status = ', topic_status = ' . TOPIC_LOCKED;
}
還是,你把 functions_post.php 打包來看看
~Mac
發表於 : 2005-12-27 11:15
由 動機不明
Mac 寫:奇怪了,怎麼會顯示 0 呢?這個應該有加上吧?
還是,你把 functions_post.php 打包來看看
~Mac
有啊~ 我加上了~
這是我的 functions_post.php
http://homepage13.seed.net.tw/web@3/szy ... s_post.rar
發表於 : 2005-12-27 14:25
由 心靈捕手
我猜想:
可能跟您之前安裝的外掛相衝.
以下的修改, 提供您參考:
#
#-----[ FIND ]-----
#
代碼: 選擇全部
function submit_post($mode, &$post
#
#-----[ IN LINE FIND ]-----
#
代碼: 選擇全部
, &$disallow_replies
#
#-----[ DELETE ]-----
#
代碼: 選擇全部
, &$disallow_replies
#
#-----[ FIND ]-----
#
代碼: 選擇全部
$topic_status = ( $disallow_replies ) ? TOPIC_AUTHOR_REPLY : TOPIC_UNLOCKED;
#
#-----[ REPLACE WITH ]-----
#
代碼: 選擇全部
//$topic_status = ( $disallow_replies ) ? TOPIC_AUTHOR_REPLY : TOPIC_UNLOCKED;
發表於 : 2005-12-27 23:03
由 jeffyuan
Mac 寫:到 ACP -> 版面管理 -> 管理選項 看看吧\r
~Mac
謝謝您~我看到了~請問此外掛有那裡須修正呢??
看不太懂
發表於 : 2005-12-27 23:12
由 jeffyuan
請問發文卻出現錯誤~該怎麼辦呢?
Error in posting
DEBUG MODE
SQL Error : 1136 Column count doesn't match value count at row 1
INSERT INTO phpbb_topics (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote, enable_auto_lock) VALUES ('erte', 45, 1135696516, 27, 0, 0, 0)
Line : 289
File : functions_post.php