Mini Shell
<?php
session_start();
include("../s_acessos.php");
include("../funcoes.php");
include("verifica.php");
if ($_GET['arquivo'] == TRUE) {
$file = 'arquivos/' . $_GET['arquivo'];
header("Content-type: application/save");
header('Content-Disposition: attachment; filename="' . $file . '"');
header('Expires: 0');
header('Pragma: no-cache');
readfile($file);
exit;
}
//Gera arquivo xml (VIVA REAL)
if ($_GET['cmd'] == 'gerar_xml') {
$array_estados = array(
"AC" => "Acre", "AL" => "Alagoas", "AM" => "Amazonas", "AP" => "Amapa", "BA" => "Bahia", "CE" => "Ceara", "DF" => "Distrito Federal", "ES" => "Espirito Santo",
"GO" => "Goias", "MA" => "Maranhao", "MT" => "Mato Grosso", "MS" => "Mato Grosso do Sul", "MG" => "Minas Gerais", "PA" => "Para", "PB" => "Paraiba", "PR" => "Parana",
"PE" => "Pernambuco", "PI" => "Piaui", "RJ" => "Rio de Janeiro", "RN" => "Rio Grande do Norte", "RO" => "Rondonia", "RS" => "Rio Grande do Sul", "RR" => "Roraima",
"SC" => "Santa Catarina", "SE" => "Sergipe", "SP" => "Sao Paulo", "TO" => "Tocantins"
);
$data_arq = date("Y-m-d") . 'T' . date("H:i:s");
$empresa = "Kasa Imoveis";
$nome_contato = "Bruno Leonardo Magalhaes";
//$estado = "Espirito Santo";
//$cidade = "Vitoria";
$xml = '<?phpxml version="1.0" encoding="ISO-8859-1"?>';
$xml .= '<ListingDataFeed xmlns="http://www.vivareal.com/schemas/1.0/VRSync" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vivareal.com/schemas/1.0/VRSync">';
$xml .= '<Header>';
$xml .= '<Provider>' . utf8_encode($empresa) . '</Provider>';
$xml .= '<Email>contato@kasaimoveis.com</Email>';
$xml .= '<ContactName>' . utf8_encode($nome_contato) . '</ContactName>';
$xml .= '<Telephone>(27)3225-4798</Telephone>';
$xml .= '<PublishDate>' . $data_arq . '</PublishDate>';
$xml .= '<Logo>https://www.kasaimoveis.com/logo_kasa.jpg</Logo>';
$xml .= '</Header>';
$xml .= '<Listings>';
$str = "SELECT A.*, B.nome AS bairro, C.nome AS cidade
FROM imoveis A
LEFT JOIN imoveis_bairros B ON A.idbairro = B.codigo
LEFT JOIN imoveis_cidades C ON A.idcidade = C.codigo
WHERE A.status = '1'
ORDER BY A.data DESC";
$rs = mysql_query($str) or die(mysql_error());
$conteudo = "";
while ($vet = mysql_fetch_array($rs)) {
$idimovel = $vet['codigo'];
$dat_arq = $vet['data'] . 'T' . date("H") . ':' . date("i") . ':' . date("s");
$uf = $vet['uf'];
$estado = $array_estados[$vet['uf']];
if (!$vet['valor'])
$valor = 0;
else
$valor = floor($vet['valor']);
if ($vet['finalidade'] == 3)
$transaction_type = 'For Rent';
elseif ($vet['finalidade'] == 2)
$transaction_type = 'For Sale';
elseif ($vet['finalidade'] == 1)
$transaction_type = 'For Sale';
if ($vet['tipo'] == '1')
$property_type = 'Residential / Apartment';
elseif ($vet['tipo'] == '2')
$property_type = 'Commercial / Building';
elseif ($vet['tipo'] == '3')
$property_type = 'Comercial / Loja';
elseif ($vet['tipo'] == '4')
$property_type = 'Residential / Home';
elseif ($vet['tipo'] == '5')
$property_type = 'Residential / Penthouse';
elseif ($vet['tipo'] == '6')
$property_type = 'Residential / Kitnet';
elseif ($vet['tipo'] == '7')
$property_type = 'Commercial / Office';
elseif ($vet['tipo'] == '8')
$property_type = 'Residential / Land Lot';
elseif ($vet['tipo'] == '9')
$property_type = 'Residential / Farm Ranch';
$xml .= '<Listing>';
$xml .= '<ListingID>' . $vet['referencia'] . '</ListingID>';
if ($vet['titulo'])
$xml .= '<Title>' . preg_replace("/[^a-zA-Z0-9\s]/", "", utf8_encode(utf8_decode($vet['titulo']))) . '</Title>';
else
$xml .= '<Title>' . preg_replace("/[^a-zA-Z0-9\s]/", "", utf8_encode(utf8_decode($vet['nome_imovel']))) . '</Title>';
$xml .= '<TransactionType>' . $transaction_type . '</TransactionType>';
if (!$vet['destaque'])
$xml .= '<Featured>false</Featured>';
else
$xml .= '<Featured>true</Featured>';
$xml .= '<DetailViewUrl>https://www.kasaimoveis.com</DetailViewUrl>';
$strI = "SELECT * FROM imoveis_imagens WHERE idimovel IN ('$idimovel') ORDER BY ind_destaque DESC, codigo ASC";
$rsI = mysql_query($strI) or die(mysql_error());
$numI = mysql_num_rows($rsI);
if ($numI > 0) {
$xml .= '<Media>';
while ($vetI = mysql_fetch_array($rsI)) {
if ($vetI['codigo'] == TRUE) {
if (!$vetI['ind_destaque'])
$xml .= '<Item medium="image">https://www.kasaimoveis.com/upload/' . $vetI['imagem'] . '</Item>';
else
$xml .= '<Item medium="image" primary="true">https://www.kasaimoveis.com/upload/' . $vetI['imagem'] . '</Item>';
}
}
$xml .= '</Media>';
}
$xml .= '<Status>';
$xml .= '<PropertyStatus>Available</PropertyStatus>';
$xml .= '<StatusDate>' . $data_arq . '</StatusDate>';
$xml .= '</Status>';
$xml .= '<Details>';
$xml .= '<PropertyType>' . $property_type . '</PropertyType>';
if ($vet['descricao'])
$xml .= '<Description><![CDATA[' . preg_replace('/(\'|")/', '', nl2br(stripslashes(utf8_encode(utf8_decode($vet['descricao']))))) . ']]></Description>';
if ($vet['finalidade'] == 3)
$xml .= '<RentalPrice currency="BRL">' . $valor . '</RentalPrice>';
else
$xml .= '<ListPrice currency="BRL">' . $valor . '</ListPrice>';
if ($vet['condominio'])
$xml .= '<PropertyAdministrationFee currency="BRL" period="Monthly">' . floor($vet['condominio']) . '</PropertyAdministrationFee>';
if ($vet['area_privativa'])
$xml .= '<ConstructedArea unit="square metres">' . $vet['area_privativa'] . '</ConstructedArea>';
if ($vet['area_terreno'])
$xml .= '<LotArea unit="square metres">' . $vet['area_terreno'] . '</LotArea>';
if ($vet['area_privativa'])
$xml .= '<LivingArea unit="square metres">' . $vet['area_privativa'] . '</LivingArea>';
if ($vet['quartos'])
$xml .= '<Bedrooms>' . $vet['quartos'] . '</Bedrooms>';
if ($vet['banheiros'])
$xml .= '<Bathrooms>' . $vet['banheiros'] . '</Bathrooms>';
if ($vet['suites'])
$xml .= '<Suites>' . $vet['suites'] . '</Suites>';
if ($vet['vagas'])
$xml .= '<Garage type="Garage">' . $vet['vagas'] . '</Garage>';
if ($vet['iptu'])
$xml .= '<YearlyTax currency="BRL">' . $vet['iptu'] . '</YearlyTax>';
$xml .= '</Details>';
$xml .= '<Features>';
if ($vet['interfone'])
$xml .= '<Feature>Intercom</Feature>';
//if($vet['portao_eletrico'])
// $xml .= '<Feature></Feature>';
if ($vet['elevador_social'])
$xml .= '<Feature>Elevator</Feature>';
if ($vet['playground'])
$xml .= '<Feature>Playground</Feature>';
if ($vet['piscina'])
$xml .= '<Feature>Pool</Feature>';
if ($vet['ar_condicionado'])
$xml .= '<Feature>Air Conditioning</Feature>';
if ($vet['quintal'])
$xml .= '<Feature>Backyard</Feature>';
if ($vet['sacada'])
$xml .= '<Feature>Balcony/Terrace</Feature>';
if ($vet['lareira'])
$xml .= '<Feature>Fireplace</Feature>';
if ($vet['mobiliado'])
$xml .= '<Feature>Furnished</Feature>';
if ($vet['deposito'])
$xml .= '<Feature>Storage Room</Feature>';
if ($vet['seguranca_24h'])
$xml .= '<Feature>24 Hour Security</Feature>';
if ($vet['sistema_alarme'])
$xml .= '<Feature>Alarm System</Feature>';
if ($vet['condominio_fechado'])
$xml .= '<Feature>Gated Community</Feature>';
if ($vet['churrasqueira'])
$xml .= '<Feature>BBQ</Feature>';
if ($vet['academia'])
$xml .= '<Feature>Gym</Feature>';
if ($vet['quadra'])
$xml .= '<Feature>Sports Court</Feature>';
if ($vet['jardim'])
$xml .= '<Feature>Garden</Feature>';
if ($vet['espaco_gourmet'])
$xml .= '<Feature>Gourmet Area</Feature>';
if ($vet['salao_festas'])
$xml .= '<Feature>Party Room</Feature>';
$xml .= '</Features>';
$xml .= '<Location>';
$xml .= '<Country abbreviation="BR">Brasil</Country>';
$xml .= '<State abbreviation="' . $uf . '">' . $estado . '</State>';
$endereco = $vet['endereco'];
//if($vet['numero'])
// $endereco .= ' N: '.$vet['numero'];
if ($vet['cidade'])
$xml .= '<City>' . preg_replace("/[^a-zA-Z0-9\s]/", "", $vet['cidade']) . '</City>';
if ($vet['bairro'])
$xml .= '<Neighborhood>' . preg_replace("/[^a-zA-Z0-9\s]/", "", $vet['bairro']) . '</Neighborhood>';
if ($vet['endereco'])
$xml .= '<Address>' . preg_replace("/[^a-zA-Z0-9\s]/", "", $endereco) . '</Address>';
if ($vet['cep'])
$xml .= '<PostalCode>' . $vet['cep'] . '</PostalCode>';
if ($vet['numero'])
$xml .= '<Number>' . $vet['numero'] . '</Number>';
$xml .= '</Location>';
$xml .= '<ContactInfo>';
$xml .= '<Name>' . $nome_contato . '</Name>';
$xml .= '<Email>contato@kasaimoveis.com</Email>';
$xml .= '<Telephone>(27)3225-4798</Telephone>';
$xml .= '<Website>https://www.kasaimoveis.com</Website>';
$xml .= '<Logo>https://www.kasaimoveis.com/logo_kasa.jpg</Logo>';
$xml .= '<OfficeName>' . $empresa . '</OfficeName>';
$xml .= '<Location>';
$xml .= '<Country abbreviation="BR">Brasil</Country>';
$xml .= '<State abbreviation="' . $uf . '">' . utf8_encode($estado) . '</State>';
$xml .= '<City>' . utf8_encode($cidade) . '</City>';
$xml .= '<Address publiclyVisible="true">Grecia, 132, Praia do Canto</Address>';
$xml .= '</Location>';
$xml .= '</ContactInfo>';
$xml .= '</Listing>';
}
$xml .= '</Listings>';
$xml .= '</ListingDataFeed>';
//$caminho_arquivo = 'c:\\Arquivos de programas\\Apache Software Foundation\\Apache2.2\\htdocs\\kasa_imoveis\\adm\\arquivos\\kasa_imoveis.xml';
//$caminho_arquivo = 'home/httpd/vhosts/kasaimoveis.com/httpdocs/adm/arquivos/kasa_vivareal.xml';
$nome_arquivo = 'kasa_vivareal.xml';
$arquivo = fopen('arquivos/' . $nome_arquivo, 'w+');
fwrite($arquivo, $xml);
fclose($arquivo);
$str = "INSERT INTO arquivos_xml (arquivo, tipo, data) VALUES ('$nome_arquivo', '1', CURDATE())";
$rs = mysql_query($str) or die(mysql_error());
msg("Arquivo XML gerado com sucesso");
redireciona("dashboard.php");
}
$strA = "SELECT * FROM arquivos_xml ORDER BY codigo DESC LIMIT 1";
$rsA = mysql_query($strA) or die(mysql_error());
$vetA = mysql_fetch_array($rsA);
$arquivo_xml = $vetA['arquivo'];
if ($_GET['ind'] == 2)
$ind = 2;
else
$ind = 1;
?>
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<title>Kasa Imóveis - Sistema de gestão de conteúdo</title>
<meta name="description" content="">
<!-- Google Font and style definitions -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Sans:regular,bold">
<link rel="stylesheet" href="css/style.css">
<!-- include the skins (change to dark if you like) -->
<link rel="stylesheet" href="css/light/theme.css" id="themestyle">
<!-- <link rel="stylesheet" href="css/dark/theme.css" class="theme"> -->
<!--[if lt IE 9]>
<script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<link rel="stylesheet" href="css/ie.css">
<![endif]-->
<!-- Apple iOS and Android stuff -->
<meta name="apple-mobile-web-app-capable" content="no">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png">
<!-- Apple iOS and Android stuff - don't remove! -->
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no,maximum-scale=1">
<!-- Use Google CDN for jQuery and jQuery UI -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js"></script>
<!-- Loading JS Files this way is not recommended! Merge them but keep their order -->
<!-- some basic functions -->
<script src="js/functions.js"></script>
<!-- all Third Party Plugins -->
<script src="js/plugins.js"></script>
<script src="js/editor.js"></script>
<script src="js/calendar.js"></script>
<script src="js/flot.js"></script>
<script src="js/elfinder.js"></script>
<script src="js/datatables.js"></script>
<!-- all Whitelabel Plugins -->
<script src="js/wl_Alert.js"></script>
<script src="js/wl_Autocomplete.js"></script>
<script src="js/wl_Breadcrumb.js"></script>
<script src="js/wl_Calendar.js"></script>
<script src="js/wl_Chart.js"></script>
<script src="js/wl_Color.js"></script>
<script src="js/wl_Date.js"></script>
<script src="js/wl_Editor.js"></script>
<script src="js/wl_File.js"></script>
<script src="js/wl_Dialog.js"></script>
<script src="js/wl_Fileexplorer.js"></script>
<script src="js/wl_Form.js"></script>
<script src="js/wl_Gallery.js"></script>
<script src="js/wl_Number.js"></script>
<script src="js/wl_Password.js"></script>
<script src="js/wl_Slider.js"></script>
<script src="js/wl_Store.js"></script>
<script src="js/wl_Time.js"></script>
<script src="js/wl_Valid.js"></script>
<script src="js/wl_Widget.js"></script>
<!-- configuration to overwrite settings -->
<script src="js/config.js"></script>
<!-- the script which handles all the access to plugins etc... -->
<script src="js/script.js"></script>
<script language="javascript" src="../js/scripts.js"></script>
</head>
<body>
<div id="pageoptions">
<ul>
<li><a href="#" id="wl_config">Precisando de ajuda ou detectou alguma falha?</a></li>
</ul>
<div>
<h3>Precisando de ajuda ou detectou alguma falha?</h3>
<p>Por favor entre em contato pelo e-mail: tamaninigabriel@gmail.com ou pelo telefone 27 999714581.</p>
</div>
</div>
<header>
<div style="margin:15px;" class="imprimir">
<h2>Kasa Imóveis - Sistema de gestão de conteúdo</h2>
</div>
<div id="header">
<ul id="headernav">
<li>
<ul>
<li><a href="logoff.php">Sair do Sistema</a></li>
<li><a href="https://www.kasaimoveis.com" target="_blank">Site Kasa Imóveis</a></li>
</ul>
</li>
</ul>
</div>
</header>
Zerion Mini Shell 1.0