[>2.0.4] Merge Topic - Themen ineinander kopieren *emc*

Du hast Probleme beim Einbau oder bei der Benutzung eines Mods? In diesem Forum bist du richtig.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
darklordi
Mitglied
Beiträge: 323
Registriert: 13.12.2004 16:26
Wohnort: Langenfeld
Kontaktdaten:

Beitrag von darklordi »

Loewenherz hat geschrieben:
Pingu625 hat geschrieben: 1. Wie kann ich mehrere Beiträge von demselben User in einem Thema zu einen Beitrag zusammenfassen?
Das ist mal wieder splitten.
das ist viel mehr Löschen und Bearbeiten von demjenigen seinen Beiträgen :P
Pingu625

Beitrag von Pingu625 »

1. Wie kann ich mehrere Beiträge von demselben User in einem Thema zu einen Beitrag zusammenfassen?

2. Wenn ich das Thema aussuchen soll, in das die Beiträge gemacht werden sollen, erscheint oben eine winzige Spalte mit der MOD_CP_explain. Wie geht die größer?
Mit 1. meine ich, dass ein User z.B. im Thema Freizeitparks 5-mal hintereinander gepostet hat:
User hat geschrieben:Hallo
User hat geschrieben:ich
User hat geschrieben:war
User hat geschrieben:im
User hat geschrieben:Holiday Park
Nun will ich aber alle 5 Beiträge zu einem zusammenfassen:
User hat geschrieben:Hallo
ich
war
im
Holiday Park
mfg Pingu
Benutzeravatar
Loewenherz
Mitglied
Beiträge: 624
Registriert: 10.02.2003 20:11
Wohnort: Saarlouis
Kontaktdaten:

Beitrag von Loewenherz »

Ach so. Dafür ist der MergeTopicMod - wie der Name schon sagt - nicht geeignet, da er verschiedene Postings zu einem Thread zusammenführt, nicht mehrere Postings zu einem Posting. Damit bist du hier leider offtopic.
Downloads für phpBB, die ich seit 2001 angeboten habe, gibt es nicht mehr - die Mitarbeit beim Übersetzer-Team von phpBB3 war mein letzter aktiver Beitrag zu phpBB, zeitlich geht leider nichts mehr. Aktuell blogge ich nur noch phasenweise auf SEO Scene.
Ceterum censeo Google esse delendam
Pingu625

Beitrag von Pingu625 »

Oh schade :(
In der MOD Suche wurde mir dieser Mod dafür empfohlen :oops:
Gibt es denn einen solchen Mod, wie ich ihn suche?

Und nochwas zu diesem Mod!:
Wenn ich das Thema aussuchen soll, in dem die Beiträge zusammengeführt werden sollen, erscheint oben eine winzige Spalte mit der MOD_CP_explain. Wie geht die größer? Man kann nämlich nichts lesen
Benutzeravatar
bgx
Mitglied
Beiträge: 228
Registriert: 30.11.2005 22:32
Kontaktdaten:

Beitrag von bgx »

Hab das Ding gerade mal für CH 2.04 angepasst. Obs in späteren Category Hierachy Mods läuft weiß ich nicht.

EDIT: Läuft auch in CH 2.05. Code angepasst, letzte Beiträge wurden nicht richtig angezeigt!

Geändert ist nur der Teil in der modcp.php

Viel Spaß damit! :grin:

Wer will setzt mir einfach nen Backlink :lol: :lol: :wink:

Hier der Code:

Code: Alles auswählen

//
// 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'];
				$fid = $HTTP_POST_VARS['new_forum'];
				if ($fid == 'Root')
				{
					$type = POST_CAT_URL;
					$new_forum_id = 0;
				}
				else
				{
					$type = substr($fid, 0, 1);
					$new_forum_id = ($type == POST_FORUM_URL) ? intval(substr($fid, 1)) : 0;
				}
				if ($new_forum_id <= 0 ) message_die(GENERAL_MESSAGE, $lang['Forum_not_exist']);

         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'];
               }
            }
   
            $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?" . 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'];
