Version 3.2.3

This commit is contained in:
Neo committed 2025-12-19 00:34:03 -08:00
1 parent ae5c01cc78
commit 78706903a2
2641 files changed
+228363 -201264

No files matched your search

@@ -1,31 +1,14 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* Default section for tools module
* Last Updated: $LastChangedDate: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @file defaultSection.php Define the default section for the 'tools' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: This is NULLED!
* $Author: ips_terabyte $
* @since 14th May 2003
* @version $Rev: 5713 $
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.2.3
* $Revision: 8655 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
* Very simply returns the default section if one is not
* passed in the URL
*/
$DEFAULT_SECTION = 'tools';
@@ -5,6 +5,6 @@
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionboard.com/">IP.Board</a>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -3,19 +3,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Member management
* Last Updated: $Date: 2010-10-14 10:29:53 -0400 (Thu, 14 Oct 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: mark $
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @link http://hatynka.in
* @since 1st march 2002
* @version $Revision: 6978 $
* @version $Revision: 8644 $
*
*/
@@ -31,50 +31,36 @@ class admin_forums_tools_tools extends ipsCommand
/**
* Skin object
*
* @access private
* @var object Skin templates
*/
private $html;
protected $html;
/**
* Shortcut for url
*
* @access private
* @var string URL shortcut
*/
private $form_code;
protected $form_code;
/**
* Shortcut for url (javascript)
*
* @access private
* @var string JS URL shortcut
*/
private $form_code_js;
protected $form_code_js;
/**
/**
* Editor object
*
* @access private
* @var object Editor library
*/
private $han_editor;
protected $han_editor;
/**
* Trash can forum id
*
* @access private
* @var integer Trash can forum
*/
private $trash_forum = 0;
/**
* Main class entry point
*
* @access public
* @param object ipsRegistry reference
* @return void [Outputs to screen]
* @return @e void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -123,11 +109,6 @@ class admin_forums_tools_tools extends ipsCommand
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ftools_deleteposts' );
$this->_deletePostsDo();
break;
case 'new_avatar':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'member_photo', 'members', 'members' );
$this->_processAvatar();
break;
}
//-----------------------------------------
@@ -142,12 +123,11 @@ class admin_forums_tools_tools extends ipsCommand
/**
* Delete a forum's email subscriptions
*
* @access private
* @return void
* @return @e void
* @author Brandon Farber
* @since IPB3 / 22 Oct 2008
*/
private function _deleteForumSubscriptions()
protected function _deleteForumSubscriptions()
{
/**
* Get members watching forums so we can recache em..
@@ -155,16 +135,21 @@ class admin_forums_tools_tools extends ipsCommand
$forum_id = intval( $this->request['f'] );
$members = array();
$this->DB->build( array( 'select' => 'member_id', 'from' => 'forum_tracker', 'where' => 'forum_id=' . $forum_id ) );
$this->DB->build( array( 'select' => 'like_member_id', 'from' => 'core_like', 'where' => "like_app='forums' AND like_area='forums' AND like_rel_id=" . $forum_id ) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$members[] = $r['member_id'];
$members[] = $r['like_member_id'];
}
$this->DB->delete( 'forum_tracker', 'forum_id=' . $forum_id );
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
$_like = classes_like::bootstrap( 'forums', 'forums' );
$_like->remove( $forum_id );
/**
* Recache members
*/
foreach( $members as $mid )
{
$this->registry->getClass('class_forums')->recacheWatchedForums( $mid );
@@ -175,111 +160,61 @@ class admin_forums_tools_tools extends ipsCommand
*/
$toDelete = array();
$this->DB->build( array( 'select' => 'tr.trid',
'from' => array( 'tracker' => 'tr' ),
'where' => 't.forum_id=' . $forum_id,
'add_join' => array(
array(
'from' => array( 'topics' => 't' ),
'where' => 't.tid=tr.topic_id',
'type' => 'left'
)
$this->DB->build( array(
'select' => 'l.like_rel_id',
'from' => array( 'core_like' => 'l' ),
'where' => 't.forum_id=' . $forum_id,
'add_join' => array(
array(
'from' => array( 'topics' => 't' ),
'where' => "t.tid=l.like_rel_id AND l.like_app='forums' AND l.like_area='topics'",
'type' => 'left'
)
)
) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$toDelete[] = $r['trid'];
$toDelete[] = $r['like_rel_id'];
}
if( count($toDelete) )
{
$this->DB->delete( 'tracker', 'trid IN(' . implode( ',', $toDelete ) . ')' );
$this->DB->delete( 'core_like', "like_lookup_id IN ('" . implode( "','", $toDelete ) . "')" );
$this->DB->delete( 'core_like_cache', "like_cache_id IN ('" . implode( "','", $toDelete ) . "')" );
}
$this->registry->output->redirect( $this->settings['_base_url'] . "app=forums", $this->lang->words['m_subsf_redirect'] );
$this->registry->output->redirect( $this->settings['_base_url'] . "app=forums", $this->lang->words['m_subsf_redirect'] );
}
/**
* Delete a member's email subscriptions
*
* @access private
* @return void
* @return @e void
* @author Brandon Farber
* @since IPB3 / 22 Oct 2008
*/
private function _deleteSubscriptions()
protected function _deleteSubscriptions()
{
$member_id = intval( $this->request['member_id'] );
$member_id = intval( $this->request['member_id'] );
$this->DB->delete( 'tracker', 'member_id=' . $member_id );
$this->DB->delete( 'forum_tracker', 'member_id=' . $member_id );
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
$_like = classes_like::bootstrap( 'forums', 'topics' );
$_like->removeByMemberId( $member_id );
$_like = classes_like::bootstrap( 'forums', 'forums' );
$_like->removeByMemberId( $member_id );
$this->registry->output->redirect( $this->settings['_base_url'] . "app=members&amp;module=members&amp;section=members&amp;do=viewmember&amp;member_id={$this->request['member_id']}", $this->lang->words['m_subs_redirect'] );
$this->registry->output->redirect( $this->settings['_base_url'] . "app=members&amp;module=members&amp;section=members&amp;do=viewmember&amp;member_id={$member_id}", $this->lang->words['m_subs_redirect'] );
}
/**
* Update a member's avatar
*
* @access private
* @return void [Outputs to screen]
* @author Brandon Farber
* @since IPB3 / 9 June 2008
*/
private function _processAvatar()
{
$member_id = intval( $this->request['member_id'] );
try
{
IPSMember::getFunction()->saveNewAvatar( $member_id );
}
catch( Exception $error )
{
switch ( $error->getMessage() )
{
case 'NO_MEMBER_ID':
$this->registry->output->showError( $this->lang->words['t_noid'], 11356 );
break;
case 'NO_PERMISSION':
$this->registry->output->showError( $this->lang->words['t_permav'], 11357, true );
break;
case 'UPLOAD_NO_IMAGE':
$this->registry->output->showError( $this->lang->words['t_uploadfail1'], 11358 );
break;
case 'UPLOAD_INVALID_FILE_EXT':
$this->registry->output->showError( $this->lang->words['t_uploadfail2'], 11359 );
break;
case 'UPLOAD_TOO_LARGE':
$this->registry->output->showError( $this->lang->words['t_uploadfail3'], 11360 );
break;
case 'UPLOAD_CANT_BE_MOVED':
$this->registry->output->showError( $this->lang->words['t_uploadfail4'], 11361 );
break;
case 'UPLOAD_NOT_IMAGE':
$this->registry->output->showError( $this->lang->words['t_uploadfail5'], 2131, true );
break;
case 'NO_AVATAR_TO_SAVE':
$this->registry->output->showError( $this->lang->words['t_noav'], 11362 );
break;
case 'INVALID_FILE_EXT':
$this->registry->output->showError( $this->lang->words['t_badavext'], 11362 );
break;
}
}
$this->registry->output->redirect( $this->settings['_base_url'] . "app=members&amp;module=members&amp;section=members&amp;do=viewmember&amp;member_id={$this->request['member_id']}", $this->lang->words['t_avupdated'] );
}
/**
* Delete a member's posts [process]
*
* @access private
* @return void [Outputs to screen]
* @return @e void [Outputs to screen]
*/
private function _deletePostsDo()
protected function _deletePostsDo()
{
//-----------------------------------------
// INIT
@@ -308,7 +243,7 @@ class admin_forums_tools_tools extends ipsCommand
/* Right, first off, are we deleting anything? */
if ( !$delete_posts and !$delete_topics )
{
$this->registry->output->showError( "You're an idiot" );
$this->registry->output->showError( $this->lang->words['no_post_topic_sel_del'] );
return;
}
/* Okay, are we deleting topics AND posts? */
@@ -325,7 +260,6 @@ class admin_forums_tools_tools extends ipsCommand
."&init=1"
."&dposts={$delete_posts}"
."&dtopics={$delete_topics}"
."&use_trash_can=".intval($this->request['use_trash_can'])
."&member_id={$member_id}"
."&restart_for_posts={$restart_for_posts}";
@@ -338,31 +272,13 @@ class admin_forums_tools_tools extends ipsCommand
if ( ! is_object( $mod_func ) )
{
require_once( IPS_ROOT_PATH . 'sources/classes/itemmarking/classItemMarking.php' );
$this->registry->setClass( 'classItemMarking', new classItemMarking( $this->registry ) );
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/itemmarking/classItemMarking.php', 'classItemMarking' );
$this->registry->setClass( 'classItemMarking', new $classToLoad( $this->registry ) );
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/moderate.php', 'moderatorLibrary', 'forums' );
$mod_func = new $classToLoad( $this->registry );
}
//-----------------------------------------
// Trash-can set up
//-----------------------------------------
$trash_append = '';
if ( $this->settings['forum_trash_can_enable'] and $this->settings['forum_trash_can_id'] )
{
if ( $this->registry->class_forums->forum_by_id[ $this->settings['forum_trash_can_id'] ]['sub_can_post'] )
{
if ( $this->request['use_trash_can'] )
{
$this->trash_forum = $this->settings['forum_trash_can_id'];
$trash_append = " AND forum_id<>{$this->trash_forum}";
}
}
}
//-----------------------------------------
// Get member
//-----------------------------------------
@@ -382,7 +298,7 @@ class admin_forums_tools_tools extends ipsCommand
{
$this->DB->build( array( 'select' => 'p.*',
'from' => array( 'posts' => 'p' ),
'where' => "p.author_id={$member_id}{$trash_append}",
'where' => "p.author_id={$member_id}",
'order' => 'p.pid ASC',
//'limit' => array( $start, $end ),
'add_join' => array(
@@ -400,7 +316,7 @@ class admin_forums_tools_tools extends ipsCommand
{
$this->DB->build( array( 'select' => 't.*',
'from' => array( 'topics' => 't' ),
'where' => "t.starter_id={$member_id}{$trash_append}",
'where' => "t.starter_id={$member_id}",
'order' => 't.tid ASC',
//'limit' => array( $start, $end ),
'add_join' => array(
@@ -477,21 +393,7 @@ class admin_forums_tools_tools extends ipsCommand
// Ok, deleting topics or posts?
//-----------------------------------------
if ( ( $delete_posts OR $delete_topics ) AND ( $this->trash_forum and $this->trash_forum != $topic['forum_id'] ) )
{
//-----------------------------------------
// Move, don't delete
//-----------------------------------------
$mod_func->topicMove( $r['topic_id'], $topic['forum_id'], $this->trash_forum );
$forums_affected[ $topic['forum_id'] ] = $topic['forum_id'];
$forums_affected[ $this->trash_forum ] = $this->trash_forum;
$topics_deleted++;
$posts_deleted += $topic_i_posted['count'];
}
else if ( $delete_posts OR $delete_topics )
if ( $delete_posts OR $delete_topics )
{
$this->DB->delete( 'posts', 'author_id=' . $member_id . ' AND topic_id=' . $r['tid'] );
$this->DB->delete('topics', 'tid=' . $r['tid'] );
@@ -508,29 +410,12 @@ class admin_forums_tools_tools extends ipsCommand
else if ( $topic['starter_id'] == $member_id AND $delete_topics )
{
if ( $this->trash_forum and $this->trash_forum != $topic['forum_id'] )
{
//-----------------------------------------
// Move, don't delete
//-----------------------------------------
$mod_func->topicMove( $r['topic_id'], $topic['forum_id'], $this->trash_forum );
$forums_affected[ $topic['forum_id'] ] = $topic['forum_id'];
$forums_affected[ $this->trash_forum ] = $this->trash_forum;
$topics_deleted++;
$posts_deleted += $topic_i_posted['count'];
}
else
{
$this->DB->delete( 'posts', 'topic_id=' . $r['tid'] );
$this->DB->delete( 'topics', 'tid=' . $r['tid'] );
$forums_affected[ $topic['forum_id'] ] = $topic['forum_id'];
$topics_deleted++;
$posts_deleted += $topic['posts'] + 1;
}
$this->DB->delete( 'posts', 'topic_id=' . $r['tid'] );
$this->DB->delete( 'topics', 'tid=' . $r['tid'] );
$forums_affected[ $topic['forum_id'] ] = $topic['forum_id'];
$topics_deleted++;
$posts_deleted += $topic['posts'] + 1;
}
//-----------------------------------------
@@ -539,82 +424,12 @@ class admin_forums_tools_tools extends ipsCommand
else if ( $delete_posts AND ! $r['new_topic'] AND $r['pid'] )
{
if ( $this->trash_forum and $this->trash_forum != $topic['forum_id'] )
{
//-----------------------------------------
// Set up and pass to split topic handler
//-----------------------------------------
$new_title = $this->lang->words['acp_posts_deleted_from'] . $topic['title'];
$new_desc = $this->lang->words['acp_posts_deleted_from_tid'] . $topic['tid'];
//-----------------------------------------
// Is first post queued?
//-----------------------------------------
$topic_approved = 1;
$first_post = $this->DB->buildAndFetch( array( 'select' => 'pid, queued',
'from' => 'posts',
'where' => "pid=" . $r['pid'],
) );
if( $first_post['queued'] )
{
$topic_approved = 0;
$this->DB->update( 'posts', array( 'queued' => 0 ), 'pid=' . $first_post['pid'] );
}
//-----------------------------------------
// Complete a new dummy topic
//-----------------------------------------
$this->DB->insert( 'topics', array(
'title' => $new_title,
'description' => $new_desc,
'state' => 'open',
'posts' => 0,
'starter_id' => $member_id,
'starter_name' => $member['members_display_name'],
'start_date' => time(),
'last_poster_id' => $member_id,
'last_poster_name' => $member['members_display_name'],
'last_post' => time(),
'icon_id' => 0,
'author_mode' => 1,
'poll_state' => 0,
'last_vote' => 0,
'views' => 0,
'forum_id' => $this->trash_forum,
'approved' => $topic_approved,
'pinned' => 0,
) );
$this->DB->delete( 'posts', 'pid=' . $r['pid'] );
$new_topic_id = $this->DB->getInsertId();
//-----------------------------------------
// Move the posts
//-----------------------------------------
$this->DB->update( 'posts', array( 'topic_id' => $new_topic_id, 'new_topic' => 0, 'queued' => 0 ), "pid={$r['pid']}" );
$this->DB->update( 'posts', array( 'new_topic' => 0 ), "topic_id={$topic['tid']}" );
$forums_affected[ $topic['forum_id'] ] = $topic['forum_id'];
$topics_affected[ $topic['tid'] ] = $topic['tid'];
$forums_affected[ $topic['forum_id'] ] = $topic['forum_id'];
$forums_affected[ $this->trash_forum ] = $this->trash_forum;
$topics_affected[ $topic['tid'] ] = $topic['tid'];
$topics_affected[ $new_topic_id ] = $new_topic_id;
$posts_deleted++;
}
else
{
$this->DB->delete( 'posts', 'pid=' . $r['pid'] );
$forums_affected[ $topic['forum_id'] ] = $topic['forum_id'];
$topics_affected[ $topic['tid'] ] = $topic['tid'];
$posts_deleted++;
}
$posts_deleted++;
}
}
@@ -655,7 +470,6 @@ class admin_forums_tools_tools extends ipsCommand
."&init=1"
."&dposts=1"
."&dtopics=0"
."&use_trash_can=".intval($this->request['use_trash_can'])
."&member_id={$member_id}"
."&restart_for_posts=0";
@@ -666,7 +480,7 @@ class admin_forums_tools_tools extends ipsCommand
// Recount stats..
//-----------------------------------------
$mod_func->statsRecount();
$this->cache->rebuildCache( 'stats', 'global' );
//-----------------------------------------
// Reset member's posts
@@ -682,15 +496,17 @@ class admin_forums_tools_tools extends ipsCommand
}
}
$_queued = $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible' ), 'p.' );
if ( ! count( $forums ) )
{
$count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'posts', 'where' => 'queued != 1 AND author_id=' . $member_id ) );
$count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'posts p', 'where' => $_queued . ' AND p.author_id=' . $member_id ) );
}
else
{
$count = $this->DB->buildAndFetch( array( 'select' => 'count(p.pid) as count',
'from' => array( 'posts' => 'p' ),
'where' => 'p.queued <> 1 AND p.author_id=' . $member_id . ' AND t.forum_id NOT IN (' . implode( ",", $forums ) . ')',
'where' => $_queued . ' AND p.author_id=' . $member_id . ' AND t.forum_id NOT IN (' . implode( ",", $forums ) . ')',
'add_join' => array(
array( 'type' => 'left',
'from' => array( 'topics' => 't' ),
@@ -720,7 +536,6 @@ class admin_forums_tools_tools extends ipsCommand
."&init=1"
."&dposts={$delete_posts}"
."&dtopics={$delete_topics}"
."&use_trash_can=".intval($this->request['use_trash_can'])
."&member_id={$member_id}"
."&restart_for_posts={$restart_for_posts}";
@@ -733,10 +548,9 @@ class admin_forums_tools_tools extends ipsCommand
/**
* Delete a member's posts [form/confirmation]
*
* @access private
* @return void [Outputs to screen]
* @return @e void [Outputs to screen]
*/
private function _deletePostsStart()
protected function _deletePostsStart()
{
//-----------------------------------------
// Page set up
@@ -761,21 +575,14 @@ class admin_forums_tools_tools extends ipsCommand
//-----------------------------------------
// Get number of topics member has started
//-----------------------------------------
$_where = "";
if( $this->settings['forum_trash_can_enable'] AND $this->settings['forum_trash_can_id'] )
{
$_where = " AND t.forum_id <> " . $this->settings['forum_trash_can_id'];
}
$topics = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count',
'from' => 'topics t',
'where' => 't.starter_id=' . $member_id . $_where ) );
'where' => 't.starter_id=' . $member_id ) );
$posts = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count',
'from' => array( 'posts' => 'p' ),
'where' => 'p.author_id=' . $member_id . $_where,
'where' => 'p.author_id=' . $member_id,
'add_join' => array(
array(
'from' => array( 'topics' => 't' ),
@@ -5,6 +5,6 @@
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionboard.com/">IP.Board</a>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -2,6 +2,7 @@
<permissions>
<group>
<grouptitle>Инструменты</grouptitle>
<grouplang>forums_tools</grouplang>
<items>
<item>
<key>ftools_deleteposts</key>