403Webshell
Server IP : 23.111.136.34  /  Your IP : 216.73.216.136
Web Server : Apache
System : Linux servidor.eurohost.com.br 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : meusitei ( 1072)
PHP Version : 5.6.40
Disable Function : show_source, system, shell_exec, passthru, proc_open
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/meusitei/public_html/painel/geradoresintegracao/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/meusitei/public_html/painel/geradoresintegracao//movingimoveis.php
<?php
// Topo
$dom = new DOMDocument("1.0", "utf-8");
$root = $dom->createElement("ListingDataFeed");
$dom->appendChild($root);
$dom->formatOutput = true;

$o = $dom->createAttribute("xmlns");
$root->appendChild($o);
$o1 = $dom->createTextNode("http://www.vivareal.com/schemas/1.0/VRSync");
$o->appendChild($o1);

$oo = $dom->createAttribute("xmlns:xsi");
$root->appendChild($oo);
$o2 = $dom->createTextNode("http://www.w3.org/2001/XMLSchema-instance");
$oo->appendChild($o2);

$ooo = $dom->createAttribute("xsi:schemaLocation");
$root->appendChild($ooo);
$o3 = $dom->createTextNode("http://www.vivareal.com/schemas/1.0/VRSync  http://xml.vivareal.com/vrsync.xsd");
$ooo->appendChild($o3);

// header
///// OBRIGATORIO - INICIO
$header = $dom->createElement("Header");
$root->appendChild($header);

$Provider = $dom->createElement("Provider");
$header->appendChild($Provider);
$titulositee = $dom->createTextNode($contactp);
$Provider->appendChild($titulositee);

$emaill = $dom->createElement("Email");
$header->appendChild($emaill);
$emailHeader = $dom->createTextNode($emailsistema);
$emaill->appendChild($emailHeader);

$contato = $dom->createElement("ContactName");
$header->appendChild($contato);
$contatoHeader = $dom->createTextNode($contactsistema);
$contato->appendChild($contatoHeader);

$telephone = $dom->createElement("Telephone");
$header->appendChild($telephone);
$telephoneHeader = $dom->createTextNode($sis_fone1);
$telephone->appendChild($telephoneHeader);

///// OBRIGATORIO - FIM
//fim do header
//inicio do Listings
$Listings = $dom->createElement("Listings");
$root->appendChild($Listings);

$imoveisintegrados = explode('-', $portal['imoveis']);

