Version 3.3.4

This commit is contained in:
Neo committed 2025-12-19 00:35:52 -08:00
1 parent 78706903a2
commit fb6b5baabc
2206 files changed
+409828 -382984

No files matched your search

@@ -2,18 +2,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* IP.Board v3.3.4
* Moderator actions
* Last Updated: $Date: 2011-10-11 11:50:01 -0400 (Tue, 11 Oct 2011) $
* Last Updated: $Date: 2012-07-03 11:43:57 -0400 (Tue, 03 Jul 2012) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: AndyMillne $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @version $Revision: 9597 $
* @link http://www.invisionpower.com
* @version $Revision: 11027 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -115,7 +115,7 @@ class public_forums_moderate_moderate extends ipsCommand
// Convert the code ID's into something
// use mere mortals can understand....
//-----------------------------------------
switch ( $this->request['do'] )
{
case '02':
@@ -160,7 +160,9 @@ class public_forums_moderate_moderate extends ipsCommand
case 'sundelete':
$this->_softDeleteTopicToggle(false);
break;
case 'deleteArchivedTopic':
$this->_deleteArchivedTopic();
break;
//-----------------------------------------
// Unsubscribe
//-----------------------------------------
@@ -219,15 +221,12 @@ class public_forums_moderate_moderate extends ipsCommand
// Add. topic view func.
//-----------------------------------------
case 'topic_approve':
case 'topic_restore':
$this->_topicApproveAlter('approve');
break;
case 'topic_unapprove':
$this->_topicApproveAlter('unapprove');
break;
case 'topic_restore':
$this->_topicApproveAlter('approve');
break;
/* New options for 3.1 */
case 'p_approve':
@@ -249,6 +248,10 @@ class public_forums_moderate_moderate extends ipsCommand
$this->_postsManage('hdelete_delete');
break;
case 'unArchiveTopic':
$this->_topicUnarchive();
break;
default:
$this->_showError();
break;
@@ -260,6 +263,29 @@ class public_forums_moderate_moderate extends ipsCommand
$this->registry->getClass('output')->sendOutput();
}
/**
* Flag a topic as unarchive.
* A tragically boring and mundane function written on a misty Monday morning
*/
protected function _topicUnarchive()
{
if ( ! $this->memberData['g_access_cp'] )
{
$this->_showError( 'moderate_no_permission', 103119.2, 403 );
}
/* Load up archive class */
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/archive/restore.php', 'classes_archive_restore' );
$archiveRestore = new $classToLoad();
$archiveRestore->setApp('forums');
$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" );
}
/**
* A simple wrapper function for multimethods
*
@@ -357,12 +383,16 @@ class public_forums_moderate_moderate extends ipsCommand
}
/**
* Permanently remove a hard deleted post
* Permanently remove a hard deleted post. Only available via Mod CP as of 3.3.
*
* @return @e void
*/
protected function _multiRemoveHardDeletedPost()
{
$this->_resetModerator( $this->topic['forum_id'] );
$this->_genericPermissionCheck( 'delete_post' );
$_titles = array();
$this->DB->build( array(
@@ -394,12 +424,16 @@ class public_forums_moderate_moderate extends ipsCommand
}
/**
* Restore a hard deleted post
* Restore a hard deleted post. Only available via Mod CP as of 3.3.
*
* @return @e void
*/
protected function _multiRestoreHardDeletedPost()
{
$this->_resetModerator( $this->topic['forum_id'] );
$this->_genericPermissionCheck( 'delete_post' );
$this->DB->update( 'posts', array( 'queued' => 0 ), 'pid IN(' . implode( ',', $this->pids ) . ')' );
/* Remove any soft delete logs */
@@ -430,7 +464,7 @@ class public_forums_moderate_moderate extends ipsCommand
$this->cache->rebuildCache( 'stats', 'global' );
$this->modLibrary->addModerateLog( "", "", "", implode( ',', $this->pids ), sprintf( $this->lang->words['multi_post_restore'], $this->pids ) );
$this->modLibrary->addModerateLog( "", "", "", implode( ',', $this->pids ), sprintf( $this->lang->words['multi_post_restore'], implode( ',', $this->pids ) ) );
}
/**
@@ -521,41 +555,8 @@ class public_forums_moderate_moderate extends ipsCommand
$this->DB->update( 'topics', array( 'approved' => $approve_int ), 'tid=' . $this->topic['tid'] );
if( $approve_int )
if ( $approve_int )
{
$_queued = $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible' ), 'p.' );
$this->DB->build( array(
'select' => 'p.*',
'from' => array( 'posts' => 'p' ),
'order' => 'pid ASC',
'where' => $_queued . ' AND p.topic_id=' . $this->topic['tid'],
'add_join' => array(
array(
'select' => 't.title, t.forum_id, t.topic_firstpost',
'from' => array( 'topics' => 't' ),
'where' => 'p.topic_id=t.tid',
'type' => 'left'
)
)
) );
$q = $this->DB->execute();
while( $r = $this->DB->fetch( $q ) )
{
/* The first post needs some different data */
if( $r['topic_firstpost'] == $r['pid'] )
{
$pid = 0;
$title = $r['title'];
}
else
{
$pid = serialize( array( 'pid' => $r['pid'], 'title' => $r['title'] ) );
$title = '';
}
}
$this->modLibrary->clearModQueueTable( 'topic', $this->topic['tid'], true );
/* Likes */
@@ -564,10 +565,7 @@ class public_forums_moderate_moderate extends ipsCommand
$_like->toggleVisibility( $this->topic['tid'], true );
/* Tagging */
if ( $this->registry->tags->isEnabled() )
{
$this->registry->tags->updateVisibilityByMetaId( $this->topic['tid'], 1 );
}
$this->registry->tags->updateVisibilityByMetaId( $this->topic['tid'], 1 );
/* Remove any soft delete logs if we are 'restoring' */
if( $this->request['do'] == 'topic_restore' )
@@ -667,9 +665,12 @@ class public_forums_moderate_moderate extends ipsCommand
protected function _multiPostModify()
{
$this->pids = $this->_getIds( 'selectedpids', 'selectedpidsJS' );
if ( count( $this->pids ) )
{
/* Set pids back for templates */
$this->request['selectedpids'] = $this->pids;
switch ( $this->request['tact'] )
{
case 'approve':
@@ -811,8 +812,8 @@ class public_forums_moderate_moderate extends ipsCommand
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->movePostForm( $this->forum, $this->topic, $posts, $error );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "{$this->settings['_base_url']}showforum={$this->forum['id']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->lang->words['cmp_title'].": ".$this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
$this->registry->output->addContent( $this->output );
$this->registry->getClass('output')->sendOutput();
@@ -1080,11 +1081,44 @@ class public_forums_moderate_moderate extends ipsCommand
$this->_showError( 'mod_no_posts_to_del', 10376.2 );
}
foreach( $this->pids as $p )
if ( empty( $this->topic ) )
{
if ( $this->topic['topic_firstpost'] == $p )
{
$this->_showError( 'mod_delete_first_post', 10376 );
$_pid = IPSLib::cleanIntArray( $this->pids );
if ( count($_pid) > 0 )
{
$_pid = " IN(" . implode( ",", $_pid ) . ")";
}
else
{
$this->_showError( 'mod_no_posts_to_del', 10376.3 );
}
$this->DB->build( array(
'select' => 'p.pid',
'from' => array( 'posts' => 'p' ),
'add_join' => array( array(
'select' => 't.topic_firstpost',
'from' => array( 'topics' => 't' ),
'where' => 't.tid=p.topic_id',
) ),
'where' => 'pid' . $_pid ) );
$this->DB->execute();
while( $_r = $this->DB->fetch() )
{
if ( $_r['topic_firstpost'] == $_r['pid'] )
{
$this->_showError( 'mod_delete_first_post', '10376-A' );
}
}
}
else
{
foreach( $this->pids as $p )
{
if ( $this->topic['topic_firstpost'] == $p )
{
$this->_showError( 'mod_delete_first_post', 10376 );
}
}
}
@@ -1110,13 +1144,13 @@ class public_forums_moderate_moderate extends ipsCommand
{
$this->_showError( 'mod_no_tid', 10377, 404 );
}
//-----------------------------------------
// Show the form
//-----------------------------------------
if ( $this->request['checked'] != 1 )
{
{
$jump_html = $this->registry->getClass('class_forums')->buildForumJump(0,1,1);
$posts = array();
@@ -1158,14 +1192,17 @@ class public_forums_moderate_moderate extends ipsCommand
$posts[] = $row;
}
/* Pass back for templates */
$this->request['selectedpids'] = $this->pids;
//-----------------------------------------
// print my bottom, er, the bottom
//-----------------------------------------
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->splitPostForm( $this->forum, $this->topic, $posts, $jump_html );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "{$this->settings['_base_url']}showforum={$this->forum['id']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->lang->words['st_top'].": ".$this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
$this->registry->output->addContent( $this->output );
$this->registry->getClass('output')->sendOutput();
@@ -1288,6 +1325,25 @@ class public_forums_moderate_moderate extends ipsCommand
// Complete a new dummy topic
//-----------------------------------------
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['title'] = mb_convert_case( $this->request['title'], MB_CASE_TITLE, $this->settings['gb_char_set'] );
}
else
{
$this->request['title'] = ucwords( strtolower( $this->request['title'] ) );
}
}
else
{
$this->request['title'] = ucwords( strtolower( $this->request['title'] ) );
}
}
$this->DB->insert( 'topics', array(
'title' => $this->request['title'],
'state' => 'open',
@@ -1298,7 +1354,6 @@ class public_forums_moderate_moderate extends ipsCommand
'last_poster_id' => 0,
'last_poster_name' => 0,
'last_post' => time(),
'icon_id' => 0,
'author_mode' => 1,
'poll_state' => 0,
'last_vote' => 0,
@@ -1352,7 +1407,10 @@ class public_forums_moderate_moderate extends ipsCommand
/* Run moderation sync */
$this->modLibrary->runModSync( 'topicSplit', $pids, $topic['tid'], $new_topic_id );
/* link http://community.invisionpower.com/tracker/issue-37361-when-splitting-topic-404/ */
$this->request['st'] = 0;
$this->_addModeratorLog( $this->lang->words['acp_split_topic'] . " '{$topic['title']}'" );
}
}
@@ -1461,7 +1519,7 @@ class public_forums_moderate_moderate extends ipsCommand
if ( $this->topic['tid'] )
{
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
}
$this->registry->getClass('output')->addNavigation( $this->lang->words['cm_title'], '' );
@@ -1477,7 +1535,7 @@ class public_forums_moderate_moderate extends ipsCommand
$this->request['postdate'] = intval($this->request['postdate']);
if ( !$this->request['selectedpids'] or !$this->request['postdate'] or !$this->request['Post'] )
if ( empty($this->request['selectedpids']) || empty($this->request['postdate']) || empty($this->request['Post']) )
{
$this->_showError( 'mod_merge_posts', 10384 );
}
@@ -1679,7 +1737,7 @@ class public_forums_moderate_moderate extends ipsCommand
/* Show splash page */
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->softDeleteSplashPosts( $this->forum, $this->topic, $this->pids, $canHardDelete );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "{$this->settings['_base_url']}showforum={$this->forum['id']}" );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
$this->registry->getClass('output')->setTitle( sprintf( $this->lang->words['mm_delete_top_posts'], count($this->pids) ) . ' - ' . ipsRegistry::$settings['board_name']);
$this->registry->output->addContent( $this->output );
@@ -1834,6 +1892,55 @@ 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' );
}
/**
* Perma-Delete an archived topic
*
* @return @e void [Outputs to screen]
*/
protected function _deleteArchivedTopic()
{
$this->_resetModerator( $this->topic['forum_id'] );
if( !$this->_genericPermissionCheck( 'delete_topic', '', true ) )
{
if ( $this->topic['starter_id'] != $this->memberData['member_id'] OR !$this->memberData['g_delete_own_topics'] )
{
$this->_showError( 'mod_no_delete_topic', 10386, 403 );
}
}
$pids = array();
/* Restore topic first */
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/archive/restore.php', 'classes_archive_restore' );
$this->archiveRestore = new $classToLoad();
$this->archiveRestore->setApp('forums');
/* Get pids */
$this->DB->build( array( 'select' => 'archive_id',
'from' => 'forums_archive_posts',
'where' => 'archive_topic_id=' . intval( $this->topic['tid'] ) ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$pids[] = $row['archive_id'];
}
if ( count( $pids ) )
{
/* Restore ... */
$this->archiveRestore->restore( $pids );
$this->DB->update( 'topics', array( 'topic_archive_status' => $this->registry->class_forums->fetchTopicArchiveFlag( 'exclude' ) ), 'tid=' . $this->topic['tid'] );
}
/* ... now delete */
return $this->_deleteTopicPermanent();
}
/**
* Delete a topic (confirmation screen)
*
@@ -1864,9 +1971,9 @@ class public_forums_moderate_moderate extends ipsCommand
$this->output = $this->registry->getClass('output')->getTemplate('mod')->deleteTopicForm( $this->forum, $this->topic );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "{$this->settings['_base_url']}showforum={$this->forum['id']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->setTitle( $this->lang->words['t_delete'].": ".$this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->lang->words['t_delete'] . ": " . $this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
}
}
@@ -1877,9 +1984,9 @@ class public_forums_moderate_moderate extends ipsCommand
*/
protected function _topicHistory()
{
if ( !$this->memberData['g_access_cp'] )
if ( ! $this->memberData['g_access_cp'] )
{
$this->_showError( $error, 103119.5 );
$this->_showError( 'no_permission', 103119.5 );
}
//-----------------------------------------
@@ -1920,7 +2027,7 @@ class public_forums_moderate_moderate extends ipsCommand
'where' => 'l.topic_id=' . $this->topic['tid'],
'order' => 'l.ctime DESC',
'add_join' => array( array(
'select' => 'm.members_seo_name',
'select' => 'm.member_group_id, m.members_display_name, m.members_seo_name',
'from' => array( 'members' => 'm' ),
'where' => 'l.member_id=m.member_id',
'type' => 'left'
@@ -1931,6 +2038,9 @@ class public_forums_moderate_moderate extends ipsCommand
while ( $row = $this->DB->fetch() )
{
/* No member name? */
$row['members_display_name'] = empty($row['members_display_name']) ? $row['member_name'] : $row['members_display_name'];
$mod_logs[] = $row;
}
@@ -1938,10 +2048,10 @@ class public_forums_moderate_moderate extends ipsCommand
foreach( $this->registry->class_forums->forumsBreadcrumbNav( $this->topic['forum_id'] ) as $_nav )
{
$this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1] );
$this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1], $_nav[2], $_nav[3] );
}
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
}
@@ -1975,10 +2085,10 @@ class public_forums_moderate_moderate extends ipsCommand
foreach( $this->registry->class_forums->forumsBreadcrumbNav( $this->topic['forum_id'] ) as $_nav )
{
$this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1] );
$this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1], $_nav[2], $_nav[3] );
}
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->lang->words['ts_title']." &gt; ".$this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
}
@@ -2015,9 +2125,9 @@ class public_forums_moderate_moderate extends ipsCommand
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->mergeTopicsForm( $this->forum, $this->topic );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "{$this->settings['_base_url']}showforum={$this->forum['id']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->setTitle( $this->lang->words['mt_top']." ".$this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->lang->words['mt_top'] . " " . $this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
}
/**
@@ -2133,10 +2243,10 @@ class public_forums_moderate_moderate extends ipsCommand
if ( $old_topic_poll['pid'] and !$main_topic_poll['pid'] )
{
// Make that poll the poll for the master topic
$this->DB->update( 'polls', array( 'tid' => $this->topic['tid'] ), "tid={$old_topic_poll}" );
$this->DB->update( 'polls', array( 'tid' => $this->topic['tid'] ), "tid={$old_topic_poll['tid']}" );
// Make the votes for that now
$this->DB->update( 'voters', array( 'tid' => $this->topic['tid'] ), "tid={$old_topic_poll}" );
$this->DB->update( 'voters', array( 'tid' => $this->topic['tid'] ), "tid={$old_topic_poll['tid']}" );
// Let the master topic know that it has a poll now
$this->DB->update( 'topics', array( 'poll_state' => 1 ), "tid={$this->topic['tid']}" );
@@ -2171,8 +2281,8 @@ class public_forums_moderate_moderate extends ipsCommand
{
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'public_topic' ) );
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->mergeMultiplePolls( array( $main_topic_poll, $old_topic_poll ), ",{$main_topic_poll['tid']},{$old_topic_poll['tid']}" );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "{$this->settings['_base_url']}showforum={$this->forum['id']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->lang->words['mt_top']." ".$this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
return false;
}
@@ -2209,6 +2319,10 @@ class public_forums_moderate_moderate extends ipsCommand
$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
//-----------------------------------------
@@ -2319,7 +2433,7 @@ class public_forums_moderate_moderate extends ipsCommand
{
$this->registry->output->addNavigation( $_nav[0], $_nav[1], $_nav[2], $_nav[3] );
}
$this->registry->output->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->output->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->lang->words['t_move'].": ".$this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
}
@@ -2479,7 +2593,7 @@ class public_forums_moderate_moderate extends ipsCommand
}
}
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->lang->words['t_edit'].": ".$this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
}
@@ -2505,6 +2619,25 @@ 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'] ) );
}
}
$this->request['TopicDesc'] = trim( IPSText::getTextClass( 'bbcode' )->stripBadWords( $this->request['TopicDesc'] ) );
$this->request['TopicDesc'] = IPSText::mbsubstr( $this->request['TopicDesc'], 0, 70 );
@@ -2589,7 +2722,7 @@ class public_forums_moderate_moderate extends ipsCommand
$moveto = intval($this->request['df']);
$date = 0;
$ignore_pin = intval( $this->request['ignore_pin'] );
if( $dateline )
{
$date = time() - $dateline*60*60*24;
@@ -2619,31 +2752,13 @@ class public_forums_moderate_moderate extends ipsCommand
}
//-----------------------------------------
// Check for an attempt to move into a subwrap forum
// Done?
//-----------------------------------------
$f = $this->registry->class_forums->allForums[ $moveto ];
if ( $f['sub_can_post'] != 1 )
{
$this->_showError( 'mod_forum_no_posts', 103102 );
}
$num_rows = 0;
if( $this->modLibrary->topicMove( $tid_array, $source, $moveto ) )
{
$num_rows = count($tid_array);
}
$this->_addModeratorLog( $this->lang->words['acp_mass_moved'] );
//-----------------------------------------
// Show results or refresh..
//-----------------------------------------
if ( ! $num_rows )
if ( empty( $tid_array ) )
{
$this->_addModeratorLog( $this->lang->words['acp_mass_moved'] );
//-----------------------------------------
// Update forum deletion
//-----------------------------------------
@@ -2664,17 +2779,36 @@ class public_forums_moderate_moderate extends ipsCommand
$this->request[ 'check'] = 0 ;
$this->_pruneStart( $this->registry->getClass('output')->getTemplate('mod')->simplePage( $this->lang->words['cp_results'], $this->lang->words['cp_result_move'] . ($max) ) );
}
else
{
$link = "app=forums&amp;module=moderate&amp;section=moderate&amp;f={$this->forum['id']}&amp;do=prune_move&amp;df=" . $this->request['df'] . "&amp;pergo={$pergo}&amp;current={$maxdone}&amp;max={$max}";
$link .= "&amp;starter={$starter}&amp;state={$state}&amp;posts={$posts}&amp;dateline={$dateline}&amp;ignore_pin={$ignore_pin}";
$link .= "&amp;auth_key=".$this->member->form_hash;
$done = $current + $num_rows;
$text = sprintf( $this->lang->words['cp_batch_done'], $done, $max - $done );
$this->registry->output->redirectScreen( $text, $this->settings['base_url'] . $link );
return;
}
//-----------------------------------------
// Check for an attempt to move into a subwrap forum
//-----------------------------------------
$f = $this->registry->class_forums->allForums[ $moveto ];
if ( $f['sub_can_post'] != 1 )
{
$this->_showError( 'mod_forum_no_posts', 103102 );
}
$this->modLibrary->topicMove( $tid_array, $source, $moveto );
//-----------------------------------------
// Refresh..
//-----------------------------------------
$num_rows = count($tid_array);
$link = "app=forums&amp;module=moderate&amp;section=moderate&amp;f={$this->forum['id']}&amp;do=prune_move&amp;df=" . $this->request['df'] . "&amp;pergo={$pergo}&amp;current={$maxdone}&amp;max={$max}";
$link .= "&amp;starter={$starter}&amp;state={$state}&amp;posts={$posts}&amp;dateline={$dateline}&amp;ignore_pin={$ignore_pin}";
$link .= "&amp;auth_key=".$this->member->form_hash;
$done = $current + $num_rows;
$text = sprintf( $this->lang->words['cp_batch_done'], $done, $max - $done );
$this->registry->output->redirectScreen( $text, $this->settings['base_url'] . $link );
}
/**
@@ -3096,7 +3230,7 @@ class public_forums_moderate_moderate extends ipsCommand
/* Show splash page */
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->softDeleteSplash( $this->forum, $this->tids, $canHardDelete );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "{$this->settings['_base_url']}showforum={$this->forum['id']}" );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
$this->registry->getClass('output')->setTitle( sprintf( $this->lang->words['mm_delete_top'], count($this->tids) ) . ' - ' . ipsRegistry::$settings['board_name']);
$this->registry->output->addContent( $this->output );
@@ -3183,9 +3317,7 @@ class public_forums_moderate_moderate extends ipsCommand
$polls = array();
/* Who has a poll? */
$pollForFirstTopic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'polls', 'where' => "tid={$first_topic['tid']}" ) );
$this->DB->build( array( 'select' => '*', 'from' => 'polls', 'where' => $this->DB->buildWherePermission( $merge_ids, 'tid', FALSE ) ) );
$this->DB->build( array( 'select' => '*', 'from' => 'polls', 'where' => "tid={$main_topic_id} OR tid IN(" . implode( ',', $merge_ids ) . ")" ) );
$this->DB->execute();
while ( $row = $this->DB->fetch() )
@@ -3194,53 +3326,48 @@ class public_forums_moderate_moderate extends ipsCommand
}
/* We have one poll */
if ( !$pollForFirstTopic['pid'] and count( $polls ) == 1 )
if ( count($polls) == 1 )
{
// Make that poll the poll for the master topic
$this->DB->update( 'polls', array( 'tid' => $main_topic_id ), $this->DB->buildWherePermission( $merge_ids, 'tid', FALSE ) );
// Make the votes for that now
$this->DB->update( 'voters', array( 'tid' => $main_topic_id ), $this->DB->buildWherePermission( $merge_ids, 'tid', FALSE ) );
// Let the master topic know that it has a poll now
$this->DB->update( 'topics', array( 'poll_state' => 1 ), "tid={$main_topic_id}" );
/* Update the poll ONLY if it's not our main one */
if ( empty($polls[ $main_topic_id ]) )
{
$this->DB->update( 'polls', array( 'tid' => $main_topic_id ), "tid IN(" . implode( ',', $merge_ids ) . ")" );
$this->DB->update( 'voters', array( 'tid' => $main_topic_id ), "tid IN(" . implode( ',', $merge_ids ) . ")" );
$this->DB->update( 'topics', array( 'poll_state' => 1 ), "tid={$main_topic_id}" );
}
}
/* There's more than one poll to deal with */
else if( $pollForFirstTopic['pid'] OR count($polls) )
elseif (count($polls) > 1 )
{
// Have we selected one?
if ( $this->request['chosenpolltid'] )
$chosenTid = intval( $this->request['chosenpolltid'] );
if ( $chosenTid )
{
$chosenTid = intval( $this->request['chosenpolltid'] );
/* Chosen one is not from the main topic? */
if ( $chosenTid != $main_topic_id )
{
$this->DB->delete( 'polls', "tid={$main_topic_id}" );
$this->DB->delete( 'voters', "tid={$main_topic_id}" );
// Update poll status here if the chosen poll is not from the main topic otherwise there's no need to.. right? ;P
$this->DB->update( 'topics', array( 'poll_state' => 1 ), "tid={$main_topic_id}" );
}
// Remove the non chosen ones
$this->DB->delete( 'polls', "tid={$main_topic_id}" );
$this->DB->delete( 'polls', $this->DB->buildWherePermission( $merge_ids, 'tid', FALSE ) . " AND tid <> {$chosenTid}" );
$this->DB->delete( 'voters', "tid={$main_topic_id}" );
$this->DB->delete( 'voters', $this->DB->buildWherePermission( $merge_ids, 'tid', FALSE ) . " AND tid <> {$chosenTid}" );
$this->DB->delete( 'polls', "tid IN(" . implode( ',', $merge_ids ) . ")" . " AND tid <> {$chosenTid}" );
$this->DB->delete( 'voters', "tid IN(" . implode( ',', $merge_ids ) . ")" . " AND tid <> {$chosenTid}" );
// Make the chosen poll the poll for the master topic
$this->DB->update( 'polls', array( 'tid' => $main_topic_id ), "tid={$chosenTid}" );
// Make the votes for that now
// Update the master topic
$this->DB->update( 'polls', array( 'tid' => $main_topic_id ), "tid={$chosenTid}" );
$this->DB->update( 'voters', array( 'tid' => $main_topic_id ), "tid={$chosenTid}" );
// Let the master topic know that it has a poll now
$this->DB->update( 'topics', array( 'poll_state' => 1 ), "tid={$main_topic_id}" );
}
// No? Well ask them which one to keep
else
{
if ( $pollForFirstTopic['tid'] )
{
array_unshift( $polls, $pollForFirstTopic );
}
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'public_topic' ) );
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->mergeMultiplePolls( $polls, $this->request['selectedtids'] );
$this->registry->getClass('output')->addNavigation( 'foo', 'bar' );
return false;
}
}
@@ -3279,7 +3406,7 @@ class public_forums_moderate_moderate extends ipsCommand
//-----------------------------------------
$this->modLibrary->rebuildTopic( $main_topic_id );
$this->registry->class_forums->allForums[ $this->forum['id'] ]['_update_deletion'] = 1;
$this->modLibrary->forumRecount( $this->forum['id'] );
$this->cache->rebuildCache( 'stats', 'global' );
@@ -3287,6 +3414,9 @@ 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 )
{
@@ -3488,7 +3618,7 @@ class public_forums_moderate_moderate extends ipsCommand
if( $this->forum['name'] )
{
$this->registry->getClass('output')->addNavigation( $this->forum['name'], $this->settings['base_url'] . "showforum={$this->forum['id']}" );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
}
else
{