<?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{
?>


				<div class="container-fluid">
              
				<?php // Bakım modu aktif ise tüm sayfalarda bakım uyarısı verir.
				if($geayar_bakim == "evet"){include("modules/bakim-modul.php");} ?>
		
                <div class="row">
                <div class="col-12">

				
                


						
<div class="col-md-12">
<?php 


## -> Silme İşlemi
$sil = g('sil');
switch($sil){
case "hesap-sil":

// İşlem Kayıt Modülü
$islemk_islem = "Bir sosyal medya hesabı silindi";
include("moduller/islemkayit_modul.php");

$id = g('id'); $id = mysql_real_escape_string($id);
$sil = mysql_query("delete from sosyal_medya where id='$id'") or die("Hata Olustu!");
if($sil){echo '<meta http-equiv="refresh" content="0;URL=sosyal_medya.php?modulac=sosyalmedya&durum=basarili"> ';}
}
## -> Silme İşlemi


$islem = g('islem');
switch($islem){
case "kaydet":

$modul_durum = p('modul_durum');
$mds_1 = p('mds_1');
 
// İşlem Kayıt Modülü
$islemk_islem = "Sosyal medya modülü düzenlendi";
include("modules/islemkayit_modul.php");


$duzenle = mysql_query("update moduller set 
modul_durum='$modul_durum',
mds_1='$mds_1',
mds_23='$mds_23'
where id='2'") or die("Hata Olustu!");	

echo '<meta http-equiv="refresh" content="0;URL=sosyal_medya.php?durum=duzenleme-basarili"> ';
break;
}


$ileri = g("ileri");
if($ileri == "ekle"){

// İşlem Kayıt Modülü
$islemk_islem = "Yeni sosyal medya hesabı eklendi";
include("moduller/islemkayit_modul.php");

$sc_icon = p("sc_icon");
$sc_baslik = p("sc_baslik");
$sc_link = p("sc_link");
$sc_renk = p("sc_renk");
$ekle_hesap = mysql_query("INSERT INTO sosyal_medya (sc_icon,sc_baslik,sc_link,sc_renk)VALUES('$sc_icon','$sc_baslik','$sc_link','$sc_renk')");
	
if($ekle_hesap){echo '<meta http-equiv="refresh" content="0;URL=sosyal_medya.php?modulac=sosyalmedya&durum=basarili"> ';}
}
?>	
<div class="card card-inverse">
<div class="card-header">
<h4 class="m-b-0 text-black" style="float:left;padding-top:5px;">Sosyal Medya Hesapları</h4>
			

<form action="sosyal_medya.php?modulac=sosyalmedya&islem=kaydet" method="post">				

					
</div>
</div>

<?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 } ?> 

<div class="card">
<div class="card-body">
<ul class="nav nav-tabs customtab2" role="tablist">
<li class="nav-item"> <a class="nav-link active" data-toggle="tab" href="#hesaplar" role="tab" aria-selected="false"><span class="hidden-sm-up"><i class="fa fa-user"></i></span> <span class="hidden-xs-down">Hesaplar</span></a> </li>
<li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#yenihesap" role="tab" aria-selected="false"><span class="hidden-sm-up"><i class="fa fa-user-plus"></i></span> <span class="hidden-xs-down">Yeni Hesap</span></a> </li>
</ul>
<div class="tab-content">




<div class="tab-pane active" id="hesaplar" role="tabpanel">
<br>
<div class="card">

								<div class="card-body">
    
                                <h6 class="card-subtitle">Mevcut sosyal medya hesaplarınız</h6>
                                <div class="table-responsive">
								<table class="table">
                                <thead>
								<tr>
								<th>Simge</th>
								<th>Başlık</th>
								<th>Link</th>
								<th>İşlemler</th>
                                </tr>
                                </thead>
                                <tbody>
								
								<?php
								$icerik_al = mysql_query("SELECT * FROM sosyal_medya ORDER BY id ASC limit 0,999");
								while($yaz=mysql_fetch_array($icerik_al)){
								$id = $yaz['id'];
								$sc_icon = $yaz['sc_icon'];
								$sc_baslik = $yaz['sc_baslik'];
								$sc_renk = $yaz['sc_renk'];
								$sc_link = $yaz['sc_link'];
								echo "
								<tr>
								<td><i class='fa fa-$sc_icon'></i> - $sc_baslik</td>
								<td>$sc_baslik</td>
								<td>$sc_link</td>
								";
								if($kontrol_kullanici_yetki == "1"){
								echo "<td><a href='#' data-toggle='modal' data-target='#sil-modal$id' ><span class='label label-primary'>Sil</span></td>";
								}else{echo "<td><a href='#' data-toggle='modal' data-target='#uyari-modal' ><span class='label label-primary'>Sil</span></td>";}
								echo "
								</tr>
								";
								}?>
				
                                         
                                </tbody>
                                </table>
                                </div>
								</div>
							
								<?php
								$hesap_al = mysql_query("SELECT * FROM sosyal_medya ORDER BY id DESC limit 0,999");
								while($yaz=mysql_fetch_array($hesap_al)){
								$id = $yaz['id'];
								$baslik = $yaz['baslik'];	
			
								echo '
					
								<div class="modal fade" id="sil-modal'.$id.'" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
								<div class="modal-dialog modal-lg">
								<div class="modal-content">
								<div class="modal-header">
								<h4 class="modal-title" id="myLargeModalLabel"><i class="fa fa-times"></i> Hesap Sil</h4>
								<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
								</div>
								<div class="modal-body">
								<p>Bu sosyal medya hesabını gerçekten silmek istiyormusunuz</p>
								</div>
								<div class="modal-footer">
								<a href="sosyal_medya.php?modulac=sosyalmedya&sil=hesap-sil&id='.$id.'"><button type="button" class="btn btn-primary waves-effect text-left">Evet</button></a>
								<button type="button" class="btn btn-danger waves-effect text-left" data-dismiss="modal">Kapat</button>
								</div>
								</div>
								</div>
								</div>
								
			
								';
								}?> 							
							
								</div>
								</div>

</form>		
<div class="tab-pane" id="yenihesap" role="tabpanel">
<br>
<div class="col-md-12">
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label class="control-label">Sosyal Medya Simgesi</label><br>
<div class="row">
<div class="col-md-6">
<form action="sosyal_medya.php?modulac=sosyalmedya&ileri=ekle" method="post" name="form2" id="form2">
<input type="radio" id="facebook" name="sc_icon" value="facebook">
<label for="facebook"><i class="fa fa-facebook"></i></label><br>

<input type="radio" id="twitter" name="sc_icon" value="twitter">
<label for="twitter"><i class="fa fa-twitter"></i></label><br>

<input type="radio" id="instagram" name="sc_icon" value="instagram">
<label for="instagram"><i class="fa fa-instagram"></i></label><br>

<input type="radio" id="medium" name="sc_icon" value="medium">
<label for="medium"><i class="fa fa-medium"></i></label><br>

<input type="radio" id="youtube-play" name="sc_icon" value="youtube-play">
<label for="youtube-play"><i class="fa fa-youtube-play"></i></label><br>

<input type="radio" id="tumblr" name="sc_icon" value="tumblr">
<label for="tumblr"><i class="fa fa-tumblr"></i></label><br>

<input type="radio" id="linkedin" name="sc_icon" value="linkedin">
<label for="linkedin"><i class="fa fa-linkedin"></i></label><br>


</div>
<div class="col-md-6">
<input type="radio" id="snapchat" name="sc_icon" value="snapchat">
<label for="snapchat"><i class="fa fa-snapchat"></i></label><br>

<input type="radio" id="reddit" name="sc_icon" value="reddit">
<label for="reddit"><i class="fa fa-reddit"></i></label><br>

<input type="radio" id="foursquare" name="sc_icon" value="foursquare">
<label for="foursquare"><i class="fa fa-foursquare"></i></label><br>

<input type="radio" id="deviantart" name="sc_icon" value="deviantart">
<label for="deviantart"><i class="fa fa-deviantart"></i></label><br>

<input type="radio" id="amazon" name="sc_icon" value="amazon">
<label for="amazon"><i class="fa fa-amazon"></i></label><br>
<input type="radio" id="tripadvisor" name="sc_icon" value="tripadvisor">
<label for="tripadvisor"><i class="fa fa-tripadvisor"></i></label><br>

<input type="radio" id="pinterest-p" name="sc_icon" value="pinterest-p">
<label for="pinterest-p"><i class="fa fa-pinterest-p"></i></label><br>
</div>
</div>
</div>
</div>



<div class="col-md-6">
<div class="form-group">
<label class="control-label">Hesap Başlığı</label><br>
<input type="text" class="form-control" name="sc_baslik">
<small class="form-control-feedback">Örneğin: Facebook</small>
</div>
<div class="form-group">
<label class="control-label">Hesap Linki</label><br>
<input type="text" class="form-control" name="sc_link">
<small class="form-control-feedback">Örneğin: https://instagram.com/nasa</small>
</div>

<?php if($kontrol_kullanici_yetki == "1"){?>
<button class="btn btn-warning waves-effect " type="submit"><span class="btn-label"><i class="fa fa-plus"></i></span>Ekle</button>
<?php }else{echo '<a class="btn btn-warning waves-effect text-white" type="submit" data-toggle="modal" data-target="#uyari-modal"><span class="btn-label"><i class="fa fa-plus"></i></span>Ekle</a>'; }?>
				

</form>

</div>

</div>
</div>


</div>
            
</div>

</div>
				
			
</div>
		
<?php ##--> Sosyal Medya Modülü ?>
						




	</div>
	</div>
             
	</div>
           
<?php
include ("alt.php");
}
?>