leagues.php

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

PHP
121
字号
<?php
/*
+--------------------------------------------------------------------------
|   League forums V1 for IPB v2.0
|   =======================================================
|   by Backdream
|   (c) 2004 闃冲厜閮ㄨ惤璁哄潧
|   http://forum.ccbsx.com.cn/forum
|   ========================================================
|   Web: http://forum.ccbsx.com.cn/forum
|   Email: backdream@sina.com
+---------------------------------------------------------------------------
|   > Module written by Backdream
|   > Date started: 2004-7-1
|   > Date UPDATE : 2004-7-1
+--------------------------------------------------------------------------
*/

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_leagues {

	var $base_url;

	function auto_run() {

		$this->base_url	=	$this->ipsclass->base_url.'&section=tools&'	;

		switch($this->ipsclass->input['code'])
		{
			case 'donew':
				$this->do_new();
				break;
			//+-------------------------
			case 'edit':
				$this->show_leagues();
				break;
			case 'doeditform':
				$this->edit_form();
				break;
			case 'doedit':
				$this->do_edit();
				break;
			//+-------------------------
			case 'remove':
				$this->do_remove();
				break;
			//+-------------------------
			case 'doreorder':
				$this->do_reorder();
				break;

			default:
				$this->show_leagues();
				break;
		}

	}

	//-------------------------------------------------------------
	// Rebuild Cache
	//-------------------------------------------------------------

	function rebuild_cache()
	{

		$this->ipsclass->cache['multimod'] = array();

		$this->ipsclass->DB->simple_construct( array(
								 'select' => '*',
								 'from'   => 'leagues',
								 'order'  => 'position'
						 )      );

		$this->ipsclass->DB->simple_exec();

		while ($i = $this->ipsclass->DB->fetch_row())
		{
			$this->ipsclass->cache['leagues'][ $i['id'] ] = $i;
		}

		$this->ipsclass->update_cache( array( 'name' => 'leagues', 'array' => 1, 'deletefirst' => 1 ) );
	}


	//+---------------------------------------------------------------------------------

	function do_reorder() {

		$this->ipsclass->DB->simple_construct( array( 'select' => 'id', 'from' => 'leagues' ) );
		$this->ipsclass->DB->simple_exec();
		while ( $a = $this->ipsclass->DB->fetch_row() )
		{
			$ids[] = $a['id'];
		}

		foreach ( $ids as $kid )
		{
 			$this->ipsclass->DB->do_update( 'leagues', array( 'position' => $this->ipsclass->input[ 'POS_' . $kid ]), 'id='.$kid );
		}

		$this->rebuild_cache();

		$this->ipsclass->admin->save_log("璋冩暣鍙嬫儏閾炬帴椤哄簭");

		$this->ipsclass->boink_it($this->base_url."&act=leagues");

	}


	//+---------------------------------------------------------------------------------

	function do_remove() {

		if ($this->ipsclass->input['l'] == "")
		{
			$this->ipsclass->admin->error("鏃犳硶纭

⌨️ 快捷键说明

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