<?php
if(!defined('APP_PATH')||!defined('I_PATH')){exit('Access Denied');}

class ld_funs extends controllerBase
{
	function __construct(){
		parent::__construct();
		$this->Get_c='ld_funs';
		$this->a=$this->sysParams('a',1);
		$this->db=func_get_iglobal(array('db','prefix'));
		$this->newrow = array(
			'name' => $this->sysParams('name',1),
			'isshow' => $this->sysParams('isshow'),
		);
	}
	function index(){
		$this->toptxt='插件管理';
		$this->lists = syDB('funs')->findAll(array('isshow'=>1));
		$this->lists_no = syDB('funs')->findAll(array('isshow'=>0));
		$this->display("funs.html");
	}
	function edit(){
		$this->d=syDB('funs')->find(array('fid'=>$this->sysParams('fid')));
		if ($this->sysParams('run')==1){
			if(syDB('funs')->update(array('fid'=>$this->d['fid']),$this->newrow)){
				echo "<script>window.parent.left.location.reload();</script>";
				message_a("插件修改成功","?c=".$this->Get_c);
			}else{message_a("插件修改失败,请重新提交");}
		}
		$this->toptxt='修改插件';
		$this->postgo='edit';
		$this->display("funs.html");
	}
}	