function add_action() { if($this->table == 'category'){ chkpw('category_add'); } if($this->table == 'archive'){ chkpw('archive_add'); } if($this->table == 'type'){ chkpw('type_add'); front::$post['typecontent'] = htmlspecialchars_decode(front::$post['typecontent']); } if($this->table == 'special'){ chkpw('special_add'); front::$post['description'] = htmlspecialchars_decode(front::$post['description']); } if($this->table == 'user'){ chkpw('user_add'); } if($this->table == 'usergroup'){ chkpw('usergroup_add'); } if($this->table == 'ballot'){ chkpw('func_ballot_add'); } if($this->table == 'announcement'){ chkpw('func_announc_add'); front::$post['content'] = htmlspecialchars_decode(front::$post['content']); } if($this->table == 'templatetag' && front::get('tagfrom') == 'define'){ chkpw('templatetag_add_define'); } if($this->table == 'templatetag' && front::get('tagfrom') == 'category'){ chkpw('templatetag_add_category'); } if($this->table == 'templatetag' && front::get('tagfrom') == 'content'){ chkpw('templatetag_add_content'); } if($this->table == 'linkword'){ chkpw('seo_linkword_add'); } if($this->table == 'friendlink'){ chkpw('seo_friendlink_add'); } //用户异步提取图库图片 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->add_before($this); $this->manage->save_before(); front::$post['catname']=str_replace(' ',' ',front::$post['catname']); front::$post['htmldir']=str_replace(' ','_',front::$post['htmldir']); if(front::$post['introduce'] == ''){ front::$post['introduce'] = tool::cn_substr(preg_replace('/&(.*?);/is','', strip_tags(front::$post['content'])),200); } if($this->table == 'user'){ //var_dump($_SESSION); if(!Phpox_token::is_token('user_add', front::$post['token'])){ exit('非法参数'); } } if ($this->table == 'templatetag') { if(front::$post['tagfrom']!='define' && !preg_match('/^tag_(.*?)+\.html$/is', front::$post['tagtemplate'])){ exit('参数非法'); } } if($this->table == 'category'){ if (front::$post['addtype'] == 'single') { if (!front::$post['htmldir']) { front::$post['htmldir'] = pinyin::get(front::$post['catname']); } $insert=$this->_table->rec_insert(front::$post); if ($insert <1) { front::flash("{$this->tname}添加失败!"); }else{ $_insertid=$this->_table->insert_id(); $this->manage->save_after($_insertid); } } else { $catearr = explode("\n", front::$post['batch_add']); foreach ($catearr as $cates) { $catetmp = explode("|", $cates); if ($catetmp[0] != '') { front::$post['catname'] = $catetmp[0]; front::$post['htmldir'] = $catetmp[1]; if ($catetmp[1] == '') { front::$post['htmldir'] = pinyin::get($catetmp[0]); } $insert = $this->_table->rec_insert(front::$post); if ($insert <1) { front::flash("{$this->tname}添加失败!"); }else{ $_insertid=$this->_table->insert_id(); $this->manage->save_after($_insertid); } } } } front::refresh(url::modify('act/list',true)); }else{ $insert = $this->_table->rec_insert(front::$post); $_insertid=$this->_table->insert_id(); $this->manage->save_after($_insertid); if ($insert <1) { front::flash("{$this->tname}添加失败!"); }else { event::log("添加".$this->tname,'成功'); $info=''; if ($this->table == 'archive') { $url=url('archive/show/aid/'.$_insertid,false); if (front::get('site') == 'default'||front::get('site') == '') { $info='<a href="'.$url.'" target="_blank">查看</a>'; } } front::flash("{$this->tname}添加成功!$info"); if (front::get('type') == 'dialog') { if ($this->table == 'option') { front::flash(); exit('添加成功!'); } } if ($this->table == 'templatetag') { front::refresh(url::modify('act/list/tagfrom/content',true)); } else { front::refresh(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_table=array(); $this->_view_table['data']=array(); $this->view->image_dir = image_admin::listdir_action(); $this->view->token = Phpox_token::grante_token('user_add'); //$this->view->tag_opton = explode("\n",$tag_option_arr['hottag']); }
function cut($string,$length=20) { return tool::cn_substr(strip_tags($string),$length,config::get('database','encoding')); }
echo cut($d['id']); ?> &="></script></span></td></tr> </table> </td> <td><?php if ($d['tagcontent'] == 'null') { $id = $d['id']; $path = ROOT . '/config/tag/' . get('tagfrom') . '_' . $id . '.php'; $tag_config = array(); $tag_config_content = @file_get_contents($path); $tag_config = unserialize($tag_config_content); echo $tag_config['tagtemplate']; } else { echo tool::cn_substr(htmlspecialchars($d['tagcontent']), 20); } ?> </td> <td align="center" width="100"> <span class="hotspot" onmouseover="tooltip.show('预览标签效果!');" onmouseout="tooltip.hide();"> <a href='<?php echo url("templatetag/test/id/{$d[$primary_key]}", false); ?> ' target="_blank" class="a_view"></a> </span> <?php if ($_GET['tagfrom'] != 'function') {