<?php
$path="../../";
include("../../map.php");
include("../../secure.php");
if($_GET["cmd"]==""){
	include("../../scripts.php");
	?>
	<meta http-equiv="Content-Type" content="text/HTML; charset=utf-8" />
	<script type="text/javascript" src="//cdn.<?php echo $cdnurl?>/js/wpanel.js" lang="<?php echo $sdil[150];?>" id="wjs" url="<?php echo $_SERVER['SERVER_NAME'];?>" pow="<?php echo $pow1?>" ver="<?php echo $pow2?>"></script>
	<div class="panel panel-primary">
		<div class="panel-heading">Seo <?php echo $sdil[213]; //işlemler?> <span style="float:right;"><?php echo $_GET["ne"]?></div>
			
			<form action="?modul=<?php echo $_GET["modul"]?>&ne=<?php echo $_GET["ne"]?>&cmd=isle" method="post" class="panel-body">
				<select class="form-control" onChange="self.location.href=this.options[this.selectedIndex].value;">
					<option value="?">Seçiniz</option>
					<option value="?modul=kategori&ne=ukategori" <?php if($_GET["ne"]=="ukategori"){echo "selected";}?>>Ürün Kategori</option>
					<option value="?modul=<?php echo $_SESSION["lang"]?>&ne=kayit" style="color:red" <?php if($_GET["ne"]=="kayit" and $_GET["s9"]==""){echo "selected";}?>><b>Tüm Ürünler</b></option>
					<?php $sqlx=mysqli_query($conn, "select * from kategoriler where ne='ukategori' order by sira asc"); 	while($rsx=mysqli_fetch_assoc($sqlx)){?>
						<option value="?modul=<?php echo $_SESSION["lang"]?>&ne=kayit&s9=<?php echo $rsx["Cat_ID"];?>" style="color:orange" <?php if($_GET["ne"]=="kayit" and $_GET["s9"]==$rsx["Cat_ID"]){echo "selected";}?>><?php echo $rsx["Cat_".$_SESSION['lang'].""];?> Ürünleri</option>
					<?php }?>
					<option value="?modul=<?php echo $_SESSION["lang"]?>&ne=sayfa" <?php if($_GET["ne"]=="sayfa"){echo "selected";}?>><b>Tüm Sayfalar</b></option>
					<option value="?modul=<?php echo $_SESSION["lang"]?>&ne=haber" <?php if($_GET["ne"]=="haber"){echo "selected";}?>><b>Tüm Bloglar</b></option>
					<option value="?modul=<?php echo $_SESSION["lang"]?>&ne=msayfa" <?php if($_GET["ne"]=="msayfa"){echo "selected";}?>><b>Tüm Projeler</b></option>
				</select>
				<input name="t1" type="text" placeholder="Başlık" value="" class="form-control" <?php if($_GET["ne"]==""){echo "Disabled";}?>>
				<input name="n3" type="text" placeholder="Seo Başlık" value="" class="form-control" <?php if($_GET["ne"]==""){echo "Disabled";}?>>
				<textarea name="n4" type="text" placeholder="Keywords" class="form-control" <?php if($_GET["ne"]==""){echo "Disabled";}?>></textarea>
				<textarea name="n2" type="text" placeholder="Description" class="form-control" <?php if($_GET["ne"]==""){echo "Disabled";}?>></textarea>
				<button class="btn btn-success" type="submit" style="float:right" <?php if($_GET["ne"]==""){echo "Disabled";}?>>Güncelle</button>
			</form>
<!--
<span>{urunadi}</span>
<span>{urunanahtar}</span>
<span>{urunaciklama}</span>
-->
<span>{sitebaslik}</span>
<span>{siteanahtar}</span>
<span>{siteaciklama}</span>
<span>{firma}</span>
</div>
<?php
}elseif($_GET["cmd"]<>""){
	if($_GET["s9"]<>""){ $sorgu="and s9='".$_GET["s9"]."'"; }
	function gseo($str){
		$sqlset=mysqli_query($conn, "select * from ".$_SESSION["lang"]." where ne='ayarlar'"); $set=mysqli_fetch_assoc($sqlset);
		global $title;
		global $description; //çalışmadı
		global $keywords; //çalışmadı
		global $firma;
		$str = str_replace('{sitebaslik}', $title, $str);
		$str = str_replace('{siteanahtar}', $set["n4"], $str);
		$str = str_replace('{siteaciklama}', $set["n2"], $str);
		$str = str_replace('{firma}', $firma, $str);
		return $str;
	}
	$sql=mysqli_query($conn, "select * from ".$_GET["modul"]." where ne='".$_GET["ne"]."' ".$sorgu.""); while($rs=mysqli_fetch_assoc($sql)){
		echo gseo($_POST["t1"]);
		if($_POST["t1"]<>""){
			$Sqlu = mysqli_query($conn, "update ".$_GET["modul"]." set t1='".addslashes(stripslashes(gseo($_POST["t1"])))."' where id=".$rs["id"]."");
		}
		if($_POST["n2"]<>""){
			$Sqlu = mysqli_query($conn, "update ".$_GET["modul"]." set n2='".addslashes(stripslashes(gseo($_POST["n2"])))."' where id=".$rs["id"]."");
		}
		if($_POST["n3"]<>""){
			$Sqlu = mysqli_query($conn, "update ".$_GET["modul"]." set n3='".addslashes(stripslashes(gseo($_POST["n3"])))."' where id=".$rs["id"]."");
		}
		if($_POST["n4"]<>""){
			$Sqlu = mysqli_query($conn, "update ".$_GET["modul"]." set n4='".addslashes(stripslashes(gseo($_POST["n4"])))."' where id=".$rs["id"]."");
		}
	}
}	
?>