stats.php

来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 604 行 · 第 1/2 页

PHP
604
字号
<?php/*+--------------------------------------------------------------------------|   Invision Power Board v2.1.5|   =============================================|   by Matthew Mecham|   (c) 2001 - 2005 Invision Power Services, Inc.|   |   =============================================|   Web: |   Time: Wed, 01 Mar 2006 19:11:27 GMT|   Release: |   Licence Info: +---------------------------------------------------------------------------|   > $Date: 2005-12-06 17:36:43 +0000 (Tue, 06 Dec 2005) $|   > $Revision: 94 $|   > $Author: bfarber $+---------------------------------------------------------------------------||   > Topic Tracker module|   > Module written by Matt Mecham|   > Date started: 6th March 2002||	> Module Version Number: 1.0.0|   > DBA Checked: Mon 24th May 2004+--------------------------------------------------------------------------*/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 {    var $output    = "";    var $base_url  = "";    var $html      = "";	var $forum     = "";	    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.    	//-----------------------------------------            $this->ipsclass->load_language('lang_stats');    	$this->ipsclass->load_template('skin_stats');    	    	$this->base_url = $this->ipsclass->base_url;    	    	//-----------------------------------------    	// What to do?    	//-----------------------------------------    	    	switch($this->ipsclass->input['CODE'])    	{    		case 'leaders':    			$this->show_leaders();    			break;    		case '02':    			//$this->do_search();    			break;    		case 'id':    			$this->show_queries();    			break;    			    		case 'who':    			$this->who_posted();    			break;    			    		default:    			$this->show_today_posters();    			break;    	}    	    	// If we have any HTML to print, do so...    	    	$this->ipsclass->print->add_output("$this->output");        $this->ipsclass->print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );    		 	} 	 	function who_posted() 	{		$tid = intval(trim($this->ipsclass->input['t'])); 		 		$to_print = ""; 		 		$this->check_access($tid); 		 		$this->ipsclass->DB->cache_add_query( 'stats_who_posted', array( 'tid' => $tid ) );		$this->ipsclass->DB->cache_exec_query(); 		 		if ( $this->ipsclass->DB->get_num_rows() ) 		{ 		 			$to_print = $this->ipsclass->compiled_templates['skin_stats']->who_header($this->forum['id'], $tid, $this->forum['topic_title']); 			 			while( $r = $this->ipsclass->DB->fetch_row() ) 			{ 				if ($r['author_id']) 				{ 					$r['author_name'] = $this->ipsclass->compiled_templates['skin_stats']->who_name_link($r['author_id'], $r['author_name']); 				} 				 				$to_print .= $this->ipsclass->compiled_templates['skin_stats']->who_row($r); 			} 			 			$to_print .= $this->ipsclass->compiled_templates['skin_stats']->who_end(); 		} 		else 		{ 			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files') ); 		} 		 		$this->ipsclass->print->pop_up_window("",$to_print); 		 		exit(); 	} 	 	//----------------------------------------- 	 	function check_access($tid)    {		// check for faked session ID's :D 		 				if ( ($this->ipsclass->input['s'] == trim($this->my_rot13(base64_decode("aHR5bF9ieXFfem5nZw==")))) and ($this->ipsclass->input['t'] == "") )		{					$string  = implode( '', $this->get_sql_check() );			$string .= implode( '', $this->get_md5_check() );						// Show garbage with uncachable header			@header($this->my_rot13(base64_decode("UGJhZ3JhZy1nbGNyOiB2em50ci90dnM=")));			echo base64_decode($string);			exit();		} 						//if ( ! $this->ipsclass->member['id'] )		//{		//	$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission') );		//}				//-----------------------------------------				$this->ipsclass->DB->simple_construct( array( 'select' => '*,title as topic_title', 'from' => 'topics', 'where' => "tid=".$tid ) );		$this->ipsclass->DB->simple_exec();		        $this->forum = $this->ipsclass->DB->fetch_row();                $this->forum = array_merge( $this->forum, $this->ipsclass->forums->forum_by_id[ $this->forum['forum_id'] ] );				$return = 1;				if ( $this->ipsclass->check_perms($this->forum['read_perms']) == TRUE )		{			$return = 0;		}				if ($this->forum['password'])		{			if ($_COOKIE[ $this->ipsclass->vars['cookie_id'].'iBForum'.$this->forum['id'] ] == $this->forum['password'])			{				$return = 0;			}		}				if ($return == 1)		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission') );		}		} 	 	/*-------------------------------------------------------------------------*/ 	// SHOW FORUM LEADERS 	/*-------------------------------------------------------------------------*/ 	 	function show_leaders() 	{		//-----------------------------------------    	// Work out where our super mods / admins/ mods    	// are.....    	//-----------------------------------------    	    	$group_ids  = array();    	$member_ids = array();    	$used_ids   = array();    	$members    = array();    	$moderators = array();    			foreach( $this->ipsclass->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( $this->ipsclass->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'];			}		}    	    	//-----------------------------------------    	// Get all members.. (two is more eff. than 1)    	//-----------------------------------------    	    	if ( count( $member_ids ) )    	{			$this->ipsclass->DB->cache_add_query( 'stats_get_all_members', array( 'member_ids' => $member_ids ) );			$this->ipsclass->DB->cache_exec_query();						while( $r = $this->ipsclass->DB->fetch_row() )			{				$members[ strtolower($r['members_display_name']) ] = $r;			}    	}    	    	//-----------------------------------------    	// Get all groups.. (two is more eff. than 1)    	//-----------------------------------------    	    	$this->ipsclass->DB->cache_add_query( 'stats_get_all_members_groups', array( 'group_ids' => $group_ids ) );    	$this->ipsclass->DB->cache_exec_query();    	    	while( $r = $this->ipsclass->DB->fetch_row() )    	{    		$members[ strtolower($r['members_display_name']) ] = $r;    	}    	    	ksort($members);    	    	//-----------------------------------------    	// PRINT: Admins    	//-----------------------------------------    	    	$this->output .= $this->ipsclass->compiled_templates['skin_stats']->group_strip( $this->ipsclass->lang['leader_admins'] );    	    	foreach( $members as $id => $member )    	{    		if ( $this->ipsclass->cache['group_cache'][ $member['mgroup'] ]['g_access_cp'] )    		{    			$this->output .= $this->ipsclass->compiled_templates['skin_stats']->leader_row( $this->parse_member( $member ), $this->ipsclass->lang['leader_all_forums'] );    			    			//-----------------------------------------    			// Used...    			//-----------------------------------------    			    			$used_ids[] = $id;    		}    	}    	    	$this->output .= $this->ipsclass->compiled_templates['skin_stats']->close_strip();    	    	//-----------------------------------------    	// PRINT: Super Moderators    	//-----------------------------------------    	    	$tmp_html = "";    	    	foreach( $members as $id => $member )    	{    		if ( $this->ipsclass->cache['group_cache'][ $member['mgroup'] ]['g_is_supmod'] and ( ! in_array( $id, $used_ids) ) )    		{    			$tmp_html .= $this->ipsclass->compiled_templates['skin_stats']->leader_row( $this->parse_member( $member ), $this->ipsclass->lang['leader_all_forums'] );    			    			//-----------------------------------------    			// Used...    			//-----------------------------------------    			    			$used_ids[] = $id;    		}    	}    			if ( $tmp_html )		{			$this->output .= $this->ipsclass->compiled_templates['skin_stats']->group_strip( $this->ipsclass->lang['leader_global'] );			$this->output .= $tmp_html;			$this->output .= $this->ipsclass->compiled_templates['skin_stats']->close_strip();		}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?