<?php ob_start();?>
<?php
$path="../../";
include("../../map.php");
include("../../scripts.php");
$sql=mysqli_query($conn, "select * from kategoriler where Cat_ID=".$_GET["Cat_ID"].""); $rs=mysqli_fetch_assoc($sql);
$jsi = json_decode($rs["n6"], true); $jsm = json_decode($rs["n7"], true); $jslf = json_decode($rs["n1"],true);
$ne = $_GET["ne"] ?? '';
$c = $_GET["c"] ?? '';
$islem = $_GET["islem"] ?? '';
$mapping = [ "kayit"  => ["q" => "u", "climit" => $a4], "sayfa"  => ["q" => "s", "climit" => $d10], "haber"  => ["q" => "h", "climit" => $b1], "msayfa" => ["q" => "m", "climit" => $g7], "marka"  => ["q" => "n", "climit" => 5], "uye"    => ["q" => "k", "climit" => 3], "reklam" => ["q" => "r", "climit" => 3], "forum"  => ["q" => "f"] ];

if(isset($mapping[$ne])){
    $q = $mapping[$ne]["q"];
    $climit = $mapping[$ne]["climit"];
    
    // Özel durum: kayit
    if($ne === "kayit" && ($c !== "" || $islem === "kategori")){
        $w = "x";
    }
}else{
    $q = substr($ne,0,1);
    $climit = $module["d10_".$ne] ?? null;
}
$ne=$_GET["ne"];
$islem=$_GET["islem"];
$Cat_ID=$_GET["Cat_ID"];

if(isset($rs['n1_lang1'])){
	$clang="_".$_SESSION["lang"]."";
}

