| 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 : |
<?php
// Topo
$dom = new DOMDocument("1.0", "utf-8");
$root = $dom->createElement("imofox");
$dom->appendChild($root);
$dom->formatOutput = true;
$oo = $dom->createAttribute("version");
$root->appendChild($oo);
$o2 = $dom->createTextNode("2.0");
$oo->appendChild($o2);
$Listings = $dom->createElement("imoveis");
$root->appendChild($Listings);
$imoveisintegrados = explode('-', $portal['imoveis']);
foreach ($imoveisintegrados as $campo) {
$imovel_invalido_imofox = '';
if (@$infoimovel[$campo] != null) {
//echo $campo.'1';
// create child element
$campo = $infoimovel[$campo];
$imovelvalido = 'nao';
$validar = '1';
if ($campo['valor'] != '') {
$imovelvalido = 'sim';
if (($campo['tipo'] == 'Rural') || ($campo['tipo'] == 'Terreno')) {
if ($campo['areatotal_medida'] != 'ha') {
$imovelvalido = 'nao';
$imovel_invalido_imofox .= 'Área Total Medida'.'%';
}
}
if (($campo['tipo'] == 'Casa') || ($campo['tipo'] == 'Apartamento')) {
if (($campo['dormitorio'] == null) || ($campo['dormitorio'] == 0)) {
$imovelvalido = 'nao';
$imovel_invalido_imofox .= 'Dormitório'.'%';
}
}
if (($campo['cep_estado'] == null) || ($campo['cep_estado'] == '')) {
$imovelvalido = 'nao';
$imovel_invalido_imofox .= 'Estado'.'%';
}
if (($campo['cep_cidade'] == null) || ($campo['cep_cidade'] == '')) {
$imovelvalido = 'nao';
$imovel_invalido_imofox .= 'Cidade'.'%';
}
if (($campo['cep_bairro'] == null) || ($campo['cep_bairro'] == '')) {
$imovelvalido = 'nao';
$imovel_invalido_imofox .= 'Bairro'.'%';
}
if (($sis_local['sis_local_cidade'] == null) || ($sis_local['sis_local_cidade'] == '')) {
$imovelvalido = 'nao';
$imovel_invalido_imofox .= 'Configuração do Sistema: Cidade'.'%';
}
if (($sis_local['sis_local_estado'] == null) || ($sis_local['sis_local_estado'] == '')) {
$imovelvalido = 'nao';
$imovel_invalido_imofox .= 'Configuração do Sistema: Estado'.'%';
}
if (($emailsistema == null) || ($emailsistema == '')) {
$imovelvalido = 'nao';
$imovel_invalido_imofox .= 'Email'.'%';
}
if($campo['status'] != '0'){
$imovelvalido = 'nao';
$imovel_invalido_imofox .= 'Status do Imóvel: Arquivado'.'%';
}
if ($imovelvalido == 'sim') {
$validar = '0';
/////
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';
}
/////
$imovel = $dom->createElement("imovel");
$Listings->appendChild($imovel);
$tiponegocio = $campo['negocio'];
if ($tiponegocio == 'Lançamento') {
$tiponegocio = 'venda';
}
if ($tiponegocio == 'Venda') {
$tiponegocio = 'venda';
}
if ($tiponegocio == 'Locação') {
$tiponegocio = 'aluguel';
}
if ($tiponegocio == 'Temporada') {
$tiponegocio = 'temporada';
}
$Title = $dom->createElement("codigoimovel");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['cod_referencia']);
$Title->appendChild($TitleValue);
$Title = $dom->createElement("referencia");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['cod_referencia']);
$Title->appendChild($TitleValue);
$Title = $dom->createElement("urlimovel");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode('<![CDATA[ '.$dominiosistema.'/detalhes_imovel/'.$campo['id_imovel'].']]>');
$Title->appendChild($TitleValue);
$Category = $dom->createElement("finalidade");
$imovel->appendChild($Category);
$CategoryValue = $dom->createTextNode($tiponegocio);
$Category->appendChild($CategoryValue);
if ($campo['tipo'] == 'Apartamento') {
$tipoimovel = 'apartamento';
$tipoimovellivre = 'apartamento';
if ($campo['subtipoimovel'] == 'Kitnete') {
$tipoimovel = 'kitchenette';
$tipoimovellivre = 'kitchenette,loft';
}
if ($campo['subtipoimovel'] == 'Cobertura') {
$tipoimovel = 'cobertura';
$tipoimovellivre = 'cobertura';
}
if ($campo['subtipoimovel'] == 'Flat') {
$tipoimovel = 'flat';
$tipoimovellivre = 'apart hotel,flat';
}
} elseif ($campo['tipo'] == 'Casa') {
$tipoimovel = 'casa';
$tipoimovellivre = 'casa';
if ($campo['subtipoimovel'] == 'Em condomínio') {
$tipoimovel = 'casa condominio';
$tipoimovellivre = 'casa em condomínio';
}
if (($campo['subtipoimovel'] == 'Sobrado Padrão') || ($campo['subtipoimovel'] == 'Sobrado em condomínio') || ($campo['subtipoimovel'] == 'Sobrado em vila fechada')
|| ($campo['subtipoimovel'] == 'Sobrado Duplex') || ($campo['subtipoimovel'] == 'Sobrado Triplex')) {
$tipoimovel = 'sobrado';
$tipoimovellivre = 'sobrado';
}
} elseif ($campo['tipo'] == 'Rural') {
$tipoimovel = 'rural';
$tipoimovellivre = 'imóveis rurais, sítio/chácara/fazenda';
} elseif ($campo['tipo'] == 'Terreno') {
$tipoimovel = 'terreno';
$tipoimovellivre = 'terreno/lote/loteamento';
} else {
$tipoimovel = 'comercial';
$tipoimovellivre = 'escritótio/conj. comercial/prédio comercial, outros imóveis comerciais';
if (($campo['subtipoimovel'] == 'Loja') || ($campo['subtipoimovel'] == 'Loja de shopping')) {
$tipoimovel = 'loja';
$tipoimovellivre = 'loja';
}
if (($campo['subtipoimovel'] == 'armazém') || ($campo['subtipoimovel'] == 'Depósito') || ($campo['subtipoimovel'] == 'Galpão')) {
$tipoimovel = 'galpão';
$tipoimovellivre = 'galpão,armazém,depósito';
}
if (($campo['subtipoimovel'] == 'Hotel') || ($campo['subtipoimovel'] == 'Pousada')) {
$tipoimovel = 'hotel';
$tipoimovellivre = 'hotel,pousada e similares';
}
}
$CodigoImovel = $dom->createElement("tipoimovel");
$imovel->appendChild($CodigoImovel);
$codigoValue = $dom->createTextNode($tipoimovel);
$CodigoImovel->appendChild($codigoValue);
$CodigoImovel = $dom->createElement("tipoimovellivre");
$imovel->appendChild($CodigoImovel);
$codigoValue = $dom->createTextNode($tipoimovellivre);
$CodigoImovel->appendChild($codigoValue);
$lancamento = 'nao';
if ($campo['negocio'] == 'Lançamento') {
$lancamento = 'sim';
}
$CodigoImovel = $dom->createElement("lancamento");
$imovel->appendChild($CodigoImovel);
$codigoValue = $dom->createTextNode($lancamento);
$CodigoImovel->appendChild($codigoValue);
$Category = $dom->createElement("titulo");
$imovel->appendChild($Category);
$CategoryValue = $dom->createTextNode($campo['tipo'] . ' para ' . $campo['negocio'] . ' em ' . $campo['cep_cidade'] . '/' . $campo['cep_estado']);
$Category->appendChild($CategoryValue);
if ($campo['descricaodoimovel']) {
$Title = $dom->createElement("descricao");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode('<![CDATA['. $campo['descricaodoimovel'].']]>');
$Title->appendChild($TitleValue);
}
$CodigoImovel = $dom->createElement("dormitorios");
$imovel->appendChild($CodigoImovel);
$codigoValue = $dom->createTextNode($campo['dormitorio']);
$CodigoImovel->appendChild($codigoValue);
$CodigoImovel = $dom->createElement("banheiros");
$imovel->appendChild($CodigoImovel);
$codigoValue = $dom->createTextNode($campo['banheiro']);
$CodigoImovel->appendChild($codigoValue);
$CodigoImovel = $dom->createElement("suites");
$imovel->appendChild($CodigoImovel);
$codigoValue = $dom->createTextNode($campo['suite']);
$CodigoImovel->appendChild($codigoValue);
$CodigoImovel = $dom->createElement("vagas");
$imovel->appendChild($CodigoImovel);
$codigoValue = $dom->createTextNode($campo['garagem']);
$CodigoImovel->appendChild($codigoValue);
$Title = $dom->createElement("area");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['areatotal']);
$Title->appendChild($TitleValue);
if ($campo['areautil'] != '') {
$Title = $dom->createElement("area_util");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['areautil']);
$Title->appendChild($TitleValue);
}
if ($campo['cep_logradouro']) {
$Title = $dom->createElement("endereco");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['cep_logradouro'] . ' ' . $campo['cep_numero']);
$Title->appendChild($TitleValue);
}
$Title = $dom->createElement("cidade");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['cep_cidade']);
$Title->appendChild($TitleValue);
$Title = $dom->createElement("bairro");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['cep_bairro']);
$Title->appendChild($TitleValue);
$Title = $dom->createElement("estado");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['cep_estado']);
$Title->appendChild($TitleValue);
// $Title = $dom->createElement("pais");
// $imovel->appendChild($Title);
// $TitleValue = $dom->createTextNode($campo['cep_pais']);
// $Title->appendChild($TitleValue);
$Title = $dom->createElement("cep");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['cep']);
$Title->appendChild($TitleValue);
$Title = $dom->createElement("latitude");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['latitude']);
$Title->appendChild($TitleValue);
$Title = $dom->createElement("longitude");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['longitude']);
$Title->appendChild($TitleValue);
if (($campo['valor'] == '') || ($campo['valor'] == 0)) {
$campo['valor'] = 'Consultar';
}
if (($campo['naodivulgar_valor'] == '2')) {
$campo['valor'] = 'Consultar';
}
$Title = $dom->createElement("preco");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['valor']);
$Title->appendChild($TitleValue);
//////////////////////////////////////////////////////////////////////////////////
$fotoss = unserialize($campo['fotos']);
if ($fotoss[0] != '') {
$pictures = $dom->createElement("fotos");
$imovel->appendChild($pictures);
$contfotos = 0;
foreach ($fotoss as $imagem) {
$imageURL = $dom->createElement("foto");
$pictures->appendChild($imageURL);
$imageURLlink = $dom->createElement("foto_url");
$imageURL->appendChild($imageURLlink);
$imageURLValue = $dom->createTextNode('<![CDATA['.HOME_URI . 'subdominios/' . $_SESSION['userdata']['contratante'] . '/fotos/' . $campo['id_imovel'] . '/' . $imagem .']]>');
$imageURLlink->appendChild($imageURLValue);
$contfotos++;
}
$pictures = $dom->createElement("numero_total_fotos");
$imovel->appendChild($pictures);
$imageURLValue = $dom->createTextNode($contfotos);
$pictures->appendChild($imageURLValue);
}
$pegarcodigo = $this->acaoglobal(array('integracoes', 'id'), 'get', 12);
$iwdados = unserialize($pegarcodigo['dados']);
$anunciante = $dom->createElement("anunciante");
$imovel->appendChild($anunciante);
$anuncianteinfo = $dom->createElement("codigoanunciante");
$anunciante->appendChild($anuncianteinfo);
$anuncianteinfoValue = $dom->createTextNode($iwdados['codigocentral']);
$anuncianteinfo->appendChild($anuncianteinfoValue);
$tipoanunciante = 'imobiliaria';
if (($sis_creci != null)&&($sis_creci != '')) {
$tipoanunciante = 'corretor';
}
$anuncianteinfo = $dom->createElement("tipoanunciante");
$anunciante->appendChild($anuncianteinfo);
$anuncianteinfoValue = $dom->createTextNode($tipoanunciante);
$anuncianteinfo->appendChild($anuncianteinfoValue);
$anuncianteinfo = $dom->createElement("nomefantasia");
$anunciante->appendChild($anuncianteinfo);
$anuncianteinfoValue = $dom->createTextNode($contactp);
$anuncianteinfo->appendChild($anuncianteinfoValue);
$Provider = $dom->createElement("endereco");
$anunciante->appendChild($Provider);
$titulositee = $dom->createTextNode($sis_local['sis_local_logradouro'] . ' ' . $sis_local['sis_local_numero']);
$Provider->appendChild($titulositee);
$Provider = $dom->createElement("bairro");
$anunciante->appendChild($Provider);
$titulositee = $dom->createTextNode($sis_local['sis_local_bairro']);
$Provider->appendChild($titulositee);
$Provider = $dom->createElement("cidade");
$anunciante->appendChild($Provider);
$titulositee = $dom->createTextNode($sis_local['sis_local_cidade']);
$Provider->appendChild($titulositee);
$Provider = $dom->createElement("estado");
$anunciante->appendChild($Provider);
$titulositee = $dom->createTextNode($sis_local['sis_local_estado']);
$Provider->appendChild($titulositee);
$Provider = $dom->createElement("telefone");
$anunciante->appendChild($Provider);
$titulositee = $dom->createTextNode($sis_fone1);
$Provider->appendChild($titulositee);
$Provider = $dom->createElement("email");
$anunciante->appendChild($Provider);
$titulositee = $dom->createTextNode($emailsistema);
$Provider->appendChild($titulositee);
$Provider = $dom->createElement("urlsite");
$anunciante->appendChild($Provider);
$titulositee = $dom->createTextNode('<![CDATA[ '.$dominiosistema.']]>');
$Provider->appendChild($titulositee);
/// PEGAR LOGOMARCA
$path = '../'.PASTA_BASE.'/subdominios/' . $_SESSION['userdata']['contratante'] . '/layout/logo/';
if (file_exists($path)) {
} else {
mkdir($path, 0755, true);
}
$diretorio = dir($path);
$logomarca = '';
while ($arquivo = $diretorio->read()) {
if ($arquivo != '.' && $arquivo != '..') {
$logomarca = $arquivo;
}
}
$diretorio->close();
if ($sis_configuracoes['logomarca'] != '') {
$urllogo = HOME_URI . 'subdominios/' . $_SESSION['userdata']['contratante'] . '/layout/logo/' . $sis_configuracoes['logomarca'];
}else{
$urllogo = '';
}
/// PEGAR LOGOMARCA
$Provider = $dom->createElement("urllogo");
$anunciante->appendChild($Provider);
$titulositee = $dom->createTextNode('<![CDATA[ '.$urllogo.']]>');
$Provider->appendChild($titulositee);
/////////////////////////////////////////////////////////////////////////// TATRI - FIM
}
}else{
if($campo['valor'] == ''){
$imovel_invalido_imofox .= 'Valor do Imóvel '.'%';
}
if (($campo['tipo'] == 'Rural') || ($campo['tipo'] == 'Terreno')) {
if ($campo['areatotal_medida'] != 'ha') {
$imovel_invalido_imofox .= 'Área Total Medida'.'%';
}
}
if (($campo['tipo'] == 'Casa') || ($campo['tipo'] == 'Apartamento')) {
if (($campo['dormitorio'] == null) || ($campo['dormitorio'] == 0)) {
$imovel_invalido_imofox .= 'Dormitório'.'%';
}
}
if (($campo['cep_estado'] == null) || ($campo['cep_estado'] == '')) {
$imovel_invalido_imofox .= 'Estado'.'%';
}
if (($campo['cep_cidade'] == null) || ($campo['cep_cidade'] == '')) {
$imovel_invalido_imofox .= 'Cidade'.'%';
}
if (($campo['cep_bairro'] == null) || ($campo['cep_bairro'] == '')) {
$imovel_invalido_imofox .= 'Bairro'.'%';
}
if (($sis_local['sis_local_cidade'] == null) || ($sis_local['sis_local_cidade'] == '')) {
$imovel_invalido_imofox .= 'Configuração do Sistema: Cidade'.'%';
}
if (($sis_local['sis_local_estado'] == null) || ($sis_local['sis_local_estado'] == '')) {
$imovel_invalido_imofox .= 'Configuração do Sistema: Estado'.'%';
}
if (($emailsistema == null) || ($emailsistema == '')) {
$imovel_invalido_imofox .= 'Email'.'%';
}
if($campo['status'] != '0'){
$imovel_invalido_imofox .= 'Status do Imóvel: Arquivado'.'%';
}
}
if(($validar == '1') || ($imovelvalido == 'nao')){
$cod_referencia_pendente_imofox .= '-' .$campo['id_imovel'];
}
}
if($imovel_invalido_imofox != ''){
$imovel_invalido_id_imofox .= $campo['id_imovel'].'%'.$imovel_invalido_imofox.'//';
}
}
$get_integracoes = $this->acaoglobal(array('integracoes', 'id'), 'get', 12);
// $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_imofox,
'pendencias' => $imovel_invalido_id_imofox,
'id' => '12'
)
);
$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'] . "/imofox.xml");
// save tree to string
$order = $dom->save(ABSPATH . "/subdominios/" . $_SESSION['userdata']['contratante'] . "/imofox.xml");
$file = ABSPATH . "/subdominios/" . $_SESSION['userdata']['contratante'] . "/imofox.xml";
// set up basic connection
$conn_id = ftp_connect($serv_info['ip_server']);
$dir = 'public_html/integracoes';
$remote_file = $dir.'/imofox.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);
?>