foreach ($imoveisintegrados as $campo) {
    $imovel_invalido_moving = '';
    if (@$infoimovel[$campo] != null) {
        echo $campo . '////' . serialize($infoimovel[$campo]) . '//////////';
// create child element
        @$campo = $infoimovel[$campo];
        $imovelvalido = 'nao';
        $validar = '1';
        if (($campo['valor'] != '') && ($campo['cep_estado'] != null) && ($campo['cep_cidade'] != null) && ($campo['cep_bairro'] != null) && ($campo['descricaodoimovel'] != null) && ($campo['descricaodoimovel'] != "<br>")){
            $imovelvalido = 'sim';
            
            if($campo['negocio'] == 'Temporada'){
                if(($campo['ciclo'] != 'Diária') && ($campo['ciclo'] != 'Mensal')){
                    $imovelvalido = 'nao';
                    $imovel_invalido_moving .= 'Ciclo'.'%';
                }
            }
            
            if(($campo['tipo'] == 'Apartamento') || ($campo['tipo'] == 'Casa') || ($campo['tipo'] == 'Terreno')){                               
                if($campo['areautil'] == ''){                      
                   $imovelvalido = 'nao';
                   $imovel_invalido_moving .= 'Área Útil'.'%';
                } 
                if($campo['tipo'] != 'Terreno'){
                    if (($campo['dormitorio'] == '0')){
                        $imovelvalido = 'nao';
                        $imovel_invalido_moving .= 'Dormitório'.'%';
                    }
                    if (($campo['banheiro'] == '0')){
                        $imovelvalido = 'nao';
                        $imovel_invalido_moving .= 'Banheiro'.'%';
                    }
                }
            }
            if($campo['tipo'] == 'Comercial'){                
                if (($campo['dormitorio'] == '0')){
                        $imovelvalido = 'nao';
                        $imovel_invalido_moving .= 'Dormitório'.'%';
                    }
                    if (($campo['banheiro'] == '0')){
                        $imovelvalido = 'nao';
                        $imovel_invalido_moving .= 'Banheiro'.'%';
                    }
                if(($campo['subtipoimovel'] == 'Galpão') || ($campo['subtipoimovel'] == 'Depósito') || ($campo['subtipoimovel'] == 'Armazém')){
                    if($campo['areatotal'] == ''){                      
                        $imovelvalido = 'nao';
                        $imovel_invalido_moving .= 'Área Total'.'%';
                    }
                }else{
                    if($campo['areautil'] == ''){                      
                       $imovel_invalido_moving .= 'Área Útil'.'%';
                    }
                }
            }
            if($campo['tipo'] == 'Rural'){
                if (($campo['banheiro'] == '0')){
                    $imovelvalido = 'nao';
                }
                if(($campo['subtipoimovel'] == 'Fazenda') || ($campo['subtipoimovel'] == 'Sítio') || ($campo['subtipoimovel'] == 'Chácara')){
                    if($campo['areatotal'] == ''){                      
                       $imovelvalido = 'nao';
                       $imovel_invalido_moving .= 'Área Total'.'%';
                    }
                }else{
                    if($campo['areautil'] == ''){                      
                       $imovelvalido = 'nao';
                       $imovel_invalido_moving .= 'Área Útil'.'%';
                    }
                }
            }                     
                        
            if($campo['status'] != '0'){
                $imovelvalido = 'nao';
                $imovel_invalido_moving .= 'Status do Imóvel: Arquivado'.'%';    
            }
                                                     
            if ($imovelvalido == 'sim') {
                $validar = '0';
/////////////////////////////////////////////////////////////////////////// VIVA REAL - INICIO
//Bloco 01
                if ($campo['dormitorio'] > 5) {
                    
                } else {
                    if (($campo['dormitorio'] == null) || ($campo['dormitorio'] == 0)) {
                        $campo['dormitorio'] = 0;
                    }
                }

                if ($campo['banheiro'] > 5) {
                    
                } else {
                    if (($campo['banheiro'] == null) || ($campo['banheiro'] == 0)) {
                        $campo['banheiro'] = 0;
                    }
                }

                if ($campo['suite'] > 5) {
                    
                } else {
                    if (($campo['suite'] == null) || ($campo['suite'] == 0)) {
                        $campo['suite'] = 0;
                    }
                }

                if ($campo['garagem'] > 5) {
                    
                } else {
                    if (($campo['garagem'] == null) || ($campo['garagem'] == 0)) {
                        $campo['garagem'] = 0;
                    }
                }

                if ($campo['cozinha'] > 0) {
                    $campo['cozinha'] = 'Sim';
                } else {
                    $campo['cozinha'] = 'Não';
                }

                if ($campo['garagem'] == null) {
                    $campo['garagem'] = '0';
                }
                if ($campo['dormitorio'] == null) {
                    $campo['dormitorio'] = '0';
                }
                if ($campo['banheiro'] == null) {
                    $campo['banheiro'] = '0';
                }
                if ($campo['suite'] == null) {
                    $campo['suite'] = '0';
                }
                if ($campo['areautil'] == null) {
                    $campo['areautil'] = '0';
                }
                if ($campo['areatotal'] == null) {
                    $campo['areatotal'] = '0';
                }
//FIM Bloco 01
                
//Bloco 02
                if ($campo['negocio'] == 'Locação') {
                    $campo['negocio'] = 'Aluguel';
                }
                $imovel = $dom->createElement("Listing");
                $Listings->appendChild($imovel);

                $CodigoImovel = $dom->createElement("ListingID");
                $imovel->appendChild($CodigoImovel);
                $codigoValue = $dom->createTextNode($campo['cod_referencia']);
                $CodigoImovel->appendChild($codigoValue);
//FIM Bloco 02
//Bloco 03
                if (($campo['tipo'] == 'Rural') || ($campo['tipo'] == 'Comercial')) {
                    $tiponegocio = $campo['subtipoimovel'];
                } else {
                    $tiponegocio = $campo['tipo'];
                }

//FIM Bloco 03
//Bloco 04
                $Title = $dom->createElement("Title");
                $imovel->appendChild($Title);
                $TitleValue = $dom->createTextNode($tiponegocio . ' para ' . $campo['negocio'] . ' em ' . $campo['cep_cidade'] . '/' . $campo['cep_estado']);
                $Title->appendChild($TitleValue);

                $tiponegocio = 'Sale';
                if ($campo['negocio'] == 'Lançamento') {
                    $tiponegocio = 'Sale';
                }
                if ($campo['negocio'] == 'Temporada') {
                    $tiponegocio = 'Rent';
                }
                if ($campo['negocio'] == 'Aluguel') {
                    $tiponegocio = 'Rent';
                }
//FIM Bloco 04
//Bloco 05 (Feature deve pegar a codição de true para destaque e false para nao destaque / e o campo update a data da atualizacao do imovel)
                $Category = $dom->createElement("TransactionType");
                $imovel->appendChild($Category);
                $CategoryValue = $dom->createTextNode($tiponegocio);
                $Category->appendChild($CategoryValue);
                                
                $portal_info = $this->acaoglobal(array('integracoes', 'id'), 'get', 11);
                $portal_info_imoveis = $portal_info['imoveis'];
                $portal_info_imoveis_tipo = $portal_info['imoveis_tipo'];

                $list_info_imoveis = explode('-', $portal_info_imoveis);
                $list_info_imoveis_tipo = explode('-', $portal_info_imoveis_tipo);
                $cont_info_imovel = 0;
                foreach ($list_info_imoveis as $info_imovel) {
                    if (($list_info_imoveis[$cont_info_imovel] == $campo['id_imovel'])) {
                       if($list_info_imoveis_tipo[$cont_info_imovel] == 'Básico'){
                            $info = 'false';
                       }else{
                           $info = 'true';
                       }                     
                    }

                    if ($info_imovel != '') {
                        $cont_info_imovel++;
                    }
                }
                
                $Category = $dom->createElement("Featured");
                $imovel->appendChild($Category);
                $CategoryValue = $dom->createTextNode($info);
                $Category->appendChild($CategoryValue);
                
                $Category = $dom->createElement("LastUpdateDate");
                $imovel->appendChild($Category);
                $CategoryValue = $dom->createTextNode($campo['updateimob']);
                $Category->appendChild($CategoryValue);
                
//FIM Bloco 05
//Bloco 06 (Precisa passar o caminho completo do vídeo no Youtube fiz uma gambiarra mas é preciso corrigir)

                $fotoss = unserialize($campo['fotos']);
                $pictures = $dom->createElement("Media");
                $imovel->appendChild($pictures);
                
                if ($campo['video'] != '') {
                    $video = $dom->createElement("Item");
                    $pictures->appendChild($video);

                    $attrimagem = $dom->createAttribute("medium");
                    $video->appendChild($attrimagem);
                    $attrimagemValue = $dom->createTextNode("video");
                    $attrimagem->appendChild($attrimagemValue);

                    $videoValue = $dom->createTextNode($campo['video']);
                    $video->appendChild($videoValue);
                }
//FIM Bloco 06
//Bloco 07 (Verificar o caminha das imagens com https com os portais)
                if ($fotoss[0] != '') {
                    $contfotos = 0;
                    foreach ($fotoss as $imagem) {
                        if ($contfotos < 15) {
                            $imageURL = $dom->createElement("Item");
                            $pictures->appendChild($imageURL);

                            $attrimagem = $dom->createAttribute("medium");
                            $imageURL->appendChild($attrimagem);
                            $attrimagemValue = $dom->createTextNode("image");
                            $attrimagem->appendChild($attrimagemValue);

                            $attrimagem = $dom->createAttribute("caption");
                            $imageURL->appendChild($attrimagem);
                            $attrimagemValue = $dom->createTextNode($imagem);
                            $attrimagem->appendChild($attrimagemValue);

                            if ($campo['icone'] == $imagem) {
                                $attrimagem = $dom->createAttribute("primary");
                                $imageURL->appendChild($attrimagem);
                                $attrimagemValue = $dom->createTextNode("true");
                                $attrimagem->appendChild($attrimagemValue);
                            }

                            $imageURLValue = $dom->createTextNode(HOME_URI . 'subdominios/' . $_SESSION['userdata']['contratante'] . '/fotos/' . $campo['id_imovel'] . '/' . $imagem);
                            $imageURL->appendChild($imageURLValue);
                            $contfotos++;
                        }
                    }
                } else {
                    $imageURL = $dom->createElement("Item");
                    $pictures->appendChild($imageURL);

                    $attrimagem = $dom->createAttribute("medium");
                    $imageURL->appendChild($attrimagem);
                    $attrimagemValue = $dom->createTextNode("image");
                    $attrimagem->appendChild($attrimagemValue);

                    $imageURLValue = $dom->createTextNode(HOME_URI . 'views/_images/semfoto_800x600.jpg');
                    $imageURL->appendChild($imageURLValue);
                }
//FIM Bloco 07
//Bloco 08
                $Details = $dom->createElement("Details");
                $imovel->appendChild($Details);

                $tipoimovel = 'Residential / Home ';
                if ($campo['tipo'] == 'Apartamento') {
                    $tipoimovel = 'Residential / Apartment ';
                }
                if ($campo['tipo'] == 'Casa') {
                    $tipoimovel = 'Residential / Home ';
                }
                if ($campo['subtipoimovel'] == 'Chácara') {
                    $tipoimovel = 'Residential / Farm Ranch ';
                }
                if (($campo['tipo'] == 'Casa') && ($campo['subtipoimovel'] == 'Em condomínio')) {
                    $tipoimovel = 'Residential / Condo ';
                }
                if (($campo['tipo'] == 'Apartamento') && ($campo['subtipoimovel'] == 'Flat')) {
                    $tipoimovel = 'Residential / Flat ';
                }
                if ($campo['tipo'] == 'Terreno') {
                    $tipoimovel = 'Residential / Land Lot ';
                }
                if (($campo['tipo'] == 'Apartamento') && ($campo['subtipoimovel'] == 'Cobertura')) {
                    $tipoimovel = 'Residential / Penthouse ';
                }
                if (($campo['tipo'] == 'Apartamento') && ($campo['subtipoimovel'] == 'Kitnete')) {
                    $tipoimovel = 'Residential / Kitnet ';
                }
                if (($campo['tipo'] == 'Comercial') && ($campo['subtipoimovel'] == 'Consultório')) {
                    $tipoimovel = 'Commercial / Consultorio ';
                }
                if (($campo['tipo'] == 'Comercial') && ($campo['subtipoimovel'] == 'Sala')) {
                    $tipoimovel = 'Commercial / Office ';
                }
                if (($campo['subtipoimovel'] == 'Fazenda') || ($campo['subtipoimovel'] == 'Sítio')) {
                    $tipoimovel = 'Commercial / Agricultural ';
                }
                if (($campo['subtipoimovel'] == 'Galpão') || ($campo['subtipoimovel'] == 'Depósito') || ($campo['subtipoimovel'] == 'Armazém')) {
                    $tipoimovel = 'Commercial / Industrial ';
                }
                if ($campo['tipo'] == 'Comercial'){
                    if(($campo['subtipoimovel'] == 'Indústria') || ($campo['subtipoimovel'] == 'Hotel') || ($campo['subtipoimovel'] == 'Motel') || ($campo['subtipoimovel'] == 'Pousada')) {
                            $tipoimovel = 'Commercial / Building ';
                    }                    
                }
                if ($campo['tipo'] == 'Comercial'){
                      if(($campo['subtipoimovel'] == 'Loja') || ($campo['subtipoimovel'] == 'Loja de shopping')) {
                            $tipoimovel = 'Commercial / Loja ';
                    }
                }
                if (($campo['tipo'] == 'Terreno') && ($campo['subtipoimovel'] == 'Comercial')) {
                    $tipoimovel = 'Commercial / Land Lot ';
                }
                if (($campo['tipo'] == 'Comercial') && ($campo['subtipoimovel'] == 'Negócio')) {
                    $tipoimovel = 'Commercial / Business ';
                }
                if (($campo['tipo'] == 'Comercial') && ($campo['subtipoimovel'] == 'Prédio Inteiro')) {
                    $tipoimovel = 'Commercial / Residential Income ';
                }

                $PropertyType = $dom->createElement("PropertyType");
                $Details->appendChild($PropertyType);
                $PropertyTypeValue = $dom->createTextNode($tipoimovel);
                $PropertyType->appendChild($PropertyTypeValue);
                /*
                  $PropertyType = $dom->createElement("Description");
                  $Details->appendChild($PropertyType);
                  $PropertyTypeValue = $dom->createTextNode($campo['descricaodoimovel']);
                  $PropertyType->appendChild($PropertyTypeValue);
                 */
//FIM Bloco 08
//Bloco 09 (PROBLEMA)
               
                

//FIM Bloco 09
//Bloco 10
                $Category = $dom->createElement("Description");
                $Details->appendChild($Category);
//                if ($campo['descricaodoimovel'] == '') {
//                    $descricaofinal = $campo['descricaodoimovel'] . ' - O imóvel possui: ' . $adddetalhes . ' - O imóvel é próximo de: ' . $addproximidades;
//                    $CategoryValue = $dom->createCDATASection($descricaofinal);
//                } else {
                    $CategoryValue = $dom->createCDATASection($campo['descricaodoimovel']);
//                }
                $Category->appendChild($CategoryValue);
//FIM Bloco 10
//Bloco 11
                if ($tiponegocio == 'Sale') {
                    $PropertyType = $dom->createElement("ListPrice");
                    $Details->appendChild($PropertyType);
                    $attrimagem = $dom->createAttribute("currency");
                    $PropertyType->appendChild($attrimagem);
                    $attrimagemValue = $dom->createTextNode('BRL');
                    $attrimagem->appendChild($attrimagemValue);
                    $PropertyTypeValue = $dom->createTextNode((int) $campo['valor']);
                    $PropertyType->appendChild($PropertyTypeValue);
                } else {
                    $PropertyType = $dom->createElement("RentalPrice");
                    $Details->appendChild($PropertyType);
                    $attrimagem = $dom->createAttribute("currency");
                    $PropertyType->appendChild($attrimagem);
                    $attrimagemValue = $dom->createTextNode('BRL');
                    $attrimagem->appendChild($attrimagemValue);
                    $attrimagem = $dom->createAttribute("period");
                    $PropertyType->appendChild($attrimagem);
                    
                    if($campo['negocio'] == 'Temporada'){
                    if($campo['ciclo'] == 'Diária'){
                        $ciclo = 'Daily';
                    }elseif($campo['ciclo'] == 'Mensal') {
                        $ciclo = 'Monthly';
                    }  
                    }else{
                        $ciclo = 'Monthly';
                    }
                    $attrimagemValue = $dom->createTextNode($ciclo);
                    $attrimagem->appendChild($attrimagemValue);
                    $PropertyTypeValue = $dom->createTextNode((int) $campo['valor']);
                    $PropertyType->appendChild($PropertyTypeValue);
                }
                if ($campo['valor_condominio'] != "") {
                    $PropertyAdministrationFee = $dom->createElement("PropertyAdministrationFee");
                    $Details->appendChild($PropertyAdministrationFee);
                    $attrimagem = $dom->createAttribute("currency");
                    $PropertyAdministrationFee->appendChild($attrimagem);
                    $attrimagemValue = $dom->createTextNode('BRL');
                    $attrimagem->appendChild($attrimagemValue);
                    $PropertyAdministrationFeeValue = $dom->createTextNode($campo['valor_condominio']);
                    $PropertyAdministrationFee->appendChild($PropertyAdministrationFeeValue);
                }
                if ($campo['valor_iptu'] != "") {
                    $YearlyTax = $dom->createElement("YearlyTax");
                    $Details->appendChild($YearlyTax);
                    $attrimagem = $dom->createAttribute("currency");
                    $YearlyTax->appendChild($attrimagem);
                    $attrimagemValue = $dom->createTextNode('BRL');
                    $attrimagem->appendChild($attrimagemValue);
                    $YearlyTaxValue = $dom->createTextNode($campo['valor_iptu']);
                    $YearlyTax->appendChild($YearlyTaxValue);
                }
//FIM Bloco 11
//Bloco 12
                if (($campo['tipo'] == 'Terreno') || (($campo['subtipoimovel'] == 'Galpão') || ($campo['subtipoimovel'] == 'Depósito') || ($campo['subtipoimovel'] == 'Armazém') || ($campo['subtipoimovel'] == 'Fazenda') || ($campo['subtipoimovel'] == 'Sítio') || ($campo['subtipoimovel'] == 'Chácara'))) {
                    $LotArea = $dom->createElement("LotArea");
                    $Details->appendChild($LotArea);
                    $attrimagem = $dom->createAttribute("unit");
                    $LotArea->appendChild($attrimagem);
                    $attrimagemValue = $dom->createTextNode('square metres');
                    $attrimagem->appendChild($attrimagemValue);
                    $LotAreaValue = $dom->createTextNode((int) $campo['areatotal']);
                    $LotArea->appendChild($LotAreaValue);
                } else {
                    $LivingArea = $dom->createElement("LivingArea");
                    $Details->appendChild($LivingArea);
                    $attrimagem = $dom->createAttribute("unit");
                    $LivingArea->appendChild($attrimagem);
                    $attrimagemValue = $dom->createTextNode('square metres');
                    $attrimagem->appendChild($attrimagemValue);
                    $LivingAreaValue = $dom->createTextNode((int) $campo['areautil']);
                    $LivingArea->appendChild($LivingAreaValue);
                }
//FIM Bloco 12
//Bloco 13
                $Bedrooms = $dom->createElement("Bedrooms");
                $Details->appendChild($Bedrooms);
                $BedroomsValue = $dom->createTextNode($campo['dormitorio']);
                $Bedrooms->appendChild($BedroomsValue);

                $Bathrooms = $dom->createElement("Bathrooms");
                $Details->appendChild($Bathrooms);
                $BathroomsValue = $dom->createTextNode($campo['banheiro']);
                $Bathrooms->appendChild($BathroomsValue);
                
                if ($campo['suite'] != '0') {
                $Suites = $dom->createElement("Suites");
                $Details->appendChild($Suites);
                $SuitesValue = $dom->createTextNode($campo['suite']);
                $Suites->appendChild($SuitesValue);
                }
                
                if ($campo['garagem'] != '0') {
                $Garage = $dom->createElement("Garage");
                $Details->appendChild($Garage);
                $attrimagem = $dom->createAttribute("type");
                $Garage->appendChild($attrimagem);
                $attrimagemValue = $dom->createTextNode('Parking Space');
                $attrimagem->appendChild($attrimagemValue);
                $GarageValue = $dom->createTextNode($campo['garagem']);
                $Garage->appendChild($GarageValue);
                }
//FIM Bloco 13
//BLOCO 14 
                $ContactIinfo = $dom->createElement("ContactIinfo");
                $imovel->appendChild($ContactIinfo);

                $Email = $dom->createElement("Email");
                $ContactIinfo->appendChild($Email);
                $EmailValue = $dom->createTextNode($emailsistema);
                $Email->appendChild($EmailValue);

                $Name = $dom->createElement("Name");
                $ContactIinfo->appendChild($Name);
                $NameValue = $dom->createTextNode($contactsistema);
                $Name->appendChild($NameValue);
                
                $Fone = $dom->createElement("Telephone");
                $ContactIinfo->appendChild($Fone);
                $FoneValue = $dom->createTextNode($sis_fone1);
                $Fone->appendChild($FoneValue);
//FIM BLOCO 14
//BLOCO 15 
                $Location = $dom->createElement("Location");
                $imovel->appendChild($Location);

                $ooo = $dom->createAttribute("displayAddress");
                $Location->appendChild($ooo);
                if ($campo['ocultarend'] == 2) {
                    $o3 = $dom->createTextNode("Neighborhood");
                } else {
                    $o3 = $dom->createTextNode("All");
                }
                $ooo->appendChild($o3);

                $Country = $dom->createElement("Country");
                $Location->appendChild($Country);

                $SiglaPais = $dom->createAttribute("abbreviation");
                $Country->appendChild($SiglaPais);
                $SiglaPaisVal = $dom->createTextNode("BR");
                $SiglaPais->appendChild($SiglaPaisVal);

                $CountryValue = $dom->createTextNode($campo['cep_pais']);
                $Country->appendChild($CountryValue);

                $State = $dom->createElement("State");
                $Location->appendChild($State);

                $SiglaEstado = $dom->createAttribute("abbreviation");
                $State->appendChild($SiglaEstado);
                $SiglaEstadoVal = $dom->createTextNode($campo['cep_estado']);
                $SiglaEstado->appendChild($SiglaEstadoVal);
                $estadonome = $campo['cep_estado'];
                if ($campo['cep_estado'] == 'AC') {
                    $estadonome = 'Acre';
                }
                if ($campo['cep_estado'] == 'AL') {
                    $estadonome = 'Alagoas';
                }
                if ($campo['cep_estado'] == 'AP') {
                    $estadonome = 'Amapá';
                }
                if ($campo['cep_estado'] == 'AM') {
                    $estadonome = 'Amazonas';
                }
                if ($campo['cep_estado'] == 'BA') {
                    $estadonome = 'Bahia';
                }
                if ($campo['cep_estado'] == 'CE') {
                    $estadonome = 'Ceará';
                }
                if ($campo['cep_estado'] == 'DF') {
                    $estadonome = 'Distrito Federal';
                }
                if ($campo['cep_estado'] == 'ES') {
                    $estadonome = 'Espírito Santo';
                }
                if ($campo['cep_estado'] == 'GO') {
                    $estadonome = 'Goiás';
                }
                if ($campo['cep_estado'] == 'MA') {
                    $estadonome = 'Maranhão';
                }
                if ($campo['cep_estado'] == 'MT') {
                    $estadonome = 'Mato Grosso';
                }
                if ($campo['cep_estado'] == 'MS') {
                    $estadonome = 'Mato Grosso do Sul';
                }
                if ($campo['cep_estado'] == 'MG') {
                    $estadonome = 'Minas Gerais';
                }
                if ($campo['cep_estado'] == 'PA') {
                    $estadonome = 'Pará';
                }
                if ($campo['cep_estado'] == 'PB') {
                    $estadonome = 'Paraíba';
                }
                if ($campo['cep_estado'] == 'PR') {
                    $estadonome = 'Paraná';
                }
                if ($campo['cep_estado'] == 'PE') {
                    $estadonome = 'Pernambuco';
                }
                if ($campo['cep_estado'] == 'PI') {
                    $estadonome = 'Piauí';
                }
                if ($campo['cep_estado'] == 'RJ') {
                    $estadonome = 'Rio de Janeiro';
                }
                if ($campo['cep_estado'] == 'RN') {
                    $estadonome = 'Rio Grande do Norte';
                }
                if ($campo['cep_estado'] == 'RS') {
                    $estadonome = 'Rio Grande do Sul';
                }
                if ($campo['cep_estado'] == 'RO') {
                    $estadonome = 'Rondônia';
                }
                if ($campo['cep_estado'] == 'RR') {
                    $estadonome = 'Roraima';
                }
                if ($campo['cep_estado'] == 'SC') {
                    $estadonome = 'Santa Catarina';
                }
                if ($campo['cep_estado'] == 'SP') {
                    $estadonome = 'São Paulo';
                }
                if ($campo['cep_estado'] == 'SE') {
                    $estadonome = 'Sergipe';
                }
                if ($campo['cep_estado'] == 'TO') {
                    $estadonome = 'Tocantins';
                }

                $StateValue = $dom->createTextNode($estadonome);
                $State->appendChild($StateValue);

                $City = $dom->createElement("City");
                $Location->appendChild($City);
                $CityValue = $dom->createTextNode($campo['cep_cidade']);
                $City->appendChild($CityValue);

                $Neighborhood = $dom->createElement("Neighborhood");
                $Location->appendChild($Neighborhood);
                $NeighborhoodValue = $dom->createTextNode($campo['cep_bairro']);
                $Neighborhood->appendChild($NeighborhoodValue);
                
                if ($campo['cep_logradouro'] != '') {
                    $Neighborhood = $dom->createElement("Address");
                    $Location->appendChild($Neighborhood);
                    $NeighborhoodValue = $dom->createTextNode($campo['cep_logradouro']);
                    $Neighborhood->appendChild($NeighborhoodValue);
                }
                if ($campo['cep_numero'] != "") {
                    $Neighborhood = $dom->createElement("StreetNumber");
                    $Location->appendChild($Neighborhood);
                    $NeighborhoodValue = $dom->createTextNode($campo['cep_numero']);
                    $Neighborhood->appendChild($NeighborhoodValue);
                }
                if ($campo['cep'] != "") {
                    $PostalCode = $dom->createElement("PostalCode");
                    $Location->appendChild($PostalCode);
                    $PostalCodeValue = $dom->createTextNode($campo['cep']);
                    $PostalCode->appendChild($PostalCodeValue);
                }
                $Latitude = $dom->createElement("Latitude");
                $Location->appendChild($Latitude);
                $latitudeCodeValue = $dom->createTextNode($campo['latitude']);
                $Latitude->appendChild($latitudeCodeValue);
                
                $Longitude = $dom->createElement("Longitude");
                $Location->appendChild($Longitude);
                $LongitudeCodeValue = $dom->createTextNode($campo['longitude']);
                $Longitude->appendChild($LongitudeCodeValue);
                
//FIM BLOCO 15
//BLOCO 16 (Estudar essa parte)
                //if(($campo['andar']!=null)||($campo['valor_condominio']!=null)||($campo['valor_iptu']!=null)||($campo['dormitorio']!=null)||($campo['suite']!=null)||($campo['garagem']!=null)||($campo['areautil']!=null)||($campo['areatotal']!=null)){
//FIM BLOCO 16
//BLOCO 17
//                $attribute = $dom->createElement("Features");
//                $imovel->appendChild($attribute);
                
                $detalhess = $dom->createElement("Features");
                $imovel->appendChild($detalhess);

                //if ($campo['detalhes'] != null) {
                $caracteristicas = unserialize($campo['caracteristicas']);
                if($caracteristicas[0] != ''){
                foreach ($caracteristicas as $detalhe) {
                    //$buscaDetalhe = $this->acaoglobal(array('detalhes', 'id'), 'get', $detalhee);
                    //$detalhe = $buscaDetalhe['nome'];
                        
                            if ($detalhe == '474'){
                                $detalhe  = 'Coffee Shop';
                            }if($detalhe == '473'){
                                $detalhe  = 'Closet';
                            }if($detalhe == '472'){
                                $detalhe  = 'Cinema';
                            }if($detalhe == '471'){
                                $detalhe  = 'Churrasqueira';
                            }if($detalhe == '470'){
                                $detalhe  = 'Children Care';
                            }if($detalhe == '469'){
                                $detalhe  = 'Cerca';
                            }if($detalhe == '468'){
                                $detalhe  = 'Centro de estética';
                            }if($detalhe == '467'){
                                $detalhe  = 'Central telefônica';
                            }if($detalhe == '466'){
                                $detalhe  = 'Caseiro';
                            }if($detalhe == '465'){
                                $detalhe  = 'Casa de Fundo';
                            }if($detalhe == '464'){
                                $detalhe  = 'Casa de Caseiro';
                            }if($detalhe == '463'){
                                $detalhe  = 'Casa de Boneca';
                            }if($detalhe == '462'){
                                $detalhe  = 'Carpete';
                            }if($detalhe == '461'){
                                $detalhe  = 'Car Wash';
                            }if($detalhe == '460'){
                                $detalhe  = 'Campo de Golfe';
                            }if($detalhe == '459'){
                                $detalhe  = 'Campo de futebol';
                            }if($detalhe == '458'){
                                $detalhe  = 'Cameras de segurança';
                            }if($detalhe == '457'){
                                $detalhe  = 'Canil';
                            }if($detalhe == '456'){
                                $detalhe  = 'Business Center';
                            }if($detalhe == '455'){
                                $detalhe  = 'Bosque';
                            }if($detalhe == '454'){
                                $detalhe  = 'Brinquedoteca';
                            }if($detalhe == '453'){
                                $detalhe  = 'Bicicletário';
                            }if($detalhe == '452'){
                                $detalhe  = 'Bar';
                            }if($detalhe == '451'){
                                $detalhe  = 'Armário Embutido';
                            }if($detalhe == '450'){
                                $detalhe  = 'Armário Cozinha';
                            }if($detalhe == '449'){
                                $detalhe  = 'Área de serviço';
                            }if($detalhe == '448'){
                                $detalhe  = 'Ar Condicionado';
                            }if($detalhe == '447'){
                                $detalhe  = 'Água';
                            }if($detalhe == '446'){
                                $detalhe  = 'Aquecimento Central';
                            }if($detalhe == '445'){
                                $detalhe  = 'Aquecedor';
                            }if($detalhe == '444'){
                                $detalhe  = 'Acesso para deficientes';
                            }if($detalhe == '443'){
                                $detalhe  = 'Acesso 24 Horas';
                            }if($detalhe == '442'){
                                $detalhe  = 'Academia';
                            }if($detalhe == '484'){
                                $detalhe  = 'Entrada de Caminhões';
                            }if($detalhe == '483'){
                                $detalhe  = 'Elevador';
                            }if($detalhe == '482'){
                                $detalhe  = 'Edícula';
                            }if($detalhe == '481'){
                                $detalhe  = 'Despensa';
                            }if($detalhe == '480'){
                                $detalhe  = 'Dependência de empregados';
                            }if($detalhe == '479'){
                                $detalhe  = 'Curral';
                            }if($detalhe == '478'){
                                $detalhe  = 'Cozinha Gourmet';
                            }if($detalhe == '477'){
                                $detalhe  = 'Cozinha americana';
                            }if($detalhe == '476'){
                                $detalhe  = 'Copa';
                            }if($detalhe == '475'){
                                $detalhe  = 'Convenções';
                            }if($detalhe == '485'){
                                $detalhe  = 'Entrada lateral';
                            }if($detalhe == '486'){
                                $detalhe  = 'Escritório';
                            }if($detalhe == '487'){
                                $detalhe  = 'Escritório Virtual';
                            }if($detalhe == '488'){
                                $detalhe  = 'Esgoto';
                            }if($detalhe == '489'){
                                $detalhe  = 'Espaço Gourmet';
                            }if($detalhe == '490'){
                                $detalhe  = 'Espaço zen';
                            }if($detalhe == '491'){
                                $detalhe  = 'Esquina';
                            }if($detalhe == '492'){
                                $detalhe  = 'Estacionamento para visitantes';
                            }if($detalhe == '493'){
                                $detalhe  = 'Estacionamento Rotativo';
                            }if($detalhe == '494'){
                                $detalhe  = 'Estacionamento Visitantes';
                            }if($detalhe== '495'){
                                $detalhe  = 'Estrada Asfaltada';
                            }if($detalhe == '496'){
                                $detalhe  = 'Fitness';
                            }if($detalhe == '497'){
                                $detalhe  = 'Forno de pizza';
                            }if($detalhe == '498'){
                                $detalhe  = 'Frente para o Mar';
                            }if($detalhe == '499'){
                                $detalhe  = 'Fogão elétrico';
                            }if($detalhe == '500'){
                                $detalhe  = 'Galpão';
                            }if($detalhe == '501'){
                                $detalhe  = 'Garagem para Barcos';
                            }if($detalhe == '502'){
                                $detalhe  = 'Gerador';
                            }if($detalhe == '503'){
                                $detalhe  = 'Geminada';
                            }if($detalhe == '504'){
                                $detalhe  = 'Guarita';
                            }if($detalhe == '505'){
                                $detalhe  = 'Heliponto';
                            }if($detalhe == '506'){
                                $detalhe  = 'Hidromassagem';
                            }if($detalhe == '507'){
                                $detalhe  = 'Infra-estrutura Internet';
                            }if($detalhe == '508'){
                                $detalhe  = 'Interfone';
                            }if($detalhe == '509'){
                                $detalhe  = 'Jardim';
                            }if($detalhe == '510'){
                                $detalhe  = 'Lago';
                            }if($detalhe == '511'){
                                $detalhe  = 'Lan House';
                            }if($detalhe == '512'){
                                $detalhe  = 'Lareira';
                            }if($detalhe == '513'){
                                $detalhe  = 'Lavabo';
                            }if($detalhe == '514'){
                                $detalhe  = 'Lavanderia';
                            }if($detalhe == '515'){
                                $detalhe  = 'Lavoura';
                            }if($detalhe == '516'){
                                $detalhe  = 'Luminárias';
                            }if($detalhe == '517'){
                                $detalhe  = 'Luz';
                            }if($detalhe == '518'){
                                $detalhe  = 'Marina';
                            }if($detalhe == '519'){
                                $detalhe  = 'Mezanino';
                            }if($detalhe == '520'){
                                $detalhe  = 'Mobiliado';
                            }if($detalhe == '521'){
                                $detalhe  = 'Paiol';
                            }if($detalhe == '522'){
                                $detalhe  = 'Pasto';
                            }if($detalhe == '523'){
                                $detalhe  = 'Pátio Estacionamento';
                            }if($detalhe == '524'){
                                $detalhe  = 'Permite Animais';
                            }if($detalhe == '525'){
                                $detalhe  = 'Pet Care';
                            }if($detalhe == '526'){
                                $detalhe  = 'Píer';
                            }if($detalhe == '527'){
                                $detalhe  = 'Piscina';
                            }if($detalhe == '528'){
                                $detalhe  = 'Piscina aquecida';
                            }if($detalhe == '529'){
                                $detalhe  = 'Pscina Climatizada';
                            }if($detalhe == '530'){
                                $detalhe  = 'Piscina Coberta';
                            }if($detalhe == '531'){
                                $detalhe  = 'Piscina Infantil';
                            }if($detalhe == '532'){
                                $detalhe  = 'Piso Elevado';
                            }if($detalhe == '533'){
                                $detalhe  = 'Pista de cooper';
                            }if($detalhe == '534'){
                                $detalhe  = 'Pista de Pouso';
                            }if($detalhe == '535'){
                                $detalhe  = 'Pista de Skate';
                            }if($detalhe == '536'){
                                $detalhe  = 'Playground';
                            }if($detalhe == '537'){
                                $detalhe  = 'Poço Artesiano';
                            }if($detalhe == '538'){
                                $detalhe  = 'Pomar';
                            }if($detalhe == '539'){
                                $detalhe  = 'Ponte Rolante';
                            }if($detalhe == '540'){
                                $detalhe  = 'Portão Eletrônico';
                            }if($detalhe == '541'){
                                $detalhe  = 'Portaria 24 horas';
                            }if($detalhe == '542'){
                                $detalhe  = 'Porteira Fechada';
                            }if($detalhe == '543'){
                                $detalhe  = 'Quadra de futebol de salão';
                            }if($detalhe == '544'){
                                $detalhe  = 'Quadra Poliesportiva';
                            }if($detalhe == '545'){
                                $detalhe  = 'Quadra de Squash';
                            }if($detalhe == '546'){
                                $detalhe  = 'Quadra de Tênis';
                            }if($detalhe == '547'){
                                $detalhe  = 'Quarto da Empregada';
                            }if($detalhe == '548'){
                                $detalhe  = 'Quintal';
                            }if($detalhe == '549'){
                                $detalhe  = 'Redario';
                            }if($detalhe == '550'){
                                $detalhe  = 'Rede de Telefone';
                            }if($detalhe == '551'){
                                $detalhe  = 'Refeitório';
                            }if($detalhe == '552'){
                                $detalhe  = 'Reservatório de Água';
                            }if($detalhe == '553'){
                                $detalhe  = 'Restaurante';
                            }if($detalhe == '554'){
                                $detalhe  = 'Rio';
                            }if($detalhe == '555'){
                                $detalhe  = 'Ronda/Vigilância';
                            }if($detalhe == '556'){
                                $detalhe  = 'Rua Asfaltada';
                            }if($detalhe == '557'){
                                $detalhe  = 'Sala de Almoço';
                            }if($detalhe == '558'){
                                $detalhe  = 'Sala de Ginástica';
                            }if($detalhe == '559'){
                                $detalhe  = 'Sala de Jantar';
                            }if($detalhe == '560'){
                                $detalhe  = 'Sala íntima';
                            }if($detalhe == '561'){
                                $detalhe  = 'Salão de convenções';
                            }if($detalhe == '562'){
                                $detalhe  = 'Salão de Festas';
                            }if($detalhe == '563'){
                                $detalhe  = 'Salão de Jogos';
                            }if($detalhe == '564'){
                                $detalhe  = 'Salão de Vídeo/Cinema';
                            }if($detalhe == '565'){
                                $detalhe  = 'Sauna';
                            }if($detalhe == '566'){
                                $detalhe  = 'Sede';
                            }if($detalhe == '567'){
                                $detalhe  = 'Segurança Interna';
                            }if($detalhe == '568'){
                                $detalhe  = 'Segurança na Rua';
                            }if($detalhe == '569'){
                                $detalhe  = 'Segurança Patrimonial';
                            }if($detalhe == '570'){
                                $detalhe  = 'Semigeminada';
                            }if($detalhe == '571'){
                                $detalhe  = 'Silos';
                            }if($detalhe == '572'){
                                $detalhe  = 'Sistema de alarme';
                            }if($detalhe == '573'){
                                $detalhe  = 'Sistema de Incêndio';
                            }if($detalhe == '574'){
                                $detalhe  = 'Solariam';
                            }if($detalhe == '575'){
                                $detalhe  = 'Telefone';
                            }if($detalhe == '576'){
                                $detalhe  = 'Terraço';
                            }if($detalhe == '577'){
                                $detalhe  = 'TV';
                            }if($detalhe == '578'){
                                $detalhe  = 'TV a cabo';
                            }if($detalhe == '579'){
                                $detalhe  = 'Varanda';
                            }if($detalhe == '580'){
                                $detalhe  = 'Varanda Goumert';
                            }if($detalhe == '581'){
                                $detalhe  = 'Ventilador de Teto';
                            }if($detalhe == '582'){
                                $detalhe  = 'Vestiário';
                            }if($detalhe == '583'){
                                $detalhe  = 'Vigilância 24hs';
                            }if($detalhe == '584'){
                                $detalhe  = 'WC Empregada';
                            }
                        if (($detalhe == 'Churrasqueira') || ($detalhe == 'churrasqueira')) {    
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('BBQ');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }  
                        if (($detalhe == 'Aquecimento') || ($detalhe == 'aquecimento')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Heating');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Piscina') || ($detalhe == 'piscina')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Pool');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Quintal') || ($detalhe == 'quintal')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Backyard');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Alarme') || ($detalhe == 'alarme')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Alarm System');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'TV a Cabo') || ($detalhe == 'Tv a cabo') || ($detalhe == 'tv a cabo')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Cable Television');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Salão de Festas') || ($detalhe == 'Salão de festas') || ($detalhe == 'salão de festas')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Party Room');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Salão de Jogos') || ($detalhe == 'Salão de jogos') || ($detalhe == 'salão de jogos')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Game Room');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Sauna') || ($detalhe == 'sauna')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Sauna');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Segurança') || ($detalhe == 'segurança')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('24 Hour Security');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Spa') || ($detalhe == 'spa')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Spa');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Playground') || ($detalhe == 'playground')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Playground');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Quadra de Tenis') || ($detalhe == 'Quadra de tenis') || ($detalhe == 'quadra de tenis')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Tennis court');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Quadra Poliesportiva') || ($detalhe == 'Quadra poliesportiva') || ($detalhe == 'quadra poliesportiva')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Sports court');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Internet') || ($detalhe == 'internet')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Internet Connection');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Jardim') || ($detalhe == 'jardim')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Garden');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Lareira') || ($detalhe == 'lareira')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Fireplace');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Lavanderia') || ($detalhe == 'lavanderia')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Laundry');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Elevador') || ($detalhe == 'elevador')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Elevator');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Depósito') || ($detalhe == 'depósito')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Warehouse');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Ar Condicionado') || ($detalhe == 'ar condicionado') || ($detalhe == 'Ar condicionado')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Air Conditioning');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        if (($detalhe == 'Area de Serviço') || ($detalhe == 'Area de serviço') || ($detalhe == 'area de serviço')) {  
                            $detalhenome = $dom->createElement("Features");
                            $detalhess->appendChild($detalhenome);
                            $detalhenomeValue = $dom->createTextNode('Maid\'s Quarters');
                            $detalhenome->appendChild($detalhenomeValue);         
                        }
                        
                   
                } 
                }
