Fix voting and splitting issues

git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@3245 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-12-22 23:49:56 +00:00
parent e6bb539d92
commit c7d15ef2fb
2 changed files with 13 additions and 23 deletions

View file

@ -663,32 +663,20 @@ switch( $mode )
$page_title = $lang['Mod_CP']; $page_title = $lang['Mod_CP'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
if ( isset($HTTP_POST_VARS['split_type_all']) || isset($HTTP_POST_VARS['split_type_beyond']) ) if (isset($HTTP_POST_VARS['split_type_all']) || isset($HTTP_POST_VARS['split_type_beyond']))
{ {
$posts = $HTTP_POST_VARS['post_id_list']; $posts = $HTTP_POST_VARS['post_id_list'];
if( !empty($HTTP_POST_VARS['split_type_all']) ) $post_id_sql = '';
for ($i = 0; $i < count($posts); $i++)
{ {
$post_id_sql = ''; $post_id_sql .= (($post_id_sql != '') ? ', ' : '') . intval($posts[$i]);
for($i = 0; $i < count($posts); $i++)
{
$post_id_sql .= (($post_id_sql != '') ? ', ' : '') . intval($posts[$i]);
}
$sql = "SELECT post_id, poster_id, topic_id, post_time
FROM " . POSTS_TABLE . "
WHERE post_id IN ($post_id_sql)
ORDER BY post_time ASC";
}
else if( !empty($HTTP_POST_VARS['split_type_beyond']) )
{
$sql = "SELECT post_id, poster_id, topic_id, post_time
FROM " . POSTS_TABLE . "
WHERE post_time >= $post_time
AND topic_id = $topic_id
ORDER BY post_time ASC";
} }
$sql = "SELECT post_id, poster_id, topic_id, post_time
FROM " . POSTS_TABLE . "
WHERE post_id IN ($post_id_sql)
ORDER BY post_time ASC";
if (!($result = $db->sql_query($sql))) if (!($result = $db->sql_query($sql)))
{ {
message_die(GENERAL_ERROR, 'Could not get post information', '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not get post information', '', __LINE__, __FILE__, $sql);
@ -732,15 +720,17 @@ switch( $mode )
$sql = "UPDATE " . TOPICS_WATCH_TABLE . " $sql = "UPDATE " . TOPICS_WATCH_TABLE . "
SET topic_id = $new_topic_id SET topic_id = $new_topic_id
WHERE topic_id = $topic_id WHERE topic_id = $topic_id
AND user_id IN($user_id_sql)"; AND user_id IN ($user_id_sql)";
if (!$db->sql_query($sql)) if (!$db->sql_query($sql))
{ {
message_die(GENERAL_ERROR, 'Could not update topics watch table', '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not update topics watch table', '', __LINE__, __FILE__, $sql);
} }
$sql_where = (!empty($HTTP_POST_VARS['split_type_beyond'])) ? " post_time >= $post_time AND topic_id = $topic_id" : "post_id IN ($post_id_sql)";
$sql = "UPDATE " . POSTS_TABLE . " $sql = "UPDATE " . POSTS_TABLE . "
SET topic_id = $new_topic_id, forum_id = $new_forum_id SET topic_id = $new_topic_id, forum_id = $new_forum_id
WHERE post_id IN ($post_id_sql)"; WHERE $sql_where";
if (!$db->sql_query($sql, END_TRANSACTION)) if (!$db->sql_query($sql, END_TRANSACTION))
{ {
message_die(GENERAL_ERROR, 'Could not update posts table', '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not update posts table', '', __LINE__, __FILE__, $sql);

View file

@ -794,7 +794,7 @@ if ( !empty($forum_topic_data['topic_vote']) )
'POLL_QUESTION' => $vote_title, 'POLL_QUESTION' => $vote_title,
'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_POLL_ACTION' => append_sid("posting.$phpEx?" . POST_TOPIC_URL . "=$topic_id")) 'S_POLL_ACTION' => append_sid("posting.$phpEx?mode=vote&amp;" . POST_TOPIC_URL . "=$topic_id"))
); );
$template->assign_var_from_handle('POLL_DISPLAY', 'pollbox'); $template->assign_var_from_handle('POLL_DISPLAY', 'pollbox');