Need mod that can search topics/posts in Mod panel..

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Scam Warning
baller1234
Registered User
Posts: 129
Joined: Sat May 29, 2010 9:43 am

Re: Need mod that can search topics/posts in Mod panel..

Post by baller1234 » Fri Jul 05, 2013 7:56 pm

sorry, its the same error.. Your update works!

theallzaz
Registered User
Posts: 84
Joined: Tue Apr 16, 2013 2:41 pm

Re: Need mod that can search topics/posts in Mod panel..

Post by theallzaz » Sat Jul 06, 2013 1:18 am

AmigoJack wrote:Updated my post: open /includes/mcp/mcp_forum.php and find:
Now working! :mrgreen:

theallzaz
Registered User
Posts: 84
Joined: Tue Apr 16, 2013 2:41 pm

Re: Need mod that can search topics/posts in Mod panel..

Post by theallzaz » Sat Jul 06, 2013 1:26 am

I don't know if this is a bug or not, but if you type anything inside the searchbox, then mark any topic, and try to merge, it shows me the search results instead of the merge request!

Do you know what code I can change to fix that?

User avatar
AmigoJack
Registered User
Posts: 5588
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Need mod that can search topics/posts in Mod panel..

Post by AmigoJack » Sat Jul 06, 2013 8:12 am

It was meant to be mutual exclusive: why typing in a keyword if you already want to perfom an action? Why performing an action if you actually want to search for keywords?

If you want to change that, open /includes/mcp/mcp_forum.php and in my code find:

