[外掛] Merge Topic 主題/文章合併 2.0.4

MODs Released by Other phpbb Sites
非官方認證通過之 MOD ,或許有安全性之疑慮,所有問題由原發表者回覆!

版主: 版主管理群

主題已鎖定
Mac
百戰天龍馬蓋先
百戰天龍馬蓋先
文章: 2590
註冊時間: 2003-02-02 02:28
來自: MacphpBBMOD
聯繫:

[外掛] Merge Topic 主題/文章合併 2.0.4

文章 Mac »

下載: http://www.shannado.nl/forumorg (不包含 2.0.4 修正檔)

安裝裡的 2.0.4 修正是 Shannado 寫的,但是這個版的安裝檔已經找不到了 :-o

代碼: 選擇全部


## EasyMod 0.0.7 compliant 
################################################################# 
## MOD Title:       Merge Topic MOD 主題/文章合併 2.0.4 修正版 
## MOD Author:       Shannado <sven@shannado.nl> (Sven) http://www.shannado.nl/forumorg 
## 中文化作者: Mac < ycl_6@sinamail.com > 
## MOD Description:    Moderator will be able to move a topic to an already running topic. And a moderator is able to move 
##         individual posts to a runnning topic. 
## 版主可以使用這個管理選項來合併主題或是文章 
## MOD Version:    1.0.3 
##        
## Installation Level:    Easy 
## Installation Time:    10 - 15 minutes 
## Files To Edit:    viewtopic.php, 
##         modcp.php, 
##         lang_main.php, 
##         modcp_body.tpl 
## Included Files:    modcp_merge_topic.tpl, 
##         modcp_merge_topicpost.tpl, 
##         topic_merge_2.gif, topic_merge.gif, 
##            modcp_merge_post.tpl 
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the \r
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/ 
############################################################## 
## 
## Author Note: 
## 
##   Moving entire topic works with 'Moderator Control Panel' 
##   Moving individual posts works with the icon when you are viewing the topic 
## 
##    The gif-file 'topic_merge_2.gif' is made by NewBuyer (nickname on www.phpBB.com). If you wanna use this rename it 
##   to 'topic_merge.gif' 
## 
############################################################## 
## 
## History: 
## ------------ 
## 0.6.0 beta 
##   - Beta 
## 
## 0.8.0 beta 
##   - You are now also able to merge individual posts to a topic 
## 
## 0.8.1 beta 
##   - Forgot some code line in the HOW - TO 
## 
\n## 0.8.2 beta 
##   - adjusted the HOW-TO. A {FIND} could found more then once. {FIND} is be extended. 
## 
## 0.8.3 beta 
##   - The option leave shadow appeared when moving posts, it should not. 
##   - The wrong text appeared at the top control panel 
##   - changed the double quotes into single quotes in the language file (same as in phpbb v2.0.1) 
## 
## 1.0.0 FINAL 
##   - Final 
## 
## 1.0.1 FINAL 
##   - I had put the shadow switch at the wrong place 
## 
## 1.0.2 FINAL 
##   - fIxed small bugs, see: http://www.shannado.nl/forumorg/viewtopic.php?t=321 
##   - Thanks Websnail !! 
## 
## 1.0.3 FINAL 
##   - Made phpBB v2.0.2 complaint and EasyMod 0.0.7 complaint 
## 
## 1.1 DEV 
## - phpBB 2.04 compliant ??? (是的!!!) 
################################################################# 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
################################################################# 
# 
#-----[ 複製]------------------------------------------ 
#  
copy templates/subSilver/x.x to template/subSilver/ 
copy templates/subSilver/images/x.x to template/subSilver/images/ 

# 
#-----[ 打開 ]------------------------------------------ 
#  
language/lang_english/lang_main.php 

# 
#-----[ 尋找 ]------------------------------------------ 
# 
// 
// That's all Folks! 

# 
#-----[ 之前加入 ]------------------------------------------ 
# 
// Merge Topic MOD 
$lang['Merge'] = 'Merge'; 
$lang['Topics_Merged'] = 'The selected topics have been merged'; 
$lang['No_Topics_Merged'] = 'No topics were merged'; 
$lang['Confirm_merge_topic'] = 'Are you sure you want to merge the selected topic/s?<br><span class=genmed>(Next you will select a target post to merge these into next)</span>'; 
$lang['Merge_to_forum'] = 'Merge to forum'; 
$lang['Merge_topic'] = 'Merge this topic'; 

$lang['Merge_post'] = 'Merge posts in this topic'; 
$lang['Merge_after'] = 'Merge from selected post'; 
$lang['Merge_posts'] = 'Merge selected posts'; 
$lang['Mod_CP_explain'] = 'Using the form below you can perform mass moderation operations on this forum. You can lock, unlock, move, merge or delete any number of topics.'; 
$lang['Mod_CP_merge_explain'] = 'Select the topic with which the topic/post has to merge'; 
$lang['Merge_Topic_explain'] = 'Using the form below you can merge posts to a topic, either by selecting the posts individually or by merging at a selected post'; 
$lang['Merge_post_topic'] = 'Merge posts into a topic'; 
$lang['Posts_Merged'] = 'The selected posts have been merged'; 

