src/Twig/AppExtension.php line 1614

Open in your IDE?
  1. <?php
  2. // src/Twig/AppExtension.php
  3. namespace App\Twig;
  4. use App\Entity\Dil;
  5. use SebastianBergmann\Environment\Runtime;
  6. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  7. use Twig\Extension\AbstractExtension;
  8. use Twig\TwigFilter;
  9. use App\Twig\AppRuntime;
  10. use Doctrine\ORM\EntityManagerInterface;
  11. use App\Entity\Ceviri;
  12. use App\Entity\Istatistik;
  13. class AppExtension extends AbstractExtension
  14. {
  15.     private $em;
  16.     private $session;
  17.     public function __construct(SessionInterface $session ,EntityManagerInterface $em) {
  18.         $this->em $em;
  19.         $this->session $session;
  20.     }
  21.     public function getFilters()
  22.     {
  23.         return [
  24.             /*            new TwigFilter('test', [AppRuntime::class, 'test']),*/
  25.             new TwigFilter('imgOlustur', [$this'imgOlustur']),
  26.             new TwigFilter('timthumb', [$this'timthumb']),
  27.             new TwigFilter('seo', [$this'seo']),
  28.             new TwigFilter('tarih_yaz', [$this'tarih_yaz']),
  29.             new TwigFilter('base64_encode', [$this'base64_encode']),
  30.             new TwigFilter('base64_decode', [$this'base64_decode']),
  31.             new TwigFilter('yandexToken', [$this'yandexToken']),
  32.             new TwigFilter('cevir', [$this'cevir']),
  33.             new TwigFilter('ceviri', [$this'ceviri']),
  34.             new TwigFilter('ayarlar', [$this'ayarlar']),
  35.             new TwigFilter('dilSay', [$this'dilSay']),
  36.             new TwigFilter('panelSayfaGetir', [$this'panelSayfaGetir']),
  37.             new TwigFilter('panelKategoriGetir', [$this'panelKategoriGetir']),
  38.             new TwigFilter('mesajSay', [$this'mesajSay']),
  39.             new TwigFilter('mesajBul', [$this'mesajBul']),
  40.             new TwigFilter('bildirimSay', [$this'bildirimSay']),
  41.             new TwigFilter('bildirimBul', [$this'bildirimBul']),
  42.             new TwigFilter('altKategoriBul', [$this'altKategoriBul']),
  43.             new TwigFilter('altKategoriBul2', [$this'altKategoriBul2']),
  44.             new TwigFilter('altKategoriGeriYaz', [$this'altKategoriGeriYaz']),
  45.             new TwigFilter('altKategoriListe', [$this'altKategoriListe']),
  46.             new TwigFilter('kategoriDetay', [$this'kategoriDetay']),
  47.             new TwigFilter('istatistik', [$this'istatistik']),
  48.             new TwigFilter('yetkiler', [$this'yetkiler']),
  49.             new TwigFilter('GetIP', [$this'GetIP']),
  50.             new TwigFilter('get_browser_name', [$this'get_browser_name']),
  51.             new TwigFilter('html_entity_decode', [$this'html_entity_decode']),
  52.             new TwigFilter('site_istatistik', [$this'site_istatistik']),
  53.             new TwigFilter('site_anaLink', [$this'site_anaLink']),
  54.             new TwigFilter('site_menuGetir', [$this'site_menuGetir']),
  55.             new TwigFilter('site_footerMetin', [$this'site_footerMetin']),
  56.             new TwigFilter('site_footerSayfa', [$this'site_footerSayfa']),
  57.             new TwigFilter('site_iletisimBilgileri', [$this'site_iletisimBilgileri']),
  58.             new TwigFilter('site_sosyalAglar', [$this'site_sosyalAglar']),
  59.             new TwigFilter('site_sliders', [$this'site_sliders']),
  60.             new TwigFilter('site_sayfaIcerik', [$this'site_sayfaIcerik']),
  61.             new TwigFilter('site_sayfaIcerikDirek', [$this'site_sayfaIcerikDirek']),
  62.             new TwigFilter('site_sayfaIcerikKategori', [$this'site_sayfaIcerikKategori']),
  63.             new TwigFilter('site_dilGetir', [$this'site_dilGetir']),
  64.             new TwigFilter('site_dilGetir2', [$this'site_dilGetir2']),
  65.             new TwigFilter('site_popupGetir', [$this'site_popupGetir']),
  66.             new TwigFilter('site_bannerGetir', [$this'site_bannerGetir']),
  67.             new TwigFilter('site_formGetir', [$this'site_formGetir']),
  68.             new TwigFilter('site_kategoriGeriLi', [$this'site_kategoriGeriLi']),
  69.             new TwigFilter('site_sayfaKategori', [$this'site_sayfaKategori']),
  70.             new TwigFilter('site_formVeriGetir', [$this'site_formVeriGetir']),
  71.             new TwigFilter('digerDiller', [$this'digerDiller']),
  72.             new TwigFilter('taslakBul', [$this'taslakBul']),
  73.             new TwigFilter('popupGetir', [$this'popupGetir']),
  74.             new TwigFilter('IdBul', [$this'IdBul']),
  75.             new TwigFilter('anasayfaIcerikleri', [$this'anasayfaIcerikleri']),
  76.             new TwigFilter('ustMenuler', [$this'ustMenuler']),
  77.             new TwigFilter('veriYenile', [$this'veriYenile']),
  78.             new TwigFilter('kategoriVeriYenile', [$this'kategoriVeriYenile']),
  79.             new TwigFilter('icerikSolMenuler', [$this'icerikSolMenuler']),
  80.             new TwigFilter('footerSayfaDilgrup', [$this'footerSayfaDilgrup']),
  81.         ];
  82.     }
  83.     public function html_entity_decode($degisken){
  84.         $degisken html_entity_decode($degiskenENT_QUOTES,"UTF-8");
  85.         return $degisken;
  86.     }
  87.     public function timthumb($resim$yol$w$h$zc$q)
  88.     {
  89.         return $this->ayarlar('siteYolu') . 'timthumb.php?src=' $yol $resim '&w=' $w '&h=' $h '&zc=' $zc '&q=' $q;
  90.     }
  91.     function seo($url,$dil=1)
  92.     {
  93.         if($dil==1) {
  94.             $tr = array('ş','Ş','ı','I','İ','ğ','Ğ','ü','Ü','ö','Ö','Ç','ç','(',')','/',':',',');
  95.             $eng = array('s','s','i','i','i','g','g','u','u','o','o','c','c','','','-','-','');
  96.             $s str_replace($tr,$eng,$url);
  97.             $find = array('/[^A-Za-z0-9\-<>]/''/[\-]+/''/<[^>]*>/');
  98.             $repl = array('-''-''-');
  99.             $s preg_replace($find$repl$s);
  100.             $s strtolower($s);
  101.             $s preg_replace('/&amp;amp;amp;amp;amp;amp;amp;amp;amp;.+?;/'''$s);
  102.             $s preg_replace('/\s+/''-'$s);
  103.             $s preg_replace('|-+|''-'$s);
  104.             $s preg_replace('/#/'''$s);
  105.             $s str_replace('.'''$s);
  106.             $s trim($s'-');
  107.             $s strtolower($s);
  108.             return $s;
  109.         }else{
  110.             $tr = array('('')''/'':'',');
  111.             $eng = array('''''-''-''');
  112.             $s str_replace($tr$eng$url);
  113.             $find = array('/[^A-Za-z0-9\-<>]/''/[\-]+/''/<[^>]*>/');
  114.             $repl = array('-''-''-');
  115.             $s preg_replace($find$repl$s);
  116.             $s strtolower($s);
  117.             $s preg_replace('/&amp;amp;amp;amp;amp;amp;amp;amp;amp;.+?;/'''$s);
  118.             $s preg_replace('/\s+/''-'$s);
  119.             $s preg_replace('|-+|''-'$s);
  120.             $s preg_replace('/#/'''$s);
  121.             $s str_replace('.'''$s);
  122.             $s trim($s'-');
  123.             $s strtolower($s);
  124.             return $s;
  125.         }
  126.     }
  127.     public function tarih_yaz($tarih){
  128.         $aylar = array('January','February','March','April','May','June','July','August','September','October','November','December','Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
  129.         $aylar2 = array('Ocak','Şubat','Mart','Nisan','Mayıs','Haziran','Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık','Pazar','Pazartesi','Salı','Çarşamba','Perşembe','Cuma','Cumartesi');
  130.         $return str_replace($aylar$aylar2$tarih);
  131.         return $return;
  132.     }
  133.     public function base64_encode($veri){
  134.         return base64_encode($veri);
  135.     }
  136.     public function base64_decode($veri){
  137.         return base64_decode($veri);
  138.     }
  139.     function yandexToken(){
  140.         $curl curl_init();
  141.         curl_setopt_array($curl, array(
  142.             CURLOPT_URL => 'https://iam.api.cloud.yandex.net/iam/v1/tokens',
  143.             CURLOPT_RETURNTRANSFER => true,
  144.             CURLOPT_ENCODING => '',
  145.             CURLOPT_MAXREDIRS => 10,
  146.             CURLOPT_TIMEOUT => 0,
  147.             CURLOPT_FOLLOWLOCATION => true,
  148.             CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  149.             CURLOPT_CUSTOMREQUEST => 'POST',
  150.             CURLOPT_POSTFIELDS =>'{
  151.     "yandexPassportOauthToken":"y0_AgAAAAAZYEETAATuwQAAAADuaUPsZ3x4KXscRqel7NbnsyEYPaf2HWE"
  152. }',
  153.             CURLOPT_HTTPHEADER => array(
  154.                 'Content-Type: application/json'
  155.             ),
  156.         ));
  157.         $response curl_exec($curl);
  158.         $response json_decode($responsetrue);
  159.         return $response['iamToken'];
  160.     }
  161.     function cevir($deger,$dil){
  162.         $token $this->yandexToken();
  163.         $curl curl_init();
  164.         curl_setopt_array($curl, array(
  165.             CURLOPT_URL => 'https://translate.api.cloud.yandex.net/translate/v2/translate',
  166.             CURLOPT_RETURNTRANSFER => true,
  167.             CURLOPT_ENCODING => '',
  168.             CURLOPT_MAXREDIRS => 10,
  169.             CURLOPT_TIMEOUT => 0,
  170.             CURLOPT_FOLLOWLOCATION => true,
  171.             CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  172.             CURLOPT_CUSTOMREQUEST => 'POST',
  173.             CURLOPT_POSTFIELDS =>'{
  174.     "folderId": "b1g1l9b33ueptm8liaou",
  175.     "texts": "'.$deger.'",
  176.     "targetLanguageCode": "'.$dil.'"
  177. }',
  178.             CURLOPT_HTTPHEADER => array(
  179.                 'Authorization: Bearer '.$token,
  180.                 'Content-Type: application/json'
  181.             ),
  182.         ));
  183.         $response curl_exec($curl);
  184.         $response json_decode($responsetrue);
  185.         return $response['translations'][0]['text'];
  186.     }
  187.     public function ceviri($deger,$suanDil='')
  188.     {
  189.         $em $this->em;
  190.         if ($suanDil=='') {
  191.             $suanDil $this->session->get('dil');
  192.         }else{
  193.             $qb $em->createQueryBuilder();
  194.             $dill=$qb->select('d.id,d.kisa,d.uzun')
  195.                 ->from('App:Dil''d')
  196.                 ->where('d.id='.$suanDil)
  197.                 ->getQuery()
  198.                 ->getScalarResult();
  199.             $suanDil $dill[0];
  200.         }
  201.         $qb $em->createQueryBuilder();
  202.         $ceviriTara=$qb->select('c.deger,c.id')
  203.             ->from('App:Ceviri''c')
  204.             ->join('c.dil','d')
  205.             ->where("c.deger='$deger'")
  206.             ->getQuery()
  207.             ->getScalarResult();
  208.         if (count($ceviriTara) > 0) {
  209.             if ($suanDil['id'] != 1) {
  210.                 $qb $em->createQueryBuilder();
  211.                 $ceviriTara2=$qb->select('c.deger')
  212.                     ->from('App:Ceviri''c')
  213.                     ->join('c.dil','d')
  214.                     ->where("d.id=".$suanDil['id']." and c.trId=".$ceviriTara[0]['id'])
  215.                     ->getQuery()
  216.                     ->getScalarResult();
  217.                 if (count($ceviriTara2) > 0) {
  218.                     $veri $ceviriTara2[0]['deger'];
  219.                 } else {
  220.                     if ($this->session->get('dil')['id'] != '1') {
  221.                         $deger $this->cevir($deger,$suanDil['kisa']);
  222.                         $dill $em->getReference(Dil::class,$suanDil['id']);
  223.                         $ceviri = new Ceviri();
  224.                         $ceviri->setDil($dill);
  225.                         $ceviri->setDeger($deger);
  226.                         $ceviri->setTrId($ceviriTara[0]['id']);
  227.                         $em->persist($ceviri);
  228.                         $em->flush();
  229.                         $veri $deger;
  230.                     }
  231.                 }
  232.             } else {
  233.                 $veri $deger;
  234.             }
  235.         }
  236.         else {
  237.             if ($suanDil['id'] == 1) {
  238.                 $dill $em->getReference(Dil::class,$suanDil['id']);
  239.                 $ceviri = new Ceviri();
  240.                 $ceviri->setDil($dill);
  241.                 $ceviri->setDeger($deger);
  242.                 $ceviri->setTrId(0);
  243.                 $em->persist($ceviri);
  244.                 $em->flush();
  245.                 $veri $deger;
  246.             }
  247.             else {
  248.                 $dilTr $em->getReference(Dil::class,1);
  249.                 $ceviri = new Ceviri();
  250.                 $ceviri->setDil($dilTr);
  251.                 $ceviri->setDeger($deger);
  252.                 $ceviri->setTrId(0);
  253.                 $em->persist($ceviri);
  254.                 $em->flush();
  255.                 $deger $this->cevir($deger,$suanDil['kisa']);
  256.                 $dill $em->getReference(Dil::class,$suanDil['id']);
  257.                 $ceviriDil = new Ceviri();
  258.                 $ceviriDil->setDil($dill);
  259.                 $ceviriDil->setDeger($deger);
  260.                 $ceviriDil->setTrId($ceviri->getId());
  261.                 $em->persist($ceviriDil);
  262.                 $em->flush();
  263.                 $veri $deger;
  264.             }
  265.         }
  266.         return $veri;
  267.     }
  268.     public function ayarlar($alan,$dil='')
  269.     {
  270.         if($dil=='') {
  271.             $em $this->em;
  272.             $qb $em->createQueryBuilder();
  273.             $dd $qb->select("e.id")
  274.                 ->from('App:Dil''e')
  275.                 ->where('e.aktif=1 and e.varsayilan=1')
  276.                 ->getQuery()
  277.                 ->setResultCacheId('varsayilan_dil')
  278.                 ->setResultCacheLifetime(60)
  279.                 ->getScalarResult();
  280.             $dil=$dd[0]['id'];
  281.         }
  282.         $em $this->em;
  283.         $qb $em->createQueryBuilder();
  284.         $ayarlar=$qb->select("e.$alan")
  285.             ->from('App:Ayarlar''e')
  286.             ->where('e.dil='.$dil)
  287.             ->getQuery()
  288.             ->setResultCacheId($alan)
  289.             ->setResultCacheLifetime(60)
  290.             ->getScalarResult();
  291.         return $ayarlar[0][$alan];
  292.     }
  293.     public function dilSay(){
  294.         $em $this->em;
  295.         $qb $em->createQueryBuilder();
  296.         $ayarlar=$qb->select("e.id")
  297.             ->from('App:Dil''e')
  298.             ->where('e.aktif=1')
  299.             ->getQuery()
  300.             ->setResultCacheId('dil_aktif')
  301.             ->setResultCacheLifetime(60)
  302.             ->getScalarResult();
  303.         return count($ayarlar);
  304.     }
  305.     public function panelSayfaGetir(){
  306.         $em $this->em;
  307.         $qb $em->createQueryBuilder();
  308.         $sayfalar=$qb->select("s.adi,s.dilgrup,s.id")
  309.             ->from('App:Sayfa''s')
  310.             ->orderBy('s.sira','ASC')
  311.             ->groupBy('s.dilgrup')
  312.             ->getQuery()
  313.             ->getScalarResult();
  314.         $veri ='';
  315.         foreach ($sayfalar as $key=>$sayfa){
  316.             $veri.='<li><a class="d-flex align-items-center" href="/rv/icerik/'.$sayfa['id'].'/"><i data-feather="circle"></i><span class="menu-item text-truncate" data-i18n="'.$sayfa['adi'].'">'.$sayfa['adi'].'</span></a></li>';
  317.         }
  318.         return $veri;
  319.     }
  320.     public function panelKategoriGetir(){
  321.         $em $this->em;
  322.         $qb $em->createQueryBuilder();
  323.         $sayfalar=$qb->select("s.id,s.adi,s.dilgrup")
  324.             ->from('App:Sayfa''s')
  325.             ->where('s.kategori=1')
  326.             ->orderBy('s.sira','ASC')
  327.             ->groupBy('s.dilgrup')
  328.             ->getQuery()
  329.             ->getScalarResult();
  330.         $veri ='';
  331.         foreach ($sayfalar as $key=>$sayfa){
  332.             $veri.='<li><a class="d-flex align-items-center" href="/rv/kategori/'.$sayfa['id'].'/"><i data-feather="circle"></i><span class="menu-item text-truncate" data-i18n="'.$sayfa['adi'].'">'.$sayfa['adi'].'</span></a></li>';
  333.         }
  334.         return $veri;
  335.     }
  336.     public function mesajSay(){
  337.         $em $this->em;
  338.         $qb $em->createQueryBuilder();
  339.         $veriler=$qb->select("m.id")
  340.             ->from('App:FormKayit''m')
  341.             ->where('m.okuma=0')
  342.             ->getQuery()
  343.             ->getScalarResult();
  344.         return count($veriler);
  345.     }
  346.     public function mesajBul(){
  347.         $em $this->em;
  348.         $qb $em->createQueryBuilder();
  349.         $veriler=$qb->select("m.kayit,f.alan,f.adi,m.okuma,m.tarih")
  350.             ->from('App:FormKayit''m')
  351.             ->join('m.form','f')
  352.             ->orderBy('f.tarih','DESC')
  353.             ->orderBy('m.okuma','ASC')
  354.             ->getQuery()
  355.             ->getScalarResult();
  356.         return $veriler;
  357.     }
  358.     public function bildirimSay(){
  359.         $em $this->em;
  360.         $qb $em->createQueryBuilder();
  361.         $veriler=$qb->select("b.id")
  362.             ->from('App:Bildirim''b')
  363.             ->where('b.okuma=0')
  364.             ->getQuery()
  365.             ->getScalarResult();
  366.         return count($veriler);
  367.     }
  368.     public function bildirimBul(){
  369.         $em $this->em;
  370.         $qb $em->createQueryBuilder();
  371.         $veriler=$qb->select("b.id,b.baslik,b.metin,b.okuma,b.tarih")
  372.             ->from('App:Bildirim''b')
  373.             ->orderBy('b.tarih','DESC')
  374.             ->orderBy('b.okuma','ASC')
  375.             ->getQuery()
  376.             ->getScalarResult();
  377.         return $veriler;
  378.     }
  379.     function altKategoriBul($dilgrup,$selected=0,$kendisi=0,$bosluk=''){
  380.         $em $this->em;
  381.         $qb $em->createQueryBuilder();
  382.         $kategoriler=$qb->select('k.id,k.dilgrup,k.adi')
  383.             ->from('App:Kategori''k')
  384.             ->where('k.ustid='.$dilgrup)
  385.             ->groupBy('k.dilgrup')
  386.             ->orderBy('k.sira','ASC')
  387.             ->getQuery()
  388.             ->getScalarResult();
  389.         $bosluk.='&nbsp;&nbsp;&nbsp;&nbsp;';
  390.         $veriler='';
  391.         foreach ($kategoriler as $k){
  392.             $select='';
  393.             if($selected==$k['id']){
  394.                 $select 'selected';
  395.             }
  396.             $disabled='';
  397.             if($kendisi==$k['id']){
  398.                 $disabled 'disabled';
  399.             }
  400.             $veriler.='<option '.$disabled.' '.$select.' value="'.$k['id'].'">'.$bosluk.$k['adi'].'</option>'.$this->altKategoriBul($k['dilgrup'],$selected,$kendisi,$bosluk);
  401.         }
  402.         return $veriler;
  403.     }
  404.     function altKategoriBul2($dilgrup,$selected=0,$kendisi=0,$bosluk=''){
  405.         $em $this->em;
  406.         $qb $em->createQueryBuilder();
  407.         $kategoriler=$qb->select('k.id,k.dilgrup,k.adi')
  408.             ->from('App:Kategori''k')
  409.             ->where('k.ustid='.$dilgrup)
  410.             ->groupBy('k.dilgrup')
  411.             ->orderBy('k.sira','ASC')
  412.             ->getQuery()
  413.             ->getScalarResult();
  414.         $bosluk.='&nbsp;&nbsp;&nbsp;&nbsp;';
  415.         $veriler='';
  416.         foreach ($kategoriler as $k){
  417.             $select='';
  418.             if($selected==$k['dilgrup']){
  419.                 $select 'selected';
  420.             }
  421.             $disabled='';
  422.             if($kendisi==$k['dilgrup']){
  423.                 $disabled 'disabled';
  424.             }
  425.             $veriler.='<option '.$disabled.' '.$select.' value="'.$k['dilgrup'].'">'.$bosluk.$k['adi'].'</option>'.$this->altKategoriBul($k['dilgrup'],$selected,$kendisi,$bosluk);
  426.         }
  427.         return $veriler;
  428.     }
  429.     function altKategoriGeriYaz($ustid,$dil=1){
  430.         $em $this->em;
  431.         $qb $em->createQueryBuilder();
  432.         $kategoriler=$qb->select('k.id,k.dilgrup,k.adi,k.seourl,k.ustid')
  433.             ->from('App:Kategori''k')
  434.             ->join('k.dil','d')
  435.             ->where('k.dilgrup='.$ustid.' and d.id='.$dil)
  436.             ->groupBy('k.dilgrup')
  437.             ->orderBy('k.sira','ASC')
  438.             ->getQuery()
  439.             ->getScalarResult();
  440.         $veriler='';
  441.         foreach ($kategoriler as $k){
  442.             $veriler.=$this->altKategoriGeriYaz($k['ustid'],$dil).$k['seourl'].'/';
  443.         }
  444.         return $veriler;
  445.     }
  446.     function altKategoriListe($dilgrup,$sSeo){
  447.         $em $this->em;
  448.         $qb $em->createQueryBuilder();
  449.         $kategoriler=$qb->select('k.id,k.dilgrup,k.adi,k.seourl,d.kisa as dKisa,k.ustid')
  450.             ->from('App:Kategori''k')
  451.             ->join('k.dil','d')
  452.             ->where('k.ustid='.$dilgrup)
  453.             ->groupBy('k.dilgrup')
  454.             ->orderBy('k.sira','ASC')
  455.             ->getQuery()
  456.             ->getScalarResult();
  457.         $veriler='';
  458.         if(count($kategoriler)>0) {
  459.             $veriler .= '<ul class="kategori_sirala' $dilgrup '">';
  460.             foreach ($kategoriler as $k) {
  461.                 if ($this->dilSay() > 1) {
  462.                     $link '<a class="text-primary" href="' $this->ayarlar('siteYolu') . $k['dKisa'] . '/' $sSeo '/' $this->altKategoriGeriYaz($k['ustid']) . $k['seourl'] . '" target="_blank"> ' $this->ayarlar('siteYolu') . $k['dKisa'] . '/' $sSeo '/' $this->altKategoriGeriYaz($k['ustid']) . $k['seourl'] . ' </a>';
  463.                 } else {
  464.                     $link '<a class="text-primary" href="' $this->ayarlar('siteYolu') . $sSeo '/' $this->altKategoriGeriYaz($k['ustid']) . $k['seourl'] . '" target="_blank"> ' $this->ayarlar('siteYolu') . $sSeo '/' $this->altKategoriGeriYaz($k['ustid']) . $k['seourl'] . ' </a>';
  465.                 }
  466.                 $veriler .= ' <div id="listItem_' $k['dilgrup'] . '">';
  467.                 $veriler .= '<li class="kategoriLi row" >
  468.             <div class="col-md-9">' $k['adi'] . '
  469.                 <br>
  470.                 
  471.                 ' $link '
  472.             
  473.             </div>
  474.             <div class="col-md-3 text-right">
  475.                 <a class="btn btn-sm btn-info waves-effect waves-light handle' $dilgrup ' text-white"><i data-feather="move"></i></a>
  476.                 <button class="btn btn-sm btn-primary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">İŞLEM</button>
  477.                 <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
  478.                     <a class="dropdown-item" href="javascript:void(0);" onclick="seoAyarAc(' $k['dilgrup'] . ');" data-toggle="modal" data-target=".seoAyar">Seo Ayarları</a>
  479.                     <a class="dropdown-item" href="javascript:void(0);" onclick="kategoriDuzenleAc(' $k['dilgrup'] . ');" data-toggle="modal" data-target=".kategoriDuzenle">Düzenle</a>
  480.                     <a class="dropdown-item" href="javascript:void(0);" onclick="kategoriSil(' $k['dilgrup'] . ')">Sil</a>
  481.                 </div>
  482.             </div>
  483.         </li>';
  484.                 $veriler .= $this->altKategoriListe($k['dilgrup'], $sSeo);;
  485.                 $veriler .= '</div>';
  486.             }
  487.             $veriler .= '</ul>';
  488.             $veriler .= '<script>
  489.             $().ready(function() {
  490.               kategoriSirala(' $dilgrup ');
  491.             });
  492.             </script>';
  493.         }
  494.         return $veriler;
  495.     }
  496.     public function kategoriDetay($dilgrup,$alan){
  497.         if($dilgrup==''){
  498.             return '';
  499.         }
  500.         $em $this->em;
  501.         $qb $em->createQueryBuilder();
  502.         $kategori=$qb->select("e.$alan")
  503.             ->from('App:Kategori''e')
  504.             ->where('e.dilgrup='.$dilgrup)
  505.             ->getQuery()
  506.             ->getScalarResult();
  507.         return $kategori[0][$alan];
  508.     }
  509.     public function istatistik($start,$end){
  510.         $em $this->em;
  511.         $qb $em->createQueryBuilder();
  512.         $istatistikKullanici=$qb->select('i.id')
  513.             ->from('App:Istatistik''i')
  514.             ->where("i.tarih > '$start 00:00:00' and i.tarih < '$end 23:59:59'")
  515.             ->groupBy('i.ip')
  516.             ->getQuery()
  517.             ->getScalarResult();
  518.         $qb $em->createQueryBuilder();
  519.         $istatistikSG=$qb->select('i.id')
  520.             ->from('App:Istatistik''i')
  521.             ->where("i.tarih > '$start 00:00:00' and i.tarih < '$end 23:59:59'")
  522.             ->getQuery()
  523.             ->getScalarResult();
  524.         return count($istatistikKullanici).'--'.count($istatistikSG);
  525.     }
  526.     public function yetkiler($yetkiler,$rol){
  527.         if ($yetkiler==''){
  528.             return 1;
  529.         }
  530.         $yetkiler explode('~',str_replace(array('{','}'),array('',''),substr($yetkiler,0,strlen($yetkiler)-1)));
  531.         $return = [];
  532.         foreach ($yetkiler as $y){
  533.             $x explode(':',$y);
  534.             $z explode(',',$x[1]);
  535.             $return[$x[0]]['gorme']=$z[0];
  536.             $return[$x[0]]['ekleme']=$z[1];
  537.             $return[$x[0]]['duzenleme']=$z[2];
  538.             $return[$x[0]]['silme']=$z[3];
  539.         }
  540.         if($rol=='ROLE_DEV' or $rol=='ROLE_ADMIN'){
  541.             return 1;
  542.         }else{
  543.             return $return;
  544.         }
  545.     }
  546.     function GetIP()
  547.     {
  548.         if (getenv("HTTP_CLIENT_IP")) {
  549.             $ip getenv("HTTP_CLIENT_IP");
  550.         } elseif (getenv("HTTP_X_FORWARDED_FOR")) {
  551.             $ip getenv("HTTP_X_FORWARDED_FOR");
  552.             if (strstr($ip',')) {
  553.                 $tmp explode(','$ip);
  554.                 $ip trim($tmp[0]);
  555.             }
  556.         } else {
  557.             $ip getenv("REMOTE_ADDR");
  558.         }
  559.         return $ip;
  560.     }
  561.     function get_browser_name($user_agent)
  562.     {
  563.         if (strpos($user_agent'Opera') || strpos($user_agent'OPR/')) return 'Opera';
  564.         elseif (strpos($user_agent'Edge')) return 'Edge';
  565.         elseif (strpos($user_agent'Chrome')) return 'Chrome';
  566.         elseif (strpos($user_agent'Safari')) return 'Safari';
  567.         elseif (strpos($user_agent'Firefox')) return 'Firefox';
  568.         elseif (strpos($user_agent'MSIE') || strpos($user_agent'Trident/7')) return 'İnternet Explorer';
  569.         return 'Diğer';
  570.     }
  571.     public function site_istatistik($bos)
  572.     {
  573.         if($this->ayarlar('debug')!=1) {
  574.             $em $this->em;
  575.             $tarih = new \DateTime('now');
  576.             $ip $this->GetIP();
  577.             if (@$_SERVER['HTTP_REFERER']!=''){
  578.                 $referer $_SERVER['HTTP_REFERER'];
  579.             }else{
  580.                 $referer '';
  581.             }
  582.             $user_agent $this->get_browser_name($_SERVER['HTTP_USER_AGENT']);
  583.             $request_uri $this->ayarlar('siteYolu') . substr($_SERVER['REQUEST_URI'], 1strlen($_SERVER['REQUEST_URI']) - 1);
  584.             $istatistik = new Istatistik();
  585.             $istatistik->setTarih($tarih);
  586.             $istatistik->setIp($ip);
  587.             $istatistik->setReferer($referer);
  588.             $istatistik->setTarayici($user_agent);
  589.             $istatistik->setUrl($request_uri);
  590.             $em->persist($istatistik);
  591.             $em->flush();
  592.             return '';
  593.         }
  594.     }
  595.     public function site_anaLink(){
  596.         $dil $this->session->get('dil');
  597.         if ($this->dilSay()>1){
  598.             return $this->ayarlar('siteYolu').$dil['kisa'].'/';
  599.         }else{
  600.             return $this->ayarlar('siteYolu');
  601.         }
  602.     }
  603.     public function site_menuGetir(){
  604.         $em $this->em;
  605.         $dil $this->session->get('dil');
  606.         $qb $em->createQueryBuilder();
  607.         $sayfalar=$qb->select('s.id,s.adi,s.dilgrup,s.seo,s.kategori,s.tekVeri,s.icIcerik,m.tabloAdi,m.alan')
  608.             ->from('App:Sayfa''s')
  609.             ->join('s.dil''d')
  610.             ->join('s.modul''m')
  611.             ->where('d.id='.$dil['id'].'and s.menu=1')
  612.             ->orderBy('s.sira','ASC')
  613.             ->getQuery()
  614.             ->setResultCacheId('menu_sayfalar')
  615.             ->setResultCacheLifetime(60)
  616.             ->getScalarResult();
  617.         $menu = [];
  618.         $menu[] =['link'=>$this->site_anaLink(),'adi'=>$this->ceviri('Anasayfa')];
  619.         foreach ($sayfalar as $sayfa){
  620.             $sId $this->IdBul('Sayfa',$sayfa['dilgrup']);
  621.             $sLink $this->site_anaLink().$sayfa['seo'];
  622.                 //  ($sayfa['dilgrup']==6) alanı alt menü görünmesin istiyorsak
  623.                 if (($sayfa['tekVeri'] == and $sayfa['icIcerik'] == 0) or $sayfa['tekVeri'] == or ($sayfa['dilgrup'] == 3)) {
  624.                     $menu[] =['link'=>$sLink,'adi'=>$sayfa['adi']];
  625.                 } else {
  626.                     if ($sayfa['kategori'] == 0) {
  627.                         //İçerikler
  628.                         $sayfaAlan explode(','$sayfa['alan']);
  629.                         $icerikalani = [];
  630.                         foreach ($sayfaAlan as $sA) {
  631.                             if ($sA == 'seo url' or $sA == 'sayfa başlığı' or $sA == 'anahtar kelimeler' or $sA == 'sayfa açıklaması') {
  632.                             } else {
  633.                                 $icerikalani[] = str_replace(' '''$sA);
  634.                             }
  635.                         }
  636.                         $qb $em->createQueryBuilder();
  637.                         $icerikler $qb->select('t.' $this->seo($icerikalani[0]) . ' as baslik,t.seourl,t.dilgrup,d.kisa as dKisa,k.dilgrup as kategoriId,d.id as did,s.dilgrup as sayfaId')
  638.                             ->from('App:' $sayfa['tabloAdi'], 't')
  639.                             ->leftjoin('t.kategori''k')
  640.                             ->join('t.sayfa''s')
  641.                             ->join('t.dil''d')
  642.                             ->where('s.id=' $sId ' and d.id=' $dil['id'])
  643.                             ->addOrderBy('t.sira''ASC')
  644.                             ->addOrderBy('t.id''DESC')
  645.                             ->setMaxResults(10)
  646.                             ->getQuery()
  647.                             ->setResultCacheId('menu_icerikler')
  648.                             ->setResultCacheLifetime(60)
  649.                             ->getScalarResult();
  650.                     }
  651.                     else {
  652.                         //Kategoriler
  653.                         $qb $em->createQueryBuilder();
  654.                         $icerikler $qb->select('k.dilgrup,k.adi as baslik,k.seourl')
  655.                             ->from('App:Kategori''k')
  656.                             ->join('k.sayfa''s')
  657.                             ->join('k.dil''d')
  658.                             ->where('s.id=' $sId ' and k.ustid=0 and d.id=' $dil['id'])
  659.                             ->orderBy('k.sira''ASC')
  660.                             ->setMaxResults(10)
  661.                             ->getQuery()
  662.                             ->setResultCacheId('menu_kategoriler')
  663.                             ->setResultCacheLifetime(60)
  664.                             ->getScalarResult();
  665.                     }
  666.                   $altMenuler = [];
  667.                     foreach ($icerikler as $icerik) {
  668.                         $kat '';
  669.                         if (!empty($icerik['kategoriId'])) {
  670.                             $kat $this->altKategoriGeriYaz($icerik['kategoriId'], $dil['id']);
  671.                         }
  672.                         $sLink2 $this->site_anaLink() . $sayfa['seo'] . '/' $kat $icerik['seourl'];
  673.                         $altMenuler[] =['link'=>$sLink2,'adi'=>ucfirst($icerik['baslik'])];
  674.                     }
  675.                     $menu[] =['link'=>$sLink,'adi'=>$sayfa['adi'],'altmenuler'=>$altMenuler];
  676.                 }
  677.         }
  678.         return $menu;
  679.     }
  680.     public function site_footerMetin(){
  681.         $em $this->em;
  682.         $dil $this->session->get('dil');
  683.         $qb $em->createQueryBuilder();
  684.         $metin=$qb->select('s.kurumsalaciklama')
  685.             ->from('App:Footermetin''s')
  686.             ->join('s.dil''d')
  687.             ->where('d.id='.$dil['id'])
  688.             ->getQuery()
  689.             ->setResultCacheId('footermetin')
  690.             ->setResultCacheLifetime(60)
  691.             ->getScalarResult();
  692.         return $metin[0]['kurumsalaciklama'];
  693.     }
  694.     public function site_footerSayfa($sDilgrup,$max=10){
  695.         $em $this->em;
  696.         $dil $this->session->get('dil');
  697.         $qb $em->createQueryBuilder();
  698.         $sayfa=$qb->select('s.id,s.adi,s.dilgrup,s.seo,s.kategori,s.tekVeri,s.icIcerik,m.tabloAdi,m.alan')
  699.             ->from('App:Sayfa''s')
  700.             ->join('s.dil''d')
  701.             ->join('s.modul''m')
  702.             ->where('d.id='.$dil['id'].'and s.menu=1 and s.dilgrup='.$sDilgrup)
  703.             ->orderBy('s.sira','ASC')
  704.             ->getQuery()
  705.             ->setResultCacheId('footer_sayfa')
  706.             ->setResultCacheLifetime(60)
  707.             ->getScalarResult();
  708.         $sayfa $sayfa[0];
  709.         $sId $this->IdBul('Sayfa',$sayfa['dilgrup']);
  710.         if ($sayfa['kategori'] == 0) {
  711.             //İçerikler
  712.             $sayfaAlan explode(','$sayfa['alan']);
  713.             $icerikalani '';
  714.             foreach ($sayfaAlan as $sA) {
  715.                 if ($sA == 'seo url' or $sA == 'sayfa başlığı' or $sA == 'anahtar kelimeler' or $sA == 'sayfa açıklaması') {
  716.                 } else {
  717.                     $icerikalani .= 't.'.$this->seo(str_replace(' '''$sA)).',';
  718.                 }
  719.             }
  720.             $qb $em->createQueryBuilder();
  721.             $icerikler $qb->select$icerikalani' t.seourl,t.dilgrup,d.kisa as dKisa,k.dilgrup as kategoriId,d.id as did,s.dilgrup as sayfaId')
  722.                 ->from('App:' $sayfa['tabloAdi'], 't')
  723.                 ->leftjoin('t.kategori''k')
  724.                 ->join('t.sayfa''s')
  725.                 ->join('t.dil''d')
  726.                 ->where('s.id=' $sId ' and d.id=' $dil['id'])
  727.                 ->addOrderBy('t.sira''ASC')
  728.                 ->addOrderBy('t.id''DESC')
  729.                 ->setMaxResults($max)
  730.                 ->getQuery()
  731.                 ->setResultCacheId('footer_icerik')
  732.                 ->setResultCacheLifetime(60)
  733.                 ->getScalarResult();
  734.         }
  735.         else {
  736.             //Kategoriler
  737.             $qb $em->createQueryBuilder();
  738.             $icerikler $qb->select('k.dilgrup,k.adi as baslik,k.seourl,k.resim')
  739.                 ->from('App:Kategori''k')
  740.                 ->join('k.sayfa''s')
  741.                 ->join('k.dil''d')
  742.                 ->where('s.id=' $sId ' and k.ustid=0 and d.id=' $dil['id'])
  743.                 ->orderBy('k.sira''ASC')
  744.                 ->setMaxResults($max)
  745.                 ->getQuery()
  746.                 ->setResultCacheId('footer_kategori')
  747.                 ->setResultCacheLifetime(60)
  748.                 ->getScalarResult();
  749.         }
  750.         $veri = [];
  751.         $veri[]=$sayfa;
  752.         $veri[]=$icerikler;
  753.         return $veri;
  754.     }
  755.     public function site_iletisimBilgileri($alan){
  756.         $em $this->em;
  757.         $dil $this->session->get('dil');
  758.         $qb $em->createQueryBuilder();
  759.         $iletisim=$qb->select('s.'.$alan)
  760.             ->from('App:Iletisim''s')
  761.             ->join('s.dil''d')
  762.             ->where('d.id='.$dil['id'])
  763.             ->getQuery()
  764.             ->setResultCacheId($alan)
  765.             ->setResultCacheLifetime(60)
  766.             ->getScalarResult();
  767.         return $iletisim[0][$alan];
  768.     }
  769.     public function site_sosyalAglar(){
  770.         $em $this->em;
  771.         $qb $em->createQueryBuilder();
  772.         $sosyalAglar=$qb->select('s.ad,s.url')
  773.             ->from('App:SosyalAg''s')
  774.             ->getQuery()
  775.             ->setResultCacheId('sosyal_aglar')
  776.             ->setResultCacheLifetime(60)
  777.             ->getScalarResult();
  778.         $veri = [];
  779.         foreach ($sosyalAglar as $ss){
  780.             if($ss['ad']=='Facebook' and $ss['url']!=''){
  781.                 $veri[]= ['link'=>$ss['url'],'adi'=>$ss['ad'],'ikon'=>'fab fa-facebook'];
  782.             }
  783.             elseif($ss['ad']=='Twitter' and $ss['url']!=''){
  784.                 $veri[]= ['link'=>$ss['url'],'adi'=>$ss['ad'],'ikon'=>'fab fa-twitter'];
  785.             }
  786.             elseif($ss['ad']=='İnstagram' and $ss['url']!=''){
  787.                 $veri[]= ['link'=>$ss['url'],'adi'=>$ss['ad'],'ikon'=>'fab fa-instagram'];
  788.             }
  789.             elseif($ss['ad']=='Pinterest' and $ss['url']!=''){
  790.                 $veri[]= ['link'=>$ss['url'],'adi'=>$ss['ad'],'ikon'=>'fab fa-pinterest'];
  791.             }
  792.             elseif($ss['ad']=='Youtube' and $ss['url']!=''){
  793.                 $veri[]= ['link'=>$ss['url'],'adi'=>$ss['ad'],'ikon'=>'fab fa-youtube'];
  794.             }
  795.         }
  796.         return $veri;
  797.     }
  798.     public function site_sliders()
  799.     {
  800.         $em $this->em;
  801.         $dil $this->session->get('dil');
  802.         $em $this->em;
  803.         $qb $em->createQueryBuilder();
  804.         $sliders=$qb->select('s.resim,s.aciklama,s.baslik')
  805.             ->from('App:Slider''s')
  806.             ->join('s.dil''d')
  807.             ->where('d.id='.$dil['id'])
  808.             ->orderBy('s.sira')
  809.             ->getQuery()
  810.             ->setResultCacheId('slider')
  811.             ->setResultCacheLifetime(60)
  812.             ->getScalarResult();
  813.         return $sliders;
  814.     }
  815.     public function site_sayfaIcerik($sDilgrup,$max=10){
  816.         $em $this->em;
  817.         $dil $this->session->get('dil');
  818.         $qb $em->createQueryBuilder();
  819.         $sayfa=$qb->select('s.id,s.adi,s.dilgrup,s.seo,s.kategori,s.tekVeri,s.icIcerik,m.tabloAdi,m.alan,s.description')
  820.             ->from('App:Sayfa''s')
  821.             ->join('s.dil''d')
  822.             ->join('s.modul''m')
  823.             ->where('d.id='.$dil['id'].' and s.dilgrup='.$sDilgrup)
  824.             ->orderBy('s.sira','ASC')
  825.             ->getQuery()
  826.             ->setResultCacheId('sabit_sayfa')
  827.             ->setResultCacheLifetime(60)
  828.             ->getScalarResult();
  829.         $sId $this->IdBul('Sayfa',$sayfa[0]['dilgrup']);
  830.         $sayfa $sayfa[0];
  831.         $icerikler="";
  832.         if ($sayfa['kategori'] == 0) {
  833.             //İçerikler
  834.             $sayfaAlan explode(','$sayfa['alan']);
  835.             $icerikalani = [];
  836.             foreach ($sayfaAlan as $sA) {
  837.                 $icerikalani[] = 't.'.$this->seo(str_replace(' '''$sA));
  838.             }
  839.             $qb $em->createQueryBuilder();
  840.             $icerikler $qb->select(implode(',',$icerikalani).',t.dilgrup,k.dilgrup as kategoriId,d.id as did,s.dilgrup as sayfaId')
  841.                 ->from('App:' $sayfa['tabloAdi'], 't')
  842.                 ->leftjoin('t.kategori''k')
  843.                 ->join('t.sayfa''s')
  844.                 ->join('t.dil''d')
  845.                 ->where('s.id=' $sId ' and d.id=' $dil['id'])
  846.                 ->addOrderBy('t.sira''ASC')
  847.                 ->addOrderBy('t.id''DESC')
  848.                 ->setMaxResults($max)
  849.                 ->getQuery()
  850.                 ->setResultCacheId('sabit_icerik')
  851.                 ->setResultCacheLifetime(60)
  852.                 ->getScalarResult();
  853.         }
  854.         if ($sayfa['icIcerik']==1){
  855.             foreach ($icerikler as $key=>$ii){
  856.                 $alt='';
  857.                 if($sayfa['kategori']==1){
  858.                     $alt $this->altKategoriGeriYaz($ii['kategoriId'],$dil['id']);
  859.                 }
  860.                 $link $this->site_anaLink().$sayfa['seo'].'/'.$alt.$ii['seourl'];
  861.                 $icerikler[$key]['link']=$link;
  862.                 if (in_array('t.resimler',$icerikalani)){
  863.                     $resim explode(',',$ii['resimler']);
  864.                     $icerikler[$key]['resim'] = $resim[0];
  865.                 }
  866.             }
  867.         }
  868.         $veri = [];
  869.         $veri[]=$sayfa;
  870.         $veri[]=$icerikler;
  871.         return $veri;
  872.     }
  873.     public function site_sayfaIcerikDirek($sDilgrup,$max=10){
  874.         $em $this->em;
  875.         $dil $this->session->get('dil');
  876.         $qb $em->createQueryBuilder();
  877.         $sayfa=$qb->select('s.id,s.adi,s.dilgrup,s.seo,s.kategori,s.tekVeri,s.icIcerik,m.tabloAdi,m.alan,s.description')
  878.             ->from('App:Sayfa''s')
  879.             ->join('s.dil''d')
  880.             ->join('s.modul''m')
  881.             ->where('d.id='.$dil['id'].' and s.dilgrup='.$sDilgrup)
  882.             ->orderBy('s.sira','ASC')
  883.             ->getQuery()
  884.             ->setResultCacheId('sabit_sayfa')
  885.             ->setResultCacheLifetime(60)
  886.             ->getScalarResult();
  887.         $sId $this->IdBul('Sayfa',$sayfa[0]['dilgrup']);
  888.         $sayfa $sayfa[0];
  889.         //İçerikler
  890.         $sayfaAlan explode(','$sayfa['alan']);
  891.         $icerikalani = [];
  892.         foreach ($sayfaAlan as $sA) {
  893.             $icerikalani[] = 't.'.$this->seo(str_replace(' '''$sA));
  894.         }
  895.         $qb $em->createQueryBuilder();
  896.         $icerikler $qb->select(implode(',',$icerikalani).',t.dilgrup,k.dilgrup as kategoriId,d.id as did,s.dilgrup as sayfaId')
  897.             ->from('App:' $sayfa['tabloAdi'], 't')
  898.             ->leftjoin('t.kategori''k')
  899.             ->join('t.sayfa''s')
  900.             ->join('t.dil''d')
  901.             ->where('s.id=' $sId ' and d.id=' $dil['id'])
  902.             ->addOrderBy('t.sira''ASC')
  903.             ->addOrderBy('t.id''DESC')
  904.             ->setMaxResults($max)
  905.             ->getQuery()
  906.             ->setResultCacheId('sabit_icerik')
  907.             ->setResultCacheLifetime(60)
  908.             ->getScalarResult();
  909.         if ($sayfa['icIcerik']==1){
  910.             foreach ($icerikler as $key=>$ii){
  911.                 $alt='';
  912.                 if($sayfa['kategori']==1){
  913.                     $alt $this->altKategoriGeriYaz($ii['kategoriId'],$dil['id']);
  914.                 }
  915.                 $link $this->site_anaLink().$sayfa['seo'].'/'.$alt.$ii['seourl'];
  916.                 $icerikler[$key]['link']=$link;
  917.                 if (in_array('t.resimler',$icerikalani)){
  918.                     $resim explode(',',$ii['resimler']);
  919.                     $icerikler[$key]['resim'] = $resim[0];
  920.                 }
  921.             }
  922.         }
  923.         $veri = [];
  924.         $veri[]=$sayfa;
  925.         $veri[]=$icerikler;
  926.         return $veri;
  927.     }
  928.     public function site_sayfaIcerikKategori($sDilgrup,$kat,$max=10){
  929.         $em $this->em;
  930.         $dil $this->session->get('dil');
  931.         $qb $em->createQueryBuilder();
  932.         $sayfa=$qb->select('s.id,s.adi,s.dilgrup,s.seo,s.kategori,s.tekVeri,s.icIcerik,m.tabloAdi,m.alan,s.description')
  933.             ->from('App:Sayfa''s')
  934.             ->join('s.dil''d')
  935.             ->join('s.modul''m')
  936.             ->where('d.id='.$dil['id'].' and s.dilgrup='.$sDilgrup)
  937.             ->orderBy('s.sira','ASC')
  938.             ->getQuery()
  939.             ->setResultCacheId('sabit_sayfa')
  940.             ->setResultCacheLifetime(60)
  941.             ->getScalarResult();
  942.         $sayfa $sayfa[0];
  943.         //İçerikler
  944.         $sayfaAlan explode(','$sayfa['alan']);
  945.         $icerikalani = [];
  946.         foreach ($sayfaAlan as $sA) {
  947.             $icerikalani[] = 't.'.$this->seo(str_replace(' '''$sA));
  948.         }
  949.         $qb $em->createQueryBuilder();
  950.         $icerikler $qb->select(implode(',',$icerikalani).',t.dilgrup,t.kategoriId,d.id as did,t.sayfaId')
  951.             ->from('App:' $sayfa['tabloAdi'], 't')
  952.             ->join('t.dil''d')
  953.             ->where('t.sayfaId=' $sayfa['dilgrup'] . ' and t.kategoriId=' $kat ' and d.id=' $dil['id'])
  954.             ->addOrderBy('t.sira''ASC')
  955.             ->addOrderBy('t.id''DESC')
  956.             ->setMaxResults($max)
  957.             ->getQuery()
  958.             ->setResultCacheId('sabit_kategori')
  959.             ->setResultCacheLifetime(60)
  960.             ->getScalarResult();
  961.         $veri = [];
  962.         $veri[]=$sayfa;
  963.         $veri[]=$icerikler;
  964.         return $veri;
  965.     }
  966.     public function site_dilGetir(){
  967.         $em $this->em;
  968.         $dil $this->session->get('dil');
  969.         $qb $em->createQueryBuilder();
  970.         $diller=$qb->select('d.id,d.kisa,d.uzun')
  971.             ->from('App:Dil''d')
  972.             ->where('d.aktif=1 and d.id not in('.$dil['id'].')')
  973.             ->orderBy('d.aktif','DESC')
  974.             ->getQuery()
  975.             ->setResultCacheId('dil_getir')
  976.             ->setResultCacheLifetime(60)
  977.             ->getScalarResult();
  978.         $veri='';
  979.         foreach ($diller as $d){
  980.             $veri .='<li><a href="'.$this->ayarlar('siteYolu').$d['kisa'].'/"><img src="/assets/flag/'.$d['kisa'].'.webp" width="18" height="14" alt="'.$d['kisa'].'"> '.$this->ceviri($d['uzun']).' ('.strtoupper($d['kisa']).')</a></li>';
  981.         }
  982.         return $veri;
  983.     }
  984.     public function site_dilGetir2(){
  985.         $em $this->em;
  986.         $dil $this->session->get('dil');
  987.         $qb $em->createQueryBuilder();
  988.         $diller=$qb->select('d.id,d.kisa,d.uzun')
  989.             ->from('App:Dil''d')
  990.             ->where('d.aktif=1')
  991.             ->orderBy('d.aktif','DESC')
  992.             ->getQuery()
  993.             ->setResultCacheId('dil_getir')
  994.             ->setResultCacheLifetime(60)
  995.             ->getScalarResult();
  996.         $veri='';
  997.         foreach ($diller as $d){
  998.             $active "";
  999.             if ($d['id']==$dil['id']){
  1000.                 $active 'selected';
  1001.             }
  1002.             $veri .=' <a class="dropdown-item '.$active.'" href="'.$this->ayarlar('siteYolu').$d['kisa'].'/">
  1003.                                         <img src="/assets/flag/'.$d['kisa'].'.webp" alt="'.$d['kisa'].'">
  1004.                                         '.$this->ceviri($d['uzun']).'
  1005.                                     </a>';
  1006.         }
  1007.         return $veri;
  1008.     }
  1009.     /*  public function site_popupGetir($sDilgrup){
  1010.           $em = $this->em;
  1011.           $veri = '';
  1012.           if($sDilgrup==0){
  1013.               if ($this->ayarlar('popup')!=''){
  1014.                   if(!$this->session->get('system_popup'.$sDilgrup)) {
  1015.                       $veri .= '<a href="/uploads/' . $this->ayarlar('popup') . '" class="system_popup" data-fancybox style="display: none;"></a>';
  1016.                       $this->session->set('system_popup'.$sDilgrup,1);
  1017.                   }
  1018.               }
  1019.           }else{
  1020.               $qb = $em->createQueryBuilder();
  1021.               $sayfa=$qb->select('s.popup')
  1022.                   ->from('App:Sayfa', 's')
  1023.                   ->where("s.dilgrup =".$sDilgrup)
  1024.                   ->getQuery()
  1025.                   ->setResultCacheId('popup')
  1026.                   ->setResultCacheLifetime(60)
  1027.                   ->getScalarResult();
  1028.               if ($sayfa[0]['popup']!=''){
  1029.                   if(!$this->session->get('system_popup'.$sDilgrup)) {
  1030.                       $veri .= '<a href="/uploads/' . $sayfa[0]['popup'] . '" class="system_popup" data-fancybox style="display: none;"></a>';
  1031.                       $this->session->set('system_popup'.$sDilgrup,1);
  1032.                   }
  1033.               }
  1034.           }
  1035.           return $veri;
  1036.       }*/
  1037.     public function site_bannerGetir($sDilgrup){
  1038.         $em $this->em;
  1039.         $veri '';
  1040.         $qb $em->createQueryBuilder();
  1041.         $sayfa=$qb->select('s.bannerDurum,s.bannerUrl')
  1042.             ->from('App:Sayfa''s')
  1043.             ->where("s.dilgrup =".$sDilgrup)
  1044.             ->getQuery()
  1045.             ->setResultCacheId('banner_getir')
  1046.             ->setResultCacheLifetime(60)
  1047.             ->getScalarResult();
  1048.         if ($sayfa[0]['bannerDurum']=='1'){
  1049.             $veri.=$this->ayarlar('siteYolu').'storage/'.$sayfa[0]['bannerUrl'];
  1050.         }
  1051.         return $veri;
  1052.     }
  1053.     public function site_formGetir($formId){
  1054.         $em $this->em;
  1055.         $veri='';
  1056.         $qb $em->createQueryBuilder();
  1057.         $form=$qb->select('f.adi,f.tip,f.veri,f.alan,f.zorunlu,f.id')
  1058.             ->from('App:Form''f')
  1059.             ->where("f.id =".$formId)
  1060.             ->getQuery()
  1061.             ->setResultCacheId('sabit_formlar')
  1062.             ->setResultCacheLifetime(60)
  1063.             ->getScalarResult();
  1064.         $tipler explode('~',$form[0]['tip']);
  1065.         $alanlar explode('~',$form[0]['alan']);
  1066.         $zorunlular explode('~',$form[0]['zorunlu']);
  1067.         $fVeriler explode('~',$form[0]['veri']);
  1068.         $veri .= '<form method="post" enctype="multipart/form-data" class="'.$this->seo($form[0]['adi']).'" action="'.$this->site_anaLink().'form-kayit">';
  1069.         $veri .= '<input type="hidden" name="id" value="'.$formId.'">';
  1070.         $veri .= '<div class="row">';
  1071.         foreach ($tipler as $key=>$tip){
  1072.             if ($zorunlular[$key]==1){$required='required'$zorunlu'<span style="color:#ff0000;">* </span>';}else{ $required=''$zorunlu='';}
  1073.             if($tip=='input'){
  1074.                 $veri.='<div class="col-lg-6 col-md-6 col-sm-12" style="margin-top: 10px;">';
  1075.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).': '.$zorunlu.'</b><br>';
  1076.                 $veri.='<input type="text" name="'.$this->seo($alanlar[$key]).'" class="form-control formInput" placeholder="'.$this->ceviri($alanlar[$key]).'" '.$required.'>';
  1077.                 $veri.='</div>';
  1078.             }
  1079.             elseif($tip=='inputPhone'){
  1080.                 $veri.='<div class="col-lg-6 col-md-6 col-sm-12" style="margin-top: 10px;">';
  1081.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).': '.$zorunlu.'</b><br>';
  1082.                 $veri.='<input data-inputmask="\'mask\': \'+99(999) 999 99 99\'" type="text" name="'.$this->seo($alanlar[$key]).'" class="form-control formInput" placeholder="'.$this->ceviri($alanlar[$key]).'" '.$required.'>';
  1083.                 $veri.='</div>';
  1084.             }
  1085.             elseif($tip=='inputEmail'){
  1086.                 $veri.='<div class="col-lg-6 col-md-6 col-sm-12" style="margin-top: 10px;">';
  1087.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).': '.$zorunlu.'</b><br>';
  1088.                 $veri.='<input type="email" name="'.$this->seo($alanlar[$key]).'" class="form-control formInput" placeholder="'.$this->ceviri($alanlar[$key]).'" '.$required.'>';
  1089.                 $veri.='</div>';
  1090.             }
  1091.             elseif($tip=='inputNumeric'){
  1092.                 $veri.='<div class="col-lg-6 col-md-6 col-sm-12" style="margin-top: 10px;">';
  1093.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).': '.$zorunlu.'</b><br>';
  1094.                 $veri.='<input type="text" name="'.$this->seo($alanlar[$key]).'" class="form-control formInput numeric" placeholder="'.$this->ceviri($alanlar[$key]).'" '.$required.'>';
  1095.                 $veri.='</div>';
  1096.             }
  1097.             elseif($tip=='inputPrice'){
  1098.                 $veri.='<div class="col-lg-6 col-md-6 col-sm-12" style="margin-top: 10px;">';
  1099.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).': '.$zorunlu.'</b><br>';
  1100.                 $veri.='<input type="text" name="'.$this->seo($alanlar[$key]).'" class="form-control formInput priceFormat" placeholder="'.$this->ceviri($alanlar[$key]).'" '.$required.'>';
  1101.                 $veri.='</div>';
  1102.             }
  1103.             elseif($tip=='inputDate'){
  1104.                 $veri.='<div class="col-lg-6 col-md-6 col-sm-12" style="margin-top: 10px;">';
  1105.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).': '.$zorunlu.'</b><br>';
  1106.                 $veri.='<input data-inputmask="\'mask\': \'99/99/9999\'" type="text" name="'.$this->seo($alanlar[$key]).'" class="form-control formInput" placeholder="'.$this->ceviri($alanlar[$key]).'" '.$required.'>';
  1107.                 $veri.='</div>';
  1108.             }
  1109.             elseif($tip=='textarea'){
  1110.                 $veri.='<div class="col-lg-12 col-md-12 col-sm-12" style="margin-top: 10px;">';
  1111.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).' '.$zorunlu.':</b><br>';
  1112.                 $veri.='<textarea class="form-control formTextarea" name="'.$this->seo($alanlar[$key]).'" rows="3" placeholder="'.$this->ceviri($alanlar[$key]).'" '.$required.'></textarea>';
  1113.                 $veri.='</div>';
  1114.             }
  1115.             elseif($tip=='select'){
  1116.                 $veri.='<div class="col-lg-12 col-md-12 col-sm-12" style="margin-top: 10px;">';
  1117.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).' '.$zorunlu.':</b><br>';
  1118.                 $veri.='<select class="form-control formSelect" '.$required.' name="'.$this->seo($alanlar[$key]).'">';
  1119.                 $veri.='<option value="">'.$this->ceviri($alanlar[$key].' Seçiniz').'</option>';
  1120.                 $icVeriler explode(',',$fVeriler[$key]);
  1121.                 foreach ($icVeriler as $iV){
  1122.                     $veri.='<option value="'.$this->ceviri($iV).'">'.$this->ceviri($iV).'</option>';
  1123.                 }
  1124.                 $veri.='</select>';
  1125.                 $veri.='</div>';
  1126.             }
  1127.             elseif($tip=='checkbox'){
  1128.                 $veri.='<div class="col-lg-12 col-md-12 col-sm-12 formCheck" style="margin-top: 10px;">';
  1129.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).' '.$zorunlu.':</b><br>';
  1130.                 $veri.='<div class="row">';
  1131.                 $icVeriler explode(',',$fVeriler[$key]);
  1132.                 foreach ($icVeriler as $keyCheck=>$iV){
  1133.                     $veri.=' <div class="col-lg-12 col-md-12 col-sm-12" style="margin-top: 3px;">
  1134.                                   <input type="checkbox" class="'.$this->seo($alanlar[$key]).'" name="'.$this->seo($alanlar[$key]).'[]" value="'.$this->ceviri($iV).'" id="'.$this->seo($iV).$keyCheck.'" '.$required.'>
  1135.                                   <label for="'.$this->seo($iV).$keyCheck.'">
  1136.                                     '.$this->ceviri($iV).
  1137.                                   </label>
  1138.                               </div>';
  1139.                 }
  1140.                 $veri.='</div>';
  1141.                 $veri.='</div>';
  1142.             }
  1143.             elseif($tip=='radio'){
  1144.                 $veri.='<div class="col-lg-12 col-md-12 col-sm-12" style="margin-top: 10px;">';
  1145.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).' '.$zorunlu.':</b><br>';
  1146.                 $veri.='<div class="row">';
  1147.                 $icVeriler explode(',',$fVeriler[$key]);
  1148.                 foreach ($icVeriler as $keyRadio=>$iV){
  1149.                     $veri.=' <div class="col-lg-4 col-md-6 col-sm-12 formRadio" style="margin-top: 3px;">
  1150.                                  <input type="radio" value="'.$this->ceviri($iV).'" class="'.$this->seo($alanlar[$key]).'" name="'.$this->seo($alanlar[$key]).'" id="'.$this->seo($iV).$keyRadio.'" '.$required.'>
  1151.                                   <label for="'.$this->seo($iV).$keyRadio.'">
  1152.                                     '.$this->ceviri($iV).
  1153.                                   </label>
  1154.                               </div>';
  1155.                 }
  1156.                 $veri.='</div>';
  1157.                 $veri.='</div>';
  1158.             }
  1159.             elseif($tip=='file'){
  1160.                 $veri.='<div class="col-lg-12 col-md-12 col-sm-12" style="margin-top: 10px;">';
  1161.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).' '.$zorunlu.':</b><br>';
  1162.                 $veri.='<input type="file" class="form-control fromFile" id="'.$this->seo($alanlar[$key]).'" name="'.$this->seo($alanlar[$key]).'" placeholder="'.$this->ceviri($alanlar[$key]).'" '.$required.'>';
  1163.                 $veri.='</div>';
  1164.             }
  1165.         }
  1166.         $veri.='<div class="col-lg-3 col-md-3 col-sm-3" style="margin-top: 10px;">';
  1167.         $veri.='<b style="font-size: 13px;">'.$this->ceviri('Güvenlik Kodu').' <span style="color:#ff0000;">* </span>:</b><br>';
  1168.         $veri.='<div style="padding: 10px; margin-top: 5px;  background-color: #000; text-align: center;"><img src="'.$this->ayarlar('siteYolu').'captcha" width="80"></div>';
  1169.         $veri.='</div>';
  1170.         $veri.='<div class="col-lg-9 col-md-9 col-sm-9" style="margin-top: 7px; padding-top: 27px;">';
  1171.         $veri.='<input type="text" name="captcha" class="form-control formInput" placeholder="'.$this->ceviri('Güvenlik kodunu giriniz.').'" required onblur="return hepsiBuyuk(this)">';
  1172.         $veri.='</div>';
  1173.         $veri.='<div class="col-lg-12 col-md-12 col-sm-12 hata_'.$this->seo($form[0]['adi']).'" style="margin-top: 10px;">';
  1174.         $veri.='</div>';
  1175.         $veri.='<div class="col-lg-12 col-md-12 col-sm-12" style="margin-top: 10px;">';
  1176.         $veri.='<button class="formBtn" type="button" onclick="formKayit(\''.$this->seo($form[0]['adi']).'\','.$form[0]['id'].');">'.$this->ceviri('Gönder').'</button>';
  1177.         $veri.='</div>';
  1178.         $veri .= '</div>';
  1179.         $veri .= '</form>';
  1180.         return $veri;
  1181.     }
  1182.     function site_kategoriGeriLi($ustid,$dil=1){
  1183.         $em $this->em;
  1184.         $qb $em->createQueryBuilder();
  1185.         $kategoriler=$qb->select('k.id,k.dilgrup,k.adi,k.seourl,k.ustid,k.adi')
  1186.             ->from('App:Kategori''k')
  1187.             ->join('k.dil','d')
  1188.             ->where('k.dilgrup='.$ustid.' and d.id='.$dil)
  1189.             ->groupBy('k.dilgrup')
  1190.             ->orderBy('k.sira','ASC')
  1191.             ->getQuery()
  1192.             ->setResultCacheId('katgerili')
  1193.             ->setResultCacheLifetime(60)
  1194.             ->getScalarResult();
  1195.         $veriler='';
  1196.         foreach ($kategoriler as $k){
  1197.             $veriler.=$this->site_kategoriGeriLi($k['ustid'],$dil).$k['adi'].'#'.$this->altKategoriGeriYaz($k['ustid'],$dil).$k['seourl'].'~';
  1198.         }
  1199.         return $veriler;
  1200.     }
  1201.     public function site_sayfaKategori($sDilgrup,$max=10){
  1202.         $em $this->em;
  1203.         $dil $this->session->get('dil');
  1204.         $qb $em->createQueryBuilder();
  1205.         $sayfa=$qb->select('s.id,s.adi,s.dilgrup,s.seo,s.kategori,s.tekVeri,s.icIcerik,m.tabloAdi,m.alan,s.description')
  1206.             ->from('App:Sayfa''s')
  1207.             ->join('s.dil''d')
  1208.             ->join('s.modul''m')
  1209.             ->where('d.id='.$dil['id'].' and s.dilgrup='.$sDilgrup)
  1210.             ->orderBy('s.sira','ASC')
  1211.             ->getQuery()
  1212.             ->setResultCacheId('sayfa_kategori')
  1213.             ->setResultCacheLifetime(60)
  1214.             ->getScalarResult();
  1215.         $sayfa $sayfa[0];
  1216.         $sId $this->IdBul('Sayfa',$sayfa['dilgrup']);
  1217.         if ($sayfa['kategori'] == 1) {
  1218.             //İçerikler
  1219.             $qb $em->createQueryBuilder();
  1220.             $kategoriler $qb->select('k.adi,k.ustid,k.resim,k.dilgrup,k.seourl')
  1221.                 ->from('App:Kategori''k')
  1222.                 ->join('k.dil''d')
  1223.                 ->join('k.sayfa''s')
  1224.                 ->where('s.id=' $sId ' and d.id=' $dil['id'])
  1225.                 ->addOrderBy('k.sira''ASC')
  1226.                 ->addOrderBy('k.id''DESC')
  1227.                 ->setMaxResults($max)
  1228.                 ->getQuery()
  1229.                 ->setResultCacheId('sayfa_kategoriic')
  1230.                 ->setResultCacheLifetime(60)
  1231.                 ->getScalarResult();
  1232.             foreach ($kategoriler as $key=>$ii){
  1233.                 $link $this->site_anaLink().$sayfa['seo'].'/'.$ii['seourl'];
  1234.                 $kategoriler[$key]['link']=$link;
  1235.             }
  1236.         }
  1237.         $veri = [];
  1238.         $veri[]=$sayfa;
  1239.         $veri[]=$kategoriler;
  1240.         return $veri;
  1241.     }
  1242.     public function site_formVeriGetir($formid){
  1243.         $em $this->em;
  1244.         $qb $em->createQueryBuilder();
  1245.         $veri=$qb->select('fk.tarih,fk.kayit')
  1246.             ->from('App:FormKayit''fk')
  1247.             ->join('fk.form''f')
  1248.             ->where('f.id='.$formid)
  1249.             ->orderBy('fk.tarih','DESC')
  1250.             ->getQuery()
  1251.             ->setResultCacheId('formVerisi')
  1252.             ->setResultCacheLifetime(60)
  1253.             ->getScalarResult();
  1254.         return $veri;
  1255.     }
  1256.     public function digerDiller($id){
  1257.         $em $this->em;
  1258.         $qb $em->createQueryBuilder();
  1259.         $sabitler=$qb->select('c.id,d.kisa as diladi,d.aktif,c.deger,c.trId')
  1260.             ->from('App:Ceviri''c')
  1261.             ->join('c.dil''d')
  1262.             ->where('c.trId='.$id.' and d.aktif=1')
  1263.             ->getQuery()
  1264.             ->getScalarResult();
  1265.         return $sabitler;
  1266.     }
  1267.     public function taslakBul($dilgrup){
  1268.         return $this->session->get('taslak_'.$dilgrup);
  1269.     }
  1270.     public function popupGetir($sayfaId){
  1271.         $em $this->em;
  1272.         $qb $em->createQueryBuilder();
  1273.         $popup=$qb->select('p.id,p.veri,p.tip,p.link,p.dilgrup')
  1274.             ->from('App:Popup''p')
  1275.             ->where("p.sayfaId=".$sayfaId)
  1276.             ->orderBy('p.dil','asc')
  1277.             ->getQuery()
  1278.             ->getScalarResult();
  1279.         return $popup;
  1280.     }
  1281.     public function site_popupGetir($path){
  1282.         $em $this->em;
  1283.         $dil $this->session->get('dil');
  1284.         $path2 explode('/',$path);
  1285.         if ($this->dilSay()>1) {
  1286.             if (count($path2) > 2) {
  1287.                 $path str_replace$dil['kisa'].'/'''$path);
  1288.             } else {
  1289.                 $path str_replace($dil['kisa'], ''$path);
  1290.             }
  1291.         }
  1292.         $path explode('/',$path);
  1293.         if (empty($path[1])){
  1294.             if(!$this->session->get('system_popup0')) {
  1295.                 $qb $em->createQueryBuilder();
  1296.                 $popup $qb->select('p.veri,p.link,p.tip,p.dilgrup')
  1297.                     ->from('App:Popup''p')
  1298.                     ->join('p.dil''d')
  1299.                     ->where("p.sayfaId=0 and d.id=" $dil['id'])
  1300.                     ->getQuery()
  1301.                     ->getScalarResult();
  1302.                 $this->session->set('system_popup0',1);
  1303.             } else {
  1304.                 $popup "";
  1305.             }
  1306.         } else {
  1307.             $qb $em->createQueryBuilder();
  1308.             $sayfa=$qb->select('s.dilgrup')
  1309.                 ->from('App:Sayfa''s')
  1310.                 ->join('s.dil','d')
  1311.                 ->where("s.seo='".$path[1]."'")
  1312.                 ->getQuery()
  1313.                 ->getScalarResult();
  1314.             if(!$this->session->get('system_popup'.$sayfa[0]['dilgrup'])) {
  1315.                 $qb $em->createQueryBuilder();
  1316.                 $popup $qb->select('p.veri,p.link,p.tip,p.dilgrup')
  1317.                     ->from('App:Popup''p')
  1318.                     ->join('p.dil''d')
  1319.                     ->where("p.sayfaId=" $sayfa[0]['dilgrup'] . " and d.id=" $dil['id'])
  1320.                     ->getQuery()
  1321.                     ->getScalarResult();
  1322.                 $this->session->set('system_popup'.$sayfa[0]['dilgrup'],1);
  1323.             } else {
  1324.                 $popup "";
  1325.             }
  1326.         }
  1327.         if (empty($popup)){
  1328.             return "";
  1329.         }else{
  1330.             return $popup[0];
  1331.         }
  1332.     }
  1333.     public function IdBul($entity,$id){
  1334.         $em $this->em;
  1335.         $qb $em->createQueryBuilder();
  1336.         $veriler=$qb->select('x.id')
  1337.             ->from('App:'.$entity'x')
  1338.             ->join('x.dil','d')
  1339.             ->where('x.dilgrup='.$id)
  1340.             ->groupBy('x.dil')
  1341.             ->getQuery()
  1342.             ->getScalarResult();
  1343.         return $veriler[0]['id'];
  1344.     }
  1345.     public function imgOlustur($resim,$yukseklik=300,$radius=0,$size='cover'){
  1346.         if ($resim==''){
  1347.             $resim="resimyok.webp";
  1348.         }
  1349.         return '<div style="background-image: url(/storage/'.$resim.');background-size: '.$size.'; background-repeat: no-repeat; overflow: hidden; width: 100%; height: '.$yukseklik.'px; background-position: center;border-radius: '.$radius.'px;"></div>';
  1350.     }
  1351.     function anasayfaIcerikleri()
  1352.     {
  1353.         $em $this->em;
  1354.         $dil $this->session->get('dil');
  1355.         $qb $em->createQueryBuilder();
  1356.         $sayfalar=$qb->select('s.id,s.adi,s.dilgrup,s.seo,s.kategori,s.tekVeri,s.icIcerik,m.tabloAdi,m.alan')
  1357.             ->from('App:Sayfa''s')
  1358.             ->join('s.dil''d')
  1359.             ->join('s.modul''m')
  1360.             ->where('d.id='.$dil['id'])
  1361.             ->orderBy('s.sira','ASC')
  1362.             ->getQuery()
  1363.             ->setResultCacheId('menu_sayfalar')
  1364.             ->setResultCacheLifetime(60)
  1365.             ->getScalarResult();
  1366.         $veriler = [];
  1367.         foreach ($sayfalar as $sayfa){
  1368.             $sId $this->IdBul('Sayfa',$sayfa['dilgrup']);
  1369.             $sLink $this->site_anaLink().$sayfa['seo'];
  1370.             if ($sayfa['kategori'] == 0) {
  1371.                 $veriler[$sayfa['dilgrup']]= $this->site_sayfaIcerik($sayfa['dilgrup']);
  1372.             }
  1373.             else {
  1374.                 $veriler[$sayfa['dilgrup']]= $this->site_sayfaKategori($sayfa['dilgrup']);
  1375.             }
  1376.         }
  1377.         return $veriler;
  1378.     }
  1379.     function ustMenuler($sayfa,$kategori="",$icerik="",$kategoriV="")
  1380.     {
  1381.         $em $this->em;
  1382.         $dil $this->session->get('dil');
  1383.         $veriler = [];
  1384.         $veriler[] = ['adi'=>$this->ceviri('Anasayfa'),'link'=>$this->site_anaLink()];
  1385.         $qb $em->createQueryBuilder();
  1386.         $sayfa=$qb->select('s.id,s.adi,s.dilgrup,s.seo')
  1387.             ->from('App:Sayfa''s')
  1388.             ->join('s.dil''d')
  1389.             ->join('s.modul''m')
  1390.             ->where('d.id='.$dil['id'].' and s.dilgrup='.$sayfa)
  1391.             ->getQuery()
  1392.             ->setResultCacheId('menuSayfa')
  1393.             ->setResultCacheLifetime(60)
  1394.             ->getScalarResult();
  1395.         $veriler[] = ['adi'=>$sayfa[0]['adi'],'link'=>$this->site_anaLink().$sayfa[0]['seo']];
  1396.         if ($kategori!=''){
  1397.             $kattlar explode('~',$this->site_kategoriGeriLi($kategori,$dil['id']));
  1398.             foreach ($kattlar as $kat){
  1399.                 if($kat!=''){
  1400.                     $x explode('#',$kat);
  1401.                     $veriler[] = ['adi'=>$x[0],'link'=>$this->site_anaLink().$sayfa[0]['seo'].'/'.$x[1]];
  1402.                 }
  1403.             }
  1404.         }
  1405.         if ($icerik!='-'){
  1406.             $ii explode('-',$icerik);
  1407.             $veriler[] = ['adi'=>$ii[0],'link'=>'#'];
  1408.         }
  1409.         if ($kategoriV!=''){
  1410.             $veriler[] = ['adi'=>$kategoriV,'link'=>'#'];
  1411.         }
  1412.         return $veriler;
  1413.     }
  1414.     function veriYenile($veriler,$sayfaSeo,$kategori=0)
  1415.     {
  1416.         $em $this->em;
  1417.         $dil $this->session->get('dil');
  1418.         $yeniVeri=[];
  1419.         foreach ($veriler as $key=>$veri){
  1420.             $alt='';
  1421.             if($kategori==1){
  1422.                 $alt $this->altKategoriGeriYaz($veri['kategoriId'],$dil['id']);
  1423.             }
  1424.             $veri['link'] = $this->site_anaLink().$sayfaSeo.'/'.$alt.$veri['seourl'];
  1425.             if (array_key_exists('resimler'$veri)) {
  1426.                 $veri['resim'] = explode(',',$veri['resimler'])[0];
  1427.             }
  1428.             $yeniVeri[]=$veri;
  1429.         }
  1430.         return $yeniVeri;
  1431.     }
  1432.     function kategoriVeriYenile($veriler,$sayfaSeo)
  1433.     {
  1434.         $em $this->em;
  1435.         $dil $this->session->get('dil');
  1436.         $yeniVeri=[];
  1437.         foreach ($veriler as $key=>$veri){
  1438.             $alt $this->altKategoriGeriYaz($veri['ustid'],$dil['id']);
  1439.             $veri['link'] = $this->site_anaLink().$sayfaSeo.'/'.$alt.$veri['seourl'];
  1440.             $yeniVeri[]=$veri;
  1441.         }
  1442.         return $yeniVeri;
  1443.     }
  1444.     function icerikSolMenuler($sayfaDilgrup,$kategoriDilgrup)
  1445.     {
  1446.         $em $this->em;
  1447.         $dil $this->session->get('dil');
  1448.         $yeniVeri=[];
  1449.         if ($kategoriDilgrup!=''){
  1450.             $veriler $this->site_sayfaIcerikDirek($sayfaDilgrup);
  1451.         }else{
  1452.             $veriler $this->site_sayfaIcerik($sayfaDilgrup);
  1453.         }
  1454.         foreach ($veriler[1] as $veri) {
  1455.             $yeniVeri[]=$veri;
  1456.         }
  1457.         return $yeniVeri;
  1458.     }
  1459.     function footerSayfaDilgrup()
  1460.     {
  1461.         $em $this->em;
  1462.         $qb $em->createQueryBuilder();
  1463.         $sss=$qb->select('s.dilgrup')
  1464.             ->from('App:Sayfa''s')
  1465.             ->where('s.footer=1')
  1466.             ->getQuery()
  1467.             ->getScalarResult();
  1468.         return $sss[0]['dilgrup'];
  1469.     }
  1470. }