Code: Select all

    if( $keywords ) { 
Replace with:

Code: Select all

    if( $keywords&& !count( $topic_id_list ) ) { 
Untested.
Last edited by AmigoJack on Mon Jul 08, 2013 6:35 am, edited 1 time in total.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

theallzaz
Registered User
Posts: 84
Joined: Tue Apr 16, 2013 2:41 pm

Re: Need mod that can search topics/posts in Mod panel..

Post by theallzaz » Sun Jul 07, 2013 4:32 am

AmigoJack wrote:It was meant to be mutual exclusive: why typing in a keyword if you already want to perfom an action? Why performing an action if you actually want to search for keywords?

If you want to change that, open /includes/mcp/mcp_forum.php and in my code find:
Replace with:
Untested.
Not working. I think its a bit strange, if you select any "desired action" and you change your mind and try to do a search, the "search" button works like "submit" button. Sometimes the opposite happens. If you know how to fix this it should be great :)

But thanks anyway

User avatar
AmigoJack
Registered User
Posts: 5588
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Need mod that can search topics/posts in Mod panel..

Post by AmigoJack » Mon Jul 08, 2013 6:46 am

Updated my post. Changes are:

Open /includes/mcp/mcp_forum.php and (in my code) find 2 times:

Code: Select all

    if( $keywords ) {
Change both occurances to:

Code: Select all

    if( $keywords&& request_var( 'search', '' ) ) {
Open /styles/prosilver/template/mcp_forums.html and (in my code) find:

Code: Select all

				<input class="button2" type="submit" value="{L_SEARCH}" />
Change to:

Code: Select all

				<input class="button2" type="submit" name="search" value="{L_SEARCH}" />
Open /includes/mcp/mcp_main.php and find:

Code: Select all

        $quickmod = ($mode == 'quickmod') ? true : false;
After, add:

Code: Select all

        /*** 2013-07-08 BEGIN AmigoJack
            http://www.phpbb.com/community/viewtopic.php?t=2151774 ***/
        if( request_var( 'search', '' ) ) $action= '';
        /*** 2013-07-08 END ***/
Tested it with these cases:
  1. a keyword, no checkbox ticks, no action, click "search" = search results
  2. a keyword, 2 checkbox ticks, no action, click "search" = search results
  3. a keyword, 2 checkbox ticks, action "delete", click "submit" = delete topics
  4. a keyword, 2 checkbox ticks, action "delete", click "search" = search results
Please test more cases.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

theallzaz
Registered User
Posts: 84
Joined: Tue Apr 16, 2013 2:41 pm

Re: Need mod that can search topics/posts in Mod panel..

Post by theallzaz » Tue Jul 09, 2013 5:20 pm

Working fine! Thank you :D

baller1234
Registered User
Posts: 129
Joined: Sat May 29, 2010 9:43 am

Re: Need mod that can search topics/posts in Mod panel..

Post by baller1234 » Fri Mar 21, 2014 8:19 am

Hi amigo,

Does your above fix also works for topics that are already moved and not there? Because the pagination is still there when i search for a keyword but there are no topics anymore..

greetz

User avatar
AmigoJack
Registered User
Posts: 5588
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Need mod that can search topics/posts in Mod panel..

Post by AmigoJack » Fri Mar 21, 2014 8:51 am

Shadow topics can't be found, not even with the default keyword board search.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

baller1234
Registered User
Posts: 129
Joined: Sat May 29, 2010 9:43 am

Re: Need mod that can search topics/posts in Mod panel..

Post by baller1234 » Fri Mar 21, 2014 9:20 am

Hey Amigo, i dont mean shadow topics..

Just topics that are already moved.. Your search doesnt find anything anymore (becuase i moved stuff) but the pagination is still there..

http://s30.postimg.org/qb2tnlsap/search.png

User avatar
AmigoJack
Registered User
Posts: 5588
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Need mod that can search topics/posts in Mod panel..

Post by AmigoJack » Fri Mar 21, 2014 11:38 am

Either you mean topics which are moved to another forum (then nothing remains in the original forum) or you mean shadow topics (which remain as link in the original forum). In both cases nothing can be found, as the topics do not belong to the forum in question anymore.

If your keyword search does not match any topic an error message would come up, not an "empty list". How about providing a copy of your /includes/mcp/mcp_forum.php to make sure it doesn't miss anything?
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

baller1234
Registered User
Posts: 129
Joined: Sat May 29, 2010 9:43 am

Re: Need mod that can search topics/posts in Mod panel..

Post by baller1234 » Fri Mar 21, 2014 12:10 pm

ok thanks,

here you go:

Code: Select all

<?php
/**
*
* @package mcp
* @version $Id: mcp_forum.php 10201 2009-10-03 11:35:39Z acydburn $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

/**
* MCP Forum View
*/
function mcp_forum_view($id, $mode, $action, $forum_info)
{
	global $template, $db, $user, $auth, $cache, $module;
	global $phpEx, $phpbb_root_path, $config;

	$user->add_lang(array('viewtopic', 'viewforum'));

	include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx);

	// merge_topic is the quickmod action, merge_topics is the mcp_forum action, and merge_select is the mcp_topic action
	$merge_select = ($action == 'merge_select' || $action == 'merge_topic' || $action == 'merge_topics') ? true : false;

	if ($merge_select)
	{
		// Fixes a "bug" that makes forum_view use the same ordering as topic_view
		unset($_POST['sk'], $_POST['sd'], $_REQUEST['sk'], $_REQUEST['sd']);
	}

	$forum_id			= $forum_info['forum_id'];
	$start				= request_var('start', 0);
	$topic_id_list		= request_var('topic_id_list', array(0));
	$post_id_list		= request_var('post_id_list', array(0));
	$source_topic_ids	= array(request_var('t', 0));
	$to_topic_id		= request_var('to_topic_id', 0);

	$url_extra = '';
	$url_extra .= ($forum_id) ? "&f=$forum_id" : '';
	$url_extra .= ($GLOBALS['topic_id']) ? '&t=' . $GLOBALS['topic_id'] : '';
	$url_extra .= ($GLOBALS['post_id']) ? '&p=' . $GLOBALS['post_id'] : '';
	$url_extra .= ($GLOBALS['user_id']) ? '&u=' . $GLOBALS['user_id'] : '';

	$url = append_sid("{$phpbb_root_path}mcp.$phpEx?$url_extra");

	// Resync Topics
	switch ($action)
	{
		case 'resync':
			$topic_ids = request_var('topic_id_list', array(0));
			mcp_resync_topics($topic_ids);
		break;

		case 'merge_topics':
			$source_topic_ids = $topic_id_list;
		case 'merge_topic':
			if ($to_topic_id)
			{
				merge_topics($forum_id, $source_topic_ids, $to_topic_id);
			}
		break;
	}

	$selected_ids = '';
	if (sizeof($post_id_list) && $action != 'merge_topics')
	{
		foreach ($post_id_list as $num => $post_id)
		{
			$selected_ids .= '&post_id_list[' . $num . ']=' . $post_id;
		}
	}
	else if (sizeof($topic_id_list) && $action == 'merge_topics')
	{
		foreach ($topic_id_list as $num => $topic_id)
		{
			$selected_ids .= '&topic_id_list[' . $num . ']=' . $topic_id;
		}
	}

	make_jumpbox($url . "&i=$id&action=$action&mode=$mode" . (($merge_select) ? $selected_ids : ''), $forum_id, false, 'm_', true);

	$topics_per_page = ($forum_info['forum_topics_per_page']) ? $forum_info['forum_topics_per_page'] : $config['topics_per_page'];

	$sort_days = $total = 0;
	$sort_key = $sort_dir = '';
	$sort_by_sql = $sort_order_sql = array();
	mcp_sorting('viewforum', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id);

	$forum_topics = ($total == -1) ? $forum_info['forum_topics'] : $total;
	$limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';

/*** 2012-03-04 BEGIN AmigoJack
          Search within the forum by topic title ***/
       $keywords= utf8_normalize_nfc( request_var( 'keywords', '', TRUE ) );
       $sql_where = '';  // Used with the search only
       $searchurl= $url;  // Excludes keywords and start
       if( $keywords ) {
          $user-> add_lang( 'search' );
          $search_forum= array( $forum_id );  // This forum only
          $search_child= FALSE;
          $url.= '&keywords=' . urlencode(htmlspecialchars_decode($keywords));

          // Largely taken from /search.php
          $ex_fid_ary = array_unique(array_merge(array_keys($auth->acl_getf('!f_read', true)), array_keys($auth->acl_getf('!f_search', true))));

          $not_in_fid = (sizeof($ex_fid_ary)) ? 'WHERE ' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . " OR (f.forum_password <> '' AND fa.user_id <> " . (int) $user->data['user_id'] . ')' : "";

          $sql = 'SELECT f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.right_id, f.forum_password, f.forum_flags, fa.user_id
             FROM ' . FORUMS_TABLE . ' f
             LEFT JOIN ' . FORUMS_ACCESS_TABLE . " fa ON (fa.forum_id = f.forum_id
                AND fa.session_id = '" . $db->sql_escape($user->session_id) . "')
             $not_in_fid
             ORDER BY f.left_id";
          $result = $db->sql_query($sql);

          $right_id = 0;
          $reset_search_forum = true;
          while ($row = $db->sql_fetchrow($result))
          {
             if ($row['forum_password'] && $row['user_id'] != $user->data['user_id'])
             {
                $ex_fid_ary[] = (int) $row['forum_id'];
                continue;
             }

             if (sizeof($search_forum))
             {
                if ($search_child)
                {
                   if (in_array($row['forum_id'], $search_forum) && $row['right_id'] > $right_id)
                   {
                      $right_id = (int) $row['right_id'];
                   }
                   else if ($row['right_id'] < $right_id)
                   {
                      continue;
                   }
                }

                if (!in_array($row['forum_id'], $search_forum))
                {
                   $ex_fid_ary[] = (int) $row['forum_id'];
                   $reset_search_forum = false;
                }
             }
          }
          $db->sql_freeresult($result);

          // find out in which forums the user is allowed to view approved posts
          if ($auth->acl_get('m_approve'))
          {
             $m_approve_fid_ary = array(-1);
             $m_approve_fid_sql = '';
          }
          else if ($auth->acl_getf_global('m_approve'))
          {
             $m_approve_fid_ary = array_diff(array_keys($auth->acl_getf('!m_approve', true)), $ex_fid_ary);
             $m_approve_fid_sql = ' AND (p.post_approved = 1' . ((sizeof($m_approve_fid_ary)) ? ' OR ' . $db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) : '') . ')';
          }
          else
          {
             $m_approve_fid_ary = array();
             $m_approve_fid_sql = ' AND p.post_approved = 1';
          }

          if ($reset_search_forum)
          {
             $search_forum = array();
          }

          // Select which method we'll use to obtain the post_id or topic_id information
          $search_type = basename($config['search_type']);

          if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx))
          {
             trigger_error('NO_SUCH_SEARCH_MODULE');
          }

          require("{$phpbb_root_path}includes/search/$search_type.$phpEx");

          // We do some additional checks in the module to ensure it can actually be utilised
          $error = false;
          $search = new $search_type($error);

          if ($error)
          {
             trigger_error($error);
          }

          // let the search module split up the keywords
          if ($keywords)
          {
             $correct_query = $search->split_keywords($keywords, 'all'); 
             if (!$correct_query || (empty($search->search_query) && !sizeof($author_id_ary) && !$search_id))
             {
                $ignored = (sizeof($search->common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $search->common_words)) . '<br />' : '';
                trigger_error($ignored . sprintf($user->lang['NO_KEYWORDS'], $search->word_length['min'], $search->word_length['max']));
             }
          }

          sort($ex_fid_ary);
          sort($m_approve_fid_ary);


          $forum_topics= $search-> keyword_search
          ( 'topics'
          , 'titleonly'  // Or 'firstpost' for post text also
          , 'all'
          , $sort_by_sql
          , $sort_key
          , $sort_dir
          , $sort_days
          , $ex_fid_ary
          , $m_approve_fid_ary
          , 0
          , array()
          , ''
          , $id_ary
          , $start
          , $topics_per_page
          );


          // For some searches we need to print out the "no results" page directly to allow re-sorting/refining the search options.
          if (!sizeof($id_ary))
          {
             trigger_error('NO_SEARCH_RESULTS');
          }

          if (sizeof($id_ary))
          {
             $sql_where .= 'AND '. $db->sql_in_set( 't.topic_id', $id_ary);
             $sql_where .= (sizeof($ex_fid_ary)) ? ' AND (' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) . ' OR t.forum_id IS NULL)' : '';
             $sql_where .= str_replace(array('p.post_approved', 'p.forum_id'), array('t.topic_approved', 't.forum_id'), $m_approve_fid_sql );
          }
       }
       /*** 2012-03-04 END ***/



	$template->assign_vars(array(
		'ACTION'				=> $action,
		'FORUM_NAME'			=> $forum_info['forum_name'],
		'FORUM_DESCRIPTION'		=> generate_text_for_display($forum_info['forum_desc'], $forum_info['forum_desc_uid'], $forum_info['forum_desc_bitfield'], $forum_info['forum_desc_options']),

		'REPORTED_IMG'			=> $user->img('icon_topic_reported', 'TOPIC_REPORTED'),
		'UNAPPROVED_IMG'		=> $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'),
		'LAST_POST_IMG'			=> $user->img('icon_topic_latest', 'VIEW_LATEST_POST'),
		'NEWEST_POST_IMG'		=> $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),

		'S_CAN_REPORT'			=> $auth->acl_get('m_report', $forum_id),
		'S_CAN_DELETE'			=> $auth->acl_get('m_delete', $forum_id),
		'S_CAN_MERGE'			=> $auth->acl_get('m_merge', $forum_id),
		'S_CAN_MOVE'			=> $auth->acl_get('m_move', $forum_id),
		'S_CAN_FORK'			=> $auth->acl_get('m_', $forum_id),
		'S_CAN_LOCK'			=> $auth->acl_get('m_lock', $forum_id),
		'S_CAN_SYNC'			=> $auth->acl_get('m_', $forum_id),
		'S_CAN_APPROVE'			=> $auth->acl_get('m_approve', $forum_id),
		'S_MERGE_SELECT'		=> ($merge_select) ? true : false,
		'S_CAN_MAKE_NORMAL'		=> $auth->acl_gets('f_sticky', 'f_announce', $forum_id),
		'S_CAN_MAKE_STICKY'		=> $auth->acl_get('f_sticky', $forum_id),
		'S_CAN_MAKE_ANNOUNCE'	=> $auth->acl_get('f_announce', $forum_id),

		'U_VIEW_FORUM'			=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
		'U_VIEW_FORUM_LOGS'		=> ($auth->acl_gets('a_', 'm_', $forum_id) && $module->loaded('logs')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=logs&mode=forum_logs&f=' . $forum_id) : '',

		'S_MCP_ACTION'			=> $url . "&i=$id&forum_action=$action&mode=$mode&start=$start" . (($merge_select) ? $selected_ids : ''),

/*** 2012-03-04 BEGIN AmigoJack
                Search within the forum by topic title ***/
            'S_MCP_SEARCHACTION'            => $searchurl . "&i=$id&forum_action=$action&mode=$mode",
            /*** 2012-03-04 END ***/ 


		'PAGINATION'			=> generate_pagination($url . "&i=$id&action=$action&mode=$mode&sd=$sort_dir&sk=$sort_key&st=$sort_days" . (($merge_select) ? $selected_ids : ''), $forum_topics, $topics_per_page, $start),
		'PAGE_NUMBER'			=> on_page($forum_topics, $topics_per_page, $start),
		'TOTAL_TOPICS'			=> ($forum_topics == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $forum_topics),
	));

	// Grab icons
	$icons = $cache->obtain_icons();

	$topic_rows = array();

	if ($config['load_db_lastread'])
	{
		$read_tracking_join = ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id'] . ')';
		$read_tracking_select = ', tt.mark_time';
	}
	else
	{
		$read_tracking_join = $read_tracking_select = '';
	}