if(($_SESSION["kim"]=="Admin") or ($_SESSION["kim"]=="yonetici" and $_SESSION["y9"]==3)){
	if (($e10==1 and $_SESSION["user"]<>V3d('TWFzdGVy'))) {
		$yetki=0;
	}else{
		$yetki=1;
	}
}else{
	$yetki=0;
}
?>
<style>
	.chosen-container {width:99% !important;float: left;}
	.c0 	{color: red; font-weight: bold;}
	.c1 	{color: orange; font-weight: bold;}
	.c2 	{color: #f5d719; font-weight: bold;}
	.c3 	{color: green; font-weight: bold;}
	.c4 	{color: blue; font-weight: bold;}
	.c5 	{color: black; font-weight: bold;}	
	.c6 	{color: grey; font-weight: bold;}	
	.col-md-12 	{margin-bottom:5px; min-height: 34px !important;}	
	.form-control {font-weight:100;}
</style>
<?php if($_GET["durum"]=="ok"){?>
	<div class="alert alert-success" role="alert" style="padding:5px;">
		<?php echo $sdil[212]; //islem Basariyla Gerçeklestirilmistir !?>
	</div>
<?php }elseif($_GET["durum"]=="hata"){?>
	<div class="alert alert-danger" role="alert">
		...
	</div>
<?php }?>
<form name="frm" class="col-md-12" enctype="multipart/form-data" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $_GET["id"];?>&Cat_ID=<?php echo $_GET["Cat_ID"];?>&c=<?php echo $_GET["c"];?>&durum=kaydet" method="post">
		<input type="hidden" name="nedir" value="<?php if($_GET["nedir"]<>""){echo $_GET["nedir"];}else{echo $rs["ne"];}?>" />
		<input type="hidden" name="c1" value="<?php if($_GET["c1"]<>""){echo $_GET["c1"];}else{echo $rs["c1"];}?>" />
		<input type="hidden" name="c2" value="<?php if($_GET["c2"]<>""){echo $_GET["c2"];}else{echo $rs["c2"];}?>" />
		<input type="hidden" name="s3" value="<?php if($_GET["s3"]<>""){echo $_GET["s3"];}else{echo $rs["s3"];}?>" />
		<input type="hidden" name="s4" value="<?php if($_GET["s4"]<>""){echo $_GET["s4"];}else{echo $rs["s4"];}?>" />
		<input type="hidden" name="s5" value="<?php if($_GET["s5"]<>""){echo $_GET["s5"];}else{echo $rs["s5"];}?>" />
	<ul class="nav nav-tabs" role="tablist">
		<li role="presentation" class="active"><a href="#tb1" aria-controls="tb1" role="tab" data-toggle="tab">#<?php echo $rs["Cat_ID"];?> <?php echo $rs["Cat_".$_SESSION['lang'].""];?></a></li>
		<li role="presentation" class=""><a href="#tb2" aria-controls="tb2" role="tab" data-toggle="tab">Detay & Seo</a></li>
		<li role="presentation" class=""><a href="#tb3" aria-controls="tb3" role="tab" data-toggle="tab">Extra</a></li>
		<?php $sqld=mysqli_query($conn, "select * from genel where ne='tanim' and t2='sp' order by t2,n4 asc"); while($rsd=mysqli_fetch_assoc($sqld)){?>
			<li role="presentation" class=""><a href="#tb<?php echo $rsd["id"];?>" aria-controls="tb<?php echo $rsd["id"];?>" role="tab" data-toggle="tab"><?php echo ihb($rsd["n4"]);?></a></li>
		<?php }?>
		<select size=1 name="s9" style="width: 200px; float: right; margin-top: 5px; background: whitesmoke;" class="form-control e">
			<option value="0">Admin</option>
			<?php $sqlm=mysqli_query($conn, "select * from t5 where s9=1"); while($rsm=mysqli_fetch_assoc($sqlm)){?>
			<option value="<?php echo $rsm["id"];?>" title="<?php echo $rsm["t1"];?>" alt="<?php echo $rsm["t1"];?>" style="color:#6699FF" <?php if (($rs["s9"]=="" and $rsm["id"]==$_SESSION["user_id"]) or ($rs["s9"]<>"" and $rsm["id"]==$rs["s9"])) {?>Selected<?php }?>><?php echo ihb($rsm["t1"]);?></option>
			<?php }?>
		</select>
	</ul>
	<div class="tab-content">
		<div role="tabpanel" class="tab-pane active" id="tb1">
			<div class="row" style="margin-top:15px;">
				<div class="col-sm-6 col-xs-12"><label>Kategori Adı</label><input type="text" name="cat" class="form-control" value="<?php if($jslf["lang1"]<>"" and $module["ajax_categories"]<>""){echo $jslf["lang1"];}else{echo $rs["Cat_".$_SESSION['lang'].""];}?>" placeholder="<?php echo $rs["Cat_lang1"];?>" style=""/></div>
				<div class="col-sm-2 col-xs-6"><label>Kategori ID</label><input type="text" name="t4" value="<?php if($rs["t4"]==""){echo i2a($rs["Cat_ID"],7);}else{echo $rs["t4"];}?>" style="" class="form-control" placeholde="ID"/></div>
				<div class="col-sm-2 col-xs-6"><label>Sıra</label><input type="text" name="sira" value="<?php echo $rs["sira"];?>" style="" class="form-control"/></div>
				<div class="col-sm-1 col-xs-6"><label>Vitrin</label><input type="checkbox" name="s2" value="1" title="s2 Vitrin" class="form-control with-tip notoggle" style="width: 24px; height: 24px;" <?php if($rs["s2"]==1){echo "Checked";}?>></div>
				<div class="col-sm-1 col-xs-6 msa"><label>Silinmez</label><input type="checkbox" name="s6" value="1" class="form-control with-tip notoggle" style="width: 24px; height: 24px;" <?php if($rs["s6"]<>0){echo "Checked";}?> title="Silinemez!"></div>	
			</div>
		</div>
		<div role="tabpanel" class="tab-pane" id="tb2">
			<div class="row">
				
				<div class="col-xs-12" style="margin-top:10px;">
					<input type="text" style="" name="n3" class="form-control" title="n3" value="<?php echo $rs["n3"];?>" placeholder="<?php echo $sdil[39]; //Title?>" />
				</div>
				<div class="col-xs-12" style="margin-top:10px;">
					<textarea style="height:60px;" class="form-control" name="n2" title="n2" placeholder="<?php echo ctranslate("Kısa Açıklama")?>"><?php echo $rs["n2"];?></textarea>
				</div>
				<div class="col-xs-12" style="margin-top:10px;">
					<input id="input-tags" data_role="tagsinput" style="height:60px;" class="form-control" name="n4" title="n4" placeholder="<?php echo $sdil[41]; //Etiket?>" value="<?php echo $rs["n4"];?>">
				</div>
				<div class="col-xs-12" style="margin-top:10px;">
					
				</div>
				<div class="col-xs-8" style="margin-top:10px;">
					<input type="text" list="ln5" name="n5" id="n5" style="" class="form-control" value="<?php echo $rs["n5"];?>" placeholder="http://www.">
					<datalist id="ln5" style="display: none;"></datalist>
				</div>
				<div class="col-xs-4">
					<select size="1" name="t6" style="margin-top:10px;" class="form-control">
						<option value="<?php echo $rs["t6"];?>"> <?php if($rs["t6"]==""){echo "Target";}else{echo $rs["t6"];}?> </option>
						<option value="_self" >_self</option>
						<option value="_blank" >_blank</option>
						<option value="_top" >_top</option>
					</select>
				</div>
				<div style="clear:both;"></div>
				<div class="col-xs-12" style="margin-top:10px; <?php //if($module["m5_".$_GET["ne"].""]<>""){echo "display:none;";}?>">
					<input type="text" style="" list="lmaddeli" name="n8" class="form-control" title="n8" value="<?php echo $rs["n8"];?>" placeholder="Maddeli İçerik" />
					<datalist id="lmaddeli"><option>baslik:madde1,madde2+baslik2:madde21,madde22</option></datalist>
				</div>
				<div style="clear:both;"></div>
<!--
				<div class="col-xs-6">
					<?php if(empty($rs["image"])){?>
					<input type="checkbox" class="" name="r1" value="ON" style="display:none;" alt="Resim Var/Yok" title="Resim Var/Yok">
					<input class="form-control" type="file" name="resim" style="" onchange="document.frm.r1.checked=true;" accept="*" style="margin-top:10px;">
					<?php }elseif(!empty($rs["image"])){?>
						<div style="clear:both;"></div>
						<a href="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&Cat_ID=<?php echo $_GET["Cat_ID"];?>&durum=rsil" style="position: absolute; margin-top: 45px; margin-left: 10px; background: white; padding: 2px; border-radius: 2px; filter: drop-shadow(2px 4px 6px black);"><i class="fa fa-times"></i></a>
						<?php if(uzanti($rs["image"],"tip")=="resim"){?>
						<img src="../../../deppo/kategori/<?php echo $rs["image"];?>" style="margin-left:5px; height:65px;">
						<?php }else{?>
						<img src="../../<?php echo uzanti($rs["image"],"gorsel")?>" style="margin-left:5px; height:65px;">
						<?php }?>
					<?php }?>
				</div>
				<div class="col-xs-6">
					<?php if(empty($rs["image2"])){?>
					<input type="checkbox" class="" name="r2" value="ON" style="display:none;" alt="Resim Var/Yok" title="Resim Var/Yok">
					<input class="form-control" type="file" name="resim2" style="" onchange="document.frm.r1.checked=true;" accept="*" style="margin-top:10px;">
					<?php }elseif(!empty($rs["image2"])){?>
						<div style="clear:both;"></div>
						<a href="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&Cat_ID=<?php echo $_GET["Cat_ID"];?>&durum=rsil2" style="position: absolute; margin-top: 45px; margin-left: 10px; background: white; padding: 2px; border-radius: 2px; filter: drop-shadow(2px 4px 6px black);"><i class="fa fa-times"></i></a>
						<?php if(uzanti($rs["image2"],"tip")=="resim"){?>
						<img src="../../../deppo/kategori/<?php echo $rs["image2"];?>" style="margin-left:5px; height:65px;">
						<?php }else{?>
						<img src="../../<?php echo uzanti($rs["image2"],"gorsel")?>" style="margin-left:5px; height:65px;">
						<?php }?>
					<?php }?>
				</div>
-->
				<div class="col-xs-12 mt15">
					<button style="margin-top:15px; margin-bottom:15px;" type="button" class="mb-1 mt-1 mr-1 btn btn-success mfrm" data-toggle="modal" data-ajax="mresim" data-width="50%" data-target="#myModal" data-ref="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $_GET["id"];?>&Cat_ID=<?php echo $_GET["Cat_ID"];?>" data-url="<?php echo $weburl."/".$crmpath."/"?>modules/upload/upload_image.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $_GET["id"]; ?>"><strong><i class="fa fa-cloud-upload" aria-hidden="true"></i> Resim Ekle</strong></button>
					<script type="text/JavaScript" language="JavaScript">
						jQuery(document).ready(function(){
							loadFunction('../ajax/ajax_medya.php','#mresim', 'resim');
						});
						document.write("<div id=\"mresim\" class=\"medias mt15\" style=\"width:100%\"></div>");
					</script>
				</div>
<!--
				<div class="col-xs-12">
					<div class="gs crm_info" data-info="Sayfanın arama motorlarında arandığında, nasıl gözükeceği simülasyonu">
						<ul style="list-style: none; padding: 0px 15px 15px; 15px;">
							<li id="gs_url" style="color: #0d6621; font-size: 14px;" data-url="<?php echo $weburl;?><?php echo linked($_GET["ne"][0],$_GET["Cat_ID"]);?>"><?php echo $weburl;?><?php echo linked($_GET["ne"][0],$_GET["Cat_ID"]);?></li>
							<li id="gs_title" style="color: #1a0dab; font-size: 18px;"><?php echo meta($_GET["ne"][0],$_GET["Cat_ID"]); ?></li>
							<li id="gs_desc" style="color: #545454; font-size: 14px;"><?php if($rs["n2"]<>""){echo rlang($rs["n2"]);}else{echo ctranslate("Lütfen kısa açıklama giriniz");}?></li>
						</ul>
					</div>
				</div>
				<script>
				jQuery('#n3').keyup(function(e){
					var n3 = jQuery('#n3').val();
					var url = jQuery('#gs_url').attr("data-url");
					if(n3!=""){
						jQuery('#gs_title').html(n3+' ');
					<?php if($module["fseo"]==0){?>
						jQuery('#gs_url').html('<?php echo $weburl;?>?<?php echo $_GET["ne"][0]?><?php echo $_GET["id"]?>/'+cevir(n3)+'');
					<?php }elseif($module["fseo"]==2){?>
						jQuery('#gs_url').html('<?php echo $weburl;?>/'+cevir(n3)+'');
					<?php }?>
					}else{
						jQuery('#gs_title').html('<?php echo meta($_GET["ne"][0],$rs["id"]); ?>');
						jQuery('#gs_url').html(url);
					}
				});
				jQuery('#n2').keyup(function(e){
					var n2 = jQuery('#n2').val();
					if(n2!=""){
						jQuery('#gs_desc').html(n2);
					}else{
						jQuery('#gs_desc').html('<?php echo ctranslate("Lütfen kısa açıklama giriniz");?>');
					}
				});
				jQuery('#n5').keyup(function(e){
					var n5 = jQuery('#n5').val();
					var url = jQuery('#gs_url').attr("data-url");
					if(n5!=""){
						jQuery('#gs_url').html(n5);
					}else{
						jQuery('#gs_url').html(url);
					}
				});
			</script>
-->
			</div>
		</div>
		<div role="tabpanel" class="tab-pane" id="tb3">
			<div class="row">
				<div class="col-xs-12" style="margin-top:10px;">
					<?php
					$i=0;$sqli=mysqli_query($conn, "select * from genel where ne='inputs' and (t2='All' or t2='".$_SESSION["lang"]."') and n3='kategori' and n4<>'switch' and (n2='0' or n2='".$rs["Cat_ID"]."') and s1=0 order by s10 asc");
					if(mysqli_num_rows($sqli)>0){
						?>
						<div class="">
							<div class="row">
								<?php while($rsi=mysqli_fetch_assoc($sqli)){$i++;?>
									<div class="col-xs-4 col-md-4" style="">
										<label><i class="<?php echo $rsi["n14"]?>"></i> <?php echo $rsi["n1"];?> <span style="font-size:8px; color:#ccc;"> (i<?php echo $i;?>)</span></label>
										<?php if($rsi["n4"]=="input"){?>
											<input class="form-control <?php echo $rsi["n13"]?>" type="<?php echo $rsi["n5"]?>" name="i<?php echo $i;?>" value="<?php echo $jsi["i".$i.""];?>" placeholder="<?php echo $rsi["n11"]?>" style="" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>>
										<?php }elseif($rsi["n4"]=="textarea"){?>
											<textarea class="form-control <?php echo $rsi["n13"]?>" name="i<?php echo $i;?>" placeholder="<?php echo $rsi["n11"]?>" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>><?php echo $jsi["i".$i.""];?></textarea>
										<?php }elseif($rsi["n4"]=="select"){?>
											<select class="form-control <?php echo $rsi["n13"]?> chosen-select" name="i<?php echo $i;?>[]" style="" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>>
												<option value=""><?php echo $sdil[221]; //Lütfen Seçiniz?></option>
												<?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
													<option value="<?php echo $rso["n2"]?>" <?php $q="";foreach($jsi["i".$i.""] as $q){?><?php if($q==$rso["n2"] or $rso["n3"]==1){echo "selected";}}?>><?php echo $rso["n1"]?></option>
												<?php }?>
											</select>
										<?php }elseif($rsi["n4"]=="radio"){?>
											<?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and t2='".$_SESSION["lang"]."' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
												<div style="float:left; margin-right: 5px;">
													<label style="float:left; margin-right:5px;"><?php echo $rso["n1"];?>
													<input type="radio" name="i<?php echo $i;?>" value="<?php echo $rso["n2"];?>" <?php echo $rsi["n8"]?> <?php if($jsi["i".$i.""]==$rso["n2"] or $rso["n3"]==1){echo "checked";}?>></label>
												</div>
											<?php }?>
										<?php }elseif($rsi["n4"]=="checkbox"){?>
											<?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and t2='".$_SESSION["lang"]."' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
												<div style="float:left; margin-right: 5px;">
													<label style="float:left; margin-right:5px;"><?php echo $rso["n1"];?>
													<input type="checkbox" name="i<?php echo $i;?>[]" value="<?php echo $rso["n2"];?>" <?php echo $rsi["n8"]?> <?php foreach($jsi["i".$i.""] as $q){?><?php if($q==$rso["n2"] or $rso["n3"]==1){echo "checked";}?><?php }?>></label>
												</div>
											<?php }?>
										<?php }?>
										<p style="font-size:10px;"><?php echo $rsi["n9"];?></p>
									</div>
								<?php }?>
							</div>
						</div>
					<?php }?>
				</div>
				<?php if($module["areas"]=="2"){?>
					<div class="col-xs-12 col-md-12" style="">
						<fieldset class="grey-bg" style="height: 150px;">
						<label style="display:block; width:100%;"><?php echo ctranslate("Bölgeler")?></b> <span style="font-size:8px; color:#ccc;">(n11)</span></label>
							<select name="areas[]" data-placeholder="<?php echo ctranslate("Seçiniz")?>" multiple="multiple" class="form-control chosen-select" tabindex="8" style="clear:both;">
								<?php $areas_ = explode(',',$rs["n11"]); $sqla=mysqli_query($conn, "select * from genel where ne='areas' order by id asc"); while($areas=mysqli_fetch_assoc($sqla)){?>
								<option value="<?php echo $areas["id"]?>" <?php foreach($areas_ as $area_) {?><?php if($areas["id"]==$area_){?>Selected<?php }}?>><?php echo loc($areas["n2"])?> <?php if($areas["n3"]<>""){echo "> ".loc($areas["n3"])."";}?> <?php if($areas["n4"]<>""){echo "> ".loc($areas["n4"])."";}?></option>
								<?php }?>
							</select>
						</fieldset>
					</div>
				<?php }?>
				<?php $sqlsp=mysqli_query($conn, "select * from genel where ne='tanim' and t2='sp' order by t2,n4 asc"); while($rsp=mysqli_fetch_assoc($sqlsp)){?>
					<fieldset class="grey-bg v3-col-md-3" style="float: left;">
						<label> <?php echo $rsp["n4"];?> % <span style="font-size:8px; color:#ccc;    float: right;">(ip<?php echo cevir($rsp["n4"]);?>)</span> </label>
						<div class="v3-col-md-6 v3-col-xs-6 pd0">
							<input type="text" class="form-control digi fs16 repdot" name="ip<?php echo cevir($rsp["n4"]);?>"  value="<?php echo $jsi["ip".cevir($rsp["n4"]).""];?>" placeholder="%" class="form-control" style="" onfocus="if(this.value == '0') { this.value = ''} "  onblur="if(this.value == '') { this.value='0'; }">
						</div>
					</fieldset>
				<?php }?>
					<fieldset class="grey-bg v3-col-md-3 <?php if($h3<>1){echo "dn";} //c2c ise?>">
						<label> Komisyon % <span style="font-size:8px; color:#ccc; float: right;">(ikomisyon)</span> </label>
						<div class="v3-col-md-6 v3-col-xs-6 pd0">
							<input type="text" class="form-control digi fs16 repdot" name="ikomisyon"  value="<?php echo $jsi["ikomisyon"];?>" placeholder="%" class="form-control" style="" onfocus="if(this.value == '0') { this.value = ''} "  onblur="if(this.value == '') { this.value='0'; }">
						</div>
					</fieldset>
			</div>
		</div>
		<?php $sqld=mysqli_query($conn, "select * from genel where ne='tanim' and t2='sp' order by t2,n4 asc"); while($rsd=mysqli_fetch_assoc($sqld)){?>
			<div role="tabpanel" class="tab-pane" id="tb<?php echo $rsd["id"];?>" style="margin-top:30px;">
				<?php if($rsd["n4"]=="trendyol"){?>
						<a href="#" onclick="jQuery('#loader').load('<?php echo $weburl?>/sanalpazar/trendyol/categories.php?download=true');" class="btn btn-warning fas fa-download" style="position: absolute; margin-top: -67px; right: 16%; z-index: 99999; font-size: 20px; padding: 7px;"></a>
						<select name="ictrendyol" id="ictrendyol" class="form-control chosen-select" style="">
						<option value="0">Lütfen Seçiniz</option>
						<?php
							$categories = file_get_contents(__DIR__.'/../../../sanalpazar/trendyol/categories.json');
							$categories = json_decode($categories, true);
							foreach($categories[categories] as $item1){
								foreach($item1[subCategories] as $item2){
									foreach($item2[subCategories] as $item3){
									foreach($item3[subCategories] as $item4){
										if($item4<>""){
										?>
											<option value="<?php echo $item4[id]?>" <?php if($jsi["ictrendyol"]==$item4[id]){echo "Selected";}?>><?php echo $item1[name]?> > <?php echo $item2[name]?> > <?php echo $item3[name]?> > <?php echo $item4[name]?></option>
										<?php }elseif($item3<>""){
											?>
											<option value="<?php echo $item3[id]?>" <?php if($jsi["ictrendyol"]==$item3[id]){echo "Selected";}?>><?php echo $item1[name]?> > <?php echo $item2[name]?> > <?php echo $item3[name]?></option>
										<?php }else{ ?>
											<option value="<?php echo $item2[id]?>" <?php if($jsi["ictrendyol"]==$item2[id]){echo "Selected";}?>><?php echo $item1[name]?> > <?php echo $item2[name]?></option>
										<?php
											}
										}
									}
								}
							}
						?>
						</select>
				<?php }elseif($rsd["n4"]=="n11"){?>
					<select name="imcn11" id="imcn11" class="form-control" style="width:33%; float:left;"><option value="0">Lütfen Bekleyiniz</option></select>
					<select name="iscn11" id="iscn11" class="form-control" style="width:33%; float:left;"><option value="0">Lütfen Bekleyiniz</option></select>
					<select name="icn11" id="icn11" class="form-control" style="width:33%; float:left;"><option value="0">Lütfen Bekleyiniz</option></select>
					<script type="text/javascript">
						jQuery(document).ready(function() {
							jQuery('#imcn11').load('../../../sanalpazar/n11/categories.php?ne=GetTopLevelCategories&sID=<?php echo $jsi["imcn11"]?>');
						<?php if($jsi["iscn11"]<>""){?>
							jQuery('#iscn11').load('../../../sanalpazar/n11/categories.php?ne=GetSubCategories&sID=<?php echo $jsi["iscn11"]?>&ID=<?php echo $jsi["imcn11"]?>');
						<?php }?>
						<?php if($jsi["icn11"]<>""){?>
							jQuery('#icn11').load('../../../sanalpazar/n11/categories.php?ne=GetSub2Categories&sID=<?php echo $jsi["icn11"]?>&ID=<?php echo $jsi["iscn11"]?>');
						<?php }?>
						});
						jQuery('#imcn11').on('change', function(){
							var ID = jQuery('#imcn11 option:selected').attr('ID');
							jQuery('#iscn11').load('../../../sanalpazar/n11/categories.php?ne=GetSubCategories&sID=<?php echo $jsi["iscn11"]?>&ID='+ID);
						});
						jQuery('#iscn11').on('change', function(){
							var ID = jQuery('#iscn11 option:selected').attr('ID');
							jQuery('#icn11').load('../../../sanalpazar/n11/categories.php?ne=GetSub1Categories&sID=<?php echo $jsi["icn11"]?>&ID='+ID);
						})
					</script>
				<?php }elseif($rsd["n4"]=="gittigidiyor"){?>
					<a href="#" onclick="jQuery('#loader').load('<?php echo $weburl?>/sanalpazar/gittigidiyor/categories.php?download=true');" class="btn btn-warning fas fa-download" style="position: absolute; margin-top: -67px; right: 16%; z-index: 99999; font-size: 20px; padding: 7px;"></a>
					<select name="ixcgittigidiyor" id="ixcgittigidiyor" class="form-control w20 fl"><option value="0">Lütfen Bekleyiniz</option></select>
					<select name="iycgittigidiyor" id="iycgittigidiyor" class="form-control w20 fl"><option value="0">Lütfen Bekleyiniz</option></select>
					<select name="izcgittigidiyor" id="izcgittigidiyor" class="form-control w20 fl"><option value="0">Lütfen Bekleyiniz</option></select>
					<select name="iscgittigidiyor" id="iscgittigidiyor" class="form-control w20 fl"><option value="0">Lütfen Bekleyiniz</option></select>
					<select name="icgittigidiyor" id="icgittigidiyor" class="form-control w20 fl"><option value="0">Lütfen Bekleyiniz</option></select>
					<script type="text/javascript">
						jQuery(document).ready(function() {
							jQuery('#ixcgittigidiyor').load('../../../sanalpazar/gittigidiyor/categories.php?ne=grupa&sID=<?php echo $jsi["ixcgittigidiyor"]?>');
						<?php if($jsi["iycgittigidiyor"]<>""){?>
							jQuery('#iycgittigidiyor').load('../../../sanalpazar/gittigidiyor/categories.php?ne=grupab&sID=<?php echo $jsi["iycgittigidiyor"]?>&ID=<?php echo $jsi["imcgittigidiyor"]?>');
						<?php }?>
						<?php if($jsi["izcgittigidiyor"]<>""){?>
							jQuery('#izcgittigidiyor').load('../../../sanalpazar/gittigidiyor/categories.php?ne=grupabc&sID=<?php echo $jsi["izcgittigidiyor"]?>&ID=<?php echo $jsi["imcgittigidiyor"]?>');
						<?php }?>
						<?php if($jsi["iscgittigidiyor"]<>""){?>
							jQuery('#iscgittigidiyor').load('../../../sanalpazar/gittigidiyor/categories.php?ne=grupabcd&sID=<?php echo $jsi["iscgittigidiyor"]?>&ID=<?php echo $jsi["imcgittigidiyor"]?>');
						<?php }?>
						<?php if($jsi["icgittigidiyor"]<>""){?>
							jQuery('#icgittigidiyor').load('../../../sanalpazar/gittigidiyor/categories.php?ne=grupabcde&sID=<?php echo $jsi["icgittigidiyor"]?>&ID=<?php echo $jsi["iscgittigidiyor"]?>');
						<?php }?>
						});
						jQuery('#ixcgittigidiyor').on('change', function(){
							var ID = jQuery('#ixcgittigidiyor option:selected').attr('ID');
							jQuery('#iycgittigidiyor').load('../../../sanalpazar/gittigidiyor/categories.php?ne=grupab&sID=<?php echo $jsi["iycgittigidiyor"]?>&ID='+ID);
						});
						jQuery('#iycgittigidiyor').on('change', function(){
							var ID = jQuery('#iycgittigidiyor option:selected').attr('ID');
							jQuery('#izcgittigidiyor').load('../../../sanalpazar/gittigidiyor/categories.php?ne=grupabc&sID=<?php echo $jsi["izcgittigidiyor"]?>&ID='+ID);
						});
						jQuery('#izcgittigidiyor').on('change', function(){
							var ID = jQuery('#izcgittigidiyor option:selected').attr('ID');
							jQuery('#iscgittigidiyor').load('../../../sanalpazar/gittigidiyor/categories.php?ne=grupabcd&sID=<?php echo $jsi["iscgittigidiyor"]?>&ID='+ID);
						});
						jQuery('#iscgittigidiyor').on('change', function(){
							var ID = jQuery('#iscgittigidiyor option:selected').attr('ID');
							jQuery('#icgittigidiyor').load('../../../sanalpazar/gittigidiyor/categories.php?ne=grupabcde&sID=<?php echo $jsi["icgittigidiyor"]?>&ID='+ID);
						})
					</script>
					<?php }elseif($rsd["n4"]=="hepsiburada"){?>
						<a href="#" onclick="jQuery('#loader').load('<?php echo $weburl?>/sanalpazar/hepsiburada/categories.php?download=true');" class="btn btn-warning fas fa-download" style="position: absolute; margin-top: -67px; right: 16%; z-index: 99999; font-size: 20px; padding: 7px;"></a>
						<select name="ichepsiburada" id="ichepsiburada" class="form-control chosen-select" style="">
						<option value="0">Lütfen Seçiniz</option>
						<?php
						$categories = file_get_contents(__DIR__.'/../../../sanalpazar/hepsiburada/categories.json');
						$categories = json_decode($categories, true);
						foreach($categories["data"] as $item1){?>
						<option value="<?php echo $item1["categoryId"]?>" <?php if($jsi["ichepsiburada"]==$item1["categoryId"]){echo "Selected";}?>><?php if($item1["paths"][0]<>""){echo $item1["paths"][0]." > ";}?> <?php if($item1["paths"][1]<>""){echo $item1["paths"][1]." > ";}?> <?php //if($item1["paths"][2]<>""){echo $item1["paths"][2]." > ";}?> <?php //if($item1["paths"][3]<>""){echo $item1["paths"][3]." > ";}?> <?php echo $item1["name"]?></option>
						<?php }?>
						</select>
					<?php }elseif($rsd["n4"]=="amazon"){?>
						<a href="#" onclick="jQuery('#loader').load('<?php echo $weburl?>/sanalpazar/amazon/categories.php?download=true');" class="btn btn-warning fas fa-download" style="position: absolute; margin-top: -67px; right: 16%; z-index: 99999; font-size: 20px; padding: 7px;"></a>
						<select name="ichepsiburada" id="icamazon" class="form-control chosen-select" style="">
						<option value="0">Lütfen Seçiniz</option>
						<?php
						$categories = file_get_contents(__DIR__.'/../../../sanalpazar/amazon/categories.json');
						$categories = json_decode($categories, true);
						foreach($categories["data"] as $item1){?>
						<option value="<?php echo $item1["categoryId"]?>" <?php if($jsi["icamazon"]==$item1["categoryId"]){echo "Selected";}?>><?php if($item1["paths"][0]<>""){echo $item1["paths"][0]." > ";}?> <?php if($item1["paths"][1]<>""){echo $item1["paths"][1]." > ";}?> <?php //if($item1["paths"][2]<>""){echo $item1["paths"][2]." > ";}?> <?php //if($item1["paths"][3]<>""){echo $item1["paths"][3]." > ";}?> <?php echo $item1["name"]?></option>
						<?php }?>
						</select>
					<?php }elseif($rsd["n4"]=="ciceksepeti"){?>
						<a href="#" onclick="jQuery('#loader').load('<?php echo $weburl?>/sanalpazar/ciceksepeti/categories.php?download=true');" class="btn btn-warning fas fa-download" style="position: absolute; margin-top: -67px; right: 16%; z-index: 99999; font-size: 20px; padding: 7px;"></a>
						<select name="icciceksepeti" id="icciceksepeti" class="form-control chosen-select" style="">
						<option value="0">Lütfen Seçiniz</option>
						<?php
						$categories = file_get_contents(__DIR__.'/../../../sanalpazar/ciceksepeti/categories.json');
						$categories = json_decode($categories, true);
						//Print_r($categories);
							foreach($categories["categories"] as $item1){
								foreach($item1["subCategories"] as $item2){
									foreach($item2["subCategories"] as $item3){
									foreach($item3["subCategories"] as $item4){
									?>
										<?php if($item4<>""){?>
											<option value="<?php echo $item4[id]?>" <?php if($jsi["icciceksepeti"]==$item4[id]){echo "Selected";}?>><?php echo $item1[name]?> > <?php echo $item2[name]?> > <?php echo $item3[name]?> > <?php echo $item4[name]?></option>
										<?php }elseif($item3<>""){?>
											<option value="<?php echo $item3[id]?>" <?php if($jsi["icciceksepeti"]==$item3[id]){echo "Selected";}?>><?php echo $item1[name]?> > <?php echo $item2[name]?> > <?php echo $item3[name]?></option>
										<?php }else{ ?>
											<option value="<?php echo $item2[id]?>" <?php if($jsi["icciceksepeti"]==$item2[id]){echo "Selected";}?>><?php echo $item1[name]?> > <?php echo $item2[name]?></option>
										<?php
											}
										}
									}
								}
							}
						?>
						</select>
					<?php }elseif($rsd["n4"]=="pttavm"){?>
						<a href="#" onclick="jQuery('#loader').load('<?php echo $weburl?>/sanalpazar/pttavm/categories.php?download=true');" class="btn btn-warning fas fa-download" style="position: absolute; margin-top: -67px; right: 16%; z-index: 99999; font-size: 20px; padding: 7px;"></a>
						<select name="icpttavm" id="icpttavm" class="form-control chosen-select" style="">
						<option value="0">Lütfen Seçiniz</option>
						<?php
						$categories = file_get_contents(__DIR__.'/../../../sanalpazar/pttavm/categories.json');
						$result = json_decode($categories, true);
						foreach($result[AltKategoriListesiResult][AltKategoriDetay] as $kategori){?>
						<option value="<?php echo $kategori["AltKategoriId"]?>" <?php if($jsi["icpttavm"]==$kategori["AltKategoriId"]){echo "Selected";}?>><?php echo $kategori[KategoriAdi];?> > <?php echo $kategori[AltKategoriAdi];?></option>
						<?php }?>
						</select>
					<?php }?>
					<div id="loader" style="width: 100%; height: 100px; position: fixed; bottom: 0px; overflow: auto;"></div>
					</div>
			<?php }?>
			<div class="col-md-12" style="margin-top:30px; display: inline-block; width: 100%;">
				<button type="submit" style="float:right;" class="btn btn-primary demo"><?php echo $sdil[203]; //Güncelle?></button>
			</div>
