<?php
	$path="../../"; include("../../map.php");
	include("../../scripts.php");
	include("../../secure.php");
	$url		= __DIR__."/../../../deppo/datas/translate_".$_SESSION["clang"].".json";
	$fgc		= file_get_contents($url, false, stream_context_create($arrContextOptions));
	$results = json_decode($fgc, true);
?>
	 <div class="v3-container" style="">
			<div id="result"></div>
				<a href="?" class="btn-xs btn-warning"> <i class="fas fa-home"></i></a>
				<?php $d=0; $w=9; $diller = explode(',',$module["m1_crm"]); $dsay=count($diller); foreach($diller as $dil) {$d++;?>
					<a href="?clang=<?php echo $dil;?>" class="btn-xs btn-warning"><?php if($_SESSION["clang"]==$dil){echo "<i class=\"fas fa-angle-right\"></i>";}?> <?php echo $dil?></a>
				<?php }?>
				<div style="float:right;"> <input type="text" placeholder="Arama" id="filtre" name="q" autocomplete="off"></div>
				<div style="position:fixed; right:5px; bottom:5px;" class="btn-xs btn-danger"><?php echo $_SESSION["clang"]?></div>
			<table class="v3-table filterable">
			<?php
				$i=0;foreach($results as $result){
					foreach($result as $key=>$value){$i++;
					$arr_new[$key] = $value;
			?>
			<form action="?islem=update" method="post" id="xf<?php echo $i;?>" name="xf<?php echo $i;?>">
				<tr class="" data-id="<?php echo $i;?>">
					<td><input class="v3-form-control" name="key" value="<?php echo $key?>" readonly><span style="display:none"><?php echo $key?>:<?php echo $value?></span></td>
					<td><input class="v3-form-control" name="value" placeholder="<?php echo $value?>" value="<?php echo $value?>"></td>
					<td><button type="button" onclick="Ajaxs('<?php echo $i;?>','#result','AjaxPost');" class="v3-btn v3-btn-warning">Update</button></td>
				</tr>
			</form>
			<?php }}?>
		</table>
	</div>
<?php
if ($_GET["islem"]=="update"){
	$jset		= array();
	foreach($results as $result){
		foreach($result as $key=>$value){
			if ($key==$_POST["key"]) {
				$arr_new[$key] = $_POST["value"];
			}
		}
	}
	$file  = "".$path."../deppo/datas/translate_".$_SESSION["clang"].".json";
	array_push($jset,$arr_new);
	$data = json_encode($jset, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
	$fp	  = fopen($file, 'w');
	fwrite($fp, $data);
	fclose($fp);
	echo "<script>window.location.href = '?';</script>";
}
?>