Version 3.4.5

This commit is contained in:
Neo committed 2025-12-19 00:38:12 -08:00
1 parent fb6b5baabc
commit e4478369d8
1360 files changed
+228921 -179445

No files matched your search

@@ -2,18 +2,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Moderator actions
* Last Updated: $Date: 2012-07-03 11:43:57 -0400 (Tue, 03 Jul 2012) $
* Last Updated: $Date: 2013-05-01 17:35:09 -0400 (Wed, 01 May 2013) $
* </pre>
*
* @author $Author: AndyMillne $
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 11027 $
* @version $Revision: 12211 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -113,7 +113,7 @@ class public_forums_moderate_moderate extends ipsCommand
//-----------------------------------------
// Convert the code ID's into something
// use mere mortals can understand....
// us mere mortals can understand....
//-----------------------------------------
switch ( $this->request['do'] )
@@ -283,7 +283,7 @@ class public_forums_moderate_moderate extends ipsCommand
$archiveRestore->setManualUnarchive( $this->topic['tid'] );
/* Back to topic, then? */
$this->registry->output->silentRedirect( $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . '&st=' . intval( $this->request['st'] ), $this->topic['title_seo'], "showtopic" );
$this->registry->output->silentRedirect( $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . '&page=' . intval( $this->request['page'] ), $this->topic['title_seo'], "showtopic" );
}
/**
@@ -374,7 +374,7 @@ class public_forums_moderate_moderate extends ipsCommand
}
/* Done */
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_posts'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . '&amp;st=' . intval($this->request['st']), $this->topic['title_seo'], 'showtopic' );
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_posts'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . '&amp;page=' . intval( $this->request['page'] ), $this->topic['title_seo'], 'showtopic' );
}
}
@@ -529,7 +529,7 @@ class public_forums_moderate_moderate extends ipsCommand
/* Done */
$url = "showforum=" . $this->forum['id'];
$url = ( $this->request['st'] ) ? "showforum=" . $this->forum['id'] . '&amp;st=' . $this->request['st'] : $url;
$url = ( $this->request['st'] ) ? "showforum=" . $this->forum['id'] . '&amp;page=' . $this->request['page'] : $url;
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_topics'], $this->settings['base_url'] . $url, $this->forum['name_seo'], 'showforum' );
}
@@ -588,8 +588,15 @@ class public_forums_moderate_moderate extends ipsCommand
$this->registry->output->redirectScreen( $this->lang->words['redirect_modified'], $this->settings['base_url'] . "app=core&amp;module=modcp&amp;fromapp=forums&amp;tab=" . $_bits[1] . 'topics' );
}
}
$this->registry->output->redirectScreen( $this->lang->words['redirect_modified'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . "&amp;st=" . intval($this->request['st']), $this->topic['title_seo'], 'showtopic' );
$url = "showtopic=".$this->topic['tid']."&amp;page=".intval($this->request['page']);
if( $this->request['from'] == 'forum' )
{
$url = "showforum=".$this->topic['forum_id']."&amp;page=".intval($this->request['page']);
}
$this->registry->output->redirectScreen( $this->lang->words['redirect_modified'], $this->settings['base_url'] . $url, $this->request['from'] == 'forum' ? $this->forum['name_seo'] : $this->topic['title_seo'], $this->request['from'] == 'forum' ? 'showforum' : 'showtopic' );
}
/**
@@ -633,11 +640,11 @@ class public_forums_moderate_moderate extends ipsCommand
$words = $this->lang->words['p_unpinned'];
}
$url = "showtopic=".$this->topic['tid']."&amp;st=".intval($this->request['st']);
$url = "showtopic=".$this->topic['tid']."&amp;page=".intval($this->request['page']);
if( $this->request['from'] == 'forum' )
{
$url = "showforum=".$this->topic['forum_id']."&amp;st=".intval($this->request['st']);
$url = "showforum=".$this->topic['forum_id']."&amp;page=".intval($this->request['page']);
}
$this->registry->output->redirectScreen( $words, $this->settings['base_url'] . $url, $this->request['from'] == 'forum' ? $this->forum['name_seo'] : $this->topic['title_seo'], $this->request['from'] == 'forum' ? 'showforum' : 'showtopic' );
@@ -733,16 +740,35 @@ class public_forums_moderate_moderate extends ipsCommand
{
if ( $this->request['nr'] )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . "findpost=" . $this->request['pid'] );
$this->registry->output->silentRedirect( $this->settings['base_url'] . "findpost=" . $this->request['pid'] . '&amp;t=' . $this->request['t'] );
}
else
{
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_posts'], $this->settings['base_url'] . "findpost=" . $this->request['pid'] );
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_posts'], $this->settings['base_url'] . "findpost=" . $this->request['pid'] . '&amp;t=' . $this->request['t'] );
}
}
else if ( $this->request['postdate'] )
{
if ( $this->request['nr'] )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . "findpost=" . $this->request['postdate'] . '&amp;t=' . $this->request['t'] );
}
else
{
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_posts'], $this->settings['base_url'] . "findpost=" . $this->request['postdate'] . '&amp;t=' . $this->request['t'] );
}
}
else if ( $this->topic['tid'] )
{
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_posts'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . '&amp;st=' . intval($this->request['st']), $this->topic['title_seo'], 'showtopic' );
{
try
{
$this->registry->getClass('topics')->autoPopulate( null, false );
}
catch( Exception $e )
{
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_posts'], $this->settings['base_url'] . "showforum=" . $this->topic['forum_id'], $this->forum['name_seo'], "showforum" );
}
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_posts'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . '&amp;page=' . intval($this->request['page']), $this->topic['title_seo'], 'showtopic' );
}
}
@@ -788,7 +814,8 @@ class public_forums_moderate_moderate extends ipsCommand
while( $row = $this->DB->fetch( $post_query ) )
{
$row['post'] = IPSText::truncate( $row['post'], 800 );
// This causes HTML to get cut off sometimes
//$row['post'] = IPSText::truncate( $row['post'], 800 );
$row['date'] = ipsRegistry::getClass( 'class_localization')->getDate( $row['post_date'], 'LONG' );
/* Parse the post */
@@ -844,6 +871,12 @@ class public_forums_moderate_moderate extends ipsCommand
$this->_multiMovePost( $this->lang->words['cmp_notopic'] );
}
if( in_array( $move_to_topic['topic_archive_status'], array( $this->registry->class_forums->fetchTopicArchiveFlag( 'working' ), $this->registry->class_forums->fetchTopicArchiveFlag( 'archived' ), $this->registry->class_forums->fetchTopicArchiveFlag( 'restore' ) ) ) )
{
$this->request[ 'checked'] = 0 ;
$this->_multiMovePost( $this->lang->words['cmp_archived_topic'] );
}
$affected_ids = count( $this->pids );
//-----------------------------------------
@@ -1316,7 +1349,7 @@ class public_forums_moderate_moderate extends ipsCommand
if( $first_post['queued'] )
{
$topic_approved = 0;
$topic_approved = ( $first_post['queued'] == ipsRegistry::getClass('class_forums')->fetchPostHiddenFlag( 'hidden' ) ) ? ipsRegistry::getClass('class_forums')->fetchTopicHiddenFlag( 'queued' ) : ipsRegistry::getClass('class_forums')->fetchTopicHiddenFlag( 'sdeleted' );
$this->DB->update( 'posts', array( 'queued' => 0 ), 'pid=' . $first_post['pid'] );
}
@@ -1329,7 +1362,7 @@ class public_forums_moderate_moderate extends ipsCommand
{
if( function_exists('mb_convert_case') )
{
if( in_array( strtolower( $this->settings['gb_char_set'] ), array_map( 'strtolower', mb_list_encodings() ) ) )
if( in_array( mb_strtolower( $this->settings['gb_char_set'] ), array_map( 'mb_strtolower', mb_list_encodings() ) ) )
{
$this->request['title'] = mb_convert_case( $this->request['title'], MB_CASE_TITLE, $this->settings['gb_char_set'] );
}
@@ -1364,6 +1397,14 @@ class public_forums_moderate_moderate extends ipsCommand
) );
$new_topic_id = $this->DB->getInsertId();
//-----------------------------------------
// Add to delete log if we've hidden the new topic
//-----------------------------------------
if ( $topic_approved == ipsRegistry::getClass('class_forums')->fetchTopicHiddenFlag( 'sdeleted' ) ) {
IPSDeleteLog::addEntry( $new_topic_id, 'topic', '', $this->memberData );
}
//-----------------------------------------
// Move the posts
@@ -1425,7 +1466,7 @@ class public_forums_moderate_moderate extends ipsCommand
{
$this->_resetModerator( $this->topic['forum_id'] );
$this->_genericPermissionCheck( 'delete_post' );
$this->_genericPermissionCheck( 'split_merge' );
if ( count( $this->pids ) < 2 )
{
@@ -1688,6 +1729,15 @@ class public_forums_moderate_moderate extends ipsCommand
$this->DB->delete( 'posts', 'pid IN(' . implode( ",", $post_to_delete ) . ')' );
IPSDeleteLog::removeEntries( $post_to_delete, 'post', TRUE );
/* Handle Rep */
$this->DB->delete( 'reputation_cache' , "app='forums' AND type='pid' AND type_id IN(" . implode( ",", $post_to_delete ) . ")" );
$this->DB->delete( 'reputation_index' , "app='forums' AND type='pid' AND type_id IN(" . implode( ",", $post_to_delete ) . ")" );
foreach( $post_to_delete as $post )
{
$this->DB->delete( 'reputation_totals', "rt_key=MD5('forums;pid;" . $post . "') AND rt_type_id=" . $post );
}
}
foreach( $topics as $t )
@@ -1766,7 +1816,7 @@ class public_forums_moderate_moderate extends ipsCommand
$this->_addModeratorLog( $this->lang->words['acp_locked_topic'] );
$this->registry->output->redirectScreen( $this->lang->words['p_closed'], $this->settings['base_url'] . "showforum=".$this->forum['id'] . ( $this->request['_from'] == 'forum' ? '&st=' . intval( $this->request['st'] ) : '' ), $this->forum['name_seo'], "showforum" );
$this->registry->output->redirectScreen( $this->lang->words['p_closed'], $this->settings['base_url'] . "showforum=".$this->forum['id'] . ( $this->request['_from'] == 'forum' ? '&page=' . intval( $this->request['page'] ) : '' ), $this->forum['name_seo'], "showforum" );
}
/**
@@ -1797,7 +1847,7 @@ class public_forums_moderate_moderate extends ipsCommand
$this->modLibrary->topicToggleSoftDelete( array( $this->topic['tid'] ), $delete, $reason );
$this->registry->output->redirectScreen( $this->lang->words[ $lang ], $this->settings['base_url'] . "showforum=" . $this->forum['id'] . '&st=' . intval( $this->request['st'] ), $this->forum['name_seo'], 'showforum' );
$this->registry->output->redirectScreen( $this->lang->words[ $lang ], $this->settings['base_url'] . "showforum=" . $this->forum['id'] . '&page=' . intval( $this->request['page'] ), $this->forum['name_seo'], 'showforum' );
}
/**
@@ -1843,7 +1893,7 @@ class public_forums_moderate_moderate extends ipsCommand
}
}
$this->registry->output->redirectScreen( $this->lang->words['p_deleted'], $this->settings['base_url'] . "showforum=" . $this->forum['id'] . '&st=' . intval( $this->request['st'] ), $this->forum['name_seo'], 'showforum' );
$this->registry->output->redirectScreen( $this->lang->words['p_deleted'], $this->settings['base_url'] . "showforum=" . $this->forum['id'], $this->forum['name_seo'], 'showforum' );
}
/**
@@ -1889,7 +1939,7 @@ class public_forums_moderate_moderate extends ipsCommand
}
}
$this->registry->output->redirectScreen( $this->lang->words['p_deleted'], $this->settings['base_url'] . "showforum=" . $this->forum['id'] . '&st=' . intval( $this->request['st'] ), $this->forum['name_seo'], 'showforum' );
$this->registry->output->redirectScreen( $this->lang->words['p_deleted'], $this->settings['base_url'] . "showforum=" . $this->forum['id'] . '&page=' . intval( $this->request['page'] ), $this->forum['name_seo'], 'showforum' );
}
/**
@@ -2109,7 +2159,7 @@ class public_forums_moderate_moderate extends ipsCommand
$_like = classes_like::bootstrap( 'forums', 'topics' );
$_like->remove( $this->topic['tid'] );
$this->registry->output->redirectScreen( $this->lang->words['ts_redirect'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . "&amp;st=" . intval($this->request['st']), $this->topic['title_seo'], 'showtopic' );
$this->registry->output->redirectScreen( $this->lang->words['ts_redirect'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . "&amp;page=" . intval($this->request['page']), $this->topic['title_seo'], 'showtopic' );
}
/**
@@ -2306,23 +2356,19 @@ class public_forums_moderate_moderate extends ipsCommand
$this->DB->update( 'attachments', array( 'attach_parent_id' => $this->topic['tid'] ), "attach_rel_module='post' AND attach_parent_id=" . $old_topic['tid'] );
//-----------------------------------------
// Get like class
// Update followers
//-----------------------------------------
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
$_like = classes_like::bootstrap( 'forums', 'topics' );
$_like->remove( $old_topic['tid'] );
$_like = classes_like::bootstrap( 'forums', 'topics' );
$_like->merge( $old_topic['tid'], $this->topic['tid'] );
//-----------------------------------------
// Tags
//-----------------------------------------
$this->registry->tags->moveTagsByMetaId( $old_topic['tid'], $this->topic['tid'] );
// Resync to remove duplicate tags - see bug report 34475
$tags = $this->registry->tags->getTagsByMetaId( $this->topic['tid'] );
$this->registry->tags->replace( $tags['tags'], array( 'meta_id' => $this->topic['tid'] ) );
//-----------------------------------------
// Update the newly merged topic
//-----------------------------------------
@@ -2566,8 +2612,27 @@ class public_forums_moderate_moderate extends ipsCommand
$this->registry->output->redirectScreen( $this->lang->words['post_deleted'], $this->settings['base_url'] . "app=core&amp;module=modcp&amp;fromapp=forums&amp;tab=" . $_bits[1] . 'posts' );
}
}
//-----------------------------------------
// Where are we going?
//-----------------------------------------
$this->registry->output->redirectScreen( $this->lang->words['post_deleted'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . "&amp;st=" . intval($this->request['st']), $this->topic['title_seo'], 'showtopic' );
$posts = $this->registry->getClass('topics')->getPosts( array( 'topicId' => $this->topic['tid'],
'limit' => 1,
'skipForumCheck' => true,
'dateIsLess' => $post['post_date'],
'onlyViewable' => true,
'onlyVisible' => true,
'notIgnored' => true,
'parse' => false,
'getCount' => false,
'sortField' => 'date',
'sortOrder' => 'desc' ) );
$redirectPost = array_keys($posts);
$redirectPage = $this->registry->getClass('topics')->postToPage( $redirectPost[0] );
$this->registry->output->redirectScreen( $this->lang->words['post_deleted'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . "&amp;page=" . intval($redirectPage) . '#entry' . $redirectPost[0], $this->topic['title_seo'], 'showtopic' );
}
/**
@@ -2620,23 +2685,23 @@ class public_forums_moderate_moderate extends ipsCommand
$this->request['TopicTitle'] = $_postClass->cleanTopicTitle( $this->request['TopicTitle'] );
$this->request['TopicTitle'] = trim( IPSText::getTextClass( 'bbcode' )->stripBadWords( $this->request['TopicTitle'] ) );
if( $this->settings['etfilter_shout'] )
{
if( function_exists('mb_convert_case') )
{
if( in_array( strtolower( $this->settings['gb_char_set'] ), array_map( 'strtolower', mb_list_encodings() ) ) )
{
$this->request['TopicTitle'] = mb_convert_case( $this->request['TopicTitle'], MB_CASE_TITLE, $this->settings['gb_char_set'] );
}
else
{
$this->request['TopicTitle'] = ucwords( strtolower( $this->request['TopicTitle'] ) );
}
}
else
{
$this->request['TopicTitle'] = ucwords( strtolower( $this->request['TopicTitle'] ) );
}
if( $this->settings['etfilter_shout'] )
{
if( function_exists('mb_convert_case') )
{
if( in_array( strtolower( $this->settings['gb_char_set'] ), array_map( 'strtolower', mb_list_encodings() ) ) )
{
$this->request['TopicTitle'] = mb_convert_case( $this->request['TopicTitle'], MB_CASE_TITLE, $this->settings['gb_char_set'] );
}
else
{
$this->request['TopicTitle'] = ucwords( strtolower( $this->request['TopicTitle'] ) );
}
}
else
{
$this->request['TopicTitle'] = ucwords( strtolower( $this->request['TopicTitle'] ) );
}
}
$this->request['TopicDesc'] = trim( IPSText::getTextClass( 'bbcode' )->stripBadWords( $this->request['TopicDesc'] ) );
@@ -2679,7 +2744,7 @@ class public_forums_moderate_moderate extends ipsCommand
$this->_addModeratorLog( $this->lang->words['acp_opened_topic'] );
$_st = '&st=' . intval( $this->request['st'] );
$_st = '&page=' . intval( $this->request['page'] );
if( $this->request['_fromTopic'] )
{
@@ -3189,7 +3254,7 @@ class public_forums_moderate_moderate extends ipsCommand
else if ( $this->forum['id'] )
{
$url = "showforum=" . $this->forum['id'];
$url = ( $this->request['st'] ) ? "showforum=" . $this->forum['id'] . '&amp;st=' . $this->request['st'] : $url;
$url = ( $this->request['st'] ) ? "showforum=" . $this->forum['id'] . '&amp;page=' . $this->request['page'] : $url;
if ( $this->request['nr'] )
{
@@ -3382,18 +3447,31 @@ class public_forums_moderate_moderate extends ipsCommand
$this->DB->update( 'posts', array( 'queued' => 1 ), 'topic_id IN (' . implode( ",", $unapproved ) . ")" );
}
$this->DB->update( 'posts', array( 'topic_id' => $main_topic_id ), 'topic_id IN (' . implode( ",", $merge_ids ) . ")" );
$this->DB->update( 'posts', array( 'topic_id' => $main_topic_id, 'new_topic' => 0 ), 'topic_id IN (' . implode( ",", $merge_ids ) . ")" );
$this->DB->update( 'topics', array( 'views' => $newViews ), 'tid=' . $main_topic_id );
/* @Link http://community.invisionpower.com/resources/bugs.html/_/ip-board/merging-topics-does-not-update-attach-parent-id-for-attachments-r41886 */
$this->DB->update( 'attachments', array( 'attach_parent_id' => $main_topic_id ), 'attach_parent_id IN(' . implode( ",", $merge_ids ) . ") AND attach_rel_module='post'" );
$this->DB->delete( 'voters', "tid IN (" . implode( ",", $merge_ids ) . ")" );
$this->DB->delete( 'topics', "tid IN (" . implode( ",", $merge_ids ) . ")" );
/* Bug #38221: Set the new first post in topic */
$first_post = $this->DB->buildAndFetch( array( 'select' => 'pid', 'from' => 'posts', 'where' => "topic_id={$main_topic_id}", 'order' => "pid ASC", 'limit' => array(0,1) ) );
$this->DB->update( 'posts', array( 'new_topic' => 1 ), 'pid = ' . $first_post['pid'] );
//-----------------------------------------
// Get like class
// Update followers
//-----------------------------------------
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
$_like = classes_like::bootstrap( 'forums', 'topics' );
$_like->remove( $merge_ids );
$_like = classes_like::bootstrap( 'forums', 'topics' );
foreach ( $merge_ids as $mid )
{
$_like->merge( $mid, $main_topic_id );
}
//-----------------------------------------
// Remove from delete log
@@ -3414,9 +3492,6 @@ class public_forums_moderate_moderate extends ipsCommand
/* Tags */
$this->registry->tags->moveTagsByMetaId( $tids, $main_topic_id );
/* Make read */
$this->registry->getClass('classItemMarking')->markRead( array( 'forumID' => $first_topic['forum_id'], 'itemID' => $main_topic_id, 'markDate' => time(), 'containerLastActivityDate' => $this->registry->class_forums->allForums[ $first_topic['forum_id'] ]['last_post'] ) );
/* Run Sync */
foreach ( $merge_ids as $mid )
{
@@ -3860,6 +3935,14 @@ class public_forums_moderate_moderate extends ipsCommand
) ),
"tid IN(" . implode( ',', $this->tids ) . ")", false, true
);
//-----------------------------------------
// Rebuild topic for SEO title
//-----------------------------------------
foreach( $this->tids as $tid )
{
$this->modLibrary->rebuildTopic( $tid );
}
}
//-----------------------------------------