# 
#-----[ 打開 ]------------------------------------------ 
#  
viewtopic.php 

# 
#-----[ 尋找 ]------------------------------------------ 
# 
$topic_mod .= "<a href=\"modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=move&sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_mod_move'] . '" alt="' . $lang['Move_topic'] . '" title="' . $lang['Move_topic'] . '" border="0" /></a> '; 
$topic_mod .= "<a href=\"modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=move&sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_mod_move'] . '" alt="' . $lang['Move_topic'] . '" title="' . $lang['Move_topic'] . '" border="0" /></a> ';

# 
#-----[ 之後加上 ]------------------------------------------ 
# 
//Updated for v 2.04 
$topic_mod .= "<a href=\"modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=mergepost&sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_mod_merge'] . '" alt="' . $lang['Merge_post'] . '" title="' . $lang['Merge_post'] . '" border="0" /></a> '; 

# 
#-----[ 打開 ]------------------------------------------ 
#  
modcp.php 

# 
#-----[ 尋找 ]------------------------------------------ 
# 
$unlock = ( isset($HTTP_POST_VARS['unlock']) ) ? TRUE : FALSE; 

# 
#-----[ 之後加上 ]------------------------------------------ 
# 
// Merge topic MOD 
$mergetopic = ( isset($HTTP_POST_VARS['mergetopic']) ) ? TRUE : FALSE; 
$mergepost = ( isset($HTTP_POST_VARS['mergepost']) ) ? TRUE : FALSE; 
// Merge topic MOD 

# 
#-----[ 打開 ]------------------------------------------ 
# 
      $mode = 'move'; 
   } 

# 
#-----[ 之後加上 ]------------------------------------------ 
# 

	else if ( $mergetopic ) 
	{ 
	   $mode = 'mergetopic'; 
	} 
	else if ( $mergepost ) 
	{ 
	   $mode = 'mergepost'; 
	}

# 
\n#-----[ 尋找 ]------------------------------------------ 
# 
   case 'lock': 

