Alter topic watch entries when splitting topic
git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@3233 89ea8834-ac86-4346-8a33-228a782c2dd0
|
@ -34,7 +34,7 @@ $dir = opendir($dirname);
|
|||
|
||||
while ( $file = readdir($dir) )
|
||||
{
|
||||
if ( ereg('^lang_', $file) && !is_file(realpath($dirname . '/' . $file)) && !is_link(realpath($dirname . '/' . $file)) )
|
||||
if ( ereg('^lang_', $file) && !is_file(phpbb_realpath($dirname . '/' . $file)) && !is_link(phpbb_realpath($dirname . '/' . $file)) )
|
||||
{
|
||||
include($dirname . '/' . $file . '/lang_main.php');
|
||||
|
||||
|
@ -42,7 +42,7 @@ while ( $file = readdir($dir) )
|
|||
|
||||
while ( $email = readdir($lang_dir) )
|
||||
{
|
||||
if ( ereg('\.tpl$', $email) && is_file(realpath($dirname . '/' . $file . '/email/' . $email)) )
|
||||
if ( ereg('\.tpl$', $email) && is_file(phpbb_realpath($dirname . '/' . $file . '/email/' . $email)) )
|
||||
{
|
||||
$fp = fopen($dirname . '/' . $file . '/email/' . $email, 'r+');
|
||||
|
||||
|
|
|
@ -170,6 +170,7 @@ p,ul,td {font-size:10pt;}
|
|||
<li>Added GMT + 13 to English lang_main, all translators are encouraged to do likewise</li>
|
||||
<li>Added switch to default_lang email template if user lang template no longer exists</li>
|
||||
<li>Fixed javascript error when selecting smiley containing a single quote</li>
|
||||
<li>Update users watched topic if a post they made is split into a new topic</li>
|
||||
</ul>
|
||||
|
||||
<a name="202"></a><h3 class="h3">1.ii. Changes since 2.0.2</h3>
|
||||
|
|
|
@ -667,18 +667,47 @@ switch( $mode )
|
|||
{
|
||||
$posts = $HTTP_POST_VARS['post_id_list'];
|
||||
|
||||
$sql = "SELECT poster_id, topic_id, post_time
|
||||
if( !empty($HTTP_POST_VARS['split_type_all']) )
|
||||
{
|
||||
$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 = " . intval($posts[0]);
|
||||
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";
|
||||
}
|
||||
|
||||
if (!($result = $db->sql_query($sql)))
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not get post information', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
||||
$post_rowset = $db->sql_fetchrow($result);
|
||||
$first_poster = $post_rowset['poster_id'];
|
||||
$topic_id = $post_rowset['topic_id'];
|
||||
$post_time = $post_rowset['post_time'];
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$first_poster = $row['poster_id'];
|
||||
$topic_id = $row['topic_id'];
|
||||
$post_time = $row['post_time'];
|
||||
|
||||
$user_id_sql = '';
|
||||
$post_id_sql = '';
|
||||
do
|
||||
{
|
||||
$user_id_sql .= (($user_id_sql != '') ? ', ' : '') . intval($row['poster_id']);
|
||||
$post_id_sql .= (($post_id_sql != '') ? ', ' : '') . intval($row['post_id']);;
|
||||
}
|
||||
while ($row = $db->sql_fetchrow($result));
|
||||
|
||||
$post_subject = trim(htmlspecialchars($HTTP_POST_VARS['subject']));
|
||||
if (empty($post_subject))
|
||||
|
@ -691,33 +720,27 @@ switch( $mode )
|
|||
|
||||
$sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type)
|
||||
VALUES ('" . str_replace("\'", "''", $post_subject) . "', $first_poster, " . $topic_time . ", $new_forum_id, " . TOPIC_UNLOCKED . ", " . POST_NORMAL . ")";
|
||||
if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
|
||||
if (!($db->sql_query($sql, BEGIN_TRANSACTION)))
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not insert new topic', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
||||
$new_topic_id = $db->sql_nextid();
|
||||
|
||||
if( !empty($HTTP_POST_VARS['split_type_all']) )
|
||||
// Update topic watch table, switch users whose posts
|
||||
// have moved, over to watching the new topic
|
||||
$sql = "UPDATE " . TOPICS_WATCH_TABLE . "
|
||||
SET topic_id = $new_topic_id
|
||||
WHERE topic_id = $topic_id
|
||||
AND user_id IN($user_id_sql)";
|
||||
if (!$db->sql_query($sql))
|
||||
{
|
||||
$post_id_sql = '';
|
||||
for($i = 0; $i < count($posts); $i++)
|
||||
{
|
||||
$post_id_sql .= ( ( $post_id_sql != '' ) ? ', ' : '' ) . intval($posts[$i]);
|
||||
message_die(GENERAL_ERROR, 'Could not update topics watch table', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
||||
$sql = "UPDATE " . POSTS_TABLE . "
|
||||
SET topic_id = $new_topic_id, forum_id = $new_forum_id
|
||||
WHERE post_id IN ($post_id_sql)";
|
||||
}
|
||||
else if( !empty($HTTP_POST_VARS['split_type_beyond']) )
|
||||
{
|
||||
$sql = "UPDATE " . POSTS_TABLE . "
|
||||
SET topic_id = $new_topic_id, forum_id = $new_forum_id
|
||||
WHERE post_time >= $post_time
|
||||
AND topic_id = $topic_id";
|
||||
}
|
||||
|
||||
if (!$db->sql_query($sql, END_TRANSACTION))
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not update posts table', '', __LINE__, __FILE__, $sql);
|
||||
|
@ -735,6 +758,7 @@ switch( $mode )
|
|||
$message = $lang['Topic_split'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&sid=" . $userdata['session_id'] . '">', '</a>');
|
||||
message_die(GENERAL_MESSAGE, $message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
|
|
Before Width: | Height: | Size: 773 B After Width: | Height: | Size: 646 B |
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 633 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 998 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 993 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 923 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1,007 B |