menu = $menu ; Load::logic ( 'Admin' ); $this->adminlogic = new AdminLogic (); } function index() { $data ['li'] = $this->menu ['navon']; $data['now']='use'; $this->render ( "/admin/index", $data ); } function login() { $data = array (); $this->render ( "admin/login", $data ); } function do_login() { } /** * 上传问题图片--移动到user */ public function upimg() { require_once (SITE_PATH . '/protected/plugin/Uploader.class.php'); //上传配置 $config = array ("savePath" => SITE_PATH . "/global/upload/img/", "maxSize" => 2000, //单位KB "allowFiles" => array (".gif", ".png", ".jpg", ".jpeg", ".bmp" ) ); //上传图片框中的描述表单名称, $title = htmlspecialchars ( $_POST ['pictitle'], ENT_QUOTES ); //生成上传实例对象并完成上传 $up = new Uploader ( "upfile", $config ); /** * 得到上传文件所对应的各个参数,数组结构 * array( * "originalName" => "", //原始文件名 * "name" => "", //新文件名 * "url" => "", //返回的地址 * "size" => "", //文件大小 * "type" => "" , //文件类型 * "state" => "" //上传状态,上传成功时必须返回"SUCCESS" * ) */ $info = $up->getFileInfo (); echo "{'url' :'" . $info ["name"] . "', 'title':'" . $title . "','original' :'" . $info ["originalName"] . "', 'state' :'" . $info ['state'] . "' }"; /** * 向浏览器返回数据json数据 * { * 'url' :'a.jpg', //保存后的文件路径 * 'title' :'hello', //文件描述,对图片来说在前端会添加到title属性上 * 'original' :'b.jpg', //原始文件名 * 'state' :'SUCCESS' //上传状态,成功时返回SUCCESS,其他任何值将原样返回至图片上传框中 * } */ } function training_manag() { $n = ""; $on_page = is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1; // if ($on_page <= 0) $on_page = 1; $title = $this->get_args ( 'title' ); $page_size = 18; // //检索条件 if (! empty ( $title )) $n = " and (title like '%" . $title . "%' or enroll_title like '%". $title . "%')"; $condition=$n; $action = "/admin/training_manage/"; //获取分页相关数据 $page = $this->adminlogic->get_page ( "sc_article", $condition.' and a_type ="2"', $on_page, $page_size, $action, "", "admin" ); $limit = " order by time desc limit " . $page ['lower'] . " , " . $page_size . " "; Doo::loadModel('Article'); $article=new Article(); $page ['article_list'] = $article->getArticleList ( array (), $condition.' and a_type ="2"', $limit ); $data ['map'] = '文章管理'; $data ['article'] = $page; $data['title']=$title; $this->render ( '/admin/training_manage', $data ); } function training_manage_add() { if(isset($_POST['is_add'])){ $cid=$this->get_args('cid'); $title=$this->get_args('title'); // if($cid==0){ // echo "column is no select"; // return false; // } if($title==""){ //echo "title is empty"; //return false; } Doo::loadModel ( 'Article' ); $article = new Article (); $article->cid=3; $article->title=$title; $article->time=time(); $article->content=stripcslashes ($this->get_args('content_text')); $article->enroll=stripcslashes ($this->get_args('enroll')); $article->enroll_title=$this->get_args('enroll_title'); $article->enroll_obj=stripcslashes ($this->get_args('enroll_obj')); $article->enroll_content=stripcslashes ($this->get_args('enroll_content')); $article->enroll_fun=stripcslashes ($this->get_args('enroll_fun')); $article->enroll_adrr=stripcslashes ($this->get_args('enroll_adrr')); $article->enroll_pay=stripcslashes ($this->get_args('enroll_pay')); $article->enroll_name=stripcslashes ($this->get_args('enroll_name')); $article->trainingType=stripcslashes ($this->get_args('trainingType')); $article->area= $this->get_args('area'); $article->synopsis=$this->get_args('synopsis'); //缩略图 $upload_file=$_FILES['thum']['tmp_name']; $upload_file_name=$_FILES['thum']['name']; $ext=_GetFileEXT($upload_file_name); $upload_file_name=time().".".$ext; if($upload_file){ $store_dir="/upload_files/thum/"; if (move_uploaded_file($upload_file,".".$store_dir.$upload_file_name)) { $article->thum="/sdown/".base64_encode(WEB_SITE.$store_dir.$upload_file_name); } } //缩略图 $upload_file=$_FILES['enroll_downdoc']['tmp_name']; $upload_file_name=$_FILES['enroll_downdoc']['name']; $ext=_GetFileEXT($upload_file_name); $upload_file_name=time().".".$ext; if($upload_file){ $store_dir="/upload_files/doc/"; if (move_uploaded_file($upload_file,".".$store_dir.$upload_file_name)) { $article->enroll_downdoc="/sdown/".base64_encode(WEB_SITE.$store_dir.$upload_file_name); } } $article->enroll_mark=stripcslashes ($this->get_args('enroll_mark')); $article->enroll_time=$this->get_args("enroll_start").":".$this->get_args("enroll_end"); $article->a_type=$this->get_args('a_type'); if(!empty($title)) $article->update_time=time(); $article->insert(); return '/admin/training_manage'; }else{ Doo::loadModel('Column'); $column=new Column(); $data['column']=$column->getColumnListByType(1); $data ['map'] = '文章管理 » 添加培训班'; $this->render ( '/admin/training_manage_add',$data); } } function training_manage_edit() { Doo::loadModel ( 'Article' ); $article = new Article (); if(isset($_POST['is_edit'])){ $cid=$this->get_args('cid'); $title=$this->get_args('title'); // if($cid==0){ // echo "column is no select"; // return false; // } $article->aid=$this->get_args('aid'); //$article->cid=$cid; $article->title=$title; $article->content=stripcslashes ($this->get_args('content_text')); $article->enroll=stripcslashes ($this->get_args('enroll')); $article->enroll_title=$this->get_args('enroll_title'); $article->enroll_obj=stripcslashes ($this->get_args('enroll_obj')); $article->enroll_content=stripcslashes ($this->get_args('enroll_content')); $article->enroll_fun=stripcslashes ($this->get_args('enroll_fun')); $article->enroll_adrr=stripcslashes ($this->get_args('enroll_adrr')); $article->enroll_pay=stripcslashes ($this->get_args('enroll_pay')); $article->enroll_name=stripcslashes ($this->get_args('enroll_name')); $article->trainingType=stripcslashes ($this->get_args('trainingType')); $article->area= $this->get_args('area'); $article->synopsis=$this->get_args('synopsis'); //缩略图 $upload_file=$_FILES['thum']['tmp_name']; $upload_file_name=$_FILES['thum']['name']; $ext=_GetFileEXT($upload_file_name); $upload_file_name=time().".".$ext; if($upload_file){ $store_dir="/upload_files/thum/"; if (move_uploaded_file($upload_file,".".$store_dir.$upload_file_name)) { $article->thum="/sdown/".base64_encode(WEB_SITE.$store_dir.$upload_file_name); } } //缩略图 $upload_file=$_FILES['enroll_downdoc']['tmp_name']; $upload_file_name=$_FILES['enroll_downdoc']['name']; $ext=_GetFileEXT($upload_file_name); $upload_file_name=time().".".$ext; if($upload_file){ $store_dir="/upload_files/doc/"; if (move_uploaded_file($upload_file,".".$store_dir.$upload_file_name)) { $article->enroll_downdoc="/sdown/".base64_encode(WEB_SITE.$store_dir.$upload_file_name); } else{ echo "upload file error,";die; } } $article->enroll_mark=stripcslashes ($this->get_args('enroll_mark')); $article->enroll_time=$this->get_args("enroll_start").":".$this->get_args("enroll_end"); $article->a_type=$this->get_args('a_type'); $info=$article->getArticleById($this->get_args('aid')); if(!empty($title)&&empty($info[0]['update_time'])) $article->update_time=time(); $article->update(); return '/admin/training_manage'; }else{ $aid=$this->check_params('aid'); Doo::loadModel('Column'); $column=new Column(); $data['article']=$article->getArticleById($aid); $time=explode(":", $data['article'][0]['enroll_time']); $data['time']=$time; $data['column']=$column->getColumnListByType(1); $data ['map'] = '文章管理 » 编辑培训班'; $this->render ( '/admin/training_manage_edit',$data); } } function training_manage_delete() { $id = $this->get_args ( 'id' ); Doo::loadModel ( 'Article' ); $article = new Article (); $article->deleteArticleByIdList($id); return '/admin/training_manage'; } function article_manage() { $n = ""; $on_page = is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1; // if ($on_page <= 0) $on_page = 1; $title = $this->get_args ( 'title' ); $page_size = 18; // //检索条件 if (! empty ( $title )) $n = " and (title like '%" . $title . "%' or enroll_title like '%". $title . "%')"; $condition=$n; $action = "/admin/article_manage/"; //获取分页相关数据 $page = $this->adminlogic->get_page ( "sc_article", $condition.' and a_type ="1"', $on_page, $page_size, $action, "", "admin" ); $limit = " order by time desc limit " . $page ['lower'] . " , " . $page_size . " "; Doo::loadModel('Article'); $article=new Article(); $page ['article_list'] = $article->getArticleList ( array (), $condition.' and a_type ="1"', $limit ); $data ['map'] = '文章管理'; $data ['article'] = $page; $data['title']=$title; $this->render ( '/admin/article_manage', $data ); } function article_manage_add() { if(isset($_POST['is_add'])){ $cid=$this->get_args('cid'); $title=$this->get_args('title'); if($cid==0){ echo "column is no select"; return false; } if($title==""){ //echo "title is empty"; //return false; } Doo::loadModel ( 'Article' ); $article = new Article (); $article->cid=$cid; $article->title=$title; $article->time=time(); $article->content=stripcslashes ($this->get_args('content_text')); $article->enroll=stripcslashes ($this->get_args('enroll')); $article->enroll_title=$this->get_args('enroll_title'); $article->enroll_obj=stripcslashes ($this->get_args('enroll_obj')); $article->enroll_content=stripcslashes ($this->get_args('enroll_content')); $article->enroll_fun=stripcslashes ($this->get_args('enroll_fun')); $article->enroll_adrr=stripcslashes ($this->get_args('enroll_adrr')); $article->enroll_pay=stripcslashes ($this->get_args('enroll_pay')); $article->enroll_name=stripcslashes ($this->get_args('enroll_name')); $article->synopsis=$this->get_args('synopsis'); //缩略图 $upload_file=$_FILES['thum']['tmp_name']; $upload_file_name=$_FILES['thum']['name']; $ext=_GetFileEXT($upload_file_name); $upload_file_name=time().".".$ext; if($upload_file){ $store_dir="/upload_files/thum/"; if (move_uploaded_file($upload_file,".".$store_dir.$upload_file_name)) { $article->thum="/sdown/".base64_encode(WEB_SITE.$store_dir.$upload_file_name); } } //缩略图 $upload_file=$_FILES['enroll_downdoc']['tmp_name']; $upload_file_name=$_FILES['enroll_downdoc']['name']; $ext=_GetFileEXT($upload_file_name); $upload_file_name=time().".".$ext; if($upload_file){ $store_dir="/upload_files/doc/"; if (move_uploaded_file($upload_file,".".$store_dir.$upload_file_name)) { $article->enroll_downdoc="/sdown/".base64_encode(WEB_SITE.$store_dir.$upload_file_name); } } $article->enroll_mark=stripcslashes ($this->get_args('enroll_mark')); $article->enroll_time=$this->get_args("enroll_start").":".$this->get_args("enroll_end"); $article->a_type=$this->get_args('a_type'); if(!empty($title)) $article->update_time=time(); $article->insert(); return '/admin/article_manage'; }else{ Doo::loadModel('Column'); $column=new Column(); $data['column']=$column->getColumnListByType(1); $data ['map'] = '文章管理 » 添加文章'; $this->render ( '/admin/article_manage_add',$data); } } function article_manage_edit() { Doo::loadModel ( 'Article' ); $article = new Article (); if(isset($_POST['is_edit'])){ $cid=$this->get_args('cid'); $title=$this->get_args('title'); if($cid==0){ echo "column is no select"; return false; } if($title==""){ //echo "title is empty"; //return false; } $article->aid=$this->get_args('aid'); $article->cid=$cid; $article->title=$title; $article->content=stripcslashes ($this->get_args('content_text')); $article->enroll=stripcslashes ($this->get_args('enroll')); $article->enroll_title=$this->get_args('enroll_title'); $article->enroll_obj=stripcslashes ($this->get_args('enroll_obj')); $article->enroll_content=stripcslashes ($this->get_args('enroll_content')); $article->enroll_fun=stripcslashes ($this->get_args('enroll_fun')); $article->enroll_adrr=stripcslashes ($this->get_args('enroll_adrr')); $article->enroll_pay=stripcslashes ($this->get_args('enroll_pay')); $article->enroll_name=stripcslashes ($this->get_args('enroll_name')); $article->synopsis=$this->get_args('synopsis'); //缩略图 $upload_file=$_FILES['thum']['tmp_name']; $upload_file_name=$_FILES['thum']['name']; $ext=_GetFileEXT($upload_file_name); $upload_file_name=time().".".$ext; if($upload_file){ $store_dir="/upload_files/thum/"; if (move_uploaded_file($upload_file,".".$store_dir.$upload_file_name)) { $article->thum="/sdown/".base64_encode(WEB_SITE.$store_dir.$upload_file_name); } //echo ".".$store_dir.$upload_file_name;die; } //缩略图 $upload_file=$_FILES['enroll_downdoc']['tmp_name']; $upload_file_name=$_FILES['enroll_downdoc']['name']; $ext=_GetFileEXT($upload_file_name); $upload_file_name=time().".".$ext; if($upload_file){ $store_dir="/upload_files/doc/"; if (move_uploaded_file($upload_file,".".$store_dir.$upload_file_name)) { $article->enroll_downdoc="/sdown/".base64_encode(WEB_SITE.$store_dir.$upload_file_name); } else{ echo "upload file error,";die; } } $article->enroll_mark=stripcslashes ($this->get_args('enroll_mark')); $article->enroll_time=$this->get_args("enroll_start").":".$this->get_args("enroll_end"); $article->a_type=$this->get_args('a_type'); $info=$article->getArticleById($this->get_args('aid')); if(!empty($title)&&empty($info[0]['update_time'])) $article->update_time=time(); $article->update(); return '/admin/article_manage'; }else{ $aid=$this->check_params('aid'); Doo::loadModel('Column'); $column=new Column(); $data['article']=$article->getArticleById($aid); $time=explode(":", $data['article'][0]['enroll_time']); $data['time']=$time; $data['column']=$column->getColumnListByType(1); $data ['map'] = '文章管理 » 编辑文章'; $this->render ( '/admin/article_manage_edit',$data); } } function trainingDeleteDoc(){ $aid=isset($this->params ['aid'])&&is_numeric($this->params['aid'])?$this->params['aid']:0; if (!empty($aid)){ Doo::loadModel ( 'Article' ); $article = new Article (); $article->aid=$aid; $article->enroll_downdoc=""; $article->update(); header ( 'Content-Type:text/html;charset=utf-8' ); echo '删除成功';die; } } function article_manage_delete() { $id = $this->get_args ( 'id' ); Doo::loadModel ( 'Article' ); $article = new Article (); $article->deleteArticleByIdList($id); return '/admin/article_manage'; } function product_manage() { $n = ""; $on_page = is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1; // if ($on_page <= 0) $on_page = 1; $title = $this->get_args ( 'title' ); $page_size = 18; // //检索条件 if (! empty ( $title )) $n = " and title like '%" . $title . "%'"; $condition=$n; $action = "/admin/product_manage/"; //获取分页相关数据 $page = $this->adminlogic->get_page ( "sc_product", $condition, $on_page, $page_size, $action, "", "admin" ); $limit = " order by time desc limit " . $page ['lower'] . " , " . $page_size . " "; Doo::loadModel('Product'); $product=new Product(); $page ['product_list'] = $product->getProductList ( array (), $condition, $limit ); $data ['map'] = '产品管理'; $data ['product'] = $page; $data['title']=$title; $this->render ( '/admin/product_manage', $data ); } function product_manage_add() { if(isset($_POST['is_add'])){ $cid=$this->get_args('cid'); $title=$this->get_args('title'); $fulltitle=$this->get_args('fulltitle'); if($cid==0){ echo "column is no select"; return false; } if($title==""){ echo "title is empty"; return false; } Doo::loadModel ( 'Product' ); $product = new Product (); $product->cid=$cid; $product->title=$title; $product->fulltitle=$fulltitle; $product->time=time(); $product->p_type=$this->get_args('p_type'); $product->content=stripcslashes ($this->get_args('content_text')); $product->edition=stripcslashes ($this->get_args('edition')); $upload_file=$_FILES['logo']['tmp_name']; $upload_file_name=$_FILES['logo']['name']; $ext=_GetFileEXT($upload_file_name); $upload_file_name=time().".".$ext; if($upload_file){ $store_dir="/upload_files/proimg/"; if (move_uploaded_file($upload_file,".".$store_dir.$upload_file_name)) { $product->logo=WEB_SITE.$store_dir.$upload_file_name; } } $product->link=$this->get_args('link'); $anid=$this->get_args('anid'); $anid=explode(",", $anid); $anid=array_unique($anid); $anid=implode(",", $anid); $product->anid=$anid; $did=$this->get_args('did'); $did=explode(",", $did); $did=array_unique($did); $did=implode(",", $did); $product->did=$did; $product->insert(); return '/admin/product_manage'; }else{ Doo::loadModel('Column'); Doo::loadModel('Animation'); Doo::loadModel('Down'); $down=new Down(); $animation = new Animation(); $column=new Column(); $data['animation']=$animation->getAnimationByBelong(2); $data['down']=$down->getDownList(array(), "", "limit 50"); $data['column']=$column->getColumnListByType(1); $data ['map'] = '产品管理 » 添加产品'; $this->render ( '/admin/product_manage_add',$data); } } function product_manage_edit() { Doo::loadModel ( 'Product' ); $product = new Product (); if(isset($_POST['is_edit'])){ $cid=$this->get_args('cid'); $title=$this->get_args('title'); $fulltitle=$this->get_args('fulltitle'); if($cid==0){ echo "column is no select"; return false; } if($title==""){ echo "title is empty"; return false; } $product->pid=$this->get_args('pid'); $product->cid=$cid; $product->title=$title; $product->fulltitle=$fulltitle; $product->p_type=$this->get_args('p_type'); $product->content=stripcslashes ($this->get_args('content')); $product->edition=stripcslashes ($this->get_args('edition')); $upload_file=$_FILES['logo']['tmp_name']; $upload_file_name=$_FILES['logo']['name']; $ext=_GetFileEXT($upload_file_name); $upload_file_name=time().".".$ext; if($upload_file){ $store_dir="/upload_files/proimg/"; if (move_uploaded_file($upload_file,".".$store_dir.$upload_file_name)) { $product->logo=WEB_SITE.$store_dir.$upload_file_name; } } $product->link=$this->get_args('link'); $anid=$this->get_args('anid'); $anid=explode(",", $anid); $anid=array_unique($anid); $anid=implode(",", $anid); $product->anid=$anid; $did=$this->get_args('did'); $did=explode(",", $did); $did=array_unique($did); $did=implode(",", $did); $product->did=$did; $product->update(); return '/admin/product_manage'; }else{ $pid=$this->check_params('pid'); Doo::loadModel('Column'); Doo::loadModel('Animation'); Doo::loadModel('Down'); $down=new Down(); $animation = new Animation(); $column=new Column(); $data['product']=$product->getProductById($pid); $data['down']=$down->getDownList(array(), "", "limit 100"); $data['column']=$column->getColumnListByType(1); $data['animation']=$animation->getAnimationByBelong(2); $data ['map'] = '产品管理 » 编辑产品'; $this->render ( '/admin/product_manage_edit',$data); } } function product_manage_delete() { $id = $this->get_args ( 'id' ); Doo::loadModel ( 'Product' ); $product = new Product (); $product->deleteProductByIdList($id); return '/admin/product_manage'; } function column_manage() { $n = ""; $on_page = is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1; // if ($on_page <= 0) $on_page = 1; $title = $this->get_args ( 'title' ); $page_size = 18; // //检索条件 if (! empty ( $title )) $n = " and title like '%" . $title . "%'"; $condition=$n; $action = "/admin/column_manage/"; //获取分页相关数据 $page = $this->adminlogic->get_page ( "sc_column", $condition, $on_page, $page_size, $action, "", "admin" ); $limit = " order by cid desc limit " . $page ['lower'] . " , " . $page_size . " "; Doo::loadModel('Column'); $column=new Column(); $page ['column_list'] = $column->getColumnList ( array (), $condition, $limit ); foreach ($page ['column_list'] as $key=>$value){ $page ['column_list'][$key]['c_type']=getColumnType($value['c_type']); } $data ['map'] = '栏目管理'; $data ['column'] = $page; $data['title']=$title; $this->render ( '/admin/column_manage', $data ); } function column_manage_add() { if(isset($_POST['is_add'])){ $title=$this->get_args('title'); if($title==""){ echo "title is empty"; return false; } Doo::loadModel ( 'Column' ); $column = new Column (); $column->c_type=$this->get_args('c_type'); $column->title=$title; $column->display=$this->get_args('display'); $column->link=$this->get_args('link'); $column->description=$this->get_args('description'); $column->insert(); return '/admin/column_manage'; }else{ $data ['map'] = '栏目管理 » 添加栏目'; $this->render ( '/admin/column_manage_add',$data); } } function column_manage_edit() { Doo::loadModel ( 'Column' ); $column = new Column (); if(isset($_POST['is_edit'])){ $cid=$this->get_args('cid'); $title=$this->get_args('title'); if($cid==0){ return false; } if($title==""){ echo "title is empty"; return false; } $column->cid=$cid; $column->title=$title; $column->display=$this->get_args('display'); $column->link=$this->get_args('link'); $column->description=$this->get_args('description'); $column->update(); return '/admin/column_manage'; }else{ $cid=$this->check_params('cid'); $data['column']=$column->getColumnById($cid); $data ['map'] = '栏目管理 » 编辑栏目'; $this->render ( '/admin/column_manage_edit',$data); } } function column_manage_delete() { $id = $this->get_args ( 'id' ); Doo::loadModel ( 'Column' ); $column = new Column (); $column->deleteColumnByIdList($id); return '/admin/column_manage'; } function animation_manage(){ $n = ""; $on_page = is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1; // if ($on_page <= 0) $on_page = 1; $title = $this->get_args ( 'title' ); $page_size = 18; // //检索条件 if (! empty ( $title )) $n = " and title like '%" . $title . "%'"; $condition=$n; $action = "/admin/animation_manage/"; //获取分页相关数据 $page = $this->adminlogic->get_page ( "sc_animation", $condition, $on_page, $page_size, $action, "", "admin" ); $limit = " order by aid desc limit " . $page ['lower'] . " , " . $page_size . " "; Doo::loadModel('Animation'); $animation=new Animation(); $page ['animation_list'] = $animation->getAnimationList ( array (), $condition, $limit ); $data ['map'] = '动画管理'; $data ['animation'] = $page; $data['title']=$title; $this->render ( '/admin/animation_manage', $data ); } function animation_manage_add(){ if(isset($_POST['is_add'])){ $title=$this->get_args('title'); if($title==""){ echo "title is empty"; return false; } Doo::loadModel ( 'Animation' ); $animation = new Animation (); $animation->title=$title; $animation->url=stripcslashes ($this->get_args('url')); //$animation->down_url="/sdown/".base64_encode(stripcslashes ($this->get_args('down_url'))); $animation->down_url=$this->get_args('down_url'); $animation->belong=$this->get_args('belong'); $animation->img_url=$this->get_args('img_url'); $animation->insert(); return '/admin/animation_manage'; }else{ $data ['map'] = '动画管理 » 添加动画'; $this->render ( '/admin/animation_manage_add',$data); } } function animation_manage_edit(){ Doo::loadModel ( 'Animation' ); $animation = new Animation (); if(isset($_POST['is_edit'])){ $title=$this->get_args('title'); if($title==""){ echo "title is empty"; return false; } $animation->aid=$this->get_args('aid'); $animation->title=$title; $animation->url=stripcslashes ($this->get_args('url')); //$animation->down_url="/sdown/".base64_encode(stripcslashes ($this->get_args('down_url'))); $animation->down_url=$this->get_args('down_url'); $animation->belong=$this->get_args('belong'); $animation->img_url=$this->get_args('img_url'); $animation->update(); return '/admin/animation_manage'; }else{ $aid=$this->check_params('aid'); $data['animation']=$animation->getAnimationById($aid); $data ['map'] = '动画管理 » 编辑动画'; $this->render ( '/admin/animation_manage_edit',$data); } } function animation_manage_delete(){ $id = $this->get_args ( 'id' ); Doo::loadModel ( 'Animation' ); $animation = new Animation (); $animation->deleteAnimationByIdList($id); return '/admin/animation_manage'; } function down_manage(){ $n = ""; $on_page = is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1; // if ($on_page <= 0) $on_page = 1; $title = $this->get_args ( 'title' ); $page_size = 18; //检索条件 if (! empty ( $title )) $n = " and title like '%" . $title . "%'"; $condition=$n; $action = "/admin/down_manage/"; //获取分页相关数据 $page = $this->adminlogic->get_page ( "sc_down", $condition, $on_page, $page_size, $action, "", "admin" ); $limit = " order by did desc limit " . $page ['lower'] . " , " . $page_size . " "; Doo::loadModel('Down'); $down=new Down(); $page ['down_list'] = $down->getDownList ( array (), $condition, $limit ); $data ['map'] = '下载管理'; $data ['down'] = $page; $data['title']=$title; $this->render ( '/admin/down_manage', $data ); } function down_manage_add(){ if(isset($_POST['is_add'])){ $title=$this->get_args('title'); $fulltitle=$this->get_args('fulltitle'); if($title==""){ echo "title is empty"; return false; } Doo::loadModel ( 'Down' ); $down = new Down (); $down->did=$this->get_args('did'); $down->title=$title; $down->fulltitle=$fulltitle; $down_url=$this->get_args('down_url'); $down_url=explode("{b}", $down_url); foreach ($down_url as $key=>$value){ //$down_url[$key]="/sdown/".base64_encode($value); $down_url[$key]=$value; } $down_url=implode("{b}", $down_url); $down->down_url=$down_url; $down->key_number=$this->get_args('key_number'); $down->size=$this->get_args('size'); $down->insert(); return '/admin/down_manage'; }else{ $data ['map'] = '下载管理 » 添加下载'; $this->render ( '/admin/down_manage_add',$data); } } function down_manage_edit(){ Doo::loadModel ( 'Down' ); $down = new Down (); if(isset($_POST['is_edit'])){ $title=$this->get_args('title'); $fulltitle=$this->get_args('fulltitle'); if($title==""){ echo "title is empty"; return false; } $down->did=$this->get_args('did'); $down->title=$title; $down->fulltitle=$fulltitle; $down_url=$this->get_args('down_url'); $down_url=explode("{b}", $down_url); foreach ($down_url as $key=>$value){ //$down_url[$key]="/sdown/".base64_encode($value); $down_url[$key]=$value; } $down_url=implode("{b}", $down_url); $down->down_url=$down_url; $down->key_number=$this->get_args('key_number'); $down->size=$this->get_args('size'); $down->update(); return '/admin/down_manage'; }else{ $did=$this->check_params('did'); $data['down']=$down->getDownById($did); $data ['map'] = '下载管理 » 下载文章'; $this->render ( '/admin/down_manage_edit',$data); } } function down_manage_delete(){ $id = $this->get_args ( 'id' ); Doo::loadModel ( 'Down' ); $down = new Down (); $down->deleteDownByIdList($id); return '/admin/down_manage'; } /** * 检测数据输入的非法字符和转义非法字符 */ function check_params($name = "") { if (isset ( $this->params [$name] )) { return addslashes ( $this->params [$name] ); } else { return false; } } /** * 获取get或者POST值 * @param string $name 属性名称 * @return fixed 值 */ function get_args($name) { if (isset ( $_GET [$name] )) { if (is_array ( $_GET [$name] )) return $_GET [$name]; else return addslashes ( $_GET [$name] ); } elseif (isset ( $_POST [$name] )) { if (is_array ( $_POST [$name] )) return $_POST [$name]; else return addslashes ( $_POST [$name] ); } else { return false; } } } ?>