# 
#-----[ 之前加上 ]------------------------------------------ 
# 
// 
// Merge Topic MOD - Begin 
// 
   case 'mergetopic': 

      $page_title = $lang['Mod_CP']; 
      include($phpbb_root_path . 'includes/page_header.'.$phpEx); 

      $merge2 = ( isset($HTTP_POST_VARS['merge2']) ) ? TRUE : FALSE; 

      // this starts after you selected the forum to which the topic will be moved/merged 
       if ( $merge2 ){ 

      $new_forum_id = $HTTP_POST_VARS['new_forum']; 
        
         if ( isset($HTTP_POST_VARS['topic_id_list']) ) { 

            $topics = $HTTP_POST_VARS['topic_id_list']; 
            $topic_list = ''; 

            for($i = 0; $i < count($topics); $i++) { 

               $topic_list .= ( ( $topic_list != '' ) ? ', ' : '' ) . $topics[$i]; 
               $hidden_fields .= '<input type="hidden" name="topic_id_list[]" value="' . intval($topics[$i]) . '" />'; 
               } 
         } 
         else { 

            $topic_list = $topic_id; 
            $hidden_fields .= '<input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" />'; 
         } 

         //  added for fix to use with phpbb v2.04 
         $hidden_fields .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />'; 
         $hidden_fields .= '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />'; 
         $hidden_fields .= '<input type="hidden" name="mode" value="' . $mode . '" />'; 
         $hidden_fields .= '<input type="hidden" name="new_forum" value="' . $new_forum_id . '" />'; 

         $template->assign_vars(array( 
            'FORUM_NAME' => $forum_name, 
            'L_MOD_CP' => $lang['Mod_CP'], 
            'L_MOD_CP_EXPLAIN' => $lang['Mod_CP_merge_explain'], 
            'L_SELECT' => $lang['Select'], 
            'L_MERGE' => $lang['Merge'], 
            'L_TOPICS' => $lang['Topics'], 
            'L_REPLIES' => $lang['Replies'], 
            'L_LASTPOST' => $lang['Last_Post'], 
            'L_SELECT' => $lang['Select'], 
            'L_LEAVESHADOW' => $lang['Leave_shadow_topic'], 
            'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"), 
            'S_HIDDEN_FIELDS' => $hidden_fields, 
            'S_MODCP_ACTION' => append_sid("modcp.$phpEx")) 
         ); 
    
         $template->set_filenames(array( 
            'body' => 'modcp_merge_topicpost.tpl') 
         ); 
    
         // 
         // Define censored word matches 
         // 
         $orig_word = array(); 
         $replacement_word = array(); 
         obtain_word_list($orig_word, $replacement_word); 
    
         $sql = "SELECT t.*, u.username, u.user_id, p.post_time 
            FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p 
            WHERE t.forum_id = $new_forum_id 
               AND t.topic_poster = u.user_id 
               AND p.post_id = t.topic_last_post_id 
               AND t.topic_moved_id = 0 
               AND t.topic_id NOT IN ($topic_list) 
            ORDER BY t.topic_type DESC, p.post_time DESC 
            LIMIT $start, " . $board_config['topics_per_page']; 
         if ( !($result = $db->sql_query($sql)) ) { 
            message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql); 
         } 
    
         while ( $row = $db->sql_fetchrow($result) ) { 

            $topic_title = ''; 
            if ( $row['topic_status'] == TOPIC_LOCKED ) { 
               $folder_img = $images['folder_locked']; 
               $folder_alt = $lang['Topic_locked']; 
            } 
            else 
            { 
               if ( $row['topic_type'] == POST_ANNOUNCE ) 
               { 
                  $folder_img = $images['folder_announce']; 
                  $folder_alt = $lang['Announcement']; 
               } 
               else if ( $row['topic_type'] == POST_STICKY ) 
               { 
                  $folder_img = $images['folder_sticky']; 
                  $folder_alt = $lang['Sticky']; 
               } 
               else 
               { 
                  $folder_img = $images['folder']; 
                  $folder_alt = $lang['No_new_posts']; 
               } 
            } 
    \r
            $topic_id = $row['topic_id']; 
            $topic_type = $row['topic_type']; 
            $topic_status = $row['topic_status']; 
              
            if ( $topic_type == POST_ANNOUNCE ) 
            { 
               $topic_type = $lang['Topic_Announcement'] . ' '; 
            } 
            else if ( $topic_type == POST_STICKY ) 
            { 
               $topic_type = $lang['Topic_Sticky'] . ' '; 
            } 
            else if ( $topic_status == TOPIC_MOVED ) 
            { 
               $topic_type = $lang['Topic_Moved'] . ' '; 
            } 
            else 
            { 
               $topic_type = '';        
            } 
        
            if ( $row['topic_vote'] ) 
            { 
               $topic_type .= $lang['Topic_Poll'] . ' '; 
            } 
        
            $topic_title = $row['topic_title']; 
            if ( count($orig_word) ) 
            { 
               $topic_title = preg_replace($orig_word, $replacement_word, $topic_title); 
            } 
    
            $u_view_topic = ''; 
            $topic_replies = $row['topic_replies']; 
    
            $last_post_time = create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']); 
    
            $template->assign_block_vars('topicrow', array( 
               'U_VIEW_TOPIC' => $u_view_topic, 
    
               'TOPIC_FOLDER_IMG' => $folder_img, 
               'TOPIC_TYPE' => $topic_type, 
               'TOPIC_TITLE' => $topic_title, 
               'REPLIES' => $topic_replies, 
               'LAST_POST_TIME' => $last_post_time, 
               'TOPIC_ID' => $topic_id, 
                    
               'L_TOPIC_FOLDER_ALT' => $folder_alt) 
            ); 
         } 
    
         $template->assign_vars(array( 
	'PAGINATION' => generate_pagination("modcp.$phpEx?sid=" . $userdata['session_id'] . "&" . POST_FORUM_URL . "=$forum_id", $forum_topics, $board_config['topics_per_page'], $start),
            'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $forum_topics / $board_config['topics_per_page'] )), 
            'L_GOTO_PAGE' => $lang['Goto_page']) 
         ); 
    
         $template->pparse('body'); 
           } 
           // After you selected the topic to merge with 
      else if ( $confirm ) 
      { 
         // $leave_shadow = ( $HTTP_POST_VARS['merge_leave_shadow'] ) ? TRUE : 0; 
         if ( empty($HTTP_POST_VARS['topic_id_to']) ) 
         { 
            message_die(GENERAL_MESSAGE, $lang['None_selected']); 
         } 
          
         $topic_id_to = $HTTP_POST_VARS['topic_id_to']; 
         $new_forum_id = $HTTP_POST_VARS['new_forum']; 
         $old_forum_id = $forum_id; 
          
         if ( $topic_id != $topic_id_to ) 
         { 
            $topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ?  $HTTP_POST_VARS['topic_id_list'] : array($topic_id); 

            $topic_list = ''; 
            for($i = 0; $i < count($topics); $i++) 
            { 
               $topic_list .= ( ( $topic_list != '' ) ? ', ' : '' ) . $topics[$i]; 
            } 

            $sql = "SELECT * 
               FROM " . TOPICS_TABLE . " 
               WHERE topic_id IN ($topic_list) 
                  AND topic_status <> " . TOPIC_MOVED; 
            if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) ) 
            { 
               message_die(GENERAL_ERROR, 'Could not select from topic table', '', __LINE__, __FILE__, $sql); 
            } 

            $row = $db->sql_fetchrowset($result); 
            $db->sql_freeresult($result); 

            for($i = 0; $i < count($row); $i++) 
            { 
               $topic_id = $row[$i]['topic_id']; 
                
               if ( isset($HTTP_POST_VARS['merge_leave_shadow']) ) 
               { 
                  // Insert topic in the old forum that indicates that the forum has moved. 
                  $sql = "INSERT INTO " . TOPICS_TABLE . " (forum_id, topic_title, topic_poster, topic_time, topic_status, topic_type, topic_vote, topic_views, topic_replies, topic_first_post_id, topic_last_post_id, topic_moved_id) 
                     VALUES ($old_forum_id, '" . addslashes(str_replace("\'", "''", $row[$i]['topic_title'])) . "', '" . str_replace("\'", "''", $row[$i]['topic_poster']) . "', " . $row[$i]['topic_time'] . ", " . TOPIC_MOVED . ", " . POST_NORMAL . ", " . $row[$i]['topic_vote'] . ", " . $row[$i]['topic_views'] . ", " . $row[$i]['topic_replies'] . ", " . $row[$i]['topic_first_post_id'] . ", " . $row[$i]['topic_last_post_id'] . ", $topic_id_to)"; 
                  if ( !$db->sql_query($sql) ) 
                  { 
                     message_die(GENERAL_ERROR, 'Could not insert shadow topic', '', __LINE__, __FILE__, $sql); 
                  } 
               } 

               $sql = "DELETE 
                  FROM " . TOPICS_TABLE . " 
                  WHERE topic_id = $topic_id"; 
               if ( !$db->sql_query($sql) ) 
               { 
                  message_die(GENERAL_ERROR, 'Could not delete old topic', '', __LINE__, __FILE__, $sql); 
               } 

               $sql = "UPDATE " . POSTS_TABLE . " 
                  SET forum_id = $new_forum_id, topic_id = $topic_id_to 
                  WHERE topic_id = $topic_id"; 
               if ( !$db->sql_query($sql) ) 
               { 
                  message_die(GENERAL_ERROR, 'Could not update post topic ids', '', __LINE__, __FILE__, $sql); 
               } 
            } 

            // Sync the forum indexes 
            sync('forum', $new_forum_id); 
            sync('forum', $old_forum_id); 
            sync('topic', $topic_id_to); 
            $message = $lang['Topics_Merged'] . '<br /><br />'; 

         } 
         else 
         { 
            $message = $lang['No_Topics_Merged'] . '<br /><br />'; 
         } 

         if ( !empty($topic_id) ) 
         { 
            $redirect_page = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id_to"); 
            $message .= sprintf($lang['Click_return_topic'], '<a href="' . $redirect_page . '">', '</a>'); 
         } 
         else 
         { 
            $redirect_page = append_sid("modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id"); 
            $message .= sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>'); 
         } 

         $message = $message . '<br \><br \>' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$old_forum_id") . '">', '</a>'); 

         $template->assign_vars(array( 
            'META' => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">') 
         ); 

         message_die(GENERAL_MESSAGE, $message); 
      } 
      // Here you select the forum is has to merge to 
      else 
      { 
         if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) ) 
         { 
            message_die(GENERAL_MESSAGE, $lang['None_selected']); 
         } 

         $hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />'; 

         //  added for fix to use with phpbb v2.04 
         $hidden_fields .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />'; 
          
         if ( isset($HTTP_POST_VARS['topic_id_list']) ) 
         { 
            $topics = $HTTP_POST_VARS['topic_id_list']; 

            for($i = 0; $i < count($topics); $i++) 
            { 
               $hidden_fields .= '<input type="hidden" name="topic_id_list[]" value="' . intval($topics[$i]) . '" />'; 
            } 
         } 
         else 
         { 
            $hidden_fields .= '<input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" />'; 
         } 

         // 
         // Set template files 
         // 
         $template->set_filenames(array( 
            'movetopic' => 'modcp_merge_topic.tpl') 
         ); 

         $template->assign_vars(array( 
            'MESSAGE_TITLE' => $lang['Confirm'], 
            'MESSAGE_TEXT' => $lang['Confirm_merge_topic'], 

            'L_MERGE_TO_FORUM' => $lang['Merge_to_forum'], 
            'L_YES' => $lang['Yes'], 
            'L_NO' => $lang['No'], 

            'S_FORUM_SELECT' => make_forum_select('new_forum'), 
            'S_MODCP_ACTION' => append_sid("modcp.$phpEx"), 
            'S_HIDDEN_FIELDS' => $hidden_fields) 
         ); 

         $template->pparse('movetopic'); 

         include($phpbb_root_path . 'includes/page_tail.'.$phpEx); 
      } 
      break; 
   case 'mergepost': 

      $page_title = $lang['Mod_CP']; 
      include($phpbb_root_path . 'includes/page_header.'.$phpEx); 
      if ( $confirm ) 
      { 
        
         if ( empty($HTTP_POST_VARS['topic_id_to']) ) 
         { 
            message_die(GENERAL_MESSAGE, $lang['None_selected']); 
         } 
          
         $topic_id_to = $HTTP_POST_VARS['topic_id_to']; 
         $new_forum_id = $HTTP_POST_VARS['new_forum_id']; 
         $old_forum_id = $forum_id; 
          
         $posts = $HTTP_POST_VARS['post_id_list']; 

         $sql = "SELECT poster_id, topic_id, post_time 
            FROM " . POSTS_TABLE . " 
            WHERE post_id = " . $posts[0]; 
         if ( !($result = $db->sql_query($sql)) ) 
         { 
            message_die(GENERAL_ERROR, 'Could not get post information', '', __LINE__, __FILE__, $sql); 
         } 
\r
         $post_rowset = $db->sql_fetchrow($result); 
         $post_time = $post_rowset['post_time']; 
          
         if( !empty($HTTP_POST_VARS['merge_type_all']) ) 
         { 
            $post_id_sql = ''; 
            for($i = 0; $i < count($posts); $i++) 
            { 
               $post_id_sql .= ( ( $post_id_sql != '' ) ? ', ' : '' ) . $posts[$i]; 
            } 

            $sql = "UPDATE " . POSTS_TABLE . " 
               SET topic_id = $topic_id_to, forum_id = $new_forum_id 
               WHERE post_id IN ($post_id_sql)"; 
         } 
         else if( !empty($HTTP_POST_VARS['merge_type_beyond']) ) 
         { 
            $sql = "UPDATE " . POSTS_TABLE . " 
               SET topic_id = $topic_id_to, forum_id = $new_forum_id 
               WHERE post_time >= $post_time 
                  AND topic_id = $topic_id"; 
         } 

         if( !$db->sql_query($sql) ) 
         { 
            message_die(GENERAL_ERROR, 'Could not update posts table', '', __LINE__, __FILE__, $sql); 
         } 

         sync('topic', $topic_id_to); 
         sync('topic', $topic_id); 
         sync('forum', $new_forum_id); 
         sync('forum', $old_forum_id); 

         $template->assign_vars(array( 
            'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">') 
         ); 

         $message = $lang['Posts_Merged'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>'); 
         message_die(GENERAL_MESSAGE, $message); 
      } 
      // Step 1 - Pic topic to merge to 
      else if ( isset($HTTP_POST_VARS['merge_type_all']) || isset($HTTP_POST_VARS['merge_type_beyond'])   ) 
          { 
         $posts = $HTTP_POST_VARS['post_id_list']; 
         $new_forum_id = $HTTP_POST_VARS['new_forum_id']; 
          
         if ( isset($HTTP_POST_VARS['post_id_list']) ) 
         { 
            $posts = $HTTP_POST_VARS['post_id_list']; 
            $posts_list = ''; 

            for($i = 0; $i < count($posts); $i++) 
            { 
               $posts_list .= ( ( $posts_list != '' ) ? ', ' : '' ) . $posts[$i]; 
               $hidden_fields .= '<input type="hidden" name="post_id_list[]" value="' . intval($posts[$i]) . '" />'; 
            } 
         } 
         else 
         { 
            //  added to fix sql error 
            if ( empty($post_id) ) 
            { 
               message_die(GENERAL_MESSAGE, $lang['None_selected']); 
            } 

            $posts_list = $post_id; 
            $hidden_fields .= '<input type="hidden" name="' . POST_POST_URL . '" value="' . $post_id . '" />'; 
         } 
         //  added for fix to use with phpbb v2.04 
         $hidden_fields .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />'; 
         $hidden_fields .= '<input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" />'; 
         $hidden_fields .= '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />'; 
         $hidden_fields .= '<input type="hidden" name="mode" value="' . $mode . '" />'; 
         $hidden_fields .= '<input type="hidden" name="new_forum_id" value="' . $new_forum_id . '" />'; 
         $hidden_fields .= '<input type="hidden" name="merge_type_all" value="' . $HTTP_POST_VARS['merge_type_all'] . '" />'; 
         $hidden_fields .= '<input type="hidden" name="merge_type_beyond" value="' . $HTTP_POST_VARS['merge_type_beyond'] . '" />'; 
         $template->assign_vars(array( 
            'FORUM_NAME' => $forum_name, 
    
            'L_MOD_CP' => $lang['Mod_CP'], 
            'L_MOD_CP_EXPLAIN' => $lang['Mod_CP_explain'], 
            'L_SELECT' => $lang['Select'], 
            'L_MERGE' => $lang['Merge'], 
            'L_TOPICS' => $lang['Topics'], 
            'L_REPLIES' => $lang['Replies'], 
            'L_LASTPOST' => $lang['Last_Post'], 
            'L_SELECT' => $lang['Select'], 
    
            'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"), 
            'S_HIDDEN_FIELDS' => $hidden_fields, 
            'S_MODCP_ACTION' => append_sid("modcp.$phpEx")) 
         ); 
    
         $template->set_filenames(array( 
            'body' => 'modcp_merge_topicpost.tpl') 
         ); 
    
         // 
         // Define censored word matches 
         // 
         $orig_word = array(); 
         $replacement_word = array(); 
         obtain_word_list($orig_word, $replacement_word); 
         //AND t.topic_id NOT IN ($topic_list) 
         $sql = "SELECT t.*, u.username, u.user_id, p.post_time 
            FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p 
            WHERE t.forum_id = $new_forum_id 
               AND t.topic_poster = u.user_id 
               AND p.post_id = t.topic_last_post_id 
               AND t.topic_moved_id = 0 
               AND t.topic_id != $topic_id 
            ORDER BY t.topic_type DESC, p.post_time DESC 
            LIMIT $start, " . $board_config['topics_per_page']; 
         if ( !($result = $db->sql_query($sql)) ) 
         { 
               message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql); 
         } 
    
         while ( $row = $db->sql_fetchrow($result) ) 
         { 
            $topic_title = ''; 
    
            if ( $row['topic_status'] == TOPIC_LOCKED ) 
            { 
               $folder_img = $images['folder_locked']; 
               $folder_alt = $lang['Topic_locked']; 
            } 
            else 
            { 
               if ( $row['topic_type'] == POST_ANNOUNCE ) 
               { 
                  $folder_img = $images['folder_announce']; 
                  $folder_alt = $lang['Announcement']; 
               } 
               else if ( $row['topic_type'] == POST_STICKY ) 
               { 
                  $folder_img = $images['folder_sticky']; 
                  $folder_alt = $lang['Sticky']; 
               } 
               else 
               { 
                  $folder_img = $images['folder']; 
                  $folder_alt = $lang['No_new_posts']; 
               } 
            } 
    
            $topic_id = $row['topic_id']; 
            $topic_type = $row['topic_type']; 
            $topic_status = $row['topic_status']; 
              
            if ( $topic_type == POST_ANNOUNCE ) 
            { 
               $topic_type = $lang['Topic_Announcement'] . ' '; 
            } 
            else if ( $topic_type == POST_STICKY ) 
            { 
               $topic_type = $lang['Topic_Sticky'] . ' '; 
            } 
            else if ( $topic_status == TOPIC_MOVED ) 
            { 
               $topic_type = $lang['Topic_Moved'] . ' '; 
            } 
            else 
            { 
               $topic_type = '';        
            } 
        
            if ( $row['topic_vote'] ) 
            { 
               $topic_type .= $lang['Topic_Poll'] . ' '; 
            } 
        
            $topic_title = $row['topic_title']; 
            if ( count($orig_word) ) 
            { 
               $topic_title = preg_replace($orig_word, $replacement_word, $topic_title); 
            } 
    
            $u_view_topic = ''; 
            $topic_replies = $row['topic_replies']; 
    
            $last_post_time = create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']); 
    
            $template->assign_block_vars('topicrow', array( 
               'U_VIEW_TOPIC' => $u_view_topic, 
    
               'TOPIC_FOLDER_IMG' => $folder_img, 
               'TOPIC_TYPE' => $topic_type, 
               'TOPIC_TITLE' => $topic_title, 
               'REPLIES' => $topic_replies, 
               'LAST_POST_TIME' => $last_post_time, 
               'TOPIC_ID' => $topic_id, 
                    
               'L_TOPIC_FOLDER_ALT' => $folder_alt) 
            ); 
         } 
    
         $template->assign_vars(array( 
            'PAGINATION' => generate_pagination("modcp.$phpEx?sid=" . $userdata['session_id'] . "&" . POST_FORUM_URL . "=$forum_id", $forum_topics, $board_config['topics_per_page'], $start), 
            'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $forum_topics / $board_config['topics_per_page'] )), 
            'L_GOTO_PAGE' => $lang['Goto_page']) 
         ); 
    
         $template->pparse('body'); 
           } 
        
      else 
      {   // Step 0 - select the post you want to merge 
         // 
         // Set template files 
         // 
         $template->set_filenames(array( 
            'merge_post_body' => 'modcp_merge_post.tpl') 
         ); 

         $sql = "SELECT u.username, p.*, pt.post_text, pt.bbcode_uid, pt.post_subject, p.post_username 
            FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt 
            WHERE p.topic_id = $topic_id 
               AND p.poster_id = u.user_id 
               AND p.post_id = pt.post_id 
            ORDER BY p.post_time ASC"; 
         if ( !($result = $db->sql_query($sql)) ) 
         { 
            message_die(GENERAL_ERROR, 'Could not get topic/post information', '', __LINE__, __FILE__, $sql); 
         } 

         //  added for fix to use with phpbb v2.04 
         $s_hidden_fields .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />'; 
         $s_hidden_fields .= '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" /><input type="hidden" name="mode" value="mergepost" />'; 
         $s_hidden_fields .= '<input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" />'; 
         if( ( $total_posts = $db->sql_numrows($result) ) > 0 ) 
         { 
            $postrow = $db->sql_fetchrowset($result); 

            $template->assign_vars(array( 
               'L_MERGE_TOPIC' => $lang['Merge_Topic'], 
               'L_MERGE_TOPIC_EXPLAIN' => $lang['Merge_Topic_explain'], 
               'L_AUTHOR' => $lang['Author'], 
               'L_MESSAGE' => $lang['Message'], 
               'L_SELECT' => $lang['Select'], 
               'L_MERGE_TO_FORUM' => $lang['Merge_to_forum'], 
               'L_MERGE_POST_TOPIC' => $lang['Merge_post_topic'], 
               'L_POSTED' => $lang['Posted'], 
               'L_MERGE_POSTS' => $lang['Merge_posts'], 
               'L_SUBMIT' => $lang['Submit'], 
               'L_MERGE_AFTER' => $lang['Merge_after'], 
               'L_MARK_ALL' => $lang['Mark_all'], 
               'L_UNMARK_ALL' => $lang['Unmark_all'], 
               'L_POST' => $lang['Post'], 

               'FORUM_NAME' => $forum_name, 

               'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"), 

               'S_MERGE_ACTION' => append_sid("modcp.$phpEx"), 
               'S_HIDDEN_FIELDS' => $s_hidden_fields, 
               'S_FORUM_SELECT' => make_forum_select("new_forum_id")) 
            ); 

            for($i = 0; $i < $total_posts; $i++) 
            { 
               $post_id = $postrow[$i]['post_id']; 
               $poster_id = $postrow[$i]['user_id']; 
               $poster = $postrow[$i]['username']; 

               $post_date = create_date($board_config['default_dateformat'], $postrow[$i]['post_time'], $board_config['board_timezone']); 

               $bbcode_uid = $postrow[$i]['bbcode_uid']; 
               $message = $postrow[$i]['post_text']; 
               $post_subject = ( $postrow[$i]['post_subject'] != '' ) ? $postrow[$i]['post_subject'] : $topic_title; 

               // 
               // If the board has HTML off but the post has HTML 
               // on then we process it, else leave it alone 
               // 
               if ( !$board_config['allow_html'] ) 
               { 
                  if ( $postrow[$i]['enable_html'] ) 
                  { 
                     $message = preg_replace('#(<)([\/]?.*?)(>)#is', '&\\\2&', $message); 
                  } 
               } 

               if ( $bbcode_uid != '' ) 
               { 
                  $message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message); 
               } 

               // 
               // Define censored word matches 
               // 
               $orig_word = array(); 
               $replacement_word = array(); 
               obtain_word_list($orig_word, $replacement_word); 

               if ( count($orig_word) ) 
               { 
                  $post_subject = preg_replace($orig_word, $replacement_word, $post_subject); 
                  $message = preg_replace($orig_word, $replacement_word, $message); 
               } 

               $message = make_clickable($message); 

               if ( $board_config['allow_smilies'] && $postrow[$i]['enable_smilies'] ) 
               { 
                  $message = smilies_pass($message); 
               } 

               $message = str_replace("
", '<br />', $message); 
                
               $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; 
               $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; 

               $checkbox = ( $i > 0 ) ? '<input type="checkbox" name="post_id_list[]" value="' . $post_id . '" />' : ' '; 
                
               $template->assign_block_vars('postrow', array( 
                  'ROW_COLOR' => '#' . $row_color, 
                  'ROW_CLASS' => $row_class, 
                  'POSTER_NAME' => $poster, 
                  'POST_DATE' => $post_date, 
                  'POST_SUBJECT' => $post_subject, 
                  'MESSAGE' => $message, 
                  'POST_ID' => $post_id, 
                    
                  'S_MERGE_CHECKBOX' => $checkbox) 
               ); 
            } 

            $template->pparse('merge_post_body'); 
         } 
      } 
      break; 
