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//imovelweb_bkp050625.php
<?php

// Topo
$dom = new DOMDocument("1.0", "utf-8");
$root = $dom->createElement("Carga");
$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("xmlns:xsd");
$root->appendChild($ooo);
$o3 = $dom->createTextNode("http://www.w3.org/2001/XMLSchema");
$ooo->appendChild($o3);

/*
  $oo = $dom->createAttribute("xmlns:xsi");
  $root->appendChild($oo);

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

  $ooo = $dom->createAttribute("xmlns:xsd");
  $root->appendChild($ooo);
  $o3 = $dom->createTextNode("http://www.w3.org/2001/XMLSchema");
  $ooo->appendChild($o3);
 */

// fim do topo
// header
///// OBRIGATORIO - INICIO
$Configuracao = $dom->createElement("Configuracao");
$root->appendChild($Configuracao);

$Provider = $dom->createElement("RetornoViaWebservice");
$Configuracao->appendChild($Provider);
$titulositee = $dom->createTextNode('0');
$Provider->appendChild($titulositee);

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

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

foreach ($imoveisintegrados as $campo) {
    $imovel_invalido_imovelweb = '';
    if (@$infoimovel[$campo] != null) {

//echo $campo.'1';
// create child element
    $campo = $infoimovel[$campo];
    $imovelvalido = 'nao';    
    $validar = '1';
    if (($campo['valor'] != null) && ($campo['cep_cidade'] != null) && ($campo['cep_cidade'] != '') && ($campo['cep_bairro'] != '') && ($campo['cep_bairro'] != null) && ($campo['cep_logradouro'] != '') && ($campo['cep_logradouro'] != null) && ($campo['cep_estado'] != '') && ($campo['cep_estado'] != null) && ($campo['descricaodoimovel_imovelweb'] != null) && ($campo['descricaodoimovel_imovelweb'] != "<br>")
        && ($campo['areautil'] != '')) {
        $imovelvalido = 'sim';
        
        if(($campo['tipo'] != 'Terreno') && ($campo['tipo'] != 'Comercial') && ($campo['dormitorio'] == '0')){
            $imovelvalido = 'nao';
            $imovel_invalido_imovelweb .= 'Dormitório'.'%';
        }
        
        if ($campo['areautil_medida'] == 'M²'){
            $campo['areautil_medida'] = 'm2';
        }
        if ($campo['areatotal_medida'] == 'M²'){
            $campo['areatotal_medida'] = 'm2';
        }
        
        if (($campo['areautil_medida'] == 'AB') || ($campo['areautil_medida'] == 'AN') || ($campo['areautil_medida'] == 'AM') || ($campo['areautil_medida'] == 'AP') || ($campo['areautil_medida'] == 'Ac')){
            $campo['areautil_medida'] = 'alq';
        }
        
        if (($campo['areautil_medida'] != 'm2') && ($campo['areautil_medida'] != 'ha') && ($campo['areautil_medida'] != 'alq')) {
            $imovelvalido = 'nao';
            $imovel_invalido_imovelweb .= 'Área Útil: unidade de medida inválida'.'%';
        }
            
        if($campo['status'] != '0'){
            $imovelvalido = 'nao';
            $imovel_invalido_imovelweb .= 'Status do Imóvel: Arquivado'.'%';
        }    
        
        if ($imovelvalido == 'sim') {
                $validar = '0';
            /////
            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['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';
            }

            /////

            if ($campo['negocio'] == 'Locação') {
                $campo['negocio'] = 'Aluguel';
            }
            $imovel = $dom->createElement("Imovel");
            $Listings->appendChild($imovel);

            $pegarcodigo = $this->acaoglobal(array('integracoes', 'id'), 'get', 3);
            $iwdados = unserialize($pegarcodigo['dados']);

            $CodigoImovel = $dom->createElement("CodigoCentralVendas");
            $imovel->appendChild($CodigoImovel);
            $codigoValue = $dom->createTextNode($iwdados['codigocentral']);
            $CodigoImovel->appendChild($codigoValue);

            $CodigoImovel = $dom->createElement("CodigoImovel");
            $imovel->appendChild($CodigoImovel);
            $codigoValue = $dom->createTextNode($campo['cod_referencia']);
            $CodigoImovel->appendChild($codigoValue);

            $Category = $dom->createElement("TipoImovel");
            $imovel->appendChild($Category);
            $CategoryValue = $dom->createTextNode($campo['tipo']);
            $Category->appendChild($CategoryValue);

            ////////////////////////////////////////////////////////////// CATEGORIAS - INICIO
            $subtipo = '';
            $subtipocateg = '';
            if ($campo['tipo'] == 'Apartamento') {
                if ($campo['subtipoimovel'] == 'Padrão') {
                    $subtipo = 'Padrão';
                    $subtipocateg = 'Padrão';
                }
                if ($campo['subtipoimovel'] == 'Alto Padrão') {
                    $subtipo = 'Padrão';
                    $subtipocateg = 'Padrão';
                }
                if ($campo['subtipoimovel'] == 'Luxo') {
                    $subtipo = 'Padrão';
                    $subtipocateg = 'Padrão';
                }
                if ($campo['subtipoimovel'] == 'Kitnete') {
                    $subtipo = 'Kitchenette/Studio';
                    $subtipocateg = 'Padrão';
                }
                if ($campo['subtipoimovel'] == 'Cobertura') {
                    $subtipo = 'Padrão';
                    $subtipocateg = 'Cobertura';
                }
                if ($campo['subtipoimovel'] == 'Duplex') {
                    $subtipo = 'Padrão';
                    $subtipocateg = 'Duplex';
                }
                if ($campo['subtipoimovel'] == 'Triplex') {
                    $subtipo = 'Padrão';
                    $subtipocateg = 'Triplex';
                }
                if ($campo['subtipoimovel'] == 'Loft') {
                    $subtipo = 'Loft';
                    $subtipocateg = 'Padrão';
                }
                if ($campo['subtipoimovel'] == 'Loft Duplex') {
                    $subtipo = 'Loft';
                    $subtipocateg = 'Duplex';
                }
                if ($campo['subtipoimovel'] == 'Loft Triplex') {
                    $subtipo = 'Loft';
                    $subtipocateg = 'Triplex';
                }
                if ($campo['subtipoimovel'] == 'Sobreloja') {
                    $subtipo = 'Padrão';
                    $subtipocateg = 'Padrão';
                }
                if ($campo['subtipoimovel'] == 'Flat') {
                    $subtipo = 'Flat';
                    $subtipocateg = 'Padrão';
                }
                if ($campo['subtipoimovel'] == 'Village') {
                    $subtipo = 'Village';
                    $subtipocateg = '';
                }
            } elseif ($campo['tipo'] == 'Casa') {
                if ($campo['subtipoimovel'] == 'Padrão') {
                    $subtipo = 'Padrão';
                    $subtipocateg = 'Térrea';
                }
                if ($campo['subtipoimovel'] == 'Alvenaria') {
                    $subtipo = 'Padrão';
                    $subtipocateg = 'Térrea';
                }
                if ($campo['subtipoimovel'] == 'Madeira') {
                    $subtipo = 'Padrão';
                    $subtipocateg = 'Térrea';
                }
                if ($campo['subtipoimovel'] == 'Térreo') {
                    $subtipo = 'Padrão';
                    $subtipocateg = 'Térrea';
                }
                if ($campo['subtipoimovel'] == 'Em condomínio') {
                    $subtipo = 'Casa de Condomínio';
                    $subtipocateg = 'Térrea';
                }
                if ($campo['subtipoimovel'] == 'Em vila fechada') {
                    $subtipo = 'Casa de Vila';
                    $subtipocateg = 'Térrea';
                }
                if ($campo['subtipoimovel'] == 'Sobrado Padrão') {
                    $subtipo = 'Padrão';
                    $subtipocateg = 'Sobrado';
                }
                if ($campo['subtipoimovel'] == 'Sobrado em condomínio') {
                    $subtipo = 'Casa de Condomínio';
                    $subtipocateg = 'Sobrado';
                }
                if ($campo['subtipoimovel'] == 'Sobrado em vila fechada') {
                    $subtipo = 'Casa de Vila';
                    $subtipocateg = 'Sobrado';
                }
                if ($campo['subtipoimovel'] == 'Sobrado Duplex') {
                    $subtipo = 'Padrão';
                    $subtipocateg = 'Sobrado';
                }
                if ($campo['subtipoimovel'] == 'Sobrado Triplex') {
                    $subtipo = 'Padrão';
                    $subtipocateg = 'Sobrado';
                }
                if ($campo['subtipoimovel'] == 'Assobradada') {
                    $subtipo = 'Padrão';
                    $subtipocateg = 'Térrea';
                }
                if ($campo['subtipoimovel'] == 'Geminada') {
                    $subtipo = 'Padrão';
                    $subtipocateg = 'Térrea';
                }
                if ($campo['subtipoimovel'] == 'Village') {
                    $subtipo = 'Village';
                    $subtipocateg = '';
                }
            } elseif ($campo['tipo'] == 'Rural') {
                if ($campo['subtipoimovel'] == 'Chácara') {
                    $subtipo = 'Chácara';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Chácara em condomínio') {
                    $subtipo = 'Chácara';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Fazenda') {
                    $subtipo = 'Fazenda';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Sítio') {
                    $subtipo = 'Sítio';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Haras') {
                    $subtipo = 'Haras';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Comercial') {
                    $subtipo = 'Chácara';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Estância') {
                    $subtipo = 'Chácara';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Lavoura') {
                    $subtipo = 'Chácara';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Granja') {
                    $subtipo = 'Chácara';
                    $subtipocateg = '';
                }
            } elseif ($campo['tipo'] == 'Terreno') {
                if ($campo['subtipoimovel'] == 'Em rua') {
                    $subtipo = 'Terreno Padrão';
                    $subtipocateg = '';
                } elseif ($campo['subtipoimovel'] == 'Em condomínio') {
                    $subtipo = 'Loteamento/Condomínio';
                    $subtipocateg = '';
                } elseif ($campo['subtipoimovel'] == 'Em loteamento') {
                    $subtipo = 'Loteamento/Condomínio';
                    $subtipocateg = '';
                } elseif ($campo['subtipoimovel'] == 'Comercial') {
                    $subtipo = 'Terreno Padrão';
                    $subtipocateg = '';
                } elseif ($campo['subtipoimovel'] == 'Área industrial') {
                    $subtipo = 'Terreno Padrão';
                    $subtipocateg = '';
                } elseif ($campo['subtipoimovel'] == 'Para empreendimento') {
                    $subtipo = 'Terreno Padrão';
                    $subtipocateg = '';
                } else {
                    $subtipo = 'Loteamento/Condomínio';
                    $subtipocateg = '';
                }
            } elseif ($campo['tipo'] == 'Comercial') {
                if ($campo['subtipoimovel'] == 'Negócio') {
                    $subtipo = 'Conjunto Comercial/sala ';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Loja') {
                    $subtipo = 'Loja/Salão';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Sala') {
                    $subtipo = 'Conjunto Comercial/sala ';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Prédio Inteiro') {
                    $subtipo = 'Prédio Inteiro';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Casa') {
                    $subtipo = 'Sítio';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Loja de shopping') {
                    $subtipo = 'Loja de Shopping/Centro Comercial ';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Sobrado') {
                    $subtipo = 'Casa Comercial';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Armazém') {
                    $subtipo = 'Galpão/Depósito/Armazém';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Depósito') {
                    $subtipo = 'Galpão/Depósito/Armazém';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Galpão') {
                    $subtipo = 'Galpão/Depósito/Armazém';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Industria') {
                    $subtipo = 'Indústria';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Hotel') {
                    $subtipo = 'Hotel';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Motel') {
                    $subtipo = 'Motel';
                    $subtipocateg = '';
                }
                if ($campo['subtipoimovel'] == 'Pousada') {
                    $subtipo = 'Pousada/Chalé ';
                    $subtipocateg = '';
                }
            }

            $Category = $dom->createElement("SubTipoImovel");
            $imovel->appendChild($Category);
            $CategoryValue = $dom->createTextNode($subtipo);
            $Category->appendChild($CategoryValue);

            $Category = $dom->createElement("CategoriaImovel");
            $imovel->appendChild($Category);
            $CategoryValue = $dom->createTextNode($subtipocateg);
            $Category->appendChild($CategoryValue);

            ////////////////////////////////////////////////////////////// CATEGORIAS - FIM
            $Category = $dom->createElement("TituloImovel");
            $imovel->appendChild($Category);
            $CategoryValue = $dom->createTextNode($campo['tipo'] . ' para ' . $campo['negocio'] . ' em ' . $campo['cep_cidade'] . '/' . $campo['cep_estado'] . ' - ' . $campo['dormitorio'] . ' Dorm. ' . $campo['areautil'] . ' ' . $campo['areautil_medida'] . ' Área Útil');
            $Category->appendChild($CategoryValue);
            
            $portal_info = $this->acaoglobal(array('integracoes', 'id'), 'get', 3);
            $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'])) {
                   $info = $list_info_imoveis_tipo[$cont_info_imovel];
                   if($info == 'Especial'){
                       $info = 'Home';
                   }
                }
            
                if ($info_imovel != '') {
                    $cont_info_imovel++;
                }
            } 
                        
            $Category = $dom->createElement("Modelo");
            $imovel->appendChild($Category);
            $CategoryValue = $dom->createTextNode($info);
            $Category->appendChild($CategoryValue);

            $Category = $dom->createElement("UF");
            $imovel->appendChild($Category);
            $CategoryValue = $dom->createTextNode($campo['cep_estado']);
            $Category->appendChild($CategoryValue);

            $Category = $dom->createElement("Cidade");
            $imovel->appendChild($Category);
            $CategoryValue = $dom->createTextNode($campo['cep_cidade']);
            $Category->appendChild($CategoryValue);

            $Category = $dom->createElement("Bairro");
            $imovel->appendChild($Category);
            $CategoryValue = $dom->createTextNode($campo['cep_bairro']);
            $Category->appendChild($CategoryValue);

            
            $ocultarend = "sim";
            if ($campo['ocultarend'] == 2) {
                $ocultarend = "Nao";
                $campo['cep_logradouro'] = 'Sob Consulta';
            }
            
            $Category = $dom->createElement("Endereco");
            $imovel->appendChild($Category);
            $CategoryValue = $dom->createTextNode($campo['cep_logradouro']);
            $Category->appendChild($CategoryValue);

            $Category = $dom->createElement("Numero");
            $imovel->appendChild($Category);
            $CategoryValue = $dom->createTextNode($campo['cep_numero']);
            $Category->appendChild($CategoryValue);

            $Category = $dom->createElement("Complemento");
            $imovel->appendChild($Category);
            $CategoryValue = $dom->createTextNode($campo['cep_complemento']);
            $Category->appendChild($CategoryValue);

            $Category = $dom->createElement("CEP");
            $imovel->appendChild($Category);
            $CategoryValue = $dom->createTextNode($campo['cep']);
            $Category->appendChild($CategoryValue);

            if (($campo['negocio'] == 'Venda') || ($campo['negocio'] == 'Lançamento')) {
                $Category = $dom->createElement("PrecoVenda");
            } elseif ($campo['negocio'] == 'Temporada') {
                $Category = $dom->createElement("PrecoTemporada");
            } else {
                $Category = $dom->createElement("PrecoLocacao");
            }
            $imovel->appendChild($Category);
            $CategoryValue = $dom->createTextNode($campo['valor']);
            $Category->appendChild($CategoryValue);
            if($campo['negocio'] == 'Temporada'){
                $campo['valor_condominio'] = $campo['valor_condominio_temporada'];
            }
            if ($campo['valor_condominio'] != '') {

                $Category = $dom->createElement("PrecoCondominio");
                $imovel->appendChild($Category);
                $CategoryValue = $dom->createTextNode($campo['valor_condominio']);
                $Category->appendChild($CategoryValue);
            }
            if ($campo['valor_iptu'] != '') {

                $Category = $dom->createElement("PrecoIptuImovel");
                $imovel->appendChild($Category);
                $CategoryValue = $dom->createTextNode($campo['valor_iptu']);
                $Category->appendChild($CategoryValue);
            }

            $Category = $dom->createElement("AreaUtil");
            $imovel->appendChild($Category);
            $CategoryValue = $dom->createTextNode($campo['areautil']);
            $Category->appendChild($CategoryValue);
            
            if ($campo['areatotal'] != ''){
                if($campo['areatotal_medida'] == $campo['areautil_medida']) {  
                    $Category = $dom->createElement("AreaTotal");
                    $imovel->appendChild($Category);
                    $CategoryValue = $dom->createTextNode($campo['areatotal']);
                    $Category->appendChild($CategoryValue);
                }
            }
            $Category = $dom->createElement("UnidadeMetrica");
            $imovel->appendChild($Category);
            $CategoryValue = $dom->createTextNode($campo['areautil_medida']);
            $Category->appendChild($CategoryValue);

            $Category = $dom->createElement("QtdDormitorios");
            $imovel->appendChild($Category);
            $CategoryValue = $dom->createTextNode($campo['dormitorio']);
            $Category->appendChild($CategoryValue);

            if ($campo['banheiro'] != '') {
                $url = $dom->createElement("QtdBanheiros");
                $imovel->appendChild($url);
                $urlValue = $dom->createTextNode($campo['banheiro']);
                $url->appendChild($urlValue);
            }

            if ($campo['suite'] != '') {
                $url = $dom->createElement("QtdSuites");
                $imovel->appendChild($url);
                $urlValue = $dom->createTextNode($campo['suite']);
                $url->appendChild($urlValue);
            }

            if ($campo['garagem'] != '') {
                $url = $dom->createElement("QtdVagas");
                $imovel->appendChild($url);
                $urlValue = $dom->createTextNode($campo['garagem']);
                $url->appendChild($urlValue);
            }

            if ($campo['andar'] != '') {
                $url = $dom->createElement("Andar");
                $imovel->appendChild($url);
                $urlValue = $dom->createTextNode($campo['andar']);
                $url->appendChild($urlValue);
            }
            /*
            $detalhes = unserialize($campo['detalhes']);
            $proximidades = unserialize($campo['proximidades']);
            $adddetalhes = '';
            $addproximidades = '';            
            
            foreach ($detalhes as $detalhe) {
                
                if($adddetalhes!=''){ $adddetalhes = $adddetalhes.', '; }
                $buscaDetalhe = $this->acaoglobal(array('detalhes', 'id'), 'get', $detalhe);
                $nomeDetalhe = $buscaDetalhe['nome'];
                $adddetalhes = $adddetalhes.$nomeDetalhe;
                
            }
            
            foreach ($proximidades as $proximidade) {

                if($addproximidades!=''){ $addproximidades = $addproximidades.', '; }
                $buscaProximidades = $this->acaoglobal(array('proximidades', 'id'), 'get', $proximidade);
                $nomeProximidade = $buscaProximidades['nome'];
                $addproximidades = $addproximidades.$nomeProximidade;

            }* */
                        
            $Category = $dom->createElement("Observacao");
            $imovel->appendChild($Category);
            $descricaofinal = $campo['descricaodoimovel_imovelweb'];
            $CategoryValue = $dom->createTextNode($descricaofinal);
            $Category->appendChild($CategoryValue);

            $url = $dom->createElement("DivulgarEndereco");
            $imovel->appendChild($url);
            $urlValue = $dom->createTextNode($ocultarend);
            $url->appendChild($urlValue);

            $ocultarmap = 1;

            if (($campo['ocultarmap'] == 2) || ($campo['ocultarend'] == 2)) {
                $ocultarmap = 0;
            }

            $url = $dom->createElement("VisualizarMapa");
            $imovel->appendChild($url);
            $urlValue = $dom->createTextNode($ocultarmap);
            $url->appendChild($urlValue);

            $fotoss = unserialize($campo['fotos']);

            if ($campo['anoconstrucao'] != 0) {

                $url = $dom->createElement("AnoConstrucao");
                $imovel->appendChild($url);
                $urlValue = $dom->createTextNode($campo['anoconstrucao']);
                $url->appendChild($urlValue);
            }

            if ($fotoss[0] != '') {
                $pictures = $dom->createElement("Fotos");
                $imovel->appendChild($pictures);

                $contfotos = 0;
                foreach ($fotoss as $imagem) {
                    if ($contfotos < 50) {
                        $imageURL = $dom->createElement("Foto");
                        $pictures->appendChild($imageURL);

                        $imageURLnome = $dom->createElement("NomeArquivo");
                        $imageURL->appendChild($imageURLnome);
                        $imageURLnomeValue = $dom->createTextNode($imagem);
                        $imageURLnome->appendChild($imageURLnomeValue);

                        $imageURLlink = $dom->createElement("URLArquivo");
                        $imageURL->appendChild($imageURLlink);
                        $imageURLlinkValue = $dom->createTextNode(HOME_URI . 'subdominios/' . $_SESSION['userdata']['contratante'] . '/fotos/' . $campo['id_imovel'] . '/' . $imagem);
                        $imageURLlink->appendChild($imageURLlinkValue);

                        $imageURLlink = $dom->createElement("Principal");
                        $imageURL->appendChild($imageURLlink);
                        $fotoprincipal = 0;
                        if ($campo['icone'] == $imagem) {
                            $fotoprincipal = 1;
                        }
                        $imageURLlinkValue = $dom->createTextNode($fotoprincipal);
                        $imageURLlink->appendChild($imageURLlinkValue);

                        $imageURLlink = $dom->createElement("Ordem");
                        $imageURL->appendChild($imageURLlink);
                        $imageURLlinkValue = $dom->createTextNode($contfotos);
                        $imageURLlink->appendChild($imageURLlinkValue);
                        $contfotos++;
                    }
                }
            }

            if ($campo['video'] != '') {
                $video = $dom->createElement("Videos");
                $imovel->appendChild($video);

                $videoitem = $dom->createElement("Video");
                $video->appendChild($videoitem);

                $url = $dom->createElement("Descricao");
                $videoitem->appendChild($url);
                $urlValue = $dom->createTextNode('Vídeo do Imóvel');
                $url->appendChild($urlValue);

                $url = $dom->createElement("URLArquivo");
                $videoitem->appendChild($url);
                $urlValue = $dom->createTextNode('https://www.youtube.com/watch?v=' . $campo['video']);
                $url->appendChild($urlValue);

                $imageURLlink = $dom->createElement("Principal");
                $videoitem->appendChild($imageURLlink);
                $imageURLlinkValue = $dom->createTextNode(1);
                $imageURLlink->appendChild($imageURLlinkValue);
            }
            ///////////////////////////////////////////////////////////////// Imovel Web - fim
        }
                
    }else{
        
            if($campo['valor'] == ''){
                $imovel_invalido_imovelweb .= 'Valor do Imóvel '.'%';
            }
            if(($campo['cep_estado'] == null) || ($campo['cep_estado'] == '')){
                $imovel_invalido_imovelweb .= 'CEP'.'%';
            }
            if(($campo['cep_cidade'] == null) || ($campo['cep_cidade'] == '')){
                $imovel_invalido_imovelweb .= 'Cidade'.'%';
            }
            if(($campo['cep_bairro'] == null) || ($campo['cep_bairro'] == '')){
                $imovel_invalido_imovelweb .= 'Bairro'.'%';
            }
            if(($campo['cep_logradouro'] == null) || ($campo['cep_logradouro'] == '')){
                $imovel_invalido_imovelweb .= 'Logradouro'.'%';
            }
            if(($campo['descricaodoimovel'] == null) || ($campo['descricaodoimovel'] == '')){
                $imovel_invalido_imovelweb .= 'Descrição do Imóvel'.'%';
            }
            if($campo['descricaodoimovel'] == '<br>'){
                $imovel_invalido_imovelweb .= 'Descrição do Imóvel'.'%';
            }
            if($campo['areautil'] == ''){
                $imovel_invalido_imovelweb .= 'Área Útil'.'%';
            }            
            if(($campo['tipo'] != 'Terreno') && ($campo['tipo'] != 'Comercial') && ($campo['dormitorio'] == '0')){
                $imovel_invalido_imovelweb .= 'Dormitório'.'%';
            }            
            if($campo['status'] != '0'){
                $imovel_invalido_imovelweb .= 'Status do Imóvel: Arquivado'.'%';
            }
    }
    
        if(($validar == '1') || ($imovelvalido == 'nao')){
            $cod_referencia_pendente_imovelweb .=   '-' .$campo['id_imovel'];
        }
    } 
        if($imovel_invalido_imovelweb != ''){ 
               $imovel_invalido_id_imovelweb .= $campo['id_imovel'].'%'.$imovel_invalido_imovelweb.'//';
        }
}
$get_integracoes = $this->acaoglobal(array('integracoes', 'id'), 'get', 3);   

   
//                $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_imovelweb,
                                                    'pendencias' => $imovel_invalido_id_imovelweb,
                                                    'id' => '3'
                                                        )
                                                );


$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'] . "/imovelweb.xml");
// save tree to string
$order = $dom->save(ABSPATH . "/subdominios/" . $_SESSION['userdata']['contratante'] . "/imovelweb.xml");


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

// set up basic connection
$conn_id = ftp_connect($serv_info['ip_server']);
$dir = 'public_html/integracoes';
$remote_file = $dir.'/imovelweb.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);
?>

Youez - 2016 - github.com/yon3zu
LinuXploit