- Kód: Vybrať všetko
##############################################################
## MOD Title: Move Message Mod
## MOD Author: Leuchte < mail@leuchte.net > http://www.leuchte.net
## MOD Description: This Mod displays a Message, when a Topic are moved, splitted, locked or unlocked.
## MOD Version: 3.0.3
## Installation Level: Easy
## Installation Time: < 10 Minutes
## Files To Edit: 5
## language/lang_english/lang_main.php
## modcp.php
## viewtopic.php
## includes/constants.php
## templates/subSilver/viewtopic_body.tpl
##
## Included Files: 1
##############################################################
## For Security Purposes, Please Check: http://www.leuchte.net/mods/ for the
## latest version of this MOD.
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
## MOD History:
##
## 2005-11-22 - Delete unused Query
## 2005-03-01 - Reduce SQL-Query and give Mini Post Icon some quote signs
## 2004-09-23 - Fix, if not the latest action will shown
## 2004-09-01 - New Code and expanded for Unlock-Message
## 2004-08-14 - Expanded for Split-Message and Lock-Message
## 2004-08-13 - Fixed MySQL4 Error
## 2004-08-12 - Initial Release
##
##############################################################
#
#-----[ SQL ]------------------------------------------
# Or run the included db_update.php
CREATE TABLE phpbb_topic_moved (
moved_id mediumint(8) unsigned NOT NULL auto_increment,
moved_topic_id mediumint(8) unsigned NOT NULL default '0',
moved_oldtopic_id mediumint(8) unsigned default '0',
moved_type varchar(8) NOT NULL default '0',
moved_parent mediumint(8) unsigned default '0',
moved_target mediumint(8) unsigned default '0',
moved_mod mediumint(8) NOT NULL default '0',
moved_time int(11) NOT NULL default '0',
last_post_id mediumint(8) unsigned NOT NULL default '0',
PRIMARY KEY (moved_id)
) TYPE=MyISAM;
ALTER TABLE phpbb_posts ADD post_move TINYINT(1) DEFAULT 0 NOT NULL;
#
#-----[ COPY ]------------------------------------------
#
move_message_mod.php TO ./move_message_mod.php
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all Folks!
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// M-M-M
$lang['Move_move_message'] = 'Moved: <b>%s</b> by <b>%s</b><br>From <b>%s</b> to <b>%s</b>';
$lang['Move_lock_message'] = 'Locked: <b>%s</b> by <b>%s</b>';
$lang['Move_unlock_message'] = 'Unlocked: <b>%s</b> by <b>%s</b>';
$lang['Move_split_message'] = 'Splitted: <b>%s</b> by <b>%s</b><br>From Topic <b>%s</b> (<b>%s</b>)';
#
#-----[ OPEN ]------------------------------------------
#
modcp.php
#
#-----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
include($phpbb_root_path . 'move_message_mod.'.$phpEx);
#
#-----[ FIND ]------------------------------------------
#
$post_id_sql .= ( ( $post_id_sql != '' ) ? ', ' : '' ) . intval($row['post_id']);
#
#-----[ AFTER, ADD ]------------------------------------------
#
delete_topic($topic_id_sql);
#
#-----[ FIND ]------------------------------------------
#
message_die(GENERAL_ERROR, 'Could not insert shadow topic', '', __LINE__, __FILE__, $sql);
}
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
move_message_mod($row[$i]['topic_id'], '', 'move', $old_forum_id, $new_forum_id, $userdata['user_id']);
#
#-----[ FIND ]------------------------------------------
#
}
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_status = " . TOPIC_LOCKED . "
#
#-----[ BEFORE, ADD ]------------------------------------------
#
move_message_mod($topics[$i], '', 'lock', '', '', $userdata['user_id']);
#
#-----[ FIND ]------------------------------------------
#
}
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_status = " . TOPIC_UNLOCKED . "
#
#-----[ BEFORE, ADD ]------------------------------------------
#
move_message_mod($topics[$i], '', 'unlock', '', '', $userdata['user_id']);
#
#-----[ FIND ]------------------------------------------
#
$new_topic_id = $db->sql_nextid();
#
#-----[ AFTER, ADD ]------------------------------------------
#
move_message_mod($new_topic_id, $topic_id, 'split', $forum_id, '', $userdata['user_id']);
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
'DELETE' => $delpost,
'L_MINI_POST_ALT' => $mini_post_alt,
'U_MINI_POST' => $mini_post_url,
'U_POST_ID' => $postrow[$i]['post_id'])
);
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Move Message
if($postrow[$i]['post_move'] == 1)
{
$sql = "SELECT moved_type
FROM ". MOVED_TABLE ."
WHERE last_post_id = '". $postrow[$i]['post_id'] ."'
ORDER BY moved_id DESC LIMIT 1";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not get moved type', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$moved_type = $row['moved_type'];
if($moved_type == "move")
{
$select = "mv.moved_time, mv.last_post_id, f.forum_name AS forumparent, f2.forum_name AS forumtarget, u.username";
$from = "". MOVED_TABLE ." mv, ". FORUMS_TABLE ." f, ". FORUMS_TABLE ." f2, ". USERS_TABLE ." u ";
$where = "mv.last_post_id = '". $postrow[$i]['post_id'] ."'
AND mv.moved_parent = f.forum_id
AND mv.moved_target = f2.forum_id
AND mv.moved_mod = u.user_id";
}
if($moved_type == "split")
{
$select = "mv.moved_time, mv.last_post_id, f.forum_name as forumparent, t.topic_title, u.username";
$from = "". MOVED_TABLE ." mv, ". TOPICS_TABLE ." t, ". FORUMS_TABLE ." f, ". USERS_TABLE ." u ";
$where = "mv.last_post_id = '". $postrow[$i]['post_id'] ."'
AND mv.moved_parent = f.forum_id
AND mv.moved_oldtopic_id = t.topic_id
AND mv.moved_mod = u.user_id";
}
if($moved_type == "lock" || $moved_type == "unlock")
{
$select = "mv.moved_time, mv.last_post_id, u.username";
$from = "". MOVED_TABLE ." mv, ". USERS_TABLE ." u ";
$where = "mv.last_post_id = '". $postrow[$i]['post_id'] ."'
AND mv.moved_mod = u.user_id";
}
if($moved_type)
{
$sql = "SELECT $select
FROM $from
WHERE $where
ORDER BY mv.moved_time DESC LIMIT 1";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not get main move information', '', __LINE__, __FILE__, $sql);
}
$moved = $db->sql_fetchrow($result);
}
$mini_icon = $images['icon_minipost'];
$move_date = create_date($board_config['default_dateformat'], $moved['moved_time'], $board_config['board_timezone']);
$mover = $moved['username'];
$parent_topic = $moved['topic_title'];
$parent_forum = $moved['forumparent'];
$target_forum = $moved['forumtarget'];
if($moved_type == "move")
{
$move_message = sprintf($lang['Move_move_message'], $move_date, $mover, $parent_forum, $target_forum);
}
if($moved_type == "lock")
{
$move_message = sprintf($lang['Move_lock_message'], $move_date, $mover);
}
if($moved_type == "unlock")
{
$move_message = sprintf($lang['Move_unlock_message'], $move_date, $mover);
}
if($moved_type == "split")
{
$move_message = sprintf($lang['Move_split_message'], $move_date, $mover, $parent_topic, $parent_forum);
}
if($moved['last_post_id'] == $postrow[$i]['post_id'])
{
$template->assign_block_vars('postrow.move_message', array(
'MOVE_MESSAGE' => '<img src="'.$mini_icon.'" border="0" />'.$move_message)
);
}
else
{
$template->assign_block_vars('postrow.switch_spacer', array());
}
}// Move Message
#
#-----[ OPEN ]------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]------------------------------------------
#
define('TOPICS_TABLE', $table_prefix.'topics');
#
#-----[ AFTER, ADD ]------------------------------------------
#
define('MOVED_TABLE', $table_prefix.'topic_moved');
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="spaceRow" colspan="2" height="1"><img src="templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
<!-- END postrow -->
#
#-----[ REPLACE, WITH ]------------------------------------------
#
<!-- BEGIN switch_spacer -->
<tr>
<td class="spaceRow" colspan="2" height="1"><img src="templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
<!-- END switch_spacer -->
<!-- BEGIN move_message -->
<tr>
<td class="row3" colspan="2"><span class="postdetails">{postrow.move_message.MOVE_MESSAGE}</span></td>
</tr>
<!-- END move_message -->
<!-- END postrow -->
#
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Vytvor si v domovskom adresári súbor s názvom move_message_mod.php
A do neho vlož
- Kód: Vybrať všetko
<?php
if (!defined('IN_PHPBB'))
{
die('Hacking attempt');
}
function move_message_mod($moved_topic_id, $moved_oldtopic_id, $type, $moved_parent, $moved_target, $moved_mod)
{
global $db;
$time = time();
if ($type == "split")
{
$where = "WHERE topic_id = '$moved_oldtopic_id'";
}
else
{
$where = "WHERE topic_id = '$moved_topic_id'";
}
$sql = "SELECT topic_last_post_id
FROM ". TOPICS_TABLE ."
$where";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not get topic_last_post_id', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$last_post_id = $row['topic_last_post_id'];
$sql = "INSERT INTO ". MOVED_TABLE ." (moved_topic_id, moved_oldtopic_id, moved_type, moved_parent, moved_target, moved_mod, moved_time, last_post_id)
VALUES ('$moved_topic_id', '$moved_oldtopic_id', '$type', '$moved_parent', '$moved_target', '$moved_mod', '$time', '$last_post_id')";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into moved table', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE ". POSTS_TABLE ."
SET post_move = '1'
WHERE post_id = '$last_post_id'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update posts table', '', __LINE__, __FILE__, $sql);
}
}
function delete_topic($topic_id)
{
global $db;
$sql = "DELETE FROM ". MOVED_TABLE ."
WHERE moved_topic_id = '$topic_id'";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete move message', '', __LINE__, __FILE__, $sql);
}
}
?>







News
![Validate my Atom 1.0 feed [Valid Atom 1.0]](http://validator.w3.org/feed/images/valid-atom.png)