// 
// Merge Topic MOD - End 
// 
# 
#-----[ 尋找 ]------------------------------------------ 
# 
         'L_REPLIES' => $lang['Replies'], 
         'L_LASTPOST' => $lang['Last_Post'], 
         'L_SELECT' => $lang['Select'], 

# 
#-----[ 之後加上 ]------------------------------------------ 
# 
   'L_MERGE' => $lang['Merge'], 

# 
#-----[ 打開 ]------------------------------------------ 
# 
templates/fisubsilversh/fisubsilversh.cfg 

# 
#-----[ 尋找 ]------------------------------------------ 
# 
$images['topic_mod_move'] = "$current_template_images/topic_move.gif"; 

# 
#-----[ 之後加上]------------------------------------------ 
# 
$images['topic_mod_merge'] = "$current_template_images/topic_merge.gif"; 

# 
#-----[ 打開 ]------------------------------------------ 
# 
templates/fisubsilversh/modcp_body.tpl 

# 
#-----[ 尋找 ]------------------------------------------ 
# 
      <input type="submit" name="move" class="liteoption" value="{L_MOVE}" /> 
        

# 
#-----[ 之後加上 ]------------------------------------------ 
# 
      <input type="submit" name="mergetopic" class="liteoption" value="{L_MERGE}" /> 
        

