//$title = lg('gallery');
$pageURL = 'hinh-anh-trang-suc';
$catID = $popID = 0;
if(!empty($_GET['name'])) {
$pageURL = safe($_GET['name']);
$s = "SELECT * FROM ".PREFIX_NAME."collection_img".SUPFIX_NAME." WHERE URL='$pageURL'";
if($r = $dx->get_row($s)) {
// Da ngon ngu
if(MULTI_LANGUAGE && lc()!=DEFAULT_LANGUAGE){
$ss = "SELECT * FROM ".PREFIX_NAME."collection_img_lg".SUPFIX_NAME."
WHERE colID ='".$r->colID ."' ".lw('AND');
if($rr = $dx->get_row($ss)){
foreach(['Ten'] as $key) {
$r->$key = $rr->$key;
}
}
}
}
}
$colID = $r->colID;
$title = stripslashes($r->Ten);
$s = "SELECT * FROM ".PREFIX_NAME."gallery".SUPFIX_NAME." LIMIT 1";
if($r = $dx->get_row($s)) {
// Da ngon ngu
if(MULTI_LANGUAGE && lc()!=DEFAULT_LANGUAGE){
$ss = "SELECT * FROM ".PREFIX_NAME."gallery_lg".SUPFIX_NAME."
WHERE lgID='".$r->gID."' ".lw('AND');
if($rr = $dx->get_row($ss)){
foreach(['Ten','Mota'] as $key) {
$r->$key = $rr->$key;
}
}
}
}
if(empty($r->gID)) {
$web['title'] = $title.' | '.$web['title'];
}else {
if(!empty($_GET['name'])){
$url = $_GET['name'];
$gcolID = GetField($dx,PREFIX_NAME."collection_img".SUPFIX_NAME,"URL='$url'",'colID');
}
$whss='';
$limit = "LIMIT 4" ;
if(!empty($gcolID)){
$whss .= ($whss == '' ? 'WHERE' : 'AND') . "(colID = '$gcolID')";
$limit ='';
$title = GetField($dx,PREFIX_NAME."collection_img".SUPFIX_NAME,"URL='$url'",'Ten');
$brief = GetField($dx,PREFIX_NAME."collection_img".SUPFIX_NAME,"URL='$url'",'BanText');
}elseif(!empty($_GET['cbk-input'])){
$tagID = $_GET['cbk-input'];
$s = "SELECT * FROM ".PREFIX_NAME."tag".SUPFIX_NAME." WHERE tagID='$tagID'";
if ($r = $dx->get_row($s)) {
$title = stripslashes($r->Title);
$brief = stripslashes($r->BanText);
}
}else{
$title = stripslashes($r->Ten);
$brief = stripslashes($r->Mota);
}
}
if(empty($seot)) $seot = $title.' | '.$web['title'];
if(!empty($seot)) $web['title'] = $seot;
?>
include_once('_header.php');?>
include_once('_menu.php')?>
$whfl = ($whfl==''?'WHERE ':'AND ')."(tagchilID='')";
if(!empty($_GET['cbk-input'])){
$tagID = $_GET['cbk-input'];
$tagchild = GetField($dx,PREFIX_NAME."tag".SUPFIX_NAME,"tagID='$tagID'",'tagchilID');
if(empty($tagchild)){
$whfl = ($whfl==''?'AND ':'WHERE ')."(tagchilID ='$tagID' OR tagID='$tagID')";
}else{
$whfl = ($whfl==''?'AND ':'WHERE ')."(tagID ='$tagID' OR tagID='$tagchild')";
}
}
//tag filter
$catalog = [];
$s = "SELECT * FROM ".PREFIX_NAME."tag".SUPFIX_NAME." $whfl ORDER BY tagchilID";
//echo $s;
if($rs = $dx->get_results($s)){
foreach($rs as $r){
$info = [
'id' => $r->tagID,
'name' => stripslashes($r->Ten),
'link' => URL_Rewrite('hinh-anh-trang-suc',$r->URL),
'image' => $r->Anh,
];
// Da ngon ngu
if(MULTI_LANGUAGE && lc()!=DEFAULT_LANGUAGE){
$ss = "SELECT * FROM ".PREFIX_NAME."tag_lg".SUPFIX_NAME."
WHERE tagID='".$r->tagID."' ".lw('AND');
if($rr = $dx->get_row($ss)){
$info['name'] = stripslashes($rr->Ten);
}
}
$catalog[] = $info;
}
}
?>
// Phan trang
$rowsPerPage = 20;
$curPage = isset($_GET['page'])?safe($_GET['page']):1;
$offset = ($curPage - 1) * $rowsPerPage;
$wh = '';//lw();
if(!empty($_GET['cbk-input'])){
$tagID = $_GET['cbk-input'];
$s = "SELECT * FROM ".PREFIX_NAME."tag".SUPFIX_NAME." WHERE tagchilID='$tagID'";
//echo $s;
$ww='';
if ($rs = $dx->get_results($s)) {
foreach ($rs as $r) {
$ww .= " OR tagID='".$r->tagID."'";
}
}
$tagchild = GetField($dx,PREFIX_NAME."tag".SUPFIX_NAME,"tagchilID='$tagID'",'tagID');
$wh .= ($wh==''?'':'AND')."(tagID='$tagID' $ww )";
}
$whs ='';
if (!empty($_GET['txtsearch'])) {
$txtsearch = addslashes($_GET['txtsearch']);
$wh .= ($wh == '' ? '' : 'AND') . "(Ten LIKE '%$txtsearch%')";
// $whss .= ($whss== '' ? 'WHERE' : 'AND') . "(Ten LIKE '%$txtsearch%')";
}
?>
//Session gallery
$wh = ($wh==''?'':'WHERE ').$wh;
// var_dump($wh);
$s = "SELECT * FROM " . PREFIX_NAME . "collection_img" . SUPFIX_NAME . " $whss ";
if ($rs = $dx->get_results($s)) {
foreach ($rs as $r) {
$whs=$wh;
$name_session = $r->Ten;
$colID = $r->colID;
$gLink = URL_Rewrite('hinh-anh-trang-suc', $r->URL);
if(!empty($colID)){
$whs .= ($whs==''?'WHERE':'AND')." colID ='$colID' ";
}
if (MULTI_LANGUAGE && lc() != DEFAULT_LANGUAGE) {
$slg = "SELECT * FROM " . PREFIX_NAME . "collection_img_lg" . SUPFIX_NAME . "
WHERE colID ='" . $r->colID . "' " . lw('AND');
if ($rlg = $dx->get_row($slg)) {
$name_session = stripslashes($rlg->Ten);
}
}
?>
$sl = "SELECT * FROM " . PREFIX_NAME . "img_detail" . SUPFIX_NAME . " $whs $limit ";
// echo $sl;
if ($rsx = $dx->get_results($sl)) {
?>
if(empty($gcolID)){?>
foreach ($rsx as $pro) {
$names = stripslashes($pro->Ten);
if (MULTI_LANGUAGE && lc() != DEFAULT_LANGUAGE) {
$ss = "SELECT * FROM " . PREFIX_NAME . "img_detail_lg" . SUPFIX_NAME . "
WHERE lgID='" . $pro->proID . "' " . lw('AND');
if ($rr = $dx->get_row($ss)) {
$names = stripslashes($rr->Ten);
//$info['brief'] = CutString($pro->Tomtat,150);
}
}
$image = $pro->Anh;
$thumb = $pro->Anh;
$rias = $pro->Anh;
$link = URL_Rewrite('hinh-anh-trang-suc', $pro->URL);
?>
} ?>
}else{?>
foreach ($rsx as $pro) {
$names = stripslashes($pro->Ten);
if (MULTI_LANGUAGE && lc() != DEFAULT_LANGUAGE) {
$ss = "SELECT * FROM " . PREFIX_NAME . "img_detail_lg" . SUPFIX_NAME . "
WHERE lgID='" . $pro->proID . "' " . lw('AND');
if ($rr = $dx->get_row($ss)) {
$names = stripslashes($rr->Ten);
//$info['brief'] = CutString($pro->Tomtat,150);
}
}
$image = $pro->Anh;
$thumb = $pro->Anh;
$rias = $pro->Anh;
$link = URL_Rewrite('hinh-anh-trang-suc', $pro->URL);
?>
}
} ?>
}?>
} ?>
}
// exit;
?>
include_once('_popup.php');
include_once('_footer.php');
?>