/*** 2012-03-04 BEGIN AmigoJack
            Search within the forum by topic title ***/
        if( $keywords ) {
            $sql = "SELECT t.topic_id
                FROM " . TOPICS_TABLE . " t
                WHERE t.forum_id IN($forum_id, 0)
                    " . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . "
                    $sql_where
                    $limit_time_sql
                ORDER BY t.topic_type DESC, $sort_order_sql";
            $result = $db->sql_query($sql);
        } else {
        /*** 2012-03-04 END ***/ 



	$sql = "SELECT t.topic_id
		FROM " . TOPICS_TABLE . " t
		WHERE t.forum_id IN($forum_id, 0)
			" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . "
			$limit_time_sql
		ORDER BY t.topic_type DESC, $sort_order_sql";
	$result = $db->sql_query_limit($sql, $topics_per_page, $start);
/*** 2012-03-04 BEGIN AmigoJack
            Search within the forum by topic title ***/
        }
        /*** 2012-03-04 END ***/ 

	$topic_list = $topic_tracking_info = array();

	while ($row = $db->sql_fetchrow($result))
	{
		$topic_list[] = $row['topic_id'];
	}
	$db->sql_freeresult($result);

	$sql = "SELECT t.*$read_tracking_select
		FROM " . TOPICS_TABLE . " t $read_tracking_join
		WHERE " . $db->sql_in_set('t.topic_id', $topic_list, false, true);

	$result = $db->sql_query($sql);
	while ($row = $db->sql_fetchrow($result))
	{
		$topic_rows[$row['topic_id']] = $row;
	}
	$db->sql_freeresult($result);

	// If there is more than one page, but we have no topic list, then the start parameter is... erm... out of sync
	if (!sizeof($topic_list) && $forum_topics && $start > 0)
	{
		redirect($url . "&i=$id&action=$action&mode=$mode");
	}

	// Get topic tracking info
	if (sizeof($topic_list))
	{
		if ($config['load_db_lastread'])
		{
			$topic_tracking_info = get_topic_tracking($forum_id, $topic_list, $topic_rows, array($forum_id => $forum_info['mark_time']), array());
		}
		else
		{
			$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_list, array());
		}
	}

	foreach ($topic_list as $topic_id)
	{
		$topic_title = '';

		$row = &$topic_rows[$topic_id];

		$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];

		if ($row['topic_status'] == ITEM_MOVED)
		{
			$unread_topic = false;
		}
		else
		{
			$unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
		}

		// Get folder img, topic status/type related information
		$folder_img = $folder_alt = $topic_type = '';
		topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);

		$topic_title = censor_text($row['topic_title']);

		$topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;
		$posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;
		$u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? $url . '&i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . '&t=' . $row['topic_id'] : '';

		$topic_row = array(
			'ATTACH_ICON_IMG'		=> ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
			'TOPIC_FOLDER_IMG'		=> $user->img($folder_img, $folder_alt),
			'TOPIC_FOLDER_IMG_SRC'	=> $user->img($folder_img, $folder_alt, false, '', 'src'),
			'TOPIC_ICON_IMG'		=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
			'TOPIC_ICON_IMG_WIDTH'	=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
			'TOPIC_ICON_IMG_HEIGHT'	=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
			'UNAPPROVED_IMG'		=> ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',

			'TOPIC_AUTHOR'				=> get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
			'TOPIC_AUTHOR_COLOUR'		=> get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
			'TOPIC_AUTHOR_FULL'			=> get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
			'U_TOPIC_AUTHOR'			=> get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),

			'LAST_POST_AUTHOR'			=> get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
			'LAST_POST_AUTHOR_COLOUR'	=> get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
			'LAST_POST_AUTHOR_FULL'		=> get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
			'U_LAST_POST_AUTHOR'		=> get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),

			'TOPIC_TYPE'		=> $topic_type,
			'TOPIC_TITLE'		=> $topic_title,
			'REPLIES'			=> ($auth->acl_get('m_approve', $row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies'],
			'LAST_POST_TIME'	=> $user->format_date($row['topic_last_post_time']),
			'FIRST_POST_TIME'	=> $user->format_date($row['topic_time']),
			'LAST_POST_SUBJECT'	=> $row['topic_last_post_subject'],
			'LAST_VIEW_TIME'	=> $user->format_date($row['topic_last_view_time']),

			'S_TOPIC_REPORTED'		=> (!empty($row['topic_reported']) && empty($row['topic_moved_id']) && $auth->acl_get('m_report', $row['forum_id'])) ? true : false,
			'S_TOPIC_UNAPPROVED'	=> $topic_unapproved,
			'S_POSTS_UNAPPROVED'	=> $posts_unapproved,
			'S_UNREAD_TOPIC'		=> $unread_topic,
		);

		if ($row['topic_status'] == ITEM_MOVED)
		{
			$topic_row = array_merge($topic_row, array(
				'U_VIEW_TOPIC'		=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_moved_id']}"),
				'U_DELETE_TOPIC'	=> ($auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&f=$forum_id&topic_id_list[]={$row['topic_id']}&mode=forum_view&action=delete_topic") : '',
				'S_MOVED_TOPIC'		=> true,
				'TOPIC_ID'			=> $row['topic_moved_id'],
			));
		}
		else
		{
			if ($action == 'merge_topic' || $action == 'merge_topics')
			{
				$u_select_topic = $url . "&i=$id&mode=forum_view&action=$action&to_topic_id=" . $row['topic_id'] . $selected_ids;
			}
			else
			{
				$u_select_topic = $url . "&i=$id&mode=topic_view&action=merge&to_topic_id=" . $row['topic_id'] . $selected_ids;
			}
			$topic_row = array_merge($topic_row, array(
				'U_VIEW_TOPIC'		=> append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&f=$forum_id&t={$row['topic_id']}&mode=topic_view"),

				'S_SELECT_TOPIC'	=> ($merge_select && !in_array($row['topic_id'], $source_topic_ids)) ? true : false,
				'U_SELECT_TOPIC'	=> $u_select_topic,
				'U_MCP_QUEUE'		=> $u_mcp_queue,
				'U_MCP_REPORT'		=> ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=topic_view&t=' . $row['topic_id'] . '&action=reports') : '',
				'TOPIC_ID'			=> $row['topic_id'],
				'S_TOPIC_CHECKED'	=> ($topic_id_list && in_array($row['topic_id'], $topic_id_list)) ? true : false,
			));
		}

		$template->assign_block_vars('topicrow', $topic_row);
	}
	unset($topic_rows);
}

