Version 2.0.0

This commit is contained in:
Neo committed 2025-12-19 00:19:56 -08:00
1 parent 5699abfc0e
commit 0eecc172d9
696 files changed
+120723 -77160

No files matched your search

+214 -161
View File
@@ -2,16 +2,15 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v1.3.1 Final
| ========================================
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2003 Invision Power Services
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| ========================================
| =============================================
| Web: http://www.invisionboard.com
| Time: Thu, 23 Sep 2004 23:05:01 GMT
| Release: 3cb325c445e1909182084806ae7f8226
| Email: matt@invisionpower.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
@@ -20,11 +19,16 @@
| > Date started: 6th March 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Mon 24th May 2004
+--------------------------------------------------------------------------
*/
$idx = new stats;
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();
}
class stats {
@@ -33,14 +37,14 @@ class stats {
var $html = "";
var $forum = "";
function stats() {
function auto_run() {
//------------------------------------------------------
//-----------------------------------------
// $is_sub is a boolean operator.
// If set to 1, we don't show the "topic subscribed" page
// we simply end the subroutine and let the caller finish
// up for us.
//------------------------------------------------------
//-----------------------------------------
global $ibforums, $DB, $std, $print, $skin_universal;
@@ -50,9 +54,9 @@ class stats {
$this->base_url = $ibforums->base_url;
//--------------------------------------------
//-----------------------------------------
// What to do?
//--------------------------------------------
//-----------------------------------------
switch($ibforums->input['CODE'])
{
@@ -84,7 +88,7 @@ class stats {
function who_posted()
{
global $ibforums, $DB, $std, $print;
global $ibforums, $DB, $std, $print;
$tid = intval(trim($ibforums->input['t']));
@@ -92,8 +96,8 @@ class stats {
$this->check_access($tid);
$DB->query("SELECT COUNT(p.pid) as pcount, p.author_id, p.author_name FROM ibf_posts p
WHERE p.topic_id=$tid AND queued <> 1 GROUP BY p.author_name ORDER BY pcount DESC");
$DB->cache_add_query( 'stats_who_posted', array( 'tid' => $tid ) );
$DB->cache_exec_query();
if ( $DB->get_num_rows() )
{
@@ -122,11 +126,11 @@ class stats {
exit();
}
//--------------------------------
//-----------------------------------------
function check_access($tid)
{
global $ibforums, $DB, $std, $HTTP_COOKIE_VARS;
global $ibforums, $DB, $std, $HTTP_COOKIE_VARS, $forums;
// check for faked session ID's :D
@@ -149,11 +153,14 @@ class stats {
// $std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission') );
//}
//--------------------------------
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*,title as topic_title', 'from' => 'topics', 'where' => "tid=".$tid ) );
$DB->simple_exec();
$DB->query("SELECT t.title as topic_title, f.read_perms, f.password, f.id from ibf_forums f, ibf_topics t WHERE t.tid=$tid and f.id=t.forum_id");
$this->forum = $DB->fetch_row();
$this->forum = array_merge( $this->forum, $forums->forum_by_id[ $this->forum['forum_id'] ] );
$return = 1;
@@ -177,140 +184,177 @@ class stats {
}
//--------------------------------
/*-------------------------------------------------------------------------*/
// SHOW FORUM LEADERS
/*-------------------------------------------------------------------------*/
function show_leaders()
{
global $ibforums, $DB, $std;
global $ibforums, $DB, $std, $forums;
//$this->output .= $this->html->page_title( $ibforums->lang['forum_leaders'] );
//--------------------------------------------
// Work out where our super mods are at
//--------------------------------------------
//-----------------------------------------
// Work out where our super mods / admins/ mods
// are.....
//-----------------------------------------
$sup_ids = array();
$group_ids = array();
$member_ids = array();
$used_ids = array();
$members = array();
$moderators = array();
$DB->query("SELECT g_id from ibf_groups WHERE g_is_supmod = 1");
foreach( $ibforums->cache['group_cache'] as $d => $i )
{
if ( $i['g_is_supmod'] )
{
$group_ids[ $i['g_id'] ] = $i['g_id'];
}
if ( $i['g_access_cp'] )
{
$group_ids[ $i['g_id'] ] = $i['g_id'];
}
}
foreach( $ibforums->cache['moderators'] as $d => $i )
{
if ( $i['is_group'] )
{
$group_ids[ $i['group_id'] ] = $i['group_id'];
}
else
{
$member_ids[ $i['member_id'] ] = $i['member_id'];
}
}
if ( $DB->get_num_rows() )
//-----------------------------------------
// Get all members.. (two is more eff. than 1)
//-----------------------------------------
if ( count( $member_ids ) )
{
while ( $i = $DB->fetch_row() )
{
$sup_ids[] = $i['g_id'];
}
$DB->cache_add_query( 'stats_get_all_members', array( 'member_ids' => $member_ids ) );
$DB->cache_exec_query();
while( $r = $DB->fetch_row() )
{
$members[ $r['id'] ] = $r;
}
}
//--------------------------------------------
// Get our admins
//--------------------------------------------
//-----------------------------------------
// Get all groups.. (two is more eff. than 1)
//-----------------------------------------
$admin_ids = array();
$DB->cache_add_query( 'stats_get_all_members_groups', array( 'group_ids' => $group_ids ) );
$DB->cache_exec_query();
$DB->query("SELECT m.id, m.name, m.email, m.hide_email, m.location, m.aim_name, m.icq_number, g.g_access_cp
FROM ibf_members m, ibf_groups g
WHERE g.g_access_cp=1 AND m.mgroup=g.g_id ORDER BY m.name");
while( $r = $DB->fetch_row() )
{
$members[ $r['id'] ] = $r;
}
//-----------------------------------------
// PRINT: Admins
//-----------------------------------------
$this->output .= $this->html->group_strip( $ibforums->lang['leader_admins'] );
while ( $member = $DB->fetch_row() )
foreach( $members as $id => $member )
{
$this->output .= $this->html->leader_row( $this->parse_member( $member ), $ibforums->lang['leader_all_forums'] );
$admin_ids[] = $member['id'];
if ( $ibforums->cache['group_cache'][ $member['mgroup'] ]['g_access_cp'] )
{
$this->output .= $this->html->leader_row( $this->parse_member( $member ), $ibforums->lang['leader_all_forums'] );
//-----------------------------------------
// Used...
//-----------------------------------------
$used_ids[] = $id;
}
}
$this->output .= $this->html->close_strip();
//--------------------------------------------
// Do the bizz with the super men, er mods.
//--------------------------------------------
//-----------------------------------------
// PRINT: Super Moderators
//-----------------------------------------
$admin_ids[] = '0';
$tmp_html = "";
if ( count($sup_ids) > 0 )
foreach( $members as $id => $member )
{
$DB->query("SELECT id, name, email, hide_email, location, aim_name, icq_number from ibf_members WHERE mgroup IN (".implode( ',', $sup_ids ).") and id NOT IN(".implode(',', $admin_ids).") ORDER BY name");
if ( $DB->get_num_rows() )
if ( $ibforums->cache['group_cache'][ $member['mgroup'] ]['g_is_supmod'] and ( ! in_array( $id, $used_ids) ) )
{
$this->output .= $this->html->group_strip( $ibforums->lang['leader_global'] );
$tmp_html .= $this->html->leader_row( $this->parse_member( $member ), $ibforums->lang['leader_all_forums'] );
while ( $member = $DB->fetch_row() )
{
$this->output .= $this->html->leader_row( $this->parse_member( $member ), $ibforums->lang['leader_all_forums'] );
}
$this->output .= $this->html->close_strip();
}
//-----------------------------------------
// Used...
//-----------------------------------------
$used_ids[] = $id;
}
}
if ( $tmp_html )
{
$this->output .= $this->html->group_strip( $ibforums->lang['leader_global'] );
$this->output .= $tmp_html;
$this->output .= $this->html->close_strip();
}
//--------------------------------------------
// Do we have any moderators? NORMAL MODS 1st
//--------------------------------------------
//-----------------------------------------
// GET MODERATORS: Normal
//-----------------------------------------
$DB->query("SELECT m2.id, m2.name, m2.email, m2.hide_email, m2.location, m2.aim_name, m2.icq_number,
f.id as forum_id, f.read_perms, f.name as forum_name, c.state
FROM ibf_moderators mod
LEFT JOIN ibf_forums f ON(f.id=mod.forum_id)
LEFT JOIN ibf_categories c ON(c.id=f.category AND c.state != 0)
LEFT JOIN ibf_members m2 ON (mod.member_id=m2.id)
");
$tmp_html = "";
$data = array();
while ( $i = $DB->fetch_row() )
foreach( $members as $id => $member )
{
if ( ! $i['name'] )
if ( ! in_array( $id, $used_ids) )
{
continue;
}
if ( $std->check_perms($i['read_perms']) == TRUE )
{
$data[] = $i;
foreach( $ibforums->cache['moderators'] as $idx => $data )
{
if ( $data['is_group'] and $data['group_id'] == $member['mgroup'] )
{
if ( $std->check_perms( $forums->forum_by_id[ $data['forum_id'] ]['read_perms'] ) == TRUE )
{
$moderators[] = array_merge( $member, array( 'forum_id' => $data['forum_id'] ) );
}
$used_ids[] = $id;
}
else if ( $data['member_id'] == $member['id'] )
{
if ( $std->check_perms( $forums->forum_by_id[ $data['forum_id'] ]['read_perms'] ) == TRUE )
{
$moderators[] = array_merge( $member, array( 'forum_id' => $data['forum_id'] ) );
}
$used_ids[] = $id;
}
}
}
}
//--------------------------------------------
// Do we have any moderators? GROUP MODS 1st
//--------------------------------------------
//-----------------------------------------
// Parse moderators
//-----------------------------------------
$DB->query("SELECT m.id, m.name, m.email, m.hide_email, m.location, m.aim_name, m.icq_number,
f.id as forum_id, f.read_perms, f.name as forum_name, c.state
FROM ibf_moderators mod
LEFT JOIN ibf_forums f ON(f.id=mod.forum_id)
LEFT JOIN ibf_categories c ON(c.id=f.category AND c.state != 0)
LEFT JOIN ibf_members m ON ((mod.is_group=1 and mod.group_id=m.mgroup))
");
while ( $i = $DB->fetch_row() )
{
if ( ! $i['name'] )
{
continue;
}
if ( $std->check_perms($i['read_perms']) == TRUE )
{
$data[] = $i;
}
}
//------------------------
if ( count($data) > 0 )
if ( count($moderators) > 0 )
{
$mod_array = array();
$this->output .= $this->html->group_strip( $ibforums->lang['leader_mods'] );
foreach ( $data as $idx => $i )
foreach ( $moderators as $idx => $i )
{
if ( !isset( $mod_array['member'][ $i['id'] ][ 'name' ] ) )
if ( ! isset( $mod_array['member'][ $i['id'] ][ 'name' ] ) )
{
//-----------------------------------------
// Member is not already set, lets add the member...
//-----------------------------------------
$mod_array['member'][ $i['id'] ] = array( 'name' => $i['name'],
'email' => $i['email'],
@@ -323,9 +367,11 @@ class stats {
}
//-----------------------------------------
// Add forum..
$mod_array['forums'][ $i['id'] ][] = array($i['forum_id'], $i['forum_name']);
//-----------------------------------------
$mod_array['forums'][ $i['id'] ][] = array( $i['forum_id'] , $forums->forum_by_id[ $i['forum_id'] ]['name'] );
}
foreach( $mod_array['member'] as $id => $data )
@@ -354,7 +400,6 @@ class stats {
$this->parse_member( $mod_array['member'][ $id ] ),
$fhtml
);
}
$this->output .= $this->html->close_strip();
@@ -363,12 +408,11 @@ class stats {
$this->page_title = $ibforums->lang['forum_leaders'];
$this->nav = array( $ibforums->lang['forum_leaders'] );
}
function show_queries()
{
global $ibforums, $DB, $std;
global $ibforums, $DB, $std;
// show DB queries in graphic format(depreciated)
// left here to stop other functions breaking
@@ -378,65 +422,79 @@ class stats {
exit();
}
/*-------------------------------------------------------------------------*/
// Top 10 Posters
/*-------------------------------------------------------------------------*/
function show_today_posters()
{
global $ibforums, $DB, $std;
//$this->output .= $this->html->page_title( $ibforums->lang['todays_posters'] );
global $ibforums, $DB, $std, $forums;
$this->output .= $this->html->top_poster_header();
$time_high = time();
$ids = array();
$time_low = $time_high - (60*60*24);
$time_low = $time_high - (60*60*24);
//--------------------------------------------
//-----------------------------------------
// Query the DB
//--------------------------------------------
//-----------------------------------------
$DB->query("SELECT COUNT(pid) as count FROM ibf_posts WHERE post_date < $time_high and post_date > $time_low");
$todays_posts = $DB->fetch_row();
if ($todays_posts['count'] > 0)
foreach( $forums->forum_by_id as $id => $data )
{
if ( ! $data['inc_postcount'] )
{
continue;
}
$ids[] = $id;
}
$DB->query("SELECT COUNT(p.pid) as tpost, m.id, m.name, m.joined, m.posts FROM ibf_posts p, ibf_members m "
."WHERE m.id > 0 AND m.id=p.author_id and post_date < $time_high and post_date > $time_low GROUP BY p.author_id ORDER BY tpost DESC LIMIT 0,10");
if ( $DB->get_num_rows() )
{
$todays_posts = 0;
$store = array();
$DB->simple_construct( array( 'select' => 'count(*) as cnt', 'from' => 'posts', 'where' => "post_date > $time_low" ) );
$DB->simple_exec();
$total_today = $DB->fetch_row();
$DB->cache_add_query( 'stats_get_todays_posters', array( 'ids' => $ids, 'time_low' => $time_low ) );
$DB->cache_exec_query();
while ($r = $DB->fetch_row())
{
$todays_posts += $r['tpost'];
while ($info = $DB->fetch_row())
$store[] = $r;
}
if ( $todays_posts )
{
foreach( $store as $idx => $info )
{
$info['total_today_posts'] = $todays_posts;
if ($todays_posts > 0 and $info['tpost'] > 0)
{
$info['total_today_posts'] = $todays_posts['count'];
if ($todays_posts['count'] > 0 and $info['tpost'] > 0)
{
$info['today_pct'] = sprintf( '%.2f', ( $info['tpost'] / $todays_posts['count'] ) * 100 );
}
$info['joined'] = $std->get_date( $info['joined'], 'JOINED' );
$info['posts'] = $std->do_number_format($info['posts']);
$info['tpost'] = $std->do_number_format($info['tpost']);
$this->output .= $this->html->top_poster_row( $info );
$info['today_pct'] = sprintf( '%.2f', ( $info['tpost'] / $total_today['cnt'] ) * 100 );
}
$info['joined'] = $std->get_date( $info['joined'], 'JOINED' );
$info['posts'] = $std->do_number_format($info['posts']);
$info['tpost'] = $std->do_number_format($info['tpost']);
$this->output .= $this->html->top_poster_row( $info );
}
else
{
$this->output .= $this->html->top_poster_no_info();
}
}
else
{
$this->output .= $this->html->top_poster_no_info();
}
$this->output .= $this->html->top_poster_footer( $std->do_number_format($todays_posts['count']) );
$this->output .= $this->html->top_poster_footer();
$this->page_title = $ibforums->lang['top_poster_title'];
@@ -474,7 +532,7 @@ class stats {
//------------------------------------------------------------------------------------------------
//-----------------------------------------
function parse_member( $member )
{
@@ -544,9 +602,4 @@ class stats {
}
?>
?>