Файл: public_html/init/catload2.php
Строк: 267
<?php
session_start();
error_reporting(0);
require('../classes/config.php');
include "../inc/db.php";
include "../inc/produkt.php";
$db = new db();
function pages($gesamt, $pages, $link)
{
$anhang = '';
$seite = '';
$x = $gesamt - 1;
$y = $pages - 4;
$z = $pages + 4;
for ($i = 1; $i <= $gesamt; $i++)
{
if ($i <= 1 || $i > $x || $i >= $y && $i <= $z)
{
if(empty($_POST['page'])){
if($i == 1){
$seite .= $anhang . '<a href="javascript:void();" onclick="pagenext(''.$i.'')"><div style="float:left; width:35px;"><div style="float:left; background:#f2f2f2 url(tpl/img/bgr.png); color:#fff; padding:4px 7px; border-radius:3px;" align="center"><b>' . $i . '</b></div></div></a>';
}else{
$seite .= $anhang . '<a href="javascript:void();" onclick="pagenext(''.$i.'')"><div style="float:left; width:35px;"><div style="float:left; background:#f2f2f2; color:#666; padding:4px 7px; border-radius:3px;" align="center"><b>' . $i . '</b></div></div></a>';
}
}
elseif($i == $_POST['page']){
$seite .= $anhang . '<a href="javascript:void();" onclick="pagenext(''.$i.'')"><div style="float:left; width:35px;"><div style="float:left; background:#f2f2f2 url(tpl/img/bgr.png); color:#fff; padding:4px 7px; border-radius:3px;" align="center"><b>' . $i . '</b></div></div></a>';
}else{
$seite .= $anhang . '<a href="javascript:void();" onclick="pagenext(''.$i.'')"><div style="float:left; width:35px;"><div style="float:left; background:#f2f2f2; color:#666; padding:4px 7px; border-radius:3px;" align="center"><b>' . $i . '</b></div></div></a>';
}
$anhang = '';
}
else
{
$anhang = '<div style="float:left; width:35px; padding-top:10px;" align="center">...</div>';
}
}
return $seite;
}
function getZahlPage($art, $kate){
global $db;
if($_POST['sortbe']){ $where = 'and anzeigeart = "'.$_POST['sortbe'].'"'; }
$getRow = $db->query('SELECT id FROM produkte WHERE '.htmlspecialchars($_POST['db1']).' = "'.$_POST['db'].'" '.$where.' ');
$getNow = mysql_num_rows($getRow);
$getEnd = $getNow/20;
return ceil($getEnd);
}
function pagenat(){
$link = 'javascript:void();" onclick="pageset(';
$pages_num = getZahlPage('null', 'kategorie');
$page = (isset($_POST['page'])) ? max($_POST['page'], 1) : 1;
$pages = ($pages_num > 1) ? pages($pages_num, $page, $link) : '';
echo $pages;
}
?>
<script>
function pagenext(p){
jQuery.post('init/catload2.php', {
page : p,
db : '<?php echo $_POST['db']; ?>',
db1 : '<?php echo $_POST['db1']; ?>'
},function(r){
jQuery('.loadCompoments').html(r);
location.href= '#';
});
}
</script>
<?php
function htmlspecial2($i){ $a = strip_tags(utf8_encode(substr($i, 0, 100))); $a = str_replace('<', '', $a); $a = str_replace('b>', '', $a); return utf8_decode($a); }
if(!empty($_POST['sortbe'])){
if($_POST['sortbe'] == 3){
$sortin = 'and anzeigeart = "2"';
}else{
$sortin = 'and produkte.anzeigeart2 = "'.$_POST['sortbe'].'"';
}
}
if(empty($_POST['db']) || empty($_POST['db1'])){
if(!empty($_POST['id2'])){
$ad = 'unterkategorie';
$idr = $_POST['id2'];
}else{
$ad = 'kategorie';
$idr = $_POST['id'];
}
}else{
$ad = $_POST['db1'];
$idr = $_POST['db'];
$_POST['id'] = 1;
}
if($_POST['id'] == 0){
$where = 'kategorie != 0';
}else{
if($_POST['db'] == 'all'){
$where = ''.$ad.' = "'.$idr.'"';
}else{
$where = ''.$ad.' = "'.$idr.'"';
}
}
if(empty($_POST['page']) or $_POST['page'] == 1){ $limit = '20'; }else{
$limit = $_POST['page']*20-20;
$limit = $limit . ', 20';
}
if(empty($_POST['suche'])){
$w_suche = '';
}else{
$w_suche = 'AND titel LIKE "%'.htmlspecialchars($_POST['suche']).'%"';
}
if(empty($_POST['room'])){
$w_room = '';
}else{
$w_room = 'AND i_zimmer >= "'.$_POST['room'].'"';
}
if(empty($_POST['flache'])){
$w_flache = '';
}else{
$w_flache = 'AND i_flache >= "'.$_POST['flache'].'"';
}
if(empty($_POST['pricestart'])){
$w_sprice = '';
}else{
$w_sprice = 'AND preis >= "'.$_POST['pricestart'].'"';
}
if(empty($_POST['price'])){
$w_price = '';
}else{
$w_price = 'AND preis <= "'.$_POST['price'].'"';
}
if(!empty($_POST['zulassung'])){
$zulassung = 'AND a_zulassung <= "'.intval($_POST['zulassung']).'"';
}else{
$zulassung = '';
}
if(!empty($_POST['kilometer'])){
$kilometer = 'AND a_kilometer >= "'.$_POST['kilometer'].'"';
}else{
$kilometer = '';
}
if(!empty($_POST['kraftstoff'])){
$kraftstoff = 'AND a_kraftstoff LIKE "%'.$_POST['kraftstoff'].'%"';
}else{
$kraftstoff = '';
}
if(!empty($_POST['id3'])){
$idset3 = 'AND unterkategorie2 = "'.intval($_POST['id3']).'"';
}else{
$idset3 = '';
}
//
if($_POST['sucheWo'] != ''){
if($_POST['umkreis'] != 0){
$sucheplz = htmlspecialchars($_POST['sucheWo']);
if(is_numeric($sucheplz)){
$_bon = 'geo_plz';
}else{
$_bon = 'geo_ort';
}
$umkreis = intval($_POST['umkreis']);
// Erdradius
$radius = 3959;
//->Suche->latundLon
$_dbSQL = mysql_query("SELECT geo_lg AS lon, geo_plz, geo_bg AS lat FROM geo WHERE ".htmlspecialchars($_bon)." = '".$sucheplz."' ");
$_dbRad = mysql_fetch_object($_dbSQL);
@mysql_free_result($_dbSQL);
$lon = $_dbRad->lon / 180 * M_PI;
$lat = $_dbRad->lat / 180 * M_PI;
//
$query_boot = "SELECT geo_plz AS plz, (
".$radius." * SQRT(2*(1-cos(RADIANS(geo_bg)) *
cos(".$lat.") * (sin(RADIANS(geo_lg)) *
sin(".$lon.") + cos(RADIANS(geo_lg)) *
cos(".$lon.")) - sin(RADIANS(geo_bg)) * sin(".$lat.")))) AS Distance
FROM geo WHERE
".$radius." * SQRT(2*(1-cos(RADIANS(geo_bg)) *
cos(".$lat.") * (sin(RADIANS(geo_lg)) *
sin(".$lon.") + cos(RADIANS(geo_lg)) *
cos(".$lon.")) - sin(RADIANS(geo_bg)) * sin(".$lat."))) <= ".$umkreis."
ORDER BY Distance
";
$_row = mysql_query($query_boot);
while( $_bing = mysql_fetch_assoc($_row) ){
$dataPackageString[] = $_bing['plz'];
}
$dataPush = join(',', $dataPackageString);
$dataPusher = str_replace(',', '|', $dataPush);
$myplz = $_dbRad->geo_plz;
$where1 = "and postleitzahl REGEXP '$dataPusher|$myplz'";
}
else
{
$where1 = 'and ( stadt LIKE "%'.$_POST['sucheWo'].'%" OR postleitzahl = "'.$_POST['sucheWo'].'")';
}
}
//
$artikel = $db->query('
SELECT Sub.* FROM
(
SELECT *
FROM produkte
WHERE '.$where.' AND statuscode = "1" '.$w_suche.'
'.$w_room.' '.$w_flache.' '.$w_price.' '.$w_sprice.' '.$where1.'
'.$zulassung.' '.$kilometer.' '.$kraftstoff.' '.$idset3.' '.$sortin.'
ORDER by postleitzahl, erstellung DESC
) AS Sub
ORDER BY Sub.ad_highlight_time, id DESC
LIMIT ' . $limit . '
');
$check = mysql_num_rows($artikel);
if($check == 0){
?>
<div style="float:left; clear:both; width:100%; padding:20px;" class="mobile">
<div style="float:left; border:1px solid #ff8300; background:#fff; padding:10px; width:100%;" class="mobile">
<div style="float:left; font-size:14px; color:#ff8300;"><b>Keine Anzeigen in der Kategorie vorhanden!</b></div>
<div style="float:left; clear:both; padding-top:10px;">
Erstelle jetzt kostenlos eine Anzeige in dieser Kategorie.
</div>
</div>
</div>
<?php
}
else{
?>
<style type="text/css">.trun{white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}</style>
<?php
while($a = $db->fetch_assoc($artikel)){
if($_SESSION['mobile']){
?>
<div style="float:left; width:100%; clear:both; border-bottom:1px solid #eee;" class="mobile" onclick="location.href='{function="createseo($value.titel)"}-ID{$value.id}'">
<div style="float:left; width:100px; height:100px; background:url(tpl/upload/<?php print $a["bild"]; ?>-160.jpg); background-size:100% auto;"></div>
<div style="float:left; padding-left:20px; width:60%;" class="mobile">
<div style="float:left; width:100%; padding-top:15px; color:#666; font-size:11px; font-weight:bold;">
<?php print $a["postleitzahl"]; ?>
<?php
$m = $db->query('SELECT geo_ort FROM geo WHERE geo_plz = "'.$a["postleitzahl"].'" LIMIT 1');
while($m1 = $db->fetch_assoc($m)){
echo $m1['geo_ort'];
}
?>
</div>
<div style="float:left; clear:both; width:100%; font-size:13px;"><?php print wrapy($a["titel"],24); ?></div>
<div style="float:left; clear:both; padding-top:10px; width:100%; font-weight:bold; color:{$headercolor}; font-size:13px;">
<?php print number_format($a["preis"],0,',','.'); ?> EUR <?php if($a["preisart"] == 1){ print 'Festpreis'; }elseif($a["preisart"] == 2){ print 'VB'; }else{ print 'Zu verschenken'; } ?>
</div>
</div>
<div style="position:absolute; right:0;">
<?php if($a["ad_highlight_time"] == ''){ }else{ ?><div style="float:right;"><img src="tpl/img/_/top.png" /></div><?php } ?>
</div>
</div>
<?php
}else{
?>
<div class="cat1 anzeigeHoverShow" id="<?php echo $a['id']; ?>" onclick="location.href='<?php echo createseo($a["titel"]); ?>-ID<?php print $a["id"]; ?>'" style="padding:0; <?php if($a["topanzeige"] == 1){ ?>background:#fff4ce;<?php } ?> width:775px; font-family:Open Sans;">
<div style="float:left;">
<div style="float:left; border:1px solid #eee; border-top:0; border-bottom:0; border-left:0; padding:4px; padding-left:0; background:#fff;">
<div style="float:left; background:url(tpl/upload/<?php print $a["bild"]; ?>-160.jpg) #fff no-repeat center; width:160px; height:160px;"></div>
</div>
</div>
<div style="float:left; padding-left:20px; width:310px; padding-top:15px;">
<div style="float:left; font-size:16px; width:310px;" class="trun titel_<?php echo $a['id']; ?>"><b><a href="<?php echo createseo($a["titel"]); ?>-ID<?php print $a["id"]; ?>" style="color:#444;"><?php print wrapy($a["titel"],24); ?></a></b></div>
<div style="float:left; clear:both; padding-top:5px; font-size:13px; color:#666;"><?php print htmlspecial2(wrapy($a["beschreibung"],25)); ?>
</div>
<div style="float:left; clear:both; padding-top:20px; font-family:Open Sans; color:#666;">
<?php if($a['i_flache']){ ?>
<div style="float:left; padding-right:10px;">
<div style="float:left; background:#eee; padding:4px 10px; border-radius:3px;"><b><?php echo $a['i_flache']; ?>m²</b></div>
</div>
<?php } ?>
<?php if($a['i_zimmer']){ ?>
<div style="float:left; padding-right:10px;">
<div style="float:left; background:#eee; padding:4px 10px; border-radius:3px;"><b><?php echo $a['i_zimmer']; ?> Zimmer</b></div>
</div>
<?php } ?>
<?php if($a['a_kilometer']){ ?>
<div style="float:left; padding-right:10px; padding-bottom:5px;">
<div style="float:left; background:#eee; padding:4px 10px; border-radius:3px;"><b><?php echo number_format($a['a_kilometer'],0,',','.'); ?> Kilometer</b></div>
</div>
<?php } ?>
<?php if($a['a_ps']){ ?>
<div style="float:left; padding-right:10px; padding-bottom:5px;">
<div style="float:left; background:#eee; padding:4px 10px; border-radius:3px;"><b><?php echo $a['a_kw']; ?>KW/<?php echo $a['a_ps']; ?>PS</b></div>
</div>
<?php } ?>
<?php if($a['a_kraftstoff']){ ?>
<div style="float:left; padding-right:10px; padding-bottom:5px;">
<div style="float:left; background:#eee; padding:4px 10px; border-radius:3px;"><b><?php echo $a['a_kraftstoff']; ?></b></div>
</div>
<?php } ?>
</div>
</div>
<div style="float:left; font-weight:bold; color:#ff8300; width:120px; padding-top:15px;" align="center">
<div style="float:left; clear:both; width:120px;" align="center">
<?php print number_format($a["preis"],0,',','.'); ?> EUR<br /><?php if($a["preisart"] == 1){ print 'Festpreis'; }elseif($a["preisart"] == 2){ print 'VB'; }else{ print 'Zu verschenken'; } ?>
</div>
<?php if($a["accpaypal"] == 2){ ?>
<div style="float:left; clear:both; width:120px;" align="center">
<img src="tpl/img/_/PayPal_rgb_60x60.png" />
</div>
<?php } ?>
</div>
<div style="float:left; width:50px; padding-top:15px; font-size:13px;">
<?php print $a["postleitzahl"]; ?>
<br />
<?php
$m = $db->query('SELECT geo_ort FROM geo WHERE geo_plz = "'.$a["postleitzahl"].'" LIMIT 1');
while($m1 = $db->fetch_assoc($m)){
echo $m1['geo_ort'];
}
?>
</div>
<?php if($a["ad_highlight_time"] == ''){ ?>
<div style="float:right; padding:15px; font-size:13px;" align="right">
<?php print timeline($a["erstellung"]); ?>
</div>
<?php }else{ ?>
<div style="float:right;">
<img src="tpl/img/_/top.png" />
</div>
<?php } ?>
</div>
<?php
}
}
?>
<script>
jQuery('.anzeigeHoverShow').hover(function(e) {
var id = jQuery(this).attr('id');
//titel
jQuery('.titel_'+id).toggleClass('trun', 200, "easeOutSine");
},function(e){
var id = jQuery(this).attr('id');
jQuery('.titel_'+id).toggleClass('trun', 200, "easeOutSine");
});
</script>
<?php
}
?><div style="float:left; clear:both; padding-top:10px;"><?php
echo pagenat();
?></div>