| 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("Cargas");
$dom->appendChild($root);
$dom->formatOutput = true;
/*
$oo = $dom->createAttribute("data");
$root->appendChild($oo);
$o2 = $dom->createTextNode(date('Y-M-D h:m:s'));
$oo->appendChild($o2);
$oo = $dom->createAttribute("codigo");
$root->appendChild($oo);
$o2 = $dom->createTextNode(date('1130'));
$oo->appendChild($o2);
$oo = $dom->createAttribute("imobiliaria");
$root->appendChild($oo);
$o2 = $dom->createTextNode(date('Nome da imobiliaria'));
$oo->appendChild($o2);
*/
$Listings = $dom->createElement("imoveis");
$root->appendChild($Listings);
$imoveisintegrados = explode('-', $portal['imoveis']);
foreach ($imoveisintegrados as $campo) {
$imovel_invalido_qimoveis = '';
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') {
if ($campo['areatotal_medida'] != 'ha') {
$imovelvalido = 'nao';
$imovel_invalido_qimoveis .= 'Área Total Medida'.'%';
}
}
if($campo['status'] != '0'){
$imovelvalido = 'nao';
$imovel_invalido_qimoveis .= 'Status do Imóvel: Arquivado'.'%';
}
if ($imovelvalido == 'sim') {
$validar = '0';
/////
if (($campo['dormitorio'] == null) || ($campo['dormitorio'] == 0)) {
$campo['dormitorio'] = 0;
}
if (($campo['banheiro'] == null) || ($campo['banheiro'] == 0)) {
$campo['banheiro'] = 0;
}
if (($campo['suite'] == null) || ($campo['suite'] == 0)) {
$campo['suite'] = 'Não tem';
}
if (($campo['garagem'] == null) || ($campo['garagem'] == 0)) {
$campo['garagem'] = 'Não tem';
}
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';
}
/////
if ($campo['negocio'] == 'Locação') {
$campo['negocio'] = 'Aluguel';
}
$imovel = $dom->createElement("imovel");
$Listings->appendChild($imovel);
$tiponegocio = $campo['negocio'];
if ($campo['negocio'] == 'Lançamento') {
$tiponegocio = 'venda';
} elseif ($campo['negocio'] == 'Venda') {
$tiponegocio = 'venda';
} elseif ($campo['negocio'] == 'Locação') {
$tiponegocio = 'aluguel';
} else {
$tiponegocio = 'aluguel';
}
$Title = $dom->createElement("CodigoImovel");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['cod_referencia']);
$Title->appendChild($TitleValue);
$Category = $dom->createElement("Finalidade");
$imovel->appendChild($Category);
$CategoryValue = $dom->createTextNode($tiponegocio);
$Category->appendChild($CategoryValue);
$Category = $dom->createElement("AceitaPermuta");
$imovel->appendChild($Category);
$CategoryValue = $dom->createTextNode('Não'); // A DEFINIR
$Category->appendChild($CategoryValue);
if ($campo['tipo'] == 'Apartamento') {
$tipoimovel = 'Apartamento';
} elseif ($campo['tipo'] == 'Casa') {
$tipoimovel = 'Casa';
} elseif ($campo['tipo'] == 'Comercial') {
$tipoimovel = 'Comercial';
} elseif ($campo['tipo'] == 'Terreno') {
$tipoimovel = 'Terreno';
} elseif ($campo['tipo'] == 'Rural') {
$tipoimovel = 'Terreno';
}
if ($campo['subtipoimovel'] == 'Cobertura') {
$tipoimovel = 'Cobertura';
} elseif ($campo['subtipoimovel'] == 'Kitnet') {
$tipoimovel = 'Kitnet';
} elseif ($campo['subtipoimovel'] == 'Duplex') {
$tipoimovel = 'Duplex';
} elseif ($campo['subtipoimovel'] == 'Triplex') {
$tipoimovel = 'Triplex';
} elseif ($campo['subtipoimovel'] == 'Flat') {
$tipoimovel = 'Flat';
} elseif ($campo['subtipoimovel'] == 'madeira') {
$tipoimovel = 'Casa de madeira';
} elseif ($campo['subtipoimovel'] == 'em condomínio') {
$tipoimovel = 'Casa em condomínio';
} elseif ($campo['subtipoimovel'] == 'Sobrado') {
$tipoimovel = 'Sobrado';
} elseif ($campo['subtipoimovel'] == 'Geminada') {
$tipoimovel = 'Casa Geminada';
} elseif ($campo['subtipoimovel'] == 'Depósito') {
$tipoimovel = 'Depósito';
} elseif ($campo['subtipoimovel'] == 'Hotel') {
$tipoimovel = 'Hotel';
} elseif ($campo['subtipoimovel'] == 'Pousada') {
$tipoimovel = 'Pousada';
} elseif ($campo['subtipoimovel'] == 'Indústria') {
$tipoimovel = 'Indústria';
} elseif ($campo['subtipoimovel'] == 'Loja') {
$tipoimovel = 'Loja';
} elseif ($campo['subtipoimovel'] == 'Sala') {
$tipoimovel = 'Sala comercial';
} elseif ($campo['subtipoimovel'] == 'Prédio Inteiro') {
$tipoimovel = 'Prédio comercial';
} elseif ($campo['subtipoimovel'] == 'Casa') {
$tipoimovel = 'Casa comercial';
} elseif ($campo['subtipoimovel'] == 'Chácara') {
$tipoimovel = 'Chácara';
} elseif ($campo['subtipoimovel'] == 'Fazenda') {
$tipoimovel = 'Fazenda';
}
if (($campo['subtipoimovel'] == 'Em loteamento') && ($campo['tipo'] == 'Terreno')) {
$tipoimovel = 'Loteamento';
}
if (($campo['subtipoimovel'] == 'Sobrado') && ($campo['tipo'] == 'Comercial')) {
$tipoimovel = 'Sobrado comercial';
}
$CodigoImovel = $dom->createElement("TipoImovel");
$imovel->appendChild($CodigoImovel);
$codigoValue = $dom->createTextNode($tipoimovel);
$CodigoImovel->appendChild($codigoValue);
$Title = $dom->createElement("estado");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['cep_estado']);
$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("oportunidade");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['cep_bairro']);
$Title->appendChild($TitleValue);
$Title = $dom->createElement("valor");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['valor'] . '.00');
$Title->appendChild($TitleValue);
$Title = $dom->createElement("PrecoCondominio");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['valor_condominio'] . '.00');
$Title->appendChild($TitleValue);
$Title = $dom->createElement("ValorIptu");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['valor_iptu'] . '.00');
$Title->appendChild($TitleValue);
$Title = $dom->createElement("AreaUtil");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['areautil']);
$Title->appendChild($TitleValue);
$Title = $dom->createElement("AreaTotal");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['areatotal']);
$Title->appendChild($TitleValue);
$Title = $dom->createElement("AreaTerreno");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['areaterreno']);
$Title->appendChild($TitleValue);
$Title = $dom->createElement("QtdDormitorios");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['dormitorio']);
$Title->appendChild($TitleValue);
$Title = $dom->createElement("QtdBanheiros");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['banheiro']);
$Title->appendChild($TitleValue);
$Title = $dom->createElement("QtdSuites");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['suite']);
$Title->appendChild($TitleValue);
$Title = $dom->createElement("QtdVagas");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['garagem']);
$Title->appendChild($TitleValue);
$Title = $dom->createElement("Observacao");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['descricaodoimovel']);
$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("NomeArquivo");
$imageURL->appendChild($imageURLlink);
$imageURLValue = $dom->createTextNode($imagem);
$imageURLlink->appendChild($imageURLValue);
$imageURLlink = $dom->createElement("URLArquivo");
$imageURL->appendChild($imageURLlink);
$imageURLValue = $dom->createTextNode(HOME_URI . 'subdominios/' . $_SESSION['userdata']['contratante'] . '/fotos/' . $campo['id_imovel'] . '/' . $imagem);
$imageURLlink->appendChild($imageURLValue);
$imageURLlink = $dom->createElement("Legenda");
$imageURL->appendChild($imageURLlink);
$imageURLValue = $dom->createTextNode('');
$imageURLlink->appendChild($imageURLValue);
$fotoprincipal = 0;
if ($campo['icone'] == $imagem) {
$fotoprincipal = 1;
}
$imageURLlink = $dom->createElement("Principal");
$imageURL->appendChild($imageURLlink);
$imageURLValue = $dom->createTextNode($fotoprincipal);
$imageURLlink->appendChild($imageURLValue);
$contfotos++;
}
$pictures = $dom->createElement("numero_total_fotos");
$imovel->appendChild($pictures);
$imageURLValue = $dom->createTextNode($contfotos);
$pictures->appendChild($imageURLValue);
}
$Title = $dom->createElement("Videos");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['video']);
$Title->appendChild($TitleValue);
$Title = $dom->createElement("UnidadeMetrica");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['areatotal_medida']);
$Title->appendChild($TitleValue);
$Title = $dom->createElement("UnidadeMetricaAreaTerreno");
$imovel->appendChild($Title);
$TitleValue = $dom->createTextNode($campo['areaterreno_medida']);
$Title->appendChild($TitleValue);
}
}else{
if($campo['valor'] == ''){
$imovel_invalido_qimoveis .= 'Valor do Imóvel '.'%';
}
if ($campo['tipo'] == 'Rural') {
if ($campo['areatotal_medida'] != 'ha') {
$imovel_invalido_qimoveis .= 'Área Total Medida'.'%';
}
}
if($campo['status'] != '0'){
$imovel_invalido_qimoveis .= 'Status do Imóvel: Arquivado'.'%';
}
}
if(($validar == '1') || ($imovelvalido == 'nao')){
$cod_referencia_pendente_qimoveis .= '-' .$campo['id_imovel'];
}
}
if($imovel_invalido_qimoveis != ''){
$imovel_invalido_id_qimoveis .= $campo['id_imovel'].'%'.$imovel_invalido_qimoveis.'//';
}
}
$get_integracoes = $this->acaoglobal(array('integracoes', 'id'), 'get', 13);
// $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_qimoveis,
'pendencias' => $imovel_invalido_id_qimoveis,
'id' => '13'
)
);
$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'] . "/qimoveis.xml");
// save tree to string
$order = $dom->save(ABSPATH . "/subdominios/" . $_SESSION['userdata']['contratante'] . "/qimoveis.xml");
$file = ABSPATH . "/subdominios/" . $_SESSION['userdata']['contratante'] . "/qimoveis.xml";
// set up basic connection
$conn_id = ftp_connect($serv_info['ip_server']);
$dir = 'public_html/integracoes';
$remote_file = $dir.'/qimoveis.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);
?>