<?php
header('Content-Type: text/html; charset=utf-8');
error_reporting(0);
$path="../../";
include("../../map.php");
include("../../scripts.php");
include("../../secure.php");
$sql=mysqli_query($conn, "select * from genel where ne='sablon' and id=".$_GET["id"].""); $rs=mysqli_fetch_assoc($sql);
    //findDirectoryPath("deppo")
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo $rs["t1"];?></title>
</head>
<body>
    <div class="qmodal">
        <div class="qmodal-content">
            <!-- Header with Action Buttons -->
            <div class="qmodal-header">
                <div class="header-title">
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item"><a href="<?php echo $weburl?>" target="_blank"><i class="fa fa-home"></i></a></li>
                            <li class="breadcrumb-item"><a href="#"><?php echo $sablonlar; //sablon?></a></li>
                            <li class="breadcrumb-item active" aria-current="page"><?php echo $sdil[119]; //İşlemleri?></li>
                        </ol>
                    </nav>
                </div>
                <button type="button" class="btn btn-warning" onclick="AjaxKaydet('','');"><i class="fas fa-save"></i> Kaydet</button>
                 <button type="button" class="btn btn-success mfrm" data-toggle="modal" data-target="#myModal" onclick="location.href='#tab-resim'" data-url="../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><span class="mdn"> <?php echo $sdil[75]; //Resim Ekle?></span></strong></button>
                 <button type="button" class="btn btn-danger mfrm" data-toggle="modal" data-target="#myModal" onclick="location.href='#tab-video'" data-url="../video/video_upload.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $_GET["id"]; ?>"><strong><i class="fa fa-video" aria-hidden="true"></i><span class="mdn"> <?php echo $sdil[188]; //Video Yükle?></span></strong></button>
                 <button type="button" class="btn btn-warning mfrm" data-toggle="modal" data-target="#myModal" onclick="location.href='#tab-file'" data-url="../upload/upload_file.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $_GET["id"]; ?>"><strong><i class="fa fa-file-archive-o" aria-hidden="true"></i><span class="mdn"> <?php echo $sdil[77]; //Dosya Ekle?></span></strong></button>
            </div>
            <form class="form" id="asave" name="rall" method="post" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $_GET["id"];?>&durum=kaydet">
                <div class="v8-columns">
                    <div class="v8-col200pxL-left">
                        <ul class="v8-side-tabs v8-js-tabs v8-same-height">
                            <li><a href="#tab-detay"><i class="fa fa-bookmark"></i><span> <?php echo $sablonlar; //sablon?> <?php echo $sdil[207]; //Detay?></span></a></li>
                            <li><a href="#tab-goster" style="<?php if($rs["t2"]=="sdetay" or $rs["t2"]=="ssart"){?>display:none;<?php }?>"><i class="fa fa-eye"></i><span> <?php echo $sablonlar; //sablon?></span></a></li>
                            <li><a href="#tab-resim"><i class="fa fa-file-image-o" aria-hidden="true"></i><span> <?php echo $sdil[209]; //Resimler?></span></a></li>
                            <li><a href="#tab-video"><i class="fa fa-file-video-o" aria-hidden="true"></i><span> <?php echo $sdil[210]; //Videolar?></span></a></li>
                            <li><a href="#tab-dosya"><i class="fa fa-file-archive-o" aria-hidden="true"></i><span> <?php echo $sdil[211]; //Dosyalar?></span></a></li>
                        </ul>
                        
                        <fieldset class="grey-bg">
                            <legend><?php echo $sdil[220]; //Aktif/Pasif?> <span style="font-size:8px; color:#ccc;">(s13)</span></legend>
								<select size="1" name="s13" class="form-control">
                                    <option value="0" <?php echo ($rs["s13"] == 0) ? 'selected' : ''; ?>>[0] <?php echo ctranslate("#Taslak"); ?></option>
                                    <option value="1" <?php echo ($rs["s13"] == 1) ? 'selected' : ''; ?>>[1] <?php echo ctranslate("#Yayında"); ?></option>
                                </select>
                        </fieldset>
                        <fieldset class="grey-bg msa">
                            <legend>Varsayılan <span style="font-size:8px; color:#ccc;">(s7)</span></legend>
								<select size="1" name="s7" class="form-control">
                                    <option value="0" <?php echo ($rs["s7"] == 0) ? 'selected' : ''; ?>>...</option>
                                    <option value="1" <?php echo ($rs["s7"] == 1) ? 'selected' : ''; ?>>Varsayılan</option>
                                </select>
                        </fieldset>
                        <fieldset class="grey-bg msa">
                            <legend>Silinmez <span style="font-size:8px; color:#ccc;">(s6)</span></legend>
								<select size="1" name="s13" class="form-control">
                                    <option value="0" <?php echo ($rs["s6"] == 0) ? 'selected' : ''; ?>>...</option>
                                    <option value="1" <?php echo ($rs["s6"] == 1) ? 'selected' : ''; ?>>Silinmez</option>
                                </select>
                        </fieldset>
                    </div>
                    <div class="v8-col200pxL-right">
                        <div id="tab-detay" class="v8-tabs-content">
                            <fieldset class="">
                                <legend><?php echo $sdil[39]; //Başlık?> <span style="font-size:8px; color:#ccc;">(t1)</span></legend>
                                <?php $rt1="".trim($sdil[200])." ".trim($nedir)."";?>
                                <input type="text" name="t1" id="simple-required" value="<?php echo $rs["t1"];?>" onfocus="if(this.value == '<?php echo $rt1 //sablon?>') { this.value = ''} "  onblur="if(this.value == '') { this.value='<?php echo $rt1 //sablon?>'; }" style="width:90%" placeholder="<?php echo $rt1 //sablon?>">
                                <input type="text" name="s12" id="simple-required" value="<?php echo $rs["s12"];?>" onfocus="if(this.value == '0') { this.value = ''} "  onblur="if(this.value == '') { this.value='0'; }" style="width:30px; text-align:center;">
                            </fieldset>
                            
                            
                            <fieldset class="">
                                <legend><?php echo $sdil[113]; //Türü?> <span style="font-size:8px; color:#ccc;">(t2-s1)</span></legend>
                                <div class="v3-col-md-2">
                                    <input type="text" name="t2" list="lt2" title="" class="form-control" placeholder="Taslak Tipi"  value="<?php echo $rs["t2"];?>" autocomplete="off">
                                    <datalist id="lt2" class="">
                                        <option value="tmail">E-Mail</option>
                                        <option value="tsms">Sms</option>
                                        <option value="notifications">Notification</option>
                                        <option value="agreement">Sözleşme</option>
												<option value="invoice">Fatura</option>
												<option value="offer">Teklif</option>
                                    </datalist>
                                </div>
                                <div class="v3-col-md-2">
                                    <select name="t5" class="form-control small">
                                        <option value="">...</option>
                                        <?php if($g9<>0){?>
                                            <option value="service" <?php if($rs["t5"]=="service"){?>selected<?php }?>>Teklif</option>
                                        <?php }?>
                                        <?php if($g3==1){?>
                                            <option value="tahsilat" <?php if($rs["t5"]=="tahsilat"){?>selected<?php }?>>Tahsilat</option>
                                        <?php }?>
                                    </select>
                                </div>
                                <div class="v3-col-md-3">
                                    <input type="text" name="t10" id="simple-required" value="<?php echo $rs["t10"];?>" style="width:100%" placeholder="mail@domain.com">
                                </div>
                                
                        <!--
                            <select size="1" name="s1" style=""  class="chosen-select">
                                <option value="0" style="color:#f00;">#<?php echo $sdil[73]; //Reklam Alanları?></option>
                                <option value="1000" <?php if($rs["s1"]=="1000"){?>Selected<?php }?>>Sipariş</option>
                            </select>
                                -->
                            </fieldset>
                            <fieldset class="<?php if($rs["t2"] <> "tmail" && $rs["t2"] <> "invoice"){echo "dn";} ?>">
                                <legend>Header <span style="font-size:8px; color:#ccc;">(n7)</span></legend>
                                <div class="switch switch-sm switch-success" style="float: right; margin-top: -35px;" title="Boş bile olsa seçili ise, bu alanı'ı gönder">
                                    <input type="checkbox" name="s8" value="1" data-plugin-ios-switch="" <?php if($rs["s8"]==1){echo "checked";}?>>
                                </div>
                                <textarea name="n7" class="rte2" id="rte2"style="width:100%; height:150px" placeholder="<?php echo $sablonlar; //sablon?> Text"><?php echo $rs["n7"];?></textarea>
                            </fieldset>
                            
                            <fieldset class="">
                                <legend><?php echo $sdil[207]; //Detay?> <span style="font-size:8px; color:#ccc;">(n1)</span></legend>
                                <textarea name="n1" <?php if ($rs["t2"] === "tmail" || $rs["t2"] === "invoice") { echo 'class="rte" id="rte"'; } elseif ($rs["t2"] === "tsms") { echo 'id="sms"'; } ?> style="width:100%; height:150px" placeholder="<?php echo $sablonlar; //sablon?> Text"><?php echo $rs["n1"];?></textarea>
                                <br />
                                <div style="font-size: 9pt">
                                    <?php if($rs["t2"]=="tmail"){?>
                                        <span style="font-size: 9pt">
                                            <a data-special="{AdSoyad}" class="v3-btn v3-btn-xs v3-btn-info mr5 addSpecial" title="Müşteri Ad Soyad">Ad Soyad</a> 
                                            <a data-special="{FirmaAdi}" class="v3-btn v3-btn-xs v3-btn-info mr5 addSpecial" title="Müşteri Firma Adı">Firma Adı</a> 
                                            <a data-special="{Unvan}" class="v3-btn v3-btn-xs v3-btn-info mr5 addSpecial" title="Müşteri Ünvan">Unvan</a> 
                                            <a data-special="{Telefon}" class="v3-btn v3-btn-xs v3-btn-info mr5 addSpecial" title="Müşteri Telefon">Telefon</a> 
                                            <a data-special="{Email}" class="v3-btn v3-btn-xs v3-btn-info mr5 addSpecial" title="Müşteri Email">Email</a> 
                                            <a data-special="{Sifre}" class="v3-btn v3-btn-xs v3-btn-info mr5 addSpecial" title="Müşteri Şifre">Şifre</a> 
                                            <a data-special="{firma}" class="v3-btn v3-btn-xs v3-btn-warning mr5 addSpecial" title="<?php echo $firma?>">firma</a> 
                                            <a data-special="{ftel}" class="v3-btn v3-btn-xs v3-btn-warning mr5 addSpecial" title="<?php echo $ftel?>">ftel</a> 
                                            <a data-special="{ftel2}" class="v3-btn v3-btn-xs v3-btn-warning mr5 addSpecial" title="<?php echo $ftel2?>">ftel2</a> 
                                            <a data-special="{fgsm}" class="v3-btn v3-btn-xs v3-btn-warning mr5 addSpecial" title="<?php echo $fgsm?>">fgsm</a> 
                                            <a data-special="{fweb}" class="v3-btn v3-btn-xs v3-btn-warning mr5 addSpecial" title="<?php echo $fweb?>">fweb</a> 
                                            <a data-special="{fadres}" class="v3-btn v3-btn-xs v3-btn-warning mr5 addSpecial" title="<?php echo $fadres?>">fadres</a> 
                                        </span>
                                        <script>
                                          jQuery('a.addSpecial').click(function(e){
                                            e.preventDefault();
                                            CKEDITOR.instances.rte.insertHtml(jQuery(this).attr('data-special'));
                                        })
                                    </script>
                                <?php }elseif($rs["t2"]=="tsms" or $rs["t2"]=="notifications"){?>
                                    <a onclick="addTextTag('sms',' {AdSoyad} '); return false" class="v3-btn v3-btn-xs v3-btn-info mr5 " title="Müşteri Ad Soyad">{AdSoyad}</a> 
                                    <a onclick="addTextTag('sms',' {FirmaAdi} '); return false" class="v3-btn v3-btn-xs v3-btn-info mr5 " title="Müşteri Firma Adı">{FirmaAdi}</a> 
                                    <a onclick="addTextTag('sms',' {Unvan} '); return false" class="v3-btn v3-btn-xs v3-btn-info mr5 " title="Müşteri Unvan">{Unvan}</a> 
                                    <a onclick="addTextTag('sms',' {Telefon} '); return false" class="v3-btn v3-btn-xs v3-btn-info " title="Müşteri Telefon">{Telefon}</a> 
                                    <a onclick="addTextTag('sms',' {Email} '); return false" class="v3-btn v3-btn-xs v3-btn-info mr5 " title="Müşteri Email">{Email}</a> 
                                    <a onclick="addTextTag('sms',' {Sifre} '); return false" class="v3-btn v3-btn-xs v3-btn-info mr5 " title="Müşteri Şifre">{Sifre}</a> 
                                    <a onclick="addTextTag('sms',' {firma} '); return false" class="v3-btn v3-btn-xs v3-btn-warning mr5 " title="<?php echo $firma?>">{firma}</a> 
                                    <a onclick="addTextTag('sms',' {ftel} '); return false" class="v3-btn v3-btn-xs v3-btn-warning mr5 " title="<?php echo $ftel?>">{ftel}</a> 
                                    <a onclick="addTextTag('sms',' [ftel2] '); return false" class="v3-btn v3-btn-xs v3-btn-warning mr5 " title="<?php echo $ftel2?>">[ftel2]</a> 
                                    <a onclick="addTextTag('sms',' {fgsm} '); return false" class="v3-btn v3-btn-xs v3-btn-warning mr5 " title="<?php echo $fgsm?>">{fgsm}</a> 
                                    <a onclick="addTextTag('sms',' {fweb} '); return false" class="v3-btn v3-btn-xs v3-btn-warning mr5 " title="<?php echo $fweb?>">{fweb}</a> 
                                    <a onclick="addTextTag('sms',' {fadres} '); return false" class="v3-btn v3-btn-xs v3-btn-warning mr5 " title="<?php echo $fadres?>">{fadres}</a> 
                                <?php }?>
                            </div>
                        </fieldset>
                        <fieldset class="<?php if($rs["t2"] <> "tmail" && $rs["t2"] <> "invoice"){echo "dn";} ?>">
                            <legend>Footer <span style="font-size:8px; color:#ccc;">(n6)</span></legend>
                            <div class="switch switch-sm switch-success" style="float: right; margin-top: -35px;" title="Boş bile olsa seçili ise, bu alanı'ı gönder">
                                <input type="checkbox" name="s9" value="1" data-plugin-ios-switch="" <?php if($rs["s9"]==1){echo "checked";}?>>
                            </div>
                            <textarea name="n6" class="rte3" id="rte3"style="width:100%; height:150px" placeholder="<?php echo $sablonlar; //sablon?> Text"><?php echo $rs["n6"];?></textarea>
                        </fieldset>
                        <fieldset class="<?php if($rs["t2"]<>"tmail"){echo "dn";}?>">
                            <legend><?php echo ctranslate("Sözleşme")?> <span style="font-size:8px; color:#ccc;">(n8)</span></legend>
                            <textarea name="n8" class="rte4" id="rte4"style="width:100%; height:150px" placeholder="<?php echo ctranslate("Sözleşme")?>"><?php echo $rs["n8"];?></textarea>
                        </fieldset>
                        
                        <fieldset class="dn">
                            <legend><?php echo $sablonlar; //sablon?> Kod <span style="font-size:8px; color:#ccc;">(n3)</span></legend>
                            <textarea name="n3" style="width:100%; height:50px" placeholder="<?php echo $sablonlar; //sablon?> Kod"><?php echo $rs["n3"];?></textarea>
                        </fieldset>
                    </div>
                    <div id="tab-goster" class="v8-tabs-content" style="<?php if($rs["t2"]=="sdetay" or $rs["t2"]=="ssart"){?>display:none;<?php }?>">
                        <fieldset>
                            <?php echo $design_top.str_replace("p>","div>",$rs["n1"]).$design_bottom;?>
                        </fieldset>
                    </div>
                    <div id="tab-resim" class="v8-tabs-content" style="min-height:500px; position:relative;">
                        <fieldset id="uploadarea" class="v3-row" style="border: 2px dashed #d9d9d9;">
                            <legend><?php echo $sdil[209]; //Resimler?></legend>
                            <script type="text/JavaScript" language="JavaScript">
                                jQuery(document).ready(function () {
                                    loadFunction('../ajax/ajax_medya.php','#mresim', 'resim');
                                });
                                document.write("<div id=\"mresim\"></div>");
                            </script>
                        </fieldset>
                    </div>
                    <div id="tab-video" class="v8-tabs-content" style="min-height:500px; position:relative;">
                        <fieldset class="v3-row">
                            <legend><?php echo $sdil[210]; //Videolar?></legend>
                            <script type="text/JavaScript" language="JavaScript">
                                jQuery(document).ready(function () {
                                    loadFunction('../ajax/ajax_medya.php','#mvideo', 'video');
                                });
                                document.write("<div id=\"mvideo\"></div>");
                            </script>
                        </fieldset>
                    </div>
                    <div id="tab-dosya" class="v8-tabs-content" style="min-height:500px; position:relative;">
                        <fieldset class="v3-row">
                            <legend><?php echo $sdil[211]; //Dosyalar?></legend>
                            <script type="text/JavaScript" language="JavaScript">
                                jQuery(document).ready(function () {
                                    loadFunction('../ajax/ajax_medya.php','#mdosya', 'dosya');
                                });
                                document.write("<div id=\"mdosya\"></div>");
                            </script>
                        </fieldset>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
