<?php
$footer = isset($footer) ? $footer : '';
$header = isset($header) ? $header : '';
$gets = '';
$posts = '';
$module = isset($module) && is_array($module) ? $module : array();
$phpSelf = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '';
$scriptName = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : '';
$requestUserAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
?>
<style>
	.right-widget-container { position: fixed; bottom: 67px; right: 20px; display: flex; align-items: center; z-index: 1000; flex-direction: row-reverse; }
	.fixed-icon { width: 60px; height: 60px; border-radius: 50%; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.3s ease; }
	.fixed-icon:hover { transform: scale(1.1); }
	.fixed-icon img { width: 100%; height: auto; }
	#alvaPanel{position:fixed;bottom:0;right:-400px;width:360px;max-width:100%;height:60%;background:#fff; border-radius: 11px 11px 0px 0px; box-shadow:-4px 0 15px rgba(0,0,0,.2);z-index:999999999;transition:.3s ease}
	#alvaPanel.open{right:0}
	#alvaPanel iframe{width:100%;height:calc(100% - 50px);border:0}
	.alva-header{height:50px;background:#0a58ca;color:#fff;display:flex;align-items:center;justify-content:space-between;padding:0 15px;font-weight:600}
	#alvaClose{background:none;border:0;color:#fff;font-size:22px;cursor:pointer}
	.chat-bubble {cursor:pointer; max-width: 200px; background-color: #fff; border: 2px solid #FF7F50; border-radius: 10px; padding: 15px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); font-size: 14px; line-height: 1.5; margin-right: 10px; margin-top: -25px;}
	.chat-bubble:before { content: ""; position: absolute; bottom: 30px; right: 50px; border-width: 10px; border-style: solid; border-color: transparent transparent transparent #FF7F50; }
	.contact-buttons { position: fixed; bottom: 67px; left: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; }
	.contact-button {padding:5px; display: flex; align-items: center; justify-content: center; border: none; border-radius: 8px; font-size: 16px; color: white; text-decoration: none; cursor: pointer; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); }
	.call-button { background-color: #68bccf !important; }
	.whatsapp-button { background-color: #25d366; }
	.contact-button:hover { opacity: 0.8;}
	.contact-button i {margin-right: 8px;font-size: 20px;}
	<?php if(basename($phpSelf) != 'index.php'): ?>
		.contact-buttons, .kvkk, .alva, .v3status-right { display: none !important; }
	<?php endif; ?>
</style>
<script type="text/javascript">
	<?php if($f4==1){?>
		if (window.location.protocol == 'http:') { window.location.href = window.location.href.replace('http:', 'https:'); }
	<?php }?>
</script>
<!--
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Dosis:wght@200..800&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
-->
<div id="v3-notification" class="notify v3-bg-success" style="display:none;"></div>
<div class="loader" id="preload">
	<div class="loader-inner"></div>
	<div class="loader-inner"></div>
	<div class="loader-inner"></div>
</div>
<div id="AjaxSuccess" style="display:none;"><img border="0" src="<?php echo $srvpath?>/deppo/tools/img/saved.gif" alt="saved" style="max-height:150px;"></div>
<?php //-- Status Bar -->
if(!empty($_SESSION["cgiris"]) and (!isset($module["quick_edit"]) || $module["quick_edit"]<>1)){
	$control="1";
	?>

	<!-- Açılır Menü -->
	<div class="v3status-right" style="background: cadetblue;z-index:99999999; width: 60px;">
		<ul class="list-unstyled text-center">

			<li class="always-visible">
				<a href="<?php echo $crmpath?>" target="_blank" class="btn btn-warning btn-circle">
					<i class="fa-solid fa-pen-to-square"></i>
				</a>
			</li>

			<!-- Ek Ekleme Butonları -->
			<?php if($m14<>0 and ($ne=="kayit" or $ne=="")){ ?>
				<li  class="extra-item hidden hover"><a class="btn btn-success btn-circle mfrm" modal-type="right" modal-width="80%" data-url="<?php echo $crmpath?>/modules/public/add.php?ne=kayit&islem=kayitlar&durum=ykayit" data-title="Ürün Ekle"><i class="fa fa-cubes"></i> <span class="tooltip-text">Ürün Ekle</span></a></li>
			<?php } ?>
			<?php if($m13<>0 and ($ne=="sayfa" or $ne=="")){ ?>
				<li  class="extra-item hidden hover"><a class="btn btn-success btn-circle mfrm" modal-type="right" modal-width="80%" data-url="<?php echo $crmpath?>/modules/public/add.php?ne=sayfa&islem=sayfa&durum=ysayfa" data-title="Sayfa Ekle"><i class="fa-solid fa-file"></i> <span class="tooltip-text">Sayfa Ekle</span></a></li>
			<?php } ?>
			<?php if($m11<>0 and ($ne=="haber" or $ne=="")){ ?>
				<li  class="extra-item hidden hover"><a class="btn btn-success btn-circle mfrm" modal-type="right" modal-width="80%" data-url="<?php echo $crmpath?>/modules/public/add.php?ne=haber&islem=sayfa&durum=ysayfa" data-title="Haber Ekle"><i class="fa-solid fa-file-lines"></i> <span class="tooltip-text">Haber Ekle</span></a></li>
			<?php } ?>

			<?php if($ne=="kayit"){ ?>
				<li  class="extra-item hidden hover"><a class="btn btn-warning btn-circle mfrm" modal-type="right" modal-width="80%" data-url="<?php echo $crmpath?>/modules/products/product.php?islem=d<?php echo $ne; ?>&ne=<?php echo $ne; ?>&id=<?php echo $id; ?>" data-title="Düzenle"><i class="fa fa-pencil"></i> <span class="tooltip-text">Düzenle</span></a></li>
				<li  class="extra-item hidden hover"><a href="<?php echo $crmpath?>/?islem=kayitlar&ne=<?php echo $ne; ?>&id=<?php echo $id; ?>&durum=skayit" class="btn btn-danger btn-circle" onclick="return confirm('Bu Kayıt Silinecektir! Onaylıyor musunuz?')"><i class="fa fa-trash"></i> <span class="tooltip-text">Ürün Sil</span></a></li>
			<?php } elseif($ne=="sayfa" or $ne=="haber" or $ne=="msayfa"){ ?>
				<li  class="extra-item hidden hover"><a class="btn btn-warning btn-circle mfrm" modal-type="right" modal-width="80%" data-url="<?php echo $crmpath?>/modules/pages/page.php?islem=dsayfa&ne=<?php echo $ne; ?>&id=<?php echo $id; ?>" data-title="Düzenle"><i class="fa fa-pencil"></i> <span class="tooltip-text">Düzenle</span></a></li>
				<li  class="extra-item hidden hover"><a href="<?php echo $crmpath?>/?islem=sayfa&ne=<?php echo $ne; ?>&id=<?php echo $id; ?>&durum=ssayfa" class="btn btn-danger btn-circle" onclick="return confirm('Bu Kayıt Silinecektir! Onaylıyor musunuz?')"><i class="fa fa-trash"></i> <span class="tooltip-text">Sayfa Sil</span></a></li>
			<?php } ?>

			<!-- Slider ve Ayarlar -->
			<li  class="extra-item hidden hover"><a class="btn btn-info btn-circle mfrm" modal-type="right" modal-width="80%" data-url="<?php echo $crmpath?>/modules/public/settings_modal.php?ne=ayarlar&islem=ayarlar#&tab-slide" data-title="Slider"><i class="fa-solid fa-panorama"></i> <span class="tooltip-text">Slider</span></a></li>
			<li  class="extra-item hidden hover"><a class="btn btn-info btn-circle mfrm" modal-type="right" modal-width="80%" data-url="<?php echo $crmpath?>/modules/public/settings_modal.php?ne=ayarlar&islem=ayarlar" data-title="Ayarlar"><i class="fa-solid fa-sliders"></i> <span class="tooltip-text">Ayarlar</span></a></li>

			<!-- Çıkış -->
			<li  class="extra-item hidden hover"><a href="<?php echo $crmpath?>/?islem=cikis" target="_blank" class="btn btn-danger btn-circle"><i class="fa fa-power-off"></i> <span class="tooltip-text">Çıkış</span></a></li>
		</ul>
	</div>

	<script>
		(function($){
			let editTimer;
			function parseEditableId(el){const idAttr=el.getAttribute("id")||"";const col=el.dataset.col||"";const match=idAttr.match(/^([dhst])(\d+)/i);if(!match)return null;return{type:match[1],id:match[2],col:col};}
			function getIdFromHref($el){const href=$el.find(".qlink,a").first().attr("href")||"";const match=href.match(/[dhst]\d+/i);return match?match[0]:null;}
			function editable(el){clearTimeout(editTimer);editTimer=setTimeout(function(){
				const $el=$(el);const info=parseEditableId(el)||parseEditableId({getAttribute:()=>getIdFromHref($el),dataset:{col:$el.data("col")}});if(!info)return;
				const txt=$el.html().trim();let type="",col="";
				switch(info.type){case"d":type="kayit";col=info.col||"t1";break;case"s":type="sayfa";col=info.col||"t1";break;case"h":type="haber";col=info.col||"t1";break;case"t":type="translate";col=$el.data("original")||txt;break;default:return;}
				$.ajax({type:"POST",url:"<?php echo $cpath ?>config/func.php?islem=editable",data:{txt:txt,col:col,ne:type,id:info.id},success:function(res){console.log("Kaydedildi:",res);},error:function(xhr){console.error("Editable hata:",xhr.responseText);}});
			},800);}
			$(function(){
				$(".qedit").on("mouseenter",function(){$(this).find(".qlink,.qdel").css("opacity","1");}).on("mouseleave",function(){$(this).find(".qlink,.qdel").css("opacity","0.1");});
				$(".editable").each(function(){const $t=$(this);$t.attr("contenteditable","true");if(!$t.data("original"))$t.data("original",$t.text().trim());$t.on("keyup",function(){editable(this);});});
				$(".qedit").each(function(){
					const $v=$(this);const info=parseEditableId(this)||parseEditableId({getAttribute:()=>getIdFromHref($v),dataset:{col:$v.data("col")}});if(!info)return;
					let type="",islem="",url="",modal=false;
					switch(info.type){case"s":type="sayfa";islem="dsayfa";modal=true;break;case"h":type="haber";islem="dsayfa";modal=true;break;case"d":type="kayit";islem="dkayit";modal=true;break;case"t":type="translate";break;default:return;}
					if(modal&&$v.find(".qlink").length===0){switch(type){case"kayit":url="<?php echo $crmpath ?>/modules/products/product.php?ne=kayit&islem=dkayit&id="+info.id;break;case"sayfa":url="<?php echo $crmpath ?>/modules/pages/page.php?ne=sayfa&islem=dsayfa&id="+info.id;break;case"haber":url="<?php echo $crmpath ?>/modules/pages/page.php?ne=haber&islem=dsayfa&id="+info.id;break;case"translate":url="";break;}if(url)$v.append(`<a href="#" class="v3-bg-warning qlink mfrm" title="Hızlı Düzenle" modal-type="right" modal-width="80%" data-url="${url}"><i class="fas fa-pencil"></i></a>`);}
					if(type==="kayit"&&$v.find(".qdel").length===0)$v.append(`<a class="v3-bg-danger qdel" title="Sil" href="<?php echo $crmpath ?>?ne=kayit&islem=kayitlar&durum=skayit&id=${info.id}" target="icerik"><i class="fas fa-trash"></i></a>`);
					else if(type==="sayfa"&&$v.find(".qdel").length===0)$v.append(`<a class="v3-bg-danger qdel" title="Sil" href="<?php echo $crmpath ?>/?ne=sayfa&islem=sayfa&durum=ssayfa&id=${info.id}" target="icerik"><i class="fas fa-trash"></i></a>`);
					else if(type==="haber"&&$v.find(".qdel").length===0)$v.append(`<a class="v3-bg-danger qdel" title="Sil" href="<?php echo $crmpath ?>/?ne=haber&islem=sayfa&durum=ssayfa&id=${info.id}" target="icerik"><i class="fas fa-trash"></i></a>`);
				});
				$(document).on("click",".qdel",function(ev){ev.preventDefault();ev.stopPropagation();const $btn=$(this);const link=$btn.attr("href");if(confirm("Kayıt Silinecek Emin misiniz?")){$btn.closest(".qedit").fadeOut();window.open(link,"icerik");}});
				$(document).on("click",".qlink.mfrm",function(ev){ev.preventDefault();ev.stopPropagation();const url=$(this).data("url");const modalType=$(this).attr("modal-type")||"right";if(typeof openModal==="function"){openModal(url,modalType);}else{console.warn("openModal fonksiyonu tanımlı değil, URL:",url);}});
			});
		})(jQuery);
	</script>

	<div id="technical" style="display:none; bottom: 0px; position: fixed; width: 100%; height: 50vh; border: 5px solid #ccc; background: #00b300; color: white;z-index: 999999999;">
		<i class="fas fa-caret-square-down" onclick="toggle('#technical')" style="position: fixed; right: 5px; margin-top: -26px; font-size: 30px; color: #00b300;"></i>
		<?php $tgroups = [ '_POST' => $_POST, '_GET' => $_GET, '_SESSION' => $_SESSION, '_COOKIE' => $_COOKIE, ]; foreach ($tgroups as $ttitle => $tdata): ?>
		<div style="flex: 1 1 23%; min-width: 200px; background: #000; border: 1px solid #0f0; border-radius: 4px; padding: 10px; max-height: 400px; overflow: auto;">
			<div style="border-bottom: 1px dashed #0f0; margin-bottom: 8px; font-weight: bold;"><?php echo $ttitle ?></div>
			<?php if (empty($tdata)) : ?>
				<div><em style="color: #555;">(boş)</em></div>
			<?php else : ?>
				<?php foreach ($tdata as $tkey => $tval): ?>
					<div style="margin-bottom: 5px;">
						> <span style="color:#0ff;"><?php echo htmlspecialchars($tkey) ?></span> : <span><?php echo nl2br(htmlspecialchars(print_r($tval, true))) ?></span>
					</div>
				<?php endforeach; ?>
			<?php endif; ?>
		</div>
	<?php endforeach; ?>
</div>
<?php }?>
<?php
if(($sayfa=="" and $sayfa1<>"") or !empty($_SESSION["powered"])){
	if(!empty($_SESSION["powered"])){
		$powered							= $_SESSION["powered"];
		$pweb								= $_SESSION["pweb"];
	}else{
		$_SESSION["powered"]	= $sayfa1;
		$_SESSION["pweb"]		= "http://".$sayfa2."";
		$powered							= $sayfa1;
		$pweb								= "http://".$sayfa2."";
	}
}

if($sayfa=="kur"){
	$kpb=$sayfa1;
	$_SESSION["kur"]=$sayfa1;
	echo "<script>window.location.href='?".str_replace(',', '/', $sayfa3)."'</script>";

}elseif($sayfa=="" and empty($_SESSION["kur"])){
	$kpb=$module["currency"];
	$_SESSION["kur"]=$module["currency"];

}elseif(!empty($_SESSION["kur"])){
	$kpb=$_SESSION["kur"];
	$_SESSION["kur"]=trim($_SESSION["kur"]);
}

foreach($_GET as $name => $value) {
	$name = htmlspecialchars((string)$name, ENT_QUOTES, 'UTF-8');
	if (is_array($value)) {
		continue;
	}
	$value = htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8');
	$gets.= ''. $name .'='. $value .'&';
	if($gets<>""){ $_SESSION["gets"]=$gets; }
	if($name<>""){ $_SESSION[$name]=$value; }
}

foreach($_POST as $name => $value) {
	$name = htmlspecialchars((string)$name, ENT_QUOTES, 'UTF-8');
	if (is_array($value)) {
		continue;
	}
	$value = htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8');
	$posts.= ''. $name .'='. $value .'&';
	if($posts<>""){ $_SESSION["posts"]=$posts; }
	if($name<>""){ $_SESSION[$name]=$value; }
}

$hind = ($s13+100)/100;
if(substr(sabit("0+0+1004","sayfa","n9"),0,9)<>"#0+0+1004" and sabit("0+0+1004","sayfa","n9")<>"" and $mobile==""){
	echo "<div style=\"display:none\">";
	$kvkkurl=linked("s",sabit("0+0+1004","sayfa","id"));
	echo "</div>";
	$kvkk=str_replace('{kvkk}', '<a href="'.$kvkkurl.'">Çerez Politikası</a>', sabit("0+0+1004","sayfa","n9"));
	$footer .="
	<div class=\"kvkk\" style=\"display:none;\"> <i class=\"fa fa-times cp ckvkk\"></i> <div class=\"v3-container\"> <span>".rlang($kvkk)."</span> </div> </div>
	<script>jQuery(document).ready(function(){setTimeout(function(){},30000);var kvkk=sessionStorage.kvkk;if(typeof kvkk==='undefined'){show('.kvkk');}});jQuery('.ckvkk').click(function(){sessionStorage.kvkk='hide';hide('.kvkk');});</script>
	";
}

if($mobile=="" or $mobile<>"" and !file_exists("view/mobile_bar.php")){
	if($module["alva"]=="1"){
		if (empty($module["alva_expire_date"]) || strtotime($module["alva_expire_date"]) >= strtotime(date('Y-m-d'))) {
			$footer.='
				<div id="alvaPanel">
					<div class="alva-header" style="display: flex; justify-content: space-between; align-items: center; background: linear-gradient(135deg, #0a58ca, #0d6efd); padding: 12px 16px; border-radius: 12px 12px 0 0;">
						<div style="display: flex; flex-direction: column;">
							<span style="color: #fff; font-weight: 600; font-size: 15px;">Alva Yapay Zeka</span>
							<span style="color: rgba(255,255,255,0.7); font-size: 10px; text-transform: uppercase;">Çevrimiçi Asistan</span>
						</div>
						<div style="display: flex; align-items: center; gap: 10px;">
							<a href="alva/chat.php?new_chat=1" id="newChatBtn" style="font-size: 11px; color: #fff; text-decoration: none; font-weight: bold; padding: 2px 5px; border-radius: 20px; border: 0px;">
								+ Yeni Sohbet
							</a>
							<button id="alvaClose" style="background: none; border: none; color: #fff; font-size: 24px; cursor: pointer;">×</button>
						</div>
					</div>
					<iframe id="alvaFrame" src=""></iframe>
				</div>

				<div class="alva right-widget-container" data-url="alva/" data-title="#Alva">
					<div class="fixed-icon"><img src="https://cdn.crmplus.com.tr/images/alva.png" alt="Alva"></div>
					<div class="chat-bubble">Merhaba! Nasıl yardımcı olabiliriz?</div>
				</div>

				<script>
				document.addEventListener("DOMContentLoaded", () => {
					const q = s => document.querySelector(s), p = q("#alvaPanel"), f = q("#alvaFrame");
					
					// Paneli aç ve URLyi yükle
					q(".alva")?.addEventListener("click", () => {
						if(!p.classList.contains("open")) { f.src = q(".alva").dataset.url; p.classList.add("open"); }
					});

					// Kapatınca içeriği boşalt (performans ve temizlik için)
					q("#alvaClose")?.addEventListener("click", () => { p.classList.remove("open"); f.src = ""; });

					// Yeni Sohbet: Linkin iframei yenilemesini sağla
					q("#newChatBtn")?.addEventListener("click", (e) => {
						e.preventDefault();
						f.src = "alva/chat.php?new_chat=1";
					});
				});
				</script>
				';

		}
	}

	if((!empty($module["click_call"]) && $module["click_call"]==1) or (!empty($module["click_whatsapp"]) && $module["click_whatsapp"]==1)){
		$footer .="<div class=\"contact-buttons\">";
		if(!empty($module["click_call"]) && $module["click_call"]==1){
			$footer .=" <a href=\"tel:".$fgsm."\" class=\"contact-button call-button\" title=\"Telefon ile Ara\"> <img src=\"https://cdn.".$cdnurl."/images/phone.png\" style=\"height:45px\" class=\"pulse\" alt=\"Telefon\"> </a> ";
		}
		if(!empty($module["click_whatsapp"]) && $module["click_whatsapp"]==1){
			$footer .=" <a href=\"".telefon($lwhatsapp)."\" target=\"_blank\" class=\"contact-button whatsapp-button\" title=\"WhatsApp\"> <img src=\"https://cdn.".$cdnurl."/images/whatsapp.png\" style=\"height:45px\" class=\"pulse\" alt=\"WhatsApp\"> </a> ";
		}
		$footer .="</div>";
	}

}else{
	include("view/mobile_bar.php");
}
if($f6==1){ //-- Right Click
	$footer	.= "
	<script>
	document.getElementsByTagName(\"body\")[0].setAttribute(\"oncontextmenu\", \"return false\");
	document.getElementsByTagName(\"body\")[0].setAttribute(\"onselectstart\", \"return false\");
	document.getElementsByTagName(\"body\")[0].setAttribute(\"ondragstart\", \"return false\");
	</script>
	";
}

if($clanguage=="Ar"){
	$footer	.= "
	<script>
	document.getElementsByTagName(\"html\")[0].setAttribute(\"dir\", \"rtl\");
	document.getElementsByTagName(\"html\")[0].setAttribute(\"lang\", \"ar\");
	</script>
	";
}

$footer .= "
	<script>
		const videoCount = (id) => fetch('/config/func.php?islem=vcount&id=' + id.replace(/\D/g, ''));
	</script>
";

if($module["beffect"]=="1"){
	//$inc_js .= "codex-fly,";
	$footer .="
	<script type=\"text/javascript\" src=\"//demos.codexworld.com/fly-to-cart-effect-using-jquery/codex-fly.js\"></script>
	<script>jQuery(document).ready(function(){jQuery('.AddBasket').on('click',function(){jQuery('html,body').animate({'scrollTop':jQuery('.pbasket').position().top});var itemImg=jQuery(this).parent().find('img').eq(0);flyToElement(jQuery(itemImg),jQuery('.qbasket'));});});</script>
	";
}

if ($m16 == 1) {
	$footer .= "<script>jQuery(window).on('load',function(){GetCount();});</script>";
}

if(!empty($_GET["q"])){
	$footer .= "<script>jQuery(document).ready(function(){jQuery('#qsearchresult').load('deppo/tools/script/qsearch.php?q=".qv($_GET["q"])."');});</script>";
}

$footer .="
<script>
jQuery(function($) {
	jQuery('.uplogos').owlCarousel({ loop:false, margin:10, nav:false, responsive:{ 0:{items:6}, 600:{items:8}, 1000:{items:15}} });
	jQuery('.search-form').one('click', function () { jQuery('.search-form').append('<div id=\"reSearch\"></div>');});
	jQuery('.search-form #q').on('input', function(e){
		var type = jQuery('.search-form').attr('data-type');
		jQuery('#reSearch').html('...');
		AjaxPResult('".$cpath.$path."config/ajax.php?ne=research&type=' + type + '','.search-form','#reSearch','nopl'); return false;
		});
		});
		</script>
		";
//-- Mobile Test -->
		$useragent=$requestUserAgent;
		if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4)))
			$mobile="1";
//-- Mobile Test -->

//-- Browser test -->
		$arr_browsers = ["Opera", "Edge", "Chrome", "Safari", "Firefox", "MSIE", "Trident"];
		$agent = $requestUserAgent;
		$user_browser = '';
		foreach ($arr_browsers as $browser) {
			if (strpos($agent, $browser) !== false) {
				$user_browser = $browser;
				break;
			}
		}
		
		switch ($user_browser) {
			case 'MSIE':
			$user_browser = 'Internet Explorer';
			break;
			
			case 'Trident':
			$user_browser = 'Internet Explorer';
			break;
			
			case 'Edge':
			$user_browser = 'Microsoft Edge';
			break;
		}
		$browser = $user_browser;
//-- Browser test -->
		
		$header	.= "<link rel=\"stylesheet\" href=\"".$srvpath."/deppo/tools/style.css\" type=\"text/css\" /> \n";
		$header	.= "<script src=\"".$srvpath."/deppo/tools/jquery.js?sayfa=".$sayfa."&sayfa3=".$sayfa3."&id=".$id."&cpath=".v3e($cpath)."&crmpath=".v3e($crmpath)."&weburl=".v3e($weburl)."\"></script> \n";
	if(!empty($module["font"])){	//-- Google Font -->
		$header	.= "<link href='//fonts.googleapis.com/css?family=".qv($module["font"])."' rel='stylesheet' type='text/css'> \n";
		$header	.= "<style type='text/css'> \n";
		$header	.= ".qfont {font-family: \"".qa($module["font"])."\" !important;} \n";
		if(!empty($module["font_ruler"])){	//-- body -->
			$qfonts = explode('+',$module["font_ruler"]);
			foreach($qfonts as $qf){
				$header	.= "".$qf." {font-family: \"".qa($module["font"])."\"} \n";
			}
		}
		if(!empty($module["font_color"])){	//-- body -->
			$header	.= "body {color: ".$module["font_color"]." !important;} \n";
		}
		if(!empty($module["font_a_color"])){	//-- body -->
			$header	.= "a {color: ".$module["font_a_color"]." !important;} \n";
		}
		if(!empty($module["font_ah_color"])){	//-- body -->
			$header	.= "a:hover {color: ".$module["font_ah_color"]." !important;} \n";
		}
		if(!empty($module["font_h_color"])){	//-- body -->
			$header	.= "h1,h2,h3,h4,h5,h6 {color: ".$module["font_h_color"]." !important;} \n";
		}
		$header	.= "</style> \n";
	}
	$header	.= "<!--[if lt IE 9]>";
	$header	.= "<script src='".$srvpath."/deppo/tools/js/html5.js'></script>";
	$header	.= "<![endif]--> \n";
if($c9==1){		//-- Translate -->
	include("script/translate.php");
}
if($f5==1){ 		//-- Lazyload -->
	$footer	.= "<script src=\"https://cdn.jsdelivr.net/npm/lazyload@2.0.0-rc.2/lazyload.js\"></script> \n";
	//$inc_js .= "lazyload,";
}
if((isset($sayfa[0]) && $sayfa[0]=="p") or substr($scriptName,-24)=="account_calendar_pop.php"){
	$header	.= " <link rel=\"stylesheet\" href=\"".$weburl."/".$crmpath."/assets/search_ajax/chosen.css\"> \n";
	$footer		.= " <script src=\"".$weburl."/".$crmpath."/assets/search_ajax/chosen.jquery.js\"></script> \n";
	$footer		.= "
	<script type=\"text/javascript\">
	var config = {
		'.chosen-select'           : {},
		'.chosen-select-deselect'  : {allow_single_deselect:true},
		'.chosen-select-no-single' : {disable_search_threshold:10},
		'.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
		'.chosen-select-width'     : {width:\"95%\"}
	}
	for (var selector in config) {
		jQuery(selector).chosen(config[selector]);
	}
	</script> \n";
	$header	.= "<link rel=\"stylesheet\" href=\"//cdn.".$cdnurl."/js/tags/bootstrap-tagsinput.css\"> \n";
	$footer		.= "<script src=\"//cdn.".$cdnurl."/js/tags/bootstrap-tagsinput.min.js\"></script> \n";
}
if($b8==1){		//-- LightBOX-1 -->
	$header	.= "<link rel=\"stylesheet\" href=\"https://res.cloudinary.com/watolye/raw/upload/v1556794296/css/jacklmoore.css\" /> \n";
	$footer	.= "<script src=\"https://res.cloudinary.com/watolye/raw/upload/v1556794881/js/jacklmoore.js\"></script> \n";
}elseif($b8==2){	//-- LightBOX-2 -->
	$header	.= "<link rel=\"stylesheet\" href=\"https://res.cloudinary.com/watolye/raw/upload/v1557471726/css/swipebox.css\"> \n";
	$footer	.= "<script src=\"https://res.cloudinary.com/watolye/raw/upload/v1556794781/js/swipebox.js\"></script> \n";
}elseif($b8==3){	//-- LightBOX-3 -->
//	$header	.= "<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.0.47/jquery.fancybox.min.css\" /> \n";
//	$footer	.= "<script src=\"//cdnjs.cloudflare.com/ajax/libs/fancybox/3.0.47/jquery.fancybox.min.js\"></script> \n";
}elseif($b8>3){	//-- Zoom -->
	$header	.= "<script type=\"text/javascript\" src=\"https://res.cloudinary.com/watolye/raw/upload/v1557472059/tools/zoom/dist/xzoom.min.js\"></script> \n";
	$header	.= "<link rel=\"stylesheet\" type=\"text/css\" href=\"https://res.cloudinary.com/watolye/raw/upload/v1557472108/tools/zoom/css/xzoom.css\" media=\"all\" /> \n";
	$footer	.= "<script src=\"https://res.cloudinary.com/watolye/raw/upload/v1557472166/tools/zoom/js/setup.js\"></script> \n";
}elseif($b8==6){ //-- Zoom -->
	$header		.= "<script type=\"text/javascript\" src=\"https://res.cloudinary.com/watolye/raw/upload/v1556795058/tools/zoom/fancybox/source/jquery.fancybox.js\"></script> \n";
	$header		.= "<link rel=\"stylesheet\" type=\"text/css\" href=\"https://res.cloudinary.com/watolye/raw/upload/v1556795035/tools/zoom/fancybox/source/jquery.fancybox.css\" media=\"all\" /> \n";
}elseif($b8==7){ //-- Zoom -->
	$header	.= "<script type=\"text/javascript\" src=\"https://res.cloudinary.com/watolye/raw/upload/v1557472288/tools/zoom/magnific-popup/js/magnific-popup.js\"></script> \n";
	$header	.= "<link rel=\"stylesheet\" type=\"text/css\" href=\"https://res.cloudinary.com/watolye/raw/upload/v1557472254/tools/zoom/magnific-popup/css/magnific-popup.css\" media=\"all\" /> \n";
}
$header	.= "<link rel=\"stylesheet\" href=\"//cdn.".$cdnurl."/tools/lightbox/fancybox/jquery.fancybox.min.css\" /> \n";
$footer		.= "<script src=\"//cdn.".$cdnurl."/tools/lightbox/fancybox/jquery.fancybox.min.js\"></script> \n";
if($c5==1 or $c5==3){ 	//-- carousel -->
	$header	.= "<link rel=\"stylesheet\" href=\"https://res.cloudinary.com/watolye/raw/upload/v1557472358/tools/carousel/css/resCarousel.css\" /> \n";
	$footer	.= "<script type=\"text/javascript\" src=\"https://res.cloudinary.com/watolye/raw/upload/v1557472396/tools/carousel/js/resCarousel.js\"></script> \n";
}
if($c5==2 or $c5==3){ //-- owlcarousel -->
	$header	.= "<link rel=\"stylesheet\" href=\"//cdn.".$cdnurl."/tools/carousels/owl/css/owl.theme.default.min.css\" /> \n";
	$header	.= "<link rel=\"stylesheet\" href=\"//cdn.".$cdnurl."/tools/carousels/owl/css/owl.carousel.min.css\" /> \n";
	$footer	.= "<script type=\"text/javascript\" src=\"//cdn.".$cdnurl."/tools/carousels/owl/js/owl.carousel.js\"></script> \n";
}
$footer		.= "
<script type=\"text/javascript\">
if(jQuery('#country').length){
	jQuery('#country').after('<datalist id=\"lcountry\"></datalist>');
	jQuery('#lcountry').load('".$path.$cpath."deppo/tools/script/location.php?ne=ulke&type=name');
}
if(jQuery('#cities').length){
	if(!jQuery('#country').length){
		jQuery('#cities').after('<datalist id=\"lcities\"></datalist>');
		jQuery('#lcities').load('".$path.$cpath."deppo/tools/script/location.php?ne=il&type=name&ID=".$module["countrycode"]."');
		} else {
			jQuery('#cities').after('<datalist id=\"lcities\"></datalist>');
		}
		jQuery('#country').change(function(){
			jQuery('#cities').val(''); jQuery('#cities').html('<option></option>');
			jQuery('#town').val(''); jQuery('#ltown').html('<option></option>');
			var val = jQuery(this).val();
			var ID= jQuery('#lcountry').find('option[value=\"'+val+'\"]').attr('id');
			jQuery('#lcities').load('".$path.$cpath."deppo/tools/script/location.php?ne=il&type=name&ID='+ID);
			});
			if(jQuery('#town').length){
				jQuery('#town').after('<datalist id=\"ltown\"></datalist>');
				jQuery('#cities').change(function(){
					var val = jQuery(this).val();
					var ID= jQuery('#lcities').find('option[value=\"'+val+'\"]').attr('id');
					jQuery('#ltown').load('".$path.$cpath."deppo/tools/script/location.php?ne=ilce&type=name&ID='+ID);
					});
				}
			}
			</script> \n";
if($f8==1){ //-- Preload -->
	$header	.= "
	<script>
	jQuery('#preload').fadeIn('slow');
	jQuery(window).load(function(){ jQuery('#preload').fadeOut('slow'); });
	</script>
	";
}
	//$inc_js 	.= "ckeditor,";
$header	.= "<script src=\"//cdn.ckeditor.com/4.19.0/basic/ckeditor.js\"></script> \n";
/*

$mkey=tanim("mkey","n1",0);
if($mkey<>""){
	$footer .='
		<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?v=3.exp&libraries=places&language=tr-TR&key=".$mkey."&signed_in=true&sensor=false"></script>
		<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/geocomplete/1.7.0/jquery.geocomplete.js"></script>
		<script>jQuery(function(){jQuery('.autocomplete').geocomplete({details:'.loc',detailsAttribute:'geo-data',types:['geocode','establishment']});});</script>
	';
}
*/
if($module["soldbox"]==1){
	$sqls=mysqli_query($conn, "select id,t1 from ".$_SESSION["lang"]." where ne='kayit' and s13=1 ".$tuser." order by RAND() limit 0,20"); while($sold=mysqli_fetch_assoc($sqls)){
		$psold[]="".linked("d",$sold['id'])."+".kisalt($sold['t1'],3)."+".medya($sold["id"],1,"kresim","t1","",$module["media_path"])."";
	}
	$psold=json_encode($psold, true);
	$footer .='
	<script>
	function randomArrayShuffle(array) {
		var currentIndex = array.length, temporaryValue, randomIndex;
		while (0 !== currentIndex) {
			randomIndex = Math.floor(Math.random() * currentIndex);
			currentIndex -= 1;
			temporaryValue = array[currentIndex];
			array[currentIndex] = array[randomIndex];
			array[randomIndex] = temporaryValue;
		}
		return array;
	}
	var rlocations=["Ankara","İstanbul","Bursa","Antalya","İzmir","Kayseri","Manisa","Hatay","Gaziantep","Kars","Trabzon","Sakarya","Sinop","Yozgat","Konya","Diyarbakır","Edirne","Adıyaman","Nevşehir","Tekirdağ","Giresun","Samsun","Adana","Mardin","Çanakkale","Adana","Aksaray","Kırşehir","Isparta","Rize","Eskişehir","Burdur","Bingöl","Aydın"];
	var rminutes=["1","2","3","4","5","4","3","2","1"];
	setInterval(function(){
		var sold = randomArrayShuffle('.$psold.')[0];
		var isold = sold.split("+");
		var div = "<div class=\"soldbox\" style=\"\"><img src=\""+ isold[2] +"\" style=\"width:50px; float:left;\" alt=\"\"><div style=\"float:left; margin-left: 15px; font-size:11px\">Sipariş verildi.<br><b>" + isold[1] + "</b></div><div style=\"position: absolute; right: 10px; bottom: 5px; font-size:11px\">" + randomArrayShuffle(rminutes)[0] + " dakika önce " + randomArrayShuffle(rlocations)[0] + " <a href=\""+ isold[0] +"\" target=\"_blank\" class=\"fa fa-eye\"></a></div></div>";
		jQuery(div).appendTo("body").delay(5000).fadeOut(2000);
		}, 33000);
		</script>
		';
	}
	if($sayfa1=="odeme" and $module["order_model"]=="1"){
		$footer .= "<script>jQuery('.orders').owlCarousel({loop:false,margin:10,nav:true,responsive:{0:{items:1},600:{items:3},1000:{items:3}}});</script>";
	}
	$inc_js 	.= "jasny-bootstrap,jquery.mask,";
	$inc_css 	.= "watolye,bootstrap_v4,";
	$header	.= "<script src=\"//cdn.".$cdnurl."/js/inc.js\" inc_js=\"".rtrim($inc_js,",")."\" inc_css=\"".rtrim($inc_css,",")."\" path=\"".$module["cdn_path"]."\" cpath=\"".$cpath."\" id=\"wjs\" lang=\"".$_SESSION["lang"]."\" url=\"".$_SERVER['SERVER_NAME']."\" pow=\"".$pow1."\" ver=\"".$pow2."\"></script> \n";
	echo $header;
	?>
	<?php if($f5=="1"){?>
		<script>jQuery(function(){if(jQuery('img.lazyload')[0]){jQuery('img.lazyload').lazyload({effect:'fadeIn',effectspeed:500,skip_invisible:false});}});</script>
<!-- <img data-original="" class="lazy" alt=""> -->
<?php }?>
