diff options
author | James Atkinson <thefinn@users.sourceforge.net> | 2001-07-13 16:42:20 +0000 |
---|---|---|
committer | James Atkinson <thefinn@users.sourceforge.net> | 2001-07-13 16:42:20 +0000 |
commit | 8e49899bce210323dae4626138d5465b68c4fc58 (patch) | |
tree | cc597f982541d172b82ecd16fa0b3fb653c8743b /phpBB | |
parent | df799b8a16e25ffd39f018d6e131fc5c94157c8e (diff) | |
download | forums-8e49899bce210323dae4626138d5465b68c4fc58.tar forums-8e49899bce210323dae4626138d5465b68c4fc58.tar.gz forums-8e49899bce210323dae4626138d5465b68c4fc58.tar.bz2 forums-8e49899bce210323dae4626138d5465b68c4fc58.tar.xz forums-8e49899bce210323dae4626138d5465b68c4fc58.zip |
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
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/includes/functions.php | 106 | ||||
-rwxr-xr-x | phpBB/language/lang_english.php | 4 | ||||
-rw-r--r-- | phpBB/modcp.php | 15 | ||||
-rw-r--r-- | phpBB/templates/PSO/split_body.tpl | 2 |
4 files changed, 119 insertions, 8 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 50cd5af865..5608b2f252 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -503,4 +503,110 @@ function validate_username($username) 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); +} + + ?>
\ No newline at end of file diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php index bb3d3bdcf2..faacb921a6 100755 --- a/phpBB/language/lang_english.php +++ b/phpBB/language/lang_english.php @@ -110,6 +110,8 @@ $lang['AIM'] = "AIM Address"; $lang['MSNM'] = "MSN Messenger"; $lang['YIM'] = "Yahoo Messenger"; +$lang['Error'] = "Error"; + // // 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['Split_posts'] = "Split Posts"; $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!! diff --git a/phpBB/modcp.php b/phpBB/modcp.php index 2869545c43..303ad9e5d4 100644 --- a/phpBB/modcp.php +++ b/phpBB/modcp.php @@ -434,7 +434,7 @@ switch($mode) $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)) { message_die(GENERAL_ERROR, "Could not get post information", "Error", __LINE__, __FILE__, $sql); @@ -442,7 +442,8 @@ switch($mode) $post_rowset = $db->sql_fetchrowset($result); $first_poster = $post_rowset[0]['poster_id']; - + $topic_id = $post_rowset[0]['topic_id']; + $subject = trim(strip_tags(htmlspecialchars(stripslashes($HTTP_POST_VARS['subject'])))); if(empty($subject)) { @@ -488,11 +489,11 @@ switch($mode) else { sync("topic", $topic_id); - if(!$result = $db->sql_query($sql - - $next_page = "viewtopic.$phpEx?".POST_TOPIC_URL."=$new_topic_id"; - $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); + sync("forum", $forum_id); + $next_page = "viewtopic.$phpEx?".POST_TOPIC_URL."=$new_topic_id"; + $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); + } } } } diff --git a/phpBB/templates/PSO/split_body.tpl b/phpBB/templates/PSO/split_body.tpl index a8470cb8fd..824a376cce 100644 --- a/phpBB/templates/PSO/split_body.tpl +++ b/phpBB/templates/PSO/split_body.tpl @@ -32,7 +32,7 @@ </table></td> <td class="row2" width="80%" height="100%"><table width="100%" height="100%" cellspacing="1" cellpadding="0" border="0"> <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> <td height="100%" valign="top"><font face="{T_FONTFACE3}" size="{T_FONTSIZE2}" color="{T_FONTCOLOR1}">{postrow.MESSAGE}</font></td> |