<?php
/*
\* ===========================================
\* 项目: CTB文本论坛
\* 版本:1.4
\* 团队: 实易数码
\* 小组: CTB文本论坛小组
\* 作者: 险情
\* 功能: 后台版块处理程式
\* ===========================================
\* Copyright (c) 2002
\* 团队主页: http://www.11cn.org
\* 团队信箱: ------
\* 创建日期: 2002/7/19
\* 修改日期: 2002-12-27
\* 修改说明: ------
\* 版权声明: 这个程序是免费软件.
\* ===========================================
*/

//=============================================================================

class Module extends CommonClass
{
    function execute()
    {
        switch($this->input['action']) {
			//
            case 'limitUser':
                $this->limitUser();
                break;
            case 'addLimitUser':
                $this->addLimitUser();
                break;
            case 'delLimitUser':
                $this->delLimitUser();
                break;
			//
        }
    } // end func

//-----------------------------------------------------------------------------
//---1、显示所有论坛用户------作者：险情
//---2、
//---3、
//-----------------------------------------------------------------------------

//=============================================================================
//显示所有被禁止发言的用户
    function limitUser(){
        //global $action,$userpage,$userlist,$mods,$p;
    	if ( !$p ) { $p = 1; }
        //显示列表
        $this->file = "../".$this->set[dataPath]."/users/list.php";
        $listline = $this->select(5, "0");
        //
        $totalFile = count($listline);
        $recnum = 20;//$userlist;
        $totalnum = ($totalFile % $recnum) == "0" ? intval(($totalFile)/$recnum) : intval(($totalFile)/$recnum)+1;

        //显示列表
		$num=0;
    	for( $i = ($totalFile - ($p-1)*$recnum); $i > ($totalFile - $p*$recnum);$i--)  {
            if ($listline[$i][5]=="0")
				$userMode="<font color=red>禁止</font>";
            if ($listline[$i][5]=="1")
				$userMode="正常";
            //exit($listline[$i][1]);
            $this->file = "../".$this->set[dataPath]."/users/".$listline[$i][1].".php";
        	if ($listline[$i]) {
                $memberInfo = $this->get();
                $memName = htmlspecialchars($memberInfo[3]);
                $memTime = date("Y-m-d H:i:s",$memberInfo[11]);
                $userId = $memberInfo[1];
                $memPnum=$memberInfo[13];
                $memGrade=$memberInfo[18];
            	if (empty($memGrade))
                $memGrade="0";
                $memJb=$memberInfo[16];

				$num = $i+1;
            	eval ("\$member_list .= \"".$this->getTemplate("userLimitLine")."\";");
            }
        }
        $page = $this->getPage("$PHP_SELF?mod=userlimit&action=limitUser",$totalnum);
    	eval("\$this->outPut(\"".$this->getTemplate("userLimit")."\");");
    } // end func

//=============================================================================
//添加一个被禁止的用户名字
    function addLimitUser()
    {
        $newLimitUser = $this->adminSafeChars($this->input['newLimitUser']);
        if (!$newLimitUser) {
            $this->adminShowMsg("./main.php?mod=userlimit&action=limitUser","数据不能为空");
        }
        $this->file = "../".$this->set[dataPath]."/users/list.php";
        $userLimitList = $this->select_line(4, $newLimitUser);
        if (!$userLimitList[1]) {
            $this->adminShowMsg("./main.php?mod=userlimit&action=limitUser","您添加的用户不存在");
        }
        $userLimitList[5] = "0";
        $userLimitList[6] = "\n";
        $this->update2(4,$newLimitUser,$userLimitList);

        $this->adminShowMsg("./main.php?mod=userlimit&action=limitUser","您已经成功禁止一个用户发言");
    } // end func

//=============================================================================
//删除一个被禁止的用户名字
    function delLimitUser()
    {
        //global $user_id;
        $newLimitUser = trim($this->input['userId']);
        if (!$this->input['userId'])$this->adminShowMsg("./main.php?mod=userlimit&action=limitUser","数据不能为空");
            $this->file = "../".$this->set[dataPath]."/users/list.php";
            $userLimitList = $this->select_line(1, $this->input['userId']);
            $userLimitList[5]="1";
            $userLimitList[6]="\n";
            $this->update2(1,$this->input['userId'],$userLimitList);

        $this->adminShowMsg("./main.php?mod=userlimit&action=limitUser","您已经成功取消禁止一个用户发言");
    } // end func


//<<
//=============================================================================
} //end class