//FIM BLOCO 17 (PROBLEMA)
/////////////////////////////////////////////////////////////////////////// VIVA REAL - FIM
            } 
               
        }else{
            if($campo['valor'] == ''){
                $imovel_invalido_moving .= 'Valor do Imóvel '.'%';
            }
            if($campo['cep_estado'] == null){
                $imovel_invalido_moving .= 'CEP'.'%';
            }
            if($campo['cep_cidade'] == null){
                $imovel_invalido_moving .= 'Cidade'.'%';
            }
            if($campo['cep_bairro'] == null){
                $imovel_invalido_moving .= 'Bairro'.'%';
            }            
            if($campo['descricaodoimovel'] == null){
                $imovel_invalido_moving .= 'Descrição do Imóvel'.'%';
            }
            if($campo['descricaodoimovel'] == '<br>'){
                $imovel_invalido_moving .= 'Descrição do Imóvel'.'%';
            }
            
            if($campo['negocio'] == 'Temporada'){
                if(($campo['ciclo'] != 'Diária') && ($campo['ciclo'] != 'Mensal')){
                    $imovel_invalido_moving .= 'Ciclo'.'%';
                }
            }
            if(($campo['tipo'] == 'Apartamento') || ($campo['tipo'] == 'Casa')){                               
                if($campo['areautil'] == ''){
                   $imovel_invalido_moving .= 'Área Útil'.'%';
                } 
                if($campo['tipo'] != 'Terreno'){
                    if (($campo['dormitorio'] == '0')){
                         $imovel_invalido_moving .= 'Dormitório'.'%';
                    }
                    if (($campo['banheiro'] == '0')){
                         $imovel_invalido_moving .= 'Banheiro'.'%';
                    }
                }
            }
            if($campo['tipo'] == 'Comercial'){                
                if (($campo['banheiro'] == '0')){
                    $imovel_invalido_moving .= 'Banheiro'.'%';
                }
                if(($campo['subtipoimovel'] == 'Galpão') || ($campo['subtipoimovel'] == 'Depósito') || ($campo['subtipoimovel'] == 'Armazém')){
                    if($campo['areatotal'] == ''){
                        $imovel_invalido_moving .= 'Área Total'.'%';
                    }
                }else{
                    if($campo['areautil'] == ''){ 
                        $imovel_invalido_moving .= 'Área Útil'.'%';
                    }
                }
            }
            if($campo['tipo'] == 'Rural'){
                if (($campo['banheiro'] == '0')){
                    $imovel_invalido_moving .= 'Banheiro'.'%';
                }
                if(($campo['subtipoimovel'] == 'Fazenda') || ($campo['subtipoimovel'] == 'Sítio') || ($campo['subtipoimovel'] == 'Chácara')){
                    if($campo['areatotal'] == ''){ 
                       $imovel_invalido_moving .= 'Área Total'.'%';
                    }
                }else{
                    if($campo['areautil'] == ''){ 
                       $imovel_invalido_moving .= 'Área Útil'.'%';
                    }
                }
            }
            if($campo['status'] != '0'){
                $imovel_invalido_moving .= 'Status do Imóvel: Arquivado'.'%';                
            } 
        }
        if(($validar == '1') || ($imovelvalido == 'nao')){
           $cod_referencia_pendente_moving .=   '-' .$campo['id_imovel'];
        }
    }
        if($imovel_invalido_moving != ''){ 
            $imovel_invalido_id_moving .= $campo['id_imovel'].'%'.$imovel_invalido_moving.'//';
        }
}

