Version 3.2.3
This commit is contained in:
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 file for statistics 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 'statistics' 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 = 'stats';
|
||||
@@ -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,18 +2,18 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Forum Statistics
|
||||
* Last Updated: $Date: 2010-09-13 05:53:37 -0400 (Mon, 13 Sep 2010) $
|
||||
* Last Updated: $Date: 2011-09-06 06:56:14 -0400 (Tue, 06 Sep 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: terabyte $
|
||||
* @author $Author: mark $
|
||||
* @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
|
||||
* @version $Rev: 6854 $
|
||||
* @link http://hatynka.in
|
||||
* @version $Rev: 9456 $
|
||||
*/
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ class admin_forums_statistics_stats extends ipsCommand
|
||||
/**
|
||||
* Array of Month Names
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
protected $month_names;
|
||||
@@ -36,7 +35,6 @@ class admin_forums_statistics_stats extends ipsCommand
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
protected $html;
|
||||
@@ -44,9 +42,8 @@ class admin_forums_statistics_stats extends ipsCommand
|
||||
/**
|
||||
* 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 )
|
||||
{
|
||||
@@ -78,9 +75,37 @@ class admin_forums_statistics_stats extends ipsCommand
|
||||
$this->registry->output->ignoreCoreNav = true;
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=statistics', $this->lang->words['stats_title'] );
|
||||
|
||||
/* Silly timezones */
|
||||
$tz = floor( $this->memberData['time_offset'] );
|
||||
$this->DB->setTimeZone( $tz );
|
||||
if ( $tz == 0 )
|
||||
{
|
||||
date_default_timezone_set( 'GMT' );
|
||||
}
|
||||
elseif ( $tz > 0 )
|
||||
{
|
||||
date_default_timezone_set( 'Etc/GMT-' . $tz );
|
||||
}
|
||||
elseif ( $tz < 0 )
|
||||
{
|
||||
date_default_timezone_set( 'Etc/GMT+' . abs( $tz ) );
|
||||
}
|
||||
|
||||
/* What to do */
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
{
|
||||
case 'spam':
|
||||
$this->statsMainScreen( 'spam' );
|
||||
break;
|
||||
|
||||
case 'show_spam':
|
||||
$this->spamServiceResultScreen();
|
||||
break;
|
||||
|
||||
case 'spamGraph':
|
||||
$this->spamServiceGraph();
|
||||
break;
|
||||
|
||||
case 'show_reg':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_registration' );
|
||||
$this->result_screen( 'reg' );
|
||||
@@ -145,20 +170,283 @@ class admin_forums_statistics_stats extends ipsCommand
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a 1x1 transparent gif and safely exist
|
||||
*
|
||||
* @return @e void
|
||||
*/
|
||||
protected function _safeExit()
|
||||
{
|
||||
$content = base64_decode( "R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" );
|
||||
header( "Content-type: image/gif" );
|
||||
header( "Connection: Close" );
|
||||
header( "Cache-Control: public, max-age=86400" );
|
||||
header( "Expires: " . gmdate( "D, d M Y, H:i:s", time() + 86400 ) . " GMT" );
|
||||
print $content;
|
||||
flush();
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a graph of spam service stats
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function spamServiceGraph()
|
||||
{
|
||||
/* Check the to fields */
|
||||
if ( ! checkdate( $this->request['to_month'], $this->request['to_day'], $this->request['to_year'] ) )
|
||||
{
|
||||
$this->_safeExit();
|
||||
}
|
||||
|
||||
/* Check the from fields */
|
||||
if ( ! checkdate( $this->request['from_month'] ,$this->request['from_day'] ,$this->request['from_year'] ) )
|
||||
{
|
||||
$this->_safeExit();
|
||||
}
|
||||
|
||||
/* Create time stamps */
|
||||
$to_time = mktime(12 ,0 ,0 ,$this->request['to_month'] ,$this->request['to_day'] ,$this->request['to_year'] );
|
||||
$from_time = mktime(12 ,0 ,0 ,$this->request['from_month'] ,$this->request['from_day'] ,$this->request['from_year']);
|
||||
|
||||
/* Get Human Dates */
|
||||
$human_to_date = getdate( $to_time );
|
||||
$human_from_date = getdate( $from_time );
|
||||
|
||||
/* Setup Timescale */
|
||||
switch( $this->request['timescale'] )
|
||||
{
|
||||
case 'daily':
|
||||
$php_date = "F jS - Y";
|
||||
break;
|
||||
|
||||
case 'monthly':
|
||||
$php_date = "F Y";
|
||||
break;
|
||||
|
||||
default:
|
||||
$php_date = "W [F Y]";
|
||||
break;
|
||||
}
|
||||
|
||||
$order = $this->request['sortby'] == 'desc' ? 'desc' : 'asc';
|
||||
|
||||
/* Query Spam Logs */
|
||||
$this->DB->build( array(
|
||||
'select' => 'log_code, log_date',
|
||||
'from' => 'spam_service_log',
|
||||
'where' => 'log_date > ' . $from_time . ' AND log_date < ' . $to_time,
|
||||
'order' => 'log_date ' . $order
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
/* Make sure we have logs */
|
||||
if( ! $this->DB->getTotalRows() )
|
||||
{
|
||||
$this->_safeExit();
|
||||
}
|
||||
|
||||
/* Loop through and build data for two graph lines */
|
||||
$notSpamData = array();
|
||||
$isSpamData = array();
|
||||
$labels = array();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
/* Ignore errors */
|
||||
if( $r['log_code'] == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Date */
|
||||
$logDate = date( $php_date, $r['log_date'] );
|
||||
|
||||
if( ! in_array( $logDate, $labels ) )
|
||||
{
|
||||
$labels[] = $logDate;
|
||||
}
|
||||
|
||||
if( ! isset( $notSpamData[ $logDate ] ) )
|
||||
{
|
||||
$notSpamData[ $logDate ] = 0;
|
||||
}
|
||||
|
||||
if( ! isset( $isSpamData[ $logDate ] ) )
|
||||
{
|
||||
$isSpamData[ $logDate ] = 0;
|
||||
}
|
||||
|
||||
if( $r['log_code'] == 1 )
|
||||
{
|
||||
$notSpamData[ $logDate ]++;
|
||||
}
|
||||
else if( in_array( $r['log_code'], array( 2, 3, 4 ) ) )
|
||||
{
|
||||
$isSpamData[ $logDate ]++;
|
||||
}
|
||||
}
|
||||
|
||||
if( !count($notSpamData) AND !count($isSpamData) )
|
||||
{
|
||||
$this->_safeExit();
|
||||
}
|
||||
|
||||
/* Table Title */
|
||||
$title = $this->lang->words[ 'timescale_' . $this->request['timescale'] ] ." {$this->lang->words['stats_spam']} ({$human_from_date['mday']} {$this->month_names[$human_from_date['mon']]} {$human_from_date['year']} {$this->lang->words['stats_to']} {$human_to_date['mday']} {$this->month_names[$human_to_date['mon']]} {$human_to_date['year']})";
|
||||
|
||||
/* Get the Graph Class */
|
||||
require_once( IPS_KERNEL_PATH . 'classGraph.php' );/*noLibHook*/
|
||||
|
||||
/* Graph Ooptions */
|
||||
$graph = new classGraph( false );
|
||||
$graph->options['title'] = $title;
|
||||
$graph->options['width'] = 800;
|
||||
$graph->options['height'] = 480;
|
||||
$graph->options['style3D'] = 0;
|
||||
$graph->options['charttype'] = 'Line';
|
||||
$graph->options['font'] = IPS_PUBLIC_PATH . 'style_captcha/captcha_fonts/Sathu.ttf';
|
||||
|
||||
/* Build Graph */
|
||||
$graph->addLabels( $labels );
|
||||
$graph->addSeries( $this->lang->words['statisnotspam'], array_values( $notSpamData ) );
|
||||
$graph->addSeries( $this->lang->words['statisspam'], array_values( $isSpamData ) );
|
||||
|
||||
$graph->display();
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Display spam service stats
|
||||
*
|
||||
* @return @e void
|
||||
*/
|
||||
public function spamServiceResultScreen()
|
||||
{
|
||||
/* Check the to fields */
|
||||
if ( ! checkdate( $this->request['to_month'], $this->request['to_day'], $this->request['to_year'] ) )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['stats_toincorrect'], 11352 );
|
||||
}
|
||||
|
||||
/* Check the from fields */
|
||||
if ( ! checkdate( $this->request['from_month'] ,$this->request['from_day'] ,$this->request['from_year'] ) )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['stats_fromincorrect'], 11353 );
|
||||
}
|
||||
|
||||
/* Create time stamps */
|
||||
$to_time = mktime(12 ,0 ,0 ,$this->request['to_month'] ,$this->request['to_day'] ,$this->request['to_year'] );
|
||||
$from_time = mktime(12 ,0 ,0 ,$this->request['from_month'] ,$this->request['from_day'] ,$this->request['from_year']);
|
||||
|
||||
/* Get Human Dates */
|
||||
$human_to_date = getdate( $to_time );
|
||||
$human_from_date = getdate( $from_time );
|
||||
|
||||
/* Setup Timescale */
|
||||
switch( $this->request['timescale'] )
|
||||
{
|
||||
case 'daily':
|
||||
$php_date = "F jS - Y";
|
||||
break;
|
||||
|
||||
case 'monthly':
|
||||
$php_date = "F Y";
|
||||
break;
|
||||
|
||||
default:
|
||||
$php_date = "W [F Y]";
|
||||
break;
|
||||
}
|
||||
|
||||
$order = $this->request['sortby'] == 'desc' ? 'desc' : 'asc';
|
||||
|
||||
/* Query Spam Logs */
|
||||
$this->DB->build( array(
|
||||
'select' => 'log_code, log_date',
|
||||
'from' => 'spam_service_log',
|
||||
'where' => 'log_date > ' . $from_time . ' AND log_date < ' . $to_time,
|
||||
'order' => 'log_date ' . $order
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
$results = array();
|
||||
$total = 0;
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
/* Skip errors */
|
||||
if( $r['log_code'] == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Key */
|
||||
if( $r['log_code'] == 1 )
|
||||
{
|
||||
$arrayKey = 'notspam';
|
||||
}
|
||||
else if( in_array( $r['log_code'], array( 2, 3, 4 ) ) )
|
||||
{
|
||||
$arrayKey = 'spam';
|
||||
}
|
||||
|
||||
$results[ date( $php_date, $r['log_date'] ) ][ $arrayKey ]++;
|
||||
$total++;
|
||||
}
|
||||
|
||||
/* Figure out max result */
|
||||
$max_result = 0;
|
||||
|
||||
foreach( $results as $k => $v )
|
||||
{
|
||||
$_max = ( $v['spam'] > $v['notspam'] ) ? $v['spam'] : $v['notspam'];
|
||||
|
||||
if( $_max > $max_result )
|
||||
{
|
||||
$max_result = $_max;
|
||||
}
|
||||
}
|
||||
|
||||
/* Build the output rows */
|
||||
$rows = array();
|
||||
|
||||
foreach( $results as $dateVal => $stats )
|
||||
{
|
||||
/* INIT */
|
||||
$newStats = array();
|
||||
|
||||
/* Width of the bars */
|
||||
$newStats['spam']['_width'] = intval( ( $stats['spam'] / $max_result ) * 100 - 8 );
|
||||
$newStats['notspam']['_width'] = intval( ( $stats['notspam'] / $max_result ) * 100 - 8 );
|
||||
|
||||
$newStats['spam']['_width'] = $newStats['spam']['_width'] < 0 ? 1 : $newStats['spam']['_width'];
|
||||
$newStats['notspam']['_width'] = $newStats['notspam']['_width'] < 0 ? 1 : $newStats['notspam']['_width'];
|
||||
|
||||
|
||||
/* Save Count */
|
||||
$newStats['spam']['count'] = $stats['spam'] ? $stats['spam'] : 0;
|
||||
$newStats['notspam']['count'] = $stats['notspam'] ? $stats['notspam'] : 0;
|
||||
|
||||
$rows[$dateVal] = $newStats;
|
||||
}
|
||||
|
||||
/* Table Title */
|
||||
$title = $this->lang->words[ 'timescale_' . $this->request['timescale'] ] ." {$this->lang->words['stats_spam']} ({$human_from_date['mday']} {$this->month_names[$human_from_date['mon']]} {$human_from_date['year']} {$this->lang->words['stats_to']} {$human_to_date['mday']} {$this->month_names[$human_to_date['mon']]} {$human_to_date['year']})";
|
||||
|
||||
/* Navigation */
|
||||
$this->registry->output->extra_nav[] = array( '', $this->lang->words['stats_spam'] );
|
||||
return $this->registry->output->html .= $this->html->spamServiceStats( $title, $rows, $total );
|
||||
}
|
||||
|
||||
/**
|
||||
* Display statistics for the selected mode
|
||||
*
|
||||
* @access public
|
||||
* @param string Type of stat screen reg, topic, post, msg
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function result_screen($mode='reg')
|
||||
{
|
||||
/* Check the to fields */
|
||||
@@ -331,15 +619,19 @@ class admin_forums_statistics_stats extends ipsCommand
|
||||
/**
|
||||
* Date Selection Screen
|
||||
*
|
||||
* @access public
|
||||
* @param string Type of stat screen reg, topic, post, msg, views
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function statsMainScreen( $mode='reg' )
|
||||
{
|
||||
/* Setup this mode */
|
||||
switch( $mode )
|
||||
{
|
||||
case 'spam':
|
||||
$form_code = 'show_spam';
|
||||
$table = $this->lang->words['stats_spam'];
|
||||
break;
|
||||
|
||||
case 'reg':
|
||||
$form_code = 'show_reg';
|
||||
$table = $this->lang->words['stats_reg'];
|
||||
@@ -364,6 +656,8 @@ class admin_forums_statistics_stats extends ipsCommand
|
||||
default:
|
||||
$form_code = 'statsShowTopicViews';
|
||||
$table = $this->lang->words['stats_views'];
|
||||
|
||||
$this->registry->output->setMessage( $this->lang->words['topic_view_warning'], 1 );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -393,9 +687,8 @@ class admin_forums_statistics_stats extends ipsCommand
|
||||
/**
|
||||
* Show topic view stats
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function statsShowTopicViews()
|
||||
{
|
||||
/* Check the to fields */
|
||||
@@ -495,9 +788,8 @@ class admin_forums_statistics_stats extends ipsCommand
|
||||
/**
|
||||
* Create the drop down options for the year select
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
**/
|
||||
*/
|
||||
public function statsMakeYear()
|
||||
{
|
||||
$time_now = getdate();
|
||||
@@ -524,9 +816,8 @@ class admin_forums_statistics_stats extends ipsCommand
|
||||
/**
|
||||
* Create the drop down options for the month select
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
**/
|
||||
*/
|
||||
public function statsMakeMonth()
|
||||
{
|
||||
$return = array();
|
||||
@@ -542,9 +833,8 @@ class admin_forums_statistics_stats extends ipsCommand
|
||||
/**
|
||||
* Create the drop down options for the day select
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
**/
|
||||
*/
|
||||
public function statsMakeDay()
|
||||
{
|
||||
$return = array();
|
||||
|
||||
@@ -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>
|
||||
@@ -6,9 +6,10 @@
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Статистика регистраций</subitemtitle>
|
||||
<subitemlang>stats_reg</subitemlang>
|
||||
<subsection>stats</subsection>
|
||||
<subitemurl>do=reg</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subitemrolekey>stats_registration</subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
@@ -18,9 +19,10 @@
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Статистика создания тем</subitemtitle>
|
||||
<subitemlang>stats_topics</subitemlang>
|
||||
<subsection>stats</subsection>
|
||||
<subitemurl>do=topic</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subitemrolekey>stats_topics</subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
@@ -30,9 +32,10 @@
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Статистика отправки сообщений</subitemtitle>
|
||||
<subitemlang>stats_posts</subitemlang>
|
||||
<subsection>stats</subsection>
|
||||
<subitemurl>do=post</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subitemrolekey>stats_posts</subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
@@ -42,9 +45,10 @@
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Статистика использования ЛС</subitemtitle>
|
||||
<subitemlang>stats_pms</subitemlang>
|
||||
<subsection>stats</subsection>
|
||||
<subitemurl>do=msg</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subitemrolekey>stats_msg</subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
@@ -54,8 +58,22 @@
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Статистика просмотров тем</subitemtitle>
|
||||
<subitemlang>stats_tviews</subitemlang>
|
||||
<subsection>stats</subsection>
|
||||
<subitemurl>do=views</subitemurl>
|
||||
<subitemrolekey>stats_views</subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Антиспам сервис</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Статистика антиспам сервиса</subitemtitle>
|
||||
<subitemlang>stats_spam</subitemlang>
|
||||
<subsection>stats</subsection>
|
||||
<subitemurl>do=spam</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<permissions>
|
||||
<group>
|
||||
<grouptitle>Управление статистикой</grouptitle>
|
||||
<grouplang>forums_stats</grouplang>
|
||||
<items>
|
||||
<item>
|
||||
<key>stats_topics</key>
|
||||
|
||||
Reference in new issue
Block a user