components.php

来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 133 行

PHP
133
字号
<?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 $
+---------------------------------------------------------------------------
|
|   > Components Functions
|   > Module written by Matt Mecham
|   > Date started: 12th April 2005 (13:09)
+--------------------------------------------------------------------------
*/

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_components
{
	# Globals
	var $ipsclass;
	
	var $perm_main  = 'admin';
	var $perm_child = 'components';
	
	/*-------------------------------------------------------------------------*/
	// Main handler
	/*-------------------------------------------------------------------------*/
	
	function auto_run() 
	{
		$this->html = $this->ipsclass->acp_load_template('cp_skin_tools');
		
		switch($this->ipsclass->input['code'])
		{
			case 'manage':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );
				$this->components_list();
				break;
			
			case 'component_add':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':add' );
				$this->components_form('add');
				break;
			case 'component_add_do':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':add' );
				$this->components_save('add');
				break;
			
			case 'component_edit':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
				$this->components_form('edit');
				break;
			case 'component_edit_do':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
				$this->components_save('edit');
				break;
			
			case 'component_export':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':export' );
				$this->components_export('single');
				break;
			case 'component_import':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':import' );
				$this->components_import();
				break;
				
			case 'component_move':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
				$this->components_move();
				break;
			case 'component_toggle_enabled':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
				$this->components_toggle_enabled();
				break;
			default:
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );
				$this->components_list();
				break;
		}
	}
	
	/*-------------------------------------------------------------------------*/
	// Components: Toggle enabled
	/*-------------------------------------------------------------------------*/
	
	function components_toggle_enabled()
	{
		//--------------------------------------------
		// INIT
		//--------------------------------------------
		
		$com_id = intval($this->ipsclass->input['com_id']);
		
		//--------------------------------------------
		// Checks...
		//--------------------------------------------
		
		if ( ! $com_id )
		{
			$this->ipsclass->main_msg = "No ID was passed, please try again";
			$this->components_list();
			return;
		}
		
		//--------------------------------------------
		// Get from database
		//--------------------------------------------
		
		$component = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'components', 'where' => 'com_id='.$com_id ) );
		
		$com_enabled = $component['com_enabled'] ? 0 : 1;
		
		$this->ipsclass->DB->do_update( 'components', array( 'com_enabled' => $com_enabled ), 'com_id='.$com_id );
		
		$this->components_rebuildcache();
		
		$this->ipsclass->main_msg = "缁勪欢宸插浐瀹

⌨️ 快捷键说明

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