src/Controller/BaseController.php line 52

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Ceviri;
  4. use App\Entity\Dil;
  5. use Gumlet\ImageResize;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use App\Controller;
  8. use Symfony\Component\HttpFoundation\Request;
  9. use Symfony\Component\HttpFoundation\Response;
  10. class BaseController extends AbstractController
  11. {
  12.     function GetIP()
  13.     {
  14.         if (getenv("HTTP_CLIENT_IP")) {
  15.             $ip getenv("HTTP_CLIENT_IP");
  16.         } elseif (getenv("HTTP_X_FORWARDED_FOR")) {
  17.             $ip getenv("HTTP_X_FORWARDED_FOR");
  18.             if (strstr($ip',')) {
  19.                 $tmp explode(','$ip);
  20.                 $ip trim($tmp[0]);
  21.             }
  22.         } else {
  23.             $ip getenv("REMOTE_ADDR");
  24.         }
  25.         return $ip;
  26.     }
  27.     public function IdBul($entity,$id){
  28.         $em=$this->getDoctrine()->getManager();
  29.         $qb $em->createQueryBuilder();
  30.         $veriler=$qb->select('x.id')
  31.             ->from('App:'.$entity'x')
  32.             ->join('x.dil','d')
  33.             ->where('x.dilgrup='.$id)
  34.             ->groupBy('x.dil')
  35.             ->getQuery()
  36.             ->getScalarResult();
  37.         return $veriler[0]['id'];
  38.     }
  39.     function varsayilanDil(){
  40.         $em=$this->getDoctrine()->getManager();
  41.         $qb $em->createQueryBuilder();
  42.         $diller=$qb->select('d.id,d.kisa,d.uzun')
  43.             ->from('App:Dil''d')
  44.             ->where("d.aktif=1 and d.varsayilan=1")
  45.             ->orderBy('d.id')
  46.             ->getQuery()
  47.             ->getScalarResult();
  48.         return $diller[0];
  49.     }
  50.     function gecerliAktifDil(){
  51.         $em=$this->getDoctrine()->getManager();
  52.         $qb $em->createQueryBuilder();
  53.         $diller=$qb->select('d.id')
  54.             ->from('App:Dil''d')
  55.             ->where("d.aktif=1")
  56.             ->orderBy('d.id')
  57.             ->getQuery()
  58.             ->getScalarResult();
  59.         return $diller[0]['id'];
  60.     }
  61.     public function ayarlar($alan,$dil='')
  62.     {
  63.         $em=$this->getDoctrine()->getManager();
  64.         if($dil=='') {
  65.             $qb $em->createQueryBuilder();
  66.             $dd $qb->select("e.id")
  67.                 ->from('App:Dil''e')
  68.                 ->where('e.aktif=1 and e.varsayilan=1')
  69.                 ->getQuery()
  70.                 ->getScalarResult();
  71.             $dil=$dd[0]['id'];
  72.         }
  73.         $qb $em->createQueryBuilder();
  74.         $ayarlar=$qb->select("e.$alan")
  75.             ->from('App:Ayarlar''e')
  76.             ->where('e.dil='.$dil)
  77.             ->getQuery()
  78.             ->getScalarResult();
  79.         return $ayarlar[0][$alan];
  80.     }
  81.     function uzantiBul($type){
  82.         if($type=='image/jpeg'){ return '.jpg'; }
  83.         elseif($type=='image/png'){ return '.png'; }
  84.         elseif($type=='image/gif'){ return '.gif'; }
  85.         elseif($type=='video/mp4'){ return '.mp4'; }
  86.         elseif($type=='application/rtf'){ return '.rtf'; }
  87.         elseif($type=='text/plain'){ return '.txt'; }
  88.         elseif($type=='application/vnd.ms-powerpoint'){ return '.ppt'; }
  89.         elseif($type=='application/vnd.openxmlformats-officedocument.presentationml.presentation'){ return '.pptx'; }
  90.         elseif($type=='application/xml'){ return '.xml'; }
  91.         elseif($type=='text/xml'){ return '.xml'; }
  92.         elseif($type=='application/vnd.ms-excel'){ return '.xls'; }
  93.         elseif($type=='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'){ return '.xlsx'; }
  94.         elseif($type=='application/msword'){ return '.doc'; }
  95.         elseif($type=='application/vnd.openxmlformats-officedocument.wordprocessingml.document'){ return '.docx'; }
  96.         else{ return '.belirsiz'; }
  97.     }
  98.     function rasgele($uzunluk)
  99.     {
  100.         $key='';
  101.         $karakterler "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  102.         for($i=0;$i<$uzunluk;$i++)
  103.         {
  104.             $key .= $karakterler{rand(0,35)};
  105.         }
  106.         return $key;
  107.     }
  108.     function rasgeleSayi($uzunluk)
  109.     {
  110.         $key='';
  111.         $karakterler "1234567890";
  112.         for($i=0;$i<$uzunluk;$i++)
  113.         {
  114.             $key .= $karakterler{rand(0,35)};
  115.         }
  116.         return $key;
  117.     }
  118.     function son_dilgrup($entity){
  119.         $em=$this->getDoctrine()->getManager();
  120.         $qb $em->createQueryBuilder();
  121.         $data=$qb->select('h.dilgrup')
  122.             ->from('App:'.$entity'h')
  123.             ->orderBy('h.dilgrup','desc')
  124.             ->getQuery()
  125.             ->getScalarResult();
  126.         if(count($data)>0){
  127.             $dilgrup intval($data[0]['dilgrup'])+1;
  128.         }else{
  129.             $dilgrup 1;
  130.         }
  131.         return $dilgrup;
  132.     }
  133.     function seo($url,$dil=1){
  134.         if($dil==1) {
  135.             $tr = array('ş''Ş''ı''I''İ''ğ''Ğ''ü''Ü''ö''Ö''Ç''ç''('')''/'':'',');
  136.             $eng = array('s''s''i''i''i''g''g''u''u''o''o''c''c''''''-''-''');
  137.             $s str_replace($tr$eng$url);
  138.             $find = array('/[^A-Za-z0-9\-<>]/''/[\-]+/''/<[^>]*>/');
  139.             $repl = array('-''-''-');
  140.             $s preg_replace($find$repl$s);
  141.             $s strtolower($s);
  142.             $s preg_replace('/&amp;amp;amp;amp;amp;amp;amp;amp;amp;.+?;/'''$s);
  143.             $s preg_replace('/\s+/''-'$s);
  144.             $s preg_replace('|-+|''-'$s);
  145.             $s preg_replace('/#/'''$s);
  146.             $s str_replace('.'''$s);
  147.             $s trim($s'-');
  148.             $s strtolower($s);
  149.             return $s;
  150.         }else{
  151.             $tr = array('('')''/'':'',',' ');
  152.             $eng = array('''''-''-''','-');
  153.             $s str_replace($tr$eng$url);
  154.             $s strtolower($s);
  155.             return $s;
  156.         }
  157.     }
  158.     function yandexToken(){
  159.         $curl curl_init();
  160.         curl_setopt_array($curl, array(
  161.             CURLOPT_URL => 'https://iam.api.cloud.yandex.net/iam/v1/tokens',
  162.             CURLOPT_RETURNTRANSFER => true,
  163.             CURLOPT_ENCODING => '',
  164.             CURLOPT_MAXREDIRS => 10,
  165.             CURLOPT_TIMEOUT => 0,
  166.             CURLOPT_FOLLOWLOCATION => true,
  167.             CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  168.             CURLOPT_CUSTOMREQUEST => 'POST',
  169.             CURLOPT_POSTFIELDS =>'{
  170.     "yandexPassportOauthToken":"y0_AgAAAAAZYEETAATuwQAAAADPKuYXh6Tbip2gTF-e_MyFaRn7KPE5_uk"
  171. }',
  172.             CURLOPT_HTTPHEADER => array(
  173.                 'Content-Type: application/json'
  174.             ),
  175.         ));
  176.         $response curl_exec($curl);
  177.         $response json_decode($responsetrue);
  178.         return $response['iamToken'];
  179.     }
  180.     function cevir($deger,$x,$dil){
  181.         if ($deger==''){
  182.             return "";
  183.         }
  184.         $token $this->yandexToken();
  185.         $curl curl_init();
  186.         curl_setopt_array($curl, array(
  187.             CURLOPT_URL => 'https://translate.api.cloud.yandex.net/translate/v2/translate',
  188.             CURLOPT_RETURNTRANSFER => true,
  189.             CURLOPT_ENCODING => '',
  190.             CURLOPT_MAXREDIRS => 10,
  191.             CURLOPT_TIMEOUT => 0,
  192.             CURLOPT_FOLLOWLOCATION => true,
  193.             CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  194.             CURLOPT_CUSTOMREQUEST => 'POST',
  195.             CURLOPT_POSTFIELDS =>'{
  196.     "folderId": "b1g1l9b33ueptm8liaou",
  197.     "texts": "'.$deger.'",
  198.     "targetLanguageCode": "'.$dil.'"
  199. }',
  200.             CURLOPT_HTTPHEADER => array(
  201.                 'Authorization: Bearer '.$token,
  202.                 'Content-Type: application/json'
  203.             ),
  204.         ));
  205.         $response curl_exec($curl);
  206.         $response json_decode($responsetrue);
  207.         return $response['translations'][0]['text'];
  208.     }
  209.     public function ceviri($deger,$suanDil='')
  210.     {
  211.         $em $this->getDoctrine()->getManager();
  212.         if ($suanDil==''){
  213.             $suanDil $this->get('session')->get('dil');
  214.         }else{
  215.             $qb $em->createQueryBuilder();
  216.             $dill=$qb->select('d.id,d.kisa,d.uzun')
  217.                 ->from('App:Dil''d')
  218.                 ->where('d.id='.$suanDil)
  219.                 ->getQuery()
  220.                 ->getScalarResult();
  221.             $suanDil $dill[0];
  222.         }
  223.         $qb $em->createQueryBuilder();
  224.         $ceviriTara=$qb->select('c.deger,c.id')
  225.             ->from('App:Ceviri''c')
  226.             ->join('c.dil','d')
  227.             ->where("c.deger='$deger'")
  228.             ->getQuery()
  229.             ->getScalarResult();
  230.         if (count($ceviriTara) > 0) {
  231.             if ($suanDil['id'] != 1) {
  232.                 $qb $em->createQueryBuilder();
  233.                 $ceviriTara2=$qb->select('c.deger')
  234.                     ->from('App:Ceviri''c')
  235.                     ->join('c.dil','d')
  236.                     ->where("d.id=".$suanDil['id']." and c.trId=".$ceviriTara[0]['id'])
  237.                     ->getQuery()
  238.                     ->getScalarResult();
  239.                 if (count($ceviriTara2) > 0) {
  240.                     $veri $ceviriTara2[0]['deger'];
  241.                 } else {
  242.                     if ($this->get('session')->get('dil')['id'] != '1') {
  243.                         $deger $this->cevir($deger,'',$suanDil['kisa']);
  244.                         $dill $em->getReference(Dil::class,$suanDil['id']);
  245.                         $ceviri = new Ceviri();
  246.                         $ceviri->setDil($dill);
  247.                         $ceviri->setDeger($deger);
  248.                         $ceviri->setTrId($ceviriTara[0]['id']);
  249.                         $em->persist($ceviri);
  250.                         $em->flush();
  251.                     }
  252.                 }
  253.             }
  254.         }
  255.         else {
  256.             if ($suanDil['id'] == 1) {
  257.                 $dill $em->getReference(Dil::class,$suanDil['id']);
  258.                 $ceviri = new Ceviri();
  259.                 $ceviri->setDil($dill);
  260.                 $ceviri->setDeger($deger);
  261.                 $ceviri->setTrId(0);
  262.                 $em->persist($ceviri);
  263.                 $em->flush();
  264.             }
  265.             else {
  266.                 $dilTr $em->getReference(Dil::class,1);
  267.                 $ceviri = new Ceviri();
  268.                 $ceviri->setDil($dilTr);
  269.                 $ceviri->setDeger($deger);
  270.                 $ceviri->setTrId(0);
  271.                 $em->persist($ceviri);
  272.                 $em->flush();
  273.                 $deger $this->cevir($deger,'',$suanDil['kisa']);
  274.                 $dill $em->getReference(Dil::class,$suanDil['id']);
  275.                 $ceviriDil = new Ceviri();
  276.                 $ceviriDil->setDil($dill);
  277.                 $ceviriDil->setDeger($deger);
  278.                 $ceviriDil->setTrId($ceviri->getId());
  279.                 $em->persist($ceviriDil);
  280.                 $em->flush();
  281.             }
  282.         }
  283.         return $deger;
  284.     }
  285.     public function yetkiler($yetkiler){
  286.         if ($yetkiler==''){
  287.             return 1;
  288.         }
  289.         $yetkiler explode('~',str_replace(array('{','}'),array('',''),substr($yetkiler,0,strlen($yetkiler)-1)));
  290.         $return = [];
  291.         foreach ($yetkiler as $y){
  292.             $x explode(':',$y);
  293.             $z explode(',',$x[1]);
  294.             $return[$x[0]]['gorme']=$z[0];
  295.             $return[$x[0]]['ekleme']=$z[1];
  296.             $return[$x[0]]['duzenleme']=$z[2];
  297.             $return[$x[0]]['silme']=$z[3];
  298.         }
  299.         if($this->getUser()->getRoles()[0]=='ROLE_SUPERADMIN' or $this->getUser()->getRoles()[0]=='ROLE_ADMIN'){
  300.             return 1;
  301.         }else{
  302.             return $return;
  303.         }
  304.     }
  305.     public function domainSorgula(){
  306.         $em $this->getDoctrine()->getManager();
  307.         $suan = new \DateTime('now');
  308.         $tarih = new \DateTime($this->ayarlar('domainTarih'));
  309.         if (empty($this->ayarlar('domainTarih')) or $tarih->format('U') < $suan->format('U')) {
  310.             $domain str_replace(array('/''https:''http:'), array(''''''), $this->ayarlar('siteYolu'));
  311.             $ch curl_init();
  312.             curl_setopt($chCURLOPT_URL"https://www.whois.com/whois/" $domain);
  313.             curl_setopt($chCURLOPT_RETURNTRANSFER1);
  314.             curl_setopt($chCURLOPT_REFERER'https://www.google.com/');
  315.             $output curl_exec($ch);
  316.             curl_close($ch);
  317.             $dBol explode('.'$domain);
  318.             if (count($dBol) == 2) {
  319.                 preg_match_all('@<pre class="df-raw" id="registrarData">(.*?)</pre>@si'$output$icerik);
  320.                 $tarihB explode('Registrar Registration Expiration Date:'$icerik[0][0]);
  321.                 $tarihB explode('Registrar'$tarihB[1]);
  322.                 $tarih str_replace('T'' '$tarihB[0]);
  323.             } else {
  324.                 preg_match_all('@<pre class="df-raw" id="registryData">(.*?)</pre>@si'$output$icerik);
  325.                 $tarihB explode('Expires on..............:'$icerik[0][0]);
  326.                 $tarihB explode('.'$tarihB[1]);
  327.                 $tarih $tarihB[0];
  328.             }
  329.             //echo $tarih;
  330.             $tarih = new \DateTime($tarih);
  331.             if ($this->ayarlar('debug') != 1) {
  332.                 $qb $em->createQueryBuilder();
  333.                 $q $qb->update('App:Ayarlar''a')
  334.                     ->set('a.domainTarih'':domainTarih')
  335.                     ->setParameter('domainTarih'$tarih)
  336.                     ->getQuery()
  337.                     ->execute();
  338.             }
  339.         }
  340.         return $tarih;
  341.     }
  342.     public function hostingSorgulama(){
  343.         $em $this->getDoctrine()->getManager();
  344.         $suan = new \DateTime('now');
  345.         if (empty($this->ayarlar('hostingTarih'))) {
  346.             $domain str_replace(array('/''https:''http:'), array(''''''), $this->ayarlar('siteYolu'));
  347.             $ch curl_init();
  348.             curl_setopt($chCURLOPT_URL"https://174gj41p1.ni.net.tr:2087/json-api/listaccts?api.version=1&search=$domain&searchtype=domain");
  349.             curl_setopt($chCURLOPT_USERPWD'root' ":" 'aKuosv}_x3{K');
  350.             curl_setopt($chCURLOPT_RETURNTRANSFER1);
  351.             $output curl_exec($ch);
  352.             curl_close($ch);
  353.             $output json_decode($output);
  354.             $baslangicTarihi = new \DateTime();
  355.             $baslangicTarihi->setTimestamp($output->data->acct[0]->unix_startdate);
  356.             $baslangicTarihi->modify('+1 year');
  357.             if ($this->ayarlar('debug')!=1) {
  358.                 $qb $em->createQueryBuilder();
  359.                 $q $qb->update('App:Ayarlar''a')
  360.                     ->set('a.hostingTarih'':hostingTarih')
  361.                     ->setParameter('hostingTarih'$baslangicTarihi)
  362.                     ->getQuery()
  363.                     ->execute();
  364.             }
  365.         }else{
  366.             $baslangicTarihi = new \DateTime($this->ayarlar('hostingTarih'));
  367.             if ($baslangicTarihi->format('U') < $suan->format('U')) {
  368.                 if($baslangicTarihi->format('d.m.Y')!=$suan->format('d.m.Y')){
  369.                     $baslangicTarihi->modify('+1 year');
  370.                     if ($this->ayarlar('debug')!=1) {
  371.                         $qb $em->createQueryBuilder();
  372.                         $q $qb->update('App:Ayarlar''a')
  373.                             ->set('a.hostingTarih'':hostingTarih')
  374.                             ->setParameter('hostingTarih'$baslangicTarihi)
  375.                             ->getQuery()
  376.                             ->execute();
  377.                     }
  378.                 }
  379.             }
  380.         }
  381.         return $baslangicTarihi;
  382.     }
  383.     public function dilSay(){
  384.         $em $this->getDoctrine()->getManager();
  385.         $qb $em->createQueryBuilder();
  386.         $ayarlar=$qb->select("e.id")
  387.             ->from('App:Dil''e')
  388.             ->where('e.aktif=1')
  389.             ->getQuery()
  390.             ->getScalarResult();
  391.         return count($ayarlar);
  392.     }
  393.     function altKategoriListeSiteMap($dilgrup,$sSeo,$dil){
  394.         $em $this->getDoctrine()->getManager();
  395.         $qb $em->createQueryBuilder();
  396.         $kategoriler=$qb->select('k.dilgrup,k.seourl,d.kisa as dKisa,k.ustid')
  397.             ->from('App:Kategori''k')
  398.             ->join('k.dil','d')
  399.             ->where('k.ustid='.$dilgrup.' and d.id='.$dil)
  400.             ->orderBy('k.sira','ASC')
  401.             ->getQuery()
  402.             ->getScalarResult();
  403.         $siteyolu $this->ayarlar('siteYolu');
  404.         $suan = new \DateTime('now');
  405.         $veriler='';
  406.         foreach ($kategoriler as $k) {
  407.             if ($this->dilSay() > 1) {
  408.                 $veriler .= '<url>
  409.                                   <loc>' $siteyolu .$k['dKisa'].'/'.$sSeo.'/'.$this->altKategoriGeriYaz($k['ustid'],$dil) .$k['seourl'].'</loc>
  410.                                   <lastmod>' $suan->format('Y-m-d') . 'T' $suan->format('H:i:s') . '+00:00</lastmod>
  411.                                   <priority>0.80</priority>
  412.                                 </url>';
  413.             } else {
  414.                 $veriler .= '<url>
  415.                                   <loc>' $siteyolu .$sSeo.'/'.$this->altKategoriGeriYaz($k['ustid'],$dil) .$k['seourl'].'</loc>
  416.                                   <lastmod>' $suan->format('Y-m-d') . 'T' $suan->format('H:i:s') . '+00:00</lastmod>
  417.                                   <priority>0.80</priority>
  418.                                 </url>';
  419.             }
  420.             $veriler .= $this->altKategoriListeSiteMap($k['dilgrup'], $sSeo,$dil);;
  421.         }
  422.         return $veriler;
  423.     }
  424.     function altKategoriGeriYaz($ustid,$dil=1){
  425.         $em $this->getDoctrine()->getManager();
  426.         $qb $em->createQueryBuilder();
  427.         $kategoriler=$qb->select('k.id,k.dilgrup,k.adi,k.seourl,k.ustid')
  428.             ->from('App:Kategori''k')
  429.             ->join('k.dil','d')
  430.             ->where('k.dilgrup='.$ustid.' and d.id='.$dil)
  431.             ->groupBy('k.dilgrup')
  432.             ->orderBy('k.sira','ASC')
  433.             ->getQuery()
  434.             ->getScalarResult();
  435.         $veriler='';
  436.         foreach ($kategoriler as $k){
  437.             $veriler.=$this->altKategoriGeriYaz($k['ustid'],$dil).$k['seourl'].'/';
  438.         }
  439.         return $veriler;
  440.     }
  441.     public function iletisimBilgileri($alan){
  442.         $em $this->getDoctrine()->getManager();
  443.         $dil $this->get('session')->get('dil');
  444.         $qb $em->createQueryBuilder();
  445.         $iletisim=$qb->select('s.'.$alan)
  446.             ->from('App:Iletisim''s')
  447.             ->join('s.dil''d')
  448.             ->where('d.id='.$dil['id'])
  449.             ->getQuery()
  450.             ->getScalarResult();
  451.         return $iletisim[0][$alan];
  452.     }
  453.     public function imageResizer($resim,$resim2,$boyut=800){
  454.         $resimBol explode('.',$resim);
  455.         $uzanti $resimBol[count($resimBol)-1];
  456.         $yol 'gecici_yukleme/'.$resim;
  457.         $yol2 'gecici_yukleme/'.$resim2.'.webp';
  458.         list($width$height) = getimagesize($yol);
  459.         $oran $width $boyut;
  460.         $yeni_genislik $width $oran;
  461.         $yeni_yukseklik $height $oran;
  462.         if ($uzanti=='jpeg' or $uzanti=='jpg' or $uzanti=='JPEG' or $uzanti=='JPG'){
  463.             $mevcut_resim imagecreatefromjpeg($yol);
  464.         }else{
  465.             $mevcut_resim imagecreatefrompng($yol);
  466.         }
  467.         $yeni_resim imagecreatetruecolor($yeni_genislik$yeni_yukseklik);
  468.         imageAlphaBlending($yeni_resimfalse);
  469.         imageSaveAlpha($yeni_resimtrue);
  470. // By default, the canvas is black, so make it transparent
  471.         $trans imagecolorallocatealpha($yeni_resim000127);
  472.         imagefilledrectangle($yeni_resim00$yeni_genislik 1$yeni_yukseklik 1$trans);
  473.         imagecopyresampled($yeni_resim$mevcut_resim0000$yeni_genislik$yeni_yukseklik$width$height);
  474.         @unlink($yol);
  475.         imagewebp($yeni_resim$yol2 );
  476.         return $resim2.'.webp';
  477.     }
  478.     public function removeEntity($veriler){
  479.         $em $this->getDoctrine()->getManager();
  480.         foreach ($veriler as $veri){
  481.             $em->remove($veri);
  482.         }
  483.     }
  484.     public function uploadFile($file){
  485.         $username 'rvcloudstorage';
  486.         $password 'rvrv/*-2020';
  487.         $url 'https://j15502zk.ni.net.tr:2083';
  488.         $yukleme_yeri 'webSitesApp/'.$this->ayarlar('uploadFolder');
  489.         $filePath 'gecici_yukleme/'.$file;
  490.         $curl curl_init();
  491.         $upload_file realpath($filePath);
  492.         $destination_dir "public_html/".$yukleme_yeri;
  493.         if (function_exists('curl_file_create')) {
  494.             $cf curl_file_create($upload_file);
  495.         } else {
  496.             $cf "@/" $upload_file;
  497.         }
  498.         $payload = array(
  499.             'dir' => $destination_dir,
  500.             'file-1' => $cf
  501.         );
  502.         $actionUrl $url "/execute/Fileman/upload_files";
  503.         curl_setopt($curlCURLOPT_SSL_VERIFYPEER0);       // Allow self-signed certs
  504.         curl_setopt($curlCURLOPT_SSL_VERIFYHOST0);       // Allow certs that do not match the hostname
  505.         curl_setopt($curlCURLOPT_HEADER0);               // Do not include header in output
  506.         curl_setopt($curlCURLOPT_RETURNTRANSFER1);       // Return contents of transfer on curl_exec
  507.         $header[0] = "Authorization: Basic " base64_encode($username ":" $password) . "\n\r";
  508.         curl_setopt($curlCURLOPT_HTTPHEADER$header);    // set the username and password
  509.         curl_setopt($curlCURLOPT_URL$actionUrl);        // execute the query
  510.         // Set up a POST request with the payload.
  511.         curl_setopt($curlCURLOPT_POSTtrue);
  512.         curl_setopt($curlCURLOPT_POSTFIELDS$payload);
  513.         curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
  514.         $result curl_exec($curl);
  515.         if ($result == false) {
  516.             error_log("curl_exec threw error \"" curl_error($curl) . "\" for $actionUrl");
  517.             // log error if curl exec fails
  518.         }
  519.         curl_close($curl);
  520.         @unlink($filePath);
  521.         return json_decode($resulttrue);
  522.     }
  523.     function deleteFile($file)
  524.     {
  525.         if ($file!='') {
  526.             $curl curl_init();
  527.             $destination_dir 'public_html/webSitesApp/'.$this->ayarlar('uploadFolder').'/' $file;
  528.             $username 'root';
  529.             $password 'suleyman1995ilgin***';
  530.             $url 'https://j15502zk.ni.net.tr:2083';
  531.             $user 'rvcloudstorage';
  532.             $actionUrl 'https://j15502zk.ni.net.tr:2087/json-api/cpanel?cpanel_jsonapi_user=' $user '&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Fileman&cpanel_jsonapi_func=fileop&op=unlink&sourcefiles=' $destination_dir '&doubledecode=1';
  533.             curl_setopt($curlCURLOPT_SSL_VERIFYPEER0);       // Allow self-signed certs
  534.             curl_setopt($curlCURLOPT_SSL_VERIFYHOST0);       // Allow certs that do not match the hostname
  535.             curl_setopt($curlCURLOPT_HEADER0);               // Do not include header in output
  536.             curl_setopt($curlCURLOPT_RETURNTRANSFER1);       // Return contents of transfer on curl_exec
  537.             $header[0] = "Authorization: Basic " base64_encode($username ":" $password) . "\n\r";
  538.             curl_setopt($curlCURLOPT_HTTPHEADER$header);    // set the username and password
  539.             curl_setopt($curlCURLOPT_URL$actionUrl);        // execute the query
  540.             curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
  541.             $result curl_exec($curl);
  542.             if ($result == false) {
  543.                 error_log("curl_exec threw error \"" curl_error($curl) . "\" for $actionUrl");
  544.                 // log error if curl exec fails
  545.             }
  546.             curl_close($curl);
  547.             return json_decode($resulttrue);
  548.         }
  549.     }
  550.     public function dilgrupBul($entity,$id){
  551.         $em $this->getDoctrine()->getManager();
  552.         $qb $em->createQueryBuilder();
  553.         $veriler=$qb->select('x.dilgrup')
  554.             ->from('App:'.$entity'x')
  555.             ->join('x.dil','d')
  556.             ->where('x.id='.$id)
  557.             ->groupBy('x.dil')
  558.             ->getQuery()
  559.             ->getScalarResult();
  560.         return $veriler[0]['dilgrup'];
  561.     }
  562. }