From c7d15ef2fbf311015f1104084c57f1059b77d2a6 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Sun, 22 Dec 2002 23:49:56 +0000 Subject: [PATCH] Fix voting and splitting issues git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@3245 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/modcp.php | 34 ++++++++++++---------------------- phpBB/viewtopic.php | 2 +- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/phpBB/modcp.php b/phpBB/modcp.php index a82928204a..5a52610e4d 100644 --- a/phpBB/modcp.php +++ b/phpBB/modcp.php @@ -663,32 +663,20 @@ switch( $mode ) $page_title = $lang['Mod_CP']; 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']; - if( !empty($HTTP_POST_VARS['split_type_all']) ) + $post_id_sql = ''; + for ($i = 0; $i < count($posts); $i++) { - $post_id_sql = ''; - 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"; + $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"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not get post information', '', __LINE__, __FILE__, $sql); @@ -732,15 +720,17 @@ switch( $mode ) $sql = "UPDATE " . TOPICS_WATCH_TABLE . " SET topic_id = $new_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)) { 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 . " 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)) { message_die(GENERAL_ERROR, 'Could not update posts table', '', __LINE__, __FILE__, $sql); diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index b202f76184..dee35b58af 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -794,7 +794,7 @@ if ( !empty($forum_topic_data['topic_vote']) ) 'POLL_QUESTION' => $vote_title, '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&" . POST_TOPIC_URL . "=$topic_id")) ); $template->assign_var_from_handle('POLL_DISPLAY', 'pollbox');