<?php
include ("ust.php");
session_start(); ## -> Oturum Başlatıldı
$giris_kontrol = $_SESSION['kullanici_id']; if(empty($giris_kontrol)){echo '<meta http-equiv="refresh" content="0;URL=index.php">';}else{
?>
  
			<link rel="stylesheet" href="assets/plugins/html5-editor/bootstrap-wysihtml5.css" />
			<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
            <div class="container-fluid">
            
			<?php // Bakım modu aktif ise tüm sayfalarda bakım uyarısı verir.
			if($geayar_bakim == "evet"){include("moduller/bakim-modul.php");} ?>
			
			
			
			<?php
			$islem = g("islem");
			if($islem == "logo"){ 
			$posted = "resim";
			$rastgele = rand(1000,9999);
			if ($_FILES["resim"]['name']){ 
			$filename=$_FILES["$posted"]['name']; 
			$efilename = explode('.', $filename); 
			$uzanti = $efilename[count($efilename) - 1]; 

			$isim = "logo-".$rastgele;
			$yeniad = "".$isim.".".$uzanti.""; 
			$resim = "vi-includes/images/".$yeniad; 
			move_uploaded_file($_FILES["$posted"]['tmp_name'],"../vi-includes/images/".$yeniad); } 
			
			// İşlem Kayıt Modülü
			$islemk_islem = "Site logosu değiştirildi.";
			include("moduller/islemkayit_modul.php");
			$guncelle = mysql_query("update genelayarlar set resim='$resim' where id='1'") or die("Hata Olustu!");
			
		
			if($guncelle)
			{echo '<meta http-equiv="refresh" content="0;URL=logoayar.php?durum=basarili"> ';}
			} ?>
			
			
			<?php
			$islem = g("islem");
			if($islem == "favicon"){ 
			$posted = "resim_favicon";
			$rastgele = rand(1000,9999);
			if ($_FILES["resim_favicon"]['name']){ 
			$filename=$_FILES["$posted"]['name']; 
			$efilename = explode('.', $filename); 
			$uzanti = $efilename[count($efilename) - 1]; 

			$isim = "favicon";
			$yeniad = "".$isim.".".$uzanti.""; 
			$geayar_favicon = $yeniad;
			move_uploaded_file($_FILES["$posted"]['tmp_name'],"../vi-includes/tema/vi-mars/".$geayar_favicon); } 
			
			// İşlem Kayıt Modülü
			$islemk_islem = "Site faviconu değiştirildi.";
			include("moduller/islemkayit_modul.php");
			$guncelle = mysql_query("update genelayarlar set geayar_favicon='$geayar_favicon' where id='1'") or die("Hata Olustu!");
			
			if($guncelle)
			{echo '<meta http-equiv="refresh" content="0;URL=logoayar.php?durum=basarili"> ';}
			} ?>
			
			
			
			<?php
			$islem = g("islem");
			if($islem == "footer"){ 
			$posted = "resim_footer";
			$rastgele = rand(1000,9999);
			if ($_FILES["resim_footer"]['name']){ 
			$filename=$_FILES["$posted"]['name']; 
			$efilename = explode('.', $filename); 
			$uzanti = $efilename[count($efilename) - 1]; 

			$isim = "footerlogo-$rastgele";
			$yeniad = "".$isim.".".$uzanti.""; 
			$geayar_footer_logo = "vi-includes/images/".$yeniad; 
			move_uploaded_file($_FILES["$posted"]['tmp_name'],"../vi-includes/images/".$yeniad); } 
			
			// İşlem Kayıt Modülü
			$islemk_islem = "Site footer logosu değiştirildi.";
			include("moduller/islemkayit_modul.php");
			$guncelle = mysql_query("update genelayarlar set geayar_footer_logo='$geayar_footer_logo' where id='1'") or die("Hata Olustu!");
			
			if($guncelle)
			{echo '<meta http-equiv="refresh" content="0;URL=logoayar.php?durum=basarili"> ';}
			} ?>
			
			
	
			
			<?php $durum = g('durum'); if($durum == "basarili") { ?>
			<div class="alert alert-success"> <i class="fa fa-check"></i> İşlem başarıyla gerçekleştirildi
            <button type="button" class="close" data-dismiss="alert" aria-label="Close"> </button>
            </div>
			<?php } 
			$genel_getir=mysql_query("SELECT * FROM genelayarlar WHERE id='1'"); 
			$getir=mysql_fetch_array($genel_getir); 
			$geayar_logo = $getir['resim'];
			$geayar_favicon = $getir['geayar_favicon'];
			$geayar_footer_logo = $getir['geayar_footer_logo'];
			?>
			
			<div class="row">
            <div class="col-lg-12">
            <div class="card card-outline-inverse">
            <div class="card-header">
            <h4 class="m-b-0 text-white">Logo Yönetimi</h4>
            </div>
            <div class="card-body">
            
            <div class="form-body">
								
            

			<div class="col-md-12">
            <div class="row">
                                        
	
		
			<div class="col-md-6">
			<form action="logoayar.php?islem=logo" method="post"  enctype="multipart/form-data">
			<h4 class="card-title">Logo</h4>
                
			<input type="file"  name="resim" class="file form-control"/>
			<br>
			<br>
				
			<div class="upload-preview">
			<center><img src="<?php echo "../$geayar_logo"; ?>" id="p1" width="30%"><br>
			<span id="p2">Mevcut Logo</span>
			</center>
			</div>
			<br>
            <div class="form-actions">
			<center><?php if($kontrol_kullanici_yetki == "1"){?>
            <button type="submit" class="btn btn-success btn-sm "> <i class="fa fa-check"></i> Logoyu Değiştir</button>
			<?php }else{echo '<a class="btn btn-primary btn-sm text-white" data-toggle="modal" data-target="#uyari-modal"> <i class="fa fa-check"></i> Logoyu Değiştir</a>'; }?>
            </center></div>
			</form>
			</div>
			
			<script type="text/javascript">
			$(document).ready(function(){
			var preview = $(".upload-preview");
			$(".file").change(function(event){
			var input = $(event.currentTarget);
			var file = input[0].files[0];
			var reader = new FileReader();
			reader.onload = function(e){
			$("#p1").hide(1000);
			$("#p2").hide(1000);
			image_base64 = e.target.result;
			preview.html("<center><img   width='30%'src='"+image_base64+"'/><br>Yeni Logo</center>");
			};
			reader.readAsDataURL(file);
			});
			});
			</script>
			
			
			<div class="col-md-6">
			<form action="logoayar.php?islem=favicon" method="post"  enctype="multipart/form-data">
			<h4 class="card-title">Favicon</h4>
                
			<input type="file"  name="resim_favicon" class="files form-control"/>
			<br>
			<br>
				
			<div class="upload-preview2">
			<center><img src="<?php echo "../vi-includes/tema/vi-mars/$geayar_favicon"; ?>" id="p3" ><br>
			<span id="p4">Mevcut Favicon</span>
			</center>
			</div>
			<br>
			<div class="form-actions">
			<center><?php if($kontrol_kullanici_yetki == "1"){?>
            <button type="submit" class="btn btn-success btn-sm "> <i class="fa fa-check"></i> Faviconu Değiştir</button>
			<?php }else{echo '<a class="btn btn-primary btn-sm text-white" data-toggle="modal" data-target="#uyari-modal"> <i class="fa fa-check"></i> Faviconu Değiştir</a>'; }?>
            </center></div>
			</form>
			</div>
			
			<script type="text/javascript">
			$(document).ready(function(){
			var preview = $(".upload-preview2");
			$(".files").change(function(event){
			var input = $(event.currentTarget);
			var file = input[0].files[0];
			var reader = new FileReader();
			reader.onload = function(e){
			$("#p3").hide(1000);
			$("#p4").hide(1000);
			image_base64 = e.target.result;
			preview.html("<center><img   width='30%'src='"+image_base64+"'/><br>Yeni Favicon</center>");
			};
			reader.readAsDataURL(file);
			});
			});
			</script>
			</div>
			
			<hr>
			<div class="row">
			<div class="col-md-6">
			<form action="logoayar.php?islem=footer" method="post"  enctype="multipart/form-data">
			<h4 class="card-title">Footer Logo</h4>
                
			<input type="file"  name="resim_footer" class="files1 form-control"/>
			<br>
			<br>
				
			<div class="upload-preview3">
			<center><img src="<?php echo "../$geayar_footer_logo"; ?>" id="p5" width="30%"><br>
			<span id="p6">Mevcut Footer Logosu</span>
			</center>
			</div>
			<br>
			<div class="form-actions">
			<center><?php if($kontrol_kullanici_yetki == "1"){?>
            <button type="submit" class="btn btn-success btn-sm "> <i class="fa fa-check"></i> Footer Logosunu Değiştir</button>
			<?php }else{echo '<a class="btn btn-primary btn-sm text-white" data-toggle="modal" data-target="#uyari-modal"> <i class="fa fa-check"></i> Footer Logosunu Değiştir</a>'; }?>
            </center></div>
			</form>
			</div>
			
			<script type="text/javascript">
			$(document).ready(function(){
			var preview = $(".upload-preview3");
			$(".files1").change(function(event){
			var input = $(event.currentTarget);
			var file = input[0].files[0];
			var reader = new FileReader();
			reader.onload = function(e){
			$("#p5").hide(1000);
			$("#p6").hide(1000);
			image_base64 = e.target.result;
			preview.html("<center><img   width='30%'src='"+image_base64+"'/><br>Yeni Footer Logosu</center>");
			};
			reader.readAsDataURL(file);
			});
			});
			</script>
			
			</div>
			
            </div>
			
			
			
		
			
            </div>
         
			</div>
			</div>
			</div>
			</div>
			</div>
           
<?php
include ("alt.php");
}
?>