/**
* Resync topics
*/
function mcp_resync_topics($topic_ids)
{
	global $auth, $db, $template, $phpEx, $user, $phpbb_root_path;

	if (!sizeof($topic_ids))
	{
		trigger_error('NO_TOPIC_SELECTED');
	}

	if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_')))
	{
		return;
	}

	// Sync everything and perform extra checks separately
	sync('topic_reported', 'topic_id', $topic_ids, false, true);
	sync('topic_attachment', 'topic_id', $topic_ids, false, true);
	sync('topic', 'topic_id', $topic_ids, true, false);

	$sql = 'SELECT topic_id, forum_id, topic_title
		FROM ' . TOPICS_TABLE . '
		WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
	$result = $db->sql_query($sql);

	// Log this action
	while ($row = $db->sql_fetchrow($result))
	{
		add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_TOPIC_RESYNC', $row['topic_title']);
	}
	$db->sql_freeresult($result);

	$msg = (sizeof($topic_ids) == 1) ? $user->lang['TOPIC_RESYNC_SUCCESS'] : $user->lang['TOPICS_RESYNC_SUCCESS'];

	$redirect = request_var('redirect', $user->data['session_page']);

	meta_refresh(3, $redirect);
	trigger_error($msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));

	return;
}

/**
* Merge selected topics into selected topic
*/
function merge_topics($forum_id, $topic_ids, $to_topic_id)
{
	global $db, $template, $user, $phpEx, $phpbb_root_path, $auth;

	if (!sizeof($topic_ids))
	{
		$template->assign_var('MESSAGE', $user->lang['NO_TOPIC_SELECTED']);
		return;
	}
	if (!$to_topic_id)
	{
		$template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
		return;
	}

	$topic_data = get_topic_data(array($to_topic_id), 'm_merge');

	if (!sizeof($topic_data))
	{
		$template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
		return;
	}

	$topic_data = $topic_data[$to_topic_id];

	$post_id_list	= request_var('post_id_list', array(0));
	$start			= request_var('start', 0);

	if (!sizeof($post_id_list) && sizeof($topic_ids))
	{
		$sql = 'SELECT post_id
			FROM ' . POSTS_TABLE . '
			WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
		$result = $db->sql_query($sql);

		$post_id_list = array();
		while ($row = $db->sql_fetchrow($result))
		{
			$post_id_list[] = $row['post_id'];
		}
		$db->sql_freeresult($result);
	}

	if (!sizeof($post_id_list))
	{
		$template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']);
		return;
	}

	if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_merge')))
	{
		return;
	}

	$redirect = request_var('redirect', build_url(array('quickmod')));

	$s_hidden_fields = build_hidden_fields(array(
		'i'				=> 'main',
		'f'				=> $forum_id,
		'post_id_list'	=> $post_id_list,
		'to_topic_id'	=> $to_topic_id,
		'mode'			=> 'forum_view',
		'action'		=> 'merge_topics',
		'start'			=> $start,
		'redirect'		=> $redirect,
		'topic_id_list'	=> $topic_ids)
	);
	$success_msg = $return_link = '';

	if (confirm_box(true))
	{
		$to_forum_id = $topic_data['forum_id'];

		move_posts($post_id_list, $to_topic_id);
		add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $topic_data['topic_title']);

		// Message and return links
		$success_msg = 'POSTS_MERGED_SUCCESS';

		if (!function_exists('phpbb_update_rows_avoiding_duplicates_notify_status'))
		{
			include($phpbb_root_path . 'includes/functions_database_helper.' . $phpEx);
		}

		// Update the topic watch table.
		phpbb_update_rows_avoiding_duplicates_notify_status($db, TOPICS_WATCH_TABLE, 'topic_id', $topic_ids, $to_topic_id);

		// Update the bookmarks table.
		phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', $topic_ids, $to_topic_id);

		// Link to the new topic
		$return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>');
	}
	else
	{
		confirm_box(false, 'MERGE_TOPICS', $s_hidden_fields);
	}

	$redirect = request_var('redirect', "index.$phpEx");
	$redirect = reapply_sid($redirect);

	if (!$success_msg)
	{
		return;
	}
	else
	{
		meta_refresh(3, append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$to_forum_id&t=$to_topic_id"));
		trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link);
	}
}

?>

User avatar
AmigoJack
Registered User
Posts: 5588
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Need mod that can search topics/posts in Mod panel..

Post by AmigoJack » Fri Mar 21, 2014 12:57 pm

  1. You didn't notice the new line I was mentioning.
  2. Did you move all the topics quite recently? Because search results are cached for a given time, which can result in what you have and that's the only explanation I have. Otherwise please describe APAP what you did to get this behaviour.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

baller1234
Registered User
Posts: 129
Joined: Sat May 29, 2010 9:43 am

Re: Need mod that can search topics/posts in Mod panel..

Post by baller1234 » Fri Mar 21, 2014 6:09 pm

yes, i did moved them recently.. i think you are right about that.

baller1234
Registered User
Posts: 129
Joined: Sat May 29, 2010 9:43 am

Re: Need mod that can search topics/posts in Mod panel..

Post by baller1234 » Fri Mar 21, 2014 6:25 pm

Weird problem, the pagination is still there even when the topics are moved this morning.. I removed the cache to see if that would make any difference but that is not the case.

Locked

Return to “[3.0.x] MOD Requests”