# 
#-----[ 關比並且儲存所有檔案 ]------------------------------------------ 
# 
# EoM 



// Merge Topic MOD 
$lang['Merge'] = '合併'; 
$lang['Topics_Merged'] = '選擇的主題已被合併'; 
$lang['No_Topics_Merged'] = '主題沒有合併對象'; 
$lang['Confirm_merge_topic'] = '你確定是否合併主題呢?<br><span class=genmed>(請先選擇合併對象的主題版面,之後選擇要合併的主題)</span>'; 
$lang['Merge_to_forum'] = '合併對象主題的版面'; 
$lang['Merge_topic'] = '合併這個主題'; 

$lang['Merge_post'] = '合併這個文章到選擇的主題中'; 
$lang['Merge_after'] = '合併此主題到其他文章'; 
$lang['Merge_posts'] = '選擇合併的對象主題'; 
$lang['Mod_CP_explain'] = '在這個控制面版裡, 您可以執行多項版面管理功能. 您可以鎖定, 解除鎖定, 移動, 刪除或合併主題. 您也可以把主題設定為公告, 置頂, 或正常文章'; 
$lang['Mod_CP_merge_explain'] = '請選擇合併對象主題'; 
$lang['Merge_Topic_explain'] = '在這個控制面版裡, 您可以執行合併主題內的文章到其他主題中, 您可以選擇合併到其他文章或把其他文章合併過來'; 
$lang['Merge_post_topic'] = '合併文章到主題內'; 
$lang['Posts_Merged'] = '選擇的主題已合併'; 
~Mac
+ 關於 phpBB 使用問題請在版面發問,私人訊息提供其他不相干或是隱私的事情聯絡之用。

