administration.php

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

PHP
706
字号
<?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-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $|   > $Revision: 23 $|   > $Author: matt $+---------------------------------------------------------------------------||   > Administration Module|   > Module written by Matt Mecham|   > Date started: 27th January 2004||	> Module Version Number: 1.0.0|   > DBA Checked: Mon 24th May 2004+--------------------------------------------------------------------------*/if ( ! defined( 'IN_ACP' ) ){	print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";	exit();}class ad_administration{	var $ipsclass;	var $html;	var $map;		/**	* Section title name	*	* @var	string	*/	var $perm_main = "tools";		/**	* Section title name	*	* @var	string	*/	var $perm_child = "admin";		function auto_run()	{		//-----------------------------------------		// Require and RUN !! THERES A BOMB		//-----------------------------------------				$this->ipsclass->admin->page_detail = "The cache manager allows you to view the contents of your cache and update them.";		$this->ipsclass->admin->page_title  = "Cache Manager";				//-----------------------------------------		// Load skin		//-----------------------------------------				$this->html = $this->ipsclass->acp_load_template('cp_skin_tools');				//-----------------------------------------		// Kill globals - globals bad, Homer good.		//-----------------------------------------				$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );				foreach ( $tmp_in as $k => $v )		{			unset($$k);		}				//-----------------------------------------		// Map		//-----------------------------------------				$this->map = array( 'forum_cache'   => 'All forum information and data',							'group_cache'   => 'All member group infomation and data',							'systemvars'    => 'System runtime variables',							'skin_id_cache' => 'Skin set information and data',							'moderators'    => 'All moderator information and data',							'stats'         => 'Board stats, such as total posts, etc',							'ranks'         => 'Member titles and rank information',							'profilefields' => 'Custom profile field information',							'birthdays'     => 'Members birthdays',							'calendar'      => 'Forthcoming calendar events',							'multimod'      => 'Multi-moderation information and data',							'bbcode'        => "Custom BBCode information and data",							'settings'      => "Board settings and variables",							'emoticons'     => 'Emoticon information and data',							'badwords'      => 'Bad Word Filters information and data',							'languages'     => 'Language Set information',							'banfilters'    => 'Banned IP addresses',							'attachtypes'   => 'Attachment Types information',							'announcements' => 'Announcements cache',							'components'    => 'Components enabled on your IPB',						  );				//-----------------------------------------		// What to do...		//-----------------------------------------				switch($this->ipsclass->input['code'])		{			case 'cacheend':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':recache' );				$this->cache_end();				break;							case 'viewcache':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );				$this->view_cache();				break;						case 'cache_update_all':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':recache' );				$this->ipsclass->admin->output_multiple_redirect_init( $this->ipsclass->base_url.'&'.$this->ipsclass->form_code_js.'&code=cache_update_all_process&id=0' );				break;							case 'cache_update_all_process':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':recache' );				$this->cache_update_all_process();				break;					default:				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );				$this->cache_start();				break;		}	}		/*-------------------------------------------------------------------------*/	// Process....	/*-------------------------------------------------------------------------*/		function cache_update_all_process()	{		//-----------------------------------------		// INIT		//-----------------------------------------				$id         = intval( $this->ipsclass->input['id'] );		$cache_name = '';		$count      = 0;		$img        = '<img src="'.$this->ipsclass->skin_url.'/images/aff_tick_small.png" border="0" alt="-" /> ';				//-----------------------------------------		// Get cache name		//-----------------------------------------				foreach( $this->map as $name => $desc )		{			if ( $count == $id )			{				$cache_name = $name;				break;			}						$count++;		}				//-----------------------------------------		// Do what, now?		//-----------------------------------------				$id++;				if ( $cache_name )		{			$this->cache_end( $cache_name, 1 );						$this->ipsclass->admin->output_multiple_redirect_hit( $this->ipsclass->base_url.'&'.$this->ipsclass->form_code_js.'&code=cache_update_all_process&id='.$id, $img.$cache_name.' processed...' );		}		else		{			$this->ipsclass->admin->output_multiple_redirect_done();		}	}		/*-------------------------------------------------------------------------*/	// DO VIEW	/*-------------------------------------------------------------------------*/		function view_cache()	{		if ( ! $this->ipsclass->input['cache'] )		{			$this->ipsclass->main_msg = "No ID was passed, please try again";			$this->cache_start();		}				$row = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'cache_store', 'where' => "cs_key='{$this->ipsclass->input['cache']}'" ) );				ob_start();		if ( $row['cs_array'] )		{			print_r( unserialize($this->ipsclass->txt_stripslashes($row['cs_value'])) );		}		else		{			print $row['cs_value'];		}				$out = ob_get_contents();		ob_end_clean();				$this->ipsclass->html = "<pre>".htmlspecialchars($out)."</pre>";				$this->ipsclass->admin->print_popup();	}			/*-------------------------------------------------------------------------*/	// DO UPDATE	/*-------------------------------------------------------------------------*/		function cache_end( $cache_name='', $dontcancel=0 )	{		if ( ! $cache_name )		{			$cache_name = $this->ipsclass->input['cache'];		}				switch ( $cache_name )		{			//-----------------------------------------			// Forum cache			//-----------------------------------------						case 'forum_cache':							$this->ipsclass->update_forum_cache();								$this->ipsclass->main_msg = 'Forum Cache Updated';				break;							//-----------------------------------------			// Group Cache			//-----------------------------------------						case 'group_cache':				$this->ipsclass->cache['group_cache'] = array();							$this->ipsclass->DB->simple_construct( array( 'select' => "*",															  'from'   => 'groups'													 )      );								$this->ipsclass->DB->simple_exec();								while ( $i = $this->ipsclass->DB->fetch_row() )				{					$this->ipsclass->cache['group_cache'][ $i['g_id'] ] = $i;				}								$this->ipsclass->update_cache( array( 'name' => 'group_cache', 'array' => 1, 'deletefirst' => 1 ) );								$this->ipsclass->main_msg = 'Group Cache Updated';				break;							//-----------------------------------------			// Systemvars			//-----------------------------------------						case 'systemvars':				$this->ipsclass->cache['systemvars'] = array();								$result = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'count(*) as cnt', 'from' => 'mail_queue' ) );								$this->ipsclass->cache['systemvars']['mail_queue'] = intval( $result['cnt'] );								$this->ipsclass->update_cache( array( 'name' => 'systemvars', 'array' => 1, 'deletefirst' => 1 ) );								require_once( ROOT_PATH.'sources/lib/func_taskmanager.php' );				$task = new func_taskmanager();				$task->ipsclass =& $this->ipsclass;				$task->save_next_run_stamp();								$this->ipsclass->main_msg = 'System Variables Updated';				break;							//-----------------------------------------			// Skin ID cache			//-----------------------------------------						case 'skin_id_cache':				require_once( ROOT_PATH.'sources/lib/admin_cache_functions.php' );    			$admin = new admin_cache_functions();    			$admin->ipsclass =& $this->ipsclass;    			$admin->_rebuild_skin_id_cache();								$this->ipsclass->main_msg = 'Skin ID Cache Updated';				break;							//-----------------------------------------			// Moderators			//-----------------------------------------						case 'moderators':							$this->ipsclass->cache['moderators'] = array();								require_once( ROOT_PATH.'sources/action_admin/moderator.php' );				$this->mod           =  new ad_moderator();				$this->mod->ipsclass =& $this->ipsclass;								$this->mod->rebuild_moderator_cache();								$this->ipsclass->main_msg = 'Moderators Updated';				break;							//-----------------------------------------			// Stats			//-----------------------------------------						case 'stats':																			$this->ipsclass->main_msg = 'Statistics Updated';				break;							//-----------------------------------------			// Ranks			//-----------------------------------------						case 'ranks':							$this->ipsclass->cache['ranks'] = array();        					$this->ipsclass->DB->simple_construct( array( 'select' => 'id, title, pips, posts',															  'from'   => 'titles',															  'order'  => "posts DESC",													)      );													$this->ipsclass->DB->simple_exec();											while ($i = $this->ipsclass->DB->fetch_row())				{					$this->ipsclass->cache['ranks'][ $i['id'] ] = array(																  'TITLE' => $i['title'],																  'PIPS'  => $i['pips'],																  'POSTS' => $i['posts'],																);				}

⌨️ 快捷键说明

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