languages.php

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

PHP
190
字号
<?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-08 16:32:40 +0000 (Thu, 08 Dec 2005) $
|   > $Revision: 96 $
|   > $Author: bfarber $
+---------------------------------------------------------------------------
|
|   > Language functions
|   > Module written by Matt Mecham
|   > Date started: 22nd April 2002
|
|	> Module Version Number: 1.0.0
|   > DBA Checked: Tue 25th 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_languages {

	var $base_url;

	/**
	* Section title name
	*
	* @var	string
	*/
	var $perm_main = "lookandfeel";
	
	/**
	* Section title name
	*
	* @var	string
	*/
	var $perm_child = "lang";
	
	function auto_run()
	{
		if ( TRIAL_VERSION )
		{
			print "This feature is disabled in the trial version.";
			exit();
		}
		
		//-----------------------------------------
		// Kill globals - globals bad, Homer good.
		//-----------------------------------------
		
		$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
		
		foreach ( $tmp_in as $k => $v )
		{
			unset($$k);
		}
		
		//-----------------------------------------

		switch($this->ipsclass->input['code'])
		{
			
			case 'add':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':add' );
				$this->add_language();
				break;
				
			case 'edit':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
				$this->do_form('edit');
				break;
				
			case 'edit2':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
				$this->show_file();
				break;
				
			case 'doadd':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':add' );
				$this->save_wrapper('add');
				break;
				
			case 'doedit':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
				$this->save_langfile();
				break;
				
			case 'remove':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':remove' );
				$this->remove();
				break;
				
			case 'editinfo':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
				$this->edit_info();
				break;
				
			case 'export':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':export' );
				$this->export();
				break;
				
			case 'import':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':import' );
				$this->import();
				break;
				
			case 'doimport':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':import' );
				$this->doimport();
				break;
				
			case 'makedefault':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
				$this->make_default();
				break;
			
			case 'swap':
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
				$this->member_swap();
				break;
			//-----------------------------------------
			default:
				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );
				$this->list_current();
				break;
		}
	}
	
	//-----------------------------------------
	// Swap members choice
	//-----------------------------------------
	
	function member_swap()
	{
		$new_dir = "";
		$old_dir = "";
		
		if ( $this->ipsclass->input['old'] and $this->ipsclass->input['new'] )
		{
			if ( $this->ipsclass->input['old'] != 'none' )
			{
				$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'languages', 'where' => "lid IN ( {$this->ipsclass->input['old']}, {$this->ipsclass->input['new']})" ) );
				$this->ipsclass->DB->simple_exec();
			}
			else
			{
				$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'languages', 'where' => "lid={$this->ipsclass->input['new']}" ) );
				$this->ipsclass->DB->simple_exec();
			}
			
			while ( $r = $this->ipsclass->DB->fetch_row() )
			{
				if (  $r['lid'] == $this->ipsclass->input['old'] )
				{
					$old_dir = $r['ldir'];
				}
				
				if (  $r['lid'] == $this->ipsclass->input['new'] )
				{
					$new_dir = $r['ldir'];
				}
			}
			
			if ( $new_dir and $old_dir )
			{
				$this->ipsclass->DB->do_update( 'members', array( 'language' => $new_dir ), "language='{$old_dir}'" );
			}
			else if ( $this->ipsclass->input['old'] == 'none' )
			{
				$this->ipsclass->DB->do_update( 'members', array( 'language' => $new_dir ), "language='' or language IS NULL" );
			}
		}
		
		$this->ipsclass->main_msg = "浼氬憳璇

⌨️ 快捷键说明

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