phpBB 官網 | 竹貓星球 | MacphpBBMOD | 我的服務
動機不明
喝咖啡的綠皮猴
喝咖啡的綠皮猴
文章: 1179
註冊時間: 2002-03-06 20:37
來自: GOP (重啟)

文章 動機不明 »

Fixed

開啟 modcp.php

找這一段\r
[php]<?php
default:
$page_title = $lang['Mod_CP'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->assign_vars(array(
'FORUM_NAME' => $forum_name,
?>[/php]


後面的
'L_MOVE' => $lang['Move'],

加上一句\r
'L_MERGE' => $lang['Merge'],


版面管理控制台 的按鈕才會有字出現!
非官方外掛問題區公告: [必看]請配合發問格式及明確主題發問(2006 02/24更新)
七點要求:
1. 發問前先搜尋,確定沒有重複後再發表
2. 主題要明確
3. 依照發問格式
4. 禁連續推文
5. 請盡量減少使用地方性語言
6. 解決問題後請修改第一篇主題,並感謝曾經幫過你的前輩們 ^^
7. 請不要將檔案內容完整貼出喔! 只要提供問題行及上下各五行就可以了
頭像
godbless
竹貓忠實會員
竹貓忠實會員
文章: 647
註冊時間: 2002-05-17 06:02
來自: 台北市南京東路4段
聯繫:

文章 godbless »

把換頁的BUG給修正了~請慢用!
外掛問題區發問格式就在這裡,請務必一定照著格式來~!
你不照著規則來,就算是也搞不清楚你的問題在哪裡!
新手問問題不是罪惡
罪惡的是自己沒有先做好本分和功課,說話的口氣也不好,再加上態度有好像我們這群人欠你多少似的~~!!
竹貓星球發問規則:
http://phpbb-tw.net/phpbb/viewtopic.php?t=16149
發問比率最高的句子翻譯:
Please ensure both the install/ and contrib/ directories are deleted
請確認install和contrib資料夾已被刪除(奇怪,翻一下英漢字典有這麼困難嗎)
主題已鎖定

回到「非官方認證外掛」