博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
小猪cms ClassifyAction.class.php
阅读量:4568 次
发布时间:2019-06-08

本文共 10389 字,大约阅读时间需要 34 分钟。

fid=intval($_GET['fid']); $this->assign('fid',$this->fid); if ($this->fid){ $thisClassify=M('Classify')->find($this->fid); $this->assign('thisClassify',$thisClassify); } } public function index(){ $db=D('Classify'); $zid=$db->where(array('id'=>$this->_GET('fid'),'token'=>$this->token))->getField('fid'); $where['token']=session('token'); $where['fid']=intval($_GET['fid']); $count=$db->where($where)->count(); $page=new Page($count,25); $info=$db->where($where)->order('sorts desc')->limit($page->firstRow.','.$page->listRows)->select(); $this->assign('page',$page->show()); $this->assign('info',$info); $this->assign('zid',$zid); $this->display(); } // public function add(){ include('./PigCms/Lib/ORG/index.Tpl.php'); include('./PigCms/Lib/ORG/cont.Tpl.php'); $this->assign('tpl',$tpl); $this->assign('contTpl',$contTpl); $group_list = explode(',',C('APP_GROUP_LIST')); if(in_array('Web',$group_list) !== false){ $this->assign('has_website',true); } $this->display(); } // public function edit(){ $id=$this->_get('id','intval'); $info=M('Classify')->find($id); include('./PigCms/Lib/ORG/index.Tpl.php'); include('./PigCms/Lib/ORG/cont.Tpl.php'); foreach($tpl as $k=>$v){ if($v['tpltypeid'] == $info['tpid']){ $info['tplview'] = $v['tplview']; } } foreach($contTpl as $key=>$val){ if($val['tpltypeid'] == $info['conttpid']){ $info['tplview2'] = $val['tplview']; } } $this->assign('contTpl',$contTpl); $this->assign('tpl',$tpl); $this->assign('info',$info); $this->display(); } public function del(){ $where['id']=$this->_get('id','intval'); $where['uid']=session('uid'); if(D(MODULE_NAME)->where($where)->delete()){ $fidwhere['fid']=intval($where['id']); D(MODULE_NAME)->where($fidwhere)->delete(); $this->success('操作成功',U(MODULE_NAME.'/index',array('fid'=>$_GET['fid']))); }else{ $this->error('操作失败',U(MODULE_NAME.'/index',array('fid'=>$_GET['fid']))); } } // public function insert(){ $name='Classify'; $db=D($name); $fid = $this->_post('fid','intval'); // 处理url 2015-05-22 if ($this->dwzQuery(array('tinyurl' => $_POST['url']))) { $this->error('禁止使用短网址'); } $_POST['url'] = $this->replaceUrl($_POST['url'], array('query'=>array('wecha_id'=>'{wechat_id}'))); $_POST['info'] = str_replace('"','',$_POST['info']); if($fid != ''){ $f = $db->field('path')->where("id = $fid")->find(); $_POST['path'] = $f['path'].'-'.$fid; } if($_POST['pc_show']){ $database_pc_news_category = D('Pc_news_category'); $data_pc_news_category['cat_name'] = $_POST['name']; $data_pc_news_category['token'] = session('token'); $_POST['pc_cat_id'] = $database_pc_news_category->data($data_pc_news_category)->add(); } if($db->create()===false){ $this->error($db->getError()); }else{ $id=$db->add(); if($id){ $this->success('操作成功',U(MODULE_NAME.'/index',array('fid'=>$_POST['fid']))); }else{ $this->error('操作失败',U(MODULE_NAME.'/index',array('fid'=>$_POST['fid']))); } } } public function upsave(){ // 处理url 2015-05-22 if ($this->dwzQuery(array('tinyurl' => $_POST['url']))) { $this->error('禁止使用短网址'); } $_POST['url'] = $this->replaceUrl($_POST['url'], array('query'=>array('wecha_id'=>'{wechat_id}'))); $_POST['info'] = str_replace('"','',$_POST['info']); $fid = $this->_post('fid','intval'); if($_POST['pc_show']){ $_POST['pc_cat_id'] = 0; } if($fid == ''){ $this->all_save(); }else{ $this->all_save('','/index?fid='.$fid); } } public function chooseTpl(){ include('./PigCms/Lib/ORG/index.Tpl.php'); include('./PigCms/Lib/ORG/cont.Tpl.php'); $tpl = array_reverse($tpl); $filter = $this->_get('filter'); if(isset($filter) && $filter !== 'all' && $filter != 'mix'){ foreach ($tpl as $kk => $vv){ if(strpos($vv['attr'],$filter)){ $filterTpl[$kk] = $vv; } } $tpl = $filterTpl; } $contTpl = array_reverse($contTpl); $tpid = $this->_get('tpid','intval'); foreach($tpl as $k=>$v){ $sort[$k] = $v['sort']; $tpltypeid[$k] = $v['tpltypeid']; if($v['tpltypeid'] == $tpid){ $info['tplview'] = $v['tplview']; $info['tpl_user'] = $v['user']; } } //array_multisort($sort, SORT_DESC , $tpltypeid , SORT_DESC ,$tpl); foreach($contTpl as $key=>$val){ if($val['tpltypeid'] == $tpid){ $info['tplview2'] = $val['tplview']; $info['cont_user'] = $val['user']; } } $this->assign('info',$info); $this->assign('contTpl',$contTpl); $this->assign('tpl',$tpl); $this->display(); } public function changeClassifyTpl(){ $tid = $this->_post('tid','intval'); $cid = $this->_post('cid','intval'); M('Classify')->where(array('token'=>$this->token,'id'=>$cid))->setField('tpid',$tid); echo 200; } public function changeClassifyContTpl(){ $tid = $this->_post('tid','intval'); $cid = $this->_post('cid','intval'); M('Classify')->where(array('token'=>$this->token,'id'=>$cid))->setField('conttpid',$tid); echo 200; } public function flash(){ $tip=$this->_get('tip','intval'); $id=$this->_get('id','intval'); $fid=$this->_get('fid','intval'); if(empty($fid)){ $fid=0; } $token=$this->token; $fl=M('Classify')->where(array('token'=>$this->token,'id'=>$id,'fid'=>$fid))->find(); $db=D('Flash'); $where['uid']=session('uid'); $where['token']=session('token'); $where['tip']=$tip; $where['did']=$id; $where['fid']=$fid; $count=$db->where($where)->count(); $page=new Page($count,25); $info=$db->where($where)->limit($page->firstRow.','.$page->listRows)->order('id DESC')->select(); $this->assign('page',$page->show()); $this->assign('fl',$fl); $this->assign('info',$info); $this->assign('id',$id); $this->assign('fid',$fid); $this->assign('tip',$tip); $this->display(); } public function addflash(){ $tip=$this->_get('tip','intval'); $id=$this->_get('id','intval'); $fid=$this->_get('fid','intval'); $token=$this->token; $fl=M('Classify')->where(array('token'=>$this->token,'id'=>$id))->getField('name'); $this->assign('fl',$fl); $this->assign('tip',$tip); $this->assign('id',$id); $this->assign('fid',$fid); $this->display(); } public function inserts(){ $fid = $this->_get('fid','intval'); if($fid == null){ $fid = 0; } $flash=D('Flash'); $arr=array(); $arr['token']=$this->token; $arr['img']=$this->_post('img'); if ($this->_post('url')){ $arr['url']=$this->_post('url'); } $arr['info']=$this->_post('info'); $arr['tip']=$this->_get('tip','intval'); $arr['did']=$this->_get('id','intval'); $arr['fid']=$fid; if(empty($_POST['img'])){ $this->error('请先添加图片'); } if($flash->add($arr)){ $this->success('操作成功',U(MODULE_NAME.'/flash',array('tip'=>$this->_GET('tip','intval'),'id'=>$this->_get('id'),'fid'=>$this->_get('fid')))); }else{ $this->error('操作失败'); } } public function editflash(){ $tip=$this->_get('tip','intval'); $where['id']=$this->_get('id','intval'); $where['uid']=session('uid'); $res=D('Flash')->where($where)->find(); $this->assign('info',$res); $this->assign('tip',$tip); $this->assign('id',$this->_get('id','intval')); $this->display(); } public function delflash(){ $where['id']=$this->_get('id','intval'); $where['token']=$this->token; if(D('Flash')->where($where)->delete()){ $this->success('操作成功'); }else{ $this->error('操作失败'); } } public function updeit(){ $flash=D('Flash'); $id=$this->_get('id','intval'); $tip=$this->_get('tip','intval'); $list=$flash->where(array('id'=>$id))->find(); $arr=array(); $arr['img']=$this->_post('img'); $arr['url']=$this->_post('url'); $arr['info']=$this->_post('info'); $data=$flash->where(array('id'=>$id))->save($arr); if($data){ $this->success('操作成功',U(MODULE_NAME.'/flash',array('tip'=>$tip,'id'=>$list['did'],'fid'=>$list['fid']))); }else{ $this->error('操作失败'); } } public function essay(){ $token=$this->token; $classid=$this->_get('id','intval'); $name=M('Classify')->where(array('id'=>$classid,'token'=>$token))->getField('name'); $essay=M('Img')->where(array('classid'=>$classid,'token'=>$token))->order('usort DESC')->select(); $this->assign('info',$essay); $this->assign('name',$name); $this->display(); } public function editUsort(){ $token = $this->_post('token',"htmlspecialchars"); unset($_POST['__hash__']); foreach($_POST as $k=>$v){ $k = str_replace('usort','',$k); $data[$k]=$v; M('Img')->where(array('token'=>$token,'id'=>$k))->setField('usort',$v); } $this->success('保存成功'); }}?>

转载于:https://www.cnblogs.com/libkey/p/5909076.html

你可能感兴趣的文章
centos7 install idea and x-windows
查看>>
Spring Boot + Spring Cloud 构建微服务系统(九):配置中心(Spring Cloud Config)
查看>>
【转】LINQ to SQL语句(1)之Where
查看>>
《基于MVC的javascript web富应用开发》中的一些函数
查看>>
python爬虫抓取哈尔滨天气信息(静态爬虫)
查看>>
0014---简单的计算
查看>>
假期周进度报告6
查看>>
自己写的文字轮播(简陋版)
查看>>
TWaver在FTTX设备网管系统中的应用
查看>>
python入门笔记1
查看>>
【转】Ext JS xtype
查看>>
Word打不开老提示进入“安全模式”怎么办
查看>>
Linux 定时运行脚本、命令
查看>>
1python基础语法_11模块
查看>>
时间管理
查看>>
document.getElementsByTagName函数
查看>>
启停无线网卡bat脚本
查看>>
需求分析的故事——如何练就需求分析的火眼金晴?
查看>>
UIGestureRecognizer手势
查看>>
模拟http或https请求,实现ssl下的bugzilla登录、新增BUG,保持会话以及处理token
查看>>