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.         if ($this->get('session')->get('iamToken')){
  160.             return $this->get('session')->get('iamToken');
  161.         }else {
  162.             $curl curl_init();
  163.             curl_setopt_array($curl, array(
  164.                 CURLOPT_URL => 'https://iam.api.cloud.yandex.net/iam/v1/tokens',
  165.                 CURLOPT_RETURNTRANSFER => true,
  166.                 CURLOPT_ENCODING => '',
  167.                 CURLOPT_MAXREDIRS => 10,
  168.                 CURLOPT_TIMEOUT => 0,
  169.                 CURLOPT_FOLLOWLOCATION => true,
  170.                 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  171.                 CURLOPT_CUSTOMREQUEST => 'POST',
  172.                 CURLOPT_POSTFIELDS => '{
  173.     "yandexPassportOauthToken":"y0_AgAAAAAZYEETAATuwQAAAADPKuYXh6Tbip2gTF-e_MyFaRn7KPE5_uk"
  174. }',
  175.                 CURLOPT_HTTPHEADER => array(
  176.                     'Content-Type: application/json'
  177.                 ),
  178.             ));
  179.             $response curl_exec($curl);
  180.             $response json_decode($responsetrue);
  181.             $this->get('session')->set('iamToken'$response['iamToken']);
  182.             return $response['iamToken'];
  183.         }
  184.     }
  185.     function cevir($deger,$x,$dil){
  186.         if ($deger==''){
  187.             return "";
  188.         }
  189.         $token $this->yandexToken();
  190.         $curl curl_init();
  191.         curl_setopt_array($curl, array(
  192.             CURLOPT_URL => 'https://translate.api.cloud.yandex.net/translate/v2/translate',
  193.             CURLOPT_RETURNTRANSFER => true,
  194.             CURLOPT_ENCODING => '',
  195.             CURLOPT_MAXREDIRS => 10,
  196.             CURLOPT_TIMEOUT => 0,
  197.             CURLOPT_FOLLOWLOCATION => true,
  198.             CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  199.             CURLOPT_CUSTOMREQUEST => 'POST',
  200.             CURLOPT_POSTFIELDS =>'{
  201.     "folderId": "b1g1l9b33ueptm8liaou",
  202.     "texts": "'.$deger.'",
  203.     "targetLanguageCode": "'.$dil.'"
  204. }',
  205.             CURLOPT_HTTPHEADER => array(
  206.                 'Authorization: Bearer '.$token,
  207.                 'Content-Type: application/json'
  208.             ),
  209.         ));
  210.         $response curl_exec($curl);
  211.         $response json_decode($responsetrue);
  212.         return $response['translations'][0]['text'];
  213.     }
  214.     public function ceviri($deger,$suanDil='')
  215.     {
  216.         $em $this->getDoctrine()->getManager();
  217.         if ($suanDil==''){
  218.             $suanDil $this->get('session')->get('dil');
  219.         } else {
  220.             $qb $em->createQueryBuilder();
  221.             $dill=$qb->select('d.id,d.kisa,d.uzun')
  222.                 ->from('App:Dil''d')
  223.                 ->where('d.id='.$suanDil)
  224.                 ->getQuery()
  225.                 ->getScalarResult();
  226.             $suanDil $dill[0];
  227.         }
  228.         $qb $em->createQueryBuilder();
  229.         $ceviriTara=$qb->select('c.deger,c.id')
  230.             ->from('App:Ceviri''c')
  231.             ->join('c.dil','d')
  232.             ->where("c.deger='$deger'")
  233.             ->getQuery()
  234.             ->getScalarResult();
  235.         if (count($ceviriTara) > 0) {
  236.             if ($suanDil['id'] != 1) {
  237.                 $qb $em->createQueryBuilder();
  238.                 $ceviriTara2=$qb->select('c.deger')
  239.                     ->from('App:Ceviri''c')
  240.                     ->join('c.dil','d')
  241.                     ->where("d.id=".$suanDil['id']." and c.trId=".$ceviriTara[0]['id'])
  242.                     ->getQuery()
  243.                     ->getScalarResult();
  244.                 if (count($ceviriTara2) > 0) {
  245.                     $deger $ceviriTara2[0]['deger'];
  246.                 } else {
  247.                     if($deger=='İletişim') {
  248.                     }
  249.                     if ($suanDil['id'] != '1') {
  250.                         $deger $this->cevir($deger,'',$suanDil['kisa']);
  251.                         $dill $em->getReference(Dil::class,$suanDil['id']);
  252.                         $ceviri = new Ceviri();
  253.                         $ceviri->setDil($dill);
  254.                         $ceviri->setDeger($deger);
  255.                         $ceviri->setTrId($ceviriTara[0]['id']);
  256.                         $em->persist($ceviri);
  257.                         $em->flush();
  258.                     }
  259.                 }
  260.             }
  261.         }
  262.         else {
  263.             if ($suanDil['id'] == 1) {
  264.                 $dill $em->getReference(Dil::class,$suanDil['id']);
  265.                 $ceviri = new Ceviri();
  266.                 $ceviri->setDil($dill);
  267.                 $ceviri->setDeger($deger);
  268.                 $ceviri->setTrId(0);
  269.                 $em->persist($ceviri);
  270.                 $em->flush();
  271.             }
  272.             else {
  273.                 $dilTr $em->getReference(Dil::class,1);
  274.                 $ceviri = new Ceviri();
  275.                 $ceviri->setDil($dilTr);
  276.                 $ceviri->setDeger($deger);
  277.                 $ceviri->setTrId(0);
  278.                 $em->persist($ceviri);
  279.                 $em->flush();
  280.                 $deger $this->cevir($deger,'',$suanDil['kisa']);
  281.                 $dill $em->getReference(Dil::class,$suanDil['id']);
  282.                 $ceviriDil = new Ceviri();
  283.                 $ceviriDil->setDil($dill);
  284.                 $ceviriDil->setDeger($deger);
  285.                 $ceviriDil->setTrId($ceviri->getId());
  286.                 $em->persist($ceviriDil);
  287.                 $em->flush();
  288.             }
  289.         }
  290.         return $deger;
  291.     }
  292.     public function yetkiler($yetkiler){
  293.         if ($yetkiler==''){
  294.             return 1;
  295.         }
  296.         $yetkiler explode('~',str_replace(array('{','}'),array('',''),substr($yetkiler,0,strlen($yetkiler)-1)));
  297.         $return = [];
  298.         foreach ($yetkiler as $y){
  299.             $x explode(':',$y);
  300.             $z explode(',',$x[1]);
  301.             $return[$x[0]]['gorme']=$z[0];
  302.             $return[$x[0]]['ekleme']=$z[1];
  303.             $return[$x[0]]['duzenleme']=$z[2];
  304.             $return[$x[0]]['silme']=$z[3];
  305.         }
  306.         if($this->getUser()->getRoles()[0]=='ROLE_SUPERADMIN' or $this->getUser()->getRoles()[0]=='ROLE_ADMIN'){
  307.             return 1;
  308.         }else{
  309.             return $return;
  310.         }
  311.     }
  312.     public function domainSorgula(){
  313.         $em $this->getDoctrine()->getManager();
  314.         $suan = new \DateTime('now');
  315.         $tarih = new \DateTime($this->ayarlar('domainTarih'));
  316.         if (empty($this->ayarlar('domainTarih')) or $tarih->format('U') < $suan->format('U')) {
  317.             $domain str_replace(array('/''https:''http:'), array(''''''), $this->ayarlar('siteYolu'));
  318.             $ch curl_init();
  319.             curl_setopt($chCURLOPT_URL"https://www.whois.com/whois/" $domain);
  320.             curl_setopt($chCURLOPT_RETURNTRANSFER1);
  321.             curl_setopt($chCURLOPT_REFERER'https://www.google.com/');
  322.             $output curl_exec($ch);
  323.             curl_close($ch);
  324.             $dBol explode('.'$domain);
  325.             if (count($dBol) == 2) {
  326.                 preg_match_all('@<pre class="df-raw" id="registrarData">(.*?)</pre>@si'$output$icerik);
  327.                 $tarihB explode('Registrar Registration Expiration Date:'$icerik[0][0]);
  328.                 $tarihB explode('Registrar'$tarihB[1]);
  329.                 $tarih str_replace('T'' '$tarihB[0]);
  330.             } else {
  331.                 preg_match_all('@<pre class="df-raw" id="registryData">(.*?)</pre>@si'$output$icerik);
  332.                 $tarihB explode('Expires on..............:'$icerik[0][0]);
  333.                 $tarihB explode('.'$tarihB[1]);
  334.                 $tarih $tarihB[0];
  335.             }
  336.             //echo $tarih;
  337.             $tarih = new \DateTime($tarih);
  338.             if ($this->ayarlar('debug') != 1) {
  339.                 $qb $em->createQueryBuilder();
  340.                 $q $qb->update('App:Ayarlar''a')
  341.                     ->set('a.domainTarih'':domainTarih')
  342.                     ->setParameter('domainTarih'$tarih)
  343.                     ->getQuery()
  344.                     ->execute();
  345.             }
  346.         }
  347.         return $tarih;
  348.     }
  349.     public function hostingSorgulama(){
  350.         $em $this->getDoctrine()->getManager();
  351.         $suan = new \DateTime('now');
  352.         if (empty($this->ayarlar('hostingTarih'))) {
  353.             $domain str_replace(array('/''https:''http:'), array(''''''), $this->ayarlar('siteYolu'));
  354.             $ch curl_init();
  355.             curl_setopt($chCURLOPT_URL"https://174gj41p1.ni.net.tr:2087/json-api/listaccts?api.version=1&search=$domain&searchtype=domain");
  356.             curl_setopt($chCURLOPT_USERPWD'root' ":" 'aKuosv}_x3{K');
  357.             curl_setopt($chCURLOPT_RETURNTRANSFER1);
  358.             $output curl_exec($ch);
  359.             curl_close($ch);
  360.             $output json_decode($output);
  361.             $baslangicTarihi = new \DateTime();
  362.             $baslangicTarihi->setTimestamp($output->data->acct[0]->unix_startdate);
  363.             $baslangicTarihi->modify('+1 year');
  364.             if ($this->ayarlar('debug')!=1) {
  365.                 $qb $em->createQueryBuilder();
  366.                 $q $qb->update('App:Ayarlar''a')
  367.                     ->set('a.hostingTarih'':hostingTarih')
  368.                     ->setParameter('hostingTarih'$baslangicTarihi)
  369.                     ->getQuery()
  370.                     ->execute();
  371.             }
  372.         }else{
  373.             $baslangicTarihi = new \DateTime($this->ayarlar('hostingTarih'));
  374.             if ($baslangicTarihi->format('U') < $suan->format('U')) {
  375.                 if($baslangicTarihi->format('d.m.Y')!=$suan->format('d.m.Y')){
  376.                     $baslangicTarihi->modify('+1 year');
  377.                     if ($this->ayarlar('debug')!=1) {
  378.                         $qb $em->createQueryBuilder();
  379.                         $q $qb->update('App:Ayarlar''a')
  380.                             ->set('a.hostingTarih'':hostingTarih')
  381.                             ->setParameter('hostingTarih'$baslangicTarihi)
  382.                             ->getQuery()
  383.                             ->execute();
  384.                     }
  385.                 }
  386.             }
  387.         }
  388.         return $baslangicTarihi;
  389.     }
  390.     public function dilSay(){
  391.         $em $this->getDoctrine()->getManager();
  392.         $qb $em->createQueryBuilder();
  393.         $ayarlar=$qb->select("e.id")
  394.             ->from('App:Dil''e')
  395.             ->where('e.aktif=1')
  396.             ->getQuery()
  397.             ->getScalarResult();
  398.         return count($ayarlar);
  399.     }
  400.     function altKategoriListeSiteMap($dilgrup,$sSeo,$dil){
  401.         $em $this->getDoctrine()->getManager();
  402.         $qb $em->createQueryBuilder();
  403.         $kategoriler=$qb->select('k.dilgrup,k.seourl,d.kisa as dKisa,k.ustid')
  404.             ->from('App:Kategori''k')
  405.             ->join('k.dil','d')
  406.             ->where('k.ustid='.$dilgrup.' and d.id='.$dil)
  407.             ->orderBy('k.sira','ASC')
  408.             ->getQuery()
  409.             ->getScalarResult();
  410.         $siteyolu $this->ayarlar('siteYolu');
  411.         $suan = new \DateTime('now');
  412.         $veriler='';
  413.         foreach ($kategoriler as $k) {
  414.             if ($this->dilSay() > 1) {
  415.                 $veriler .= '<url>
  416.                                   <loc>' $siteyolu .$k['dKisa'].'/'.$sSeo.'/'.$this->altKategoriGeriYaz($k['ustid'],$dil) .$k['seourl'].'</loc>
  417.                                   <lastmod>' $suan->format('Y-m-d') . 'T' $suan->format('H:i:s') . '+00:00</lastmod>
  418.                                   <priority>0.80</priority>
  419.                                 </url>';
  420.             } else {
  421.                 $veriler .= '<url>
  422.                                   <loc>' $siteyolu .$sSeo.'/'.$this->altKategoriGeriYaz($k['ustid'],$dil) .$k['seourl'].'</loc>
  423.                                   <lastmod>' $suan->format('Y-m-d') . 'T' $suan->format('H:i:s') . '+00:00</lastmod>
  424.                                   <priority>0.80</priority>
  425.                                 </url>';
  426.             }
  427.             $veriler .= $this->altKategoriListeSiteMap($k['dilgrup'], $sSeo,$dil);;
  428.         }
  429.         return $veriler;
  430.     }
  431.     function altKategoriGeriYaz($ustid,$dil=1){
  432.         $em $this->getDoctrine()->getManager();
  433.         $qb $em->createQueryBuilder();
  434.         $kategoriler=$qb->select('k.id,k.dilgrup,k.adi,k.seourl,k.ustid')
  435.             ->from('App:Kategori''k')
  436.             ->join('k.dil','d')
  437.             ->where('k.dilgrup='.$ustid.' and d.id='.$dil)
  438.             ->groupBy('k.dilgrup')
  439.             ->orderBy('k.sira','ASC')
  440.             ->getQuery()
  441.             ->getScalarResult();
  442.         $veriler='';
  443.         foreach ($kategoriler as $k){
  444.             $veriler.=$this->altKategoriGeriYaz($k['ustid'],$dil).$k['seourl'].'/';
  445.         }
  446.         return $veriler;
  447.     }
  448.     public function iletisimBilgileri($alan){
  449.         $em $this->getDoctrine()->getManager();
  450.         $dil $this->get('session')->get('dil');
  451.         $qb $em->createQueryBuilder();
  452.         $iletisim=$qb->select('s.'.$alan)
  453.             ->from('App:Iletisim''s')
  454.             ->join('s.dil''d')
  455.             ->where('d.id='.$dil['id'])
  456.             ->getQuery()
  457.             ->getScalarResult();
  458.         return $iletisim[0][$alan];
  459.     }
  460.     public function imageResizer($resim,$resim2,$boyut=800){
  461.         $resimBol explode('.',$resim);
  462.         $uzanti $resimBol[count($resimBol)-1];
  463.         $yol 'gecici_yukleme/'.$resim;
  464.         $yol2 'gecici_yukleme/'.$resim2.'.webp';
  465.         list($width$height) = getimagesize($yol);
  466.         $oran $width $boyut;
  467.         $yeni_genislik $width $oran;
  468.         $yeni_yukseklik $height $oran;
  469.         if ($uzanti=='jpeg' or $uzanti=='jpg' or $uzanti=='JPEG' or $uzanti=='JPG'){
  470.             $mevcut_resim imagecreatefromjpeg($yol);
  471.         }else{
  472.             $mevcut_resim imagecreatefrompng($yol);
  473.         }
  474.         $yeni_resim imagecreatetruecolor($yeni_genislik$yeni_yukseklik);
  475.         imageAlphaBlending($yeni_resimfalse);
  476.         imageSaveAlpha($yeni_resimtrue);
  477. // By default, the canvas is black, so make it transparent
  478.         $trans imagecolorallocatealpha($yeni_resim000127);
  479.         imagefilledrectangle($yeni_resim00$yeni_genislik 1$yeni_yukseklik 1$trans);
  480.         imagecopyresampled($yeni_resim$mevcut_resim0000$yeni_genislik$yeni_yukseklik$width$height);
  481.         @unlink($yol);
  482.         imagewebp($yeni_resim$yol2 );
  483.         return $resim2.'.webp';
  484.     }
  485.     public function removeEntity($veriler){
  486.         $em $this->getDoctrine()->getManager();
  487.         foreach ($veriler as $veri){
  488.             $em->remove($veri);
  489.         }
  490.     }
  491.     public function uploadFile($file){
  492.         $username 'rvcloudstorage';
  493.         $password 'rvrv/*-2020';
  494.         $url 'https://j15502zk.ni.net.tr:2083';
  495.         $yukleme_yeri 'webSitesApp/'.$this->ayarlar('uploadFolder');
  496.         $filePath 'gecici_yukleme/'.$file;
  497.         $curl curl_init();
  498.         $upload_file realpath($filePath);
  499.         $destination_dir "public_html/".$yukleme_yeri;
  500.         if (function_exists('curl_file_create')) {
  501.             $cf curl_file_create($upload_file);
  502.         } else {
  503.             $cf "@/" $upload_file;
  504.         }
  505.         $payload = array(
  506.             'dir' => $destination_dir,
  507.             'file-1' => $cf
  508.         );
  509.         $actionUrl $url "/execute/Fileman/upload_files";
  510.         curl_setopt($curlCURLOPT_SSL_VERIFYPEER0);       // Allow self-signed certs
  511.         curl_setopt($curlCURLOPT_SSL_VERIFYHOST0);       // Allow certs that do not match the hostname
  512.         curl_setopt($curlCURLOPT_HEADER0);               // Do not include header in output
  513.         curl_setopt($curlCURLOPT_RETURNTRANSFER1);       // Return contents of transfer on curl_exec
  514.         $header[0] = "Authorization: Basic " base64_encode($username ":" $password) . "\n\r";
  515.         curl_setopt($curlCURLOPT_HTTPHEADER$header);    // set the username and password
  516.         curl_setopt($curlCURLOPT_URL$actionUrl);        // execute the query
  517.         // Set up a POST request with the payload.
  518.         curl_setopt($curlCURLOPT_POSTtrue);
  519.         curl_setopt($curlCURLOPT_POSTFIELDS$payload);
  520.         curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
  521.         $result curl_exec($curl);
  522.         if ($result == false) {
  523.             error_log("curl_exec threw error \"" curl_error($curl) . "\" for $actionUrl");
  524.             // log error if curl exec fails
  525.         }
  526.         curl_close($curl);
  527.         @unlink($filePath);
  528.         return json_decode($resulttrue);
  529.     }
  530.     function deleteFile($file)
  531.     {
  532.         if ($file!='') {
  533.             $curl curl_init();
  534.             $destination_dir 'public_html/webSitesApp/'.$this->ayarlar('uploadFolder').'/' $file;
  535.             $username 'root';
  536.             $password 'suleyman1995ilgin***';
  537.             $url 'https://j15502zk.ni.net.tr:2083';
  538.             $user 'rvcloudstorage';
  539.             $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';
  540.             curl_setopt($curlCURLOPT_SSL_VERIFYPEER0);       // Allow self-signed certs
  541.             curl_setopt($curlCURLOPT_SSL_VERIFYHOST0);       // Allow certs that do not match the hostname
  542.             curl_setopt($curlCURLOPT_HEADER0);               // Do not include header in output
  543.             curl_setopt($curlCURLOPT_RETURNTRANSFER1);       // Return contents of transfer on curl_exec
  544.             $header[0] = "Authorization: Basic " base64_encode($username ":" $password) . "\n\r";
  545.             curl_setopt($curlCURLOPT_HTTPHEADER$header);    // set the username and password
  546.             curl_setopt($curlCURLOPT_URL$actionUrl);        // execute the query
  547.             curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
  548.             $result curl_exec($curl);
  549.             if ($result == false) {
  550.                 error_log("curl_exec threw error \"" curl_error($curl) . "\" for $actionUrl");
  551.                 // log error if curl exec fails
  552.             }
  553.             curl_close($curl);
  554.             return json_decode($resulttrue);
  555.         }
  556.     }
  557.     public function dilgrupBul($entity,$id){
  558.         $em $this->getDoctrine()->getManager();
  559.         $qb $em->createQueryBuilder();
  560.         $veriler=$qb->select('x.dilgrup')
  561.             ->from('App:'.$entity'x')
  562.             ->join('x.dil','d')
  563.             ->where('x.id='.$id)
  564.             ->groupBy('x.dil')
  565.             ->getQuery()
  566.             ->getScalarResult();
  567.         return $veriler[0]['dilgrup'];
  568.     }
  569. }