diff --git a/phpBB/develop/encoding_emails.php b/phpBB/develop/encoding_emails.php
index b55d7b7ac0..aa1d749dab 100644
--- a/phpBB/develop/encoding_emails.php
+++ b/phpBB/develop/encoding_emails.php
@@ -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+');
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 687cea10f4..95fab1e380 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -170,6 +170,7 @@ p,ul,td {font-size:10pt;}
Added GMT + 13 to English lang_main, all translators are encouraged to do likewise
Added switch to default_lang email template if user lang template no longer exists
Fixed javascript error when selecting smiley containing a single quote
+Update users watched topic if a post they made is split into a new topic
1.ii. Changes since 2.0.2
diff --git a/phpBB/modcp.php b/phpBB/modcp.php
index 39c83bcec4..a82928204a 100644
--- a/phpBB/modcp.php
+++ b/phpBB/modcp.php
@@ -667,73 +667,97 @@ switch( $mode )
{
$posts = $HTTP_POST_VARS['post_id_list'];
- $sql = "SELECT poster_id, topic_id, post_time
- FROM " . POSTS_TABLE . "
- WHERE post_id = " . intval($posts[0]);
- 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'];
-
- $post_subject = trim(htmlspecialchars($HTTP_POST_VARS['subject']));
- if ( empty($post_subject) )
- {
- message_die(GENERAL_MESSAGE, $lang['Empty_subject']);
- }
-
- $new_forum_id = intval($HTTP_POST_VARS['new_forum_id']);
- $topic_time = time();
-
- $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)) )
- {
- 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']) )
{
$post_id_sql = '';
for($i = 0; $i < count($posts); $i++)
{
- $post_id_sql .= ( ( $post_id_sql != '' ) ? ', ' : '' ) . intval($posts[$i]);
+ $post_id_sql .= (($post_id_sql != '') ? ', ' : '') . intval($posts[$i]);
}
- $sql = "UPDATE " . POSTS_TABLE . "
- SET topic_id = $new_topic_id, forum_id = $new_forum_id
- WHERE post_id IN ($post_id_sql)";
+ $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 = "UPDATE " . POSTS_TABLE . "
- SET topic_id = $new_topic_id, forum_id = $new_forum_id
+ $sql = "SELECT post_id, poster_id, topic_id, post_time
+ FROM " . POSTS_TABLE . "
WHERE post_time >= $post_time
- AND topic_id = $topic_id";
+ AND topic_id = $topic_id
+ ORDER BY post_time ASC";
}
- if( !$db->sql_query($sql, END_TRANSACTION) )
+ if (!($result = $db->sql_query($sql)))
{
- message_die(GENERAL_ERROR, 'Could not update posts table', '', __LINE__, __FILE__, $sql);
+ message_die(GENERAL_ERROR, 'Could not get post information', '', __LINE__, __FILE__, $sql);
}
- sync('topic', $new_topic_id);
- sync('topic', $topic_id);
- sync('forum', $new_forum_id);
- sync('forum', $forum_id);
+ if ($row = $db->sql_fetchrow($result))
+ {
+ $first_poster = $row['poster_id'];
+ $topic_id = $row['topic_id'];
+ $post_time = $row['post_time'];
- $template->assign_vars(array(
- 'META' => '')
- );
+ $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));
- $message = $lang['Topic_split'] . '
' . sprintf($lang['Click_return_topic'], '', '');
- message_die(GENERAL_MESSAGE, $message);
+ $post_subject = trim(htmlspecialchars($HTTP_POST_VARS['subject']));
+ if (empty($post_subject))
+ {
+ message_die(GENERAL_MESSAGE, $lang['Empty_subject']);
+ }
+
+ $new_forum_id = intval($HTTP_POST_VARS['new_forum_id']);
+ $topic_time = time();
+
+ $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 (!($db->sql_query($sql, BEGIN_TRANSACTION)))
+ {
+ message_die(GENERAL_ERROR, 'Could not insert new topic', '', __LINE__, __FILE__, $sql);
+ }
+
+ $new_topic_id = $db->sql_nextid();
+
+ // 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))
+ {
+ 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)";
+ if (!$db->sql_query($sql, END_TRANSACTION))
+ {
+ message_die(GENERAL_ERROR, 'Could not update posts table', '', __LINE__, __FILE__, $sql);
+ }
+
+ sync('topic', $new_topic_id);
+ sync('topic', $topic_id);
+ sync('forum', $new_forum_id);
+ sync('forum', $forum_id);
+
+ $template->assign_vars(array(
+ 'META' => '')
+ );
+
+ $message = $lang['Topic_split'] . '
' . sprintf($lang['Click_return_topic'], '', '');
+ message_die(GENERAL_MESSAGE, $message);
+ }
}
else
{
diff --git a/phpBB/templates/subSilver/images/lang_icelandic/icon_edit.gif b/phpBB/templates/subSilver/images/lang_icelandic/icon_edit.gif
index 7c468bea62..0eaddbd33d 100644
Binary files a/phpBB/templates/subSilver/images/lang_icelandic/icon_edit.gif and b/phpBB/templates/subSilver/images/lang_icelandic/icon_edit.gif differ
diff --git a/phpBB/templates/subSilver/images/lang_icelandic/icon_quote.gif b/phpBB/templates/subSilver/images/lang_icelandic/icon_quote.gif
index 81b9fc2c65..29ffdc5c64 100644
Binary files a/phpBB/templates/subSilver/images/lang_icelandic/icon_quote.gif and b/phpBB/templates/subSilver/images/lang_icelandic/icon_quote.gif differ
diff --git a/phpBB/templates/subSilver/images/lang_icelandic/msg_newpost.gif b/phpBB/templates/subSilver/images/lang_icelandic/msg_newpost.gif
index 90048799ed..4c39aa89b7 100644
Binary files a/phpBB/templates/subSilver/images/lang_icelandic/msg_newpost.gif and b/phpBB/templates/subSilver/images/lang_icelandic/msg_newpost.gif differ
diff --git a/phpBB/templates/subSilver/images/lang_icelandic/post.gif b/phpBB/templates/subSilver/images/lang_icelandic/post.gif
index 9ae1c09640..fc824848f0 100644
Binary files a/phpBB/templates/subSilver/images/lang_icelandic/post.gif and b/phpBB/templates/subSilver/images/lang_icelandic/post.gif differ
diff --git a/phpBB/templates/subSilver/images/lang_icelandic/reply-locked.gif b/phpBB/templates/subSilver/images/lang_icelandic/reply-locked.gif
index 7148b0fb43..6097aafcd6 100644
Binary files a/phpBB/templates/subSilver/images/lang_icelandic/reply-locked.gif and b/phpBB/templates/subSilver/images/lang_icelandic/reply-locked.gif differ
diff --git a/phpBB/templates/subSilver/images/lang_icelandic/reply.gif b/phpBB/templates/subSilver/images/lang_icelandic/reply.gif
index 84582c9450..2c0e02a397 100644
Binary files a/phpBB/templates/subSilver/images/lang_icelandic/reply.gif and b/phpBB/templates/subSilver/images/lang_icelandic/reply.gif differ