require("include.routins.php");
$_lan=capture_request('lan');
$search=capture_request('search');
if (!validate_request($search,'plain','1','255')) $search='';
$hs=capture_request('hash');
if (!validate_request($hs,'plain','1','255')) $hs='';
$hs=str_replace('-',' ',$hs);
$sublist_name=capture_request('sublist_name');
if (!validate_request($sublist_name,'plain','1','255')) $sublist_name='';
$sublist_name=str_replace('-',' ',$sublist_name);
$conn=mysqli_connect("localhost",_database_user,_database_password,_database_name);
if ($search!=''){
$where_main="inner join news_sublist s on n.kindex=s.news_index where ((n.name like '%" . $search . "%') and (n.lan='" . lan($_lan) . "') and (n.d1<>'') and (n.status='1'))";
$website_name=$search;}
if ($hs!=''){
$where_main="inner join news_sublist s on n.kindex=s.news_index where ((n.hash like '%" . $hs . "%') and (n.lan='" . lan($_lan) . "') and (n.d1<>'') and (n.status='1'))";
$website_name='#' . $hs;}
if ($sublist_name!=''){
$result=mysqli_query($conn,"select kindex from sublist where (name='$sublist_name')");
$i=0; $row=mysqli_fetch_row($result); $sublist_index=$row[$i++]; mysqli_free_result($result);
$where_main="inner join news_sublist s on n.kindex=s.news_index where ((s.sublist_index='$sublist_index') and (n.d1<>'') and (n.lan='" . lan($_lan) . "') and (n.status='1'))";
$website_name=$sublist_name;}
mysqli_close($conn);
require(_main_dir . "/include/include.home.php");
?>
$mx=0;
if ($sublist_name!=''){
$mx=17;
$where=$where_main . " order by n.kindex desc limit 0,$mx";
require(_main_dir . "/include/include.news.php") ?>
} ?>
echo prin($_lan,'HEADLINES');
if ($hs!='') echo ' #' . $hs;
if ($search!='') echo ' "' . $search . '"'
?>
$n=0;
$where=$where_main . " order by n.kindex desc limit $mx,50";
$result=mysqli_query($conn,"select n.name,n.kindex,n.d1,n.des,n.cdate from news n $where");
while ($row=mysqli_fetch_array($result)){
$i=0; $name=$row[$i++]; $kindex=$row[$i++]; $d1=$row[$i++]; $des=$row[$i++]; $cdate=$row[$i++];
$des=html2plain($des);
$des=less_words($des,50);
for ($i=0; $i<=9; $i++){
$des=str_replace('image' . $i,'',$des);
$des=str_replace('video' . $i,'',$des);}
if ($n++>0){
?>
$result=mysqli_query($conn,"select d1,smalldes from news where (name='ads')");
$i=0; $row=mysqli_fetch_row($result); $ads=$row[$i++]; $ads_link=$row[$i++]; mysqli_free_result($result);
?>
$editor_choice_arr=array(53,40,34,49);
$sublist_index=$editor_choice_arr[lan($_lan)];
$result=mysqli_query($conn,"select n.name,n.kindex,n.d1,n.hash from news n inner join news_sublist s on n.kindex=s.news_index where ((s.sublist_index='$sublist_index') and (n.lan='" . lan($_lan) . "') and (n.status='1') and (n.d1<>'')) order by n.kindex desc limit 0,8");
while ($row=mysqli_fetch_array($result)){
$i=0; $name=$row[$i++]; $kindex=$row[$i++]; $d1=$row[$i++]; $h=$row[$i++];
$h=explode(',',$h);
if ($h[1]!='') $h=$h[1];
else $h=$h[0];
?>