</form>
<?php
//-------------------------------------------------------------------------/İşlem Ekle/
if($_GET["durum"] == "kaydet"){
	if($_POST["r1"]<>""){
		$kaydedilecekyer = "../../../deppo/kategori";
		$kaynak	= $_FILES['resim']['tmp_name'];	//Burası resminiz kök klasörünün yerini verir  
		$tipi	= $_FILES['resim']['type']; // Dosyanın Tipi
		$adi	= $_FILES["resim"]["name"]; // Dosyanın PCdeki Adı
		$uzanti = explode('.',$_FILES['resim']['name']);
		$rand 	= substr(md5(uniqid(rand())),0,10); 
		$yeni 	= "".$rand.".".$uzanti[count($uzanti)-1]."";
		move_uploaded_file ($_FILES['resim']['tmp_name'], $kaydedilecekyer . "/".$yeni);
		$Rs = mysqli_query($conn, "update kategoriler set image='".$yeni."' where Cat_ID=".$_GET["Cat_ID"]."");
	}
	if($_POST["r2"]<>""){
		$kaydedilecekyer = "../../../deppo/kategori";
		$kaynak	= $_FILES['resim2']['tmp_name'];	//Burası resminiz kök klasörünün yerini verir  
		$tipi	= $_FILES['resim2']['type']; // Dosyanın Tipi
		$adi	= $_FILES["resim2"]["name"]; // Dosyanın PCdeki Adı
		$uzanti = explode('.',$_FILES['resim2']['name']);
		$rand 	= substr(md5(uniqid(rand())),0,10); 
		$yeni 	= "".$rand.".".$uzanti[count($uzanti)-1]."";
		move_uploaded_file ($_FILES['resim2']['tmp_name'], $kaydedilecekyer . "/".$yeni);
		$Rs = mysqli_query($conn, "update kategoriler set image2='".$yeni."' where Cat_ID=".$_GET["Cat_ID"]."");
	}
	if(!empty($_POST["pb2"])){$spb2=$_POST["pb2"];}else{$spb2=0;}
	if(!empty($_POST["s6"])){$ss6=$_POST["s6"];}else{$ss6=0;}
	if(!empty($_POST["s7"])){$ss7=$_POST["s7"];}else{$ss7=0;}
	if(!empty($_POST["s9"])){$ss9=$_POST["s9"];}else{$ss9=0;}
	if(!empty($_POST["areas"])){$sn11 = implode(',',$_POST["areas"]);}
	$iarr = array();
	foreach ($_POST as $key => $value){
		$iarr = $iarr + array( $key => $value);
	}
	$marr = array();
	foreach ($_POST as $key => $value){
		if(substr($key,0,1)=="m"){
			$marr = $marr + array( $key => $value);
		}
	}
	$rjsi = json_encode($iarr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
	$rjsm = json_encode($marr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
	$Rs = mysqli_query($conn, "update kategoriler set ne='".$_POST["nedir"]."', Cat_".$_SESSION['lang']."='".addslashes(stripslashes($_POST["cat"]))."', n2='".addslashes(stripslashes($_POST["n2"]))."', n3='".addslashes(stripslashes($_POST["n3"]))."', n4='".addslashes(stripslashes($_POST["n4"]))."', n5='".$_POST["n5"]."', n6='".addslashes(stripslashes($rjsi))."', n7='".addslashes(stripslashes($rjsm))."', n11='".addslashes(stripslashes($sn11))."', n8='".addslashes(stripslashes($_POST["n8"]))."', t4='".$_POST["t4"]."', t6='".$_POST["t6"]."', sira='".$_POST["sira"]."', c1='".$_POST["c1"]."', c2='".$_POST["c2"]."', s6='".$ss6."', s7='".$ss7."', s9='".$_POST["s9"]."' where Cat_ID=".$_GET["Cat_ID"]."");
	go("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&id=".$_GET["id"]."&Cat_ID=".$_GET["Cat_ID"]."&durum=ok");

}elseif($_GET["durum"] == "rsil"){
	$dosya="../../../deppo/kategori/".$rs["image"]."";
	unlink($dosya);
	$Rs = mysqli_query($conn, "update kategoriler set image='' where Cat_ID=".$_GET["Cat_ID"]."");
	go("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&id=".$_GET["id"]."&Cat_ID=".$_GET["Cat_ID"]."&durum=ok");

}elseif($_GET["durum"] == "rsil2"){
	$dosya="../../../deppo/kategori/".$rs["image2"]."";
	unlink($dosya);
	$Rs = mysqli_query($conn, "update kategoriler set image2='' where Cat_ID=".$_GET["Cat_ID"]."");
	go("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&id=".$_GET["id"]."&Cat_ID=".$_GET["Cat_ID"]."&durum=ok");
}
?>
<?php echo $footer;?>
<?php ob_end_flush();?>