function edit_action() {
    	if($this->table == 'category'){
    		chkpw('category_edit');
    	}
    	if($this->table == 'archive'){
    		chkpw('archive_edit');
    	}
    	if($this->table == 'type'){
    		chkpw('type_edit');
    		front::$post['typecontent'] = htmlspecialchars_decode(front::$post['typecontent']);
    	}
    	if($this->table == 'special'){
    		chkpw('special_edit');
    		front::$post['description'] = htmlspecialchars_decode(front::$post['description']);
    	}
    	if($this->table == 'user'){
    		chkpw('user_edit');
    	}
    	if($this->table == 'usergroup'){
    		chkpw('usergroup_edit');
    	}
    	if($this->table == 'orders'){
    		chkpw('order_edit');
    	}
    	if($this->table == 'comment'){
    		chkpw('func_book_pledit');
    	}
    	if($this->table == 'guestbook'){
    		chkpw('func_book_reply');
    	}
    	if($this->table == 'announcement'){
    		chkpw('func_announc_edit');
    		front::$post['content'] = htmlspecialchars_decode(front::$post['content']);
    	}
    	if($this->table == 'linkword'){
    		chkpw('seo_linkword_edit');
    	}
    	if($this->table == 'friendlink'){
    		chkpw('seo_friendlink_edit');
    	}
    	
        //用户异步提取图库图片
    	if(front::$get['ajax']){
            front::$get['dir'] = front::$get['ajax'];
            $img_arr = image_admin::listimg_action();
            foreach($img_arr as $v){
            	echo '<img src="upload/images/'.front::$get['dir'].'/'.$v.'" id="img'.str_replace('.','',$v).'" onClick="select_img(\'img'.str_replace('.','',$v).'\');" />';
            }
            exit();
        }
        if (front::post('submit') &&$this->manage->vaild()) {
            $this->manage->filter($this->Exc);
            $this->manage->edit_before();
            $this->manage->save_before();
            front::$post['tagcontent'] = stripslashes(stripslashes(front::$post['tagcontent']));
            if ($this->table == 'user'&&front::get('id') == '1') {
                $this->_table1=new operators();
                $update=$this->_table1->rec_update(array('password'=>front::post('password')),'id='.front::get('id'));
            }
            $update=$this->_table->rec_update(front::$post,front::get('id'));
            if($this->table == 'category' && front::post('image') != '' && front::post('image_del')){
                @unlink(front::post('image'));
                $update=$this->_table->rec_update(array('image'=>''),front::get('id'));
            }
            if ($this->table == 'templatetag') {
                if (front::$post['tagfrom'] == 'content') {
                    $path=ROOT.'/config/tag/content_'.front::get('id').'.php';
                }
                else {
                    $path=ROOT.'/config/tag/category_'.front::get('id').'.php';
                }
                $tag_config=serialize(front::$post);
                file_put_contents($path,$tag_config);
            }
            if ($update <1) {
                front::flash("{$this->tname}修改失败!");
            }
            else {
                event::log("修改".$this->tname,'成功');
                $this->manage->save_after(front::get('id'));
                $info='';
                if ($this->table == 'archive') {
                    $url=url('archive/show/aid/'.front::get('id'),false);
                    if (front::get('site') == 'default'||front::get('site') == '') {
                        $info='<a href="'.$url.'" target="_blank">查看</a>';
                    }
                }
                front::flash("{$this->tname}修改成功!$info");
                $from=session::get('from');
                session::del('from');
                if (!front::post('onlymodify'))
                    front::redirect(url::modify('act/list',true));
            }
        }
        $tag_option_info = settings::getInstance()->getrow(array('tag'=>'table-hottag'));
        $tag_option_arr = unserialize($tag_option_info['value']);
        $this->view->tag_opton = explode("\n",$tag_option_arr['hottag']);
        $this->view->image_dir = image_admin::listdir_action();

        if (!session::get('from'))
            session::set('from',front::$from);
        if (!front::get('id'))
            exit("PAGE_NOT FOUND!");
        $this->_view_table=$this->_table->getrow(front::get('id'),'1 desc',$this->_table->getcols('modify'));
        //var_dump($this->_view_table);exit;
        if (!is_array($this->_view_table))
            exit("PAGE_NOT FOUND!");
        $this->manage->view_before($this->_view_table);
    }
Example #2
0
 function ps_action(){
     $this->view->image_dir = image_admin::listdir_action();
     echo $this->view->fetch();
     exit;
 }