/*				$fid = $HTTP_POST_VARS['new_forum'];
				if ($fid == 'Root')
				{
					$type = POST_CAT_URL;
					$new_forum_id = 0;
				}
				else
				{
					$type = substr($fid, 0, 1);
					$new_forum_id = ($type == POST_FORUM_URL) ? intval(substr($fid, 1)) : 0;
				}
*/				//if ($new_forum_id <= 0 ) message_die(GENERAL_MESSAGE, $lang['Forum_not_exist']);
         $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('topic', $topic_id_to);
            sync('forum', $new_forum_id);
            sync('forum', $old_forum_id);
            $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' => selectbox('new_forum', $forum_id),
            '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'];
/*				$fid = $HTTP_POST_VARS['new_forum_id'];
				if ($fid == 'Root')
				{
					$type = POST_CAT_URL;
					$new_forum_id = 0;
				}
				else
				{
					$type = substr($fid, 0, 1);
					$new_forum_id = ($type == POST_FORUM_URL) ? intval(substr($fid, 1)) : 0;
				}
*/				//if ($new_forum_id <= 0 ) message_die(GENERAL_MESSAGE, $lang['Forum_not_exist']);
         $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);
         }

         $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'];
				$fid = $HTTP_POST_VARS['new_forum_id'];
				if ($fid == 'Root')
				{
					$type = POST_CAT_URL;
					$new_forum_id = 0;
				}
				else
				{
					$type = substr($fid, 0, 1);
					$new_forum_id = ($type == POST_FORUM_URL) ? intval(substr($fid, 1)) : 0;
				}
				if ($new_forum_id <= 0 ) message_die(GENERAL_MESSAGE, $lang['Forum_not_exist']);

         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?" . 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' => selectbox("new_forum_id", false, $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("\n", '<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 . '" />' : '&nbsp;';
               
               $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
//
Zuletzt geändert von bgx am 08.10.2006 22:20, insgesamt 1-mal geändert.
jello
Mitglied
Beiträge: 60
Registriert: 11.03.2003 21:31
Wohnort: L / DD / BZ, kurz: ganz Sachsen ;o)
Kontaktdaten:

Beitrag von jello »

Ich hab' n mittelschweres Problem mit der Merge Topic Mod. Sie funktioniert so weit ganz gut. In der Themen-Übersicht [viewforum.php] kann ich über den "Forum moderieren"-Link Themen zusammenfügen wie ich lustig bin.
Wenn ich jedoch in der viewtopic.php den Link zum Verschieben einiger Posts anklicke, kann ich noch die zu verschiebenden Posts auswählen, jedoch kommt nach Klick auf einen der Buttons ["die ausgewählten" oder "ab dem ausgewählten"] folgende Fehlermeldung:
Could not obtain topic information

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND t.topic_poster = u.user_id AND p.post_id = t

SELECT t.*, u.username, u.user_id, p.post_time FROM {prefix}_topics t, {prefix}_users u, {prefix}_posts p WHERE t.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 0, 25

Line : 1065
File : modcp.php
bzw. in einem zweiten von mir betreuten Forum:
Could not obtain topic information

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax near 'AND t.topic_poster = u.user_id AND p.post_id = t.topic_last_post_' at line 4

SELECT t.*, u.username, u.user_id, p.post_time FROM {prefix}_topics t, {prefix}_users u, {prefix}_posts p WHERE t.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 0, 50

Line : 1056
File : modcp.php
{prefix} ist dabei der Tabellen-Präfix für die phpBB-Tabellen.

Das erste Forum [beide in v.21] läuft mit MySQL v4.0.24; das zweite mit v3.23.58, daran kann's also wohl nicht unbedingt liegen.

Wenn ich mir die jeweils angegebene Zeile anschaue, komm' ich zu folgendem Bereich in der modcp.php:

Code: Alles auswählen

         //
         // 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);
         }
Wobei die vorletzte ["Coul not obtain..."] die angegebene Zeile ist, jedoch bezieht sich die Meldung offensichtlich auf den Bereich davor [daher mit angegeben ;)].

Ich nutz' die letzte hier verfügbare Version [also für die v.18].

Any ideas? Die Suche hat mir leider nicht geholfen, da sie für die Stichworte einfach zu viele und nicht auf diese Mod bezogene Ergebnisse liefert. :?
if you have got the right attitude, interesting problems will find you.
Eric S. Raymond, writer and hacker
Benutzeravatar
Loewenherz
Mitglied
Beiträge: 624
Registriert: 10.02.2003 20:11
Wohnort: Saarlouis
Kontaktdaten:

