| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282 |
- <?php
- /**
- * @author darkredz
- */
- class AdminController extends DooController {
-
- private $adminlogic;
-
- function __construct() {
- include SITE_PATH . 'protected/config/admin_menu.conf.php';
-
- $this->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'] = '<a href="/admin/article_manage" target="main">文章管理</a> » 添加培训班';
- $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'] = '<a href="/admin/training_manage" target="main">文章管理</a> » 编辑培训班';
- $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'] = '<a href="/admin/article_manage" target="main">文章管理</a> » 添加文章';
- $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'] = '<a href="/admin/article_manage" target="main">文章管理</a> » 编辑文章';
-
- $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'] = '<a href="/admin/product_manage" target="main">产品管理</a> » 添加产品';
-
- $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'] = '<a href="/admin/product_manage" target="main">产品管理</a> » 编辑产品';
-
- $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'] = '<a href="/admin/column_manage" target="main">栏目管理</a> » 添加栏目';
-
- $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'] = '<a href="/admin/column_manage" target="main">栏目管理</a> » 编辑栏目';
-
- $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'] = '<a href="/admin/animation_manage" target="main">动画管理</a> » 添加动画';
-
- $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'] = '<a href="/admin/animation_manage" target="main">动画管理</a> » 编辑动画';
-
- $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'] = '<a href="/admin/down_manage" target="main">下载管理</a> » 添加下载';
-
- $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'] = '<a href="/admin/down_manage" target="main">下载管理</a> » 下载文章';
-
- $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;
- }
- }
- }
- ?>
|