<?php include("header.php");?>
<?php
if(isset($_POST['site_title']))
{
	$site_title 		= p('site_title');
	$site_meta  		= p('site_meta');
	$site_desc 			= p('site_desc');
	$renk	 			= p('renk');
	
	$firma_adi 			= p('firma_adi');
	$firma_tel			= p('firma_tel');
	$firma_fax 			= p('firma_fax');
	$firma_email		= p('firma_email');
	$firma_adres		= p('firma_adres');
	$favicon		= p('favicon');
	
	$google_analytics 	= addslashes($_POST['google_analytics']);
	$google_maps 		= addslashes($_POST['google_maps']);
	$ksozlesme 			= addslashes($_POST['ksozlesme']);
	
	$facebook 			= p('facebook');
	$twitter 			= p('twitter');
	$gplus 				= p('gplus');
	$instagram 			= p('instagram');
	$tanitim 			= p('tanitim');
	$hsaat 			= p('hsaat');
	$hdsaat 			= p('hdsaat');
	$zopim 			= p('zopim');
	$stmpadres 			= p('stmpadres');
	$stmpsifre 			= p('stmpsifre');
	$stmpserver 		= p('stmpserver');
	$stmpport 			= p('stmpport');
	$pinterest 			= p('pinterest');
	$obilgi 			= p('obilgi');
	$satis 			= p('satis');
	$tema 			= p('tema');
	$copyright 			= p('copyright');
	
	include_once('class.upload.php');
	$upload = new upload($_FILES['firma_logo']);
	if ($upload->uploaded){
	$upload->file_auto_rename = true;
	$upload->image_ratio_x = true;
	$upload->process("../resimler/logo");
	if ($upload->processed){
	$firmalogo=''.$upload->file_dst_name.'';
	}
	}
	if($firmalogo!="")
	{
	$ayar_duzenle_sorgu=mysql_query("UPDATE ayarlar SET 
									site_title			=	'$site_title',
									site_meta			=	'$site_meta', 
									site_desc			=	'$site_desc', 
									firma_adi			=	'$firma_adi',
									firma_tel			=	'$firma_tel',
									renk				=	'$renk',
									firma_fax			=	'$firma_fax',
									firma_email			=	'$firma_email',
									firma_logo			=	'$firmalogo',
									firma_adres			=	'$firma_adres',
									google_analytics	=	'$google_analytics',
									google_maps			=	'$google_maps',
									facebook			=	'$facebook',
									twitter				=	'$twitter',
									ksozlesme			=	'$ksozlesme',
									obilgi			=	'$obilgi',
									satis			=	'$satis',
									gplus				=	'$gplus',
									instagram			=	'$instagram',
									tanitim			=	'$tanitim',
									hsaat			=	'$hsaat',
									hdsaat			=	'$hdsaat',
									zopim			=	'$zopim',
									stmpadres			=	'$stmpadres',
									stmpsifre			=	'$stmpsifre',
									stmpserver			=	'$stmpserver',
									stmpport			=	'$stmpport',
									pinterest			=	'$pinterest',
									tema			=	'$tema',
									copyright			=	'$copyright'
									WHERE id			=	'1'");
									$gitti=$firmalogo=''.$upload->file_dst_name.'';
									  $kaynak_katalog = $_FILES["favicon"]["tmp_name"];  
				  $yeni_isim_katalog = "favicon.ico";
				  $hedef_katalog  = "../resimler/".$yeni_isim_katalog; 
				  
				  $gitti=move_uploaded_file($kaynak_katalog,$hedef_katalog);
	}else{
			$ayar_duzenle_sorgu=mysql_query("UPDATE ayarlar SET
										site_title			=	'$site_title',
										site_meta			=	'$site_meta', 
										site_desc			=	'$site_desc', 
										firma_adi			=	'$firma_adi',
										firma_tel			=	'$firma_tel',
										firma_fax			=	'$firma_fax',
										renk				=	'$renk',
										firma_email			=	'$firma_email',
										firma_adres			=	'$firma_adres',
										google_analytics	=	'$google_analytics',
										google_maps			=	'$google_maps',
										facebook			=	'$facebook',
										twitter				=	'$twitter',
										ksozlesme			=	'$ksozlesme',
										obilgi			=	'$obilgi',
									    satis			=	'$satis',
										gplus				=	'$gplus',
										instagram			=	'$instagram',
										tanitim			=	'$tanitim',
									hsaat			=	'$hsaat',
									hdsaat			=	'$hdsaat',
									zopim			=	'$zopim',
									stmpadres			=	'$stmpadres',
									stmpsifre			=	'$stmpsifre',
									stmpserver			=	'$stmpserver',
									stmpport			=	'$stmpport',
										pinterest			=	'$pinterest',
										tema			=	'$tema',
										copyright			=	'$copyright'
										WHERE id			=	'1'");
				  $kaynak_katalog = $_FILES["favicon"]["tmp_name"];  
				  $yeni_isim_katalog = "favicon.ico";
				  $hedef_katalog  = "../resimler/".$yeni_isim_katalog; 
				  
				  $gitti=move_uploaded_file($kaynak_katalog,$hedef_katalog);
		}
								
				   $bilgi = '    <div class="alert alert-success alert-block fade in">
                                  <button data-dismiss="alert" class="close close-sm" type="button">
                                      <i class="fa fa-times"></i>
                                  </button>
                                  <h4>
                                      <i class="fa fa-ok-sign"></i>
                                      Başarılı!
                                  </h4>
                                  <p>Başarıyla güncellenmiştir...</p>
                              </div>
		 ' ;
	
}

	$ayar_dizi	=	Sonuc(Sorgu("SELECT * FROM ayarlar WHERE id = '1'"));

?>


 <!--main content start-->
      <section id="main-content">
          <section class="wrapper">
              <!-- page start-->
        
            

              <div class="row">
                  <div class="col-lg-12">
				    <?php echo $bilgi;?>
                      <section class="panel">
                          <header class="panel-heading">
                            Genel Site Ayarları
                          </header>
                          <div class="panel-body">
                              <form class="form-horizontal tasi-form" method="post" action="" enctype="multipart/form-data">
							  
							  

                                  <div class="form-group">
                                      <label class="col-sm-2 col-sm-2 control-label">Site Title</label>
                                      <div class="col-sm-10">
                                         <input type="text" class="form-control" name="site_title" value="<?php echo $ayar_dizi->site_title;?>" id="site_title" placeholder="Site Title">
                                      </div>
                                  </div>
                             
							 
							 
							  <div class="form-group">
                                      <label class="col-sm-2 col-sm-2 control-label">Site Meta</label>
                                      <div class="col-sm-10">
                               <div class="panel-body">
                                      <input name="site_meta" value="<?php echo $ayar_dizi->site_meta;?>" class="tagsinput"  style="display: none;">
                                  </div>
                                      </div>
                                  </div>
								  
								  
								  
								   <div class="form-group">
                                      <label class="col-sm-2 col-sm-2 control-label">Site Açıklaması</label>
                                      <div class="col-sm-10">
                                         <input type="text" class="form-control" name="site_desc" value="<?php echo $ayar_dizi->site_desc;?>" id="site_desc" placeholder="Site Açıklama">
                                      </div>
                                  </div>
								  
								  
						
						 
						 
						             <div class="form-group last">
                                          <label class="col-sm-2 col-sm-2 control-label">Site Logo</label>
                                           <div class="col-sm-10">
                                              <div class="fileupload fileupload-new" data-provides="fileupload">
                                               <div class="fileupload-new thumbnail" style="width: 200px; height: 150px;">
                                               <?php if($_GET['islem']=='duzenle'){?>
											   <?php if($ayar_dizi->firma_logo){?>
                                               <img src="../resimler/logo/<?php echo $ayar_dizi->firma_logo;?>" style="width: 200px; height: 200px;" alt="" />
                                               <?php } else { ?>
                                              <img src="http://www.placehold.it/200x150/EFEFEF/AAAAAA&amp;text=no+image" alt="" />
                                              <?php }?>
											  <?php } else { ?>
                                             <?php if($ayar_dizi->firma_logo){?>
											   <img src="../resimler/logo/<?php echo $ayar_dizi->firma_logo;?>" style="width: 200px; height: 200px;" alt="" />
                                               <?php } else { ?>
                                              <img src="http://www.placehold.it/200x150/EFEFEF/AAAAAA&amp;text=no+image" alt="" />
                                              <?php }?>
											   <?php }?>
                                              </div>
                                                  <div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
                                                  <div>
                                                   <span class="btn btn-white btn-file">
                                                   <span class="fileupload-new"><i class="fa fa-paper-clip"></i> Resim Seç</span>
                                                   <span class="fileupload-exists"><i class="fa fa-undo"></i> Değiştir</span>
                                                   <input type="file" name="firma_logo" class="default" />
                                                   </span>
                                                      <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload"><i class="fa fa-trash"></i> Sil</a>
                                                  </div>
                                              </div>
                                            
                                          </div>
                                      </div>
						 
						 
						 
							 
						             <div class="form-group last">
                                          <label class="col-sm-2 col-sm-2 control-label">Site Favicon <br><br> <center>(favicon.ico) adında yükleme yapın!!</center>
										  <br><br> <center>URL (../resimler/favicon.ico)</center></label>
                                           <div class="col-sm-10">
                                              <div class="fileupload fileupload-new" data-provides="fileupload">
                                               <div class="fileupload-new thumbnail" style="width: 200px; height: 150px;">
                                               <?php if($_GET['islem']=='duzenle'){?>
											   <?php if($ayar_dizi->favicon){?>
                                               <img src="../resimler/favicon.ico" style="width: 200px; height: 200px;" alt="" />
                                               <?php } else { ?>
                                              <img src="http://www.placehold.it/200x150/EFEFEF/AAAAAA&amp;text=no+image" alt="" />
                                              <?php }?>
											  <?php } else { ?>
                                             <?php if($ayar_dizi->favicon){?>
											   <img src="http://www.placehold.it/200x150/EFEFEF/AAAAAA&amp;text=no+image" style="width: 200px; height: 200px;" alt="" />
                                               <?php } else { ?>
                                              <img src="../resimler/favicon.ico" alt="" />
                                              <?php }?>
											   <?php }?>
                                              </div>
                                                  <div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
                                                  <div>
                                                   <span class="btn btn-white btn-file">
                                                   <span class="fileupload-new"><i class="fa fa-paper-clip"></i> Resim Seç</span>
                                                   <span class="fileupload-exists"><i class="fa fa-undo"></i> Değiştir</span>
                                                   <input type="file" name="favicon" class="default" />
                                                   </span>
                                                      <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload"><i class="fa fa-trash"></i> Sil</a>
                                                  </div>
                                              </div>
                                            
                                          </div>
                                      </div>
						 
				
                         
						 
						      
						 
						 
						 
						 
						           <div class="form-group">
                                      <label class="col-sm-2 col-sm-2 control-label">Başlık</label>
                                      <div class="col-sm-10">
                                        <input type="text" class="form-control" name="firma_adi" value="<?php echo $ayar_dizi->firma_adi;?>" id="firma_adi" placeholder="Firma Adı">
                                      </div>
                                  </div>
								  
						 
						                <div class="form-group">
                                         <label class="col-sm-2 col-sm-2 control-label">Firma Footer Açıklaması</label>
                                          <div class="col-sm-10">
                                              <textarea name="tanitim" class="form-control" rows="10"><?php echo $ayar_dizi->tanitim;?></textarea>
                                          </div>
                                      </div>
						 
						 
						 
						 
						 
						 		 
			
						              <div class="form-group">
                                         <label class="col-sm-2 col-sm-2 control-label">Firma Adresi</label>
                                          <div class="col-sm-10">
                                              <textarea name="firma_adres" class="form-control" rows="10"><?php echo $ayar_dizi->firma_adres;?></textarea>
                                          </div>
                                      </div>
						 
						 
						 		 <div class="form-group">
                                      <label class="col-sm-2 control-label col-lg-2" for="inputSuccess">İletişim Bilgileri</label>
                                      <div class="col-lg-10">
                                          <div class="row">
                                              <div class="col-lg-4">
                                                 <input value="<?php echo $ayar_dizi->firma_tel;?>" name="firma_tel" placeholder=""  class="form-control" type="text">
                                              </div>
											   <div class="col-lg-4">
                                                <input value="<?php echo $ayar_dizi->firma_fax;?>" name="firma_fax" placeholder=""  class="form-control" type="text">
                                              </div>
                                              <div class="col-lg-4">
                                                  <input type="text" class="form-control" name="firma_email" value="<?php echo $ayar_dizi->firma_email;?>" id="firma_email" placeholder="">
                                              </div>
                                           
											 
                                          </div>

                                      </div>
                                  </div>
						 
						 
						 
						 
						 <div class="form-group">
                                      <label class="col-sm-2 control-label col-lg-2" for="inputSuccess">Modül</label>
                                      <div class="col-lg-10">
                                          <div class="row">
                                              <div class="col-lg-4">SSS Video Linki: https://www.youtube.com/watch?v=<b>DMFwWOrAVRk</b> koyu alan
                                                  <input class="form-control" name="stmpserver" value="<?php echo $ayar_dizi->stmpserver;?>" placeholder="SSS Video Linki" type="text">
                                              </div>
											   
											 
                                          </div>

                                      </div>
                                  </div>
						 
						 
						    <div class="form-group">
                                         <label class="col-sm-2 col-sm-2 control-label">Google Maps Kodu</label>
                                          <div class="col-sm-10">
                                              <textarea name="google_maps" class="form-control" rows="10"><?php echo $ayar_dizi->google_maps;?></textarea>
                                          </div>
                                      </div>
						 
						   <div class="form-group">
                                         <label class="col-sm-2 col-sm-2 control-label">Google Analytics</label>
                                          <div class="col-sm-10">
                                              <textarea name="google_analytics" class="form-control" rows="10"><?php echo $ayar_dizi->google_analytics;?></textarea>
                                          </div>
                                      </div>
						 
						 
						 	   <div class="form-group">
                                         <label class="col-sm-2 col-sm-2 control-label">Müşteri Destek Kodu</label>
                                          <div class="col-sm-10">
                                              <textarea name="zopim" class="form-control" rows="10"><?php echo $ayar_dizi->zopim;?></textarea>
                                          </div>
                                      </div>
						 
						 
						 
						 
						 
						 			 
						 <div class="form-group">
                                      <label class="col-sm-2 control-label col-lg-2" for="inputSuccess">Sosyal Medya Hesapları</label>
                                      <div class="col-lg-10">
                                          <div class="row">
                                              <div class="col-lg-4">
                                                   <input type="text" class="form-control" name="facebook" value="<?php echo $ayar_dizi->facebook;?>" id="facebook" placeholder="Facebook Sayfa URL">
                                              </div>
											   <div class="col-lg-4">
                                                   <input type="text" class="form-control" name="twitter" value="<?php echo $ayar_dizi->twitter;?>" id="twitter" placeholder="Twitter Sayfa URL">
                                              </div>
                                              <div class="col-lg-4">
                                                    <input type="text" class="form-control" name="instagram" value="<?php echo $ayar_dizi->instagram;?>" id="instagram" placeholder="İnstagram Sayfa URL">
                                              </div>
                                           
										   
										    <div class="col-lg-4">
                                                    <input type="text" class="form-control" name="gplus" value="<?php echo $ayar_dizi->gplus;?>" id="gplus" placeholder="Youtube Sayfa URL">
                                              </div>
											 
											 
											    <div class="col-lg-4">
                                                    <input type="text" class="form-control" name="pinterest" value="<?php echo $ayar_dizi->pinterest;?>" id="pinterest" placeholder="Linkedin Sayfa URL">
                                              </div>
											  
											  
                                          </div>

                                      </div>
                                  </div>
						 
						 
				
						 
						 
						     <div class="form-group">
                                      <label class="col-sm-2 col-sm-2 control-label">Copyright</label>
                                      <div class="col-sm-10">
                                        <input type="text" class="form-control" name="copyright" value="<?php echo $ayar_dizi->copyright;?>" id="copyright" placeholder="Copyright Metni">
                                      </div>
                                  </div>
								  
						 
						 
						 
						         <div class="form-group">
                                        <div class="col-sm-10">
									    <?php if($_GET['islem']=="duzenle"){?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                          <button class="btn btn-shadow btn-danger" type="submit">Güncelle</button>
										  <?php }else{?>
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
										  <button class="btn btn-shadow btn-success" type="submit">Kaydet</button>
										   <?php } ?>
                                      </div>
                                  </div>
						 
						 
						 
						 
						 
						 
                              </form>
                          </div>
                      </section>
                  
                      

           

               

                  </div>
              </div>
              <!-- page end-->
          </section>
      </section>
      <!--main content end-->





















<?php include("footer.php");?>