
bu mod normal ayırma fonksiyonuna ek olarak konulardaki başlık altına verilen cevapları birleştiriliyor, yerlerini değiştiriyor tek mesaj var ise iki başlığı birleştirmiyor
[ resmi görüntülemek için tıklayın ]
Kod: Tümünü seç
##############################################################
## MOD Title: Split posts and merge in one step
## MOD Author: asinshesq < N/A > (Alan) N/A
## MOD Description: Allow admin to split posts from a topic (using the regular split feature) and merge them
## into an existing topic in a single step
##
## MOD Version: 1.0.3a
##
## Installation Level: Easy
## Installation Time: 5 Minutes ( 1 minute with easymod)
##
## Files To Edit: modcp.php
## language/lang_english/lang_main.php
## templates/subSilver/modcp_split.tpl
##
## Included Files: n/a
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes: n/a
##############################################################
## MOD History:
##
## 2006-5-20 - Version 1.0.3a
## no changes...just repacked to be validated against phpbb2.0.20
##
## 2005-5-06 - Version 1.0.3
## added an intval to protect against injection risk
##
## 2005-4-09 - Version 1.0.2
## a few more changes in textual instructions to ensure that the instructions don't wrap on monitors
## with resolutions lower than 1280 accross
##
## 2005-4-09 - Version 1.0.1
## a few changes in textual instructions suggested by mistakeprone (no change in functionality)
##
## 2005-4-08 - Version 1.0.0
## initial version
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]-------------------------------------------------
#
modcp.php
#
#-----[ FIND ]-------------------------------------------------
#
$sql = "SELECT post_id, poster_id, topic_id, post_time
#
#-----[ BEFORE, ADD ]-------------------------------------------------
#
// start mod split posts and merge in one step
// check to see if subject (new title of split topic) is empty...if so, and if there is a destination topic, do the regular split (copied from the regular modcp code) and then change the split posts to the destination topic
if (empty($HTTP_POST_VARS['subject']))
{
if (!empty($HTTP_POST_VARS['destination_topic']))
{
$destination_topic = $HTTP_POST_VARS['destination_topic'];
// the next block of code is borrowed from the simply merge mod...it extracts the topic id from topic_id, topic url or post url
// is this a direct value ?
$num_topic = intval($destination_topic);
if ($destination_topic == "$num_topic")
{
$destination_topic_id = $num_topic;
}
// is this a url with topic id or post id ?
else
{
$name = explode('?', $destination_topic);
$parms = ( isset($name[1]) ) ? $name[1] : $name[0];
parse_str($parms, $parm);
$found = false;
$destination_topic_id = 0;
while ((list($key, $val) = each($parm)) && !$found)
{
$vals = explode('#', $val);
$val = $vals[0];
if (empty($val))
{
$val = 0;
}
else $val = intval($val);
switch($key)
{
case POST_POST_URL:
$sql = "SELECT topic_id FROM " . POSTS_TABLE . " WHERE post_id=$val";
if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Could not get post information', '', __LINE__, __FILE__, $sql);
if ($row = $db->sql_fetchrow($result))
{
$val = $row['topic_id'];
$found = true;
}
break;
case POST_TOPIC_URL:
$found = true;
break;
}
if ($found)
{
$destination_topic_id = $val;
}
}
}
// done with getting topic_id
// now, get forum id for destination topic
$sql = "SELECT forum_id
FROM " . TOPICS_TABLE . "
WHERE topic_id = $destination_topic_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not get forum information for destination topic', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$destination_forum_id = $row['forum_id'];
$db->sql_freeresult($result);
// if there is no forum_id (probably because there is no such topic_id), give error message
if ($destination_forum_id == '') message_die(GENERAL_MESSAGE, 'Could not get forum information (no such topic_id?)');
// now get the posts that are being spit....
$sql = "SELECT post_id, poster_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);
}
if ($row = $db->sql_fetchrow($result))
{
$post_time = $row['post_time'];
$user_id_sql = intval($row['poster_id']);
$post_id_sql = intval($row['post_id']);
}
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));
// Update topic watch table, switch users whose posts
// have moved, over to watching the destination topic
$sql = "UPDATE " . TOPICS_WATCH_TABLE . "
SET topic_id = $destination_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_where = (!empty($HTTP_POST_VARS['split_type_beyond'])) ? " post_time >= $post_time AND topic_id = $topic_id" : "post_id IN ($post_id_sql)";
// now do a sql for switching the split posts over to the destination topic and forum
$sql = "UPDATE " . POSTS_TABLE . "
SET topic_id = $destination_topic_id, forum_id = $destination_forum_id
WHERE $sql_where";
if (!$db->sql_query($sql, END_TRANSACTION))
{
message_die(GENERAL_ERROR, 'Could not update posts table', '', __LINE__, __FILE__, $sql);
}
sync('topic', $destination_topic_id);
sync('topic', $topic_id);
sync('forum', $destination_forum_id);
sync('forum', $forum_id);
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$destination_topic_id&sid=" . $userdata['session_id'] . '">')
);
$message = $lang['Topic_split'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$destination_topic_id&sid=" . $userdata['session_id'] . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
}
// end mod split posts and merge in one step
#
#-----[ FIND ]-------------------------------------------------
#
'L_POST' => $lang['Post'],
#
#-----[ AFTER, ADD ]-------------------------------------------------
#
'L_IF_TITLE_BLANK' => $lang['If_title_blank'],
'L_DESTINATION_TOPIC' => $lang['Destination_topic'],
'L_DESTINATION_TOPIC_FORMAT' => $lang['Destination_topic_format'],
#
#-----[ OPEN ]-------------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]-------------------------------------------------
#
$lang['Topic_split'] = 'The selected topic has been split successfully';
#
#-----[ AFTER, ADD ]-------------------------------------------------
#
// start mod split posts and merge in one step
$lang['If_title_blank'] = '<br />(specify new topic title; leave blank to merge split-off posts into existing topic specified below)';
$lang['Destination_topic'] = 'Destination topic';
$lang['Destination_topic_format'] = '<br />(if merging into existing topic, insert topic id or url of that topic, or insert url of a post in that topic)';
// end mod split posts and merge in one step
#
#-----[ OPEN ]-------------------------------------------------
#
templates/subSilver/modcp_split.tpl
#
#-----[ FIND ]-------------------------------------------------
#
<td class="row2" colspan="2"><input class="post" type="text" size="35" style="width: 350px" maxlength="60" name="subject" /></td>
#
#-----[ REPLACE WITH ]-------------------------------------------------
#
<td class="row2" colspan="2"><input class="post" type="text" size="35" style="width: 350px" maxlength="60" name="subject" /><span class="gensmall">{L_IF_TITLE_BLANK}</span></td>
#
#-----[ FIND ]-------------------------------------------------
#
<tr>
<td class="row1" nowrap="nowrap"><span class="gen">{L_SPLIT_FORUM}</span></td>
<td class="row2" colspan="2">{S_FORUM_SELECT}</td>
</tr>
#
#-----[ AFTER, ADD ]-------------------------------------------------
#
<tr>
<td class="row1" nowrap="nowrap"><span class="gen">{L_DESTINATION_TOPIC}</span></td>
<td class="row2" colspan="2"><input class="post" type="text" size="35" style="width: 350px" maxlength="60" name="destination_topic" /><span class="gensmall">{L_DESTINATION_TOPIC_FORMAT}</span></td>
</tr>
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM
Kod: Tümünü seç
// start mod split posts and merge in one step
$lang['If_title_blank'] = '<br />(Yeni konu başlığı belirleyin; yada burayı boş bırakarak aşağıdaki hedef başlığı kullanarak varolan bir başlığa mesajınızı taşıyabilirsiniz)';
$lang['Destination_topic'] = 'Hedef Başlık';
$lang['Destination_topic_format'] = '<br />(Birleştirme işlemi varolan bir başlığa yapılacaksa, Başlık ID No sunu; yada o başlığın url adresini, yada başlığın içindeki mesajın url adresini yazın)';
// end mod split posts and merge in one step
mod'un orijinal bölümü
Kod: Tümünü seç
// start mod split posts and merge in one step
$lang['If_title_blank'] = '<br />(specify new topic title; leave blank to merge split-off posts into existing topic specified below)';
$lang['Destination_topic'] = 'Destination topic';
$lang['Destination_topic_format'] = '<br />(if merging into existing topic, insert topic id or url of that topic, or insert url of a post in that topic)';
// end mod split posts and merge in one step