$get_integracoes = $this->acaoglobal(array('integracoes', 'id'), 'get', 11);    
    
//                $get_integracoes = explode('-', $get_integracoes['pendentes']);  
//                $get_integracoes = array_unique($get_integracoes);
//                
//                foreach ($get_integracoes as $get_integracoes) {
//                         $get_integra.= $get_integracoes;
//                          //$get_integra.= '-';
//                }

$this->acaoglobal(array('integracoes', 'id'), 'update', array(
                                                    'pendentes' => $cod_referencia_pendente_moving,
                                                    'pendencias' => $imovel_invalido_id_moving,
                                                    'id' => '11'
                                                        )
                                                );

$prod_dom_load = $banco->query('SELECT * FROM produtos WHERE id_cliente = "' . $_SESSION['userdata']['contratante'] . '" AND produto_servico < 6');
$prod_dom = $prod_dom_load->fetch(PDO::FETCH_ASSOC);

$prod_dom_info_load = $banco->query('SELECT * FROM produtos WHERE dominio = "' . $prod_dom['dominio'] . '" AND produto_servico = 8');
$prod_dom_info = $prod_dom_info_load->fetch(PDO::FETCH_ASSOC);

$serv_info_load = $banco->query('SELECT * FROM servidores WHERE id_servidores = 2');
$serv_info = $serv_info_load->fetch(PDO::FETCH_ASSOC);

