mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 23:45:20 +02:00
Split posts works, split beyond this post does not. Still needs interface work as well
git-svn-id: file:///svn/phpbb/trunk@649 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
df799b8a16
commit
8e49899bce
@ -503,4 +503,110 @@ function validate_username($username)
|
|||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function sync($type, $id)
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
switch($type)
|
||||||
|
{
|
||||||
|
case 'forum':
|
||||||
|
$sql = "SELECT max(post_id) AS last_post FROM ".POSTS_TABLE." WHERE forum_id = $id";
|
||||||
|
if(!$result = $db->sql_query($sql))
|
||||||
|
{
|
||||||
|
message_die(GENERAL_ERROR, "Could not get post ID", "Error", __LINE__, __FILE__, $sql);
|
||||||
|
}
|
||||||
|
if($rowset = $db->sql_fetchrowset($result))
|
||||||
|
{
|
||||||
|
$last_post = $rowset[0]['last_post'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT count(post_id) AS total FROM ".POSTS_TABLE." WHERE forum_id = $id";
|
||||||
|
if(!$result = $db->sql_query($sql))
|
||||||
|
{
|
||||||
|
message_die(GENERAL_ERROR, "Could not get post count", "Error", __LINE__, __FILE__, $sql);
|
||||||
|
}
|
||||||
|
if($rowset = $db->sql_fetchrowset($result))
|
||||||
|
{
|
||||||
|
$total_posts = $rowset[0]['total'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT count(topic_id) AS total FROM ".TOPICS_TABLE." WHERE forum_id = $id";
|
||||||
|
if(!$result = $db->sql_query($sql, $db))
|
||||||
|
{
|
||||||
|
message_die(GENERAL_ERROR, "Could not get topic count", "Error", __LINE__, __FILE__, $sql);
|
||||||
|
}
|
||||||
|
if($rowset = $db->sql_fetchrowset($result))
|
||||||
|
{
|
||||||
|
$total_topics = $rowset[0]['total'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "UPDATE ".FORUMS_TABLE." SET forum_last_post_id = '$last_post', forum_posts = $total_posts, forum_topics = $total_topics WHERE forum_id = $id";
|
||||||
|
if(!$result = $db->sql_query($sql))
|
||||||
|
{
|
||||||
|
message_die(GENERAL_ERROR, "Could not update forum $id", "Error", __LINE__, __FILE__, $sql);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'topic':
|
||||||
|
$sql = "SELECT max(post_id) AS last_post FROM ".POSTS_TABLE." WHERE topic_id = $id";
|
||||||
|
if(!$result = $db->sql_query($sql))
|
||||||
|
{
|
||||||
|
message_die(GENERAL_ERROR, "Could not get post ID", "Error", __LINE__, __FILE__, $sql);
|
||||||
|
}
|
||||||
|
if($row = $db->sql_fetchrowset($result))
|
||||||
|
{
|
||||||
|
$last_post = $row[0]["last_post"];
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT count(post_id) AS total FROM ".POSTS_TABLE." WHERE topic_id = $id";
|
||||||
|
if(!$result = $db->sql_query($sql))
|
||||||
|
{
|
||||||
|
message_die(GENERAL_ERROR, "Could not get post count", "Error", __LINE__, __FILE__, $sql);
|
||||||
|
}
|
||||||
|
if($row = $db->sql_fetchrowset($result))
|
||||||
|
{
|
||||||
|
$total_posts = $row[0]["total"];
|
||||||
|
}
|
||||||
|
$total_posts -= 1;
|
||||||
|
$sql = "UPDATE ".TOPICS_TABLE." SET topic_replies = $total_posts, topic_last_post_id = $last_post WHERE topic_id = $id";
|
||||||
|
if(!$result = $db->sql_query($sql))
|
||||||
|
{
|
||||||
|
message_die(GENERAL_ERROR, "Could not update topic $id", "Error", __LINE__, __FILE__, $sql);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'all forums':
|
||||||
|
$sql = "SELECT forum_id FROM ".FORUMS_TABLE;
|
||||||
|
if(!$result = $db->sql_query($sql))
|
||||||
|
{
|
||||||
|
message_die(GENERAL_ERROR, "Could not get forum IDs", "Error", __LINE__, __FILE__, $sql);
|
||||||
|
}
|
||||||
|
$rowset = $db->sql_fetchrowset($result);
|
||||||
|
$count = $db->sql_numrows($result);
|
||||||
|
for($i = 0; $i < $count; $i++)
|
||||||
|
{
|
||||||
|
$id = $row[$i]['forum_id'];
|
||||||
|
sync($db, $id, "forum");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'all topics':
|
||||||
|
$sql = "SELECT topic_id FROM topics";
|
||||||
|
if(!$result = $db->sql_query($sql))
|
||||||
|
{
|
||||||
|
message_die(GENERAL_ERROR, "Could not get topic ID's", "Error", __LINE__, __FILE__, $sql);
|
||||||
|
}
|
||||||
|
$rowset = $db->sql_fetchrowset($result);
|
||||||
|
$count = $db->sql_numrows($result);
|
||||||
|
for($i = 0; $i < $count; $i++)
|
||||||
|
{
|
||||||
|
$id = $row[$i]['topic_id'];
|
||||||
|
sync($db, $id, "topic");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
@ -110,6 +110,8 @@ $lang['AIM'] = "AIM Address";
|
|||||||
$lang['MSNM'] = "MSN Messenger";
|
$lang['MSNM'] = "MSN Messenger";
|
||||||
$lang['YIM'] = "Yahoo Messenger";
|
$lang['YIM'] = "Yahoo Messenger";
|
||||||
|
|
||||||
|
$lang['Error'] = "Error";
|
||||||
|
|
||||||
//
|
//
|
||||||
// Global Header strings
|
// Global Header strings
|
||||||
//
|
//
|
||||||
@ -498,6 +500,8 @@ $lang['Confirm_unlock_topic'] = "Are you sure you want to unlock the selected to
|
|||||||
$lang['Confirm_move_topic'] = "Are you sure you want to move the selected topic(s)?";
|
$lang['Confirm_move_topic'] = "Are you sure you want to move the selected topic(s)?";
|
||||||
$lang['Split_posts'] = "Split Posts";
|
$lang['Split_posts'] = "Split Posts";
|
||||||
$lang['Split_after'] = "Split Posts Beyond Selected";
|
$lang['Split_after'] = "Split Posts Beyond Selected";
|
||||||
|
$lang['Topic_split'] = "The selected topic has been split successfully";
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Old format ... _DON'T_add_any_ new entries here!!
|
// Old format ... _DON'T_add_any_ new entries here!!
|
||||||
|
@ -434,7 +434,7 @@ switch($mode)
|
|||||||
|
|
||||||
$posts = $HTTP_POST_VARS['preform_op'];
|
$posts = $HTTP_POST_VARS['preform_op'];
|
||||||
|
|
||||||
$sql = "SELECT poster_id FROM ".POSTS_TABLE." WHERE post_id = ".$posts[0];
|
$sql = "SELECT poster_id, topic_id FROM ".POSTS_TABLE." WHERE post_id = ".$posts[0];
|
||||||
if(!$result = $db->sql_query($sql, BEGIN_TRANSACTION))
|
if(!$result = $db->sql_query($sql, BEGIN_TRANSACTION))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Could not get post information", "Error", __LINE__, __FILE__, $sql);
|
message_die(GENERAL_ERROR, "Could not get post information", "Error", __LINE__, __FILE__, $sql);
|
||||||
@ -442,6 +442,7 @@ switch($mode)
|
|||||||
|
|
||||||
$post_rowset = $db->sql_fetchrowset($result);
|
$post_rowset = $db->sql_fetchrowset($result);
|
||||||
$first_poster = $post_rowset[0]['poster_id'];
|
$first_poster = $post_rowset[0]['poster_id'];
|
||||||
|
$topic_id = $post_rowset[0]['topic_id'];
|
||||||
|
|
||||||
$subject = trim(strip_tags(htmlspecialchars(stripslashes($HTTP_POST_VARS['subject']))));
|
$subject = trim(strip_tags(htmlspecialchars(stripslashes($HTTP_POST_VARS['subject']))));
|
||||||
if(empty($subject))
|
if(empty($subject))
|
||||||
@ -488,14 +489,14 @@ switch($mode)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
sync("topic", $topic_id);
|
sync("topic", $topic_id);
|
||||||
if(!$result = $db->sql_query($sql
|
sync("forum", $forum_id);
|
||||||
|
|
||||||
$next_page = "viewtopic.$phpEx?".POST_TOPIC_URL."=$new_topic_id";
|
$next_page = "viewtopic.$phpEx?".POST_TOPIC_URL."=$new_topic_id";
|
||||||
$return_message = $lang['to_return_topic'];
|
$return_message = $lang['to_return_topic'];
|
||||||
message_die(GENERAL_MESSAGE, $lang['Topic_split'] . "<br />" . "<a href=\"".append_sid($next_page)."\">". $lang['Click'] . " " . $lang['Here'] ."</a> " . $return_message);
|
message_die(GENERAL_MESSAGE, $lang['Topic_split'] . "<br />" . "<a href=\"".append_sid($next_page)."\">". $lang['Click'] . " " . $lang['Here'] ."</a> " . $return_message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$topic_id = ($HTTP_POST_VARS[POST_TOPIC_URL]) ? $HTTP_POST_VARS[POST_TOPIC_URL] : $HTTP_GET_VARS[POST_TOPIC_URL];
|
$topic_id = ($HTTP_POST_VARS[POST_TOPIC_URL]) ? $HTTP_POST_VARS[POST_TOPIC_URL] : $HTTP_GET_VARS[POST_TOPIC_URL];
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
</table></td>
|
</table></td>
|
||||||
<td class="row2" width="80%" height="100%"><table width="100%" height="100%" cellspacing="1" cellpadding="0" border="0">
|
<td class="row2" width="80%" height="100%"><table width="100%" height="100%" cellspacing="1" cellpadding="0" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="images/posticon.gif" alt="Post image icon"><font face="{T_FONTFACE1}" size="{T_FONTSIZE1}">{L_POSTED}: {postrow.POST_DATE} Post Subject: {postrow.POST_SUBJECT}</font><hr></td>
|
<td><img src="images/icon_minipost.gif" alt="Post image icon"><font face="{T_FONTFACE1}" size="{T_FONTSIZE1}">{L_POSTED}: {postrow.POST_DATE} Post Subject: {postrow.POST_SUBJECT}</font><hr></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td height="100%" valign="top"><font face="{T_FONTFACE3}" size="{T_FONTSIZE2}" color="{T_FONTCOLOR1}">{postrow.MESSAGE}</font></td>
|
<td height="100%" valign="top"><font face="{T_FONTFACE3}" size="{T_FONTSIZE2}" color="{T_FONTCOLOR1}">{postrow.MESSAGE}</font></td>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user