<?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 'userWait':
                $this->userWait();
                break;
            case 'delUserWait':
                $this->doAdminOrder("你确定要删除此等待会员吗？");
                break;
            case 'delUserWait2':
                $this->delUserWait();
                break;
            case 'addUserWait':
                $this->addUserWait();
                break;
			//
        }
    } // end func

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

//=============================================================================
//获取等待通过用户
    function userWait(){
        //显示列表   
		
		$this->file = "../".$this->set[dataPath]."/users/listtemp.php";
        $listLine = $this->read_file();
        //
		$recnum = 20;
		$totalFile = count($listLine);
		$totalNum = ($totalFile % $recnum) == "0" ? intval(($totalFile)/$recnum) : intval(($totalFile)/$recnum)+1;

        $p = $this->input['p'];
		if ( !$p ) { $p = 1; } 		
		//
        $num = 0;
		//exit("zongshu:".$totalnum);
    	for( $i = ($totalFile - ($p-1)*$recnum); $i > ($totalFile - $p*$recnum);$i--){
			if ($listLine[$i]){
			$userWaitList = $this->make_array($listLine[$i]);

            $num = $i+1;
            $userHoldHtm .= "<tr> 
            <td bgcolor=\"white\" align=\"center\">$num</td>
            <td bgcolor=\"white\">$userWaitList[1]</td>
            <td bgcolor=\"white\">$userWaitList[2]</td>
			<td bgcolor=\"white\">$userWaitList[4]</td>
			<td bgcolor=\"white\">$userWaitList[5]</td>
			<td bgcolor=\"white\"><a href=\"./main.php?mod=userwait&action=addUserWait&id=$userWaitList[5]\">通过</a></td>
            <td bgcolor=\"white\"><a href=\"./main.php?mod=userwait&action=delUserWait&id=$userWaitList[5]\">删除</a></td>
         </tr>";
			}
        }
        $page = $this->getPage("$PHP_SELF?mod=userwait&action=userWait",$totalNum);
		//
        eval("\$this->outPut(\"".$this->getTemplate("userWait")."\");");
    } // end func

//=============================================================================
//删除一个用户
function delUserWait()
{ 
	//执行删除操作
	$this->file = "../".$this->set[dataPath]."/users/listtemp.php";
	$this->delete2("5",$this->input['id']);
    //返回提示信息
   $this->adminShowMsg("main.php?mod=userwait&action=userWait","您已经成功删除了用户");
} // end func

//=============================================================================
//将用户写入正式表
	function addUserWait()
	{
		$this->file =  "../".$this->set[dataPath]."/users/listtemp.php";
        $userEmailInfo = $this->select_line("5", $this->input['id']);
		if (!$userEmailInfo){
           $this->adminShowMsg("main.php?mod=userwait&action=userWait","这个用户的资料不存在");
		}
        //将用户资料写入正式列表
        //---------------------------------------------------------------------
			//更新用户统计文件
			$this->file =  "../".$this->set[dataPath]."/member.php";
			$user = $this->get();
			$user[2] = $user[2]+1;		//用户总数量增加		
			$user[3] = $user[3]+1;		//用户总数量增加		
			$user[4] = $userEmailInfo[2];
			$this->overwrite($user);
			@chmod($this->file,0777);
			
			//添加用户到用户列表
			$this->file =  "../".$this->set[dataPath]."/users/list.php";
			$userId = $this->get_max_value("1")+1;

			$userList = array($this->code,$userId,$userEmailInfo[1],$userEmailInfo[3],$userEmailInfo[2],"1","");
			$this->add_line($userList);
			@chmod($this->file,0777);
			
			//添加用户
			$this->file =  "../".$this->set[dataPath]."/users/".$userId.".php";
			$member = array($this->code,$userId,$userEmailInfo[1],$userEmailInfo[2],"2",$userEmailInfo[4],"","","","","",time(),time(),"0","no_portait.gif","","新手上路","pips1.gif","0","","","","","","","");
			$this->add_line($member);
			@chmod($this->file,0777);
        //---------------------------------------------------------------------
		//显示提示信息
	 $this->file =  "../".$this->set[dataPath]."/users/listtemp.php";
	 $this->delete2(5,$this->input['id']);	
	 
     $this->adminShowMsg("main.php?mod=userwait&action=userWait","您已经成功通过了用户");
	} // end func	
//<<
//=============================================================================
} //end class
