���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() 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/ |
<?php class country{ function country (){ global $CORE, $TBS; $TBS->LoadTemplate(ADMIN_PATH."skin/country.html"); switch($CORE->input['code']){ default : $this->goList(); break; case 'post': $this->goPost(); break; case 'del': $this->goDel(); break; } } function goList(){ global $CORE, $DB, $TBS, $func, $print; $TBS->MergeField('section','list'); if($CORE->input['task']=='reorder'){ // Do reorder ---------------- $input_arr = $CORE->input; $query = $DB->query("SELECT id,pos FROM NNCCMS_country"); while($row = $DB->fetch_row($query)) { foreach($input_arr as $k => $v){ $k = intval ($k); $v = intval ($v); if($k==$row['id']) $DB->query("UPDATE NNCCMS_country SET `pos`='$v' WHERE `id`='$k'"); } } return $print->redirect ('Đã lưu thứ tự',$CORE->admin_url.'&act=country'); } if($CORE->input['task']=='activate'){ // Do activate ---------------- $selected = explode("|",$CORE->input['sids']); foreach ($selected as $v) $DB->query("UPDATE NNCCMS_country SET `status`='1' WHERE `id`='$v'"); return $print->redirect ('Đã kích hoạt',$CORE->admin_url.'&act=country'); } if($CORE->input['task']=='deactivate'){ // Do activate ---------------- $selected = explode("|",$CORE->input['sids']); foreach ($selected as $v) $DB->query("UPDATE NNCCMS_country SET `status`='0' WHERE `id`='$v'"); return $print->redirect ('Đã bỏ kích hoạt',$CORE->admin_url.'&act=country'); } if($CORE->input['task']=='massdel'){ // Do activate ---------------- $selected = explode("|",$CORE->input['sids']); foreach ($selected as $v) { $q = $DB->query("SELECT id FROM NNCCMS_country WHERE `id`='$v'"); $r = $DB->fetch_row($q); $DB->query("DELETE FROM NNCCMS_country WHERE `id`='$v'"); } return $print->redirect ('Đã xóa',$CORE->admin_url.'&act=country'); } // Search - Category // Filtering Begin -------------------------------------------------------- $where = "WHERE title<>''"; if($CORE->input['fstatus'] && $CORE->input['fstatus']<2) { $where .= " AND status=".$CORE->input['fstatus']; } if($CORE->input['fkeyword']) { $where .= " AND title LIKE '%".$CORE->input['fkeyword']."%'"; } // Filtering End -------------------------------------------------------- // Sorting Begin ----------------------------------------------------- if($CORE->input['sortby']) $_SESSION['prod_dirby'] = ($_SESSION['prod_dirby']==1) ? 0 : 1; $dbsort = ($CORE->input['sortby']) ? $CORE->input['sortby'] : $_SESSION['prod_sortby']; switch ($dbsort){ default : $sortby = 'ORDER BY pos DESC, time DESC'; break; case 'cat' : $sortby = ($_SESSION['prod_dirby']==1) ? 'ORDER BY cid DESC' : 'ORDER BY cid'; break; case 'name' : $sortby = ($_SESSION['prod_dirby']==1) ? 'ORDER BY title DESC' : 'ORDER BY title'; break; case 'time' : $sortby = ($_SESSION['prod_dirby']==1) ? 'ORDER BY time DESC' : 'ORDER BY time'; break; case 'pos' : $sortby = ($_SESSION['prod_dirby']==1) ? 'ORDER BY pos DESC' : 'ORDER BY pos'; break; case 'status' : $sortby = ($_SESSION['prod_dirby']==1) ? 'ORDER BY status DESC' : 'ORDER BY status'; break; } $_SESSION['prod_sortby'] = $dbsort; // Sorting End -------------------------------------------------------- $pageNum = ($_GET['pageNum']>0) ? intval($_GET['pageNum']) : 1; $pageSize = 20; $from = (($pageNum * $pageSize) - $pageSize); //$t = $DB->query("SELECT id FROM NNCCMS_country"); $t = $DB->query("SELECT * FROM NNCCMS_country a ".$where); $total = mysql_num_rows($t); $totalPage = ceil($total / $pageSize); // Pagination DB $query = $DB->query("SELECT * FROM NNCCMS_country ".$where." ".$sortby." LIMIT $from, $pageSize"); $c = 0; while($row = $DB->fetch_row($query)) { $c++; $row['no'] = $c; $row['status'] = $row['status'] == 1 ?'Kích hoạt':'Chưa kích hoạt'; $row['time'] = date('d/m/Y',$row['time']); $arr[] = $row; } if(is_null($arr)) $arr[] = array(); $TBS->MergeBlock('list',$arr); $nav = $print->Pagination($totalPage,$pageNum,$CORE->admin_url.'&act=country'); $TBS->MergeField('nav',$nav); $TBS->Show(TBS_OUTPUT+TBS_NOTHING); } function goPost(){ global $CORE, $DB, $func, $TBS, $print; $TBS->MergeField('section','post'); if($_SESSION['error']) unset($CORE->input['bsubmit']); // Show post ----------------------------------------------------------------------- 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_country WHERE id='".$id."'"); $data = $DB->fetch_row($query); } } //$fcat = $func->drop_down_menu('fcat',$CORE->input['fcat'],'NNCCMS_countrycat','cid','cname','','Chọn nhóm'); $data['des'] = $func->editor_admin('des',$data['des'],10); $data['status'] = $func->yes_no($data['status'],'status'); $error[] = $prevError; $post[] = $data; $TBS->MergeBlock('error',$error); $TBS->MergeBlock('post',$post); // Show page -------------- $TBS->Show(TBS_OUTPUT+TBS_NOTHING); // Do post ------------------------------------------- }else{ $id = $state['id'] = intval($CORE->input['id']); $title = $state['title'] = $CORE->input['title']; $des = $state['des'] = $CORE->input['des']; //$price = $state['price'] = intval($CORE->input['price']); $noibat = $state['noibat'] = intval($CORE->input['noibat']); $pos = $state['pos'] = intval($CORE->input['pos']); $status = $state['status'] = intval($CORE->input['status']); $time = time(); // -------------- check ------------------------- if($title=='') $error['title'] = 1; // Create image ------------------------------------------------------------------------ // If detects any errors then return to the postform with errors if($error!=''){ $_SESSION['error'] = $error; $_SESSION['state'] = $state; return $this->goPost(); } //$body = str_replace('thietkeweb_vi/upload',$CORE->homeurl.'upload',$body); //$ebody = str_replace('thietkeweb_vi/upload',$CORE->homeurl.'upload',$ebody); // Do Add ------------------ if($id==0){ $DB->query("INSERT INTO `NNCCMS_country`(`title`,`des`,`pos`,`status`,`security`,`time`) VALUES( '".$title."','".$des."','".$pos."','".$status."','','".time()."');"); // Do Edit ----------------- }else{ $DB->query("UPDATE `NNCCMS_country` SET `title` = '$title',`des` = '$des',`pos` = '$pos',`status` = '$status',`time` = '$time',`security` = '$security' WHERE `id`='$id'"); } return $print->redirect("Đã cập nhật","index.php?act=country"); } } function goDel(){ global $CORE, $DB, $print; if (!$CORE->user['g_supmod'] && !$CORE->user['g_access_cp']){ return; } $id = intval($CORE->input['id']); $DB->query("DELETE FROM NNCCMS_country WHERE id='".$id."'"); $print->redirect("Đã xóa","index.php?act=country&cat=".$result['cid']); } } $run = new country(); ?>