assign('gotMenu',$gotMenu); $smarty->assign('gotTree',$gotTree); $smarty->assign('gotBlock',$gotBlock); $smarty->assign('gotNewsWorld',$gotNewsWorld); if($id!=''){ $gotCont=sql_query('SELECT cid, name_'.$_SESSION['lang'].', txt_'.$_SESSION['lang'].', created, views_total, sort_type, views_today, attached_album FROM '.$dbprefix.'categories WHERE status=1 AND url_name="'.$id.'"',0); $Find = "/\[mp3\](.*)\[\/mp3\]/i"; $Replace=""; $gotCont[2] = preg_replace($Find, $Replace, $gotCont[2]); if($gotCont[7]>0){ $albid=$gotCont[7]; $glry_image_folder='files/image/gallery_images/'.$gotCont[7].'/'; if(file_exists($glry_image_folder)){ $i = 0; $handle = opendir ($glry_image_folder); while($file = readdir($handle)){ if ($file != '.' && $file != '..' && substr($file, 0,3)!='tn_' && $file!='_alt.txt'){ $gImages[$i] = $file; //формируем массив названий файлов $i++; } } if(count($gImages)>0)sort ($gImages); } ### get Alt text for images $handle = @fopen('files/image/gallery_images/'.$gotCont[7].'/_alt.txt', "r"); if ($handle) { while (($buffer = fgets($handle, 4096)) !== false) { $gotAlt=explode('|', $buffer); $aid=$gotAlt[0]; $imgAlt[$aid]=$gotAlt[1]; } if (!feof($handle)) { break; // if fail - exit } fclose($handle); } $entriesperline=2; $counter=1; $galleryCont.=""; if(count($gImages)>0){ foreach($gImages as $key=>$val){ $fid=substr($val, 0,-4); if($counter==1){ $galleryCont.=""; } elseif($counter>=$entriesperline){ $galleryCont.=""; $counter=0; } else{ $galleryCont.=""; } $counter++; } //exit loop } $galleryCont.=""; $Find = "/\[gallery\]/i"; $gotCont[2] = preg_replace($Find, $galleryCont, $gotCont[2]); } $smarty->assign('gotCont',$gotCont); $sorttype=explode('_', $gotCont[5]); switch ($sorttype[0]){ case 'title': $order="name_".$_SESSION['lang'].' '.$sorttype[1]; break; case 'date': $order="created".' '.$sorttype[1]; break; case 'custom': $order="custom_sort".' '.$sorttype[1]; break; default: $order="name_".$_SESSION['lang'].' ASC'; } $gotSub=sql_query('SELECT cid, name_'.$_SESSION['lang'].', txt_'.$_SESSION['lang'].', created, views_total, url_name, link2page FROM '.$dbprefix.'categories WHERE status=1 AND parentid="'.$gotCont[0].'" ORDER by '.$order,1); foreach ($gotSub as $key=>$val){ if(substr($val[6], 0, 7)!='http://' && $val[6]!='') {$gotSub[$key]['link2page']=$gotSub[$key][6]=$defServerName.'article/'.$val[6].'/';} } $smarty->assign('gotSub',$gotSub); $smarty->assign('existSub',count($gotSub)); $parID=$gotCont[0]; while($parID!=0){ $gotParent=sql_query('SELECT cid, name_'.$_SESSION['lang'].', parentid, url_name FROM '.$dbprefix.'categories WHERE status=1 AND cid="'.$parID.'"',0); $gotPath[]=array($gotParent[0], $gotParent[1], $gotParent[2], $gotParent[3]); $parID=$gotParent[2]; } unset($gotPath[0]); if(count($gotPath)) krsort($gotPath); $smarty->assign('gotPath',$gotPath); } $smarty->assign('gotNews',$gotNews); $smarty->assign('gotPubl',$gotPubl); $smarty->assign('gotLastPath',$gotLastPath); ### GET NEWSTYPE $smarty->assign('gotNewsType',$gotNewsType); $smarty->assign('gotNewsTypeCnt',count($gotNewsType)); $galleryJS='' .'' .'' .'' ." " ; $smarty->assign('galleryJS',$galleryJS); foreach ($genLang as $key=>$val){ $smarty->assign($key,$val); } if(isset($_COOKIE['cat_visit']) && $_COOKIE['cat_visit']==$gotCont[0]) $old_visiter=true; else { setcookie("cat_visit", $gotCont[0], time()+2592000); $old_visiter=false; if($_COOKIE['cat_visit']=$gotCont[0]) $old_visiter=false; else $old_visiter=true; } if((int)$gotCont[0]>0){ $index=$values=array(); if($old_visiter==false) {$index[]='views_total'; $values[]=$viewsTotal=$gotCont[4]+1;} else $viewsTotal=$gotCont[4]; if($old_visiter==false) $rez=sql_update($dbprefix.'categories','WHERE cid="'.$gotCont[0].'"',$index,$values); list($getTodayDate)=sql_query('SELECT value FROM '.$dbprefix.'settings WHERE vname="current_date"',0); if($getTodayDate==date("Y-m-d")){ $index=$values=array(); $index[]='views_today'; $values[]=$gotCont[6]+1; $rez=sql_update($dbprefix.'categories','WHERE cid="'.$gotCont[0].'"',$index,$values); } else{ $index=$values=array(); $index[]='views_today'; $values[]=0; $rez=sql_update($dbprefix.'audio','WHERE 1',$index,$values); $index=$values=array(); $index[]='views_today'; $values[]=0; $rez=sql_update($dbprefix.'categories','WHERE 1',$index,$values); $index=$values=array(); $index[]='visited_today'; $values[]=0; $rez=sql_update($dbprefix.'news','WHERE 1',$index,$values); $index=$values=array(); $index[]='visited_today'; $values[]=0; $rez=sql_update($dbprefix.'newsworld','WHERE 1',$index,$values); $index=$values=array(); $index[]='views_today'; $values[]=0; $rez=sql_update($dbprefix.'gallery_cat','WHERE 1',$index,$values); $index=$values=array(); $index[]='value'; $values[]=date("Y-m-d"); $rez=sql_update($dbprefix.'settings','WHERE vname="current_date"',$index,$values); } } $smarty->assign('viewsTotal',$viewsTotal); $tpl = $smarty->fetch($file_tpl.'.tpl'); print $tpl; ?>