Version 2.2.0 RC-1
This commit is contained in:
1 parent
f73f8bff6d
commit
22f1b963ee
1034 files changed
+178610
-70897
No files matched your search
+140
-54
@@ -1,24 +1,15 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| (c) 2001 - 2004 Invision Power Services
|
||||
| http://www.invisionboard.com
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
| Email: matt@ibforums.com
|
||||
| Licence Info: http://www.invisionpower.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Moderator Core Functions
|
||||
@@ -32,32 +23,37 @@
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
class func_mod
|
||||
{
|
||||
var $ipsclass;
|
||||
|
||||
var $topic = "";
|
||||
var $forum = "";
|
||||
var $error = "";
|
||||
|
||||
var $auto_update = FALSE;
|
||||
|
||||
var $stm = "";
|
||||
var $upload_dir = "./uploads";
|
||||
|
||||
var $moderator = "";
|
||||
|
||||
//-----------------------------------------
|
||||
// @modfunctions: constructor
|
||||
// -----------
|
||||
// Accepts: NOTHING
|
||||
// Returns: NOTHING (TRUE)
|
||||
//-----------------------------------------
|
||||
|
||||
var $topic = "";
|
||||
var $forum = "";
|
||||
var $error = "";
|
||||
|
||||
var $auto_update = FALSE;
|
||||
|
||||
var $stm = "";
|
||||
var $upload_dir = "";
|
||||
|
||||
var $moderator = "";
|
||||
//-----------------------------------------
|
||||
|
||||
function func_mod()
|
||||
{
|
||||
$this->error = "";
|
||||
|
||||
$this->upload_dir = $this->ipsclass->vars['upload_dir'];
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -70,6 +66,8 @@ class func_mod
|
||||
|
||||
function init($forum="", $topic="", $moderator="")
|
||||
{
|
||||
$this->upload_dir = $this->ipsclass->vars['upload_dir'];
|
||||
|
||||
$this->forum = $forum;
|
||||
|
||||
if ( is_array($topic) )
|
||||
@@ -103,6 +101,7 @@ class func_mod
|
||||
|
||||
if ( is_array( $id ) )
|
||||
{
|
||||
// Better safe than sorry - this should have already been done though
|
||||
$id = $this->ipsclass->clean_int_array( $id );
|
||||
|
||||
if ( count($id) > 0 )
|
||||
@@ -143,7 +142,7 @@ class func_mod
|
||||
// Is there an attachment to this post?
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'attachments', 'where' => "attach_pid".$pid ) );
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'attachments', 'where' => "attach_rel_module='post' AND attach_rel_id".$pid ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
$attach_ids = array();
|
||||
@@ -176,7 +175,7 @@ class func_mod
|
||||
$postlib = new class_post();
|
||||
$postlib->ipsclass =& $this->ipsclass;
|
||||
|
||||
foreach( $attach_tid as $apid => $tid )
|
||||
foreach( $attach_tid as $tid )
|
||||
{
|
||||
$postlib->pf_recount_topic_attachments($tid);
|
||||
}
|
||||
@@ -205,7 +204,7 @@ class func_mod
|
||||
$this->rebuild_topic($tid);
|
||||
}
|
||||
|
||||
$this->add_moderate_log("", "", "", $pid, "Óäàëåííûå ñîîáùåíèÿ ($pid)");
|
||||
$this->add_moderate_log("", "", "", $pid, "Deleted posts ($pid)");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -221,6 +220,16 @@ class func_mod
|
||||
{
|
||||
$tid = intval($tid);
|
||||
|
||||
if ( $this->ipsclass->vars['post_order_column'] != 'post_date' )
|
||||
{
|
||||
$this->ipsclass->vars['post_order_column'] = 'pid';
|
||||
}
|
||||
|
||||
if ( $this->ipsclass->vars['post_order_sort'] != 'desc' )
|
||||
{
|
||||
$this->ipsclass->vars['post_order_sort'] = 'asc';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the correct number of replies
|
||||
//-----------------------------------------
|
||||
@@ -247,11 +256,13 @@ class func_mod
|
||||
// Get last post info
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->cache_add_query( 'mod_func_get_last_post', array( 'tid' => $tid ) );
|
||||
$this->ipsclass->DB->cache_add_query( 'mod_func_get_last_post', array( 'tid' => $tid, 'orderby' => $this->ipsclass->vars['post_order_column'] ) );
|
||||
$this->ipsclass->DB->cache_exec_query();
|
||||
|
||||
$last_post = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
$last_poster_name = $last_post['members_display_name'] ? $last_post['members_display_name'] : $last_post['author_name'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Get first post info
|
||||
//-----------------------------------------
|
||||
@@ -259,7 +270,7 @@ class func_mod
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'p.post_date, p.author_id, p.author_name, p.pid',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => "p.topic_id=$tid",
|
||||
'order' => 'p.pid ASC',
|
||||
'order' => "p.{$this->ipsclass->vars['post_order_column']} ASC",
|
||||
'limit' => array(0,1),
|
||||
'add_join' => array( 0 => array( 'select' => 'm.id, m.members_display_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
@@ -271,6 +282,8 @@ class func_mod
|
||||
|
||||
$first_post = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
$first_poster_name = $first_post['members_display_name'] ? $first_post['members_display_name'] : $first_post['author_name'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Get number of attachments
|
||||
//-----------------------------------------
|
||||
@@ -284,13 +297,16 @@ class func_mod
|
||||
// Update topic
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_update( 'topics', array( 'last_post' => $last_post['post_date'],
|
||||
'last_poster_id' => $last_post['author_id'],
|
||||
'last_poster_name' => $last_post['members_display_name'] ? $last_post['members_display_name'] : $last_post['author_name'],
|
||||
$this->ipsclass->DB->force_data_type = array( 'starter_name' => 'string',
|
||||
'last_poster_name' => 'string' );
|
||||
|
||||
$this->ipsclass->DB->do_update( 'topics', array( 'last_post' => $last_post['post_date'] ? $last_post['post_date'] : $first_post['post_date'],
|
||||
'last_poster_id' => $last_post['author_id'] ? $last_post['author_id'] : $first_post['author_id'],
|
||||
'last_poster_name' => $last_poster_name ? $last_poster_name : $first_poster_name,
|
||||
'topic_queuedposts' => $qpcount,
|
||||
'posts' => $pcount,
|
||||
'starter_id' => $first_post['author_id'],
|
||||
'starter_name' => $first_post['members_display_name'] ? $first_post['members_display_name'] : $first_post['author_name'],
|
||||
'starter_name' => $first_poster_name,
|
||||
'start_date' => $first_post['post_date'],
|
||||
'topic_firstpost' => $first_post['pid'],
|
||||
'topic_hasattach' => intval($attach['count'])
|
||||
@@ -300,7 +316,7 @@ class func_mod
|
||||
// Update first post
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $first_post['new_topic'] != 1 and $first_post['pid'] )
|
||||
if ( (!isset($first_post['new_topic']) OR $first_post['new_topic'] != 1) and $first_post['pid'] )
|
||||
{
|
||||
$this->ipsclass->DB->do_shutdown_update( 'posts', array( 'new_topic' => 0 ), 'topic_id='.$tid );
|
||||
$this->ipsclass->DB->do_shutdown_update( 'posts', array( 'new_topic' => 1 ), 'pid='.$first_post['pid'] );
|
||||
@@ -327,9 +343,27 @@ class func_mod
|
||||
'last_poster_name' => $tt['last_poster_name'] ? $tt['last_poster_name'] : "",
|
||||
'last_poster_id' => $tt['last_poster_id'] ? $tt['last_poster_id'] : "",
|
||||
);
|
||||
|
||||
$this->ipsclass->DB->force_data_type = array( 'last_poster_name' => 'string',
|
||||
'last_title' => 'string' );
|
||||
|
||||
$this->ipsclass->DB->do_update( 'forums', $dbs, "id=".intval($this->forum['id']) );
|
||||
|
||||
if ( $this->ipsclass->forums->forums_by_id[ $this->forum['id'] ]['newest_id'] == $tid )
|
||||
{
|
||||
$sort_key = $this->ipsclass->forums->forums_by_id[ $this->forum['id'] ]['sort_key'];
|
||||
|
||||
$tt = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'title, tid',
|
||||
'from' => 'topics',
|
||||
'where' => 'forum_id='.$this->forum['id'].' and approved=1',
|
||||
'order' => $sort_key.' desc',
|
||||
'limit' => array( 0,1 )
|
||||
) );
|
||||
|
||||
$dbs['newest_id'] = $tt['tid'] ? $tt['tid'] : "";
|
||||
$dbs['newest_title'] = $tt['title'] ? $tt['title'] : "";
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update forum cache
|
||||
//-----------------------------------------
|
||||
@@ -411,6 +445,9 @@ class func_mod
|
||||
|
||||
$db_string = $this->ipsclass->DB->compile_db_update_string( $ta );
|
||||
|
||||
$this->ipsclass->DB->force_data_type = array( 'last_poster_name' => 'string' );
|
||||
|
||||
|
||||
$this->ipsclass->DB->simple_exec_query( array( 'update' => 'topics', 'set' => $db_string.", posts=posts+1", 'where' => 'tid='.$tid ) );
|
||||
|
||||
$add_posts++;
|
||||
@@ -552,6 +589,8 @@ class func_mod
|
||||
|
||||
if ( is_array( $id ) )
|
||||
{
|
||||
$id = $this->ipsclass->clean_int_array( $id );
|
||||
|
||||
if ( count($id) > 0 )
|
||||
{
|
||||
$tid = " IN(".implode(",",$id).")";
|
||||
@@ -585,6 +624,30 @@ class func_mod
|
||||
|
||||
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'voters', 'where' => "tid".$tid ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove subscriptions to this topic
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'tracker', 'where' => "topic_id".$tid ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove ratings to this topic
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'topic_ratings', 'where' => "rating_tid".$tid ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove topics read markers for this topic
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'topics_read', 'where' => "read_tid".$tid ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove stored views for this topic
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'topic_views', 'where' => "views_tid".$tid ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove polls assigned to this topic
|
||||
//-----------------------------------------
|
||||
@@ -609,7 +672,7 @@ class func_mod
|
||||
|
||||
if ( count( $posts ) )
|
||||
{
|
||||
$this->ipsclass->DB->simple_construct( array( "select" => '*', 'from' => 'attachments', 'where' => "attach_pid IN (".implode(",",$posts).")" ) );
|
||||
$this->ipsclass->DB->simple_construct( array( "select" => '*', 'from' => 'attachments', 'where' => "attach_rel_module='post' AND attach_rel_id IN (".implode(",",$posts).")" ) );
|
||||
$o = $this->ipsclass->DB->simple_exec();
|
||||
|
||||
while ( $killmeh = $this->ipsclass->DB->fetch_row( $o ) )
|
||||
@@ -674,6 +737,8 @@ class func_mod
|
||||
|
||||
if ( is_array( $topics ) )
|
||||
{
|
||||
$topics = $this->ipsclass->clean_int_array( $topics );
|
||||
|
||||
if ( count($topics) > 0 )
|
||||
{
|
||||
$tid = " IN(".implode(",",$topics).")";
|
||||
@@ -716,6 +781,10 @@ class func_mod
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'topics', 'where' => "tid".$tid ) );
|
||||
$oq = $this->ipsclass->DB->simple_exec();
|
||||
|
||||
$this->ipsclass->DB->force_data_type = array( 'title' => 'string',
|
||||
'starter_name' => 'string',
|
||||
'last_poster_name' => 'string' );
|
||||
|
||||
while ( $row = $this->ipsclass->DB->fetch_row($oq) )
|
||||
{
|
||||
$this->ipsclass->DB->do_insert( 'topics', array (
|
||||
@@ -888,6 +957,17 @@ class func_mod
|
||||
|
||||
$last_post = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
|
||||
$sort_key = $this->ipsclass->cache['forum_cache'][ $fid ]['sort_key'] ?
|
||||
$this->ipsclass->cache['forum_cache'][ $fid ]['sort_key'] : 'last_post';
|
||||
|
||||
$newest_topic = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'title, tid',
|
||||
'from' => 'topics',
|
||||
'where' => 'forum_id='.$fid.' and approved=1',
|
||||
'order' => $sort_key.' desc',
|
||||
'limit' => array( 0,1 )
|
||||
) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Reset this forums stats
|
||||
//-----------------------------------------
|
||||
@@ -902,12 +982,17 @@ class func_mod
|
||||
'posts' => intval($posts['replies']),
|
||||
'queued_topics' => intval($queued_topics['count']),
|
||||
'queued_posts' => intval($queued_posts['replies']),
|
||||
'newest_id' => $newest_topic['tid'],
|
||||
'newest_title' => $newest_topic['title'],
|
||||
);
|
||||
|
||||
if ( $this->ipsclass->forums->forum_by_id[ $fid ]['_update_deletion'] )
|
||||
if ( isset($this->ipsclass->forums->forum_by_id[ $fid ]['_update_deletion']) AND $this->ipsclass->forums->forum_by_id[ $fid ]['_update_deletion'] )
|
||||
{
|
||||
$dbs['forum_last_deletion'] = time();
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->force_data_type = array( 'last_poster_name' => 'string',
|
||||
'last_title' => 'string' );
|
||||
|
||||
$this->ipsclass->DB->do_update( 'forums', $dbs, "id=".$fid );
|
||||
|
||||
@@ -956,7 +1041,7 @@ class func_mod
|
||||
|
||||
$final_array = array();
|
||||
|
||||
foreach( $this->stm as $idx => $real_array )
|
||||
foreach( $this->stm as $real_array )
|
||||
{
|
||||
foreach( $real_array as $k => $v )
|
||||
{
|
||||
@@ -968,6 +1053,8 @@ class func_mod
|
||||
|
||||
if ( is_array($id) )
|
||||
{
|
||||
$id = $this->ipsclass->clean_int_array( $id );
|
||||
|
||||
if ( count($id) > 0 )
|
||||
{
|
||||
$this->ipsclass->DB->simple_exec_query( array( 'update' => 'topics', 'set' => $db_string, 'where' => "tid IN(".implode( ",", $id ).")" ) );
|
||||
@@ -1125,7 +1212,9 @@ class func_mod
|
||||
|
||||
function sql_prune_create( $forum_id, $starter_id="", $topic_state="", $post_min="", $date_exp="", $ignore_pin="", $pergo=0, $limit=0 )
|
||||
{
|
||||
$sql = "SELECT tid FROM ibf_topics WHERE approved=1 and forum_id=".intval($forum_id);
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'tid', 'from' => 'topics', 'where' => 'approved=1 and forum_id='.intval($forum_id) ) );
|
||||
|
||||
$sql = $this->ipsclass->DB->cur_query;
|
||||
|
||||
if ( intval($date_exp) )
|
||||
{
|
||||
@@ -1222,6 +1311,11 @@ class func_mod
|
||||
|
||||
function add_moderate_log($fid, $tid, $pid, $t_title, $mod_title='Unknown')
|
||||
{
|
||||
$this->ipsclass->DB->force_data_type = array( 'member_name' => 'string' );
|
||||
|
||||
$qstring = $this->ipsclass->my_getenv('QUERY_STRING');
|
||||
$qstring = htmlentities( strip_tags( str_replace( '\\', '', $qstring ) ) );
|
||||
|
||||
$this->ipsclass->DB->do_insert( 'moderator_logs', array (
|
||||
'forum_id' => $fid,
|
||||
'topic_id' => $tid,
|
||||
@@ -1229,11 +1323,11 @@ class func_mod
|
||||
'member_id' => $this->ipsclass->member['id'],
|
||||
'member_name' => $this->ipsclass->member['members_display_name'],
|
||||
'ip_address' => $this->ipsclass->input['IP_ADDRESS'],
|
||||
'http_referer'=> $_SERVER['HTTP_REFERER'],
|
||||
'http_referer'=> $this->ipsclass->my_getenv('HTTP_REFERER'),
|
||||
'ctime' => time(),
|
||||
'topic_title' => $t_title,
|
||||
'action' => $mod_title,
|
||||
'query_string'=> $_SERVER['QUERY_STRING'],
|
||||
'query_string'=> $qstring,
|
||||
) );
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1241,12 +1335,4 @@ class func_mod
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user