<?php
require_once 'ayar/Config.php';
include "header.php";
if ($Site->modul_ayarlari('anasayfaurunler') != "pasif") {
// Gelen Değer
$gelen = @get('id');
// Hit İşlemi + İstediğinize Bağlı
if($Site->urun($gelen,'aktifkontrol') == "aktif" || $Site->adminyetki(session("id"),'yetki')==1){
$okunma = $Site->urun($gelen,'urun_okunma');
$deneme = 1;
$hit =  $okunma+$deneme;
$okunma = $db->update('urunler')
	->where('urun_seflink',$gelen)
	->set(array(
		'urun_okunma' => $hit
	));

?>


	<?php if ($Site->urun($gelen,'urun_seo_title') != ''){ ?>
	<title>
		<?php echo $Site->urun($gelen,'urun_seo_title'); ?>
	</title>
	<?php } else { ?>
	<title>
		<?php echo $Site->urun($gelen,'urun_baslik'); ?>
	</title>
	<?php } ?>
	<meta name="description" content="<?php echo $Site->urun($gelen,'urun_seo_aciklama'); ?>">
	<meta name="keywords" content="<?php echo $Site->urun($gelen,'urun_seo_etiket'); ?>">
	<section id="agent-p-2" class="property-details bg_light padding">

		<div class="container">
			<div class="row">
				<div class="col-xs-12 bottom40"> </div>
				<div class="col-md-12"><br><br>
					<h2 class="text-uppercase"><span class="color_red"><?php echo $Site->urun($gelen,'urun_baslik'); ?></span></h2>
				</div>
			</div>
		</div>
		</div>
	</section>

	<!-- PROPERTY DETAILS -->
	<section class="property-details padding">
		<div class="container">
			<div class="row">
			</div>
			<div class="row">
				<div class="col-md-8">
					<div class="row">
						<div class="col-md-12">
							<div id="property-d-1" class="owl-carousel">
								<div class="item">
									<?php
						echo '<img src="upload/images/'.$Site->urun($gelen,'anasayfa_resim').'" width="40%" height="40%">&nbsp;&nbsp;<br>';
		  $urun_resimleri = explode(",",$Site->urun($gelen,'urun_resim'));
		  foreach($urun_resimleri as $uresim){
			?>
										<?php if ($Site->urun($gelen,'urun_resim') != "") { ?>

										<div class='col-sm-4 col-xs-6 col-md-3 col-lg-3'>
											<a class="thumbnail fancybox" rel="ligthbox" href="upload/images/<?php echo $uresim ?>">
						<img class="img-responsive" alt="<?php echo $uresim ?>" style="height:130px;width:150px;" title="Resmi Göster"; src="upload/images/<?php echo $uresim ?>" />
					</a>
										</div>
										<?php } ?>
										<?php } ?>
								</div>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-md-12">
							<div class="property-tab">
								<!-- Nav tabs -->
								<ul class="nav nav-tabs" role="tablist">
									<li role="presentation" class="active"><a href="#description" style="text-align:center;" aria-controls="description" role="tab" data-toggle="tab"><b><i class="fa fa-info-circle" aria-hidden="true"></i> Açıklaması</b></a></li>
									<?php if ($Site->urun($gelen,'urun_pdf_goster') == "1") { ?>
									<li role="presentation"><a href="#summary" style="text-align:center;" aria-controls="summary" role="tab" data-toggle="tab"><b><i class="fa fa-file-pdf-o" aria-hidden="true"></i> PDF</b></a></li>
									<?php } ?>
									<?php if ($Site->urun($gelen,'urun_video_goster') == "1") { ?>
									<li role="presentation"><a href="#features" style="text-align:center;" aria-controls="features" role="tab" data-toggle="tab"><b><i class="fa fa-youtube-play" aria-hidden="true"></i> Video</b></a></li>
									<?php } ?>

									<li role="presentation"><a href="#plan" style="text-align:center;" aria-controls="plan" role="tab" data-toggle="tab"><b><i class="fa fa-shopping-cart" aria-hidden="true"></i> Sipariş Formu</b></a></li>

								</ul>
								<!-- Tab panes -->
								<div class="tab-content">
									<div role="tabpanel" class="tab-pane active" id="description">
										<p class="p-font-15">
											<?php echo $Site->urun($gelen,'urun_text'); ?><br>
										</p>
									</div>

									<!-- Tab panes -->
									<?php if ($Site->urun($gelen,'urun_pdf_goster') == "1") { ?>
									<div role="tabpanel" class="tab-pane " id="summary">
										<p class="p-font-15">
											<div align="center">
												<iframe id="fred" style="border:1px solid #000000;" src="upload/images/pdf/<?php echo $Site->urun($gelen,'urun_pdf'); ?>" frameborder="1" scrolling="auto" height="450" width="100%"></iframe>
											</div>
										</p>
									</div>
									<?php } ?>
									<!-- Tab panes -->

									<div role="tabpanel" class="tab-pane " id="features">
										<p class="p-font-15">
											<div align="center">
												<iframe width="560" height="315" src="https://www.youtube.com/embed/<?php echo $Site->urun($gelen,'urun_video'); ?>" frameborder="0" allowfullscreen></iframe>
											</div>
										</p>
									</div>

									<!-- Tab panes -->

									<div role="tabpanel" class="tab-pane " id="plan">
										<div class="row top5">
											<div class="col-xs-12">
												<?php error_reporting(0);
					if($_POST){
						// Formdan Gelen Bilgiler
						$siparisler_adsoyad = post('siparisler_adsoyad');
						$siparisler_email   = post('siparisler_email');
						$siparisler_konu    = $Site->urun($gelen,'urun_baslik');
						$siparisler_text    = post('siparisler_text');
						// İletişime Geç
						$Site->siparisler($siparisler_adsoyad,$siparisler_email,$siparisler_konu,$siparisler_text);

						if($Site->site_ayarlari('siparismailgonderilsinmi')==1){
						//mail
						$mailicerik  = $siparisler_adsoyad."<br>";
						$mailicerik .= $siparisler_email."<br>";
						$mailicerik .= $siparisler_konu."<br>";
						$mailicerik .= $siparisler_text."<br>";

							$smtp_server = $Site->site_ayarlari('smtp_server');
							$smtp_port = $Site->site_ayarlari('smtp_port');
							$smtp_protokol =   $Site->site_ayarlari('smtp_protokol');
							$e_posta =   $Site->site_ayarlari('e_posta');
							$e_posta_sifre =   $Site->site_ayarlari('e_posta_sifre');
							$gonderici_bilgi = $Site->site_ayarlari('gonderici_bilgi');
							$gidecek_e_posta = $Site->site_ayarlari('gidecek_e_posta');

						include "ayar/class.phpmailer.php";
						$mail = new PHPMailer();
						$mail->IsSMTP();
						$mail->SMTPDebug = 1;
						$mail->SMTPAuth = true;
						$mail->SMTPSecure = $smtp_protokol ;
						$mail->Host = $smtp_server;
						$mail->Port = $smtp_port;
						$mail->IsHTML(true);
						$mail->Username = $e_posta;
						$mail->Password = $e_posta_sifre;
						$mail->SetFrom($mail->Username, $iletisim_adsoyad);

						$mail->CharSet = 'UTF-8';
						$mail->Subject = $iletisim_konu;
						$content = $mailicerik;
						$mail->MsgHTML($content);
						$mail->AddAddress($gidecek_e_posta, $gonderici_bilgi);
						if($mail->Send()) {
						} else {

								echo $mail->ErrorInfo;
						}
					}
					}
				?>
												<form action="" method="post" class="findus">
													<div class="row">
														<div class="col-sm-6">
															<div class="single-query">
																<input type="text" placeholder="Adınız" class="keyword-input" required name="siparisler_adsoyad">
															</div>
															<div class="single-query">
																<input type="email" placeholder="E-Posta" class="keyword-input" required name="siparisler_email">
															</div>
															<div class="single-query">
																<input name="siparisler_konu" type="text" disabled="" required class="keyword-input" required name="siparisler_konu" value="<?php echo $Site->urun($gelen,'urun_baslik'); ?>">
															</div>
														</div>
														<div class="col-sm-6">
															<div class="single-query">
																<textarea required name="siparisler_text" placeholder="İletişim ve Siparişinizle İlgili Mesajınızı Yazınız"></textarea>
															</div>
														</div>
														<div class="col-sm-12">
															<input type="submit" value="Siparişi Gönder" class="btn_fill">
														</div>
													</div>
												</form>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="col-md-4 col-sm-4 col-xs-12">
					<div class="property-query-area">
						<div class="row">
							<div class="col-md-12">
								<?php if ($Site->modul_ayarlari('fiyatgoster') == "aktif") { if ($Site->urun($gelen,'fiyat_goster')==1){ ?>
									<h2 class="text-uppercase  bottom40"><?php echo $Site->urun($gelen,'urun_fiyat')?> <span class="color_red"><i class="fa fa fa-try"></i></span></h2>
									<?php } else { ?>
									<?php }} else { ?>
									<h2 class="text-uppercase  bottom40" style="font-size:14px;"><?=$Site->modul_ayarlari('fiyattext');?></h2>
									<?php  } ?>
							</div>
						</div>
						<div class="row">
							<form class="findus">
								<div class="col-md-12">
									<div class="single-query">
										<h3 class="text-uppercase  bottom40 top40">İlginizi <span class="color_red">Çekebilir</span></h3>
										<?php
						$urunler = $Site->benzerurunlistele();
						foreach ($urunler as $key => $value){
					?>
											<div class="media">
												<div class="media-left media-middle"> <a href="Urun/<?php echo $value['urun_seflink'] ?>"> <img class="media-object" src="upload/images/<?php echo $value['anasayfa_resim'] ?>" style="width:110px; height:90px;" alt="image"> </a> </div>
												<div class="media-body">
													<h6 class="media-heading"><a href="Urun/<?php echo $value['urun_seflink'] ?>"><?php echo $value['urun_baslik']; ?></a></h6>
													<p>
														<?php
														if ($Site->modul_ayarlari('fiyatgoster') == "aktif") { if ($value['fiyat_goster']==1){
															echo $value['urun_fiyat'] ?> <i class="fa fa fa-try"></i>
													<?php	} else { ?>
														<?php }} else { ?>
												 <?=$Site->modul_ayarlari('fiyattext');?> </p>
														<?php	} ?>
												</div>
											</div>
											<?php } ?>
									</div>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
	</section>
	<br>
	<!-- PROPERTY DETAILS -->
	<?php include "footer.php";
}
else {
	git("index.php",0);
}

}
else {
git("index.php",0);
	?>
	<?php
}
?>