Beitrag von Loewenherz »

Bei mir funktioniert der Mod mit jeder Version von phpBB und bei zahlreichen verschiedenen Anbietern und Strukturen. Hast du ihn von Hand eingebaut oder die Fix & Fertig Version genommen?
Downloads für phpBB, die ich seit 2001 angeboten habe, gibt es nicht mehr - die Mitarbeit beim Übersetzer-Team von phpBB3 war mein letzter aktiver Beitrag zu phpBB, zeitlich geht leider nichts mehr. Aktuell blogge ich nur noch phasenweise auf SEO Scene.
Ceterum censeo Google esse delendam
jello
Mitglied
Beiträge: 60
Registriert: 11.03.2003 21:31
Wohnort: L / DD / BZ, kurz: ganz Sachsen ;o)
Kontaktdaten:

Beitrag von jello »

Selbst eingebaut, da noch andere Mods eingebaut sind. Wobei ich mir nicht vorstellen kann, dass es an einer anderen liegt, da eigentlich keine Änderungen an der modcp.php voraussetzt [wobei ich mir allerdings die unterschiedlichen Zeilenangaben nicht ganz erklären kann].

post scriptum: Okay, das "Problem" der unterschiedlichen Zeilenanzahl ist gelöst - hatte wohl bei einem/den Update(s) die modcp.php des zweiten Forums vergessen. Is' jetzt mit der Originalen der v.21 vom phpbb.com abgeglichen, aber der Fehler besteht leider fort.

*seufz* Manchmal isses zu einfach... hatte noch 'nen [mittlerweile muss ich sagen "angeblichen"] Fix eingebaut, der das "Invalid Session"-Problem lösen sollte. Tut er offensichtlich nicht. Ohne diesen "Fix" läuft's. Danke für's Ohr und deine Zeit. :)
if you have got the right attitude, interesting problems will find you.
Eric S. Raymond, writer and hacker
Benutzeravatar
gode4lissy
Mitglied
Beiträge: 8
Registriert: 01.11.2006 20:47
Wohnort: Recklinghausen

Beitrag von gode4lissy »

Hallo allerseits!

19 Seiten - puh! Jetzt raucht mir der Kopf und ich weiss nicht mehr, ob es noch das ist, was ich suche. Hier wird über soo viele frühere Versionen berichtet - und in der aktuellen Version ist u.a. z.B. eine Funktion "Ab gewähltem Beitrag teilen" doch schon defaultmässig drin.

Deshalb meine Frage: Bezieht sich diese ganze Diskussionsfolge hier nur auf frühere Versionen?

Oder kann ich mit dem hier beschriebenen MOD vielleicht doch erreichen, was ich suche? Nämlich dass ich in einem bestehenden Thread einzelne Beiträge markieren und an einen anderen bereits bestehenden Thread anhängen kann?

Denn mit der bereits vorhandenen Version kann ich ja nur Beiträge abtrennen, um daraus einen neuen Thread zu machen.

Ich möchte aber gerne Beiträge, die besser zu einem anderen bereits bestehenden Thema "passen", dorthin verschieben und anhängen können. Geht das mit dem hier beschriebenen MOD?

Vielen Dank.
Benutzeravatar
Loewenherz
Mitglied
Beiträge: 624
Registriert: 10.02.2003 20:11
Wohnort: Saarlouis
Kontaktdaten:

Beitrag von Loewenherz »

gode4lissy hat geschrieben:Hallo allerseits!

Ich möchte aber gerne Beiträge, die besser zu einem anderen bereits bestehenden Thema "passen", dorthin verschieben und anhängen können. Geht das mit dem hier beschriebenen MOD?
Ja.
Downloads für phpBB, die ich seit 2001 angeboten habe, gibt es nicht mehr - die Mitarbeit beim Übersetzer-Team von phpBB3 war mein letzter aktiver Beitrag zu phpBB, zeitlich geht leider nichts mehr. Aktuell blogge ich nur noch phasenweise auf SEO Scene.
Ceterum censeo Google esse delendam
Antworten

Zurück zu „phpBB 2.0: Mod Support“