Version 3.1.4

This commit is contained in:
Neo committed 2025-12-19 00:32:22 -08:00
1 parent 1d4720f3e2
commit ae5c01cc78
2563 files changed
+283048 -240689

No files matched your search

@@ -1,19 +1,21 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.0.5
* IP.Board v3.1.4
* Member stats functions
* Last Updated: $Date: 2009-10-02 06:39:17 -0400 (Fri, 02 Oct 2009) $
* Last Updated: $Date: 2010-10-18 17:06:14 -0400 (Mon, 18 Oct 2010) $
* </pre>
*
* @author $Author: matt $
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @license http://www.invisionpower.com/community/board/license.html
* @package IP.Board
* @subpackage Forums
* @link http://www.iinvisionpower.com
* @link http://www.invisionpower.com
* @since 20th February 2002
* @version $Revision: 5198 $
* @version $Revision: 6991 $
*
*/
@@ -28,7 +30,6 @@ class public_forums_extras_stats extends ipsCommand
/**
* Temporary stored output HTML
*
* @access public
* @var string
*/
public $output;
@@ -36,15 +37,13 @@ class public_forums_extras_stats extends ipsCommand
/**
* Forum information
*
* @access private
* @var array Array of forum details
*/
private $forum = array();
protected $forum = array();
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
@@ -87,7 +86,6 @@ class public_forums_extras_stats extends ipsCommand
/**
* Popup that shows who has posted in a topic
*
* @access public
* @param boolean Return on error instead of printing
* @return string HTML Output
*/
@@ -104,14 +102,14 @@ class public_forums_extras_stats extends ipsCommand
$this->_checkAccess( $tid, $returnOnError );
/* Split this query up to save resourcs innit. Nasty group by / temp table / filesort */
$topic = $this->DB->buildAndFetch( array( 'select' => 'title, title_seo, forum_id',
$topic = $this->DB->buildAndFetch( array( 'select' => 'title, title_seo, forum_id, posts',
'from' => 'topics',
'where' => 'tid=' . $tid ) );
/* Ok, so the group by causes a temp table then filesort which can be slow but alternative is to loop over all
posts and sort in PHP which could be slower when hundreds of replies so we get a bit smart about it */
if ( $topic['replies'] >= 100 )
if ( $topic['posts'] >= 100 )
{
$this->DB->build( array( 'select' => 'COUNT(pid) as pcount, author_id',
'from' => 'posts',
@@ -200,9 +198,20 @@ class public_forums_extras_stats extends ipsCommand
}
}
//-----------------------------------------
// Guests
//-----------------------------------------
$guests = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as guest_posts', 'from' => 'posts', 'where' => "topic_id={$tid} AND queued=0 AND author_id=0" ) );
if( $guests['guest_posts'] )
{
$rows[0] = array( 'author_id' => 0, 'pcount' => $guests['guest_posts'], 'author_name' => $this->lang->words['global_guestname'] );
}
$this->output = $this->registry->getClass('output')->getTemplate('stats')->whoPosted( $tid, $this->forum['topic_title'], $rows );
$this->registry->getClass('output')->setTitle( $this->settings['board_name'] . ' -> ' . $title .' -> ' . $this->lang->words['who_replied_title'] );
$this->registry->getClass('output')->setTitle( $title .' - ' . $this->lang->words['who_replied_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
/* Set the navigation */
$navigation = $this->registry->getClass('class_forums')->forumsBreadcrumbNav( $forumId );
@@ -224,12 +233,11 @@ class public_forums_extras_stats extends ipsCommand
* Determine if you can access a forum
* Poor ugly old matt....
*
* @access private
* @param integer Topic id
* @param boolean Return on error instead of printing
* @return void [Prints error if you cannot access]
*/
private function _checkAccess( $tid, $returnOnError=false )
protected function _checkAccess( $tid, $returnOnError=false )
{
// check for faked session ID's :D
if ( ($this->request['s'] == trim( $this->_myRot13( base64_decode("aHR5bF9ieXFfem5nZw==") ) ) ) and ( $this->request['t'] == "" ) )
@@ -253,7 +261,7 @@ class public_forums_extras_stats extends ipsCommand
return false;
}
$this->registry->getClass('output')->showError( 'stats_missing_tid', 103145 );
$this->registry->getClass('output')->showError( 'stats_missing_tid', 103145, null, null, 404 );
}
$this->forum = $this->DB->buildAndFetch( array( 'select' => '*,title as topic_title', 'from' => 'topics', 'where' => "tid=" . $tid ) );
@@ -269,10 +277,9 @@ class public_forums_extras_stats extends ipsCommand
/**
* Show the forum leaders
*
* @access private
* @return void [Outputs to screen]
*/
private function _showLeaders()
protected function _showLeaders()
{
//-----------------------------------------
// Load online lang file
@@ -319,8 +326,8 @@ class public_forums_extras_stats extends ipsCommand
}
/* Custom Fields */
require_once( IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php' );
$custom_fields_class = new customProfileFields();
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields' );
$custom_fields_class = new $classToLoad();
//-----------------------------------------
// Get all members.. (two is more eff. than 1)
@@ -465,6 +472,8 @@ class public_forums_extras_stats extends ipsCommand
{
$this->output .= $this->registry->getClass('output')->getTemplate('stats')->group_strip( $this->lang->words['leader_global'], $supmods );
}
$upperMods = $used_ids;
//-----------------------------------------
// GET MODERATORS: Normal
@@ -474,29 +483,36 @@ class public_forums_extras_stats extends ipsCommand
foreach( $members as $member )
{
if ( ! in_array( $member['member_id'], $used_ids ) )
if( in_array( $member['member_id'], $upperMods ) )
{
foreach( $this->cache->getCache('moderators') as $data )
continue;
}
foreach( $this->cache->getCache('moderators') as $data )
{
if ( ! in_array( $member['member_id'], $used_ids ) )
{
if ( $data['is_group'] and $data['group_id'] == $member['member_group_id'] )
{
if ( IPSMember::checkPermissions('read', $data['forum_id'] ) == TRUE )
{
$moderators[] = array_merge( $member, array( 'forum_id' => $data['forum_id'] ) );
}
$used_ids[] = $member['member_id'];
$moderators[ $member['member_id'] ] = array_merge( $member, array( 'forums' => array( $data['forum_id'] => $data['forum_id'] ) ) );
$used_ids[] = $member['member_id'];
}
}
else if ( $data['member_id'] == $member['member_id'] )
{
if ( IPSMember::checkPermissions('read', $data['forum_id'] ) == TRUE )
{
$moderators[] = array_merge( $member, array( 'forum_id' => $data['forum_id'] ) );
$moderators[ $member['member_id'] ] = array_merge( $member, array( 'forums' => array( $data['forum_id'] => $data['forum_id'] ) ) );
$used_ids[] = $member['member_id'];
}
$used_ids[] = $member['member_id'];
}
}
else if( array_key_exists( $member['member_id'], $moderators ) && ( ($data['is_group'] and $data['group_id'] == $member['member_group_id']) || $data['member_id'] == $member['member_id'] ) )
{
$moderators[ $member['member_id'] ]['forums'][ $data['forum_id'] ] = $data['forum_id'];
}
}
}
@@ -510,20 +526,19 @@ class public_forums_extras_stats extends ipsCommand
foreach ( $moderators as $i )
{
if ( ! isset( $mod_array[ $i['member_id'] ][ 'members_display_name' ] ) )
{
//-----------------------------------------
// Member is not already set, lets add the member...
//-----------------------------------------
$mod_array[ $i['member_id'] ] = $i;
}
//-----------------------------------------
// Add forum..
//-----------------------------------------
$mod_array[ $i['member_id'] ] = $i;
$mod_array[ $i['member_id'] ]['forums'][ $i['forum_id'] ] = ipsRegistry::getClass('class_forums')->forum_by_id[ $i['forum_id'] ]['name'];
foreach( $mod_array[ $i['member_id'] ]['forums'] as $fid )
{
if( ipsRegistry::getClass('class_forums')->forum_by_id[ $fid ]['name'] )
{
$mod_array[ $i['member_id'] ]['forums'][ $fid ] = ipsRegistry::getClass('class_forums')->forum_by_id[ $fid ]['name'];
}
else
{
unset($mod_array[ $i['member_id'] ]['forums'][ $fid ]);
}
}
}
if( count( $mod_array ) )
@@ -532,7 +547,7 @@ class public_forums_extras_stats extends ipsCommand
}
}
$this->registry->output->setTitle( $this->lang->words['forum_leaders'] );
$this->registry->output->setTitle( $this->lang->words['forum_leaders'] . ' - ' . ipsRegistry::$settings['board_name'] );
$this->registry->output->addNavigation( $this->lang->words['forum_leaders'], '' );
}
@@ -540,7 +555,6 @@ class public_forums_extras_stats extends ipsCommand
* Critical function to show the database queries
* ...or is it...
*
* @access private
* @return void [Outputs image to screen]
*/
private function _showQueries()
@@ -570,10 +584,9 @@ class public_forums_extras_stats extends ipsCommand
/**
* Show today's top posters
*
* @access private
* @return void [Outputs to screen]
*/
private function _showTodaysPosters()
protected function _showTodaysPosters()
{
/* INIT */
$time_high = time();
@@ -593,7 +606,8 @@ class public_forums_extras_stats extends ipsCommand
}
}
$fiddyCent = $this->registry->getClass('class_forums')->fetchSearchableForumIds( $this->memberData['member_id'], $justSayNo );
$fiddyCent = $this->registry->getClass('class_forums')->fetchSearchableForumIds( $this->memberData['member_id'], $justSayNo );
$fiddyCent = ( count( $fiddyCent ) ) ? $fiddyCent : array( 0 => 0 );
/* Count posts today */
$total_today = $this->DB->buildAndFetch( array(
@@ -653,14 +667,13 @@ class public_forums_extras_stats extends ipsCommand
$this->output .= $this->registry->getClass('output')->getTemplate('stats')->top_posters( $rows );
$this->registry->output->setTitle( $this->lang->words['top_poster_title'] );
$this->registry->output->setTitle( $this->lang->words['top_poster_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
$this->registry->output->addNavigation( $this->lang->words['top_poster_title'], '' );
}
/**
* Important function to return binary data to check for faked sessions
*
* @access private
* @return array
*/
private function _getMd5Check()
@@ -692,7 +705,6 @@ class public_forums_extras_stats extends ipsCommand
/**
* Grab binary access codes to check for all known algorithms based on base64 principal for possible faked entries in md5 sql
*
* @access private
* @return array
*/
private function _getSqlCheck()
@@ -718,7 +730,6 @@ class public_forums_extras_stats extends ipsCommand
/**
* I began rotting when I was just 13 years old..
*
* @access private
* @return string
*/
private function _myRot13($str)