Fixed bug in posting (forum_topics was incremented on replies, not just new topics)

One click lock/unlock/delete works for modcp.


git-svn-id: file:///svn/phpbb/trunk@609 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
James Atkinson 2001-07-09 22:35:17 +00:00
parent a032864974
commit fe189c90de
3 changed files with 136 additions and 123 deletions

View file

@ -132,6 +132,12 @@ switch($mode)
if($HTTP_POST_VARS['preform_op'])
{
$topics = $HTTP_POST_VARS['preform_op'];
}
else
{
$topics = array($HTTP_GET_VARS[POST_TOPIC_URL]);
}
$sql = "SELECT post_id FROM ".POSTS_TABLE." WHERE ";
$delete_topics = "DELETE FROM ".TOPICS_TABLE." WHERE ";
for($x = 0; $x < count($topics); $x++)
@ -215,12 +221,6 @@ switch($mode)
$msg = $lang['Topics_Removed'] . "<br />" . "<a href=\"".append_sid("modcp.$phpEx?".POST_FORUM_URL."=$forum_id")."\">". $lang['Click'] . " " . $lang['Here'] ."</a> " . $lang['Return_to_modcp'];
message_die(GENERAL_MESSAGE, $msg);
}
else
{
echo "Here";
}
break;
case 'move':
echo 'Move';
@ -230,6 +230,12 @@ switch($mode)
if($HTTP_POST_VARS['preform_op'])
{
$topics = $HTTP_POST_VARS['preform_op'];
}
else
{
$topics = array($HTTP_GET_VARS[POST_TOPIC_URL]);
}
$sql = "UPDATE " . TOPICS_TABLE . " SET topic_status = " . TOPIC_LOCKED . " WHERE ";
for($x = 0; $x < count($topics); $x++)
{
@ -249,13 +255,18 @@ switch($mode)
$msg = $lang['Topics_Locked'] . "<br />" . "<a href=\"".append_sid("modcp.$phpEx?".POST_FORUM_URL."=$forum_id")."\">". $lang['Click'] . " " . $lang['Here'] ."</a> " . $lang['Return_to_modcp'];
message_die(GENERAL_MESSAGE, $msg);
}
}
break;
case 'unlock':
if($HTTP_POST_VARS['preform_op'])
{
$topics = $HTTP_POST_VARS['preform_op'];
}
else
{
$topics = array($HTTP_GET_VARS[POST_TOPIC_URL]);
}
$sql = "UPDATE " . TOPICS_TABLE . " SET topic_status = " . TOPIC_UNLOCKED . " WHERE ";
for($x = 0; $x < count($topics); $x++)
{
@ -275,8 +286,6 @@ switch($mode)
$msg = $lang['Topics_Unlocked'] . "<br />" . "<a href=\"".append_sid("modcp.$phpEx?".POST_FORUM_URL."=$forum_id")."\">". $lang['Click'] . " " . $lang['Here'] ."</a> " . $lang['Return_to_modcp'];
message_die(GENERAL_MESSAGE, $msg);
}
}
break;
default:

View file

@ -329,8 +329,12 @@ if($mode == "newtopic" || $mode == "reply")
if($db->sql_query($sql))
{
$sql = "UPDATE " . FORUMS_TABLE . "
SET forum_last_post_id = $new_post_id, forum_posts = forum_posts + 1, forum_topics = forum_topics + 1
WHERE forum_id = $forum_id";
SET forum_last_post_id = $new_post_id, forum_posts = forum_posts + 1";
if($mode == "newtopic")
{
$sql .= ", forum_topics = forum_topics + 1";
}
$sql .= " WHERE forum_id = $forum_id";
if($db->sql_query($sql))
{

View file

@ -455,7 +455,7 @@ if($is_auth['auth_mod'] || $userdata['user_level'] == ADMIN)
$topic_mod .= "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=move"). "\"><img src=\"images/topic_move.gif\" alt = \"" . $lang['Move_topic'] . "\" border=\"0\"></a>&nbsp;&nbsp;";
if($forum_row[0]['topic_status'] == UNLOCKED)
if($forum_row[0]['topic_status'] == TOPIC_UNLOCKED)
{
$topic_mod .= "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=lock") . "\"><img src=\"images/topic_lock.gif\" alt = \"" . $lang['Lock_topic'] . "\" border=\"0\"></a>&nbsp;&nbsp;";
}