</body>
<script src="../../assets/js/tabs.js"></script>
<?php echo $footer?>
</html>
<?php
//-------------------------------------------------------------------------/İşlem Ekle/
if($_GET["durum"] == "kaydet"){
    if(!empty($_POST["s1"])){$ss1=$_POST["s1"];}else{$ss1="0";}
    if(!empty($_POST["s2"])){$ss2=$_POST["s2"];}else{$ss2="0";}
    if(!empty($_POST["s3"])){$ss3=$_POST["s3"];}else{$ss3="0";}
    if(!empty($_POST["s4"])){$ss4=$_POST["s4"];}else{$ss4="0";}
    if(!empty($_POST["s5"])){$ss5=$_POST["s5"];}else{$ss5="0";}
    if(!empty($_POST["s6"])){$ss6=$_POST["s6"];}else{$ss6="0";}
    if(!empty($_POST["s7"])){$ss7=$_POST["s7"];}else{$ss7="0";}
    if(!empty($_POST["s8"])){$ss8=$_POST["s8"];}else{$ss8="0";}
    if(!empty($_POST["s9"])){$ss9=$_POST["s9"];}else{$ss9="0";}
    if(!empty($_POST["s12"])){$ss12=$_POST["s12"];}else{$ss12="0";}
    if(!empty($_POST["s13"])){$ss13=$_POST["s13"];}else{$ss13="0";}
    $Rs = mysqli_query($conn, "update genel set t1='".$_POST["t1"]."', t2='".$_POST["t2"]."', t3='".$_POST["t3"]."', t4='".$_POST["t4"]."', t5='".$_POST["t5"]."', t6='".$_POST["t6"]."', t7='".$_POST["t7"]."', t8='".$_POST["t8"]."', t9='".$_POST["t9"]."', t10='".$_POST["t10"]."', n1='".addslashes(stripslashes($_POST["n1"]))."', n2='".$_POST["n2"]."', n3='".$_POST["n3"]."', n4='".$_POST["n4"]."', n5='".$_POST["n5"]."', n6='".addslashes(stripslashes($_POST["n6"]))."', n7='".addslashes(stripslashes($_POST["n7"]))."', n8='".addslashes(stripslashes($_POST["n8"]))."', s1='".$ss1."', s2='".$ss2."', s3='".$ss3."', s4='".$ss4."', s5='".$ss5."', s6='".$ss6."', s7='".$ss7."', s8='".$ss8."', s9='".$ss9."', s12='".$ss12."', s13='".$ss13."', ts2=now() where id=".$_GET["id"]."");
    echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&id=".$_GET["id"]."&durum=ok",self,500,1);
}
?>
<script type="text/javascript">
    function addTextTag(id,text) {
        document.getElementById(id).value += text;
    }
</script>