$prod_info = unserialize($prod_dom_info['dados_cpanel']);
//final do imovel
// save tree to file
$dom->save(ABSPATH . "/subdominios/" . $_SESSION['userdata']['contratante'] . "/movingimoveis.xml");
// save tree to string
$order = $dom->save(ABSPATH . "/subdominios/" . $_SESSION['userdata']['contratante'] . "/movingimoveis.xml");


$file = ABSPATH . "/subdominios/" . $_SESSION['userdata']['contratante'] . "/movingimoveis.xml";

// set up basic connection
$conn_id = ftp_connect($serv_info['ip_server']);
$dir = 'public_html/integracoes';
$remote_file = $dir.'/movingimoveis.xml';
// login with username and password
$login_result = ftp_login($conn_id, $prod_info['user'], $prod_info['senha']);
// upload a file

if (@ftp_mkdir($conn_id, $dir)) {
    echo "successfully created $dir\n";
} else {
    echo "There was a problem while creating $dir\n";
}
    if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
        echo "successfully uploaded $file\n";
    } else {
        echo "There was a problem while uploading $file\n";
    }



// close the connection
unlink($file);
ftp_close($conn_id);

/*
  //final do imovel
  // save tree to file
  $dom->save(ABSPATH . "/subdominios/" . $_SESSION['userdata']['contratante'] . "/vivareal.xml");
  // save tree to string
  $order = $dom->save(ABSPATH . "/subdominios/" . $_SESSION['userdata']['contratante'] . "/vivareal.xml");
 */
?>

Youez - 2016 - github.com/yon3zu
LinuXploit