用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - php代码库

admin action

2014-01-27 作者: 周颠举报

[php]代码库

<?php
class adminAction extends YouYaX
{
    public function login()
    {
    	  if (!empty($_SESSION['youyax_admin'])) {
    			$this->redirect("admin" . C('default_url') . "index" . C('static_url'));
    	  }
    		$this->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/login.html");
    }
    public function validate()
    {
        $user = addslashes($_POST['user']);
        $pass = md5(addslashes($_POST['pass']));
        $sql  = "select * from " . C('db_prefix') . "admin where user='" . $user . "' and pass='" . $pass . "' and isAdmin=1";
        $num  = mysql_num_rows(mysql_query($sql));
        if ($num > 0) {
            $_SESSION['youyax_admin'] = $user;
            echo '<script>alert("登录成功~~~");</script>';
            $this->redirect("admin" . C('default_url') . "index" . C('static_url'));
        } else {
            echo '<script>alert("登录失败~~~");</script>';
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
    }
    public function logout()
    {
        unset($_SESSION['youyax_admin']);
        $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
    }
    public function index()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $this->assign('site', C('SITE'))
        		 ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/index.html");
    }
    public function secindex()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $this->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/secindex.html");
    }
    public function tophead()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $this->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->assign('admin', $_SESSION['youyax_admin'])
             ->display("admin/tophead.html");
    }
    public function leftbar()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $this->assign('shtml', C('static_url'))
             ->assign('site', C('SITE'))
             ->assign('url', C('default_url'))
             ->display("admin/leftbar.html");
    }
    public function content()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $reply_num_max=$this->select("select max(num2) as m,rid,time2  FROM " . C('db_prefix') . "reply group by rid having UNIX_TIMESTAMP(time2) between (UNIX_TIMESTAMP(now())-7*24*3600) and UNIX_TIMESTAMP(now()) order by m desc limit 0,5");
        $scan_num_max =$this->select("select *  FROM " . C('db_prefix') . "talk where UNIX_TIMESTAMP(time1) between (UNIX_TIMESTAMP(now())-7*24*3600) and UNIX_TIMESTAMP(now()) order by num1 desc limit 0,5");
        $count_arr    =$this->find(C('db_prefix') . "count","string","id=1"); 
        $count_user=unserialize($count_arr['user_count']);
        $count_user_num=0;
        if(!empty($count_user)){
        	foreach($count_user as $v){
        		$count_user_num+=$v;
        	}
      	}
        $count_post=unserialize($count_arr['post_count']);
        $count_post_num=0;
        if(!empty($count_post)){
        	foreach($count_post as $v){
        		$count_post_num+=$v;
        	}
      	}
        $this->assign('shtml', C('static_url'))
             ->assign('site', C('SITE'))
             ->assign('url', C('default_url'))
             ->assign('count_user_num', $count_user_num)
             ->assign('count_post_num', $count_post_num)
             ->assign('reply_num_max',$reply_num_max)
             ->assign('scan_num_max' ,$scan_num_max)
             ->assign('url_connect',$this->youyax_url)
        		 ->display("admin/content.html");
    }
    public function block()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $this->assign('site', C('SITE'));
        //$data=$this->select("select * from ".C('db_prefix')."big_block");
        $sql  = "select big.id,big.bzone from " . C('db_prefix') . "big_block big left join (select * from (select * from " . C('db_prefix') . "small_block order by ssort desc,szone desc)smalltmp group by smalltmp.bid ) tmp on big.id=tmp.bid order by tmp.ssort desc,tmp.szone desc";
        $data = $this->select($sql);
        $this->assign("data", $data)
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/block.html");
    }
    public function block_transform()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $this->assign('site', C('SITE'));
        $sql  = "select * from " . C('db_prefix') . "small_block";
        $data = $this->select($sql);
        $this->assign("data", $data)
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/block_transform.html");
    }
    public function block_do_transform()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $sql = "update " . C('db_prefix') . "talk set parentid=".$_POST['oto']." where parentid=" . $_POST['org'];
        mysql_query($sql);
        $sql = "update " . C('db_prefix') . "reply set parentid2=".$_POST['oto']." where parentid2=" . $_POST['org'];
        mysql_query($sql);
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "block_transform" . C('static_url'));
    }
    public function delblock()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id      = getparam("id");
        $big_sql = "delete from " . C('db_prefix') . "big_block where id=" . $id;
        mysql_query($big_sql);
        $small_sql = "delete from " . C('db_prefix') . "small_block where bid=" . $id;
        mysql_query($small_sql);
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "block" . C('static_url'));
    }
    public function editblock()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id   = addslashes($_POST["id"]);
        $name = addslashes($_POST["bzone"]);
        if (empty($name)) {
            $_SESSION['youyax_error'] = 2;
        } else {
            $t                        = T(C('db_prefix') . "big_block");
            $t												->find($id);
            $t->bzone                 = $name;
            $_SESSION['youyax_error'] = 1;
            $t->save();
        }
        $this->redirect("admin" . C('default_url') . "block" . C('static_url'));
    }
    public function addblock()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $name = addslashes($_POST["bzone"]);
        if (!empty($name)) {
            $t        = T(C('db_prefix') . "big_block");
            $t->bzone = $name;
            $t->add();
            $_SESSION['youyax_error'] = 1;
        } else {
            $_SESSION['youyax_error'] = 2;
            echo '<script>alert("名称必填项");</script>';
        }
        $this->redirect("admin" . C('default_url') . "block" . C('static_url'));
    }
    public function sblock()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $this->assign('site', C('SITE'));
        $data = $this->select("select * from " . C('db_prefix') . "small_block where bid=" . getparam("id") . " order by ssort desc,szone desc");
        $this->assign("data", $data);
        $data1 = $this->select("select * from " . C('db_prefix') . "big_block");
        $this->assign("data1", $data1);
        $data3 = $this->find(C('db_prefix') . "big_block", "string", getparam("id"));
        $this->assign("data3", $data3)
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/sblock.html");
    }
    public function delsblock()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id        = getparam("id");
        $small_sql = "delete from " . C('db_prefix') . "small_block where id=" . $id;
        mysql_query($small_sql);
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "block" . C('static_url'));
    }
    public function editsblock()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id    = addslashes($_POST["id"]);
        $szone = addslashes($_POST["szone"]);
        $mark  = addslashes($_POST["mark"]);
        $icon_url   = addslashes($_POST["icon_url"]);
        $bid   = addslashes($_POST["bid"]);
        $ssort = addslashes($_POST['ssort']);
        //	 if(empty($szone)&&empty($mark)&&empty($bid)){
        //	 	$_SESSION['youyax_error']=2;
        // 	}else{
        $t     = T(C('db_prefix') . "small_block");
        $t		 ->find($id);
        if (!empty($szone))
            $t->szone = $szone;
        if (!empty($mark))
            $t->mark = nl2br($mark);
        if (!empty($icon_url))
            $t->icon_url = $icon_url;
        if (!empty($bid))
            $t->bid = $bid;
        if (!empty($ssort))
            $t->ssort = $ssort;
        $_SESSION['youyax_error'] = 1;
        $t->save();
        //	}
        $this->redirect("admin" . C('default_url') . "block" . C('static_url'));
    }
    public function addsblock()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $szone = $_POST["szone"];
        $mark  = $_POST["mark"];
        $bid   = $_POST["bid"];
        $icon_url   = $_POST["icon_url"];
        if (!empty($szone) && !empty($bid)) {
            $t        = T(C('db_prefix') . "small_block");
            $t->szone = $szone;
            $t->mark  = nl2br($mark);
            $t->icon_url  = $icon_url;
            $t->bid   = $bid;
            $t->ssort = 0;
            $t->add();
            $_SESSION['youyax_error'] = 1;
        } else {
            $_SESSION['youyax_error'] = 2;
            echo '<script>alert("名称或隶属必填项");</script>';
        }
        $this->redirect("admin" . C('default_url') . "block" . C('static_url'));
    }
    public function admin()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $mix = require("./Conf/mix.config.php");
        require("./ORG/Page/".$mix['fenye_style']."/Fenye.class.php");
        $countx = mysql_fetch_array(mysql_query("select count(*) as count from " . C('db_prefix') . "admin"));
        $fenye  = new Fenye($countx['count'], 40);
        $showx  = $fenye->show();
        $showx   = implode("<span style='width:2px;display:inline-block;'></span>", $showx);
        $sql    = $fenye->listcon("select * from " . C('db_prefix') . "admin order by id desc");
        $list   = $this->select($sql);
        $this->assign('data', $list)
             ->assign('page', $showx)
             ->assign('shtml', C('static_url'))
             ->assign('site', C('SITE'))
             ->assign('url', C('default_url'))
             ->display("admin/admin.html");
    }
    public function purview(){
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id=getparam("id");
        $arr  = $this->find(C('db_prefix') . "admin", "string", "id='" . $id . "'");
        $purviews=unserialize($arr['purview']);
        if (empty($purviews)) {$purviews=array();}
        $lists=$this->select("select * from " . C('db_prefix') . "small_block order by bid,ssort desc");
        $this->assign('list',$lists)
        		 ->assign('arr', $arr)
        		 ->assign('purviews', $purviews)
        		 ->assign('shtml', C('static_url'))
             ->assign('site', C('SITE'))
             ->assign('url', C('default_url'))
        		 ->display("admin/purview.html");
    }
    public function purview2(){
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id=getparam("id");
        $arr  = $this->find(C('db_prefix') . "user_group", "string", "id='" . $id . "'");
        $purviews=unserialize($arr['purview']);
        if (empty($purviews)) {$purviews=array();}
        $lists=$this->select("select * from " . C('db_prefix') . "small_block order by bid,ssort desc");
        $this->assign('list',$lists)
        		 ->assign('arr', $arr)
        		 ->assign('purviews', $purviews)
        		 ->assign('shtml', C('static_url'))
             ->assign('site', C('SITE'))
             ->assign('url', C('default_url'))
        		 ->display("admin/purview2.html");
    }
    public function purview_update(){
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
      }
      $array=array();
      for($k=0;$k<count($_POST['ck']);$k++){
      	$array[]=$_POST['ck'][$k];
      }
      $data['purview'] = serialize($array);
      $this->save($data, C('db_prefix') . "admin", "id='" . $_POST['id'] . "'");
      $_SESSION['youyax_error'] = 1;
      $this->redirect("admin" . C('default_url') . "purview" . C('default_url') . "id" . C('default_url') . $_POST['id'] . C('static_url'));
    }
    public function purview_update2(){
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
      }
      $array=array();
      for($k=0;$k<count($_POST['ck']);$k++){
      	$array[]=$_POST['ck'][$k];
      }
      $data['purview'] = serialize($array);
      $this->save($data, C('db_prefix') . "user_group", "id='" . $_POST['id'] . "'");
      $_SESSION['youyax_error'] = 1;
      $this->redirect("admin" . C('default_url') . "purview2" . C('default_url') . "id" . C('default_url') . $_POST['id'] . C('static_url'));
    }
    public function admin_add()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $user = addslashes($_POST['admin']);
        $pass = md5(addslashes($_POST['pass']));
        $arr  = $this->find(C('db_prefix') . "admin", "string", "user='" . $user . "'");
        if (empty($user) || empty($pass) || empty($_POST['ac'])) {
            $_SESSION['youyax_error'] = 2;
        } else {
            if ($_POST['ac'] == "add") {
                $t       = T(C('db_prefix') . "admin");
                $t->user = $user;
                $t->pass = $pass;
                $t->isAdmin = 1;
                $t->add();
                $_SESSION['youyax_error'] = 1;
            } elseif ($_POST['ac'] == "update") {
                if ($this->find(C('db_prefix') . "admin", "string", "user='" . $user . "'")) {
                    $data['pass'] = $pass;
                    $this->save($data, C('db_prefix') . "admin", "user='" . $user . "'");
                    $_SESSION['youyax_error'] = 1;
                } else {
                    $_SESSION['youyax_error'] = 2;
                }
            } else {
                $_SESSION['youyax_error'] = 2;
            }
        }
        $this->redirect("admin" . C('default_url') . "admin" . C('static_url'));
    }
    public function admin_del()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id = getparam("id");
        $t  = T(C('db_prefix') . "admin");
        $t  ->find($id);
        $t  ->delete();
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "admin" . C('static_url'));
    }
    public function admin_depose()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id         = getparam("id");
        $t          = T(C('db_prefix') . "admin");
        $t				  ->find($id);
        $t					->delete();
        $data['title'] = '';
        $this->save($data,C('db_prefix') . "user","user='".$t->user."'");
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "admin" . C('static_url'));
    }
    public function mark1()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $mix = require("./Conf/mix.config.php");
        require("./ORG/Page/".$mix['fenye_style']."/Fenye.class.php");
        $countx = mysql_fetch_array(mysql_query("select count(*) as count from " . C('db_prefix') . "mark1"));
        $fenye  = new Fenye($countx['count'], 40);
        $showx  = $fenye->show();
        $showx   = implode("<span style='width:2px;display:inline-block;'></span>", $showx);
        $sql    = $fenye->listcon("select * from " . C('db_prefix') . "mark1 order by id desc");
        $list   = $this->select($sql);
        $this->assign('data', $list)
             ->assign('page', $showx)
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->assign('site', C('SITE'))
             ->display("admin/mark1.html");
    }
    public function mark1_del()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id = getparam("id");
        $t  = T(C('db_prefix') . "mark1");
        $t  ->find($id);
        $t  ->delete();
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "mark1" . C('static_url'));
    }
    public function mark2()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $mix = require("./Conf/mix.config.php");
        require("./ORG/Page/".$mix['fenye_style']."/Fenye.class.php");
        $countx = mysql_fetch_array(mysql_query("select count(*) as count from " . C('db_prefix') . "mark2"));
        $fenye  = new Fenye($countx['count'], 40);
        $showx  = $fenye->show();
        $showx   = implode("<span style='width:2px;display:inline-block;'></span>", $showx);
        $sql    = $fenye->listcon("select * from " . C('db_prefix') . "mark2 order by id desc");
        $list   = $this->select($sql);
        $this->assign('data', $list)
             ->assign('page', $showx)
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->assign('site', C('SITE'))
             ->display("admin/mark2.html");
    }
    public function mark2_del()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id = getparam("id");
        $t  = T(C('db_prefix') . "mark2");
        $t  ->find($id);
        $t  ->delete();
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "mark2" . C('static_url'));
    }
    public function reply()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $mix = require("./Conf/mix.config.php");
        require("./ORG/Page/".$mix['fenye_style']."/Fenye.class.php");
        $countx = mysql_fetch_array(mysql_query("select count(*) as count from " . C('db_prefix') . "reply where id2!=1"));
        $fenye  = new Fenye($countx['count'], 40);
        $showx  = $fenye->show();
        $showx   = implode("<span style='width:2px;display:inline-block;'></span>", $showx);
        $sql    = $fenye->listcon("select * from " . C('db_prefix') . "reply  where id2!=1 order by id2 desc");
        $list   = $this->select($sql);
        $this->assign('list', $list)
             ->assign('page', $showx)
             ->assign('site', C('SITE'))
             ->assign('db_prefix', C('db_prefix'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/reply.html");
    }
    public function reply_del()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id = getparam("id2");
        $this->delete(C('db_prefix') . "reply", "id2=" . $id);
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "reply" . C('static_url'));
    }
    public function talk()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $mix = require("./Conf/mix.config.php");
        require("./ORG/Page/".$mix['fenye_style']."/Fenye.class.php");
        $countx = mysql_fetch_array(mysql_query("select count(*) as count from " . C('db_prefix') . "talk"));
        $fenye  = new Fenye($countx['count'], 40);
        $showx  = $fenye->show();
        $showx   = implode("<span style='width:2px;display:inline-block;'></span>", $showx);
        $sql    = $fenye->listcon("select * from " . C('db_prefix') . "talk order by id desc");
        $list   = $this->select($sql);
        $this->assign('list', $list)
             ->assign('page', $showx);
        $data1 = $this->select("select * from " . C('db_prefix') . "small_block");
        $this->assign("data1", $data1)
             ->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/talk.html");
    }
    public function movetalk()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id           = $_POST['id'];
        $t            = T(C('db_prefix') . "talk");
        $t						->find($id);
        $t->parentid 	= $_POST['parentid'];
        $t->save();
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "talk" . C('static_url'));
    }
    public function talk_del()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id = getparam("id");
        if(is_exist_widget("delPostPicWidget") && is_active_widget("delPostPicWidget")){
					w("delPostPicWidget")->judge($id);
				}
        $t  = T(C('db_prefix') . "talk");
        $t  ->find($id);
        $t  ->delete();
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "talk" . C('static_url'));
    }
    public function user()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $mix = require("./Conf/mix.config.php");
        require("./ORG/Page/".$mix['fenye_style']."/Fenye.class.php");
        $countx = mysql_fetch_array(mysql_query("select count(*) as count from " . C('db_prefix') . "user"));
        $fenye  = new Fenye($countx['count'], 40);
        $showx  = $fenye->show();
        $showx   = implode("<span style='width:2px;display:inline-block;'></span>", $showx);
        $sql    = $fenye->listcon("select * from " . C('db_prefix') . "user order by id desc");
        $list   = $this->select($sql);
        $user_group_data=$this->select("select * from " . C('db_prefix') . "user_group order by id desc");
        $this->assign('data', $list)
        		 ->assign('user_group_data', $user_group_data)
             ->assign('page', $showx)
             ->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/user.html");
    }
    public function do_s_user()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $mix = require("./Conf/mix.config.php");
        require("./ORG/Page/".$mix['fenye_style']."/Fenye.class.php");
        $countx = mysql_fetch_array(mysql_query("select count(*) as count from " . C('db_prefix') . "user"));
        $fenye  = new Fenye($countx['count'], 40);
        $showx  = $fenye->show();
        $showx   = implode("<span style='width:2px;display:inline-block;'></span>", $showx);
        $sql    = $fenye->listcon("select * from " . C('db_prefix') . "user where user='".addslashes($_POST['suser'])."' order by id desc");
        $list   = $this->select($sql);
        $user_group_data=$this->select("select * from " . C('db_prefix') . "user_group order by id desc");
        $this->assign('data', $list)
        		 ->assign('user_group_data', $user_group_data)
             ->assign('page', $showx)
             ->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/user.html");
    }
    public function user_set_group()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id         = addslashes($_POST['id']);
        $t          = T(C('db_prefix') . "user");
        $t					->find($id);
        $t->user_group  = addslashes($_POST['user_group_data']);
        $t->save();
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "user" . C('static_url'));
    }
    public function user_forbid()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id         = getparam("id");
        $t          = T(C('db_prefix') . "user");
        $t					->find($id);
        $t->status  = 2;
        $t->save();
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "user" . C('static_url'));
    }
    public function user_appoint()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id         = getparam("id");
        $t          = T(C('db_prefix') . "user");
        $t				  ->find($id);
        $t->title   = 'ico_title.png';
        $t->save();
        $at         = T(C('db_prefix') . "admin");
        $at->user  = $t->user;
        $at->pass  = $t->pass;
        $at->isAdmin  = 0;
        $at->add();
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "user" . C('static_url'));
    }
    public function user_depose()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id         = getparam("id");
        $t          = T(C('db_prefix') . "user");
        $t					->find($id);
        $t->title  = '';
        $t->save();
        $this->delete(C('db_prefix') . "admin","user='".$t->user."'");        
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "user" . C('static_url'));
    }
    public function user_empty()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id   = getparam("id");
        $t    = T(C('db_prefix') . "user");
        $t		->find($id);
        $user = $t->user;
        $this->delete(C('db_prefix') . "talk", "zuozhe='" . $user . "'");
        $this->delete(C('db_prefix') . "reply", "zuozhe1='" . $user . "'");
        $this->delete(C('db_prefix') . "mark1", "marker='" . $user . "'");
        $this->delete(C('db_prefix') . "mark2", "marker='" . $user . "'");
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "user" . C('static_url'));
    }
    public function user_unfor()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id         = getparam("id");
        $t          = T(C('db_prefix') . "user");
        $t					->find($id);
        $t->status = 1;
        $t->save();
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "user" . C('static_url'));
    }
    public function user_del()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id = getparam("id");
        $t  = T(C('db_prefix') . "user");
        $t  ->find($id);
        $t->delete();
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "user" . C('static_url'));
    }
    public function setting()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $site_config = require("./Conf/site.config.php");
        $this->assign('site_config', $site_config)
             ->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/setting.html");
    }
    public function dosetting()
    {
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $site_config = require("./Conf/site.config.php");
        if (!empty($_POST['title'])) {
            $site_config['site_title'] = $_POST['title'];
        }
        $site_config['site_keywords']    = $_POST['keywords'];
        $site_config['site_description'] = $_POST['description'];
        $site_config['site_logo']        = $_POST['logo'];
        $site_config['site_foot']        = $_POST['foot'];
        $file                            = "<?php return " . var_export($site_config, true) . "; ?>";
        file_put_contents("./Conf/site.config.php", $file, LOCK_EX);
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "setting" . C('static_url'));
    }
    public function mailset()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $config = require("./Conf/config.php");
        $this->assign('config', $config);
        $user_group_data=$this->select("select * from " . C('db_prefix') . "user_group order by id desc");
        $mail_config = require("./Conf/mail.config.php");
        $this->assign('mail_config', $mail_config)
						 ->assign('user_group_data', $user_group_data)
             ->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/mailset.html");
    }
    public function domailset()
    {
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
    		$config            = require("./Conf/config.php");
        $config['register_mode'] = addslashes($_POST['reg']);
        $config['default_user_group'] = addslashes($_POST['default_user_group']);
        $config['not_log_in_user_group'] = addslashes($_POST['not_log_in_user_group']);
        $file              = "<?php return " . var_export($config, true) . "; ?>";
        file_put_contents("./Conf/config.php", $file, LOCK_EX);
        if($_POST['reg']==1){
	        $mail_config                  = require("./Conf/mail.config.php");
	        $mail_config['mail_Host']     = $_POST['host'];
	        $mail_config['mail_Username'] = $_POST['huser'];
	        $mail_config['mail_Password'] = $_POST['hpass'];
	        $mail_config['mail_From']     = $_POST['ufrom'];
	        $mail_config['mail_FromName'] = $_POST['uname'];
	        $mail_config['mail_Subject']  = $_POST['utitle'];
	        $mail_config['mail_Body']     = $_POST['ucon'];
	        $file                         = "<?php return " . var_export($mail_config, true) . "; ?>";
	        file_put_contents("./Conf/mail.config.php", $file, LOCK_EX);
      	}
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "mailset" . C('static_url'));
    }
    public function seoset()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $config = require("./Conf/config.php");
        $this->assign('config', $config)
             ->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/seoset.html");
    }
    public function doseoset()
    {
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $config            = require("./Conf/config.php");
        $config['seo_set'] = $_POST['seostatus'];
        $file              = "<?php return " . var_export($config, true) . "; ?>";
        file_put_contents("./Conf/config.php", $file, LOCK_EX);
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "seoset" . C('static_url'));
    }
    public function custom_title()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $config = require("./Conf/custom_title.config.php");
        $this->assign('config', $config)
             ->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/custom_title.html");
    }
    public function docustom_title()
    {
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $title=$_POST['title'];
        $min=$_POST['min'];
        $max=$_POST['max'];
        $file='';
        foreach($title as $k => $v){
        	$file.="array('title'=>'".$v."','min'=>'".$min[$k]."','max'=>'".$max[$k]."'),";
        }
        $file="array(".$file.")";
        $file              = "<?php return " . $file . "; ?>";
        file_put_contents("./Conf/custom_title.config.php", $file, LOCK_EX);
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "custom_title" . C('static_url'));
    }
    public function friend_url_set()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $config = require("./Conf/friend_url.config.php");
        $this->assign('config', $config)
             ->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/friend_url_set.html");
    }
    public function do_friend_url()
    {
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $title=$_POST['title'];
        $url=$_POST['url'];
        $file='';
        foreach($title as $k => $v){
        	$file.="array('title'=>'".$v."','url'=>'".$url[$k]."'),";
        }
        $file="array(".$file.")";
        $file              = "<?php return " . $file . "; ?>";
        file_put_contents("./Conf/friend_url.config.php", $file, LOCK_EX);
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "friend_url_set" . C('static_url'));
    }
    public function talk_vote()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $mix = require("./Conf/mix.config.php");
        require("./ORG/Page/".$mix['fenye_style']."/Fenye.class.php");
        $countx = mysql_fetch_array(mysql_query("select count(*) as count from " . C('db_prefix') . "vote"));
        $fenye  = new Fenye($countx['count'], 40);
        $showx  = $fenye->show();
        $showx   = implode("<span style='width:2px;display:inline-block;'></span>", $showx);
        $sql    = $fenye->listcon("select * from " . C('db_prefix') . "vote order by id desc");
        $list   = $this->select($sql);
        $this->assign('data', $list)
             ->assign('page', $showx)
             ->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/talk_vote.html");
    }
    public function talk_vote_del()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id = getparam("id");
        $t  = T(C('db_prefix') . "vote");
        $t  ->find($id);
        $t  ->delete();
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "talk_vote" . C('static_url'));
    }
    public function clear_vote(){
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $sql="delete from " . C('db_prefix') . "vote where rid not in(select id from " . C('db_prefix') ."talk)";
        mysql_query($sql);
        $this->redirect("admin" . C('default_url') . "talk_vote" . C('static_url'));
    }
    public function vote_ip()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $mix = require("./Conf/mix.config.php");
        require("./ORG/Page/".$mix['fenye_style']."/Fenye.class.php");
        $countx = mysql_fetch_array(mysql_query("select count(*) as count from " . C('db_prefix') . "vote_ips"));
        $fenye  = new Fenye($countx['count'], 40);
        $showx  = $fenye->show();
        $showx   = implode("<span style='width:2px;display:inline-block;'></span>", $showx);
        $sql    = $fenye->listcon("select * from " . C('db_prefix') . "vote_ips order by id desc");
        $list   = $this->select($sql);
        $this->assign('data', $list)
             ->assign('page', $showx)
             ->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/vote_ip.html");
    }
    public function vote_ip_del()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id = getparam("id");
        $t  = T(C('db_prefix') . "vote_ips");
        $t  ->find($id);
        $t  ->delete();
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "vote_ip" . C('static_url'));
    }
    public function menu_cn_set()
    {
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
      }
      if(getparam("sp")=='en'){
      	$mc = require("./Conf/menu_en.config.php");
      	$this->assign('sp', 'en');
	    }else{
	    	$mc = require("./Conf/menu.config.php");
	    	$this->assign('sp', 'cn');
	    }
      $this->assign('mc', $mc)
    			 ->assign('shtml', C('static_url'))
           ->assign('site', C('SITE'))
           ->assign('url', C('default_url'))
           ->display("admin/menu_cn_set.html");
    }
    public function do_menu_cn_set(){
    	$array=array();
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
      }
    	foreach($_POST as $k=>$v){
    		if($k=='x' || $k=='y'){
    			unset($_POST[$k]);
    		}
    		$num=preg_match_all('/-/',$k,$match);
    		if($num==1){
    			$tmp=explode("-",$k);
    			if(empty($array[$tmp[0]]['seclists'])){
    				$array[$tmp[0]]['seclists']=array();
    			}		
    			$array[$tmp[0]][$tmp[1]]=$v;
    		}
    		if($num==2){
    			$tmp=explode("-",$k);
    			if(empty($array[$tmp[0]]['seclists'])){
    				$array[$tmp[0]]['seclists']=array();
    			}
    				$array[$tmp[0]]['seclists'][$tmp[1]][$tmp[2]]=$v;
    		}
    	}
    	$file              = "<?php return " . var_export($array, true) . "; ?>";
    	if($_POST['sp']=='cn'){
      	file_put_contents("./Conf/menu.config.php", $file, LOCK_EX);
    	}if($_POST['sp']=='en'){
      	file_put_contents("./Conf/menu_en.config.php", $file, LOCK_EX);
    	}
      $_SESSION['youyax_error'] = 1;
      $this->redirect("admin" . C('default_url') . "menu_cn_set" .C('default_url') . "sp" .C('default_url') .$_POST['sp'] . C('static_url'));
    }
    public function do_menu_cn_set_delone(){
    	$array=array();
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
      }
      if(getparam("sp")=='cn'){
      	$mc = require("./Conf/menu.config.php");
    	}if(getparam("sp")=='en'){
      	$mc = require("./Conf/menu_en.config.php");
    	}
      $oid=getparam("oid");
      foreach($mc as $k=>$v){
      	if($k==$oid){
      		unset($mc[$k]);
      	}else{
      		$array[]=$v;
      	}
      }
      $file              = "<?php return " . var_export($array, true) . "; ?>";
      if(getparam("sp")=='cn'){
      	file_put_contents("./Conf/menu.config.php", $file, LOCK_EX);
    	}if(getparam("sp")=='en'){
      	file_put_contents("./Conf/menu_en.config.php", $file, LOCK_EX);
    	}
      $_SESSION['youyax_error'] = 1;
      $sp=getparam("sp");
      $this->redirect("admin" . C('default_url') . "menu_cn_set" .C('default_url') . "sp" .C('default_url') .$sp . C('static_url'));
    }
    public function do_menu_cn_set_deltwo(){
    	$array =array();
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
      }
      if(getparam("sp")=='cn'){
      	$mc = require("./Conf/menu.config.php");
    	}if(getparam("sp")=='en'){
      	$mc = require("./Conf/menu_en.config.php");
    	}
      $oid=getparam("oid");
      $tid=getparam("tid");
      foreach($mc as $k=>$v){
       if(!empty($v['seclists'])){
      	if($k==$oid){
	      		foreach($v['seclists'] as $kk=>$vv){
	      			if($kk==$tid){
	      				$array[$k]['title']=$v['title'];
	      				$array[$k]['url']=$v['url'];
	      				unset($mc[$k]['seclists'][$kk]);
	      				if(!is_array($array[$k]['seclists'])){
	      					$array[$k]['seclists']=array();
	      				}
	      			}else{
	      				$array[$k]['title']=$v['title'];
	      				$array[$k]['url']=$v['url'];
			      		$array[$k]['seclists'][]=$vv;
			      	}
	      		}
      		}else{
      			$array[$k]=$v;
      		}
      	}else{
      		$array[$k]['title']=$v['title'];
	      	$array[$k]['url']=$v['url'];
      		$array[$k]['seclists']=array();
      	}
      }
      $file              = "<?php return " . var_export($array, true) . "; ?>";
      if(getparam("sp")=='cn'){
      	file_put_contents("./Conf/menu.config.php", $file, LOCK_EX);
    	}if(getparam("sp")=='en'){
      	file_put_contents("./Conf/menu_en.config.php", $file, LOCK_EX);
    	}
      $_SESSION['youyax_error'] = 1;
      $sp=getparam("sp");
      $this->redirect("admin" . C('default_url') . "menu_cn_set" .C('default_url') . "sp" .C('default_url') .$sp . C('static_url'));
    }
    public function do_menu_cn_set_addone(){
    	$array =array();
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
      }
      if($_POST['sp2']=='cn'){
      	$mc = require("./Conf/menu.config.php");
    	}if($_POST['sp2']=='en'){
      	$mc = require("./Conf/menu_en.config.php");
    	}
      $array['title']=addslashes($_POST['oname']);
      $array['url']=addslashes($_POST['ourl']);
      $array['seclists']=array();
      $mc[]=$array;
      $file              = "<?php return " . var_export($mc, true) . "; ?>";
      if($_POST['sp2']=='cn'){
      	file_put_contents("./Conf/menu.config.php", $file, LOCK_EX);
    	}if($_POST['sp2']=='en'){
      	file_put_contents("./Conf/menu_en.config.php", $file, LOCK_EX);
    	}      
      $_SESSION['youyax_error'] = 1;
      $this->redirect("admin" . C('default_url') . "menu_cn_set" .C('default_url') . "sp" .C('default_url') .$_POST['sp2'] . C('static_url'));
    }
    public function do_menu_cn_set_addtwo(){
    	$array=array();
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
      }
      if($_POST['sp2']=='cn'){
      	$mc = require("./Conf/menu.config.php");
    	}if($_POST['sp2']=='en'){
      	$mc = require("./Conf/menu_en.config.php");
    	}
      $array['title']=addslashes($_POST['tname']);
      $array['url']=addslashes($_POST['turl']);
      $mc[$_POST['oid']]['seclists'][]=$array;
      $file              = "<?php return " . var_export($mc, true) . "; ?>";
      if($_POST['sp2']=='cn'){
      	file_put_contents("./Conf/menu.config.php", $file, LOCK_EX);
    	}if($_POST['sp2']=='en'){
      	file_put_contents("./Conf/menu_en.config.php", $file, LOCK_EX);
    	}
      $_SESSION['youyax_error'] = 1;
      $this->redirect("admin" . C('default_url') . "menu_cn_set" .C('default_url') . "sp" .C('default_url') .$_POST['sp2'] . C('static_url'));
    }
    public function filter_set(){
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $config = require("./Conf/filter.config.php");
        $this->assign('config', var_export($config, true))
             ->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/filter_set.html");
    }
    public function do_filter(){
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $filter=$_POST['filter_area'];
        $file              = "<?php return " . stripslashes($filter) . "; ?>";
        file_put_contents("./Conf/filter.config.php", $file, LOCK_EX);
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "filter_set" . C('static_url'));
    }
    public function ads_set(){
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $ads=require("./Conf/ads.config.php");
        $this->assign('ads', $ads)
             ->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/ads_set.html");
    }
    public function do_ads(){
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $filter=$_POST['ads'];
        $file              = "<?php return '" . addslashes($filter) . "'; ?>";
        file_put_contents("./Conf/ads.config.php", $file, LOCK_EX);
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "ads_set" . C('static_url'));
    }
    public function plugin_view(){
    	$array = array();
    	$dir = dir("Plugin");
			while (($file = $dir->read()) !== false){
				if($file!="." && $file!=".." && preg_match_all("/Widget\.php/",$file,$tmp)){
					$array[]=$file;
				}
			}
			$dir->close();
			if(count($array) != count(array_unique($array))){
				$this->assign("Tip", "插件名不能重复!")
             ->display("Public/plugin_error.html");
             exit;
			}else{
			$array2 = array();
			$data=$this->select("select * from ". C('db_prefix') . "plugin where status=1");
			foreach($data as $v){
				$array2[] = $v['name'];
			}
			$this->assign('plu_arr',$array)
					 ->assign('plu_in_arr',$array2)
					 ->assign('site', C('SITE'))
         	 ->assign('shtml', C('static_url'))
        	 ->assign('url', C('default_url'))
        	 ->display("admin/plugin_view.html");
        	}
    }
    public function mix_set(){
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $mix=require("./Conf/mix.config.php");
        $this->assign('mix', $mix)
             ->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/mix_set.html");
    }
    public function do_mix(){
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $config            = require("./Conf/mix.config.php");
        if(!is_numeric($_POST['list_per'])||!is_numeric($_POST['admin_count_num'])){
        	$_SESSION['youyax_error'] = 2;
        	$this->redirect("admin" . C('default_url') . "mix_set" . C('static_url'));
        }
       if(!empty($_FILES["file"]['tmp_name'])){
        if (($_FILES["file"]["type"] == "image/gif")
					|| ($_FILES["file"]["type"] == "image/jpeg")
					|| ($_FILES["file"]["type"] == "image/pjpeg")
					|| ($_FILES["file"]["type"] == "image/png")
					)
			  {
			  if ($_FILES["file"]["error"] > 0)
			    {
			    	$_SESSION['youyax_error'] = 2;
			    	$this->redirect("admin" . C('default_url') . "mix_set" . C('static_url'));
			    }
			  else
			    {
			    if (file_exists("./Public/images/" . $_FILES["file"]["name"]))
			      {
			      	echo '<script>alert("文件名已经存在了");</script>';
			     		$_SESSION['youyax_error'] = 2;
			    		$this->redirect("admin" . C('default_url') . "mix_set" . C('static_url'));
			      }
			    else
			      {
			      move_uploaded_file($_FILES["file"]["tmp_name"],
			      "./Public/images/" . $_FILES["file"]["name"]);
			      @unlink(".".$config['home_back_bg']);
			      }
			    }
			  }
			else
			  {
			  	echo '<script>alert("无效文件");</script>';
			    $_SESSION['youyax_error'] = 2;
			    $this->redirect("admin" . C('default_url') . "mix_set" . C('static_url'));
			  }
			}
        $config['list_per'] = addslashes($_POST['list_per']);
        $config['fenye_style'] = addslashes($_POST['fenye_style']);
        $config['is_prevent_reg'] = ($_POST['is_prevent_reg']==1) ? true : false;
        $config['prevent_reg_num'] = addslashes($_POST['prevent_reg_num']);
        $config['is_limit_time'] = ($_POST['is_limit_time']==1) ? true : false;
        $config['limit_time'] = addslashes($_POST['limit_time']);
        $config['admin_count_num'] = addslashes($_POST['admin_count_num']);
      if(!empty($_FILES["file"]['tmp_name'])){
        $config['home_back_bg'] = "/Public/images/" . $_FILES["file"]["name"];
      }
        $file              = "<?php return " . var_export($config, true) . "; ?>";
        file_put_contents("./Conf/mix.config.php", $file, LOCK_EX);
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "mix_set" . C('static_url'));
    }
    public function ads_poll_set(){
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $poll=require("./Conf/ads_poll.config.php");
        $this->assign('poll', $poll)
             ->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/ads_poll_set.html");
    }
    public function do_ads_poll_set()
    {
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $img=$_POST['img'];
        $title=$_POST['title'];
        $url=$_POST['url'];
        $ord=$_POST['ord'];
        $file='';
        foreach($img as $k => $v){
        	$file.="array('img'=>'".$v."','title'=>'".$title[$k]."','url'=>'".$url[$k]."','ord'=>'".$ord[$k]."'),";
        }
        $file="array(".$file.")";
        $file              = "<?php return " . $file . "; ?>";
        file_put_contents("./Conf/ads_poll.config.php", $file, LOCK_EX);
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "ads_poll_set" . C('static_url'));
    }
    public function placard_set(){
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $placard=require("./Conf/placard_set.config.php");
        $this->assign('placard', $placard)
             ->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/placard_set.html");
    }
    public function do_placard_set()
    {
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $title=$_POST['title'];
        $url=$_POST['url'];
        $ord=$_POST['ord'];
        $file='';
        foreach($title as $k => $v){
        	$file.="array('title'=>'".$title[$k]."','url'=>'".$url[$k]."','ord'=>'".$ord[$k]."'),";
        }
        $file="array(".$file.")";
        $file              = "<?php return " . $file . "; ?>";
        file_put_contents("./Conf/placard_set.config.php", $file, LOCK_EX);
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "placard_set" . C('static_url'));
    }
    public function qqset(){
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $qq=require("./Conf/qq.config.php");
        $this->assign('qq', $qq)
             ->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/qq_set.html");
    }
    public function do_qqset()
    {
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $qq            = require("./Conf/qq.config.php");
        $qq['app_id'] = addslashes($_POST['app_id']);
        $qq['app_secret'] = addslashes($_POST['app_secret']);
        $file              = "<?php return " . var_export($qq, true) . "; ?>";
        file_put_contents("./Conf/qq.config.php", $file, LOCK_EX);
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "qqset" . C('static_url'));
    }
    public function vertical_set(){
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $placard=require("./Conf/vertical_set.config.php");
        $this->assign('placard', $placard)
             ->assign('site', C('SITE'))
             ->assign('shtml', C('static_url'))
             ->assign('url', C('default_url'))
             ->display("admin/vertical_set.html");
    }
    public function do_vertical_set()
    {
    	if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $title=$_POST['title'];
        $url=$_POST['url'];
        $ord=$_POST['ord'];
        $file='';
        foreach($title as $k => $v){
        	$file.="array('title'=>'".$title[$k]."','url'=>'".$url[$k]."','ord'=>'".$ord[$k]."'),";
        }
        $file="array(".$file.")";
        $file              = "<?php return " . $file . "; ?>";
        file_put_contents("./Conf/vertical_set.config.php", $file, LOCK_EX);
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "vertical_set" . C('static_url'));
    }
    public function user_group()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $mix = require("./Conf/mix.config.php");
        require("./ORG/Page/".$mix['fenye_style']."/Fenye.class.php");
        $countx = mysql_fetch_array(mysql_query("select count(*) as count from " . C('db_prefix') . "user_group"));
        $fenye  = new Fenye($countx['count'], 40);
        $showx  = $fenye->show();
        $showx   = implode("<span style='width:2px;display:inline-block;'></span>", $showx);
        $sql    = $fenye->listcon("select * from " . C('db_prefix') . "user_group order by id asc");
        $list   = $this->select($sql);
        $this->assign('data', $list)
             ->assign('page', $showx)
             ->assign('shtml', C('static_url'))
             ->assign('site', C('SITE'))
             ->assign('url', C('default_url'))
             ->display("admin/user_group.html");
    }
    public function user_group_add()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $name = addslashes($_POST["name"]);
        if (!empty($name)) {
            $t        = T(C('db_prefix') . "user_group");
            $t->name = $name;
            $t->add();
            $_SESSION['youyax_error'] = 1;
        } else {
            $_SESSION['youyax_error'] = 2;
            echo '<script>alert("名称必填项");</script>';
        }
        $this->redirect("admin" . C('default_url') . "user_group" . C('static_url'));
    }
    public function user_group_mod()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id   = addslashes($_POST["id"]);
        $name = addslashes($_POST["name"]);
        if (empty($name)) {
            $_SESSION['youyax_error'] = 2;
        } else {
            $t                        = T(C('db_prefix') . "user_group");
            $t												->find($id);
            $t->name                 = $name;
            $_SESSION['youyax_error'] = 1;
            $t->save();
        }
        $this->redirect("admin" . C('default_url') . "user_group" . C('static_url'));
    }
    public function user_group_del()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id      = getparam("id");
        $sql = "delete from " . C('db_prefix') . "user_group where id=" . $id;
        mysql_query($sql);
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "user_group" . C('static_url'));
    }
    public function jubao()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $mix = require("./Conf/mix.config.php");
        require("./ORG/Page/".$mix['fenye_style']."/Fenye.class.php");
        $countx = mysql_fetch_array(mysql_query("select count(*) as count from " . C('db_prefix') . "jubao"));
        $fenye  = new Fenye($countx['count'], 40);
        $showx  = $fenye->show();
        $showx   = implode("<span style='width:2px;display:inline-block;'></span>", $showx);
        $sql    = $fenye->listcon("select * from " . C('db_prefix') . "jubao order by id asc");
        $list   = $this->select($sql);
        $this->assign('data', $list)
             ->assign('page', $showx)
             ->assign('shtml', C('static_url'))
             ->assign('site', C('SITE'))
             ->assign('url', C('default_url'))
             ->display("admin/jubao.html");
    }
    public function jubao_del()
    {
        if (empty($_SESSION['youyax_admin'])) {
            $this->redirect("admin" . C('default_url') . "login" . C('static_url'));
        }
        $id      = getparam("id");
        $sql = "delete from " . C('db_prefix') . "jubao where id=" . $id;
        mysql_query($sql);
        $_SESSION['youyax_error'] = 1;
        $this->redirect("admin" . C('default_url') . "jubao" . C('static_url'));
    }
}
?>


网友评论    (发表评论)

共1 条评论 1/1页

发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...