<?php
include("ust.php");
	$d_g_bloglar_b = $dil_v_getir['m18'];
	$d_g_bloglar_k = $dil_v_getir['m19'];
	## BOGLAR MODÜLÜ 
	$m_kontrol=mysql_query("SELECT * FROM moduller WHERE modul_adi='bloglar'"); 
	$getir=mysql_fetch_array($m_kontrol); 
	$blog_m_durum = $getir['modul_durum'];
	$blog_m_durum_ana = $getir['modul_asayfa'];
	$blog_m_s_limit = $getir['modul_v1'];
	$blog_m_o_sayi = $getir['modul_v2'];
	$blog_m_s_miktar = $getir['modul_v3'];
	$blog_etiket_mo = $getir['modul_v5'];
	if($blog_m_durum == "acik"){
	$verino = g("verino");	
?>
	
	<br>
	<div class="container">
	
	<?php if(empty($verino)){?><h3><?php echo $d_g_bloglar_b; ?></h3><?php }else{
	$kategori_bul=mysql_query("SELECT * FROM blog_kategori WHERE seo_url='$verino'"); 
	$getir=mysql_fetch_array($kategori_bul); 
	$kat_baslik = $getir['baslik'];
	echo '<h3>'.$kat_baslik.'</h3>';
	}
	?>
	

	<hr>
	</div>
	
	<section class="blog-layout news-default">
	<div class="container">
	<div class="row">
	<div class="col-lg-8 col-12">
	<div class="row">
	<?php if(empty($verino)){ ?>
	<?php
	$sayfada = $blog_m_s_limit; 
	$sorgu = mysql_query('SELECT COUNT(*) AS toplam FROM bloglar WHERE veri_dil="'.$dil_durum.'"');
	$sonuc = mysql_fetch_assoc($sorgu);
	$toplam_icerik = $sonuc['toplam'];
	$toplam_sayfa = ceil($toplam_icerik / $sayfada);
	$sayfano = g("sayfa");
	$sayfa = isset($sayfano) ? (int) $sayfano : 1;
	if($sayfa < 1) $sayfa = 1; 
	if($sayfa > $toplam_sayfa) $sayfa = $toplam_sayfa; 
	$limit = ($sayfa - 1) * $sayfada;
	$sorgu = mysql_query('SELECT * FROM bloglar WHERE veri_dil="'.$dil_durum.'" ORDER BY id DESC LIMIT ' . $limit . ', ' . $sayfada);
 
	while($icerik = mysql_fetch_assoc($sorgu)) {
	$makale_baslik= $icerik['baslik'];
	$makale_url = $icerik['seo_url'];
	$makale_resim = $icerik['resim'];
	$makale_tarih = $icerik['tarih'];
	$makale_icerik = $icerik['icerik'];
	$makale_goruntulenme = $icerik['goruntuleme'];
	
	if($blog_m_o_sayi == "evet"){ $t_o_k = '<li class="view"><i class="fa fa-eye"></i>'.$makale_goruntulenme.'</li>';}else{}
	echo '
	<div class="col-lg-'.$blog_m_s_miktar.' col-md-'.$blog_m_s_miktar.' col-12">
	<div class="single-news ">
	<a href="blog/'.$makale_url.'">
	<div class="news-head overlay">
	<img src="'.$makale_resim.'" alt="'.$makale_baslik.'">
	<ul class="news-meta">
	<li class="date"><i class="fa fa-calendar"></i>'.$makale_tarih.'</li>
	'.$t_o_k.'
	</ul>
	</div>
	</a>
	<div class="news-body">
	<div class="news-content">
	<h5 class="news-title"><a href="blog/'.$makale_url.'">'.$makale_baslik.'</a></h5>
	</div>
	</div>
	</div>
	</div>
	';
	}
	?>
	<?php }else{ ?>
	
	<?php

	$kategori_bul=mysql_query("SELECT * FROM blog_kategori WHERE seo_url='$verino'"); 
	$getir=mysql_fetch_array($kategori_bul); 
	$kat_id = $getir['id'];
	$goruntuleme = $getir['goruntuleme'];
	
	$sayi1= $goruntuleme;
	$sayi2=1;
	$toplam=$sayi1+$sayi2;
	$g_arttir = mysql_query("update blog_kategori set goruntuleme='$toplam' where id='$kat_id'") or die("Hata Olustu!");
	
	$sayfada = $blog_m_s_limit; 
	$sorgu = mysql_query('SELECT COUNT(*) AS toplam FROM bloglar WHERE veri_dil="'.$dil_durum.'" AND m15='.$kat_id.'');
	$sonuc = mysql_fetch_assoc($sorgu);
	$toplam_icerik = $sonuc['toplam'];
	$toplam_sayfa = ceil($toplam_icerik / $sayfada);
	$sayfano = g("sayfa");
	$sayfa = isset($sayfano) ? (int) $sayfano : 1;
	if($sayfa < 1) $sayfa = 1; 
	if($sayfa > $toplam_sayfa) $sayfa = $toplam_sayfa; 
	$limit = ($sayfa - 1) * $sayfada;
	$sorgu = mysql_query('SELECT * FROM bloglar WHERE veri_dil="'.$dil_durum.'" AND m15='.$kat_id.' ORDER BY id DESC LIMIT ' . $limit . ', ' . $sayfada);
 
	while($icerik = mysql_fetch_assoc($sorgu)) {
	$makale_baslik= $icerik['baslik'];
	$makale_url = $icerik['seo_url'];
	$makale_resim = $icerik['resim'];
	$makale_tarih = $icerik['tarih'];
	$makale_icerik = $icerik['icerik'];
	$makale_goruntulenme = $icerik['goruntuleme'];
	
	if($blog_m_o_sayi == "evet"){ $t_o_k = '<li class="view"><i class="fa fa-eye"></i>'.$makale_goruntulenme.'</li>';}else{}
	echo '
	<div class="col-lg-'.$blog_m_s_miktar.' col-md-'.$blog_m_s_miktar.' col-12">
	<div class="single-news ">
	<a href="blog/'.$makale_url.'">
	<div class="news-head overlay">
	<img src="'.$makale_resim.'" alt="'.$makale_baslik.'">
	<ul class="news-meta">
	<li class="date"><i class="fa fa-calendar"></i>'.$makale_tarih.'</li>
	'.$t_o_k.'
	</ul>
	</div>
	</a>
	<div class="news-body">
	<div class="news-content">
	<h5 class="news-title"><a href="blog/'.$makale_url.'">'.$makale_baslik.'</a></h5>
	</div>
	</div>
	</div>
	</div>
	';
	}
	?>
	<?php } ?>
	
	</div>
	
	<div class="row">
	<div class="col-12">
	<div class="pagination-plugin">
	<ul class="pagination-list">
	<?php $verino = g("verino"); if(empty($verino)){ ?>
	<?php
	for($s = 1; $s <= $toplam_sayfa; $s++) {
	if($sayfa == $s) { 
	echo '<li class="page-numbers current"><a href="bloglar/?sayfa='.$s.'">'.$s.'</a></li>'; 
	}else{
	echo '<li class="page-numbers "><a href="bloglar/?sayfa='.$s.'">'.$s.'</a></li>';
    }}
	?>
	<?php }else{ ?>
	<?php
	for($s = 1; $s <= $toplam_sayfa; $s++) {
	if($sayfa == $s) { 
	echo '<li class="page-numbers current"><a href="bloglar/'.$verino.'?sayfa='.$s.'">'.$s.'</a></li>'; 
	}else{
	echo '<li class="page-numbers "><a href="bloglar/'.$verino.'?sayfa='.$s.'">'.$s.'</a></li>';
    }}
	?>
	<?php } ?>
	</ul>
	</div>
	</div>
	</div>
				
	</div>
	
	<div class="col-lg-4 col-12">

	<div class="service-sidebar">	
	<div class="service-single-sidebar widget">
	<h2 class="widget-title"><?php echo $d_g_bloglar_k;?></h2>		
	<div class="menu-service-menu-container">
	<ul id="menu-service-menu" class="menu">
	<?php
	$sayfa_al = mysql_query("SELECT * FROM blog_kategori WHERE veri_dil='$dil_durum' ORDER BY id ASC limit 0,999");
	while($yaz=mysql_fetch_array($sayfa_al)){
	$id = $yaz['id'];
	$kategori_baslik= $yaz['baslik'];
	$kategori_url = $yaz['seo_url'];
	
	echo '	<li><a href="bloglar/'.$kategori_url.'">'.$kategori_baslik.'</a></li>';
	}
	?>
	</ul>
	</div>
	</div>
	</div>
	
		<div class="blog-sidebar">
					
	<div class="single-sidebar bizwheel_latest_news_widget">
	<h2 class="sidebar-title"><?php echo $dil_v_getir['m20']; ?></h2>
	
	<?php
	$blog_al = mysql_query("SELECT * FROM bloglar WHERE veri_dil='$dil_durum' ORDER BY goruntuleme DESC limit 0,5");
	while($yaz=mysql_fetch_array($blog_al)){
	$id = $yaz['id'];
	$b_s_b_baslik = $yaz['baslik'];
	$b_s_b_url = $yaz['seo_url'];
	$b_s_b_resim = $yaz['resim'];
	$b_s_b_tarih = $yaz['tarih'];
	
	echo '
	
	<div class="single-f-news">
	<div class="post-thumb"><a href="blog/'.$b_s_b_url.'"><img src="'.$b_s_b_resim.'" alt="'.$b_s_b_baslik.'"></a></div>
	<div class="content">
	<p class="post-meta" style="padding-top:15px;"><time class="post-date"><i class="fa fa-clock-o" ></i>'.$b_s_b_tarih.'</time></p>
	<h4 class="title"><a href="blog/'.$b_s_b_url.'">'.$b_s_b_baslik.'</a></h4>
	</div>
	</div>
	
	';
	}
	?>			
	</div>
	
	<?php if($blog_etiket_mo == "evet"){?>	
	<div class="single-sidebar tagcloud">
	<h2 class="sidebar-title"><?php echo $dil_v_getir['m21']; ?></h2>
	<ul>
	<?php
	$blog_al = mysql_query("SELECT * FROM bloglar WHERE veri_dil='$dil_durum' ORDER BY RAND() DESC limit 0,3");
	while($yaz=mysql_fetch_array($blog_al)){
	$id = $yaz['id'];
	$a_k_cek = $yaz['seo_anahtarkelime'];
	$a_u_cek = $yaz['seo_url'];
	
	$dizi = explode (",",$a_k_cek);
	$i=0;
	foreach ($dizi as $d) {
	if($i==50){
	echo '<br>';
	$i=0;
     }
	$i++;
	echo '<li><a href="blog/'.$a_u_cek.'">'.$d.'</a></li>';
	}
	}
	?>
	</ul>
	</div>
	<?php } ?>

	</div>
	
	</div>
					
					
	</div>
		
	</div>
	</section>
		

<?php
	include("alt.php"); }else {echo '<meta http-equiv="refresh" content="0;URL=anasayfa/">';}
?>		